From 79b2d2d520762fb1ef6d0a832ffb1a8750d57c51 Mon Sep 17 00:00:00 2001 From: Pascal Kuthe Date: Sat, 10 Dec 2022 00:27:18 +0100 Subject: [PATCH] removed unneded changes --- src/frontend/inpcom.c | 42 ++++-------- src/frontend/subckt.c | 8 --- src/spicelib/parser/Makefile.am | 5 -- src/spicelib/parser/inp2a.c | 109 -------------------------------- src/spicelib/parser/inppas2.c | 1 + src/spicelib/parser/inpxx.h | 3 - test_docker.sh | 7 -- 7 files changed, 13 insertions(+), 162 deletions(-) delete mode 100644 src/spicelib/parser/inp2a.c delete mode 100755 test_docker.sh diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index b8c65e2ac..ccfa6ea64 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -2406,29 +2406,14 @@ static char *get_model_type(char *line) } -static char *get_adevice_model_name(char *line, struct nscope *scope) +static char *get_adevice_model_name(char *line) { - char *beg_ptr, *end_ptr, *name; - int i = 0; + char *ptr_end, *ptr_beg; - beg_ptr = skip_non_ws(line); /* eat device name */ - beg_ptr = skip_ws(beg_ptr); + ptr_end = skip_back_ws(strchr(line, '\0'), line); + ptr_beg = skip_back_non_ws(ptr_end, line); - for (i = 0; i < 30; i++) { /* skip the terminals */ - end_ptr = skip_non_ws(beg_ptr); - name = copy_substring(beg_ptr, end_ptr); - if (inp_find_model(scope, name)){ - return name; - }else if (beg_ptr == end_ptr){ - break; - } - end_ptr = skip_ws(end_ptr); - beg_ptr = end_ptr; - - } - - - return NULL; + return copy_substring(ptr_beg, ptr_end); } @@ -2647,7 +2632,7 @@ static void get_subckts_for_subckt(struct card *start_card, char *subckt_name, nlist_adjoin(used_subckts, inst_subckt_name); } else if (*line == 'a') { - char *model_name = get_adevice_model_name( line, card->level); + char *model_name = get_adevice_model_name(line); nlist_adjoin(used_models, model_name); } else if (has_models) { @@ -2733,7 +2718,7 @@ void comment_out_unused_subckt_models(struct card *start_card) nlist_adjoin(used_subckts, subckt_name); } else if (*line == 'a') { - char *model_name = get_adevice_model_name(line, card->level); + char *model_name = get_adevice_model_name(line); nlist_adjoin(used_models, model_name); } else if (has_models) { @@ -10021,7 +10006,7 @@ static char inp_get_elem_ident(char *type) if (cieq(type, "res")) return 'r'; /* xspice code models do not have unique type names, - but could also be a OpenVAF model. */ + but could also be an OSDI/OpenVAF model. */ else return 'a'; } @@ -10288,12 +10273,9 @@ void inp_rem_unused_models(struct nscope *root, struct card *deck) /* num_terminals may be 0 for a elements */ if ((num_terminals != 0) || (*curr_line == 'a')) { char *elem_model_name; - if (*curr_line == 'a'){ - elem_model_name = get_adevice_model_name( curr_line, card->level); - if (!elem_model_name){ - continue; - } - }else + if (*curr_line == 'a') + elem_model_name = get_adevice_model_name(curr_line); + else elem_model_name = get_model_name(curr_line, num_terminals); /* ignore certain cases, for example @@ -10304,7 +10286,7 @@ void inp_rem_unused_models(struct nscope *root, struct card *deck) struct modellist *m = inp_find_model(card->level, elem_model_name); if (m) { - if (*curr_line != m->elemb && *curr_line != 'n') + if (*curr_line != m->elemb && !(*curr_line == 'n' && m->elemb == 'a')) fprintf(stderr, "warning, model type mismatch in line\n " "%s\n", diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index b04ad01de..9d7817530 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -1690,11 +1690,7 @@ numnodes(const char *line, struct subs *subs, wordlist const *modnames) /* Paolo Nenzi Jan-2001 */ /* If model names equal node names, this code will fail! */ -#ifdef OSDI - if ((c == 'n') ||(c == 'm') || (c == 'p') || (c == 'q') || (c == 'd')) { /* IF this is a mos, cpl, bjt or diode */ -#else if ((c == 'm') || (c == 'p') || (c == 'q') || (c == 'd')) { /* IF this is a mos, cpl, bjt or diode */ -#endif char *s = nexttok(line); /* Skip the instance name */ int gotit = 0; int i = 0; @@ -2265,10 +2261,6 @@ inp_numnodes(char c) return (4); case 'z': return (3); -#ifdef OSDI - case 'n': - return (7); -#endif default: fprintf(cp_err, "Warning: unknown device type: %c\n", c); diff --git a/src/spicelib/parser/Makefile.am b/src/spicelib/parser/Makefile.am index fa693d835..5ef6e38ca 100644 --- a/src/spicelib/parser/Makefile.am +++ b/src/spicelib/parser/Makefile.am @@ -71,11 +71,6 @@ libinp_la_SOURCES = \ sperror.c \ inpxx.h - -if OSDI_WANTED -libinp_la_SOURCES += inp2a.c -endif - AM_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src/include -I$(top_srcdir)/src/frontend AM_CFLAGS = $(STATIC) AM_YFLAGS = -d diff --git a/src/spicelib/parser/inp2a.c b/src/spicelib/parser/inp2a.c deleted file mode 100644 index ba3c2a3da..000000000 --- a/src/spicelib/parser/inp2a.c +++ /dev/null @@ -1,109 +0,0 @@ -/********** -Copyright 1990 Regents of the University of California. All rights reserved. -Author: 1988 Thomas L. Quarles -Modified: 2001 Paolo Nenzi (Cider Integration) -**********/ - -#include "ngspice/ngspice.h" - -#include "ngspice/devdefs.h" -#include "ngspice/fteext.h" -#include "ngspice/ifsim.h" -#include "ngspice/inpdefs.h" -#include "ngspice/inpmacs.h" - -#include "inpxx.h" -#include - -#ifdef XSPICE -#include "ngspice/mifproto.h" -#endif - -void INP2A(CKTcircuit *ckt, INPtables *tab, struct card *current) { - /* Mname [L=] - * [W=] [AD=] [AS=] [PD=] - * [PS=] [NRD=] [NRS=] [OFF] - * [IC=,,] - */ - - int type; /* the type the model says it is */ - char *line; /* the part of the current line left to parse */ - char *name; /* the resistor's name */ - // limit to at most 20 nodes - const int max_i = 20; - CKTnode *node[20]; - int error; /* error code temporary */ - int numnodes; /* flag indicating 4 or 5 (or 6 or 7) nodes */ - GENinstance *fast; /* pointer to the actual instance */ - int waslead; /* flag to indicate that funny unlabeled number was found */ - double leadval; /* actual value of unlabeled number */ - INPmodel *thismodel; /* pointer to model description for user's model */ - GENmodel *mdfast; /* pointer to the actual model */ - int i; - - line = current->line; - - INPgetNetTok(&line, &name, 1); - INPinsert(&name, tab); - - for (i = 0;; i++) { - char *token; - INPgetNetTok(&line, &token, 1); - - if (i >= 2) { - txfree(INPgetMod(ckt, token, &thismodel, tab)); - - /* /1* check if using model binning -- pass in line since need 'l' and 'w' *1/ */ - /* if (!thismodel) */ - /* txfree(INPgetModBin(ckt, token, &thismodel, tab, line)); */ - - if (thismodel) { - INPinsert(&token, tab); - break; - } - } - if (i >= max_i) { - LITERR("could not find a valid modelname"); - return; - } - INPtermInsert(ckt, &token, tab, &node[i]); - } - - type = thismodel->INPmodType; - mdfast = thismodel->INPmodfast; - IFdevice *dev = ft_sim->devices[type]; - - if (!dev->registry_entry) { - -#ifdef XSPICE - MIF_INP2A(ckt, tab, current); -#else - LITERR("incorrect model type! Expected OSDI device"); -#endif - return; - } - - if (i == 0) { - LITERR("not enough nodes"); - return; - } - - if (i > *dev->terms) { - LITERR("too many nodes connected to instance"); - return; - } - - numnodes = i; - - IFC(newInstance, (ckt, mdfast, &fast, name)); - - for (i = 0; i < *dev->terms; i++) - if (i < numnodes) - IFC(bindNode, (ckt, fast, i + 1, node[i])); - else - GENnode(fast)[i] = -1; - - PARSECALL((&line, ckt, type, fast, &leadval, &waslead, tab)); - if (waslead) - LITERR(" error: no unlabeled parameter permitted on osdi devices\n"); -} diff --git a/src/spicelib/parser/inppas2.c b/src/spicelib/parser/inppas2.c index 989fc6d5f..c388525be 100644 --- a/src/spicelib/parser/inppas2.c +++ b/src/spicelib/parser/inppas2.c @@ -245,6 +245,7 @@ void INPpas2(CKTcircuit *ckt, struct card *data, INPtables * tab, TSKtask *task) case 'B': /* Bname [V=expr] [I=expr] */ /* Arbitrary source. */ + INP2B(ckt, tab, current); break; case '.': /* . Many possibilities */ diff --git a/src/spicelib/parser/inpxx.h b/src/spicelib/parser/inpxx.h index ae47f0465..81e9355db 100644 --- a/src/spicelib/parser/inpxx.h +++ b/src/spicelib/parser/inpxx.h @@ -8,9 +8,6 @@ /* inp2xx.c */ -#ifdef OSDI -void INP2A(CKTcircuit *ckt, INPtables *tab, struct card *current); -#endif void INP2B(CKTcircuit *ckt, INPtables *tab, struct card *current); void INP2C(CKTcircuit *ckt, INPtables *tab, struct card *current); void INP2D(CKTcircuit *ckt, INPtables *tab, struct card *current); diff --git a/test_docker.sh b/test_docker.sh deleted file mode 100755 index b9893c1cb..000000000 --- a/test_docker.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -IMAGENAME="registry.gitlab.com/dospm/ngspice" -TAG="latest" - -docker build -t $IMAGENAME:$TAG . -docker run -it --rm --user "$(id -u)":"$(id -g)" -v "${PWD}":/tmp $IMAGENAME:$TAG /bin/bash \ No newline at end of file