[Pkg-electronics-commits] [gnucap] 30/47: subckt-1: testing, id tags, and cleanup

felix salfelder felix-guest at moszumanska.debian.org
Mon Sep 26 10:37:16 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 ec24c47bb16386194e2fc3f7dea12b97233ad477
Author: al davis <ad211 at freeelectron.net>
Date:   Sat Sep 17 22:33:37 2016 -0400

    subckt-1: testing, id tags, and cleanup
---
 apps/Make1                          |  2 +-
 apps/c_delete.cc                    |  2 +-
 apps/d_subckt.cc                    | 12 ++++--------
 apps/lang_spectre.cc                |  6 +++---
 apps/lang_spice.cc                  |  8 ++++----
 apps/lang_verilog.cc                |  2 +-
 include/Make1                       |  2 +-
 include/e_node.h                    |  3 +--
 include/e_paramlist.h               |  2 +-
 include/e_subckt.h                  |  2 +-
 include/spice-wrapper.cc            |  2 +-
 include/u_lang.h                    |  2 +-
 lib/Make.depend                     | 16 ++++++++--------
 lib/Make1                           |  2 +-
 lib/d_logic.cc                      |  2 +-
 lib/e_card.cc                       | 14 +++++---------
 lib/e_cardlist.cc                   |  4 ++--
 lib/e_node.cc                       |  2 +-
 lib/e_paramlist.cc                  |  4 +---
 lib/u_lang.cc                       |  2 +-
 tests/==out/d_subckt.error3.ckt.out |  7 +++++++
 tests/d_subckt.error3.ckt           |  9 +++++++++
 22 files changed, 56 insertions(+), 51 deletions(-)

diff --git a/apps/Make1 b/apps/Make1
index 7f2a5e7..24adf00 100644
--- a/apps/Make1
+++ b/apps/Make1
@@ -1,4 +1,4 @@
-#$Id: Make1,v 26.138 2013/04/24 02:44:30 al Exp $ -*- Makefile -*-
+#$Id: Make1 2016/09/17 $ -*- Makefile -*-
 # Copyright (C) 2001 Albert Davis
 # Author: Albert Davis <aldavis at gnu.org>
 #
diff --git a/apps/c_delete.cc b/apps/c_delete.cc
index 07a9af0..9bd577a 100644
--- a/apps/c_delete.cc
+++ b/apps/c_delete.cc
@@ -1,4 +1,4 @@
-/*$Id: c_delete.cc,v 26.137 2010/04/10 02:37:05 al Exp $ -*- C++ -*-
+/*$Id: c_delete.cc 2016/09/17 $ -*- C++ -*-
  * Copyright (C) 2001 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
diff --git a/apps/d_subckt.cc b/apps/d_subckt.cc
index 218f545..7c2aeff 100644
--- a/apps/d_subckt.cc
+++ b/apps/d_subckt.cc
@@ -1,4 +1,4 @@
-/*$Id: d_subckt.cc  2016/09/11  $ -*- C++ -*-
+/*$Id: d_subckt.cc  2016/09/17  $ -*- C++ -*-
  * Copyright (C) 2001 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
@@ -37,8 +37,8 @@
 #include "e_paramlist.h"
 #include "e_subckt.h"
 /*--------------------------------------------------------------------------*/
-int COMMON_PARAMLIST::_count = -1;
 namespace{
+/*--------------------------------------------------------------------------*/
 static COMMON_PARAMLIST Default_SUBCKT(CC_STATIC);
 #define PORTS_PER_SUBCKT 100
 //BUG// fixed limit on number of ports
@@ -55,12 +55,10 @@ private: // override virtual
   char		id_letter()const	{untested();return 'X';}
   bool		print_type_in_spice()const {return true;}
   std::string   value_name()const	{return "#";}
-  // std::string   dev_type()const
   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_instance()const;
   void		precalc_first();
   bool		makes_own_scope()const  {return false;}
 
@@ -78,7 +76,7 @@ protected:
 private:
   node_t	_nodes[PORTS_PER_SUBCKT];
   static int	_count;
-};
+} p1;
 int DEV_SUBCKT::_count = -1;
 /*--------------------------------------------------------------------------*/
 class INTERFACE DEV_SUBCKT_PROTO : public DEV_SUBCKT {
@@ -129,9 +127,7 @@ 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);
+DISPATCHER<CARD>::INSTALL d1(&device_dispatcher, "X|subckt", &pp);
 /*--------------------------------------------------------------------------*/
 DEV_SUBCKT_PROTO::DEV_SUBCKT_PROTO(const DEV_SUBCKT_PROTO& p)
   :DEV_SUBCKT(p)
