Skip to content

Commit

Permalink
Merge branch 'master' into pramodk/docs-likwid
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodk authored Jul 15, 2024
2 parents 33c73aa + 2ace814 commit f3de077
Show file tree
Hide file tree
Showing 26 changed files with 2,274 additions and 2,256 deletions.
1,140 changes: 576 additions & 564 deletions src/ivoc/graph.cpp

Large diffs are not rendered by default.

150 changes: 75 additions & 75 deletions src/ivoc/grglyph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,31 @@ class GrGlyph: public Resource {
double gr_addglyph(void* v) {
TRY_GUI_REDIRECT_ACTUAL_DOUBLE("Graph.addglyph", v);
#if HAVE_IV
IFGUI
Graph* g = (Graph*) v;
Object* obj = *hoc_objgetarg(1);
check_obj_type(obj, "Glyph");
GrGlyph* gl = (GrGlyph*) (obj->u.this_pointer);
Coord x = *getarg(2);
Coord y = *getarg(3);
Coord sx = ifarg(4) ? *getarg(4) : 1.;
Coord sy = ifarg(5) ? *getarg(5) : 1.;
Coord rot = ifarg(6) ? *getarg(6) : 0.;
int fix = ifarg(7) ? int(chkarg(7, 0, 2)) : 0;
GrGlyphItem* ggi = new GrGlyphItem(gl, sx, sy, rot);
switch (fix) {
case 0:
g->append(ggi);
break;
case 1:
g->append_fixed(ggi);
break;
case 2:
g->append_viewfixed(ggi);
break;
if (hoc_usegui) {
Graph* g = (Graph*) v;
Object* obj = *hoc_objgetarg(1);
check_obj_type(obj, "Glyph");
GrGlyph* gl = (GrGlyph*) (obj->u.this_pointer);
Coord x = *getarg(2);
Coord y = *getarg(3);
Coord sx = ifarg(4) ? *getarg(4) : 1.;
Coord sy = ifarg(5) ? *getarg(5) : 1.;
Coord rot = ifarg(6) ? *getarg(6) : 0.;
int fix = ifarg(7) ? int(chkarg(7, 0, 2)) : 0;
GrGlyphItem* ggi = new GrGlyphItem(gl, sx, sy, rot);
switch (fix) {
case 0:
g->append(ggi);
break;
case 1:
g->append_fixed(ggi);
break;
case 2:
g->append_viewfixed(ggi);
break;
}
g->move(g->count() - 1, x, y);
}
g->move(g->count() - 1, x, y);
ENDGUI
#endif
return 0.;
}
Expand All @@ -62,9 +62,9 @@ static Object** g_new_path(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.path", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
g->new_path();
ENDGUI
if (hoc_usegui) {
g->new_path();
}
#endif
return g->temp_objvar();
}
Expand All @@ -73,9 +73,9 @@ static Object** g_move_to(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.m", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
g->move_to(*getarg(1), *getarg(2));
ENDGUI
if (hoc_usegui) {
g->move_to(*getarg(1), *getarg(2));
}
#endif
return g->temp_objvar();
}
Expand All @@ -84,9 +84,9 @@ static Object** g_line_to(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.l", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
g->line_to(*getarg(1), *getarg(2));
ENDGUI
if (hoc_usegui) {
g->line_to(*getarg(1), *getarg(2));
}
#endif
return g->temp_objvar();
}
Expand All @@ -95,9 +95,9 @@ static Object** g_control_point(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.cpt", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
g->control_point(*getarg(1), *getarg(2));
ENDGUI
if (hoc_usegui) {
g->control_point(*getarg(1), *getarg(2));
}
#endif
return g->temp_objvar();
}
Expand All @@ -106,9 +106,9 @@ static Object** g_curve_to(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.curve", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
g->curve_to(*getarg(1), *getarg(2), *getarg(3), *getarg(4), *getarg(5), *getarg(6));
ENDGUI
if (hoc_usegui) {
g->curve_to(*getarg(1), *getarg(2), *getarg(3), *getarg(4), *getarg(5), *getarg(6));
}
#endif
return g->temp_objvar();
}
Expand All @@ -117,11 +117,11 @@ static Object** g_stroke(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.s", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
int ci = ifarg(1) ? int(chkarg(1, 0, 10000)) : 1;
int bi = ifarg(2) ? int(chkarg(2, 0, 10000)) : 0;
g->stroke(ci, bi);
ENDGUI
if (hoc_usegui) {
int ci = ifarg(1) ? int(chkarg(1, 0, 10000)) : 1;
int bi = ifarg(2) ? int(chkarg(2, 0, 10000)) : 0;
g->stroke(ci, bi);
}
#endif
return g->temp_objvar();
}
Expand All @@ -130,9 +130,9 @@ static Object** g_close_path(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.close", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
g->close_path();
ENDGUI
if (hoc_usegui) {
g->close_path();
}
#endif
return g->temp_objvar();
}
Expand All @@ -141,10 +141,10 @@ static Object** g_fill(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.fill", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
int ci = ifarg(1) ? int(chkarg(1, 0, 10000)) : 1;
g->fill(ci);
ENDGUI
if (hoc_usegui) {
int ci = ifarg(1) ? int(chkarg(1, 0, 10000)) : 1;
g->fill(ci);
}
#endif
return g->temp_objvar();
}
Expand All @@ -153,9 +153,9 @@ static Object** g_erase(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.erase", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
g->erase();
ENDGUI
if (hoc_usegui) {
g->erase();
}
#endif
return g->temp_objvar();
}
Expand All @@ -164,9 +164,9 @@ static Object** g_circle(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.circle", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
g->circle(*getarg(1), *getarg(2), *getarg(3));
ENDGUI
if (hoc_usegui) {
g->circle(*getarg(1), *getarg(2), *getarg(3));
}
#endif
return g->temp_objvar();
}
Expand All @@ -175,9 +175,9 @@ static Object** g_gif(void* v) {
TRY_GUI_REDIRECT_ACTUAL_OBJ("Glyph.gif", v);
GrGlyph* g = (GrGlyph*) v;
#if HAVE_IV
IFGUI
g->gif(gargstr(1));
ENDGUI
if (hoc_usegui) {
g->gif(gargstr(1));
}
#endif
return g->temp_objvar();
}
Expand Down Expand Up @@ -220,26 +220,26 @@ void GrGlyph_reg() {
GrGlyph::GrGlyph(Object* o) {
obj_ = o;
#if HAVE_IV
IFGUI
type_ = new DataVec(10);
x_ = new DataVec(10);
y_ = new DataVec(10);
type_->ref();
x_->ref();
y_->ref();
gif_ = NULL;
ENDGUI
if (hoc_usegui) {
type_ = new DataVec(10);
x_ = new DataVec(10);
y_ = new DataVec(10);
type_->ref();
x_->ref();
y_->ref();
gif_ = NULL;
}
#endif
}

GrGlyph::~GrGlyph() {
#if HAVE_IV
IFGUI
type_->unref();
x_->unref();
y_->unref();
Resource::unref(gif_);
ENDGUI
if (hoc_usegui) {
type_->unref();
x_->unref();
y_->unref();
Resource::unref(gif_);
}
#endif
}

Expand Down
54 changes: 27 additions & 27 deletions src/ivoc/ivoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@ void nrniv_bind_thread() {

void nrn_err_dialog(const char* mes) {
#if HAVE_IV
IFGUI
if (nrn_err_dialog_active_ && !Session::instance()->done()) {
char m[1024];
Sprintf(m, "%s (See terminal window)", mes);
continue_dialog(m);
if (hoc_usegui) {
if (nrn_err_dialog_active_ && !Session::instance()->done()) {
char m[1024];
Sprintf(m, "%s (See terminal window)", mes);
continue_dialog(m);
}
}
ENDGUI
#endif
}

Expand Down Expand Up @@ -239,12 +239,12 @@ bool setAcceptInputCallback(bool b) {

void ivoc_style() {
TRY_GUI_REDIRECT_DOUBLE("ivoc_style", NULL);
IFGUI
if (Session::instance()) {
Style* s = Session::instance()->style();
s->remove_attribute(gargstr(1));
s->attribute(gargstr(1), gargstr(2), -5);
}
if (hoc_usegui) {
if (Session::instance()) {
Style* s = Session::instance()->style();
s->remove_attribute(gargstr(1));
s->attribute(gargstr(1), gargstr(2), -5);
}
#if 0
String s;
if (WidgetKit::instance()->style()->find_attribute(gargstr(1)+1, s)) {
Expand All @@ -253,7 +253,7 @@ if (WidgetKit::instance()->style()->find_attribute(gargstr(1)+1, s)) {
printf("couldn't find %s\n", gargstr(1));
}
#endif
ENDGUI
}
hoc_ret();
hoc_pushx(1.);
}
Expand Down Expand Up @@ -487,22 +487,22 @@ extern void nrniv_bind_call(void);
#endif

void hoc_notify_iv() {
IFGUI
if (hoc_usegui) {
#ifdef MINGW
if (!nrn_is_gui_thread()) {
// allow gui thread to run
nrnpy_pass();
hoc_pushx(0.);
hoc_ret();
return;
}
nrniv_bind_call();
if (!nrn_is_gui_thread()) {
// allow gui thread to run
nrnpy_pass();
hoc_pushx(0.);
hoc_ret();
return;
}
nrniv_bind_call();
#endif
Resource::flush();
Oc oc;
oc.notify();
single_event_run();
ENDGUI
Resource::flush();
Oc oc;
oc.notify();
single_event_run();
}
hoc_pushx(1.);
hoc_ret();
}
Expand Down
Loading

0 comments on commit f3de077

Please sign in to comment.