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