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