MCPcopy Create free account
hub / github.com/Singular/Singular / enterid

Function enterid

Singular/ipid.cc:281–388  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

279}
280
281idhdl enterid(const char * s, int lev, int t, idhdl* root, BOOLEAN init, BOOLEAN search)
282{
283 if (s==NULL) return NULL;
284 if (root==NULL) return NULL;
285 idhdl h;
286 s=omStrDup(s);
287 // idhdl *save_root=root;
288 if (t==PACKAGE_CMD)
289 {
290 if (root!=&(basePack->idroot))
291 {
292 root=&(basePack->idroot);
293 }
294 }
295 // is it already defined in root ?
296 if ((h=(*root)->get_level(s,lev))!=NULL)
297 {
298 if ((IDTYP(h) == t)||(t==DEF_CMD))
299 {
300 if (IDTYP(h)==PACKAGE_CMD)
301 {
302 if (strcmp(s,"Top")==0)
303 {
304 goto errlabel;
305 }
306 else return h;
307 }
308 else
309 {
310 if (BVERBOSE(V_REDEFINE))
311 {
312 const char *f=VoiceName();
313 if (strcmp(f,"STDIN")==0)
314 Warn("redefining %s (%s)",s,my_yylinebuf);
315 else
316 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);
317 }
318 if (s==IDID(h)) IDID(h)=NULL;
319 if((t!=PROC_CMD)||(IDPROC(h)->language!=LANG_C))
320 {
321 killhdl2(h,root,currRing);
322 }
323 }
324 }
325 else
326 goto errlabel;
327 }
328 // is it already defined in currRing->idroot ?
329 else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
330 {
331 if ((h=currRing->idroot->get_level(s,lev))!=NULL)
332 {
333 if ((IDTYP(h) == t)||(t==DEF_CMD))
334 {
335 if (BVERBOSE(V_REDEFINE))
336 {
337 const char *f=VoiceName();
338 if (strcmp(f,"STDIN")==0)

Callers 15

libparse.ccFile · 0.85
jjSetRingFunction · 0.85
jjLOADFunction · 0.85
jjHILBERT3QtFunction · 0.85
iiCallLibProcBeginFunction · 0.85
iiLibCmdFunction · 0.85
iiAddCprocFunction · 0.85
load_modules_auxFunction · 0.85
load_builtinFunction · 0.85
module_help_mainFunction · 0.85
module_help_procFunction · 0.85
siInitFunction · 0.85

Calls 7

VoiceNameFunction · 0.85
WarnFunction · 0.85
killhdl2Function · 0.85
checkallFunction · 0.85
WerrorFunction · 0.85
get_levelMethod · 0.80
setMethod · 0.45

Tested by 3

mainFunction · 0.68
IpIdTestMethod · 0.68
test_enteridMethod · 0.68