Browse Source

comments improved

pre-master-46
h_vogt 10 years ago
committed by rlar
parent
commit
33b11f9598
  1. 5
      src/frontend/inp.c
  2. 21
      src/frontend/inpcom.c
  3. 2
      src/frontend/subckt.c
  4. 4
      src/misc/string.c

5
src/frontend/inp.c

@ -327,15 +327,18 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
tfree(dir_name); tfree(dir_name);
/* if nothing came back from inp_readall, just close fp and return to caller */ /* if nothing came back from inp_readall, just close fp and return to caller */
if (!deck) { /* MW. We must close fp always when returning */
if (!deck) {
if (!intfile) if (!intfile)
fclose(fp); fclose(fp);
return; return;
} }
if (!comfile) { if (!comfile) {
/* Extract the .option lines from the deck into 'options',
and remove them from the deck. */
options = inp_getopts(deck); options = inp_getopts(deck);
/* copy a deck before subckt substitution. */
realdeck = inp_deckcopy(deck); realdeck = inp_deckcopy(deck);
/* Save the title before INPgetTitle gets it. */ /* Save the title before INPgetTitle gets it. */

21
src/frontend/inpcom.c

@ -548,7 +548,7 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile)
/* get max. line length and number of lines in input deck, /* get max. line length and number of lines in input deck,
and renumber the lines, and renumber the lines,
count the number of '{' per line as an upper estimate of the number count the number of '{' per line as an upper estimate of the number
of parameter substitutions in a line*/
of parameter substitutions in a line */
dynmaxline = 0; dynmaxline = 0;
max_line_length = 0; max_line_length = 0;
no_braces = 0; no_braces = 0;
@ -1320,6 +1320,15 @@ inp_chk_for_multi_in_vcvs(struct line *c, int *line_number)
} }
/* If ngspice is started with option -a, then variable 'autorun'
* will be set and the following function scans the deck.
* If 'run' is not found, a .control section will be added:
* .control
* run
* op ; if .op is found
* write rawfile ; if rawfile given
* .endc
*/
static void static void
inp_add_control_section(struct line *deck, int *line_number) inp_add_control_section(struct line *deck, int *line_number)
{ {
@ -1386,8 +1395,8 @@ inp_add_control_section(struct line *deck, int *line_number)
} }
// look for shell-style end-of-line continuation '\\'
/* overwrite shell-style end-of-line continuation '\\' with spaces,
* and return TRUE when found */
static bool static bool
chk_for_line_continuation(char *line) chk_for_line_continuation(char *line)
{ {
@ -5760,6 +5769,10 @@ inp_poly_err(struct line *card)
#endif #endif
/* Used for debugging. You may add
* tprint(working);
* somewhere in function inp_readall() of this file to have
* a printout of the actual deck written to file "tprint-out.txt" */
void void
tprint(struct line *t) tprint(struct line *t)
{ {
@ -6021,6 +6034,8 @@ inp_fix_temper_in_param(struct line *deck)
} }
/* append "()" to each 'identifier' in 'curr_line',
* unless already there */
static char * static char *
inp_functionalise_identifier(char *curr_line, char *identifier) inp_functionalise_identifier(char *curr_line, char *identifier)
{ {

2
src/frontend/subckt.c

@ -242,9 +242,9 @@ inp_subcktexpand(struct line *deck) {
if (ciprefix(".model", c->li_line)) if (ciprefix(".model", c->li_line))
nupa_scan(c->li_line, c->li_linenum, FALSE); nupa_scan(c->li_line, c->li_linenum, FALSE);
} }
/* now copy instances */
for (c = deck; c; c = c->li_next) /* first Numparam pass */ for (c = deck; c; c = c->li_next) /* first Numparam pass */
c->li_line = nupa_copy(c->li_line, c->li_linenum); c->li_line = nupa_copy(c->li_line, c->li_linenum);
/* now copy instances */
#ifdef TRACE #ifdef TRACE
fprintf(stderr, "Numparams transformed deck:\n"); fprintf(stderr, "Numparams transformed deck:\n");

4
src/misc/string.c

@ -40,6 +40,10 @@ copy(const char *str)
return(p); return(p);
} }
/* copy a substring, from 'str' to 'end'
* including *str, excluding *end
*/
char * char *
copy_substring(const char *str, const char *end) copy_substring(const char *str, const char *end)
{ {

Loading…
Cancel
Save