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