My Project
Loading...
Searching...
No Matches
Functions | Variables
subexpr.cc File Reference
#include "kernel/mod2.h"
#include "omalloc/omalloc.h"
#include "misc/intvec.h"
#include "misc/options.h"
#include "coeffs/numbers.h"
#include "coeffs/bigintmat.h"
#include "coeffs/ffields.h"
#include "polys/monomials/maps.h"
#include "polys/matpol.h"
#include "polys/monomials/ring.h"
#include "kernel/polys.h"
#include "kernel/ideals.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/syz.h"
#include "kernel/oswrapper/timer.h"
#include "Singular/tok.h"
#include "Singular/ipid.h"
#include "Singular/ipshell.h"
#include "Singular/lists.h"
#include "Singular/attrib.h"
#include "Singular/links/silink.h"
#include "Singular/ipprint.h"
#include "Singular/subexpr.h"
#include "Singular/blackbox.h"
#include "Singular/number2.h"
#include <ctype.h>

Go to the source code of this file.

Functions

static voids_internalCopy (const int t, void *d)
 
void s_internalDelete (const int t, void *d, const ring r)
 
BOOLEAN assumeStdFlag (leftv h)
 
void syMake (leftv v, const char *id, package pa)
 
void syMakeMonom (leftv v, const char *id)
 

Variables

VAR omBin sSubexpr_bin = omGetSpecBin(sizeof(_ssubexpr))
 
VAR omBin sleftv_bin = omGetSpecBin(sizeof(sleftv))
 
VAR omBin procinfo_bin = omGetSpecBin(sizeof(procinfo))
 
VAR omBin libstack_bin = omGetSpecBin(sizeof(libstack))
 
STATIC_VAR omBin size_two_bin = omGetSpecBin(2)
 
INST_VAR sleftv sLastPrinted
 
VAR BOOLEAN siq =FALSE
 

Function Documentation

◆ assumeStdFlag()

BOOLEAN assumeStdFlag ( leftv  h)

Definition at line 1588 of file subexpr.cc.

1589{
1590 if (h->e!=NULL)
1591 {
1592 leftv hh=h->LData();
1593 if (h!=hh) return assumeStdFlag(h->LData());
1594 }
1595 if (!hasFlag(h,FLAG_STD))
1596 {
1597 if (!TEST_VERB_NSB)
1598 {
1599 if (TEST_V_ALLWARN)
1600 Warn("%s is no standard basis in >>%s<<",h->Name(),my_yylinebuf);
1601 else
1602 Warn("%s is no standard basis",h->Name());
1603 }
1604 return FALSE;
1605 }
1606 return TRUE;
1607}
#define TRUE
Definition auxiliary.h:100
#define FALSE
Definition auxiliary.h:96
Class used for (list of) interpreter objects.
Definition subexpr.h:83
#define Warn
Definition emacs.cc:77
VAR char my_yylinebuf[80]
Definition febase.cc:44
#define hasFlag(A, F)
Definition ipid.h:112
#define FLAG_STD
Definition ipid.h:106
STATIC_VAR Poly * h
Definition janet.cc:971
#define NULL
Definition omList.c:12
#define TEST_V_ALLWARN
Definition options.h:142
#define TEST_VERB_NSB
Definition options.h:136
BOOLEAN assumeStdFlag(leftv h)
Definition subexpr.cc:1588

◆ s_internalCopy()

static void * s_internalCopy ( const int  t,
void d 
)
inlinestatic

Definition at line 433 of file subexpr.cc.

