updates tcl for Windows

This commit is contained in:
h_vogt 2012-02-11 11:59:12 +00:00
parent 848b0c2158
commit 5d101f46f9
6 changed files with 37 additions and 7 deletions

View File

@ -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 :

View File

@ -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

View File

@ -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 <windows.h>
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;

View File

@ -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])

View File

@ -14,7 +14,7 @@ Copyright 1990 Regents of the University of California. All rights reserved.
#include <tcl.h>
#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 <windows.h>
@ -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)

View File

@ -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);
}
}