From d2f9faf66bc9a91728d7aa47cd3b947bb3e843a1 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sun, 1 Jan 2012 13:58:03 +0000 Subject: [PATCH] .lib handling --- ChangeLog | 4 ++++ src/frontend/inpcom.c | 17 +++++++++-------- src/include/ngspice/compatmode.h | 1 + src/main.c | 4 +++- src/spinit.in | 2 -- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index a470544bc..110e5396d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2012-01-01 Holger Vogt + * inpcom.c, main.c, compatmode.h: + .lib handling depends on input to compatmode + 2011-12-30 Holger Vogt * b4v5dest.c, b4dest.c, b3dest, b3v32.dest : memory leaks reduced * b3v32... : struct bsim3SizeDependParam --> struct bsim3v32SizeDependParam diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index fb0dfe3c8..4f774d86d 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -261,10 +261,10 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c ; y = t; while ( isspace(*y) || isquote(*y) ) y++; /* advance past space chars */ - - // check if rest of line commented out - if ( *y && *y != '$' ) { /* .lib */ - + + if ( *y && ((inp_compat_mode == COMPATMODE_ALL) || (inp_compat_mode == COMPATMODE_HS) + || (inp_compat_mode == COMPATMODE_NATIVE))) { + /* .lib */ char *copys = NULL; char keep_char; @@ -329,11 +329,12 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c /* Make the .lib a comment */ *buffer = '*'; - } /*else { // no lib name given + } else if (inp_compat_mode == COMPATMODE_PS) { + /* .lib (no lib name given ) */ fprintf(cp_err, "Warning: library name missing in line\n %s", buffer); fprintf(cp_err, " File included as: .inc %s\n", s); memcpy(buffer, ".inc",4); - } */ + } } /* end of .lib handling */ @@ -736,7 +737,7 @@ inp_readall(FILE *fp, struct line **data, int call_depth, char *dir_name, bool c if (cp_getvar("addcontrol", CP_BOOL, NULL)) inp_add_control_section(working, &line_number); - if (inp_compat_mode == COMPATMODE_ALL) { + if (inp_compat_mode != COMPATMODE_SPICE3) { /* Do all the compatibility stuff here */ working = cc->li_next; /* E, G, L, R, C compatibility transformations */ @@ -2104,7 +2105,7 @@ inp_fix_for_numparam(struct line *deck) if ( !ciprefix( "*lib", c->li_line ) && !ciprefix( "*inc", c->li_line ) ) inp_change_quotes(c->li_line); - if (inp_compat_mode == COMPATMODE_ALL) { + if ((inp_compat_mode == COMPATMODE_ALL) || (inp_compat_mode == COMPATMODE_PS)) { if ( ciprefix( ".subckt", c->li_line ) || ciprefix( "x", c->li_line ) ) { /* remove params: */ str_ptr = strstr(c->li_line, "params:"); diff --git a/src/include/ngspice/compatmode.h b/src/include/ngspice/compatmode.h index de86c6675..8a1ff41e7 100644 --- a/src/include/ngspice/compatmode.h +++ b/src/include/ngspice/compatmode.h @@ -8,6 +8,7 @@ typedef enum { COMPATMODE_HS = 1, COMPATMODE_SPICE3 = 2, COMPATMODE_ALL = 3, + COMPATMODE_PS = 4 } COMPATMODE_T ; extern COMPATMODE_T ngspice_compat_mode(void) ; diff --git a/src/main.c b/src/main.c index 843a93c61..db34c9090 100644 --- a/src/main.c +++ b/src/main.c @@ -436,10 +436,12 @@ COMPATMODE_T ngspice_compat_mode(void) return( COMPATMODE_ALL ) ; if (strcasecmp(behaviour, "hs")==0) return( COMPATMODE_HS ) ; + if (strcasecmp(behaviour, "ps")==0) + return( COMPATMODE_PS ) ; if (strcasecmp(behaviour, "spice3")==0) return( COMPATMODE_SPICE3 ) ; } - return(COMPATMODE_NATIVE) ; + return(COMPATMODE_ALL) ; } /* end ngspice_compat_mode() */ /* -------------------------------------------------------------------------- */ diff --git a/src/spinit.in b/src/spinit.in index e5bcf8ba8..2d2f644c0 100644 --- a/src/spinit.in +++ b/src/spinit.in @@ -9,8 +9,6 @@ set x11lineararcs *set ngdebug ** no asking after quit ** set noaskquit -** set the compatibility mode to allow some hspice constructs -set ngbehavior=all ** set the number of threads in openmp ** default (if compiled with --enable-openmp) is: 2 *set num_threads=4