434{
435 switch (t)
436 {
437 case CRING_CMD:
438 {
439 coeffs cf=(coeffs)d;
440 cf->ref++;
441 return (void*)d;
442 }
443#ifdef SINGULAR_4_2
444 case CNUMBER_CMD:
445 return (void*)n2Copy((number2)d);
446 case CPOLY_CMD:
447 return (void*)p2Copy((poly2)d);
448 case CMATRIX_CMD: // like BIGINTMAT
449#endif
450 case BIGINTMAT_CMD:
451 case BIGINTVEC_CMD:
452 return (void*)bimCopy((bigintmat *)d);
453 case BUCKET_CMD:
454 return (void*)sBucketCopy((sBucket_pt)d);
455 case INTVEC_CMD:
456 case INTMAT_CMD:
457 return (void *)ivCopy((intvec *)d);
458 case MATRIX_CMD:
459 return (void *)mp_Copy((matrix)d, currRing);
460 case SMATRIX_CMD:
461 case IDEAL_CMD:
462 case MODUL_CMD:
463 return (void *)idCopy((ideal)d);
464 case STRING_CMD:
465 return (void *)omStrDup((char *)d);
466 case PACKAGE_CMD:
467 return (void *)paCopy((package) d);
468 case PROC_CMD:
469 return (void *)piCopy((procinfov) d);
470 case POLY_CMD:
471 case VECTOR_CMD:
472 return (void *)pCopy((poly)d);
473 case INT_CMD:
474 return d;
475 case NUMBER_CMD:
476 return (void *)nCopy((number)d);
477 case BIGINT_CMD:
478 return (void *)n_Copy((number)d, coeffs_BIGINT);
479 case MAP_CMD:
480 return (void *)maCopy((map)d, currRing);
481 case LIST_CMD:
482 return (void *)lCopy((lists)d);
483 case LINK_CMD:
484 return (void *)slCopy((si_link) d);
485 case RING_CMD:
486 {
487 ring r=(ring)d;
488 if (r!=NULL)
489 {
490 rIncRefCnt(r);
491 //Print("s_internalCopy:+ ring %lx, ref %d\n",r,r->ref);
492 }
493 return d;
494 }
495 case RESOLUTION_CMD:
496 return (void*)syCopy((syStrategy)d);
497 case DEF_CMD:
498 case NONE:
499 case 0: /* type in error case */
500 break; /* error recovery: do nothing */
501 //case COMMAND:
502 default:
503 {
504 if (t>MAX_TOK)
505 {
507 if (b!=NULL) return b->blackbox_Copy(b,d);
508 return NULL;
509 }
510 else
511 Warn("s_internalCopy: cannot copy type %s(%d)",
512 Tok2Cmdname(t),t);
513 }
514 }
515 return NULL;
516}
bigintmat * bimCopy(const bigintmat *b)
same as copy constructor - apart from it being able to accept NULL as input
Definition bigintmat.cc:405
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition blackbox.cc:17
CanonicalForm cf
Definition cfModGcd.cc:4091
CanonicalForm b
Definition cfModGcd.cc:4111
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Matrices of numbers.
Definition bigintmat.h:51
Definition lists.h:24
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition coeffs.h:455
const char * Tok2Cmdname(int tok)
Definition gentable.cc:140
@ IDEAL_CMD
Definition grammar.cc:285
@ MATRIX_CMD
Definition grammar.cc:287
@ BUCKET_CMD
Definition grammar.cc:284
@ BIGINTMAT_CMD
Definition grammar.cc:278
@ MAP_CMD
Definition grammar.cc:286
@ PROC_CMD
Definition grammar.cc:281
@ INTMAT_CMD
Definition grammar.cc:280
@ MODUL_CMD
Definition grammar.cc:288
@ 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
@ RING_CMD
Definition grammar.cc:282
ideal idCopy(ideal A)
Definition ideals.h:60
intvec * ivCopy(const intvec *o)
Definition intvec.h:145
VAR coeffs coeffs_BIGINT
Definition ipid.cc:50
package paCopy(package pack)
Definition ipid.h:44
lists lCopy(lists L)
Definition lists.cc:32
map maCopy(map theMap, const ring r)
Definition maps.cc:32
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition matpol.cc:57
The main handler for Singular numbers which are suitable for Singular polynomials.
#define nCopy(n)
Definition numbers.h:15
#define omStrDup(s)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
#define pCopy(p)
return a copy of the poly
Definition polys.h:185
static ring rIncRefCnt(ring r)
Definition ring.h:846
sBucket_pt sBucketCopy(const sBucket_pt bucket)
Copy sBucket non-intrusive!!!
Definition sbuckets.cc:70
ip_package * package
Definition structs.h:43
procinfov piCopy(procinfov pi)
Definition subexpr.h:149
syStrategy syCopy(syStrategy syzstr)
Definition syz1.cc:1885
@ BIGINT_CMD
Definition tok.h:38
@ CRING_CMD
Definition tok.h:56
@ LIST_CMD
Definition tok.h:118
@ INTVEC_CMD
Definition tok.h:101
@ PACKAGE_CMD
Definition tok.h:150
@ CMATRIX_CMD
Definition tok.h:46
@ DEF_CMD
Definition tok.h:58
@ CNUMBER_CMD
Definition tok.h:47
@ LINK_CMD
Definition tok.h:117
@ STRING_CMD
Definition tok.h:187
@ CPOLY_CMD
Definition tok.h:48
@ INT_CMD
Definition tok.h:96
@ MAX_TOK
Definition tok.h:220
#define NONE
Definition tok.h:223

