`E..table {expr} {pairs}', `G..', allow an optional `=' after `table'

This commit is contained in:
rlar 2015-10-05 21:23:09 +02:00
parent 7479e48f7a
commit b447f26703
1 changed files with 16 additions and 8 deletions

View File

@ -4251,14 +4251,18 @@ inp_compat(struct line *card)
// Exxx n1 n2 int1 0 1 // Exxx n1 n2 int1 0 1
ckt_array[0] = tprintf("%s %s %s %s_int1 0 1", ckt_array[0] = tprintf("%s %s %s %s_int1 0 1",
title_tok, node1, node2, title_tok); title_tok, node1, node2, title_tok);
// get the expression // skip "table"
str_ptr = gettok(&cut_line); /* ignore 'table' */ cut_line = skip_ws(cut_line);
if (!cieq(str_ptr, "table")) { if (!ciprefix("table", cut_line)) {
fprintf(stderr, "Error: bad syntax in line %d\n %s\n", fprintf(stderr, "Error: bad syntax in line %d\n %s\n",
card->li_linenum_orig, card->li_line); card->li_linenum_orig, card->li_line);
controlled_exit(EXIT_BAD); controlled_exit(EXIT_BAD);
} }
tfree(str_ptr); cut_line += 5;
// compatibility, allow table = {expr} {pairs}
if (*cut_line == '=')
*cut_line++ = ' ';
// get the expression
str_ptr = gettok_char(&cut_line, '{', FALSE, FALSE); str_ptr = gettok_char(&cut_line, '{', FALSE, FALSE);
expression = gettok_char(&cut_line, '}', TRUE, TRUE); /* expression */ expression = gettok_char(&cut_line, '}', TRUE, TRUE); /* expression */
if (!expression || !str_ptr) { if (!expression || !str_ptr) {
@ -4437,14 +4441,18 @@ inp_compat(struct line *card)
m_token = copy("1"); m_token = copy("1");
ckt_array[0] = tprintf("%s %s %s %s_int1 0 %s", ckt_array[0] = tprintf("%s %s %s %s_int1 0 %s",
title_tok, node1, node2, title_tok, m_token); title_tok, node1, node2, title_tok, m_token);
// get the expression // skip "table"
str_ptr = gettok(&cut_line); /* ignore 'table' */ cut_line = skip_ws(cut_line);
if (!cieq(str_ptr, "table")) { if (!ciprefix("table", cut_line)) {
fprintf(stderr, "Error: bad syntax in line %d\n %s\n", fprintf(stderr, "Error: bad syntax in line %d\n %s\n",
card->li_linenum_orig, card->li_line); card->li_linenum_orig, card->li_line);
controlled_exit(EXIT_BAD); controlled_exit(EXIT_BAD);
} }
tfree(str_ptr); cut_line += 5;
// compatibility, allow table = {expr} {pairs}
if (*cut_line == '=')
*cut_line++ = ' ';
// get the expression
str_ptr = gettok_char(&cut_line, '{', FALSE, FALSE); str_ptr = gettok_char(&cut_line, '{', FALSE, FALSE);
expression = gettok_char(&cut_line, '}', TRUE, TRUE); /* expression */ expression = gettok_char(&cut_line, '}', TRUE, TRUE); /* expression */
if (!expression || !str_ptr) { if (!expression || !str_ptr) {