Re: scope and CARD_LIST:_card_list

Felix Salfelder <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.