From 86f326d11ec09e1c393d11b84e3ebe61e31087b0 Mon Sep 17 00:00:00 2001 From: arno Date: Sat, 14 Oct 2000 21:49:25 +0000 Subject: [PATCH] * NEWS TODO acconfig.h configure.in src/ngspice.idx src/frontend/inpcom.c src/include/complex.h src/include/macros.h src/include/memory.h src/include/ngspice.h src/maths/cmaths/Makefile.am src/maths/cmaths/cmath1.c src/maths/cmaths/cmath2.c src/maths/cmaths/cmath3.c src/maths/cmaths/cmath4.c src/maths/cmaths/test_cx_j.c src/maths/cmaths/test_cx_mag.c src/maths/cmaths/test_cx_ph.c src/misc/alloc.c src/misc/alloc.h: Added support for the Boehm-Weiser conservative garbage collector. * NOTES src/maths/cmaths/cmath.h: Added. * notes/Linux.changes notes/dbx notes/internal notes/mac_port notes/porting notes/spice2: Removed or incorporated into NOTES. --- NEWS | 29 ++-- NOTES | 69 ++++++++++ TODO | 13 +- acconfig.h | 3 + configure.in | 3 + notes/Linux.changes | 164 ----------------------- notes/dbx | 7 - notes/internal | 98 -------------- notes/mac_port | 207 ---------------------------- notes/porting | 237 --------------------------------- notes/spice2 | 15 --- src/frontend/inpcom.c | 2 +- src/include/complex.h | 2 - src/include/macros.h | 7 - src/include/memory.h | 18 +++ src/include/ngspice.h | 15 +-- src/maths/cmaths/Makefile.am | 1 + src/maths/cmaths/cmath.h | 7 + src/maths/cmaths/cmath1.c | 2 + src/maths/cmaths/cmath2.c | 1 + src/maths/cmaths/cmath3.c | 1 + src/maths/cmaths/cmath4.c | 2 +- src/maths/cmaths/test_cx_j.c | 2 + src/maths/cmaths/test_cx_mag.c | 2 + src/maths/cmaths/test_cx_ph.c | 2 + src/misc/alloc.c | 7 +- src/misc/alloc.h | 2 + 27 files changed, 142 insertions(+), 776 deletions(-) create mode 100644 NOTES delete mode 100644 notes/Linux.changes delete mode 100644 notes/dbx delete mode 100644 notes/internal delete mode 100644 notes/mac_port delete mode 100644 notes/porting delete mode 100644 notes/spice2 create mode 100644 src/maths/cmaths/cmath.h diff --git a/NEWS b/NEWS index 4ae42e4c9..ec142f6fc 100644 --- a/NEWS +++ b/NEWS @@ -1,16 +1,17 @@ Ng-spice-rework-10 ============ -Added BSIM4 model and closed a couple of serious bugs. Added DEVICES file -to distribution. This file contains the status of device models in this -simulator. Read it, this file can save you a lot of time. +Added BSIM4 model and closed a couple of serious bugs. Added DEVICES +file to distribution. This file contains the status of device models +in this simulator. Read it, this file can save you a lot of time. Ng-spice-rework-9 ============ -Thanks to Arno Peters now all device models are dynamically loaed on demand. -Thay are linked as shared libraries. The next step is the dlopen() one which -will make possible to link devices without any recompilation. +Thanks to Arno Peters now all device models are dynamically loaed on +demand. Thay are linked as shared libraries. The next step is the +dlopen() one which will make possible to link devices without any +recompilation. @@ -74,13 +75,13 @@ Ng-spice-rework-6 (29 Jan 2000) This porting includes: -1) BSIM3V3.1 model as level 49. This is the version modified by Serban Popescu - which understands the M parameter and implements HDIF. +1) BSIM3V3.1 model as level 49. This is the version modified by Serban +Popescu which understands the M parameter and implements HDIF. 2) BSIM3V3.2 model al Level 50. This is the standard Berkeley version. -3) Now the resistor model can accepts two differents values for DC and AC - resistance. +3) Now the resistor model can accepts two differents values for DC and +AC resistance. @@ -94,11 +95,11 @@ Ng-spice-rework-4 (22/12/99) This porting includes a new feature: -1) dynamically loading of some device code as an experimental feature for - the future GPL simulator. Thanks to Arno Peters and Manu Rouat. +1) dynamically loading of some device code as an experimental feature +for the future GPL simulator. Thanks to Arno Peters and Manu Rouat. -2) Patched the following bug (thanks to Andrew Tuckey for having supplied the - patch). +2) Patched the following bug (thanks to Andrew Tuckey for having +supplied the patch). * Wsw (current controlled switch) in subckt, parsing bug. * scale factor in arbitrary source. diff --git a/NOTES b/NOTES new file mode 100644 index 000000000..3851bcae1 --- /dev/null +++ b/NOTES @@ -0,0 +1,69 @@ +DEBUGGING SPICE + +To avoid a segmentation fault in the initial run, use the following +command in gdb: + + setenv SPICE_NO_DATASEG_CHECK "1" + +Or, the comparable command in your shell before running gdb. This +disable accurate tracking of how much memory is used. + +---------------------------------------------------------------------- +USING A GARBAGE COLLECTOR + +Get the Boehm-Weiser conservative garbage collector at the following +address: + + http://www.hpl.hp.com/personal/Hans_Boehm/gc/ + +Compile it with 'make liblinuxgc.so' and install libgc.so and gc.h +where the compiler can find them (i.e., /usr/local/lib and +/usr/local/include). Run configure and compile. + + +---------------------------------------------------------------------- +CREATING PATCHES + +If you don't have access to anonymous CVS: + + # extract the differences + $ diff -ruN ng-spice-rework-x ng-spice > my.patch + +where ng-spice-rework-x is the snapshot you used to base your changes +on. + +If you do have access to anonymous CVS: + + $ cvs diff -u > my.patch + +Note: this only works if you haven't added any files. Otherwise, the +first method is better. + +Now, send your patch to ng-spice mailing list. + + +---------------------------------------------------------------------- +INCORPORATING PATCHES + + # apply the patch + $ patch -p1 < my.patch + + # update the automatically generated files + $ sh autogen.sh + +---------------------------------------------------------------------- +INCOMPATIBILITIES BETWEEN SPICE3 AND SPICE2 + +The output format of spice3 is slightly different for .print and .plot +lines. Most notably, different traces on plots are not scaled +independently. This is most noticeable on phase/magnitude plots from +an AC analysis (also, phase is displayed in radians). Finally, +frequency for ".PRINT AC" lines is displayed as a complex quantity +with an all-zero imaginary component. + +For input, "POLY( )" sources are not supported (the non-linear +dependent source provides a more general replacement). Also, the +".ALTER" line is not supported. The Spice3 parser may be slightly +different on subtle points of reading input (lines need not start at +column 1 for instance). + diff --git a/TODO b/TODO index 9264ed01b..f238935b1 100644 --- a/TODO +++ b/TODO @@ -40,9 +40,8 @@ or another memory checker to find them. Could also try a garbage collector (http://www.hpl.hp.com/personal/Hans_Boehm/gc/) to circumvent memory leaks. -Either get help program functioning again; OR interface to webbrowser, -info reader and get rid of all help-related code. Option 2 is the -most appealing. +Substitute help interface by call to webbrowser or info reader and get +rid of all help-related code. Refactorings @@ -101,14 +100,6 @@ Add more circuit tests into the tests directory. Use gcov to measure current test coverage (and to find out where more tests are needed.) Make this a configure switch. -Let GCC generate even more warnings on dubious construction by -specifying the following compile switches: -pedantic -W --Wmissing-prototypes -Wstrict-prototypes -Wtraditional -Wconversion --Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings --Waggregate-return -fshort-enums -fno-common -Wnested-externs --Dinline= -g -O4. Use 'configure --enable-smoketest' to use these -compile switches. Our goal is to remove all warnings. - Documentation ------------- diff --git a/acconfig.h b/acconfig.h index 48a739cf5..69b5b6b10 100644 --- a/acconfig.h +++ b/acconfig.h @@ -8,6 +8,9 @@ /* Define the build date */ #define NGSPICEBUILDDATE none +/* Define if we want garbage collection enabled */ +#undef HAVE_LIBGC + /* Define if we have termcap */ #undef HAVE_TERMCAP diff --git a/configure.in b/configure.in index 4c1974624..8b25e7ac8 100644 --- a/configure.in +++ b/configure.in @@ -160,6 +160,9 @@ dnl Check for a few mathematical functions: AC_CHECK_FUNCS(erfc logb scalb scalbn asinh acosh atanh) +AC_CHECK_LIB(gc,GC_malloc,AC_DEFINE(HAVE_LIBGC) LIBS="$LIBS -lgc") + + # Expand the prefix variable (this is really annoying!) if eval "test x$prefix = xNONE"; then dprefix=$ac_default_prefix diff --git a/notes/Linux.changes b/notes/Linux.changes deleted file mode 100644 index fd4d1329d..000000000 --- a/notes/Linux.changes +++ /dev/null @@ -1,164 +0,0 @@ -So, this is third version of Spice3f5 for RedHat Linux 2.6. I took re-ported -version of spice3f5 and made changes to fix some bugs. If someone want to help, -please send me "newer" versions wtih more bugs fixed. -I hope that those who wnat to have good spice under Linux (no more Win95) -will find this port useful and maybe help each other to improve it. - -There was a lot of bugs in previus versions, generally in command parsiong routines. -I copy all original files to *.orig and marked all my changes with /* MW. ... */ - -I changed cp/bquote.c and cp/var2.c to handle some special situations -and commands like $foo, `foo`. Also problems with 'gets()' (in sconvert and -inp.c) function are fixed. I chnaget it to fgets(buf, BSIZE_SP, stdin) for -safe use. - -Globing ('[]{}?*') didn't work at all. Now it is removed (form cp/glob.c). -We don't need this features in spice. - -Initial command parsing (cp_lexer() from cp/lexical.c) strip all commas from -strings. This was in conflict with aritchetic expressions. - -com_let() in fte/postcoms.c caused core dump in some situations - fixed. - -Editor problems. Com_edit() in fte/inp.c failed occasionally, when it -tryies to fclose() fp second time. Now inp_spsource() always closes fp, and -other calling functions do not. It seems to work right now. - -vec_get() (fte/vectors.c) has some problems with devices parameters and -memory leaks. I hope that my changes fixed it at all. - -I have to add INPinsertNofree() in inp/inpsymt.c. This is special case for -routines from fte/spiceif.c and fte/outitf.c - It does not do free() for -any pointers that it gets. This may cause small memory leaks, but I don't -know how to make it better. - -com_alter_common() (fte/device.c) caused segmentation faults ocassionally, -due to double free the same pointers. It works right now. - -cp_lexer() corretly gets ^V, ^D, and ESC. I have to #include ioctl.h file in -cp/lexical.c and cp/complete.c - -There were problem with com_iplot() if it was called when X11 does not run. -I have to add additonal check to gr_pmsg() (from fte/graph.c) and now it -works fine. - -Trace failed to display comlex data due to segmentation fault. Someone wants -to plot realdata even if given vector was complex. I changed gr_iplot() -(in fte/graf.c) and now it is fine. - -There are some changes in os_linux.h and os_unix.h, but they are not mandatory, -I think. Also I have to add PI, and some other const. declarations in spice.h -They were needed somewhere. (why someone didn't used M_PI and so on instead ?) - -In file fte/x11.c, was a prloblem with background color for plot windows. I -changed init_colors() and now we can use color0 variable. - -Spice3f5 has a few memory leaks. I suppose that some vectors and maybe other -things are simple 'lost' somewhere. If you (just like me) trying to make this -program better, take care about this also. -Generally I didn't do much with graphisc interface, because it seems to work -quite good. Only problem is core dump, when cliking mouse on help screen. - -Manuals are sometimes in error. Vector creation by [ el. el. ...] is not -supported I think. For indexing we must use [low , hi]. For setting 'list' -variables - ( el. el. ... ). Indexing also doesn't work with let xx[...] = yy. - -Someone should change these f... manuals. - - -And now for those who think about makeing this program better. There is a big -problem with memory, when you run a few simulations. Destroy commad does not -free much memory, and after some time you can see that spice uses 3MB, when -you just clean all vectros. Also I don't know how to unload a circuit - -spice hold all sourced files in the "deck" list and there is no way to free -it from command line (or maybe I didn't find any). - Unfortunatelly I am sure that these are not all off the problems -with this program, but now I can use it quite effectively. If anyone will -know anything about bugs-free, good, commannd driven simulator for Linux -__PLEASE__ let me know. - -For easer use I made special debug file (conf/debug). I used it for makeing -"debug" version of spice with efence library and -g option. Executable files -from this are located in spice3f5/objdbg/bin, when you do 'util/build linux debug'. - -I am an electronic designer, so I really need a good working simulator... - -Original readme file is given below. - - Michael Widlok (widlok@uci.agh.edu.pl) - Uniersity of Mining and Metallurgy - Krakow, Poland. - - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This is my (re-)port of Spice3f4 to Linux version 2 (I am not the same -person who ported it before). It also wraps in the latest official -pre-3f5 patches from Berkeley I could find (found in -sp3f4.patch.tar.Z). Support for the MFB interface using the Linux -termcap library and some various Linux features have been ported. - -This was not done for the hell of it, but it seemed that something -broke due to some Linux/system/library changes, so I decided to try -porting it from scratch. In fact, if you don't have any problems with -the previous port, your probably fine then. However, if you do have -problems (e.g. exiting Spice leaves you in uppercase mode), or want -MFB for some reason, then try this. It seems to work here. - -Basically, I started out with sp3f4.kit.tar.Z. Then, I applied the -most recent patches contained in sp3f4.patch.tar.Z and wrote new Linux -build files: "linux" and "os_linux.h" (some minor mods to the source -were also necessary, protected with linux conditionals). - -Since the previous spice3f4.tar.gz port file was generally available, -there was no point in duplicating source, so I just diffed from the -spice3f4.tar.gz tree to freshly ported tree and edited or removed a -few of the diffs. A few of the changes made in spice3f4.tar.gz have -been reverted to the distribution defaults, but one notable change is -that performing the install step will install the necessary files into -/usr/local/spice. You'll need to add /usr/local/spice/bin to your -shell path. See the file conf/linux to change the installation -location (this location gets hard-coded in the spice binaries). - -This is a patched file of the original readme.Linux from -spice3f4.tar.gz, and the previous contents by Jeff@EE.Ryerson.Ca is -given below. Just follow the below instructions, so you should be -able to safely do: - - ./util/build linux - ./util/build linux install - -You should then find the spice binaries and library files -in e.g. /usr/local/spice. Example files and the man pages -are not installed, so you might want to copy them by hand. - -Andrew Veliath (veliaa@rpi.edu) -January 25, 1997 - -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This is my port of Spice3f4 to Linux. It required a few more changes -than the porting document indicated would be necessary, mostly to do -with supported/unsupported functions in Linux libc & libm. - -I've tried to make these changes in as as portable a way as possible, -so it should build cleanly on other Unicies, however I've removed the -MS-DOS support so the tarred and gziped source fits on one disk. - -To build spice3, first have a look in the file readme, but you should -be able to just do... - -./util/build linux -./util/build install linux - -Note that there is a modifyer "gcc" you can try if you have trouble, but -it claims to work around some obscure bug in gcc that I'm positive got -fixed eons ago. To use it anyway, do ./util/build linux gcc. - -I found this source through archie, (look for spice3f3.tar.Z, and then -patched it to 3f4 with patches from ic.berkeley.edu), I assume that the -ftp site I got it from has read thier license from Berkeley, which if -it's the same as the 3e2 license states that the holder can distribute -copies free of charge provided it does not fall into hands unfriendly -to the U.S. So... I guess if that's you, please destroy all copies of this -you might have! - -Jeff@EE.Ryerson.Ca diff --git a/notes/dbx b/notes/dbx deleted file mode 100644 index c7c54c170..000000000 --- a/notes/dbx +++ /dev/null @@ -1,7 +0,0 @@ -A note when using dbx (under unix-type operating systems) to debug spice3: - -To avoid a segmentation fault in the initial run, use the following command -in dbx: - setenv SPICE_NO_DATASEG_CHECK "1" -Or, the comparable command in your shell before running dbx. This -disable accurate tracking of how much memory is used. diff --git a/notes/internal b/notes/internal deleted file mode 100644 index a6bf6666c..000000000 --- a/notes/internal +++ /dev/null @@ -1,98 +0,0 @@ -Internal Changes from 3e2 - - The device structure has changed: The state counter in all device - structures has been moved to correspond to GENstates in the - GENinstance structure. - - Also, a new per-device-type function has been added: XXXunsetup, - which deallocates nodes and other resources created in the - XXXsetup function. ("XXX" is the device abbreviation.) - -Internal Changes from 3d2 - -FILE NAMES: - - Of the changes to spice3 between 3d2 and 3e1, the - the most obvious is the new filenames. All filesnames - have been converted to lowercase and are at most eight - characters plus an optional dot and three character extension. - This change was made to accomodate MS-DOS and other operating - systems which limit the maximum file name length. - - -ORGANIZATION - - The top level directory contains the installation "readme" file - and a "makedefs" files used by the "build" command. - - "src/" contains all of the C source code. This used to be named - "spice3" or "spice3d2" in previous releases. - - "src/lib" is the library or "toolkit" portion of Spice3. Within - it are the following subdirectories: - - ckt/ All of the analysis code. - ni/ Numerical algorithms (used by ckt routines). - sparse/ Sparse matrix package (used by ckt and ni). - misc/ Miscellaneous utility and portability routines. - dev/ All of the device specific code, with a subdir for - each device implementation. - - inp/ Input parsing; could be much smaller. - - fte/ The front end. Really bad. - cp/ More front end -- "C shell". - hlp/ The windowed help system. - - mfb/ Terminal independant graphics package. - mfbpc/ MFB interface for the IBM PC. - - - "src/bin" contains the source for all executable programs (the - location for "main( )"). "main.c" is used by spice, nutmeg, - bspice, and cspice (the latter two for MS-DOS). The function - of "main.c" is altered by defining the pre-processor symbols - SIMULATOR (for either spice, bspice, or cspice), BATCH for - bspice, and BATCH and SPICE2 for cspice (no special defines - give nutmeg). Each variant of the simulator uses "conf.c" (or - "bconf.c" or "cconf.c", or "nconf.c" for nutmeg), which is - automatically generated from "config.c". "config.c" is a - template used to select devices and analyses. "tune.c" - ("tunepc.c") contains the compiled in pathnames. - - - "examples/" contains several spice input files. - - "lib/" contains standard data files for spice, such as the help - files and MFB capability files. - - "man/" contains UNIX style manual pages (ala "man(1)"). - - "util/" contains utility scripts, such as "build" for running the - recursive "make" and "delall.bat" for deleting the distribution on - MS-DOS systems. - - All "Makefile"s have been replaced with "makedefs" (and optionally - "depend" and "makeops"). "makedefs" is combined with other - make definition files with the "build" script. - -SOURCE LEVEL CHANGES - - (Added features are listed in the "README" file). - - DEVICES: The interface to devices has, once again, changed. - The change is small from 3d2. Table size values in the device - information struction are now pointers to integers containing - the table sizes. Per-analyses functions have been surrounded - with "#ifdef AN_xx"/"#else"/"#endif" lines. Note that the - "itf.h" files are stored only in the "include/" subdirectory. - - Adding devices to the master list is done in the file - "src/bin/config.c", instead of "FTE/SPIinit.c". - - SPARSE MATRIX PACKAGE: the sparse matrix package in Spice3e1 - and later is a more efficient implementation than in earlier releases. - The interface is the same. - - - diff --git a/notes/mac_port b/notes/mac_port deleted file mode 100644 index 921723936..000000000 --- a/notes/mac_port +++ /dev/null @@ -1,207 +0,0 @@ - - - Compiling spice with Think C on a Macintosh. - -A 68020 (Mac II) with co-processor is required. - -The src directory from the spice distribution should be moved into -the C folder. - -**** recompile think c libraries **** - - Both the ANSI and unix libraries must be recompiled with the - following additional compiler settings: - Generate 68020 instructions - Generate 68881 instructions - 4-bytes ints - Native floating-point format - - The "console.c" file must be edited and should be removed from - the ANSI project. I actually recompiled copies of the ANSI and - unix libraries that I called ANSI.68881 and unix.68881. - Copy the "console.c" source (a THINK C file) to a suitable - location so that it can be included in the spice project. (See - the next section for details of how "consol.c" must be modified.) - - -**** creating the project **** - - Create a new project and set the Options as follows: - Laguage Settings - Turn on the following options - Define #__STDC__ - Recognize trigraphs - enums are always ints - Check pointer types - Language Extension - THINK C - Compiler Settings - Turn on the following options - Generate 68020 instructions - Generate 68881 instructions - 4-bytes ints - Native floating-point format - Code Optimization - Turn on all options - Prefix - make sure there is no prefix (remove - default #include ) - - Note: The Language setting 'Strict Prototype Enforcement' must be - turned off. - - Set the project type to application with at least 1024k partition - and turn on the 'Far DATA' option. - -*** Adding the code to the project *** - - Start Adding the code to the project. The code must be divided - into segments that are less that 32K each when compiled. The - following division has been used: - - Segment 1: the ANSI.68881 and unix.68881 libraries. - Segment 2: all *.c files in /src/sparse - Segment 3: all *.c files in /src/lib/ni - Segment 4: all *.c files in /src/lib/misc - Segment 5: files /src/lib/inp/inp2dot.c - and /src/lib/inp/inptree.c - Segment 6: all other *.c files in /src/inp - Segment 7: all *.c files in /src/lib/hlp - Segment 8: all *.c files in /src/lib/cp - except /src/lib/cp/input.c - Segment 9: file /src/lib/ckt/dloadfns.c - Segment 10: files /src/lib/ckt/cktpzstr.c, - /src/lib/ckt/cktsens.c, /src/lib/ckt/dctran.c, - and /src/lib/ckt/distoan.c - Segment 11: all other *.c files in /src/lib/ckt - Segment 12: cmath*.c files in /src/lib/fte - Segment 13: files agraf.c, clip.c, display.c, graf.c, - graphdb.c, plot5.c, plotcurv.c and - postsc.c in /src/lib/fte - - Segment 14: files evaluate.c, parse.c, postcoms.c, - and subckt.c in /src/lib/fte - Segment 15: files breakp.c, device.c, doplot.c, - grid.c and shyu.c in /src/lib/fte - Segment 16: files dotcards.c, inp.c, outif.c, rawfile.c, - spiceif.c and vectors.c in /src/lib/fte - Segment 17: all other *.c files in /src/lib/fte - except nutmegif.c - Segment 18: all *.c files in /src/lib/fte/vsrc - and /src/lib/fte/isrc - Segment 19: all *.c files in /src/lib/fte/jfet - Segment 20: all *.c files in /src/lib/fte/vccs, - /src/lib/fte/vcvs, /src/lib/fte/cccs, - and /src/lib/fte/ccvs - Segment 21: all *.c files in /src/lib/fte/asrc - and /src/lib/fte/urc - Segment 22: all *.c files in /src/lib/fte/cap, - /src/lib/fte/ind, and /src/lib/fte/res - Segment 23: all *.c files in /src/lib/fte/csw, - /src/lib/fte/sw, and /src/lib/fte/tra - Segment 24: all *.c files in /src/lib/fte/mos6 - Segment 25: all *.c files in /src/lib/fte/mes - Segment 26: all *.c files in /src/lib/fte/ltra - Segment 27: file mos3load.c in /src/lib/fte/mos3 - Segment 28: files mos3dist.c, mos3dset.c, - and mos3sld.c in /src/lib/fte/mos3 - Segment 29: remaining *.c files in /src/lib/fte/mos3 - Segment 30: all *.c files in /src/lib/fte/dio - Segment 31: file mos1load.c in /src/lib/fte/mos1 - Segment 32: files mos1dist.c, mos1dset.c, - and mos1sld.c in /src/lib/fte/mos1 - Segment 33: remaining *.c files in /src/lib/fte/mos1 - Segment 34: file bjtload.c in /src/lib/fte/bjt - Segment 35: files bjtdisto.c, bjtdset.c, - and bjtsload.c in /src/lib/fte/bjt - Segment 36: remaining *.c files in /src/lib/fte/bjt - Segment 37: file mos2load.c in /src/lib/fte/mos2 - Segment 38: file mos2dset.c in /src/lib/fte/mos2 - Segment 39: files mos2dist.c, and mos2sld.c - in /src/lib/fte/mos2 - Segment 40: remaining *.c files in /src/lib/fte/mos2 - Segment 41: files b1dset.c, and b1ld.c in /src/lib/fte/bsim1 - Segment 42: files b1disto.c, and b1eval.c in /src/lib/fte/bsim1 - Segment 43: remaining *.c files in /src/lib/fte/bsim1 - Segment 44: files b2eval.c, and b2ld.c in /src/lib/fte/bsim2 - Segment 45: remaining *.c files in /src/lib/fte/bsim2 - Segment 46: all *.c files in /src/lib/dev/disto, - and devsup.c in /src/lib/dev - Segment 47 all *.c files in /src/lib/mac, - and file /src/bin/main.c - - Note that the following files are not included: - /src/lib/cp/input.c - /src/lib/fte/nutmegif.c - - Add "console.c" (the copy made as described above) and make the - following alterations to it: - 1. The lines: - static char console_environment, noPrint, interrupted; - static short console_refnum; - static MenuHandle appleMenu; - static WindowPeek theConsole; - - must be changed to make console_environment and - appleMenu external: - extern char console_environment, noPrint, interrupted; - static char noPrint, interrupted; - static short console_refnum; - extern MenuHandle appleMenu; - static WindowPeek theConsole; - - 2. Alter the function ProcessEvent() to add a default switch - case. The altered section appears following a doEvent label as - (note: this code fragment has 4-space tabs and long lines - broken to fit an 80-column page; these changes do not affect - the code): - - doEvent: - if (event.what == mouseDown) { - switch (FindWindow(event.where, &wp)) { - case inMenuBar: - InitCursor(); - choice = MenuSelect(event.where); - goto doMenu; - case inSysWindow: - SystemClick(&event, wp); - break; - default: /* For spice to pass mouse - events to graphs */ - if ((WindowPtr) wp != FrontWindow()) { - SelectWindow(wp); - in.cnt = 0; - } /* in.cnt=0 forces console to - return to application */ - } - } - - - - - - Compilation takes about 3 to 4 hours on a 25MHz mac. Set the cache - to at least 256k to eliminate a lot of disk access. - -**** makeindx **** - Create a project with the same option settings decribed above. - - Add src/bin/makeidx.c, ANSI.68881 and an unmodified version of - "console.c". - - Build the makeindex application. - - Move the application into lib/helpdir directory of the the spice - distribution. Run it and add the names of the files to be indexed - (nutmeg.txt spice.txt) to the command line and hit return. - -**** proc2mod **** - - Create a project with the same option settings decribed above. - - Add src/bin/proc2mod.c, src/lib/misc/alloc.c, src/lib/misc/string.c - src/lib/inp/inpcfix.c, src/lib/inp/inpeval.c, - src/lib/inp/inpgtok.c, ANSI.68881 and an unmodified - version of console.c. - - Build the proc2mod application. diff --git a/notes/porting b/notes/porting deleted file mode 100644 index 7ef93a409..000000000 --- a/notes/porting +++ /dev/null @@ -1,237 +0,0 @@ -(ER - 7/08/99) - -These are a few notes on the autoconf porting that is being done. - -Autoconf automaticcaly provides #defines (in config.h) that describe -the system that ng-spice is being compiled on. Thus, all the os_xxx.h -files should no longer be necessary. - - -Here is a (as complete as possible) list of new #defines and their -corresponding #defines in the old build system: - - - - -#define HAS_VAX_FPERRORS - unused (should remove the code) -#define MAXPOSINT 4294967295 - don't know about that one -#define MAX_EXP_ARG 87.0 - same - ----------- Operating System (os_xxx.h) parameters: - ------ Enabling flags -#define AVAIL_MFB -DWANT_MFB passed to cpp -#define AVAIL_X11 X_DISPLAY_MISSING (reversed) - ------ String or character constants -#define DIR_CWD "." now in spice.h -#define DIR_PATHSEP "/" now in spice;h -#define DIR_TERM '/' now in spice.h - -On Unix, I don't think that there are other possibilities. -We should get rid of those. - - ------ sprintf( ) format strings -#define TEMPFORMAT "/tmp/%s%d" /* sprintf format for creating temp files */ -#define SYSTEM_MAIL "mail -s \"%s (%s) Bug Report\" %s" /* mail command */ -#define SYSTEM_PLOT5LPR "lpr -P%s -g %s" /* For printing Unix plot(5) files */ -#define SYSTEM_PSLPR "lpr -P%s %s" /* For printing postscript files */ - - -Same for these I guess... - - - ------ System capabilities -#define HAS_ACCESS HAVE_ACCES -#define HAS_ASCII not handled yet -#define HAS_ATRIGH HAVE_ATANH HAVE_ACOSH HAVE_ASINH -#define HAS_BCOPY HAVE_BCOPY -#define HAS_BSDDIRS HAVE_DIR_H -#define HAS_BSDRANDOM unused -#define HAS_BSDRLIMIT HAVE_GETRLIMIT -#define HAS_BSDRUSAGE HAVE_GETRUSAGE -#define HAS_BSDSOCKETS unused -#define HAS_BSDTIME HAVE_GETTIMEOFDAY -#define HAS_BSDTTY HAVE_SGTTY_H -#define HAS_CHDIR removed -#define HAS_CLEARERR removed -#define HAS_CTYPE HAVE_CTYPE_H -#define HAS_DOSDIRS dos only - should remove code -#define HAS_DUP2 HAVE_DUP2 -#define HAS_ENVIRON removed -#define HAS_EXIT1 vms only - should remove the code -#define HAS_FCNTL HAVE_FCNTL_H -#define HAS_FTIME HAVE_FTIME -#define HAS_GETCWD HAVE_GETCWD -#define HAS_GETPID removed -#define HAS_GETPW HAVE_PWD_H -#define HAS_GETWD HAVE_GETWD -#define HAS_INDEX HAVE_INDEX -#define HAS_NO_IEEE_LOGB HAVE_LOGB HAVE_SCALB HAVE_SCALBN -#define HAS_NO_IEEE_LOGB_DECL removed -#define HAS_ISATTY HAVE_ISATTY -#define HAS_LONGJUMP removed -#define HAS_MINDATA dos only? - should remove code if so -#define HAS_NOINLINE dos only? - should remove code if so -#define HAS_NOVM dos only? - should remove code if so -#define HAS_NO_ATRIGH_DECL removed -#define HAS_PCTERM dos only - should remove code -#define HAS_POPEN HAVE_POPEN -#define HAS_QSORT HAVE_QSORT -#define HAS_SHORTMACRO dos only - should remove code -#define HAS_STAT STAT_MACROS_BROKEN (reversed) -#define HAS_STDLIB STDC_HEADERS -#define HAS_STRCHR HAVE_STRCHR -#define HAS_STRINGS STDC_HEADERS (reversed) not sure about that one! -#define HAS_SYSTEM removed -#define HAS_SYSVDIRS HAVE_DIRENT_H -#define HAS_SYSVRLIMIT HAVE_ULIMIT -#define HAS_SYSVRUSAGE HAVE_UTIME -#define HAS_SYSVTIME HAVE_TIME -#define HAS_SYSVTTY HAVE_TERMIO_H -#define HAS_TERMCAP HAVE_TERMCAP -#define HAS_TERMREAD don't know what to do with this one -#define HAS_UNIX_SIGS removed -#define HAS_UNLINK removed -#define HAS_VFORK HAVE_VFORK_H -#define HAS_VMSHACK vms only - should remove the code -#define HAS_VPERROR removed -#define HAS_WAIT HAVE_WAIT - -plus a few others: - -#define HAS_MEMAVL dos only - should remove code -#define HAS_FLAT_INCLUDES macos only - should remove code -#define HAS_BATCHSIM dos only - should remove code - - - ----------------------------------------------------------------------------- - -PORTING SPICE3e1 - - Porting Spice3 to a new operating system usually consists of listing - the capabilities of that operating system in a new '.h' file and - including this '.h' file in the standard portability sequence. This - also needs to be done separately for the numerical capabilities of the - system hardware (this consist of only two parameters at present). - - For each operating system there is a file in the "include/" directory - named "os_xxx.h", where xxx identifies the given operating system (ex. - "os_bsd.h", "os_aix.h"). These files are selectively #include-d by - "include/port.h". For a new operating system, you should add the - appropriate "#include" line to "include/port.h". Be sure to guard - the new "#include" line with "#ifdef/#endif", as is done with the other - operating system capability files. The same may also need to be done - for your hardware (for the file "hw_xxx.h"), though there is typically - very little difference in hardware. - - Note that operating system which are a derivative of another supported - system can '#include' the "os_xxx.h" file from the other system. For - example, "os_aix.h" includes "os_sysv.h", which in turn includes - "os_unix.h". - - The entries that can go into a "os_xxx.h" file are described below; - most are simple flags (e.g. HAS_xxxx). To turn on a flag, insert the - "#define" line for that flag; to turn off the flag, simply leave the - "#define" line out. Other entries are strings, others single-quoted - characters or numbers. Be sure to use the same type as the example - values shown. - - There are always exceptions to the rule. Some incompatibilities - have not yet been dealt with cleanly; review the other "os_xxx.h" - files, the file "capabil.h", and the file "suffix.h" to understand - how some problems have been handled (note especially the lines like - "#define index strchr"). After trying to compile, you may yet find - non-portable code that is not guarded by one of the following - options. You are encouraged to alter the source code (".c" or ".h" - files) in the style of the current portability scheme. - - Note: to enable X11 or MFB, the flag AVAIL_X11 or AVAIL_MFB, - respectively, must be included in the "os_xxx.h" file; this _was_ to - simplify the problems of forgetting to re-edit the "config.h" file, - but this is no longer necessary. - ----------- Machine architecture numerics (hw_xxx.h) parameters: - (In the future this will be more complete and will be used for - tuning the accuracy or performance of the numerical algorithms) - -#define HAS_VAX_FPERRORS /* Only for Vax */ -#define MAXPOSINT 4294967295 /* == 2^32 - 1, maximum positive integer */ -#define MAX_EXP_ARG 87.0 /* Approximate largest arg to exp() */ - ----------- Operating System (os_xxx.h) parameters: - ------ Enabling flags -#define AVAIL_MFB /* If the MFB package can work on this system */ -#define AVAIL_X11 /* If the X11 Window System can work */ - ------ String or character constants -#define DIR_CWD "." /* Current working directory */ -#define DIR_PATHSEP "/" /* subdirectory separator */ -#define DIR_TERM '/' /* Subdirectory component terminator */ - ------ sprintf( ) format strings -#define TEMPFORMAT "/tmp/%s%d" /* sprintf format for creating temp files */ -#define SYSTEM_MAIL "mail -s \"%s (%s) Bug Report\" %s" /* mail command */ -#define SYSTEM_PLOT5LPR "lpr -P%s -g %s" /* For printing Unix plot(5) files */ -#define SYSTEM_PSLPR "lpr -P%s %s" /* For printing postscript files */ - ------ System capabilities -#define HAS_ACCESS /* access( ) */ -#define HAS_ASCII /* eighth bit of a character is not used */ -#define HAS_ATRIGH /* acosh( ), asinh( ), atanh( ) */ -#define HAS_BCOPY /* bcopy( ), bzero( ) */ -#define HAS_BSDDIRS /* */ -#define HAS_BSDRANDOM /* srandom( ) and random( ) */ -#define HAS_BSDRLIMIT /* getrlimit( ) returns proc limits */ -#define HAS_BSDRUSAGE /* getrusage( ) returns cpu usage */ -#define HAS_BSDSOCKETS /* , socket( ), etc. */ -#define HAS_BSDTIME /* gettimeofday( ) return time */ -#define HAS_BSDTTY /* */ -#define HAS_CHDIR /* for tree filesystems, chdir( ) */ -#define HAS_CLEARERR /* clearerr( ), should be in stdio */ -#define HAS_CTYPE /* , iswhite( ), etc. */ -#define HAS_DOSDIRS /* Emulate opendir, etc. */ -#define HAS_DUP2 /* dup2(a, b) for shifting file descrs. */ -#define HAS_ENVIRON /* getenv( ) */ -#define HAS_EXIT1 /* If exit status of 1 is normal for procs */ -#define HAS_FCNTL /* acosh( ), asinh( ), atanh( ) */ -#define HAS_FTIME /* ftime( ), */ -#define HAS_GETCWD /* getcwd(buf, size) */ -#define HAS_GETPID /* getpid( ) to identify processes */ -#define HAS_GETPW /* getpwuid( ), etc. */ -#define HAS_GETWD /* getwd(buf) */ -#define HAS_INDEX /* index( ) instead of strchr( ) */ -#define HAS_NO_IEEE_LOGB /* no logb( ) and scalb( ) functions */ -#define HAS_NO_IEEE_LOGB_DECL /* logb( ) and scalb( ) not in math.h */ -#define HAS_ISATTY /* isatty( ) */ -#define HAS_LONGJUMP /* setjmp( ), longjmp( ) */ -#define HAS_MINDATA /* Machine has limited data area */ -#define HAS_NOINLINE /* Machine has limited data area */ -#define HAS_NOVM /* Machine has limited data area */ -#define HAS_NO_ATRIGH_DECL /* if asinh( ) is not in math.h */ -#define HAS_PCTERM /* For MS-DOS, use PC graphics for MFB */ -#define HAS_POPEN /* popen( ), pipe through shell command */ -#define HAS_QSORT /* qsort( ) exists */ -#define HAS_SHORTMACRO /* If the compiler can't handle long macros */ -#define HAS_STAT /* stat( ) returns info on files */ -#define HAS_STDLIB /* #include for libc defs */ -#define HAS_STRCHR /* strchr( ) instead of index( ) */ -#define HAS_STRINGS /* #include (else ) */ -#define HAS_SYSTEM /* system( ), execute system command */ -#define HAS_SYSVDIRS /* */ -#define HAS_SYSVRLIMIT /* ulimit( ) reports on proc size limit */ -#define HAS_SYSVRUSAGE /* utimes( ) reports on cpu usage */ -#define HAS_SYSVTIME /* time( ) returns seconds from 1970 */ -#define HAS_SYSVTTY /* */ -#define HAS_TERMCAP /* tgetxxx( ) */ -#define HAS_TERMREAD /* Has "read" syscall from terminals */ -#define HAS_UNIX_SIGS /* signal( ), kill( ) */ -#define HAS_UNLINK /* unlink( ), for removing files */ -#define HAS_VFORK /* BSD-ism, should not be necessary */ -#define HAS_VMSHACK /* Stand on your head for VMS */ -#define HAS_VPERROR /* perror( ) defined by standard '.h's */ -#define HAS_WAIT /* wait( ) wait for processes */ diff --git a/notes/spice2 b/notes/spice2 deleted file mode 100644 index 0e239036e..000000000 --- a/notes/spice2 +++ /dev/null @@ -1,15 +0,0 @@ - - Incompatibilities between spice3 and spice2 - -The output format of spice3 is slightly different for .print and .plot lines. -Most notably, different traces on plots are not scaled independently. This -is most noticeable on phase/magnitude plots from an AC analysis (also, -phase is displayed in radians). Finally, frequency for ".PRINT AC" lines -is displayed as a complex quantity with an all-zero imaginary component. - -For input, "POLY( )" sources are not supported (the non-linear dependent -source provides a more general replacement). Also, the ".ALTER" line -is not supported. The Spice3 parser may be slightly different -on subtle points of reading input (lines need not start at column 1 -for instance). - diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index fc2112c1d..ce6c394f8 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -57,7 +57,7 @@ readline(FILE *fd) } } if (!strlen) { - free(strptr); + tfree(strptr); return (NULL); } strptr[strlen] = '\0'; diff --git a/src/include/complex.h b/src/include/complex.h index 6c6d8b014..dc7b0a4e7 100644 --- a/src/include/complex.h +++ b/src/include/complex.h @@ -52,8 +52,6 @@ typedef struct /* Some defines used mainly in cmath.c. */ -#define alloc_c(len) ((complex *) tmalloc((len) * sizeof (complex))) -#define alloc_d(len) ((double *) tmalloc((len) * sizeof (double))) #define FTEcabs(d) (((d) < 0.0) ? - (d) : (d)) #define cph(c) (atan2(imagpart(c), (realpart(c)))) #define cmag(c) (sqrt(imagpart(c) * imagpart(c) + realpart(c) * realpart(c))) diff --git a/src/include/macros.h b/src/include/macros.h index e9a3796fe..7a203b986 100644 --- a/src/include/macros.h +++ b/src/include/macros.h @@ -21,13 +21,6 @@ 'a') && ((c) <= 'f')) ? ((c) - 'a' + 10) : ((((c) >= 'A') && \ ((c) <= 'F')) ? ((c) - 'A' + 10) : 0))) -#define tfree(x) (txfree(x), x = 0) -#define alloc(TYPE) ((TYPE *) tmalloc(sizeof(TYPE))) -#define MALLOC(x) tmalloc((unsigned)(x)) -#define FREE(x) {if (x) {txfree((char *)(x));(x) = 0;}} -#define REALLOC(x,y) trealloc((char *)(x),(unsigned)(y)) -#define ZERO(PTR,TYPE) (bzero((PTR),sizeof(TYPE))) - #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MAX(a,b) ((a) > (b) ? (a) : (b)) diff --git a/src/include/memory.h b/src/include/memory.h index 349aca18f..6b378277f 100644 --- a/src/include/memory.h +++ b/src/include/memory.h @@ -1,8 +1,26 @@ #ifndef _MEMORY_H #define _MEMORY_H +#ifndef HAVE_LIBGC extern void *tmalloc(size_t num); extern void *trealloc(void *str, size_t num); extern void txfree(void *ptr); +#define tfree(x) (txfree(x), x = 0) + +#else +#include + +#define tmalloc(m) GC_malloc(m) +#define trealloc(m,n) GC_realloc((m),(n)) +#define tfree(m) +#define txfree(m) +#endif + +#define alloc(TYPE) ((TYPE *) tmalloc(sizeof(TYPE))) +#define MALLOC(x) tmalloc((unsigned)(x)) +#define FREE(x) {if (x) {txfree((char *)(x));(x) = 0;}} +#define REALLOC(x,y) trealloc((char *)(x),(unsigned)(y)) +#define ZERO(PTR,TYPE) (bzero((PTR),sizeof(TYPE))) + #endif diff --git a/src/include/ngspice.h b/src/include/ngspice.h index e48dd9c5c..d29df380e 100644 --- a/src/include/ngspice.h +++ b/src/include/ngspice.h @@ -10,14 +10,15 @@ #define _GNU_SOURCE #include -#include -#include - - +#include +#include "memory.h" #include "defines.h" #include "macros.h" +#include +#include + #ifdef STDC_HEADERS # include @@ -99,12 +100,6 @@ struct timeb timebegin; #endif -/* Functions declarations from src/misc/[].c */ - -extern void *tmalloc(size_t num); -extern void *trealloc(void *str, size_t num); -extern void txfree(void *ptr); - extern char *gettok(char **s); extern void appendc(char *s, char c); extern int scannum(char *str); diff --git a/src/maths/cmaths/Makefile.am b/src/maths/cmaths/Makefile.am index bcc34d2cd..6d508387d 100644 --- a/src/maths/cmaths/Makefile.am +++ b/src/maths/cmaths/Makefile.am @@ -3,6 +3,7 @@ noinst_LIBRARIES = libcmaths.a libcmaths_a_SOURCES = \ + cmath.h \ cmath1.c \ cmath1.h \ cmath2.c \ diff --git a/src/maths/cmaths/cmath.h b/src/maths/cmaths/cmath.h new file mode 100644 index 000000000..fdecf1e9d --- /dev/null +++ b/src/maths/cmaths/cmath.h @@ -0,0 +1,7 @@ +#ifndef _CMATH_H +#define _CMATH_H + +#define alloc_c(len) ((complex *) tmalloc((len) * sizeof (complex))) +#define alloc_d(len) ((double *) tmalloc((len) * sizeof (double))) + +#endif diff --git a/src/maths/cmaths/cmath1.c b/src/maths/cmaths/cmath1.c index 48655adf2..d755d0bab 100644 --- a/src/maths/cmaths/cmath1.c +++ b/src/maths/cmaths/cmath1.c @@ -17,9 +17,11 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group */ #include +#include #include #include +#include "cmath.h" #include "cmath1.h" diff --git a/src/maths/cmaths/cmath2.c b/src/maths/cmaths/cmath2.c index 90911463a..18a3c7824 100644 --- a/src/maths/cmaths/cmath2.c +++ b/src/maths/cmaths/cmath2.c @@ -20,6 +20,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include #include +#include "cmath.h" #include "cmath2.h" static double * diff --git a/src/maths/cmaths/cmath3.c b/src/maths/cmaths/cmath3.c index 37e246e5c..7c6f8c4d1 100644 --- a/src/maths/cmaths/cmath3.c +++ b/src/maths/cmaths/cmath3.c @@ -19,6 +19,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include #include +#include "cmath.h" #include "cmath3.h" diff --git a/src/maths/cmaths/cmath4.c b/src/maths/cmaths/cmath4.c index 014138247..aca045e7b 100644 --- a/src/maths/cmaths/cmath4.c +++ b/src/maths/cmaths/cmath4.c @@ -19,13 +19,13 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include #include #include -//#include #include #include #include #include +#include "cmath.h" #include "cmath4.h" void * diff --git a/src/maths/cmaths/test_cx_j.c b/src/maths/cmaths/test_cx_j.c index e2c0a7adf..c84d606ad 100644 --- a/src/maths/cmaths/test_cx_j.c +++ b/src/maths/cmaths/test_cx_j.c @@ -1,9 +1,11 @@ #include +#include #include #include #include +#include "cmath.h" #include "cmath1.h" FILE *cp_err; diff --git a/src/maths/cmaths/test_cx_mag.c b/src/maths/cmaths/test_cx_mag.c index 8ee327c6c..16e19e297 100644 --- a/src/maths/cmaths/test_cx_mag.c +++ b/src/maths/cmaths/test_cx_mag.c @@ -1,9 +1,11 @@ #include +#include #include #include #include +#include "cmath.h" #include "cmath1.h" FILE *cp_err; diff --git a/src/maths/cmaths/test_cx_ph.c b/src/maths/cmaths/test_cx_ph.c index 95bd1e050..89efc5850 100644 --- a/src/maths/cmaths/test_cx_ph.c +++ b/src/maths/cmaths/test_cx_ph.c @@ -1,10 +1,12 @@ #include #include +#include #include #include #include +#include "cmath.h" #include "cmath1.h" FILE *cp_err; diff --git a/src/misc/alloc.c b/src/misc/alloc.c index 4cf7405ad..2895c2f1d 100644 --- a/src/misc/alloc.c +++ b/src/misc/alloc.c @@ -5,10 +5,12 @@ Copyright 1990 Regents of the University of California. All rights reserved. /* * Memory alloction functions */ +#include -#include "ngspice.h" +#ifndef HAVE_LIBGC +#include #include -#include "alloc.h" +#include /* Malloc num bytes and initialize to zero. Fatal error if the space can't @@ -114,3 +116,4 @@ txfree(void *ptr) free(ptr); } +#endif diff --git a/src/misc/alloc.h b/src/misc/alloc.h index 7a9a98386..1499dd45d 100644 --- a/src/misc/alloc.h +++ b/src/misc/alloc.h @@ -6,8 +6,10 @@ #ifndef ALLOC_H_INCLUDED #define ALLOC_H_INCLUDED +#ifndef WANT_GC void * tmalloc(size_t num); void * trealloc(void *ptr, size_t num); void txfree(void *ptr); +#endif #endif