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  case CRING_CMD:
790  return nCoeffString((coeffs)d);
791  case CMATRIX_CMD:
792  {
793  bigintmat *b=(bigintmat*)d;
794  return b->String();
795  }
796  #endif
797 
798  case NUMBER_CMD:
799  StringSetS((char*) (typed ? "number(" : ""));
800  if ((rtyp==IDHDL)&&(IDTYP((idhdl)data)==NUMBER_CMD))
801  {
802  nWrite(IDNUMBER((idhdl)data));
803  }
804  else if (rtyp==NUMBER_CMD)
805  {
806  number n=(number)data;
807  nWrite(n);
808  data=(char *)n;
809  }
810  else if((rtyp==VMINPOLY)&&(rField_is_GF(currRing)))
811  {
812  nfShowMipo(currRing->cf);
813  }
814  else
815  {
816  number n=nCopy((number)d);
817  nWrite(n);
818  nDelete(&n);
819  }
820  StringAppendS((char*) (typed ? ")" : ""));
821  return StringEndS();
822 
823  case BIGINT_CMD:
824  {
825  StringSetS((char*) (typed ? "bigint(" : ""));
826  number nl=(number)d;
828  StringAppendS((char*) (typed ? ")" : ""));
829  return StringEndS();
830  }
831 
832  case MATRIX_CMD:
833  s= iiStringMatrix((matrix)d,dim, currRing);
834  if (typed)
835  {
836  char* ns = (char*) omAlloc(strlen(s) + 40);
837  sprintf(ns, "matrix(ideal(%s),%d,%d)", s,
838  ((ideal) d)->nrows, ((ideal) d)->ncols);
839  omCheckAddr(ns);
840  return ns;
841  }
842  else
843  {
844  return omStrDup(s);
845  }
846 
847  case MODUL_CMD:
848  case IDEAL_CMD:
849  case MAP_CMD:
850  s= iiStringMatrix((matrix)d,dim, currRing);
851  if (typed)
852  {
853  char* ns = (char*) omAlloc(strlen(s) + 10);
854  sprintf(ns, "%s(%s)", (t/*Typ()*/==MODUL_CMD ? "module" : "ideal"), s);
855  omCheckAddr(ns);
856  return ns;
857  }
858  return omStrDup(s);
859 
860  case INTVEC_CMD:
861  case INTMAT_CMD:
862  {
863  intvec *v=(intvec *)d;
864  s = v->String(dim);
865  if (typed)
866  {
867  char* ns;
868  if (t/*Typ()*/ == INTMAT_CMD)
869  {
870  ns = (char*) omAlloc(strlen(s) + 40);
871  sprintf(ns, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
872  }
873  else
874  {
875  ns = (char*) omAlloc(strlen(s) + 10);
876  sprintf(ns, "intvec(%s)", s);
877  }
878  omCheckAddr(ns);
879  omFree(s);
880  return ns;
881  }
882  else
883  return s;
884  }
885  case BIGINTMAT_CMD:
886  {
887  bigintmat *bim=(bigintmat*)d;
888  s = bim->String();
889  if (typed)
890  {
891  char* ns = (char*) omAlloc0(strlen(s) + 40);
892  sprintf(ns, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
893  omCheckAddr(ns);
894  return ns;
895  }
896  else
897  return omStrDup(s);
898  }
899 
900  case RING_CMD:
901  case QRING_CMD:
902  s = rString((ring)d);
903 
904  if (typed)
905  {
906  char* ns;
907  if (t/*Typ()*/ == QRING_CMD)
908  {
909  char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
910  currRing);
911  ns = (char*) omAlloc(strlen(s) + strlen(id) + 20);
912  sprintf(ns, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
913  }
914  else
915  {
916  ns = (char*) omAlloc(strlen(s) + 4);
917  sprintf(ns, "\"%s\"", s);
918  }
919  omFree(s);
920  omCheckAddr(ns);
921  return ns;
922  }
923  return s;
924  case RESOLUTION_CMD:
925  {
926  lists l = syConvRes((syStrategy)d);
927  s = lString(l, typed, dim);
928  l->Clean();
929  return s;
930  }
931 
932  case PROC_CMD:
933  {
934  procinfo* pi = (procinfo*) d;
935  if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
936  s = (pi->data.s.body);
937  else
938  s = (char *)"";
939  if (typed)
940  {
941  char* ns = (char*) omAlloc(strlen(s) + 4);
942  sprintf(ns, "\"%s\"", s);
943  omCheckAddr(ns);
944  return ns;
945  }
946  return omStrDup(s);
947  }
948 
949  case LINK_CMD:
950  s = slString((si_link) d);
951  if (typed)
952  {
953  char* ns = (char*) omAlloc(strlen(s) + 10);
954  sprintf(ns, "link(\"%s\")", s);
955  omFreeBinAddr(s);
956  omCheckAddr(ns);
957  return ns;
958  }
959  return s;
960 
961  case LIST_CMD:
962  return lString((lists) d, typed, dim);
963 
964  default:
965  if(t> MAX_TOK)
966  {
967  blackbox *bb=getBlackboxStuff(t);
968  if (bb!=NULL) return bb->blackbox_String(bb,d);
969  }
970  } /* end switch: (Typ()) */
971  }
972  return omStrDup("");
973 }
974 
975 
977 {
978  if (e==NULL)
979  {
980  switch (rtyp)
981  {
982  case IDHDL:
983  return IDTYP((idhdl)data);
984  case ALIAS_CMD:
985  {
986  idhdl h=(idhdl)data;
987  return ((idhdl)h->data.ustring)->typ;
988  }
989  case VECHO:
990  case VPRINTLEVEL:
991  case VCOLMAX:
992  case VTIMER:
993  case VRTIMER:
994  case VOICE:
995  case VMAXDEG:
996  case VMAXMULT:
997  case TRACE:
998  case VSHORTOUT:
999  return INT_CMD;
1000  case VMINPOLY:
1001  data=NULL;
1002  return NUMBER_CMD;
1003  case VNOETHER:
1004  data=NULL;
1005  return POLY_CMD;
1006  //case COMMAND:
1007  // return COMMAND;
1008  default:
1009  return rtyp;
1010  }
1011  }
1012  int r=0;
1013  int t=rtyp;
1014  void *d=data;
1015  if (t==IDHDL) t=IDTYP((idhdl)d);
1016  else if (t==ALIAS_CMD)
1017  { idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
1018  switch (t)
1019  {
1020 #ifdef SINGULAR_4_1
1021  case CMATRIX_CMD:
1022  {
1023  bigintmat *b=(bigintmat*)d;
1024  if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
1025  return NUMBER_CMD;
1026  else
1027  return CNUMBER_CMD;
1028  }
1029 #endif
1030  case INTVEC_CMD:
1031  case INTMAT_CMD:
1032  r=INT_CMD;
1033  break;
1034  case BIGINTMAT_CMD:
1035  r=BIGINT_CMD;
1036  break;
1037  case IDEAL_CMD:
1038  case MATRIX_CMD:
1039  case MAP_CMD:
1040  r=POLY_CMD;
1041  break;
1042  case MODUL_CMD:
1043  r=VECTOR_CMD;
1044  break;
1045  case STRING_CMD:
1046  r=STRING_CMD;
1047  break;
1048  default:
1049  {
1050  blackbox *b=NULL;
1051  if (t>MAX_TOK)
1052  {
1053  b=getBlackboxStuff(t);
1054  }
1055  if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
1056  {
1057  lists l;
1058  if (rtyp==IDHDL) l=IDLIST((idhdl)d);
1059  else l=(lists)d;
1060  if ((0<e->start)&&(e->start<=l->nr+1))
1061  {
1062  Subexpr tmp=l->m[e->start-1].e;
1063  l->m[e->start-1].e=e->next;
1064  r=l->m[e->start-1].Typ();
1065  e->next=l->m[e->start-1].e;
1066  l->m[e->start-1].e=tmp;
1067  }
1068  else
1069  {
1070  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1071  r=DEF_CMD;
1072  }
1073  }
1074  else
1075  Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
1076  break;
1077  }
1078  }
1079  return r;
1080 }
1081 
1083 {
1084  lists l=NULL;
1085  int r;
1086  if (rtyp==LIST_CMD)
1087  l=(lists)data;
1088  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1089  l=IDLIST((idhdl)data);
1090  else
1091  return Typ();
1092  //if (l!=NULL)
1093  {
1094  if ((e!=NULL) && (e->next!=NULL))
1095  {
1096  if ((0<e->start)&&(e->start<=l->nr+1))
1097  {
1098  l->m[e->start-1].e=e->next;
1099  r=l->m[e->start-1].LTyp();
1100  l->m[e->start-1].e=NULL;
1101  }
1102  else
1103  {
1104  //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1105  r=NONE;
1106  }
1107  return r;
1108  }
1109  return LIST_CMD;
1110  }
1111  return Typ();
1112 }
1113 
1114 #ifdef SINGULAR_4_1
1116 static int iiCmatrix_index=0;
1117 #endif
1119 {
1120  if ((rtyp!=IDHDL) && iiCheckRing(rtyp))
1121  return NULL;
1122  if (e==NULL)
1123  {
1124  switch (rtyp)
1125  {
1126  case ALIAS_CMD:
1127  {
1128  idhdl h=(idhdl)data;
1129  return ((idhdl)h->data.ustring)->data.ustring;
1130  }
1131  case VECHO: return (void *)(long)si_echo;
1132  case VPRINTLEVEL:return (void *)(long)printlevel;
1133  case VCOLMAX: return (void *)(long)colmax;
1134  case VTIMER: return (void *)(long)getTimer();
1135  case VRTIMER: return (void *)(long)getRTimer();
1136  case VOICE: return (void *)(long)(myynest+1);
1137  case VMAXDEG: return (void *)(long)Kstd1_deg;
1138  case VMAXMULT: return (void *)(long)Kstd1_mu;
1139  case TRACE: return (void *)(long)traceit;
1140  case VSHORTOUT: return (void *)(long)(currRing != NULL ? currRing->ShortOut : 0);
1141  case VMINPOLY:
1142  if ( (currRing != NULL) && nCoeff_is_algExt(currRing->cf) && !nCoeff_is_GF(currRing->cf))
1143  {
1144  /* Q(a), Fp(a), but not GF(q) */
1145  const ring A = currRing->cf->extRing;
1146 
1147  assume( A != NULL );
1148  assume( A->qideal != NULL );
1149 
1150  return (void *)A->qideal->m[0];
1151  }
1152  else
1153  return (void *)currRing->cf->nNULL;
1154 
1155  case VNOETHER: return (void *) (currRing->ppNoether);
1156  case IDHDL:
1157  return IDDATA((idhdl)data);
1158  case COMMAND:
1159  //return NULL;
1160  default:
1161  return data;
1162  }
1163  }
1164  /* e != NULL : */
1165  int t=rtyp;
1166  void *d=data;
1167  if (t==IDHDL)
1168  {
1169  t=((idhdl)data)->typ;
1170  d=IDDATA((idhdl)data);
1171  }
1172  else if (t==ALIAS_CMD)
1173  {
1175  t=IDTYP(h);
1176  d=IDDATA(h);
1177  }
1178  if (iiCheckRing(t))
1179  return NULL;
1180  char *r=NULL;
1181  int index=e->start;
1182  switch (t)
1183  {
1184  case INTVEC_CMD:
1185  {
1186  intvec *iv=(intvec *)d;
1187  if ((index<1)||(index>iv->length()))
1188  {
1189  if (!errorreported)
1190  Werror("wrong range[%d] in intvec %s(%d)",index,this->Name(),iv->length());
1191  }
1192  else
1193  r=(char *)(long)((*iv)[index-1]);
1194  break;
1195  }
1196  case INTMAT_CMD:
1197  {
1198  intvec *iv=(intvec *)d;
1199  if ((index<1)
1200  ||(index>iv->rows())
1201  ||(e->next->start<1)
1202  ||(e->next->start>iv->cols()))
1203  {
1204  if (!errorreported)
1205  Werror("wrong range[%d,%d] in intmat %s(%dx%d)",index,e->next->start,
1206  this->Name(),iv->rows(),iv->cols());
1207  }
1208  else
1209  r=(char *)(long)(IMATELEM((*iv),index,e->next->start));
1210  break;
1211  }
1212  case BIGINTMAT_CMD:
1213  {
1214  bigintmat *m=(bigintmat *)d;
1215  if ((index<1)
1216  ||(index>m->rows())
1217  ||(e->next->start<1)
1218  ||(e->next->start>m->cols()))
1219  {
1220  if (!errorreported)
1221  Werror("wrong range[%d,%d] in bigintmat %s(%dx%d)",index,e->next->start,
1222  this->Name(),m->rows(),m->cols());
1223  }
1224  else
1225  r=(char *)(BIMATELEM((*m),index,e->next->start));
1226  break;
1227  }
1228 #ifdef SINGULAR_4_1
1229  case CMATRIX_CMD:
1230  {
1231  bigintmat *m=(bigintmat *)d;
1232  if ((index<1)
1233  ||(index>m->rows())
1234  ||(e->next->start<1)
1235  ||(e->next->start>m->cols()))
1236  {
1237  if (!errorreported)
1238  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",index,e->next->start,
1239  this->Name(),m->rows(),m->cols());
1240  }
1241  else
1242  {
1243  iiNumber2Data[iiCmatrix_index].cf=m->basecoeffs();
1244  iiNumber2Data[iiCmatrix_index].n=BIMATELEM((*m),index,e->next->start);
1245  r=(char*)&iiNumber2Data[iiCmatrix_index];
1246  iiCmatrix_index=(iiCmatrix_index+1) % 4;
1247  }
1248  break;
1249  }
1250 #endif
1251  case IDEAL_CMD:
1252  case MODUL_CMD:
1253  case MAP_CMD:
1254  {
1255  ideal I=(ideal)d;
1256  if ((index<1)||(index>IDELEMS(I)))
1257  {
1258  if (!errorreported)
1259  Werror("wrong range[%d] in ideal/module %s(%d)",index,this->Name(),IDELEMS(I));
1260  }
1261  else
1262  r=(char *)I->m[index-1];
1263  break;
1264  }
1265  case STRING_CMD:
1266  {
1267  // this was a memory leak
1268  // we evalute it, cleanup and replace this leftv by it's evalutated form
1269  // the evalutated form will be build in tmp
1270  sleftv tmp;
1271  tmp.Init();
1272  tmp.rtyp=STRING_CMD;
1273  r=(char *)omAllocBin(size_two_bin);
1274  if ((index>0)&& (index<=(int)strlen((char *)d)))
1275  {
1276  r[0]=*(((char *)d)+index-1);
1277  r[1]='\0';
1278  }
1279  else
1280  {
1281  r[0]='\0';
1282  }
1283  tmp.data=r;
1284  if ((rtyp==IDHDL)||(rtyp==STRING_CMD))
1285  {
1286  tmp.next=next; next=NULL;
1287  //if (rtyp==STRING_CMD) { omFree((ADDRESS)data); }
1288  //data=NULL;
1289  d=NULL;
1290  CleanUp();
1291  memcpy(this,&tmp,sizeof(tmp));
1292  }
1293  // and, remember, r is also the result...
1294  else
1295  {
1296  // ???
1297  // here we still have a memory leak...
1298  // example: list L="123","456";
1299  // L[1][2];
1300  // therefore, it should never happen:
1301  assume(0);
1302  // but if it happens: here is the temporary fix:
1303  // omMarkAsStaticAddr(r);
1304  }
1305  break;
1306  }
1307  case MATRIX_CMD:
1308  {
1309  if ((index<1)
1310  ||(index>MATROWS((matrix)d))
1311  ||(e->next->start<1)
1312  ||(e->next->start>MATCOLS((matrix)d)))
1313  {
1314  if (!errorreported)
1315  Werror("wrong range[%d,%d] in matrix %s(%dx%d)",
1316  index,e->next->start,
1317  this->Name(),
1318  MATROWS((matrix)d),MATCOLS((matrix)d));
1319  }
1320  else
1321  r=(char *)MATELEM((matrix)d,index,e->next->start);
1322  break;
1323  }
1324  default:
1325  {
1326  blackbox *b=NULL;
1327  if (t>MAX_TOK)
1328  {
1329  b=getBlackboxStuff(t);
1330  }
1331  if ((t==LIST_CMD)||((b!=NULL)&&(BB_LIKE_LIST(b))))
1332  {
1333  lists l=(lists)d;
1334  if ((0<index)&&(index<=l->nr+1))
1335  {
1336  if ((e->next!=NULL)
1337  && (l->m[index-1].rtyp==STRING_CMD))
1338  // string[..].Data() modifies sleftv, so let's do it ourself
1339  {
1340  char *dd=(char *)l->m[index-1].data;
1341  int j=e->next->start-1;
1342  r=(char *)omAllocBin(size_two_bin);
1343  if ((j>=0) && (j<(int)strlen(dd)))
1344  {
1345  r[0]=*(dd+j);
1346  r[1]='\0';
1347  }
1348  else
1349  {
1350  r[0]='\0';
1351  }
1352  }
1353  else
1354  {
1355  Subexpr tmp=l->m[index-1].e;
1356  l->m[index-1].e=e->next;
1357  r=(char *)l->m[index-1].Data();
1358  e->next=l->m[index-1].e;
1359  l->m[index-1].e=tmp;
1360  }
1361  }
1362  else //if (!errorreported)
1363  Werror("wrong range[%d] in list %s(%d)",index,this->Name(),l->nr+1);
1364  }
1365  else
1366  Werror("cannot index %s of type %s(%d)",this->Name(),Tok2Cmdname(t),t);
1367  break;
1368  }
1369  }
1370  return r;
1371 }
1372 
1374 {
1375  if (e==NULL) return &attribute;
1376  if ((rtyp==LIST_CMD)
1377  ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1378  || (rtyp>MAX_TOK)
1379  || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1380  {
1381  leftv v=LData();
1382  return &(v->attribute);
1383  }
1384  return NULL;
1385 }
1386 
1388 {
1389  if (e!=NULL)
1390  {
1391  lists l=NULL;
1392  blackbox *b=getBlackboxStuff(rtyp);
1393 
1394  if ((rtyp==LIST_CMD)
1395  || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1396  l=(lists)data;
1397  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1398  l=IDLIST((idhdl)data);
1399  else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1400  {
1401  b=getBlackboxStuff(IDTYP((idhdl)data));
1402  if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1403  }
1404  else if (rtyp==ALIAS_CMD)
1405  {
1406  idhdl h=(idhdl)data;
1407  l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1408  }
1409  if (l!=NULL)
1410  {
1411  if ((0>=e->start)||(e->start>l->nr+1))
1412  return NULL;
1413  if (e->next!=NULL)
1414  {
1415  l->m[e->start-1].e=e->next;
1416  leftv r=l->m[e->start-1].LData();
1417  l->m[e->start-1].e=NULL;
1418  return r;
1419  }
1420  return &(l->m[e->start-1]);
1421  }
1422  }
1423  return this;
1424 }
1425 
1426 #if 0
1427 leftv sleftv::LHdl()
1428 {
1429  if (e!=NULL)
1430  {
1431  lists l=NULL;
1432 
1433  if (rtyp==LIST_CMD)
1434  l=(lists)data;
1435  if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1436  l=IDLIST((idhdl)data);
1437  if (l!=NULL)
1438  {
1439  if ((0>=e->start)||(e->start>l->nr+1))
1440  return NULL;
1441  if (e->next!=NULL)
1442  {
1443  l->m[e->start-1].e=e->next;
1444  leftv r=l->m[e->start-1].LHdl();
1445  l->m[e->start-1].e=NULL;
1446  return r;
1447  }
1448  return &(l->m[e->start-1]);
1449  }
1450  }
1451  return this;
1452 }
1453 #endif
1454 
1456 {
1457  if (h->e!=NULL)
1458  {
1459  leftv hh=h->LData();
1460  if (h!=hh) return assumeStdFlag(h->LData());
1461  }
1462  if (!hasFlag(h,FLAG_STD))
1463  {
1464  if (!TEST_VERB_NSB)
1465  {
1466  if (TEST_V_ALLWARN)
1467  Warn("%s is no standard basis in >>%s<<",h->Name(),my_yylinebuf);
1468  else
1469  Warn("%s is no standard basis",h->Name());
1470  }
1471  return FALSE;
1472  }
1473  return TRUE;
1474 }
1475 
1476 /*2
1477 * transforms a name (as an string created by omAlloc or omStrDup)
1478 * into an expression (sleftv), deletes the string
1479 * utility for grammar and iparith
1480 */
1481 void syMake(leftv v,const char * id, package pa)
1482 {
1483  /* resolv an identifier: (to DEF_CMD, if siq>0)
1484  * 1) reserved id: done by scanner
1485  * 2) `basering` / 'Current`
1486  * 3) existing identifier, local
1487  * 4) ringvar, ringpar, local ring
1488  * 5) existing identifier, global
1489  * 6) monom (resp. number), local ring: consisting of:
1490  * 6') ringvar, ringpar,global ring
1491  * 6'') monom (resp. number), local ring
1492  * 7) monom (resp. number), non-local ring
1493  * 8) basering
1494  * 9) `_`
1495  * 10) everything else is of type 0
1496  */
1497 #ifdef TEST
1498  if ((*id<' ')||(*id>(char)126))
1499  {
1500  Print("wrong id :%s:\n",id);
1501  }
1502 #endif
1503  idhdl save_ring=currRingHdl;
1504  v->Init();
1505  if(pa != NULL)
1506  {
1507  v->req_packhdl = pa;
1508  }
1509  else v->req_packhdl = currPack;
1510 // if (v->req_packhdl!=basePack)
1511 // Print("search %s in %s\n",id,v->req_packhdl->libname);
1512  idhdl h=NULL;
1513 #ifdef SIQ
1514  if (siq<=0)
1515 #endif
1516  {
1517  if (!isdigit(id[0]))
1518  {
1519  if (strcmp(id,"basering")==0)
1520  {
1521  if (currRingHdl!=NULL)
1522  {
1523  if (id!=IDID(currRingHdl)) omFreeBinAddr((ADDRESS)id);
1524  h=currRingHdl;
1525  goto id_found;
1526  }
1527  else
1528  {
1529  v->name = id;
1530  return; /* undefined */
1531  }
1532  }
1533  else if (strcmp(id,"Current")==0)
1534  {
1535  if (currPackHdl!=NULL)
1536  {
1537  omFreeBinAddr((ADDRESS)id);
1538  h=currPackHdl;
1539  goto id_found;
1540  }
1541  else
1542  {
1543  v->name = id;
1544  return; /* undefined */
1545  }
1546  }
1547  if(v->req_packhdl!=currPack)
1548  {
1549  h=v->req_packhdl->idroot->get(id,myynest);
1550  }
1551  else
1552  h=ggetid(id);
1553  /* 3) existing identifier, local */
1554  if ((h!=NULL) && (IDLEV(h)==myynest))
1555  {
1556  if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1557  goto id_found;
1558  }
1559  }
1561  {
1562  currRingHdl=NULL;
1563  }
1564  /* 4. local ring: ringvar */
1565  if ((currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest)
1566  /*&& (!yyInRingConstruction)*/)
1567  {
1568  int vnr;
1569  if ((vnr=r_IsRingVar(id, currRing->names,currRing->N))>=0)
1570  {
1571  poly p=pOne();
1572  pSetExp(p,vnr+1,1);
1573  pSetm(p);
1574  v->data = (void *)p;
1575  v->name = id;
1576  v->rtyp = POLY_CMD;
1577  return;
1578  }
1579  if((n_NumberOfParameters(currRing->cf)>0)
1580  &&((vnr=r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1581  n_NumberOfParameters(currRing->cf))>=0)))
1582  {
1583  BOOLEAN ok=FALSE;
1584  poly p = pmInit(id,ok);
1585  if (ok && (p!=NULL))
1586  {
1587  v->data = pGetCoeff(p);
1588  pGetCoeff(p)=NULL;
1589  pLmFree(p);
1590  v->rtyp = NUMBER_CMD;
1591  v->name = id;
1592  return;
1593  }
1594  }
1595  }
1596  /* 5. existing identifier, global */
1597  if (h!=NULL)
1598  {
1599  if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1600  goto id_found;
1601  }
1602  /* 6. local ring: number/poly */
1603  if ((currRingHdl!=NULL) && (IDLEV(currRingHdl)==myynest))
1604  {
1605  BOOLEAN ok=FALSE;
1606  /*poly p = (!yyInRingConstruction) ? pmInit(id,ok) : (poly)NULL;*/
1607  poly p = pmInit(id,ok);
1608  if (ok)
1609  {
1610  if (p==NULL)
1611  {
1612  v->data = (void *)nInit(0);
1613  v->rtyp = NUMBER_CMD;
1614  #ifdef HAVE_PLURAL
1615  // in this case we may have monomials equal to 0 in p_Read
1616  v->name = id;
1617  #else
1618  omFreeBinAddr((ADDRESS)id);
1619  #endif
1620  }
1621  else if (pIsConstant(p))
1622  {
1623  v->data = pGetCoeff(p);
1624  pGetCoeff(p)=NULL;
1625  pLmFree(p);
1626  v->rtyp = NUMBER_CMD;
1627  v->name = id;
1628  }
1629  else
1630  {
1631  v->data = p;
1632  v->rtyp = POLY_CMD;
1633  v->name = id;
1634  }
1635  return;
1636  }
1637  }
1638  /* 7. non-local ring: number/poly */
1639  {
1640  BOOLEAN ok=FALSE;
1641  poly p = ((currRing!=NULL) /* ring required */
1642  && (currRingHdl!=NULL)
1643  /*&& (!yyInRingConstruction) - not in decl */
1644  && (IDLEV(currRingHdl)!=myynest)) /* already in case 4/6 */
1645  ? pmInit(id,ok) : (poly)NULL;
1646  if (ok)
1647  {
1648  if (p==NULL)
1649  {
1650  v->data = (void *)nInit(0);
1651  v->rtyp = NUMBER_CMD;
1652  #ifdef HAVE_PLURAL
1653  // in this case we may have monomials equal to 0 in p_Read
1654  v->name = id;
1655  #else
1656  omFreeBinAddr((ADDRESS)id);
1657  #endif
1658  }
1659  else
1660  if (pIsConstant(p))
1661  {
1662  v->data = pGetCoeff(p);
1663  pGetCoeff(p)=NULL;
1664  pLmFree(p);
1665  v->rtyp = NUMBER_CMD;
1666  v->name = id;
1667  }
1668  else
1669  {
1670  v->data = p;
1671  v->rtyp = POLY_CMD;
1672  v->name = id;
1673  }
1674  //if (TEST_V_ALLWARN /*&& (myynest>0)*/
1675  //&& ((r_IsRingVar(id, currRing->names,currRing->N)>=0)
1676  // || ((n_NumberOfParameters(currRing->cf)>0)
1677  // &&(r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1678  // n_NumberOfParameters(currRing->cf))>=0))))
1679  //{
1680  //// WARNING: do not use ring variable names in procedures
1681  // Warn("use of variable >>%s<< in a procedure in line %s",id,my_yylinebuf);
1682  //}
1683  return;
1684  }
1685  }
1686  /* 8. basering ? */
1687  if ((myynest>1)&&(currRingHdl!=NULL))
1688  {
1689  if (strcmp(id,IDID(currRingHdl))==0)
1690  {
1691  if (IDID(currRingHdl)!=id) omFreeBinAddr((ADDRESS)id); /*assume strlen (id) <1000 */
1692  h=currRingHdl;
1693  goto id_found;
1694  }
1695  }
1696  if((v->req_packhdl!=basePack) && (v->req_packhdl==currPack))
1697  {
1698  h=basePack->idroot->get(id,myynest);
1699  if (h!=NULL)
1700  {
1701  if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1702  v->req_packhdl=basePack;
1703  goto id_found;
1704  }
1705  }
1706  }
1707 #ifdef SIQ
1708  else
1709  v->rtyp=DEF_CMD;
1710 #endif
1711  /* 9: _ */
1712  if (strcmp(id,"_")==0)
1713  {
1714  omFreeBinAddr((ADDRESS)id);
1715  v->Copy(&sLastPrinted);
1716  }
1717  else
1718  {
1719  /* 10: everything else */
1720  /* v->rtyp = UNKNOWN;*/
1721  v->name = id;
1722  }
1723  currRingHdl=save_ring;
1724  return;
1725 id_found: // we have an id (in h) found, to set the data in from h
1726  if (IDTYP(h)!=ALIAS_CMD)
1727  {
1728  v->rtyp = IDHDL;
1729  v->flag = IDFLAG(h);
1730  v->attribute=IDATTR(h);
1731  }
1732  else
1733  {
1734  v->rtyp = ALIAS_CMD;
1735  }
1736  v->name = IDID(h);
1737  v->data = (char *)h;
1738  currRingHdl=save_ring;
1739 }
1740 
1742 {
1743  BOOLEAN nok=FALSE;
1744  leftv nn=next;
1745  next=NULL;
1746  if(rtyp==IDHDL)
1747  {
1748  int t=Typ();
1749  if (t!=PROC_CMD)
1750  {
1751  void *d=CopyD(t);
1752  data=d;
1753  rtyp=t;
1754  name=NULL;
1755  e=NULL;
1756  }
1757  }
1758  else if (rtyp==COMMAND)
1759  {
1760  command d=(command)data;
1761  if(d->op==PROC_CMD) //assume d->argc==2
1762  {
1763  char *what=(char *)(d->arg1.Data());
1764  idhdl h=ggetid(what);
1765  if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
1766  {
1767  nok=d->arg2.Eval();
1768  if(!nok)
1769  {
1770  nok=iiMake_proc(h,req_packhdl,&d->arg2);
1771  this->CleanUp(currRing);
1772  if (!nok)
1773  {
1774  memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
1775  memset(&iiRETURNEXPR,0,sizeof(sleftv));
1776  }
1777  }
1778  }
1779  else nok=TRUE;
1780  }
1781  else if (d->op=='=') //assume d->argc==2
1782  {
1783  if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
1784  {
1785  nok=d->arg1.Eval();
1786  }
1787  if (!nok)
1788  {
1789  const char *n=d->arg1.name;
1790  nok=(n == NULL) || d->arg2.Eval();
1791  if (!nok)
1792  {
1793  int save_typ=d->arg1.rtyp;
1794  omCheckAddr((ADDRESS)n);
1795  if (d->arg1.rtyp!=IDHDL)
1796  syMake(&d->arg1,n);
1797  omCheckAddr((ADDRESS)d->arg1.name);
1798  if (d->arg1.rtyp==IDHDL)
1799  {
1800  n=omStrDup(IDID((idhdl)d->arg1.data));
1801  killhdl((idhdl)d->arg1.data);
1802  d->arg1.Init();
1803  //d->arg1.data=NULL;
1804  d->arg1.name=n;
1805  }
1806  d->arg1.rtyp=DEF_CMD;
1807  sleftv t;
1808  if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
1809  if (::RingDependend(d->arg2.rtyp))
1810  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
1811  else
1812  nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
1813  memcpy(&d->arg1,&t,sizeof(sleftv));
1814  omCheckAddr((ADDRESS)d->arg1.name);
1815  nok=nok||iiAssign(&d->arg1,&d->arg2);
1816  omCheckIf(d->arg1.name != NULL, // OB: ????
1817  omCheckAddr((ADDRESS)d->arg1.name));
1818  if (!nok)
1819  {
1820  memset(&d->arg1,0,sizeof(sleftv));
1821  this->CleanUp();
1822  rtyp=NONE;
1823  }
1824  }
1825  }
1826  else nok=TRUE;
1827  }
1828  else
1829  {
1830  sleftv tmp; tmp.Init();
1831  int toktype=iiTokType(d->op);
1832  if ((toktype==CMD_M)
1833  ||( toktype==ROOT_DECL_LIST)
1834  ||( toktype==RING_DECL_LIST))
1835  {
1836  if (d->argc <=3)
1837  {
1838  if (d->argc>=1) nok=d->arg1.Eval();
1839  if ((!nok) && (d->argc>=2))
1840  {
1841  nok=d->arg2.Eval();
1842  d->arg1.next=(leftv)omAllocBin(sleftv_bin);
1843  memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
1844  d->arg2.Init();
1845  }
1846  if ((!nok) && (d->argc==3))
1847  {
1848  nok=d->arg3.Eval();
1849  d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
1850  memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
1851  d->arg3.Init();
1852  }
1853  if (d->argc==0)
1854  nok=nok||iiExprArithM(&tmp,NULL,d->op);
1855  else
1856  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1857  }
1858  else
1859  {
1860  nok=d->arg1.Eval();
1861  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1862  }
1863  }
1864  else if (d->argc==1)
1865  {
1866  nok=d->arg1.Eval();
1867  nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
1868  }
1869  else if(d->argc==2)
1870  {
1871  nok=d->arg1.Eval();
1872  nok=nok||d->arg2.Eval();
1873  nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
1874  }
1875  else if(d->argc==3)
1876  {
1877  nok=d->arg1.Eval();
1878  nok=nok||d->arg2.Eval();
1879  nok=nok||d->arg3.Eval();
1880  nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
1881  }
1882  else if(d->argc!=0)
1883  {
1884  nok=d->arg1.Eval();
1885  nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
1886  }
1887  else // d->argc == 0
1888  {
1889  nok = iiExprArithM(&tmp, NULL, d->op);
1890  }
1891  this->CleanUp();
1892  memcpy(this,&tmp,sizeof(tmp));
1893  }
1894  }
1895  else if (((rtyp==0)||(rtyp==DEF_CMD))
1896  &&(name!=NULL))
1897  {
1898  syMake(this,name);
1899  }
1900 #ifdef MDEBUG
1901  switch(Typ())
1902  {
1903  case NUMBER_CMD:
1904 #ifdef LDEBUG
1905  nTest((number)Data());
1906 #endif
1907  break;
1908  case BIGINT_CMD:
1909 #ifdef LDEBUG
1910  n_Test((number)Data(),coeffs_BIGINT);
1911 #endif
1912  break;
1913  case POLY_CMD:
1914  pTest((poly)Data());
1915  break;
1916  case IDEAL_CMD:
1917  case MODUL_CMD:
1918  case MATRIX_CMD:
1919  {
1920  ideal id=(ideal)Data();
1921  omCheckAddrSize(id,sizeof(*id));
1922  int i=id->ncols*id->nrows-1;
1923  for(;i>=0;i--) pTest(id->m[i]);
1924  }
1925  break;
1926  }
1927 #endif
1928  if (nn!=NULL) nok=nok||nn->Eval();
1929  next=nn;
1930  return nok;
1931 }
1932 
1933 const char *iiSleftv2name(leftv v)
1934 {
1935  return(v->name);
1936 }
1937 
1939 {
1940  omCheckAddrSize(this,sizeof(sattr));
1941  return s_internalCopy(atyp,data);
1942 }
1943 
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:211
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:801
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:2163
Definition: tok.h:207
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:1741
#define pSetm(p)
Definition: polys.h:241
ip_command * command
Definition: ipid.h:24
const poly a
Definition: syzextra.cc:212
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:98
Definition: tok.h:208
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:8414
#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:1373
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:8626
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition: ipshell.cc:3097
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:217
sleftv iiRETURNEXPR
Definition: iplib.cc:517
#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:126
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:221
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:8714
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:467
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:976
#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:810
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:128
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:797
void * data
Definition: subexpr.h:89
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:1938
Definition: tok.h:212
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:563
Definition: tok.h:59
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:913
int LTyp()
Definition: subexpr.cc:1082
#define nTest(a)
Definition: numbers.h:35
Definition: intvec.h:14
const char * iiTwoOps(int t)
Definition: gentable.cc:252
void rKill(ring r)
Definition: ipshell.cc:6057
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:408
Definition: tok.h:61
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:739
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:1455
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:210
void rWrite(ring r, BOOLEAN details)
Definition: ring.cc:236
static int iiCmatrix_index
Definition: subexpr.cc:1116
#define IDELEMS(i)
Definition: simpleideals.h:24
static FORCE_INLINE BOOLEAN nCoeff_is_GF(const coeffs r)
Definition: coeffs.h:842
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:145
#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:592
#define BIMATELEM(M, I, J)
Definition: bigintmat.h:134
#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:1123
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:849
#define omGetSpecBin(size)
Definition: omBin.h:11
void paPrint(const char *n, package p)
Definition: ipshell.cc:6261
BOOLEAN iiCheckRing(int i)
Definition: ipshell.cc:1472
Definition: tok.h:213
#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:2128
int nr
Definition: lists.h:43
int rows() const
Definition: bigintmat.h:146
CanonicalForm cf
Definition: cfModGcd.cc:4024
#define MATCOLS(i)
Definition: matpol.h:28
Definition: tok.h:119
#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:1115
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:439
coeffs basecoeffs() const
Definition: bigintmat.h:147
#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:1118
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:120
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:159
#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
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:962
int iiTokType(int op)
Definition: iparith.cc:244
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:209
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:8227
#define NONE
Definition: tok.h:220
void syMake(leftv v, const char *id, package pa)
Definition: subexpr.cc:1481
BOOLEAN lRingDependend(lists L)
Definition: lists.cc:199
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:488
leftv LData()
Definition: subexpr.cc:1387
const char * iiSleftv2name(leftv v)
Definition: subexpr.cc:1933
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:1783
#define Warn
Definition: emacs.cc:80
#define omStrDup(s)
Definition: omAllocDecl.h:263