inp_readall() change function signature for readability
This commit is contained in:
parent
aeb850021b
commit
aa573f79e8
|
|
@ -1464,7 +1464,7 @@ com_alter_mod(wordlist *wl)
|
||||||
modfile = inp_pathopen(filename, readmode);
|
modfile = inp_pathopen(filename, readmode);
|
||||||
{
|
{
|
||||||
char *dir_name = ngdirname(filename);
|
char *dir_name = ngdirname(filename);
|
||||||
inp_readall(modfile, &modeldeck, 0, dir_name, 0);
|
modeldeck = inp_readall(modfile, 0, dir_name, 0);
|
||||||
free(dir_name);
|
free(dir_name);
|
||||||
}
|
}
|
||||||
tfree(input);
|
tfree(input);
|
||||||
|
|
|
||||||
|
|
@ -302,7 +302,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
|
||||||
char *dir_name = ngdirname(filename ? filename : ".");
|
char *dir_name = ngdirname(filename ? filename : ".");
|
||||||
|
|
||||||
startTime = seconds();
|
startTime = seconds();
|
||||||
inp_readall(fp, &deck, 0, dir_name, comfile);
|
deck = inp_readall(fp, 0, dir_name, comfile);
|
||||||
endTime = seconds();
|
endTime = seconds();
|
||||||
tfree(dir_name);
|
tfree(dir_name);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,10 +169,10 @@ read_a_lib(char *y, int call_depth, char *dir_name)
|
||||||
|
|
||||||
if (dir_name_flag == FALSE) {
|
if (dir_name_flag == FALSE) {
|
||||||
char *y_dir_name = ngdirname(y);
|
char *y_dir_name = ngdirname(y);
|
||||||
inp_readall(newfp, &libraries[num_libraries-1], call_depth+1, y_dir_name, FALSE);
|
libraries[num_libraries-1] = inp_readall(newfp, call_depth+1, y_dir_name, FALSE);
|
||||||
tfree(y_dir_name);
|
tfree(y_dir_name);
|
||||||
} else {
|
} else {
|
||||||
inp_readall(newfp, &libraries[num_libraries-1], call_depth+1, dir_name, FALSE);
|
libraries[num_libraries-1] = inp_readall(newfp, call_depth+1, dir_name, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(newfp);
|
fclose(newfp);
|
||||||
|
|
@ -317,10 +317,9 @@ expand_libs(int line_number)
|
||||||
...
|
...
|
||||||
debug printout to debug-out.txt
|
debug printout to debug-out.txt
|
||||||
*-------------------------------------------------------------------------*/
|
*-------------------------------------------------------------------------*/
|
||||||
void
|
struct line *
|
||||||
inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool comfile)
|
inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile)
|
||||||
/* fp: in, pointer to file to be read,
|
/* fp: in, pointer to file to be read,
|
||||||
data: out, linked list of cards
|
|
||||||
call_depth: in, nested call to fcn
|
call_depth: in, nested call to fcn
|
||||||
dir_name: in, name of directory of file to be read
|
dir_name: in, name of directory of file to be read
|
||||||
comfile: in, TRUE if command file (e.g. spinit, .spiceinit
|
comfile: in, TRUE if command file (e.g. spinit, .spiceinit
|
||||||
|
|
@ -541,10 +540,10 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
||||||
|
|
||||||
if (dir_name_flag == FALSE) {
|
if (dir_name_flag == FALSE) {
|
||||||
char *y_dir_name = ngdirname(y);
|
char *y_dir_name = ngdirname(y);
|
||||||
inp_readall(newfp, &newcard, call_depth+1, y_dir_name, FALSE); /* read stuff in include file into netlist */
|
newcard = inp_readall(newfp, call_depth+1, y_dir_name, FALSE); /* read stuff in include file into netlist */
|
||||||
tfree(y_dir_name);
|
tfree(y_dir_name);
|
||||||
} else {
|
} else {
|
||||||
inp_readall(newfp, &newcard, call_depth+1, dir_name, FALSE); /* read stuff in include file into netlist */
|
newcard = inp_readall(newfp, call_depth+1, dir_name, FALSE); /* read stuff in include file into netlist */
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) fclose(newfp);
|
(void) fclose(newfp);
|
||||||
|
|
@ -640,10 +639,8 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
||||||
tfree(buffer);
|
tfree(buffer);
|
||||||
} /* end while ((buffer = readline(fp)) != NULL) */
|
} /* end while ((buffer = readline(fp)) != NULL) */
|
||||||
|
|
||||||
if (!end) { /* No stuff here */
|
if (!end) /* No stuff here */
|
||||||
*data = NULL;
|
return NULL;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (call_depth == 0 && found_end == TRUE) {
|
if (call_depth == 0 && found_end == TRUE) {
|
||||||
struct line *prev;
|
struct line *prev;
|
||||||
|
|
@ -772,11 +769,8 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
||||||
|
|
||||||
/* The following processing of an input file is not required for command files
|
/* The following processing of an input file is not required for command files
|
||||||
like spinit or .spiceinit, so return command files here. */
|
like spinit or .spiceinit, so return command files here. */
|
||||||
if (comfile) {
|
if (comfile)
|
||||||
/* save the return value (via **data) */
|
return cc;
|
||||||
*data = cc;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
working = cc->li_next;
|
working = cc->li_next;
|
||||||
|
|
||||||
|
|
@ -825,9 +819,6 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
||||||
inp_add_series_resistor(working);
|
inp_add_series_resistor(working);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* save the return value (via **data) */
|
|
||||||
*data = cc;
|
|
||||||
|
|
||||||
/* 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
|
||||||
|
|
@ -862,6 +853,8 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c
|
||||||
fprintf(stdout, "max line length %d, max subst. per line %d, number of lines %d\n",
|
fprintf(stdout, "max line length %d, max subst. per line %d, number of lines %d\n",
|
||||||
(int) max_line_length, no_braces, dynmaxline);
|
(int) max_line_length, no_braces, dynmaxline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return cc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ inp_nutsource(FILE *fp, bool comfile, char *filename)
|
||||||
wordlist *controls = NULL;
|
wordlist *controls = NULL;
|
||||||
FILE *lastin, *lastout, *lasterr;
|
FILE *lastin, *lastout, *lasterr;
|
||||||
|
|
||||||
inp_readall(fp, &deck, 0, NULL, comfile); /* still to check if . or filename instead of NULL */
|
deck = inp_readall(fp, 0, NULL, comfile); /* still to check if . or filename instead of NULL */
|
||||||
if (!deck)
|
if (!deck)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ extern void inp_source(char *file);
|
||||||
void inp_spsource(FILE *fp, bool comfile, char *filename);
|
void inp_spsource(FILE *fp, bool comfile, char *filename);
|
||||||
extern void inp_casefix(char *string);
|
extern void inp_casefix(char *string);
|
||||||
extern void inp_list(FILE *file, struct line *deck, struct line *extras, int type);
|
extern void inp_list(FILE *file, struct line *deck, struct line *extras, int type);
|
||||||
extern void inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool comfile);
|
extern struct line *inp_readall(FILE *fp, int call_depth, char *dir_name, bool comfile);
|
||||||
extern FILE *inp_pathopen(char *name, char *mode);
|
extern FILE *inp_pathopen(char *name, char *mode);
|
||||||
|
|
||||||
/* nutinp.c */
|
/* nutinp.c */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue