Browse Source

.lib handling

h_vogt 14 years ago
parent
commit
d2f9faf66b
  1. 4
      ChangeLog
  2. 17
      src/frontend/inpcom.c
  3. 1
      src/include/ngspice/compatmode.h
  4. 4
      src/main.c
  5. 2
      src/spinit.in

4
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

17
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 <file name> <lib name> */
if ( *y && ((inp_compat_mode == COMPATMODE_ALL) || (inp_compat_mode == COMPATMODE_HS)
|| (inp_compat_mode == COMPATMODE_NATIVE))) {
/* .lib <file name> <lib name> */
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 <file name> (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:");

1
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) ;

4
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() */
/* -------------------------------------------------------------------------- */

2
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

Loading…
Cancel
Save