My Project
Loading...
Searching...
No Matches
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 void * s_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 1587 of file subexpr.cc.

1588{
1589 if (h->e!=NULL)
1590 {
1591 leftv hh=h->LData();
1592 if (h!=hh) return assumeStdFlag(h->LData());
1593 }
1594 if (!hasFlag(h,FLAG_STD))
1595 {
1596 if (!TEST_VERB_NSB)
1597 {
1598 if (TEST_V_ALLWARN)
1599 Warn("%s is no standard basis in >>%s<<",h->Name(),my_yylinebuf);
1600 else
1601 Warn("%s is no standard basis",h->Name());
1602 }
1603 return FALSE;
1604 }
1605 return TRUE;
1606}
#define TRUE
Definition auxiliary.h:101
#define FALSE
Definition auxiliary.h:97
#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:145
#define TEST_VERB_NSB
Definition options.h:139
sleftv * leftv
Definition structs.h:53
BOOLEAN assumeStdFlag(leftv h)
Definition subexpr.cc:1587

◆ 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 {
506 blackbox *b=getBlackboxStuff(t);
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:403
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
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:137
@ 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:146
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
ip_smatrix * matrix
Definition matpol.h:43
slists * lists
The main handler for Singular numbers which are suitable for Singular polynomials.
#define nCopy(n)
Definition numbers.h:15
#define omStrDup(s)
VAR coeffs coeffs_BIGINT
Definition polys.cc:14
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:186
static ring rIncRefCnt(ring r)
Definition ring.h:849
sBucket_pt sBucketCopy(const sBucket_pt bucket)
Copy sBucket non-intrusive!!!
Definition sbuckets.cc:70
sBucket * sBucket_pt
Definition sbuckets.h:16
ip_package * package
Definition structs.h:39
procinfo * procinfov
Definition structs.h:56
procinfov piCopy(procinfov pi)
Definition subexpr.h:149
syStrategy syCopy(syStrategy syzstr)
Definition syz1.cc:1885
ssyStrategy * syStrategy
Definition syz.h:36
@ 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; /* no break: continue as IDEAL*/
576 }
577 case SMATRIX_CMD:
578 case MATRIX_CMD:
579 case IDEAL_CMD:
580 case MODUL_CMD:
581 {
582 ideal i=(ideal)d;
583 id_Delete(&i,r);
584 break;
585 }
586 case STRING_CMD:
587 omFree(d);
588 break;
589 //case PACKAGE_CMD:
590 // return (void *)paCopy((package) d);
591 case PROC_CMD:
592 piKill((procinfo*)d);
593 break;
594 case POLY_CMD:
595 case VECTOR_CMD:
596 {
597 poly p=(poly)d;
598 p_Delete(&p,r);
599 break;
600 }
601 case NUMBER_CMD:
602 {
603 number n=(number)d;
604 n_Delete(&n,r->cf);
605 break;
606 }
607 case BIGINT_CMD:
608 {
609 number n=(number)d;
611 break;
612 }
613 case LIST_CMD:
614 {
615 lists l=(lists)d;
616 l->Clean(r);
617 break;
618 }
619 case LINK_CMD:
620 {
621 si_link l=(si_link)d;
622 slKill(l);
623 break;
624 }
625 case RING_CMD:
626 {
627 ring R=(ring)d;
628 if ((R!=currRing)||(R->ref>=0))
629 rKill(R);
630 #ifdef TEST
631 else
632 Print("currRing? ref=%d\n",R->ref);
633 #endif
634 break;
635 }
636 case RESOLUTION_CMD:
637 {
639 if (s!=NULL) syKillComputation(s,r);
640 break;
641 }
642 case COMMAND:
643 {
644 command cmd=(command)d;
645 if (cmd->arg1.rtyp!=0) cmd->arg1.CleanUp(r);
646 if (cmd->arg2.rtyp!=0) cmd->arg2.CleanUp(r);
647 if (cmd->arg3.rtyp!=0) cmd->arg3.CleanUp(r);
649 break;
650 }
651 case INT_CMD:
652 case DEF_CMD:
653 case ALIAS_CMD:
654 case PACKAGE_CMD:
655 case IDHDL:
656 case NONE:
657 case ANY_TYPE:
658 case VECHO:
659 case VPRINTLEVEL:
660 case VCOLMAX:
661 case VTIMER:
662 case VRTIMER:
663 case VOICE:
664 case VMAXDEG:
665 case VMAXMULT:
666 case TRACE:
667 case VSHORTOUT:
668 case VNOETHER:
669 case VMINPOLY:
670 case 0: /* type in error case */
671 break; /* error recovery: do nothing */
672 //case COMMAND:
673 //case COMMAND:
674 default:
675 {
676 if (t>MAX_TOK)
677 {
678 blackbox *b=getBlackboxStuff(t);
679 if (b!=NULL) b->blackbox_destroy(b,d);
680 break;
681 }
682 else
683 Warn("s_internalDelete: cannot delete type %s(%d)",
684 Tok2Cmdname(t),t);
685 }
686 }
687}
void * ADDRESS
Definition auxiliary.h:120
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:960
void nKillChar(coeffs r)
undo all initialisations
Definition numbers.cc:556
#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:724
ip_command * command
Definition ipid.h:23
void rKill(ring r)
Definition ipshell.cc:6174
#define assume(x)
Definition mod2.h:389
#define omFree(addr)
#define omFreeBin(addr, bin)
#define omFreeBinAddr(addr)
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:903
void sBucketDeleteAndDestroy(sBucket_pt *bucket_pt)
Definition sbuckets.cc:110
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
#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 1613 of file subexpr.cc.

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

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

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

VAR omBin sleftv_bin = omGetSpecBin(sizeof(sleftv))

Definition at line 41 of file subexpr.cc.

◆ sSubexpr_bin

VAR omBin sSubexpr_bin = omGetSpecBin(sizeof(_ssubexpr))

Definition at line 40 of file subexpr.cc.