inpcom.c, cleanup deck loops #4/4
This commit is contained in:
parent
3ee0374c0f
commit
cf734f60ac
|
|
@ -929,9 +929,9 @@ inp_fix_gnd_name(struct line *c)
|
||||||
for (; c; c = c->li_next) {
|
for (; c; c = c->li_next) {
|
||||||
gnd = c->li_line;
|
gnd = c->li_line;
|
||||||
// if there is a comment or no gnd, go to next line
|
// if there is a comment or no gnd, go to next line
|
||||||
if ((*gnd == '*') || (strstr(gnd, "gnd") == NULL)) {
|
if ((*gnd == '*') || (strstr(gnd, "gnd") == NULL))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
// replace "?gnd?" by "? 0 ?", ? being a ' ' ',' '(' ')'.
|
// replace "?gnd?" by "? 0 ?", ? being a ' ' ',' '(' ')'.
|
||||||
while ((gnd = strstr(gnd, "gnd")) != NULL) {
|
while ((gnd = strstr(gnd, "gnd")) != NULL) {
|
||||||
if ((isspace(gnd[-1]) || gnd[-1] == '(' || gnd[-1] == ',') &&
|
if ((isspace(gnd[-1]) || gnd[-1] == '(' || gnd[-1] == ',') &&
|
||||||
|
|
@ -1881,9 +1881,8 @@ inp_casefix(char *string)
|
||||||
static void
|
static void
|
||||||
inp_stripcomments_deck(struct line *c)
|
inp_stripcomments_deck(struct line *c)
|
||||||
{
|
{
|
||||||
for (; c; c = c->li_next) {
|
for (; c; c = c->li_next)
|
||||||
inp_stripcomments_line(c->li_line);
|
inp_stripcomments_line(c->li_line);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2234,18 +2233,16 @@ inp_fix_for_numparam(struct line *c)
|
||||||
char *str_ptr;
|
char *str_ptr;
|
||||||
|
|
||||||
for (; c; c = c->li_next) {
|
for (; c; c = c->li_next) {
|
||||||
if (ciprefix(".lib", c->li_line) || ciprefix("*lib", c->li_line) || ciprefix("*inc", c->li_line)) {
|
if (ciprefix(".lib", c->li_line) || ciprefix("*lib", c->li_line) || ciprefix("*inc", c->li_line))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
/* exclude lines between .control and .endc from getting quotes changed */
|
/* exclude lines between .control and .endc from getting quotes changed */
|
||||||
if (ciprefix(".control", c->li_line))
|
if (ciprefix(".control", c->li_line))
|
||||||
found_control = TRUE;
|
found_control = TRUE;
|
||||||
if (ciprefix(".endc", c->li_line))
|
if (ciprefix(".endc", c->li_line))
|
||||||
found_control = FALSE;
|
found_control = FALSE;
|
||||||
if (found_control) {
|
if (found_control)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
inp_change_quotes(c->li_line);
|
inp_change_quotes(c->li_line);
|
||||||
|
|
||||||
|
|
@ -2259,7 +2256,6 @@ inp_fix_for_numparam(struct line *c)
|
||||||
|
|
||||||
if (ciprefix(".subckt", c->li_line))
|
if (ciprefix(".subckt", c->li_line))
|
||||||
c->li_line = inp_fix_subckt(c->li_line);
|
c->li_line = inp_fix_subckt(c->li_line);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2269,18 +2265,17 @@ inp_remove_excess_ws(struct line *c)
|
||||||
{
|
{
|
||||||
bool found_control = FALSE;
|
bool found_control = FALSE;
|
||||||
for (; c; c = c->li_next) {
|
for (; c; c = c->li_next) {
|
||||||
if (*c->li_line == '*') {
|
if (*c->li_line == '*')
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
/* exclude echo lines between .control and .endc from removing white spaces */
|
/* exclude echo lines between .control and .endc from removing white spaces */
|
||||||
if (ciprefix(".control", c->li_line))
|
if (ciprefix(".control", c->li_line))
|
||||||
found_control = TRUE;
|
found_control = TRUE;
|
||||||
if (ciprefix(".endc", c->li_line))
|
if (ciprefix(".endc", c->li_line))
|
||||||
found_control = FALSE;
|
found_control = FALSE;
|
||||||
if ((found_control) && (ciprefix("echo", c->li_line))) {
|
if ((found_control) && (ciprefix("echo", c->li_line)))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
c->li_line = inp_remove_ws(c->li_line); /* freed in fcn */
|
c->li_line = inp_remove_ws(c->li_line); /* freed in fcn */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2297,7 +2292,6 @@ inp_remove_excess_ws(struct line *c)
|
||||||
static void
|
static void
|
||||||
expand_section_references(struct line *c, int call_depth, char *dir_name)
|
expand_section_references(struct line *c, int call_depth, char *dir_name)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (; c; c = c->li_next) {
|
for (; c; c = c->li_next) {
|
||||||
|
|
||||||
char *line = c->li_line;
|
char *line = c->li_line;
|
||||||
|
|
@ -3153,9 +3147,8 @@ inp_fix_param_values(struct line *deck)
|
||||||
for (; c; c = c->li_next) {
|
for (; c; c = c->li_next) {
|
||||||
line = c->li_line;
|
line = c->li_line;
|
||||||
|
|
||||||
if (*line == '*' || (ciprefix(".param", line) && strchr(line, '{'))) {
|
if (*line == '*' || (ciprefix(".param", line) && strchr(line, '{')))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if (ciprefix(".control", line)) {
|
if (ciprefix(".control", line)) {
|
||||||
control_section = TRUE;
|
control_section = TRUE;
|
||||||
|
|
@ -3167,19 +3160,16 @@ inp_fix_param_values(struct line *deck)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* no handling of params in "option" lines */
|
/* no handling of params in "option" lines */
|
||||||
if (control_section || ciprefix(".option", line)) {
|
if (control_section || ciprefix(".option", line))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
/* no handling of params in "set" lines */
|
/* no handling of params in "set" lines */
|
||||||
if (ciprefix("set", line)) {
|
if (ciprefix("set", line))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
/* no handling of params in B source lines */
|
/* no handling of params in B source lines */
|
||||||
if (*line == 'b') {
|
if (*line == 'b')
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
/* for xspice .cmodel: replace .cmodel with .model and skip entire line) */
|
/* for xspice .cmodel: replace .cmodel with .model and skip entire line) */
|
||||||
if (ciprefix(".cmodel", line)) {
|
if (ciprefix(".cmodel", line)) {
|
||||||
|
|
@ -3195,13 +3185,14 @@ inp_fix_param_values(struct line *deck)
|
||||||
/* exclude CIDER models */
|
/* exclude CIDER models */
|
||||||
if (ciprefix(".model", line) && (strstr(line, "numos") || strstr(line, "numd") ||
|
if (ciprefix(".model", line) && (strstr(line, "numos") || strstr(line, "numd") ||
|
||||||
strstr(line, "nbjt") || strstr(line, "nbjt2") ||
|
strstr(line, "nbjt") || strstr(line, "nbjt2") ||
|
||||||
strstr(line, "numd2"))) {
|
strstr(line, "numd2")))
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* exclude CIDER devices with ic.file parameter */
|
/* exclude CIDER devices with ic.file parameter */
|
||||||
if (strstr(line, "ic.file")) {
|
if (strstr(line, "ic.file"))
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
while ((equal_ptr = strchr(line, '=')) != NULL) {
|
while ((equal_ptr = strchr(line, '=')) != NULL) {
|
||||||
|
|
||||||
|
|
@ -3599,10 +3590,9 @@ inp_sort_params(struct line *start_card, struct line *end_card, struct line *car
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* determine the number of lines with .param */
|
/* determine the number of lines with .param */
|
||||||
for (ptr = start_card; ptr; ptr = ptr->li_next) {
|
for (ptr = start_card; ptr; ptr = ptr->li_next)
|
||||||
if (strchr(ptr->li_line, '='))
|
if (strchr(ptr->li_line, '='))
|
||||||
num_params++;
|
num_params++;
|
||||||
}
|
|
||||||
|
|
||||||
arr_size = num_params;
|
arr_size = num_params;
|
||||||
num_params = 0; /* This is just to keep the code in row 2907ff. */
|
num_params = 0; /* This is just to keep the code in row 2907ff. */
|
||||||
|
|
@ -3624,7 +3614,7 @@ inp_sort_params(struct line *start_card, struct line *end_card, struct line *car
|
||||||
ptr_array_ordered = TMALLOC(struct line *, arr_size);
|
ptr_array_ordered = TMALLOC(struct line *, arr_size);
|
||||||
|
|
||||||
ptr = start_card;
|
ptr = start_card;
|
||||||
for (ptr = start_card; ptr; ptr = ptr->li_next) {
|
for (ptr = start_card; ptr; ptr = ptr->li_next)
|
||||||
// ignore .param lines without '='
|
// ignore .param lines without '='
|
||||||
if (strchr(ptr->li_line, '=')) {
|
if (strchr(ptr->li_line, '=')) {
|
||||||
depends_on[num_params][0] = NULL;
|
depends_on[num_params][0] = NULL;
|
||||||
|
|
@ -3634,7 +3624,7 @@ inp_sort_params(struct line *start_card, struct line *end_card, struct line *car
|
||||||
|
|
||||||
ptr_array[num_params++] = ptr;
|
ptr_array[num_params++] = ptr;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// look for duplicately defined parameters and mark earlier one to skip
|
// look for duplicately defined parameters and mark earlier one to skip
|
||||||
// param list is ordered as defined in netlist
|
// param list is ordered as defined in netlist
|
||||||
for (i = 0; i < num_params; i++)
|
for (i = 0; i < num_params; i++)
|
||||||
|
|
@ -5675,7 +5665,6 @@ inp_add_series_resistor(struct line *deck)
|
||||||
static void
|
static void
|
||||||
inp_poly_err(struct line *card)
|
inp_poly_err(struct line *card)
|
||||||
{
|
{
|
||||||
|
|
||||||
size_t skip_control = 0;
|
size_t skip_control = 0;
|
||||||
for (; card; card = card->li_next) {
|
for (; card; card = card->li_next) {
|
||||||
char *curr_line = card->li_line;
|
char *curr_line = card->li_line;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue