From eee79750bebdb5cdc8e071eb0bff507bd026379b Mon Sep 17 00:00:00 2001 From: Frederic Petrot Date: Wed, 28 Jul 2004 12:04:23 +0000 Subject: [PATCH] Hacked the parser to skip multiple reads of a cell with identical name (that I feel not allowed to call the 'same' cell) to avoid an error. Note that this assumes that two cells with the same name are the same cell, which is against spice believes, ... --- alliance/src/mbkspice/src/spi_parse.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/alliance/src/mbkspice/src/spi_parse.c b/alliance/src/mbkspice/src/spi_parse.c index 5e575906..672b38bb 100644 --- a/alliance/src/mbkspice/src/spi_parse.c +++ b/alliance/src/mbkspice/src/spi_parse.c @@ -21,7 +21,7 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ident "$Author: czo $ $Date: 2002/09/30 16:20:57 $ $Revision: 1.2 $" +#ident "$Author: fred $ $Date: 2004/07/28 12:04:23 $ $Revision: 1.3 $" /******************************************************************************* * * @@ -173,8 +173,8 @@ char mode; if( SPI_VERBOSE ) { printf( "Parser Spice compile le %s a %s\n", __DATE__, __TIME__ ); - printf( "Revision : %s\n", "$Revision: 1.2 $" ); - printf( "Date : %s\n", "$Date: 2002/09/30 16:20:57 $" ); + printf( "Revision : %s\n", "$Revision: 1.3 $" ); + printf( "Date : %s\n", "$Date: 2004/07/28 12:04:23 $" ); printf( "Separateur : '%c'\n", SPI_SEPAR ); printf( "Nom de noeud : %s\n", SPI_NETNAME ); @@ -315,6 +315,22 @@ ginterf *teteinterf; } else { + lofig_list *lf; + const char *name = namealloc(ptcir->NOM); + /* Check that a model has not yet been read, otherwise (wrongly) + * assumes that the models having the same name are identical. + * I issue a warning because this suck. + * I should preprend a prefix and use the prefixed name, but + * since it is the first and probably last time that I hack this + * code, I'll live with this on my conscience ;-) */ + for (lf = HEAD_LOFIG; lf ; lf = lf->NEXT) { + if (lf->NAME == name) { + fprintf(stderr, "Warning: skipping model '%s' as it has already" + " been loaded\n", name); + goto skip; + } + } + /* Si la figure est vide, on ne construit pas la lofig correspondante */ if( ptcir->RESI || ptcir->VALIM || @@ -334,7 +350,7 @@ ginterf *teteinterf; newfig->USER = constphinterf( newfig->USER, teteinterf ); } else - if( SPI_VERBOSE ) +skip: if( SPI_VERBOSE ) printf( "Ne construit pas la figure %s.\n", ptcir->NOM ); }