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