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