diff --git a/apps/lang_spectre.cc b/apps/lang_spectre.cc
index 57d6e3d..1c83803 100644
--- a/apps/lang_spectre.cc
+++ b/apps/lang_spectre.cc
@@ -1,4 +1,4 @@
-/*$Id: lang_spectre.cc 2015/01/27 al $ -*- C++ -*-
+/*$Id: lang_spectre.cc 2016/09/17  $ -*- C++ -*-
  * Copyright (C) 2007 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
@@ -48,7 +48,7 @@ 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*);
-  BASE_SUBCKT* parse_module(CS&, BASE_SUBCKT*);
+  BASE_SUBCKT*	parse_module(CS&, BASE_SUBCKT*);
   COMPONENT*	parse_instance(CS&, COMPONENT*);
   std::string	find_type_in_string(CS&);
 
@@ -417,8 +417,8 @@ class CMD_SUBCKT : public CMD {
     assert(!new_module->owner());
     assert(new_module->subckt());
     assert(new_module->subckt()->is_empty());
-    lang_spectre.parse_module(cmd, new_module);
     assert(!new_module->is_device());
+    lang_spectre.parse_module(cmd, new_module);
     Scope->push_back(new_module);
   }
 } p2;
diff --git a/apps/lang_spice.cc b/apps/lang_spice.cc
index 72191b8..9788f01 100644
--- a/apps/lang_spice.cc
+++ b/apps/lang_spice.cc
@@ -1,4 +1,4 @@
-/*$Id: lang_spice.cc  2016/03/23 al $ -*- C++ -*-
+/*$Id: lang_spice.cc  2016/09/17 al $ -*- C++ -*-
  * Copyright (C) 2006 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
@@ -47,7 +47,7 @@ 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*);
-  BASE_SUBCKT* parse_module(CS&, BASE_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
@@ -763,7 +763,7 @@ void LANG_SPICE_BASE::print_type(OMSTREAM& o, const COMPONENT* x)
   assert(x);
   if (x->print_type_in_spice()) {
     o << "  " << x->dev_type();
-  }else if (fix_case(x->short_label()[0]) != fix_case(x->id_letter())) {itested();
+  }else if (fix_case(x->short_label()[0]) != fix_case(x->id_letter())) {untested();
     o << "  " << x->dev_type();
   }else{
     // don't print type
@@ -868,8 +868,8 @@ class CMD_SUBCKT : public CMD {
     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());
+    lang_spice.parse_module(cmd, new_module);
     Scope->push_back(new_module);
   }
 } p2;
diff --git a/apps/lang_verilog.cc b/apps/lang_verilog.cc
index 8423fcf..eec1d71 100644
--- a/apps/lang_verilog.cc
+++ b/apps/lang_verilog.cc
@@ -1,4 +1,4 @@
-/*$Id: lang_verilog.cc 2014/07/04 al $ -*- C++ -*-
+/*$Id: lang_verilog.cc  2016/09/17 al $ -*- C++ -*-
  * Copyright (C) 2007 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
diff --git a/include/Make1 b/include/Make1
index bce833f..4bd99e8 100644
--- a/include/Make1
+++ b/include/Make1
@@ -1,4 +1,4 @@
-#$Id: Make1 2016/09/16$ -*- Makefile -*-
+#$Id: Make1 2016/09/17 $ -*- Makefile -*-
 # Copyright (C) 2001 Albert Davis
 # Author: Albert Davis <aldavis at gnu.org>
 #
diff --git a/include/e_node.h b/include/e_node.h
index 5efeda2..e1dd620 100644
--- a/include/e_node.h
+++ b/include/e_node.h
@@ -230,8 +230,7 @@ public: // matrix
 class INTERFACE node_t {
 private:
   static bool node_is_valid(int i) {
-    if (i == INVALID_NODE) {untested();
-      itested();
+    if (i == INVALID_NODE) {
     }else if (i < 0) {
       unreachable();
     }else if (i > NODE::_sim->_total_nodes) {
diff --git a/include/e_paramlist.h b/include/e_paramlist.h
index b74f1c6..eb0e5f3 100644
--- a/include/e_paramlist.h
+++ b/include/e_paramlist.h
@@ -1,4 +1,4 @@
-/*$Id: d_subckt.h  2016/09/11 $ -*- C++ -*-
+/*$Id: d_subckt.h  2016/09/17 $ -*- C++ -*-
  * Copyright (C) 2001 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
diff --git a/include/e_subckt.h b/include/e_subckt.h
index d5a1d5e..9541bdf 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			{unreachable(); return NULL;}
+  //CARD* clone()const			//CARD/null
   //void  precalc_first()	{assert(subckt()); subckt()->precalc();}
   //void  expand()			//COMPONENT
   //void  precalc_last()	{assert(subckt()); subckt()->precalc();}
diff --git a/include/spice-wrapper.cc b/include/spice-wrapper.cc
index ce95660..200c2cc 100644
--- a/include/spice-wrapper.cc
+++ b/include/spice-wrapper.cc
@@ -1,4 +1,4 @@
-/* $Id: spice-wrapper.cc 2016/03/29 al $ -*- C++ -*-
+/* $Id: spice-wrapper.cc 2016/09/17 $ -*- C++ -*-
  * Copyright (C) 2007 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
diff --git a/include/u_lang.h b/include/u_lang.h
index 383713f..aeae120 100644
--- a/include/u_lang.h
+++ b/include/u_lang.h
@@ -1,4 +1,4 @@
-/*$Id: u_lang.h 2015/01/21 al $ -*- C++ -*-
+/*$Id: u_lang.h 2016/09/17 $ -*- C++ -*-
  * Copyright (C) 2006 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
diff --git a/lib/Make.depend b/lib/Make.depend
index a35949a..7546f44 100644
--- a/lib/Make.depend
+++ b/lib/Make.depend
@@ -225,15 +225,15 @@ e_storag.o: e_storag.cc ../include/e_storag.h ../include/e_elemnt.h \
  ../include/l_denoise.h ../include/e_compon.h ../include/u_time_pair.h \
  ../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
  ../include/ap.h ../include/e_cardlist.h ../include/e_card.h
-e_paramlist.o: e_paramlist.cc ../include/e_node.h ../include/u_sim_data.h \
- ../include/constant.h ../include/md.h ../include/io_trace.h \
- ../include/io_error.h ../include/l_compar.h ../include/u_opt.h \
- ../include/mode.h ../include/io_.h ../include/l_lib.h \
- ../include/m_matrix.h ../include/l_stlextra.h ../include/e_base.h \
- ../include/globals.h ../include/l_dispatcher.h ../include/ap.h \
- ../include/e_paramlist.h ../include/e_compon.h ../include/u_time_pair.h \
+e_paramlist.o: e_paramlist.cc ../include/e_paramlist.h \
+ ../include/e_compon.h ../include/u_sim_data.h ../include/constant.h \
+ ../include/md.h ../include/io_trace.h ../include/io_error.h \
+ ../include/l_compar.h ../include/u_opt.h ../include/mode.h \
+ ../include/io_.h ../include/l_lib.h ../include/m_matrix.h \
+ ../include/l_stlextra.h ../include/u_time_pair.h \
  ../include/u_parameter.h ../include/m_expression.h ../include/m_base.h \
- ../include/e_cardlist.h ../include/e_card.h ../include/e_subckt.h
+ ../include/ap.h ../include/e_cardlist.h ../include/e_card.h \
+ ../include/e_base.h
 e_cardlist.o: e_cardlist.cc ../include/u_time_pair.h \
  ../include/constant.h ../include/md.h ../include/io_trace.h \
  ../include/io_error.h ../include/e_node.h ../include/u_sim_data.h \
diff --git a/lib/Make1 b/lib/Make1
index 5a9825f..e0f7347 100644
--- a/lib/Make1
+++ b/lib/Make1
@@ -1,4 +1,4 @@
-#$Id: Make1,v 26.138 2013/04/24 03:03:11 al Exp $ -*- Makefile -*-
+#$Id: Make1  2016/09/17 $ -*- Makefile -*-
 # Copyright (C) 2001 Albert Davis
 # Author: Albert Davis <aldavis at gnu.org>
 #
diff --git a/lib/d_logic.cc b/lib/d_logic.cc
index 1652936..a1295b0 100644
--- a/lib/d_logic.cc
+++ b/lib/d_logic.cc
@@ -1,4 +1,4 @@
-/*$Id: d_logic.cc,v 26.137 2010/04/10 02:37:33 al Exp $ -*- C++ -*-
+/*$Id: d_logic.cc  2016/09/17 $ -*- C++ -*-
  * Copyright (C) 2001 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
diff --git a/lib/e_card.cc b/lib/e_card.cc
index 05124ca..330c57a 100644
--- a/lib/e_card.cc
+++ b/lib/e_card.cc
@@ -1,4 +1,4 @@
-/*$Id: e_card.cc 2016/03/25 al $ -*- C++ -*-
+/*$Id: e_card.cc 2016/09/17 $ -*- C++ -*-
  * Copyright (C) 2001 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
@@ -192,21 +192,17 @@ TIME_PAIR CARD::tr_review()
 /*--------------------------------------------------------------------------*/
 void CARD::new_subckt()
 {
+  assert(!_subckt);
   delete _subckt;
+  _subckt = NULL;
   _subckt = new CARD_LIST;
 }
 /*--------------------------------------------------------------------------*/
 void CARD::new_subckt(const CARD* Model, PARAM_LIST* Params)
 {
   delete _subckt;
-  try{
-    _subckt = new CARD_LIST(Model, this, scope(), Params);
-  }catch(...){untested();
-    // BUG?
-    // new CARD_LIST must not throw if it has been successful previously.
-    assert(!_subckt);
-    throw;
-  }
+  _subckt = NULL;
+  _subckt = new CARD_LIST(Model, this, scope(), Params);
 }
 /*--------------------------------------------------------------------------*/
 void CARD::renew_subckt(const CARD* Model, PARAM_LIST* Params)
