ipid.cc
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 
5 /*
6 * ABSTRACT: identfier handling
7 */
8 
9 
10 
11 
12 
13 #include "kernel/mod2.h"
14 
15 #include "misc/options.h"
16 #include "misc/intvec.h"
17 
18 #include "coeffs/numbers.h"
19 #include "coeffs/bigintmat.h"
20 
21 #include "polys/matpol.h"
22 #include "polys/monomials/ring.h"
23 
24 #include "kernel/polys.h"
25 #include "kernel/ideals.h"
26 #include "kernel/GBEngine/syz.h"
27 
28 #include "Singular/tok.h"
29 #include "Singular/ipshell.h"
30 #include "Singular/fevoices.h"
31 #include "Singular/lists.h"
32 #include "Singular/attrib.h"
33 #include "Singular/links/silink.h"
34 #include "Singular/ipid.h"
35 #include "Singular/blackbox.h"
36 #include "Singular/number2.h"
37 
38 #ifdef SINGULAR_4_2
39 #include "Singular/number2.h"
40 #endif
41 #ifdef HAVE_DYNAMIC_LOADING
42 #include "polys/mod_raw.h"
43 #endif /* HAVE_DYNAMIC_LOADING */
44 
47 //omBin ip_package_bin = omGetSpecBin(sizeof(ip_package));
49 
51 
53 //idhdl idroot = NULL;
54 
57 package currPack = NULL;
58 package basePack = NULL;
60 
61 void paCleanUp(package pack);
62 
63 /*0 implementation*/
64 
65 int iiS2I(const char *s)
66 {
67  int i;
68  i=s[0];
69  if (s[1]!='\0')
70  {
71  i=(i<<8)+s[1];
72  if (s[2]!='\0')
73  {
74  i=(i<<8)+s[2];
75  if (s[3]!='\0')
76  {
77  i=(i<<8)+s[3];
78  }
79  }
80  }
81  return i;
82 }
83 
84 idhdl idrec::get(const char * s, int level)
85 {
86  assume(s!=NULL);
87  assume((level>=0) && (level<=1000)); //not really, but if it isnt in that bounds..
88  idhdl h = this;
90  int l;
91  const char *id_;
92  int i=iiS2I(s);
93  int less4=(i < (1<<24));
94  while (h!=NULL)
95  {
97  l=IDLEV(h);
98  if ((l==0)||(l==level))
99  {
100  if (i==h->id_i)
101  {
102  id_=IDID(h);
103  if (less4 || (0 == strcmp(s+4,id_+4)))
104  {
105  if (l==level) return h;
106  found=h;
107  }
108  }
109  }
110  h = IDNEXT(h);
111  }
112  return found;
113 }
114 
115 //idrec::~idrec()
116 //{
117 // if (id!=NULL)
118 // {
119 // omFree((ADDRESS)id);
120 // id=NULL;
121 // }
122 // /* much more !! */
123 //}
124 
125 void *idrecDataInit(int t)
126 {
127  switch (t)
128  {
129  //the type with init routines:
130 #ifdef SINGULAR_4_2
131  case CNUMBER_CMD:
132  return (void*)n2Init(0,NULL);
133  case CPOLY_CMD:
134  return (void*)p2Init(0,NULL);
135  case CMATRIX_CMD:
136 #endif
137  case BIGINTMAT_CMD:
138  return (void *)new bigintmat();
139  case BUCKET_CMD:
140  if (currRing!=NULL)
141  return (void*)sBucketCreate(currRing);
142  else
143  {
144  WerrorS("need basering for polyBucket");
145  return NULL;
146  }
147  case INTVEC_CMD:
148  case INTMAT_CMD:
149  return (void *)new intvec();
150  case NUMBER_CMD:
151  {
152  if (currRing!=NULL) return (void *) nInit(0);
153  else return NULL;
154  }
155  case BIGINT_CMD:
156  return (void *) n_Init(0, coeffs_BIGINT);
157  case IDEAL_CMD:
158  case MODUL_CMD:
159  case MATRIX_CMD:
160  case SMATRIX_CMD:
161  return (void*) idInit(1,1);
162  case MAP_CMD:
163  {
164  map m = (map)idInit(1,1);
165  m->preimage = omStrDup(IDID(currRingHdl));
166  return (void *)m;
167  }
168  case STRING_CMD:
169  return (void *)omAlloc0(1);
170  case LIST_CMD:
171  {
173  l->Init();
174  return (void*)l;
175  }
176  //the types with the standard init: set the struct to zero
177  case LINK_CMD:
178  return (void*) omAlloc0Bin(sip_link_bin);
179  case RING_CMD:
180  return NULL;
181  case PACKAGE_CMD:
182  {
183  package pa=(package)omAlloc0Bin(sip_package_bin);
184  pa->language=LANG_NONE;
185  pa->loaded = FALSE;
186  return (void*)pa;
187  }
188  case PROC_CMD:
189  {
191  pi->ref=1;
192  pi->language=LANG_NONE;
193  return (void*)pi;
194  }
195  case RESOLUTION_CMD:
196  return (void *)omAlloc0(sizeof(ssyStrategy));
197  //other types: without init (int,script,poly,def,package)
198  case CRING_CMD:
199  case INT_CMD:
200  case DEF_CMD:
201  case POLY_CMD:
202  case VECTOR_CMD:
203  case QRING_CMD:
204  return (void*)0L;
205  default:
206  {
207  if (t>MAX_TOK)
208  {
209 #ifdef BLACKBOX_DEVEL
210  Print("bb-type %d\n",t);
211 #endif
212  blackbox *bb=getBlackboxStuff(t);
213  if (bb!=NULL)
214  return (void *)bb->blackbox_Init(bb);
215  }
216  else
217  Werror("unknown type in idrecDataInit:%d",t);
218  break;
219  }
220  }
221  return (void *)0L;
222 }
223 idhdl idrec::set(const char * s, int level, int t, BOOLEAN init)
224 {
225  //printf("define %s, %x, level: %d, typ: %d\n", s,s,level,t);
226  idhdl h = (idrec *)omAlloc0Bin(idrec_bin);
227  IDID(h) = s;
228  IDTYP(h) = t;
229  IDLEV(h) = level;
230  IDNEXT(h) = this;
231  BOOLEAN at_start=(this==IDROOT);
232  h->id_i=iiS2I(s);
233  if (t==BUCKET_CMD) WarnS("defining polyBucket");
234  if (init)
235  {
236  if ((t==IDEAL_CMD)||(t==MODUL_CMD))
237  IDFLAG(h) = Sy_bit(FLAG_STD);
238  IDSTRING(h)=(char *)idrecDataInit(t);
239  // additional settings:--------------------------------------
240 #if 0
241  // this leads to a memory leak
242  if (t == QRING_CMD)
243  {
244  // IDRING(h)=rCopy(currRing);
245  /* QRING_CMD is ring dep => currRing !=NULL */
246  }
247 #endif
248  }
249  // --------------------------------------------------------
250  if (at_start)
251  IDNEXT(h) = IDROOT;
252  return h;
253 }
254 
255 char * idrec::String(BOOLEAN typed)
256 {
257  sleftv tmp;
258  memset(&tmp,0,sizeof(sleftv));
259  tmp.rtyp=IDTYP(this);
260  tmp.data=IDDATA(this);
261  tmp.name=IDID(this);
262  return tmp.String(NULL, typed);
263 }
264 
265 idhdl enterid(const char * s, int lev, int t, idhdl* root, BOOLEAN init, BOOLEAN search)
266 {
267  if (s==NULL) return NULL;
268  if (root==NULL) return NULL;
269  idhdl h;
270  s=omStrDup(s);
271  // idhdl *save_root=root;
272  if (t==PACKAGE_CMD)
273  {
274  if (root!=&(basePack->idroot))
275  {
276  root=&(basePack->idroot);
277  }
278  }
279  // is it already defined in root ?
280  if ((h=(*root)->get(s,lev))!=NULL)
281  {
282  if (IDLEV(h)==lev)
283  {
284  if ((IDTYP(h) == t)||(t==DEF_CMD))
285  {
286  if (IDTYP(h)==PACKAGE_CMD)
287  {
288  if (strcmp(s,"Top")==0)
289  {
290  goto errlabel;
291  }
292  else return h;
293  }
294  else
295  {
296  if (BVERBOSE(V_REDEFINE))
297  Warn("redefining %s (%s)",s,my_yylinebuf);
298  if (s==IDID(h)) IDID(h)=NULL;
299  killhdl2(h,root,currRing);
300  }
301  }
302  else
303  goto errlabel;
304  }
305  }
306  // is it already defined in currRing->idroot ?
307  else if (search && (currRing!=NULL)&&((*root) != currRing->idroot))
308  {
309  if ((h=currRing->idroot->get(s,lev))!=NULL)
310  {
311  if (IDLEV(h)==lev)
312  {
313  if ((IDTYP(h) == t)||(t==DEF_CMD))
314  {
315  if (BVERBOSE(V_REDEFINE))
316  Warn("redefining %s (%s)",s,my_yylinebuf);
317  if (s==IDID(h)) IDID(h)=NULL;
318  killhdl2(h,&currRing->idroot,currRing);
319  }
320  else
321  goto errlabel;
322  }
323  }
324  }
325  // is it already defined in idroot ?
326  else if (search && (*root != IDROOT))
327  {
328  if ((h=IDROOT->get(s,lev))!=NULL)
329  {
330  if (IDLEV(h)==lev)
331  {
332  if ((IDTYP(h) == t)||(t==DEF_CMD))
333  {
334  if (BVERBOSE(V_REDEFINE))
335  Warn("redefining %s (%s)",s,my_yylinebuf);
336  if (s==IDID(h)) IDID(h)=NULL;
337  killhdl2(h,&IDROOT,NULL);
338  }
339  else
340  goto errlabel;
341  }
342  }
343  }
344  *root = (*root)->set(s, lev, t, init);
345 #ifndef SING_NDEBUG
346  checkall();
347 #endif
348  return *root;
349 
350  errlabel:
351  //Werror("identifier `%s` in use(lev h=%d,typ=%d,t=%d, curr=%d)",s,IDLEV(h),IDTYP(h),t,lev);
352  Werror("identifier `%s` in use",s);
353  //listall();
354  omFree((ADDRESS)s);
355  return NULL;
356 }
357 void killid(const char * id, idhdl * ih)
358 {
359  if (id!=NULL)
360  {
361  idhdl h = (*ih)->get(id,myynest);
362 
363  // id not found in global list, is it defined in current ring ?
364  if (h==NULL)
365  {
366  if ((currRing!=NULL) && (*ih != (currRing->idroot)))
367  {
368  h = currRing->idroot->get(id,myynest);
369  if (h!=NULL)
370  {
371  killhdl2(h,&(currRing->idroot),currRing);
372  return;
373  }
374  }
375  Werror("`%s` is not defined",id);
376  return;
377  }
378  killhdl2(h,ih,currRing);
379  }
380  else
381  WerrorS("kill what ?");
382 }
383 
384 void killhdl(idhdl h, package proot)
385 {
386  int t=IDTYP(h);
387  if (((BEGIN_RING<t) && (t<END_RING))
388  || ((t==LIST_CMD) && (lRingDependend((lists)IDDATA(h)))))
389  killhdl2(h,&currRing->idroot,currRing);
390  else
391  {
392  if(t==PACKAGE_CMD)
393  {
394  killhdl2(h,&(basePack->idroot),NULL);
395  }
396  else
397  {
398  idhdl s=proot->idroot;
399  while ((s!=h) && (s!=NULL)) s=s->next;
400  if (s!=NULL)
401  killhdl2(h,&(proot->idroot),NULL);
402  else if (basePack!=proot)
403  {
404  idhdl s=basePack->idroot;
405  while ((s!=h) && (s!=NULL)) s=s->next;
406  if (s!=NULL)
407  killhdl2(h,&(basePack->idroot),currRing);
408  else
409  killhdl2(h,&(currRing->idroot),currRing);
410  }
411  }
412  }
413 }
414 
415 void killhdl2(idhdl h, idhdl * ih, ring r)
416 {
417  //printf("kill %s, id %x, typ %d lev: %d\n",IDID(h),(int)IDID(h),IDTYP(h),IDLEV(h));
418  idhdl hh;
419 
420  if (TEST_V_ALLWARN
421  && (IDLEV(h)!=myynest)
422  &&(IDLEV(h)==0))
423  {
424  if (((*ih)==basePack->idroot)
425  || ((currRing!=NULL)&&((*ih)==currRing->idroot)))
426  Warn("kill global `%s` at line >>%s<<\n",IDID(h),my_yylinebuf);
427  }
428  if (h->attribute!=NULL)
429  {
430  if ((IDTYP(h)==RING_CMD)&&(IDRING(h)!=r))
431  h->attribute->killAll(IDRING(h));
432  else
433  h->attribute->killAll(r);
434  h->attribute=NULL;
435  }
436  if (IDTYP(h) == PACKAGE_CMD)
437  {
438  if (((IDPACKAGE(h)->language==LANG_C)&&(IDPACKAGE(h)->idroot!=NULL))
439  || (strcmp(IDID(h),"Top")==0))
440  {
441  Warn("cannot kill `%s`",IDID(h));
442  return;
443  }
444  // any objects defined for this package ?
445  if ((IDPACKAGE(h)->ref<=0) && (IDPACKAGE(h)->idroot!=NULL))
446  {
447  if (currPack==IDPACKAGE(h))
448  {
450  currPackHdl=NULL;
451  }
452  idhdl * hd = &IDRING(h)->idroot;
453  idhdl hdh = IDNEXT(*hd);
454  idhdl temp;
455  while (hdh!=NULL)
456  {
457  temp = IDNEXT(hdh);
458  killhdl2(hdh,&(IDPACKAGE(h)->idroot),NULL);
459  hdh = temp;
460  }
461  killhdl2(*hd,hd,NULL);
462  if (IDPACKAGE(h)->libname!=NULL) omFree((ADDRESS)(IDPACKAGE(h)->libname));
463  }
464  paKill(IDPACKAGE(h));
465  if (currPackHdl==h) currPackHdl=packFindHdl(currPack);
467  }
468  else if (IDTYP(h)==RING_CMD)
469  rKill(h);
470  else if (IDDATA(h)!=NULL)
471  s_internalDelete(IDTYP(h),IDDATA(h),r);
472  // general -------------------------------------------------------------
473  // now dechain it and delete idrec
474  if (IDID(h)!=NULL) // OB: ?????
475  omFree((ADDRESS)IDID(h));
476  IDID(h)=NULL;
477  IDDATA(h)=NULL;
478  if (h == (*ih))
479  {
480  // h is at the beginning of the list
481  *ih = IDNEXT(h) /* ==*ih */;
482  }
483  else if (ih!=NULL)
484  {
485  // h is somethere in the list:
486  hh = *ih;
487  loop
488  {
489  if (hh==NULL)
490  {
491  PrintS(">>?<< not found for kill\n");
492  return;
493  }
494  idhdl hhh = IDNEXT(hh);
495  if (hhh == h)
496  {
497  IDNEXT(hh) = IDNEXT(hhh);
498  break;
499  }
500  hh = hhh;
501  }
502  }
503  omFreeBin((ADDRESS)h, idrec_bin);
504 }
505 
506 #if 0
507 idhdl ggetid(const char *n, BOOLEAN /*local*/, idhdl *packhdl)
508 {
509  idhdl h = IDROOT->get(n,myynest);
510  idhdl h2=NULL;
511  *packhdl = NULL;
512  if ((currRing!=NULL) && ((h==NULL)||(IDLEV(h)!=myynest)))
513  {
514  h2 = currRing->idroot->get(n,myynest);
515  }
516  if (h2==NULL) return h;
517  return h2;
518 }
519 #endif
520 
521 idhdl ggetid(const char *n)
522 {
523  idhdl h = IDROOT->get(n,myynest);
524  if ((h!=NULL)&&(IDLEV(h)==myynest)) return h;
525  if (currRing!=NULL)
526  {
527  idhdl h2 = currRing->idroot->get(n,myynest);
528  if (h2!=NULL) return h2;
529  }
530  if (h!=NULL) return h;
531  if (basePack!=currPack)
532  return basePack->idroot->get(n,myynest);
533  return NULL;
534 }
535 
537 {
538  if (hasFlag(h,FLAG_STD)) PrintS(" (SB)");
539 #ifdef HAVE_PLURAL
540  if (hasFlag(h,FLAG_TWOSTD)) PrintS(" (2SB)");
541 #endif
542 }
543 
545 {
546  idhdl h=root;
547  /* compute the length */
548  int l=0;
549  while (h!=NULL) { l++; h=IDNEXT(h); }
550  /* allocate list */
552  L->Init(l);
553  /* copy names */
554  h=root;
555  l=0;
556  while (h!=NULL)
557  {
558  /* list is initialized with 0 => no need to clear anything */
559  L->m[l].rtyp=STRING_CMD;
560  L->m[l].data=omStrDup(IDID(h));
561  l++;
562  h=IDNEXT(h);
563  }
564  return L;
565 }
566 
567 lists ipNameListLev(idhdl root, int lev)
568 {
569  idhdl h=root;
570  /* compute the length */
571  int l=0;
572  while (h!=NULL) { if (IDLEV(h)==lev) l++; h=IDNEXT(h); }
573  /* allocate list */
575  L->Init(l);
576  /* copy names */
577  h=root;
578  l=0;
579  while (h!=NULL)
580  {
581  if (IDLEV(h)==lev)
582  {
583  /* list is initialized with 0 => no need to clear anything */
584  L->m[l].rtyp=STRING_CMD;
585  L->m[l].data=omStrDup(IDID(h));
586  l++;
587  }
588  h=IDNEXT(h);
589  }
590  return L;
591 }
592 
593 /*
594 * move 'tomove' from root1 list to root2 list
595 */
596 static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
597 {
598  idhdl h;
599  /* search 'tomove' in root2 : if found -> do nothing */
600  h=root2;
601  while ((h!=NULL) && (h!=tomove)) h=IDNEXT(h);
602  if (h!=NULL) return FALSE; /*okay */
603  /* search predecessor of h in root1, remove 'tomove' */
604  h=root1;
605  if (tomove==h)
606  {
607  root1=IDNEXT(h);
608  }
609  else
610  {
611  while ((h!=NULL) && (IDNEXT(h)!=tomove)) h=IDNEXT(h);
612  if (h==NULL) return TRUE; /* not in the list root1 -> do nothing */
613  IDNEXT(h)=IDNEXT(tomove);
614  }
615  /* add to root2 list */
616  IDNEXT(tomove)=root2;
617  root2=tomove;
618  return FALSE;
619 }
620 
621 void ipMoveId(idhdl tomove)
622 {
623  if ((currRing!=NULL)&&(tomove!=NULL))
624  {
625  if (RingDependend(IDTYP(tomove))
626  || ((IDTYP(tomove)==LIST_CMD) && (lRingDependend(IDLIST(tomove)))))
627  {
628  /*move 'tomove' to ring id's*/
629  if (ipSwapId(tomove,IDROOT,currRing->idroot))
630  ipSwapId(tomove,basePack->idroot,currRing->idroot);
631  }
632  else
633  {
634  /*move 'tomove' to global id's*/
635  ipSwapId(tomove,currRing->idroot,IDROOT);
636  }
637  }
638 }
639 
640 const char * piProcinfo(procinfov pi, const char *request)
641 {
642  if((pi == NULL)||(pi->language==LANG_NONE)) return "empty proc";
643  else if (strcmp(request, "libname") == 0) return pi->libname;
644  else if (strcmp(request, "procname") == 0) return pi->procname;
645  else if (strcmp(request, "type") == 0)
646  {
647  switch (pi->language)
648  {
649  case LANG_SINGULAR: return "singular"; break;
650  case LANG_C: return "object"; break;
651  case LANG_NONE: return "none"; break;
652  default: return "unknown language";
653  }
654  }
655  else if (strcmp(request, "ref") == 0)
656  {
657  char p[8];
658  sprintf(p, "%d", pi->ref);
659  return omStrDup(p); // MEMORY-LEAK
660  }
661  return "??";
662 }
663 
665 {
666  (pi->ref)--;
667  if (pi->ref == 0)
668  {
669  if (pi->language==LANG_SINGULAR)
670  {
672  while (p!=NULL)
673  {
674  if (p->pi==pi && pi->ref <= 1)
675  {
676  Warn("`%s` in use, can not be killed",pi->procname);
677  return TRUE;
678  }
679  p=p->next;
680  }
681  }
682  if (pi->libname != NULL) // OB: ????
683  omFree((ADDRESS)pi->libname);
684  if (pi->procname != NULL) // OB: ????
685  omFree((ADDRESS)pi->procname);
686 
687  if( pi->language == LANG_SINGULAR)
688  {
689  if (pi->data.s.body != NULL) // OB: ????
690  omFree((ADDRESS)pi->data.s.body);
691  }
692  if( pi->language == LANG_C)
693  {
694  }
695  memset((void *) pi, 0, sizeof(procinfo));
696  //pi->language=LANG_NONE;
698  }
699  return FALSE;
700 }
701 
702 void paCleanUp(package pack)
703 {
704  (pack->ref)--;
705  if (pack->ref < 0)
706  {
707 #ifndef HAVE_STATIC
708  if( pack->language == LANG_C)
709  {
710  Print("//dlclose(%s)\n",pack->libname);
711 #ifdef HAVE_DYNAMIC_LOADING
712  dynl_close (pack->handle);
713 #endif /* HAVE_DYNAMIC_LOADING */
714  }
715 #endif /* HAVE_STATIC */
716  omFree((ADDRESS)pack->libname);
717  memset((void *) pack, 0, sizeof(sip_package));
718  pack->language=LANG_NONE;
719  }
720 }
721 
722 void proclevel::push(char *n)
723 {
724  //Print("push %s\n",n);
725  proclevel *p=(proclevel*)omAlloc0(sizeof(proclevel));
726  p->name=n;
728  p->cPack=currPack;
729  p->next=this;
730  procstack=p;
731 }
733 {
734  //Print("pop %s\n",name);
735  //if (currRing!=::currRing) PrintS("currRing wrong\n");;
736  //::currRing=this->currRing;
737  //if (r==NULL) Print("set ring to NULL at lev %d(%s)\n",myynest,name);
738  //::currRingHdl=this->currRingHdl;
739  //if((::currRingHdl==NULL)||(IDRING(::currRingHdl)!=(::currRing)))
740  // ::currRingHdl=rFindHdl(::currRing,NULL,NULL);
741  //Print("restore pack=%s,1.obj=%s\n",IDID(currPackHdl),IDID(currPack->idroot));
742  currPackHdl=this->cPackHdl;
743  currPack=this->cPack;
745  proclevel *p=this;
746  procstack=next;
747  omFreeSize(p,sizeof(proclevel));
748 }
749 
751 {
752  idhdl h=basePack->idroot;
753  while (h!=NULL)
754  {
755  if ((IDTYP(h)==PACKAGE_CMD)
756  && (IDPACKAGE(h)==r))
757  return h;
758  h=IDNEXT(h);
759  }
760  return NULL;
761 }
762 
764 {
765  if (iiCurrArgs==NULL)
766  {
767  Werror("not enough arguments for proc %s",VoiceName());
768  p->CleanUp();
769  return TRUE;
770  }
772  iiCurrArgs=h->next;
773  h->next=NULL;
774  if (h->rtyp!=IDHDL)
775  {
776  BOOLEAN res=iiAssign(p,h);
777  h->CleanUp();
779  return res;
780  }
781  if ((h->Typ()!=p->Typ()) &&(p->Typ()!=DEF_CMD))
782  {
783  WerrorS("type mismatch");
784  return TRUE;
785  }
786  idhdl pp=(idhdl)p->data;
787  switch(pp->typ)
788  {
789  case CRING_CMD:
790  nKillChar((coeffs)pp);
791  break;
792  case DEF_CMD:
793  case INT_CMD:
794  break;
795  case INTVEC_CMD:
796  case INTMAT_CMD:
797  delete IDINTVEC(pp);
798  break;
799  case NUMBER_CMD:
800  nDelete(&IDNUMBER(pp));
801  break;
802  case BIGINT_CMD:
803  n_Delete(&IDNUMBER(pp),coeffs_BIGINT);
804  break;
805  case MAP_CMD:
806  {
807  map im = IDMAP(pp);
808  omFree((ADDRESS)im->preimage);
809  }
810  // continue as ideal:
811  case IDEAL_CMD:
812  case MODUL_CMD:
813  case MATRIX_CMD:
814  idDelete(&IDIDEAL(pp));
815  break;
816  case PROC_CMD:
817  case RESOLUTION_CMD:
818  case STRING_CMD:
819  omFree((ADDRESS)IDSTRING(pp));
820  break;
821  case LIST_CMD:
822  IDLIST(pp)->Clean();
823  break;
824  case LINK_CMD:
826  break;
827  // case ring: cannot happen
828  default:
829  Werror("unknown type %d",p->Typ());
830  return TRUE;
831  }
832  pp->typ=ALIAS_CMD;
833  IDDATA(pp)=(char*)h->data;
834  int eff_typ=h->Typ();
835  if ((RingDependend(eff_typ))
836  || ((eff_typ==LIST_CMD) && (lRingDependend((lists)h->Data()))))
837  {
838  ipSwapId(pp,IDROOT,currRing->idroot);
839  }
840  h->CleanUp();
842  return FALSE;
843 }
844 
void * idrecDataInit(int t)
Definition: ipid.cc:125
#define omAllocBin(bin)
Definition: omAllocDecl.h:205
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:400
#define IDLIST(a)
Definition: ipid.h:132
ip_package * package
Definition: structs.h:48
void ipMoveId(idhdl tomove)
Definition: ipid.cc:621
const CanonicalForm int s
Definition: facAbsFact.cc:55
sleftv * m
Definition: lists.h:46
idhdl ggetid(const char *n)
Definition: ipid.cc:521
Class used for (list of) interpreter objects.
Definition: subexpr.h:82
omBin sip_package_bin
Definition: ipid.cc:46
Definition: tok.h:48
int level(const CanonicalForm &f)
omBin_t * omBin
Definition: omStructs.h:12
#define Print
Definition: emacs.cc:80
Definition: tok.h:96
#define IDLINK(a)
Definition: ipid.h:133
void killAll(const ring r)
Definition: attrib.cc:186
idhdl currPackHdl
Definition: ipid.cc:55
#define idDelete(H)
delete an ideal
Definition: ideals.h:29
Definition: lists.h:23
#define IDINTVEC(a)
Definition: ipid.h:123
#define IDID(a)
Definition: ipid.h:117
#define FALSE
Definition: auxiliary.h:94
Compatiblity layer for legacy polynomial operations (over currRing)
void paCleanUp(package pack)
Definition: ipid.cc:702
Definition: tok.h:38
Matrices of numbers.
Definition: bigintmat.h:50
void killid(const char *id, idhdl *ih)
Definition: ipid.cc:357
Definition: tok.h:216
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:538
#define omFreeSize(addr, size)
Definition: omAllocDecl.h:260
#define IDNEXT(a)
Definition: ipid.h:113
language_defs language
Definition: subexpr.h:59
proclevel * procstack
Definition: ipid.cc:52
#define IDROOT
Definition: ipid.h:18
int id_i
Definition: idrec.h:47
#define TRUE
Definition: auxiliary.h:98
#define IDIDEAL(a)
Definition: ipid.h:128
void * ADDRESS
Definition: auxiliary.h:133
short ref
Definition: subexpr.h:60
Definition: fevoices.h:58
void WerrorS(const char *s)
Definition: feFopen.cc:24
idhdl basePackHdl
Definition: ipid.cc:56
#define loop
Definition: structs.h:80
#define WarnS
Definition: emacs.cc:78
char * name
Definition: ipid.h:60
Voice * next
Definition: fevoices.h:61
coeffs coeffs_BIGINT
Definition: ipid.cc:50
int Typ()
Definition: subexpr.cc:1033
BOOLEAN piKill(procinfov pi)
Definition: ipid.cc:664
#define Sy_bit(x)
Definition: options.h:32
char * String(BOOLEAN typed=FALSE)
Definition: ipid.cc:255
void paKill(package pack)
Definition: ipid.h:49
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
idhdl get(const char *s, int lev)
Definition: ipid.cc:84
bool found
Definition: facFactorize.cc:56
omBin procinfo_bin
Definition: subexpr.cc:42
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
Definition: subexpr.cc:783
void ipListFlag(idhdl h)
Definition: ipid.cc:536
void * data
Definition: subexpr.h:88
char * procname
Definition: subexpr.h:57
Definition: subexpr.h:22
#define IDPACKAGE(a)
Definition: ipid.h:134
int myynest
Definition: febase.cc:41
#define IDTYP(a)
Definition: ipid.h:114
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:415
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:265
int RingDependend(int t)
Definition: gentable.cc:28
Definition: tok.h:56
char my_yylinebuf[80]
Definition: febase.cc:43
#define FLAG_TWOSTD
Definition: ipid.h:105
Definition: intvec.h:19
char * libname
Definition: subexpr.h:56
idhdl cPackHdl
Definition: ipid.h:58
CanonicalForm res
Definition: facAbsFact.cc:64
void rKill(ring r)
Definition: ipshell.cc:6124
const char * piProcinfo(procinfov pi, const char *request)
Definition: ipid.cc:640
omBin idrec_bin
Definition: ipid.cc:48
lists ipNameListLev(idhdl root, int lev)
Definition: ipid.cc:567
Definition: tok.h:58
Definition: ipid.h:54
procinfo * pi
Definition: fevoices.h:64
const char * name
Definition: subexpr.h:87
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:390
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
The main handler for Singular numbers which are suitable for Singular polynomials.
CanonicalForm pp(const CanonicalForm &)
CanonicalForm pp ( const CanonicalForm & f )
Definition: cf_gcd.cc:248
sBucket_pt sBucketCreate(const ring r)
Definition: sbuckets.cc:96
procinfodata data
Definition: subexpr.h:63
int iiS2I(const char *s)
Definition: ipid.cc:65
#define IDSTRING(a)
Definition: ipid.h:131
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:514
idhdl currRingHdl
Definition: ipid.cc:59
int m
Definition: cfEzgcd.cc:121
proclevel * next
Definition: ipid.h:57
idrec * idhdl
Definition: ring.h:21
omBin sleftv_bin
Definition: subexpr.cc:41
int i
Definition: cfEzgcd.cc:125
void PrintS(const char *s)
Definition: reporter.cc:284
lists ipNameList(idhdl root)
Definition: ipid.cc:544
idhdl next
Definition: idrec.h:38
#define IDLEV(a)
Definition: ipid.h:116
const char * VoiceName()
Definition: fevoices.cc:56
#define nDelete(n)
Definition: numbers.h:16
#define IDMAP(a)
Definition: ipid.h:130
#define FLAG_STD
Definition: ipid.h:104
leftv next
Definition: subexpr.h:86
#define IDNUMBER(a)
Definition: ipid.h:127
#define BVERBOSE(a)
Definition: options.h:35
INLINE_THIS void Init(int l=0)
Definition: tok.h:34
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define omGetSpecBin(size)
Definition: omBin.h:11
#define pi
Definition: libparse.cc:1143
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition: simpleideals.cc:35
int dynl_close(void *handle)
Definition: mod_raw.cc:170
Definition: tok.h:117
#define NULL
Definition: omList.c:12
attr attribute
Definition: idrec.h:41
slists * lists
Definition: mpr_numeric.h:146
omBin sip_command_bin
Definition: ipid.cc:45
Voice * currentVoice
Definition: fevoices.cc:47
void killhdl(idhdl h, package proot)
Definition: ipid.cc:384
package basePack
Definition: ipid.cc:58
#define hasFlag(A, F)
Definition: ipid.h:107
BOOLEAN iiAlias(leftv p)
Definition: ipid.cc:763
#define IDRING(a)
Definition: ipid.h:122
package currPack
Definition: ipid.cc:57
leftv iiCurrArgs
Definition: ipshell.cc:76
int rtyp
Definition: subexpr.h:91
#define IDFLAG(a)
Definition: ipid.h:115
void CleanUp(ring r=currRing)
Definition: subexpr.cc:348
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
void * Data()
Definition: subexpr.cc:1176
int typ
Definition: idrec.h:43
Definition: tok.h:118
omBin slists_bin
Definition: lists.cc:23
Definition: tok.h:158
idhdl packFindHdl(package r)
Definition: ipid.cc:750
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:4346
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:455
void iiCheckPack(package &p)
Definition: ipshell.cc:1539
int p
Definition: cfModGcd.cc:4019
#define IDDATA(a)
Definition: ipid.h:121
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
void push(char *)
Definition: ipid.cc:722
void pop()
Definition: ipid.cc:732
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:971
int BOOLEAN
Definition: auxiliary.h:85
package cPack
Definition: ipid.h:59
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
static int ipSwapId(idhdl tomove, idhdl &root1, idhdl &root2)
Definition: ipid.cc:596
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:510
#define V_REDEFINE
Definition: options.h:45
void Werror(const char *fmt,...)
Definition: reporter.cc:189
#define TEST_V_ALLWARN
Definition: options.h:140
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition: ipid.cc:223
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:93
procinfo * procinfov
Definition: structs.h:65
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:16
ListNode * next
Definition: janet.h:31
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1830
#define Warn
Definition: emacs.cc:77
#define omStrDup(s)
Definition: omAllocDecl.h:263