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