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));
123 pWrite0(p);
124 pDelete(&p);
125 break;
126 }
127 else
129 }
130 break;
131 case UNKNOWN:
132 case DEF_CMD:
134 PrintS("`");PrintS(n);PrintS("`");
135 break;
136 case PACKAGE_CMD:
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 {
150 const ring r = (ring)d;
151 rWrite(r, currRing == r);
152 break;
153 }
154 case MATRIX_CMD:
156 break;
157 case SMATRIX_CMD:
158 {
160 ipPrint_MA0(m, n);
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:
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 }
199 pWrite0((poly)d);
200 break;
201 case RESOLUTION_CMD:
202 {
205 break;
206 }
207 case STRING_CMD:
209 PrintS((char *)d);
210 break;
211 case INT_CMD:
213 ::Print("%ld",(long)d);
214 break;
215 case PROC_CMD:
216 {
218
220 PrintS("// libname : ");
221 PrintS(piProcinfo(pi, "libname"));
222 PrintLn();
223
225 PrintS("// procname : ");
226 PrintS(piProcinfo(pi, "procname"));
227 PrintLn();
228
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;
240 ::Print("// type : %s\n", slStatus(l, "type"));
242 ::Print("// mode : %s\n", slStatus(l, "mode"));
244 ::Print("// name : %s\n", slStatus(l, "name"));
246 ::Print("// open : %s\n", slStatus(l, "open"));
248 ::Print("// read : %s\n", slStatus(l, "read"));
250 ::Print("// write: %s", slStatus(l, "write"));
251 break;
252 }
253 case BIGINT_CMD:
254 s=String(d);
255 if (s==NULL) return;
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 {
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 {
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 {
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(" ");
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
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 {
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 {
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
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 const size_t len=MAX_INT_LEN+17;
789 #else
790 const size_t len=MAX_INT_LEN+7;
791 #endif
792 s=(char*)omAlloc(len);
793 snprintf(s,len,"int(%ld)",(long)d);
794 }
795 else
796 {
797 #if SIZEOF_LONG==8
798 const size_t len=MAX_INT_LEN+12;
799 #else
800 const size_t len=MAX_INT_LEN+2;
801 #endif
802 s=(char*)omAlloc(len);
803 snprintf(s,len,"%ld",(long)d);
804 }
805 return s;
806
807 case STRING_CMD:
808 if (d == NULL)
809 {
810 if (typed) return omStrDup("\"\"");
811 return omStrDup("");
812 }
813 if (typed)
814 {
815 size_t len=strlen((char*) d) + 3;
816 s = (char*) omAlloc(len);
817 snprintf(s,len,"\"%s\"", (char*) d);
818 return s;
819 }
820 else
821 {
822 return omStrDup((char*)d);
823 }
824
825 case POLY_CMD:
826 case VECTOR_CMD:
827 if (typed)
828 {
829 char* ps = pString((poly) d);
830 size_t len=strlen(ps) + 10;
831 s = (char*) omAlloc(len);
832 snprintf(s,len,"%s(%s)", (t /*Typ()*/ == POLY_CMD ? "poly" : "vector"), ps);
833 omFree(ps);
834 return s;
835 }
836 else
837 return pString((poly)d);
838
839 case CRING_CMD:
840 return nCoeffString((coeffs)d);
841 #ifdef SINGULAR_4_2
842 case CNUMBER_CMD:
843 return n2String((number2)d,typed);
844 case CMATRIX_CMD:
845 {
846 bigintmat *b=(bigintmat*)d;
847 return b->String();
848 }
849 #endif
850
851 case NUMBER_CMD:
852 StringSetS((char*) (typed ? "number(" : ""));
854 {
855 nfShowMipo(currRing->cf);
856 }
857 else
858 {
859 nWrite((number)d);
860 }
861 StringAppendS((char*) (typed ? ")" : ""));
862 return StringEndS();
863
864 case BIGINT_CMD:
865 {
866 StringSetS((char*) (typed ? "bigint(" : ""));
867 number nl=(number)d;
869 StringAppendS((char*) (typed ? ")" : ""));
870 return StringEndS();
871 }
872 case BUCKET_CMD:
873 return sBucketString((sBucket_pt)d);
874 case MATRIX_CMD:
876 if (typed)
877 {
878 size_t len=strlen(s) + 40;
879 char* ns = (char*) omAlloc(len);
880 snprintf(ns,len, "matrix(ideal(%s),%d,%d)", s,
881 ((ideal) d)->nrows, ((ideal) d)->ncols);
883 return ns;
884 }
885 else
886 {
887 return omStrDup(s);
888 }
889
890 case IDEAL_CMD:
891 case MAP_CMD:
892 case MODUL_CMD:
893 case SMATRIX_CMD:
895 if (typed)
896 {
897 size_t len=strlen(s) + 10;
898 char* ns = (char*) omAlloc(len);
899 if ((t/*Typ()*/==IDEAL_CMD)||(t==MAP_CMD))
900 snprintf(ns,len, "ideal(%s)", s);
901 else /*MODUL_CMD, SMATRIX_CMD */
902 snprintf(ns,len, "module(%s)", s);
903 omFree(s);
905 return ns;
906 }
907 return s;
908
909 case INTVEC_CMD:
910 case INTMAT_CMD:
911 {
912 intvec *v=(intvec *)d;
913 s = v->String(dim);
914 if (typed)
915 {
916 char* ns;
917 if (t/*Typ()*/ == INTMAT_CMD)
918 {
919 size_t len=strlen(s) + 40;
920 ns = (char*) omAlloc(len);
921 snprintf(ns,len, "intmat(intvec(%s),%d,%d)", s, v->rows(), v->cols());
922 }
923 else
924 {
925 size_t len=strlen(s) + 10;
926 ns = (char*) omAlloc(len);
927 snprintf(ns,len, "intvec(%s)", s);
928 }
930 omFree(s);
931 return ns;
932 }
933 else
934 return s;
935 }
936 case BIGINTMAT_CMD:
937 {
938 bigintmat *bim=(bigintmat*)d;
939 s = bim->String();
940 if (typed)
941 {
942 size_t len=strlen(s) + 40;
943 char* ns = (char*) omAlloc(len);
944 snprintf(ns,len, "bigintmat(bigintvec(%s),%d,%d)", s, bim->rows(), bim->cols());
945 return ns;
946 }
947 else
948 return omStrDup(s);
949 }
950
951 case RING_CMD:
952 s = rString((ring)d);
953
954 if (typed)
955 {
956 char* ns;
957 ring r=(ring)d;
958 if (r->qideal!=NULL)
959 {
960 char* id = iiStringMatrix((matrix) ((ring) d)->qideal, dim,
961 currRing);
962 size_t len=strlen(s) + strlen(id) + 20;
963 ns = (char*) omAlloc(len);
964 snprintf(ns,len, "\"%s\";%sideal(%s)", s,(dim == 2 ? "\n" : " "), id);
965 }
966 else
967 {
968 size_t len=strlen(s) + 4;
969 ns = (char*) omAlloc(len);
970 snprintf(ns,len, "\"%s\"", s);
971 }
972 omFree(s);
974 return ns;
975 }
976 return s;
977 case RESOLUTION_CMD:
978 {
980 s = lString(l, typed, dim);
981 l->Clean();
982 return s;
983 }
984
985 case PROC_CMD:
986 {
987 procinfo* pi = (procinfo*) d;
988 if((pi->language == LANG_SINGULAR) && (pi->data.s.body!=NULL))
989 s = (pi->data.s.body);
990 else
991 s = (char *)"";
992 if (typed)
993 {
994 size_t len=strlen(s) + 4;
995 char* ns = (char*) omAlloc(len);
996 snprintf(ns,len, "\"%s\"", s);
997 return ns;
998 }
999 return omStrDup(s);
1000 }
1001
1002 case LINK_CMD:
1003 s = slString((si_link) d);
1004 if (typed)
1005 {
1006 size_t len=strlen(s) + 10;
1007 char* ns = (char*) omAlloc(len);
1008 snprintf(ns,len, "link(\"%s\")", s);
1010 omCheckAddr(ns);
1011 return ns;
1012 }
1013 return s;
1014
1015 case LIST_CMD:
1016 return lString((lists) d, typed, dim);
1017
1018 default:
1019 if(t> MAX_TOK)
1020 {
1022 if (bb!=NULL) return bb->blackbox_String(bb,d);
1023 }
1024 } /* end switch: (Typ()) */
1025 }
1026 return omStrDup("");
1027}
1028
1029
1031{
1032 if (e==NULL)
1033 {
1034 switch (rtyp)
1035 {
1036 case IDHDL:
1037 return IDTYP((idhdl)data);
1038 case ALIAS_CMD:
1039 {
1040 idhdl h=(idhdl)data;
1041 return ((idhdl)h->data.ustring)->typ;
1042 }
1043 case VECHO:
1044 case VPRINTLEVEL:
1045 case VCOLMAX:
1046 case VTIMER:
1047 case VRTIMER:
1048 case VOICE:
1049 case VMAXDEG:
1050 case VMAXMULT:
1051 case TRACE:
1052 case VSHORTOUT:
1053 return INT_CMD;
1054 case VMINPOLY:
1055 data=NULL;
1056 return NUMBER_CMD;
1057 case VNOETHER:
1058 data=NULL;
1059 return POLY_CMD;
1060 //case COMMAND:
1061 // return COMMAND;
1062 default:
1063 return rtyp;
1064 }
1065 }
1066 int r=0;
1067 int t=rtyp;
1068 void *d=data;
1069 if (t==IDHDL) t=IDTYP((idhdl)d);
1070 else if (t==ALIAS_CMD)
1071 { idhdl h=(idhdl)IDDATA((idhdl)data); t=IDTYP(h);d=IDDATA(h); }
1072 switch (t)
1073 {
1074#ifdef SINGULAR_4_2
1075 case CMATRIX_CMD:
1076 {
1077 bigintmat *b=(bigintmat*)d;
1078 if ((currRing!=NULL)&&(currRing->cf==b->basecoeffs()))
1079 return NUMBER_CMD;
1080 else
1081 return CNUMBER_CMD;
1082 }
1083#endif
1084 case INTVEC_CMD:
1085 case INTMAT_CMD:
1086 r=INT_CMD;
1087 break;
1088 case BIGINTMAT_CMD:
1089 r=BIGINT_CMD;
1090 break;
1091 case IDEAL_CMD:
1092 case MATRIX_CMD:
1093 case MAP_CMD:
1094 case SMATRIX_CMD:
1095 r=POLY_CMD;
1096 break;
1097 case MODUL_CMD:
1098 r=VECTOR_CMD;
1099 break;
1100 case STRING_CMD:
1101 r=STRING_CMD;
1102 break;
1103 default:
1104 {
1105 blackbox *b=NULL;
1106 if (t>MAX_TOK)
1107 {
1109 }
1110 if ((t==LIST_CMD)||((b!=NULL)&&BB_LIKE_LIST(b)))
1111 {
1112 lists l;
1113 if (rtyp==IDHDL) l=IDLIST((idhdl)d);
1114 else l=(lists)d;
1115 if ((0<e->start)&&(e->start<=l->nr+1))
1116 {
1117 Subexpr tmp=l->m[e->start-1].e;
1118 l->m[e->start-1].e=e->next;
1119 r=l->m[e->start-1].Typ();
1120 e->next=l->m[e->start-1].e;
1121 l->m[e->start-1].e=tmp;
1122 }
1123 else
1124 {
1125 //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1126 r=DEF_CMD;
1127 }
1128 }
1129 else
1130 Werror("cannot index type %s(%d)",Tok2Cmdname(t),t);
1131 break;
1132 }
1133 }
1134 return r;
1135}
1136
1138{
1139 lists l=NULL;
1140 int r;
1141 if (rtyp==LIST_CMD)
1142 l=(lists)data;
1143 else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1144 l=IDLIST((idhdl)data);
1145 else
1146 return Typ();
1147 //if (l!=NULL)
1148 {
1149 if ((e!=NULL) && (e->next!=NULL))
1150 {
1151 if ((0<e->start)&&(e->start<=l->nr+1))
1152 {
1153 l->m[e->start-1].e=e->next;
1154 r=l->m[e->start-1].LTyp();
1155 l->m[e->start-1].e=NULL;
1156 }
1157 else
1158 {
1159 //Warn("out of range: %d not in 1..%d",e->start,l->nr+1);
1160 r=NONE;
1161 }
1162 return r;
1163 }
1164 return LIST_CMD;
1165 }
1166 return Typ();
1167}
1168
1169#ifdef SINGULAR_4_2
1172#endif
1174{
1175 if ((rtyp!=IDHDL) && iiCheckRing(rtyp))
1176 return NULL;
1178 {
1179 flag&=~Sy_bit(FLAG_OTHER_RING);
1180 WerrorS("object from another ring");
1181 return NULL;
1182 }
1183 if (e==NULL)
1184 {
1185 switch (rtyp)
1186 {
1187 case ALIAS_CMD:
1188 {
1189 idhdl h=(idhdl)data;
1190 return ((idhdl)h->data.ustring)->data.ustring;
1191 }
1192 case VECHO: return (void *)(long)si_echo;
1193 case VPRINTLEVEL:return (void *)(long)printlevel;
1194 case VCOLMAX: return (void *)(long)colmax;
1195 case VTIMER: return (void *)(long)getTimer();
1196 case VRTIMER: return (void *)(long)getRTimer();
1197 case VOICE: return (void *)(long)(myynest+1);
1198 case VMAXDEG: return (void *)(long)Kstd1_deg;
1199 case VMAXMULT: return (void *)(long)Kstd1_mu;
1200 case TRACE: return (void *)(long)traceit;
1201 case VSHORTOUT: return (void *)(long)(currRing != NULL ? currRing->ShortOut : 0);
1202 case VMINPOLY:
1203 if ( (currRing != NULL) && nCoeff_is_algExt(currRing->cf) && !nCoeff_is_GF(currRing->cf))
1204 {
1205 /* Q(a), Fp(a), but not GF(q) */
1206 const ring A = currRing->cf->extRing;
1207
1208 assume( A != NULL );
1209 assume( A->qideal != NULL );
1210
1211 return (void *)A->qideal->m[0];
1212 }
1213 else
1214 return (void *)nInit(0);
1215
1216 case VNOETHER: return (void *) (currRing->ppNoether);
1217 case IDHDL:
1218 return IDDATA((idhdl)data);
1219 case COMMAND:
1220 //return NULL;
1221 default:
1222 return data;
1223 }
1224 }
1225 /* e != NULL : */
1226 int t=rtyp;
1227 void *d=data;
1228 if (t==IDHDL)
1229 {
1230 t=((idhdl)data)->typ;
1231 d=IDDATA((idhdl)data);
1232 }
1233 else if (t==ALIAS_CMD)
1234 {
1236 t=IDTYP(h);
1237 d=IDDATA(h);
1238 }
1239 if (iiCheckRing(t))
1240 return NULL;
1241 char *r=NULL;
1242 int index=e->start;
1243 switch (t)
1244 {
1245 case INTVEC_CMD:
1246 {
1247 intvec *iv=(intvec *)d;
1248 if ((index<1)||(index>iv->length()))
1249 {
1250 if (!errorreported)
1251 Werror("wrong range[%d] in intvec %s(%d)",index,this->Name(),iv->length());
1252 }
1253 else
1254 r=(char *)(long)((*iv)[index-1]);
1255 break;
1256 }
1257 case INTMAT_CMD:
1258 {
1259 intvec *iv=(intvec *)d;
1260 if ((index<1)
1261 ||(index>iv->rows())
1262 ||(e->next->start<1)
1263 ||(e->next->start>iv->cols()))
1264 {
1265 if (!errorreported)
1266 Werror("wrong range[%d,%d] in intmat %s(%dx%d)",index,e->next->start,
1267 this->Name(),iv->rows(),iv->cols());
1268 }
1269 else
1270 r=(char *)(long)(IMATELEM((*iv),index,e->next->start));
1271 break;
1272 }
1273 case BIGINTMAT_CMD:
1274 {
1275 bigintmat *m=(bigintmat *)d;
1276 if ((index<1)
1277 ||(index>m->rows())
1278 ||(e->next->start<1)
1279 ||(e->next->start>m->cols()))
1280 {
1281 if (!errorreported)
1282 Werror("wrong range[%d,%d] in bigintmat %s(%dx%d)",index,e->next->start,
1283 this->Name(),m->rows(),m->cols());
1284 }
1285 else
1286 r=(char *)(BIMATELEM((*m),index,e->next->start));
1287 break;
1288 }
1289#ifdef SINGULAR_4_2
1290 case CMATRIX_CMD:
1291 {
1292 bigintmat *m=(bigintmat *)d;
1293 if ((index<1)
1294 ||(index>m->rows())
1295 ||(e->next->start<1)
1296 ||(e->next->start>m->cols()))
1297 {
1298 if (!errorreported)
1299 Werror("wrong range[%d,%d] in matrix %s(%dx%d)",index,e->next->start,
1300 this->Name(),m->rows(),m->cols());
1301 }
1302 else
1303 {
1304 iiNumber2Data[iiCmatrix_index].cf=m->basecoeffs();
1305 iiNumber2Data[iiCmatrix_index].n=BIMATELEM((*m),index,e->next->start);
1306 r=(char*)&iiNumber2Data[iiCmatrix_index];
1308 }
1309 break;
1310 }
1311#endif
1312 case IDEAL_CMD:
1313 case MODUL_CMD:
1314 case MAP_CMD:
1315 {
1316 ideal I=(ideal)d;
1317 if ((index<1)||(index>IDELEMS(I)))
1318 {
1319 if (!errorreported)
1320 Werror("wrong range[%d] in ideal/module %s(%d)",index,this->Name(),IDELEMS(I));
1321 }
1322 else
1323 r=(char *)I->m[index-1];
1324 break;
1325 }
1326 case SMATRIX_CMD:
1327 {
1328 ideal I=(ideal)d;
1329 int c;
1330 sleftv tmp;
1331 tmp.Init();
1332 tmp.rtyp=POLY_CMD;
1333 if ((index>0)&& (index<=I->rank)
1334 && (e->next!=NULL)
1335 && ((c=e->next->start)>0) &&(c<=IDELEMS(I)))
1336 {
1337 r=(char*)SMATELEM(I,index-1,c-1,currRing);
1338 }
1339 else
1340 {
1341 r=NULL;
1342 }
1343 tmp.data=r;
1344 if ((rtyp==IDHDL)||(rtyp==SMATRIX_CMD))
1345 {
1346 tmp.next=next; next=NULL;
1347 d=NULL;
1348 CleanUp();
1349 memcpy(this,&tmp,sizeof(tmp));
1350 }
1351 // and, remember, r is also the result...
1352 else
1353 {
1354 // ???
1355 // here we still have a memory leak...
1356 // example: list L="123","456";
1357 // L[1][2];
1358 // therefore, it should never happen:
1359 assume(0);
1360 // but if it happens: here is the temporary fix:
1361 // omMarkAsStaticAddr(r);
1362 }
1363 break;
1364 }
1365 case STRING_CMD:
1366 {
1367 // this was a memory leak
1368 // we evalute it, cleanup and replace this leftv by it's evalutated form
1369 // the evalutated form will be build in tmp
1370 sleftv tmp;
1371 tmp.Init();
1372 tmp.rtyp=STRING_CMD;
1373 r=(char *)omAllocBin(size_two_bin);
1374 if ((index>0)&& (index<=(int)strlen((char *)d)))
1375 {
1376 r[0]=*(((char *)d)+index-1);
1377 r[1]='\0';
1378 }
1379 else
1380 {
1381 r[0]='\0';
1382 }
1383 tmp.data=r;
1384 if ((rtyp==IDHDL)||(rtyp==STRING_CMD))
1385 {
1386 tmp.next=next; next=NULL;
1387 //if (rtyp==STRING_CMD) { omFree((ADDRESS)data); }
1388 //data=NULL;
1389 d=NULL;
1390 CleanUp();
1391 memcpy(this,&tmp,sizeof(tmp));
1392 }
1393 // and, remember, r is also the result...
1394 else
1395 {
1396 // ???
1397 // here we still have a memory leak...
1398 // example: list L="123","456";
1399 // L[1][2];
1400 // therefore, it should never happen:
1401 assume(0);
1402 // but if it happens: here is the temporary fix:
1403 // omMarkAsStaticAddr(r);
1404 }
1405 break;
1406 }
1407 case MATRIX_CMD:
1408 {
1409 if ((index<1)
1410 ||(index>MATROWS((matrix)d))
1411 ||(e->next->start<1)
1412 ||(e->next->start>MATCOLS((matrix)d)))
1413 {
1414 if (!errorreported)
1415 Werror("wrong range[%d,%d] in matrix %s(%dx%d)",
1416 index,e->next->start,
1417 this->Name(),
1418 MATROWS((matrix)d),MATCOLS((matrix)d));
1419 }
1420 else
1421 r=(char *)MATELEM((matrix)d,index,e->next->start);
1422 break;
1423 }
1424 default:
1425 {
1426 blackbox *b=NULL;
1427 if (t>MAX_TOK)
1428 {
1430 }
1431 if ((t==LIST_CMD)||((b!=NULL)&&(BB_LIKE_LIST(b))))
1432 {
1433 lists l=(lists)d;
1434 if ((0<index)&&(index<=l->nr+1))
1435 {
1436 if ((e->next!=NULL)
1437 && (l->m[index-1].rtyp==STRING_CMD))
1438 // string[..].Data() modifies sleftv, so let's do it ourself
1439 {
1440 char *dd=(char *)l->m[index-1].data;
1441 int j=e->next->start-1;
1442 r=(char *)omAllocBin(size_two_bin);
1443 if ((j>=0) && (j<(int)strlen(dd)))
1444 {
1445 r[0]=*(dd+j);
1446 r[1]='\0';
1447 }
1448 else
1449 {
1450 r[0]='\0';
1451 }
1452 }
1453 else
1454 {
1455 Subexpr tmp=l->m[index-1].e;
1456 l->m[index-1].e=e->next;
1457 r=(char *)l->m[index-1].Data();
1458 e->next=l->m[index-1].e;
1459 l->m[index-1].e=tmp;
1460 }
1461 }
1462 else //if (!errorreported)
1463 Werror("wrong range[%d] in list %s(%d)",index,this->Name(),l->nr+1);
1464 }
1465 else
1466 Werror("cannot index %s of type %s(%d)",this->Name(),Tok2Cmdname(t),t);
1467 break;
1468 }
1469 }
1470 return r;
1471}
1472
1474{
1475 if (e==NULL) return &attribute;
1476 if ((rtyp==LIST_CMD)
1477 ||((rtyp==IDHDL)&&(IDTYP((idhdl)data)==LIST_CMD))
1478 || (rtyp>MAX_TOK)
1479 || ((rtyp==IDHDL)&&(IDTYP((idhdl)data)>MAX_TOK)))
1480 {
1481 leftv v=LData();
1482 return &(v->attribute);
1483 }
1484 return NULL;
1485}
1486
1488{
1489 if (e!=NULL)
1490 {
1491 lists l=NULL;
1493
1494 if ((rtyp==LIST_CMD)
1495 || ((b!=NULL)&&(BB_LIKE_LIST(b))))
1496 l=(lists)data;
1497 else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1498 l=IDLIST((idhdl)data);
1499 else if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)>MAX_TOK))
1500 {
1502 if (BB_LIKE_LIST(b)) l=IDLIST((idhdl)data);
1503 }
1504 else if (rtyp==ALIAS_CMD)
1505 {
1506 idhdl h=(idhdl)data;
1507 l= (lists)(((idhdl)h->data.ustring)->data.ustring);
1508 }
1509 if (l!=NULL)
1510 {
1511 if ((0>=e->start)||(e->start>l->nr+1))
1512 return NULL;
1513 if (e->next!=NULL)
1514 {
1515 l->m[e->start-1].e=e->next;
1516 leftv r=l->m[e->start-1].LData();
1517 l->m[e->start-1].e=NULL;
1518 return r;
1519 }
1520 return &(l->m[e->start-1]);
1521 }
1522 }
1523 return this;
1524}
1525
1526#if 0
1527leftv sleftv::LHdl()
1528{
1529 if (e!=NULL)
1530 {
1531 lists l=NULL;
1532
1533 if (rtyp==LIST_CMD)
1534 l=(lists)data;
1535 if ((rtyp==IDHDL)&& (IDTYP((idhdl)data)==LIST_CMD))
1536 l=IDLIST((idhdl)data);
1537 if (l!=NULL)
1538 {
1539 if ((0>=e->start)||(e->start>l->nr+1))
1540 return NULL;
1541 if (e->next!=NULL)
1542 {
1543 l->m[e->start-1].e=e->next;
1544 leftv r=l->m[e->start-1].LHdl();
1545 l->m[e->start-1].e=NULL;
1546 return r;
1547 }
1548 return &(l->m[e->start-1]);
1549 }
1550 }
1551 return this;
1552}
1553#endif
1554
1556{
1557 if (h->e!=NULL)
1558 {
1559 leftv hh=h->LData();
1560 if (h!=hh) return assumeStdFlag(h->LData());
1561 }
1562 if (!hasFlag(h,FLAG_STD))
1563 {
1564 if (!TEST_VERB_NSB)
1565 {
1566 if (TEST_V_ALLWARN)
1567 Warn("%s is no standard basis in >>%s<<",h->Name(),my_yylinebuf);
1568 else
1569 Warn("%s is no standard basis",h->Name());
1570 }
1571 return FALSE;
1572 }
1573 return TRUE;
1574}
1575
1576/*2
1577* transforms a name (as an string created by omAlloc or omStrDup)
1578* into an expression (sleftv), deletes the string
1579* utility for grammar and iparith
1580*/
1581void syMake(leftv v,const char * id, package pa)
1582{
1583 /* resolv an identifier: (to DEF_CMD, if siq>0)
1584 * 1) reserved id: done by scanner
1585 * 2) `basering` / 'Current`
1586 * 3) existing identifier, local
1587 * 4) ringvar, ringpar, local ring
1588 * 5) existing identifier, global
1589 * 6a) int/bigint
1590 * 6b) monom (resp. number), local ring: consisting of:
1591 * 6') ringvar, ringpar,global ring
1592 * 6'') monom (resp. number), local ring
1593 * 7) monom (resp. number), non-local ring
1594 * 8) basering
1595 * 9) `_`
1596 * 10) everything else is of type 0
1597 */
1598#ifdef TEST
1599 if ((*id<' ')||(*id>(char)126))
1600 {
1601 Print("wrong id :%s:\n",id);
1602 }
1603#endif
1605 v->Init();
1606 if(pa != NULL)
1607 {
1608 v->req_packhdl = pa;
1609 }
1610 else v->req_packhdl = currPack;
1611// if (v->req_packhdl!=basePack)
1612// Print("search %s in %s\n",id,v->req_packhdl->libname);
1613 idhdl h=NULL;
1614#ifdef SIQ
1615 if (siq<=0)
1616#endif
1617 {
1618 if (id[0]=='#')
1619 {
1620 h=ggetid(id);
1621 /* 3) existing identifier, local */
1622 if ((h!=NULL) && (IDLEV(h)==myynest))
1623 {
1624 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1625 goto id_found;
1626 }
1627 }
1628 else if ((id[0]!='-')&&(id[0]>='@' /* letters, _ */))
1629 {
1630 if (strcmp(id,"basering")==0)
1631 {
1632 if (currRingHdl!=NULL)
1633 {
1634 if (id!=IDID(currRingHdl)) omFreeBinAddr((ADDRESS)id);
1635 h=currRingHdl;
1636 goto id_found;
1637 }
1638 else
1639 {
1640 v->name = id;
1641 return; /* undefined */
1642 }
1643 }
1644 else if (strcmp(id,"Current")==0)
1645 {
1646 if (currPackHdl!=NULL)
1647 {
1649 h=currPackHdl;
1650 goto id_found;
1651 }
1652 else
1653 {
1654 v->name = id;
1655 return; /* undefined */
1656 }
1657 }
1658 if(v->req_packhdl!=currPack)
1659 {
1660 h=v->req_packhdl->idroot->get(id,myynest);
1661 }
1662 else
1663 {
1664 h=ggetid(id);
1665 }
1666 /* 3) existing identifier, local */
1667 if ((h!=NULL) && (IDLEV(h)==myynest))
1668 {
1669 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1670 goto id_found;
1671 }
1673 {
1675 }
1676 /* 4. local ring: ringvar */
1678 /*&& (!yyInRingConstruction)*/)
1679 {
1680 int vnr;
1681 if ((vnr=r_IsRingVar(id, currRing->names,currRing->N))>=0)
1682 {
1683 poly p=pOne();
1684 pSetExp(p,vnr+1,1);
1685 pSetm(p);
1686 v->data = (void *)p;
1687 v->name = id;
1688 v->rtyp = POLY_CMD;
1689 return;
1690 }
1691 if((n_NumberOfParameters(currRing->cf)>0)
1692 &&((vnr=r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1693 n_NumberOfParameters(currRing->cf))>=0)))
1694 {
1695 BOOLEAN ok=FALSE;
1696 poly p = pmInit(id,ok);
1697 if (ok && (p!=NULL))
1698 {
1699 v->data = pGetCoeff(p);
1700 pGetCoeff(p)=NULL;
1701 pLmFree(p);
1702 v->rtyp = NUMBER_CMD;
1703 v->name = id;
1704 return;
1705 }
1706 }
1707 }
1708 /* 5. existing identifier, global */
1709 if (h!=NULL)
1710 {
1711 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1712 goto id_found;
1713 }
1714 }
1715 else
1716 {
1717 /* 6a: int/bigint */
1718 int i=0;
1719 if (id[0]=='-') { i=1; }
1720 while(isdigit(id[i])) i++;
1721 if (id[i]=='\0')
1722 {
1723 int j=atoi(id);
1724 char tmp[MAX_INT_LEN+5];
1725 snprintf(tmp,MAX_INT_LEN+5,"%d",j);
1726 if (strcmp(tmp,id)!=0)
1727 {
1728 number n;
1729 n_Read(id,&n,coeffs_BIGINT);
1730 v->rtyp=BIGINT_CMD;
1731 v->data = n;
1732 }
1733 else
1734 {
1735 v->data=(void*)(long)j;
1736 v->rtyp=INT_CMD;
1737 }
1739 return;
1740 }
1741 }
1742 /* 6b local ring: number/poly */
1744 {
1745 BOOLEAN ok=FALSE;
1746 /*poly p = (!yyInRingConstruction) ? pmInit(id,ok) : (poly)NULL;*/
1747 poly p = pmInit(id,ok);
1748 if (ok)
1749 {
1750 if (p==NULL)
1751 {
1752 v->data = (void *)nInit(0);
1753 v->rtyp = NUMBER_CMD;
1754 #ifdef HAVE_PLURAL
1755 // in this case we may have monomials equal to 0 in p_Read
1756 v->name = id;
1757 #else
1759 #endif
1760 }
1761 else if (pIsConstant(p))
1762 {
1763 v->data = pGetCoeff(p);
1764 pGetCoeff(p)=NULL;
1765 pLmFree(p);
1766 v->rtyp = NUMBER_CMD;
1767 v->name = id;
1768 }
1769 else
1770 {
1771 v->name = id;
1772 #ifdef HAVE_SHIFTBBA
1773 if ((currRing->isLPring!=0)
1774 && (p_Totaldegree(p,currRing)>1))
1775 {
1777 /* v->rtyp = UNKNOWN; - already set */
1778 return; /* error, report "unknown id" */
1779 }
1780 #endif
1781 v->data = p;
1782 v->rtyp = POLY_CMD;
1783 }
1784 return;
1785 }
1786 }
1787 /* 7. non-local ring: number/poly */
1788 {
1789 BOOLEAN ok=FALSE;
1790 poly p = ((currRing!=NULL) /* ring required */
1791 && (currRingHdl!=NULL)
1792 /*&& (!yyInRingConstruction) - not in decl */
1793 && (IDLEV(currRingHdl)!=myynest)) /* already in case 4/6 */
1794 ? pmInit(id,ok) : (poly)NULL;
1795 if (ok)
1796 {
1797 if (p==NULL)
1798 {
1799 v->data = (void *)nInit(0);
1800 v->rtyp = NUMBER_CMD;
1802 }
1803 else
1804 if (pIsConstant(p))
1805 {
1806 v->data = pGetCoeff(p);
1807 pGetCoeff(p)=NULL;
1808 pLmFree(p);
1809 v->rtyp = NUMBER_CMD;
1810 v->name = id;
1811 }
1812 else
1813 {
1814 v->data = p;
1815 v->rtyp = POLY_CMD;
1816 v->name = id;
1817 }
1818 //if (TEST_V_ALLWARN /*&& (myynest>0)*/
1819 //&& ((r_IsRingVar(id, currRing->names,currRing->N)>=0)
1820 // || ((n_NumberOfParameters(currRing->cf)>0)
1821 // &&(r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1822 // n_NumberOfParameters(currRing->cf))>=0))))
1823 //{
1824 //// WARNING: do not use ring variable names in procedures
1825 // Warn("use of variable >>%s<< in a procedure in line %s",id,my_yylinebuf);
1826 //}
1827 return;
1828 }
1829 }
1830 /* 8. basering ? */
1831 if ((myynest>1)&&(currRingHdl!=NULL))
1832 {
1833 if (strcmp(id,IDID(currRingHdl))==0)
1834 {
1835 if (IDID(currRingHdl)!=id) omFreeBinAddr((ADDRESS)id); /*assume strlen (id) <1000 */
1836 h=currRingHdl;
1837 goto id_found;
1838 }
1839 }
1840 if((v->req_packhdl!=basePack) && (v->req_packhdl==currPack))
1841 {
1842 h=basePack->idroot->get(id,myynest);
1843 if (h!=NULL)
1844 {
1845 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1846 v->req_packhdl=basePack;
1847 goto id_found;
1848 }
1849 }
1850 }
1851#ifdef SIQ
1852 else
1853 v->rtyp=DEF_CMD;
1854#endif
1855 /* 9: _ */
1856 if (strcmp(id,"_")==0)
1857 {
1859 v->Copy(&sLastPrinted);
1860 }
1861 else
1862 {
1863 /* 10: everything else */
1864 /* v->rtyp = UNKNOWN;*/
1865 v->name = id;
1866 }
1868 return;
1869id_found: // we have an id (in h) found, to set the data in from h
1870 if (IDTYP(h)!=ALIAS_CMD)
1871 {
1872 v->rtyp = IDHDL;
1873 v->flag = IDFLAG(h);
1874 v->attribute=IDATTR(h);
1875 }
1876 else
1877 {
1878 v->rtyp = ALIAS_CMD;
1879 }
1880 v->name = IDID(h);
1881 v->data = (char *)h;
1883}
1884
1885void syMakeMonom(leftv v,const char * id)
1886{
1887 if (!isdigit(id[0]))
1888 {
1889 Print("non-digit:%s\n",id);
1890 }
1891 /* resolv an identifier: (to DEF_CMD, if siq>0)
1892 * 6) monom (resp. number), local ring
1893 * 7) monom (resp. number), non-local ring
1894 * 10) everything else is of type 0
1895 */
1896#ifdef TEST
1897 if ((*id<' ')||(*id>(char)126))
1898 {
1899 Print("wrong id :%s:\n",id);
1900 }
1901#endif
1903 v->Init();
1904 v->req_packhdl = currPack;
1905#ifdef SIQ
1906 if (siq<=0)
1907#endif
1908 {
1909 /* 6. local ring: number/poly */
1910 BOOLEAN ok=FALSE;
1911 poly p = pmInit(id,ok);
1912 if (ok)
1913 {
1914 if (p==NULL)
1915 {
1916 v->data = (void *)nInit(0);
1917 v->rtyp = NUMBER_CMD;
1918 #ifdef HAVE_PLURAL
1919 // in this case we may have monomials equal to 0 in p_Read
1920 if (rIsPluralRing(currRing)) v->name = omStrDup(id);
1921 #endif
1922 }
1923 else if (pIsConstant(p))
1924 {
1925 v->data = pGetCoeff(p);
1926 pGetCoeff(p)=NULL;
1927 pLmFree(p);
1928 v->rtyp = NUMBER_CMD;
1929 }
1930 else
1931 {
1932 v->name = omStrDup(id);
1933 #ifdef HAVE_SHIFTBBA
1934 if ((currRing->isLPring!=0)
1935 && (p_Totaldegree(p,currRing)>1))
1936 {
1938 /* v->rtyp = UNKNOWN; - already set */
1939 return; /* error, report "unknown id" */
1940 }
1941 #endif
1942 v->data = p;
1943 v->rtyp = POLY_CMD;
1944 }
1945 return;
1946 }
1947 }
1948#ifdef SIQ
1949 else
1950 {
1951 v->rtyp=DEF_CMD;
1952 }
1953#endif
1954 /* 9: _ */
1955 if (strcmp(id,"_")==0)
1956 {
1957 v->Copy(&sLastPrinted);
1958 }
1959 else
1960 {
1961 /* 10: everything else */
1962 /* v->rtyp = UNKNOWN;*/
1963 v->name = omStrDup(id);
1964 }
1966}
1967
1969{
1971 leftv nn=next;
1972 next=NULL;
1973 if(rtyp==IDHDL)
1974 {
1975 int t=Typ();
1976 if (t!=PROC_CMD)
1977 {
1978 void *d=CopyD(t);
1979 data=d;
1980 rtyp=t;
1981 name=NULL;
1982 e=NULL;
1983 }
1984 }
1985 else if (rtyp==COMMAND)
1986 {
1987 command d=(command)data;
1988 if(d->op==PROC_CMD) //assume d->argc==2
1989 {
1990 char *what=(char *)(d->arg1.Data());
1991 idhdl h=ggetid(what);
1992 if((h!=NULL)&&(IDTYP(h)==PROC_CMD))
1993 {
1994 nok=d->arg2.Eval();
1995 if(!nok)
1996 {
1997 nok=iiMake_proc(h,req_packhdl,&d->arg2);
1998 this->CleanUp(currRing);
1999 if (!nok)
2000 {
2001 memcpy(this,&iiRETURNEXPR,sizeof(sleftv));
2003 }
2004 }
2005 }
2006 else nok=TRUE;
2007 }
2008 else if (d->op=='=') //assume d->argc==2
2009 {
2010 if ((d->arg1.rtyp!=IDHDL)&&(d->arg1.rtyp!=DEF_CMD))
2011 {
2012 nok=d->arg1.Eval();
2013 }
2014 if (!nok)
2015 {
2016 const char *n=d->arg1.name;
2017 nok=(n == NULL) || d->arg2.Eval();
2018 if (!nok)
2019 {
2020 int save_typ=d->arg1.rtyp;
2021 omCheckAddr((ADDRESS)n);
2022 if (d->arg1.rtyp!=IDHDL)
2023 syMake(&d->arg1,n);
2024 omCheckAddr((ADDRESS)d->arg1.name);
2025 if (d->arg1.rtyp==IDHDL)
2026 {
2027 n=omStrDup(IDID((idhdl)d->arg1.data));
2028 killhdl((idhdl)d->arg1.data);
2029 d->arg1.Init();
2030 //d->arg1.data=NULL;
2031 d->arg1.name=n;
2032 }
2033 d->arg1.rtyp=DEF_CMD;
2034 sleftv t;
2035 if(save_typ!=PROC_CMD) save_typ=d->arg2.rtyp;
2036 if (::RingDependend(d->arg2.rtyp))
2037 nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&currRing->idroot);
2038 else
2039 nok=iiDeclCommand(&t,&d->arg1,0,save_typ,&IDROOT);
2040 memcpy(&d->arg1,&t,sizeof(sleftv));
2041 omCheckAddr((ADDRESS)d->arg1.name);
2042 nok=nok||iiAssign(&d->arg1,&d->arg2);
2043 omCheckIf(d->arg1.name != NULL, // OB: ????
2044 omCheckAddr((ADDRESS)d->arg1.name));
2045 if (!nok)
2046 {
2047 d->arg1.Init();
2048 this->CleanUp();
2049 rtyp=NONE;
2050 }
2051 }
2052 }
2053 else nok=TRUE;
2054 }
2055 else
2056 {
2057 sleftv tmp; tmp.Init();
2058 int toktype=iiTokType(d->op);
2059 if ((toktype==CMD_M)
2060 ||( toktype==ROOT_DECL_LIST)
2061 ||( toktype==RING_DECL_LIST))
2062 {
2063 if (d->argc <=3)
2064 {
2065 if (d->argc>=1) nok=d->arg1.Eval();
2066 if ((!nok) && (d->argc>=2))
2067 {
2068 nok=d->arg2.Eval();
2069 d->arg1.next=(leftv)omAllocBin(sleftv_bin);
2070 memcpy(d->arg1.next,&d->arg2,sizeof(sleftv));
2071 d->arg2.Init();
2072 }
2073 if ((!nok) && (d->argc==3))
2074 {
2075 nok=d->arg3.Eval();
2076 d->arg1.next->next=(leftv)omAllocBin(sleftv_bin);
2077 memcpy(d->arg1.next->next,&d->arg3,sizeof(sleftv));
2078 d->arg3.Init();
2079 }
2080 if (d->argc==0)
2081 nok=nok||iiExprArithM(&tmp,NULL,d->op);
2082 else
2083 nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
2084 }
2085 else
2086 {
2087 nok=d->arg1.Eval();
2088 nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
2089 }
2090 }
2091 else if (d->argc==1)
2092 {
2093 nok=d->arg1.Eval();
2094 nok=nok||iiExprArith1(&tmp,&d->arg1,d->op);
2095 }
2096 else if(d->argc==2)
2097 {
2098 nok=d->arg1.Eval();
2099 nok=nok||d->arg2.Eval();
2100 nok=nok||iiExprArith2(&tmp,&d->arg1,d->op,&d->arg2);
2101 }
2102 else if(d->argc==3)
2103 {
2104 nok=d->arg1.Eval();
2105 nok=nok||d->arg2.Eval();
2106 nok=nok||d->arg3.Eval();
2107 nok=nok||iiExprArith3(&tmp,d->op,&d->arg1,&d->arg2,&d->arg3);
2108 }
2109 else if(d->argc!=0)
2110 {
2111 nok=d->arg1.Eval();
2112 nok=nok||iiExprArithM(&tmp,&d->arg1,d->op);
2113 }
2114 else // d->argc == 0
2115 {
2116 nok = iiExprArithM(&tmp, NULL, d->op);
2117 }
2118 this->CleanUp();
2119 memcpy(this,&tmp,sizeof(tmp));
2120 }
2121 }
2122 else if (((rtyp==0)||(rtyp==DEF_CMD))
2123 &&(name!=NULL))
2124 {
2125 syMake(this,name);
2126 }
2127#ifdef MDEBUG
2128 switch(Typ())
2129 {
2130 case NUMBER_CMD:
2131#ifdef LDEBUG
2132 nTest((number)Data());
2133#endif
2134 break;
2135 case BIGINT_CMD:
2136#ifdef LDEBUG
2138#endif
2139 break;
2140 case POLY_CMD:
2141 pTest((poly)Data());
2142 break;
2143 case IDEAL_CMD:
2144 case MODUL_CMD:
2145 case MATRIX_CMD:
2146 {
2147 ideal id=(ideal)Data();
2148 omCheckAddrSize(id,sizeof(*id));
2149 int i=id->ncols*id->nrows-1;
2150 for(;i>=0;i--) pTest(id->m[i]);
2151 }
2152 break;
2153 }
2154#endif
2155 if (nn!=NULL) nok=nok||nn->Eval();
2156 next=nn;
2157 return nok;
2158}
2159
2161{
2162 omCheckAddrSize(this,sizeof(sattr));
2163 return s_internalCopy(atyp,data);
2164}
2165
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: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
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:2160
int atyp
Definition attrib.h:27
Class used for (list of) interpreter objects.
Definition subexpr.h:83
int Typ()
Definition subexpr.cc:1030
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:1173
void Init()
Definition subexpr.h:107
BOOLEAN RingDependend()
Definition subexpr.cc:418
leftv next
Definition subexpr.h:86
int Eval()
Definition subexpr.cc:1968
int LTyp()
Definition subexpr.cc:1137
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:1473
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:1487
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:569
static BOOLEAN pa(leftv res, leftv args)
Definition cohomo.cc:3722
#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:8949
BOOLEAN iiExprArith1(leftv res, leftv a, int op)
Definition iparith.cc:9138
BOOLEAN iiExprArithM(leftv res, leftv a, int op)
Definition iparith.cc:9439
BOOLEAN iiExprArith3(leftv res, int op, leftv a, leftv b, leftv c)
Definition iparith.cc:9348
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:1199
void rKill(ring r)
Definition ipshell.cc:6182
BOOLEAN iiCheckRing(int i)
Definition ipshell.cc:1587
lists syConvRes(syStrategy syzstr, BOOLEAN toDel, int add_row_shift)
Definition ipshell.cc:3184
void paPrint(const char *n, package p)
Definition ipshell.cc:6335
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: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
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: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:840
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)
#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:1581
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:1555
VAR omBin sleftv_bin
Definition subexpr.cc:41
void syMakeMonom(leftv v, const char *id)
Definition subexpr.cc:1885
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:1581
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 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)