comments improved

This commit is contained in:
h_vogt 2016-04-09 12:25:37 +02:00 committed by rlar
parent 27053b877f
commit 33b11f9598
4 changed files with 27 additions and 5 deletions

View File

@ -327,15 +327,18 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
tfree(dir_name);
/* 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)
fclose(fp);
return;
}
if (!comfile) {
/* Extract the .option lines from the deck into 'options',
and remove them from the deck. */
options = inp_getopts(deck);
/* copy a deck before subckt substitution. */
realdeck = inp_deckcopy(deck);
/* Save the title before INPgetTitle gets it. */

View File

@ -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,
and renumber the lines,
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;
max_line_length = 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
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
chk_for_line_continuation(char *line)
{
@ -5760,6 +5769,10 @@ inp_poly_err(struct line *card)
#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
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 *
inp_functionalise_identifier(char *curr_line, char *identifier)
{

View File

@ -242,9 +242,9 @@ inp_subcktexpand(struct line *deck) {
if (ciprefix(".model", c->li_line))
nupa_scan(c->li_line, c->li_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);
/* now copy instances */
#ifdef TRACE
fprintf(stderr, "Numparams transformed deck:\n");

View File

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