From a76cd1e104963b5254945e94d79b25ae7383e373 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 17 Jul 2010 20:48:20 +0000 Subject: [PATCH] textual replacement VT_* to CP_*, to avoid conflict in the windows world --- ChangeLog | 9 +++ src/frontend/aspice.c | 8 +-- src/frontend/com_ahelp.c | 2 +- src/frontend/com_display.c | 2 +- src/frontend/com_fft.c | 4 +- src/frontend/com_ghelp.c | 24 ++++---- src/frontend/com_hardcopy.c | 8 +-- src/frontend/com_option.c | 10 +-- src/frontend/com_set.c | 12 ++-- src/frontend/com_shift.c | 2 +- src/frontend/com_strcmp.c | 2 +- src/frontend/control.c | 2 +- src/frontend/cpitf.c | 8 +-- src/frontend/device.c | 8 +-- src/frontend/diff.c | 6 +- src/frontend/display.c | 4 +- src/frontend/dotcards.c | 2 +- src/frontend/fourier.c | 6 +- src/frontend/hpgl.c | 2 +- src/frontend/init.c | 2 +- src/frontend/inp.c | 36 +++++------ src/frontend/inpcom.c | 16 ++--- src/frontend/measure.c | 2 +- src/frontend/misccoms.c | 2 +- src/frontend/nutinp.c | 2 +- src/frontend/options.c | 58 +++++++++--------- src/frontend/outitf.c | 10 +-- src/frontend/plotting/agraf.c | 8 +-- src/frontend/plotting/gnuplot.c | 4 +- src/frontend/plotting/graf.c | 10 +-- src/frontend/plotting/plotcurv.c | 6 +- src/frontend/plotting/plotit.c | 4 +- src/frontend/plotting/x11.c | 10 +-- src/frontend/plotting/xgraph.c | 4 +- src/frontend/postcoms.c | 12 ++-- src/frontend/postsc.c | 16 ++--- src/frontend/rawfile.c | 8 +-- src/frontend/runcoms.c | 2 +- src/frontend/runcoms2.c | 2 +- src/frontend/spec.c | 8 +-- src/frontend/spiceif.c | 34 +++++------ src/frontend/subckt.c | 14 ++--- src/frontend/terminal.c | 6 +- src/frontend/variable.c | 78 ++++++++++++------------ src/frontend/variable.h | 2 +- src/frontend/vectors.c | 22 +++---- src/frontend/wdisp/windisp.c | 14 ++--- src/include/cpextern.h | 10 +-- src/main.c | 12 ++-- src/maths/cmaths/cmath4.c | 4 +- src/maths/misc/randnumb.c | 2 +- src/nghelp.c | 2 +- src/spicelib/devices/bsim3/b3par.c | 2 +- src/spicelib/devices/bsim3/b3set.c | 2 +- src/spicelib/devices/bsim3soi/b4soiset.c | 2 +- src/spicelib/devices/bsim3v0/b3v0par.c | 2 +- src/spicelib/devices/bsim3v1/b3v1par.c | 2 +- src/spicelib/devices/bsim3v1a/b3v1apar.c | 2 +- src/spicelib/devices/bsim3v1s/b3v1spar.c | 2 +- src/spicelib/devices/bsim3v32/b3v32par.c | 2 +- src/spicelib/devices/bsim4/b4par.c | 2 +- src/spicelib/devices/bsim4/b4set.c | 2 +- src/spicelib/devices/bsim4v2/b4v2par.c | 2 +- src/spicelib/devices/bsim4v3/b4v3par.c | 2 +- src/spicelib/devices/bsim4v4/b4v4par.c | 2 +- src/spicelib/devices/bsim4v5/b4v5par.c | 2 +- src/spicelib/parser/inpgmod.c | 2 +- src/tclspice.c | 2 +- 68 files changed, 292 insertions(+), 283 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3992701a6..be2e36a58 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-07-17 Robert Larice + * src/* : + textual replacement VT_* to CP_* + these are the enum constans of `enum vp_types' . + VT_* is allready used in the windows world. + lets use CP_* to avoid conflicts. + replacement was done mechanical, with: + perl -pi -e 's/VT_(BOOL|NUM|REAL|STRING|LIST)/CP_\1/g' $(git grep -le '\bVT_') + 2010-07-17 Robert Larice * src/frontend/variable.c , * src/frontend/variable.h , diff --git a/src/frontend/aspice.c b/src/frontend/aspice.c index d4cbde2ab..68438b3f1 100644 --- a/src/frontend/aspice.c +++ b/src/frontend/aspice.c @@ -76,7 +76,7 @@ com_aspice(wordlist *wl) bool saveout = FALSE; deck = wl->wl_word; - if (!cp_getvar("spicepath", VT_STRING, spicepath)) { + if (!cp_getvar("spicepath", CP_STRING, spicepath)) { if (!Spice_Path || !*Spice_Path) { fprintf(cp_err, "No spice-3 binary is available for the aspice command.\n"); @@ -269,11 +269,11 @@ com_rspice(wordlist *wl) char *p; /* Figure out where the spicedaemon is and connect to it. */ - if (!cp_getvar("rhost", VT_STRING, rhost)) + if (!cp_getvar("rhost", CP_STRING, rhost)) (void) strcpy(rhost, Spice_Host); - if (!cp_getvar("rprogram", VT_STRING, program)) + if (!cp_getvar("rprogram", CP_STRING, program)) *program = '\0'; - if (!cp_getvar("remote_shell", VT_STRING, remote_shell)) + if (!cp_getvar("remote_shell", CP_STRING, remote_shell)) strcpy(remote_shell, "rsh"); if (*rhost == '\0') { diff --git a/src/frontend/com_ahelp.c b/src/frontend/com_ahelp.c index d7ebfc397..23e0cb661 100644 --- a/src/frontend/com_ahelp.c +++ b/src/frontend/com_ahelp.c @@ -39,7 +39,7 @@ com_ahelp(wordlist *wl) } /* determine level */ - if (cp_getvar("level", VT_STRING, slevel)) { + if (cp_getvar("level", CP_STRING, slevel)) { switch (*slevel) { case 'b': level = 1; break; diff --git a/src/frontend/com_display.c b/src/frontend/com_display.c index 71c0c2e31..847bb4a91 100644 --- a/src/frontend/com_display.c +++ b/src/frontend/com_display.c @@ -65,7 +65,7 @@ com_display(wordlist *wl) dvs = (struct dvec **) tmalloc(len * (sizeof (struct dvec *))); for (d = plot_cur->pl_dvecs, i = 0; d; d = d->v_next, i++) dvs[i] = d; - if (!cp_getvar("nosort", VT_BOOL, (char *) &b)) + if (!cp_getvar("nosort", CP_BOOL, (char *) &b)) qsort((char *) dvs, len, sizeof (struct dvec *), dcomp); out_printf("Title: %s\n", plot_cur->pl_title); diff --git a/src/frontend/com_fft.c b/src/frontend/com_fft.c index 3e001ba94..d37f09c2a 100644 --- a/src/frontend/com_fft.c +++ b/src/frontend/com_fft.c @@ -58,7 +58,7 @@ com_fft(wordlist *wl) { char window[BSIZE_SP]; double maxt = time[tlen-1]; - if (!cp_getvar("specwindow", VT_STRING, window)) + if (!cp_getvar("specwindow", CP_STRING, window)) strcpy(window,"blackman"); if (eq(window, "none")) for(i=0; iva_type) { - case VT_BOOL: + case CP_BOOL: s = (char *) &vars->va_bool; break; - case VT_NUM: + case CP_NUM: s = (char *) &vars->va_num; break; - case VT_REAL: + case CP_REAL: s = (char *) &vars->va_real; break; - case VT_STRING: + case CP_STRING: s = vars->va_string; break; - case VT_LIST: + case CP_LIST: s = (char *) vars->va_vlist; break; default: diff --git a/src/frontend/com_set.c b/src/frontend/com_set.c index 42c74993a..de6c204ea 100644 --- a/src/frontend/com_set.c +++ b/src/frontend/com_set.c @@ -25,19 +25,19 @@ com_set(wordlist *wl) /* This is sort of a hassle... */ while (vars) { switch (vars->va_type) { - case VT_BOOL: + case CP_BOOL: s = (char *) &vars->va_bool; break; - case VT_NUM: + case CP_NUM: s = (char *) &vars->va_num; break; - case VT_REAL: + case CP_REAL: s = (char *) &vars->va_real; break; - case VT_STRING: + case CP_STRING: s = vars->va_string; break; - case VT_LIST: + case CP_LIST: s = (char *) vars->va_vlist; break; default: @@ -48,7 +48,7 @@ com_set(wordlist *wl) vars = vars->va_next; /* va: avoid memory leak: free oldvar carefully */ tfree(oldvar->va_name); - if (oldvar->va_type==VT_STRING) + if (oldvar->va_type==CP_STRING) tfree(oldvar->va_string); /* copied in cp_vset */ /* don't free oldvar->va_list! This structure is used furthermore! */ tfree(oldvar); diff --git a/src/frontend/com_shift.c b/src/frontend/com_shift.c index 42e93bb36..c5bb7eef2 100644 --- a/src/frontend/com_shift.c +++ b/src/frontend/com_shift.c @@ -36,7 +36,7 @@ com_shift(wordlist *wl) fprintf(cp_err, "Error: %s: no such variable\n", n); return; } - if (v->va_type != VT_LIST) { + if (v->va_type != CP_LIST) { fprintf(cp_err, "Error: %s not of type list\n", n); return; } diff --git a/src/frontend/com_strcmp.c b/src/frontend/com_strcmp.c index 1a035397a..7e31eab82 100644 --- a/src/frontend/com_strcmp.c +++ b/src/frontend/com_strcmp.c @@ -23,6 +23,6 @@ com_strcmp(wordlist *wl) i = strcmp(s1, s2); tfree(s1);/*DG cp_unquote memory leak*/ tfree(s2); - cp_vset(var, VT_NUM, (char *) &i); + cp_vset(var, CP_NUM, (char *) &i); return; } diff --git a/src/frontend/control.c b/src/frontend/control.c index 2f5f15557..424194765 100644 --- a/src/frontend/control.c +++ b/src/frontend/control.c @@ -451,7 +451,7 @@ doblock(struct control *bl, int *num) for (wl = cp_variablesubst(cp_bquote(cp_doglob(wl_copy(bl->co_text)))); wl; wl = wl->wl_next) { - cp_vset(bl->co_foreachvar, VT_STRING, wl->wl_word); + cp_vset(bl->co_foreachvar, CP_STRING, wl->wl_word); for (ch = bl->co_children; ch; ch = cn) { cn = ch->co_next; i = doblock(ch, &nn); diff --git a/src/frontend/cpitf.c b/src/frontend/cpitf.c index 67d776580..bcca590d3 100644 --- a/src/frontend/cpitf.c +++ b/src/frontend/cpitf.c @@ -146,7 +146,7 @@ ft_cpinit(void) } } - cp_vset("program", VT_STRING, cp_program); + cp_vset("program", CP_STRING, cp_program); /* Make the prompt use only the last component of the path... */ @@ -166,9 +166,9 @@ ft_cpinit(void) } else (void) sprintf(buf, "%s ! -> ", cp_program); - cp_vset("prompt", VT_STRING, buf); - cp_vset("noglob", VT_BOOL, (char *) &t); - cp_vset("brief", VT_BOOL, (char *) &t); + cp_vset("prompt", CP_STRING, buf); + cp_vset("noglob", CP_BOOL, (char *) &t); + cp_vset("brief", CP_BOOL, (char *) &t); /* Make vectors from values in predefs[] for the current plot. Define functions from entries in udfs[] (like user defined functions). diff --git a/src/frontend/device.c b/src/frontend/device.c index ffe42b52d..d8992b31a 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -44,7 +44,7 @@ com_showmod(wordlist *wl) { bool showmode; - if (cp_getvar("altshow", VT_BOOL, (char *) &showmode)) + if (cp_getvar("altshow", CP_BOOL, (char *) &showmode)) all_show(wl, 1); else all_show_old(wl, 1); @@ -55,7 +55,7 @@ com_show(wordlist *wl) { bool showmode; - if (cp_getvar("altshow", VT_BOOL, (char *) &showmode)) + if (cp_getvar("altshow", CP_BOOL, (char *) &showmode)) all_show(wl, 0); else all_show_old(wl, 0); @@ -82,7 +82,7 @@ all_show(wordlist *wl, int mode) return; } - if (!cp_getvar("width", VT_NUM, (char *) &screen_width)) + if (!cp_getvar("width", CP_NUM, (char *) &screen_width)) screen_width = DEF_WIDTH; count = (screen_width - LEFT_WIDTH) / (DEV_WIDTH + 1); count = 1; @@ -246,7 +246,7 @@ all_show_old(wordlist *wl, int mode) return; } - if (!cp_getvar("width", VT_NUM, (char *) &screen_width)) + if (!cp_getvar("width", CP_NUM, (char *) &screen_width)) screen_width = DEF_WIDTH; count = (screen_width - LEFT_WIDTH) / (DEV_WIDTH + 1); diff --git a/src/frontend/diff.c b/src/frontend/diff.c index 8cc6bf8fa..64ddbec66 100644 --- a/src/frontend/diff.c +++ b/src/frontend/diff.c @@ -84,11 +84,11 @@ com_diff(wordlist *wl) wordlist *tw; char numbuf[BSIZE_SP],numbuf2[BSIZE_SP] ,numbuf3[BSIZE_SP], numbuf4[BSIZE_SP]; /* For printnum */ - if (!cp_getvar("diff_vntol", VT_REAL, (char *) &vntol)) + if (!cp_getvar("diff_vntol", CP_REAL, (char *) &vntol)) vntol = 1.0e-6; - if (!cp_getvar("diff_abstol", VT_REAL, (char *) &abstol)) + if (!cp_getvar("diff_abstol", CP_REAL, (char *) &abstol)) abstol = 1.0e-12; - if (!cp_getvar("diff_reltol", VT_REAL, (char *) &reltol)) + if (!cp_getvar("diff_reltol", CP_REAL, (char *) &reltol)) reltol = 0.001; /* Let's try to be clever about defaults. This code is ugly. */ diff --git a/src/frontend/display.c b/src/frontend/display.c index 689620053..28e9843f1 100644 --- a/src/frontend/display.c +++ b/src/frontend/display.c @@ -8,7 +8,7 @@ $Id$ #include #include #include -#include /* for VT_STRING */ +#include /* for CP_STRING */ #include /* for mylog() */ #ifdef TCL_MODULE @@ -152,7 +152,7 @@ DevInit(void) #ifndef X_DISPLAY_MISSING /* determine display type */ - if (getenv("DISPLAY") || cp_getvar("display", VT_STRING, buf)) { + if (getenv("DISPLAY") || cp_getvar("display", CP_STRING, buf)) { dispdev = FindDev("X11"); } #endif diff --git a/src/frontend/dotcards.c b/src/frontend/dotcards.c index bfacb71b7..f4d554004 100644 --- a/src/frontend/dotcards.c +++ b/src/frontend/dotcards.c @@ -284,7 +284,7 @@ ft_cktcoms(bool terse) continue; } i = atoi(++s); - cp_vset("width", VT_NUM, (char *) &i); + cp_vset("width", CP_NUM, (char *) &i); } } else if (eq(command->wl_word, ".print")) { if (terse) { diff --git a/src/frontend/fourier.c b/src/frontend/fourier.c index 737323b11..dd54ff79a 100644 --- a/src/frontend/fourier.c +++ b/src/frontend/fourier.c @@ -62,12 +62,12 @@ fourier(wordlist *wl, struct plot *current_plot) return 1; } - if ((!cp_getvar("nfreqs", VT_NUM, (char *) &nfreqs)) || (nfreqs < 1)) + if ((!cp_getvar("nfreqs", CP_NUM, (char *) &nfreqs)) || (nfreqs < 1)) nfreqs = 10; - if ((!cp_getvar("polydegree", VT_NUM, (char *) &polydegree)) || + if ((!cp_getvar("polydegree", CP_NUM, (char *) &polydegree)) || (polydegree < 0)) polydegree = 1; - if ((!cp_getvar("fourgridsize", VT_NUM, (char *) &fourgridsize)) || + if ((!cp_getvar("fourgridsize", CP_NUM, (char *) &fourgridsize)) || (fourgridsize < 1)) fourgridsize = DEF_FOURGRIDSIZE; diff --git a/src/frontend/hpgl.c b/src/frontend/hpgl.c index 16f0026ca..428490f3c 100644 --- a/src/frontend/hpgl.c +++ b/src/frontend/hpgl.c @@ -86,7 +86,7 @@ static int hcopygraphid; int GL_Init(void) { - if (!cp_getvar("hcopyscale", VT_STRING, psscale)) { + if (!cp_getvar("hcopyscale", CP_STRING, psscale)) { scale = 1.0; } else { sscanf(psscale, "%lf", &scale); diff --git a/src/frontend/init.c b/src/frontend/init.c index 73b65d6ff..108ad9eea 100644 --- a/src/frontend/init.c +++ b/src/frontend/init.c @@ -32,7 +32,7 @@ cp_init(void) /* break word to right or left of characters <>;&*/ cp_chars[(int) *s] = (CPC_BRR | CPC_BRL); - cp_vset("history", VT_NUM, (char *) &cp_maxhistlength); + cp_vset("history", CP_NUM, (char *) &cp_maxhistlength); cp_curin = stdin; cp_curout = stdout; diff --git a/src/frontend/inp.c b/src/frontend/inp.c index a539da160..5e790711a 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -150,7 +150,7 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type) if (useout) out_init(); - cp_getvar("renumber", VT_BOOL, (char *) &renumber); + cp_getvar("renumber", CP_BOOL, (char *) &renumber); if (type == LS_LOGICAL) { top1: for (here = deck; here; here = here->li_next) { @@ -512,10 +512,10 @@ inp_spsource(FILE *fp, bool comfile, char *filename) if ( temperature != NULL ) { temperature_value = atof(temperature); s = (char *) &temperature_value; - cp_vset("pretemp", VT_REAL, s ); + cp_vset("pretemp", CP_REAL, s ); } if (ft_ngdebug) { - cp_getvar( "pretemp", VT_REAL, (double *) &testemp ); + cp_getvar( "pretemp", CP_REAL, (double *) &testemp ); printf("test temperature %f\n", testemp); } /* We are done handling the control stuff. Now process remainder of deck. @@ -526,7 +526,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename) SetAnalyse( "Prepare Deck", 0); #endif /* Now expand subcircuit macros and substitute numparams.*/ - if (!cp_getvar("nosubckt", VT_BOOL, (char *) &nosubckts)) + if (!cp_getvar("nosubckt", CP_BOOL, (char *) &nosubckts)) if( (deck->li_next = inp_subcktexpand(deck->li_next)) == NULL ){ line_free(realdeck,TRUE); line_free(deck->li_actual, TRUE); @@ -598,7 +598,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename) } if ( ciprefix( ".meas", dd->li_line ) ) { - if ( cp_getvar( "autostop", VT_BOOL, (bool *) &autostop ) ) { + if ( cp_getvar( "autostop", CP_BOOL, (bool *) &autostop ) ) { if ( strstr( dd->li_line, " max " ) || strstr( dd->li_line, " min " ) || strstr( dd->li_line, " avg " ) || strstr( dd->li_line, " rms " ) || strstr( dd->li_line, " integ " ) ) { printf( "Warning: .OPTION AUTOSTOP will not be effective because one of 'max|min|avg|rms|integ' is used in .meas\n" ); @@ -625,7 +625,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename) if ( temperature != NULL ) { temperature_value = atof(temperature); s = (char *) &temperature_value; - cp_vset("temp", VT_REAL, s ); + cp_vset("temp", CP_REAL, s ); txfree(temperature); } @@ -722,7 +722,7 @@ inp_dodeck( } ft_curckt = ct = alloc(struct circ); } - cp_getvar("noparse", VT_BOOL, (char *) &noparse); + cp_getvar("noparse", CP_BOOL, (char *) &noparse); /* We check preliminary for the scale option. This special processing @@ -750,17 +750,17 @@ inp_dodeck( } for (eev = ct->ci_vars; eev; eev = eev->va_next) { switch (eev->va_type) { - case VT_BOOL: + case CP_BOOL: break; - case VT_NUM: + case CP_NUM: break; - case VT_REAL: + case CP_REAL: if ( strcmp("scale",eev->va_name)==0 ){ - cp_vset("scale", VT_REAL, (char*) &eev->va_real ); + cp_vset("scale", CP_REAL, (char*) &eev->va_real ); printf("Scale set\n"); } break; - case VT_STRING: + case CP_STRING: break; } /* switch . . . */ } @@ -822,7 +822,7 @@ inp_dodeck( } /* for (dd = deck; dd; dd = dd->li_next) */ /* Only print out netlist if brief is FALSE */ - cp_getvar( "brief", VT_BOOL, (bool *) &brief ); + cp_getvar( "brief", CP_BOOL, (bool *) &brief ); if(brief==FALSE) { /* output deck */ out_printf( "\nProcessed Netlist\n" ); @@ -888,19 +888,19 @@ inp_dodeck( for (eev = ct->ci_vars; eev; eev = eev->va_next) { one = 1; switch (eev->va_type) { - case VT_BOOL: + case CP_BOOL: if_option(ct->ci_ckt, eev->va_name, eev->va_type, &one); break; - case VT_NUM: + case CP_NUM: if_option(ct->ci_ckt, eev->va_name, eev->va_type, (char *) &eev->va_num); break; - case VT_REAL: + case CP_REAL: if_option(ct->ci_ckt, eev->va_name, eev->va_type, (char *) &eev->va_real); break; - case VT_STRING: + case CP_STRING: if_option(ct->ci_ckt, eev->va_name, eev->va_type, eev->va_string); break; @@ -1007,7 +1007,7 @@ doedit(char *filename) { char buf[BSIZE_SP], buf2[BSIZE_SP], *editor; - if (cp_getvar("editor", VT_STRING, buf2)) { + if (cp_getvar("editor", CP_STRING, buf2)) { editor = buf2; } else { if (!(editor = getenv("EDITOR"))) { diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 045aac123..a313e706e 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -181,7 +181,7 @@ inp_pathopen(char *name, char *mode) #if defined(HAS_WINDOWS) /* search in the path where the source (input) file has been found, but only if "name" is just a file name */ - if (!(index(name, DIR_TERM)) && cp_getvar("sourcefile", VT_STRING, buf2)) { + if (!(index(name, DIR_TERM)) && cp_getvar("sourcefile", CP_STRING, buf2)) { /* If pathname is found, get path. (char *dirname(const char *name) might have been used here) */ if (substring(DIR_PATHSEP, buf2)) { @@ -204,19 +204,19 @@ inp_pathopen(char *name, char *mode) * do an fopen. */ if (index(name, DIR_TERM) - || !cp_getvar("sourcepath", VT_LIST, (char *) &v)) + || !cp_getvar("sourcepath", CP_LIST, (char *) &v)) return (fopen(name, mode)); while (v) { switch (v->va_type) { - case VT_STRING: + case CP_STRING: cp_wstrip(v->va_string); (void) sprintf(buf, "%s%s%s", v->va_string, DIR_PATHSEP, name); break; - case VT_NUM: + case CP_NUM: (void) sprintf(buf, "%d%s%s", v->va_num, DIR_PATHSEP, name); break; - case VT_REAL: /* This is foolish */ + case CP_REAL: /* This is foolish */ (void) sprintf(buf, "%g%s%s", v->va_real, DIR_PATHSEP, name); break; } @@ -388,7 +388,7 @@ inp_add_control_section( struct line *deck, int *line_number ) { prev_card = newcard; found_run = TRUE; } - if ( cp_getvar( "rawfile", VT_STRING, rawfile ) ) { + if ( cp_getvar( "rawfile", CP_STRING, rawfile ) ) { line = (char*) tmalloc( strlen("write") + strlen(rawfile) + 2 ); sprintf(line, "write %s", rawfile); newcard = create_new_card( line, line_number ); @@ -407,7 +407,7 @@ inp_add_control_section( struct line *deck, int *line_number ) { deck->li_next = newcard; newcard->li_next = prev_card; - if ( cp_getvar( "rawfile", VT_STRING, rawfile ) ) { + if ( cp_getvar( "rawfile", CP_STRING, rawfile ) ) { line = (char*) tmalloc( strlen("write") + strlen(rawfile) + 2 ); sprintf(line, "write %s", rawfile); prev_card = deck->li_next; @@ -1612,7 +1612,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c inp_fix_gnd_name(working); inp_chk_for_multi_in_vcvs(working, &line_number); - if (cp_getvar("addcontrol", VT_BOOL, (char *) &v)) + if (cp_getvar("addcontrol", CP_BOOL, (char *) &v)) inp_add_control_section(working, &line_number); inp_compat_mode = ngspice_compat_mode() ; if (inp_compat_mode == COMPATMODE_ALL) { diff --git a/src/frontend/measure.c b/src/frontend/measure.c index e33a77f30..0d7f885d5 100644 --- a/src/frontend/measure.c +++ b/src/frontend/measure.c @@ -384,7 +384,7 @@ check_autostop( char* what ) { bool autostop; measures_passed = TRUE; - if ( cp_getvar( "autostop", VT_BOOL, (bool *) &autostop ) ) { + if ( cp_getvar( "autostop", CP_BOOL, (bool *) &autostop ) ) { do_measure( what, TRUE ); if ( measures_passed == TRUE ) flag = TRUE; diff --git a/src/frontend/misccoms.c b/src/frontend/misccoms.c index ad7b47ed9..d3d1eb204 100644 --- a/src/frontend/misccoms.c +++ b/src/frontend/misccoms.c @@ -35,7 +35,7 @@ com_quit(wordlist *wl) char buf[64]; bool noask; - (void) cp_getvar("noaskquit", VT_BOOL, (char *) &noask); + (void) cp_getvar("noaskquit", CP_BOOL, (char *) &noask); gr_clean(); cp_ccon(FALSE); if(wl) diff --git a/src/frontend/nutinp.c b/src/frontend/nutinp.c index 150c4aa36..93594f9f1 100644 --- a/src/frontend/nutinp.c +++ b/src/frontend/nutinp.c @@ -168,7 +168,7 @@ inp_nutsource(FILE *fp, bool comfile, char *filename) * fix the case before we do this but after we * deal with the commands. */ - if (!cp_getvar("nosubckt", VT_BOOL, (char *) + if (!cp_getvar("nosubckt", CP_BOOL, (char *) &nosubckts)) deck->li_next = inp_subcktexpand(deck-> li_next); diff --git a/src/frontend/options.c b/src/frontend/options.c index 608d19d9d..73a47a7c9 100644 --- a/src/frontend/options.c +++ b/src/frontend/options.c @@ -51,7 +51,7 @@ cp_enqvar(char *word) vv = alloc(struct variable); vv->va_name = copy(word); vv->va_next = NULL; - vv->va_type = VT_REAL; + vv->va_type = CP_REAL; if (isreal(d)) { vv->va_real = d->v_realdata[0]; } else { @@ -62,11 +62,11 @@ cp_enqvar(char *word) vv = alloc(struct variable); vv->va_next = NULL; vv->va_name = copy(word); - vv->va_type = VT_LIST; + vv->va_type = CP_LIST; vv->va_vlist = NULL; for (i = d->v_length - 1; i >= 0; i--) { tv = alloc(struct variable); - tv->va_type = VT_REAL; + tv->va_type = CP_REAL; if (isreal(d)) { tv->va_real = d->v_realdata[i]; } else { @@ -94,36 +94,36 @@ cp_enqvar(char *word) vv = alloc(struct variable); vv->va_next = NULL; vv->va_name = word; - vv->va_type = VT_STRING; + vv->va_type = CP_STRING; vv->va_string = copy(plot_cur->pl_name); } else if (eq(word, "curplottitle")) { vv = alloc(struct variable); vv->va_next = NULL; vv->va_name = word; - vv->va_type = VT_STRING; + vv->va_type = CP_STRING; vv->va_string = copy(plot_cur->pl_title); } else if (eq(word, "curplotdate")) { vv = alloc(struct variable); vv->va_next = NULL; vv->va_name = word; - vv->va_type = VT_STRING; + vv->va_type = CP_STRING; vv->va_string = copy(plot_cur->pl_date); } else if (eq(word, "curplot")) { vv = alloc(struct variable); vv->va_next = NULL; vv->va_name = word; - vv->va_type = VT_STRING; + vv->va_type = CP_STRING; vv->va_string = copy(plot_cur->pl_typename); } else if (eq(word, "plots")) { vv = alloc(struct variable); vv->va_next = NULL; vv->va_vlist = NULL; vv->va_name = word; - vv->va_type = VT_LIST; + vv->va_type = CP_LIST; vv->va_vlist = NULL; for (pl = plot_list; pl; pl = pl->pl_next) { tv = alloc(struct variable); - tv->va_type = VT_STRING; + tv->va_type = CP_STRING; tv->va_string = copy(pl->pl_typename); tv->va_next = vv->va_vlist; vv->va_vlist = tv; @@ -250,17 +250,17 @@ cp_usrset(struct variable *var, bool isset) bool bv; if (eq(var->va_name, "debug")) { - if (var->va_type == VT_BOOL) { + if (var->va_type == CP_BOOL) { cp_debug = ft_simdb = ft_parsedb = ft_evdb = ft_vecdb = ft_grdb = ft_gidb = ft_controldb = isset; - } else if (var->va_type == VT_LIST) { + } else if (var->va_type == CP_LIST) { for (tv = var->va_vlist; tv; tv = tv->va_next) - if (var->va_type != VT_STRING) + if (var->va_type != CP_STRING) fprintf(cp_err, "Error: bad type for debug var\n"); else setdb(tv->va_string); - } else if (var->va_type == VT_STRING) { + } else if (var->va_type == CP_STRING) { setdb(var->va_string); } else fprintf(cp_err, "Error: bad type for debug var\n"); @@ -293,20 +293,20 @@ cp_usrset(struct variable *var, bool isset) } else if (eq(var->va_name, "strictnumparse")) { ft_strictnumparse = isset; } else if (eq(var->va_name, "rawfileprec")) { - if ((var->va_type == VT_BOOL) && (isset == FALSE)) + if ((var->va_type == CP_BOOL) && (isset == FALSE)) raw_prec = -1; - else if (var->va_type == VT_REAL) + else if (var->va_type == CP_REAL) raw_prec = var->va_real; - else if (var->va_type == VT_NUM) + else if (var->va_type == CP_NUM) raw_prec = var->va_num; else fprintf(cp_err, "Bad 'rawfileprec' \"%s\"\n", var->va_name); } else if (eq(var->va_name, "numdgt")) { - if ((var->va_type == VT_BOOL) && (isset == FALSE)) + if ((var->va_type == CP_BOOL) && (isset == FALSE)) cp_numdgt = -1; - else if (var->va_type == VT_REAL) + else if (var->va_type == CP_REAL) cp_numdgt = var->va_real; - else if (var->va_type == VT_NUM) + else if (var->va_type == CP_NUM) cp_numdgt = var->va_num; else fprintf(cp_err, "Excuse me??\n"); @@ -321,32 +321,32 @@ cp_usrset(struct variable *var, bool isset) fprintf(cp_err, "Warning: no PATH in environment.\n"); } - } else if (eq(var->va_name, "units") && (var->va_type == VT_STRING)) { + } else if (eq(var->va_name, "units") && (var->va_type == CP_STRING)) { if (isset && ((*var->va_string == 'd') || (*var->va_string == 'D'))) cx_degrees = TRUE; else cx_degrees = FALSE; } else if (eq(var->va_name, "curplot")) { - if (var->va_type == VT_STRING) + if (var->va_type == CP_STRING) plot_setcur(var->va_string); else fprintf(cp_err, "Error: plot name not a string\n"); return (US_DONTRECORD); } else if (eq(var->va_name, "curplotname")) { - if (plot_cur && (var->va_type == VT_STRING)) + if (plot_cur && (var->va_type == CP_STRING)) plot_cur->pl_name = copy(var->va_string); else fprintf(cp_err, "Error: can't set plot name\n"); return (US_DONTRECORD); } else if (eq(var->va_name, "curplottitle")) { - if (plot_cur && (var->va_type == VT_STRING)) + if (plot_cur && (var->va_type == CP_STRING)) plot_cur->pl_title = copy(var->va_string); else fprintf(cp_err, "Error: can't set plot title\n"); return (US_DONTRECORD); } else if (eq(var->va_name, "curplotdate")) { - if (plot_cur && (var->va_type == VT_STRING)) + if (plot_cur && (var->va_type == CP_STRING)) plot_cur->pl_date = copy(var->va_string); else fprintf(cp_err, "Error: can't set plot date\n"); @@ -371,7 +371,7 @@ cp_usrset(struct variable *var, bool isset) /* Now call the interface option routine. */ switch (var->va_type) { - case VT_BOOL: + case CP_BOOL: if (var->va_bool) { /*val[0] = '\0';*/ bv = TRUE; @@ -382,21 +382,21 @@ cp_usrset(struct variable *var, bool isset) vv = (char *) &bv; } break; - case VT_STRING: + case CP_STRING: (void) strcpy(val, var->va_string); vv = val; break; - case VT_NUM: + case CP_NUM: /*(void) sprintf(val, "%d", var->va_num);*/ iv = var->va_num; vv = (char *) &iv; break; - case VT_REAL: + case CP_REAL: /*(void) strcpy(val, printnum(var->va_real));*/ dv = var->va_real; vv = (char *) &dv; break; - case VT_LIST: + case CP_LIST: /* if_option can't handle lists anyway. */ vv = NULL; break; diff --git a/src/frontend/outitf.c b/src/frontend/outitf.c index 3f831bea6..3bc29f112 100644 --- a/src/frontend/outitf.c +++ b/src/frontend/outitf.c @@ -146,7 +146,7 @@ beginPlot(void *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analNa /*end saj*/ /* Check to see if we want to print informational data. */ - if (cp_getvar("printinfo", VT_BOOL, (char *) &printinfo)) + if (cp_getvar("printinfo", CP_BOOL, (char *) &printinfo)) fprintf(cp_err, "(debug printing enabled)\n"); *runp = run = alloc(struct runDesc); @@ -1104,11 +1104,11 @@ getSpecial(dataDesc *desc, runDesc *run, IFvalue *val) } else if ((vv = if_getstat(run->circuit, &desc->name[1]))) { /* skip @ sign */ desc->type = IF_REAL; - if (vv->va_type == VT_REAL) + if (vv->va_type == CP_REAL) val->rValue = vv->va_real; - else if (vv->va_type == VT_NUM) + else if (vv->va_type == CP_NUM) val->rValue = vv->va_num; - else if (vv->va_type == VT_BOOL) + else if (vv->va_type == CP_BOOL) val->rValue = (vv->va_bool ? 1.0 : 0.0); else { return FALSE; /* not a real */ @@ -1171,7 +1171,7 @@ OUTerror(int flags, char *format, IFuid *names) char buf[BSIZE_SP], *s, *bptr; int nindex = 0; - if ((flags == ERR_INFO) && cp_getvar("printinfo", VT_BOOL, + if ((flags == ERR_INFO) && cp_getvar("printinfo", CP_BOOL, (char *) &printinfo)) return; diff --git a/src/frontend/plotting/agraf.c b/src/frontend/plotting/agraf.c index d58790d4c..c64c023d8 100644 --- a/src/frontend/plotting/agraf.c +++ b/src/frontend/plotting/agraf.c @@ -55,7 +55,7 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s /* Make sure the margin is correct */ omargin = margin; - if (!cp_getvar("noasciiplotvalue", VT_BOOL, (char *) &novalue) && + if (!cp_getvar("noasciiplotvalue", CP_BOOL, (char *) &novalue) && !vec_eq(xscale, vecs)) { margin *= 2; } else @@ -63,15 +63,15 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s if ((xscale->v_gridtype == GRID_YLOG) || (xscale->v_gridtype == GRID_LOGLOG)) ylogscale = TRUE; - if (!cp_getvar("width", VT_NUM, (char *) &maxy)) { + if (!cp_getvar("width", CP_NUM, (char *) &maxy)) { maxy = DEF_WIDTH; } - if (!cp_getvar("height", VT_NUM, (char *) &height)) + if (!cp_getvar("height", CP_NUM, (char *) &height)) height = DEF_HEIGHT; if (ft_nopage) nobreakp = TRUE; else - cp_getvar("nobreak", VT_BOOL, (char *) &nobreakp); + cp_getvar("nobreak", CP_BOOL, (char *) &nobreakp); maxy -= (margin + FUDGE); maxx = xscale->v_length; xrange[0] = xlims[0]; diff --git a/src/frontend/plotting/gnuplot.c b/src/frontend/plotting/gnuplot.c index a07c0d98b..d47e9cc80 100644 --- a/src/frontend/plotting/gnuplot.c +++ b/src/frontend/plotting/gnuplot.c @@ -47,11 +47,11 @@ ft_gnuplot(double *xlims, double *ylims, char *filename, char *title, char *xlab fprintf( cp_err, "Error: too many vectors for gnuplot.\n" ); return; } - if (!cp_getvar("xbrushwidth", VT_NUM, &linewidth)) + if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth)) linewidth = 1; if (linewidth < 1) linewidth = 1; - if (!cp_getvar("pointstyle", VT_STRING, pointstyle)) { + if (!cp_getvar("pointstyle", CP_STRING, pointstyle)) { markers = FALSE; } else { if (cieq(pointstyle,"markers")) { diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index 79fde6309..1679dba8d 100644 --- a/src/frontend/plotting/graf.c +++ b/src/frontend/plotting/graf.c @@ -105,17 +105,17 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */ plotno = 0; /* note: should do only once, maybe in gr_init_once */ - if (!cp_getvar("pointchars", VT_STRING, pointchars)) + if (!cp_getvar("pointchars", CP_STRING, pointchars)) (void) strcpy(pointchars, DEFPOINTCHARS); - if (!cp_getvar("ticmarks", VT_NUM, (char *) &graph->ticmarks)) { - if (cp_getvar("ticmarks", VT_BOOL, (char *) &b)) + if (!cp_getvar("ticmarks", CP_NUM, (char *) &graph->ticmarks)) { + if (cp_getvar("ticmarks", CP_BOOL, (char *) &b)) graph->ticmarks = 10; else graph->ticmarks = 0; } - if (cp_getvar("ticlist", VT_LIST, ticlist)) { + if (cp_getvar("ticlist", CP_LIST, ticlist)) { wl = (wordlist *)vareval("ticlist"); ticlist = (char *)wl_flatten(wl); graph->ticdata = (double *) readtics(ticlist); @@ -457,7 +457,7 @@ gr_pmsg(char *text) Update(); - if (cp_getvar("device", VT_STRING, buf) + if (cp_getvar("device", CP_STRING, buf) && !(strcmp("/dev/tty", buf) == 0)) fprintf(cp_err, "%s", text); else diff --git a/src/frontend/plotting/plotcurv.c b/src/frontend/plotting/plotcurv.c index 24ca4f98f..bd9985f02 100644 --- a/src/frontend/plotting/plotcurv.c +++ b/src/frontend/plotting/plotcurv.c @@ -40,7 +40,7 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart) if (nostart) { degree = currentgraph->degree; } else { - if (!cp_getvar("polydegree", VT_NUM, (char *) °ree)) + if (!cp_getvar("polydegree", CP_NUM, (char *) °ree)) degree = 1; currentgraph->degree = degree; } @@ -52,7 +52,7 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart) return; } - if (!cp_getvar("gridsize", VT_NUM, (char *) &gridsize)) + if (!cp_getvar("gridsize", CP_NUM, (char *) &gridsize)) gridsize = 0; if ((gridsize < 0) || (gridsize > 10000)) { fprintf(cp_err, "Error: bad grid size %d\n", gridsize); @@ -322,7 +322,7 @@ plotinterval(struct dvec *v, double lo, double hi, register double *coeffs, int /* This is a problem -- how do we know what granularity to use? If * the guy cares about this he will use gridsize. */ - if (!cp_getvar("polysteps", VT_NUM, (char *) &steps)) + if (!cp_getvar("polysteps", CP_NUM, (char *) &steps)) steps = GRANULARITY; incr = (hi - lo) / (double) (steps + 1); diff --git a/src/frontend/plotting/plotit.c b/src/frontend/plotting/plotit.c index 2ca0410f6..23c9276fd 100644 --- a/src/frontend/plotting/plotit.c +++ b/src/frontend/plotting/plotit.c @@ -452,7 +452,7 @@ plotit(wordlist *wl, char *hcopy, char *devname) } if (!sameflag && !gfound) { - if (cp_getvar("gridstyle", VT_STRING, buf)) { + if (cp_getvar("gridstyle", CP_STRING, buf)) { if (eq(buf, "lingrid")) gtype = GRID_LIN; else if (eq(buf, "loglog")) @@ -511,7 +511,7 @@ plotit(wordlist *wl, char *hcopy, char *devname) } if (!sameflag && !pfound) { - if (cp_getvar("plotstyle", VT_STRING, buf)) { + if (cp_getvar("plotstyle", CP_STRING, buf)) { if (eq(buf, "linplot")) ptype = PLOT_LIN; else if (eq(buf, "combplot")) diff --git a/src/frontend/plotting/x11.c b/src/frontend/plotting/x11.c index b8731daea..0880ccfce 100644 --- a/src/frontend/plotting/x11.c +++ b/src/frontend/plotting/x11.c @@ -118,7 +118,7 @@ X11_Init(void) char *argv[2]; int argc = 2; - if (cp_getvar("display", VT_STRING, buf)) { + if (cp_getvar("display", CP_STRING, buf)) { displayname = buf; } else if (!(displayname = getenv("DISPLAY"))) { internalerror("Can't open X display."); @@ -222,7 +222,7 @@ initcolors(GRAPH *graph) for (i = 0; i < xmaxcolors; i++) { (void) sprintf(buf, "color%d", i); - if (!cp_getvar(buf, VT_STRING, colorstring)) + if (!cp_getvar(buf, CP_STRING, colorstring)) (void) strcpy(colorstring, colornames[i]); if (!XAllocNamedColor(display, DefaultColormap(display, DefaultScreen(display)), @@ -410,7 +410,7 @@ X11_NewViewport(GRAPH *graph) XtAddCallback(DEVDEP(graph).buttons[1], XtNcallback, (XtCallbackProc) hardcopy, graph); /* set up fonts */ - if (!cp_getvar("font", VT_STRING, fontname)) { + if (!cp_getvar("font", CP_STRING, fontname)) { (void) strcpy(fontname, DEF_FONT); } @@ -508,7 +508,7 @@ X11_Arc(int x0, int y0, int radius, double theta1, double theta2) int t1, t2; - if (!cp_getvar("x11lineararcs", VT_BOOL, (char *) &t1)) { + if (!cp_getvar("x11lineararcs", CP_BOOL, (char *) &t1)) { linear_arc(x0, y0, radius, theta1, theta2); } @@ -816,7 +816,7 @@ zoomin(GRAPH *graph) /* hack for Gordon Jacobs */ /* add to history list if plothistory is set */ - if (cp_getvar("plothistory", VT_BOOL, (char *) &dummy)) { + if (cp_getvar("plothistory", CP_BOOL, (char *) &dummy)) { wl = cp_parse(buf); (void) cp_addhistent(cp_event++, wl); } diff --git a/src/frontend/plotting/xgraph.c b/src/frontend/plotting/xgraph.c index c24076718..5eb146cfa 100644 --- a/src/frontend/plotting/xgraph.c +++ b/src/frontend/plotting/xgraph.c @@ -38,11 +38,11 @@ ft_xgraph(double *xlims, double *ylims, char *filename, char *title, char *xlabe fprintf( cp_err, "Error: too many vectors for Xgraph.\n" ); return; } - if (!cp_getvar("xbrushwidth", VT_NUM, &linewidth)) + if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth)) linewidth = 1; if (linewidth < 1) linewidth = 1; - if (!cp_getvar("pointstyle", VT_STRING, pointstyle)) { + if (!cp_getvar("pointstyle", CP_STRING, pointstyle)) { markers = FALSE; } else { if (cieq(pointstyle,"markers")) { diff --git a/src/frontend/postcoms.c b/src/frontend/postcoms.c index cbf378044..f9df97f76 100644 --- a/src/frontend/postcoms.c +++ b/src/frontend/postcoms.c @@ -226,19 +226,19 @@ com_print(wordlist *wl) } //end if (v->v_rlength == 1) } } else { /* Print in columns. */ - if (cp_getvar("width", VT_NUM, (char *) &i)) + if (cp_getvar("width", CP_NUM, (char *) &i)) width = i; if (width < 40) width = 40; - if (cp_getvar("height", VT_NUM, (char *) &i)) + if (cp_getvar("height", CP_NUM, (char *) &i)) height = i; if (height < 20) height = 20; - if (!cp_getvar("nobreak", VT_BOOL, (char *) &nobreak) && !ft_nopage) + if (!cp_getvar("nobreak", CP_BOOL, (char *) &nobreak) && !ft_nopage) nobreak = FALSE; else nobreak = TRUE; - (void) cp_getvar("noprintscale", VT_BOOL, (char *) + (void) cp_getvar("noprintscale", CP_BOOL, (char *) &noprintscale); bv = vecs; nextpage: @@ -415,7 +415,7 @@ com_write(wordlist *wl) wl = wl->wl_next; } else file = ft_rawfile; - if (cp_getvar("filetype", VT_STRING, buf)) { + if (cp_getvar("filetype", CP_STRING, buf)) { if (eq(buf, "binary")) ascii = FALSE; else if (eq(buf, "ascii")) @@ -423,7 +423,7 @@ com_write(wordlist *wl) else fprintf(cp_err, "Warning: strange file type %s\n", buf); } - (void) cp_getvar("appendwrite", VT_BOOL, (char *) &appendwrite); + (void) cp_getvar("appendwrite", CP_BOOL, (char *) &appendwrite); if (wl) names = ft_getpnames(wl, TRUE); diff --git a/src/frontend/postsc.c b/src/frontend/postsc.c index 4f7ecb5eb..f4c3a4a7a 100644 --- a/src/frontend/postsc.c +++ b/src/frontend/postsc.c @@ -83,7 +83,7 @@ PS_Init(void) { char pswidth[30], psheight[30]; - if (!cp_getvar("hcopyscale", VT_STRING, psscale)) { + if (!cp_getvar("hcopyscale", CP_STRING, psscale)) { scale = 1.0; } else { sscanf(psscale, "%lf", &scale); @@ -92,7 +92,7 @@ PS_Init(void) } dispdev->numlinestyles = NUMELEMS(linestyle); /* plot color */ - if (!cp_getvar("hcopypscolor", VT_NUM, &setbgcolor)) { + if (!cp_getvar("hcopypscolor", CP_NUM, &setbgcolor)) { /* if not set, set plot to b&w and use line styles */ colorflag = 0; dispdev->numcolors = 2; @@ -101,11 +101,11 @@ PS_Init(void) /* get backgroung color and set plot to color */ colorflag = 1; dispdev->numcolors = 21; /* don't know what the maximum should be */ - cp_getvar("hcopypstxcolor", VT_NUM, &settxcolor); + cp_getvar("hcopypstxcolor", CP_NUM, &settxcolor); } /* plot size */ - if (!cp_getvar("hcopywidth", VT_STRING, pswidth)) { + if (!cp_getvar("hcopywidth", CP_STRING, pswidth)) { dispdev->width = 7.75 * 72.0 * scale; /* (8 1/2 - 3/4) * 72 */ } else { sscanf(pswidth, "%d", &(dispdev->width)); @@ -114,7 +114,7 @@ PS_Init(void) if (dispdev->width >= 10000) dispdev->width = 10000; } - if (!cp_getvar("hcopyheight", VT_STRING, psheight)) { + if (!cp_getvar("hcopyheight", CP_STRING, psheight)) { dispdev->height = dispdev->width; } else { sscanf(psheight, "%d", &(dispdev->height)); @@ -134,9 +134,9 @@ PS_Init(void) * viewport.height = absolute.height - 2 * viewportyoff */ - if (!cp_getvar("hcopyfont", VT_STRING, psfont)) + if (!cp_getvar("hcopyfont", CP_STRING, psfont)) strcpy(psfont, "Helvetica"); - if (!cp_getvar("hcopyfontsize", VT_STRING, psfontsize)) { + if (!cp_getvar("hcopyfontsize", CP_STRING, psfontsize)) { fontsize = 10; fontwidth = 6; fontheight = 14; @@ -415,7 +415,7 @@ PS_SelectColor(int colorid) /* should be replaced by PS_DefineColor */ /* Extract the rgbcolor, format is: "rgb://" */ sprintf(colorN, "color%d",colorid); - if (cp_getvar(colorN, VT_STRING, colorstring)){ + if (cp_getvar(colorN, CP_STRING, colorstring)){ for (i=0; colorstring[i]; i++) if (colorstring[i] == '/' || colorstring[i] == ':') colorstring[i] = ' '; diff --git a/src/frontend/rawfile.c b/src/frontend/rawfile.c index 8aca3b1db..06e0c87aa 100644 --- a/src/frontend/rawfile.c +++ b/src/frontend/rawfile.c @@ -47,7 +47,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary) char buf[BSIZE_SP]; char *branch; - if (!cp_getvar("nopadding", VT_BOOL, (char *) &raw_padding)) + if (!cp_getvar("nopadding", CP_BOOL, (char *) &raw_padding)) raw_padding = FALSE; /* Invert since we want to know if we should pad. */ raw_padding = !raw_padding; @@ -131,14 +131,14 @@ raw_write(char *name, struct plot *pl, bool app, bool binary) for (vv = pl->pl_env; vv; vv = vv->va_next) { wl = cp_varwl(vv); - if (vv->va_type == VT_BOOL) { + if (vv->va_type == CP_BOOL) { fprintf(fp, "Option: %s\n", vv->va_name); } else { fprintf(fp, "Option: %s = ", vv->va_name); - if (vv->va_type == VT_LIST) + if (vv->va_type == CP_LIST) fprintf(fp, "( "); wl_print(wl, fp); - if (vv->va_type == VT_LIST) + if (vv->va_type == CP_LIST) fprintf(fp, " )"); (void) putc('\n', fp); } diff --git a/src/frontend/runcoms.c b/src/frontend/runcoms.c index 914fdfd6d..700f641ba 100644 --- a/src/frontend/runcoms.c +++ b/src/frontend/runcoms.c @@ -195,7 +195,7 @@ dosim( ww->wl_word = copy(what); } /* reset output file type according to variable given in spinit */ - if (cp_getvar("filetype", VT_STRING, buf)) { + if (cp_getvar("filetype", CP_STRING, buf)) { if (eq(buf, "binary")) ascii = FALSE; else if (eq(buf, "ascii")) diff --git a/src/frontend/runcoms2.c b/src/frontend/runcoms2.c index b04aef929..672f8ab72 100644 --- a/src/frontend/runcoms2.c +++ b/src/frontend/runcoms2.c @@ -79,7 +79,7 @@ com_resume(wordlist *wl) if (last_used_rawfile) dofile = TRUE; - if (cp_getvar("filetype", VT_STRING, buf)) { + if (cp_getvar("filetype", CP_STRING, buf)) { if (eq(buf, "binary")) ascii = FALSE; else if (eq(buf, "ascii")) diff --git a/src/frontend/spec.c b/src/frontend/spec.c index e9764e9a4..8686ef291 100644 --- a/src/frontend/spec.c +++ b/src/frontend/spec.c @@ -83,7 +83,7 @@ com_spec(wordlist *wl) { char window[BSIZE_SP]; double maxt = time[tlen-1]; - if (!cp_getvar("specwindow", VT_STRING, window)) + if (!cp_getvar("specwindow", CP_STRING, window)) strcpy(window,"hanning"); if (eq(window, "none")) for(i=0; i span) { @@ -137,7 +137,7 @@ com_spec(wordlist *wl) } else if (eq(window, "gaussian")) { int order; double scale; - if (!cp_getvar("specwindoworder", VT_NUM, &order)) order = 2; + if (!cp_getvar("specwindoworder", CP_NUM, &order)) order = 2; if (order < 2) order = 2; scale = pow(2*M_PI/order,0.5)*(0.5-erfc(pow(order,0.5))); for(i=0; ianalyses[which]->analysisParms[i].dataType & IF_VARTYPES) { case IF_REAL: - if (type == VT_REAL) + if (type == CP_REAL) pval.rValue = *((double *) value); - else if (type == VT_NUM) + else if (type == CP_NUM) pval.rValue = *((int *) value); else goto badtype; break; case IF_INTEGER: - if (type == VT_NUM) + if (type == CP_NUM) pval.iValue = *((int *) value); - else if (type == VT_REAL) + else if (type == CP_REAL) pval.iValue = *((double *) value); else goto badtype; break; case IF_STRING: - if (type == VT_STRING) + if (type == CP_STRING) pval.sValue = copy(value); else goto badtype; @@ -506,11 +506,11 @@ badtype: fprintf(cp_err, "Error: bad type given for option %s --\n", name); fprintf(cp_err, "\ttype given was "); switch (type) { - case VT_BOOL: fputs("boolean", cp_err); break; - case VT_NUM: fputs("integer", cp_err); break; - case VT_REAL: fputs("real", cp_err); break; - case VT_STRING: fputs("string", cp_err); break; - case VT_LIST: fputs("list", cp_err); break; + case CP_BOOL: fputs("boolean", cp_err); break; + case CP_NUM: fputs("integer", cp_err); break; + case CP_REAL: fputs("real", cp_err); break; + case CP_STRING: fputs("string", cp_err); break; + case CP_LIST: fputs("list", cp_err); break; default: fputs("something strange", cp_err); break; } fprintf(cp_err, ", type expected was "); @@ -521,7 +521,7 @@ badtype: case IF_FLAG: fputs("flag.\n", cp_err); break; default: fputs("something strange.\n", cp_err); break; } - if (type == VT_BOOL) + if (type == CP_BOOL) fputs("\t(Note that you must use an = to separate option name and value.)\n", cp_err); return 0; @@ -930,30 +930,30 @@ parmtovar(IFvalue *pv, IFparm *opt) switch (opt->dataType & IF_VARTYPES) { case IF_INTEGER: - vv->va_type = VT_NUM; + vv->va_type = CP_NUM; vv->va_num = pv->iValue; break; case IF_REAL: case IF_COMPLEX: - vv->va_type = VT_REAL; + vv->va_type = CP_REAL; vv->va_real = pv->rValue; break; case IF_STRING: - vv->va_type = VT_STRING; + vv->va_type = CP_STRING; vv->va_string = pv->sValue; break; case IF_FLAG: - vv->va_type = VT_BOOL; + vv->va_type = CP_BOOL; vv->va_bool = pv->iValue ? TRUE : FALSE; break; case IF_REALVEC: - vv->va_type = VT_LIST; + vv->va_type = CP_LIST; for (i = 0; i < pv->v.numValue; i++) { nv = alloc(struct variable); nv->va_next = vv->va_vlist; vv->va_vlist = nv; - nv->va_type = VT_REAL; + nv->va_type = CP_REAL; /* Change this so that the values are printed in order and * not in inverted order as happens in the conversion process. * Originally was nv->va_real = pv->v.vec.rVec[i]; diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index 658649d6d..d65e35acf 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -162,19 +162,19 @@ inp_subcktexpand(struct line *deck) wordlist *wl; modnames = NULL; - if(!cp_getvar("substart", VT_STRING, start)) + if(!cp_getvar("substart", CP_STRING, start)) (void) strcpy(start, ".subckt"); - if(!cp_getvar("subend", VT_STRING, sbend)) + if(!cp_getvar("subend", CP_STRING, sbend)) (void) strcpy(sbend, ".ends"); - if(!cp_getvar("subinvoke", VT_STRING, invoke)) + if(!cp_getvar("subinvoke", CP_STRING, invoke)) (void) strcpy(invoke, "x"); - if(!cp_getvar("modelcard", VT_STRING, model)) + if(!cp_getvar("modelcard", CP_STRING, model)) (void) strcpy(model, ".model"); - if(!cp_getvar("modelline", VT_STRING, model)) + if(!cp_getvar("modelline", CP_STRING, model)) (void) strcpy(model, ".model"); - (void) cp_getvar("nobjthack", VT_BOOL, (char *) &nobjthack); + (void) cp_getvar("nobjthack", CP_BOOL, (char *) &nobjthack); - (void) cp_getvar("numparams", VT_BOOL, (char *) &use_numparams); + (void) cp_getvar("numparams", CP_BOOL, (char *) &use_numparams); use_numparams = TRUE; diff --git a/src/frontend/terminal.c b/src/frontend/terminal.c index c29c62d21..35252aa86 100644 --- a/src/frontend/terminal.c +++ b/src/frontend/terminal.c @@ -84,7 +84,7 @@ out_init(void) noprint = nopause = FALSE; - if (cp_getvar("nomoremode", VT_BOOL, (char *) &moremode)) + if (cp_getvar("nomoremode", CP_BOOL, (char *) &moremode)) out_moremode = FALSE; else out_moremode = TRUE; @@ -109,9 +109,9 @@ out_init(void) #endif if (!xsize) - (void) cp_getvar("width", VT_NUM, (char *) &xsize); + (void) cp_getvar("width", CP_NUM, (char *) &xsize); if (!ysize) - (void) cp_getvar("height", VT_NUM, (char *) &ysize); + (void) cp_getvar("height", CP_NUM, (char *) &ysize); if (!xsize) xsize = DEF_SCRWIDTH; diff --git a/src/frontend/variable.c b/src/frontend/variable.c index 21d09d980..9d74356f0 100644 --- a/src/frontend/variable.c +++ b/src/frontend/variable.c @@ -40,25 +40,25 @@ cp_varwl(struct variable *var) struct variable *vt; switch(var->va_type) { - case VT_BOOL: + case CP_BOOL: /* Can't ever be FALSE. */ sprintf(buf, "%s", var->va_bool ? "TRUE" : "FALSE"); break; - case VT_NUM: + case CP_NUM: sprintf(buf, "%d", var->va_num); break; - case VT_REAL: + case CP_REAL: /* This is a case where printnum isn't too good... */ sprintf(buf, "%G", var->va_real); break; - case VT_STRING: + case CP_STRING: /*strcpy(buf, cp_unquote(var->va_string)); DG: memory leak here*/ copystring= cp_unquote(var->va_string);/*DG*/ strcpy(buf,copystring); tfree(copystring); break; - case VT_LIST: /* The tricky case. */ + case CP_LIST: /* The tricky case. */ for (vt = var->va_vlist; vt; vt = vt->va_next) { w = cp_varwl(vt); if (wl == NULL) @@ -112,7 +112,7 @@ cp_vset(char *varname, enum vt_types type, char *value) v_free = TRUE; } switch (type) { - case VT_BOOL: + case CP_BOOL: if (* ((bool *) value) == FALSE) { cp_remvar(copyvarname); if(v_free) { @@ -124,19 +124,19 @@ cp_vset(char *varname, enum vt_types type, char *value) v->va_bool = TRUE; break; - case VT_NUM: + case CP_NUM: v->va_num = * (int *) value; break; - case VT_REAL: + case CP_REAL: v->va_real = * (double *) value; break; - case VT_STRING: + case CP_STRING: v->va_string = copy(value); break; - case VT_LIST: + case CP_LIST: v->va_vlist = (struct variable *) value; break; @@ -156,15 +156,15 @@ cp_vset(char *varname, enum vt_types type, char *value) cp_noglob = TRUE; else if (eq(copyvarname, "nonomatch")) cp_nonomatch = TRUE; - else if (eq(copyvarname, "history") && (type == VT_NUM)) + else if (eq(copyvarname, "history") && (type == CP_NUM)) cp_maxhistlength = v->va_num; - else if (eq(copyvarname, "history") && (type == VT_REAL)) + else if (eq(copyvarname, "history") && (type == CP_REAL)) cp_maxhistlength = v->va_real; else if (eq(copyvarname, "noclobber")) cp_noclobber = TRUE; else if (eq(varname, "echo")) /*CDHW*/ cp_echo = TRUE; /*CDHW*/ - else if (eq(copyvarname, "prompt") && (type == VT_STRING)) + else if (eq(copyvarname, "prompt") && (type == CP_STRING)) cp_promptstring = copy(v->va_string); else if (eq(copyvarname, "ignoreeof")) cp_ignoreeof = TRUE; @@ -224,8 +224,8 @@ cp_vset(char *varname, enum vt_types type, char *value) ft_curckt->ci_vars = v; } else { /* va: avoid memory leak within bcopy */ - if (u->va_type==VT_STRING) tfree(u->va_string); - else if (u->va_type==VT_LIST) tfree(u->va_vlist); + if (u->va_type==CP_STRING) tfree(u->va_string); + else if (u->va_type==CP_LIST) tfree(u->va_vlist); u->va_V = v->va_V; /* va_name is the same string */ u->va_type = v->va_type; @@ -279,7 +279,7 @@ cp_setparse(wordlist *wl) strchr(name, '=') == NULL) { vv = alloc(struct variable); vv->va_name = copy(name); - vv->va_type = VT_BOOL; + vv->va_type = CP_BOOL; vv->va_bool = TRUE; vv->va_next = vars; vars = vv; @@ -337,10 +337,10 @@ cp_setparse(wordlist *wl) copyval = ss = cp_unquote(wl->wl_word); td = ft_numparse(&ss, FALSE); if (td) { - vv->va_type = VT_REAL; + vv->va_type = CP_REAL; vv->va_real = *td; } else { - vv->va_type = VT_STRING; + vv->va_type = CP_STRING; vv->va_string = copy(ss); } tfree(copyval);/*DG: must free ss any way to avoid cp_unquote memory leak*/ @@ -359,7 +359,7 @@ cp_setparse(wordlist *wl) vv = alloc(struct variable); vv->va_name = copy(name); - vv->va_type = VT_LIST; + vv->va_type = CP_LIST; vv->va_vlist = listv; vv->va_next = vars; vars = vv; @@ -375,11 +375,11 @@ cp_setparse(wordlist *wl) vv->va_next = vars; vars = vv; if (td) { - /*** We should try to get VT_NUM's... */ - vv->va_type = VT_REAL; + /*** We should try to get CP_NUM's... */ + vv->va_type = CP_REAL; vv->va_real = *td; } else { - vv->va_type = VT_STRING; + vv->va_type = CP_STRING; vv->va_string = copy(val); } tfree(copyval);/*DG: must free ss any way to avoid cp_unquote memory leak */ @@ -401,8 +401,8 @@ free_struct_variable(struct variable *v) tv = v; while(tv) { tvv = tv->va_next; - if(tv->va_type == VT_LIST) free_struct_variable(tv->va_vlist); - if(tv->va_type == VT_STRING) tfree(tv->va_string); + if(tv->va_type == CP_LIST) free_struct_variable(tv->va_vlist); + if(tv->va_type == CP_STRING) tfree(tv->va_string); tfree(tv); tv = tvv; } @@ -448,7 +448,7 @@ cp_remvar(char *varname) v = alloc(struct variable); ZERO(v, struct variable); v->va_name = copy(varname); - v->va_type = VT_NUM; + v->va_type = CP_NUM; v->va_bool = 0; found = FALSE; } @@ -557,29 +557,29 @@ cp_getvar(char *name, enum vt_types type, void *retval) if (v == NULL) for (v = uv2; v && !eq(name, v->va_name); v = v->va_next); if (v == NULL) { - if (type == VT_BOOL) + if (type == CP_BOOL) * (bool *) retval = FALSE; free_struct_variable(uv1); return (FALSE); } if (v->va_type == type) { switch (type) { - case VT_BOOL: + case CP_BOOL: * (bool *) retval = TRUE; break; - case VT_NUM: { + case CP_NUM: { int *i; i = (int *) retval; *i = v->va_num; break; } - case VT_REAL: { + case CP_REAL: { double *d; d = (double *) retval; *d = v->va_real; break; } - case VT_STRING: { /* Gotta be careful to have room. */ + case CP_STRING: { /* Gotta be careful to have room. */ char *s; s = cp_unquote(v->va_string); cp_wstrip(s); @@ -587,7 +587,7 @@ cp_getvar(char *name, enum vt_types type, void *retval) tfree(s);/*DG*/ break; } - case VT_LIST: { /* Funny case... */ + case CP_LIST: { /* Funny case... */ struct variable **tv; tv = (struct variable **) retval; *tv = v->va_vlist; @@ -604,23 +604,23 @@ cp_getvar(char *name, enum vt_types type, void *retval) return (TRUE); } else { /* Try to coerce it.. */ - if ((type == VT_NUM) && (v->va_type == VT_REAL)) { + if ((type == CP_NUM) && (v->va_type == CP_REAL)) { int *i; i = (int *) retval; *i = (int) v->va_real; free_struct_variable(uv1); return (TRUE); - } else if ((type == VT_REAL) && (v->va_type == VT_NUM)) { + } else if ((type == CP_REAL) && (v->va_type == CP_NUM)) { double *d; d = (double *) retval; *d = (double) v->va_num; free_struct_variable(uv1); return (TRUE); - } else if ((type == VT_STRING) && (v->va_type == VT_NUM)) { + } else if ((type == CP_STRING) && (v->va_type == CP_NUM)) { (void) sprintf((char*) retval, "%d", v->va_num); free_struct_variable(uv1); return (TRUE); - } else if ((type == VT_STRING) && (v->va_type == VT_REAL)) { + } else if ((type == CP_STRING) && (v->va_type == CP_REAL)) { (void) sprintf((char*) retval, "%f", v->va_real); free_struct_variable(uv1); return (TRUE); @@ -788,11 +788,11 @@ vareval(char *string) tfree(oldstring); return (NULL); } - if (v->va_type == VT_LIST) + if (v->va_type == CP_LIST) for (v = v->va_vlist, i = 0; v; v = v->va_next) i++; else - i = (v->va_type != VT_BOOL); + i = (v->va_type != CP_BOOL); (void) sprintf(buf, "%d", i); wl->wl_word = copy(buf); tfree(oldstring); @@ -913,7 +913,7 @@ cp_vprint(void) if (j && eq(vars[j].x_v->va_name, vars[j - 1].x_v->va_name)) continue; v = vars[j].x_v; - if (v->va_type == VT_BOOL) { + if (v->va_type == CP_BOOL) { /* out_printf("%c %s\n", vars[j].x_char, v->va_name); */ sprintf(out_pbuf, "%c %s\n", vars[j].x_char, v->va_name); out_send(out_pbuf); @@ -921,7 +921,7 @@ cp_vprint(void) out_printf("%c %s\t", vars[j].x_char, v->va_name); wl = vareval(v->va_name); s = wl_flatten(wl); - if (v->va_type == VT_LIST) { + if (v->va_type == CP_LIST) { out_printf("( %s )\n", s); } else out_printf("%s\n", s); diff --git a/src/frontend/variable.h b/src/frontend/variable.h index 53e838bfc..90241bba3 100644 --- a/src/frontend/variable.h +++ b/src/frontend/variable.h @@ -9,7 +9,7 @@ #include "cpextern.h" /* Variables that are accessible to the parser via $varname - * expansions. If the type is VT_LIST the value is a pointer to a + * expansions. If the type is CP_LIST the value is a pointer to a * list of the elements. */ struct variable { enum vt_types va_type; diff --git a/src/frontend/vectors.c b/src/frontend/vectors.c index 8ca9bf1ec..95b9304cd 100644 --- a/src/frontend/vectors.c +++ b/src/frontend/vectors.c @@ -445,16 +445,16 @@ vec_get(const char *vec_name) *#define va_string va_V.vV_string *#define va_vlist va_V.vV_list *enum vt_types { - * VT_BOOL, - * VT_NUM, - * VT_REAL, - * VT_STRING, - * VT_LIST + * CP_BOOL, + * CP_NUM, + * CP_REAL, + * CP_STRING, + * CP_LIST ° }; */ /* The variable is a vector */ - if (vv->va_type == VT_LIST) + if (vv->va_type == CP_LIST) { /* Compute the length of the vector, * used with the parameters of isrc and vsrc @@ -480,11 +480,11 @@ vec_get(const char *vec_name) */ d->v_dims[1]=1; } - else if (vv->va_type == VT_NUM) /* Variable is an integer */ + else if (vv->va_type == CP_NUM) /* Variable is an integer */ { *d->v_realdata = (double) vv->va_num; } - else if (vv->va_type == VT_REAL) /* Variable is a real */ + else if (vv->va_type == CP_REAL) /* Variable is a real */ { if (!(vv->va_next)) { @@ -510,13 +510,13 @@ vec_get(const char *vec_name) { switch(nv->va_type) { - case VT_REAL: + case CP_REAL: fprintf(stdout,"%s=%g\n",nv->va_name,nv->va_real); break; - case VT_STRING: + case CP_STRING: fprintf(stdout,"%s=%s\n",nv->va_name,nv->va_string); break; - case VT_NUM: + case CP_NUM: fprintf(stdout,"%s=%d\n",nv->va_name,nv->va_num); break; } diff --git a/src/frontend/wdisp/windisp.c b/src/frontend/wdisp/windisp.c index 379702a18..8c6c149e5 100644 --- a/src/frontend/wdisp/windisp.c +++ b/src/frontend/wdisp/windisp.c @@ -114,12 +114,12 @@ int WIN_Init( ) /* always, user may have set color0 to white */ /* get background color information from spinit, only "white" is recognized as a suitable option! */ - if (cp_getvar("color0", VT_STRING, colorstring)) { + if (cp_getvar("color0", CP_STRING, colorstring)) { if (cieq(colorstring, "white")) isblack = FALSE; else isblack = TRUE; } /* get linewidth information from spinit */ - if (!cp_getvar("xbrushwidth", VT_NUM, &linewidth)) + if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth)) linewidth = 0; if (linewidth < 0) linewidth = 0; @@ -129,7 +129,7 @@ int WIN_Init( ) isblackold = isblack; /* get linewidth information from spinit - if (!cp_getvar("xbrushwidth", VT_NUM, &linewidth)) + if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth)) linewidth = 0; if (linewidth < 0) linewidth = 0; */ @@ -232,7 +232,7 @@ static int LType( int ColorIndex) LRESULT HcpyPlot( HWND hwnd) { int colorval = isblack? 0 : 1; - cp_vset("hcopypscolor", VT_NUM, (char*)(&colorval)); + cp_vset("hcopypscolor", CP_NUM, (char*)(&colorval)); com_hardcopy(NULL); return 0; } @@ -240,7 +240,7 @@ LRESULT HcpyPlot( HWND hwnd) LRESULT HcpyPlotBW( HWND hwnd) { int bgcolor; - if (cp_getvar("hcopypscolor", VT_NUM, &bgcolor)) + if (cp_getvar("hcopypscolor", CP_NUM, &bgcolor)) cp_remvar("hcopypscolor"); com_hardcopy(NULL); return 0; @@ -815,10 +815,10 @@ int WIN_Text( char * text, int x, int y) lf.lfPitchAndFamily = 0 ; /* set up fonts */ - if (!cp_getvar("wfont", VT_STRING, lf.lfFaceName)) { + if (!cp_getvar("wfont", CP_STRING, lf.lfFaceName)) { (void) lstrcpy(lf.lfFaceName, DEF_FONTW); } - if (!cp_getvar("wfont_size", VT_NUM, (char *) &(lf.lfHeight))) { + if (!cp_getvar("wfont_size", CP_NUM, (char *) &(lf.lfHeight))) { lf.lfHeight = (int) (1.1 * currentgraph->fontheight) ; } diff --git a/src/include/cpextern.h b/src/include/cpextern.h index f7cf4ad1d..b27074ec9 100644 --- a/src/include/cpextern.h +++ b/src/include/cpextern.h @@ -161,11 +161,11 @@ void cp_rehash(char *pathlist, bool docc); /* variable.c */ enum vt_types { - VT_BOOL, - VT_NUM, - VT_REAL, - VT_STRING, - VT_LIST + CP_BOOL, + CP_NUM, + CP_REAL, + CP_STRING, + CP_LIST }; extern bool cp_ignoreeof; diff --git a/src/main.c b/src/main.c index 3df3db507..60140ab3e 100644 --- a/src/main.c +++ b/src/main.c @@ -364,7 +364,7 @@ COMPATMODE_T ngspice_compat_mode(void) { char behaviour[80] ; - if( cp_getvar("ngbehavior", VT_STRING, behaviour)){ + if( cp_getvar("ngbehavior", CP_STRING, behaviour)){ if (strcasecmp(behaviour,"all")==0) return( COMPATMODE_ALL ) ; if (strcasecmp(behaviour,"hspice")==0) @@ -816,13 +816,13 @@ main(int argc, char **argv) case 'b': /* Batch mode */ ft_batchmode = TRUE; addctrlsect = FALSE; - cp_vset("addcontrol",VT_BOOL,&addctrlsect); + cp_vset("addcontrol",CP_BOOL,&addctrlsect); break; case 'a': /* Add control section for autorun */ if (!ft_batchmode) { addctrlsect = TRUE; - cp_vset("addcontrol",VT_BOOL, &addctrlsect); + cp_vset("addcontrol",CP_BOOL, &addctrlsect); } break; @@ -868,7 +868,7 @@ main(int argc, char **argv) case 'r': /* The raw file */ if (optarg) { - cp_vset("rawfile", VT_STRING, optarg); + cp_vset("rawfile", CP_STRING, optarg); } rflag = TRUE; break; @@ -879,7 +879,7 @@ main(int argc, char **argv) case 't': if (optarg) { - cp_vset("term", VT_STRING, optarg); + cp_vset("term", CP_STRING, optarg); } break; @@ -1090,7 +1090,7 @@ bot: /* write source file name into source window */ SetSource(dname); /* write source file name into a variable */ - cp_vset("sourcefile", VT_STRING, dname); + cp_vset("sourcefile", CP_STRING, dname); #endif append_to_stream(tempfile, tp); fclose(tp); diff --git a/src/maths/cmaths/cmath4.c b/src/maths/cmaths/cmath4.c index 4cbe4b208..21bed72ec 100644 --- a/src/maths/cmaths/cmath4.c +++ b/src/maths/cmaths/cmath4.c @@ -207,7 +207,7 @@ cx_interpolate(void *data, short int type, int length, int *newlength, short int *newlength = ns->v_length; d = alloc_d(ns->v_length); - if (!cp_getvar("polydegree", VT_NUM, (void *) °ree)) + if (!cp_getvar("polydegree", CP_NUM, (void *) °ree)) degree = 1; for (base = 0; base < length; base += grouping) { @@ -241,7 +241,7 @@ cx_deriv(void *data, short int type, int length, int *newlength, short int *newt return (NULL); } - if (!cp_getvar("dpolydegree", VT_NUM, (void *) °ree)) + if (!cp_getvar("dpolydegree", CP_NUM, (void *) °ree)) degree = 2; /* default quadratic */ n = degree + 1; diff --git a/src/maths/misc/randnumb.c b/src/maths/misc/randnumb.c index cfe6c1f74..e3a484f2f 100644 --- a/src/maths/misc/randnumb.c +++ b/src/maths/misc/randnumb.c @@ -32,7 +32,7 @@ void checkseed(void) int newseed; static int oldseed; /* printf("Enter checkseed()\n"); */ - if (cp_getvar("rndseed", VT_NUM, &newseed)) { + if (cp_getvar("rndseed", CP_NUM, &newseed)) { if ((newseed > 0) && (oldseed != newseed)) { srandom(newseed); oldseed = newseed; diff --git a/src/nghelp.c b/src/nghelp.c index 60c8d6a3a..7bc2fee9b 100644 --- a/src/nghelp.c +++ b/src/nghelp.c @@ -59,7 +59,7 @@ main(int ac, char **av) #ifndef X_DISPLAY_MISSING - if (cp_getvar("display", VT_STRING, buf)) { + if (cp_getvar("display", CP_STRING, buf)) { displayname = buf; } else if (!(displayname = getenv("DISPLAY"))) { fprintf(stderr, "Can't open X display."); diff --git a/src/spicelib/devices/bsim3/b3par.c b/src/spicelib/devices/bsim3/b3par.c index 96e79c30e..dc170e7f4 100644 --- a/src/spicelib/devices/bsim3/b3par.c +++ b/src/spicelib/devices/bsim3/b3par.c @@ -26,7 +26,7 @@ IFvalue *select) BSIM3instance *here = (BSIM3instance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM3_W: diff --git a/src/spicelib/devices/bsim3/b3set.c b/src/spicelib/devices/bsim3/b3set.c index 314b8550d..24bea58b8 100644 --- a/src/spicelib/devices/bsim3/b3set.c +++ b/src/spicelib/devices/bsim3/b3set.c @@ -1011,7 +1011,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\ } } #ifdef USE_OMP3 - if (!cp_getvar("num_threads", VT_NUM, (char *) &nthreads)) + if (!cp_getvar("num_threads", CP_NUM, (char *) &nthreads)) nthreads = 2; omp_set_num_threads(nthreads); diff --git a/src/spicelib/devices/bsim3soi/b4soiset.c b/src/spicelib/devices/bsim3soi/b4soiset.c index cdd274ea9..549780701 100644 --- a/src/spicelib/devices/bsim3soi/b4soiset.c +++ b/src/spicelib/devices/bsim3soi/b4soiset.c @@ -2674,7 +2674,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\ } #ifdef USE_OMP4SOI - if (!cp_getvar("num_threads", VT_NUM, (char *) &nthreads)) + if (!cp_getvar("num_threads", CP_NUM, (char *) &nthreads)) nthreads = 2; omp_set_num_threads(nthreads); diff --git a/src/spicelib/devices/bsim3v0/b3v0par.c b/src/spicelib/devices/bsim3v0/b3v0par.c index 01679513e..6ad2dc1c2 100644 --- a/src/spicelib/devices/bsim3v0/b3v0par.c +++ b/src/spicelib/devices/bsim3v0/b3v0par.c @@ -18,7 +18,7 @@ BSIM3v0param(int param, IFvalue *value, GENinstance *inst, IFvalue *select) BSIM3v0instance *here = (BSIM3v0instance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM3v0_W: diff --git a/src/spicelib/devices/bsim3v1/b3v1par.c b/src/spicelib/devices/bsim3v1/b3v1par.c index 8b65cb4ef..cac6f8df8 100644 --- a/src/spicelib/devices/bsim3v1/b3v1par.c +++ b/src/spicelib/devices/bsim3v1/b3v1par.c @@ -24,7 +24,7 @@ BSIM3v1param(int param, IFvalue *value, GENinstance *inst, IFvalue *select) BSIM3v1instance *here = (BSIM3v1instance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM3v1_W: diff --git a/src/spicelib/devices/bsim3v1a/b3v1apar.c b/src/spicelib/devices/bsim3v1a/b3v1apar.c index 5ebcdc9e2..dbbd6e11b 100644 --- a/src/spicelib/devices/bsim3v1a/b3v1apar.c +++ b/src/spicelib/devices/bsim3v1a/b3v1apar.c @@ -19,7 +19,7 @@ BSIM3v1Aparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select) BSIM3v1Ainstance *here = (BSIM3v1Ainstance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM3v1A_W: diff --git a/src/spicelib/devices/bsim3v1s/b3v1spar.c b/src/spicelib/devices/bsim3v1s/b3v1spar.c index f2defb1ee..0fb4d04aa 100644 --- a/src/spicelib/devices/bsim3v1s/b3v1spar.c +++ b/src/spicelib/devices/bsim3v1s/b3v1spar.c @@ -19,7 +19,7 @@ BSIM3v1Sparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select) BSIM3v1Sinstance *here = (BSIM3v1Sinstance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM3v1S_W: diff --git a/src/spicelib/devices/bsim3v32/b3v32par.c b/src/spicelib/devices/bsim3v32/b3v32par.c index 1f8d70c17..410291d68 100644 --- a/src/spicelib/devices/bsim3v32/b3v32par.c +++ b/src/spicelib/devices/bsim3v32/b3v32par.c @@ -23,7 +23,7 @@ BSIM3v32param (int param, IFvalue *value, GENinstance *inst, IFvalue *select) BSIM3v32instance *here = (BSIM3v32instance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM3v32_W: diff --git a/src/spicelib/devices/bsim4/b4par.c b/src/spicelib/devices/bsim4/b4par.c index a333086d1..bb2569a4b 100644 --- a/src/spicelib/devices/bsim4/b4par.c +++ b/src/spicelib/devices/bsim4/b4par.c @@ -32,7 +32,7 @@ IFvalue *select) BSIM4instance *here = (BSIM4instance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM4_W: diff --git a/src/spicelib/devices/bsim4/b4set.c b/src/spicelib/devices/bsim4/b4set.c index 80af93311..cf37511a7 100644 --- a/src/spicelib/devices/bsim4/b4set.c +++ b/src/spicelib/devices/bsim4/b4set.c @@ -2391,7 +2391,7 @@ if((here->ptr = SMPmakeElt(matrix,here->first,here->second))==(double *)NULL){\ } /* end of loop through all the BSIM4 device models */ #ifdef USE_OMP4 - if (!cp_getvar("num_threads", VT_NUM, (char *) &nthreads)) + if (!cp_getvar("num_threads", CP_NUM, (char *) &nthreads)) nthreads = 2; omp_set_num_threads(nthreads); diff --git a/src/spicelib/devices/bsim4v2/b4v2par.c b/src/spicelib/devices/bsim4v2/b4v2par.c index e3552625a..9fdb32163 100644 --- a/src/spicelib/devices/bsim4v2/b4v2par.c +++ b/src/spicelib/devices/bsim4v2/b4v2par.c @@ -25,7 +25,7 @@ IFvalue *select) BSIM4v2instance *here = (BSIM4v2instance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM4v2_W: diff --git a/src/spicelib/devices/bsim4v3/b4v3par.c b/src/spicelib/devices/bsim4v3/b4v3par.c index af7b50c7e..ceb218927 100644 --- a/src/spicelib/devices/bsim4v3/b4v3par.c +++ b/src/spicelib/devices/bsim4v3/b4v3par.c @@ -28,7 +28,7 @@ IFvalue *select) BSIM4v3instance *here = (BSIM4v3instance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM4v3_W: diff --git a/src/spicelib/devices/bsim4v4/b4v4par.c b/src/spicelib/devices/bsim4v4/b4v4par.c index 46c1fd77d..332b0140b 100644 --- a/src/spicelib/devices/bsim4v4/b4v4par.c +++ b/src/spicelib/devices/bsim4v4/b4v4par.c @@ -29,7 +29,7 @@ IFvalue *select) BSIM4v4instance *here = (BSIM4v4instance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM4v4_W: diff --git a/src/spicelib/devices/bsim4v5/b4v5par.c b/src/spicelib/devices/bsim4v5/b4v5par.c index 940e66a80..92f202973 100644 --- a/src/spicelib/devices/bsim4v5/b4v5par.c +++ b/src/spicelib/devices/bsim4v5/b4v5par.c @@ -30,7 +30,7 @@ IFvalue *select) BSIM4v5instance *here = (BSIM4v5instance*)inst; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; switch(param) { case BSIM4v5_W: diff --git a/src/spicelib/parser/inpgmod.c b/src/spicelib/parser/inpgmod.c index c08f0123f..b3a01e33f 100644 --- a/src/spicelib/parser/inpgmod.c +++ b/src/spicelib/parser/inpgmod.c @@ -204,7 +204,7 @@ INPgetModBin( CKTcircuit* ckt, char* name, INPmodel** model, INPtables* tab, cha int error; double scale; - if ( !cp_getvar( "scale", VT_REAL, (double*) &scale ) ) scale = 1; + if ( !cp_getvar( "scale", CP_REAL, (double*) &scale ) ) scale = 1; *model = NULL; diff --git a/src/tclspice.c b/src/tclspice.c index fd51a7fab..50abd956d 100755 --- a/src/tclspice.c +++ b/src/tclspice.c @@ -94,7 +94,7 @@ typedef pthread_t threadId_t; #include #include #include -#ifndef _MSC_VER /* avoid second definition of VT_BOOL */ +#ifndef _MSC_VER /* avoid second definition of CP_BOOL */ #include #else #include