◆ s_internalDelete()

void s_internalDelete ( const int  t,
void d,
const ring  r 
)

Definition at line 518 of file subexpr.cc.

519{
520 assume(d!=NULL);
521 switch (t)
522 {
523 case CRING_CMD:
524 {
525 coeffs cf=(coeffs)d;
526 if ((cf->ref<1)&&
527 ((cf->type <=n_GF)
528 ||((cf->type >=n_long_C)&&(cf->type <=n_CF))))
529 {
530 Warn("cannot kill `%s`",nCoeffName(cf));
531 }
532 else // allow nKillChar for n_long_R, extensions, and user defined:
533 nKillChar((coeffs)d);
534 break;
535 }
536#ifdef SINGULAR_4_2
537 case CNUMBER_CMD:
538 {
539 number2 n=(number2)d;
540 n2Delete(n);
541 break;
542 }
543 case CPOLY_CMD:
544 {
545 poly2 n=(poly2)d;
546 p2Delete(n);
547 break;
548 }
549 case CMATRIX_CMD: //like BIGINTMAT
550#endif
551 case BIGINTMAT_CMD:
552 case BIGINTVEC_CMD:
553 {
554 bigintmat *v=(bigintmat*)d;
555 delete v;
556 break;
557 }
558 case BUCKET_CMD:
559 {
562 break;
563 }
564 case INTVEC_CMD:
565 case INTMAT_CMD:
566 {
567 intvec *v=(intvec*)d;
568 delete v;
569 break;
570 }
571 case MAP_CMD:
572 {
573 map m=(map)d;
574 omFreeBinAddr((ADDRESS)m->preimage);
575 m->preimage=NULL;
576 /* no break: continue as IDEAL*/
577 }
578 case SMATRIX_CMD:
579 case MATRIX_CMD:
580 case IDEAL_CMD:
581 case MODUL_CMD:
582 {
583 ideal i=(ideal)d;
584 id_Delete(&i,r);
585 break;
586 }
587 case STRING_CMD:
588 omFree(d);
589 break;
590 //case PACKAGE_CMD:
591 // return (void *)paCopy((package) d);
592 case PROC_CMD:
593 piKill((procinfo*)d);
594 break;
595 case POLY_CMD:
596 case VECTOR_CMD:
597 {
598 poly p=(poly)d;
599 p_Delete(&p,r);
600 break;
601 }
602 case NUMBER_CMD:
603 {
604 number n=(number)d;
605 n_Delete(&n,r->cf);
606 break;
607 }
608 case BIGINT_CMD:
609 {
610 number n=(number)d;
612 break;
613 }
614 case LIST_CMD:
615 {
616 lists l=(lists)d;
617 l->Clean(r);
618 break;
619 }
620 case LINK_CMD:
621 {
622 si_link l=(si_link)d;
623 slKill(l);
624 break;
625 }
626 case RING_CMD:
627 {
628 ring R=(ring)d;
629 if ((R!=currRing)||(R->ref>=0))
630 rKill(R);
631 #ifdef TEST
632 else
633 Print("currRing? ref=%d\n",R->ref);
634 #endif
635 break;
636 }
637 case RESOLUTION_CMD:
638 {
640 if (s!=NULL) syKillComputation(s,r);
641 break;
642 }
643 case COMMAND:
644 {
645 command cmd=(command)d;
646 if (cmd->arg1.rtyp!=0) cmd->arg1.CleanUp(r);
647 if (cmd->arg2.rtyp!=0) cmd->arg2.CleanUp(r);
648 if (cmd->arg3.rtyp!=0) cmd->arg3.CleanUp(r);
650 break;
651 }
652 case INT_CMD:
653 case DEF_CMD:
654 case ALIAS_CMD:
655 case PACKAGE_CMD:
656 case IDHDL:
657 case NONE:
658 case ANY_TYPE:
659 case VECHO:
660 case VPRINTLEVEL:
661 case VCOLMAX:
662 case VTIMER:
663 case VRTIMER:
664 case VOICE:
665 case VMAXDEG:
666 case VMAXMULT:
667 case TRACE:
668 case VSHORTOUT:
669 case VNOETHER:
670 case VMINPOLY:
671 case 0: /* type in error case */
672 break; /* error recovery: do nothing */
673 //case COMMAND:
674 //case COMMAND:
675 default:
676 {
677 if (t>MAX_TOK)
678 {
680 if (b!=NULL) b->blackbox_destroy(b,d);
681 break;
682 }
683 else
684 Warn("s_internalDelete: cannot delete type %s(%d)",
685 Tok2Cmdname(t),t);
686 }
687 }
688}
int l
Definition cfEzgcd.cc:100
int m
Definition cfEzgcd.cc:128
int i
Definition cfEzgcd.cc:132
int p
Definition cfModGcd.cc:4086
@ 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 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
void nKillChar(coeffs r)
undo all initialisations
Definition numbers.cc:574
#define Print
Definition emacs.cc:80
const CanonicalForm int s
Definition facAbsFact.cc:51
const Variable & v
< [in] a sqrfree bivariate poly
Definition facBivar.h:39
@ VMAXMULT
Definition grammar.cc:308
@ VMAXDEG
Definition grammar.cc:307
@ VMINPOLY
Definition grammar.cc:310
@ VNOETHER
Definition grammar.cc:309
VAR omBin sip_command_bin
Definition ipid.cc:45
BOOLEAN piKill(procinfov pi)
Definition ipid.cc:749
ip_command * command
Definition ipid.h:23
void rKill(ring r)
Definition ipshell.cc:6189
#define assume(x)
Definition mod2.h:387
slists * lists
#define omFree(addr)
#define omFreeBin(addr, bin)
#define omFreeBinAddr(addr)
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:901
void sBucketDeleteAndDestroy(sBucket_pt *bucket_pt)
Definition sbuckets.cc:110
sBucket * sBucket_pt
Definition sbuckets.h:16
void id_Delete(ideal *h, ring r)
deletes an ideal/module/matrix
#define R
Definition sirandom.c:27
void syKillComputation(syStrategy syzstr, ring r=currRing)
Definition syz1.cc:1495
ssyStrategy * syStrategy
Definition syz.h:36
#define IDHDL
Definition tok.h:31
@ VCOLMAX
Definition tok.h:211
@ ALIAS_CMD
Definition tok.h:34
@ VSHORTOUT
Definition tok.h:216
@ VPRINTLEVEL
Definition tok.h:217
@ VECHO
Definition tok.h:210
@ TRACE
Definition tok.h:214
@ VTIMER
Definition tok.h:212
@ VRTIMER
Definition tok.h:213
@ VOICE
Definition tok.h:215
#define COMMAND
Definition tok.h:29
#define ANY_TYPE
Definition tok.h:30