diff --git a/lib/e_cardlist.cc b/lib/e_cardlist.cc
index 6e6826c..5a3320f 100644
--- a/lib/e_cardlist.cc
+++ b/lib/e_cardlist.cc
@@ -1,4 +1,4 @@
-/*$Id: e_cardlist.cc,v 26.137 2010/04/10 02:37:33 al Exp $ -*- C++ -*-
+/*$Id: e_cardlist.cc  2016/09/17 $ -*- C++ -*-
  * Copyright (C) 2001 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
@@ -506,7 +506,7 @@ void CARD_LIST::map_subckt_nodes(const CARD* model, const CARD* owner)
 	// for each connection node in card
 	try{
 	  (**ci).n_(ii).map_subckt_node(map, owner);
-	}catch(...){ untested();
+	}catch(...){
 	  delete[] map;
 	  throw;
 	}
diff --git a/lib/e_node.cc b/lib/e_node.cc
index 417b558..97e0185 100644
--- a/lib/e_node.cc
+++ b/lib/e_node.cc
@@ -536,7 +536,7 @@ void node_t::map_subckt_node(int* m, const CARD* d)
   assert(e_() >= 0);
   if (node_is_valid(m[e_()])) {
     _ttt = m[e_()];
-  }else{untested();
+  }else{
     throw Exception(d->long_label() + ": need more nodes");
   }
   //_nnn->set_flat_number(_ttt);
diff --git a/lib/e_paramlist.cc b/lib/e_paramlist.cc
index 02f9012..4bc9226 100644
--- a/lib/e_paramlist.cc
+++ b/lib/e_paramlist.cc
@@ -21,10 +21,8 @@
  *------------------------------------------------------------------
  */
 //testing=script 2016.09.16
