|
|
@ -1788,26 +1788,7 @@ comment_out_unused_subckt_models(struct line *start_card, int no_of_lines) |
|
|
|
|
|
|
|
|
// find closing paren |
|
|
// find closing paren |
|
|
static char * |
|
|
static char * |
|
|
inp_search_closing_paren1(char *s) |
|
|
|
|
|
{ |
|
|
|
|
|
int count = 0; |
|
|
|
|
|
// assert(*s == '(') |
|
|
|
|
|
while (*s) { |
|
|
|
|
|
if (*s == '(') |
|
|
|
|
|
count++; |
|
|
|
|
|
if (*s == ')') |
|
|
|
|
|
count--; |
|
|
|
|
|
if (count == 0) |
|
|
|
|
|
return s + 1; |
|
|
|
|
|
s++; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return NULL; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static char * |
|
|
|
|
|
inp_search_for_closing_paren2(char *s) |
|
|
|
|
|
|
|
|
inp_search_closing_paren(char *s) |
|
|
{ |
|
|
{ |
|
|
int count = 0; |
|
|
int count = 0; |
|
|
// assert(*s == '(') |
|
|
// assert(*s == '(') |
|
|
@ -1910,7 +1891,7 @@ inp_fix_ternary_operator_str(char *line, bool all) |
|
|
// get if |
|
|
// get if |
|
|
str_ptr = skip_ws(question + 1); |
|
|
str_ptr = skip_ws(question + 1); |
|
|
if (*str_ptr == '(') { |
|
|
if (*str_ptr == '(') { |
|
|
colon = inp_search_closing_paren1(str_ptr); |
|
|
|
|
|
|
|
|
colon = inp_search_closing_paren(str_ptr); |
|
|
if (!colon) { |
|
|
if (!colon) { |
|
|
fprintf(stderr, "ERROR: problem parsing 'if' of ternary string %s!\n", line); |
|
|
fprintf(stderr, "ERROR: problem parsing 'if' of ternary string %s!\n", line); |
|
|
controlled_exit(EXIT_FAILURE); |
|
|
controlled_exit(EXIT_FAILURE); |
|
|
@ -1937,7 +1918,7 @@ inp_fix_ternary_operator_str(char *line, bool all) |
|
|
str_ptr = skip_ws(colon + 1); |
|
|
str_ptr = skip_ws(colon + 1); |
|
|
/* ... : (else) */ |
|
|
/* ... : (else) */ |
|
|
if (*str_ptr == '(') { |
|
|
if (*str_ptr == '(') { |
|
|
str_ptr2 = inp_search_for_closing_paren2(str_ptr); |
|
|
|
|
|
|
|
|
str_ptr2 = inp_search_closing_paren(str_ptr); |
|
|
if (!str_ptr2) { |
|
|
if (!str_ptr2) { |
|
|
fprintf(stderr, "ERROR: problem parsing ternary line %s!\n", line); |
|
|
fprintf(stderr, "ERROR: problem parsing ternary line %s!\n", line); |
|
|
controlled_exit(EXIT_FAILURE); |
|
|
controlled_exit(EXIT_FAILURE); |
|
|
|