From 8ddd172cc978ff56ab9a4b0c2491419518fe9d45 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Fri, 14 May 2010 20:26:54 +0000 Subject: [PATCH] tmalloc patch R Larice --- ChangeLog | 5 ++ src/include/dllitf.h | 6 +- src/spicelib/devices/cpl/cplsetup.c | 3 - src/xspice/cm/cmexport.c | 31 +++++---- src/xspice/icm/xtraevt/int/udnfunc.c | 2 +- src/xspice/icm/xtraevt/real/udnfunc.c | 2 +- src/xspice/xspice.c | 31 +++++---- visualc/vngspice.sln | 91 +++++++++++++-------------- visualc/vngspice.vcproj | 16 +++-- 9 files changed, 101 insertions(+), 86 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a9482f89..e068f8d0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-05-14 Holger Vogt + * dllitf.h, cplsetup.c, cmexport.c, int/udnfunc.c, real/udnfunc.c, xspice.c: + tmalloc patch by R Larice + vngspice.sln, vngspice.proj: 64 bit support + 2010-05-11 Holger Vogt * inpcom.c: new fcn inp_fix_gnd_name: 'gnd' replaced by ' 0 ', if delimiters are '(' or ' ' or ',' on the left and ')' or ' ' or ',' on the right. diff --git a/src/include/dllitf.h b/src/include/dllitf.h index 7915f1d1d..3d2ee14e2 100755 --- a/src/include/dllitf.h +++ b/src/include/dllitf.h @@ -72,9 +72,9 @@ struct coreInfo_t { void * ((*dllitf_calloc_pj)(size_t, size_t)); void * ((*dllitf_realloc_pj)(void *, size_t)); void ((*dllitf_free_pj)(void *)); - char * ((*dllitf_tmalloc)(int)); - char * ((*dllitf_trealloc)(char *, int)); - void ((*dllitf_txfree)(char *)); + void * ((*dllitf_tmalloc)(size_t)); + void * ((*dllitf_trealloc)(void *, size_t)); + void ((*dllitf_txfree)(void *)); }; #endif diff --git a/src/spicelib/devices/cpl/cplsetup.c b/src/spicelib/devices/cpl/cplsetup.c index 1c876af0e..16ff68df3 100644 --- a/src/spicelib/devices/cpl/cplsetup.c +++ b/src/spicelib/devices/cpl/cplsetup.c @@ -1890,9 +1890,6 @@ static int divC(double ar, double ai, double br, double bi, double *cr, double * static NODE *NEW_node(void) { - /* - char *tmalloc(); - */ NODE *n; n = (NODE *) tmalloc (sizeof (NODE)); diff --git a/src/xspice/cm/cmexport.c b/src/xspice/cm/cmexport.c index 88a7e5ae6..c0a301709 100755 --- a/src/xspice/cm/cmexport.c +++ b/src/xspice/cm/cmexport.c @@ -3,13 +3,18 @@ #include #include +#define U(x) (void)x /*how annoying!, needed for structure below*/ -static void *tcalloc(size_t a, size_t b){ - return tmalloc(a*b); +static void *tcalloc(size_t a, size_t b) { + return tmalloc(a*b); /* FIXME, tcalloc must zero !?!? */ } -static void *empty(void){ +static void no_free(void *p) { + U(p); +} + +static FILE * no_file(void) { return NULL; } @@ -58,24 +63,24 @@ struct coreInfo_t coreInfo = cm_complex_subtract, cm_complex_multiply, cm_complex_divide, - (FILE *(*)(void))empty, - (FILE *(*)(void))empty, - (FILE *(*)(void))empty, + no_file, + no_file, + no_file, #ifndef HAVE_LIBGC tmalloc, tcalloc, trealloc, txfree, - (char *(*)(int))tmalloc, - (char *(*)(char *,int))trealloc, - (void (*)(char *))txfree + tmalloc, + trealloc, + txfree #else GC_malloc, tcalloc, GC_realloc, - (void (*)(void *))empty, - (char *(*)(int))GC_malloc, - (char *(*)(char *,int))GC_realloc, - (void (*)(char *))empty + no_free, + GC_malloc, + GC_realloc, + no_free #endif }; diff --git a/src/xspice/icm/xtraevt/int/udnfunc.c b/src/xspice/icm/xtraevt/int/udnfunc.c index 1cbdc0ef7..ca20d0827 100644 --- a/src/xspice/icm/xtraevt/int/udnfunc.c +++ b/src/xspice/icm/xtraevt/int/udnfunc.c @@ -44,7 +44,7 @@ NON-STANDARD FEATURES #include "evtudn.h" -void *tmalloc(unsigned); +void *tmalloc(size_t); diff --git a/src/xspice/icm/xtraevt/real/udnfunc.c b/src/xspice/icm/xtraevt/real/udnfunc.c index 641e28dae..9ae51080e 100644 --- a/src/xspice/icm/xtraevt/real/udnfunc.c +++ b/src/xspice/icm/xtraevt/real/udnfunc.c @@ -44,7 +44,7 @@ NON-STANDARD FEATURES #include "evtudn.h" -void *tmalloc(unsigned); +void *tmalloc(size_t); diff --git a/src/xspice/xspice.c b/src/xspice/xspice.c index 1762f5223..c0a301709 100755 --- a/src/xspice/xspice.c +++ b/src/xspice/xspice.c @@ -3,13 +3,18 @@ #include #include +#define U(x) (void)x /*how annoying!, needed for structure below*/ -void *tcalloc(size_t a, size_t b){ - return tmalloc(a*b); +static void *tcalloc(size_t a, size_t b) { + return tmalloc(a*b); /* FIXME, tcalloc must zero !?!? */ } -static void *empty(void){ +static void no_free(void *p) { + U(p); +} + +static FILE * no_file(void) { return NULL; } @@ -58,24 +63,24 @@ struct coreInfo_t coreInfo = cm_complex_subtract, cm_complex_multiply, cm_complex_divide, - (FILE *(*)(void))empty, - (FILE *(*)(void))empty, - (FILE *(*)(void))empty, + no_file, + no_file, + no_file, #ifndef HAVE_LIBGC tmalloc, tcalloc, trealloc, txfree, - (char *(*)(int))tmalloc, - (char *(*)(char *,int))trealloc, - (void (*)(char *))txfree + tmalloc, + trealloc, + txfree #else GC_malloc, tcalloc, GC_realloc, - (void (*)(void *))empty, - (char *(*)(int))GC_malloc, - (char *(*)(char *,int))GC_realloc, - (void (*)(char *))empty + no_free, + GC_malloc, + GC_realloc, + no_free #endif }; diff --git a/visualc/vngspice.sln b/visualc/vngspice.sln index c47acb3c9..d03c9317a 100644 --- a/visualc/vngspice.sln +++ b/visualc/vngspice.sln @@ -1,47 +1,44 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual C++ Express 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vngspice", "vngspice.vcproj", "{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - console_debug|Win32 = console_debug|Win32 - console_debug|x64 = console_debug|x64 - console_release|Win32 = console_release|Win32 - console_release|x64 = console_release|x64 - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - release64|Win32 = release64|Win32 - release64|x64 = release64|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_debug|Win32.ActiveCfg = console_debug|Win32 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_debug|Win32.Build.0 = console_debug|Win32 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_debug|x64.ActiveCfg = console_debug|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_debug|x64.Build.0 = console_debug|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_release|Win32.ActiveCfg = console_release|Win32 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_release|Win32.Build.0 = console_release|Win32 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_release|x64.ActiveCfg = console_release|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_release|x64.Build.0 = console_release|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|Win32.ActiveCfg = Debug|Win32 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|Win32.Build.0 = Debug|Win32 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|x64.ActiveCfg = Debug|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|x64.Build.0 = Debug|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|Win32.ActiveCfg = Release|Win32 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|Win32.Build.0 = Release|Win32 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|x64.ActiveCfg = Release|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|x64.Build.0 = Release|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.release64|Win32.ActiveCfg = release64|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.release64|Win32.Build.0 = release64|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.release64|x64.ActiveCfg = release64|x64 - {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.release64|x64.Build.0 = release64|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - AMDCaProjectFile = D:\Spice_general\ng-spice-rework\visualc\CodeAnalyst\vngspice.caw - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vngspice", "vngspice.vcproj", "{83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + console_debug|Win32 = console_debug|Win32 + console_debug|x64 = console_debug|x64 + console_release|Win32 = console_release|Win32 + console_release|x64 = console_release|x64 + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + release64|Win32 = release64|Win32 + release64|x64 = release64|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_debug|Win32.ActiveCfg = console_debug|Win32 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_debug|Win32.Build.0 = console_debug|Win32 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_debug|x64.ActiveCfg = console_debug|x64 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_debug|x64.Build.0 = console_debug|x64 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_release|Win32.ActiveCfg = console_release|Win32 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_release|Win32.Build.0 = console_release|Win32 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_release|x64.ActiveCfg = console_release|x64 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.console_release|x64.Build.0 = console_release|x64 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|Win32.ActiveCfg = Debug|Win32 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|Win32.Build.0 = Debug|Win32 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|x64.ActiveCfg = Debug|x64 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Debug|x64.Build.0 = Debug|x64 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|Win32.ActiveCfg = Release|Win32 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|Win32.Build.0 = Release|Win32 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|x64.ActiveCfg = Release|x64 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.Release|x64.Build.0 = Release|x64 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.release64|Win32.ActiveCfg = release64|Win32 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.release64|Win32.Build.0 = release64|Win32 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.release64|x64.ActiveCfg = release64|x64 + {83E315C7-EDD3-4F6B-AF28-87A92A4FA49A}.release64|x64.Build.0 = release64|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/visualc/vngspice.vcproj b/visualc/vngspice.vcproj index 03828aa5e..7e0c93b97 100644 --- a/visualc/vngspice.vcproj +++ b/visualc/vngspice.vcproj @@ -842,7 +842,7 @@ FavorSizeOrSpeed="1" WholeProgramOptimization="true" AdditionalIncludeDirectories=""$(ProjectDir)..\src\maths\poly";"$(ProjectDir)..\src\frontend";"$(ProjectDir)..\src\spicelib\devices";"$(ProjectDir)..\src\include";"$(ProjectDir)include"" - PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;SIMULATOR" + PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;SIMULATOR,PSAPI_VERSION=1" WarningLevel="3" CompileAs="1" /> @@ -857,6 +857,8 @@ /> + +