Changeset 57dcd6 in git
- Timestamp:
- Dec 13, 2012, 12:07:24 AM (10 years ago)
- Branches:
- (u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'cdfcdb8287f66bc6070028082cbbc6eff10e609b')
- Children:
- c1e7a64cbf29c8f08287152a94545e06e8608a9a
- Parents:
- 801d2b82d26cf116224a17169c6379c454c018e7
- git-author:
- Alexander Dreyer <adreyer@gmx.de>2012-12-13 00:07:24+01:00
- git-committer:
- Alexander Dreyer <adreyer@gmx.de>2012-12-14 11:40:21+01:00
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
r801d2b r57dcd6 2948 2948 res->rtyp = NONE; 2949 2949 return FALSE; 2950 }2951 else2952 2953 /*==== pyobject (or pyobject*, like pyobject.so) force loading python ===*/2954 if (strncmp(sys_cmd, "pyobject", 8) == 0)2955 {2956 res->rtyp = NONE;2957 return pyobject_ensure();2958 2950 } 2959 2951 else -
Singular/iparith.cc
r801d2b r57dcd6 5155 5155 char libnamebuf[256]; 5156 5156 lib_types LT = type_of_LIB(s, libnamebuf); 5157 5157 5158 #ifdef HAVE_DYNAMIC_LOADING 5158 5159 extern BOOLEAN load_modules(char *newlib, char *fullpath, BOOLEAN autoexport); … … 5195 5196 } 5196 5197 case LT_BUILTIN: 5197 return FALSE; 5198 SModulFunc_t iiGetBuiltinModInit(char*); 5199 return load_builtin(s,autoexport, iiGetBuiltinModInit(s)); 5198 5200 case LT_MACH_O: 5199 5201 case LT_ELF: -
Singular/iplib.cc
r801d2b r57dcd6 672 672 } 673 673 674 int huhu_mod_init(SModulFunctions*){ return 0; } 675 676 #define SI_GET_BUILTIN_MOD_INIT(name) \ 677 int name##_mod_init(SModulFunctions*); \ 678 if (strcmp(libname, #name ".so") == 0) { return name##_mod_init; } 679 680 681 SModulFunc_t 682 iiGetBuiltinModInit(char* libname) 683 { 684 SI_FOREACH_BUILTIN(SI_GET_BUILTIN_MOD_INIT) 685 686 return NULL; 687 } 688 689 690 #undef SI_GET_BUILTIN_MOD_INIT 691 692 674 693 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ 675 694 BOOLEAN iiTryLoadLib(leftv v, const char *id) … … 684 703 idhdl packhdl; 685 704 lib_types LT; 686 687 705 for(i=0; suffix[i] != NULL; i++) 688 706 { … … 702 720 else if (LT==LT_BUILTIN) 703 721 { 704 LoadResult=load_builtin(s,FALSE, (SModulFunc_t)NULL);722 LoadResult=load_builtin(s,FALSE, iiGetBuiltinModInit(s)); 705 723 } 706 724 if(!LoadResult ) … … 1126 1144 (*init)(&sModulFunctions); 1127 1145 } 1128 if (BVERBOSE(V_LOAD_LIB)) Print( "// ** loaded %s \n", newlib);1146 if (BVERBOSE(V_LOAD_LIB)) Print( "// ** loaded (builtin) %s \n", newlib); 1129 1147 currPack->loaded=1; 1130 1148 currPack=s; -
Singular/pyobject.cc
r801d2b r57dcd6 413 413 size_t size(leftv iter, size_t distance = 0) const 414 414 { 415 if (iter) { do { ++distance; } while( iter = iter->next); };415 if (iter) { do { ++distance; } while((iter = iter->next)); }; 416 416 return distance; 417 417 } … … 463 463 sync_contexts(); 464 464 465 Py_ XINCREF(Py_None);465 Py_INCREF(Py_None); 466 466 return PythonCastStatic<>(Py_None).assign_to(result); 467 467 } … … 496 496 sync_contexts(); 497 497 498 Py_ XINCREF(Py_None);498 Py_INCREF(Py_None); 499 499 return PythonCastStatic<>(Py_None).assign_to(result); 500 500 } … … 503 503 void* pyobject_Init(blackbox*) 504 504 { 505 Py_ XINCREF(Py_None);505 Py_INCREF(Py_None); 506 506 return Py_None; 507 507 } … … 715 715 716 716 #define PYOBJECT_ADD_C_PROC(name) \ 717 add_C_proc((currPack->libname? currPack->libname: ""), (char*)#name, FALSE, name); 718 719 typedef BOOLEAN (*func_type)(leftv, leftv); 720 void pyobject_init(int (*add_C_proc)(const char*, const char*, BOOLEAN, 721 func_type) ) 717 psModulFunctions->iiAddCproc((currPack->libname? currPack->libname: ""),\ 718 (char*)#name, FALSE, name); 719 720 int pyobject_mod_init(SModulFunctions* psModulFunctions) 722 721 { 723 722 int tok = -1; … … 734 733 bbx->blackbox_Op3 = pyobject_Op3; 735 734 bbx->blackbox_OpM = pyobject_OpM; 736 bbx->data = omAlloc0(newstruct_desc_size());735 bbx->data = (void*)omAlloc0(newstruct_desc_size()); 737 736 738 737 PythonInterpreter::init(tok); … … 742 741 PYOBJECT_ADD_C_PROC(python_run); 743 742 } 743 return 0; 744 744 } 745 745 #undef PYOBJECT_ADD_C_PROC … … 747 747 #ifndef EMBED_PYTHON 748 748 extern "C" { 749 voidmod_init(SModulFunctions* psModulFunctions)749 int mod_init(SModulFunctions* psModulFunctions) 750 750 { 751 pyobject_init(psModulFunctions->iiAddCproc);751 return pyobject_mod_init(psModulFunctions); 752 752 } 753 753 } -
Singular/pyobject_setup.cc
r801d2b r57dcd6 19 19 #include <Singular/ipshell.h> 20 20 21 /* whether pyobject module is linked statically or dynamically */ 22 23 #ifdef EMBED_PYTHON // Case: we include the pyobject interface in the binary 24 25 #ifdef HAVE_PYTHON 21 #ifdef EMBED_PYTHON 26 22 #include "pyobject.cc" 27 static BOOLEAN pyobject_load()28 {29 pyobject_init(iiAddCproc);30 return FALSE;31 }32 33 #else // Forced embedding, but no (development version of) python available!34 static BOOLEAN pyobject_load() { return TRUE; }35 23 #endif 36 24 37 38 # else // Case: pyobject may be loaded from a dynamic module (prefered variant)39 // Note: we do not need python at compile time.40 25 static BOOLEAN pyobject_load() 41 26 { 42 27 return jjLOAD("pyobject.so", TRUE); 43 28 } 44 #endif45 46 47 29 48 30 /// blackbox support - initialization via autoloading -
libpolys/polys/mod_raw.cc
r801d2b r57dcd6 34 34 #define BYTES_TO_CHECK 7 35 35 36 char* si_bultin_libs[]={ "huhu.so", NULL }; 36 #define SI_BUILTIN_LIBSTR(name) (char*) #name ".so", 37 38 char* si_bultin_libs[]={ SI_FOREACH_BUILTIN(SI_BUILTIN_LIBSTR) NULL }; 39 40 #undef SI_BUILTIN_LIBSTR 37 41 38 42 lib_types type_of_LIB(char *newlib, char *libnamebuf) -
libpolys/polys/mod_raw.h
r801d2b r57dcd6 39 39 40 40 #endif /* HAVE_DL */ 41 42 43 #ifdef EMBED_PYTHON 44 #define SI_BUILTIN_PYOBJECT(add) add(pyobject) 45 #else 46 #define SI_BUILTIN_PYOBJECT(add) 47 #endif 48 49 /// Use @c add(name) to add built-in library to macro 50 #define SI_FOREACH_BUILTIN(add)\ 51 add(huhu)\ 52 SI_BUILTIN_PYOBJECT(add) 53 54 41 55 #endif /* MOD_RAW_H */
Note: See TracChangeset
for help on using the changeset viewer.