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