Browse Source

Holger Vogt Windows port for Ngspice.

pre-master-46
pnenzi 25 years ago
parent
commit
937e3db647
  1. 16
      ChangeLog
  2. 49
      INSTALL
  3. 8
      acconfig.h
  4. 73
      configure.in
  5. 13
      src/ChangeLog
  6. 12
      src/Makefile.am
  7. 11
      src/conf.c
  8. 16
      src/frontend/ChangeLog
  9. 2
      src/frontend/Makefile.am
  10. 35
      src/frontend/display.c
  11. 3
      src/frontend/outitf.c
  12. 7
      src/frontend/parser/ChangeLog
  13. 14
      src/frontend/parser/complete.c
  14. 2
      src/frontend/parser/input.c
  15. 2
      src/frontend/parser/lexical.c
  16. 4
      src/frontend/plotting/ChangeLog
  17. 14
      src/frontend/plotting/graf.c
  18. 54
      src/frontend/rawfile.c
  19. 74
      src/frontend/resource.c
  20. 21
      src/frontend/runcoms.c
  21. 12
      src/include/ChangeLog
  22. 8
      src/include/complex.h
  23. 17
      src/include/defines.h
  24. 8
      src/include/ngspice.h
  25. 28
      src/main.c
  26. 3
      src/maths/cmaths/Makefile.am
  27. 3
      src/maths/cmaths/cmath1.c
  28. 1
      src/maths/cmaths/test_cx_ph.c
  29. 7
      src/spicelib/analysis/ChangeLog
  30. 30
      src/spicelib/analysis/acan.c
  31. 9
      src/spicelib/analysis/dctran.c
  32. 9
      src/spicelib/devices/ChangeLog
  33. 6
      src/spicelib/devices/bsim3v1/b3v1noi.c
  34. 6
      src/spicelib/devices/bsim3v2/b3v2noi.c
  35. 50
      src/spicelib/devices/dev.c

16
ChangeLog

@ -1,3 +1,19 @@
2002-01-03 Paolo Nenzi <p.nenzi@ieee.org>
* acconfig.h: added define needed for Windows and some aesthetic
rework (from Holger Vogt patch).
* configure.in: added macros to handle windows related
issues (Holger patch and me).
* INSTALL: added documentation on ngspice compilation under
Windows (Holger Vogt patch).
* Makefile.am: added Windows compilation code (Holger Vogt patch and
me).
2001-12-05 Emmanuel Rouat <emmanuel.rouat@wanadoo.fr> 2001-12-05 Emmanuel Rouat <emmanuel.rouat@wanadoo.fr>
* configure.in: removed (unnecessary) macros to handle GNU getopt * configure.in: removed (unnecessary) macros to handle GNU getopt

49
INSTALL

@ -151,3 +151,52 @@ operates.
script, and exit. script, and exit.
`configure' also accepts some other, not widely useful, options. `configure' also accepts some other, not widely useful, options.
NGSPICE COMPILATION UNDER WINDOWS OS
====================================
make ngspice with CYGWIN and external MINGW32
according to http://www.geocrawler.com/lists/3/SourceForge/6013/0/7321042/
$ cd ng-spice-rework-14
$ export PATH="/cygdrive/g/gcc_mingw/bin:$PATH"
$ autoconf
$ rm config.cache
$ ./configure --with-windows --prefix="/cygdrive/g/gcc_mingw/bin"
$ make clean
$ make 2> make.err
$ cp config.h config_ming.h
ngspice.exe is o.k.,but make tests does not work (cannot direct console
output into file). Needs to add .save "what" "where.test" to every input
(*.cir) file. Also all given output files have to be adapted to WINDOWS (CR/LF
instead of only LF at each line ending) for allowing proper comparison.
make ngspice with CYGWIN and internal MINGW32 (use config.h made above)
$ cd ng-spice-rework-14
$ rm config.cache
$ export CFLAGS="-mno-cygwin -g -O2"
$ export LDFLAGS="-L/lib/mingw"
$ export CPPFLAGS="-I/usr/include/mingw"
$ ./configure --with-windows
$ cp config_ming.h config.h
$ make clean
$ make 2> make.err
./configure does not work correctly: It finds headers and libs which are not
really available in the -mno-cygwin port of MINGW32. Therefore config.h is
not o.k.
ToDo: find appropriate presets for variables ?
rewrite tests for headers and libs (search exclusively in mingw
directories)

8
acconfig.h

@ -32,8 +32,14 @@
/* Undefine HAVE_EKV since it is not included in the standard distribution */ /* Undefine HAVE_EKV since it is not included in the standard distribution */
#undef HAVE_EKV #undef HAVE_EKV
/* Define if we have GNU readline */
/* Undefine HAVE_GNUREADLINE */
#undef HAVE_GNUREADLINE #undef HAVE_GNUREADLINE
/* We do not want spurios debug info into non-developer code */ /* We do not want spurios debug info into non-developer code */
#undef FTEDEBUG #undef FTEDEBUG
/* Generate MS WINDOWS executable */
#undef HAS_WINDOWS
/* get system memory and time */
#undef HAVE__MEMAVL

73
configure.in