-#include "e_node.h"
-#include "globals.h"
 #include "e_paramlist.h"
-#include "e_subckt.h"
+/*--------------------------------------------------------------------------*/
 int COMMON_PARAMLIST::_count = -1;
 /*--------------------------------------------------------------------------*/
 bool COMMON_PARAMLIST::operator==(const COMMON_COMPONENT& x)const
diff --git a/lib/u_lang.cc b/lib/u_lang.cc
index 7ded7e1..d7d36e2 100644
--- a/lib/u_lang.cc
+++ b/lib/u_lang.cc
@@ -1,4 +1,4 @@
-/*$Id: u_lang.cc 2015/02/05 al $ -*- C++ -*-
+/*$Id: u_lang.cc 2016/09/17 $ -*- C++ -*-
  * Copyright (C) 2006 Albert Davis
  * Author: Albert Davis <aldavis at gnu.org>
  *
diff --git a/tests/==out/d_subckt.error3.ckt.out b/tests/==out/d_subckt.error3.ckt.out
new file mode 100644
index 0000000..e792223
--- /dev/null
+++ b/tests/==out/d_subckt.error3.ckt.out
@@ -0,0 +1,7 @@
+ 
+x1: need more nodes
+.subckt foo ( 1 2 3 4 )
+e1 ( 1 2 3 4 )  1.
+.ends foo
+v1 ( 1 0 )  DC  1.
+x1 ( 1 2 )  foo 
diff --git a/tests/d_subckt.error3.ckt b/tests/d_subckt.error3.ckt
new file mode 100644
index 0000000..35389a1
--- /dev/null
+++ b/tests/d_subckt.error3.ckt
@@ -0,0 +1,9 @@
+
+.subckt foo (1 2 3 4)
+e1 (1 2 3 4) 1
+.ends
+v1 (1 0) 1
+x1 (1 2) foo
+.op
+.list
+.end

-- 
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