diff --git a/ChangeLog b/ChangeLog index 7c24e9ce4..bc21850e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-02-11 Holger Vogt + * ngspice.h: fprintf --> tcl_fprintf added + * tclspice.c: small updates for Windows + * outitf.c, vectors.c, alloc.c: + outheap (under Windows) provided, but deactivated + 2012-02-11 Robert Larice * src/spicelib/parser/inpptree-parser.c , * src/spicelib/parser/inpptree-parser.h : diff --git a/src/frontend/outitf.c b/src/frontend/outitf.c index 65f16181d..5317a8ea3 100644 --- a/src/frontend/outitf.c +++ b/src/frontend/outitf.c @@ -68,7 +68,7 @@ static void freeRun(runDesc *run); to prevent massive memory fragmentation of standard process heap. This is especially required by TCL for Windows, but may help also under standard Windows GUI. */ -#if (defined(HAS_TCLWIN)) && ((defined(_MSC_VER) || defined(__MINGW32__))) +#if 0 && (defined(HAS_TCLWIN)) && ((defined(_MSC_VER) || defined(__MINGW32__))) #define newrealloc hrealloc #else #define newrealloc trealloc diff --git a/src/frontend/vectors.c b/src/frontend/vectors.c index de1308b53..31f125614 100644 --- a/src/frontend/vectors.c +++ b/src/frontend/vectors.c @@ -22,6 +22,14 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include "plotting/plotting.h" #include "error.h" /* controlled_exit() */ +#if 0 && defined(HAS_TCLWIN) +#if defined(_MSC_VER) || defined(__MINGW32__) +#undef BOOLEAN +#include +extern HANDLE outheap; +#endif +#endif + #ifdef XSPICE /* gtri - begin - add function prototype for EVTfindvec */ struct dvec *EVTfindvec(char *node); @@ -813,7 +821,17 @@ vec_free_x(struct dvec *v) } } if (v->v_name) tfree(v->v_name); +#if 0 && (defined(HAS_TCLWIN)) && ((defined(_MSC_VER) || defined(__MINGW32__))) + if (v->v_realdata) { + if (HeapValidate(outheap, 0, v->v_realdata)) + HeapFree(outheap, 0, v->v_realdata); + else + tfree(v->v_realdata); + } +#else if (v->v_realdata) tfree(v->v_realdata); +#endif + if (v->v_compdata) tfree(v->v_compdata); tfree(v); return; diff --git a/src/include/ngspice/ngspice.h b/src/include/ngspice/ngspice.h index 526c3c7bb..c51166f24 100644 --- a/src/include/ngspice/ngspice.h +++ b/src/include/ngspice/ngspice.h @@ -247,6 +247,9 @@ extern int tcl_fprintf(FILE *f, const char *format, ...); #undef printf #define printf tcl_printf +#undef fprintf +#define fprintf tcl_fprintf + #undef perror #define perror(string) fprintf(stderr,"%s: %s\n",string,sys_errlist[errno]) diff --git a/src/misc/alloc.c b/src/misc/alloc.c index aa28bf571..c25ccc3e2 100644 --- a/src/misc/alloc.c +++ b/src/misc/alloc.c @@ -14,7 +14,7 @@ Copyright 1990 Regents of the University of California. All rights reserved. #include #endif -#if defined(HAS_WINDOWS) || defined(HAS_TCLWIN) +#if defined(HAS_WINDOWS) || (defined(HAS_TCLWIN) && 0) #if defined(_MSC_VER) || defined(__MINGW32__) #undef BOOLEAN #include @@ -142,7 +142,7 @@ trealloc(void *ptr, size_t num) Function is used in outitf.c to prevent heap fragmentation An additional heap outheap is used to store the plot output data. */ -#if defined(HAS_TCLWIN) +#if 0 && defined(HAS_TCLWIN) #if defined(_MSC_VER) || defined(__MINGW32__) void * hrealloc(void *ptr, size_t num) diff --git a/src/tclspice.c b/src/tclspice.c index 781b55ac7..229cf8bf6 100755 --- a/src/tclspice.c +++ b/src/tclspice.c @@ -187,6 +187,9 @@ HANDLE outheap; void tcl_stdflush(FILE *f); int tcl_vfprintf(FILE *f, const char *fmt, va_list args); +#if defined(__MINGW32__) || defined(_MSC_VER) +__declspec(dllexport) +#endif int Spice_Init(Tcl_Interp *interp); int Tcl_ExecutePerLoop(void); void triggerEventCheck(ClientData clientData,int flags); @@ -512,7 +515,7 @@ static int vectoblt TCL_CMDPROCARGS(clientData,interp,argc,argv) { var = (char *)argv[1]; var_dvec = vec_get(var); if ( var_dvec == NULL ){ - Tcl_SetResult(interp, "Bad spice vector",TCL_STATIC); + Tcl_SetResult(interp, "Bad spice vector ", TCL_STATIC); Tcl_AppendResult(interp, (char *)var, TCL_STATIC); return TCL_ERROR; } @@ -2241,7 +2244,7 @@ int Spice_Init(Tcl_Interp *interp) { save_interp(); -#if defined(_MSC_VER) || defined(__MINGW32__) +#if 0 && (defined(_MSC_VER) || defined(__MINGW32__)) /* create private heap for current process*/ outheap = HeapCreate(0, 10000000, 0); if (!outheap) { @@ -2344,9 +2347,9 @@ bot: for (i = 0;(key = cp_coms[i].co_comname); i++) { sprintf(buf,"%s%s",TCLSPICE_prefix,key); if(Tcl_GetCommandInfo(interp,buf, &infoPtr)!= 0){ - printf("Command '%s' can not be registered!\n", buf); + printf("Command '%s' can not be registered!\n", buf); }else{ - Tcl_CreateCommand(interp, buf, _tcl_dispatch, NULL, NULL); + Tcl_CreateCommand(interp, buf, _tcl_dispatch, NULL, NULL); } }