From 5083324b4e6a981332f296a898d4a275bdff8449 Mon Sep 17 00:00:00 2001 From: Mike Gevaert Date: Fri, 30 Aug 2024 08:57:05 +0200 Subject: [PATCH] fix linking errors --- src/oc/code.cpp | 46 ++++++++--------- src/oc/code2.cpp | 6 +-- src/oc/debug.cpp | 11 ++-- src/oc/fileio.cpp | 26 +++++----- src/oc/hoc.cpp | 124 +++++++++++++++++++++++----------------------- src/oc/math.cpp | 10 ++-- src/oc/nonlin.cpp | 18 +++---- src/oc/plot.cpp | 8 +-- src/oc/plt.cpp | 4 +- src/oc/symbol.cpp | 26 +++++----- 10 files changed, 140 insertions(+), 139 deletions(-) diff --git a/src/oc/code.cpp b/src/oc/code.cpp index 68e848c5f4..f89fcd5f38 100644 --- a/src/oc/code.cpp +++ b/src/oc/code.cpp @@ -999,7 +999,7 @@ void hoc_varpush() { #define relative(pc) (pc + (pc)->i) -void forcode(void) { +void hoc_forcode(void) { double d; Inst* savepc = pc; /* loop body */ int isec; @@ -1283,7 +1283,7 @@ void for_segment1(void) { for_segment2(sym, mode); } -void ifcode(void) { +void hoc_ifcode(void) { double d; Inst* savepc = pc; /* then part */ @@ -1297,17 +1297,17 @@ void ifcode(void) { pc = relative(savepc + 2); /* next stmt */ } -void Break(void) /* break statement */ +void hoc_Break(void) /* break statement */ { hoc_returning = 2; } -void Continue(void) /* continue statement */ +void hoc_Continue(void) /* continue statement */ { hoc_returning = 3; } -void Stop(void) /* stop statement */ +void hoc_Stop(void) /* stop statement */ { hoc_returning = 4; } @@ -1386,7 +1386,7 @@ void hoc_push_frame(Symbol* sp, int narg) { /* helpful for explicit function cal fp->ob = hoc_thisobject; } -void pop_frame(void) { +void hoc_pop_frame(void) { int i; frameobj_clean(fp); for (i = 0; i < fp->nargs; i++) { @@ -1518,7 +1518,7 @@ void hoc_ret() { hoc_returning = 1; } -void funcret(void) /* return from a function */ +void hoc_funcret(void) /* return from a function */ { double d; if (fp->sp->type != FUNCTION) @@ -1528,7 +1528,7 @@ void funcret(void) /* return from a function */ hoc_pushx(d); } -void procret(void) /* return from a procedure */ +void hoc_procret(void) /* return from a procedure */ { if (fp->sp->type == FUNCTION) hoc_execerror(fp->sp->name, "(func) returns no value"); @@ -1687,7 +1687,7 @@ double hoc_opasgn(int op, double dest, double src) { } } -void argassign(void) /* store top of stack in argument */ +void hoc_argassign(void) /* store top of stack in argument */ { double d; int i, op; @@ -1755,7 +1755,7 @@ void hoc_argrefarg(void) { hoc_pushpx(pd); } -void bltin(void) /* evaluate built-in on top of stack */ +void hoc_bltin(void) /* evaluate built-in on top of stack */ { double d; d = hoc_xpop(); @@ -1824,7 +1824,7 @@ void hoc_autoobject(void) { /* AUTOOBJ symbol at pc+1. */ hoc_pushobj(&(cast(fp->argn[obs->u.u_auto]))); } -void eval(void) /* evaluate variable on stack */ +void hoc_eval(void) /* evaluate variable on stack */ { Objectdata* odsav; Object* obsav = 0; @@ -1984,7 +1984,7 @@ void hoc_sub(void) /* subtract top two elems on stack */ hoc_pushx(d1); } -void mul(void) /* multiply top two elems on stack */ +void hoc_mul(void) /* multiply top two elems on stack */ { double d1, d2; d2 = hoc_xpop(); @@ -2036,7 +2036,7 @@ void hoc_negate() { hoc_pushx(-d); } -void gt(void) { +void hoc_gt(void) { double d1, d2; d2 = hoc_xpop(); d1 = hoc_xpop(); @@ -2052,7 +2052,7 @@ void hoc_lt() { hoc_pushx(d1); } -void ge(void) { +void hoc_ge(void) { double d1, d2; d2 = hoc_xpop(); d1 = hoc_xpop(); @@ -2060,7 +2060,7 @@ void ge(void) { hoc_pushx(d1); } -void le(void) { +void hoc_le(void) { double d1, d2; d2 = hoc_xpop(); d1 = hoc_xpop(); @@ -2269,7 +2269,7 @@ void hoc_assign_str(char** cpp, const char* buf) { } } -void assstr(void) { /* assign string on top to stack - 1 */ +void hoc_assstr(void) { /* assign string on top to stack - 1 */ char **ps1, **ps2; ps1 = hoc_strpop(); @@ -2406,7 +2406,7 @@ void hoc_prexpr() { hoc_plprint(s->buf); } -void prstr(void) /* print string value */ +void hoc_prstr(void) /* print string value */ { static HocStr* s; char** cpp; @@ -2454,7 +2454,7 @@ void hoc_newline(void) /* print newline */ hoc_plprint("\n"); } -void varread(void) /* read into variable */ +void hoc_varread(void) /* read into variable */ { double d = 0.0; extern NrnFILEWrap* hoc_fin; @@ -2491,12 +2491,12 @@ static Inst* codechk(void) { return hoc_progp++; } -Inst* Code(Pfrv f) { /* install one instruction or operand */ +Inst* hoc_Code(Pfrv f) { /* install one instruction or operand */ hoc_progp->pf = f; return codechk(); } -Inst* codei(int f) { +Inst* hoc_codei(int f) { hoc_progp->pf = NULL; /* zero high order bits to avoid debugzz problem */ hoc_progp->i = f; return codechk(); @@ -2507,17 +2507,17 @@ Inst* hoc_codeptr(void* vp) { return codechk(); } -void codesym(Symbol* f) { +void hoc_codesym(Symbol* f) { hoc_progp->sym = f; IGNORE(codechk()); } -void codein(Inst* f) { +void hoc_codein(Inst* f) { hoc_progp->in = f; IGNORE(codechk()); } -void insertcode(Inst* begin, Inst* end, Pfrv f) { +void hoc_insertcode(Inst* begin, Inst* end, Pfrv f) { Inst* i; for (i = end - 1; i != begin; i--) { *i = *(i - 1); diff --git a/src/oc/code2.cpp b/src/oc/code2.cpp index f5bdd2c0b4..fc89f53b70 100644 --- a/src/oc/code2.cpp +++ b/src/oc/code2.cpp @@ -454,7 +454,7 @@ static int hoc_vsscanf(const char* buf) { return n; } -void System(void) { +void hoc_System(void) { extern int hoc_plttext; static char stdoutfile[] = "/systmp.tmp"; double d; @@ -509,7 +509,7 @@ void System(void) { hoc_pushx(d); } -void Xred(void) /* read with prompt string and default and limits */ +void hoc_Xred(void) /* read with prompt string and default and limits */ { double d; @@ -589,7 +589,7 @@ static void symdebug(const char* s, Symlist* list) /* for debugging display the } } -void symbols(void) /* display the types above */ +void hoc_symbols(void) /* display the types above */ { int i, j; Symbol* sp; diff --git a/src/oc/debug.cpp b/src/oc/debug.cpp index 2b086ad7db..f46311bb55 100644 --- a/src/oc/debug.cpp +++ b/src/oc/debug.cpp @@ -4,16 +4,17 @@ #include "code.h" #include "equation.h" #include -int zzdebug; + +int hoc_zzdebug; #define prcod(c1, c2) else if (p->pf == c1) Printf("%p %p %s", p, p->pf, c2) -void debug(void) /* print the machine */ +void hoc_debug(void) /* print the machine */ { - if (zzdebug == 0) - zzdebug = 1; + if (hoc_zzdebug == 0) + hoc_zzdebug = 1; else - zzdebug = 0; + hoc_zzdebug = 0; } /* running copy of calls to execute */ diff --git a/src/oc/fileio.cpp b/src/oc/fileio.cpp index c554c5cbdb..e62e2c7ea8 100644 --- a/src/oc/fileio.cpp +++ b/src/oc/fileio.cpp @@ -20,7 +20,7 @@ extern char* neuron_home; NrnFILEWrap* hoc_frin; -FILE* fout; +FILE* hoc_fout; void hoc_stdout(void) { static int prev = -1; @@ -53,7 +53,7 @@ void hoc_stdout(void) { hoc_pushx((double) fileno(stdout)); } -void ropen(void) /* open file for reading */ +void hoc_ropen(void) /* open file for reading */ { double d; const char* fname; @@ -81,7 +81,7 @@ void ropen(void) /* open file for reading */ hoc_pushx(d); } -void wopen(void) /* open file for writing */ +void hoc_wopen(void) /* open file for writing */ { const char* fname; double d; @@ -91,14 +91,14 @@ void wopen(void) /* open file for writing */ else fname = ""; d = 1.; - if (fout != stdout) { - IGNORE(fclose(fout)); + if (hoc_fout != stdout) { + IGNORE(fclose(hoc_fout)); } - fout = stdout; + hoc_fout = stdout; if (fname[0] != 0) { - if ((fout = fopen(expand_env_var(fname), "w")) == nullptr) { + if ((hoc_fout = fopen(expand_env_var(fname), "w")) == nullptr) { d = 0.; - fout = stdout; + hoc_fout = stdout; } } errno = 0; @@ -225,7 +225,7 @@ int hoc_xopen1(const char* name, const char* rcs) { return 0; } -void xopen(void) /* read and execute a hoc program */ +void hoc_xopen(void) /* read and execute a hoc program */ { if (ifarg(2)) { hoc_xopen1(gargstr(1), gargstr(2)); @@ -236,18 +236,18 @@ void xopen(void) /* read and execute a hoc program */ hoc_pushx(1.); } -void Fprint(void) /* fprintf function */ +void hoc_Fprint(void) /* fprintf function */ { char* buf; double d; hoc_sprint1(&buf, 1); - d = (double) fprintf(fout, "%s", buf); + d = (double) fprintf(hoc_fout, "%s", buf); hoc_ret(); hoc_pushx(d); } -void PRintf(void) /* printf function */ +void hoc_PRintf(void) /* printf function */ { char* buf; double d; @@ -315,7 +315,7 @@ double hoc_fw_scan(NrnFILEWrap* fi) { return d; } -void Fscan(void) /* read a number from input file */ +void hoc_Fscan(void) /* read a number from input file */ { double d; NrnFILEWrap* fi; diff --git a/src/oc/hoc.cpp b/src/oc/hoc.cpp index 7e0e1316a7..ae76892f9d 100644 --- a/src/oc/hoc.cpp +++ b/src/oc/hoc.cpp @@ -112,7 +112,7 @@ extern void add_history(const char*); #endif int nrn_nobanner_; -int pipeflag; +int hoc_pipeflag; int hoc_usegui; #if 1 /* no longer necessary to distinguish signed from unsigned since EOF @@ -146,18 +146,18 @@ extern int hoc_print_first_instance; used to be a FILE* but had fopen problems when 128K cores on BG/P tried to fopen the same file for reading at once. */ -NrnFILEWrap* fin; /* input file pointer */ +NrnFILEWrap* hoc_fin; /* input file pointer */ #include const char* progname; /* for error messages */ -int lineno; +int hoc_lineno; #if HAVE_EXECINFO_H #include #endif #include int hoc_intset; /* safer interrupt handling */ -int indef; +int hoc_indef; const char* infile; /* input file name */ extern size_t hoc_xopen_file_size_; extern char* hoc_xopen_file_; @@ -205,7 +205,7 @@ int getnb(void) /* get next non-white character */ int c; /*EMPTY*/ - while ((c = Getc(fin)) == ' ' || c == '\t') { + while ((c = Getc(hoc_fin)) == ' ' || c == '\t') { ; } return c; @@ -228,10 +228,10 @@ static int eos; static char* optarray(char* buf) { int c; - if ((c = Getc(fin)) == '[') { + if ((c = Getc(hoc_fin)) == '[') { char* s = buf + strlen(buf); *s++ = c; - while (isdigit(c = Getc(fin)) && (s - buf) < 200) { + while (isdigit(c = Getc(hoc_fin)) && (s - buf) < 200) { *s++ = c; } if (c == ']') { @@ -242,7 +242,7 @@ static char* optarray(char* buf) { hoc_acterror(buf, " not literal name[int]"); } } else { - unGetc(c, fin); + unGetc(c, hoc_fin); } return buf; } @@ -266,7 +266,7 @@ int yylex(void) /* hoc6 */ } if (c == '/' && follow('*', 1, 0)) /* comment */ { - while ((c = Getc(fin)) != '*' || follow('/', 0, 1)) { + while ((c = Getc(hoc_fin)) != '*' || follow('/', 0, 1)) { if (c == EOF) return (0); /* if (c == YYNEEDMORE) {*/ @@ -280,31 +280,31 @@ int yylex(void) /* hoc6 */ { char* npt; double d; - IGNORE(unGetc(c, fin)); + IGNORE(unGetc(c, hoc_fin)); npt = (char*) hoc_ctp; /*EMPTY*/ - while (isdigit(c = Getc(fin))) { + while (isdigit(c = Getc(hoc_fin))) { ; } if (c == '.') { /*EMPTY*/ - while (isdigit(c = Getc(fin))) { + while (isdigit(c = Getc(hoc_fin))) { ; } } if (*npt == '.' && !isdigit(npt[1])) { - IGNORE(unGetc(c, fin)); + IGNORE(unGetc(c, hoc_fin)); return (int) (*npt); } if (c == 'E' || c == 'e') { - if (isdigit(c = Getc(fin)) || c == '+' || c == '-') { + if (isdigit(c = Getc(hoc_fin)) || c == '+' || c == '-') { /*EMPTY*/ - while (isdigit(c = Getc(fin))) { + while (isdigit(c = Getc(hoc_fin))) { ; } } } - IGNORE(unGetc(c, fin)); + IGNORE(unGetc(c, hoc_fin)); IGNORE(sscanf(npt, "%lf", &d)); if (d == 0.) return NUMZERO; @@ -320,8 +320,8 @@ int yylex(void) /* hoc6 */ hoc_execerror("Name too long:", sbuf); } *p++ = c; - } while ((c = Getc(fin)) != EOF && (isalnum(c) || c == '_')); - IGNORE(unGetc(c, fin)); + } while ((c = Getc(hoc_fin)) != EOF && (isalnum(c) || c == '_')); + IGNORE(unGetc(c, hoc_fin)); *p = '\0'; if (strncmp(sbuf, "__nrnsec_0x", 11) == 0) { yylval.ptr = hoc_sec_internal_name2ptr(sbuf, 1); @@ -349,8 +349,8 @@ int yylex(void) /* hoc6 */ if (nrn_parsing_pysec_) { yylval.ptr = hoc_pysec_name2ptr(optarray(sbuf), 1); if (nrn_parsing_pysec_ > (void*) 1) { /* there will be a second part */ - c = Getc(fin); - unGetc(c, fin); + c = Getc(hoc_fin); + unGetc(c, hoc_fin); if (c != '.') { /* so there must be a . */ nrn_parsing_pysec_ = NULL; hoc_acterror( @@ -384,9 +384,9 @@ int yylex(void) /* hoc6 */ yylval.narg = 0; return retval; } - while (isdigit(c = Getc(fin))) + while (isdigit(c = Getc(hoc_fin))) n = 10 * n + c - '0'; - IGNORE(unGetc(c, fin)); + IGNORE(unGetc(c, hoc_fin)); if (n == 0) hoc_acterror("strange $...", (char*) 0); yylval.narg = n; @@ -400,7 +400,7 @@ int yylex(void) /* hoc6 */ if (!sbuf) { sbuf = hocstr_create(256); } - for (p = sbuf->buf; (c = Getc(fin)) != '"'; p++) { + for (p = sbuf->buf; (c = Getc(hoc_fin)) != '"'; p++) { if (c == '\n' || c == EOF || c == YYNEEDMORE) hoc_acterror("missing quote", ""); n = p - sbuf->buf; @@ -488,7 +488,7 @@ static int backslash(int c) { /* get next char with \'s interpreted */ static char transtab[] = "b\bf\fn\nr\rt\t"; if (c != '\\') return c; - c = Getc(fin); + c = Getc(hoc_fin); if (islower(c) && strchr(transtab, c)) return strchr(transtab, c)[1]; return c; @@ -496,15 +496,15 @@ static int backslash(int c) { /* get next char with \'s interpreted */ static int follow(int expect, int ifyes, int ifno) /* look ahead for >=, etc. */ { - int c = Getc(fin); + int c = Getc(hoc_fin); if (c == expect) return ifyes; - IGNORE(unGetc(c, fin)); + IGNORE(unGetc(c, hoc_fin)); return ifno; } -void arayinstal(void) /* allocate storage for arrays */ +void hoc_arayinstal(void) /* allocate storage for arrays */ { int i, nsub; Symbol* sp; @@ -586,8 +586,8 @@ void hoc_free_arrayinfo(Arrayinfo* a) { } } -void defnonly(const char* s) { /* warn if illegal definition */ - if (!indef) +void hoc_defnonly(const char* s) { /* warn if illegal definition */ + if (!hoc_indef) hoc_acterror(s, "used outside definition"); } @@ -780,8 +780,8 @@ int hoc_main1_inited_; /* has got to be called first. oc can only be event driven after this returns */ void hoc_main1_init(const char* pname, const char** envp) { - extern NrnFILEWrap* frin; - extern FILE* fout; + extern NrnFILEWrap* hoc_frin; + extern FILE* hoc_fout; if (!hoc_xopen_file_) { hoc_xopen_file_size_ = 200; @@ -791,7 +791,7 @@ void hoc_main1_init(const char* pname, const char** envp) { hoc_promptstr = "oc>"; yystart = 1; - lineno = 0; + hoc_lineno = 0; if (hoc_main1_inited_) { return; } @@ -812,8 +812,8 @@ void hoc_main1_init(const char* pname, const char** envp) { hoc_cbufstr = hocstr_create(CBUFSIZE); hoc_cbuf = hoc_cbufstr->buf; hoc_ctp = hoc_cbuf; - frin = nrn_fw_set_stdin(); - fout = stdout; + hoc_frin = nrn_fw_set_stdin(); + hoc_fout = stdout; if (!nrn_is_cable()) { Fprintf(stderr, "OC INTERPRETER %s %s\n", RCS_hoc_version, RCS_hoc_date); Fprintf(stderr, @@ -1038,15 +1038,15 @@ static const char* double_at2space(const char* infile) { #endif /*MINGW*/ int hoc_moreinput() { - if (pipeflag) { - pipeflag = 0; + if (hoc_pipeflag) { + hoc_pipeflag = 0; return 1; } #if defined(WIN32) /* like mswin, do not need a '-' after hoc files, but ^D works */ if (gargc == 0 && cygonce == 0) { cygonce = 1; - fin = nrn_fw_set_stdin(); + hoc_fin = nrn_fw_set_stdin(); infile = 0; hoc_xopen_file_[0] = 0; #if defined(USE_PYTHON) @@ -1056,10 +1056,10 @@ int hoc_moreinput() { #endif } #endif // WIN32 - if (fin && !nrn_fw_eq(fin, stdin)) { - IGNORE(nrn_fw_fclose(fin)); + if (hoc_fin && !nrn_fw_eq(hoc_fin, stdin)) { + IGNORE(nrn_fw_fclose(hoc_fin)); } - fin = nrn_fw_set_stdin(); + hoc_fin = nrn_fw_set_stdin(); infile = 0; hoc_xopen_file_[0] = 0; if (gargc-- <= 0) { @@ -1085,7 +1085,7 @@ int hoc_moreinput() { it back */ infile = double_at2space(infile); #endif - lineno = 0; + hoc_lineno = 0; #if defined(USE_PYTHON) if (use_python_interpreter) { /* deal only with .hoc files. The hoc files are intended @@ -1098,7 +1098,7 @@ int hoc_moreinput() { } #endif if (strcmp(infile, "-") == 0) { - fin = nrn_fw_set_stdin(); + hoc_fin = nrn_fw_set_stdin(); infile = 0; hoc_xopen_file_[0] = 0; } else if (strcmp(infile, "-parallel") == 0) { @@ -1118,7 +1118,7 @@ int hoc_moreinput() { std::snprintf(hs->buf, hs->size + 1, "%s\n", infile); /* now infile is a hoc statement */ hpfi = hoc_print_first_instance; - fin = (NrnFILEWrap*) 0; + hoc_fin = (NrnFILEWrap*) 0; hoc_print_first_instance = 0; // This is processing HOC code via -c on the commandline. That HOC code could include // nrnpython(...), so the Python interpreter needs to be configured appropriately for @@ -1141,7 +1141,7 @@ int hoc_moreinput() { hoc_execerror("Python error", infile); } return hoc_moreinput(); - } else if ((fin = nrn_fw_fopen(infile, "r")) == (NrnFILEWrap*) 0) { + } else if ((hoc_fin = nrn_fw_fopen(infile, "r")) == (NrnFILEWrap*) 0) { Fprintf(stderr, "%d %s: can't open %s\n", nrnmpi_myid_world, progname, infile); #if NRNMPI if (nrnmpi_numprocs_world > 1) { @@ -1318,15 +1318,15 @@ static void nrn_inputbuf_getline(void) { // used by ocjump.cpp void oc_save_input_info(const char** i1, int* i2, int* i3, NrnFILEWrap** i4) { *i1 = nrn_inputbufptr; - *i2 = pipeflag; - *i3 = lineno; - *i4 = fin; + *i2 = hoc_pipeflag; + *i3 = hoc_lineno; + *i4 = hoc_fin; } void oc_restore_input_info(const char* i1, int i2, int i3, NrnFILEWrap* i4) { nrn_inputbufptr = i1; - pipeflag = i2; - lineno = i3; - fin = i4; + hoc_pipeflag = i2; + hoc_lineno = i3; + hoc_fin = i4; } int hoc_oc(const char* buf) { @@ -1370,7 +1370,7 @@ int hoc_oc(const char* buf, std::ostream& os) { return 0; } -void warning(const char* s, const char* t) /* print warning message */ +void hoc_warning(const char* s, const char* t) /* print warning message */ { CHAR* cp; char id[10]; @@ -1386,9 +1386,9 @@ void warning(const char* s, const char* t) /* print warning message */ Fprintf(stderr, "%s%s: %s\n", id, progname, s); } if (hoc_xopen_file_ && hoc_xopen_file_[0]) { - Fprintf(stderr, "%s in %s near line %d\n", id, hoc_xopen_file_, lineno); + Fprintf(stderr, "%s in %s near line %d\n", id, hoc_xopen_file_, hoc_lineno); } else { - Fprintf(stderr, "%s near line %d\n", id, lineno); + Fprintf(stderr, "%s near line %d\n", id, hoc_lineno); } n = strlen(hoc_cbuf); for (cp = hoc_cbuf; cp < (hoc_cbuf + n); ++cp) { @@ -1423,7 +1423,7 @@ static int Getc(NrnFILEWrap* fp) { #if 0 /* don't allow parser to block. Actually partial statements were never allowed anyway */ - if (!pipeflag && nrn_fw_eq(fp,stdin)) { + if (!hoc_pipeflag && nrn_fw_eq(fp,stdin)) { eos = 1; return 0; } @@ -1634,12 +1634,12 @@ int hoc_get_line(void) { /* supports re-entry. fill hoc_cbuf with next line */ } hoc_ctp = hoc_cbuf = hoc_cbufstr->buf; *hoc_ctp = '\0'; - if (pipeflag == 3) { + if (hoc_pipeflag == 3) { nrn_inputbuf_getline(); if (*hoc_ctp == '\0') { return EOF; } - } else if (pipeflag) { + } else if (hoc_pipeflag) { if (hoc_strgets_need() > hoc_cbufstr->size) { hocstr_resize(hoc_cbufstr, hoc_strgets_need() + 100); } @@ -1648,7 +1648,7 @@ int hoc_get_line(void) { /* supports re-entry. fill hoc_cbuf with next line */ } } else { #if READLINE - if (nrn_fw_eq(fin, stdin) && nrn_istty_) { + if (nrn_fw_eq(hoc_fin, stdin) && nrn_istty_) { char* line; int n; #if INTERVIEWS @@ -1705,18 +1705,18 @@ int hoc_get_line(void) { /* supports re-entry. fill hoc_cbuf with next line */ hoc_audit_command(hoc_cbuf); } else { fflush(stdout); - if (hoc_fgets_unlimited(hoc_cbufstr, fin) == (CHAR*) 0) { + if (hoc_fgets_unlimited(hoc_cbufstr, hoc_fin) == (CHAR*) 0) { return EOF; } } #else // READLINE #if INTERVIEWS - if (nrn_fw_eq(fin, stdin) && hoc_interviews && !hoc_in_yyparse) { + if (nrn_fw_eq(hoc_fin, stdin) && hoc_interviews && !hoc_in_yyparse) { run_til_stdin()); } #endif // INTERVIEWS #if defined(WIN32) - if (nrn_fw_eq(fin, stdin)) { + if (nrn_fw_eq(hoc_fin, stdin)) { if (gets(hoc_cbuf) == (char*) 0) { /*DebugMessage("gets returned NULL\n");*/ return EOF; @@ -1725,14 +1725,14 @@ int hoc_get_line(void) { /* supports re-entry. fill hoc_cbuf with next line */ } else #endif // WIN32 { - if (hoc_fgets_unlimited(hoc_cbufstr, fin) == (char*) 0) { + if (hoc_fgets_unlimited(hoc_cbufstr, hoc_fin) == (char*) 0) { return EOF; } } #endif // READLINE } errno = 0; - lineno++; + hoc_lineno++; hoc_ctp = hoc_cbuf = hoc_cbufstr->buf; hoc_ictp = 0; return 1; diff --git a/src/oc/math.cpp b/src/oc/math.cpp index 38b73b26fa..8814ee6621 100644 --- a/src/oc/math.cpp +++ b/src/oc/math.cpp @@ -50,12 +50,12 @@ void hoc_atan2(void) { hoc_pushx(d); } -double Log(double x) { +double hoc_Log(double x) { clear_fe_except(); return errcheck(log(x), "log"); } -double Log10(double x) { +double hoc_Log10(double x) { clear_fe_except(); return errcheck(log10(x), "log10"); } @@ -95,17 +95,17 @@ double hoc1_Exp(double x) { return errcheck(exp(x), "exp"); } -double Sqrt(double x) { +double hoc_Sqrt(double x) { clear_fe_except(); return errcheck(sqrt(x), "sqrt"); } -double Pow(double x, double y) { +double hoc_Pow(double x, double y) { clear_fe_except(); return errcheck(pow(x, y), "exponentiation"); } -double integer(double x) { +double hoc_integer(double x) { if (x < 0) { return (double) (long) (x - EPS); } else { diff --git a/src/oc/nonlin.cpp b/src/oc/nonlin.cpp index f4880f6ae0..e98969f293 100644 --- a/src/oc/nonlin.cpp +++ b/src/oc/nonlin.cpp @@ -9,9 +9,9 @@ #include "code.h" -int do_equation; /* switch for determining access to dep vars */ -int* hoc_access; /* links to next accessed variables */ -int hoc_var_access; /* variable number as pointer into access array */ +int hoc_do_equation; /* switch for determining access to dep vars */ +int* hoc_access; /* links to next accessed variables */ +int hoc_var_access; /* variable number as pointer into access array */ static double** varble; /* pointer to symbol values */ @@ -89,9 +89,9 @@ void hoc_eqn_name(void) /* save row number for lhs and/or rhs */ set_varble(); } init_access(); - do_equation = 1; + hoc_do_equation = 1; hoc_eval(); - do_equation = 0; + hoc_do_equation = 0; if (hoc_var_access < 1) hoc_execerror("illegal equation name", (hoc_pc - 2)->sym->name); row = hoc_var_access; @@ -123,7 +123,7 @@ static void set_varble(void) { /* set up varble array by searching for tags */ static double Delta = .001; /* variable variation */ -void eqinit(void) /* built in function to initialize equation solver */ +void hoc_eqinit(void) /* built in function to initialize equation solver */ { #if !OCSMALL Symbol* sp; @@ -176,9 +176,9 @@ static void eqn_side(int lhs) { Inst* savepc = hoc_pc; init_access(); - do_equation = 1; + hoc_do_equation = 1; hoc_execute(savepc); - do_equation = 0; + hoc_do_equation = 0; if (lhs) { f0 = hoc_xpop(); @@ -251,7 +251,7 @@ void hoc_Prmat(void) { hoc_pushx(1.); } -void solve(void) { +void hoc_solve(void) { #if !OCSMALL /* Sum is a measure of the dependent variable accuracy and how well the equations are solved */ diff --git a/src/oc/plot.cpp b/src/oc/plot.cpp index 7100b11bd1..e62f36c58c 100644 --- a/src/oc/plot.cpp +++ b/src/oc/plot.cpp @@ -91,7 +91,7 @@ static void hoc_x11plot(int, double, double); static void hard_text_preamble(); -void plprint(const char* s) { +void hoc_plprint(const char* s) { char buf[128]; if (text && s[strlen(s) - 1] == '\n') { @@ -182,7 +182,7 @@ void hoc_close_plot(void) { #endif } -void plt(int mode, double x, double y) { +void hoc_plt(int mode, double x, double y) { if (x < 0.) x = 0.; if (x > 1000.) @@ -341,7 +341,7 @@ static void hardplot_file(const char* s) { } void Fig_file(const char* s, int dev) { - plt(-1, 0., 0.); + hoc_plt(-1, 0., 0.); hardplot_file(s); if (!hpdev) return; @@ -543,7 +543,7 @@ void vtplot(int mode, double x, double y) { } #endif /*VT*/ -int set_color(int c) { +int hoc_set_color(int c) { hoc_color = c; #if SUNCORE set_line_index(c); diff --git a/src/oc/plt.cpp b/src/oc/plt.cpp index a80f27ce70..89bf8561ff 100644 --- a/src/oc/plt.cpp +++ b/src/oc/plt.cpp @@ -11,7 +11,7 @@ extern void Fig_file(const char*, int); #ifndef MINGW -void Plt(void) { +void hoc_Plt(void) { TRY_GUI_REDIRECT_DOUBLE("plt", NULL); int mode; double x, y; @@ -33,7 +33,7 @@ void Plt(void) { hoc_pushx(1.); } -void Setcolor(void) { +void hoc_Setcolor(void) { TRY_GUI_REDIRECT_DOUBLE("setcolor", NULL); double i; i = hoc_set_color((int) *getarg(1)); diff --git a/src/oc/symbol.cpp b/src/oc/symbol.cpp index 50edc119ad..0574c8c343 100644 --- a/src/oc/symbol.cpp +++ b/src/oc/symbol.cpp @@ -30,11 +30,11 @@ Symlist* hoc_top_level_symlist = nullptr; /* all user names seen at top-level (non-public names inside templates do not appear here) */ extern Objectdata* hoc_top_level_data; -Symlist* symlist = nullptr; /* the current user symbol table: linked list */ -Symlist* p_symlist = nullptr; /* current proc, func, or temp table */ - /* containing constants, strings, and auto */ - /* variables. Discarding these lists at */ - /* appropriate times prevents storage leakage. */ +Symlist* hoc_symlist = nullptr; /* the current user symbol table: linked list */ +Symlist* hoc_p_symlist = nullptr; /* current proc, func, or temp table */ + /* containing constants, strings, and auto */ + /* variables. Discarding these lists at */ + /* appropriate times prevents storage leakage. */ void print_symlist(const char* s, Symlist* tab) { Printf("%s\n", s); @@ -60,10 +60,10 @@ Symbol* hoc_lookup(const char* s) /* find s in symbol table */ { Symbol* sp; - if ((sp = hoc_table_lookup(s, p_symlist)) != nullptr) { + if ((sp = hoc_table_lookup(s, hoc_p_symlist)) != nullptr) { return sp; } - if ((sp = hoc_table_lookup(s, symlist)) != nullptr) { + if ((sp = hoc_table_lookup(s, hoc_symlist)) != nullptr) { return sp; } if ((sp = hoc_table_lookup(s, hoc_built_in_symlist)) != nullptr) { @@ -73,11 +73,11 @@ Symbol* hoc_lookup(const char* s) /* find s in symbol table */ return nullptr; /* nullptr ==> not found */ } -Symbol* install(/* install s in the list symbol table */ - const char* s, - int t, - double d, - Symlist** list) { +Symbol* hoc_install(/* install s in the list symbol table */ + const char* s, + int t, + double d, + Symlist** list) { Symbol* sp = (Symbol*) emalloc(sizeof(Symbol)); sp->name = (char*) emalloc((unsigned) (strlen(s) + 1)); /* +1 for '\0' */ Strcpy(sp->name, s); @@ -120,7 +120,7 @@ Symbol* install(/* install s in the list symbol table */ } Symbol* hoc_install_var(const char* name, double* pval) { - Symbol* s = hoc_install(name, UNDEF, 0., &symlist); + Symbol* s = hoc_install(name, UNDEF, 0., &hoc_symlist); s->type = VAR; s->u.pval = pval; s->subtype = USERDOUBLE;