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