Browse Source

updates tcl for Windows

h_vogt 14 years ago
parent
commit
5d101f46f9
  1. 6
      ChangeLog
  2. 2
      src/frontend/outitf.c
  3. 18
      src/frontend/vectors.c
  4. 3
      src/include/ngspice/ngspice.h
  5. 4
      src/misc/alloc.c
  6. 11
      src/tclspice.c

6
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 2012-02-11 Robert Larice
* src/spicelib/parser/inpptree-parser.c , * src/spicelib/parser/inpptree-parser.c ,
* src/spicelib/parser/inpptree-parser.h : * src/spicelib/parser/inpptree-parser.h :

2
src/frontend/outitf.c

@ -68,7 +68,7 @@ static void freeRun(runDesc *run);
to prevent massive memory fragmentation of standard process heap. to prevent massive memory fragmentation of standard process heap.
This is especially required by TCL for Windows, but may help This is especially required by TCL for Windows, but may help
also under standard Windows GUI. */ 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 #define newrealloc hrealloc
#else #else
#define newrealloc trealloc #define newrealloc trealloc

18
src/frontend/vectors.c

@ -22,6 +22,14 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "plotting/plotting.h" #include "plotting/plotting.h"
#include "error.h" /* controlled_exit() */ #include "error.h" /* controlled_exit() */
#if 0 && defined(HAS_TCLWIN)
#if defined(_MSC_VER) || defined(__MINGW32__)
#undef BOOLEAN
#include <windows.h>
extern HANDLE outheap;
#endif
#endif
#ifdef XSPICE #ifdef XSPICE
/* gtri - begin - add function prototype for EVTfindvec */ /* gtri - begin - add function prototype for EVTfindvec */
struct dvec *EVTfindvec(char *node); struct dvec *EVTfindvec(char *node);
@ -813,7 +821,17 @@ vec_free_x(struct dvec *v)
} }
} }
if (v->v_name) tfree(v->v_name); 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); if (v->v_realdata) tfree(v->v_realdata);
#endif
if (v->v_compdata) tfree(v->v_compdata); if (v->v_compdata) tfree(v->v_compdata);
tfree(v); tfree(v);
return; return;

3
src/include/ngspice/ngspice.h

@ -247,6 +247,9 @@ extern int tcl_fprintf(FILE *f, const char *format, ...);
#undef printf #undef printf
#define printf tcl_printf #define printf tcl_printf
#undef fprintf
#define fprintf tcl_fprintf
#undef perror #undef perror
#define perror(string) fprintf(stderr,"%s: %s\n",string,sys_errlist[errno]) #define perror(string) fprintf(stderr,"%s: %s\n",string,sys_errlist[errno])

4
src/misc/alloc.c

@ -14,7 +14,7 @@ Copyright 1990 Regents of the University of California. All rights reserved.
#include <tcl.h> #include <tcl.h>
#endif #endif
#if defined(HAS_WINDOWS) || defined(HAS_TCLWIN)
#if defined(HAS_WINDOWS) || (defined(HAS_TCLWIN) && 0)
#if defined(_MSC_VER) || defined(__MINGW32__) #if defined(_MSC_VER) || defined(__MINGW32__)
#undef BOOLEAN #undef BOOLEAN
#include <windows.h> #include <windows.h>
@ -142,7 +142,7 @@ trealloc(void *ptr, size_t num)
Function is used in outitf.c to prevent heap fragmentation Function is used in outitf.c to prevent heap fragmentation
An additional heap outheap is used to store the plot output data. 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__) #if defined(_MSC_VER) || defined(__MINGW32__)
void * void *
hrealloc(void *ptr, size_t num) hrealloc(void *ptr, size_t num)

11
src/tclspice.c

@ -187,6 +187,9 @@ HANDLE outheap;
void tcl_stdflush(FILE *f); void tcl_stdflush(FILE *f);
int tcl_vfprintf(FILE *f, const char *fmt, va_list args); 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 Spice_Init(Tcl_Interp *interp);
int Tcl_ExecutePerLoop(void); int Tcl_ExecutePerLoop(void);
void triggerEventCheck(ClientData clientData,int flags); void triggerEventCheck(ClientData clientData,int flags);
@ -512,7 +515,7 @@ static int vectoblt TCL_CMDPROCARGS(clientData,interp,argc,argv) {
var = (char *)argv[1]; var = (char *)argv[1];
var_dvec = vec_get(var); var_dvec = vec_get(var);
if ( var_dvec == NULL ){ 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); Tcl_AppendResult(interp, (char *)var, TCL_STATIC);
return TCL_ERROR; return TCL_ERROR;
} }
@ -2241,7 +2244,7 @@ int Spice_Init(Tcl_Interp *interp) {
save_interp(); save_interp();
#if defined(_MSC_VER) || defined(__MINGW32__)
#if 0 && (defined(_MSC_VER) || defined(__MINGW32__))
/* create private heap for current process*/ /* create private heap for current process*/
outheap = HeapCreate(0, 10000000, 0); outheap = HeapCreate(0, 10000000, 0);
if (!outheap) { if (!outheap) {
@ -2344,9 +2347,9 @@ bot:
for (i = 0;(key = cp_coms[i].co_comname); i++) { for (i = 0;(key = cp_coms[i].co_comname); i++) {
sprintf(buf,"%s%s",TCLSPICE_prefix,key); sprintf(buf,"%s%s",TCLSPICE_prefix,key);
if(Tcl_GetCommandInfo(interp,buf, &infoPtr)!= 0){ 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{ }else{
Tcl_CreateCommand(interp, buf, _tcl_dispatch, NULL, NULL);
Tcl_CreateCommand(interp, buf, _tcl_dispatch, NULL, NULL);
} }
} }

Loading…
Cancel
Save