NEURON
code2.cpp
Go to the documentation of this file.
1 #include <../../nrnconf.h>
2 /* /local/src/master/nrn/src/oc/code2.cpp,v 1.12 1999/06/08 17:48:26 hines Exp */
3 
4 #include "hocstr.h"
5 #include "parse.hpp"
6 #include "hocparse.h"
7 #include <stdio.h>
8 #include <stdlib.h>
9 #ifdef HAVE_UNISTD_H
10 #include <unistd.h>
11 #endif
12 #include <ctype.h>
13 #include <errno.h>
14 #include "nrnfilewrap.h"
15 #include <cstring>
16 
17 #include "utils/logger.hpp"
18 
19 
21 
22 extern char** gargv;
23 extern int gargc;
24 extern double chkarg(int, double low, double high);
27 extern Symbol* hoc_table_lookup(const char*, Symlist*);
28 
29 extern char** hoc_pgargstr(int);
30 
31 float* hoc_sym_domain(Symbol* sym) {
32  if (sym && sym->extra) {
33  return sym->extra->parmlimits;
34  }
35  return (float*) 0;
36 }
37 
39  Symbol* sym;
40  sym = hoc_lookup(name);
41  if (sym) {
42  return sym->extra;
43  } else {
44  return (HocSymExtension*) 0;
45  }
46 }
47 
48 Symbol* hoc_name2sym(const char* name) {
49  char *buf, *cp;
50  Symbol* sym;
51  buf = static_cast<char*>(emalloc(strlen(name) + 1));
52  strcpy(buf, name);
53  for (cp = buf; *cp; ++cp) {
54  if (*cp == '.') {
55  *cp = '\0';
56  ++cp;
57  break;
58  }
59  }
61  if (!sym) {
63  }
64  if (sym && *cp == '\0') {
65  free(buf);
66  return sym;
67  } else if (sym && sym->type == TEMPLATE && *cp != '\0') {
68  sym = hoc_table_lookup(cp, sym->u.ctemplate->symtable);
69  if (sym) {
70  free(buf);
71  return sym;
72  }
73  }
74  free(buf);
75  return (Symbol*) 0;
76 }
77 
78 void hoc_Symbol_limits(void) {
79  Symbol* sym;
81 
82  if (hoc_is_str_arg(1)) {
83  char* name = gargstr(1);
84  sym = hoc_name2sym(name);
85  if (!sym) {
86  hoc_execerror("Cannot find the symbol for ", name);
87  }
88  } else {
90  if (!sym) {
92  "Cannot find the symbol associated with the pointer when called from Python.",
93  "Use a string instead of pointer argument");
94  }
95  }
96  assert(sym);
97  hoc_symbol_limits(sym, *getarg(2), *getarg(3));
98  hoc_ret();
99  hoc_pushx(1.);
100 }
101 
102 void hoc_symbol_limits(Symbol* sym, float low, float high) {
103  sym_extra_alloc(sym);
104  if (!sym->extra->parmlimits) {
105  sym->extra->parmlimits = (float*) emalloc(2 * sizeof(float));
106  }
107  sym->extra->parmlimits[0] = low;
108  sym->extra->parmlimits[1] = high;
109 }
110 
111 void hoc_symbol_tolerance(Symbol* sym, double tol) {
112  sym_extra_alloc(sym);
113  sym->extra->tolerance = tol;
114 }
115 
116 double check_domain_limits(float* limits, double val) {
117  if (limits) {
118  if (val < limits[0]) {
119  return (double) limits[0];
120  } else if (val > limits[1]) {
121  return (double) limits[1];
122  }
123  }
124  return val;
125 }
126 
127 
128 char* hoc_symbol_units(Symbol* sym, const char* units) {
129  if (!sym) {
130  return (char*) 0;
131  }
132  if (units) {
133  if (sym->extra && sym->extra->units) {
134  free(sym->extra->units);
135  sym->extra->units = (char*) 0;
136  }
137  sym_extra_alloc(sym);
138  sym->extra->units = static_cast<char*>(emalloc(strlen(units) + 1));
139  strcpy(sym->extra->units, units);
140  }
141  if (sym->extra && sym->extra->units) {
142  return sym->extra->units;
143  } else {
144  return (char*) 0;
145  }
146 }
147 
148 void hoc_Symbol_units(void) {
149  Symbol* sym;
151  char** units = hoc_temp_charptr();
152 
153  if (hoc_is_double_arg(1)) {
154  units_on_flag_ = (int) chkarg(1, 0., 1.);
155  if (units_on_flag_) {
156  *units = const_cast<char*>("on");
157  } else {
158  *units = const_cast<char*>("off");
159  }
160  } else {
161  if (hoc_is_str_arg(1)) {
162  char* name = gargstr(1);
163  sym = hoc_name2sym(name);
164  if (!sym) {
165  hoc_execerror("Cannot find the symbol for ", name);
166  }
167  } else {
169  if (!sym) {
171  "Cannot find the symbol associated with the pointer when called from Python.",
172  "Use a string instead of pointer argument");
173  }
174  }
175  assert(sym);
176  *units = (char*) 0;
177  if (ifarg(2)) {
178  *units = gargstr(2);
179  }
180  *units = hoc_symbol_units(sym, *units);
181  if (*units == (char*) 0) {
182  *units = const_cast<char*>("");
183  }
184  }
185  hoc_ret();
187 }
188 
189 char* hoc_back2forward(char*);
190 char* neuronhome_forward(void) {
191  extern char* neuron_home;
192 #ifdef WIN32
193  static char* buf;
194  extern void hoc_forward2back();
195  if (!buf) {
196  buf = static_cast<char*>(emalloc(strlen(neuron_home) + 1));
197  strcpy(buf, neuron_home);
198  }
200  return buf;
201 #else
202  return neuron_home;
203 #endif
204 }
205 
207 extern void setneuronhome(const char*);
208 void hoc_neuronhome(void) {
209  extern char* neuron_home;
210 #ifdef WIN32
211  if (ifarg(1) && (int) chkarg(1, 0., 1.) == 1) {
212  if (!neuron_home_dos) {
214  }
215  hoc_ret();
217  } else {
218  hoc_ret();
220  }
221 #else
222  hoc_ret();
224 #endif
225 }
226 
227 char* gargstr(int narg) /* Return pointer to string which is the narg argument */
228 {
229  return *hoc_pgargstr(narg);
230 }
231 
232 void hoc_Strcmp(void) {
233  char *s1, *s2;
234  s1 = gargstr(1);
235  s2 = gargstr(2);
236  hoc_ret();
237  hoc_pushx((double) strcmp(s1, s2));
238 }
239 
240 static int hoc_vsscanf(const char* buf);
241 
242 void hoc_sscanf(void) {
243  int n;
244  n = hoc_vsscanf(gargstr(1));
245  hoc_ret();
246  hoc_pushx((double) n);
247 }
248 
249 static int hoc_vsscanf(const char* buf) {
250  /* assumes arg2 format string from hoc as well as remaining args */
251  char *pf, *format, errbuf[100];
252  void* arglist[20];
253  int n = 0, iarg, i, islong, convert, sawnum;
254  struct {
255  union {
256  double d;
257  float f;
258  long l;
259  int i;
260  char* s;
261  char c;
262  } u;
263  int type;
264  } arg[20];
265  for (i = 0; i < 20; ++i) {
266  arglist[i] = nullptr;
267  }
268  format = gargstr(2);
269  iarg = 0;
270  errbuf[0] = '\0';
271  for (pf = format; *pf; ++pf) {
272  if (*pf == '%') {
273  convert = 1;
274  islong = 0;
275  sawnum = 0;
276  ++pf;
277  if (!*pf)
278  goto incomplete;
279  if (*pf == '*') {
280  convert = 0;
281  ++pf;
282  if (!*pf)
283  goto incomplete;
284  }
285  if (convert && iarg >= 19) {
286  goto too_many;
287  }
288  while (isdigit(*pf)) {
289  sawnum = 1;
290  ++pf;
291  if (!*pf)
292  goto incomplete;
293  }
294  if (*pf == 'l') {
295  islong = 1;
296  ++pf;
297  if (!*pf)
298  goto incomplete;
299  }
300  if (convert)
301  switch (*pf) {
302  case '%':
303  convert = 0;
304  break;
305  case 'd':
306  case 'i':
307  case 'o':
308  case 'u':
309  case 'x':
310  if (islong) {
311  arg[iarg].type = 'l';
312  arglist[iarg] = (void*) &arg[iarg].u.l;
313  } else {
314  arg[iarg].type = 'i';
315  arglist[iarg] = (void*) &arg[iarg].u.i;
316  }
317  break;
318  case 'e':
319  case 'f':
320  case 'g':
321  if (islong) {
322  arg[iarg].type = 'd';
323  arglist[iarg] = (void*) &arg[iarg].u.d;
324  } else {
325  arg[iarg].type = 'f';
326  arglist[iarg] = (void*) &arg[iarg].u.f;
327  }
328  break;
329  case '[':
330  if (islong) {
331  goto bad_specifier;
332  }
333  i = 0; /* watch out for []...] and [^]...] */
334  for (;;) {
335  if (!*pf)
336  goto incomplete;
337  if (*pf == ']') {
338  if (!((i == 1) || ((i == 2) && (pf[-1] == '^')))) {
339  break;
340  }
341  }
342  ++i;
343  ++pf;
344  }
345  case 's':
346  if (islong) {
347  goto bad_specifier;
348  }
349  arg[iarg].type = 's';
350  arg[iarg].u.s = static_cast<char*>(emalloc(strlen(buf) + 1));
351  arglist[iarg] = (void*) arg[iarg].u.s;
352  break;
353  case 'c':
354  if (islong || sawnum) {
355  goto bad_specifier;
356  }
357  arg[iarg].type = 'c';
358  arglist[iarg] = (void*) &arg[iarg].u.c;
359  break;
360  default:
361  goto bad_specifier;
362  /*break;*/
363  }
364  if (convert) {
365  ++iarg;
366  if (!ifarg(iarg + 2)) {
367  goto missing_arg;
368  }
369  switch (arg[iarg - 1].type) {
370  case 's':
371  if (!hoc_is_str_arg(iarg + 2)) {
372  Sprintf(errbuf, "arg %d must be a string", iarg + 2);
373  goto bad_arg;
374  }
375  break;
376  default:
377  if (!hoc_is_pdouble_arg(iarg + 2)) {
378  Sprintf(errbuf, "arg %d must be a pointer to a number", iarg + 2);
379  goto bad_arg;
380  }
381  break;
382  }
383  }
384  }
385  }
386 
387  if (iarg < 4) {
388  n = sscanf(buf, format, arglist[0], arglist[1], arglist[2]);
389  } else if (iarg < 13) {
390  n = sscanf(buf,
391  format,
392  arglist[0],
393  arglist[1],
394  arglist[2],
395  arglist[3],
396  arglist[4],
397  arglist[5],
398  arglist[6],
399  arglist[7],
400  arglist[8],
401  arglist[9],
402  arglist[10],
403  arglist[11]);
404  } else {
405  goto too_many;
406  }
407  assert(n <= iarg);
408 
409  for (i = 0; i < n; ++i) {
410  switch (arg[i].type) {
411  case 'd':
412  *hoc_pgetarg(i + 3) = arg[i].u.d;
413  break;
414  case 'i':
415  *hoc_pgetarg(i + 3) = (double) arg[i].u.i;
416  break;
417  case 'l':
418  *hoc_pgetarg(i + 3) = (double) arg[i].u.l;
419  break;
420  case 'f':
421  *hoc_pgetarg(i + 3) = (double) arg[i].u.f;
422  break;
423  case 's':
424  hoc_assign_str(hoc_pgargstr(i + 3), arg[i].u.s);
425  break;
426  case 'c':
427  *hoc_pgetarg(i + 3) = (double) arg[i].u.c;
428  break;
429  }
430  }
431  goto normal;
432 incomplete:
433  Sprintf(errbuf, "incomplete format specifier for arg %d", iarg + 3);
434  goto normal;
435 bad_specifier:
436  Sprintf(errbuf, "unknown conversion specifier for arg %d", iarg + 3);
437  goto normal;
438 missing_arg:
439  Sprintf(errbuf, "missing arg %d", iarg + 2);
440  goto normal;
441 bad_arg:
442  goto normal;
443 too_many:
444  Sprintf(errbuf, "too many ( > %d) args", iarg + 2);
445  goto normal;
446 normal:
447  for (i = 0; i < iarg; ++i) {
448  if (arg[i].type == 's') {
449  free(arg[i].u.s);
450  }
451  }
452  if (errbuf[0]) {
453  hoc_execerror("scan error:", errbuf);
454  }
455  return n;
456 }
457 
458 void hoc_System(void) {
459  extern int hoc_plttext;
460  static char stdoutfile[] = "/systmp.tmp";
461  double d;
462  FILE* fp;
463 
464  if (hoc_plttext && !strchr(gargstr(1), '>')) {
465  int n;
466  HocStr* st;
467  n = strlen(gargstr(1)) + strlen(stdoutfile);
468  st = hocstr_create(n + 256);
469  std::snprintf(st->buf, st->size + 1, "%s > %s", gargstr(1), stdoutfile);
470  d = (double) system(st->buf);
471 #if 1
472  if ((fp = fopen(stdoutfile, "r")) == (FILE*) 0) {
473  hoc_execerror("Internal error in System(): can't open", stdoutfile);
474  }
475  while (fgets(st->buf, 255, fp) == st->buf) {
476  hoc_plprint(st->buf);
477  }
478 #endif
479  hocstr_delete(st);
480  IGNORE(unlink(stdoutfile));
481  } else if (ifarg(2)) {
482  NrnFILEWrap* fpw;
483  extern HocStr* hoc_tmpbuf;
484  HocStr* line;
485  int i;
486  fp = popen(gargstr(1), "r");
487  if (!fp) {
488  hoc_execerror("could not popen the command:", gargstr(1));
489  }
490  line = hocstr_create(1000);
491  i = 0;
492  hoc_tmpbuf->buf[0] = '\0';
493  fpw = nrn_fw_wrap(fp);
494  while (fgets_unlimited(line, fpw)) {
495  i += strlen(line->buf);
496  if (hoc_tmpbuf->size <= i) {
498  }
499  strcat(hoc_tmpbuf->buf, line->buf);
500  }
501  hocstr_delete(line);
502  d = (double) pclose(fp);
503  nrn_fw_delete(fpw);
505  } else {
506  d = (double) system(gargstr(1));
507  }
508  errno = 0;
509  hoc_ret();
510  hoc_pushx(d);
511 }
512 
513 void hoc_Xred(void) /* read with prompt string and default and limits */
514 {
515  double d;
516 
517  d = hoc_xred(gargstr(1), *getarg(2), *getarg(3), *getarg(4));
518  hoc_ret();
519  hoc_pushx(d);
520 }
521 
522 static struct { /* symbol types */
523  const char* name;
524  short t_type;
525 } type_sym[] = {{"Builtins", BLTIN},
526  {"Other Builtins", FUN_BLTIN},
527  {"Functions", FUNCTION},
528  {"Procedures", PROCEDURE},
529  {"Undefined", UNDEF},
530  {"Scalars", VAR},
531  {0, 0}};
532 
533 static void symdebug(const char* s, Symlist* list) /* for debugging display the symbol lists */
534 {
535  Symbol* sp;
536 
537  Printf("\n\nSymbol list %s\n\n", s);
538  if (list)
539  for (sp = list->first; sp != (Symbol*) 0; sp = sp->next) {
540  Printf("name:%s\ntype:", sp->name);
541  switch (sp->type) {
542  case VAR:
543  if (!is_array(*sp)) {
544  if (sp->subtype == USERINT)
545  Printf("VAR USERINT %8d", *(sp->u.pvalint));
546  else if (sp->subtype == USERDOUBLE)
547  Printf("VAR USERDOUBLE %.8g", *(OPVAL(sp)));
548  else
549  Printf("VAR %.8g", *(OPVAL(sp)));
550  } else {
551  if (sp->subtype == USERINT)
552  Printf("ARRAY USERINT");
553  else if (sp->subtype == USERDOUBLE)
554  Printf("ARRAY USERDOUBLE");
555  else
556  Printf("ARRAY");
557  }
558  break;
559  case NUMBER:
560  Printf("NUMBER %.8g", *(OPVAL(sp)));
561  break;
562  case STRING:
563  Printf("STRING %s", *(OPSTR(sp)));
564  break;
565  case UNDEF:
566  Printf("UNDEF");
567  break;
568  case BLTIN:
569  Printf("BLTIN");
570  break;
571  case AUTO:
572  Printf("AUTO");
573  break;
574  case FUNCTION:
575  Printf("FUNCTION");
576  symdebug(sp->name, sp->u.u_proc->list);
577  break;
578  case PROCEDURE:
579  Printf("PROCEDURE");
580  symdebug(sp->name, sp->u.u_proc->list);
581  break;
582  case FUN_BLTIN:
583  Printf("FUN_BLTIN");
584  break;
585  default:
586  Printf("%d", sp->type);
587  break;
588  }
589  Printf("\n");
590  }
591 }
592 
593 void hoc_symbols(void) /* display the types above */
594 {
595  int i, j;
596  Symbol* sp;
597 
598  if (hoc_zzdebug == 0)
599  for (i = 0; type_sym[i].t_type != 0; i++) {
600  Printf("\n%s\n", type_sym[i].name);
601  for (sp = hoc_symlist->first; sp != (Symbol*) 0; sp = sp->next)
602  if (sp->type == type_sym[i].t_type) {
603  Printf("\t%s", sp->name);
604  switch (sp->type) {
605  case VAR:
606  if (is_array(*sp)) {
607  for (j = 0; j < sp->arayinfo->nsub; j++)
608  Printf("[%d]", sp->arayinfo->sub[j]);
609  }
610  break;
611 
612  default:
613  break;
614  }
615  }
616  Printf("\n");
617  }
618  else {
619  symdebug("p_symlist", hoc_p_symlist);
620  symdebug("symlist", hoc_symlist);
621  }
622  hoc_ret();
623  hoc_pushx(0.);
624 }
625 
626 double chkarg(int arg, double low, double high) /* argument checking for user functions */
627 {
628  double val;
629 
630  val = *getarg(arg);
631  if (val > high || val < low) {
632  hoc_execerror("Arg out of range in user function", (char*) 0);
633  }
634  return val;
635 }
636 
637 
638 double hoc_run_expr(Symbol* sym) /* value of expression in sym made by hoc_parse_expr*/
639 {
640  Inst* pcsav = hoc_pc;
641  hoc_execute(sym->u.u_proc->defn.in);
642  hoc_pc = pcsav;
643  return hoc_ac_;
644 }
645 
646 Symbol* hoc_parse_expr(const char* str, Symlist** psymlist) {
647  Symbol* sp;
648  char s[BUFSIZ];
650 
651  if (!psymlist) {
652  psymlist = &hoc_top_level_symlist;
653  }
654  sp = hoc_install(str, PROCEDURE, 0., psymlist);
655  sp->u.u_proc->defn.in = STOP;
656  sp->u.u_proc->list = (Symlist*) 0;
657  sp->u.u_proc->nauto = 0;
658  sp->u.u_proc->nobjauto = 0;
659  if (strlen(str) > BUFSIZ - 20) {
660  HocStr* s;
661  s = hocstr_create(strlen(str) + 20);
662  std::snprintf(s->buf, s->size + 1, "hoc_ac_ = %s\n", str);
663  hoc_xopen_run(sp, s->buf);
664  hocstr_delete(s);
665  } else {
666  Sprintf(s, "hoc_ac_ = %s\n", str);
667  hoc_xopen_run(sp, s);
668  }
669  return sp;
670 }
671 
672 void hoc_run_stmt(Symbol* sym) {
673  Inst* pcsav = hoc_pc;
674  hoc_execute(sym->u.u_proc->defn.in);
675  hoc_pc = pcsav;
676 }
678 
679 Symbol* hoc_parse_stmt(const char* str, Symlist** psymlist) {
680  Symbol* sp;
681  char s[BUFSIZ];
682 
683  if (!psymlist) {
684  psymlist = &hoc_top_level_symlist;
685  }
686  sp = hoc_install(str, PROCEDURE, 0., psymlist);
687  sp->u.u_proc->defn.in = STOP;
688  sp->u.u_proc->list = (Symlist*) 0;
689  sp->u.u_proc->nauto = 0;
690  sp->u.u_proc->nobjauto = 0;
691  if (strlen(str) > BUFSIZ - 10) {
692  HocStr* s;
693  s = hocstr_create(strlen(str) + 10);
694  std::snprintf(s->buf, s->size + 1, "{%s}\n", str);
695  hoc_xopen_run(sp, s->buf);
696  hocstr_delete(s);
697  } else {
698  Sprintf(s, "{%s}\n", str);
699  hoc_xopen_run(sp, s);
700  }
701  return sp;
702 }
703 
704 /**
705  * @brief Executing hoc_pointer(&var) will put the address of the variable in this location.
706  */
708 
709 void hoc_pointer() {
710  hoc_varhandle = hoc_hgetarg<double>(1);
711  hoc_ret();
712  hoc_pushx(1.);
713 }
714 
716  constexpr std::string_view prefix{"{hoc_pointer_(&"}, suffix{")}\n"};
717  std::string code;
718  code.reserve(prefix.size() + suffix.size() + s.size());
719  code.append(prefix);
720  code.append(s);
721  code.append(")}\n");
722  hoc_varhandle = {};
723  auto const status = hoc_oc(code.c_str());
724  assert(status == 0);
725  return hoc_varhandle;
726 }
727 
728 double* hoc_val_pointer(const char* s) {
729  return static_cast<double*>(hoc_val_handle(s));
730 }
731 
732 void hoc_name_declared(void) {
733  Symbol* s;
735  Symlist* slsav;
736  int x;
737  int arg2 = 0;
738  if (ifarg(2)) {
739  arg2 = chkarg(2, 0., 2.);
740  }
741  if (arg2 == 1.) {
742  s = hoc_lookup(gargstr(1));
743  } else {
744  slsav = hoc_symlist;
746  s = hoc_lookup(gargstr(1));
747  hoc_symlist = slsav;
748  }
749  x = s ? 1. : 0.;
750  if (s) {
751  x = (s->type == OBJECTVAR) ? 2 : x;
752  x = (s->type == SECTION) ? 3 : x;
753  x = (s->type == STRING) ? 4 : x;
754  x = (s->type == VAR) ? 5 : x;
755  if (x == 5 && arg2 == 2) {
756  x = (s->arayinfo) ? 6 : x;
757  x = (s->subtype == USERINT) ? 7 : x;
758  x = (s->subtype == USERPROPERTY) ? 8 : x;
759  }
760  }
761  hoc_ret();
762  hoc_pushx((double) x);
763 }
#define STRING
Definition: bbslsrv.cpp:9
void setneuronhome(const char *)
Definition: ivocmain.cpp:185
float * hoc_sym_domain(Symbol *sym)
Definition: code2.cpp:31
char ** gargv
Definition: hoc.cpp:167
int gargc
Definition: hoc.cpp:168
Symlist * hoc_top_level_symlist
Definition: code2.cpp:677
void hoc_Symbol_limits(void)
Definition: code2.cpp:78
int units_on_flag_
Definition: code2.cpp:20
neuron::container::data_handle< double > hoc_varhandle
Executing hoc_pointer(&var) will put the address of the variable in this location.
Definition: code2.cpp:707
static void symdebug(const char *s, Symlist *list)
Definition: code2.cpp:533
void hoc_symbol_tolerance(Symbol *sym, double tol)
Definition: code2.cpp:111
void hoc_Strcmp(void)
Definition: code2.cpp:232
void hoc_Xred(void)
Definition: code2.cpp:513
Symbol * hoc_table_lookup(const char *, Symlist *)
Definition: symbol.cpp:48
short t_type
Definition: code2.cpp:524
void hoc_sscanf(void)
Definition: code2.cpp:242
const char * name
Definition: code2.cpp:523
void hoc_neuronhome(void)
Definition: code2.cpp:208
char * neuronhome_forward(void)
Definition: code2.cpp:190
Symbol * hoc_name2sym(const char *name)
Definition: code2.cpp:48
char * hoc_back2forward(char *)
void hoc_name_declared(void)
Definition: code2.cpp:732
static int hoc_vsscanf(const char *buf)
Definition: code2.cpp:249
void hoc_symbols(void)
Definition: code2.cpp:593
void hoc_System(void)
Definition: code2.cpp:458
Symlist * hoc_built_in_symlist
Definition: symbol.cpp:28
static struct @38 type_sym[]
void hoc_Symbol_units(void)
Definition: code2.cpp:148
char * gargstr(int narg)
Definition: code2.cpp:227
void hoc_pointer()
Definition: code2.cpp:709
char ** hoc_pgargstr(int)
Definition: code.cpp:1623
char * neuron_home_dos
Definition: code2.cpp:206
static Frame * fp
Definition: code.cpp:96
#define i
Definition: md1redef.h:19
Symbol * hoc_get_last_pointer_symbol()
Definition: code.cpp:1789
int hoc_zzdebug
Definition: debug.cpp:19
static HocParmLimits limits[]
Definition: extcelln.cpp:36
char buf[512]
Definition: init.cpp:13
void hoc_plprint(const char *)
Definition: plot.cpp:97
void hoc_run_stmt(Symbol *sym)
Definition: code2.cpp:672
void sym_extra_alloc(Symbol *)
Definition: symbol.cpp:248
void hoc_pushstr(char **d)
Definition: code.cpp:800
HocSymExtension * hoc_var_extra(const char *name)
Definition: code2.cpp:38
double chkarg(int, double low, double high)
Definition: code2.cpp:626
neuron::container::data_handle< double > hoc_val_handle(std::string_view s)
Definition: code2.cpp:715
void hoc_ret()
double hoc_xred(const char *, double, double, double)
Definition: xred.cpp:65
double check_domain_limits(float *limits, double val)
Definition: code2.cpp:116
Symbol * hoc_install(const char *, int, double, Symlist **)
Definition: symbol.cpp:77
int hoc_is_str_arg(int narg)
Definition: code.cpp:872
void hoc_assign_str(char **cpp, const char *buf)
Definition: code.cpp:2263
double * hoc_val_pointer(const char *s)
Definition: code2.cpp:728
Symbol * hoc_parse_expr(const char *str, Symlist **psymlist)
Definition: code2.cpp:646
int hoc_oc(const char *buf)
Definition: hoc.cpp:1314
double hoc_run_expr(Symbol *sym)
Definition: code2.cpp:638
char * hoc_symbol_units(Symbol *sym, const char *units)
Definition: code2.cpp:128
int hoc_is_double_arg(int narg)
Definition: code.cpp:864
char ** hoc_temp_charptr(void)
Definition: code.cpp:717
int hoc_xopen_run(Symbol *sp, const char *str)
Definition: code.cpp:667
double hoc_ac_
Definition: hoc_init.cpp:222
void hoc_symbol_limits(Symbol *sym, float low, float high)
Definition: code2.cpp:102
double * hoc_pgetarg(int narg)
Definition: oc_ansi.h:253
Symbol * hoc_lookup(const char *)
Definition: symbol.cpp:59
int hoc_is_pdouble_arg(int narg)
Definition: code.cpp:868
Symbol * hoc_parse_stmt(const char *str, Symlist **psymlist)
Definition: code2.cpp:679
char * fgets_unlimited(HocStr *s, NrnFILEWrap *f)
Definition: hoc.cpp:838
HocStr * hoc_tmpbuf
Definition: hoc.cpp:137
HocStr * hocstr_create(size_t size)
Definition: hoc.cpp:828
static int c
Definition: hoc.cpp:169
void hocstr_resize(HocStr *hs, size_t n)
Definition: hoc.cpp:847
void hocstr_delete(HocStr *hs)
Definition: hoc.cpp:842
#define assert(ex)
Definition: hocassrt.h:24
#define USERPROPERTY
Definition: hocdec.h:85
#define USERDOUBLE
Definition: hocdec.h:84
#define getarg
Definition: hocdec.h:17
bool is_array(const Symbol &sym)
Definition: hocdec.h:136
#define USERINT
Definition: hocdec.h:83
#define OPSTR(sym)
Definition: hocdec.h:235
#define OPVAL(sym)
Definition: hocdec.h:234
#define STOP
Definition: hocdec.h:57
Symlist * hoc_p_symlist
Definition: symbol.cpp:35
static int narg()
Definition: ivocvect.cpp:121
const char * neuron_home
Definition: hoc_init.cpp:227
void hoc_pushx(double)
Definition: code.cpp:779
#define IGNORE(arg)
Definition: model.h:224
void hoc_execerror(const char *s1, const char *s2)
Definition: nrnoc_aux.cpp:39
static void * emalloc(size_t size)
Definition: mpispike.cpp:30
int Sprintf(char(&buf)[N], const char *fmt, Args &&... args)
Redirect sprintf to snprintf if the buffer size can be deduced.
Definition: wrap_sprintf.h:14
if(ncell==0)
Definition: cellorder.cpp:785
static char suffix[256]
Definition: nocpout.cpp:135
#define nrn_fw_wrap(f)
Definition: nrnfilewrap.h:9
#define nrn_fw_delete(fw)
Definition: nrnfilewrap.h:10
FILE NrnFILEWrap
Definition: nrnfilewrap.h:8
int const size_t const size_t n
Definition: nrngsl.h:10
#define FUNCTION(a, b)
Definition: nrngsl.h:5
return status
size_t j
s
Definition: multisend.cpp:521
int ifarg(int)
Definition: code.cpp:1607
short type
Definition: cabvars.h:10
Inst * hoc_pc
Definition: code.cpp:78
Symlist * hoc_symlist
Definition: symbol.cpp:34
void hoc_execute(Inst *)
Definition: code.cpp:2531
int hoc_plttext
Definition: plot.cpp:59
#define NULL
Definition: spdefs.h:105
void units(unit *)
Definition: units.cpp:641
int nsub
Definition: hocdec.h:61
int sub[1]
Definition: hocdec.h:63
Definition: hocstr.h:6
size_t size
Definition: hocstr.h:8
char * buf
Definition: hocstr.h:7
float * parmlimits
Definition: hocdec.h:98
char * units
Definition: hocdec.h:99
float tolerance
Definition: hocdec.h:100
int nauto
Definition: hocdec.h:71
Inst defn
Definition: hocdec.h:67
Symlist * list
Definition: hocdec.h:69
int nobjauto
Definition: hocdec.h:72
Definition: model.h:47
Proc * u_proc
Definition: hocdec.h:120
Symbol * next
Definition: hocdec.h:133
union Symbol::@28 u
short type
Definition: model.h:48
int * pvalint
Definition: hocdec.h:116
long subtype
Definition: model.h:49
cTemplate * ctemplate
Definition: hocdec.h:126
char * name
Definition: model.h:61
HocSymExtension * extra
Definition: hocdec.h:131
Arrayinfo * arayinfo
Definition: hocdec.h:130
Definition: hocdec.h:75
Symbol * first
Definition: hocdec.h:76
Symlist * symtable
Definition: hocdec.h:148
Definition: units.cpp:83
Definition: hocdec.h:42
Inst * in
Definition: hocdec.h:51
int Printf(const char *fmt, Args... args)
Definition: logger.hpp:18