NEURON
nrnmenu.cpp
Go to the documentation of this file.
1 
2 #include <../../nrnconf.h>
3 
4 #include <stdio.h>
5 #include <string.h>
6 #include <OS/string.h>
7 #include <ivstream.h>
8 
9 #if HAVE_IV
10 #include "secbrows.h"
11 #include "ivoc.h"
12 #endif
13 #include "nrnoc2iv.h"
14 #include "nrnmenu.h"
15 #include "classreg.h"
16 #include "gui-redirect.h"
17 extern Object** (*nrnpy_gui_helper_)(const char* name, Object* obj);
18 extern double (*nrnpy_object_to_double_)(Object*);
19 
20 
21 typedef void (*ReceiveFunc)(Point_process*, double*, double);
22 extern int hoc_return_type_code;
23 // from nrnoc
24 #include "membfunc.h"
25 #include "parse.hpp"
27 extern Symbol** pointsym;
28 extern double* point_process_pointer(Point_process*, Symbol*, int);
29 extern "C" Point_process* ob2pntproc(Object*);
30 extern ReceiveFunc* pnt_receive;
31 extern int nrn_has_net_event_cnt_;
32 extern int* nrn_has_net_event_;
33 extern short* nrn_is_artificial_;
34 extern int node_index(Section*, double);
35 extern char* pnt_map;
36 extern void nrn_parent_info(Section*);
37 
38 // to nrnoc
39 void nrnallsectionmenu();
40 void nrnallpointmenu();
41 void nrnsecmenu();
42 void nrnglobalmechmenu();
43 void nrnmechmenu();
44 void nrnpointmenu();
45 
46 Object* (*nrnpy_callable_with_args)(Object*, int narg);
48 
49 
50 #if HAVE_IV
51 static void pnodemenu(Prop* p1, double, int type, const char* path, MechSelector* = NULL);
52 static void mech_menu(Prop* p1, double, int type, const char* path, MechSelector* = NULL);
53 static void point_menu(Object*, int);
54 #endif
55 
57  TRY_GUI_REDIRECT_DOUBLE("nrnallsectionmenu", NULL);
58 
59 #if HAVE_IV
60  IFGUI
62  ENDGUI
63 #endif
64 
65  hoc_retpushx(1.);
66 }
67 
68 void nrnsecmenu() {
69  TRY_GUI_REDIRECT_DOUBLE("nrnsecmenu", NULL);
70 #if HAVE_IV
71  IFGUI
72  double x;
73  Section* sec = NULL;
74  if (hoc_is_object_arg(1)) { // x = -1 not allowed
75  nrn_seg_or_x_arg(1, &sec, &x);
77  } else {
78  x = chkarg(1, -1., 1.);
79  }
80  section_menu(x, (int) chkarg(2, 1., 3.));
81  if (sec) {
82  nrn_popsec();
83  }
84  ENDGUI
85 #endif
86  hoc_retpushx(1.);
87 }
88 
89 #ifdef ultrix
90 char* strstr(const char*, const char*);
91 #endif
92 
93 static bool has_globals(const char* name) {
94  Symbol* sp;
95  char suffix[100];
96  sprintf(suffix, "_%s", name);
97  for (sp = hoc_built_in_symlist->first; sp; sp = sp->next) {
98  if (sp->type == VAR && sp->subtype == USERDOUBLE && strstr(sp->name, suffix)) {
99  return true;
100  }
101  }
102  return false;
103 }
104 
106  TRY_GUI_REDIRECT_DOUBLE("nrnglobalmechmenu", NULL);
107 #if HAVE_IV
108  IFGUI
109  Symbol* sp;
110  char* s;
111  char buf[200];
112  char suffix[100];
113  if (!ifarg(1)) {
114  hoc_ivmenu("Mechanisms (Globals)");
115  for (sp = hoc_built_in_symlist->first; sp; sp = sp->next) {
116  if (sp->type == MECHANISM && sp->subtype != MORPHOLOGY && has_globals(sp->name)) {
117  sprintf(buf, "nrnglobalmechmenu(\"%s\")", sp->name);
118  hoc_ivbutton(sp->name, buf);
119  }
120  }
121  hoc_ivmenu(0);
122  hoc_retpushx(1.);
123  return;
124  }
125  char* name = gargstr(1);
126  sprintf(suffix, "_%s", name);
127  if (ifarg(2) && *getarg(2) == 0.) {
128  int cnt = 0;
129  for (sp = hoc_built_in_symlist->first; sp; sp = sp->next) {
130  if (sp->type == VAR && sp->subtype == USERDOUBLE &&
131  (s = strstr(sp->name, suffix)) != 0 && s[strlen(suffix)] == '\0') {
132  ++cnt;
133  }
134  }
135  hoc_retpushx(double(cnt));
136  return;
137  }
138  sprintf(buf, "%s (Globals)", name);
139  hoc_ivpanel(buf);
140  for (sp = hoc_built_in_symlist->first; sp; sp = sp->next) {
141  if (sp->type == VAR && sp->subtype == USERDOUBLE && (s = strstr(sp->name, suffix)) != 0 &&
142  s[strlen(suffix)] == '\0') {
143  if (ISARRAY(sp)) {
144  char n[50];
145  int i;
146  Arrayinfo* a = sp->arayinfo;
147  for (i = 0; i < a->sub[0]; i++) {
148  if (i > 5)
149  break;
150  sprintf(buf, "%s[%d]", sp->name, i);
151  sprintf(n, "%s[%d]", sp->name, i);
152  hoc_ivpvalue(n, hoc_val_pointer(buf), false, sp->extra);
153  }
154  } else {
155  hoc_ivvalue(sp->name, sp->name, 1);
156  }
157  }
158  }
159  hoc_ivpanelmap();
160  ENDGUI
161 #endif
162  hoc_retpushx(1.);
163 }
164 
165 void nrnmechmenu() {
166  hoc_retpushx(1.);
167 }
168 
169 #if HAVE_IV
170 void section_menu(double x1, int type, MechSelector* ms) {
171  char buf[200];
172  const char* name;
173  Section* sec;
174  Prop* p;
175  Node* node;
176  double x;
177  String btype;
178  CopyString sname;
179 
180  switch (type) {
181  case nrnocCONST:
182  btype = "(Parameters)";
183  break;
184  case STATE:
185  btype = "(States)";
186  break;
187  case 2:
188  btype = "(Assigned)";
189  break;
190  }
191 
192  sec = chk_access();
193  name = secname(sec);
194 
195  if (x1 >= 0) {
196  node = node_exact(sec, x1);
197  x = nrn_arc_position(sec, node);
198  sprintf(buf, "%s(%g) %s", name, x, btype.string());
199  } else {
200  sprintf(buf, "%s(0 - 1) %s", name, btype.string());
201  node = sec->pnode[0];
202  x = nrn_arc_position(sec, node);
203  sname = hoc_section_pathname(sec);
204  // printf("returned %s\n", sname.string());
205  }
206  hoc_ivpanel(buf);
207  hoc_ivlabel(buf);
208  if (type == nrnocCONST) {
209  if (x1 < 0) {
210  sprintf(buf, "nseg = %d", sec->nnode - 1);
211  hoc_ivlabel(buf);
212  sprintf(buf, "%s.L", sname.string());
213  if (sec->npt3d) {
214  hoc_ivvaluerun("L", buf, "define_shape()", 1);
215  } else {
216  hoc_ivvalue("L", buf, 1);
217  }
218  sprintf(buf, "%s.Ra += 0", sname.string());
219  hoc_ivpvaluerun("Ra", &sec->prop->dparam[7].val, buf, 1, 0, hoc_var_extra("Ra"));
220  p = sec->prop;
221  if (p->dparam[4].val != 1) {
222  hoc_ivpvaluerun("Rall",
223  &sec->prop->dparam[4].val,
224  "diam_changed = 1",
225  1,
226  0,
227  hoc_var_extra("rallbranch"));
228  }
229  }
230  } else {
231  if (x1 < 0) {
232  sprintf(buf, "%s.%s", sname.string(), "v");
233  hoc_ivvalue("v", buf);
234  } else {
235  sprintf(buf, "v(%g)", x);
236  hoc_ivpvalue("v", hoc_val_pointer(buf), false, hoc_lookup("v")->extra);
237  }
238  }
239 
240  p = node->prop;
241  if (x1 < 0) {
242  pnodemenu(p, x, type, sname.string(), ms);
243  } else {
244  pnodemenu(p, x, type, 0, ms);
245  }
246  hoc_ivpanelmap();
247 }
248 
249 static void pnodemenu(Prop* p1, double x, int type, const char* path, MechSelector* ms) {
250  if (!p1) {
251  return;
252  }
253  pnodemenu(p1->next, x, type, path, ms); /*print in insert order*/
254  if (memb_func[p1->type].is_point) {
255  return;
256  } else {
257  mech_menu(p1, x, type, path, ms);
258  }
259 }
260 #endif
261 
262 #if HAVE_IV
263 static bool nrn_is_const(const char* path, const char* name) {
264  char buf[256];
265  sprintf(buf,
266  "%s for (hoc_ac_) if (hoc_ac_ > 0 && hoc_ac_ < 1) if (%s(hoc_ac_) != %s(.5)) {hoc_ac_ "
267  "= 0 break}\n",
268  path,
269  name,
270  name);
271  Oc oc;
272  oc.run(buf);
273  return (hoc_ac_ != 0.);
274 }
275 #endif
276 
277 #if HAVE_IV
278 static void mech_menu(Prop* p1, double x, int type, const char* path, MechSelector* ms) {
279  Symbol *sym, *vsym;
280  int i, j;
281  char buf[200];
282  bool deflt;
283 
284  if (ms && !ms->is_selected(p1->type)) {
285  return;
286  }
287  if (type == nrnocCONST) {
288  deflt = true;
289  } else {
290  deflt = false;
291  }
292  sym = memb_func[p1->type].sym;
293  if (sym->s_varn) {
294  for (j = 0; j < sym->s_varn; j++) {
295  vsym = sym->u.ppsym[j];
296  if (nrn_vartype(vsym) == type) {
297  if (vsym->type == RANGEVAR) {
298  if (ISARRAY(vsym)) {
299  char n[50];
300  Arrayinfo* a = vsym->arayinfo;
301  for (i = 0; i < a->sub[0]; i++) {
302  if (i > 5)
303  break;
304  sprintf(n, "%s[%d]", vsym->name, i);
305  if (path) {
306  if (nrn_is_const(path, n)) {
307  sprintf(buf, "%s.%s", path, n);
308  hoc_ivvalue(n, buf, deflt);
309  } else {
310  sprintf(buf, "%s is not constant", n);
311  hoc_ivlabel(buf);
312  }
313  } else {
314  sprintf(buf, "%s[%d](%g)", vsym->name, i, x);
316  }
317  }
318  } else {
319  if (path) {
320  if (nrn_is_const(path, vsym->name)) {
321  sprintf(buf, "%s.%s", path, vsym->name);
322  hoc_ivvalue(vsym->name, buf, deflt);
323  } else {
324  sprintf(buf, "%s is not constant", vsym->name);
325  hoc_ivlabel(buf);
326  }
327  } else {
328  sprintf(buf, "%s(%g)", vsym->name, x);
329  if (p1->type == MORPHOLOGY) {
330  Section* sec = chk_access();
331  char buf2[200];
332  sprintf(buf2, "%s.Ra += 0", secname(sec));
334  vsym->name, hoc_val_pointer(buf), buf2, 1, 0, vsym->extra);
335  } else {
337  }
338  }
339  }
340  }
341  }
342  }
343  }
344 }
345 #endif
346 
348  TRY_GUI_REDIRECT_DOUBLE("nrnallpointmenu", NULL);
349 #if HAVE_IV
350  IFGUI
351  int i;
352  double x = n_memb_func - 1;
353  Symbol *sp, *psym;
354  char buf[200];
355  hoc_Item* q;
356 
357  if (!ifarg(1)) {
358  hoc_ivmenu("Point Processes");
359  for (i = 1; (sp = pointsym[i]) != (Symbol*) 0; i++) {
360  sprintf(buf, "nrnallpointmenu(%d)", i);
361  hoc_ivbutton(sp->name, buf);
362  }
363  hoc_ivmenu(0);
364  hoc_retpushx(1.);
365  return;
366  }
367 
368  i = (int) chkarg(1, 0., x);
369  if ((psym = pointsym[i]) != (Symbol*) 0) {
370  hoc_ivpanel(psym->name);
372  assert(sp && sp->type == TEMPLATE);
373 
374  bool locmenu = false;
375  ITERATE(q, sp->u.ctemplate->olist) { // are there any
376  hoc_ivmenu("locations");
377  locmenu = true;
378  break;
379  }
380 
381  bool are_globals = false;
382  char suffix[100];
383  sprintf(suffix, "_%s", sp->name);
384  for (Symbol* stmp = hoc_built_in_symlist->first; stmp; stmp = stmp->next) {
385  if (stmp->type == VAR && stmp->subtype == USERDOUBLE && strstr(stmp->name, suffix)) {
386  are_globals = true;
387  break;
388  }
389  }
390 
391  ITERATE(q, sp->u.ctemplate->olist) {
392  Object* ob = OBJ(q);
393  Point_process* pp = ob2pntproc(ob);
394  if (pp->sec) {
395  sprintf(buf, "nrnpointmenu(%p)", ob);
397  }
398  }
399  if (locmenu) {
400  hoc_ivmenu(0);
401  }
402  if (are_globals) {
403  sprintf(buf, "nrnglobalmechmenu(\"%s\")", psym->name);
404  hoc_ivbutton("Globals", buf);
405  }
406  hoc_ivpanelmap();
407  }
408  ENDGUI
409 #endif
410  hoc_retpushx(1.);
411 }
412 
413 void nrnpointmenu() {
414  TRY_GUI_REDIRECT_DOUBLE("nrnpointmenu", NULL);
415 #if HAVE_IV
416  IFGUI
417  Object* ob;
418  if (hoc_is_object_arg(1)) {
419  ob = *hoc_objgetarg(1);
420  } else {
421  ob = (Object*) ((size_t) (*getarg(1)));
422  }
423  Symbol* sym = hoc_table_lookup(ob->ctemplate->sym->name, ob->ctemplate->symtable);
424  if (!sym || sym->type != MECHANISM || !memb_func[sym->subtype].is_point) {
425  hoc_execerror(ob->ctemplate->sym->name, "not a point process");
426  }
427  int make_label = 1;
428  if (ifarg(2)) {
429  make_label = int(chkarg(2, -1., 1.));
430  }
431  point_menu(ob, make_label);
432  ENDGUI
433 #endif
434  hoc_retpushx(1.);
435 }
436 
437 #if HAVE_IV
438 static void point_menu(Object* ob, int make_label) {
439  Point_process* pp = ob2pntproc(ob);
440  int k, m;
441  Symbol *psym, *vsym;
442  char buf[200];
443  bool deflt;
444 
445  if (pp->sec) {
446  sprintf(buf, "%s at ", hoc_object_name(ob));
447  strcat(buf, sec_and_position(pp->sec, pp->node));
448  } else {
449  sprintf(buf, "%s", hoc_object_name(ob));
450  }
451  hoc_ivpanel(buf);
452 
453 
454  if (make_label == 1) {
455  hoc_ivlabel(buf);
456  } else if (make_label == 0) {
458  } else if (make_label == -1) { // i.e. do neither
459  k = 0;
460  }
461  psym = pointsym[pnt_map[pp->prop->type]];
462 
463 #if 0
464  switch (type) {
465  case nrnocCONST:
466  sprintf(buf, "%s[%d] (Parameters)", psym->name, j);
467  break;
468  case STATE:
469  sprintf(buf, "%s[%d] (States)", psym->name, j);
470  break;
471  case 2:
472  sprintf(buf, "%s[%d] (Assigned)", psym->name, j);
473  break;
474  }
475 #endif
476 
477  if (psym->s_varn) {
478  for (k = 0; k < psym->s_varn; k++) {
479  vsym = psym->u.ppsym[k];
480  if (nrn_vartype(vsym) == nrnocCONST) {
481  deflt = true;
482 
483 #if defined(MikeNeubig)
484  deflt = false;
485 #endif // end of hack
486  } else {
487  deflt = false;
488  }
489  if (ISARRAY(vsym)) {
490  Arrayinfo* a = vsym->arayinfo;
491  for (m = 0; m < vsym->arayinfo->sub[0]; m++) {
492  double* pd;
493  if (m > 5)
494  break;
495  sprintf(buf, "%s[%d]", vsym->name, m);
496  pd = point_process_pointer(pp, vsym, m);
497  if (pd) {
498  hoc_ivpvalue(buf, pd, deflt, vsym->extra);
499  }
500  }
501  } else {
503  }
504  }
505  }
506 
507  hoc_ivpanelmap();
508 }
509 #endif
510 
511 //-----------------------
512 // MechanismStandard
514 
515 static double ms_panel(void* v) {
516  TRY_GUI_REDIRECT_METHOD_ACTUAL_DOUBLE("MechanismStandard.panel", ms_class_sym_, v);
517 #if HAVE_IV
518  IFGUI
519  char* label = NULL;
520  if (ifarg(1)) {
521  label = gargstr(1);
522  }
523  ((MechanismStandard*) v)->panel(label);
524  ENDGUI
525 #endif
526  return 0.;
527 }
528 static double ms_action(void* v) {
529  char* a = 0;
530  Object* pyact = NULL;
531  if (ifarg(1)) {
532  if (hoc_is_str_arg(1)) {
533  a = gargstr(1);
534  } else {
535  pyact = *hoc_objgetarg(1);
536  }
537  }
538  ((MechanismStandard*) v)->action(a, pyact);
539  return 0.;
540 }
541 
542 static double ms_out(void* v) {
544  if (ifarg(1)) {
545  if (hoc_is_double_arg(1)) {
546  double x = chkarg(1, 0, 1);
547  m->out(chk_access(), x);
548  } else {
549  Object* o = *hoc_objgetarg(1);
550  if (is_obj_type(o, "MechanismStandard")) {
551  m->out((MechanismStandard*) o->u.this_pointer);
552  } else if (is_point_process(o)) {
553  m->out(ob2pntproc(o));
554  } else if (nrnpy_ob_is_seg && (*nrnpy_ob_is_seg)(o)) {
555  double x;
556  Section* sec;
557  nrn_seg_or_x_arg(1, &sec, &x);
558  m->out(sec, x);
559  } else {
560  hoc_execerror("Object arg must be MechanismStandard or a Point Process, not",
561  hoc_object_name(o));
562  }
563  }
564  } else {
565  m->out(chk_access());
566  }
567  return 0.;
568 }
569 
570 static double ms_in(void* v) {
572  if (ifarg(1)) {
573  if (hoc_is_double_arg(1)) {
574  double x = chkarg(1, 0, 1);
575  m->in(chk_access(), x);
576  } else {
577  Object* o = *hoc_objgetarg(1);
578  if (is_obj_type(o, "MechanismStandard")) {
579  m->in((MechanismStandard*) o->u.this_pointer);
580  } else if (is_point_process(o)) {
581  m->in(ob2pntproc(o));
582  } else if (nrnpy_ob_is_seg && (*nrnpy_ob_is_seg)(o)) {
583  double x;
584  Section* sec;
585  nrn_seg_or_x_arg(1, &sec, &x);
586  m->in(sec, x);
587  } else {
589  "Object arg must be MechanismStandard or a Point Process or a nrn.Segment, not",
590  hoc_object_name(o));
591  }
592  }
593  } else {
594  m->in(chk_access());
595  }
596  return 0.;
597 }
598 
599 static double ms_set(void* v) {
600  int i = 0;
601  if (ifarg(3)) { // array index
602  i = int(*getarg(3));
603  }
604  ((MechanismStandard*) v)->set(gargstr(1), *getarg(2), i);
605  return 0.;
606 }
607 static double ms_get(void* v) {
608  int i = 0;
609  if (ifarg(2)) { // array index
610  i = int(*getarg(2));
611  }
612  return ((MechanismStandard*) v)->get(gargstr(1), i);
613 }
614 static double ms_count(void* v) {
616  return ((MechanismStandard*) v)->count();
617 }
618 static double ms_name(void* v) {
619  const char* n;
620  int rval = 0;
622  if (ifarg(2)) {
623  n = ms->name((int) chkarg(2, 0, ms->count() - 1), rval);
624  } else {
625  n = ms->name();
626  }
629  return double(rval);
630 }
631 
632 static double ms_save(void* v) {
633 #if HAVE_IV
634  ostream* o = Oc::save_stream;
635  if (o) {
636  ((MechanismStandard*) v)->save(gargstr(1), o);
637  }
638 #endif
639  return 0.;
640 }
641 
642 static void* ms_cons(Object* ob) {
643  int vartype = nrnocCONST;
644  if (ifarg(2)) {
645  // 0 means all
646  vartype = int(chkarg(2, -1, STATE));
647  }
648  MechanismStandard* m = new MechanismStandard(gargstr(1), vartype);
649  m->ref();
650  m->msobj_ = ob;
651  return (void*) m;
652 }
653 
654 static void ms_destruct(void* v) {
656 }
657 
658 static Member_func ms_members[] = {"panel", ms_panel, "action", ms_action, "in", ms_in,
659  "_in", ms_in, "out", ms_out, "set", ms_set,
660  "get", ms_get, "count", ms_count, "name", ms_name,
661  "save", ms_save, 0, 0};
662 
664  class2oc("MechanismStandard", ms_cons, ms_destruct, ms_members, NULL, NULL, NULL);
665  ms_class_sym_ = hoc_lookup("MechanismStandard");
666 }
667 
668 MechanismStandard::MechanismStandard(const char* name, int vartype) {
669  msobj_ = NULL;
670  glosym_ = NULL;
671  np_ = new NrnProperty(name);
672  name_cnt_ = 0;
673  vartype_ = vartype; // vartype=0 means all but not globals, -1 means globals
674  offset_ = 0;
675  if (vartype_ == -1) {
676  char suffix[100];
677  char* s;
678  sprintf(suffix, "_%s", name);
679  Symbol* sp;
680  for (sp = hoc_built_in_symlist->first; sp; sp = sp->next) {
681  if (sp->type == VAR && sp->subtype == USERDOUBLE &&
682  (s = strstr(sp->name, suffix)) != 0 && s[strlen(suffix)] == '\0') {
683  ++name_cnt_;
684  }
685  }
686  glosym_ = new Symbol*[name_cnt_];
687  int i = 0;
688  for (sp = hoc_built_in_symlist->first; sp; sp = sp->next) {
689  if (sp->type == VAR && sp->subtype == USERDOUBLE &&
690  (s = strstr(sp->name, suffix)) != 0 && s[strlen(suffix)] == '\0') {
691  glosym_[i] = sp;
692  ++i;
693  }
694  }
695  } else {
696  for (Symbol* sym = np_->first_var(); np_->more_var(); sym = np_->next_var()) {
697  int type = np_->var_type(sym);
698  if (type < vartype) {
699  ++offset_;
700  } else if (vartype == 0 || type == vartype) {
701  ++name_cnt_;
702  }
703  }
704  }
705  action_ = "";
706  pyact_ = NULL;
707 }
709  if (pyact_) {
711  }
712  if (glosym_) {
713  delete[] glosym_;
714  }
715  delete np_;
716 }
718  return name_cnt_;
719 }
720 const char* MechanismStandard::name() {
721  return np_->name();
722 }
723 const char* MechanismStandard::name(int i, int& size) {
724  Symbol* s;
725  if (vartype_ == -1) {
726  s = glosym_[i];
727  } else {
728  s = np_->var(i + offset_);
729  }
730  size = hoc_total_array_data(s, 0);
731  return s->name;
732 }
733 
734 void MechanismStandard::panel(const char* label) {
735 #if HAVE_IV
736  mschk("panel");
737  char buf[256];
738  int i;
739  Symbol* sym;
740  hoc_ivpanel("MechanismStandard");
741  if (label) {
742  hoc_ivlabel(label);
743  } else {
744  hoc_ivlabel(np_->name());
745  }
746  for (sym = np_->first_var(), i = 0; np_->more_var(); sym = np_->next_var(), ++i) {
747  if (vartype_ == 0 || np_->var_type(sym) == vartype_) {
748  Object* pyactval = NULL;
749  int size = hoc_total_array_data(sym, 0);
750  if (pyact_) {
753  hoc_pushx(double(i));
754  hoc_pushx(0.0);
755  pyactval = (*nrnpy_callable_with_args)(pyact_, 3);
756  } else {
757  sprintf(buf, "hoc_ac_ = %d %s", i, action_.string());
758  }
759  hoc_ivvaluerun_ex(sym->name,
760  NULL,
761  np_->prop_pval(sym),
762  NULL,
763  pyact_ ? NULL : buf,
764  pyactval,
765  true,
766  false,
767  true,
768  sym->extra);
769  if (pyactval) {
770  hoc_obj_unref(pyactval);
771  }
772  int j;
773  for (j = 1; j < size; ++j) {
774  ++i;
775  if (pyact_) {
778  hoc_pushx(double(i));
779  hoc_pushx(double(j));
780  pyactval = (*nrnpy_callable_with_args)(pyact_, 3);
781  } else {
782  sprintf(buf, "hoc_ac_ = %d %s", i, action_.string());
783  }
784  char buf2[200];
785  sprintf(buf2, "%s[%d]", sym->name, j);
786  hoc_ivvaluerun_ex(buf2,
787  NULL,
788  np_->prop_pval(sym, j),
789  NULL,
790  pyact_ ? NULL : buf,
791  pyact_,
792  true,
793  false,
794  true,
795  sym->extra);
796  if (pyactval) {
797  hoc_obj_unref(pyactval);
798  }
799  }
800  }
801  }
802  hoc_ivpanelmap();
803 #endif
804 }
805 void MechanismStandard::action(const char* action, Object* pyact) {
806  mschk("action");
807  action_ = action ? action : "";
808  if (pyact) {
809  pyact_ = pyact;
810  hoc_obj_ref(pyact);
811  }
812 }
813 void MechanismStandard::set(const char* name, double val, int index) {
814  mschk("set");
815  Symbol* s = np_->find(name);
816  if (s) {
817  *np_->prop_pval(s, index) = val;
818  } else {
819  hoc_execerror(name, "not in this property");
820  }
821 }
822 double MechanismStandard::get(const char* name, int index) {
823  mschk("get");
824  Symbol* s = np_->find(name);
825  if (!s) {
826  hoc_execerror(name, "not in this property");
827  }
828  double* pval = np_->prop_pval(s, index);
829  if (!pval) {
830  return -1e300;
831  }
832  return *pval;
833 }
834 
836  mschk("in");
837  int i = 0;
838  if (x >= 0) {
839  i = node_index(sec, x);
840  }
841  Prop* p = nrn_mechanism(np_->type(), sec->pnode[i]);
843 }
845  mschk("in");
847 }
849  mschk("in");
850  NrnProperty::assign(ms->np_->prop(), np_->prop(), vartype_);
851 }
852 
854  mschk("out");
855  if (x < 0) {
856  for (int i = 0; i < sec->nnode; ++i) {
857  Prop* p = nrn_mechanism(np_->type(), sec->pnode[i]);
859  }
860  } else {
861  int i = node_index(sec, x);
862  Prop* p = nrn_mechanism(np_->type(), sec->pnode[i]);
864  }
865 }
867  mschk("out");
869 }
871  mschk("out");
872  NrnProperty::assign(np_->prop(), ms->np_->prop(), vartype_);
873 }
874 
875 void MechanismStandard::save(const char* obref, std::ostream* po) {
876  mschk("save");
877  std::ostream& o = *po;
878  char buf[256];
879  sprintf(buf, "%s = new MechanismStandard(\"%s\")", obref, np_->name());
880  o << buf << std::endl;
881  for (Symbol* sym = np_->first_var(); np_->more_var(); sym = np_->next_var()) {
882  if (vartype_ == 0 || np_->var_type(sym) == vartype_) {
883  int i, cnt = hoc_total_array_data(sym, 0);
884  for (i = 0; i < cnt; ++i) {
885  sprintf(
886  buf, "%s.set(\"%s\", %g, %d)", obref, sym->name, *np_->prop_pval(sym, i), i);
887  o << buf << std::endl;
888  }
889  }
890  }
891 }
892 
893 void MechanismStandard::mschk(const char* s) {
894  if (vartype_ == -1) {
895  hoc_execerror(s, " MechanismStandard method not implemented for GLOBAL type");
896  }
897 }
898 
899 /*
900 help MembraneType
901 listin nrniv
902 Provides a way of iterating over all membrane mechanisms or point
903 processes and allows selection via a menu or under hoc control.
904 
905 mt = new MembraneType(0)
906 The object can be considered a list of all the available continuous
907 membrane mechanisms. eg "hh", "pas", "extracellular". that can
908 be inserted into a section.
909 
910 mt = new MembraneType(1)
911 The object can be considered a list of all available Point Processes.
912 eg. PulseStim, AlphaSynapse, VClamp.
913 
914 To print the names of all mechanisms in this object list try:
915 strdef mname
916 for i=0,mt.count() {
917  mt.select(i)
918  mt.selected(mname)
919  print mname
920 }
921 
922 help select
923 mt.select("name")
924 mt.select(i)
925 selects either the named mechanism or the i'th mechanism in the list.
926 
927 help selected
928 i = mt.selected([strdef])
929 returns the index of the current selection. If present, strarg is assigned
930 to the name of the current selection.
931 
932 help make
933 mt.make()
934 For continuous mechanisms. Inserts selected mechanism into currently
935 accessed section.
936 
937 help remove
938 mt.remove()
939 For continuous mechanisms. Deletes selected mechanism from currently
940 accessed section. A nop if the mechanism is not in the section.
941 
942 help make
943 mt.make(objectvar)
944 For point processes. The arg becomes a reference to a new point process
945 of type given by the selection.
946 Note that the newly created point process is not located in any section.
947 Note that if objectvar was the only reference to another object then
948 that object is destroyed.
949 
950 help count
951 i = mt.count()
952 The number of different mechanisms in the list.
953 
954 help menu
955 mt.menu()
956 Inserts a special menu into the currently open xpanel. The menu
957 label always reflects the current selection. Submenu items are indexed
958 according to position with the first item being item 0. When the mouse
959 button is released on a submenu item that item becomes the selection
960 and the action (if any) is executed.
961 
962 help action
963 mt.action("command")
964 The action to be executed when a submenu item is selected.
965 */
967 
968 static double mt_select(void* v) {
969  MechanismType* mt = (MechanismType*) v;
970  if (hoc_is_double_arg(1)) {
971  mt->select(int(chkarg(1, -1, mt->count() - 1)));
972  } else if (hoc_is_str_arg(1)) {
973  mt->select(gargstr(1));
974  }
975  return 0.;
976 }
977 static double mt_selected(void* v) {
978  MechanismType* mt = (MechanismType*) v;
979  int i = mt->selected_item();
980  if (ifarg(1)) {
982  }
984  return double(i);
985 }
986 static double mt_internal_type(void* v) {
987  MechanismType* mt = (MechanismType*) v;
988  return double(mt->internal_type());
989 }
990 static double mt_make(void* v) {
991  MechanismType* mt = (MechanismType*) v;
992  if (mt->is_point()) {
994  } else {
995  mt->insert(chk_access());
996  }
997  return 0.;
998 }
999 static double mt_remove(void* v) {
1000  MechanismType* mt = (MechanismType*) v;
1001  mt->remove(chk_access());
1002  return 0.;
1003 }
1004 static double mt_count(void* v) {
1005  MechanismType* mt = (MechanismType*) v;
1007  return double(mt->count());
1008 }
1009 static double mt_menu(void* v) {
1010  TRY_GUI_REDIRECT_METHOD_ACTUAL_DOUBLE("MechanismType.menu", mt_class_sym_, v);
1011 #if HAVE_IV
1012  IFGUI
1013  MechanismType* mt = (MechanismType*) v;
1014  mt->menu();
1015  ENDGUI
1016 #endif
1017  return 0.;
1018 }
1019 static double mt_action(void* v) {
1020  MechanismType* mt = (MechanismType*) v;
1021  if (hoc_is_str_arg(1)) {
1022  mt->action(gargstr(1), NULL);
1023  } else {
1024  mt->action(NULL, *hoc_objgetarg(1));
1025  }
1026  return 0.;
1027 }
1028 static double mt_is_target(void* v) {
1029  MechanismType* mt = (MechanismType*) v;
1031  return double(mt->is_netcon_target(int(chkarg(1, 0, mt->count()))));
1032 }
1033 static double mt_has_net_event(void* v) {
1034  MechanismType* mt = (MechanismType*) v;
1036  return double(mt->has_net_event(int(chkarg(1, 0, mt->count()))));
1037 }
1038 static double mt_is_artificial(void* v) {
1039  MechanismType* mt = (MechanismType*) v;
1041  return double(mt->is_artificial(int(chkarg(1, 0, mt->count()))));
1042 }
1043 static Object** mt_pp_begin(void* v) {
1044  MechanismType* mt = (MechanismType*) v;
1045  Point_process* pp = mt->pp_begin();
1046  Object* obj = NULL;
1047  if (pp) {
1048  obj = pp->ob;
1049  }
1050  return hoc_temp_objptr(obj);
1051 }
1052 
1053 static Object** mt_pp_next(void* v) {
1054  MechanismType* mt = (MechanismType*) v;
1055  Point_process* pp = mt->pp_next();
1056  Object* obj = NULL;
1057  if (pp) {
1058  obj = pp->ob;
1059  }
1060  return hoc_temp_objptr(obj);
1061 }
1062 
1063 extern const char** nrn_nmodl_text_;
1064 static const char** mt_code(void* v) {
1065  static const char* nullstr = "";
1066  MechanismType* mt = (MechanismType*) v;
1067  int type = mt->internal_type();
1068  const char** p = nrn_nmodl_text_ + type;
1069  if (*p) {
1070  return p;
1071  }
1072  return &nullstr;
1073 }
1074 
1075 extern const char** nrn_nmodl_filename_;
1076 static const char** mt_file(void* v) {
1077  static const char* nullstr = "";
1078  MechanismType* mt = (MechanismType*) v;
1079  int type = mt->internal_type();
1080  const char** p = nrn_nmodl_filename_ + type;
1081  if (*p) {
1082  return p;
1083  }
1084  return &nullstr;
1085 }
1086 
1087 static void* mt_cons(Object* obj) {
1088  MechanismType* mt = new MechanismType(int(chkarg(1, 0, 1)));
1089  mt->ref();
1090  mt->mtobj_ = obj;
1091  return (void*) mt;
1092 }
1093 static void mt_destruct(void* v) {
1094  MechanismType* mt = (MechanismType*) v;
1095  mt->unref();
1096 }
1097 static Member_func mt_members[] = {"select",
1098  mt_select,
1099  "selected",
1100  mt_selected,
1101  "make",
1102  mt_make,
1103  "remove",
1104  mt_remove,
1105  "count",
1106  mt_count,
1107  "menu",
1108  mt_menu,
1109  "action",
1110  mt_action,
1111  "is_netcon_target",
1112  mt_is_target,
1113  "has_net_event",
1115  "is_artificial",
1117  "internal_type",
1119  0,
1120  0};
1122  {"pp_begin", mt_pp_begin, "pp_next", mt_pp_next, 0, 0};
1123 static Member_ret_str_func mt_retstr_func[] = {"code", mt_code, "file", mt_file, 0, 0};
1125  class2oc(
1127  mt_class_sym_ = hoc_lookup("MechanismType");
1128 }
1129 
1130 /* static */ class MechTypeImpl {
1131  private:
1132  friend class MechanismType;
1134  int* type_;
1135  int count_;
1136  int select_;
1142 };
1143 
1144 typedef Symbol* PSym;
1145 
1147  mti_ = new MechTypeImpl;
1149  mti_->count_ = 0;
1150  int i;
1151  for (i = 2; i < n_memb_func; ++i) {
1152  if (point_process == memb_func[i].is_point) {
1153  ++mti_->count_;
1154  }
1155  }
1156  mti_->type_ = new int[mti_->count_];
1157  int j = 0;
1158  for (i = 2; i < n_memb_func; ++i) {
1159  if (point_process == memb_func[i].is_point) {
1160  mti_->type_[j] = i;
1161  ++j;
1162  }
1163  }
1164  mti_->pyact_ = NULL;
1165  action("", NULL);
1166  select(0);
1167 }
1169  if (mti_->pyact_) {
1171  }
1172  delete[] mti_->type_;
1173  delete mti_;
1174 }
1176  return mti_->is_point_;
1177 }
1178 
1180  if (!mti_->is_point_) {
1181  hoc_execerror("Not a MechanismType(1)", 0);
1182  }
1183  mti_->sec_iter_ = chk_access();
1185  mti_->p_iter_ = 0;
1186  if (mti_->sec_iter_->parentnode) {
1187  mti_->inode_iter_ = -1;
1189  }
1190  if (!mti_->p_iter_) {
1191  mti_->inode_iter_ = 0;
1192  mti_->p_iter_ = mti_->sec_iter_->pnode[0]->prop;
1193  }
1194  Point_process* pp = pp_next(); // note that p_iter is the one looked at and then incremented
1195  return pp;
1196 }
1197 
1199  Point_process* pp = NULL;
1200  bool done = mti_->p_iter_ == 0;
1201  while (!done) {
1202  if (mti_->p_iter_->type == mti_->type_[mti_->select_]) {
1203  pp = (Point_process*) mti_->p_iter_->dparam[1]._pvoid;
1204  done = true;
1205  // but if it does not belong to this section
1206  if (pp->sec != mti_->sec_iter_) {
1207  pp = NULL;
1208  done = false;
1209  }
1210  }
1211  mti_->p_iter_ = mti_->p_iter_->next;
1212  while (!mti_->p_iter_) {
1213  ++mti_->inode_iter_;
1214  if (mti_->inode_iter_ >= mti_->sec_iter_->nnode) {
1215  done = true;
1216  break; // really at the end
1217  } else {
1219  }
1220  }
1221  }
1222  return pp;
1223 }
1224 
1226  int j = mti_->type_[i];
1227  return pnt_receive[j] ? true : false;
1228 }
1229 
1231  int j = mti_->type_[i];
1232  int k;
1233  for (k = 0; k < nrn_has_net_event_cnt_; ++k) {
1234  if (nrn_has_net_event_[k] == j) {
1235  return true;
1236  }
1237  }
1238  return false;
1239 }
1240 
1242  int j = mti_->type_[i];
1243  return (nrn_is_artificial_[j] ? true : false);
1244 }
1245 
1246 void MechanismType::select(const char* name) {
1247  for (int i = 0; i < mti_->count_; ++i) {
1248  if (strcmp(name, memb_func[mti_->type_[i]].sym->name) == 0) {
1249  select(i);
1250  break;
1251  }
1252  }
1253 }
1256  return sym->name;
1257 }
1259  return mti_->type_[selected_item()];
1260 }
1261 extern void mech_insert1(Section*, int);
1262 extern void mech_uninsert1(Section*, Symbol*);
1264  if (!mti_->is_point_) {
1266  }
1267 }
1269  if (!mti_->is_point_) {
1271  }
1272 }
1273 
1275 
1279  *o = nrn_new_pointprocess(sym);
1280  (*o)->refcount = 1;
1281 }
1282 
1283 void MechanismType::action(const char* action, Object* pyact) {
1284  mti_->action_ = action ? action : "";
1285  if (pyact) {
1286  hoc_obj_ref(pyact);
1287  }
1288  if (mti_->pyact_) {
1290  mti_->pyact_ = NULL;
1291  }
1292  mti_->pyact_ = pyact;
1293 }
1295 #if HAVE_IV
1296  char buf[200];
1297  Oc oc;
1298  oc.run("{xmenu(\"MechType\")}\n");
1299  for (int i = 0; i < mti_->count_; ++i) {
1300  Symbol* s = memb_func[mti_->type_[i]].sym;
1301  if (s->subtype != MORPHOLOGY) {
1302  if (mti_->pyact_) {
1305  hoc_pushx(double(i));
1306  Object* pyactval = (*nrnpy_callable_with_args)(mti_->pyact_, 2);
1307  hoc_ivbutton(s->name, NULL, pyactval);
1308  hoc_obj_unref(pyactval);
1309  } else {
1310  sprintf(buf,
1311  "xbutton(\"%s\", \"hoc_ac_=%d %s\")\n",
1312  s->name,
1313  i,
1314  mti_->action_.string());
1315  oc.run(buf);
1316  }
1317  }
1318  }
1319  oc.run("{xmenu()}\n");
1320 #endif
1321 }
1322 
1324  return mti_->count_;
1325 }
1327  return mti_->select_;
1328 }
1330  if (index < 0) {
1331  mti_->select_ = index;
1332  } else if (index >= count()) {
1333  mti_->select_ = count() - 1;
1334  } else {
1335  mti_->select_ = index;
1336  }
1337 }
const char * secname(Section *sec)
Definition: cabcode.cpp:1776
void nrn_pushsec(Section *sec)
Definition: cabcode.cpp:99
double nrn_arc_position(Section *sec, Node *node)
Definition: cabcode.cpp:1867
Prop * nrn_mechanism(int type, Node *nd)
Definition: cabcode.cpp:1079
Section * chk_access(void)
Definition: cabcode.cpp:444
const char * sec_and_position(Section *sec, Node *nd)
Definition: cabcode.cpp:1908
void nrn_popsec(void)
Definition: cabcode.cpp:123
char * hoc_section_pathname(Section *sec)
Definition: cabcode.cpp:1835
Node * node_exact(Section *sec, double x)
Definition: cabcode.cpp:1940
short index
Definition: cabvars.h:10
Memb_func * memb_func
Definition: init.cpp:123
short type
Definition: cabvars.h:9
Object * pyact_
Definition: nrnmenu.cpp:1138
Section * sec_iter_
Definition: nrnmenu.cpp:1139
CopyString action_
Definition: nrnmenu.cpp:1137
Prop * p_iter_
Definition: nrnmenu.cpp:1141
bool is_point_
Definition: nrnmenu.cpp:1133
CopyString action_
Definition: nrnmenu.h:43
void mschk(const char *)
Definition: nrnmenu.cpp:893
void in(Section *, double x=-1.)
Definition: nrnmenu.cpp:835
virtual ~MechanismStandard()
Definition: nrnmenu.cpp:708
void out(Section *, double x=-1.)
Definition: nrnmenu.cpp:853
MechanismStandard(const char *, int vartype)
Definition: nrnmenu.cpp:668
NrnProperty * np_
Definition: nrnmenu.h:39
Object * msobj_
Definition: nrnmenu.h:37
void save(const char *, std::ostream *)
Definition: nrnmenu.cpp:875
void action(const char *, Object *pyact)
Definition: nrnmenu.cpp:805
void set(const char *, double val, int arrayindex=0)
Definition: nrnmenu.cpp:813
double get(const char *, int arrayindex=0)
Definition: nrnmenu.cpp:822
Object * pyact_
Definition: nrnmenu.h:44
Symbol ** glosym_
Definition: nrnmenu.h:45
const char * name()
Definition: nrnmenu.cpp:720
void panel(const char *label=NULL)
Definition: nrnmenu.cpp:734
void point_process(Object **)
Definition: nrnmenu.cpp:1276
virtual ~MechanismType()
Definition: nrnmenu.cpp:1168
const char * selected()
Definition: nrnmenu.cpp:1254
Point_process * pp_begin()
Definition: nrnmenu.cpp:1179
Object * mtobj_
Definition: nrnmenu.h:73
bool is_netcon_target(int)
Definition: nrnmenu.cpp:1225
void remove(Section *)
Definition: nrnmenu.cpp:1268
MechanismType(bool point_process)
Definition: nrnmenu.cpp:1146
Point_process * pp_next()
Definition: nrnmenu.cpp:1198
void select(const char *)
Definition: nrnmenu.cpp:1246
int selected_item()
Definition: nrnmenu.cpp:1326
bool is_point()
Definition: nrnmenu.cpp:1175
int internal_type()
Definition: nrnmenu.cpp:1258
MechTypeImpl * mti_
Definition: nrnmenu.h:75
bool is_artificial(int)
Definition: nrnmenu.cpp:1241
bool has_net_event(int)
Definition: nrnmenu.cpp:1230
void insert(Section *)
Definition: nrnmenu.cpp:1263
void action(const char *, Object *pyact)
Definition: nrnmenu.cpp:1283
Symbol * find(const char *rangevar)
Definition: ndatclas.cpp:203
int var_type(Symbol *) const
Definition: ndatclas.cpp:153
double * prop_pval(const Symbol *, int arrayindex=0) const
Definition: ndatclas.cpp:223
static bool assign(Prop *src, Prop *dest, int vartype=0)
Definition: ndatclas.cpp:157
Symbol * var(int)
Definition: ndatclas.cpp:149
Symbol * first_var()
Definition: ndatclas.cpp:127
const char * name() const
Definition: ndatclas.cpp:111
int type() const
Definition: ndatclas.cpp:119
Symbol * next_var()
Definition: ndatclas.cpp:140
bool more_var()
Definition: ndatclas.cpp:132
Prop * prop() const
Definition: ndatclas.cpp:123
Definition: ivoc.h:36
int run(int argc, const char **argv)
static ostream * save_stream
Definition: ivoc.h:77
virtual void ref() const
Definition: resource.cpp:47
virtual void unref() const
Definition: resource.cpp:52
static void make_section_browser()
Definition: string.h:34
const char * string() const
Definition: string.h:139
Symbol * hoc_table_lookup(const char *, Symlist *)
Definition: symbol.cpp:61
static char * stmp[HOC_TEMP_CHARPTR_SIZE]
Definition: code.cpp:639
sprintf(buf, " if (secondorder) {\n" " int _i;\n" " for (_i = 0; _i < %d; ++_i) {\n" " _p[_slist%d[_i]] += dt*_p[_dlist%d[_i]];\n" " }}\n", numeqn, listnum, listnum)
double chkarg(int, double low, double high)
Definition: code2.cpp:638
int nrn_vartype(Symbol *sym)
Definition: eion.cpp:515
ms
Definition: extargs.h:1
void hoc_execerror(const char *, const char *)
Definition: hoc.cpp:754
char buf[512]
Definition: init.cpp:13
int hoc_is_object_arg(int narg)
Definition: code.cpp:756
HocSymExtension * hoc_var_extra(const char *name)
Definition: code2.cpp:35
size_t hoc_total_array_data(Symbol *s, Objectdata *obd)
Definition: hoc_oop.cpp:94
int hoc_is_str_arg(int narg)
Definition: code.cpp:752
void hoc_assign_str(char **cpp, const char *buf)
Definition: code.cpp:2350
double * hoc_val_pointer(const char *s)
Definition: code2.cpp:727
int is_obj_type(Object *obj, const char *type_name)
Definition: hoc_oop.cpp:2059
int hoc_is_double_arg(int narg)
Definition: code.cpp:744
void hoc_retpushx(double x)
Definition: hocusr.cpp:154
double hoc_ac_
Definition: hoc_init.cpp:397
void hoc_obj_ref(Object *obj)
Definition: hoc_oop.cpp:1810
char * hoc_object_name(Object *ob)
Definition: hoc_oop.cpp:72
void hoc_dec_refcount(Object **pobj)
Definition: hoc_oop.cpp:1816
Symbol * hoc_lookup(const char *)
void hoc_obj_unref(Object *obj)
Definition: hoc_oop.cpp:1828
void hoc_push_object(Object *d)
Definition: code.cpp:673
char ** hoc_pgargstr(int narg)
Definition: code.cpp:1599
#define TRY_GUI_REDIRECT_DOUBLE(name, obj)
Definition: gui-redirect.h:58
#define TRY_GUI_REDIRECT_METHOD_ACTUAL_DOUBLE(name, sym, v)
Definition: gui-redirect.h:23
#define assert(ex)
Definition: hocassrt.h:32
#define IFGUI
Definition: hocdec.h:372
#define ISARRAY(arg)
Definition: hocdec.h:164
#define USERDOUBLE
Definition: hocdec.h:93
#define getarg
Definition: hocdec.h:15
#define gargstr
Definition: hocdec.h:14
#define ENDGUI
Definition: hocdec.h:373
#define OBJ(q)
Definition: hoclist.h:67
Object ** hoc_objgetarg(int)
Definition: code.cpp:1587
void
int ifarg(int)
Definition: code.cpp:1581
void hoc_pushx(double)
static const char * nullstr
Definition: ivocvect.cpp:225
static int narg()
Definition: ivocvect.cpp:150
Object ** hoc_temp_objptr(Object *)
Definition: code.cpp:216
#define pval
Definition: md1redef.h:32
#define v
Definition: md1redef.h:4
#define sec
Definition: md1redef.h:13
#define i
Definition: md1redef.h:12
#define MORPHOLOGY
Definition: membfunc.h:63
#define nrnocCONST
Definition: membfunc.h:69
#define STATE
Definition: membfunc.h:71
#define ITERATE(itm, lst)
Definition: model.h:25
char * name
Definition: init.cpp:16
static Node * node(Object *)
Definition: netcvode.cpp:340
static char suffix[256]
Definition: nocpout.cpp:149
int is_point_process(Object *)
Definition: point.cpp:396
void nrn_seg_or_x_arg(int iarg, Section **psec, double *px)
Definition: point.cpp:185
int const size_t const size_t n
Definition: nrngsl.h:11
size_t q
if(status)
size_t p
size_t j
const char ** nrn_nmodl_filename_
Definition: init.cpp:168
void MechanismStandard_reg()
Definition: nrnmenu.cpp:663
static void * mt_cons(Object *obj)
Definition: nrnmenu.cpp:1087
short * nrn_is_artificial_
Definition: init.cpp:193
static void * ms_cons(Object *ob)
Definition: nrnmenu.cpp:642
Point_process * ob2pntproc(Object *)
Definition: hocmech.cpp:88
double * point_process_pointer(Point_process *, Symbol *, int)
Definition: point.cpp:257
static double ms_action(void *v)
Definition: nrnmenu.cpp:528
static const char ** mt_code(void *v)
Definition: nrnmenu.cpp:1064
int node_index(Section *, double)
Definition: cabcode.cpp:1471
void nrnmechmenu()
Definition: nrnmenu.cpp:165
static void ms_destruct(void *v)
Definition: nrnmenu.cpp:654
ReceiveFunc * pnt_receive
Definition: init.cpp:133
static Symbol * ms_class_sym_
Definition: nrnmenu.cpp:513
double(* nrnpy_object_to_double_)(Object *)
Definition: xmenu.cpp:14
static Object ** mt_pp_begin(void *v)
Definition: nrnmenu.cpp:1043
static bool has_globals(const char *name)
Definition: nrnmenu.cpp:93
void mech_insert1(Section *, int)
Definition: cabcode.cpp:849
static Member_func ms_members[]
Definition: nrnmenu.cpp:658
static double mt_remove(void *v)
Definition: nrnmenu.cpp:999
void(* ReceiveFunc)(Point_process *, double *, double)
Definition: nrnmenu.cpp:21
Symbol * PSym
Definition: nrnmenu.cpp:1144
static double mt_selected(void *v)
Definition: nrnmenu.cpp:977
void nrnallsectionmenu()
Definition: nrnmenu.cpp:56
static double ms_panel(void *v)
Definition: nrnmenu.cpp:515
void mech_uninsert1(Section *, Symbol *)
Definition: cabcode.cpp:916
int nrn_has_net_event_cnt_
Definition: init.cpp:138
static double mt_menu(void *v)
Definition: nrnmenu.cpp:1009
static double mt_count(void *v)
Definition: nrnmenu.cpp:1004
static Member_ret_obj_func mt_retobj_members[]
Definition: nrnmenu.cpp:1121
static double mt_internal_type(void *v)
Definition: nrnmenu.cpp:986
void nrn_parent_info(Section *)
Definition: cabcode.cpp:1678
static double mt_make(void *v)
Definition: nrnmenu.cpp:990
static double mt_select(void *v)
Definition: nrnmenu.cpp:968
int * nrn_has_net_event_
Definition: init.cpp:139
static double mt_action(void *v)
Definition: nrnmenu.cpp:1019
char * pnt_map
Definition: init.cpp:128
static double ms_save(void *v)
Definition: nrnmenu.cpp:632
int hoc_return_type_code
Definition: code.cpp:42
static double mt_is_target(void *v)
Definition: nrnmenu.cpp:1028
static Object ** mt_pp_next(void *v)
Definition: nrnmenu.cpp:1053
void nrnallpointmenu()
Definition: nrnmenu.cpp:347
void nrnpointmenu()
Definition: nrnmenu.cpp:413
static double mt_has_net_event(void *v)
Definition: nrnmenu.cpp:1033
static double ms_out(void *v)
Definition: nrnmenu.cpp:542
static Member_func mt_members[]
Definition: nrnmenu.cpp:1097
static Symbol * mt_class_sym_
Definition: nrnmenu.cpp:966
Object *(* nrnpy_callable_with_args)(Object *, int narg)
Definition: nrnmenu.cpp:46
Object * nrn_new_pointprocess(Symbol *)
Definition: point.cpp:53
static double mt_is_artificial(void *v)
Definition: nrnmenu.cpp:1038
void MechanismType_reg()
Definition: nrnmenu.cpp:1124
static const char ** mt_file(void *v)
Definition: nrnmenu.cpp:1076
void nrnsecmenu()
Definition: nrnmenu.cpp:68
static double ms_set(void *v)
Definition: nrnmenu.cpp:599
Symbol ** pointsym
Definition: init.cpp:126
static Member_ret_str_func mt_retstr_func[]
Definition: nrnmenu.cpp:1123
static double ms_get(void *v)
Definition: nrnmenu.cpp:607
static double ms_name(void *v)
Definition: nrnmenu.cpp:618
const char ** nrn_nmodl_text_
Definition: init.cpp:163
int(* nrnpy_ob_is_seg)(Object *)
Definition: nrnmenu.cpp:47
Symlist * hoc_built_in_symlist
Definition: ivocmac.cpp:76
void nrnglobalmechmenu()
Definition: nrnmenu.cpp:105
static double ms_in(void *v)
Definition: nrnmenu.cpp:570
static double ms_count(void *v)
Definition: nrnmenu.cpp:614
static void mt_destruct(void *v)
Definition: nrnmenu.cpp:1093
void class2oc(const char *, void *(*cons)(Object *), void(*destruct)(void *), Member_func *, int(*checkpoint)(void **), Member_ret_obj_func *, Member_ret_str_func *)
Definition: hoc_oop.cpp:1560
int n_memb_func
Definition: init.cpp:440
static philox4x32_key_t k
Definition: nrnran123.cpp:11
static int point_process
Definition: nrnunit.cpp:11
void hoc_ivvaluerun_ex(CChar *name, CChar *var, double *pvar, Object *pyvar, CChar *action, Object *pyact, bool deflt=false, bool canrun=false, bool usepointer=false, HocSymExtension *extra=NULL)
void hoc_ivvalue(CChar *name, CChar *variable, bool deflt=false, Object *pyvar=0)
void hoc_ivbutton(CChar *name, CChar *action, Object *pyact=0)
void hoc_ivmenu(CChar *, bool add2menubar=false)
void hoc_ivpanelmap(int scroll=-1)
void hoc_ivpvalue(CChar *name, double *, bool deflt=false, HocSymExtension *extra=NULL)
void hoc_ivvaluerun(CChar *name, CChar *variable, CChar *action, bool deflt=false, bool canrun=false, bool usepointer=false, Object *pyvar=0, Object *pyact=0)
void hoc_ivpanel(CChar *, bool h=false)
void hoc_ivlabel(CChar *)
void hoc_ivpvaluerun(CChar *name, double *, CChar *action, bool deflt=false, bool canrun=false, HocSymExtension *extra=NULL)
static Symbol * vsym
Definition: occvode.cpp:49
static double done(void *v)
Definition: ocbbs.cpp:282
void section_menu(double, int, MechSelector *=NULL)
o
Definition: seclist.cpp:175
#define cnt
Definition: spt2queue.cpp:19
#define NULL
Definition: sptree.h:16
int sub[1]
Definition: hocdec.h:72
int is_point
Definition: membfunc.h:53
Symbol * sym
Definition: membfunc.h:38
Definition: section.h:133
struct Prop * prop
Definition: section.h:152
Definition: hocdec.h:227
Object * ob
Definition: section.h:267
Section * sec
Definition: section.h:263
Node * node
Definition: section.h:264
Prop * prop
Definition: section.h:265
Definition: section.h:214
Datum * dparam
Definition: section.h:220
short type
Definition: section.h:216
struct Prop * next
Definition: section.h:215
struct Node ** pnode
Definition: section.h:51
struct Node * parentnode
Definition: section.h:50
short nnode
Definition: section.h:41
Definition: model.h:57
HocStruct Symbol ** ppsym
Definition: hocdec.h:150
short type
Definition: model.h:58
long subtype
Definition: model.h:59
HocStruct Symbol * next
Definition: hocdec.h:162
union Symbol::@18 u
unsigned s_varn
Definition: hocdec.h:158
char * name
Definition: model.h:72
HocSymExtension * extra
Definition: hocdec.h:160
HocStruct cTemplate * ctemplate
Definition: hocdec.h:152
Arrayinfo * arayinfo
Definition: hocdec.h:159
Definition: hocdec.h:84
HocStruct Symbol * first
Definition: hocdec.h:85
hoc_List * olist
Definition: hocdec.h:204
void * _pvoid
Definition: hocdec.h:187
char * strstr(char *cs, char *ct)
Definition: xred.cpp:173