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