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 1555 of file subexpr.cc.

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}
#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:1555

◆ s_internalCopy()

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

Definition at line 430 of file subexpr.cc.

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}
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:4082
CanonicalForm b
Definition cfModGcd.cc:4102
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:448
const char * Tok2Cmdname(int tok)
Definition gentable.cc:140
@ IDEAL_CMD
Definition grammar.cc:284
@ MATRIX_CMD
Definition grammar.cc:286
@ BUCKET_CMD
Definition grammar.cc:283
@ BIGINTMAT_CMD
Definition grammar.cc:278
@ MAP_CMD
Definition grammar.cc:285
@ PROC_CMD
Definition grammar.cc:280
@ INTMAT_CMD
Definition grammar.cc:279
@ MODUL_CMD
Definition grammar.cc:287
@ 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
@ RING_CMD
Definition grammar.cc:281
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:840
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:1884
@ 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:149
@ 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:185
@ CPOLY_CMD
Definition tok.h:48
@ INT_CMD
Definition tok.h:96
@ MAX_TOK
Definition tok.h:218
#define NONE
Definition tok.h:221

◆ s_internalDelete()

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

Definition at line 514 of file subexpr.cc.

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}
int l
Definition cfEzgcd.cc:100
int m
Definition cfEzgcd.cc:128
int i
Definition cfEzgcd.cc:132
int p
Definition cfModGcd.cc:4077
@ 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:452
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition coeffs.h:960
void nKillChar(coeffs r)
undo all initialisations
Definition numbers.cc:569
#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:307
@ VMAXDEG
Definition grammar.cc:306
@ VMINPOLY
Definition grammar.cc:309
@ VNOETHER
Definition grammar.cc:308
VAR omBin sip_command_bin
Definition ipid.cc:45
BOOLEAN piKill(procinfov pi)
Definition ipid.cc:724
ip_command * command
Definition ipid.h:23
void rKill(ring r)
Definition ipshell.cc:6182
#define assume(x)
Definition mod2.h:389
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:209
@ ALIAS_CMD
Definition tok.h:34
@ VSHORTOUT
Definition tok.h:214
@ VPRINTLEVEL
Definition tok.h:215
@ VECHO
Definition tok.h:208
@ TRACE
Definition tok.h:212
@ VTIMER
Definition tok.h:210
@ VRTIMER
Definition tok.h:211
@ VOICE
Definition tok.h:213
#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 1581 of file subexpr.cc.

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}
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:775
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition coeffs.h:771
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
static BOOLEAN pa(leftv res, leftv args)
Definition cohomo.cc:3722
int j
Definition facHensel.cc:110
VAR int myynest
Definition febase.cc:41
VAR BOOLEAN yyInRingConstruction
Definition grammar.cc:172
idhdl ggetid(const char *n)
Definition ipid.cc:558
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:212
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 1885 of file subexpr.cc.

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}
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition ring.h:400

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.