◆ syMake()

void syMake ( leftv  v,
const char id,
package  pa 
)

Definition at line 1614 of file subexpr.cc.

1615{
1616 /* resolv an identifier: (to DEF_CMD, if siq>0)
1617 * 1) reserved id: done by scanner
1618 * 2) `basering` / 'Current`
1619 * 3) existing identifier, local
1620 * 4) ringvar, ringpar, local ring
1621 * 5) existing identifier, global
1622 * 6a) int/bigint
1623 * 6b) monom (resp. number), local ring: consisting of:
1624 * 6') ringvar, ringpar,global ring
1625 * 6'') monom (resp. number), local ring
1626 * 7) monom (resp. number), non-local ring
1627 * 8) basering
1628 * 9) `_`
1629 * 10) everything else is of type 0
1630 */
1631#ifdef TEST
1632 if ((*id<' ')||(*id>(char)126))
1633 {
1634 Print("wrong id :%s:\n",id);
1635 }
1636#endif
1638 v->Init();
1639 if(pa != NULL)
1640 {
1641 v->req_packhdl = pa;
1642 }
1643 else v->req_packhdl = currPack;
1644// if (v->req_packhdl!=basePack)
1645// Print("search %s in %s\n",id,v->req_packhdl->libname);
1646 idhdl h=NULL;
1647#ifdef SIQ
1648 if (siq<=0)
1649#endif
1650 {
1651 if (id[0]=='#')
1652 {
1653 h=ggetid(id);
1654 /* 3) existing identifier, local */
1655 if ((h!=NULL) && (IDLEV(h)==myynest))
1656 {
1657 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1658 goto id_found;
1659 }
1660 }
1661 else if ((id[0]!='-')&&(id[0]>='@' /* letters, _ */))
1662 {
1663 if (strcmp(id,"basering")==0)
1664 {
1665 if (currRingHdl!=NULL)
1666 {
1667 if (id!=IDID(currRingHdl)) omFreeBinAddr((ADDRESS)id);
1668 h=currRingHdl;
1669 goto id_found;
1670 }
1671 else
1672 {
1673 v->name = id;
1674 return; /* undefined */
1675 }
1676 }
1677 else if (strcmp(id,"Current")==0)
1678 {
1679 if (currPackHdl!=NULL)
1680 {
1682 h=currPackHdl;
1683 goto id_found;
1684 }
1685 else
1686 {
1687 v->name = id;
1688 return; /* undefined */
1689 }
1690 }
1691 if(v->req_packhdl!=currPack)
1692 {
1693 h=v->req_packhdl->idroot->get(id,myynest);
1694 }
1695 else
1696 {
1697 h=ggetid(id);
1698 }
1699 /* 3) existing identifier, local */
1700 if ((h!=NULL) && (IDLEV(h)==myynest))
1701 {
1702 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1703 goto id_found;
1704 }
1706 {
1708 }
1709 /* 4. local ring: ringvar */
1711 /*&& (!yyInRingConstruction)*/)
1712 {
1713 int vnr;
1714 if ((vnr=r_IsRingVar(id, currRing->names,currRing->N))>=0)
1715 {
1716 poly p=pOne();
1717 pSetExp(p,vnr+1,1);
1718 pSetm(p);
1719 v->data = (void *)p;
1720 v->name = id;
1721 v->rtyp = POLY_CMD;
1722 return;
1723 }
1724 if((n_NumberOfParameters(currRing->cf)>0)
1725 &&((vnr=r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1726 n_NumberOfParameters(currRing->cf))>=0)))
1727 {
1728 BOOLEAN ok=FALSE;
1729 poly p = pmInit(id,ok);
1730 if (ok && (p!=NULL))
1731 {
1732 v->data = pGetCoeff(p);
1733 pGetCoeff(p)=NULL;
1734 pLmFree(p);
1735 v->rtyp = NUMBER_CMD;
1736 v->name = id;
1737 return;
1738 }
1739 }
1740 }
1741 /* 5. existing identifier, global */
1742 if (h!=NULL)
1743 {
1744 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1745 goto id_found;
1746 }
1747 }
1748 else
1749 {
1750 /* 6a: int/bigint */
1751 int i=0;
1752 if (id[0]=='-') { i=1; }
1753 while(isdigit(id[i])) i++;
1754 if (id[i]=='\0')
1755 {
1756 int j=atoi(id);
1757 char tmp[MAX_INT_LEN+5];
1758 snprintf(tmp,MAX_INT_LEN+5,"%d",j);
1759 if (strcmp(tmp,id)!=0)
1760 {
1761 number n;
1762 n_Read(id,&n,coeffs_BIGINT);
1763 v->rtyp=BIGINT_CMD;
1764 v->data = n;
1765 }
1766 else
1767 {
1768 v->data=(void*)(long)j;
1769 v->rtyp=INT_CMD;
1770 }
1772 return;
1773 }
1774 }
1775 /* 6b local ring: number/poly */
1777 {
1778 BOOLEAN ok=FALSE;
1779 /*poly p = (!yyInRingConstruction) ? pmInit(id,ok) : (poly)NULL;*/
1780 poly p = pmInit(id,ok);
1781 if (ok)
1782 {
1783 if (p==NULL)
1784 {
1785 v->data = (void *)nInit(0);
1786 v->rtyp = NUMBER_CMD;
1787 #ifdef HAVE_PLURAL
1788 // in this case we may have monomials equal to 0 in p_Read
1789 v->name = id;
1790 #else
1792 #endif
1793 }
1794 else if (pIsConstant(p))
1795 {
1796 v->data = pGetCoeff(p);
1797 pGetCoeff(p)=NULL;
1798 pLmFree(p);
1799 v->rtyp = NUMBER_CMD;
1800 v->name = id;
1801 }
1802 else
1803 {
1804 v->name = id;
1805 #ifdef HAVE_SHIFTBBA
1806 if ((currRing->isLPring!=0)
1807 && (p_Totaldegree(p,currRing)>1))
1808 {
1810 /* v->rtyp = UNKNOWN; - already set */
1811 return; /* error, report "unknown id" */
1812 }
1813 #endif
1814 v->data = p;
1815 v->rtyp = POLY_CMD;
1816 }
1817 return;
1818 }
1819 }
1820 /* 7. non-local ring: number/poly */
1821 {
1822 BOOLEAN ok=FALSE;
1823 poly p = ((currRing!=NULL) /* ring required */
1824 && (currRingHdl!=NULL)
1825 /*&& (!yyInRingConstruction) - not in decl */
1826 && (IDLEV(currRingHdl)!=myynest)) /* already in case 4/6 */
1827 ? pmInit(id,ok) : (poly)NULL;
1828 if (ok)
1829 {
1830 if (p==NULL)
1831 {
1832 v->data = (void *)nInit(0);
1833 v->rtyp = NUMBER_CMD;
1835 }
1836 else
1837 if (pIsConstant(p))
1838 {
1839 v->data = pGetCoeff(p);
1840 pGetCoeff(p)=NULL;
1841 pLmFree(p);
1842 v->rtyp = NUMBER_CMD;
1843 v->name = id;
1844 }
1845 else
1846 {
1847 v->data = p;
1848 v->rtyp = POLY_CMD;
1849 v->name = id;
1850 }
1851 //if (TEST_V_ALLWARN /*&& (myynest>0)*/
1852 //&& ((r_IsRingVar(id, currRing->names,currRing->N)>=0)
1853 // || ((n_NumberOfParameters(currRing->cf)>0)
1854 // &&(r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1855 // n_NumberOfParameters(currRing->cf))>=0))))
1856 //{
1857 //// WARNING: do not use ring variable names in procedures
1858 // Warn("use of variable >>%s<< in a procedure in line %s",id,my_yylinebuf);
1859 //}
1860 return;
1861 }
1862 }
1863 /* 8. basering ? */
1864 if ((myynest>1)&&(currRingHdl!=NULL))
1865 {
1866 if (strcmp(id,IDID(currRingHdl))==0)
1867 {
1868 if (IDID(currRingHdl)!=id) omFreeBinAddr((ADDRESS)id); /*assume strlen (id) <1000 */
1869 h=currRingHdl;
1870 goto id_found;
1871 }
1872 }
1873 if((v->req_packhdl!=basePack) && (v->req_packhdl==currPack))
1874 {
1875 h=basePack->idroot->get(id,myynest);
1876 if (h!=NULL)
1877 {
1878 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1879 v->req_packhdl=basePack;
1880 goto id_found;
1881 }
1882 }
1883 }
1884#ifdef SIQ
1885 else
1886 v->rtyp=DEF_CMD;
1887#endif
1888 /* 9: _ */
1889 if (strcmp(id,"_")==0)
1890 {
1892 v->Copy(&sLastPrinted);
1893 }
1894 else
1895 {
1896 /* 10: everything else */
1897 /* v->rtyp = UNKNOWN;*/
1898 v->name = id;
1899 }
1901 return;
1902id_found: // we have an id (in h) found, to set the data in from h
1903 if (IDTYP(h)!=ALIAS_CMD)
1904 {
1905 v->rtyp = IDHDL;
1906 v->flag = IDFLAG(h);
1907 v->attribute=IDATTR(h);
1908 }
1909 else
1910 {
1911 v->rtyp = ALIAS_CMD;
1912 }
1913 v->name = IDID(h);
1914 v->data = (char *)h;
1916}
int BOOLEAN
Definition auxiliary.h:87
char name() const
Definition variable.cc:122
Definition idrec.h:35
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 int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition coeffs.h:778
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
static BOOLEAN pa(leftv res, leftv args)
Definition cohomo.cc:3770
int j
Definition facHensel.cc:110
VAR int myynest
Definition febase.cc:41
BOOLEAN yyInRingConstruction
Definition grammar.cc:172
idhdl ggetid(const char *n)
Definition ipid.cc:583
VAR package basePack
Definition ipid.cc:58
VAR idhdl currRingHdl
Definition ipid.cc:59
VAR package currPack
Definition ipid.cc:57
VAR idhdl currPackHdl
Definition ipid.cc:55
#define IDFLAG(a)
Definition ipid.h:120
#define IDID(a)
Definition ipid.h:122
#define IDLEV(a)
Definition ipid.h:121
#define IDTYP(a)
Definition ipid.h:119
#define IDATTR(a)
Definition ipid.h:123
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
const int MAX_INT_LEN
Definition mylimits.h:13
#define nInit(i)
Definition numbers.h:24
static void p_LmDelete(poly p, const ring r)
Definition p_polys.h:723
static long p_Totaldegree(poly p, const ring r)
Definition p_polys.h:1507
#define pSetm(p)
Definition polys.h:271
#define pIsConstant(p)
like above, except that Comp must be 0
Definition polys.h:238
#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
#define pOne()
Definition polys.h:315
int r_IsRingVar(const char *n, char **names, int N)
Definition ring.cc:213
INST_VAR sleftv sLastPrinted
Definition subexpr.cc:46
VAR BOOLEAN siq
Definition subexpr.cc:48

