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