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