- Timestamp:
- Apr 27, 1998, 5:00:50 PM (26 years ago)
- Branches:
- (u'spielwiese', '2fa36c576e6a4ddbb1093b43c7f8e9835e17e52a')
- Children:
- 20e38e12826eb51bd172dbde212f3fe280ede7f2
- Parents:
- 1d110184c43ad191d6eb86c741b1c450e6d5846c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/extra.cc
r1d1101 r48ef1b7 2 2 * Computer Algebra System SINGULAR * 3 3 *****************************************/ 4 /* $Id: extra.cc,v 1.4 1 1998-04-27 12:34:11 obachmanExp $ */4 /* $Id: extra.cc,v 1.42 1998-04-27 15:00:50 krueger Exp $ */ 5 5 /* 6 6 * ABSTRACT: general interface to internals of Singular ("system" command) … … 66 66 #include "mpsr.h" 67 67 68 #ifdef HAVE_DYNAMIC_LOADING 69 #include <dlfcn.h> 70 #endif /* HAVE_DYNAMIC_LOADING */ 71 68 72 // see clapsing.cc for a description of the `FACTORY_*' options 69 73 … … 79 83 TIMING_DEFINE_PRINTPROTO( algLcmTimer ); 80 84 #endif 85 86 void piShowProcList(); 81 87 82 88 //void emStart(); … … 91 97 if(strcmp((char*)(h->Data()),"LIB")==0) 92 98 { 99 #ifdef HAVE_NAMESPACES 100 idhdl hh=namespaceroot->get((char*)h->next->Data(),0); 101 #else /* HAVE_NAMESPACES */ 93 102 idhdl hh=idroot->get((char*)h->next->Data(),0); 103 #endif /* HAVE_NAMESPACES */ 94 104 if ((hh!=NULL)&&(IDTYP(hh)==PROC_CMD)) 95 105 { … … 103 113 } 104 114 else 115 #ifdef HAVE_NAMESPACES 116 /*==================== nspush ===================================*/ 117 if(strcmp((char*)(h->Data()),"nspush")==0) 118 { 119 idhdl hh=namespaceroot->get((char*)h->next->Data(),0, TRUE); 120 if ((hh!=NULL)&&(IDTYP(hh)==PACKAGE_CMD)) 121 { 122 namespaceroot = namespaceroot->push(IDPACKAGE(hh), IDID(hh)); 123 return FALSE; 124 } else 125 Warn("package `%s` not found",(char*)h->next->Data()); 126 } 127 else 128 /*==================== nspop ====================================*/ 129 if(strcmp((char*)(h->Data()),"nspop")==0) 130 { 131 namespaceroot->pop(); 132 return FALSE; 133 } 134 else 135 /*==================== nsstack ===================================*/ 136 if(strcmp((char*)(h->Data()),"nsstack")==0) 137 { 138 namehdl nshdl = namespaceroot; 139 for( ; nshdl->isroot != TRUE; nshdl = nshdl->next) { 140 Print("NSstack: %s:%d\n", nshdl->name, nshdl->lev); 141 } 142 Print("NSstack: %s:%d\n", nshdl->name, nshdl->lev); 143 return FALSE; 144 } 145 else 146 #endif /* HAVE_NAMESPACES */ 105 147 /*==================== proclist =================================*/ 106 148 if(strcmp((char*)(h->Data()),"proclist")==0) 107 149 { 108 void piShowProcList();109 150 //res->rtyp=STRING_CMD; 110 151 //res->data=(void *)mstrdup(""); … … 121 162 } 122 163 else 164 #ifdef HAVE_DYNAMIC_LOADING 165 /*==================== load ==================================*/ 166 if(strcmp((char*)(h->Data()),"load")==0) 167 { 168 if ((h->next!=NULL) && (h->next->Typ()==STRING_CMD)) { 169 int iiAddCproc(char *libname, char *procname, BOOLEAN pstatic, 170 BOOLEAN(*func)(leftv res, leftv v)); 171 int (*fktn)(int(*iiAddCproc)(char *libname, char *procname, 172 BOOLEAN pstatic, 173 BOOLEAN(*func)(leftv res, leftv v))); 174 void *vp; 175 res->rtyp=STRING_CMD; 176 177 fprintf(stderr, "Loading %s\n", h->next->Data()); 178 res->data=(void *)mstrdup(""); 179 if((vp=dlopen(h->next->Data(),RTLD_LAZY))==(void *)NULL) { 180 WerrorS("dlopen failed"); 181 Werror("%s not found", h->next->Data()); 182 } else { 183 fktn = dlsym(vp, "mod_init"); 184 if( fktn!= NULL) (*fktn)(iiAddCproc); 185 else Werror("mod_init: %s\n", dlerror()); 186 piShowProcList(); 187 } 188 return FALSE; 189 } 190 else WerrorS("string expected"); 191 } 192 else 193 #endif /* HAVE_DYNAMIC_LOADING */ 123 194 /*==================== gen ==================================*/ 124 195 if(strcmp((char*)(h->Data()),"gen")==0)
Note: See TracChangeset
for help on using the changeset viewer.