Changeset 9f82971 in git
- Timestamp:
- Nov 5, 2010, 12:02:15 PM (13 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 088214122d919b931fc5e2a3bda1528332aedcc0
- Parents:
- ce2fa9e3304caaa51b9f2278ca19da5ae34105d0
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/misc_ip.cc
rce2fa9 r9f82971 1074 1074 } 1075 1075 } 1076 1077 const char *singular_date=__DATE__ " " __TIME__; 1078 1079 int mmInit( void ); 1080 int mmIsInitialized=mmInit(); 1081 1082 extern "C" 1083 { 1084 void omSingOutOfMemoryFunc() 1085 { 1086 fprintf(stderr, "\nSingular error: no more memory\n"); 1087 omPrintStats(stderr); 1088 m2_end(14); 1089 /* should never get here */ 1090 exit(1); 1091 } 1092 } 1093 1094 int mmInit( void ) 1095 { 1096 if(mmIsInitialized==0) 1097 { 1098 1099 #ifndef LIBSINGULAR 1100 #if defined(OMALLOC_USES_MALLOC) || defined(X_OMALLOC) 1101 /* in mmstd.c, for some architectures freeSize() unconditionally uses the *system* free() */ 1102 /* sage ticket 5344: http://trac.sagemath.org/sage_trac/ticket/5344 */ 1103 #include <omalloc/omalloc.h> 1104 /* do not rely on the default in Singular as libsingular may be different */ 1105 mp_set_memory_functions(omMallocFunc,omReallocSizeFunc,omFreeSizeFunc); 1106 #else 1107 mp_set_memory_functions(malloc,reallocSize,freeSize); 1108 #endif 1109 #endif // ifndef LIBSINGULAR 1110 om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc; 1111 #ifndef OM_NDEBUG 1112 #ifndef __OPTIMIZE__ 1113 om_Opts.ErrorHook = dErrorBreak; 1114 #endif 1115 #endif 1116 omInitInfo(); 1117 #ifdef OM_SING_KEEP 1118 om_Opts.Keep = OM_SING_KEEP; 1119 #endif 1120 } 1121 mmIsInitialized=1; 1122 return 1; 1123 } 1124 1125 #ifdef LIBSINGULAR 1126 int siInit(char *name) 1127 { 1128 // hack such that all shared' libs in the bindir are loaded correctly 1129 feInitResources(name); 1130 iiInitArithmetic(); 1131 1132 #if 0 1133 SingularBuilder::Ptr SingularInstance = SingularBuilder::instance(); 1134 #else 1135 basePack=(package)omAlloc0(sizeof(*basePack)); 1136 currPack=basePack; 1137 idhdl h; 1138 h=enterid("Top", 0, PACKAGE_CMD, &IDROOT, TRUE); 1139 IDPACKAGE(h)->language = LANG_TOP; 1140 IDPACKAGE(h)=basePack; 1141 currPackHdl=h; 1142 basePackHdl=h; 1143 1144 slStandardInit(); 1145 myynest=0; 1146 #endif 1147 if (! feOptValue(FE_OPT_NO_STDLIB)) 1148 { 1149 int vv=verbose; 1150 verbose &= ~Sy_bit(V_LOAD_LIB); 1151 iiLibCmd(omStrDup("standard.lib"), TRUE,TRUE,TRUE); 1152 verbose=vv; 1153 } 1154 errorreported = 0; 1155 } 1156 #endif 1157 -
Singular/tesths.cc
rce2fa9 r9f82971 40 40 extern int iiInitArithmetic(); 41 41 42 const char *singular_date=__DATE__ " " __TIME__;43 44 #include <kernel/si_gmp.h>45 46 int mmInit( void );47 int mmIsInitialized=mmInit();48 49 extern "C"50 {51 void omSingOutOfMemoryFunc()52 {53 fprintf(stderr, "\nSingular error: no more memory\n");54 omPrintStats(stderr);55 m2_end(14);56 /* should never get here */57 exit(1);58 }59 }60 61 int mmInit( void )62 {63 if(mmIsInitialized==0)64 {65 66 #ifndef LIBSINGULAR67 #if defined(OMALLOC_USES_MALLOC) || defined(X_OMALLOC)68 /* in mmstd.c, for some architectures freeSize() unconditionally uses the *system* free() */69 /* sage ticket 5344: http://trac.sagemath.org/sage_trac/ticket/5344 */70 #include <omalloc/omalloc.h>71 /* do not rely on the default in Singular as libsingular may be different */72 mp_set_memory_functions(omMallocFunc,omReallocSizeFunc,omFreeSizeFunc);73 #else74 mp_set_memory_functions(malloc,reallocSize,freeSize);75 #endif76 #endif // ifndef LIBSINGULAR77 om_Opts.OutOfMemoryFunc = omSingOutOfMemoryFunc;78 #ifndef OM_NDEBUG79 #ifndef __OPTIMIZE__80 om_Opts.ErrorHook = dErrorBreak;81 #endif82 #endif83 omInitInfo();84 #ifdef OM_SING_KEEP85 om_Opts.Keep = OM_SING_KEEP;86 #endif87 }88 mmIsInitialized=1;89 return 1;90 }91 92 #ifdef LIBSINGULAR93 int siInit(char *name)94 {95 // hack such that all shared' libs in the bindir are loaded correctly96 feInitResources(name);97 iiInitArithmetic();98 99 #if 0100 SingularBuilder::Ptr SingularInstance = SingularBuilder::instance();101 #else102 basePack=(package)omAlloc0(sizeof(*basePack));103 currPack=basePack;104 idhdl h;105 h=enterid("Top", 0, PACKAGE_CMD, &IDROOT, TRUE);106 IDPACKAGE(h)->language = LANG_TOP;107 IDPACKAGE(h)=basePack;108 currPackHdl=h;109 basePackHdl=h;110 111 slStandardInit();112 myynest=0;113 #endif114 if (! feOptValue(FE_OPT_NO_STDLIB))115 {116 int vv=verbose;117 verbose &= ~Sy_bit(V_LOAD_LIB);118 iiLibCmd(omStrDup("standard.lib"), TRUE,TRUE,TRUE);119 verbose=vv;120 }121 errorreported = 0;122 }123 #endif124 125 42 #if ! defined(LIBSINGULAR) 126 43 /*0 implementation*/
Note: See TracChangeset
for help on using the changeset viewer.