From 511cdd718850a6e52a4fcaf16f24f068e385657c Mon Sep 17 00:00:00 2001 From: rlar Date: Mon, 30 Oct 2017 17:35:41 +0100 Subject: [PATCH] struct card, #3/6, rename members from struct line to struct card --- src/frontend/device.c | 8 +- src/frontend/inp.c | 360 +++++++-------- src/frontend/inpcom.c | 798 +++++++++++++++++----------------- src/frontend/measure.c | 40 +- src/frontend/nutinp.c | 74 ++-- src/frontend/options.c | 36 +- src/frontend/runcoms2.c | 4 +- src/frontend/spiceif.c | 26 +- src/frontend/spiceif.h | 2 +- src/frontend/subckt.c | 286 ++++++------ src/frontend/subckt.h | 4 +- src/include/ngspice/enh.h | 2 +- src/include/ngspice/ftedefs.h | 10 +- src/include/ngspice/fteext.h | 20 +- src/main.c | 6 +- src/xspice/enh/enhtrans.c | 38 +- 16 files changed, 857 insertions(+), 857 deletions(-) diff --git a/src/frontend/device.c b/src/frontend/device.c index daa9ef7e1..71638d98b 100644 --- a/src/frontend/device.c +++ b/src/frontend/device.c @@ -1354,7 +1354,7 @@ com_alter_mod(wordlist *wl) char *filename = NULL, *eqword, *input, *modelline = NULL, *inptoken; int modno = 0, molineno = 0, i, j; wordlist *newcommand; - struct line *modeldeck, *tmpdeck; + struct card *modeldeck, *tmpdeck; char *readmode = "r"; char **arglist; bool modelfound = FALSE; @@ -1406,13 +1406,13 @@ com_alter_mod(wordlist *wl) tfree(input); tfree(filename); /* get all lines starting with *model */ - for (tmpdeck = modeldeck; tmpdeck; tmpdeck = tmpdeck->li_next) - if (ciprefix("*model", tmpdeck->li_line)) { + for (tmpdeck = modeldeck; tmpdeck; tmpdeck = tmpdeck->nextcard) + if (ciprefix("*model", tmpdeck->line)) { if (molineno == MODLIM) { fprintf(cp_err, "Error: more than %d models in deck, rest ignored\n", molineno); break; } - modellines[molineno] = tmpdeck->li_line; + modellines[molineno] = tmpdeck->line; molineno++; } /* Check if all models named in altermod command are to be found in input deck. diff --git a/src/frontend/inp.c b/src/frontend/inp.c index aa72d05a2..5cbe1c32f 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -51,13 +51,13 @@ Author: 1985 Wayne A. Christopher static char *upper(register char *string); static bool doedit(char *filename); -static struct line *com_options = NULL; -static void cktislinear(CKTcircuit *ckt, struct line *deck); -static void dotifeval(struct line *deck); +static struct card *com_options = NULL; +static void cktislinear(CKTcircuit *ckt, struct card *deck); +static void dotifeval(struct card *deck); -static wordlist *inp_savecurrents(struct line *deck, struct line *options, wordlist *wl, wordlist *controls); +static wordlist *inp_savecurrents(struct card *deck, struct card *options, wordlist *wl, wordlist *controls); -void line_free_x(struct line *deck, bool recurse); +void line_free_x(struct card *deck, bool recurse); void create_circbyline(char *line); extern bool ft_batchmode; @@ -74,7 +74,7 @@ struct pt_temper { struct pt_temper *next; }; -static int inp_parse_temper(struct line *deck, +static int inp_parse_temper(struct card *deck, struct pt_temper **motdlist_p, struct pt_temper **devtlist_p); static void inp_parse_temper_trees(struct circ *ckt); @@ -179,10 +179,10 @@ upper(char *string) * deck. The listing should be of either LS_PHYSICAL or LS_LOGICAL or * LS_DECK lines as specified by the type parameter. */ void -inp_list(FILE *file, struct line *deck, struct line *extras, int type) +inp_list(FILE *file, struct card *deck, struct card *extras, int type) { - struct line *here; - struct line *there; + struct card *here; + struct card *there; bool renumber; bool useout = (file == cp_out); int i = 1; @@ -203,15 +203,15 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type) if (type == LS_LOGICAL) { top1: - for (here = deck; here; here = here->li_next) { + for (here = deck; here; here = here->nextcard) { if (renumber) - here->li_linenum = i; - if (ciprefix(".end", here->li_line) && !isalpha_c(here->li_line[4])) + here->linenum = i; + if (ciprefix(".end", here->line) && !isalpha_c(here->line[4])) continue; - if (*here->li_line != '*') { - Xprintf(file, "%6d : %s\n", here->li_linenum, upper(here->li_line)); - if (here->li_error) - Xprintf(file, "%s\n", here->li_error); + if (*here->line != '*') { + Xprintf(file, "%6d : %s\n", here->linenum, upper(here->line)); + if (here->error) + Xprintf(file, "%s\n", here->error); } i++; } @@ -227,33 +227,33 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type) } else if ((type == LS_PHYSICAL) || (type == LS_DECK)) { top2: - for (here = deck; here; here = here->li_next) { - if ((here->li_actual == NULL) || (here == deck)) { + for (here = deck; here; here = here->nextcard) { + if ((here->actualLine == NULL) || (here == deck)) { if (renumber) - here->li_linenum = i; - if (ciprefix(".end", here->li_line) && !isalpha_c(here->li_line[4])) + here->linenum = i; + if (ciprefix(".end", here->line) && !isalpha_c(here->line[4])) continue; if (type == LS_PHYSICAL) Xprintf(file, "%6d : %s\n", - here->li_linenum, upper(here->li_line)); + here->linenum, upper(here->line)); else - Xprintf(file, "%s\n", upper(here->li_line)); - if (here->li_error && (type == LS_PHYSICAL)) - Xprintf(file, "%s\n", here->li_error); + Xprintf(file, "%s\n", upper(here->line)); + if (here->error && (type == LS_PHYSICAL)) + Xprintf(file, "%s\n", here->error); } else { - for (there = here->li_actual; there; there = there->li_next) { - there->li_linenum = i++; - if (ciprefix(".end", here->li_line) && isalpha_c(here->li_line[4])) + for (there = here->actualLine; there; there = there->nextcard) { + there->linenum = i++; + if (ciprefix(".end", here->line) && isalpha_c(here->line[4])) continue; if (type == LS_PHYSICAL) Xprintf(file, "%6d : %s\n", - there->li_linenum, upper(there->li_line)); + there->linenum, upper(there->line)); else - Xprintf(file, "%s\n", upper(there->li_line)); - if (there->li_error && (type == LS_PHYSICAL)) - Xprintf(file, "%s\n", there->li_error); + Xprintf(file, "%s\n", upper(there->line)); + if (there->error && (type == LS_PHYSICAL)) + Xprintf(file, "%s\n", there->error); } - here->li_linenum = i; + here->linenum = i; } i++; } @@ -274,19 +274,19 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type) /* * Free memory used by a line. - * If recurse is TRUE then recursively free all lines linked via the ->li_next field. + * If recurse is TRUE then recursively free all lines linked via the ->nextcard field. * If recurse is FALSE free only this line. - * All lines linked via the ->li_actual field are always recursivly freed. + * All lines linked via the ->actualLine field are always recursivly freed. * SJB - 22nd May 2001 */ void -line_free_x(struct line *deck, bool recurse) +line_free_x(struct card *deck, bool recurse) { while (deck) { - struct line *next_deck = deck->li_next; - line_free_x(deck->li_actual, TRUE); - tfree(deck->li_line); - tfree(deck->li_error); + struct card *next_deck = deck->nextcard; + line_free_x(deck->actualLine, TRUE); + tfree(deck->line); + tfree(deck->error); tfree(deck); if (!recurse) return; @@ -296,31 +296,31 @@ line_free_x(struct line *deck, bool recurse) /* concatenate two lists, destructively altering the first one */ -struct line * -line_nconc(struct line *head, struct line *rest) +struct card * +line_nconc(struct card *head, struct card *rest) { - struct line *p = head; + struct card *p = head; if (!rest) return head; if (!head) return rest; - while (p->li_next) - p = p->li_next; - p->li_next = rest; + while (p->nextcard) + p = p->nextcard; + p->nextcard = rest; return head; } -/* reverse the linked list struct line */ -struct line * -line_reverse(struct line *head) +/* reverse the linked list struct card */ +struct card * +line_reverse(struct card *head) { - struct line *prev = NULL; - struct line *next; + struct card *prev = NULL; + struct card *next; while (head) { - next = head->li_next; - head->li_next = prev; + next = head->nextcard; + head->nextcard = prev; prev = head; head = next; } @@ -343,8 +343,8 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) * intfile = whether input is from internal array. Values are TRUE/FALSE */ { - struct line *deck, *dd, *ld, *prev_param = NULL, *prev_card = NULL; - struct line *realdeck = NULL, *options = NULL, *curr_meas = NULL; + struct card *deck, *dd, *ld, *prev_param = NULL, *prev_card = NULL; + struct card *realdeck = NULL, *options = NULL, *curr_meas = NULL; char *tt = NULL, name[BSIZE_SP], *s, *t, *temperature = NULL; double testemp = 0.0; bool commands = FALSE; @@ -377,7 +377,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) } /* files starting with *ng_script are user supplied command files */ - if (ciprefix("*ng_script", deck->li_line)) + if (ciprefix("*ng_script", deck->line)) comfile = TRUE; if (!comfile) { @@ -389,8 +389,8 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) realdeck = inp_deckcopy(deck); /* Save the title before INPgetTitle gets it. */ - tt = copy(deck->li_line); - if (!deck->li_next) + tt = copy(deck->line); + if (!deck->nextcard) fprintf(cp_err, "Warning: no lines in input\n"); } if (!intfile) @@ -419,17 +419,17 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) /* Process each command, except 'option' which is assembled in a list and ingnored here */ for (dd = deck; dd; dd = ld) { - ld = dd->li_next; - if ((dd->li_line[0] == '*') && (dd->li_line[1] != '#')) + ld = dd->nextcard; + if ((dd->line[0] == '*') && (dd->line[1] != '#')) continue; - if (!ciprefix(".control", dd->li_line) && !ciprefix(".endc", dd->li_line)) { - if (dd->li_line[0] == '*') - cp_evloop(dd->li_line + 2); + if (!ciprefix(".control", dd->line) && !ciprefix(".endc", dd->line)) { + if (dd->line[0] == '*') + cp_evloop(dd->line + 2); /* option line stored but not processed */ - else if (ciprefix("option", dd->li_line)) - com_options = inp_getoptsc(dd->li_line, com_options); + else if (ciprefix("option", dd->line)) + com_options = inp_getoptsc(dd->line, com_options); else - cp_evloop(dd->li_line); + cp_evloop(dd->line); } } /* free the control deck */ @@ -442,22 +442,22 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) else { /* must be regular deck . . . . */ /* loop through deck and handle control cards */ - for (dd = deck->li_next; dd; dd = ld->li_next) { + for (dd = deck->nextcard; dd; dd = ld->nextcard) { /* get temp from deck */ - if (ciprefix(".temp", dd->li_line)) { - s = skip_ws(dd->li_line + 5); + if (ciprefix(".temp", dd->line)) { + s = skip_ws(dd->line + 5); if (temperature) txfree(temperature); temperature = strdup(s); } /* Ignore comment lines, but not lines begining with '*#', but remove them, if they are in a .control ... .endc section */ - s = skip_ws(dd->li_line); - if ((*s == '*') && ((s != dd->li_line) || (s[1] != '#'))) { + s = skip_ws(dd->line); + if ((*s == '*') && ((s != dd->line) || (s[1] != '#'))) { if (commands) { /* Remove comment lines in control sections, so they don't * get considered as circuits. */ - ld->li_next = dd->li_next; + ld->nextcard = dd->nextcard; line_free(dd, FALSE); continue; } @@ -466,55 +466,55 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) } /* Put the first token from line into s */ - strncpy(name, dd->li_line, BSIZE_SP); + strncpy(name, dd->line, BSIZE_SP); s = skip_ws(name); t = skip_non_ws(s); *t = '\0'; - if (ciprefix(".control", dd->li_line)) { - ld->li_next = dd->li_next; + if (ciprefix(".control", dd->line)) { + ld->nextcard = dd->nextcard; line_free(dd, FALSE); /* SJB - free this line's memory */ if (commands) fprintf(cp_err, "Warning: redundant .control card\n"); else commands = TRUE; - } else if (ciprefix(".endc", dd->li_line)) { - ld->li_next = dd->li_next; + } else if (ciprefix(".endc", dd->line)) { + ld->nextcard = dd->nextcard; line_free(dd, FALSE); /* SJB - free this line's memory */ if (commands) commands = FALSE; else fprintf(cp_err, "Warning: misplaced .endc card\n"); - } else if (commands || prefix("*#", dd->li_line)) { + } else if (commands || prefix("*#", dd->line)) { /* assemble all commands starting with pre_ after stripping pre_, to be executed before circuit parsing */ - if (ciprefix("pre_", dd->li_line)) { - s = copy(dd->li_line + 4); + if (ciprefix("pre_", dd->line)) { + s = copy(dd->line + 4); pre_controls = wl_cons(s, pre_controls); } /* assemble all other commands to be executed after circuit parsing */ else { /* special control lines outside of .control section*/ - if (prefix("*#", dd->li_line)) { - s = copy(dd->li_line + 2); + if (prefix("*#", dd->line)) { + s = copy(dd->line + 2); /* all commands from within .control section */ } else { - s = dd->li_line; - dd->li_line = NULL; /* SJB - prevent line_free() freeing the string (now pointed at by wl->wl_word) */ + s = dd->line; + dd->line = NULL; /* SJB - prevent line_free() freeing the string (now pointed at by wl->wl_word) */ } controls = wl_cons(s, controls); } - ld->li_next = dd->li_next; + ld->nextcard = dd->nextcard; line_free(dd, FALSE); - } else if (!*dd->li_line) { + } else if (!*dd->line) { /* So blank lines in com files don't get considered as circuits. */ - ld->li_next = dd->li_next; + ld->nextcard = dd->nextcard; line_free(dd, FALSE); } else { /* lines .width, .four, .plot, .print, .save added to wl_first, removed from deck */ /* lines .op, .meas, .tf added to wl_first */ inp_casefix(s); /* s: first token from line */ - inp_casefix(dd->li_line); + inp_casefix(dd->line); if (eq(s, ".width") || ciprefix(".four", s) || eq(s, ".plot") || @@ -524,10 +524,10 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) ciprefix(".meas", s) || eq(s, ".tf")) { - wl_append_word(&wl_first, &end, copy(dd->li_line)); + wl_append_word(&wl_first, &end, copy(dd->line)); if (!eq(s, ".op") && !eq(s, ".tf") && !ciprefix(".meas", s)) { - ld->li_next = dd->li_next; + ld->nextcard = dd->nextcard; line_free(dd, FALSE); } else { ld = dd; @@ -536,7 +536,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) ld = dd; } } - } /* end for (dd = deck->li_next . . . . */ + } /* end for (dd = deck->nextcard . . . . */ /* Now that the deck is loaded, do the pre commands, if there are any, before the circuit structure is set up */ @@ -560,16 +560,16 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) /* We are done handling the control stuff. Now process remainder of deck. Go on if there is something left after the controls.*/ - if (deck->li_next) { + if (deck->nextcard) { fprintf(cp_out, "\nCircuit: %s\n\n", tt); #ifdef HAS_PROGREP SetAnalyse("Prepare Deck", 0); #endif /* Now expand subcircuit macros and substitute numparams.*/ if (!cp_getvar("nosubckt", CP_BOOL, NULL)) - if ((deck->li_next = inp_subcktexpand(deck->li_next)) == NULL) { + if ((deck->nextcard = inp_subcktexpand(deck->nextcard)) == NULL) { line_free(realdeck, TRUE); - line_free(deck->li_actual, TRUE); + line_free(deck->actualLine, TRUE); tfree(tt); return; } @@ -577,41 +577,41 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) /* Now handle translation of spice2c6 POLYs. */ #ifdef XSPICE /* Translate all SPICE 2G6 polynomial type sources */ - deck->li_next = ENHtranslate_poly(deck->li_next); + deck->nextcard = ENHtranslate_poly(deck->nextcard); #endif - line_free(deck->li_actual, FALSE); - deck->li_actual = realdeck; + line_free(deck->actualLine, FALSE); + deck->actualLine = realdeck; /* print out the expanded deck into debug-out2.txt */ if (ft_ngdebug) { /*debug: print into file*/ FILE *fdo = fopen("debug-out2.txt", "w"); - struct line *t = NULL; + struct card *t = NULL; fprintf(fdo, "**************** uncommented deck **************\n\n"); /* always print first line */ - fprintf(fdo, "%6d %6d %s\n", deck->li_linenum_orig, deck->li_linenum, deck->li_line); + fprintf(fdo, "%6d %6d %s\n", deck->linenum_orig, deck->linenum, deck->line); /* here without out-commented lines */ - for (t = deck->li_next; t; t = t->li_next) { - if (*(t->li_line) == '*') + for (t = deck->nextcard; t; t = t->nextcard) { + if (*(t->line) == '*') continue; - fprintf(fdo, "%6d %6d %s\n", t->li_linenum_orig, t->li_linenum, t->li_line); + fprintf(fdo, "%6d %6d %s\n", t->linenum_orig, t->linenum, t->line); } fprintf(fdo, "\n****************** complete deck ***************\n\n"); /* now completely */ - for (t = deck; t; t = t->li_next) - fprintf(fdo, "%6d %6d %s\n", t->li_linenum_orig, t->li_linenum, t->li_line); + for (t = deck; t; t = t->nextcard) + fprintf(fdo, "%6d %6d %s\n", t->linenum_orig, t->linenum, t->line); fclose(fdo); } - for (dd = deck; dd; dd = dd->li_next) { + for (dd = deck; dd; dd = dd->nextcard) { /* get csparams and create vectors, being available in .control section, in plot 'const' */ - if (ciprefix(".csparam", dd->li_line)) { + if (ciprefix(".csparam", dd->line)) { wordlist *wlist = NULL; char *cstoken[3]; int i; - dd->li_line[0] = '*'; - s = skip_ws(dd->li_line + 8); + dd->line[0] = '*'; + s = skip_ws(dd->line + 8); cstoken[0] = gettok_char(&s, '=', FALSE, FALSE); cstoken[1] = gettok_char(&s, '=', TRUE, FALSE); cstoken[2] = gettok(&s); @@ -654,7 +654,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) tt = NULL; options = NULL; - } /* if (deck->li_next) */ + } /* if (deck->nextcard) */ /* look for and set temperature; also store param and .meas statements in circuit struct */ if (ft_curckt) { @@ -664,33 +664,33 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) ft_curckt->FTEstats->FTESTATnetLoadTime = endTime - startTime; } - for (dd = deck; dd; dd = dd->li_next) { + for (dd = deck; dd; dd = dd->nextcard) { /* all parameter lines should be sequentially ordered and placed at beginning of deck */ - if (ciprefix(".para", dd->li_line)) { + if (ciprefix(".para", dd->line)) { ft_curckt->ci_param = dd; /* find end of .param statements */ - while (ciprefix(".para", dd->li_line)) { + while (ciprefix(".para", dd->line)) { prev_param = dd; - dd = dd->li_next; + dd = dd->nextcard; if (dd == NULL) break; // no line after .param line } - prev_card->li_next = dd; - prev_param->li_next = NULL; + prev_card->nextcard = dd; + prev_param->nextcard = NULL; if (dd == NULL) { fprintf(cp_err, "Warning: Missing .end card!\n"); break; // no line after .param line } } - if (ciprefix(".meas", dd->li_line)) { + if (ciprefix(".meas", dd->line)) { if (cp_getvar("autostop", CP_BOOL, NULL)) { - 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 ")) + if (strstr(dd->line, " max ") || + strstr(dd->line, " min ") || + strstr(dd->line, " avg ") || + strstr(dd->line, " rms ") || + strstr(dd->line, " integ ")) { printf("Warning: .OPTION AUTOSTOP will not be effective because one of 'max|min|avg|rms|integ' is used in .meas\n"); printf(" AUTOSTOP being disabled...\n"); @@ -701,11 +701,11 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) if (curr_meas == NULL) { curr_meas = ft_curckt->ci_meas = dd; } else { - curr_meas->li_next = dd; + curr_meas->nextcard = dd; curr_meas = dd; } - prev_card->li_next = dd->li_next; - curr_meas->li_next = NULL; + prev_card->nextcard = dd->nextcard; + curr_meas->nextcard = NULL; dd = prev_card; } prev_card = dd; @@ -729,20 +729,20 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) if (ft_ngdebug) { /*debug: print into file*/ FILE *fdo = fopen("debug-out3.txt", "w"); - struct line *t = NULL; + struct card *t = NULL; fprintf(fdo, "**************** uncommented deck **************\n\n"); /* always print first line */ - fprintf(fdo, "%6d %6d %s\n", deck->li_linenum_orig, deck->li_linenum, deck->li_line); + fprintf(fdo, "%6d %6d %s\n", deck->linenum_orig, deck->linenum, deck->line); /* here without out-commented lines */ - for (t = deck->li_next; t; t = t->li_next) { - if (*(t->li_line) == '*') + for (t = deck->nextcard; t; t = t->nextcard) { + if (*(t->line) == '*') continue; - fprintf(fdo, "%6d %6d %s\n", t->li_linenum_orig, t->li_linenum, t->li_line); + fprintf(fdo, "%6d %6d %s\n", t->linenum_orig, t->linenum, t->line); } fprintf(fdo, "\n****************** complete deck ***************\n\n"); /* now completely */ - for (t = deck; t; t = t->li_next) - fprintf(fdo, "%6d %6d %s\n", t->li_linenum_orig, t->li_linenum, t->li_line); + for (t = deck; t; t = t->nextcard) + fprintf(fdo, "%6d %6d %s\n", t->linenum_orig, t->linenum, t->line); fclose(fdo); } @@ -789,17 +789,17 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) *-----------------------------------------------------------------*/ void inp_dodeck( - struct line *deck, /*in: the spice deck */ + struct card *deck, /*in: the spice deck */ char *tt, /*in: the title of the deck */ wordlist *end, /*in: all lines with .width, .plot, .print, .save, .op, .meas, .tf */ bool reuse, /*in: TRUE if called from runcoms2.c com_rset, FALSE if called from inp_spsource() */ - struct line *options, /*in: all .option lines from deck */ + struct card *options, /*in: all .option lines from deck */ char *filename /*in: input file of deck */ ) { struct circ *ct; - struct line *dd; + struct card *dd; CKTcircuit *ckt; char *s; INPtables *tab = NULL; @@ -814,10 +814,10 @@ inp_dodeck( /* First throw away any old error messages there might be and fix the case of the lines. */ - for (dd = deck; dd; dd = dd->li_next) - if (dd->li_error) { - tfree(dd->li_error); - dd->li_error = NULL; + for (dd = deck; dd; dd = dd->nextcard) + if (dd->error) { + tfree(dd->error); + dd->error = NULL; } if (reuse) { @@ -841,9 +841,9 @@ inp_dodeck( is needed because we need the scale info BEFORE building the circuit and seems there is no other way to do this. */ if (!noparse) { - struct line *opt_beg = options; - for (; options; options = options->li_next) { - s = skip_non_ws(options->li_line); + struct card *opt_beg = options; + for (; options; options = options->nextcard) { + s = skip_non_ws(options->line); ii = cp_interactive; cp_interactive = FALSE; @@ -916,42 +916,42 @@ inp_dodeck( ft_curckt->FTEstats->FTESTATdeckNumLines = 0; /*---------------------------------------------------- Now run through the deck and look to see if there are - errors on any line (message contained in ->li_error). + errors on any line (message contained in ->error). Error messages have been generated either by writing - directly to ->li_error from a struct line or to + directly to ->error from a struct card or to ->error from a struct card , or by using one of the macros as defined in inpmacs.h. Functions INPerror(), INPerrCat(), and SPerror() are invoked. *---------------------------------------------------*/ - for (dd = deck; dd; dd = dd->li_next) { + for (dd = deck; dd; dd = dd->nextcard) { ft_curckt->FTEstats->FTESTATdeckNumLines += 1; #ifdef TRACE /* SDB debug statement */ - printf("In inp_dodeck, looking for errors and examining line %s . . . \n", dd->li_line); + printf("In inp_dodeck, looking for errors and examining line %s . . . \n", dd->line); #endif - if (dd->li_error) { + if (dd->error) { char *p, *q; #ifdef XSPICE /* add setting of ipc syntax error flag */ g_ipc.syntax_error = IPC_TRUE; #endif - p = dd->li_error; + p = dd->error; do { q = strchr(p, '\n'); if (q) *q = '\0'; - if (p == dd->li_error) { - if (strstr(dd->li_line, ".model")) + if (p == dd->error) { + if (strstr(dd->line, ".model")) out_printf("Warning: Model issue on line %d :\n %.*s ...\n%s\n", - dd->li_linenum_orig, 72, dd->li_line, dd->li_error); + dd->linenum_orig, 72, dd->line, dd->error); else { out_printf("Error on line %d :\n %s\n%s\n", - dd->li_linenum_orig, dd->li_line, dd->li_error); + dd->linenum_orig, dd->line, dd->error); have_err = TRUE; } if (ft_stricterror) @@ -964,9 +964,9 @@ inp_dodeck( *q++ = '\n'; p = q; } while (p && *p); - } /* end if (dd->li_error) */ + } /* end if (dd->error) */ - } /* for (dd = deck; dd; dd = dd->li_next) */ + } /* for (dd = deck; dd; dd = dd->nextcard) */ /* Stop here and exit if error occurred in batch mode */ if (have_err && ft_batchmode) { @@ -980,12 +980,12 @@ inp_dodeck( out_printf("\nProcessed Netlist\n"); out_printf("=================\n"); print_listing = 1; - for (dd = deck; dd; dd = dd->li_next) { - if (ciprefix(".prot", dd->li_line)) + for (dd = deck; dd; dd = dd->nextcard) { + if (ciprefix(".prot", dd->line)) print_listing = 0; if (print_listing == 1) - out_printf("%s\n", dd->li_line); - if (ciprefix(".unprot", dd->li_line)) + out_printf("%s\n", dd->line); + if (ciprefix(".unprot", dd->line)) print_listing = 1; } out_printf("\n"); @@ -1006,8 +1006,8 @@ inp_dodeck( ct->ci_name = tt; ct->ci_deck = deck; ct->ci_options = options; - if (deck->li_actual) - ct->ci_origdeck = deck->li_actual; + if (deck->actualLine) + ct->ci_origdeck = deck->actualLine; else ct->ci_origdeck = ct->ci_deck; ct->ci_ckt = ckt; /* attach the input ckt to the list of circuits */ @@ -1021,8 +1021,8 @@ inp_dodeck( if (!noparse) { /* - * for (; options; options = options->li_next) { - * s = skip_non_ws(options->li_line); + * for (; options; options = options->nextcard) { + * s = skip_non_ws(options->line); * ii = cp_interactive; * cp_interactive = FALSE; * wl = cp_lexer(s); @@ -1264,14 +1264,14 @@ inp_source(char *file) ckt->CKTisLinear is set to 1. Return immediately if a first non-linear element is found. */ static void -cktislinear(CKTcircuit *ckt, struct line *deck) +cktislinear(CKTcircuit *ckt, struct card *deck) { - struct line *dd; + struct card *dd; char firstchar; - if (deck->li_next) - for (dd = deck->li_next; dd; dd = dd->li_next) { - firstchar = *dd->li_line; + if (deck->nextcard) + for (dd = deck->nextcard; dd; dd = dd->nextcard) { + firstchar = *dd->line; switch (firstchar) { case 'r': case 'l': @@ -1342,17 +1342,17 @@ com_circbyline(wordlist *wl) numparam has evaluated .if('boolean expression') to .if ( 1.000000000e+000 ) or .elseif ( 0.000000000e+000 ) */ static void -dotifeval(struct line *deck) +dotifeval(struct card *deck) { int iftrue = 0, elseiftrue = 0, elsetrue = 0, iffound = 0, elseiffound = 0, elsefound = 0; - struct line *dd; + struct card *dd; char *dottoken; char *s, *t; /* skip the first line (title line) */ - for (dd = deck->li_next; dd; dd = dd->li_next) { + for (dd = deck->nextcard; dd; dd = dd->nextcard) { - s = t = dd->li_line; + s = t = dd->line; if (*s == '*') continue; @@ -1364,7 +1364,7 @@ dotifeval(struct line *deck) elseiffound = 0; iffound = 1; *s = '*'; - s = dd->li_line + 3; + s = dd->line + 3; iftrue = atoi(s); } else if (cieq(dottoken, ".elseif")) { @@ -1373,7 +1373,7 @@ dotifeval(struct line *deck) iffound = 0; *s = '*'; if (!iftrue) { - s = dd->li_line + 7; + s = dd->line + 7; elseiftrue = atoi(s); } } @@ -1435,7 +1435,7 @@ dotifeval(struct line *deck) */ static int -inp_parse_temper(struct line *card, struct pt_temper **modtlist_p, struct pt_temper **devtlist_p) +inp_parse_temper(struct card *card, struct pt_temper **modtlist_p, struct pt_temper **devtlist_p) { int error = 0; @@ -1443,10 +1443,10 @@ inp_parse_temper(struct line *card, struct pt_temper **modtlist_p, struct pt_tem struct pt_temper *devtlist = NULL; /* skip title line */ - card = card->li_next; - for (; card; card = card->li_next) { + card = card->nextcard; + for (; card; card = card->nextcard) { - char *curr_line = card->li_line; + char *curr_line = card->line; /* exclude some elements */ if (strchr("*vbiegfh", curr_line[0])) @@ -1600,13 +1600,13 @@ inp_evaluate_temper(struct circ *circ) */ static wordlist * -inp_savecurrents(struct line *deck, struct line *options, wordlist *wl, wordlist *controls) +inp_savecurrents(struct card *deck, struct card *options, wordlist *wl, wordlist *controls) { wordlist *p; /* check if option 'savecurrents' is set */ - for (; options; options = options->li_next) - if (strstr(options->li_line, "savecurrents")) + for (; options; options = options->nextcard) + if (strstr(options->line, "savecurrents")) break; if (!options) @@ -1633,8 +1633,8 @@ inp_savecurrents(struct line *deck, struct line *options, wordlist *wl, wordlist * We currently serve bipolars, resistors, MOS1, capacitors, inductors, * controlled current sources. Others may follow. */ - for (deck = deck->li_next; deck; deck = deck->li_next) { - char *newline, *devname, *devline = deck->li_line; + for (deck = deck->nextcard; deck; deck = deck->nextcard) { + char *newline, *devname, *devline = deck->line; switch (devline[0]) { case 'm': diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index a677d513d..3bb11db9a 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -56,7 +56,7 @@ Author: 1985 Wayne A. Christopher static struct library { char *realpath; char *habitat; - struct line *deck; + struct card *deck; } libraries[N_LIBRARIES]; static int num_libraries; @@ -88,7 +88,7 @@ struct func_temper struct func_temper *next; }; -extern void line_free_x(struct line *deck, bool recurse); +extern void line_free_x(struct card *deck, bool recurse); static COMPATMODE_T inp_compat_mode; @@ -103,50 +103,50 @@ long dynsubst; /* spicenum.c 221 */ static char *readline(FILE *fd); static int get_number_terminals(char *c); -static void inp_stripcomments_deck(struct line *deck, bool cs); +static void inp_stripcomments_deck(struct card *deck, bool cs); static void inp_stripcomments_line(char *s, bool cs); -static void inp_fix_for_numparam(struct names *subckt_w_params, struct line *deck); -static void inp_remove_excess_ws(struct line *deck); -static void expand_section_references(struct line *deck, char *dir_name); -static void inp_grab_func(struct function_env *, struct line *deck); -static void inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struct line *deck); +static void inp_fix_for_numparam(struct names *subckt_w_params, struct card *deck); +static void inp_remove_excess_ws(struct card *deck); +static void expand_section_references(struct card *deck, char *dir_name); +static void inp_grab_func(struct function_env *, struct card *deck); +static void inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struct card *deck); static void inp_expand_macros_in_func(struct function_env *); -static struct line *inp_expand_macros_in_deck(struct function_env *, struct line *deck); -static void inp_fix_param_values(struct line *deck); -static void inp_reorder_params(struct names *subckt_w_params, struct line *list_head); -static int inp_split_multi_param_lines(struct line *deck, int line_number); -static void inp_sort_params(struct line *param_cards, struct line *card_bf_start, struct line *s_c, struct line *e_c); +static struct card *inp_expand_macros_in_deck(struct function_env *, struct card *deck); +static void inp_fix_param_values(struct card *deck); +static void inp_reorder_params(struct names *subckt_w_params, struct card *list_head); +static int inp_split_multi_param_lines(struct card *deck, int line_number); +static void inp_sort_params(struct card *param_cards, struct card *card_bf_start, struct card *s_c, struct card *e_c); static char *inp_remove_ws(char *s); -static void inp_compat(struct line *deck); -static void inp_bsource_compat(struct line *deck); -static bool inp_temper_compat(struct line *card); -static void inp_dot_if(struct line *deck); +static void inp_compat(struct card *deck); +static void inp_bsource_compat(struct card *deck); +static bool inp_temper_compat(struct card *card); +static void inp_dot_if(struct card *deck); static char *inp_modify_exp(char* expression); -static struct func_temper *inp_new_func(char *funcname, char *funcbody, struct line *card, +static struct func_temper *inp_new_func(char *funcname, char *funcbody, struct card *card, int *sub_count, int subckt_depth); static void inp_delete_funcs(struct func_temper *funcs); static bool chk_for_line_continuation(char *line); -static void comment_out_unused_subckt_models(struct line *start_card); -static void inp_fix_macro_param_func_paren_io(struct line *begin_card); -static void inp_fix_gnd_name(struct line *deck); -static void inp_chk_for_multi_in_vcvs(struct line *deck, int *line_number); -static void inp_add_control_section(struct line *deck, int *line_number); +static void comment_out_unused_subckt_models(struct card *start_card); +static void inp_fix_macro_param_func_paren_io(struct card *begin_card); +static void inp_fix_gnd_name(struct card *deck); +static void inp_chk_for_multi_in_vcvs(struct card *deck, int *line_number); +static void inp_add_control_section(struct card *deck, int *line_number); static char *get_quoted_token(char *string, char **token); static void replace_token(char *string, char *token, int where, int total); -static void inp_add_series_resistor(struct line *deck); -static void subckt_params_to_param(struct line *deck); -static void inp_fix_temper_in_param(struct line *deck); +static void inp_add_series_resistor(struct card *deck); +static void subckt_params_to_param(struct card *deck); +static void inp_fix_temper_in_param(struct card *deck); static char *inp_spawn_brace(char *s); static char *inp_pathresolve(const char *name); static char *inp_pathresolve_at(char *name, char *dir); static char *search_plain_identifier(char *str, const char *identifier); -void tprint(struct line *deck); +void tprint(struct card *deck); struct inp_read_t -{ struct line *cc; +{ struct card *cc; int line_number; }; @@ -154,39 +154,39 @@ static struct inp_read_t inp_read(FILE *fp, int call_depth, char *dir_name, bool #ifndef XSPICE -static void inp_poly_err(struct line *deck); +static void inp_poly_err(struct card *deck); #endif /* insert a new card, just behind the given card */ -static struct line * -insert_new_line(struct line *card, char *line, int linenum, int linenum_orig) +static struct card * +insert_new_line(struct card *card, char *line, int linenum, int linenum_orig) { - struct line *x = TMALLOC(struct line, 1); + struct card *x = TMALLOC(struct card, 1); - x->li_next = card ? card->li_next : NULL; - x->li_error = NULL; - x->li_actual = NULL; - x->li_line = line; - x->li_linenum = linenum; - x->li_linenum_orig = linenum_orig; + x->nextcard = card ? card->nextcard : NULL; + x->error = NULL; + x->actualLine = NULL; + x->line = line; + x->linenum = linenum; + x->linenum_orig = linenum_orig; if (card) - card->li_next = x; + card->nextcard = x; return x; } /* insert new_card, just behind the given card */ -static struct line * -insert_deck(struct line *card, struct line *new_card) +static struct card * +insert_deck(struct card *card, struct card *new_card) { if (card) { - new_card->li_next = card->li_next; - card->li_next = new_card; + new_card->nextcard = card->nextcard; + card->nextcard = new_card; } else { - new_card->li_next = NULL; + new_card->nextcard = NULL; } return new_card; } @@ -230,12 +230,12 @@ find_lib(char *name) } -static struct line * -find_section_definition(struct line *c, char *name) +static struct card * +find_section_definition(struct card *c, char *name) { - for (; c; c = c->li_next) { + for (; c; c = c->nextcard) { - char *line = c->li_line; + char *line = c->line; if (ciprefix(".lib", line)) { @@ -353,19 +353,19 @@ delete_names(struct names *p) */ static void -inp_stitch_continuation_lines(struct line *working) +inp_stitch_continuation_lines(struct card *working) { - struct line *prev = NULL; + struct card *prev = NULL; while (working) { char *s, c, *buffer; - for (s = working->li_line; (c = *s) != '\0' && c <= ' '; s++) + for (s = working->line; (c = *s) != '\0' && c <= ' '; s++) ; #ifdef TRACE /* SDB debug statement */ - printf("In inp_read, processing linked list element line = %d, s = %s . . . \n", working->li_linenum, s); + printf("In inp_read, processing linked list element line = %d, s = %s . . . \n", working->linenum, s); #endif switch (c) { @@ -374,49 +374,49 @@ inp_stitch_continuation_lines(struct line *working) case '*': case '\0': /* skip these cards, and keep prev as the last regular card */ - working = working->li_next; /* for these chars, go to next card */ + working = working->nextcard; /* for these chars, go to next card */ break; case '+': /* handle continuation */ if (!prev) { - working->li_error = copy("Illegal continuation line: ignored."); - working = working->li_next; + working->error = copy("Illegal continuation line: ignored."); + working = working->nextcard; break; } /* We now may have lept over some comment lines, which are located among the continuation lines. We have to delete them here to prevent a memory leak */ - while (prev->li_next != working) { - struct line *tmpl = prev->li_next->li_next; - line_free_x(prev->li_next, FALSE); - prev->li_next = tmpl; + while (prev->nextcard != working) { + struct card *tmpl = prev->nextcard->nextcard; + line_free_x(prev->nextcard, FALSE); + prev->nextcard = tmpl; } /* create buffer and write last and current line into it. */ - buffer = tprintf("%s %s", prev->li_line, s + 1); - - /* replace prev->li_line by buffer */ - s = prev->li_line; - prev->li_line = buffer; - prev->li_next = working->li_next; - working->li_next = NULL; - /* add original line to prev->li_actual */ - if (prev->li_actual) { - struct line *end; - for (end = prev->li_actual; end->li_next; end = end->li_next) + buffer = tprintf("%s %s", prev->line, s + 1); + + /* replace prev->line by buffer */ + s = prev->line; + prev->line = buffer; + prev->nextcard = working->nextcard; + working->nextcard = NULL; + /* add original line to prev->actualLine */ + if (prev->actualLine) { + struct card *end; + for (end = prev->actualLine; end->nextcard; end = end->nextcard) ; - end->li_next = working; + end->nextcard = working; tfree(s); } else { - prev->li_actual = insert_new_line(NULL, s, prev->li_linenum, 0); - prev->li_actual->li_next = working; + prev->actualLine = insert_new_line(NULL, s, prev->linenum, 0); + prev->actualLine->nextcard = working; } - working = prev->li_next; + working = prev->nextcard; break; default: /* regular one-line card */ prev = working; - working = working->li_next; + working = working->nextcard; break; } } @@ -512,10 +512,10 @@ find_back_assignment(const char *p, const char *start) debug printout to debug-out.txt *-------------------------------------------------------------------------*/ -struct line * +struct card * inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_temper_p) { - struct line *cc; + struct card *cc; struct inp_read_t rv; num_libraries = 0; @@ -525,7 +525,7 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_t cc = rv . cc; /* files starting with *ng_script are user supplied command files */ - if (cc && ciprefix("*ng_script", cc->li_line)) + if (cc && ciprefix("*ng_script", cc->line)) comfile = TRUE; /* The following processing of an input file is not required for command files @@ -535,10 +535,10 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_t unsigned int no_braces; /* number of '{' */ size_t max_line_length; /* max. line length in input deck */ - struct line *tmp_ptr1; + struct card *tmp_ptr1; struct names *subckt_w_params = new_names(); - struct line *working = cc->li_next; + struct card *working = cc->nextcard; delete_libs(); inp_fix_for_numparam(subckt_w_params, working); @@ -575,10 +575,10 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_t bool expr_w_temper = FALSE; if (inp_compat_mode != COMPATMODE_SPICE3) { /* Do all the compatibility stuff here */ - working = cc->li_next; + working = cc->nextcard; /* E, G, L, R, C compatibility transformations */ inp_compat(working); - working = cc->li_next; + working = cc->nextcard; /* B source numparam compatibility transformation */ inp_bsource_compat(working); inp_dot_if(working); @@ -596,17 +596,17 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_t dynmaxline = 0; max_line_length = 0; no_braces = 0; - for (tmp_ptr1 = cc; tmp_ptr1; tmp_ptr1 = tmp_ptr1->li_next) { + for (tmp_ptr1 = cc; tmp_ptr1; tmp_ptr1 = tmp_ptr1->nextcard) { char *s; unsigned int braces_per_line = 0; /* count number of lines */ dynmaxline++; /* renumber the lines of the processed input deck */ - tmp_ptr1->li_linenum = dynmaxline; - if (max_line_length < strlen(tmp_ptr1->li_line)) - max_line_length = strlen(tmp_ptr1->li_line); + tmp_ptr1->linenum = dynmaxline; + if (max_line_length < strlen(tmp_ptr1->line)) + max_line_length = strlen(tmp_ptr1->line); /* count '{' */ - for (s = tmp_ptr1->li_line; *s; s++) + for (s = tmp_ptr1->line; *s; s++) if (*s == '{') braces_per_line++; if (no_braces < braces_per_line) @@ -616,20 +616,20 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_t if (ft_ngdebug) { /*debug: print into file*/ FILE *fd = fopen("debug-out.txt", "w"); - struct line *t; + struct card *t; fprintf(fd, "**************** uncommented deck **************\n\n"); /* always print first line */ - fprintf(fd, "%6d %6d %s\n", cc->li_linenum_orig, cc->li_linenum, cc->li_line); + fprintf(fd, "%6d %6d %s\n", cc->linenum_orig, cc->linenum, cc->line); /* here without out-commented lines */ - for (t = cc->li_next; t; t = t->li_next) { - if (*(t->li_line) == '*') + for (t = cc->nextcard; t; t = t->nextcard) { + if (*(t->line) == '*') continue; - fprintf(fd, "%6d %6d %s\n", t->li_linenum_orig, t->li_linenum, t->li_line); + fprintf(fd, "%6d %6d %s\n", t->linenum_orig, t->linenum, t->line); } fprintf(fd, "\n****************** complete deck ***************\n\n"); /* now completely */ - for (t = cc; t; t = t->li_next) - fprintf(fd, "%6d %6d %s\n", t->li_linenum_orig, t->li_linenum, t->li_line); + for (t = cc; t; t = t->nextcard) + fprintf(fd, "%6d %6d %s\n", t->linenum_orig, t->linenum, t->line); fclose(fd); fprintf(stdout, "max line length %d, max subst. per line %d, number of lines %d\n", @@ -651,7 +651,7 @@ inp_read(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile) */ { struct inp_read_t rv; - struct line *end = NULL, *cc = NULL; + struct card *end = NULL, *cc = NULL; char *buffer = NULL; /* segfault fix */ #ifdef XSPICE @@ -659,7 +659,7 @@ inp_read(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile) int line_count = 0; #endif char *new_title = NULL; - int line_number = 1; /* sjb - renamed to avoid confusion with struct line */ + int line_number = 1; /* sjb - renamed to avoid confusion with struct card */ int line_number_orig = 1; int cirlinecount = 0; /* length of circarray */ static int is_control = 0; /* We are reading from a .control section */ @@ -789,7 +789,7 @@ inp_read(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile) char *y = NULL; char *s; - struct line *newcard; + struct card *newcard; inp_stripcomments_line(buffer, FALSE); @@ -848,14 +848,14 @@ inp_read(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile) if (newcard) { int line_number_inc = 1; - end->li_next = newcard; + end->nextcard = newcard; /* Renumber the lines */ - for (end = newcard; end && end->li_next; end = end->li_next) { - end->li_linenum = line_number++; - end->li_linenum_orig = line_number_inc++; + for (end = newcard; end && end->nextcard; end = end->nextcard) { + end->linenum = line_number++; + end->linenum_orig = line_number_inc++; } - end->li_linenum = line_number++; /* SJB - renumber the last line */ - end->li_linenum_orig = line_number_inc++; /* SJB - renumber the last line */ + end->linenum = line_number++; /* SJB - renumber the last line */ + end->linenum_orig = line_number_inc++; /* SJB - renumber the last line */ } /* Fix the buffer up a bit. */ @@ -932,7 +932,7 @@ inp_read(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile) } /* files starting with *ng_script are user supplied command files */ - if (call_depth == 0 && ciprefix("*ng_script", cc->li_line)) + if (call_depth == 0 && ciprefix("*ng_script", cc->line)) comfile = TRUE; if (call_depth == 0 && !comfile) { @@ -957,8 +957,8 @@ inp_read(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile) /* Replace first line with the new title, if available */ if (call_depth == 0 && !comfile && new_title) { - tfree(cc->li_line); - cc->li_line = new_title; + tfree(cc->line); + cc->line = new_title; } /* Strip or convert end-of-line comments. @@ -966,9 +966,9 @@ inp_read(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile) If the line only contains an end-of-line comment then it is converted into a normal comment with a '*' at the start. Some special handling if this is a command file or called from within a .control section. */ - inp_stripcomments_deck(cc->li_next, comfile || is_control); + inp_stripcomments_deck(cc->nextcard, comfile || is_control); - inp_stitch_continuation_lines(cc->li_next); + inp_stitch_continuation_lines(cc->nextcard); rv . line_number = line_number; rv . cc = cc; @@ -1178,11 +1178,11 @@ readline(FILE *fd) Delimiters of gnd may be ' ' or ',' or '(' or ')' */ static void -inp_fix_gnd_name(struct line *c) +inp_fix_gnd_name(struct card *c) { - for (; c; c = c->li_next) { + for (; c; c = c->nextcard) { - char *gnd = c->li_line; + char *gnd = c->line; // if there is a comment or no gnd, go to next line if ((*gnd == '*') || !strstr(gnd, "gnd")) @@ -1198,7 +1198,7 @@ inp_fix_gnd_name(struct line *c) } // now remove the extra white spaces around 0 - c->li_line = inp_remove_ws(c->li_line); + c->line = inp_remove_ws(c->line); } } @@ -1220,13 +1220,13 @@ inp_fix_gnd_name(struct line *c) */ static void -inp_chk_for_multi_in_vcvs(struct line *c, int *line_number) +inp_chk_for_multi_in_vcvs(struct card *c, int *line_number) { int skip_control = 0; - for (; c; c = c->li_next) { + for (; c; c = c->nextcard) { - char *line = c->li_line; + char *line = c->line; /* there is no e source inside .control ... .endc */ if (ciprefix(".control", line)) { @@ -1356,7 +1356,7 @@ inp_chk_for_multi_in_vcvs(struct line *c, int *line_number) tfree(xy_values2[0]); tfree(xy_values2[1]); - *c->li_line = '*'; + *c->line = '*'; c = insert_new_line(c, m_instance, (*line_number)++, 0); c = insert_new_line(c, m_model, (*line_number)++, 0); } @@ -1375,33 +1375,33 @@ inp_chk_for_multi_in_vcvs(struct line *c, int *line_number) * .endc */ static void -inp_add_control_section(struct line *deck, int *line_number) +inp_add_control_section(struct card *deck, int *line_number) { - struct line *c, *prev_card = NULL; + struct card *c, *prev_card = NULL; bool found_control = FALSE, found_run = FALSE; bool found_end = FALSE; char *op_line = NULL, rawfile[1000], *line; - for (c = deck; c; c = c->li_next) { + for (c = deck; c; c = c->nextcard) { - if (*c->li_line == '*') + if (*c->line == '*') continue; - if (ciprefix(".op ", c->li_line)) { - *c->li_line = '*'; - op_line = c->li_line + 1; + if (ciprefix(".op ", c->line)) { + *c->line = '*'; + op_line = c->line + 1; } - if (ciprefix(".end", c->li_line)) + if (ciprefix(".end", c->line)) found_end = TRUE; - if (found_control && ciprefix("run", c->li_line)) + if (found_control && ciprefix("run", c->line)) found_run = TRUE; - if (ciprefix(".control", c->li_line)) + if (ciprefix(".control", c->line)) found_control = TRUE; - if (ciprefix(".endc", c->li_line)) { + if (ciprefix(".endc", c->line)) { found_control = FALSE; if (!found_run) { @@ -1467,33 +1467,33 @@ chk_for_line_continuation(char *line) // .param func1(x,y) = {x*y} --> .func func1(x,y) {x*y} static void -inp_fix_macro_param_func_paren_io(struct line *card) +inp_fix_macro_param_func_paren_io(struct card *card) { char *str_ptr, *new_str; - for (; card; card = card->li_next) { + for (; card; card = card->nextcard) { - if (*card->li_line == '*') + if (*card->line == '*') continue; - if (ciprefix(".macro", card->li_line) || ciprefix(".eom", card->li_line)) { - str_ptr = skip_non_ws(card->li_line); + if (ciprefix(".macro", card->line) || ciprefix(".eom", card->line)) { + str_ptr = skip_non_ws(card->line); - if (ciprefix(".macro", card->li_line)) { + if (ciprefix(".macro", card->line)) { new_str = tprintf(".subckt%s", str_ptr); } else { new_str = tprintf(".ends%s", str_ptr); } - tfree(card->li_line); - card->li_line = new_str; + tfree(card->line); + card->line = new_str; } - if (ciprefix(".subckt", card->li_line) || ciprefix("x", card->li_line)) { + if (ciprefix(".subckt", card->line) || ciprefix("x", card->line)) { /* remove () */ - str_ptr = skip_non_ws(card->li_line); // skip over .subckt, instance name + str_ptr = skip_non_ws(card->line); // skip over .subckt, instance name str_ptr = skip_ws(str_ptr); - if (ciprefix(".subckt", card->li_line)) { + if (ciprefix(".subckt", card->line)) { str_ptr = skip_non_ws(str_ptr); // skip over subckt name str_ptr = skip_ws(str_ptr); } @@ -1506,13 +1506,13 @@ inp_fix_macro_param_func_paren_io(struct line *card) } str_ptr++; } - card->li_line = inp_remove_ws(card->li_line); /* remove the extra white spaces just introduced */ + card->line = inp_remove_ws(card->line); /* remove the extra white spaces just introduced */ } } - if (ciprefix(".para", card->li_line)) { + if (ciprefix(".para", card->line)) { bool is_func = FALSE; - str_ptr = skip_non_ws(card->li_line); // skip over .param + str_ptr = skip_non_ws(card->line); // skip over .param str_ptr = skip_ws(str_ptr); while (!isspace_c(*str_ptr) && *str_ptr != '=') { if (*str_ptr == '(') @@ -1521,10 +1521,10 @@ inp_fix_macro_param_func_paren_io(struct line *card) } if (is_func) { - str_ptr = strchr(card->li_line, '='); + str_ptr = strchr(card->line, '='); if (str_ptr) *str_ptr = ' '; - str_ptr = card->li_line + 1; + str_ptr = card->line + 1; str_ptr[0] = 'f'; str_ptr[1] = 'u'; str_ptr[2] = 'n'; @@ -1726,19 +1726,19 @@ nlist_destroy(struct nlist *nlist) static void -get_subckts_for_subckt(struct line *start_card, char *subckt_name, +get_subckts_for_subckt(struct card *start_card, char *subckt_name, struct nlist *used_subckts, struct nlist *used_models, bool has_models) { - struct line *card; + struct card *card; int first_new_subckt = used_subckts->num_names; bool found_subckt = FALSE; int i, fence; - for (card = start_card; card; card = card->li_next) { + for (card = start_card; card; card = card->nextcard) { - char *line = card->li_line; + char *line = card->line; if (*line == '*') continue; @@ -1790,9 +1790,9 @@ get_subckts_for_subckt(struct line *start_card, char *subckt_name, */ static void -comment_out_unused_subckt_models(struct line *start_card) +comment_out_unused_subckt_models(struct card *start_card) { - struct line *card; + struct card *card; struct nlist *used_subckts, *used_models; int i = 0, fence; bool processing_subckt = FALSE, remove_subckt = FALSE, has_models = FALSE; @@ -1801,18 +1801,18 @@ comment_out_unused_subckt_models(struct line *start_card) used_subckts = nlist_allocate(100); used_models = nlist_allocate(100); - for (card = start_card; card; card = card->li_next) { - if (ciprefix(".model", card->li_line)) + for (card = start_card; card; card = card->nextcard) { + if (ciprefix(".model", card->line)) has_models = TRUE; - if (ciprefix(".cmodel", card->li_line)) + if (ciprefix(".cmodel", card->line)) has_models = TRUE; - if (ciprefix(".para", card->li_line) && !strchr(card->li_line, '=')) - *card->li_line = '*'; + if (ciprefix(".para", card->line) && !strchr(card->line, '=')) + *card->line = '*'; } - for (card = start_card; card; card = card->li_next) { + for (card = start_card; card; card = card->nextcard) { - char *line = card->li_line; + char *line = card->line; if (*line == '*') continue; @@ -1862,9 +1862,9 @@ comment_out_unused_subckt_models(struct line *start_card) used_subckts, used_models, has_models); /* comment out any unused subckts, currently only at top level */ - for (card = start_card; card; card = card->li_next) { + for (card = start_card; card; card = card->nextcard) { - char *line = card->li_line; + char *line = card->line; if (*line == '*') continue; @@ -2016,16 +2016,16 @@ inp_casefix(char *string) and for .control sections only '$ ' is accepted as end-of-line comment, to avoid conflict with $variable definition, otherwise we accept '$'. */ static void -inp_stripcomments_deck(struct line *c, bool cf) +inp_stripcomments_deck(struct card *c, bool cf) { bool found_control = FALSE; - for (; c; c = c->li_next) { + for (; c; c = c->nextcard) { /* exclude lines between .control and .endc from removing white spaces */ - if (ciprefix(".control", c->li_line)) + if (ciprefix(".control", c->line)) found_control = TRUE; - if (ciprefix(".endc", c->li_line)) + if (ciprefix(".endc", c->line)) found_control = FALSE; - inp_stripcomments_line(c->li_line, found_control|cf); + inp_stripcomments_line(c->line, found_control|cf); } } @@ -2161,7 +2161,7 @@ find_name(struct names *p, char *name) static char* inp_fix_subckt(struct names *subckt_w_params, char *s) { - struct line *head, *first_param_card, *c; + struct card *head, *first_param_card, *c; char *equal, *beg, *buffer, *ptr1, *ptr2, *new_str; equal = strchr(s, '='); @@ -2212,11 +2212,11 @@ inp_fix_subckt(struct names *subckt_w_params, char *s) /* create new ordered parameter string for subckt call */ new_str = NULL; - for (c = head->li_next; c; c = c->li_next) + for (c = head->nextcard; c; c = c->nextcard) if (new_str == NULL) { - new_str = strdup(c->li_line); + new_str = strdup(c->line); } else { - char *x = tprintf("%s %s", new_str, c->li_line); + char *x = tprintf("%s %s", new_str, c->line); tfree(new_str); new_str = x; } @@ -2307,68 +2307,68 @@ inp_remove_ws(char *s) */ static void -inp_fix_for_numparam(struct names *subckt_w_params, struct line *c) +inp_fix_for_numparam(struct names *subckt_w_params, struct card *c) { bool found_control = FALSE; - for (; c; c = c->li_next) { + for (; c; c = c->nextcard) { - if (*(c->li_line) == '*' || ciprefix(".lib", c->li_line)) + if (*(c->line) == '*' || ciprefix(".lib", c->line)) continue; /* exclude lines between .control and .endc from getting quotes changed */ - if (ciprefix(".control", c->li_line)) + if (ciprefix(".control", c->line)) found_control = TRUE; - if (ciprefix(".endc", c->li_line)) + if (ciprefix(".endc", c->line)) found_control = FALSE; if (found_control) continue; - inp_change_quotes(c->li_line); + inp_change_quotes(c->line); if ((inp_compat_mode == COMPATMODE_ALL) || (inp_compat_mode == COMPATMODE_PS)) - if (ciprefix(".subckt", c->li_line) || ciprefix("x", c->li_line)) { + if (ciprefix(".subckt", c->line) || ciprefix("x", c->line)) { /* remove params: */ - char *str_ptr = strstr(c->li_line, "params:"); + char *str_ptr = strstr(c->line, "params:"); if (str_ptr) memcpy(str_ptr, " ", 7); } - if (ciprefix(".subckt", c->li_line)) - c->li_line = inp_fix_subckt(subckt_w_params, c->li_line); + if (ciprefix(".subckt", c->line)) + c->line = inp_fix_subckt(subckt_w_params, c->line); } } static void -inp_remove_excess_ws(struct line *c) +inp_remove_excess_ws(struct card *c) { bool found_control = FALSE; - for (; c; c = c->li_next) { + for (; c; c = c->nextcard) { - if (*c->li_line == '*') + if (*c->line == '*') continue; /* exclude echo lines between .control and .endc from removing white spaces */ - if (ciprefix(".control", c->li_line)) + if (ciprefix(".control", c->line)) found_control = TRUE; - if (ciprefix(".endc", c->li_line)) + if (ciprefix(".endc", c->line)) found_control = FALSE; - if (found_control && ciprefix("echo", c->li_line)) + if (found_control && ciprefix("echo", c->line)) continue; - c->li_line = inp_remove_ws(c->li_line); /* freed in fcn */ + c->line = inp_remove_ws(c->line); /* freed in fcn */ } } -static struct line * -expand_section_ref(struct line *c, char *dir_name) +static struct card * +expand_section_ref(struct card *c, char *dir_name) { - char *line = c->li_line; + char *line = c->line; char *s, *s_e, *y; @@ -2384,7 +2384,7 @@ expand_section_ref(struct line *c, char *dir_name) if (*y) { /* library section reference: `.lib ' */ - struct line *section_def; + struct card *section_def; char keep_char1, keep_char2; char *y_e; struct library *lib; @@ -2412,11 +2412,11 @@ expand_section_ref(struct line *c, char *dir_name) /* recursively expand the refered section itself */ { - struct line *t = section_def; - for (; t; t = t->li_next) { - if (ciprefix(".endl", t->li_line)) + struct card *t = section_def; + for (; t; t = t->nextcard) { + if (ciprefix(".endl", t->line)) break; - if (ciprefix(".lib", t->li_line)) + if (ciprefix(".lib", t->line)) t = expand_section_ref(t, lib->habitat); } if (!t) { @@ -2427,16 +2427,16 @@ expand_section_ref(struct line *c, char *dir_name) /* insert the library section definition into `c' */ { - struct line *t = section_def; - for (; t; t=t->li_next) { - c = insert_new_line(c, copy(t->li_line), t->li_linenum, t->li_linenum_orig); + struct card *t = section_def; + for (; t; t=t->nextcard) { + c = insert_new_line(c, copy(t->line), t->linenum, t->linenum_orig); if (t == section_def) { - c->li_line[0] = '*'; - c->li_line[1] = '<'; + c->line[0] = '*'; + c->line[1] = '<'; } - if(ciprefix(".endl", t->li_line)) { - c->li_line[0] = '*'; - c->li_line[1] = '>'; + if(ciprefix(".endl", t->line)) { + c->line[0] = '*'; + c->line[1] = '>'; break; } } @@ -2464,10 +2464,10 @@ expand_section_ref(struct line *c, char *dir_name) */ static void -expand_section_references(struct line *c, char *dir_name) +expand_section_references(struct card *c, char *dir_name) { - for (; c; c = c->li_next) - if (ciprefix(".lib", c->li_line)) + for (; c; c = c->nextcard) + if (ciprefix(".lib", c->line)) c = expand_section_ref(c, dir_name); } @@ -2615,30 +2615,30 @@ found_mult_param(int num_params, char *param_names[]) Function is called from inp_fix_inst_calls_for_numparam() */ static int -inp_fix_subckt_multiplier(struct names *subckt_w_params, struct line *subckt_card, +inp_fix_subckt_multiplier(struct names *subckt_w_params, struct card *subckt_card, int num_subckt_params, char *subckt_param_names[], char *subckt_param_values[]) { - struct line *card; + struct card *card; char *new_str; subckt_param_names[num_subckt_params] = strdup("m"); subckt_param_values[num_subckt_params] = strdup("1"); num_subckt_params ++; - if (!strstr(subckt_card->li_line, "params:")) { - new_str = tprintf("%s params: m=1", subckt_card->li_line); - add_name(subckt_w_params, get_subckt_model_name(subckt_card->li_line)); + if (!strstr(subckt_card->line, "params:")) { + new_str = tprintf("%s params: m=1", subckt_card->line); + add_name(subckt_w_params, get_subckt_model_name(subckt_card->line)); } else { - new_str = tprintf("%s m=1", subckt_card->li_line); + new_str = tprintf("%s m=1", subckt_card->line); } - tfree(subckt_card->li_line); - subckt_card->li_line = new_str; + tfree(subckt_card->line); + subckt_card->line = new_str; - for (card = subckt_card->li_next; - card && !ciprefix(".ends", card->li_line); - card = card->li_next) { - char *curr_line = card->li_line; + for (card = subckt_card->nextcard; + card && !ciprefix(".ends", card->line); + card = card->nextcard) { + char *curr_line = card->line; /* no 'm' for B, V, E, H or comment line */ if (strchr("*bveh", curr_line[0])) continue; @@ -2647,8 +2647,8 @@ inp_fix_subckt_multiplier(struct names *subckt_w_params, struct line *subckt_car continue; new_str = tprintf("%s m={m}", curr_line); - tfree(card->li_line); - card->li_line = new_str; + tfree(card->line); + card->line = new_str; } return num_subckt_params; @@ -2656,9 +2656,9 @@ inp_fix_subckt_multiplier(struct names *subckt_w_params, struct line *subckt_car static void -inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struct line *deck) +inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struct card *deck) { - struct line *c; + struct card *c; char *subckt_param_names[1000]; char *subckt_param_values[1000]; char *inst_param_names[1000]; @@ -2668,8 +2668,8 @@ inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struct line *deck // first iterate through instances and find occurences where 'm' multiplier needs to be // added to the subcircuit -- subsequent instances will then need this parameter as well - for (c = deck; c; c = c->li_next) { - char *inst_line = c->li_line; + for (c = deck; c; c = c->nextcard) { + char *inst_line = c->line; if (*inst_line == '*') continue; @@ -2679,11 +2679,11 @@ inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struct line *deck char *subckt_name = inp_get_subckt_name(inst_line); if (found_mult_param(num_inst_params, inst_param_names)) { - struct line *d, *p = NULL; + struct card *d, *p = NULL; // iterate through the deck to find the subckt (last one defined wins) - for (d = deck; d; d = d->li_next) { - char *subckt_line = d->li_line; + for (d = deck; d; d = d->nextcard) { + char *subckt_line = d->line; if (ciprefix(".subckt", subckt_line)) { subckt_line = skip_non_ws(subckt_line); subckt_line = skip_ws(subckt_line); @@ -2695,7 +2695,7 @@ inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struct line *deck } if (p) { - int num_subckt_params = inp_get_params(p->li_line, subckt_param_names, subckt_param_values); + int num_subckt_params = inp_get_params(p->line, subckt_param_names, subckt_param_values); if (!found_mult_param(num_subckt_params, subckt_param_names)) inp_fix_subckt_multiplier(subckt_w_params, p, num_subckt_params, subckt_param_names, subckt_param_values); @@ -2715,8 +2715,8 @@ inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struct line *deck } } - for (c = deck; c; c = c->li_next) { - char *inst_line = c->li_line; + for (c = deck; c; c = c->nextcard) { + char *inst_line = c->line; if (*inst_line == '*') continue; @@ -2726,14 +2726,14 @@ inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struct line *deck char *subckt_name = inp_get_subckt_name(inst_line); if (find_name(subckt_w_params, subckt_name)) { - struct line *d; + struct card *d; /* find .subckt line */ sprintf(name_w_space, "%s ", subckt_name); - for (d = deck; d; d = d->li_next) { - char *subckt_line = d->li_line; + for (d = deck; d; d = d->nextcard) { + char *subckt_line = d->line; if (ciprefix(".subckt", subckt_line)) { subckt_line = skip_non_ws(subckt_line); subckt_line = skip_ws(subckt_line); @@ -2759,16 +2759,16 @@ inp_fix_inst_calls_for_numparam(struct names *subckt_w_params, struct line *deck if (!found_param_match) { // comment out .subckt and continue - while (d != NULL && !ciprefix(".ends", d->li_line)) { - *(d->li_line) = '*'; - d = d->li_next; + while (d != NULL && !ciprefix(".ends", d->line)) { + *(d->line) = '*'; + d = d->nextcard; } - *(d->li_line) = '*'; + *(d->line) = '*'; continue; } } - c->li_line = inp_fix_inst_line(inst_line, num_subckt_params, subckt_param_names, subckt_param_values, num_inst_params, inst_param_names, inst_param_values); + c->line = inp_fix_inst_line(inst_line, num_subckt_params, subckt_param_names, subckt_param_values, num_inst_params, inst_param_names, inst_param_values); for (i = 0; i < num_subckt_params; i++) { tfree(subckt_param_names[i]); tfree(subckt_param_values[i]); @@ -2945,18 +2945,18 @@ inp_get_func_from_line(struct function_env *env, char *line) */ static void -inp_grab_func(struct function_env *env, struct line *c) +inp_grab_func(struct function_env *env, struct card *c) { int nesting = 0; - for (; c; c = c->li_next) { + for (; c; c = c->nextcard) { - if (*c->li_line == '*') + if (*c->line == '*') continue; - if (ciprefix(".subckt", c->li_line)) + if (ciprefix(".subckt", c->line)) nesting++; - if (ciprefix(".ends", c->li_line)) + if (ciprefix(".ends", c->line)) nesting--; if (nesting < 0) @@ -2965,9 +2965,9 @@ inp_grab_func(struct function_env *env, struct line *c) if (nesting > 0) continue; - if (ciprefix(".func", c->li_line)) { - inp_get_func_from_line(env, c->li_line); - *c->li_line = '*'; + if (ciprefix(".func", c->line)) { + inp_get_func_from_line(env, c->line); + *c->line = '*'; } } } @@ -3242,8 +3242,8 @@ delete_function_env(struct function_env *env) } -static struct line * -inp_expand_macros_in_deck(struct function_env *env, struct line *c) +static struct card * +inp_expand_macros_in_deck(struct function_env *env, struct card *c) { env = new_function_env(env); @@ -3251,26 +3251,26 @@ inp_expand_macros_in_deck(struct function_env *env, struct line *c) inp_expand_macros_in_func(env); - for (; c; c = c->li_next) { + for (; c; c = c->nextcard) { - if (*c->li_line == '*') + if (*c->line == '*') continue; - if (ciprefix(".subckt", c->li_line)) { - struct line *subckt = c; - c = inp_expand_macros_in_deck(env, c->li_next); + if (ciprefix(".subckt", c->line)) { + struct card *subckt = c; + c = inp_expand_macros_in_deck(env, c->nextcard); if (c) continue; fprintf(stderr, "Error: line %d, missing .ends\n %s\n", - subckt->li_linenum_orig, subckt->li_line); + subckt->linenum_orig, subckt->line); controlled_exit(EXIT_BAD); } - if (ciprefix(".ends", c->li_line)) + if (ciprefix(".ends", c->line)) break; - c->li_line = inp_expand_macro_in_str(env, c->li_line); + c->line = inp_expand_macro_in_str(env, c->line); } env = delete_function_env(env); @@ -3294,7 +3294,7 @@ inp_expand_macros_in_deck(struct function_env *env, struct line *c) */ static void -inp_fix_param_values(struct line *c) +inp_fix_param_values(struct card *c) { char *beg_of_str, *end_of_str, *old_str, *equal_ptr, *new_str; char *vec_str, *tmp_str, *natok, *buffer, *newvec, *whereisgt; @@ -3302,8 +3302,8 @@ inp_fix_param_values(struct line *c) wordlist *nwl; int parens; - for (; c; c = c->li_next) { - char *line = c->li_line; + for (; c; c = c->nextcard) { + char *line = c->line; if (*line == '*' || (ciprefix(".para", line) && strchr(line, '{'))) continue; @@ -3439,11 +3439,11 @@ inp_fix_param_values(struct line *c) wl_free(nwl); /* insert new vector into actual line */ *equal_ptr = '\0'; - new_str = tprintf("%s=[%s] %s", c->li_line, newvec, end_of_str+1); + new_str = tprintf("%s=[%s] %s", c->line, newvec, end_of_str+1); tfree(newvec); - old_str = c->li_line; - c->li_line = new_str; + old_str = c->line; + c->line = new_str; line = new_str + strlen(old_str) + 1; tfree(old_str); } else if (*beg_of_str == '<') { @@ -3481,11 +3481,11 @@ inp_fix_param_values(struct line *c) wl_free(nwl); /* insert new complex value into actual line */ *equal_ptr = '\0'; - new_str = tprintf("%s=<%s> %s", c->li_line, newvec, end_of_str+1); + new_str = tprintf("%s=<%s> %s", c->line, newvec, end_of_str+1); tfree(newvec); - old_str = c->li_line; - c->li_line = new_str; + old_str = c->line; + c->line = new_str; line = new_str + strlen(old_str) + 1; tfree(old_str); } else { @@ -3505,14 +3505,14 @@ inp_fix_param_values(struct line *c) *equal_ptr = '\0'; if (*end_of_str == '\0') { - new_str = tprintf("%s={%s}", c->li_line, beg_of_str); + new_str = tprintf("%s={%s}", c->line, beg_of_str); } else { *end_of_str = '\0'; - new_str = tprintf("%s={%s} %s", c->li_line, beg_of_str, end_of_str+1); + new_str = tprintf("%s={%s} %s", c->line, beg_of_str, end_of_str+1); } - old_str = c->li_line; - c->li_line = new_str; + old_str = c->line; + c->line = new_str; line = new_str + strlen(old_str) + 1; tfree(old_str); @@ -3560,7 +3560,7 @@ struct dependency char *param_name; char *param_str; char *depends_on[100]; - struct line *card; + struct card *card; }; @@ -3713,16 +3713,16 @@ get_number_terminals(char *c) static char *ya_search_identifier(char *str, const char *identifier, char *str_begin); -static void inp_quote_params(struct line *s_c, struct line *e_c, struct dependency *deps, int num_params); +static void inp_quote_params(struct card *s_c, struct card *e_c, struct dependency *deps, int num_params); /* sort parameters based on parameter dependencies */ static void -inp_sort_params(struct line *param_cards, struct line *card_bf_start, struct line *s_c, struct line *e_c) +inp_sort_params(struct card *param_cards, struct card *card_bf_start, struct card *s_c, struct card *e_c) { int i, j, num_params, ind = 0, max_level; - struct line *c; + struct card *c; int skipped; int arr_size; @@ -3734,21 +3734,21 @@ inp_sort_params(struct line *param_cards, struct line *card_bf_start, struct lin /* determine the number of lines with .param */ arr_size = 0; - for (c = param_cards; c; c = c->li_next) - if (strchr(c->li_line, '=')) + for (c = param_cards; c; c = c->nextcard) + if (strchr(c->line, '=')) arr_size ++; deps = TMALLOC(struct dependency, arr_size); num_params = 0; - for (c = param_cards; c; c = c->li_next) + for (c = param_cards; c; c = c->nextcard) // ignore .param lines without '=' - if (strchr(c->li_line, '=')) { + if (strchr(c->line, '=')) { deps[num_params].depends_on[0] = NULL; deps[num_params].level = -1; deps[num_params].skip = 0; - deps[num_params].param_name = get_param_name(c->li_line); /* strdup in fcn */ - deps[num_params].param_str = strdup(get_param_str(c->li_line)); + deps[num_params].param_name = get_param_name(c->line); /* strdup in fcn */ + deps[num_params].param_str = strdup(get_param_str(c->line)); deps[num_params].card = c; num_params ++; } @@ -3815,15 +3815,15 @@ inp_sort_params(struct line *param_cards, struct line *card_bf_start, struct lin static void -inp_add_params_to_subckt(struct names *subckt_w_params, struct line *subckt_card) +inp_add_params_to_subckt(struct names *subckt_w_params, struct card *subckt_card) { - struct line *card = subckt_card->li_next; - char *subckt_line = subckt_card->li_line; + struct card *card = subckt_card->nextcard; + char *subckt_line = subckt_card->line; char *new_line, *param_ptr, *subckt_name, *end_ptr; - for (; card; card = card->li_next) { + for (; card; card = card->nextcard) { - char *curr_line = card->li_line; + char *curr_line = card->line; if (!ciprefix(".para", curr_line)) break; @@ -3848,7 +3848,7 @@ inp_add_params_to_subckt(struct names *subckt_w_params, struct line *subckt_card *curr_line = '*'; } - subckt_card->li_line = subckt_line; + subckt_card->line = subckt_line; } @@ -3867,54 +3867,54 @@ inp_add_params_to_subckt(struct names *subckt_w_params, struct line *subckt_card * */ -static struct line * -inp_reorder_params_subckt(struct names *subckt_w_params, struct line *subckt_card) +static struct card * +inp_reorder_params_subckt(struct names *subckt_w_params, struct card *subckt_card) { - struct line *first_param_card = NULL; - struct line *last_param_card = NULL; + struct card *first_param_card = NULL; + struct card *last_param_card = NULL; - struct line *prev_card = subckt_card; - struct line *c = subckt_card->li_next; + struct card *prev_card = subckt_card; + struct card *c = subckt_card->nextcard; /* move .param lines to beginning of deck */ while (c != NULL) { - char *curr_line = c->li_line; + char *curr_line = c->line; if (*curr_line == '*') { prev_card = c; - c = c->li_next; + c = c->nextcard; continue; } if (ciprefix(".subckt", curr_line)) { prev_card = inp_reorder_params_subckt(subckt_w_params, c); - c = prev_card->li_next; + c = prev_card->nextcard; continue; } if (ciprefix(".ends", curr_line)) { if (first_param_card) { - inp_sort_params(first_param_card, subckt_card, subckt_card->li_next, c); + inp_sort_params(first_param_card, subckt_card, subckt_card->nextcard, c); inp_add_params_to_subckt(subckt_w_params, subckt_card); } return c; } if (ciprefix(".para", curr_line)) { - prev_card->li_next = c->li_next; + prev_card->nextcard = c->nextcard; last_param_card = insert_deck(last_param_card, c); if (!first_param_card) first_param_card = last_param_card; - c = prev_card->li_next; + c = prev_card->nextcard; continue; } prev_card = c; - c = c->li_next; + c = c->nextcard; } /* the terminating `.ends' deck wasn't found */ @@ -3923,28 +3923,28 @@ inp_reorder_params_subckt(struct names *subckt_w_params, struct line *subckt_car static void -inp_reorder_params(struct names *subckt_w_params, struct line *list_head) +inp_reorder_params(struct names *subckt_w_params, struct card *list_head) { - struct line *first_param_card = NULL; - struct line *last_param_card = NULL; + struct card *first_param_card = NULL; + struct card *last_param_card = NULL; - struct line *prev_card = list_head; - struct line *c = prev_card->li_next; + struct card *prev_card = list_head; + struct card *c = prev_card->nextcard; /* move .param lines to beginning of deck */ while (c != NULL) { - char *curr_line = c->li_line; + char *curr_line = c->line; if (*curr_line == '*') { prev_card = c; - c = c->li_next; + c = c->nextcard; continue; } if (ciprefix(".subckt", curr_line)) { prev_card = inp_reorder_params_subckt(subckt_w_params, c); - c = prev_card->li_next; + c = prev_card->nextcard; continue; } @@ -3955,22 +3955,22 @@ inp_reorder_params(struct names *subckt_w_params, struct line *list_head) } if (ciprefix(".para", curr_line)) { - prev_card->li_next = c->li_next; + prev_card->nextcard = c->nextcard; last_param_card = insert_deck(last_param_card, c); if (!first_param_card) first_param_card = last_param_card; - c = prev_card->li_next; + c = prev_card->nextcard; continue; } prev_card = c; - c = c->li_next; + c = c->nextcard; } - inp_sort_params(first_param_card, list_head, list_head->li_next, NULL); + inp_sort_params(first_param_card, list_head, list_head->nextcard, NULL); } @@ -3980,11 +3980,11 @@ inp_reorder_params(struct names *subckt_w_params, struct line *list_head) // afetr the current multi-param line in the deck static int -inp_split_multi_param_lines(struct line *card, int line_num) +inp_split_multi_param_lines(struct card *card, int line_num) { - for (; card; card = card->li_next) { + for (; card; card = card->nextcard) { - char *curr_line = card->li_line; + char *curr_line = card->line; if (*curr_line == '*') continue; @@ -4005,7 +4005,7 @@ inp_split_multi_param_lines(struct line *card, int line_num) array = TMALLOC(char *, counter); // need to split multi param line - curr_line = card->li_line; + curr_line = card->line; counter = 0; while ((equal_ptr = find_assignment(curr_line)) != NULL) { @@ -4038,7 +4038,7 @@ inp_split_multi_param_lines(struct line *card, int line_num) } // comment out current multi-param line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new param lines immediately after current line for (i = 0; i < counter; i++) card = insert_new_line(card, array[i], line_num++, 0); @@ -4209,7 +4209,7 @@ search_plain_identifier(char *str, const char *identifier) */ static void -inp_compat(struct line *card) +inp_compat(struct card *card) { char *str_ptr, *cut_line, *title_tok, *node1, *node2; char *out_ptr, *exp_ptr, *beg_ptr, *end_ptr, *copy_ptr, *del_ptr; @@ -4222,9 +4222,9 @@ inp_compat(struct line *card) char *equation, *tc1_ptr = NULL, *tc2_ptr = NULL; double tc1 = 0.0, tc2 = 0.0; - for (; card; card = card->li_next) { + for (; card; card = card->nextcard) { - char *curr_line = card->li_line; + char *curr_line = card->line; /* exclude any command inside .control ... .endc */ if (ciprefix(".control", curr_line)) { @@ -4274,7 +4274,7 @@ inp_compat(struct line *card) cut_line = skip_ws(cut_line); if (!ciprefix("table", cut_line)) { fprintf(stderr, "Error: bad syntax in line %d\n %s\n", - card->li_linenum_orig, card->li_line); + card->linenum_orig, card->line); controlled_exit(EXIT_BAD); } cut_line += 5; @@ -4286,7 +4286,7 @@ inp_compat(struct line *card) expression = gettok_char(&cut_line, '}', TRUE, TRUE); /* expression */ if (!expression || !str_ptr) { fprintf(stderr, "Error: bad syntax in line %d\n %s\n", - card->li_linenum_orig, card->li_line); + card->linenum_orig, card->line); controlled_exit(EXIT_BAD); } tfree(str_ptr); @@ -4308,7 +4308,7 @@ inp_compat(struct line *card) ffirstno = gettok_node(&cut_line); if (!ffirstno) { fprintf(stderr, "Error: bad syntax in line %d\n %s\n", - card->li_linenum_orig, card->li_line); + card->linenum_orig, card->line); controlled_exit(EXIT_BAD); } firstno = copy(ffirstno); @@ -4318,7 +4318,7 @@ inp_compat(struct line *card) cut_line = strrchr(str_ptr, '('); if (!cut_line) { fprintf(stderr, "Error: bad syntax in line %d (missing parentheses)\n %s\n", - card->li_linenum_orig, card->li_line); + card->linenum_orig, card->line); controlled_exit(EXIT_BAD); } /* replace '(' with ',' and ')' with ' ' */ @@ -4335,7 +4335,7 @@ inp_compat(struct line *card) lastlastno = gettok_node(&cut_line); if (!secondno || (*midline == '\0') || (delta <= 0.) || !lastlastno) { fprintf(stderr, "Error: bad syntax in line %d\n %s\n", - card->li_linenum_orig, card->li_line); + card->linenum_orig, card->line); controlled_exit(EXIT_BAD); } ckt_array[1] = tprintf("b%s %s_int1 0 v = pwl(%s, %e, %s, %s, %s, %s, %e, %s)", @@ -4343,7 +4343,7 @@ inp_compat(struct line *card) midline, lnumber + delta, lastlastno); // comment out current variable e line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new B source line immediately after current line for (i = 0; i < 2; i++) card = insert_new_line(card, ckt_array[i], 0, 0); @@ -4381,7 +4381,7 @@ inp_compat(struct line *card) title_tok, title_tok, str_ptr); // comment out current variable e line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new B source line immediately after current line for (i = 0; i < 2; i++) card = insert_new_line(card, ckt_array[i], 0, 0); @@ -4436,7 +4436,7 @@ inp_compat(struct line *card) cut_line = skip_ws(cut_line); if (!ciprefix("table", cut_line)) { fprintf(stderr, "Error: bad syntax in line %d\n %s\n", - card->li_linenum_orig, card->li_line); + card->linenum_orig, card->line); controlled_exit(EXIT_BAD); } cut_line += 5; @@ -4448,7 +4448,7 @@ inp_compat(struct line *card) expression = gettok_char(&cut_line, '}', TRUE, TRUE); /* expression */ if (!expression || !str_ptr) { fprintf(stderr, "Error: bad syntax in line %d\n %s\n", - card->li_linenum_orig, card->li_line); + card->linenum_orig, card->line); controlled_exit(EXIT_BAD); } tfree(str_ptr); @@ -4470,7 +4470,7 @@ inp_compat(struct line *card) ffirstno = gettok_node(&cut_line); if (!ffirstno) { fprintf(stderr, "Error: bad syntax in line %d\n %s\n", - card->li_linenum_orig, card->li_line); + card->linenum_orig, card->line); controlled_exit(EXIT_BAD); } firstno = copy(ffirstno); @@ -4492,7 +4492,7 @@ inp_compat(struct line *card) lastlastno = gettok_node(&cut_line); if (!secondno || (*midline == '\0') || (delta <= 0.) || !lastlastno) { fprintf(stderr, "Error: bad syntax in line %d\n %s\n", - card->li_linenum_orig, card->li_line); + card->linenum_orig, card->line); controlled_exit(EXIT_BAD); } /* BGxxx int1 0 V = pwl (expression, x0-(x2-x0)/2, y0, x0, y0, x1, y1, x2, y2, x2+(x2-x0)/2, y2) */ @@ -4501,7 +4501,7 @@ inp_compat(struct line *card) midline, lnumber + delta, lastlastno); // comment out current variable e line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new B source line immediately after current line for (i = 0; i < 2; i++) card = insert_new_line(card, ckt_array[i], 0, 0); @@ -4551,7 +4551,7 @@ inp_compat(struct line *card) title_tok, title_tok, str_ptr); // comment out current variable g line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new B source line immediately after current line for (i = 0; i < 2; i++) card = insert_new_line(card, ckt_array[i], 0, 0); @@ -4597,7 +4597,7 @@ inp_compat(struct line *card) ckt_array[2] = tprintf("vb%s %s_int1 0 dc 0", title_tok, title_tok); // comment out current variable f line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new three lines immediately after current line for (i = 0; i < 3; i++) card = insert_new_line(card, ckt_array[i], 0, 0); @@ -4643,7 +4643,7 @@ inp_compat(struct line *card) ckt_array[2] = tprintf("vb%s %s_int1 0 dc 0", title_tok, title_tok); // comment out current variable h line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new three lines immediately after current line for (i = 0; i < 3; i++) card = insert_new_line(card, ckt_array[i], 0, 0); @@ -4719,7 +4719,7 @@ inp_compat(struct line *card) tc2_ptr = NULL; // comment out current old R line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new B source line immediately after current line card = insert_new_line(card, xline, 0, 0); @@ -4797,7 +4797,7 @@ inp_compat(struct line *card) tc1_ptr = NULL; tc2_ptr = NULL; // comment out current variable capacitor line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new B source line immediately after current line for (i = 0; i < 3; i++) card = insert_new_line(card, ckt_array[i], 0, 0); @@ -4877,7 +4877,7 @@ inp_compat(struct line *card) tc1_ptr = NULL; tc2_ptr = NULL; // comment out current variable inductor line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new B source line immediately after current line for (i = 0; i < 3; i++) card = insert_new_line(card, ckt_array[i], 0, 0); @@ -5020,7 +5020,7 @@ inp_compat(struct line *card) if (pai == paui) continue; // remove white spaces - card->li_line = inp_remove_ws(curr_line); + card->line = inp_remove_ws(curr_line); // insert new B source line immediately after current line for (ii = paui; ii < pai; ii++) card = insert_new_line(card, ckt_array[ii], 0, 0); @@ -5112,7 +5112,7 @@ inp_compat(struct line *card) if (pai == paui) continue; // remove white spaces - card->li_line = inp_remove_ws(curr_line); + card->line = inp_remove_ws(curr_line); // comment out current variable capacitor line // *(ckt_array[0]) = '*'; // insert new B source line immediately after current line @@ -5172,14 +5172,14 @@ replace_token(char *string, char *token, int wherereplace, int total) */ static void -inp_bsource_compat(struct line *card) +inp_bsource_compat(struct card *card) { char *equal_ptr, *str_ptr, *new_str, *final_str; int skip_control = 0; - for (; card; card = card->li_next) { + for (; card; card = card->nextcard) { - char *curr_line = card->li_line; + char *curr_line = card->line; /* exclude any command inside .control ... .endc */ if (ciprefix(".control", curr_line)) { @@ -5194,8 +5194,8 @@ inp_bsource_compat(struct line *card) if (*curr_line == 'b') { /* remove white spaces of everything inside {}*/ - card->li_line = inp_remove_ws(card->li_line); - curr_line = card->li_line; + card->line = inp_remove_ws(card->line); + curr_line = card->line; /* store starting point for later parsing, beginning of {expression} */ equal_ptr = strchr(curr_line, '='); /* check for errors */ @@ -5210,10 +5210,10 @@ inp_bsource_compat(struct line *card) final_str = tprintf("%.*s %s", (int) (equal_ptr + 1 - curr_line), curr_line, new_str); // comment out current line (old B source line) - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new B source line immediately after current line /* Copy old line numbers into new B source line */ - card = insert_new_line(card, final_str, card->li_linenum, card->li_linenum_orig); + card = insert_new_line(card, final_str, card->linenum, card->linenum_orig); tfree(new_str); } /* end of if 'b' */ @@ -5224,20 +5224,20 @@ inp_bsource_compat(struct line *card) /* Find all expressions containing the keyword 'temper', * except for B lines and some other exclusions. Prepare * these expressions by calling inp_modify_exp() and return - * a modified card->li_line + * a modified card->line */ static bool -inp_temper_compat(struct line *card) +inp_temper_compat(struct card *card) { int skip_control = 0; char *beg_str, *end_str, *beg_tstr, *end_tstr, *exp_str; bool with_temper = FALSE; - for (; card; card = card->li_next) { + for (; card; card = card->nextcard) { char *new_str = NULL; - char *curr_line = card->li_line; + char *curr_line = card->line; if (curr_line == NULL) continue; @@ -5262,8 +5262,8 @@ inp_temper_compat(struct line *card) continue; /* now start processing of the remaining lines containing 'temper' */ /* remove white spaces of everything inside {}*/ - card->li_line = inp_remove_ws(card->li_line); - curr_line = card->li_line; + card->line = inp_remove_ws(card->line); + curr_line = card->line; beg_str = beg_tstr = curr_line; while ((beg_tstr = search_identifier(beg_tstr, "temper", curr_line)) != NULL) { @@ -5289,8 +5289,8 @@ inp_temper_compat(struct line *card) } if (*beg_str) new_str = INPstrCat(new_str, copy(beg_str), " "); - tfree(card->li_line); - card->li_line = inp_remove_ws(new_str); + tfree(card->line); + card->line = inp_remove_ws(new_str); } return with_temper; } @@ -5480,14 +5480,14 @@ get_quoted_token(char *string, char **token) */ static void -inp_add_series_resistor(struct line *deck) +inp_add_series_resistor(struct card *deck) { int skip_control = 0; - struct line *card; + struct card *card; char *rval = NULL; - for (card = deck; card; card = card->li_next) { - char *curr_line = card->li_line; + for (card = deck; card; card = card->nextcard) { + char *curr_line = card->line; if (*curr_line != '*' && strstr(curr_line, "option")) { char *t = strstr(curr_line, "rseries"); if (t) { @@ -5511,8 +5511,8 @@ inp_add_series_resistor(struct line *deck) "\nOption rseries given: \n" "resistor %s Ohms added in series to each inductor L\n\n", rval); - for (card = deck; card; card = card->li_next) { - char *cut_line = card->li_line; + for (card = deck; card; card = card->nextcard) { + char *cut_line = card->line; /* exclude any command inside .control ... .endc */ if (ciprefix(".control", cut_line)) { @@ -5536,7 +5536,7 @@ inp_add_series_resistor(struct line *deck) char *newR = tprintf("R%s_intern__ %s_intern__ %s %s", title_tok, title_tok, node2, rval); // comment out current L line - *(card->li_line) = '*'; + *(card->line) = '*'; // insert new new L and R lines immediately after current line card = insert_new_line(card, newL, 0, 0); @@ -5561,10 +5561,10 @@ inp_add_series_resistor(struct line *deck) */ static void -subckt_params_to_param(struct line *card) +subckt_params_to_param(struct card *card) { - for (; card; card = card->li_next) { - char *curr_line = card->li_line; + for (; card; card = card->nextcard) { + char *curr_line = card->line; if (ciprefix(".subckt", curr_line)) { char *cut_line, *new_line; cut_line = strstr(curr_line, "params:"); @@ -5574,10 +5574,10 @@ subckt_params_to_param(struct line *card) new_line = copy(cut_line); /* replace "params:" by ".param " */ memcpy(new_line, ".param ", 7); - /* card->li_line ends with subcircuit name */ + /* card->line ends with subcircuit name */ cut_line[-1] = '\0'; - /* insert new_line after card->li_line */ - insert_new_line(card, new_line, card->li_linenum + 1, 0); + /* insert new_line after card->line */ + insert_new_line(card, new_line, card->linenum + 1, 0); } } } @@ -5589,13 +5589,13 @@ subckt_params_to_param(struct line *card) #ifndef XSPICE static void -inp_poly_err(struct line *card) +inp_poly_err(struct card *card) { size_t skip_control = 0; - for (; card; card = card->li_next) { + for (; card; card = card->nextcard) { - char *curr_line = card->li_line; + char *curr_line = card->line; if (*curr_line == '*') continue; @@ -5622,8 +5622,8 @@ inp_poly_err(struct line *card) if (ciprefix("poly", curr_line)) { fprintf(stderr, "\nError: XSPICE is required to run the 'poly' option in line %d\n", - card->li_linenum_orig); - fprintf(stderr, " %s\n", card->li_line); + card->linenum_orig); + fprintf(stderr, " %s\n", card->line); fprintf(stderr, "\nSee manual chapt. 31 for installation instructions\n"); controlled_exit(EXIT_BAD); } @@ -5639,26 +5639,26 @@ inp_poly_err(struct line *card) * somewhere in function inp_readall() of this file to have * a printout of the actual deck written to file "tprint-out.txt" */ void -tprint(struct line *t) +tprint(struct card *t) { - struct line *tmp; + struct card *tmp; /*debug: print into file*/ FILE *fd = fopen("tprint-out.txt", "w"); - for (tmp = t; tmp; tmp = tmp->li_next) - if (*(tmp->li_line) != '*') - fprintf(fd, "%6d %6d %s\n", tmp->li_linenum_orig, tmp->li_linenum, tmp->li_line); + for (tmp = t; tmp; tmp = tmp->nextcard) + if (*(tmp->line) != '*') + fprintf(fd, "%6d %6d %s\n", tmp->linenum_orig, tmp->linenum, tmp->line); fprintf(fd, "\n*********************************************************************************\n"); fprintf(fd, "*********************************************************************************\n"); fprintf(fd, "*********************************************************************************\n\n"); - for (tmp = t; tmp; tmp = tmp->li_next) - fprintf(fd, "%6d %6d %s\n", tmp->li_linenum_orig, tmp->li_linenum, tmp->li_line); + for (tmp = t; tmp; tmp = tmp->nextcard) + fprintf(fd, "%6d %6d %s\n", tmp->linenum_orig, tmp->linenum, tmp->line); fprintf(fd, "\n*********************************************************************************\n"); fprintf(fd, "*********************************************************************************\n"); fprintf(fd, "*********************************************************************************\n\n"); - for (tmp = t; tmp; tmp = tmp->li_next) - if (*(tmp->li_line) != '*') - fprintf(fd, "%s\n",tmp->li_line); + for (tmp = t; tmp; tmp = tmp->nextcard) + if (*(tmp->line) != '*') + fprintf(fd, "%s\n",tmp->line); fclose(fd); } @@ -5667,11 +5667,11 @@ tprint(struct line *t) .if(expression) --> .if{expression} */ static void -inp_dot_if(struct line *card) +inp_dot_if(struct card *card) { - for (; card; card = card->li_next) { + for (; card; card = card->nextcard) { - char *curr_line = card->li_line; + char *curr_line = card->line; if (*curr_line == '*') continue; @@ -5680,7 +5680,7 @@ inp_dot_if(struct line *card) char *firstbr = strchr(curr_line, '('); char *lastbr = strrchr(curr_line, ')'); if ((!firstbr) || (!lastbr)) { - fprintf(cp_err, "Error in netlist line %d\n", card->li_linenum_orig); + fprintf(cp_err, "Error in netlist line %d\n", card->linenum_orig); fprintf(cp_err, " Bad syntax: %s\n\n", curr_line); controlled_exit(EXIT_BAD); } @@ -5705,12 +5705,12 @@ inp_dot_if(struct line *card) static char *inp_functionalise_identifier(char *curr_line, char *identifier); static void -inp_fix_temper_in_param(struct line *deck) +inp_fix_temper_in_param(struct card *deck) { int skip_control = 0, subckt_depth = 0, j, *sub_count; char *funcbody, *funcname; struct func_temper *f, *funcs = NULL, **funcs_tail_ptr = &funcs; - struct line *card; + struct card *card; sub_count = TMALLOC(int, 16); for(j = 0; j < 16; j++) @@ -5722,9 +5722,9 @@ inp_fix_temper_in_param(struct line *deck) .func xxx1() 'temper + 25' */ card = deck; - for (; card; card = card->li_next) { + for (; card; card = card->nextcard) { - char *curr_line = card->li_line; + char *curr_line = card->line; if (*curr_line == '*') continue; @@ -5789,7 +5789,7 @@ inp_fix_temper_in_param(struct line *deck) fprintf(stderr, "Error: you cannot assign a value to TEMPER\n" " Line no. %d, %s\n", - card->li_linenum, curr_line); + card->linenum, curr_line); controlled_exit(EXIT_BAD); } @@ -5819,10 +5819,10 @@ inp_fix_temper_in_param(struct line *deck) sub_count[j] = 0; card = deck; - for (; card; card = card->li_next) { + for (; card; card = card->nextcard) { char *new_str = NULL; /* string we assemble here */ - char *curr_line = card->li_line; + char *curr_line = card->line; char *firsttok_str; if (*curr_line == '*') @@ -5887,8 +5887,8 @@ inp_fix_temper_in_param(struct line *deck) tfree(funcbody); } else { /* Or just enter new line into deck */ - insert_new_line(card, new_str, 0, card->li_linenum); - *card->li_line = '*'; + insert_new_line(card, new_str, 0, card->linenum); + *card->line = '*'; } } } @@ -5929,7 +5929,7 @@ inp_functionalise_identifier(char *curr_line, char *identifier) */ static struct func_temper * -inp_new_func(char *funcname, char *funcbody, struct line *card, +inp_new_func(char *funcname, char *funcbody, struct card *card, int *sub_count, int subckt_depth) { struct func_temper *f; @@ -5944,8 +5944,8 @@ inp_new_func(char *funcname, char *funcbody, struct line *card, /* replace line in deck */ new_str = tprintf(".func %s() %s", funcname, funcbody); - *card->li_line = '*'; - insert_new_line(card, new_str, 0, card->li_linenum); + *card->line = '*'; + insert_new_line(card, new_str, 0, card->linenum); return f; } @@ -5966,15 +5966,15 @@ inp_delete_funcs(struct func_temper *f) /* look for unquoted parameters and quote them */ /* FIXME, this function seems to be useless and/or buggy and/or naive */ static void -inp_quote_params(struct line *c, struct line *end_c, struct dependency *deps, int num_params) +inp_quote_params(struct card *c, struct card *end_c, struct dependency *deps, int num_params) { bool in_control = FALSE; - for (; c && c != end_c; c = c->li_next) { + for (; c && c != end_c; c = c->nextcard) { int i, j, num_terminals; - char *curr_line = c->li_line; + char *curr_line = c->line; if (ciprefix(".control", curr_line)) { in_control = TRUE; @@ -6033,8 +6033,8 @@ inp_quote_params(struct line *c, struct line *end_c, struct dependency *deps, in curr_line = tprintf("%.*s{%s}%s", prefix_len, curr_line, deps[i].param_name, rest); s = curr_line + prefix_len + strlen(deps[i].param_name) + 2; - tfree(c->li_line); - c->li_line = curr_line; + tfree(c->line); + c->line = curr_line; } else { s += strlen(deps[i].param_name); } diff --git a/src/frontend/measure.c b/src/frontend/measure.c index f126f2b55..edc4ca81f 100644 --- a/src/frontend/measure.c +++ b/src/frontend/measure.c @@ -209,7 +209,7 @@ do_measure( bool chk_only /*in: TRUE if checking for "autostop", FALSE otherwise*/ ) { - struct line *meas_card, *meas_results = NULL, *end = NULL, *newcard; + struct card *meas_card, *meas_results = NULL, *end = NULL, *newcard; char *line, *an_name, *an_type, *resname, *meastype, *str_ptr, out_line[1000]; int ok = 0; int fail; @@ -261,8 +261,8 @@ do_measure( */ /* first pass through .meas cards: evaluate everything except param|expr */ - for (meas_card = ft_curckt->ci_meas; meas_card != NULL; meas_card = meas_card->li_next) { - line = meas_card->li_line; + for (meas_card = ft_curckt->ci_meas; meas_card != NULL; meas_card = meas_card->nextcard) { + line = meas_card->line; line = nexttok(line); /* discard .meas */ @@ -272,8 +272,8 @@ do_measure( if (chkAnalysisType(an_type) != TRUE) { if (!chk_only) { - fprintf(cp_err, "Error: unrecognized analysis type '%s' for the following .meas statement on line %d:\n", an_type, meas_card->li_linenum); - fprintf(cp_err, " %s\n", meas_card->li_line); + fprintf(cp_err, "Error: unrecognized analysis type '%s' for the following .meas statement on line %d:\n", an_type, meas_card->linenum); + fprintf(cp_err, " %s\n", meas_card->line); } txfree(an_type); @@ -305,13 +305,13 @@ do_measure( /* New way of processing measure statements using common code in fcn get_measure2() (com_measure2.c)*/ out_line[0] = '\0'; - measure_word_list = measure_parse_line(meas_card->li_line); + measure_word_list = measure_parse_line(meas_card->line); if (measure_word_list) { fail = get_measure2(measure_word_list, &result, out_line, chk_only); if (fail) { measures_passed = FALSE; if (!chk_only) - fprintf(stderr, " %s failed!\n\n", meas_card->li_line); + fprintf(stderr, " %s failed!\n\n", meas_card->line); num_failed++; if (chk_only) { /* added for speed - cleanup last parse and break */ @@ -332,14 +332,14 @@ do_measure( } if (!chk_only) { - newcard = TMALLOC(struct line, 1); - newcard->li_line = strdup(out_line); - newcard->li_next = NULL; + newcard = TMALLOC(struct card, 1); + newcard->line = strdup(out_line); + newcard->nextcard = NULL; if (meas_results == NULL) { meas_results = end = newcard; } else { - end->li_next = newcard; + end->nextcard = newcard; end = newcard; } } @@ -356,8 +356,8 @@ do_measure( } /* second pass through .meas cards: now do param|expr .meas statements */ newcard = meas_results; - for (meas_card = ft_curckt->ci_meas; meas_card != NULL; meas_card = meas_card->li_next) { - line = meas_card->li_line; + for (meas_card = ft_curckt->ci_meas; meas_card != NULL; meas_card = meas_card->nextcard) { + line = meas_card->line; line = nexttok(line); /* discard .meas */ @@ -367,8 +367,8 @@ do_measure( if (chkAnalysisType(an_type) != TRUE) { if (!chk_only) { - fprintf(cp_err, "Error: unrecognized analysis type '%s' for the following .meas statement on line %d:\n", an_type, meas_card->li_linenum); - fprintf(cp_err, " %s\n", meas_card->li_line); + fprintf(cp_err, "Error: unrecognized analysis type '%s' for the following .meas statement on line %d:\n", an_type, meas_card->linenum); + fprintf(cp_err, " %s\n", meas_card->line); } txfree(an_type); @@ -386,11 +386,11 @@ do_measure( if (strncmp(meastype, "param", 5) != 0 && strncmp(meastype, "expr", 4) != 0) { if (!chk_only) - fprintf(stdout, "%s", newcard->li_line); + fprintf(stdout, "%s", newcard->line); end = newcard; - newcard = newcard->li_next; + newcard = newcard->nextcard; - txfree(end->li_line); + txfree(end->line); txfree(end); txfree(an_type); @@ -403,10 +403,10 @@ do_measure( fprintf(stdout, "%-20s=", resname); if (!chk_only) { - ok = nupa_eval(meas_card->li_line, meas_card->li_linenum, meas_card->li_linenum_orig); + ok = nupa_eval(meas_card->line, meas_card->linenum, meas_card->linenum_orig); if (ok) { - str_ptr = strstr(meas_card->li_line, meastype); + str_ptr = strstr(meas_card->line, meastype); if (!get_double_value(&str_ptr, meastype, &result, chk_only)) { if (!chk_only) fprintf(stdout, " failed\n"); diff --git a/src/frontend/nutinp.c b/src/frontend/nutinp.c index c8b82ec2d..4d09c8dee 100644 --- a/src/frontend/nutinp.c +++ b/src/frontend/nutinp.c @@ -27,8 +27,8 @@ Author: 1985 Wayne A. Christopher void inp_nutsource(FILE *fp, bool comfile, char *filename) { - struct line *deck, *dd, *ld; - struct line *realdeck, *options = NULL; + struct card *deck, *dd, *ld; + struct card *realdeck, *options = NULL; char *tt = NULL, name[BSIZE_SP], *s, *t; bool commands = FALSE; wordlist *wl = NULL, *end = NULL; @@ -43,8 +43,8 @@ inp_nutsource(FILE *fp, bool comfile, char *filename) if (!comfile) { /* Save the title before INPgetTitle gets it. */ - tt = copy(deck->li_line); - if (!deck->li_next) + tt = copy(deck->line); + if (!deck->nextcard) fprintf(cp_err, "Warning: no lines in deck...\n"); } (void) fclose(fp); @@ -74,80 +74,80 @@ inp_nutsource(FILE *fp, bool comfile, char *filename) if (comfile) { /* This is easy. */ for (dd = deck; dd; dd = ld) { - ld = dd->li_next; - if ((dd->li_line[0] == '*') && (dd->li_line[1] != '#')) + ld = dd->nextcard; + if ((dd->line[0] == '*') && (dd->line[1] != '#')) continue; - if (!ciprefix(".control", dd->li_line) && - !ciprefix(".endc", dd->li_line)) { - if (dd->li_line[0] == '*') - (void) cp_evloop(dd->li_line + 2); + if (!ciprefix(".control", dd->line) && + !ciprefix(".endc", dd->line)) { + if (dd->line[0] == '*') + (void) cp_evloop(dd->line + 2); else - (void) cp_evloop(dd->li_line); + (void) cp_evloop(dd->line); } - tfree(dd->li_line); + tfree(dd->line); tfree(dd); } } else { - for (dd = deck->li_next; dd; dd = ld->li_next) { - if ((dd->li_line[0] == '*') && (dd->li_line[1] != '#')) { + for (dd = deck->nextcard; dd; dd = ld->nextcard) { + if ((dd->line[0] == '*') && (dd->line[1] != '#')) { ld = dd; continue; } - (void) strncpy(name, dd->li_line, BSIZE_SP); + (void) strncpy(name, dd->line, BSIZE_SP); s = skip_ws(name); t = skip_non_ws(s); *t = '\0'; - if (ciprefix(".control", dd->li_line)) { - ld->li_next = dd->li_next; - tfree(dd->li_line); + if (ciprefix(".control", dd->line)) { + ld->nextcard = dd->nextcard; + tfree(dd->line); tfree(dd); if (commands) fprintf(cp_err, "Warning: redundant .control line\n"); else commands = TRUE; - } else if (ciprefix(".endc", dd->li_line)) { - ld->li_next = dd->li_next; - tfree(dd->li_line); + } else if (ciprefix(".endc", dd->line)) { + ld->nextcard = dd->nextcard; + tfree(dd->line); tfree(dd); if (commands) commands = FALSE; else fprintf(cp_err, "Warning: misplaced .endc line\n"); - } else if (commands || prefix("*#", dd->li_line)) { + } else if (commands || prefix("*#", dd->line)) { controls = wl_cons(NULL, controls); wl = controls; - if (prefix("*#", dd->li_line)) - wl->wl_word = copy(dd->li_line + 2); + if (prefix("*#", dd->line)) + wl->wl_word = copy(dd->line + 2); else - wl->wl_word = dd->li_line; - ld->li_next = dd->li_next; + wl->wl_word = dd->line; + ld->nextcard = dd->nextcard; tfree(dd); - } else if (!*dd->li_line) { + } else if (!*dd->line) { /* So blank lines in com files don't get * considered as circuits. */ - ld->li_next = dd->li_next; - tfree(dd->li_line); + ld->nextcard = dd->nextcard; + tfree(dd->line); tfree(dd); } else { inp_casefix(s); - inp_casefix(dd->li_line); + inp_casefix(dd->line); if (eq(s, ".width") || ciprefix(".four", s) || eq(s, ".plot") || eq(s, ".print") || eq(s, ".save")) { - wl_append_word(&wl, &end, copy(dd->li_line)); - ld->li_next = dd->li_next; - tfree(dd->li_line); + wl_append_word(&wl, &end, copy(dd->line)); + ld->nextcard = dd->nextcard; + tfree(dd->line); tfree(dd); } else { ld = dd; } } } - if (deck->li_next) { + if (deck->nextcard) { /* There is something left after the controls. */ fprintf(cp_out, "\nCircuit: %s\n\n", tt); fprintf(stderr, "\nCircuit: %s\n\n", tt); @@ -157,8 +157,8 @@ inp_nutsource(FILE *fp, bool comfile, char *filename) * deal with the commands. */ if (!cp_getvar("nosubckt", CP_BOOL, NULL)) - deck->li_next = inp_subcktexpand(deck->li_next); - deck->li_actual = realdeck; + deck->nextcard = inp_subcktexpand(deck->nextcard); + deck->actualLine = realdeck; nutinp_dodeck(deck, tt, wl, FALSE, options, filename); } @@ -259,7 +259,7 @@ nutinp_source(char *file) */ void -nutinp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse, struct line *options, char *filename) +nutinp_dodeck(struct card *deck, char *tt, wordlist *end, bool reuse, struct card *options, char *filename) { NG_IGNORE(filename); NG_IGNORE(options); diff --git a/src/frontend/options.c b/src/frontend/options.c index 8796cee4c..4a68fdb52 100644 --- a/src/frontend/options.c +++ b/src/frontend/options.c @@ -136,20 +136,20 @@ cp_usrvars(void) /* Extract the .option lines from the deck */ -struct line * -inp_getopts(struct line *deck) +struct card * +inp_getopts(struct card *deck) { - struct line *last = NULL, *opts = NULL, *dd, *next = NULL; + struct card *last = NULL, *opts = NULL, *dd, *next = NULL; - for (dd = deck->li_next; dd; dd = next) { - next = dd->li_next; - if (ciprefix(".opt", dd->li_line)) { - inp_casefix(dd->li_line); + for (dd = deck->nextcard; dd; dd = next) { + next = dd->nextcard; + if (ciprefix(".opt", dd->line)) { + inp_casefix(dd->line); if (last) - last->li_next = dd->li_next; + last->nextcard = dd->nextcard; else - deck->li_next = dd->li_next; - dd->li_next = opts; + deck->nextcard = dd->nextcard; + dd->nextcard = opts; opts = dd; } else { last = dd; @@ -165,20 +165,20 @@ inp_getopts(struct line *deck) * substitute '.options' for 'option' * then put it in front of the given 'options' list */ -struct line * -inp_getoptsc(char *line, struct line *options) +struct card * +inp_getoptsc(char *line, struct card *options) { line = nexttok(line); /* skip option */ - struct line *next = TMALLOC(struct line, 1); + struct card *next = TMALLOC(struct card, 1); - next->li_line = tprintf(".options %s", line); - next->li_linenum = 0; - next->li_error = NULL; - next->li_actual = NULL; + next->line = tprintf(".options %s", line); + next->linenum = 0; + next->error = NULL; + next->actualLine = NULL; /* put new line in front */ - next->li_next = options; + next->nextcard = options; return next; } diff --git a/src/frontend/runcoms2.c b/src/frontend/runcoms2.c index 95ce71379..ea0bc0a94 100644 --- a/src/frontend/runcoms2.c +++ b/src/frontend/runcoms2.c @@ -29,7 +29,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #define RAWBUF_SIZE 32768 extern char rawfileBuf[RAWBUF_SIZE]; -extern void line_free_x(struct line * deck, bool recurse); +extern void line_free_x(struct card * deck, bool recurse); extern INPmodel *modtab; #define line_free(line, flag) \ @@ -198,7 +198,7 @@ void com_remcirc(wordlist *wl) { struct variable *v, *next; - struct line *dd; /*in: the spice deck */ + struct card *dd; /*in: the spice deck */ struct circ *p, *prev = NULL; #ifdef SHARED_MODULE TRANan *job; diff --git a/src/frontend/spiceif.c b/src/frontend/spiceif.c index 46dd085ba..b6e4e48e8 100644 --- a/src/frontend/spiceif.c +++ b/src/frontend/spiceif.c @@ -92,16 +92,16 @@ static int finddev_special(CKTcircuit *ckt, char *name, GENinstance **devptr, GE /* Input a single deck, and return a pointer to the circuit. */ CKTcircuit * -if_inpdeck(struct line *deck, INPtables **tab) +if_inpdeck(struct card *deck, INPtables **tab) { CKTcircuit *ckt; int err, i; - struct line *ll; + struct card *ll; IFuid taskUid; IFuid optUid; int which = -1; - for (i = 0, ll = deck; ll; ll = ll->li_next) + for (i = 0, ll = deck; ll; ll = ll->nextcard) i++; *tab = INPtabInit(i); ft_curckt->ci_symtab = *tab; @@ -160,16 +160,16 @@ if_inpdeck(struct line *deck, INPtables **tab) /* reset the model table, will be filled in anew in INPpas1() */ modtab = NULL; - INPpas1(ckt, (card *) deck->li_next, *tab); + INPpas1(ckt, (card *) deck->nextcard, *tab); /* store the new model table in the current circuit */ ft_curckt->ci_modtab = modtab; - INPpas2(ckt, (card *) deck->li_next, *tab, ft_curckt->ci_defTask); + INPpas2(ckt, (card *) deck->nextcard, *tab, ft_curckt->ci_defTask); /* INPpas2 has been modified to ignore .NODESET and .IC * cards. These are left till INPpas3 so that we can check for * nodeset/ic of non-existant nodes. */ - INPpas3(ckt, (card *) deck->li_next, + INPpas3(ckt, (card *) deck->nextcard, *tab, ft_curckt->ci_defTask, ft_sim->nodeParms, ft_sim->numNodeParms); @@ -197,7 +197,7 @@ int if_run(CKTcircuit *ckt, char *what, wordlist *args, INPtables *tab) { int err; - struct line deck; + struct card deck; char buf[BSIZE_SP]; int which = -1; IFuid specUid, optUid; @@ -226,10 +226,10 @@ if_run(CKTcircuit *ckt, char *what, wordlist *args, INPtables *tab) s = wl_flatten(args); /* va: tfree char's tmalloc'ed in wl_flatten */ (void) sprintf(buf, ".%s", s); tfree(s); - deck.li_next = deck.li_actual = NULL; - deck.li_error = NULL; - deck.li_linenum = 0; - deck.li_line = buf; + deck.nextcard = deck.actualLine = NULL; + deck.error = NULL; + deck.linenum = 0; + deck.line = buf; /*CDHW Delete any previous special task CDHW*/ @@ -302,8 +302,8 @@ if_run(CKTcircuit *ckt, char *what, wordlist *args, INPtables *tab) INPpas2(ckt, (card *) &deck, tab, ft_curckt->ci_specTask); - if (deck.li_error) { - fprintf(cp_err, "Warning: %s\n", deck.li_error); + if (deck.error) { + fprintf(cp_err, "Warning: %s\n", deck.error); return 2; } } diff --git a/src/frontend/spiceif.h b/src/frontend/spiceif.h index b76e7ca36..118065b15 100644 --- a/src/frontend/spiceif.h +++ b/src/frontend/spiceif.h @@ -6,7 +6,7 @@ #ifndef ngspice_SPICEIF_H #define ngspice_SPICEIF_H -CKTcircuit * if_inpdeck(struct line *deck, INPtables **tab); +CKTcircuit * if_inpdeck(struct card *deck, INPtables **tab); int if_run(CKTcircuit *t, char *what, wordlist *args, INPtables *tab); int if_option(CKTcircuit *ckt, char *name, enum cp_types type, void *value); void if_dump(CKTcircuit *ckt, FILE *file); diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index bcb752a3c..064304f34 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -74,7 +74,7 @@ Modified: 2000 AlansFixes #include "numparam/numpaif.h" -extern void line_free_x(struct line * deck, bool recurse); +extern void line_free_x(struct card * deck, bool recurse); #define line_free(line, flag) \ do { \ @@ -85,8 +85,8 @@ extern void line_free_x(struct line * deck, bool recurse); struct subs; -static struct line *doit(struct line *deck, wordlist *modnames); -static int translate(struct line *deck, char *formal, char *actual, char *scname, +static struct card *doit(struct card *deck, wordlist *modnames); +static int translate(struct card *deck, char *formal, char *actual, char *scname, const char *subname, struct subs *subs, wordlist const *modnames); struct bxx_buffer; static void finishLine(struct bxx_buffer *dst, char *src, char *scname); @@ -94,8 +94,8 @@ static int settrans(char *formal, char *actual, const char *subname); static char *gettrans(const char *name, const char *name_end); static int numnodes(const char *line, struct subs *subs, wordlist const *modnames); static int numdevs(char *s); -static wordlist *modtranslate(struct line *deck, char *subname, wordlist *new_modnames); -static void devmodtranslate(struct line *deck, char *subname, wordlist * const orig_modnames); +static wordlist *modtranslate(struct card *deck, char *subname, wordlist *new_modnames); +static void devmodtranslate(struct card *deck, char *subname, wordlist * const orig_modnames); static int inp_numnodes(char c); /*--------------------------------------------------------------------- @@ -117,7 +117,7 @@ struct subs { char *su_name; /* The .subckt name. */ char *su_args; /* The .subckt arguments, space separated. */ int su_numargs; - struct line *su_def; /* Pointer to the .subckt definition. */ + struct card *su_def; /* Pointer to the .subckt definition. */ struct subs *su_next; }; @@ -136,7 +136,7 @@ static int num_global_nodes; static void -collect_global_nodes(struct line *c) +collect_global_nodes(struct card *c) { num_global_nodes = 0; @@ -146,16 +146,16 @@ collect_global_nodes(struct line *c) global_nodes[num_global_nodes++] = copy("null"); #endif - for (; c; c = c->li_next) - if (ciprefix(".global", c->li_line)) { - char *s = c->li_line; + for (; c; c = c->nextcard) + if (ciprefix(".global", c->line)) { + char *s = c->line; s = nexttok(s); while (*s) { char *t = skip_non_ws(s); global_nodes[num_global_nodes++] = copy_substring(s, t); s = skip_ws(t); } - c->li_line[0] = '*'; /* comment it out */ + c->line[0] = '*'; /* comment it out */ } #ifdef TRACE @@ -202,9 +202,9 @@ free_global_nodes(void) it returns a pointer to the same deck after the new subcircuits are spliced in. -------------------------------------------------------------------*/ -struct line * -inp_subcktexpand(struct line *deck) { - struct line *c; +struct card * +inp_subcktexpand(struct card *deck) { + struct card *c; int ok = 0; wordlist *modnames = NULL; @@ -228,26 +228,26 @@ inp_subcktexpand(struct line *deck) { #ifdef TRACE fprintf(stderr, "Numparams is processing this deck:\n"); - for (c = deck; c; c = c->li_next) - fprintf(stderr, "%3d:%s\n", c->li_linenum, c->li_line); + for (c = deck; c; c = c->nextcard) + fprintf(stderr, "%3d:%s\n", c->linenum, c->line); #endif ok = nupa_signal(NUPADECKCOPY, NULL); /* get the subckt/model names from the deck */ - for (c = deck; c; c = c->li_next) { /* first Numparam pass */ - if (ciprefix(".subckt", c->li_line)) - nupa_scan(c->li_line, c->li_linenum, TRUE); - if (ciprefix(".model", c->li_line)) - nupa_scan(c->li_line, c->li_linenum, FALSE); + for (c = deck; c; c = c->nextcard) { /* first Numparam pass */ + if (ciprefix(".subckt", c->line)) + nupa_scan(c->line, c->linenum, TRUE); + if (ciprefix(".model", c->line)) + nupa_scan(c->line, c->linenum, FALSE); } /* now copy instances */ - for (c = deck; c; c = c->li_next) /* first Numparam pass */ - c->li_line = nupa_copy(c->li_line, c->li_linenum); + for (c = deck; c; c = c->nextcard) /* first Numparam pass */ + c->line = nupa_copy(c->line, c->linenum); #ifdef TRACE fprintf(stderr, "Numparams transformed deck:\n"); - for (c = deck; c; c = c->li_next) - fprintf(stderr, "%3d:%s\n", c->li_linenum, c->li_line); + for (c = deck; c; c = c->nextcard) + fprintf(stderr, "%3d:%s\n", c->linenum, c->line); #endif } @@ -257,17 +257,17 @@ inp_subcktexpand(struct line *deck) { */ { int nest = 0; - for (c = deck; c; c = c->li_next) { + for (c = deck; c; c = c->nextcard) { - if (ciprefix(".subckt", c->li_line)) + if (ciprefix(".subckt", c->line)) nest++; - else if (ciprefix(".ends", c->li_line)) + else if (ciprefix(".ends", c->line)) nest--; else if (nest > 0) continue; - if (ciprefix(model, c->li_line)) { - char *s = nexttok(c->li_line); + if (ciprefix(model, c->line)) { + char *s = nexttok(c->line); modnames = wl_cons(gettok(&s), modnames); } } @@ -286,9 +286,9 @@ inp_subcktexpand(struct line *deck) { collect_global_nodes(deck); /* Let's do a few cleanup things... Get rid of ( ) around node lists... */ - for (c = deck; c; c = c->li_next) { /* iterate on lines in deck */ + for (c = deck; c; c = c->nextcard) { /* iterate on lines in deck */ - char *s = c->li_line; + char *s = c->line; if (*s == '*') /* skip comment */ continue; @@ -350,14 +350,14 @@ inp_subcktexpand(struct line *deck) { /* Count numbers of line in deck after expansion */ if (deck) { dynMaxckt = 0; /* number of lines in deck after expansion */ - for (c = deck; c; c = c->li_next) + for (c = deck; c; c = c->nextcard) dynMaxckt++; } /* Now check to see if there are still subckt instances undefined... */ - for (c = deck; c; c = c->li_next) - if (ciprefix(invoke, c->li_line)) { - fprintf(cp_err, "Error: unknown subckt: %s\n", c->li_line); + for (c = deck; c; c = c->nextcard) + if (ciprefix(invoke, c->line)) { + fprintf(cp_err, "Error: unknown subckt: %s\n", c->line); if (use_numparams) ok = ok && nupa_signal(NUPAEVALDONE, NULL); return NULL; @@ -366,19 +366,19 @@ inp_subcktexpand(struct line *deck) { if (use_numparams) { /* the NUMPARAM final line translation pass */ ok = ok && nupa_signal(NUPASUBDONE, NULL); - for (c = deck; c; c = c->li_next) + for (c = deck; c; c = c->nextcard) /* 'param' .meas statements can have dependencies on measurement values */ /* need to skip evaluating here and evaluate after other .meas statements */ - if (ciprefix(".meas", c->li_line) && strstr(c->li_line, "param")) { + if (ciprefix(".meas", c->line) && strstr(c->line, "param")) { ; } else { - nupa_eval(c->li_line, c->li_linenum, c->li_linenum_orig); + nupa_eval(c->line, c->linenum, c->linenum_orig); } #ifdef TRACE fprintf(stderr, "Numparams converted deck:\n"); - for (c = deck; c; c = c->li_next) - fprintf(stderr, "%3d:%s\n", c->li_linenum, c->li_line); + for (c = deck; c; c = c->nextcard) + fprintf(stderr, "%3d:%s\n", c->linenum, c->line); #endif /*nupa_list_params(stdout);*/ @@ -390,22 +390,22 @@ inp_subcktexpand(struct line *deck) { } -static struct line * -find_ends(struct line *l) +static struct card * +find_ends(struct card *l) { int nest = 1; - while (l->li_next) { + while (l->nextcard) { - if (ciprefix(sbend, l->li_next->li_line)) /* found a .ends */ + if (ciprefix(sbend, l->nextcard->line)) /* found a .ends */ nest--; - else if (ciprefix(start, l->li_next->li_line)) /* found a .subckt */ + else if (ciprefix(start, l->nextcard->line)) /* found a .subckt */ nest++; if (!nest) break; - l = l->li_next; + l = l->nextcard; } return l; @@ -423,8 +423,8 @@ find_ends(struct line *l) /* It takes as argument a pointer to the deck, and returns a */ /* pointer to the deck after the subcircuit has been spliced in. */ /*-------------------------------------------------------------------*/ -static struct line * -doit(struct line *deck, wordlist *modnames) { +static struct card * +doit(struct card *deck, wordlist *modnames) { struct subs *sss = NULL; /* *sss temporarily hold decks to substitute */ int numpasses = MAXNEST; bool gotone; @@ -437,31 +437,31 @@ doit(struct line *deck, wordlist *modnames) { #ifdef TRACE /* SDB debug statement */ { - struct line *c; + struct card *c; printf("In doit, about to start first pass through deck.\n"); - for (c = deck; c; c = c->li_next) - printf(" %s\n", c->li_line); + for (c = deck; c; c = c->nextcard) + printf(" %s\n", c->line); } #endif { /* First pass: xtract all the .subckts and stick pointers to them into sss. */ - struct line *c = deck; - struct line *prev_of_c = NULL; + struct card *c = deck; + struct card *prev_of_c = NULL; while (c) { - if (ciprefix(sbend, c->li_line)) { /* if line == .ends */ + if (ciprefix(sbend, c->line)) { /* if line == .ends */ fprintf(cp_err, "Error: misplaced %s line: %s\n", sbend, - c->li_line); + c->line); return (NULL); } - if (ciprefix(start, c->li_line)) { /* if line == .subckt */ + if (ciprefix(start, c->line)) { /* if line == .subckt */ - struct line *prev_of_ends = find_ends(c); - struct line *ends = prev_of_ends->li_next; + struct card *prev_of_ends = find_ends(c); + struct card *ends = prev_of_ends->nextcard; if (!ends) { fprintf(cp_err, "Error: no %s line.\n", sbend); @@ -475,7 +475,7 @@ doit(struct line *deck, wordlist *modnames) { /* Now put the .subckt definition found into sss */ { - char *s = c->li_line; + char *s = c->line; sss = TMALLOC(struct subs, 1); @@ -483,7 +483,7 @@ doit(struct line *deck, wordlist *modnames) { sss->su_name = gettok(&s); sss->su_args = copy(s); - sss->su_def = c->li_next; + sss->su_def = c->nextcard; /* count the number of args in the .subckt line */ sss->su_numargs = 0; @@ -503,25 +503,25 @@ doit(struct line *deck, wordlist *modnames) { /* cut the whole .subckt ... .ends sequence from the deck chain */ line_free_x(c, FALSE); /* drop the .subckt card */ - c = ends->li_next; + c = ends->nextcard; if (prev_of_c) - prev_of_c->li_next = c; + prev_of_c->nextcard = c; else deck = c; if (use_numparams == FALSE) { line_free_x(ends, FALSE); /* drop the .ends card */ - prev_of_ends->li_next = NULL; + prev_of_ends->nextcard = NULL; } else { - ends->li_line[0] = '*'; /* comment the .ends card */ - ends->li_next = NULL; + ends->line[0] = '*'; /* comment the .ends card */ + ends->nextcard = NULL; } } else { prev_of_c = c; - c = c->li_next; + c = c->nextcard; } } } @@ -542,27 +542,27 @@ doit(struct line *deck, wordlist *modnames) { #ifdef TRACE /* SDB debug statement */ { - struct line *c; + struct card *c; printf("In doit, about to start second pass through deck.\n"); - for (c = deck; c; c = c->li_next) - printf(" %s\n", c->li_line); + for (c = deck; c; c = c->nextcard) + printf(" %s\n", c->line); } #endif error = 0; /* Second pass: do the replacements. */ do { /* while (!error && numpasses-- && gotone) */ - struct line *c = deck; - struct line *prev_of_c = NULL; + struct card *c = deck; + struct card *prev_of_c = NULL; gotone = FALSE; - for (; c; prev_of_c = c, c = c->li_next) { - if (ciprefix(invoke, c->li_line)) { /* found reference to .subckt (i.e. component with refdes X) */ + for (; c; prev_of_c = c, c = c->nextcard) { + if (ciprefix(invoke, c->line)) { /* found reference to .subckt (i.e. component with refdes X) */ char *tofree, *tofree2, *s, *t; char *scname; gotone = TRUE; - t = tofree = s = copy(c->li_line); /* s & t hold copy of component line */ + t = tofree = s = copy(c->line); /* s & t hold copy of component line */ /* make scname point to first non-whitepace chars after refdes invocation * e.g. if invocation is Xreference, *scname = reference @@ -601,8 +601,8 @@ doit(struct line *deck, wordlist *modnames) { */ if (sss) { - struct line *su_deck = inp_deckcopy(sss->su_def); - struct line *rest_of_c = c->li_next; + struct card *su_deck = inp_deckcopy(sss->su_def); + struct card *rest_of_c = c->nextcard; /* Now we have to replace this line with the * macro definition. @@ -625,19 +625,19 @@ doit(struct line *deck, wordlist *modnames) { if (use_numparams == FALSE) { line_free_x(c, FALSE); /* drop the invocation */ if (prev_of_c) - prev_of_c->li_next = su_deck; + prev_of_c->nextcard = su_deck; else deck = su_deck; } else { - c->li_line[0] = '*'; /* comment the invocation */ - c->li_next = su_deck; + c->line[0] = '*'; /* comment the invocation */ + c->nextcard = su_deck; } c = su_deck; - while (c->li_next) - c = c->li_next; + while (c->nextcard) + c = c->nextcard; - c->li_next = rest_of_c; + c->nextcard = rest_of_c; } tfree(tofree); @@ -655,10 +655,10 @@ doit(struct line *deck, wordlist *modnames) { #ifdef TRACE /* Added by H.Tanaka to display converted deck */ { - struct line *c = deck; + struct card *c = deck; printf("Converted deck\n"); - for (; c; c = c->li_next) - printf("%s\n", c->li_line); + for (; c; c = c->nextcard) + printf("%s\n", c->line); } { wordlist *w = modnames; @@ -692,23 +692,23 @@ doit(struct line *deck, wordlist *modnames) { /*-------------------------------------------------------------------*/ /* Copy a deck, including the actual lines. */ /*-------------------------------------------------------------------*/ -struct line * -inp_deckcopy(struct line *deck) { - struct line *d = NULL, *nd = NULL; +struct card * +inp_deckcopy(struct card *deck) { + struct card *d = NULL, *nd = NULL; while (deck) { if (nd) { - d->li_next = TMALLOC(struct line, 1); - d = d->li_next; + d->nextcard = TMALLOC(struct card, 1); + d = d->nextcard; } else { - nd = d = TMALLOC(struct line, 1); + nd = d = TMALLOC(struct card, 1); } - d->li_linenum = deck->li_linenum; - d->li_line = copy(deck->li_line); - if (deck->li_error) - d->li_error = copy(deck->li_error); - d->li_actual = inp_deckcopy(deck->li_actual); - deck = deck->li_next; + d->linenum = deck->linenum; + d->line = copy(deck->line); + if (deck->error) + d->error = copy(deck->error); + d->actualLine = inp_deckcopy(deck->actualLine); + deck = deck->nextcard; } return (nd); } @@ -866,7 +866,7 @@ bxx_buffer(struct bxx_buffer *t) * touch it. * * Variable name meanings: - * *deck = pointer to subcircuit definition (lcc) (struct line) + * *deck = pointer to subcircuit definition (lcc) (struct card) * formal = copy of the .subckt definition line (e.g. ".subckt subcircuitname 1 2 3") (string) * actual = copy of the .subcircuit invocation line (e.g. "Xexample 4 5 6 subcircuitname") (string) * scname = refdes (- first letter) used at invocation (e.g. "example") (string) @@ -909,9 +909,9 @@ translate_inst_name(struct bxx_buffer *buffer, const char *scname, const char *n static int -translate(struct line *deck, char *formal, char *actual, char *scname, const char *subname, struct subs *subs, wordlist const *modnames) +translate(struct card *deck, char *formal, char *actual, char *scname, const char *subname, struct subs *subs, wordlist const *modnames) { - struct line *c; + struct card *c; struct bxx_buffer buffer; char *next_name, *name, *t, *nametofree, *paren_ptr; int nnodes, i, dim; @@ -933,8 +933,8 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha goto quit; } - for (c = deck; c; c = c->li_next) { - char *s = c->li_line; + for (c = deck; c; c = c->nextcard) { + char *s = c->line; char dev_type = tolower_c(s[0]); bxx_rewind(&buffer); @@ -951,7 +951,7 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha name = paren_ptr + 1; if ((paren_ptr = strchr(name, ')')) == NULL) { - fprintf(cp_err, "Error: missing closing ')' for .ic|.nodeset statement %s\n", c->li_line); + fprintf(cp_err, "Error: missing closing ')' for .ic|.nodeset statement %s\n", c->line); goto quit; } @@ -1067,13 +1067,13 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha bxx_putc(&buffer, ' '); /* Next iterate over all nodes (netnames) found and translate them. */ - nnodes = numnodes(c->li_line, subs, modnames); + nnodes = numnodes(c->line, subs, modnames); while (--nnodes >= 0) { name = gettok_node(&s); if (name == NULL) { fprintf(cp_err, "Error: too few nodes: %s\n", - c->li_line); + c->line); goto quit; } @@ -1096,7 +1096,7 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha /* move pointer ahead of '(' */ if (get_l_paren(&s) == 1) { fprintf(cp_err, "Error: no left paren after POLY %s\n", - c->li_line); + c->line); tfree(next_name); goto quit; } @@ -1108,7 +1108,7 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha /* move pointer ahead of ')' */ if (get_r_paren(&s) == 1) { fprintf(cp_err, "Error: no right paren after POLY %s\n", - c->li_line); + c->line); tfree(next_name); goto quit; } @@ -1121,11 +1121,11 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha tfree(next_name); /* Now translate the controlling source/nodes */ - nnodes = dim * numdevs(c->li_line); + nnodes = dim * numdevs(c->line); while (--nnodes >= 0) { name = gettok_node(&s); /* name points to the returned token */ if (name == NULL) { - fprintf(cp_err, "Error: too few devs: %s\n", c->li_line); + fprintf(cp_err, "Error: too few devs: %s\n", c->line); goto quit; } @@ -1154,11 +1154,11 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha tfree(name); bxx_putc(&buffer, ' '); - nnodes = numnodes(c->li_line, subs, modnames); + nnodes = numnodes(c->line, subs, modnames); while (--nnodes >= 0) { name = gettok_node(&s); if (name == NULL) { - fprintf(cp_err, "Error: too few nodes: %s\n", c->li_line); + fprintf(cp_err, "Error: too few nodes: %s\n", c->line); goto quit; } @@ -1171,11 +1171,11 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha * This may be superfluous because we handle dependent * source devices above . . . . */ - nnodes = numdevs(c->li_line); + nnodes = numdevs(c->line); while (--nnodes >= 0) { name = gettok_node(&s); if (name == NULL) { - fprintf(cp_err, "Error: too few devs: %s\n", c->li_line); + fprintf(cp_err, "Error: too few devs: %s\n", c->line); goto quit; } @@ -1193,11 +1193,11 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha break; } - tfree(c->li_line); - c->li_line = copy(bxx_buffer(&buffer)); + tfree(c->line); + c->line = copy(bxx_buffer(&buffer)); #ifdef TRACE - printf("In translate, translated line = %s \n", c->li_line); + printf("In translate, translated line = %s \n", c->line); #endif } rtn = 1; @@ -1480,15 +1480,15 @@ numdevs(char *s) * modtranslate returns the list of model names which have been translated *----------------------------------------------------------------------*/ static wordlist * -modtranslate(struct line *c, char *subname, wordlist *new_modnames) +modtranslate(struct card *c, char *subname, wordlist *new_modnames) { wordlist *orig_modnames = NULL; - struct line *lcc = c; + struct card *lcc = c; - for (; c; c = c->li_next) - if (ciprefix(".model", c->li_line)) { + for (; c; c = c->nextcard) + if (ciprefix(".model", c->line)) { char *model_name, *new_model_name; - char *t = c->li_line; + char *t = c->line; #ifdef TRACE printf("modtranslate(), translating:\n" @@ -1508,8 +1508,8 @@ modtranslate(struct line *c, char *subname, wordlist *new_modnames) /* perform the actual translation of this .model line */ t = tprintf(".model %s %s", new_model_name, t); - tfree(c->li_line); - c->li_line = t; + tfree(c->line); + c->line = t; #ifdef TRACE printf(" \"%s\"\n", t); @@ -1553,7 +1553,7 @@ translate_mod_name(struct bxx_buffer *buffer, char *modname, char *subname, stru static void -devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) +devmodtranslate(struct card *s, char *subname, wordlist * const orig_modnames) { int found; @@ -1561,14 +1561,14 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) bxx_init(&buffer); - for (; s; s = s->li_next) { + for (; s; s = s->nextcard) { char *t, c, *name, *next_name; wordlist *wlsub; bxx_rewind(&buffer); - t = s->li_line; + t = s->line; #ifdef TRACE /* SDB debug stuff */ @@ -1629,8 +1629,8 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) #endif bxx_put_cstring(&buffer, t); - tfree(s->li_line); - s->li_line = copy(bxx_buffer(&buffer)); + tfree(s->line); + s->line = copy(bxx_buffer(&buffer)); break; #endif /* XSPICE */ @@ -1663,8 +1663,8 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) } bxx_put_cstring(&buffer, t); - tfree(s->li_line); - s->li_line = copy(bxx_buffer(&buffer)); + tfree(s->line); + s->line = copy(bxx_buffer(&buffer)); break; case 'd': @@ -1684,8 +1684,8 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) tfree(name); bxx_putc(&buffer, ' '); bxx_put_cstring(&buffer, t); - tfree(s->li_line); - s->li_line = copy(bxx_buffer(&buffer)); + tfree(s->line); + s->line = copy(bxx_buffer(&buffer)); break; case 'u': /* urc transmissionline */ @@ -1711,8 +1711,8 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) tfree(name); bxx_putc(&buffer, ' '); bxx_put_cstring(&buffer, t); - tfree(s->li_line); - s->li_line = copy(bxx_buffer(&buffer)); + tfree(s->line); + s->line = copy(bxx_buffer(&buffer)); break; /* 4 terminal devices */ @@ -1743,8 +1743,8 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) translate_mod_name(&buffer, name, subname, orig_modnames); bxx_putc(&buffer, ' '); bxx_put_cstring(&buffer, t); - tfree(s->li_line); - s->li_line = copy(bxx_buffer(&buffer)); + tfree(s->line); + s->line = copy(bxx_buffer(&buffer)); tfree(name); break; @@ -1793,8 +1793,8 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) bxx_putc(&buffer, ' '); bxx_put_cstring(&buffer, t); - tfree(s->li_line); - s->li_line = copy(bxx_buffer(&buffer)); + tfree(s->line); + s->line = copy(bxx_buffer(&buffer)); tfree(name); break; @@ -1838,8 +1838,8 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) bxx_putc(&buffer, ' '); bxx_put_cstring(&buffer, t); - tfree(s->li_line); - s->li_line = copy(bxx_buffer(&buffer)); + tfree(s->line); + s->line = copy(bxx_buffer(&buffer)); break; /* 4-18 terminal devices */ @@ -1869,8 +1869,8 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) bxx_putc(&buffer, ' '); bxx_put_cstring(&buffer, t); - tfree(s->li_line); - s->li_line = copy(bxx_buffer(&buffer)); + tfree(s->line); + s->line = copy(bxx_buffer(&buffer)); break; default: diff --git a/src/frontend/subckt.h b/src/frontend/subckt.h index 969b7e95c..a21b8d875 100644 --- a/src/frontend/subckt.h +++ b/src/frontend/subckt.h @@ -6,7 +6,7 @@ #ifndef ngspice_SUBCKT_H #define ngspice_SUBCKT_H -struct line * inp_subcktexpand(struct line *deck); -struct line * inp_deckcopy(struct line *deck); +struct card * inp_subcktexpand(struct card *deck); +struct card * inp_deckcopy(struct card *deck); #endif diff --git a/src/include/ngspice/enh.h b/src/include/ngspice/enh.h index 9daf34bfb..ded06bef5 100644 --- a/src/include/ngspice/enh.h +++ b/src/include/ngspice/enh.h @@ -94,7 +94,7 @@ struct Enh_Ckt_Data { void ENHreport_conv_prob(Enh_Conv_Source_t type, char *name, char *msg); -struct line *ENHtranslate_poly(struct line *deck); +struct card *ENHtranslate_poly(struct card *deck); #endif diff --git a/src/include/ngspice/ftedefs.h b/src/include/ngspice/ftedefs.h index 04295f0b3..18d045347 100644 --- a/src/include/ngspice/ftedefs.h +++ b/src/include/ngspice/ftedefs.h @@ -35,11 +35,11 @@ struct circ { INPtables *ci_symtab; /* The INP symbol table. */ INPmodel *ci_modtab; /* The INP model table. */ struct dbcomm *ci_dbs; /* The database storing save, iplot, stop data */ - struct line *ci_deck; /* The input deck. */ - struct line *ci_origdeck; /* The input deck, before subckt expansion. */ - struct line *ci_options; /* The .option cards from the deck... */ - struct line *ci_meas; /* .measure commands to run after simulation */ - struct line *ci_param; /* .param statements found in deck */ + struct card *ci_deck; /* The input deck. */ + struct card *ci_origdeck; /* The input deck, before subckt expansion. */ + struct card *ci_options; /* The .option cards from the deck... */ + struct card *ci_meas; /* .measure commands to run after simulation */ + struct card *ci_param; /* .param statements found in deck */ struct variable *ci_vars; /* ... and the parsed versions. */ bool ci_inprogress; /* We are in a break now. */ bool ci_runonce; /* So com_run can to a reset if necessary... */ diff --git a/src/include/ngspice/fteext.h b/src/include/ngspice/fteext.h index 92d111f1b..7944df884 100644 --- a/src/include/ngspice/fteext.h +++ b/src/include/ngspice/fteext.h @@ -206,20 +206,20 @@ extern bool gr_circular; /* inp.c */ -void inp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse, - struct line *options, char *filename); +void inp_dodeck(struct card *deck, char *tt, wordlist *end, bool reuse, + struct card *options, char *filename); extern void inp_source(char *file); void inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile); extern void inp_casefix(char *string); -extern void inp_list(FILE *file, struct line *deck, struct line *extras, int type); -extern struct line *inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_temper); +extern void inp_list(FILE *file, struct card *deck, struct card *extras, int type); +extern struct card *inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_temper); extern FILE *inp_pathopen(char *name, char *mode); extern char *search_identifier(char *str, const char *identifier, char *str_begin); extern char *find_assignment(const char *s); extern char *find_back_assignment(const char *s, const char *start); -extern struct line *line_nconc(struct line *head, struct line *rest); -extern struct line *line_reverse(struct line *head); +extern struct card *line_nconc(struct card *head, struct card *rest); +extern struct card *line_reverse(struct card *head); extern char **circarray; extern void rem_tlist(struct pt_temper *p); @@ -227,8 +227,8 @@ extern void rem_tlist(struct pt_temper *p); /* nutinp.c */ void inp_nutsource(FILE *fp, bool comfile, char *filename); -void nutinp_dodeck(struct line *deck, char *tt, wordlist *end, bool reuse, - struct line *options, char *filename); +void nutinp_dodeck(struct card *deck, char *tt, wordlist *end, bool reuse, + struct card *options, char *filename); extern void nutcom_source(wordlist *wl); /* interpolate.c */ @@ -254,8 +254,8 @@ extern bool ft_gidb; extern bool ft_controldb; extern bool ft_asyncdb; extern char *ft_setkwords[]; -extern struct line *inp_getopts(struct line *deck); -extern struct line *inp_getoptsc(char *line, struct line *options); +extern struct card *inp_getopts(struct card *deck); +extern struct card *inp_getoptsc(char *line, struct card *options); extern bool ft_ngdebug; extern bool ft_stricterror; diff --git a/src/main.c b/src/main.c index f9faba647..a7110aeea 100644 --- a/src/main.c +++ b/src/main.c @@ -265,7 +265,7 @@ if_dump(CKTcircuit *ckt, FILE *fp) /* -------------------------------------------------------------------------- */ CKTcircuit * -if_inpdeck(struct line *deck, INPtables **tab) +if_inpdeck(struct card *deck, INPtables **tab) { NG_IGNORE(tab); NG_IGNORE(deck); @@ -410,8 +410,8 @@ ipc_get_line(char *str, int *len, Ipc_Wait_t wait) return x; } -struct line * -ENHtranslate_poly(struct line *deck) +struct card * +ENHtranslate_poly(struct card *deck) { NG_IGNORE(deck); return NULL; diff --git a/src/xspice/enh/enhtrans.c b/src/xspice/enh/enhtrans.c index 8c9f0bf9e..3c1d0b871 100644 --- a/src/xspice/enh/enhtrans.c +++ b/src/xspice/enh/enhtrans.c @@ -79,25 +79,25 @@ to new polynomial controlled source code model syntax. /* out the old dependent source. */ /* It returns (a pointer to) the processed deck. */ /*---------------------------------------------------------------------*/ -struct line * +struct card * ENHtranslate_poly( - struct line *deck) { /* Linked list of lines in input deck */ - struct line *d; - struct line *l1; - struct line *l2; + struct card *deck) { /* Linked list of lines in input deck */ + struct card *d; + struct card *l1; + struct card *l2; char *card; /* Iterate through each card in the deck and translate as needed */ - for(d = deck; d; d = d->li_next) { + for(d = deck; d; d = d->nextcard) { #ifdef TRACE /* SDB debug statement */ - printf("In ENHtranslate_poly, now examining card %s . . . \n", d->li_line); + printf("In ENHtranslate_poly, now examining card %s . . . \n", d->line); #endif /* If doesn't need to be translated, continue to next card */ - if(! needs_translating(d->li_line)) { + if(! needs_translating(d->line)) { #ifdef TRACE /* SDB debug statement */ @@ -112,27 +112,27 @@ ENHtranslate_poly( #endif /* Create two new line structs and splice into deck */ - l1 = TMALLOC(struct line, 1); - l2 = TMALLOC(struct line, 1); - l2->li_next = d->li_next; - l1->li_next = l2; - d->li_next = l1; + l1 = TMALLOC(struct card, 1); + l2 = TMALLOC(struct card, 1); + l2->nextcard = d->nextcard; + l1->nextcard = l2; + d->nextcard = l1; /* PN 2004: Add original linenumber to ease the debug process * for malfromned netlist */ - l1->li_linenum = d->li_linenum; - l2->li_linenum = d->li_linenum; + l1->linenum = d->linenum; + l2->linenum = d->linenum; /* Create the translated cards */ - d->li_error = two2three_translate(d->li_line, &(l1->li_line), &(l2->li_line)); + d->error = two2three_translate(d->line, &(l1->line), &(l2->line)); /* Comment out the original line */ - card = TMALLOC(char, strlen(d->li_line) + 2); + card = TMALLOC(char, strlen(d->line) + 2); strcpy(card,"*"); - strcat(card, d->li_line); - d->li_line = card; + strcat(card, d->line); + d->line = card; #ifdef TRACE /* SDB debug statement */