Changeset 330e6f8 in tol
- Timestamp:
- Jan 18, 2011, 9:59:13 AM (16 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- a6dac944
- Parents:
- d471a9f
- Location:
- tol
- Files:
-
- 1 added
- 5 edited
-
btol/bgrammar/spfuninst.cpp (modified) (5 diffs)
-
contrib/cint/tolCint.cpp (modified) (16 diffs)
-
contrib/cint/tolCint.h (added)
-
init.cpp (modified) (2 diffs)
-
win-VC8/tollib.vcproj (modified) (2 diffs)
-
win-VC9/tollib.vcproj (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tol/btol/bgrammar/spfuninst.cpp
rd471a9f r330e6f8 51 51 #include <tol/tol_bsymboltable.h> 52 52 #include <tol/tol_bnameblock.h> 53 #include <G__ci.h> 53 #include <contrib/cint/tolCint.h> 54 54 55 55 56 BTraceInit("spfuninst.cpp"); … … 1650 1651 BText ups = BParser::Unparse(tre, " "); 1651 1652 //Std(ups+"\n"); 1652 if(ups==" a::fun(?)::b")1653 if(ups=="cD::C2B") 1653 1654 printf(""); 1654 1655 //Std(BText("\nEvMember branch1='")+BParser::Unparse(branch1," ")+"'\n"); … … 1830 1831 if(gra==GraReal()) 1831 1832 { 1832 BDat cnt = G__double(G__calc(name));1833 BDat cnt = Cint_double(Cint_calc(name)); 1833 1834 /* 1834 g = G__calc(name);1835 g = Cint_calc(name); 1835 1836 bool ok = true; 1836 1837 switch (g.type) … … 1855 1856 int rows = -1, columns = -1; 1856 1857 double* buffer = NULL; 1857 rows = G__int(G__calc(name+".rows_"));1858 columns = G__int(G__calc(name+".columns_"));1859 buffer = (double*) G__int(G__calc(BText("(int)(")+name+".buffer_)"));1858 rows = Cint_int(Cint_calc(name+".rows_")); 1859 columns = Cint_int(Cint_calc(name+".columns_")); 1860 buffer = (double*)Cint_int(Cint_calc(BText("(int)(")+name+".buffer_)")); 1860 1861 if(rows>0 && columns>0 && buffer!=NULL) 1861 1862 { … … 1868 1869 int length = -1; 1869 1870 char* buffer = NULL; 1870 length = G__int(G__calc(name+".length_"));1871 buffer = (char*) G__int(G__calc(BText("(int)(")+name+".buffer_)"));1871 length = Cint_int(Cint_calc(name+".length_")); 1872 buffer = (char*)Cint_int(Cint_calc(BText("(int)(")+name+".buffer_)")); 1872 1873 if(length>0 && buffer!=NULL) 1873 1874 { -
tol/contrib/cint/tolCint.cpp
rd471a9f r330e6f8 22 22 */ 23 23 24 #if defined(_MSC_VER) 25 #include <win_tolinc.h> 26 #endif 24 #include <contrib/cint/tolCint.h> 27 25 28 26 #include <tol/tol_blanguag.h> … … 32 30 #include <tol/tol_btxtgra.h> 33 31 #include <tol/tol_bsetgra.h> 34 35 //#pragma pack(16) 36 #include <Api.h> 37 #include <G__ci.h> 38 //#pragma pack(4) 39 40 /* 41 42 G__scratch_all() 43 44 */ 45 46 //#define DO_TRACE_CINT_DECIMAL; 47 #ifdef DO_TRACE_CINT_DECIMAL 48 #define TRACE_CINT_DECIMAL \ 49 G__exec_text(BText(" double x = 2.1112; printf(\"")+__FILE__+":"+__LINE__+" [x=%.15lg]\n\",x); "); 50 #else 51 #define TRACE_CINT_DECIMAL 52 #endif 53 54 32 #include <ltdl.h> 33 34 typedef void (*G__scratch_all_t) (void); 35 typedef char* (*G__lasterror_filename_t) (void); 36 typedef int (*G__lasterror_linenum_t) (void); 37 typedef int (*G__init_cint_t) (G__CONST char* command); 38 typedef void (*G__set_errmsgcallback_t) (void* p); 39 typedef void (*G__setautoconsole_t) (int autoconsole); 40 typedef void (*G__SetCINTSYSDIR_t) (char* cintsysdir); 41 typedef int (*G__loadfile_t) (G__CONST char* filename); 42 typedef int (*G__unloadfile_t) (G__CONST char* filename); 43 typedef G__value (*G__exec_tempfile_t) (G__CONST char *file); 44 typedef G__value (*G__exec_text_t) (G__CONST char *unnamedmacro); 45 typedef long (*G__int_t) (G__value buf); 46 typedef double (*G__double_t) (G__value buf); 47 typedef G__value (*G__calc_t) (G__CONST char *expr); 48 typedef int (*G__deletevariable_t) (G__CONST char* varname); 49 50 static G__scratch_all_t G__scratch_all_ptr = NULL; 51 static G__lasterror_filename_t G__lasterror_filename_ptr = NULL; 52 static G__lasterror_linenum_t G__lasterror_linenum_ptr = NULL; 53 static G__init_cint_t G__init_cint_ptr = NULL; 54 static G__set_errmsgcallback_t G__set_errmsgcallback_ptr = NULL; 55 static G__setautoconsole_t G__setautoconsole_ptr = NULL; 56 static G__SetCINTSYSDIR_t G__SetCINTSYSDIR_ptr = NULL; 57 static G__loadfile_t G__loadfile_ptr = NULL; 58 static G__unloadfile_t G__unloadfile_ptr = NULL; 59 static G__exec_tempfile_t G__exec_tempfile_ptr = NULL; 60 static G__exec_text_t G__exec_text_ptr = NULL; 61 static G__int_t G__int_ptr = NULL; 62 static G__double_t G__double_ptr = NULL; 63 static G__calc_t G__calc_ptr = NULL; 64 static G__deletevariable_t G__deletevariable_ptr = NULL; 65 66 //-------------------------------------------------------------------- 67 int Cint_dynamic_linkage (void) 68 //-------------------------------------------------------------------- 69 { 70 BText libraryName = "libcint"; 71 BText libraryPath = ""; 72 #ifdef UNIX 73 libraryPath = libraryName+".so"; 74 #else 75 libraryPath = libraryName+".dll"; 76 #endif 77 78 lt_dlhandle handleLib; 79 80 // abro la DynLib 81 handleLib = lt_dlopen( libraryPath ); 82 if ( !handleLib ) 83 { 84 //Std(BText("\nTRACE BLoadDynLib::Evaluator 3 lt_dlerror='")+lt_dlerror()+"'"); 85 BText reason( lt_dlerror( ) ); 86 Warning(BText("[Cint_dynamic_linkage(\"")+libraryPath+"\")]"+" \n" 87 " lt_dlopen error:'"+reason+"'"); 88 return(false); 89 } 90 G__scratch_all_ptr = reinterpret_cast<G__scratch_all_t>( lt_dlsym( handleLib, "G__scratch_all" ) ); 91 G__lasterror_filename_ptr = reinterpret_cast<G__lasterror_filename_t>( lt_dlsym( handleLib, "G__lasterror_filename" ) ); 92 G__lasterror_linenum_ptr = reinterpret_cast<G__lasterror_linenum_t>( lt_dlsym( handleLib, "G__lasterror_linenum" ) ); 93 G__init_cint_ptr = reinterpret_cast<G__init_cint_t>( lt_dlsym( handleLib, "G__init_cint" ) ); 94 G__set_errmsgcallback_ptr = reinterpret_cast<G__set_errmsgcallback_t>( lt_dlsym( handleLib, "G__set_errmsgcallback" ) ); 95 G__setautoconsole_ptr = reinterpret_cast<G__setautoconsole_t>( lt_dlsym( handleLib, "G__setautoconsole" ) ); 96 G__SetCINTSYSDIR_ptr = reinterpret_cast<G__SetCINTSYSDIR_t>( lt_dlsym( handleLib, "G__SetCINTSYSDIR" ) ); 97 G__loadfile_ptr = reinterpret_cast<G__loadfile_t>( lt_dlsym( handleLib, "G__loadfile" ) ); 98 G__unloadfile_ptr = reinterpret_cast<G__unloadfile_t>( lt_dlsym( handleLib, "G__unloadfile" ) ); 99 G__exec_tempfile_ptr = reinterpret_cast<G__exec_tempfile_t>( lt_dlsym( handleLib, "G__exec_tempfile" ) ); 100 G__exec_text_ptr = reinterpret_cast<G__exec_text_t>( lt_dlsym( handleLib, "G__exec_text" ) ); 101 G__int_ptr = reinterpret_cast<G__int_t>( lt_dlsym( handleLib, "G__int" ) ); 102 G__double_ptr = reinterpret_cast<G__double_t>( lt_dlsym( handleLib, "G__double" ) ); 103 G__calc_ptr = reinterpret_cast<G__calc_t>( lt_dlsym( handleLib, "G__calc" ) ); 104 G__deletevariable_ptr = reinterpret_cast<G__deletevariable_t>( lt_dlsym( handleLib, "G__deletevariable" ) ); 105 return(true); 106 } 107 108 //-------------------------------------------------------------------- 109 void Cint_not_linked_message (void) 110 //-------------------------------------------------------------------- 111 { 112 Error("Cannot use CINT due to libcint.dll is not linked."); 113 } 114 115 //-------------------------------------------------------------------- 116 void Cint_scratch_all (void) 117 //-------------------------------------------------------------------- 118 { 119 if(!G__scratch_all_ptr) 120 { 121 Cint_not_linked_message(); 122 return; 123 } 124 (*G__scratch_all_ptr)(); 125 } 126 127 //-------------------------------------------------------------------- 128 char* Cint_lasterror_filename (void) 129 //-------------------------------------------------------------------- 130 { 131 if(!G__lasterror_filename_ptr) 132 { 133 Cint_not_linked_message(); 134 return(NULL); 135 } 136 return((*G__lasterror_filename_ptr)()); 137 } 138 139 //-------------------------------------------------------------------- 140 int Cint_lasterror_linenum (void) 141 //-------------------------------------------------------------------- 142 { 143 if(!G__lasterror_linenum_ptr) 144 { 145 return(0); 146 } 147 return((*G__lasterror_linenum_ptr)()); 148 } 149 150 //-------------------------------------------------------------------- 151 int Cint_init_cint (G__CONST char* command) 152 //-------------------------------------------------------------------- 153 { 154 if(!G__init_cint_ptr) 155 { 156 Cint_not_linked_message(); 157 return(-1); 158 } 159 return((*G__init_cint_ptr)(command)); 160 } 161 162 //-------------------------------------------------------------------- 163 void Cint_set_errmsgcallback (void* p) 164 //-------------------------------------------------------------------- 165 { 166 if(!G__set_errmsgcallback_ptr) 167 { 168 Cint_not_linked_message(); 169 return; 170 } 171 (*G__set_errmsgcallback_ptr) (p); 172 } 173 174 //-------------------------------------------------------------------- 175 void Cint_setautoconsole (int autoconsole) 176 //-------------------------------------------------------------------- 177 { 178 if(!G__setautoconsole_ptr) 179 { 180 Cint_not_linked_message(); 181 return; 182 } 183 (*G__setautoconsole_ptr) (autoconsole); 184 } 185 186 //-------------------------------------------------------------------- 187 void Cint_SetCINTSYSDIR (char* cintsysdir) 188 //-------------------------------------------------------------------- 189 { 190 if(!G__SetCINTSYSDIR_ptr) 191 { 192 Cint_not_linked_message(); 193 return; 194 } 195 (*G__SetCINTSYSDIR_ptr) (cintsysdir); 196 } 197 198 //-------------------------------------------------------------------- 199 int Cint_loadfile (G__CONST char* filename) 200 //-------------------------------------------------------------------- 201 { 202 if(!G__loadfile_ptr) 203 { 204 Cint_not_linked_message(); 205 return(0); 206 } 207 return((*G__loadfile_ptr) (filename)); 208 } 209 210 //-------------------------------------------------------------------- 211 int Cint_unloadfile (G__CONST char* filename) 212 //-------------------------------------------------------------------- 213 { 214 if(!G__unloadfile_ptr) 215 { 216 Cint_not_linked_message(); 217 return(0); 218 } 219 return((*G__unloadfile_ptr) (filename)); 220 } 221 222 //-------------------------------------------------------------------- 223 G__value Cint_exec_tempfile (G__CONST char *file) 224 //-------------------------------------------------------------------- 225 { 226 static G__value gv; 227 if(!G__exec_tempfile_ptr) 228 { 229 Cint_not_linked_message(); 230 return(gv); 231 } 232 return((*G__exec_tempfile_ptr) (file)); 233 } 234 235 //-------------------------------------------------------------------- 236 G__value Cint_exec_text (G__CONST char *unnamedmacro) 237 //-------------------------------------------------------------------- 238 { 239 static G__value gv; 240 if(!G__exec_text_ptr) 241 { 242 Cint_not_linked_message(); 243 return(gv); 244 } 245 return((*G__exec_text_ptr) (unnamedmacro)); 246 } 247 248 //-------------------------------------------------------------------- 249 long Cint_int (G__value buf) 250 //-------------------------------------------------------------------- 251 { 252 if(!G__int_ptr) 253 { 254 Cint_not_linked_message(); 255 return(0); 256 } 257 return((*G__int_ptr) (buf)); 258 } 259 260 //-------------------------------------------------------------------- 261 double Cint_double (G__value buf) 262 //-------------------------------------------------------------------- 263 { 264 if(!G__double_ptr) 265 { 266 Cint_not_linked_message(); 267 return(BDat::Unknown().Value()); 268 } 269 return((*G__double_ptr) (buf)); 270 } 271 272 //-------------------------------------------------------------------- 273 G__value Cint_calc (G__CONST char *expr) 274 //-------------------------------------------------------------------- 275 { 276 static G__value gv; 277 if(!G__calc_ptr) 278 { 279 Cint_not_linked_message(); 280 return(gv ); 281 } 282 return((*G__calc_ptr) (expr)); 283 } 284 285 //-------------------------------------------------------------------- 286 int Cint_deletevariable (G__CONST char* varname) 287 //-------------------------------------------------------------------- 288 { 289 if(!G__deletevariable_ptr) 290 { 291 Cint_not_linked_message(); 292 return(0); 293 } 294 return((*G__deletevariable_ptr) (varname)); 295 } 55 296 56 297 //-------------------------------------------------------------------- … … 70 311 //-------------------------------------------------------------------- 71 312 { 72 BText filename = G__lasterror_filename();73 BText linenum = G__lasterror_linenum();313 BText filename = Cint_lasterror_filename(); 314 BText linenum = Cint_lasterror_linenum(); 74 315 BText locInfo = ""; 75 316 if(filename.HasName()) … … 100 341 { 101 342 Cint_is_initialized() = true; 343 if(!Cint_dynamic_linkage()) { return(false); } 102 344 BText order = "cint"; 103 345 if(filePath.HasName()) { order += BText(" ")+filePath; } 104 int G__init_cint_ = G__init_cint(order);346 int G__init_cint_ = Cint_init_cint(order); 105 347 switch(G__init_cint_) { 106 348 case G__INIT_CINT_SUCCESS_MAIN: … … 115 357 Error("Cint initialization failed G__INIT_CINT_FAILURE.\n"); 116 358 } 117 G__set_errmsgcallback(reinterpret_cast<void*>(Cint_errmsgcallback));118 G__setautoconsole(1);359 Cint_set_errmsgcallback(reinterpret_cast<void*>(Cint_errmsgcallback)); 360 Cint_setautoconsole(1); 119 361 TRACE_CINT_DECIMAL; 120 362 return(G__init_cint_); … … 123 365 124 366 //-------------------------------------------------------------------- 125 int Cint_scratch_all ()367 int Cint_scratch_all_safe() 126 368 //-------------------------------------------------------------------- 127 369 { … … 133 375 { 134 376 Cint_is_initialized() = false; 135 return(Cint_scratch_all()); 377 Cint_scratch_all(); 378 return(true); 136 379 } 137 380 } … … 150 393 if(CheckNonDeclarativeAction("Cint.SetCINTSYSDIR")) { return; } 151 394 BText& filePath = Text(Arg(1)); 152 G__SetCINTSYSDIR(filePath);395 Cint_SetCINTSYSDIR(filePath); 153 396 contens_ = 1; 154 397 } … … 188 431 { 189 432 if(CheckNonDeclarativeAction("Cint.scratch_all")) { return; } 190 contens_ = Cint_scratch_all ();433 contens_ = Cint_scratch_all_safe(); 191 434 } 192 435 … … 207 450 if(CheckNonDeclarativeAction("Cint.loadfile")) { return; } 208 451 BText& filePath = Text(Arg(1)); 209 contens_ = G__loadfile(filePath.String());452 contens_ = Cint_loadfile(filePath.String()); 210 453 } 211 454 … … 223 466 if(CheckNonDeclarativeAction("Cint.unloadfile")) { return; } 224 467 BText& filePath = Text(Arg(1)); 225 contens_ = G__unloadfile(filePath.String());468 contens_ = Cint_unloadfile(filePath.String()); 226 469 } 227 470 … … 247 490 if(CheckNonDeclarativeAction("Cint.exec_tempfile")) { return; } 248 491 BText& filePath = Text(Arg(1)); 249 G__exec_tempfile(filePath.String());492 Cint_exec_tempfile(filePath.String()); 250 493 contens_ = true; 251 494 } … … 274 517 if(CheckNonDeclarativeAction("Cint.exec_text")) { return; } 275 518 BText& expression = Text(Arg(1)); 276 G__exec_text(expression);519 Cint_exec_text(expression); 277 520 contens_ = true; 278 521 } … … 299 542 if(CheckNonDeclarativeAction("Cint.calc")) { return; } 300 543 BText& expression = Text(Arg(1)); 301 contens_ = G__double(G__calc(expression));544 contens_ = Cint_double(Cint_calc(expression)); 302 545 /* 303 G__value g = G__calc(expression);546 G__value g = Cint_calc(expression); 304 547 switch (g.type) 305 548 { … … 430 673 }; 431 674 //Std(BText("\nTRACE [Cint.import_from_tol] expression=[\n")+expression+"\n]\n"); 432 G__exec_text(expression);675 Cint_exec_text(expression); 433 676 } 434 677 … … 479 722 { 480 723 BText pns = prefix_+var->Name()+sufix_; 481 contens_ += G__deletevariable(pns);724 contens_ += Cint_deletevariable(pns); 482 725 } 483 726 } -
tol/init.cpp
rd471a9f r330e6f8 66 66 #include <errno.h> 67 67 #include <gsl/gsl_errno.h> 68 69 68 #include <tol/tol_bnameblock.h> 69 #include <contrib/cint/tolCint.h> 70 70 71 71 … … 124 124 static BText _tolSdkPath_ = ""; 125 125 static BSystemText* tolSdkPath_ = NULL; 126 127 int Cint_initialize(const BText& filePath);128 129 //#define DO_TRACE_CINT_DECIMAL;130 #ifdef DO_TRACE_CINT_DECIMAL131 #include <G__ci.h>132 #define TRACE_CINT_DECIMAL \133 G__exec_text(BText(" double x = 2.1112; printf(\"")+__FILE__+":"+__LINE__+" [x=%.15lg]\n\",x); ");134 #else135 #define TRACE_CINT_DECIMAL136 #endif137 126 138 127 -
tol/win-VC8/tollib.vcproj
rd471a9f r330e6f8 79 79 <Tool 80 80 Name="VCLinkerTool" 81 AdditionalDependencies="user32.lib ws2_32.lib shell32.lib $(ATLAS_LIB)/libcblas.lib $(ATLAS_LIB)/libclapack.lib $(GSL_LIB)/debug/libgsl_dll_d.lib $(CHOLMOD_LIB)/debug/libcholmod.lib $(CHOLMOD_LIB)/debug/blapi.lib $(BZIP2_LIB)/debug/libbz2_debug.lib $(ZipArchive_LIB)/debug/ZipArchive.lib $(CINT_LIB)/libcint.libANN.lib libltdl.lib $(NOINHERIT)"81 AdditionalDependencies="user32.lib ws2_32.lib shell32.lib $(ATLAS_LIB)/libcblas.lib $(ATLAS_LIB)/libclapack.lib $(GSL_LIB)/debug/libgsl_dll_d.lib $(CHOLMOD_LIB)/debug/libcholmod.lib $(CHOLMOD_LIB)/debug/blapi.lib $(BZIP2_LIB)/debug/libbz2_debug.lib $(ZipArchive_LIB)/debug/ZipArchive.lib ANN.lib libltdl.lib $(NOINHERIT)" 82 82 OutputFile="Debug/tol.dll" 83 83 LinkIncremental="2" … … 183 183 <Tool 184 184 Name="VCLinkerTool" 185 AdditionalDependencies="user32.lib shell32.lib ws2_32.lib $(ATLAS_LIB)/libcblas.lib $(ATLAS_LIB)/libclapack.lib $(GSL_LIB)/release/libgsl_dll.lib $(CHOLMOD_LIB)/release/libcholmod.lib $(CHOLMOD_LIB)/release/blapi.lib $(BZIP2_LIB)/release/libbz2.lib $(ZipArchive_LIB)/release/ZipArchive.lib $(CINT_LIB)/libcint.libANN.lib libltdl.lib $(NOINHERIT)"185 AdditionalDependencies="user32.lib shell32.lib ws2_32.lib $(ATLAS_LIB)/libcblas.lib $(ATLAS_LIB)/libclapack.lib $(GSL_LIB)/release/libgsl_dll.lib $(CHOLMOD_LIB)/release/libcholmod.lib $(CHOLMOD_LIB)/release/blapi.lib $(BZIP2_LIB)/release/libbz2.lib $(ZipArchive_LIB)/release/ZipArchive.lib ANN.lib libltdl.lib $(NOINHERIT)" 186 186 OutputFile="$(OutDir)\tol.dll" 187 187 LinkIncremental="1" -
tol/win-VC9/tollib.vcproj
rd471a9f r330e6f8 80 80 <Tool 81 81 Name="VCLinkerTool" 82 AdditionalDependencies="user32.lib ws2_32.lib shell32.lib $(ATLAS_LIB)/libcblas.lib $(ATLAS_LIB)/libclapack.lib $(GSL_LIB)/debug/libgsl_dll_d.lib $(CHOLMOD_LIB)/debug/libcholmod.lib $(CHOLMOD_LIB)/debug/blapi.lib $(BZIP2_LIB)/debug/libbz2_debug.lib $(ZipArchive_LIB)/debug/ZipArchive.lib $(CINT_LIB)/libcint.libANN.lib libltdl.lib $(NOINHERIT)"82 AdditionalDependencies="user32.lib ws2_32.lib shell32.lib $(ATLAS_LIB)/libcblas.lib $(ATLAS_LIB)/libclapack.lib $(GSL_LIB)/debug/libgsl_dll_d.lib $(CHOLMOD_LIB)/debug/libcholmod.lib $(CHOLMOD_LIB)/debug/blapi.lib $(BZIP2_LIB)/debug/libbz2_debug.lib $(ZipArchive_LIB)/debug/ZipArchive.lib ANN.lib libltdl.lib $(NOINHERIT)" 83 83 OutputFile="Debug/tol.dll" 84 84 LinkIncremental="2" … … 183 183 <Tool 184 184 Name="VCLinkerTool" 185 AdditionalDependencies="user32.lib shell32.lib ws2_32.lib $(ATLAS_LIB)/libcblas.lib $(ATLAS_LIB)/libclapack.lib $(GSL_LIB)/release/libgsl_dll.lib $(CHOLMOD_LIB)/release/libcholmod.lib $(CHOLMOD_LIB)/release/blapi.lib $(BZIP2_LIB)/release/libbz2.lib $(ZipArchive_LIB)/release/ZipArchive.lib $(CINT_LIB)/libcint.libANN.lib libltdl.lib $(NOINHERIT)"185 AdditionalDependencies="user32.lib shell32.lib ws2_32.lib $(ATLAS_LIB)/libcblas.lib $(ATLAS_LIB)/libclapack.lib $(GSL_LIB)/release/libgsl_dll.lib $(CHOLMOD_LIB)/release/libcholmod.lib $(CHOLMOD_LIB)/release/blapi.lib $(BZIP2_LIB)/release/libbz2.lib $(ZipArchive_LIB)/release/ZipArchive.lib ANN.lib libltdl.lib $(NOINHERIT)" 186 186 OutputFile="$(OutDir)\tol.dll" 187 187 LinkIncremental="1"
Note: See TracChangeset
for help on using the changeset viewer.
