From 3b794a57d195b415f05bf0b07df4c1879bddbfc7 Mon Sep 17 00:00:00 2001 From: stefanjones Date: Wed, 26 May 2004 19:49:15 +0000 Subject: [PATCH] 2004-05-26 Stefan Jones * src/tclspice.c src/include/ngspice.h src/misc/tilde.c src/spicelib/devices/dev.c src/xspice/ipc/ipcsockets.c: Fixup for compiling under mingw --- ChangeLog | 6 +++ src/include/ngspice.h | 8 ++++ src/misc/tilde.c | 6 --- src/spicelib/devices/dev.c | 81 +++++++++++++++++++++++++++++++++++++ src/tclspice.c | 3 ++ src/xspice/ipc/ipcsockets.c | 40 ++++++++++++++++++ 6 files changed, 138 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a0da9d67..0a37e02d7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-05-26 Stefan Jones + + * src/tclspice.c src/include/ngspice.h src/misc/tilde.c + src/spicelib/devices/dev.c src/xspice/ipc/ipcsockets.c: + Fixup for compiling under mingw + 2004-05-21 Stefan Jones * src/frontend/terminal.c: diff --git a/src/include/ngspice.h b/src/include/ngspice.h index c73abda51..308d1c607 100644 --- a/src/include/ngspice.h +++ b/src/include/ngspice.h @@ -184,3 +184,11 @@ extern int tcl_fprintf(FILE *f, const char *format, ...); #define fprintf tcl_fprintf #endif + +#ifdef __MINGW32__ + +#define sigjmp_buf jmp_buf +#define sigsetjmp(a,b) setjmp(a) +#define siglongjmp longjmp + +#endif diff --git a/src/misc/tilde.c b/src/misc/tilde.c index e83343914..718d731f6 100644 --- a/src/misc/tilde.c +++ b/src/misc/tilde.c @@ -71,7 +71,6 @@ tildexpand(char *string) #endif } if (result) { -#ifdef HAVE_PWD_H strcpy(buf, result); if (*string) strcat(buf, string); @@ -79,9 +78,4 @@ tildexpand(char *string) } else return NULL; - -#else - /* Emulate the old behavior to prevent side effects. -- ro */ - return copy(string); -#endif } diff --git a/src/spicelib/devices/dev.c b/src/spicelib/devices/dev.c index a2fb4cfb1..3c169a59d 100644 --- a/src/spicelib/devices/dev.c +++ b/src/spicelib/devices/dev.c @@ -28,6 +28,8 @@ * ENHANCEMENTS, OR MODIFICATIONS. */ #include +#include + #include #include @@ -39,7 +41,13 @@ #ifdef XSPICE /*saj headers for xspice*/ #include /* for strcpy, strcat*/ + +#ifndef __MINGW32__ #include /* to load librarys*/ +#else +#include +#endif + #include "dllitf.h" /* the coreInfo Structure*/ #include "evtudn.h" /*Use defined nodes */ @@ -346,6 +354,7 @@ int add_udn(int n,Evt_Udn_Info_t **udns){ extern struct coreInfo_t coreInfo; +#ifndef __MINGW32__ int load_opus(char *name){ void *lib; @@ -422,5 +431,77 @@ int load_opus(char *name){ return 0; } +#else + +int load_opus(char *name){ + void *lib; + int *num=NULL; + struct coreInfo_t **core; + SPICEdev **devs; + Evt_Udn_Info_t **udns; + void *(*fetch)(void)=NULL; + + lib = LoadLibrary(name); + if(!lib){ + printf("Could not open library %s\n",name); + return 1; + } + + fetch = GetProcAddress(lib,"CMdevNum"); + if(fetch){ + num = (int *)(*fetch)(); + printf("Got %u devices.\n",*num); + fetch = NULL; + }else{ + printf("Could not find symbol CMdevNum\n"); + return 1; + } + + fetch = GetProcAddress(lib,"CMdevs"); + if(fetch){ + devs = (SPICEdev **)(*fetch)(); + fetch = NULL; + }else{ + printf("Could not find symbol CMdevs\n"); + return 1; + } + + fetch = GetProcAddress(lib,"CMgetCoreItfPtr"); + if(fetch){ + core = (struct coreInfo_t **)(*fetch)(); + *core = &coreInfo; + fetch = NULL; + }else{ + printf("Could not find symbol CMgetCoreItfPtr\n"); + return 1; + } + add_device(*num,devs,1); + + fetch = GetProcAddress(lib,"CMudnNum"); + if(fetch){ + num = (int *)(*fetch)(); + printf("Got %u udns.\n",*num); + fetch = NULL; + }else{ + printf("Could not find symbol CMudnNum\n"); + return 1; + } + + fetch = GetProcAddress(lib,"CMudns"); + if(fetch){ + udns = (Evt_Udn_Info_t **)(*fetch)(); + fetch = NULL; + }else{ + printf("Could not find symbol CMudns\n"); + return 1; + } + + add_udn(*num,udns); + + return 0; +} + +#endif /* MINGW */ + #endif /*-------------------- end of XSPICE additions ----------------------*/ diff --git a/src/tclspice.c b/src/tclspice.c index b82267c49..fe3d97c66 100755 --- a/src/tclspice.c +++ b/src/tclspice.c @@ -53,6 +53,9 @@ /* To interupt a spice run */ #include +#ifndef sighandler_t +typedef void (*sighandler_t)(int); +#endif #include extern sigjmp_buf jbuf; diff --git a/src/xspice/ipc/ipcsockets.c b/src/xspice/ipc/ipcsockets.c index 8c4efeba9..a133ec057 100755 --- a/src/xspice/ipc/ipcsockets.c +++ b/src/xspice/ipc/ipcsockets.c @@ -94,6 +94,9 @@ /*=== INCLUDE FILES ===*/ #include "ngspice.h" + +#ifndef __MINGW32__ + #include #include #include @@ -741,4 +744,41 @@ Ipc_Status_t ipc_transport_terminate_server () return status; } +#else + +#include "ipc.h" +#include "ipctiein.h" + +Ipc_Status_t ipc_transport_initialize_server (server_name, mode, protocol, + batch_filename) + char *server_name; /* not used */ + Ipc_Mode_t mode; /* not used */ + Ipc_Protocol_t protocol; /* IN - only used in assert */ + char *batch_filename; /* OUT - returns a value */ + /* Note that unused parameters are required to maintain compatibility */ + /* with version 1 (mailboxes) functions of the same names. */ +{ + return IPC_STATUS_ERROR; +} + +Ipc_Status_t ipc_transport_get_line (str, len, wait) + char *str; /* returns the result, null terminated */ + int *len; /* length of str passed IN and passed OUT */ + Ipc_Wait_t wait; /* IN - wait or dont wait on incoming msg */ +{ + return IPC_STATUS_ERROR; +} + +Ipc_Status_t ipc_transport_send_line (str, len) + char *str; /* IN - String to write */ + int len; /* IN - Number of characters out of STR to write */ +{ + return IPC_STATUS_ERROR; +} + +Ipc_Status_t ipc_transport_terminate_server () { + return IPC_STATUS_ERROR; +} +#endif /* MINGW */ + /*#endif IPC_UNIX_SOCKETS */