[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scope and CARD_LIST:_card_list
From: |
Felix Salfelder |
Subject: |
Re: scope and CARD_LIST:_card_list |
Date: |
Wed, 27 Jan 2021 00:55:06 +0100 |
On Mon, Jan 25, 2021 at 03:08:15PM -0500, al davis wrote:
> > I also have issues with DEV_DOT. Symptoms are that commands like "get"
> > wont work properly if scope != CARD_LIST::_card_list. This is because
> > the owner is lost in command elaboration.[..]
>
> use scope?
Not sure what you mean. I was thinking of something like
{
CARD_LIST cl;
CMD::command("get file", &cl);
}
Both "get" and "include" commands call new__instance(cs, /*owner=*/ NULL,
Scope).
When new__instance encounters a command, the Scope argument is not not
used. The parse_command function only takes a DEV_DOT* x, and here, its
owner is NULL.
e.g. LANG_SPICE_BASE::parse_command does
CARD_LIST* scope = (x->owner()) ? x->owner()->subckt() : &CARD_LIST::card_list;
[..] ^ is NULL
CMD::cmdproc(cmd, scope);
I think the workaround is to use a CARD at the root instead, and avoid
CMD::command. Similar to
{
BASE_SUBCKT* root = device_dispatcher.clone("subckt");
CS cs(STRING, "get file");
new__instance(cs, root, root->subckt());
}
Not sure which consequences this will have. CARD::long_label might not
play well if there is an additional owner at the top. (and set_owner has
an assertion against resetting it NULL, perhaps for a reason).
thanks
felix