Modified the detection of subcircuits such that it does not flag

false errors about missing .ENDS statements on the top-level
cell at EOF.
This commit is contained in:
Tim Edwards 2015-08-31 09:33:31 -04:00
parent bf758a9eb0
commit 4b7c06101c
4 changed files with 93 additions and 11 deletions

View File

@ -469,7 +469,7 @@ void ReadSpiceFile(char *fname, int filenum, struct cellstack **CellStackPtr,
{
int cdnum = 1, rdnum = 1, ndev, multi;
int warnings = 0, update = 0, hasports = 0;
char *eqptr, devtype, endsubcell;
char *eqptr, devtype, in_subckt;
struct keyvalue *kvlist = NULL;
char inst[256], model[256], instname[256];
struct nlist *tp;
@ -478,6 +478,7 @@ void ReadSpiceFile(char *fname, int filenum, struct cellstack **CellStackPtr,
inst[255] = '\0';
model[255] = '\0';
instname[255] = '\0';
in_subckt = (char)0;
while (!EndParseFile()) {
@ -493,6 +494,12 @@ void ReadSpiceFile(char *fname, int filenum, struct cellstack **CellStackPtr,
goto skip_ends;
}
if (in_subckt == (char)1) {
Fprintf(stderr, "Missing .ENDS statement on subcircuit.\n");
InputParseError(stderr);
}
in_subckt = (char)1;
/* Save pointer to current cell */
if (CurrentCell != NULL)
parent = CurrentCell->cell;
@ -610,22 +617,23 @@ skip_ends:
SpiceSkipNewLine();
SkipTok();
if (EndParseFile()) break;
if (matchnocase(nexttok, ".ENDS")) break;
if (matchnocase(nexttok, ".ENDS")) {
in_subckt = 0;
break;
}
}
}
}
else if (endsubcell || matchnocase(nexttok, ".ENDS")) {
else if (matchnocase(nexttok, ".ENDS")) {
CleanupSubcell();
EndCell();
// This condition will be true if no nodes or components were
// created in the top-level cell before the first subcircuit
// definition, so it is not necessarily an error. . .
// if (*(CellStackPtr) && ((*CellStackPtr)->next == NULL))
// Printf(".ENDS encountered outside of a subcell.\n");
// else
if (in_subckt == (char)0) {
Fprintf(stderr, ".ENDS occurred outside of a subcircuit!\n");
InputParseError(stderr);
}
in_subckt = (char)0;
if (*CellStackPtr) PopStack(CellStackPtr);
if (*CellStackPtr) ReopenCellDef((*CellStackPtr)->cellname, filenum);
@ -1782,8 +1790,12 @@ baddevice:
/* Watch for bad ending syntax */
if (in_subckt == (char)1) {
Fprintf(stderr, "Missing .ENDS statement on subcircuit.\n");
InputParseError(stderr);
}
if (*(CellStackPtr)) {
Printf("Error: Subcircuit without .ENDS encountered at EOF (ignoring).\n");
CleanupSubcell();
EndCell();
if (*CellStackPtr) PopStack(CellStackPtr);

View File

@ -375,3 +375,36 @@ rm -f /usr/local/lib/netgen/tcl/netgenexec
cp netgenexec /usr/local/lib/netgen/tcl/netgenexec
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/tcltk'
make[1]: Leaving directory '/home/tim/gitsrc/netgen-1.5'
make[1]: Entering directory '/home/tim/gitsrc/netgen-1.5'
./scripts/mkdirs /usr/local/bin /usr/local/share/man \
/usr/local/lib/netgen/tcl
for dir in lib doc tcltk netgen tcltk; do \
(cd $dir && make install-tcl); done
make[2]: Entering directory '/home/tim/gitsrc/netgen-1.5/lib'
make[2]: Nothing to be done for 'install-tcl'.
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/lib'
make[2]: Entering directory '/home/tim/gitsrc/netgen-1.5/doc'
../scripts/mkdirs /usr/local/share/man /usr/local/share/man/man1
../scripts/mkdirs /usr/local/lib/netgen/doc
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/doc'
make[2]: Entering directory '/home/tim/gitsrc/netgen-1.5/tcltk'
rm -f /usr/local/bin/netgen.sh /usr/local/bin/netgen
cp netgen.sh /usr/local/bin/netgen
(cd /usr/local/bin; chmod 0755 netgen)
rm -f /usr/local/lib/netgen/tcl/netgen.tcl
cp netgen.tcl /usr/local/lib/netgen/tcl/netgen.tcl
rm -f /usr/local/lib/netgen/tcl/netgenexec
cp netgenexec /usr/local/lib/netgen/tcl/netgenexec
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/tcltk'
make[2]: Entering directory '/home/tim/gitsrc/netgen-1.5/netgen'
rm -f /usr/local/lib/netgen/tcl/tclnetgen.so
cp tclnetgen.so /usr/local/lib/netgen/tcl/tclnetgen.so
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/netgen'
make[2]: Entering directory '/home/tim/gitsrc/netgen-1.5/tcltk'
rm -f /usr/local/bin/netgen.sh /usr/local/bin/netgen
cp netgen.sh /usr/local/bin/netgen
(cd /usr/local/bin; chmod 0755 netgen)
rm -f /usr/local/lib/netgen/tcl/netgenexec
cp netgenexec /usr/local/lib/netgen/tcl/netgenexec
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/tcltk'
make[1]: Leaving directory '/home/tim/gitsrc/netgen-1.5'

View File

@ -1120,3 +1120,40 @@ make[2]: Entering directory '/home/tim/gitsrc/netgen-1.5/tcltk'
make[2]: Nothing to be done for 'tcl-main'.
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/tcltk'
make[1]: Leaving directory '/home/tim/gitsrc/netgen-1.5'
make[1]: Entering directory '/home/tim/gitsrc/netgen-1.5'
--- making modules
for dir in base tcltk; do \
(cd $dir && make module); done
make[2]: Entering directory '/home/tim/gitsrc/netgen-1.5/base'
make[2]: Nothing to be done for 'module'.
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/base'
make[2]: Entering directory '/home/tim/gitsrc/netgen-1.5/tcltk'
--- compiling tcltk/tclnetgen.o
rm -f tclnetgen.o
gcc -g -m64 -fPIC -fPIC -I../base -I. -I.. -DCAD_DIR=\"/usr/local/lib\" -DTCL_DIR=\"/usr/local/lib/netgen/tcl\" -DPACKAGE_NAME=\"netgen\" -DPACKAGE_TARNAME=\"netgen\" -DPACKAGE_VERSION=\"1.3\" -DPACKAGE_STRING=\"netgen\ 1.3\" -DPACKAGE_BUGREPORT=\"eda-dev@opencircuitdesign.com\" -DPACKAGE_URL=\"\" -DNETGEN_VERSION=\"1.5\" -DNETGEN_REVISION=\"39\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DDBUG_OFF=1 -DTCL_NETGEN=1 -Dlinux=1 -DSYSV=1 -DISC=1 -DSHDLIB_EXT=\".so\" -DNDEBUG -DNETGEN_DATE="\"`date`\"" -c tclnetgen.c
--- linking libtcltk.o
rm -f libtcltk.o
/bin/ld -r tclnetgen.o -o libtcltk.o
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/tcltk'
--- making Tcl shared-object libraries
for dir in netgen tcltk; do \
(cd $dir && make tcl-main); done
make[2]: Entering directory '/home/tim/gitsrc/netgen-1.5/netgen'
--- making netgen Tcl library (tclnetgen.so)
rm -f tclnetgen.so
gcc -g -m64 -fPIC -fPIC -I../base -I. -I.. -o tclnetgen.so -shared -Wl,-soname,tclnetgen.so -Wl,--version-script=../netgen/symbol.map \
../base/libbase.o ../tcltk/libtcltk.o -lc -lX11 -lm \
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/netgen'
make[2]: Entering directory '/home/tim/gitsrc/netgen-1.5/tcltk'
gcc -g -m64 -fPIC -fPIC -I../base -I. -I.. -DCAD_DIR=\"/usr/local/lib\" -DTCL_DIR=\"/usr/local/lib/netgen/tcl\" -DPACKAGE_NAME=\"netgen\" -DPACKAGE_TARNAME=\"netgen\" -DPACKAGE_VERSION=\"1.3\" -DPACKAGE_STRING=\"netgen\ 1.3\" -DPACKAGE_BUGREPORT=\"eda-dev@opencircuitdesign.com\" -DPACKAGE_URL=\"\" -DNETGEN_VERSION=\"1.5\" -DNETGEN_REVISION=\"39\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DSIZEOF_VOID_P=8 -DSIZEOF_UNSIGNED_INT=4 -DSIZEOF_UNSIGNED_LONG=8 -DSIZEOF_UNSIGNED_LONG_LONG=8 -DSTDC_HEADERS=1 -DHAVE_SETENV=1 -DHAVE_PUTENV=1 -DHAVE_DIRENT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_VA_COPY=1 -DHAVE___VA_COPY=1 -DDBUG_OFF=1 -DTCL_NETGEN=1 -Dlinux=1 -DSYSV=1 -DISC=1 -DSHDLIB_EXT=\".so\" -DNDEBUG -DNETGEN_DATE="\"`date`\"" netgenexec.c -o netgenexec \
-lm -L/usr/lib64 -ltk8.6 -L/usr/lib64 -ltcl8.6
sed -e /TCL_DIR/s%TCL_DIR%/usr/local/lib/netgen/tcl%g \
-e /SHDLIB_EXT/s%SHDLIB_EXT%.so%g \
netgen.tcl.in > netgen.tcl
sed -e /TCL_DIR/s%TCL_DIR%/usr/local/lib/netgen/tcl%g \
-e /TCLLIB_DIR/s%TCLLIB_DIR%/usr/lib%g \
-e /WISH_EXE/s%WISH_EXE%/usr/bin/wish%g \
netgen.sh.in > netgen.sh
make[2]: Leaving directory '/home/tim/gitsrc/netgen-1.5/tcltk'
make[1]: Leaving directory '/home/tim/gitsrc/netgen-1.5'

Binary file not shown.