Changeset f2749c in git
- Timestamp:
- Apr 2, 2019, 1:24:01 PM (4 years ago)
- Branches:
- (u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
- Children:
- d20e96946730123ff9fe475bded1ae950d09590d
- Parents:
- befd80dcf6854e395b3758a678e1384360f63f4b
- Location:
- Singular
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/idrec.h
rbefd80d rf2749c 49 49 idrec() { memset(this,0,sizeof(*this)); } 50 50 idhdl get(const char * s, int lev); 51 idhdl get_level(const char * s, int lev); 51 52 idhdl set(const char * s, int lev, int t/*typ*/, BOOLEAN init=TRUE); 52 53 char * String(BOOLEAN typed = FALSE); -
Singular/ipid.cc
rbefd80d rf2749c 99 99 } 100 100 return found; 101 } 102 103 idhdl idrec::get_level(const char * s, int level) 104 { 105 assume(s!=NULL); 106 assume((level>=0) && (level<=1000)); //not really, but if it isnt in that bounds.. 107 idhdl h = this; 108 int l; 109 const char *id_; 110 unsigned long i=iiS2I(s); 111 int less4=(i < (1L<<((SIZEOF_LONG-1)*8))); 112 while (h!=NULL) 113 { 114 omCheckAddr((ADDRESS)IDID(h)); 115 l=IDLEV(h); 116 if ((l==level)&&(i==h->id_i)) 117 { 118 id_=IDID(h); 119 if (less4 || (0 == strcmp(s+SIZEOF_LONG,id_+SIZEOF_LONG))) 120 { 121 return h; 122 } 123 } 124 h = IDNEXT(h); 125 } 126 return NULL; 101 127 } 102 128 … … 266 292 } 267 293 // is it already defined in root ? 268 if ((h=(*root)->get(s,lev))!=NULL) 269 { 270 if (IDLEV(h)==lev) 294 if ((h=(*root)->get_level(s,lev))!=NULL) 295 { 296 if ((IDTYP(h) == t)||(t==DEF_CMD)) 297 { 298 if (IDTYP(h)==PACKAGE_CMD) 299 { 300 if (strcmp(s,"Top")==0) 301 { 302 goto errlabel; 303 } 304 else return h; 305 } 306 else 307 { 308 if (BVERBOSE(V_REDEFINE)) 309 { 310 const char *f=VoiceName(); 311 if (strcmp(f,"STDIN")==0) 312 Warn("redefining %s (%s)",s,my_yylinebuf); 313 else 314 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno); 315 } 316 if (s==IDID(h)) IDID(h)=NULL; 317 killhdl2(h,root,currRing); 318 } 319 } 320 else 321 goto errlabel; 322 } 323 // is it already defined in currRing->idroot ? 324 else if (search && (currRing!=NULL)&&((*root) != currRing->idroot)) 325 { 326 if ((h=currRing->idroot->get_level(s,lev))!=NULL) 271 327 { 272 328 if ((IDTYP(h) == t)||(t==DEF_CMD)) 273 329 { 274 if ( IDTYP(h)==PACKAGE_CMD)330 if (BVERBOSE(V_REDEFINE)) 275 331 { 276 if (strcmp(s,"Top")==0)277 {278 goto errlabel;279 }280 else return h;332 const char *f=VoiceName(); 333 if (strcmp(f,"STDIN")==0) 334 Warn("redefining %s (%s)",s,my_yylinebuf); 335 else 336 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno); 281 337 } 282 else 283 { 284 if (BVERBOSE(V_REDEFINE)) 285 { 286 const char *f=VoiceName(); 287 if (strcmp(f,"STDIN")==0) 288 Warn("redefining %s (%s)",s,my_yylinebuf); 289 else 290 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno); 291 } 292 if (s==IDID(h)) IDID(h)=NULL; 293 killhdl2(h,root,currRing); 294 } 338 if (s==IDID(h)) IDID(h)=NULL; 339 killhdl2(h,&currRing->idroot,currRing); 295 340 } 296 341 else … … 298 343 } 299 344 } 300 // is it already defined in currRing->idroot ?301 else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))302 {303 if ((h=currRing->idroot->get(s,lev))!=NULL)304 {305 if (IDLEV(h)==lev)306 {307 if ((IDTYP(h) == t)||(t==DEF_CMD))308 {309 if (BVERBOSE(V_REDEFINE))310 {311 const char *f=VoiceName();312 if (strcmp(f,"STDIN")==0)313 Warn("redefining %s (%s)",s,my_yylinebuf);314 else315 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno);316 }317 if (s==IDID(h)) IDID(h)=NULL;318 killhdl2(h,&currRing->idroot,currRing);319 }320 else321 goto errlabel;322 }323 }324 }325 345 // is it already defined in idroot ? 326 346 else if (search && (*root != IDROOT)) 327 347 { 328 if ((h=IDROOT->get (s,lev))!=NULL)329 { 330 if ( IDLEV(h)==lev)331 { 332 if ( (IDTYP(h) == t)||(t==DEF_CMD))348 if ((h=IDROOT->get_level(s,lev))!=NULL) 349 { 350 if ((IDTYP(h) == t)||(t==DEF_CMD)) 351 { 352 if (BVERBOSE(V_REDEFINE)) 333 353 { 334 if (BVERBOSE(V_REDEFINE)) 335 { 336 const char *f=VoiceName(); 337 if (strcmp(f,"STDIN")==0) 338 Warn("redefining %s (%s)",s,my_yylinebuf); 339 else 340 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno); 341 } 342 if (s==IDID(h)) IDID(h)=NULL; 343 killhdl2(h,&IDROOT,NULL); 354 const char *f=VoiceName(); 355 if (strcmp(f,"STDIN")==0) 356 Warn("redefining %s (%s)",s,my_yylinebuf); 357 else 358 Warn("redefining %s (%s) %s:%d",s,my_yylinebuf,f, yylineno); 344 359 } 345 else 346 goto errlabel; 347 } 360 if (s==IDID(h)) IDID(h)=NULL; 361 killhdl2(h,&IDROOT,NULL); 362 } 363 else 364 goto errlabel; 348 365 } 349 366 } … … 527 544 idhdl ggetid(const char *n) 528 545 { 529 idhdl h = IDROOT->get(n,myynest);530 if ((h!=NULL)&&(IDLEV(h)==myynest)) return h;531 546 if (currRing!=NULL) 532 547 { 533 548 idhdl h2 = currRing->idroot->get(n,myynest); 549 if ((h2!=NULL)&&(IDLEV(h2)==myynest)) return h2; 550 idhdl h = IDROOT->get(n,myynest); 551 if (h!=NULL) return h; 534 552 if (h2!=NULL) return h2; 535 553 } 536 if (h!=NULL) return h; 554 else 555 { 556 idhdl h = IDROOT->get(n,myynest); 557 if (h!=NULL) return h; 558 } 537 559 if (basePack!=currPack) 538 560 return basePack->idroot->get(n,myynest);
Note: See TracChangeset
for help on using the changeset viewer.