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