@ -1,6 +1,9 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/main.c) AC_INIT(src/main.c)
dnl Keep old autoconf version, procedure is not compatible to new 2.5.2
AC_PREREQ(2.13)
dnl Create a configuration header dnl Create a configuration header
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
@ -57,6 +60,7 @@ AM_MAINTAINER_MODE
dnl Work on compiler options according to system: dnl Work on compiler options according to system:
dnl Set default CFLAG - only use -Wall if we have gcc dnl Set default CFLAG - only use -Wall if we have gcc
AC_PROG_CC AC_PROG_CC
if test "x$GCC" = "xyes"; then if test "x$GCC" = "xyes"; then
@ -106,6 +110,22 @@ AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL AM_PROG_LIBTOOL
dnl --with-windows : the user wants to use generate the MS WINDOWS executable
AC_ARG_WITH(windows,
[ --with-windows MS WINDOWS executable],
dnl set HAS_WINDOWS flag:
AC_DEFINE(HAS_WINDOWS)
)
case $with_windows in
yes )
AC_DEFINE(X_DISPLAY_MISSING)
AC_MSG_RESULT(No X display!)
CFLAGS="$CFLAGS -mwindows";;
*)
dnl Checks for X11 header files and libraries - X11 support can be disabled dnl Checks for X11 header files and libraries - X11 support can be disabled
dnl by passing the '--without-x' option to configure: dnl by passing the '--without-x' option to configure:
@ -117,16 +137,18 @@ AC_PATH_XTRA
dnl Checks for X libraries - if X11 wasn't found then don't make following dnl Checks for X libraries - if X11 wasn't found then don't make following
dnl tests and compile without X11 support - otherwise, check if the following dnl tests and compile without X11 support - otherwise, check if the following
dnl libraries are present (error if they are not) dnl libraries are present (error if they are not)
dnl In CYGWIN library ordering has to be changed. Is this compatible to LINUX?
dnl XShmAttach is a struct in CYGWIN, not a function
if test ! "$no_x" = "yes" ; then if test ! "$no_x" = "yes" ; then
X_LIBS="$X_LIBS -lX11 -lXt"
AC_CHECK_LIB(Xext, XShmAttach,X_LIBS="$X_LIBS -lXext",AC_MSG_ERROR(Couldn't find Xext librairies), $X_LIBS $X_EXTRA_LIBS)
AC_CHECK_LIB(Xmu,main,X_LIBS="$X_LIBS -lXmu",AC_MSG_ERROR(Couldn't find Xmu librairies), $X_LIBS $X_EXTRA_LIBS)
AC_CHECK_LIB(Xaw,main,X_LIBS="$X_LIBS -lXaw",AC_MSG_ERROR(Couldn't find Xaw librairies),$X_LIBS $X_EXTRA_LIBS) AC_CHECK_LIB(Xaw,main,X_LIBS="$X_LIBS -lXaw",AC_MSG_ERROR(Couldn't find Xaw librairies),$X_LIBS $X_EXTRA_LIBS)
X_LIBS="$X_LIBS -lXt"
AC_CHECK_LIB(Xmu,main,X_LIBS="$X_LIBS -lXmu",AC_MSG_ERROR(Couldn't find Xmu librairies), $X_LIBS $X_EXTRA_LIBS)
AC_CHECK_LIB(Xext,main,X_LIBS="$X_LIBS -lXext",AC_MSG_ERROR(Couldn't find Xext librairies), $X_LIBS $X_EXTRA_LIBS)
X_LIBS="$X_LIBS -lX11 -lXpm"
fi ;;
fi
esac
dnl Check for a few typdefs: dnl Check for a few typdefs:
AC_TYPE_PID_T AC_TYPE_PID_T
@ -135,8 +157,8 @@ AC_TYPE_SIGNAL
dnl Check for a few libraries and headers: dnl Check for a few libraries and headers:
dnl Look for ncurses first, then termcap dnl Look for ncurses first, then termcap
AC_SEARCH_LIBS(tputs,ncurses termcap,AC_DEFINE(HAVE_TERMCAP),
AC_MSG_ERROR(Found neither ncurses or termcap))
#AC_SEARCH_LIBS(tputs,ncurses termcap,AC_DEFINE(HAVE_TERMCAP),
# AC_MSG_ERROR(Found neither ncurses or termcap))
AC_HEADER_DIRENT AC_HEADER_DIRENT
@ -149,13 +171,20 @@ AC_HEADER_TIME
AC_STRUCT_TM AC_STRUCT_TM
AC_STRUCT_TIMEZONE AC_STRUCT_TIMEZONE
AC_CHECK_FUNCS(localtime) AC_CHECK_FUNCS(localtime)
AC_CHECK_FUNCS(gettimeofday time ftime , break)
AC_CHECK_FUNCS(getrusage utimes, break)
AC_CHECK_FUNCS(getrlimit ulimit, break)
case $host_os in
*cygwin* )
AC_CHECK_FUNCS(ftime)
AC_DEFINE(HAVE__MEMAVL) ;;
* )
AC_CHECK_FUNCS(gettimeofday time ftime , break)
AC_CHECK_FUNCS(getrusage utimes, break)
AC_CHECK_FUNCS(getrlimit ulimit, break) ;;
esac
dnl Look for termios first (posix) dnl Look for termios first (posix)
AC_CHECK_HEADERS(termios.h termio.h sgtty.h , break) AC_CHECK_HEADERS(termios.h termio.h sgtty.h , break)
AC_CHECK_FUNCS(isatty)
AC_CHECK_FUNCS(isatty tcgetattr tcsetattr)
dnl Check for a few functions: dnl Check for a few functions:
AC_FUNC_VFORK AC_FUNC_VFORK
@ -177,9 +206,12 @@ dnl Check for the garbage collector:
AC_CHECK_LIB(gc,GC_malloc,AC_DEFINE(HAVE_LIBGC) LIBS="$LIBS -lgc") AC_CHECK_LIB(gc,GC_malloc,AC_DEFINE(HAVE_LIBGC) LIBS="$LIBS -lgc")
dnl Check for the asprintf function: dnl Check for the asprintf function:
AC_CHECK_FUNCS(asprintf)
AC_CHECK_FUNCS(asprintf,,AC_CHECK_LIB(iberty,asprintf,AC_DEFINE(HAVE_ASPRINTF) LIBS="$LIBS -liberty"))
# AC_CHECK_FUNC(getopt_long, getopt_long=true)
# AM_CONDITIONAL(HAVE_GETOPT_LONG, test "$getopt_long" = "true")
# Expand the prefix variable (this is really annoying!) # Expand the prefix variable (this is really annoying!)
if eval "test x$prefix = xNONE"; then if eval "test x$prefix = xNONE"; then
dprefix=$ac_default_prefix dprefix=$ac_default_prefix
@ -187,10 +219,22 @@ else
dprefix=$prefix dprefix=$prefix
fi fi
AC_DEFINE_UNQUOTED(NGSPICEBINDIR, "`echo $dprefix/bin`" ) AC_DEFINE_UNQUOTED(NGSPICEBINDIR, "`echo $dprefix/bin`" )
AC_DEFINE_UNQUOTED(NGSPICEDATADIR, "`echo $dprefix/share/ng-spice-rework`" ) AC_DEFINE_UNQUOTED(NGSPICEDATADIR, "`echo $dprefix/share/ng-spice-rework`" )
AC_DEFINE_UNQUOTED(NGSPICEBUILDDATE, "`date`" ) AC_DEFINE_UNQUOTED(NGSPICEBUILDDATE, "`date`" )
dnl with the MS WINDOWS executable we suggest /spice_win/bin as *.exe-path
if test "$with_windows" = "yes"; then
dnl redefine the path for WINDOWS:
AC_MSG_RESULT(WINDOWS cide enabled)
AC_DEFINE_UNQUOTED(NGSPICEBINDIR, "`echo /spice_win/bin`" )
AC_DEFINE_UNQUOTED(NGSPICEDATADIR, "`echo /spice_win/lib`" )
WINMAIN = "winmain.o"
else
WINMAIN =""
fi
AC_SUBST(WINMAIN)
# Recapitulate settings: # Recapitulate settings:
AC_MSG_RESULT(Settings which were chosen:) AC_MSG_RESULT(Settings which were chosen:)
@ -297,6 +341,7 @@ src/frontend/Makefile \
src/frontend/help/Makefile \ src/frontend/help/Makefile \
src/frontend/parser/Makefile \ src/frontend/parser/Makefile \
src/frontend/plotting/Makefile \ src/frontend/plotting/Makefile \
src/frontend/wdisp/Makefile \
src/include/Makefile \ src/include/Makefile \
src/maths/Makefile \ src/maths/Makefile \
src/maths/cmaths/Makefile \ src/maths/cmaths/Makefile \
@ -312,6 +357,6 @@ tests/resistance/Makefile \
tests/bsim3soipd/Makefile \ tests/bsim3soipd/Makefile \
tests/bsim3soifd/Makefile \ tests/bsim3soifd/Makefile \
tests/bsim3soidd/Makefile \ tests/bsim3soidd/Makefile \
tests/bsim4/Makefile \
tests/bsim4/Makefile \
tests/mesa/Makefile tests/mesa/Makefile
) )

13
src/ChangeLog

@ -1,3 +1,16 @@
2002-01-03 Paolo Nenzi <p.nenzi@ieee.org>
* main.c: Some code additions for Windows support (Holger Vogt patch).
* maths/cmaths/Makefile.am: reintegrated test code removed from
Holger Vogt patch (this may cause trouble under Windows).
* maths/cmaths/cmath1.c, maths/cmaths/test_cx_ph.c: small changes to
support Windows (Holger Vogt patch).
* winmain.c: added file for Windows port (Holger Vogt).
2001-12-04 Emmanuel Rouat <emmanuel.rouat@wanadoo.fr> 2001-12-04 Emmanuel Rouat <emmanuel.rouat@wanadoo.fr>
* maths/cmaths/Makefile.am (noinst_PROGRAMS): test programs * maths/cmaths/Makefile.am (noinst_PROGRAMS): test programs

12
src/Makefile.am

@ -63,12 +63,15 @@ DYNAMIC_DEVICELIBS = \
ngspice_SOURCES = \ ngspice_SOURCES = \
conf.c \ conf.c \
conf.h \ conf.h \
ngspice.c
ngspice.c
ngspice_LDADD = \ ngspice_LDADD = \
@WINMAIN@ \
spice.o \ spice.o \
frontend/libfte.a \ frontend/libfte.a \
frontend/wdisp/libwindisp.a \
frontend/plotting/libplotting.a \ frontend/plotting/libplotting.a \
spicelib/devices/dev.o \
$(DYNAMIC_DEVICELIBS) \ $(DYNAMIC_DEVICELIBS) \
spicelib/analysis/libckt.a \ spicelib/analysis/libckt.a \
spicelib/devices/libdev.a \ spicelib/devices/libdev.a \
@ -83,7 +86,10 @@ ngspice_LDADD = \
misc/libmisc.a misc/libmisc.a
spice.o: main.c
winmain.o: winmain.c
$(COMPILE) -DSIMULATOR -o winmain.o -c $(srcdir)/winmain.c
spice.o: main.c
$(COMPILE) -DSIMULATOR -o spice.o -c $(srcdir)/main.c $(COMPILE) -DSIMULATOR -o spice.o -c $(srcdir)/main.c
## nutmeg: ## nutmeg:
@ -95,7 +101,9 @@ ngnutmeg_SOURCES = \
ngnutmeg.c ngnutmeg.c
ngnutmeg_LDADD = \ ngnutmeg_LDADD = \
@WINMAIN@ \
frontend/libfte.a \ frontend/libfte.a \
frontend/wdisp/libwindisp.a \
frontend/plotting/libplotting.a \ frontend/plotting/libplotting.a \
frontend/parser/libparser.a \ frontend/parser/libparser.a \
frontend/help/libhlp.a \ frontend/help/libhlp.a \

11
src/conf.c

@ -7,10 +7,21 @@
char Spice_Version[ ] = VERSION; char Spice_Version[ ] = VERSION;
char Spice_Notice[ ] = "Please submit bug-reports to: ng-spice-bugs@ieee.ing.uniroma1.it"; char Spice_Notice[ ] = "Please submit bug-reports to: ng-spice-bugs@ieee.ing.uniroma1.it";
char Spice_Build_Date[ ] = NGSPICEBUILDDATE; char Spice_Build_Date[ ] = NGSPICEBUILDDATE;
/*
char *Spice_Exec_Dir = "/spice_win/bin";
char *Spice_Lib_Dir = "/spice_win/lib";
*/
char *Spice_Exec_Dir = NGSPICEBINDIR; char *Spice_Exec_Dir = NGSPICEBINDIR;
char *Spice_Lib_Dir = NGSPICEDATADIR; char *Spice_Lib_Dir = NGSPICEDATADIR;
#ifdef __MINGW32__
char *Def_Editor = "notepad.exe";
int AsciiRawFile = 1;
#else
char *Def_Editor = "vi"; char *Def_Editor = "vi";
int AsciiRawFile = 0; int AsciiRawFile = 0;
#endif
char *Bug_Addr = "ng-spice-bugs@ieee.ing.uniroma1.it"; char *Bug_Addr = "ng-spice-bugs@ieee.ing.uniroma1.it";
char *Spice_Host = ""; char *Spice_Host = "";

16
src/frontend/ChangeLog

@ -1,4 +1,16 @@
2001-12-14 Paolo Nenzi <p.nenzi@iee.org>
2002-01-03 Paolo Nenzi <p.nenzi@ieee.org>
* wdisp: added an entire directory containing windows frontend code
(Holger Vogt patch). Files in wdsip: ftegraf.h, makedefs, Makefile.am,
windisp.c and winprint.c.
* Makefile.am: Windows code compilation rules added to makefile.
* display.c, outitf.c, rawfile.c, resource.c, runcoms.c: added
defines for Windows (Holger Vogt patch).
2001-12-14 Paolo Nenzi <p.nenzi@ieee.org>
* control.c, control.h, com_cdump.c, com_cdump.h, variable.c, variable.h: * control.c, control.h, com_cdump.c, com_cdump.h, variable.c, variable.h:
Patched the code with the one contributed by Charles Williams. The patches Patched the code with the one contributed by Charles Williams. The patches
@ -6,7 +18,7 @@
2001-11-25 Emmanuel Rouat <emmanuel.rouat@wanadoo.fr> 2001-11-25 Emmanuel Rouat <emmanuel.rouat@wanadoo.fr>
* circuits.h: transfered definition of sstructire 'circ' to ftedefs.h
* circuits.h: transfered definition of structure 'circ' to ftedefs.h
2001-02-07 Paolo Nenzi <p.nenzi@ieee.org> 2001-02-07 Paolo Nenzi <p.nenzi@ieee.org>

2
src/frontend/Makefile.am

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
SUBDIRS = plotting help parser
SUBDIRS = plotting help parser wdisp
noinst_LIBRARIES = libfte.a noinst_LIBRARIES = libfte.a

35
src/frontend/display.c

@ -31,6 +31,17 @@ extern int X11_Init(void), X11_NewViewport(GRAPH *graph), X11_Close(void), X11_
#endif #endif
#ifdef HAS_WINDOWS /* Grafik-IO über MS Windows */
extern int WIN_Init(), WIN_NewViewport(), WIN_Close(), WIN_Clear(),
WIN_DrawLine(), WIN_Arc(), WIN_Text(), WIN_DefineColor(),
WIN_DefineLinestyle(), WIN_SetLinestyle(), WIN_SetColor(),
WIN_Update(), WIN_DiagramReady();
extern int WPRINT_Init(), WPRINT_NewViewport(), WPRINT_Close(), WPRINT_Clear(),
WPRINT_DrawLine(), WPRINT_Arc(), WPRINT_Text(), WPRINT_DefineColor(),
WPRINT_DefineLinestyle(), WPRINT_SetLinestyle(), WPRINT_SetColor(),
WPRINT_Update(), WPRINT_DiagramReady();
#endif
@ -62,6 +73,24 @@ DISPDEVICE device[] = {
gen_DatatoScreen,}, gen_DatatoScreen,},
#endif #endif
#ifdef HAS_WINDOWS /* Grafik-IO über MS Windows */
{"Windows", 0, 0, 1000, 1000, 0, 0, WIN_Init, WIN_NewViewport,
WIN_Close, WIN_Clear,
WIN_DrawLine, WIN_Arc, WIN_Text, WIN_DefineColor, WIN_DefineLinestyle,
WIN_SetLinestyle, WIN_SetColor, WIN_Update,
nodev, nodev, nodev, gen_Input,
gen_DatatoScreen, WIN_DiagramReady},
// Achtung: Namen "WinPrint" nicht ändern!
{"WinPrint", 0, 0, 1000, 1000, 0, 0, WPRINT_Init, WPRINT_NewViewport,
WPRINT_Close, WPRINT_Clear,
WPRINT_DrawLine, WPRINT_Arc, WPRINT_Text, WPRINT_DefineColor, WPRINT_DefineLinestyle,
WPRINT_SetLinestyle, WPRINT_SetColor, WPRINT_Update,
nodev, nodev, nodev, nodev,
gen_DatatoScreen, WPRINT_DiagramReady},
#endif
{"plot5", 0, 0, 1000, 1000, 0, 0, Plt5_Init, Plt5_NewViewport, {"plot5", 0, 0, 1000, 1000, 0, 0, Plt5_Init, Plt5_NewViewport,
Plt5_Close, Plt5_Clear, Plt5_Close, Plt5_Clear,
@ -87,6 +116,7 @@ DISPDEVICE device[] = {
}; };
DISPDEVICE *dispdev = device + NUMELEMS(device) - 1; DISPDEVICE *dispdev = device + NUMELEMS(device) - 1;
// DISPDEVICE *dispdev = device ; /* GCC257 stuertzt hier ab */
#define XtNumber(arr) (sizeof(arr) / sizeof(arr[0])) #define XtNumber(arr) (sizeof(arr) / sizeof(arr[0]))
@ -135,6 +165,11 @@ DevInit(void)
#endif #endif
#ifdef HAS_WINDOWS
if (!dispdev) {
dispdev = FindDev("Windows");
}
#endif
if (!dispdev) { if (!dispdev) {
externalerror( externalerror(

3
src/frontend/outitf.c

@ -524,6 +524,7 @@ OUTpData(void *plotPtr, IFvalue *refValue, IFvalue *valuePtr)
variable just the same */ variable just the same */
currclock = clock(); currclock = clock();
#ifndef HAS_WINDOWS
if ((currclock-lastclock)>(0.25*CLOCKS_PER_SEC)) { if ((currclock-lastclock)>(0.25*CLOCKS_PER_SEC)) {
if (run->isComplex) { if (run->isComplex) {
fprintf(stderr, " Reference value : % 12.5e\r", fprintf(stderr, " Reference value : % 12.5e\r",
@ -534,7 +535,7 @@ OUTpData(void *plotPtr, IFvalue *refValue, IFvalue *valuePtr)
} }
lastclock = currclock; lastclock = currclock;
} }
#endif
for (i = 0; i < run->numData; i++) { for (i = 0; i < run->numData; i++) {
if (run->data[i].outIndex == -1) { if (run->data[i].outIndex == -1) {
if (run->data[i].type == IF_REAL) if (run->data[i].type == IF_REAL)

7
src/frontend/parser/ChangeLog

@ -1,3 +1,10 @@
2002-01-03 Paolo Nenzi <p.nenzi@ieee.org>
* complete.c: Double patch applied, code for Windows support (Holger
Vogt) and rework of netBSD support (AMAKAWA Shuhei).
* input.c, lexical.c: Windows support (Holger Vogt patch).
2001-12-14 Paolo Nenzi <p.nenzi@ieee.org> 2001-12-14 Paolo Nenzi <p.nenzi@ieee.org>
* lexical.c, complete.c, complete.h: * lexical.c, complete.c, complete.h:

14
src/frontend/parser/complete.c

@ -35,8 +35,10 @@ Modified: 1999 Paolo Nenzi
#include <pwd.h> #include <pwd.h>
#endif #endif
#ifndef __MINGW32__
/* MW. We also need ioctl.h here I think */ /* MW. We also need ioctl.h here I think */
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif
/* Be sure the ioctls get included in the following */ /* Be sure the ioctls get included in the following */
#ifdef HAVE_SGTTY_H #ifdef HAVE_SGTTY_H
@ -413,10 +415,6 @@ cp_ccon(bool on)
# else # else
# ifdef HAVE_TERMIOS_H # ifdef HAVE_TERMIOS_H
# ifdef __NetBSD__
# define TCGETS
# define TCSETS
# endif
# define TERM_GET TCGETS # define TERM_GET TCGETS
# define TERM_SET TCSETS # define TERM_SET TCSETS
@ -426,7 +424,7 @@ cp_ccon(bool on)
# endif # endif
# endif # endif
# if defined(TERM_GET) || defined(__NetBSD__)
#ifdef TERM_GET
static bool ison = FALSE; static bool ison = FALSE;
if (cp_nocc || !cp_interactive || (ison == on)) if (cp_nocc || !cp_interactive || (ison == on))
@ -434,7 +432,7 @@ cp_ccon(bool on)
ison = on; ison = on;
if (ison == TRUE) { if (ison == TRUE) {
#ifdef __NetBSD__
#if HAVE_TCGETATTR
tcgetattr(fileno(cp_in),&OS_Buf); tcgetattr(fileno(cp_in),&OS_Buf);
#else #else
(void) ioctl(fileno(cp_in), TERM_GET, (char *) &OS_Buf); (void) ioctl(fileno(cp_in), TERM_GET, (char *) &OS_Buf);
@ -443,13 +441,13 @@ cp_ccon(bool on)
sbuf.c_cc[VEOF] = 0; sbuf.c_cc[VEOF] = 0;
sbuf.c_cc[VEOL] = ESCAPE; sbuf.c_cc[VEOL] = ESCAPE;
sbuf.c_cc[VEOL2] = CNTRL_D; sbuf.c_cc[VEOL2] = CNTRL_D;
#ifdef __NetBSD__
#if HAVE_TCSETATTR
tcsetattr(fileno(cp_in),TCSANOW,&sbuf); tcsetattr(fileno(cp_in),TCSANOW,&sbuf);
#else #else
(void) ioctl(fileno(cp_in), TERM_SET, (char *) &sbuf); (void) ioctl(fileno(cp_in), TERM_SET, (char *) &sbuf);
#endif #endif
} else { } else {
#ifdef __NetBSD__
#ifdef HAVE_TCSETATTR
tcsetattr(fileno(cp_in),TCSANOW,&OS_Buf); tcsetattr(fileno(cp_in),TCSANOW,&OS_Buf);
#else #else
(void) ioctl(fileno(cp_in), TERM_SET, (char *) &OS_Buf); (void) ioctl(fileno(cp_in), TERM_SET, (char *) &OS_Buf);

2
src/frontend/parser/input.c

@ -24,6 +24,7 @@ inchar(FILE *fp)
{ {
char c; char c;
#ifndef HAS_WINDOWS
int i; int i;
if (cp_interactive && !cp_nocc) { if (cp_interactive && !cp_nocc) {
@ -38,6 +39,7 @@ inchar(FILE *fp)
} else } else
return ((int) c); return ((int) c);
} else } else
#endif
c = getc(fp); c = getc(fp);
return ((int) c); return ((int) c);
} }

2
src/frontend/parser/lexical.c

@ -22,8 +22,10 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include <pwd.h> #include <pwd.h>
#endif #endif
#ifndef __MINGW32__
/* MW. Linux has TIOCSTI, so we include all headers here */ /* MW. Linux has TIOCSTI, so we include all headers here */
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif
#ifdef HAVE_SGTTY_H #ifdef HAVE_SGTTY_H
#include <sys/types.h> #include <sys/types.h>

4
src/frontend/plotting/ChangeLog

@ -1,3 +1,7 @@
2002-01-03 Paolo Nenzi <p.nenzi@ieee.org>
* graf.c: Added code to support Windows (Holger Vogt patch).
2000-10-10 Arno W. Peters <A.W.Peters@ieee.org> 2000-10-10 Arno W. Peters <A.W.Peters@ieee.org>
* graf.c: Removed need to press return after resizing the plot * graf.c: Removed need to press return after resizing the plot

14
src/frontend/plotting/graf.c

@ -153,6 +153,16 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
graph->data.xmax = xlims[1]; graph->data.xmax = xlims[1];
graph->data.ymin = ylims[0]; graph->data.ymin = ylims[0];
graph->data.ymax = ylims[1]; graph->data.ymax = ylims[1];
/* get title into plot window */
#ifdef HAS_WINDOWS
if (!pname)
pname = "(unknown)";
if (!plotname)
plotname = "(unknown)";
comb_title = tmalloc(strlen(plotname) + strlen(pname) + 3);
sprintf(comb_title, "%s: %s", pname, plotname);
graph->plotname = comb_title;
#endif
/* note: have enum here or some better convention */ /* note: have enum here or some better convention */
if (NewViewport(graph) == 1) { if (NewViewport(graph) == 1) {
@ -199,7 +209,7 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
graph->grid.ylabel = "imag"; graph->grid.ylabel = "imag";
} }
} }
#ifndef HAS_WINDOWS
if (!pname) if (!pname)
pname = "(unknown)"; pname = "(unknown)";
if (!plotname) if (!plotname)
@ -207,7 +217,7 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
comb_title = tmalloc(strlen(plotname) + strlen(pname) + 3); comb_title = tmalloc(strlen(plotname) + strlen(pname) + 3);
sprintf(comb_title, "%s: %s", pname, plotname); sprintf(comb_title, "%s: %s", pname, plotname);
graph->plotname = comb_title; graph->plotname = comb_title;
#endif
gr_resize_internal(graph); gr_resize_internal(graph);
gr_redrawgrid(graph); gr_redrawgrid(graph);

54
src/frontend/rawfile.c

@ -24,6 +24,12 @@ int raw_prec = -1; /* How many sigfigs to use, default 15 (max). */
#define DEFPREC 15 #define DEFPREC 15
#ifdef HAS_WINDOWS
#undef fscanf /* redo I/O from WINMAIN.C here
otherwise reading ASCII will not work */
#endif
/* Write a raw file. We write everything in the plot pointed to. */ /* Write a raw file. We write everything in the plot pointed to. */
void void
@ -56,11 +62,34 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
else else
prec = DEFPREC; prec = DEFPREC;
#ifdef __MINGW32__
// -Binärdatei binär schreiben- hvogt 15.03.2000 ---------------------
if (binary) {
if (!(fp = fopen(name, app ? "ab" : "wb"))) {
perror(name);
return;
}
fprintf(cp_out,"binary raw file\n");
}
else {
if (!(fp = fopen(name, app ? "a" : "w"))) {
perror(name);
return;
}
fprintf(cp_out,"ASCII raw file\n");
}
// --------------------------------------------------------------------
#else
if (!(fp = fopen(name, app ? "a" : "w"))) { if (!(fp = fopen(name, app ? "a" : "w"))) {
perror(name); perror(name);
return; return;
} }
#endif
numdims = nvars = length = 0; numdims = nvars = length = 0;
for (v = pl->pl_dvecs; v; v = v->v_next) { for (v = pl->pl_dvecs; v; v = v->v_next) {
if (iscomplex(v)) if (iscomplex(v))
@ -138,7 +167,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
if (v->v_gridtype) if (v->v_gridtype)
fprintf(fp, " grid=%d", v->v_gridtype); fprintf(fp, " grid=%d", v->v_gridtype);
if (v->v_plottype) if (v->v_plottype)
fprintf(fp, " plot=%d", v->v_gridtype);
fprintf(fp, " plot=%d", v->v_plottype);
/* Only write dims if they are different from default. */ /* Only write dims if they are different from default. */
writedims = FALSE; writedims = FALSE;
if (v->v_numdims != numdims) { if (v->v_numdims != numdims) {
@ -253,12 +282,35 @@ raw_read(char *name)
struct variable *vv; struct variable *vv;
wordlist *wl, *nwl; wordlist *wl, *nwl;
FILE *fp, *lastin, *lastout, *lasterr; FILE *fp, *lastin, *lastout, *lasterr;
bool binary = TRUE;
if (!(fp = fopen(name, "r"))) { if (!(fp = fopen(name, "r"))) {
perror(name); perror(name);
return (NULL); return (NULL);
} }
#ifdef __MINGW32__
// Test, ob Datei wirklich ASCII, sonst binär annehmen hvogt 15.3.2000
while (fgets(buf, BSIZE_SP, fp)) {
if (ciprefix("values:", buf)) {
binary = FALSE;
rewind(fp); // zurückspulen
fprintf(cp_err, "\nASCII raw file\n");
break;
}
}
if (binary) {
(void) fclose(fp);
if (!(fp = fopen(name, "rb"))) {
perror(name);
return (NULL);
}
fprintf(cp_err, "\nbinary raw file\n");
}
//--------------------------------------------------------
#endif
/* Since we call cp_evloop() from here, we have to do this junk. */ /* Since we call cp_evloop() from here, we have to do this junk. */
lastin = cp_curin; lastin = cp_curin;
lastout = cp_curout; lastout = cp_curout;

74
src/frontend/resource.c

@ -17,24 +17,47 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "resource.h" #include "resource.h"
#include "variable.h" #include "variable.h"
#ifdef HAVE__MEMAVL
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
/* static declarations */ /* static declarations */
static void printres(char *name); static void printres(char *name);
static RETSIGTYPE fault(void); static RETSIGTYPE fault(void);
static void * baseaddr(void); static void * baseaddr(void);
#ifdef HAVE__MEMAVL
size_t mem_avail;
size_t _memavl(void)
{
MEMORYSTATUS ms;
DWORD sum;
ms.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus( &ms);
sum = ms.dwAvailPhys + ms.dwAvailPageFile;
return (size_t) sum;
}
#else
char *startdata; char *startdata;
char *enddata; char *enddata;
#endif
void void
init_rlimits(void) init_rlimits(void)
{ {
# ifdef HAVE__MEMAVL // hvogt
mem_avail = _memavl( );
# else
startdata = (char *) baseaddr( ); startdata = (char *) baseaddr( );
enddata = sbrk(0); enddata = sbrk(0);
# endif
// startdata = (char *) baseaddr( );
// enddata = sbrk(0);
} }
@ -88,10 +111,19 @@ void
ft_ckspace(void) ft_ckspace(void)
{ {
long usage, limit; long usage, limit;
#ifdef HAVE__MEMAVL
size_t mem_avail_now;
mem_avail_now = _memavl( );
usage = mem_avail - mem_avail_now;
limit = mem_avail;
#else
static long old_usage = 0; static long old_usage = 0;
char *hi; char *hi;
# ifdef HAVE_GETRLIMIT # ifdef HAVE_GETRLIMIT
struct rlimit rld; struct rlimit rld;
@ -102,6 +134,8 @@ ft_ckspace(void)
# else # else
/* SYSVRLIMIT */ /* SYSVRLIMIT */
limit = ulimit(3, 0L) - (enddata - startdata); limit = ulimit(3, 0L) - (enddata - startdata);
@ -110,6 +144,7 @@ ft_ckspace(void)
usage = (long) (hi - enddata); usage = (long) (hi - enddata);
if (limit < 0) if (limit < 0)
return; /* what else do you do? */ return; /* what else do you do? */
@ -118,6 +153,8 @@ ft_ckspace(void)
old_usage = usage; old_usage = usage;
#endif
if (usage > limit * 0.9) { if (usage > limit * 0.9) {
fprintf(cp_err, "Warning - approaching max data size: "); fprintf(cp_err, "Warning - approaching max data size: ");
fprintf(cp_err, "current size = %ld, limit = %ld.\n", usage, limit); fprintf(cp_err, "current size = %ld, limit = %ld.\n", usage, limit);
@ -162,7 +199,7 @@ printres(char *name)
int sec, msec; int sec, msec;
ftime(&timenow); ftime(&timenow);
timediff(&timenow, &timebegin, &total, &totalu); timediff(&timenow, &timebegin, &total, &totalu);
totalu /= 1000;
// totalu /= 1000; hvogt
cpu_elapsed = "elapsed"; cpu_elapsed = "elapsed";
# else # else
# define NO_RUDATA # define NO_RUDATA
@ -191,10 +228,10 @@ printres(char *name)
lastusec -= 1000; lastusec -= 1000;
lastsec += 1; lastsec += 1;
} }
#ifndef HAVE__MEMAVL
fprintf(cp_out, "%s time since last call: %lu.%03lu seconds.\n", fprintf(cp_out, "%s time since last call: %lu.%03lu seconds.\n",
cpu_elapsed, lastsec, lastusec); cpu_elapsed, lastsec, lastusec);
#endif
lastsec = total; lastsec = total;
lastusec = totalu; lastusec = totalu;
} }
@ -212,6 +249,17 @@ printres(char *name)
if (!name || eq(name, "space")) { if (!name || eq(name, "space")) {
long usage = 0, limit = 0; long usage = 0, limit = 0;
#ifdef HAVE__MEMAVL
size_t mem_avail_now;
mem_avail_now = _memavl( );
usage = mem_avail - mem_avail_now;
limit = mem_avail;
#else
#ifdef ipsc #ifdef ipsc
NXINFO cur = nxinfo, start = nxinfo_snap; NXINFO cur = nxinfo, start = nxinfo_snap;
@ -236,8 +284,18 @@ printres(char *name)
# endif # endif
# endif # endif
#endif #endif
#endif
#ifdef HAVE__MEMAVL
if (usage > 1000000)
fprintf(cp_out, "Current dynamic memory usage = %8.6f MB,\n", usage/1000000.);
else
fprintf(cp_out, "Current dynamic memory usage = %5.3f kB,\n", usage/1000.);
fprintf(cp_out, "Dynamic memory limit = %8.6f MB.\n", limit/1000000.);
#else
fprintf(cp_out, "Current dynamic memory usage = %ld,\n", usage); fprintf(cp_out, "Current dynamic memory usage = %ld,\n", usage);
fprintf(cp_out, "Dynamic memory limit = %ld.\n", limit); fprintf(cp_out, "Dynamic memory limit = %ld.\n", limit);
#endif
yy = TRUE; yy = TRUE;
} }
@ -321,6 +379,10 @@ baseaddr(void)
if (getenv("SPICE_NO_DATASEG_CHECK")) if (getenv("SPICE_NO_DATASEG_CHECK"))
return 0; return 0;
#if defined(__CYGWIN__) || defined(HAS_WINDOWS)
return 0;
#endif
low = 0; low = 0;
high = (char *) ((unsigned long) sbrk(0) & ~((1 << LOG2_PAGESIZE) - 1)); high = (char *) ((unsigned long) sbrk(0) & ~((1 << LOG2_PAGESIZE) - 1));

21
src/frontend/runcoms.c

@ -214,12 +214,33 @@ dosim(char *what, wordlist *wl)
#endif /* PARALLEL_ARCH */ #endif /* PARALLEL_ARCH */
if (!*wl->wl_word) if (!*wl->wl_word)
rawfileFp = stdout; rawfileFp = stdout;
#ifdef __MINGW32__
// ask if binary or ASCII, open file with w or wb hvogt 15.3.2000
else if (ascii) {
if(!(rawfileFp = fopen(wl->wl_word, "w"))) {
perror(wl->wl_word);
ft_setflag = FALSE;
return 1;
}
fprintf(cp_out,"ASCII raw file\n");
}
else if (!ascii) {
if(!(rawfileFp = fopen(wl->wl_word, "wb"))) {
perror(wl->wl_word);
ft_setflag = FALSE;
return 1;
}
fprintf(cp_out,"binary raw file\n");
}
//-------------------------------------------------------------------------
#else
else if (!(rawfileFp = fopen(wl->wl_word, "w"))) { else if (!(rawfileFp = fopen(wl->wl_word, "w"))) {
setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE); setvbuf(rawfileFp, rawfileBuf, _IOFBF, RAWBUF_SIZE);
perror(wl->wl_word); perror(wl->wl_word);
ft_setflag = FALSE; ft_setflag = FALSE;
return 1; return 1;
} }
#endif /* __MINGW32__ */
rawfileBinary = !ascii; rawfileBinary = !ascii;
#ifdef PARALLEL_ARCH #ifdef PARALLEL_ARCH
} else { } else {

12
src/include/ChangeLog

@ -1,3 +1,15 @@
2002-01-03 Paolo Nenzi <p.nenzi@ieee.org>
* wstdio.h: Standard input/output for Windows (Holger Vogt patch).
* complex.h: _complex redefined as _complex1 to avoid conflict with
MINGW32 Paolo Nenzi <p.nenzi@ieee.org>
* defines.h: added defines for Windows (Holger Vogt patch).
* ngspice.h: added wstdio.h inclusion if compiling for Windows
(Holger Vogt patch).
2001-12-14 Paolo Nenzi <p.nenzi@ieee.org> 2001-12-14 Paolo Nenzi <p.nenzi@ieee.org>
* cpextern.h: Modification needed for patches sent by * cpextern.h: Modification needed for patches sent by

8
src/include/complex.h

@ -7,15 +7,15 @@
/* Complex numbers. */ /* Complex numbers. */
struct _complex { /* IBM portability... */
struct _complex1 { /* IBM portability... renamed due to double definition in MINGW32*/
double cx_real; double cx_real;
double cx_imag; double cx_imag;
} ; } ;
typedef struct _complex complex;
typedef struct _complex1 complex;
#define realpart(cval) ((struct _complex *) (cval))->cx_real
#define imagpart(cval) ((struct _complex *) (cval))->cx_imag
#define realpart(cval) ((struct _complex1 *) (cval))->cx_real
#define imagpart(cval) ((struct _complex1 *) (cval))->cx_imag
/* /*

17
src/include/defines.h

@ -65,6 +65,18 @@
#define REFTEMP 300.15 /* 27 degrees C */ #define REFTEMP 300.15 /* 27 degrees C */
#ifdef __MINGW32__
#define DIR_PATHSEP "\\"
#define DIR_TERM '\\'
#define DIR_CWD "."
#define TEMPFORMAT "%s%d.tmp"
/*
#define SYSTEM_PLOT5LPR "lpr -P%s -g %s"
#define SYSTEM_PSLPR "lpr -P%s %s"
#define SYSTEM_MAIL "Mail -s \"%s (%s) Bug Report\" %s"
*/
#else
#define DIR_PATHSEP "/" #define DIR_PATHSEP "/"
#define DIR_TERM '/' #define DIR_TERM '/'
@ -75,6 +87,7 @@
#define SYSTEM_PSLPR "lpr -P%s %s" #define SYSTEM_PSLPR "lpr -P%s %s"
#define SYSTEM_MAIL "Mail -s \"%s (%s) Bug Report\" %s" #define SYSTEM_MAIL "Mail -s \"%s (%s) Bug Report\" %s"
#endif
/* /*
* #define-s that are always on * #define-s that are always on
@ -102,7 +115,7 @@
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
/*
#define DIR_PATHSEP "/" #define DIR_PATHSEP "/"
#define DIR_TERM '/' #define DIR_TERM '/'
@ -113,7 +126,7 @@
#define SYSTEM_PSLPR "lpr -P%s %s" #define SYSTEM_PSLPR "lpr -P%s %s"
#define SYSTEM_MAIL "Mail -s \"%s (%s) Bug Report\" %s" #define SYSTEM_MAIL "Mail -s \"%s (%s) Bug Report\" %s"
*/

8
src/include/ngspice.h

@ -103,6 +103,14 @@ struct timeb timebegin;
#include <time.h> #include <time.h>
#endif #endif
// added for CYGWIN
#ifndef HUGE
#define HUGE HUGE_VAL
#endif
#ifdef HAS_WINDOWS
#include "wstdio.h"
#endif
extern char *gettok(char **s); extern char *gettok(char **s);
extern void appendc(char *s, char c); extern void appendc(char *s, char c);

28
src/main.c

@ -23,7 +23,9 @@
#include <spicelib/devices/dev.h> #include <spicelib/devices/dev.h>
#include <spicelib/analysis/analysis.h> #include <spicelib/analysis/analysis.h>
#include <misc/ivars.h> #include <misc/ivars.h>
#if !defined(__CYGWIN__)
#include <misc/getopt.h> #include <misc/getopt.h>
#endif
#include <frontend/resource.h> #include <frontend/resource.h>
#include <frontend/variable.h> #include <frontend/variable.h>
@ -46,6 +48,9 @@ bool ft_intrpt = FALSE; /* Set by the (void) signal handlers. */
bool ft_setflag = FALSE; /* Don't abort after an interrupt. */ bool ft_setflag = FALSE; /* Don't abort after an interrupt. */
char *ft_rawfile = "rawspice.raw"; char *ft_rawfile = "rawspice.raw";
bool oflag = FALSE; /* Output über redefinierte Funktionen */
FILE *flogp; // hvogt 15.12.2001
/* Frontend and circuit options */ /* Frontend and circuit options */
IFsimulator *ft_sim = NULL; IFsimulator *ft_sim = NULL;
@ -240,7 +245,11 @@ append_to_stream(FILE *dest, FILE *source)
} }
int int
#ifdef HAS_WINDOWS
xmain(int argc, char **argv)
#else
main(int argc, char **argv) main(int argc, char **argv)
#endif
{ {
int c; int c;
int err; int err;
@ -318,7 +327,8 @@ main(int argc, char **argv)
#ifdef MALLOCTRACE #ifdef MALLOCTRACE
mallocTraceInit("malloc.out"); mallocTraceInit("malloc.out");
#endif #endif
#ifdef HAVE_ISATTY
#if defined (HAVE_ISATTY) && !defined(HAS_WINDOWS)
istty = (bool) isatty(fileno(stdin)); istty = (bool) isatty(fileno(stdin));
#endif #endif
@ -398,10 +408,22 @@ main(int argc, char **argv)
#else #else
sprintf (buf, "%s", optarg); sprintf (buf, "%s", optarg);
#endif #endif
if (!(freopen (buf, "w", stdout))) {
/* if (!(freopen (buf, "w", stdout))) {
perror (buf); perror (buf);
shutdown (EXIT_BAD); shutdown (EXIT_BAD);
} }
*/
// *** Log-File öffnen *******
if (!(flogp = fopen(buf, "w"))) {
perror(buf);
shutdown(EXIT_BAD);
}
// ***************************
com_version(NULL); // hvogt 11.11.2001
fprintf(stdout, "\nBatch mode\n\n");
fprintf(stdout, "Simulation output goes to rawfile: %s\n\n", ft_rawfile);
fprintf(stdout, "Comments and warnigs go to log-file: %s\n", buf);
oflag = TRUE;
} }
break; break;
@ -473,7 +495,7 @@ main(int argc, char **argv)
if (!ft_batchmode) { if (!ft_batchmode) {
signal(SIGINT, ft_sigintr); signal(SIGINT, ft_sigintr);
signal(SIGFPE, sigfloat); signal(SIGFPE, sigfloat);
#ifdef SIGTSTP
#if defined(SIGTSTP) // && !defined(__MINGW32__)
signal(SIGTSTP, sigstop); signal(SIGTSTP, sigstop);
#endif #endif
} }

3
src/maths/cmaths/Makefile.am

@ -14,7 +14,7 @@ libcmaths_a_SOURCES = \
cmath4.h cmath4.h
noinst_PROGRAMS = test_cx_mag test_cx_j test_cx_ph noinst_PROGRAMS = test_cx_mag test_cx_j test_cx_ph
test_cx_ph_SOURCES = \ test_cx_ph_SOURCES = \
test_cx_ph.c test_cx_ph.c
@ -38,6 +38,7 @@ test_cx_j_LDADD = \
TESTS = test_cx_mag test_cx_j test_cx_ph TESTS = test_cx_mag test_cx_j test_cx_ph
INCLUDES = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/maths/poly INCLUDES = -I$(top_srcdir)/src/include -I$(top_srcdir)/src/maths/poly
MAINTAINERCLEANFILES = Makefile.in MAINTAINERCLEANFILES = Makefile.in

3
src/maths/cmaths/cmath1.c

@ -24,6 +24,9 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "cmath.h" #include "cmath.h"
#include "cmath1.h" #include "cmath1.h"
#ifdef HAS_WINDOWS
#define fp_r_i_n_t_f fprintf
#endif
/* This flag determines whether degrees or radians are used. The radtodeg /* This flag determines whether degrees or radians are used. The radtodeg
* and degtorad macros are no-ops if this is FALSE. * and degtorad macros are no-ops if this is FALSE.

1
src/maths/cmaths/test_cx_ph.c

@ -6,6 +6,7 @@
#include <memory.h> #include <memory.h>
#include <dvec.h> #include <dvec.h>
#include <complex.h> #include <complex.h>
#include <defines.h>
#include "cmath.h" #include "cmath.h"
#include "cmath1.h" #include "cmath1.h"

7
src/spicelib/analysis/ChangeLog

@ -1,3 +1,10 @@
2002-01-03 Paolo Nenzi <p.nenzi@ieee.org>
* Added some code that adds new functionalities if
ngspice is compiled for Windows (Holger Vogt patch)
I think that the new code interactively displays the
percent done of the analysis.
2001-01-23 Paolo Nenzi <p.nenzi@ieee.org> 2001-01-23 Paolo Nenzi <p.nenzi@ieee.org>
* noisean.c: patched the code with the new one * noisean.c: patched the code with the new one

30
src/spicelib/analysis/acan.c

@ -11,6 +11,10 @@ Modified 2001: AlansFixes
#include "devdefs.h" #include "devdefs.h"
#include "sperror.h" #include "sperror.h"
#ifdef HAS_WINDOWS
void SetAnalyse( char * Analyse, int Percent);
#endif
int int
ACan(CKTcircuit *ckt, int restart) ACan(CKTcircuit *ckt, int restart)
@ -196,10 +200,36 @@ ACan(CKTcircuit *ckt, int restart)
switch(((ACAN*)ckt->CKTcurJob)->ACstepType) { switch(((ACAN*)ckt->CKTcurJob)->ACstepType) {
case DECADE: case DECADE:
case OCTAVE: case OCTAVE:
// neu eingefügt 14.12.2001
#ifdef HAS_WINDOWS
{
double endfreq = ((ACAN*)ckt->CKTcurJob)->ACstopFreq;
double startfreq = ((ACAN*)ckt->CKTcurJob)->ACstartFreq;
double step = ((ACAN*)ckt->CKTcurJob)->ACfreqDelta;
endfreq = log(endfreq);
if (startfreq == 0.0)
startfreq = 1e-12;
startfreq = log(startfreq);
if (freq > 0.0)
SetAnalyse( "ac", (log(freq)-startfreq) * 100.0 / (endfreq-startfreq));
}
#endif
freq *= ((ACAN*)ckt->CKTcurJob)->ACfreqDelta; freq *= ((ACAN*)ckt->CKTcurJob)->ACfreqDelta;
if(((ACAN*)ckt->CKTcurJob)->ACfreqDelta==1) goto endsweep; if(((ACAN*)ckt->CKTcurJob)->ACfreqDelta==1) goto endsweep;
break; break;
case LINEAR: case LINEAR:
#ifdef HAS_WINDOWS
{
double endfreq = ((ACAN*)ckt->CKTcurJob)->ACstopFreq;
double startfreq = ((ACAN*)ckt->CKTcurJob)->ACstartFreq;
SetAnalyse( "ac", (freq - startfreq)* 100.0 / (endfreq-startfreq));
}
#endif
freq += ((ACAN*)ckt->CKTcurJob)->ACfreqDelta; freq += ((ACAN*)ckt->CKTcurJob)->ACfreqDelta;
if(((ACAN*)ckt->CKTcurJob)->ACfreqDelta==0) goto endsweep; if(((ACAN*)ckt->CKTcurJob)->ACfreqDelta==0) goto endsweep;
break; break;

9
src/spicelib/analysis/dctran.c

@ -13,6 +13,12 @@ Modified: 2000 AlansFixes
#include <trandefs.h> #include <trandefs.h>
#include <sperror.h> #include <sperror.h>
#ifdef HAS_WINDOWS /* hvogt 10.03.99, nach W. Mues */
void SetAnalyse( char * Analyse, int Percent);
#endif
int int
DCtran(CKTcircuit *ckt, DCtran(CKTcircuit *ckt,
int restart) /* forced restart flag */ int restart) /* forced restart flag */
@ -328,6 +334,9 @@ resume:
(void)printf("limited by Tmax\n"); (void)printf("limited by Tmax\n");
} }
} }
#endif
#ifdef HAS_WINDOWS
SetAnalyse( "tran", (int)((ckt->CKTtime * 100) / ckt->CKTfinalTime));
#endif #endif
ckt->CKTdelta = ckt->CKTdelta =
MIN(ckt->CKTdelta,ckt->CKTmaxStep); MIN(ckt->CKTdelta,ckt->CKTmaxStep);

9
src/spicelib/devices/ChangeLog

@ -1,3 +1,12 @@
2002-01-03 Paolo Nenzi <p.nenzi@ieee.org>
* bsim3v1/b3v1noi.c, bsim3v2/b3v2noi.c: Both models had a
function called StrongInversionNoiseEval(). They were renamed
BSIM3V1StrongInversionNoiseEval() and
BSIM3V2StrongInversionNoiseEval(). (Holger Vogt)
* dev.c: support for ieee754 floating point. (Holger Vogt patch)
2000-08-28 Arno W. Peters <A.W.Peters@ieee.org> 2000-08-28 Arno W. Peters <A.W.Peters@ieee.org>
* asrc/asrcset.c, bjt/bjtsetup.c, bsim1/b1set.c, bsim2/b2set.c, * asrc/asrcset.c, bjt/bjtsetup.c, bsim1/b1set.c, bsim2/b2set.c,

6
src/spicelib/devices/bsim3v1/b3v1noi.c

@ -44,7 +44,7 @@ extern void NevalSrc();
extern double Nintegrate(); extern double Nintegrate();
double double
StrongInversionNoiseEval(vgs, vds, model, here, freq, temp)
BSIM3V1StrongInversionNoiseEval(vgs, vds, model, here, freq, temp)
double vgs, vds, freq, temp; double vgs, vds, freq, temp;
BSIM3V1model *model; BSIM3V1model *model;
BSIM3V1instance *here; BSIM3V1instance *here;
@ -253,7 +253,7 @@ int i;
vgs = vgs + vds; vgs = vgs + vds;
} }
if (vgs >= here->BSIM3V1von + 0.1) if (vgs >= here->BSIM3V1von + 0.1)
{ Ssi = StrongInversionNoiseEval(vgs,
{ Ssi = BSIM3V1StrongInversionNoiseEval(vgs,
vds, model, here, data->freq, vds, model, here, data->freq,
ckt->CKTtemp); ckt->CKTtemp);
noizDens[BSIM3V1FLNOIZ] *= Ssi; noizDens[BSIM3V1FLNOIZ] *= Ssi;
@ -268,7 +268,7 @@ int i;
* 4.0e36; * 4.0e36;
Swi = T10 / T11 * here->BSIM3V1cd Swi = T10 / T11 * here->BSIM3V1cd
* here->BSIM3V1cd; * here->BSIM3V1cd;
Slimit = StrongInversionNoiseEval(
Slimit = BSIM3V1StrongInversionNoiseEval(
here->BSIM3V1von + 0.1, vds, model, here->BSIM3V1von + 0.1, vds, model,
here, data->freq, ckt->CKTtemp); here, data->freq, ckt->CKTtemp);
T1 = Swi + Slimit; T1 = Swi + Slimit;

6
src/spicelib/devices/bsim3v2/b3v2noi.c

@ -44,7 +44,7 @@ extern void NevalSrc();
extern double Nintegrate(); extern double Nintegrate();
double double
StrongInversionNoiseEval(vgs, vds, model, here, freq, temp)
BSIM3V2StrongInversionNoiseEval(vgs, vds, model, here, freq, temp)
double vgs, vds, freq, temp; double vgs, vds, freq, temp;
BSIM3V2model *model; BSIM3V2model *model;
BSIM3V2instance *here; BSIM3V2instance *here;
@ -253,7 +253,7 @@ int error, i;
vgs = vgs + vds; vgs = vgs + vds;
} }
if (vgs >= here->BSIM3V2von + 0.1) if (vgs >= here->BSIM3V2von + 0.1)
{ Ssi = StrongInversionNoiseEval(vgs,
{ Ssi = BSIM3V2StrongInversionNoiseEval(vgs,
vds, model, here, data->freq, vds, model, here, data->freq,
ckt->CKTtemp); ckt->CKTtemp);
noizDens[BSIM3V2FLNOIZ] *= Ssi; noizDens[BSIM3V2FLNOIZ] *= Ssi;
@ -268,7 +268,7 @@ int error, i;
* 4.0e36; * 4.0e36;
Swi = T10 / T11 * here->BSIM3V2cd Swi = T10 / T11 * here->BSIM3V2cd
* here->BSIM3V2cd; * here->BSIM3V2cd;
Slimit = StrongInversionNoiseEval(
Slimit = BSIM3V2StrongInversionNoiseEval(
here->BSIM3V2von + 0.1, vds, model, here->BSIM3V2von + 0.1, vds, model,
here, data->freq, ckt->CKTtemp); here, data->freq, ckt->CKTtemp);
T1 = Swi + Slimit; T1 = Swi + Slimit;

50
src/spicelib/devices/dev.c

@ -182,3 +182,53 @@ devices(void)
{ {
return DEVices; return DEVices;
} }
#ifdef __MINGW32__
// isnan for SOI devices in MINGW32 hvogt
union ieee754_double
{
double d;
/* This is the IEEE 754 double-precision format. */
struct
{
/* Together these comprise the mantissa. */
unsigned int mantissa1:32;
unsigned int mantissa0:20;
unsigned int exponent:11;
unsigned int negative:1;
} ieee;
struct
{
/* Together these conprise the mantissa. */
unsigned int mantissa1:32;
unsigned int mantissa0:19;
unsigned int quiet_nan:1;
unsigned int exponent:11;
unsigned int negative:1;
} ieee_nan;
};
int
isnan(double value)
{
union ieee754_double u;
u.d = value;
/* IEEE 754 NaN's have the maximum possible
exponent and a nonzero mantissa. */
return ((u.ieee.exponent & 0x7ff) == 0x7ff &&
(u.ieee.mantissa0 != 0 || u.ieee.mantissa1 != 0));
}
/*
* end isnan.c
*/
#endif
Loading…
Cancel
Save