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