◆ syMakeMonom()

void syMakeMonom ( leftv  v,
const char id 
)

Definition at line 1918 of file subexpr.cc.

1919{
1920 if (!isdigit(id[0]))
1921 {
1922 Print("non-digit:%s\n",id);
1923 }
1924 /* resolv an identifier: (to DEF_CMD, if siq>0)
1925 * 6) monom (resp. number), local ring
1926 * 7) monom (resp. number), non-local ring
1927 * 10) everything else is of type 0
1928 */
1929#ifdef TEST
1930 if ((*id<' ')||(*id>(char)126))
1931 {
1932 Print("wrong id :%s:\n",id);
1933 }
1934#endif
1936 v->Init();
1937 v->req_packhdl = currPack;
1938#ifdef SIQ
1939 if (siq<=0)
1940#endif
1941 {
1942 /* 6. local ring: number/poly */
1943 BOOLEAN ok=FALSE;
1944 poly p = pmInit(id,ok);
1945 if (ok)
1946 {
1947 if (p==NULL)
1948 {
1949 v->data = (void *)nInit(0);
1950 v->rtyp = NUMBER_CMD;
1951 #ifdef HAVE_PLURAL
1952 // in this case we may have monomials equal to 0 in p_Read
1953 if (rIsPluralRing(currRing)) v->name = omStrDup(id);
1954 #endif
1955 }
1956 else if (pIsConstant(p))
1957 {
1958 v->data = pGetCoeff(p);
1959 pGetCoeff(p)=NULL;
1960 pLmFree(p);
1961 v->rtyp = NUMBER_CMD;
1962 }
1963 else
1964 {
1965 v->name = omStrDup(id);
1966 #ifdef HAVE_SHIFTBBA
1967 if ((currRing->isLPring!=0)
1968 && (p_Totaldegree(p,currRing)>1))
1969 {
1971 /* v->rtyp = UNKNOWN; - already set */
1972 return; /* error, report "unknown id" */
1973 }
1974 #endif
1975 v->data = p;
1976 v->rtyp = POLY_CMD;
1977 }
1978 return;
1979 }
1980 }
1981#ifdef SIQ
1982 else
1983 {
1984 v->rtyp=DEF_CMD;
1985 }
1986#endif
1987 /* 9: _ */
1988 if (strcmp(id,"_")==0)
1989 {
1990 v->Copy(&sLastPrinted);
1991 }
1992 else
1993 {
1994 /* 10: everything else */
1995 /* v->rtyp = UNKNOWN;*/
1996 v->name = omStrDup(id);
1997 }
1999}
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:405

Variable Documentation

◆ libstack_bin

VAR omBin libstack_bin = omGetSpecBin(sizeof(libstack))

Definition at line 43 of file subexpr.cc.

◆ procinfo_bin

VAR omBin procinfo_bin = omGetSpecBin(sizeof(procinfo))

Definition at line 42 of file subexpr.cc.

◆ siq

Definition at line 48 of file subexpr.cc.

◆ size_two_bin

STATIC_VAR omBin size_two_bin = omGetSpecBin(2)

Definition at line 44 of file subexpr.cc.

◆ sLastPrinted

INST_VAR sleftv sLastPrinted

Definition at line 46 of file subexpr.cc.

◆ sleftv_bin

Definition at line 41 of file subexpr.cc.

◆ sSubexpr_bin

Definition at line 40 of file subexpr.cc.