spielwiese
Last change
on this file since beab83 was
beab83,
checked in by Michael Brickenstein <bricken@…>, 21 years ago
|
+ gmp workaround
git-svn-id: file:///usr/local/Singular/svn/trunk@6305 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /* $Id: mminit.cc,v 1.25 2002-11-04 17:14:18 bricken Exp $ */ |
---|
5 | /* |
---|
6 | * ABSTRACT: init of memory management |
---|
7 | */ |
---|
8 | |
---|
9 | #include <stdio.h> |
---|
10 | #include <stdlib.h> |
---|
11 | |
---|
12 | #include "mod2.h" |
---|
13 | #include "mmalloc.h" |
---|
14 | #include "structs.h" |
---|
15 | // this prevents the definition of malloc/free and macros |
---|
16 | // by omalloc |
---|
17 | #define OMALLOC_C |
---|
18 | #include "omalloc.h" |
---|
19 | |
---|
20 | extern "C" |
---|
21 | { |
---|
22 | #ifdef __cplusplus |
---|
23 | #undef __cplusplus |
---|
24 | #include <gmp.h> |
---|
25 | #define __cplusplus |
---|
26 | #else |
---|
27 | #include <gmp.h> |
---|
28 | #endif |
---|
29 | } |
---|
30 | |
---|
31 | int mmIsInitialized=mmInit(); |
---|
32 | |
---|
33 | extern "C" |
---|
34 | { |
---|
35 | void omSingOutOfMemoryFunc() |
---|
36 | { |
---|
37 | fprintf(stderr, "\nerror: no more memory\n"); |
---|
38 | omPrintStats(stderr); |
---|
39 | m2_end(14); |
---|
40 | /* should never get here */ |
---|
41 | exit(1); |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | int mmInit( void ) |
---|
46 | { |
---|
47 | if(mmIsInitialized==0) |
---|
48 | { |
---|
49 | #if defined(OMALLOC_USES_MALLOC) || defined(X_OMALLOC) |
---|
50 | mp_set_memory_functions(omMallocFunc,omReallocSizeFunc,omFreeSizeFunc); |
---|
51 | #else |
---|
52 | mp_set_memory_functions(malloc,reallocSize,freeSize); |
---|
53 | #endif |
---|
54 | om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc; |
---|
55 | #ifndef OM_NDEBUG |
---|
56 | om_Opts.ErrorHook = dErrorBreak; |
---|
57 | #endif |
---|
58 | omInitInfo(); |
---|
59 | #ifdef OM_SING_KEEP |
---|
60 | om_Opts.Keep = OM_SING_KEEP; |
---|
61 | #endif |
---|
62 | } |
---|
63 | mmIsInitialized=1; |
---|
64 | return 1; |
---|
65 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.