[Pkg-electronics-commits] [gnucap] 14/49: lang* -- comment print syntax
felix salfelder
felix-guest at moszumanska.debian.org
Tue Feb 2 21:39:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
felix-guest pushed a commit to branch wip
in repository gnucap.
commit fc1db8833a3f543a7a7c96c3e7fdb3f07e5e5e75
Author: al davis <al at floyd.freeelectron.net>
Date: Fri Jul 4 17:39:08 2014 -0400
lang* -- comment print syntax
---
apps/lang_spectre.cc | 11 ++++++++---
apps/lang_spice.cc | 8 ++++++--
apps/lang_verilog.cc | 11 ++++++++---
include/e_base.h | 4 +---
lib/e_base.cc | 4 ++--
lib/e_card.cc | 6 +++---
6 files changed, 28 insertions(+), 16 deletions(-)
diff --git a/apps/lang_spectre.cc b/apps/lang_spectre.cc
index 1a0da81..8396a22 100644
--- a/apps/lang_spectre.cc
+++ b/apps/lang_spectre.cc
@@ -1,4 +1,4 @@
-/*$Id: lang_spectre.cc,v 26.137 2010/04/10 02:37:05 al Exp $ -*- C++ -*-
+/*$Id: lang_spectre.cc 2014/07/04 al $ -*- C++ -*-
* Copyright (C) 2007 Albert Davis
* Author: Albert Davis <aldavis at gnu.org>
*
@@ -210,6 +210,7 @@ MODEL_SUBCKT* LANG_SPECTRE::parse_module(CS& cmd, MODEL_SUBCKT* x)
/*--------------------------------------------------------------------------*/
COMPONENT* LANG_SPECTRE::parse_instance(CS& cmd, COMPONENT* x)
{
+ assert(x);
cmd.reset();
parse_label(cmd, x);
parse_ports(cmd, x);
@@ -357,6 +358,10 @@ void LANG_SPECTRE::print_instance(OMSTREAM& o, const COMPONENT* x)
void LANG_SPECTRE::print_comment(OMSTREAM& o, const DEV_COMMENT* x)
{
assert(x);
+ if (x->comment()[0] != '*') {untested();
+ o << "*";
+ }else{untested();
+ }
o << x->comment() << '\n';
}
/*--------------------------------------------------------------------------*/
@@ -380,11 +385,11 @@ class CMD_MODEL : public CMD {
const CARD* p = lang_spectre.find_proto(base_name, NULL);
if (p) {
MODEL_CARD* new_card = dynamic_cast<MODEL_CARD*>(p->clone());
- if (exists(new_card)) {
+ if (new_card) {
assert(!new_card->owner());
lang_spectre.parse_paramset(cmd, new_card);
Scope->push_back(new_card);
- }else{ //BUG// memory leak
+ }else{
cmd.warn(bDANGER, here, "model: base has incorrect type");
}
}else{
diff --git a/apps/lang_spice.cc b/apps/lang_spice.cc
index 7ee6611..241f6be 100644
--- a/apps/lang_spice.cc
+++ b/apps/lang_spice.cc
@@ -1,4 +1,4 @@
-/*$Id: lang_spice.cc,v 26.138 2013/04/24 02:44:30 al Exp $ -*- C++ -*-
+/*$Id: lang_spice.cc 2014/07/04 al $ -*- C++ -*-
* Copyright (C) 2006 Albert Davis
* Author: Albert Davis <aldavis at gnu.org>
*
@@ -720,6 +720,10 @@ void LANG_SPICE_BASE::print_comment(OMSTREAM& o, const DEV_COMMENT* x)
{
assert(x);
if (x->comment()[1] != '+') {
+ if (x->comment()[0] != '*') {
+ o << "*";
+ }else{
+ }
o << x->comment() << '\n';
}else{
}
@@ -837,7 +841,7 @@ class CMD_MODEL : public CMD {
if (p) {
MODEL_CARD* new_card = dynamic_cast<MODEL_CARD*>(p->clone());
- if (exists(new_card)) {
+ if (new_card) {
assert(!new_card->owner());
lang_spice.parse_paramset(cmd, new_card);
Scope->push_back(new_card);
diff --git a/apps/lang_verilog.cc b/apps/lang_verilog.cc
index 62d6060..a9d8da7 100644
--- a/apps/lang_verilog.cc
+++ b/apps/lang_verilog.cc
@@ -1,4 +1,4 @@
-/*$Id: lang_verilog.cc,v 26.138 2013/04/24 02:44:30 al Exp $ -*- C++ -*-
+/*$Id: lang_verilog.cc 2014/07/04 al $ -*- C++ -*-
* Copyright (C) 2007 Albert Davis
* Author: Albert Davis <aldavis at gnu.org>
*
@@ -271,6 +271,7 @@ MODEL_SUBCKT* LANG_VERILOG::parse_module(CS& cmd, MODEL_SUBCKT* x)
/*--------------------------------------------------------------------------*/
COMPONENT* LANG_VERILOG::parse_instance(CS& cmd, COMPONENT* x)
{
+ assert(x);
cmd.reset();
parse_type(cmd, x);
parse_args_instance(cmd, x);
@@ -428,6 +429,10 @@ void LANG_VERILOG::print_instance(OMSTREAM& o, const COMPONENT* x)
void LANG_VERILOG::print_comment(OMSTREAM& o, const DEV_COMMENT* x)
{
assert(x);
+ if ((x->comment().compare(0, 2, "//")) != 0) {untested();
+ o << "//";
+ }else{untested();
+ }
o << x->comment() << '\n';
}
/*--------------------------------------------------------------------------*/
@@ -452,11 +457,11 @@ class CMD_PARAMSET : public CMD {
const CARD* p = lang_verilog.find_proto(base_name, NULL);
if (p) {
MODEL_CARD* new_card = dynamic_cast<MODEL_CARD*>(p->clone());
- if (exists(new_card)) {
+ if (new_card) {
assert(!new_card->owner());
lang_verilog.parse_paramset(cmd, new_card);
Scope->push_back(new_card);
- }else{ //BUG// memory leak
+ }else{
cmd.warn(bDANGER, here, "paramset: base has incorrect type");
}
}else{
diff --git a/include/e_base.h b/include/e_base.h
index d7691ca..95f1e83 100644
--- a/include/e_base.h
+++ b/include/e_base.h
@@ -1,4 +1,4 @@
-/*$Id: e_base.h,v 26.138 2013/04/24 02:32:27 al Exp $ -*- C++ -*-
+/*$Id: e_base.h 2014/07/04 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis <aldavis at gnu.org>
*
@@ -69,7 +69,5 @@ public: // label
void set_label(const std::string& s) {_label = s;}
};
/*--------------------------------------------------------------------------*/
-inline bool exists(const CKT_BASE* c) {return c!=0;}
-/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
#endif
diff --git a/lib/e_base.cc b/lib/e_base.cc
index a63b48b..8f03fc2 100644
--- a/lib/e_base.cc
+++ b/lib/e_base.cc
@@ -1,4 +1,4 @@
-/*$Id: e_base.cc,v 26.137 2010/04/10 02:37:33 al Exp $ -*- C++ -*-
+/*$Id: e_base.cc 2014/07/04 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis <aldavis at gnu.org>
*
@@ -115,7 +115,7 @@ double CKT_BASE::ac_probe_num(const std::string& what)const
/*--------------------------------------------------------------------------*/
/*static*/ double CKT_BASE::probe(const CKT_BASE *This, const std::string& what)
{
- if (exists(This)) {
+ if (This) {
return This->probe_num(what);
}else{ /* return 0 if doesn't exist */
return 0.0; /* happens when optimized models */
diff --git a/lib/e_card.cc b/lib/e_card.cc
index 7f77ce6..a398009 100644
--- a/lib/e_card.cc
+++ b/lib/e_card.cc
@@ -1,4 +1,4 @@
-/*$Id: e_card.cc,v 26.134 2009/11/29 03:47:06 al Exp $ -*- C++ -*-
+/*$Id: e_card.cc 2014/07/04 al $ -*- C++ -*-
* Copyright (C) 2001 Albert Davis
* Author: Albert Davis <aldavis at gnu.org>
*
@@ -59,7 +59,7 @@ CARD::~CARD()
const std::string CARD::long_label()const
{
std::string buffer(short_label());
- for (const CARD* brh = owner(); exists(brh); brh = brh->owner()) {
+ for (const CARD* brh = owner(); brh; brh = brh->owner()) {
buffer = brh->short_label() + '.' + buffer;
}
return buffer;
@@ -243,7 +243,7 @@ void CARD::set_param_by_name(std::string Name, std::string Value)
*/
void CARD::set_dev_type(const std::string& New_Type)
{
- if (!Umatch(New_Type, dev_type() + ' ')) {itested();
+ if (!Umatch(New_Type, dev_type() + ' ')) {untested();
//throw Exception_Cant_Set_Type(dev_type(), New_Type);
}else{
// it matches -- ok.
--
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