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

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

◆ s_internalCopy()

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

Definition at line 431 of file subexpr.cc.

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

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}
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:726
ip_command * command
Definition ipid.h:23
void rKill(ring r)
Definition ipshell.cc:6182
#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 1612 of file subexpr.cc.

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}
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:3722
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:560
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 1916 of file subexpr.cc.

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}
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.