1 #include <../../nrnconf.h>
21 extern double chkarg(
int,
double low,
double high);
29 if (sym && sym->
extra) {
50 for (cp =
buf; *cp; ++cp) {
61 if (sym && *cp ==
'\0') {
64 }
else if (sym && sym->
type == TEMPLATE && *cp !=
'\0') {
90 "Cannot find the symbol associated with the pointer when called from Python.",
91 "Use a string instead of pointer argument");
117 return (
double)
limits[0];
118 }
else if (val >
limits[1]) {
119 return (
double)
limits[1];
171 "Cannot find the symbol associated with the pointer when called from Python.",
172 "Use a string instead of pointer argument");
181 if (*
units == (
char*) 0) {
237 pushx((
double) strcmp(s1, s2));
251 char *pf, *
format, errbuf[100];
253 int n = 0, iarg,
i, islong, convert, sawnum;
266 for (
i = 0;
i < 20; ++
i) {
267 arglist[
i] =
nullptr;
272 for (pf =
format; *pf; ++pf) {
286 if (convert && iarg >= 19) {
289 while (isdigit(*pf)) {
312 arg[iarg].type =
'l';
313 arglist[iarg] = (
void*) &
arg[iarg].u.l;
315 arg[iarg].type =
'i';
316 arglist[iarg] = (
void*) &
arg[iarg].u.i;
323 arg[iarg].type =
'd';
324 arglist[iarg] = (
void*) &
arg[iarg].u.d;
326 arg[iarg].type =
'f';
327 arglist[iarg] = (
void*) &
arg[iarg].u.f;
339 if (!((
i == 1) || ((
i == 2) && (pf[-1] ==
'^')))) {
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;
355 if (islong || sawnum) {
358 arg[iarg].type =
'c';
359 arglist[iarg] = (
void*) &
arg[iarg].u.c;
367 if (!
ifarg(iarg + 2)) {
373 sprintf(errbuf,
"arg %d must be a string", iarg + 2);
379 sprintf(errbuf,
"arg %d must be a pointer to a number", iarg + 2);
392 n = sscanf(
buf,
format, arglist[0], arglist[1], arglist[2]);
393 }
else if (iarg < 13) {
414 for (
i = 0;
i <
n; ++
i) {
438 sprintf(errbuf,
"incomplete format specifier for arg %d", iarg + 3);
441 sprintf(errbuf,
"unknown conversion specifier for arg %d", iarg + 3);
444 sprintf(errbuf,
"missing arg %d", iarg + 2);
449 sprintf(errbuf,
"too many ( > %d) args", iarg + 2);
452 for (
i = 0;
i < iarg; ++
i) {
465 static char stdoutfile[] =
"/systmp.tmp";
472 n = strlen(
gargstr(1)) + strlen(stdoutfile);
475 d = (double) system(st->
buf);
477 if ((
fp =
fopen(stdoutfile,
"r")) == (FILE*) 0) {
478 hoc_execerror(
"Internal error in System(): can't open", stdoutfile);
480 while (fgets(st->
buf, 255,
fp) == st->
buf) {
485 IGNORE(unlink(stdoutfile));
486 }
else if (
ifarg(2)) {
500 i += strlen(
line->buf);
511 d = (double) system(
gargstr(1));
549 Printf(
"\n\nSymbol list %s\n\n", s);
566 Printf(
"ARRAY USERDOUBLE");
644 if (val > high || val < low) {
645 hoc_execerror(
"Arg out of range in user function", (
char*) 0);
672 if (strlen(str) > BUFSIZ - 20) {
679 sprintf(s,
"hoc_ac_ = %s\n", str);
704 if (strlen(str) > BUFSIZ - 10) {
730 if (strlen(s) > BUFSIZ - 20) {
733 sprintf(
buf->buf,
"{hoc_pointer_(&%s)}\n", s);
762 x = (s->
type == OBJECTVAR) ? 2 : x;
763 x = (s->
type == SECTION) ? 3 : x;
765 x = (s->
type == VAR) ? 5 : x;
766 if (x == 5 && arg2 == 2) {
void setneuronhome(const char *)
float * hoc_sym_domain(Symbol *sym)
Symlist * hoc_top_level_symlist
void hoc_Symbol_limits(void)
static void symdebug(const char *s, Symlist *list)
void hoc_symbol_tolerance(Symbol *sym, double tol)
Symbol * hoc_table_lookup(const char *, Symlist *)
void hoc_neuronhome(void)
char * neuronhome_forward(void)
Symbol * hoc_name2sym(const char *name)
char * hoc_back2forward(char *)
void hoc_name_declared(void)
static int hoc_vsscanf(const char *buf)
static struct @29 type_sym[]
Symlist * hoc_built_in_symlist
void hoc_Symbol_units(void)
char ** hoc_pgargstr(int)
Symbol * hoc_get_last_pointer_symbol()
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)
static HocParmLimits limits[]
void hoc_execerror(const char *, const char *)
void hoc_run_stmt(Symbol *sym)
void sym_extra_alloc(Symbol *)
void hoc_pushstr(char **d)
HocSymExtension * hoc_var_extra(const char *name)
double chkarg(int, double low, double high)
double check_domain_limits(float *limits, double val)
Symbol * hoc_install(const char *, int, double, Symlist **)
int hoc_is_str_arg(int narg)
void hoc_assign_str(char **cpp, const char *buf)
double * hoc_val_pointer(const char *s)
Symbol * hoc_parse_expr(const char *str, Symlist **psymlist)
int hoc_oc(const char *buf)
double hoc_run_expr(Symbol *sym)
char * hoc_symbol_units(Symbol *sym, const char *units)
int hoc_is_double_arg(int narg)
char ** hoc_temp_charptr(void)
int hoc_xopen_run(Symbol *sp, const char *str)
void hoc_symbol_limits(Symbol *sym, float low, float high)
Symbol * hoc_lookup(const char *)
int hoc_is_pdouble_arg(int narg)
double * hoc_pgetarg(int narg)
Symbol * hoc_parse_stmt(const char *str, Symlist **psymlist)
char * fgets_unlimited(HocStr *s, NrnFILEWrap *f)
HocStr * hocstr_create(size_t size)
void hocstr_resize(HocStr *hs, size_t n)
void hocstr_delete(HocStr *hs)
static char line[MAXLINE]
FILE * popen(char *s1, char *s2)
char * emalloc(unsigned n)
int vsscanf(const char *str, const char *format, va_list args)
#define nrn_fw_delete(fw)
int const size_t const size_t n
char * hoc_forward2back(char *s)
HocStruct cTemplate * ctemplate
double xred(const char *prompt, double defalt, double min, double max)