Re: prototype name -- bug or feature?

Felix Salfelder <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
On Thu, Jan 17, 2013 at 09:52:15PM +0100, Felix Salfelder wrote:
> i don't know. but is this a verilog issue? potentially some or other
> language plugin might want to (dis)allow bogus declarations, so
> find_looking_out should make it optional. i think, optionally just
> returning cards if !is_device(), would at least solve my problem.

while i'm at it: i've now implemented
const CARD* find_card(string name, CARD_LIST* Scope, bool nondevice=0);
in LANGUAGE as follows.

const CARD* LANGUAGE::find_card(string name, CARD_LIST* Scope, bool nondevice) {
  if (!Scope) Scope = &CARD_LIST::card_list;
  CARD_LIST::const_iterator i = Scope->find_(name);
  if(nondevice){
    while (i!=Scope->end()) {
      if((*i)->is_device()){ untested();
        i = Scope->find_again(name, ++i); // skip
      } else {
        break;
      }
    }
  }
  if (i == Scope->end()) {
    throw Exception_Cant_Find(name, "scope");
  }
  return *i;
}

i've changed the find_ call in LANGUAGE::find_proto to
try {
	p = find_card( Name, &CARD_LIST::card_list, !OPT::bogus );
} catch(Exception_Cant_Find) {
	assert(!p);
}

if there's really a language that does conditional bogus instanciations,
nondevice needs to be changed to prefer_nondevice... i'll leave it like
this for now.

have fun
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.