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