diff --git a/contrib/ChangeLog b/contrib/ChangeLog index 9ebcd5e43..f74466c7b 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,10 +1,16 @@ -2000-03-22 Paolo Nenzi +2000-10-10 Arno W. Peters + + * mslib, spiceprm: Michael Widlok released new version of his + programs. + +2000-03-22 Paolo Nenzi - * mslib: Major update. M. Widlok sent the new version of it's programs. + * mslib: Major update. M. Widlok sent the new version of it's + programs. * spiceprm: Major update. See above line. -1999-09-14 Arno +1999-09-14 Arno W. Peters * mslib: Added. diff --git a/contrib/mslib/inc_inp.c b/contrib/mslib/inc_inp.c index c8436a075..f2c540453 100644 --- a/contrib/mslib/inc_inp.c +++ b/contrib/mslib/inc_inp.c @@ -92,10 +92,11 @@ readlib(struct LSData *lib, FILE * tlib, \ { char name[BSIZE]; - int numi, wflag; + int numi, wflag, nextsub; numi = 0; wflag = NOWRITE; + nextsub = 0; while (fgets(buf, bsizer, lib->filedes)) { @@ -128,7 +129,16 @@ readlib(struct LSData *lib, FILE * tlib, \ case (SUBLLINE): if (sub) { - if (checkname(sub, name)) + if (wflag==WRITESUB) + { + /* subckt inside subckt + not so funny */ + nextsub++; + fputs(buf, tlib); + break; + } + + if (checkname(sub, name)) { wflag = WRITESUB; numi++; @@ -150,12 +160,20 @@ readlib(struct LSData *lib, FILE * tlib, \ break; case (ENDSLLINE): - if (wflag == WRITESUB) + if (nextsub) + { + nextsub--; + fputs(buf, tlib); + break; + } else { + + if (wflag == WRITESUB) { fprintf(tlib, "%s\n* End Subckt\n\n", buf); } wflag = NOWRITE; break; + } case (CONTLLINE): if (wflag != NOWRITE) diff --git a/contrib/mslib/liblook b/contrib/mslib/liblook new file mode 100755 index 000000000..3cf1f8cb4 --- /dev/null +++ b/contrib/mslib/liblook @@ -0,0 +1,77 @@ +#!/bin/sh +#set -x -v + +# MW. Lib search / show program + +# usage liblook libname [text_to_find] [l_before] [l_after] + +LIBPATH=/usr/local/lib + +function trapper() + { + echo User break! + echo Exiting . . . + unset LIBPATH + exit 1 + } + +trap trapper SIGINT SIGQUIT + +function operror() + { + echo Incorrect parameters: $*, $# + echo Usage: liblook libname [text_to_find] [l_before] [l_after] + unset LIBPATH + exit 2 + } + +function showlib() + { + if test -f $LIBPATH/$1; then + less $LIBPATH/$1; exit 0; fi + + if test -f [C./$1; then + less ./$1; exit 0; fi + + echo Searching $1 in ~/ . . . + less $(find ~/ -name $1) + } + +function searchlib() + { + if test -f $LIBPATH/$1; then + echo File: $1; echo; + grep -B"$3" -A"$4" --ignore-case -e "$2" $LIBPATH/$1; + echo; exit 0; fi + + if test -f ./$1; then + echo File: $1; echo; + grep -B"$3" -A"$4" --ignore-case -e "$2" ./$1; + echo; exit 0; fi + +#if *.lib or sth like this + + echo Searching $1 in ~/ . . .;echo; + if (grep -B"$3" -A"$4" --ignore-case -e "$2" $(find ~/ -name $1)); then + echo; exit 0; fi + + echo Searching $1 in $LIBPATH;echo; + if (grep -B"$3" -A"$4" --ignore-case -e "$2" $(find $LIBPATH -name $1)); then + echo; exit 0; fi + + } + + +# Main body +if test $# -lt 1 -o $# -gt 4; then operror $*; fi + +case $# in +1) showlib $*;; +2) searchlib $1 $2 2 2;; +3) searchlib $1 $2 $3 2;; +4) searchlib $1 $2 $3 $4;; +esac + +unset LIBPATH +exit 0 + diff --git a/contrib/mslib/libprm b/contrib/mslib/libprm new file mode 100755 index 000000000..bfc8ae59d --- /dev/null +++ b/contrib/mslib/libprm @@ -0,0 +1,70 @@ +#!/bin/sh +#set -x -v + +# MW. Lip / Param parsing program for spice + +# -n normal, -f full (keep everything), -r replace original file +# -e new addition start with editor, then like normal + +export TMPLP=/tmp/LibPrm.$$- + +function trapper() + { + echo User break! + echo Exiting . . . + rm -f -v ${TMPLP}* + unset TMPLP + exit 1 + } + +trap trapper SIGINT SIGQUIT + +function operror() + { + echo Incorrect parameters: $*, $# + unset TMPLP + exit 2 + } + +function repnormpl() + { + mslib $1 ${TMPLP}1 + sed -n -e 'p' -e "1r ${TMPLP}1" $1 >${TMPLP}2 + spiceprm ${TMPLP}2 $2 + } + +function keepall() + { + mslib $1 + sed -n -e 'p' -e "1r $1.lib" $1 >${TMPLP}2 + spiceprm ${TMPLP}2 $2 + } + +function withedit() + { + joe $1 + mslib $1 ${TMPLP}1 + sed -n -e 'p' -e "1r ${TMPLP}1" $1 >${TMPLP}2 + spiceprm ${TMPLP}2 $2 + } + + +# Main body +if test $# -lt 2 -o $# -gt 3; then operror $*; fi +if !(test -f $2); then operror $*; fi + +case $1$# in +-r3) operror $*;; +-n2) repnormpl $2 ${2%.cir}.ckt;; +-n3) repnormpl $2 $3;; +-r2) repnormpl $2 $2;; +-f2) keepall $2 ${2%.cir}.ckt;; +-f3) keepall $2 $3;; +-e2) withedit $2 ${2%.cir}.ckt;; +-e3) withedit $2 $3;; +esac + +rm -f ${TMPLP}* +unset TMPLP +exit 0 + diff --git a/contrib/mslib/libprm_readme b/contrib/mslib/libprm_readme new file mode 100644 index 000000000..8f7bb3df7 --- /dev/null +++ b/contrib/mslib/libprm_readme @@ -0,0 +1,14 @@ +So, this is my idea of using parametrized subckts with spice3f4. + + First I create an input file like foo.cir and I include commands for +mslib (*MOD, *SUB, *LIB) in it. Then I run "libprm -n foo.cir". Libprm then +runs mslib first to get all models and subckts form given libraries and then +runs spiceprm to evaluate all used parameters. + This works quite right for me, and I hope that You will find my idea +useful. Spiceprm is not my program (I get it from Internet), but I think +that it will better to enclose all used programs in this packet. Spiceprm +has it's own directory with very good readme and examples. If You want to +find out more about libprm or mslib look for the source code. These are rather +short and easy programs - they are all that I could write in quite short +time. + \ No newline at end of file diff --git a/contrib/mslib/makefile b/contrib/mslib/makefile index 186038480..63a0b3e25 100644 --- a/contrib/mslib/makefile +++ b/contrib/mslib/makefile @@ -7,6 +7,9 @@ HDRS= datadef.h SRCC= inc_main.c inc_inp.c inc_LSD.c mslib: $(OBJS) - $(CC) $(LDFLAGS) -o $@ $(OBJS) + $(CC) $(LDFLAGS) -o $@ $(OBJS) -$(OBJS): $(HDRS) \ No newline at end of file +clean: + $(RM) $(OBJS) mslib + +$(OBJS): $(HDRS) diff --git a/contrib/spiceprm/CHANGES b/contrib/spiceprm/CHANGES index 9988a99b6..e7d53da8a 100644 --- a/contrib/spiceprm/CHANGES +++ b/contrib/spiceprm/CHANGES @@ -1,3 +1,10 @@ +------------------------------- +MW. 01-10-2000 +Bugs Fixes - +----------- +.subckt inside another parametrized .subckt works right now. + + ---------------------------------------------------------------------- Version 0.11 January 2, 1996 ---------------------------------------------------------------------- diff --git a/contrib/spiceprm/spiceprm b/contrib/spiceprm/spiceprm index 71fc5b93a..c5d82253f 100755 --- a/contrib/spiceprm/spiceprm +++ b/contrib/spiceprm/spiceprm @@ -163,8 +163,9 @@ sub prm_scan { } $hasprm = 0; undef @list; $sublist = ''; + last PRM_TST; } - last PRM_TST; +# MW. 'last PRM_TST' should be inside 'if' loop to allow nestle subckts. } if ($depth) { push(@list, $_); @@ -248,7 +249,7 @@ sub prm_wr { last PRMWR_SCAN; } if (/^\.ends/) { - if (--$depth == 0) { $sublist = ''; } + if (--$depth == 0) { $sublist = ''; } else { $sublist =~ s/(\#\w+)$//; } } prm_wrline($_);