[Pkg-electronics-commits] [gnucap] 22/47: replace MODEL_SUBCKT
felix salfelder
felix-guest at moszumanska.debian.org
Mon Sep 26 10:36:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
felix-guest pushed a commit to branch master
in repository gnucap.
commit 7dc74530e1601d7fde26b9ac6db109d5aabbf7d5
Author: Felix Salfelder <felix at salfelder.org>
Date: Thu Sep 10 12:02:25 2015 +0200
replace MODEL_SUBCKT
- use SUBCKT_BASE interface.
- implement DEV_SUBCKT_PROTO.
- access through dispatcher.
---
apps/c_delete.cc | 2 +-
apps/lang_spectre.cc | 12 ++---
apps/lang_spice.cc | 21 +++++----
apps/lang_verilog.cc | 15 ++++---
include/d_subckt.h | 51 +++++----------------
include/e_subckt.h | 2 +-
include/u_lang.h | 8 ++--
lib/d_logic.cc | 2 +-
lib/d_subckt.cc | 124 ++++++++++++++++++++++++++++++++++-----------------
lib/e_card.cc | 16 +++----
lib/e_cardlist.cc | 1 +
lib/u_lang.cc | 18 +++++---
12 files changed, 148 insertions(+), 124 deletions(-)
diff --git a/apps/c_delete.cc b/apps/c_delete.cc
index eead5cf..b22ad18 100644
--- a/apps/c_delete.cc
+++ b/apps/c_delete.cc
@@ -62,7 +62,7 @@ private:
if (i == Scope->end()) {
// can't find "container" (probably .subckt) - no match
return false;
- }else if (!dynamic_cast<MODEL_SUBCKT*>(*i)) {
+ }else if (!dynamic_cast<BASE_SUBCKT*>(*i)) {
// found a match, but it isn't a container (subckt)
return false;
}else{
diff --git a/apps/lang_spectre.cc b/apps/lang_spectre.cc
index 953361d..600f803 100644
--- a/apps/lang_spectre.cc
+++ b/apps/lang_spectre.cc
@@ -48,13 +48,13 @@ public: // override virtual, called by commands
DEV_COMMENT* parse_comment(CS&, DEV_COMMENT*);
DEV_DOT* parse_command(CS&, DEV_DOT*);
MODEL_CARD* parse_paramset(CS&, MODEL_CARD*);
- MODEL_SUBCKT* parse_module(CS&, MODEL_SUBCKT*);
+ BASE_SUBCKT* parse_module(CS&, BASE_SUBCKT*);
COMPONENT* parse_instance(CS&, COMPONENT*);
std::string find_type_in_string(CS&);
private: // override virtual, called by print_item
void print_paramset(OMSTREAM&, const MODEL_CARD*);
- void print_module(OMSTREAM&, const MODEL_SUBCKT*);
+ void print_module(OMSTREAM&, const BASE_SUBCKT*);
void print_instance(OMSTREAM&, const COMPONENT*);
void print_comment(OMSTREAM&, const DEV_COMMENT*);
void print_command(OMSTREAM& o, const DEV_DOT* c);
@@ -193,7 +193,7 @@ MODEL_CARD* LANG_SPECTRE::parse_paramset(CS& cmd, MODEL_CARD* x)
return x;
}
/*--------------------------------------------------------------------------*/
-MODEL_SUBCKT* LANG_SPECTRE::parse_module(CS& cmd, MODEL_SUBCKT* x)
+BASE_SUBCKT* LANG_SPECTRE::parse_module(CS& cmd, BASE_SUBCKT* x)
{
assert(x);
@@ -337,7 +337,7 @@ void LANG_SPECTRE::print_paramset(OMSTREAM& o, const MODEL_CARD* x)
o << "\n\n";
}
/*--------------------------------------------------------------------------*/
-void LANG_SPECTRE::print_module(OMSTREAM& o, const MODEL_SUBCKT* x)
+void LANG_SPECTRE::print_module(OMSTREAM& o, const BASE_SUBCKT* x)
{
assert(x);
assert(x->subckt());
@@ -410,7 +410,9 @@ DISPATCHER<CMD>::INSTALL d1(&command_dispatcher, "model", &p1);
class CMD_SUBCKT : public CMD {
void do_it(CS& cmd, CARD_LIST* Scope)
{
- MODEL_SUBCKT* new_module = new MODEL_SUBCKT;
+ const CARD* s = device_dispatcher["subckt"];
+ assert(s); // for now
+ BASE_SUBCKT* new_module = dynamic_cast<BASE_SUBCKT*>(s->clone());
assert(new_module);
assert(!new_module->owner());
assert(new_module->subckt());
diff --git a/apps/lang_spice.cc b/apps/lang_spice.cc
index 1c39ff5..6131cf4 100644
--- a/apps/lang_spice.cc
+++ b/apps/lang_spice.cc
@@ -47,11 +47,11 @@ public: // override virtual, called by commands
DEV_COMMENT* parse_comment(CS&, DEV_COMMENT*);
DEV_DOT* parse_command(CS&, DEV_DOT*);
MODEL_CARD* parse_paramset(CS&, MODEL_CARD*);
- MODEL_SUBCKT* parse_module(CS&, MODEL_SUBCKT*);
+ BASE_SUBCKT* parse_module(CS&, BASE_SUBCKT*);
COMPONENT* parse_instance(CS&, COMPONENT*);
std::string find_type_in_string(CS&);
public: // "local?", called by own commands
- void parse_module_body(CS&, MODEL_SUBCKT*, CARD_LIST*, const std::string&,
+ void parse_module_body(CS&, BASE_SUBCKT*, CARD_LIST*, const std::string&,
EOB, const std::string&);
private: // local
void parse_type(CS&, CARD*);
@@ -64,7 +64,7 @@ private: // compatibility hacks
private: // override virtual, called by print_item
void print_paramset(OMSTREAM&, const MODEL_CARD*);
- void print_module(OMSTREAM&, const MODEL_SUBCKT*);
+ void print_module(OMSTREAM&, const BASE_SUBCKT*);
void print_instance(OMSTREAM&, const COMPONENT*);
void print_comment(OMSTREAM&, const DEV_COMMENT*);
void print_command(OMSTREAM&, const DEV_DOT*);
@@ -543,7 +543,7 @@ MODEL_CARD* LANG_SPICE_BASE::parse_paramset(CS& cmd, MODEL_CARD* x)
return x;
}
/*--------------------------------------------------------------------------*/
-MODEL_SUBCKT* LANG_SPICE_BASE::parse_module(CS& cmd, MODEL_SUBCKT* x)
+BASE_SUBCKT* LANG_SPICE_BASE::parse_module(CS& cmd, BASE_SUBCKT* x)
{
assert(x);
@@ -565,7 +565,7 @@ MODEL_SUBCKT* LANG_SPICE_BASE::parse_module(CS& cmd, MODEL_SUBCKT* x)
return x;
}
/*--------------------------------------------------------------------------*/
-void LANG_SPICE_BASE::parse_module_body(CS& cmd, MODEL_SUBCKT* x, CARD_LIST* Scope,
+void LANG_SPICE_BASE::parse_module_body(CS& cmd, BASE_SUBCKT* x, CARD_LIST* Scope,
const std::string& prompt, EOB exit_on_blank, const std::string& exit_key)
{
try {
@@ -587,7 +587,7 @@ void LANG_SPICE_BASE::parse_module_body(CS& cmd, MODEL_SUBCKT* x, CARD_LIST* Sco
/*--------------------------------------------------------------------------*/
COMPONENT* LANG_SPICE_BASE::parse_instance(CS& cmd, COMPONENT* x)
{
- try {
+ try { untested();
assert(x);
cmd.reset().umatch(ANTI_COMMENT);
@@ -694,7 +694,7 @@ void LANG_SPICE_BASE::print_paramset(OMSTREAM& o, const MODEL_CARD* x)
o << ")\n";
}
/*--------------------------------------------------------------------------*/
-void LANG_SPICE_BASE::print_module(OMSTREAM& o, const MODEL_SUBCKT* x)
+void LANG_SPICE_BASE::print_module(OMSTREAM& o, const BASE_SUBCKT* x)
{
assert(x);
assert(x->subckt());
@@ -860,13 +860,16 @@ DISPATCHER<CMD>::INSTALL d1(&command_dispatcher, ".model", &p1);
/*--------------------------------------------------------------------------*/
class CMD_SUBCKT : public CMD {
void do_it(CS& cmd, CARD_LIST* Scope)
- {
- MODEL_SUBCKT* new_module = new MODEL_SUBCKT;
+ { untested();
+ const CARD* s = device_dispatcher["subckt"];
+ assert(s); // for now
+ BASE_SUBCKT* new_module = dynamic_cast<BASE_SUBCKT*>(s->clone());
assert(new_module);
assert(!new_module->owner());
assert(new_module->subckt());
assert(new_module->subckt()->is_empty());
lang_spice.parse_module(cmd, new_module);
+ assert(!new_module->is_device());
Scope->push_back(new_module);
}
} p2;
diff --git a/apps/lang_verilog.cc b/apps/lang_verilog.cc
index 8f75483..7cf78b8 100644
--- a/apps/lang_verilog.cc
+++ b/apps/lang_verilog.cc
@@ -72,13 +72,13 @@ public: // override virtual, called by commands
DEV_COMMENT* parse_comment(CS&, DEV_COMMENT*);
DEV_DOT* parse_command(CS&, DEV_DOT*);
MODEL_CARD* parse_paramset(CS&, MODEL_CARD*);
- MODEL_SUBCKT* parse_module(CS&, MODEL_SUBCKT*);
+ BASE_SUBCKT* parse_module(CS&, BASE_SUBCKT*);
COMPONENT* parse_instance(CS&, COMPONENT*);
std::string find_type_in_string(CS&);
private: // override virtual, called by print_item
void print_paramset(OMSTREAM&, const MODEL_CARD*);
- void print_module(OMSTREAM&, const MODEL_SUBCKT*);
+ void print_module(OMSTREAM&, const BASE_SUBCKT*);
void print_instance(OMSTREAM&, const COMPONENT*);
void print_comment(OMSTREAM&, const DEV_COMMENT*);
void print_command(OMSTREAM& o, const DEV_DOT* c);
@@ -261,8 +261,8 @@ MODEL_CARD* LANG_VERILOG::parse_paramset(CS& cmd, MODEL_CARD* x)
*/
//BUG// strictly one device per line
-MODEL_SUBCKT* LANG_VERILOG::parse_module(CS& cmd, MODEL_SUBCKT* x)
-{
+BASE_SUBCKT* LANG_VERILOG::parse_module(CS& cmd, BASE_SUBCKT* x)
+{ untested();
assert(x);
// header
@@ -416,7 +416,7 @@ void LANG_VERILOG::print_paramset(OMSTREAM& o, const MODEL_CARD* x)
_mode = mDEFAULT;
}
/*--------------------------------------------------------------------------*/
-void LANG_VERILOG::print_module(OMSTREAM& o, const MODEL_SUBCKT* x)
+void LANG_VERILOG::print_module(OMSTREAM& o, const BASE_SUBCKT* x)
{
assert(x);
assert(x->subckt());
@@ -489,14 +489,15 @@ DISPATCHER<CMD>::INSTALL d1(&command_dispatcher, "paramset", &p1);
/*--------------------------------------------------------------------------*/
class CMD_MODULE : public CMD {
void do_it(CS& cmd, CARD_LIST* Scope)
- {
+ { untested();
CARD const* sckt = device_dispatcher["subckt"];
assert(sckt);
- MODEL_SUBCKT* new_module = dynamic_cast<MODEL_SUBCKT*>(sckt->clone());
+ BASE_SUBCKT* new_module = dynamic_cast<BASE_SUBCKT*>(sckt->clone());
assert(new_module);
assert(!new_module->owner());
assert(new_module->subckt());
assert(new_module->subckt()->is_empty());
+ assert(!new_module->is_device());
lang_verilog.parse_module(cmd, new_module);
Scope->push_back(new_module);
}
diff --git a/include/d_subckt.h b/include/d_subckt.h
index 682944f..2b05c54 100644
--- a/include/d_subckt.h
+++ b/include/d_subckt.h
@@ -30,60 +30,30 @@
#define PORTS_PER_SUBCKT 100
//BUG// fixed limit on number of ports
/*--------------------------------------------------------------------------*/
-class INTERFACE MODEL_SUBCKT : public COMPONENT {
-protected:
- explicit MODEL_SUBCKT(const MODEL_SUBCKT&p);
-public:
- explicit MODEL_SUBCKT();
- ~MODEL_SUBCKT();
-public: // override virtual
- char id_letter()const {untested();return '\0';}
- CARD* clone_instance()const;
- bool print_type_in_spice()const {unreachable(); return false;}
- std::string value_name()const {incomplete(); return "";}
- std::string dev_type()const {untested(); return "";}
- int max_nodes()const {return PORTS_PER_SUBCKT;}
- int min_nodes()const {return 0;}
- int matrix_nodes()const {untested();return 0;}
- int net_nodes()const {return _net_nodes;}
- CARD* clone()const {return new MODEL_SUBCKT(*this);}
- bool is_device()const {return false;}
- void precalc_first() {}
- void expand() {}
- void precalc_last() {}
- bool makes_own_scope()const {return true;}
- void map_nodes() {}
- CARD_LIST* scope() {return subckt();}
- const CARD_LIST* scope()const {return subckt();}
-
- std::string port_name(int)const {
- return "";
- }
-public:
- static int count() {return _count;}
-
-private:
- node_t _nodes[PORTS_PER_SUBCKT];
- static int _count;
-};
/*--------------------------------------------------------------------------*/
class DEV_SUBCKT : public BASE_SUBCKT {
- friend class MODEL_SUBCKT;
-private:
+ friend class DEV_SUBCKT_PROTO;
+protected:
explicit DEV_SUBCKT(const DEV_SUBCKT&);
public:
explicit DEV_SUBCKT();
~DEV_SUBCKT() {--_count;}
+ CARD* clone()const {untested(); return new DEV_SUBCKT(*this);}
private: // override virtual
char id_letter()const {return 'X';}
bool print_type_in_spice()const {return true;}
std::string value_name()const {return "#";}
+// std::string dev_type()const {untested(); return BASE_SUBCKT::dev_type();}
int max_nodes()const {return PORTS_PER_SUBCKT;}
int min_nodes()const {return 0;}
int matrix_nodes()const {return 0;}
int net_nodes()const {return _net_nodes;}
- CARD* clone()const {return new DEV_SUBCKT(*this);}
+protected:
+// CARD* clone_instance()const;
+private:
void precalc_first();
+ bool makes_own_scope()const {itested(); return false;}
+
void expand();
void precalc_last();
double tr_probe_num(const std::string&)const;
@@ -98,9 +68,8 @@ private: // override virtual
}
public:
static int count() {return _count;}
-protected:
- const MODEL_SUBCKT* _parent;
private:
+ const BASE_SUBCKT* _parent;
node_t _nodes[PORTS_PER_SUBCKT];
static int _count;
};
diff --git a/include/e_subckt.h b/include/e_subckt.h
index 9541bdf..423266c 100644
--- a/include/e_subckt.h
+++ b/include/e_subckt.h
@@ -42,7 +42,7 @@ protected: // override virtual
//int min_nodes()const //COMPONENT/null
int matrix_nodes()const {return 0;}
int net_nodes()const {return _net_nodes;}
- //CARD* clone()const //CARD/null
+ CARD* clone()const {unreachable(); return NULL;}
//void precalc_first() {assert(subckt()); subckt()->precalc();}
//void expand() //COMPONENT
//void precalc_last() {assert(subckt()); subckt()->precalc();}
diff --git a/include/u_lang.h b/include/u_lang.h
index c09037c..383713f 100644
--- a/include/u_lang.h
+++ b/include/u_lang.h
@@ -25,7 +25,7 @@
#include "u_opt.h"
/*--------------------------------------------------------------------------*/
class COMPONENT;
-class MODEL_SUBCKT;
+class BASE_SUBCKT;
class MODEL_CARD;
class CARD;
class DEV_COMMENT;
@@ -36,7 +36,7 @@ class INTERFACE LANGUAGE : public CKT_BASE {
public:
const CARD* find_proto(const std::string&, const CARD*);
public:
- void new__instance(CS& cmd, MODEL_SUBCKT* owner, CARD_LIST* Scope);
+ void new__instance(CS& cmd, BASE_SUBCKT* owner, CARD_LIST* Scope);
public:
//BUG//need constructors
@@ -57,7 +57,7 @@ public: // called by commands and parse_item
virtual DEV_COMMENT* parse_comment(CS&, DEV_COMMENT*) = 0;
virtual DEV_DOT* parse_command(CS&, DEV_DOT*) = 0;
virtual MODEL_CARD* parse_paramset(CS&, MODEL_CARD*) = 0;
- virtual MODEL_SUBCKT* parse_module(CS&, MODEL_SUBCKT*) = 0;
+ virtual BASE_SUBCKT* parse_module(CS&, BASE_SUBCKT*) = 0;
virtual COMPONENT* parse_instance(CS&, COMPONENT*) = 0;
virtual std::string find_type_in_string(CS&) = 0;
@@ -66,7 +66,7 @@ public: // real public interface
virtual void print_item(OMSTREAM&, const CARD*);
private: // called by print_item
virtual void print_paramset(OMSTREAM&, const MODEL_CARD*) = 0;
- virtual void print_module(OMSTREAM&, const MODEL_SUBCKT*) = 0;
+ virtual void print_module(OMSTREAM&, const BASE_SUBCKT*) = 0;
virtual void print_instance(OMSTREAM&, const COMPONENT*) = 0;
virtual void print_comment(OMSTREAM&, const DEV_COMMENT*) = 0;
virtual void print_command(OMSTREAM&, const DEV_DOT*) = 0;
diff --git a/lib/d_logic.cc b/lib/d_logic.cc
index e5c75d6..df48fad 100644
--- a/lib/d_logic.cc
+++ b/lib/d_logic.cc
@@ -90,7 +90,7 @@ void DEV_LOGIC::expand()
try {
const CARD* model = find_looking_out(subckt_name);
- if(!dynamic_cast<const MODEL_SUBCKT*>(model)) {untested();
+ if(!dynamic_cast<const BASE_SUBCKT*>(model)) {untested();
error(((!_sim->is_first_expand()) ? (bDEBUG) : (bWARNING)),
long_label() + ": " + subckt_name + " is not a subckt, forcing digital\n");
}else{
diff --git a/lib/d_subckt.cc b/lib/d_subckt.cc
index 8bbc3f5..ce1a7bd 100644
--- a/lib/d_subckt.cc
+++ b/lib/d_subckt.cc
@@ -31,21 +31,13 @@
* the expansion (attact to the X) has all comments removed
* - need to process the entire ring - for doesn't work
*/
-//testing=script 2006.07.17
#include "globals.h"
#include "d_subckt.h"
/*--------------------------------------------------------------------------*/
int DEV_SUBCKT::_count = -1;
int COMMON_SUBCKT::_count = -1;
-int MODEL_SUBCKT::_count = -1;
static COMMON_SUBCKT Default_SUBCKT(CC_STATIC);
/*--------------------------------------------------------------------------*/
-static DEV_SUBCKT p1;
-static MODEL_SUBCKT p2;
-static DISPATCHER<CARD>::INSTALL
- d1(&device_dispatcher, "X|dev_subckt", &p1),
- d2(&device_dispatcher, "subckt|macro", &p2);
-/*--------------------------------------------------------------------------*/
bool COMMON_SUBCKT::operator==(const COMMON_COMPONENT& x)const
{
const COMMON_SUBCKT* p = dynamic_cast<const COMMON_SUBCKT*>(&x);
@@ -115,72 +107,120 @@ void COMMON_SUBCKT::precalc_last(const CARD_LIST* Scope)
}
}
/*--------------------------------------------------------------------------*/
-MODEL_SUBCKT::MODEL_SUBCKT()
- :COMPONENT()
-{
- _n = _nodes;
- new_subckt();
- ++_count;
-}
/*--------------------------------------------------------------------------*/
-MODEL_SUBCKT::MODEL_SUBCKT(const MODEL_SUBCKT& p)
- :COMPONENT(p)
-{
- for (int ii = 0; ii < max_nodes(); ++ii) {
- _nodes[ii] = p._nodes[ii];
- }
- _n = _nodes;
- assert(p.subckt()->is_empty()); // incomplete, but enough for now.
- new_subckt();
- ++_count;
-}
+class INTERFACE DEV_SUBCKT_PROTO : public DEV_SUBCKT {
+private:
+ explicit DEV_SUBCKT_PROTO(const DEV_SUBCKT_PROTO&p) : DEV_SUBCKT(p) {untested();}
+public:
+ explicit DEV_SUBCKT_PROTO() : DEV_SUBCKT() {untested();}
+ ~DEV_SUBCKT_PROTO(){}
+public: // override virtual
+ char id_letter()const {untested();return '\0';}
+ CARD* clone_instance()const;
+ bool print_type_in_spice()const {unreachable(); return false;}
+ std::string value_name()const {incomplete(); return "";}
+ std::string dev_type()const {untested(); return "";}
+ int max_nodes()const {return PORTS_PER_SUBCKT;}
+ int min_nodes()const {return 0;}
+ int matrix_nodes()const {untested();return 0;}
+ int net_nodes()const {return _net_nodes;}
+ CARD* clone()const {untested(); return new DEV_SUBCKT_PROTO(*this);}
+ bool is_device()const {return false;}
+ bool makes_own_scope()const {return true;}
+ CARD_LIST* scope() {return subckt();}
+ const CARD_LIST* scope()const {return subckt();}
+private: // no-ops for prototype
+ void precalc_first(){untested();}
+ void expand(){untested();}
+ void precalc_last(){untested();}
+ void map_nodes(){untested();}
+ void tr_begin(){untested();}
+ void tr_load(){untested();}
+ void tr_accept(){untested();}
+ void tr_advance(){untested();}
+ void tr_restore(){untested();}
+ void tr_regress(){untested();}
+ void dc_advance(){untested();}
+ void ac_begin(){untested();}
+ void do_ac(){untested();}
+ void ac_load(){untested();}
+ bool do_tr(){untested(); return true;}
+ bool tr_needs_eval()const{untested(); return false;}
+ void tr_queue_eval(){untested();}
+ std::string port_name(int)const {return "";}
+public:
+ static int count() {return _count;}
+
+private:
+ node_t _nodes[PORTS_PER_SUBCKT];
+ static int _count;
+} pp;
+static DEV_SUBCKT p1;
+static DISPATCHER<CARD>::INSTALL
+ d1(&device_dispatcher, "X|subckt", &pp);
/*--------------------------------------------------------------------------*/
-MODEL_SUBCKT::~MODEL_SUBCKT()
-{
- --_count;
+CARD* DEV_SUBCKT_PROTO::clone()const
+{ untested();
+ return new DEV_SUBCKT_PROTO(*this);
}
/*--------------------------------------------------------------------------*/
-CARD* MODEL_SUBCKT::clone_instance()const
-{
+CARD* DEV_SUBCKT_PROTO::clone_instance()const
+{untested();
DEV_SUBCKT* new_instance = dynamic_cast<DEV_SUBCKT*>(p1.clone());
- new_instance->_parent = this;
+
+ if (this == &pp){ untested();
+ // cloning from static, empty model
+ }else{ untested();
+ new_instance->_parent = this;
+ }
+
+ assert(new_instance->is_device());
return new_instance;
}
/*--------------------------------------------------------------------------*/
DEV_SUBCKT::DEV_SUBCKT()
:BASE_SUBCKT(),
_parent(NULL)
-{
+{ untested();
attach_common(&Default_SUBCKT);
_n = _nodes;
+ new_subckt();
++_count;
}
/*--------------------------------------------------------------------------*/
DEV_SUBCKT::DEV_SUBCKT(const DEV_SUBCKT& p)
:BASE_SUBCKT(p),
_parent(p._parent)
-{
+{ untested();
//strcpy(modelname, p.modelname); in common
for (int ii = 0; ii < max_nodes(); ++ii) {
_nodes[ii] = p._nodes[ii];
}
_n = _nodes;
+ assert(p.subckt()->is_empty());
+ if(subckt()){ untested();
+ }else{untested();
+ new_subckt();
+ }
++_count;
}
/*--------------------------------------------------------------------------*/
void DEV_SUBCKT::expand()
-{
+{ untested();
BASE_SUBCKT::expand();
COMMON_SUBCKT* c = prechecked_cast<COMMON_SUBCKT*>(mutable_common());
assert(c);
- if (!_parent) {
+ if (!_parent) { untested();
+ // get here when instanciating X, then set modelname
+ assert(c->modelname()!="");
const CARD* model = find_looking_out(c->modelname());
- if(!dynamic_cast<const MODEL_SUBCKT*>(model)) {
+ if(!dynamic_cast<const BASE_SUBCKT*>(model)) { untested();
throw Exception_Type_Mismatch(long_label(), c->modelname(), "subckt");
- }else{
- _parent = prechecked_cast<const MODEL_SUBCKT*>(model);
+ }else{ untested();
+ _parent = prechecked_cast<const BASE_SUBCKT*>(model);
}
- }else{
+ }else{ untested();
+ // possible after clone_instance.
assert(find_looking_out(c->modelname()) == _parent);
}
@@ -198,12 +238,12 @@ void DEV_SUBCKT::precalc_first()
{
BASE_SUBCKT::precalc_first();
- if (subckt()) {
+ if (subckt()) { untested();
COMMON_SUBCKT* c = prechecked_cast<COMMON_SUBCKT*>(mutable_common());
assert(c);
subckt()->attach_params(&(c->_params), scope());
subckt()->precalc_first();
- }else{
+ }else{ untested();
}
assert(!is_constant()); /* because I have more work to do */
}
diff --git a/lib/e_card.cc b/lib/e_card.cc
index 0d13ab1..ad34784 100644
--- a/lib/e_card.cc
+++ b/lib/e_card.cc
@@ -165,21 +165,21 @@ const CARD* CARD::find_in_parent_scope(const std::string& name)const
* throws exception if can't find.
*/
const CARD* CARD::find_looking_out(const std::string& name)const
-{
- try {
+{ untested();
+ try { untested();
return find_in_parent_scope(name);
- }catch (Exception_Cant_Find&) {
- if (owner()) {
+ }catch (Exception_Cant_Find&) { untested();
+ if (owner()) { untested();
return owner()->find_looking_out(name);
- }else if (makes_own_scope()) {
+ }else if (makes_own_scope()) { untested();
// probably a subckt or "module"
CARD_LIST::const_iterator i = CARD_LIST::card_list.find_(name);
- if (i != CARD_LIST::card_list.end()) {
+ if (i != CARD_LIST::card_list.end()) { untested();
return *i;
- }else{
+ }else{ untested();
throw;
}
- }else{
+ }else{ untested();
throw;
}
}
diff --git a/lib/e_cardlist.cc b/lib/e_cardlist.cc
index d46544f..6c43572 100644
--- a/lib/e_cardlist.cc
+++ b/lib/e_cardlist.cc
@@ -87,6 +87,7 @@ PARAM_LIST* CARD_LIST::params()const
CARD_LIST::iterator CARD_LIST::find_again(const std::string& short_name,
CARD_LIST::iterator Begin)
{
+ trace0(("CARD_LIST::find_ name=" + short_name).c_str());
return notstd::find_ptr(Begin, end(), short_name);
}
/*--------------------------------------------------------------------------*/
diff --git a/lib/u_lang.cc b/lib/u_lang.cc
index 2076e28..586425d 100644
--- a/lib/u_lang.cc
+++ b/lib/u_lang.cc
@@ -99,7 +99,7 @@ const CARD* LANGUAGE::find_proto(const std::string& Name, const CARD* Scope)
}
}
/*--------------------------------------------------------------------------*/
-void LANGUAGE::new__instance(CS& cmd, MODEL_SUBCKT* owner, CARD_LIST* Scope)
+void LANGUAGE::new__instance(CS& cmd, BASE_SUBCKT* owner, CARD_LIST* Scope)
{
if (cmd.is_end()) {untested();
// nothing
@@ -127,8 +127,12 @@ CARD* LANGUAGE::parse_item(CS& cmd, CARD* c)
// If you can think of a better way, tell me.
// It must be in the LANGUAGE class, not CARD.
- if (dynamic_cast<MODEL_SUBCKT*>(c)) {untested();
- return parse_module(cmd, prechecked_cast<MODEL_SUBCKT*>(c));
+ if (BASE_SUBCKT* s=dynamic_cast<BASE_SUBCKT*>(c)) { untested();
+ if (c->is_device()){ untested();
+ return parse_instance(cmd, s);
+ }else{ untested();
+ return parse_module(cmd, s);
+ }
}else if (dynamic_cast<COMPONENT*>(c)) {
return parse_instance(cmd, prechecked_cast<COMPONENT*>(c));
}else if (dynamic_cast<MODEL_CARD*>(c)) {untested();
@@ -152,8 +156,12 @@ void LANGUAGE::print_item(OMSTREAM& o, const CARD* c)
assert(c);
assert(dynamic_cast<const CARD*>(c));
- if (dynamic_cast<const MODEL_SUBCKT*>(c)) {
- print_module(o, prechecked_cast<const MODEL_SUBCKT*>(c));
+ if (const BASE_SUBCKT* s=dynamic_cast<const BASE_SUBCKT*>(c)) { untested();
+ if (s->is_device()){ untested();
+ print_instance(o, s);
+ }else{ untested();
+ print_module(o, s);
+ }
}else if (dynamic_cast<const COMPONENT*>(c)) {
print_instance(o, prechecked_cast<const COMPONENT*>(c));
}else if (dynamic_cast<const MODEL_CARD*>(c)) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-electronics/gnucap.git
More information about the Pkg-electronics-commits
mailing list