subckt.c, copy a deck without .control section
This commit is contained in:
parent
eaebab6882
commit
f03d033e09
|
|
@ -715,15 +715,32 @@ inp_deckcopy(struct line *deck) {
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy a deck, without the actual lines, without comment lines.
|
* Copy a deck, without the li_actual lines, without comment lines, and
|
||||||
* First line is always copied.
|
* without .control section(s).
|
||||||
|
* First line is always copied (except being .control).
|
||||||
*/
|
*/
|
||||||
struct line *
|
struct line *
|
||||||
inp_deckcopy_oc(struct line *deck)
|
inp_deckcopy_oc(struct line *deck)
|
||||||
{
|
{
|
||||||
struct line *d = NULL, *nd = NULL;
|
struct line *d = NULL, *nd = NULL;
|
||||||
|
int skip_control = 0;
|
||||||
|
|
||||||
while (deck) {
|
while (deck) {
|
||||||
|
/* exclude any command inside .control ... .endc */
|
||||||
|
if (ciprefix(".control", deck->li_line)) {
|
||||||
|
skip_control++;
|
||||||
|
deck = deck->li_next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (ciprefix(".endc", deck->li_line)) {
|
||||||
|
skip_control--;
|
||||||
|
deck = deck->li_next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (skip_control > 0) {
|
||||||
|
deck = deck->li_next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (nd) {
|
if (nd) {
|
||||||
d->li_next = TMALLOC(struct line, 1);
|
d->li_next = TMALLOC(struct line, 1);
|
||||||
d = d->li_next;
|
d = d->li_next;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue