subexpr.cc
Go to the documentation of this file.
1 /****************************************
2 * Computer Algebra System SINGULAR *
3 ****************************************/
4 /*
5 * ABSTRACT: handling of leftv
6 */
7 
8 #include <kernel/mod2.h>
9 
10 #include <omalloc/omalloc.h>
11 
12 #include <misc/intvec.h>
13 #include <misc/options.h>
14 
15 #include <coeffs/numbers.h>
16 #include <coeffs/bigintmat.h>
17 
18 #include <coeffs/ffields.h> // nfShowMipo // minpoly printing...
19 
20 #include <polys/monomials/maps.h>
21 #include <polys/matpol.h>
22 #include <polys/monomials/ring.h>
23 
24 // #include <coeffs/longrat.h>
25 
26 #include <kernel/polys.h>
27 #include <kernel/ideals.h>
28 #include <kernel/GBEngine/kstd1.h>
29 #include <kernel/GBEngine/syz.h>
30 #include <kernel/oswrapper/timer.h>
31 
32 #include <Singular/tok.h>
33 #include <Singular/ipid.h>
34 #include <Singular/ipshell.h>
35 #include <Singular/lists.h>
36 #include <Singular/attrib.h>
37 #include <Singular/links/silink.h>
38 #include <Singular/attrib.h>
39 #include <Singular/subexpr.h>
40 #include <Singular/blackbox.h>
41 #include <Singular/number2.h>
42 
43 #include <stdlib.h>
44 #include <stdio.h>
45 #include <string.h>
46 #include <ctype.h>
47 #include <unistd.h>
48 
54 
56 const char sNoName[]="_";
57 #ifdef SIQ
59 #endif
60 
62 {
63  int n = 1;
64  leftv sl = next;
65  while (sl!=NULL)
66  {
67  n++;
68  sl=sl->next;
69  }
70  return n;
71 }
72 
73 void sleftv::Print(leftv store, int spaces)
74 {
75  int t=Typ();
76  if (errorreported) return;
77 #ifdef SIQ
78  if (rtyp==COMMAND)
79  {
80  command c=(command)data;
81  char ch[2];
82  ch[0]=c->op;ch[1]='\0';
83  const char *s=ch;
84  if (c->op>127) s=iiTwoOps(c->op);
85  ::Print("##command %d(%s), %d args\n",
86  c->op, s, c->argc);
87  if (c->argc>0)
88  c->arg1.Print(NULL,spaces+2);
89  if(c->argc<4)
90  {
91  if (c->argc>1)
92  c->arg2.Print(NULL,spaces+2);
93  if (c->argc>2)
94  c->arg3.Print(NULL,spaces+2);
95  }
96  PrintS("##end");
97  }
98  else
99 #endif
100  {
101  const char *n=Name();
102  char *s;
103  void *d=Data();
104  if (errorreported) return;
105  if ((store!=NULL)&&(store!=this))
106  store->CleanUp();
107 
108  switch (t /*=Typ()*/)
109  {
110 #ifdef SINGULAR_4_1
111  case CRING_CMD:
112  crPrint((coeffs)d);
113  break;
114  case CNUMBER_CMD:
115  n2Print((number2)d);
116  break;
117  case CMATRIX_CMD: // like BIGINTMAT
118 #endif
119  case BIGINTMAT_CMD:
120  ((bigintmat *)d)->pprint(80);
121  break;
122  case UNKNOWN:
123  case DEF_CMD:
124  PrintNSpaces(spaces);
125  PrintS("`");PrintS(n);PrintS("`");
126  break;
127  case PACKAGE_CMD:
128  PrintNSpaces(spaces);
129  paPrint(n,(package)d);
130  break;
131  case NONE:
132  return;
133  case INTVEC_CMD:
134  case INTMAT_CMD:
135  ((intvec *)d)->show(t,spaces);
136  break;
137  case RING_CMD:
138  case QRING_CMD:
139  {
140  PrintNSpaces(spaces);
141  const ring r = (const ring)d;
142  rWrite(r, currRing == r);
143  break;
144  }
145  case MATRIX_CMD:
146  iiWriteMatrix((matrix)d,n,2, currRing, spaces);
147  break;
148  case MODUL_CMD:
149  case IDEAL_CMD:
150  if ((TEST_V_QRING) &&(currRing->qideal!=NULL)
151  &&(!hasFlag(this,FLAG_QRING)))
152  {
153  jjNormalizeQRingId(this);
154  d=Data();
155  }
156  // no break:
157  case MAP_CMD:
158  iiWriteMatrix((matrix)d,n,1, currRing, spaces);
159  break;
160  case POLY_CMD:
161  case VECTOR_CMD:
162  if ((e==NULL)
163  && (TEST_V_QRING)
164  &&(currRing->qideal!=NULL)
165  &&(!hasFlag(this,FLAG_QRING)))
166  {
167  setFlag(this,FLAG_QRING);
168  poly p=(poly)d;
170  if (p!=(poly)d)
171  {
172  d=(void*)p;
173  if ((rtyp==POLY_CMD)||(rtyp==VECTOR_CMD)) data=d;
174  else if (rtyp==IDHDL)
175  {
176  idhdl h=(idhdl)data;
177  IDPOLY(h)=p;
178  setFlag(h,FLAG_QRING);
179  }
180  }
181  }
182  PrintNSpaces(spaces);
183  pWrite0((poly)d);
184  break;
185  case RESOLUTION_CMD:
186  {
187  syStrategy tmp=(syStrategy)d;
188  syPrint(tmp,IDID(currRingHdl));
189  break;
190  }
191  case STRING_CMD:
192  PrintNSpaces(spaces);
193  PrintS((char *)d);
194  break;
195  case INT_CMD:
196  PrintNSpaces(spaces);
197  ::Print("%d",(int)(long)d);
198  break;
199  case PROC_CMD:
200  {
202 
203  PrintNSpaces(spaces);
204  PrintS("// libname : ");
205  PrintS(piProcinfo(pi, "libname"));
206  PrintLn();
207 
208  PrintNSpaces(spaces);
209  PrintS("// procname : ");
210  PrintS(piProcinfo(pi, "procname"));
211  PrintLn();
212 
213  PrintNSpaces(spaces);
214  PrintS("// type : ");
215  PrintS(piProcinfo(pi, "type"));
216  // ::Print("%-*.*s// ref : %s",spaces,spaces," ",
217  // piProcinfo(pi, "ref"));
218  break;
219  }
220  case LINK_CMD:
221  {
222  si_link l=(si_link)d;
223  PrintNSpaces(spaces);
224  ::Print("// type : %s\n", slStatus(l, "type"));
225  PrintNSpaces(spaces);
226  ::Print("// mode : %s\n", slStatus(l, "mode"));
227  PrintNSpaces(spaces);
228  ::Print("// name : %s\n", slStatus(l, "name"));
229  PrintNSpaces(spaces);
230  ::Print("// open : %s\n", slStatus(l, "open"));
231  PrintNSpaces(spaces);
232  ::Print("// read : %s\n", slStatus(l, "read"));
233  PrintNSpaces(spaces);
234  ::Print("// write: %s", slStatus(l, "write"));
235  break;
236  }
237  case NUMBER_CMD:
238  case BIGINT_CMD:
239  if (t==NUMBER_CMD)
240  {
241  number n=(number)d;
242  nNormalize(n);
243  d=n;
244  }
245  s=String(d);
246  if (s==NULL) return;
247  PrintNSpaces(spaces);
248  PrintS(s);
249  omFree((ADDRESS)s);
250  break;
251  case LIST_CMD:
252  {
253  lists l=(lists)d;
254  if (lSize(l)<0)
255  {
256  PrintNSpaces(spaces);
257  PrintS("empty list\n");
258  }
259  else
260  {
261  int i=0;
262  for (;i<=l->nr;i++)
263  {
264  if (l->m[i].rtyp!=DEF_CMD)
265  {
266  PrintNSpaces(spaces);
267  ::Print("[%d]:\n",i+1);
268  l->m[i].Print(NULL,spaces+3);
269  }
270  }
271  }
272  break;
273  }
274 
275  default:
276  if (t>MAX_TOK)
277  {
278  blackbox * bb=getBlackboxStuff(t);
279  PrintNSpaces(spaces);
280  if (bb!=NULL) { bb->blackbox_Print(bb,d); }
281  else { ::Print("Print: blackbox %d(bb=NULL)",t); }
282  }
283  else
284  ::Print("Print:unknown type %s(%d)", Tok2Cmdname(t),t);
285  } /* end switch: (Typ()) */
286  }
287  if (next!=NULL)
288  {
289  if (t==COMMAND) PrintLn();
290  else if (t!=LIST_CMD) PrintS(" ");
291  next->Print(NULL,spaces);
292  }
293  else if (t!=LIST_CMD)
294  {
295  PrintLn();
296  }
297 #ifdef SIQ
298  if (rtyp!=COMMAND)
299 #endif
300  {
301  if ((store!=NULL)
302  && (store!=this))
303  {
304  if((t/*Typ()*/!=LINK_CMD)
305  && (t/*Typ()*/!=PACKAGE_CMD)
306  && (t/*Typ()*/!=DEF_CMD)
307  )
308  {
309  store->rtyp=t/*Typ()*/;
310  store->data=CopyD();
311  if(attribute!=NULL)
312  {
313  store->attribute=CopyA();
314  }
315  store->flag=flag;
316  }
317  }
318  }
319 }
320 
321 void sleftv::CleanUp(ring r)
322 {
323  if ((name!=NULL) && (name!=sNoName) && (rtyp!=IDHDL) && (rtyp!=ALIAS_CMD))
324  {
325  //::Print("free %x (%s)\n",name,name);
326  omFree((ADDRESS)name);
327  }
328  //name=NULL;
329  //flag=0;
330  if (data!=NULL)
331  {
332  if (rtyp==IDHDL) attribute=NULL; // is only a pointer to attribute of id
333  else s_internalDelete(rtyp,data,r);
334  //data=NULL; // will be done by Init() at the end
335  }
336  if (attribute!=NULL)
337  {
338  switch (rtyp)
339  {
340  case PACKAGE_CMD:
341  case IDHDL:
342  case ANY_TYPE:
343  case VECHO:
344  case VPRINTLEVEL:
345  case VCOLMAX:
346  case VTIMER:
347  case VRTIMER:
348  case VOICE:
349  case VMAXDEG:
350  case VMAXMULT:
351  case TRACE:
352  case VSHORTOUT:
353  case VNOETHER:
354  case VMINPOLY:
355  case LIB_CMD:
356  case 0:
357  //attribute=NULL; // will be done by Init() at the end
358  break;
359  default:
360  {
361  attribute->killAll(r);
362  }
363  }
364  }
365  Subexpr h;
366  while (e!=NULL)
367  {
368  h=e->next;
370  e=h;
371  }
372  //rtyp=NONE; // will be done by Init() at the end
373  if (next!=NULL)
374  {
375  leftv tmp_n;
376  do
377  {
378  tmp_n=next->next;
379  //next->name=NULL;
380  next->next=NULL;
381  next->CleanUp(r);
382  omFreeBin((ADDRESS)next, sleftv_bin);
383  next=tmp_n;
384  } while (next!=NULL);
385  }
386  Init();
387 }
388 
390 {
391  int rt=Typ();
392  if(::RingDependend(rt) && (rt!=QRING_CMD))
393  return TRUE;
394  if (rt==LIST_CMD)
395  return lRingDependend((lists)Data());
396  if (this->next!=NULL)
397  return this->next->RingDependend();
398  return FALSE;
399 }
400 
401 static inline void * s_internalCopy(const int t, void *d)
402 {
403  switch (t)
404  {
405 #ifdef SINGULAR_4_1
406  case CRING_CMD:
407  {
408  coeffs cf=(coeffs)d;
409  cf->ref++;
410  return (void*)d;
411  }
412  case CNUMBER_CMD:
413  return (void*)n2Copy((number2)d);
414  case CMATRIX_CMD: // like BIGINTMAT
415 #endif
416  case BIGINTMAT_CMD:
417  return (void*)bimCopy((bigintmat *)d);
418  case INTVEC_CMD:
419  case INTMAT_CMD:
420  return (void *)ivCopy((intvec *)d);
421  case MATRIX_CMD:
422  return (void *)mp_Copy((matrix)d, currRing);
423  case IDEAL_CMD:
424  case MODUL_CMD:
425  return (void *)idCopy((ideal)d);
426  case STRING_CMD:
427  return (void *)omStrDup((char *)d);
428  case PACKAGE_CMD:
429  return (void *)paCopy((package) d);
430  case PROC_CMD:
431  return (void *)piCopy((procinfov) d);
432  case POLY_CMD:
433  case VECTOR_CMD:
434  return (void *)pCopy((poly)d);
435  case INT_CMD:
436  return d;
437  case NUMBER_CMD:
438  return (void *)nCopy((number)d);
439  case BIGINT_CMD:
440  return (void *)n_Copy((number)d, coeffs_BIGINT);
441  case MAP_CMD:
442  return (void *)maCopy((map)d, currRing);
443  case LIST_CMD:
444  return (void *)lCopy((lists)d);
445  case LINK_CMD:
446  return (void *)slCopy((si_link) d);
447  case RING_CMD:
448  case QRING_CMD:
449  {
450  ring r=(ring)d;
451  if (r!=NULL) r->ref++;
452  //Print("+ ring %d, ref %d\n",r,r->ref);
453  return d;
454  }
455  case RESOLUTION_CMD:
456  return (void*)syCopy((syStrategy)d);
457  case DEF_CMD:
458  case NONE:
459  case 0: /* type in error case */
460  break; /* error recovery: do nothing */
461  //case COMMAND:
462  default:
463  {
464  if (t>MAX_TOK)
465  {
466  blackbox *b=getBlackboxStuff(t);
467  if (b!=NULL) return b->blackbox_Copy(b,d);
468  return NULL;
469  }
470  else
471  Warn("s_internalCopy: cannot copy type %s(%d)",
472  Tok2Cmdname(t),t);
473  }
474  }
475  return NULL;
476 }
477 
478 void s_internalDelete(const int t, void *d, const ring r)
479 {
480  assume(d!=NULL);
481  switch (t)
482  {
483 #ifdef SINGULAR_4_1
484  case CRING_CMD:
485  nKillChar((coeffs)d);
486  break;
487  case CNUMBER_CMD:
488  {
489  number2 n=(number2)d;
490  n2Delete(n);
491  break;
492  }
493  case CMATRIX_CMD: //like BIGINTMAT
494 #endif
495  case BIGINTMAT_CMD:
496  {
497  bigintmat *v=(bigintmat*)d;
498  delete v;
499  break;
500  }
501  case INTVEC_CMD:
502  case INTMAT_CMD:
503  {
504  intvec *v=(intvec*)d;
505  delete v;
506  break;
507  }
508  case MAP_CMD:
509  {
510  map m=(map)d;
511  omFreeBinAddr((ADDRESS)m->preimage);
512  m->preimage=NULL;
513  /* no break: continue as IDEAL*/
514  }
515  case MATRIX_CMD:
516  case IDEAL_CMD:
517  case MODUL_CMD:
518  {
519  ideal i=(ideal)d;
520  id_Delete(&i,r);
521  break;
522  }
523  case STRING_CMD:
524  omFree(d);
525  break;
526  //case PACKAGE_CMD:
527  // return (void *)paCopy((package) d);
528  case PROC_CMD:
529  piKill((procinfo*)d);
530  break;
531  case POLY_CMD:
532  case VECTOR_CMD:
533  {
534  poly p=(poly)d;
535  p_Delete(&p,r);
536  break;
537  }
538  case NUMBER_CMD:
539  {
540  number n=(number)d;
541  n_Delete(&n,r);
542  break;
543  }
544  case BIGINT_CMD:
545  {
546  number n=(number)d;
548  break;
549  }
550  case LIST_CMD:
551  {
552  lists l=(lists)d;
553  l->Clean(r);
554  break;
555  }
556  case LINK_CMD:
557  {
558  si_link l=(si_link)d;
559  slKill(l);
560  break;
561  }
562  case RING_CMD:
563  case QRING_CMD:
564  {
565  ring R=(ring)d;
566  if ((R!=currRing)||(R->ref>=0))
567  rKill(R);
568  #ifdef TEST
569  else
570  Print("currRing? ref=%d\n",R->ref);
571  #endif
572  break;
573  }
574  case RESOLUTION_CMD:
575  {
577  if (s!=NULL) syKillComputation(s,r);
578  break;
579  }
580  case COMMAND:
581  {
582  command cmd=(command)d;
583  if (cmd->arg1.rtyp!=0) cmd->arg1.CleanUp(r);
584  if (cmd->arg2.rtyp!=0) cmd->arg2.CleanUp(r);
585  if (cmd->arg3.rtyp!=0) cmd->arg3.CleanUp(r);
587  break;
588  }
589  case INT_CMD:
590  case DEF_CMD:
591  case ALIAS_CMD:
592  case PACKAGE_CMD:
593  case IDHDL:
594  case NONE:
595  case ANY_TYPE:
596  case VECHO:
597  case VPRINTLEVEL:
598  case VCOLMAX:
599  case VTIMER:
600  case VRTIMER:
601  case VOICE:
602  case VMAXDEG:
603  case VMAXMULT:
604  case TRACE:
605  case VSHORTOUT:
606  case VNOETHER:
607  case VMINPOLY:
608  case LIB_CMD:
609  case 0: /* type in error case */
610  break; /* error recovery: do nothing */
611  //case COMMAND:
612  //case COMMAND:
613  default:
614  {
615  if (t>MAX_TOK)
616  {
617  blackbox *b=getBlackboxStuff(t);
618  if (b!=NULL) b->blackbox_destroy(b,d);
619  break;
620  }
621  else
622  Warn("s_internalDelete: cannot delete type %s(%d)",
623  Tok2Cmdname(t),t);
624  }
625  }
626 }
627 
628 void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
629 {
630  if (t==STRING_CMD)
631  {
632  if ((e==NULL)
633  || (source->rtyp==LIST_CMD)
634  || ((source->rtyp==IDHDL)
635  &&((IDTYP((idhdl)source->data)==LIST_CMD)
636  || (IDTYP((idhdl)source->data)>MAX_TOK)))
637  || (source->rtyp>MAX_TOK))
638  return (void *)omStrDup((char *)d);
639  else if (e->next==NULL)
640  {
641  char *s=(char*)omAllocBin(size_two_bin);
642  s[0]=*(char *)d;
643  s[1]='\0';
644  return s;
645  }
646  #ifdef TEST
647  else
648  {
649  Werror("not impl. string-op in `%s`",my_yylinebuf);
650  return NULL;
651  }
652  #endif
653  }
654  return s_internalCopy(t,d);
655 }
656 
657 void sleftv::Copy(leftv source)
658 {
659  Init();
660  rtyp=source->Typ();
661  void *d=source->Data();
662  if(!errorreported)
663  {
665  if ((source->attribute!=NULL)||(source->e!=NULL))
666  attribute=source->CopyA();
667  flag=source->flag;
668  if (source->next!=NULL)
669  {
670  next=(leftv)omAllocBin(sleftv_bin);
671  next->Copy(source->next);
672  }
673  }
674 }
675 
676 void * sleftv::CopyD(int t)
677 {
678  if ((rtyp!=IDHDL)&&(rtyp!=ALIAS_CMD)&&(e==NULL))
679  {
680  if (iiCheckRing(t)) return NULL;
681  void *x = data;
682  if (rtyp==VNOETHER) x = (void *)pCopy((currRing->ppNoether));
683  else if ((rtyp==VMINPOLY) && nCoeff_is_algExt(currRing->cf) && (!nCoeff_is_GF(currRing->cf)))
684  {
685  const ring A = currRing->cf->extRing;
686 
687  assume( A != NULL );
688  assume( A->qideal != NULL );
689 
690  x=(void *)p_Copy(A->qideal->m[0], A);
691  }
692  data=NULL;
693  return x;
694  }
695  void *d=Data(); // will also do a iiCheckRing
696  if ((!errorreported) && (d!=NULL)) return slInternalCopy(this,t,d,e);
697  return NULL;
698 }
699 
700 //void * sleftv::CopyD()
701 //{
702  //if ((rtyp!=IDHDL)&&(e==NULL)
703  //&&(rtyp!=VNOETHER)&&(rtyp!=LIB_CMD)&&(rtyp!=VMINPOLY))
704  //{
705  // void *x=data;
706  // data=NULL;
707  // return x;
708  //}
709 // return CopyD(Typ());
710 //}
711 
713 {
714  attr *a=Attribute();
715  if ((a!=NULL) && (*a!=NULL))
716  return (*a)->Copy();
717  return NULL;
718 }
719 
720 char * sleftv::String(void *d, BOOLEAN typed, int dim)
721 {
722 #ifdef SIQ
723  if (rtyp==COMMAND)
724  {
725  ::Print("##command %d\n",((command)data)->op);
726  if (((command)data)->arg1.rtyp!=0)
727  ((command)data)->arg1.Print(NULL,2);
728  if (((command)data)->arg2.rtyp!=0)
729  ((command)data)->arg2.Print(NULL,2);
730  if (((command)data)->arg3.rtyp==0)
731  ((command)data)->arg3.Print(NULL,2);
732  PrintS("##end\n");
733  return omStrDup("");
734  }
735 #endif
736  if (d==NULL) d=Data();
737  if (!errorreported)
738  {
739  char *s;
740  int t=Typ();
741  switch (t /*Typ()*/)
742  {
743  case INT_CMD:
744  if (typed)
745  {
746  s=(char *)omAlloc(MAX_INT_LEN+7);
747  sprintf(s,"int(%d)",(int)(long)d);
748  }
749  else
750  {
751  s=(char *)omAlloc(MAX_INT_LEN+2);
752  sprintf(s,"%d",(int)(long)d);
753  }
754  return s;
755 
756  case STRING_CMD:
757  if (d == NULL)
758  {
759  if (typed) return omStrDup("\"\"");
760  return omStrDup("");
761  }
762  if (typed)
763  {
764  s = (char*) omAlloc(strlen((char*) d) + 3);
765  sprintf(s,"\"%s\"", (char*) d);
766  return s;
767  }
768  else
769  {
770  return omStrDup((char*)d);
771  }
772 
773  case POLY_CMD:
774  case VECTOR_CMD:
775  if (typed)
776  {
777  char* ps = pString((poly) d);
778  s = (char*) omAlloc(strlen(ps) + 10);
779  sprintf(s,"%s(%s)", (t /*Typ()*/ == POLY_CMD ? "poly" : "vector"), ps);
780  omFree(ps);
781  return s;
782  }
783  else
784  return pString((poly)d);
785 
786  #ifdef SINGULAR_4_1
787  case CNUMBER_CMD:
788  return n2String((number2)d,typed);
789  #endif
790 
791  case NUMBER_CMD:
792  StringSetS((char*) (typed ? "number(" : ""));
793  if ((rtyp==IDHDL)&&(IDTYP((idhdl)data)==NUMBER_CMD))
794  {
795  nWrite(IDNUMBER((idhdl)data));
796  }
797  else if (rtyp==NUMBER_CMD)
798  {
799  number n=(number)data;
800  nWrite(n);
801  data=(char *)n;
802  }
803  else if((rtyp==VMINPOLY)&&(rField_is_GF(currRing)))
804  {
805  nfShowMipo(currRing->cf);
806  }
807  else
808  {
809  number n=nCopy((number)d);
810  nWrite(n);
811  nDelete(&n);
812  }
813  StringAppendS((char*) (typed ? ")" : ""));
814  return StringEndS();
815 
816  case BIGINT_CMD:
817  {
818  StringSetS((char*) (typed ? "bigint(" : ""));
819  number nl=(number)d;
821  StringAppendS((char*) (typed ? ")" : ""));
822  return StringEndS();
823  }
824 
825  case MATRIX_CMD:
826  s= iiStringMatrix((matrix)d,dim, currRing);
827  if (typed)
828  {
829  char* ns = (char*) omAlloc(strlen(s) + 40);
830  sprintf(ns, "matrix(ideal(%s),%d,%d)", s,
831  ((ideal) d)->nrows, ((ideal) d)->ncols);
832  omCheckAddr(ns);
833  return ns;
834  }
835  else
836  {
837  return omStrDup(s);
838  }
839 
840  case MODUL_CMD:
841  case IDEAL_CMD:
842  case MAP_CMD:
843  s= iiStringMatrix((matrix)d,dim, currRing);
844  if (typed)
845  {
846  char* ns = (char*) omAlloc(strlen(s) + 10);
847  sprintf(ns, "%s(%s)", (t/*Typ()*/==MODUL_CMD ? "module" : "ideal"), s);
848  omCheckAddr(ns);
849  return ns;
850  }
851  return omStrDup(s);
852 
853  case INTVEC_CMD:
854  case INTMAT_CMD:
855  {
856  intvec *v=(intvec *)d;
857  s = v->String(dim);
858  if (typed)
859  {
860  char* ns;
861  if (t/*Typ()*/ == INTMAT_CMD)
862  {
863  ns = (char*) omAlloc(strlen(s) + 40);
864  sprintf(ns, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
865  }
866  else
867  {
868  ns = (char*) omAlloc(strlen(s) + 10);
869  sprintf(ns, "intvec(%s)", s);
870  }
871  omCheckAddr(ns);
872  omFree(s);
873  return ns;
874  }
875  else
876  return s;
877  }
878  case BIGINTMAT_CMD:
879  {
880  bigintmat *bim=(bigintmat*)d;
881  s = bim->String();
882  if (typed)
883  {
884  char* ns = (char*) omAlloc0(strlen(s) + 40);
885  sprintf(ns, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
886  omCheckAddr(ns);
887  return ns;
888  }
889  else
890  return omStrDup(s);
891  }
892 
893  case RING_CMD:
894  case QRING_CMD:
895  s = rString((ring)d);
896 
897  if (typed)
898  {
899  char* ns;
900  if (t/*Typ()*/ == QRING_CMD)
901  {
902  char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
903  currRing);
904  ns = (char*) omAlloc(strlen(s) + strlen(id) + 20);
905  sprintf(ns, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
906  }
907  else
908  {
909  ns = (char*) omAlloc(strlen(s) + 4);
910  sprintf(ns, "\"%s\"", s);
911  }
912  omFree(s);
913  omCheckAddr(ns);
914  return ns;
915  }
916  return s;
917  case RESOLUTION_CMD:
918  {
919  lists l = syConvRes((syStrategy)d);
920  s = lString(l, typed, dim);
921  l->Clean();
922  return s;
923  }
924 
925  case PROC_CMD:
926  {
927  procinfo* pi = (procinfo*) d;
928  if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
929  s = (pi->data.s.body);
930  else
931  s = (char *)"";
932  if (typed)
933  {
934  char* ns = (char*) omAlloc(strlen(s) + 4);
935  sprintf(ns, "\"%s\"", s);
936  omCheckAddr(ns);
937  return ns;
938  }
939  return omStrDup(s);
940  }
941 
942  case LINK_CMD:
943  s = slString((si_link) d);
944  if (typed)
945  {
946  char* ns = (char*) omAlloc(strlen(s) + 10);
947  sprintf(ns, "link(\"%s\")", s);
948  omFreeBinAddr(s);
949  omCheckAddr(ns);
950  return ns;
951  }
952  return s;
953 
954  case LIST_CMD:
955  return lString((lists) d, typed, dim);
956 
957  default:
958  if(t> MAX_TOK)
959  {
960  blackbox *bb=getBlackboxStuff(t);
961  if (bb!=NULL) return bb->blackbox_String(bb,d);
962  }
963  } /* end switch: (Typ()) */
964  }
965  return omStrDup("");
966 }
967 
968 
970 {
971  if (e==NULL)
972  {
973  switch (rtyp)
974  {
975  case IDHDL:
976  return IDTYP((idhdl)data);
977  case ALIAS_CMD:
978  {
979  idhdl h=(idhdl)data;
980  return ((idhdl)h->data.ustring)->typ;
981  }
982  case VECHO:
983  case VPRINTLEVEL:
984  case VCOLMAX:
985  case VTIMER:
986  case VRTIMER:
987  case VOICE:
988  case VMAXDEG:
989  case VMAXMULT:
990  case TRACE:
991  case VSHORTOUT:
992  return INT_CMD;
993  case VMINPOLY:
994  data=NULL;
995  return NUMBER_CMD;
996  case VNOETHER:
997  data=NULL;
998  return POLY_CMD;
999  //case COMMAND:
1000  // return COMMAND;
1001  default:
1002  return rtyp;
1003  }
1004  }
1005  int r=0;
1006  int t=rtyp;
1007  void *d=data;
1008  if (t==IDHDL) t=IDTYP((idhdl)d);
1009  else if (t==ALIAS_CMD)
1010  { idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
1011  switch (t)
1012  {
1013 #ifdef SINGULAR_4_1
1014  case CMATRIX_CMD:
1015  {
1016  bigintmat *b=(bigintmat*)d;
1017  if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
1018  return NUMBER_CMD;
1019  else
1020  return CNUMBER_CMD;
1021  }
1022 #endif
1023  case INTVEC_CMD:
1024  case INTMAT_CMD:
1025  r=INT_CMD;
1026  break;
1027  case BIGINTMAT_CMD:
1028  r=BIGINT_CMD;
1029  break;
1030  case IDEAL_CMD:
1031  case MATRIX_CMD:
1032  case MAP_CMD:
1033  r=POLY_CMD;
1034  break;
1035  case MODUL_CMD:
1036  r=VECTOR_CMD;
1037  break;
1038  case STRING_CMD:
1039  r=STRING_CMD;
1040  break;
1041  default:
1042  {
1043  blackbox *b=NULL;
1044  if (t>MAX_TOK)
1045  {
1046  b=getBlackboxStuff(t);
1047  }
1048  if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
1049  {
1050  lists l;
1051  if (rtyp==IDHDL) l=IDLIST((idhdl)d);
1052  else l=(lists)d;
1053  if ((0<e->start)&&(e->start<=l->nr+1))
1054  {
1055  Subexpr tmp=l->m[e->start-1].e;
1056  l->m[e->start-1].e=e->next;
1057  r=l->m[e->start-1].Typ();
1058  e->next=l->m[e->start-1].e;
1059  l->m[e->start-1].e=tmp;
1060  }
1061  else
1062  {
1063  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1064  r=DEF_CMD;
1065  }
1066  }
1067  else
1068  Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
1069  break;
1070  }
1071  }
1072  return r;
1073 }
1074 
1076 {
1077  lists l=NULL;
1078  int r;
1079  if (rtyp==LIST_CMD)
1080  l=(lists)data;
1081  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1082  l=IDLIST((idhdl)data);
1083  else
1084  return Typ();
1085  //if (l!=NULL)
1086  {
1087  if ((e!=NULL) && (e->next!=NULL))
1088  {
1089  if ((0<e->start)&&(e->start<=l->nr+1))
1090  {
1091  l->m[e->start-1].e=e->next;
1092  r=l->m[e->start-1].LTyp();
1093  l->m[e->start-1].e=NULL;
1094  }
1095  else
1096  {
1097  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1098  r=NONE;
1099  }
1100  return r;
1101  }
1102  return LIST_CMD;
1103  }
1104  return Typ();
1105 }
1106 
1107 #ifdef SINGULAR_4_1
1109 static int iiCmatrix_index=0;
1110 #endif
1112 {
1113  if ((rtyp!=IDHDL) && iiCheckRing(rtyp))
1114  return NULL;
1115  if (e==NULL)
1116  {
1117  switch (rtyp)
1118  {
1119  case ALIAS_CMD:
1120  {
1121  idhdl h=(idhdl)data;
1122  return ((idhdl)h->data.ustring)->data.ustring;
1123  }
1124  case VECHO: return (void *)(long)si_echo;
1125  case VPRINTLEVEL:return (void *)(long)printlevel;
1126  case VCOLMAX: return (void *)(long)colmax;
1127  case VTIMER: return (void *)(long)getTimer();
1128  case VRTIMER: return (void *)(long)getRTimer();
1129  case VOICE: return (void *)(long)(myynest+1);
1130  case VMAXDEG: return (void *)(long)Kstd1_deg;
1131  case VMAXMULT: return (void *)(long)Kstd1_mu;
1132  case TRACE: return (void *)(long)traceit;
1133  case VSHORTOUT: return (void *)(long)(currRing != NULL ? currRing->ShortOut : 0);
1134  case VMINPOLY:
1135  if ( (currRing != NULL) && nCoeff_is_algExt(currRing->cf) && !nCoeff_is_GF(currRing->cf))
1136  {
1137  /* Q(a), Fp(a), but not GF(q) */
1138  const ring A = currRing->cf->extRing;
1139 
1140  assume( A != NULL );
1141  assume( A->qideal != NULL );
1142 
1143  return (void *)A->qideal->m[0];
1144  }
1145  else
1146  return (void *)currRing->cf->nNULL;
1147 
1148  case VNOETHER: return (void *) (currRing->ppNoether);
1149  case IDHDL:
1150  return IDDATA((idhdl)data);
1151  case COMMAND:
1152  //return NULL;
1153  default:
1154  return data;
1155  }
1156  }
1157  /* e != NULL : */
1158  int t=rtyp;
1159  void *d=data;
1160  if (t==IDHDL)
1161  {
1162  t=((idhdl)data)->typ;
1163  d=IDDATA((idhdl)data);
1164  }
1165  else if (t==ALIAS_CMD)
1166  {
1168  t=IDTYP(h);
1169  d=IDDATA(h);
1170  }
1171  if (iiCheckRing(t))
1172  return NULL;
1173  char *r=NULL;
1174  int index=e->start;
1175  switch (t)
1176  {
1177  case INTVEC_CMD:
1178  {
1179  intvec *iv=(intvec *)d;
1180  if ((index<1)||(index>iv->length()))
1181  {
1182  if (!errorreported)
1183  Werror("wrong range[%d] in intvec %s(%d)",index,this->Name(),iv->length());
1184  }
1185  else
1186  r=(char *)(long)((*iv)[index-1]);
1187  break;
1188  }
1189  case INTMAT_CMD:
1190  {
1191  intvec *iv=(intvec *)d;
1192  if ((index<1)
1193  ||(index>iv->rows())
1194  ||(e->next->start<1)
1195  ||(e->next->start>iv->cols()))
1196  {
1197  if (!errorreported)
1198  Werror("wrong range[%d,%d] in intmat %s(%dx%d)",index,e->next->start,
1199  this->Name(),iv->rows(),iv->cols());
1200  }
1201  else
1202  r=(char *)(long)(IMATELEM((*iv),index,e->next->start));
1203  break;
1204  }
1205  case BIGINTMAT_CMD:
1206  {
1207  bigintmat *m=(bigintmat *)d;
1208  if ((index<1)
1209  ||(index>m->rows())
1210  ||(e->next->start<1)
1211  ||(e->next->start>m->cols()))
1212  {
1213  if (!errorreported)
1214  Werror("wrong range[%d,%d] in bigintmat %s(%dx%d)",index,e->next->start,
1215  this->Name(),m->rows(),m->cols());
1216  }
1217  else
1218  r=(char *)(BIMATELEM((*m),index,e->next->start));
1219  break;
1220  }
1221 #ifdef SINGULAR_4_1
1222  case CMATRIX_CMD:
1223  {
1224  bigintmat *m=(bigintmat *)d;
1225  if ((index<1)
1226  ||(index>m->rows())
1227  ||(e->next->start<1)
1228  ||(e->next->start>m->cols()))
1229  {
1230  if (!errorreported)
1231  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",index,e->next->start,
1232  this->Name(),m->rows(),m->cols());
1233  }
1234  else
1235  {
1236  iiNumber2Data[iiCmatrix_index].cf=m->basecoeffs();
1237  iiNumber2Data[iiCmatrix_index].n=BIMATELEM((*m),index,e->next->start);
1238  r=(char*)&iiNumber2Data[iiCmatrix_index];
1239  iiCmatrix_index=(iiCmatrix_index+1) % 4;
1240  }
1241  break;
1242  }
1243 #endif
1244  case IDEAL_CMD:
1245  case MODUL_CMD:
1246  case MAP_CMD:
1247  {
1248  ideal I=(ideal)d;
1249  if ((index<1)||(index>IDELEMS(I)))
1250  {
1251  if (!errorreported)
1252  Werror("wrong range[%d] in ideal/module %s(%d)",index,this->Name(),IDELEMS(I));
1253  }
1254  else
1255  r=(char *)I->m[index-1];
1256  break;
1257  }
1258  case STRING_CMD:
1259  {
1260  // this was a memory leak
1261  // we evalute it, cleanup and replace this leftv by it's evalutated form
1262  // the evalutated form will be build in tmp
1263  sleftv tmp;
1264  tmp.Init();
1265  tmp.rtyp=STRING_CMD;
1266  r=(char *)omAllocBin(size_two_bin);
1267  if ((index>0)&& (index<=(int)strlen((char *)d)))
1268  {
1269  r[0]=*(((char *)d)+index-1);
1270  r[1]='\0';
1271  }
1272  else
1273  {
1274  r[0]='\0';
1275  }
1276  tmp.data=r;
1277  if ((rtyp==IDHDL)||(rtyp==STRING_CMD))
1278  {
1279  tmp.next=next; next=NULL;
1280  //if (rtyp==STRING_CMD) { omFree((ADDRESS)data); }
1281  //data=NULL;
1282  d=NULL;
1283  CleanUp();
1284  memcpy(this,&tmp,sizeof(tmp));
1285  }
1286  // and, remember, r is also the result...
1287  else
1288  {
1289  // ???
1290  // here we still have a memory leak...
1291  // example: list L="123","456";
1292  // L[1][2];
1293  // therefore, it should never happen:
1294  assume(0);
1295  // but if it happens: here is the temporary fix:
1296  // omMarkAsStaticAddr(r);
1297  }
1298  break;
1299  }
1300  case MATRIX_CMD:
1301  {
1302  if ((index<1)
1303  ||(index>MATROWS((matrix)d))
1304  ||(e->next->start<1)
1305  ||(e->next->start>MATCOLS((matrix)d)))
1306  {
1307  if (!errorreported)
1308  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",
1309  index,e->next->start,
1310  this->Name(),
1311  MATROWS((matrix)d),MATCOLS((matrix)d));
1312  }
1313  else
1314  r=(char *)MATELEM((matrix)d,index,e->next->start);
1315  break;
1316  }
1317  default:
1318  {
1319  blackbox *b=NULL;
1320  if (t>MAX_TOK)
1321  {
1322  b=getBlackboxStuff(t);
1323  }
1324  if ((t==LIST_CMD)||((b!=NULL)&&(BB_LIKE_LIST(b))))
1325  {
1326  lists l=(lists)d;
1327  if ((0<index)&&(index<=l->nr+1))
1328  {
1329  if ((e->next!=NULL)
1330  && (l->m[index-1].rtyp==STRING_CMD))
1331  // string[..].Data() modifies sleftv, so let's do it ourself
1332  {
1333  char *dd=(char *)l->m[index-1].data;
1334  int j=e->next->start-1;
1335  r=(char *)omAllocBin(size_two_bin);
1336  if ((j>=0) && (j<(int)strlen(dd)))
1337  {
1338  r[0]=*(dd+j);
1339  r[1]='\0';
1340  }
1341  else
1342  {
1343  r[0]='\0';
1344  }
1345  }
1346  else
1347  {
1348  Subexpr tmp=l->m[index-1].e;
1349  l->m[index-1].e=e->next;
1350  r=(char *)l->m[index-1].Data();
1351  e->next=l->m[index-1].e;
1352  l->m[index-1].e=tmp;
1353  }
1354  }
1355  else //if (!errorreported)
1356  Werror("wrong range[%d] in list %s(%d)",index,this->Name(),l->nr+1);
1357  }
1358  else
1359  Werror("cannot index %s of type %s(%d)",this->Name(),Tok2Cmdname(t),t);
1360  break;
1361  }
1362  }
1363  return r;
1364 }
1365 
1367 {
1368  if (e==NULL) return &attribute;
1369  if ((rtyp==LIST_CMD)
1370  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1371  || (rtyp>MAX_TOK)
1372  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1373  {
1374  leftv v=LData();
1375  return &(v->attribute);
1376  }
1377  return NULL;
1378 }
1379 
1381 {
1382  if (e!=NULL)
1383  {
1384  lists l=NULL;
1385  blackbox *b=getBlackboxStuff(rtyp);
1386 
1387  if ((rtyp==LIST_CMD)
1388  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1389  l=(lists)data;
1390  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1391  l=IDLIST((idhdl)data);
1392  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1393  {
1394  b=getBlackboxStuff(IDTYP((idhdl)data));
1395  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1396  }
1397  else if (rtyp==ALIAS_CMD)
1398  {
1399  idhdl h=(idhdl)data;
1400  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1401  }
1402  if (l!=NULL)
1403  {
1404  if ((0>=e->start)||(e->start>l->nr+1))
1405  return NULL;
1406  if (e->next!=NULL)
1407  {
1408  l->m[e->start-1].e=e->next;
1409  leftv r=l->m[e->start-1].LData();
1410  l->m[e->start-1].e=NULL;
1411  return r;
1412  }
1413  return &(l->m[e->start-1]);
1414  }
1415  }
1416  return this;
1417 }
1418 
1419 #if 0
1420 leftv sleftv::LHdl()
1421 {
1422  if (e!=NULL)
1423  {
1424  lists l=NULL;
1425 
1426  if (rtyp==LIST_CMD)
1427  l=(lists)data;
1428  if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1429  l=IDLIST((idhdl)data);
1430  if (l!=NULL)
1431  {
1432  if ((0>=e->start)||(e->start>l->nr+1))
1433  return NULL;
1434  if (e->next!=NULL)
1435  {
1436  l->m[e->start-1].e=e->next;
1437  leftv r=l->m[e->start-1].LHdl();
1438  l->m[e->start-1].e=NULL;
1439  return r;
1440  }
1441  return &(l->m[e->start-1]);
1442  }
1443  }
1444  return this;
1445 }
1446 #endif
1447 
1449 {
1450  if (h->e!=NULL)
1451  {
1452  leftv hh=h->LData();
1453  if (h!=hh) return assumeStdFlag(h->LData());
1454  }
1455  if (!hasFlag(h,FLAG_STD))
1456  {
1457  if (!TEST_VERB_NSB)
1458  {
1459  if (TEST_V_ALLWARN)
1460  Warn("%s is no standard basis in >>%s<<",h->Name(),my_yylinebuf);
1461  else
1462  Warn("%s is no standard basis",h->Name());
1463  }
1464  return FALSE;
1465  }
1466  return TRUE;
1467 }
1468 
1469 /*2
1470 * transforms a name (as an string created by omAlloc or omStrDup)
1471 * into an expression (sleftv), deletes the string
1472 * utility for grammar and iparith
1473 */
1474 void syMake(leftv v,const char * id, idhdl packhdl)
1475 {
1476  /* resolv an identifier: (to DEF_CMD, if siq>0)
1477  * 1) reserved id: done by scanner
1478  * 2) `basering` / 'Current`
1479  * 3) existing identifier, local
1480  * 4) ringvar, ringpar, local ring
1481  * 5) existing identifier, global
1482  * 6) monom (resp. number), local ring: consisting of:
1483  * 6') ringvar, ringpar,global ring
1484  * 6'') monom (resp. number), local ring
1485  * 7) monom (resp. number), non-local ring
1486  * 8) basering
1487  * 9) `_`
1488  * 10) everything else is of type 0
1489  */
1490 #ifdef TEST
1491  if ((*id<' ')||(*id>(char)126))
1492  {
1493  Print("wrong id :%s:\n",id);
1494  }
1495 #endif
1496  idhdl save_ring=currRingHdl;
1497  v->Init();
1498  if(packhdl != NULL)
1499  {
1500  // Print("setting req_packhdl to %s\n",IDID(packhdl));
1501  v->req_packhdl = IDPACKAGE(packhdl);
1502  }
1503  else v->req_packhdl = currPack;
1504 // if (v->req_packhdl!=basePack)
1505 // Print("search %s in %s\n",id,v->req_packhdl->libname);
1506  idhdl h=NULL;
1507 #ifdef SIQ
1508  if (siq<=0)
1509 #endif
1510  {
1511  if (!isdigit(id[0]))
1512  {
1513  if (strcmp(id,"basering")==0)
1514  {
1515  if (currRingHdl!=NULL)
1516  {
1517  if (id!=IDID(currRingHdl)) omFreeBinAddr((ADDRESS)id);
1518  h=currRingHdl;
1519  goto id_found;
1520  }
1521  else
1522  {
1523  v->name = id;
1524  return; /* undefined */
1525  }
1526  }
1527  else if (strcmp(id,"Current")==0)
1528  {
1529  if (currPackHdl!=NULL)
1530  {
1531  omFreeBinAddr((ADDRESS)id);
1532  h=currPackHdl;
1533  goto id_found;
1534  }
1535  else
1536  {
1537  v->name = id;
1538  return; /* undefined */
1539  }
1540  }
1541  if(v->req_packhdl!=currPack)
1542  {
1543  h=v->req_packhdl->idroot->get(id,myynest);
1544  }
1545  else
1546  h=ggetid(id);
1547  /* 3) existing identifier, local */
1548  if ((h!=NULL) && (IDLEV(h)==myynest))
1549  {
1550  if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1551  goto id_found;
1552  }
1553  }
1555  {
1556  currRingHdl=NULL;
1557  }
1558  /* 4. local ring: ringvar */
1559  if ((currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest)
1560  /*&& (!yyInRingConstruction)*/)
1561  {
1562  int vnr;
1563  if ((vnr=r_IsRingVar(id, currRing->names,currRing->N))>=0)
1564  {
1565  poly p=pOne();
1566  pSetExp(p,vnr+1,1);
1567  pSetm(p);
1568  v->data = (void *)p;
1569  v->name = id;
1570  v->rtyp = POLY_CMD;
1571  return;
1572  }
1573  if((n_NumberOfParameters(currRing->cf)>0)
1574  &&((vnr=r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1575  n_NumberOfParameters(currRing->cf))>=0)))
1576  {
1577  BOOLEAN ok=FALSE;
1578  poly p = pmInit(id,ok);
1579  if (ok && (p!=NULL))
1580  {
1581  v->data = pGetCoeff(p);
1582  pGetCoeff(p)=NULL;
1583  pLmFree(p);
1584  v->rtyp = NUMBER_CMD;
1585  v->name = id;
1586  return;
1587  }
1588  }
1589  }
1590  /* 5. existing identifier, global */
1591  if (h!=NULL)
1592  {
1593  if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1594  goto id_found;
1595  }
1596  /* 6. local ring: number/poly */
1597  if ((currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest))
1598  {
1599  BOOLEAN ok=FALSE;
1600  /*poly p = (!yyInRingConstruction) ? pmInit(id,ok) : (poly)NULL;*/
1601  poly p = pmInit(id,ok);
1602  if (ok)
1603  {
1604  if (p==NULL)
1605  {
1606  v->data = (void *)nInit(0);
1607  v->rtyp = NUMBER_CMD;
1608  #ifdef HAVE_PLURAL
1609  // in this case we may have monomials equal to 0 in p_Read
1610  v->name = id;
1611  #else
1612  omFreeBinAddr((ADDRESS)id);
1613  #endif
1614  }
1615  else if (pIsConstant(p))
1616  {
1617  v->data = pGetCoeff(p);
1618  pGetCoeff(p)=NULL;
1619  pLmFree(p);
1620  v->rtyp = NUMBER_CMD;
1621  v->name = id;
1622  }
1623  else
1624  {
1625  v->data = p;
1626  v->rtyp = POLY_CMD;
1627  v->name = id;
1628  }
1629  return;
1630  }
1631  }
1632  /* 7. non-local ring: number/poly */
1633  {
1634  BOOLEAN ok=FALSE;
1635  poly p = ((currRing!=NULL) /* ring required */
1636  && (currRingHdl!=NULL)
1637  /*&& (!yyInRingConstruction) - not in decl */
1638  && (IDLEV(currRingHdl)!=myynest)) /* already in case 4/6 */
1639  ? pmInit(id,ok) : (poly)NULL;
1640  if (ok)
1641  {
1642  if (p==NULL)
1643  {
1644  v->data = (void *)nInit(0);
1645  v->rtyp = NUMBER_CMD;
1646  #ifdef HAVE_PLURAL
1647  // in this case we may have monomials equal to 0 in p_Read
1648  v->name = id;
1649  #else
1650  omFreeBinAddr((ADDRESS)id);
1651  #endif
1652  }
1653  else
1654  if (pIsConstant(p))
1655  {
1656  v->data = pGetCoeff(p);
1657  pGetCoeff(p)=NULL;
1658  pLmFree(p);
1659  v->rtyp = NUMBER_CMD;
1660  v->name = id;
1661  }
1662  else
1663  {
1664  v->data = p;
1665  v->rtyp = POLY_CMD;
1666  v->name = id;
1667  }
1668  //if (TEST_V_ALLWARN /*&& (myynest>0)*/
1669  //&& ((r_IsRingVar(id, currRing->names,currRing->N)>=0)
1670  // || ((n_NumberOfParameters(currRing->cf)>0)
1671  // &&(r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1672  // n_NumberOfParameters(currRing->cf))>=0))))
1673  //{
1674  //// WARNING: do not use ring variable names in procedures
1675  // Warn("use of variable >>%s<< in a procedure in line %s",id,my_yylinebuf);
1676  //}
1677  return;
1678  }
1679  }
1680  /* 8. basering ? */
1681  if ((myynest>1)&&(currRingHdl!=NULL))
1682  {
1683  if (strcmp(id,IDID(currRingHdl))==0)
1684  {
1685  if (IDID(currRingHdl)!=id) omFreeBinAddr((ADDRESS)id); /*assume strlen (id) <1000 */
1686  h=currRingHdl;
1687  goto id_found;
1688  }
1689  }
1690  if((v->req_packhdl!=basePack) && (v->req_packhdl==currPack))
1691  {
1692  h=basePack->idroot->get(id,myynest);
1693  if (h!=NULL)
1694  {
1695  if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1696  v->req_packhdl=basePack;
1697  goto id_found;
1698  }
1699  }
1700  }
1701 #ifdef SIQ
1702  else
1703  v->rtyp=DEF_CMD;
1704 #endif
1705  /* 9: _ */
1706  if (strcmp(id,"_")==0)
1707  {
1708  omFreeBinAddr((ADDRESS)id);
1709  v->Copy(&sLastPrinted);
1710  }
1711  else
1712  {
1713  /* 10: everything else */
1714  /* v->rtyp = UNKNOWN;*/
1715  v->name = id;
1716  }
1717  currRingHdl=save_ring;
1718  return;
1719 id_found: // we have an id (in h) found, to set the data in from h
1720  if (IDTYP(h)!=ALIAS_CMD)
1721  {
1722  v->rtyp = IDHDL;
1723  v->flag = IDFLAG(h);
1724  v->attribute=IDATTR(h);
1725  }
1726  else
1727  {
1728  v->rtyp = ALIAS_CMD;
1729  }
1730  v->name = IDID(h);
1731  v->data = (char *)h;
1732  currRingHdl=save_ring;
1733 }
1734 
1736 {
1737  BOOLEAN nok=FALSE;
1738  leftv nn=next;
1739  next=NULL;
1740  if(rtyp==IDHDL)
1741  {
1742  int t=Typ();
1743  if (t!=PROC_CMD)
1744  {
1745  void *d=CopyD(t);
1746  data=d;
1747  rtyp=t;
1748  name=NULL;
1749  e=NULL;
1750  }
1751  }
1752  else if (rtyp==COMMAND)
1753  {
1754  command d=(command)data;
1755  if(d->op==PROC_CMD) //assume d->argc==2
1756  {
1757  char *what=(char *)(d->arg1.Data());
1758  idhdl h=ggetid(what);
1759  if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
1760  {
1761  nok=d->arg2.Eval();
1762  if(!nok)
1763  {
1764  nok=iiMake_proc(h,req_packhdl,&d->arg2);
1765  this->CleanUp(currRing);
1766  if (!nok)
1767  {
1768  memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
1769  memset(&iiRETURNEXPR,0,sizeof(sleftv));
1770  }
1771  }
1772  }
1773  else nok=TRUE;
1774  }
1775  else if (d->op=='=') //assume d->argc==2
1776  {
1777  if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
1778  {
1779  nok=d->arg1.Eval();
1780  }
1781  if (!nok)
1782  {
1783  const char *n=d->arg1.name;
1784  nok=(n == NULL) || d->arg2.Eval();
1785  if (!nok)
1786  {
1787  int save_typ=d->arg1.rtyp;
1788  omCheckAddr((ADDRESS)n);
1789  if (d->arg1.rtyp!=IDHDL)
1790  syMake(&d->arg1,n);
1791  omCheckAddr((ADDRESS)d->arg1.name);
1792  if (d->arg1.rtyp==IDHDL)
1793  {
1794  n=omStrDup(IDID((idhdl)d->arg1.data));
1795  killhdl((idhdl)d->arg1.data);
1796  d->arg1.Init();
1797  //d->arg1.data=NULL;
1798  d->arg1.name=n;
1799  }
1800  d->arg1.rtyp=DEF_CMD;
1801  sleftv t;
1802  if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
1803  if (::RingDependend(d->arg2.rtyp))
1804  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
1805  else
1806  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
1807  memcpy(&d->arg1,&t,sizeof(sleftv));
1808  omCheckAddr((ADDRESS)d->arg1.name);
1809  nok=nok||iiAssign(&d->arg1,&d->arg2);
1810  omCheckIf(d->arg1.name != NULL, // OB: ????
1811  omCheckAddr((ADDRESS)d->arg1.name));
1812  if (!nok)
1813  {
1814  memset(&d->arg1,0,sizeof(sleftv));
1815  this->CleanUp();
1816  rtyp=NONE;
1817  }
1818  }
1819  }
1820  else nok=TRUE;
1821  }
1822  else
1823  {
1824  sleftv tmp; tmp.Init();
1825  int toktype=iiTokType(d->op);
1826  if ((toktype==CMD_M)
1827  ||( toktype==ROOT_DECL_LIST)
1828  ||( toktype==RING_DECL_LIST))
1829  {
1830  if (d->argc <=3)
1831  {
1832  if (d->argc>=1) nok=d->arg1.Eval();
1833  if ((!nok) && (d->argc>=2))
1834  {
1835  nok=d->arg2.Eval();
1836  d->arg1.next=(leftv)omAllocBin(sleftv_bin);
1837  memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
1838  d->arg2.Init();
1839  }
1840  if ((!nok) && (d->argc==3))
1841  {
1842  nok=d->arg3.Eval();
1843  d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
1844  memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
1845  d->arg3.Init();
1846  }
1847  if (d->argc==0)
1848  nok=nok||iiExprArithM(&tmp,NULL,d->op);
1849  else
1850  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1851  }
1852  else
1853  {
1854  nok=d->arg1.Eval();
1855  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1856  }
1857  }
1858  else if (d->argc==1)
1859  {
1860  nok=d->arg1.Eval();
1861  nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
1862  }
1863  else if(d->argc==2)
1864  {
1865  nok=d->arg1.Eval();
1866  nok=nok||d->arg2.Eval();
1867  nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
1868  }
1869  else if(d->argc==3)
1870  {
1871  nok=d->arg1.Eval();
1872  nok=nok||d->arg2.Eval();
1873  nok=nok||d->arg3.Eval();
1874  nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
1875  }
1876  else if(d->argc!=0)
1877  {
1878  nok=d->arg1.Eval();
1879  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1880  }
1881  else // d->argc == 0
1882  {
1883  nok = iiExprArithM(&tmp, NULL, d->op);
1884  }
1885  this->CleanUp();
1886  memcpy(this,&tmp,sizeof(tmp));
1887  }
1888  }
1889  else if (((rtyp==0)||(rtyp==DEF_CMD))
1890  &&(name!=NULL))
1891  {
1892  syMake(this,name);
1893  }
1894 #ifdef MDEBUG
1895  switch(Typ())
1896  {
1897  case NUMBER_CMD:
1898 #ifdef LDEBUG
1899  nTest((number)Data());
1900 #endif
1901  break;
1902  case BIGINT_CMD:
1903 #ifdef LDEBUG
1904  n_Test((number)Data(),coeffs_BIGINT);
1905 #endif
1906  break;
1907  case POLY_CMD:
1908  pTest((poly)Data());
1909  break;
1910  case IDEAL_CMD:
1911  case MODUL_CMD:
1912  case MATRIX_CMD:
1913  {
1914  ideal id=(ideal)Data();
1915  omCheckAddrSize(id,sizeof(*id));
1916  int i=id->ncols*id->nrows-1;
1917  for(;i>=0;i--) pTest(id->m[i]);
1918  }
1919  break;
1920  }
1921 #endif
1922  if (nn!=NULL) nok=nok||nn->Eval();
1923  next=nn;
1924  return nok;
1925 }
1926 
1927 const char *iiSleftv2name(leftv v)
1928 {
1929  return(v->name);
1930 }
1931 
1933 {
1934  omCheckAddrSize(this,sizeof(sattr));
1935  return s_internalCopy(atyp,data);
1936 }
1937 
void n2Print(number2 d)
Definition: number2.cc:311
#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
BOOLEAN yyInRingConstruction
Definition: grammar.cc:173
#define IDLIST(a)
Definition: ipid.h:136
ip_package * package
Definition: structs.h:46
Definition: tok.h:164
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:796
void * slInternalCopy(leftv source, const int t, void *d, Subexpr e)
Definition: subexpr.cc:628
const CanonicalForm int s
Definition: facAbsFact.cc:55
char * pString(poly p)
Definition: polys.h:277
#define TEST_VERB_NSB
Definition: options.h:129
void jjNormalizeQRingP(poly &p)
Definition: ipassign.cc:2162
Definition: tok.h:160
sleftv * m
Definition: lists.h:45
#define nWrite(n)
Definition: numbers.h:29
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
Class used for (list of) interpreter objects.
Definition: subexpr.h:83
int Eval()
Definition: subexpr.cc:1735
#define pSetm(p)
Definition: polys.h:241
ip_command * command
Definition: ipid.h:24
const poly a
Definition: syzextra.cc:212
void syMake(leftv v, const char *id, idhdl packhdl)
Definition: subexpr.cc:1474
omBin_t * omBin
Definition: omStructs.h:12
void PrintLn()
Definition: reporter.cc:327
#define ANY_TYPE
Definition: tok.h:34
#define Print
Definition: emacs.cc:83
Definition: tok.h:85
Definition: tok.h:161
void killAll(const ring r)
Definition: attrib.cc:196
idhdl currPackHdl
Definition: ipid.cc:61
Definition: attrib.h:15
Subexpr e
Definition: subexpr.h:106
BITSET flag
Definition: subexpr.h:91
Definition: lists.h:22
#define nNormalize(n)
Definition: numbers.h:30
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition: iparith.cc:8330
#define IDID(a)
Definition: ipid.h:121
#define pSetExp(p, i, v)
Definition: polys.h:42
int getRTimer()
Definition: timer.cc:172
#define FALSE
Definition: auxiliary.h:140
Compatiblity layer for legacy polynomial operations (over currRing)
coeffs cf
Definition: number2.h:13
const int MAX_INT_LEN
Definition: mylimits.h:13
attr * Attribute()
Definition: subexpr.cc:1366
Definition: tok.h:42
return P p
Definition: myNF.cc:203
Matrices of numbers.
Definition: bigintmat.h:51
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition: iparith.cc:8542
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3046
char * rString(ring r)
Definition: ring.cc:644
omBin sleftv_bin
Definition: subexpr.cc:50
#define pTest(p)
Definition: polys.h:387
void n2Delete(number2 &d)
Definition: number2.cc:285
Definition: tok.h:170
sleftv iiRETURNEXPR
Definition: iplib.cc:527
#define omCheckIf(cond, test)
Definition: omAllocDecl.h:323
language_defs language
Definition: subexpr.h:58
#define IDROOT
Definition: ipid.h:20
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define BB_LIKE_LIST(B)
Definition: blackbox.h:54
intvec * ivCopy(const intvec *o)
Definition: intvec.h:141
BOOLEAN siq
Definition: subexpr.cc:58
const char sNoName[]
Definition: subexpr.cc:56
int listLength()
Definition: subexpr.cc:61
#define TRUE
Definition: auxiliary.h:144
int length() const
Definition: intvec.h:86
void Init()
Definition: subexpr.h:108
#define UNKNOWN
Definition: tok.h:174
void * ADDRESS
Definition: auxiliary.h:161
void * CopyD()
Definition: subexpr.h:120
sleftv * leftv
Definition: structs.h:60
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition: iparith.cc:8630
void syPrint(syStrategy syzstr, const char *currRingName)
Definition: syz1.cc:1945
procinfov piCopy(procinfov pi)
Definition: subexpr.h:149
static BOOLEAN rField_is_GF(const ring r)
Definition: ring.h:470
char * StringEndS()
Definition: reporter.cc:151
char * lString(lists l, BOOLEAN typed, int dim)
Definition: lists.cc:377
static number & pGetCoeff(poly p)
return an alias to the leading coefficient of p assumes that p != NULL NOTE: not copy ...
Definition: monomials.h:51
int traceit
Definition: febase.cc:47
coeffs coeffs_BIGINT
Definition: ipid.cc:54
int Typ()
Definition: subexpr.cc:969
#define omAlloc(size)
Definition: omAllocDecl.h:210
BOOLEAN piKill(procinfov pi)
Definition: ipid.cc:647
void pWrite0(poly p)
Definition: polys.h:280
const char * Name()
Definition: subexpr.h:121
void Print(leftv store=NULL, int spaces=0)
Called by type_cmd (e.g. "r;") or as default in jPRINT.
Definition: subexpr.cc:73
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:35
static poly p_Copy(poly p, const ring r)
returns a copy of p
Definition: p_polys.h:811
void iiWriteMatrix(matrix im, const char *n, int dim, const ring r, int spaces)
set spaces to zero by default
Definition: matpol.cc:739
int Kstd1_mu
Definition: kutil.cc:229
char * String(int dim=2) const
Definition: intvec.cc:146
omBin procinfo_bin
Definition: subexpr.cc:51
char * String(void *d=NULL, BOOLEAN typed=FALSE, int dim=1)
Called for conversion to string (used by string(..), write(..),..)
Definition: subexpr.cc:720
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:792
void * data
Definition: subexpr.h:89
#define IDPACKAGE(a)
Definition: ipid.h:138
int myynest
Definition: febase.cc:46
ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:12
#define IDTYP(a)
Definition: ipid.h:118
void * CopyA()
Definition: subexpr.cc:1932
Definition: tok.h:165
void nfShowMipo(const coeffs r)
Show the mininimal polynom.... NOTE: this is used by char * sleftv::String(void *d, BOOLEAN typed, int dim) (from Singular/subexpr.cc) for printing minpoly.
Definition: ffields.cc:582
BOOLEAN iiMake_proc(idhdl pn, package pack, sleftv *sl)
Definition: iplib.cc:573
Definition: tok.h:56
char my_yylinebuf[80]
Definition: febase.cc:48
int r_IsRingVar(const char *n, char **names, int N)
Definition: ring.cc:222
const ring r
Definition: syzextra.cc:208
BOOLEAN RingDependend()
Definition: subexpr.cc:389
static FORCE_INLINE BOOLEAN nCoeff_is_algExt(const coeffs r)
TRUE iff r represents an algebraic extension field.
Definition: coeffs.h:911
int LTyp()
Definition: subexpr.cc:1075
#define nTest(a)
Definition: numbers.h:35
Definition: intvec.h:16
const char * iiTwoOps(int t)
Definition: gentable.cc:252
void rKill(ring r)
Definition: ipshell.cc:5999
const char * piProcinfo(procinfov pi, const char *request)
Definition: ipid.cc:623
int j
Definition: myNF.cc:70
bigintmat * bimCopy(const bigintmat *b)
same as copy constructor - apart from it being able to accept NULL as input
Definition: bigintmat.cc:405
Definition: tok.h:58
const char * name
Definition: subexpr.h:88
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
#define omFree(addr)
Definition: omAllocDecl.h:261
#define assume(x)
Definition: mod2.h:405
The main handler for Singular numbers which are suitable for Singular polynomials.
number n
Definition: number2.h:14
void StringSetS(const char *st)
Definition: reporter.cc:128
void StringAppendS(const char *st)
Definition: reporter.cc:107
int nrows
Definition: cf_linsys.cc:32
attr CopyA()
Definition: subexpr.cc:712
#define A
Definition: sirandom.c:23
const ring R
Definition: DebugPrint.cc:36
procinfodata data
Definition: subexpr.h:62
omBin sSubexpr_bin
Definition: subexpr.cc:49
static FORCE_INLINE void n_Write(number &n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition: coeffs.h:592
#define n_Test(a, r)
BOOLEAN n_Test(number a, const coeffs r)
Definition: coeffs.h:923
void s_internalDelete(const int t, void *d, const ring r)
Definition: subexpr.cc:478
idhdl currRingHdl
Definition: ipid.cc:65
void Copy(leftv e)
Definition: subexpr.cc:657
#define setFlag(A, F)
Definition: ipid.h:112
int m
Definition: cfEzgcd.cc:119
#define pIsConstant(p)
like above, except that Comp might be != 0
Definition: polys.h:209
package paCopy(package pack)
Definition: ipid.h:45
int dim(ideal I, ring r)
idrec * idhdl
Definition: ring.h:18
#define FLAG_QRING
Definition: ipid.h:110
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1448
int i
Definition: cfEzgcd.cc:123
void PrintS(const char *s)
Definition: reporter.cc:294
#define TEST_V_QRING
Definition: options.h:125
#define pOne()
Definition: polys.h:286
Definition: tok.h:163
Definition: tok.h:88
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
static int iiCmatrix_index
Definition: subexpr.cc:1109
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:837
int lSize(lists L)
Definition: lists.cc:25
lists lCopy(lists L)
Definition: lists.cc:32
#define IDLEV(a)
Definition: ipid.h:120
#define nDelete(n)
Definition: numbers.h:16
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:401
int cols() const
Definition: bigintmat.h:147
#define FLAG_STD
Definition: ipid.h:108
ideal idCopy(ideal A)
Definition: ideals.h:73
short errorreported
Definition: feFopen.cc:23
leftv next
Definition: subexpr.h:87
static int index(p_Length length, p_Ord ord)
Definition: p_Procs_Impl.h:597
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:136
#define IDNUMBER(a)
Definition: ipid.h:131
number2 n2Copy(const number2 d)
Definition: number2.cc:270
Definition: tok.h:38
int iiDeclCommand(leftv sy, leftv name, int lev, int t, idhdl *root, BOOLEAN isring, BOOLEAN init_b)
Definition: ipshell.cc:1119
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:850
#define omGetSpecBin(size)
Definition: omBin.h:11
void paPrint(const char *n, package p)
Definition: ipshell.cc:6203
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1468
Definition: tok.h:166
#define pi
Definition: libparse.cc:1143
const Variable & v
< [in] a sqrfree bivariate poly
Definition: facBivar.h:37
void jjNormalizeQRingId(leftv I)
Definition: ipassign.cc:2127
int nr
Definition: lists.h:43
int rows() const
Definition: bigintmat.h:148
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define MATCOLS(i)
Definition: matpol.h:28
Definition: tok.h:95
#define NULL
Definition: omList.c:10
int cols() const
Definition: intvec.h:87
slists * lists
Definition: mpr_numeric.h:146
package req_packhdl
Definition: subexpr.h:107
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of &#39;n&#39;
Definition: coeffs.h:452
omBin sip_command_bin
Definition: ipid.cc:49
static snumber2 iiNumber2Data[4]
Definition: subexpr.cc:1108
syStrategy syCopy(syStrategy syzstr)
Definition: syz1.cc:1895
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:128
#define IDPOLY(a)
Definition: ipid.h:129
int rows() const
Definition: intvec.h:88
void killhdl(idhdl h, package proot)
Definition: ipid.cc:372
package basePack
Definition: ipid.cc:64
char * String()
IO: String returns a singular string containing the matrix, needs freeing afterwards.
Definition: bigintmat.cc:433
coeffs basecoeffs() const
Definition: bigintmat.h:149
#define hasFlag(A, F)
Definition: ipid.h:111
int int ncols
Definition: cf_linsys.cc:32
package currPack
Definition: ipid.cc:63
Variable x
Definition: cfModGcd.cc:4023
int rtyp
Definition: subexpr.h:92
#define nCopy(n)
Definition: numbers.h:15
sleftv sLastPrinted
Definition: subexpr.cc:55
#define IDFLAG(a)
Definition: ipid.h:119
void CleanUp(ring r=currRing)
Definition: subexpr.cc:321
void Clean(ring r=currRing)
Definition: lists.h:25
#define pmInit(a, b)
Definition: polys.h:260
#define IDATTR(a)
Definition: ipid.h:122
void * Data()
Definition: subexpr.cc:1111
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced ...
Definition: polys.h:70
Definition: tok.h:96
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:75
attr attribute
Definition: subexpr.h:90
int printlevel
Definition: febase.cc:42
map maCopy(map theMap, const ring r)
Definition: maps.cc:38
Definition: tok.h:126
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete &#39;p&#39;
Definition: coeffs.h:456
#define MATROWS(i)
Definition: matpol.h:27
int iiTokType(int op)
Definition: iparith.cc:255
polyrec * poly
Definition: hilb.h:10
#define IDDATA(a)
Definition: ipid.h:125
int Kstd1_deg
Definition: kutil.cc:228
int colmax
Definition: febase.cc:43
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
Definition: tok.h:162
int getTimer()
Definition: timer.cc:97
#define nInit(i)
Definition: numbers.h:24
static Poly * h
Definition: janet.cc:978
int BOOLEAN
Definition: auxiliary.h:131
#define IMATELEM(M, I, J)
Definition: intvec.h:77
char * iiStringMatrix(matrix im, int dim, const ring r, char ch)
Definition: matpol.cc:760
const poly b
Definition: syzextra.cc:213
BOOLEAN iiExprArith2(leftv res, leftv a, int op, leftv b, BOOLEAN proccall)
Definition: iparith.cc:8143
#define NONE
Definition: tok.h:173
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:488
leftv LData()
Definition: subexpr.cc:1380
const char * iiSleftv2name(leftv v)
Definition: subexpr.cc:1927
void Werror(const char *fmt,...)
Definition: reporter.cc:199
#define TEST_V_ALLWARN
Definition: options.h:135
void syKillComputation(syStrategy syzstr, ring r=currRing)
Definition: syz1.cc:1497
void PrintNSpaces(const int n)
Definition: reporter.cc:381
idhdl ggetid(const char *n, BOOLEAN, idhdl *packhdl)
Definition: ipid.cc:490
#define omAlloc0(size)
Definition: omAllocDecl.h:211
int l
Definition: cfEzgcd.cc:94
procinfo * procinfov
Definition: structs.h:63
static omBin size_two_bin
Definition: subexpr.cc:53
char * n2String(number2 d, BOOLEAN typed)
Definition: number2.cc:298
int si_echo
Definition: febase.cc:41
#define pCopy(p)
return a copy of the poly
Definition: polys.h:156
#define MATELEM(mat, i, j)
Definition: matpol.h:29
#define COMMAND
Definition: tok.h:33
void crPrint(coeffs c)
Definition: number2.cc:25
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:20
ssyStrategy * syStrategy
Definition: syz.h:35
utypes data
Definition: idrec.h:40
omBin libstack_bin
Definition: subexpr.cc:52
BOOLEAN iiAssign(leftv l, leftv r, BOOLEAN toplevel)
Definition: ipassign.cc:1782
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263