My Project
Loading...
Searching...
No Matches
Data Structures | Typedefs | Enumerations | Functions | Variables
subexpr.h File Reference
#include <string.h>
#include "polys/monomials/ring.h"
#include "kernel/mod2.h"
#include "Singular/grammar.h"
#include "Singular/tok.h"
#include "Singular/attrib.h"
#include "Singular/fevoices.h"

Go to the source code of this file.

Data Structures

class  proc_singular
 
struct  proc_object
 
union  procinfodata
 
class  procinfo
 
struct  Subexpr
 
class  sleftv
 Class used for (list of) interpreter objects. More...
 
class  libstack
 

Typedefs

typedef procinfoprocinfov
 
typedef sleftvleftv
 
typedef libstacklibstackv
 

Enumerations

enum  language_defs {
  LANG_NONE , LANG_TOP , LANG_SINGULAR , LANG_C ,
  LANG_MIX , LANG_MAX
}
 

Functions

BOOLEAN RingDependend (int t)
 
void syMake (leftv v, const char *name, package pa=NULL)
 
void syMakeMonom (leftv v, const char *name)
 
BOOLEAN assumeStdFlag (leftv h)
 
procinfov piCopy (procinfov pi)
 
BOOLEAN piKill (procinfov l)
 
const charpiProcinfo (procinfov pi, const char *request)
 
void piShowProcinfo (procinfov pi, char *txt)
 
void s_internalDelete (const int t, void *d, const ring r)
 

Variables

EXTERN_VAR BOOLEAN siq
 
EXTERN_INST_VAR sleftv sLastPrinted
 
EXTERN_VAR omBin sSubexpr_bin
 
EXTERN_VAR omBin procinfo_bin
 
EXTERN_VAR omBin libstack_bin
 

Data Structure Documentation

◆ proc_singular

class proc_singular

Definition at line 23 of file subexpr.h.

Data Fields
char * body
long body_end
int body_lineno
long body_start
long def_end
int example_lineno
long example_start
long help_chksum
long help_end
long help_start
long proc_end
long proc_start

◆ uprocinfodata

union uprocinfodata

Definition at line 45 of file subexpr.h.

Data Fields
struct proc_object o
proc_singular s

◆ procinfo

class procinfo

Definition at line 53 of file subexpr.h.

Data Fields
procinfodata data
char is_static
language_defs language
char * libname
package pack
char * procname
short ref
char trace_flag

◆ _ssubexpr

struct _ssubexpr

Definition at line 68 of file subexpr.h.

Data Fields
struct _ssubexpr * next
int start

Typedef Documentation

◆ leftv

Definition at line 79 of file subexpr.h.

◆ libstackv

Definition at line 159 of file subexpr.h.

◆ procinfov

Definition at line 66 of file subexpr.h.

Enumeration Type Documentation

◆ language_defs

Enumerator
LANG_NONE 
LANG_TOP 
LANG_SINGULAR 
LANG_C 
LANG_MIX 
LANG_MAX 

Definition at line 22 of file subexpr.h.

language_defs
Definition subexpr.h:22
@ LANG_MAX
Definition subexpr.h:22
@ LANG_SINGULAR
Definition subexpr.h:22
@ LANG_NONE
Definition subexpr.h:22
@ LANG_MIX
Definition subexpr.h:22
@ LANG_C
Definition subexpr.h:22
@ LANG_TOP
Definition subexpr.h:22

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

◆ piCopy()

procinfov piCopy ( procinfov pi)
inline

Definition at line 149 of file subexpr.h.

150{
151 pi->ref++;
152 return pi;
153}
#define pi
Definition libparse.cc:1145

◆ piKill()

BOOLEAN piKill ( procinfov l)

Definition at line 726 of file ipid.cc.

727{
728 (pi->ref)--;
729 if (pi->ref == 0)
730 {
731 if (pi->language==LANG_SINGULAR)
732 {
734 while (p!=NULL)
735 {
736 if (p->pi==pi && pi->ref <= 1)
737 {
738 Warn("`%s` in use, can not be killed",pi->procname);
739 return TRUE;
740 }
741 p=p->next;
742 }
743 }
744 if (pi->libname != NULL) // OB: ????
745 omFreeBinAddr((ADDRESS)pi->libname);
746 if (pi->procname != NULL) // OB: ????
747 omFreeBinAddr((ADDRESS)pi->procname);
748
749 if( pi->language == LANG_SINGULAR)
750 {
751 if (pi->data.s.body != NULL) // OB: ????
752 omFree((ADDRESS)pi->data.s.body);
753 }
754 if( pi->language == LANG_C)
755 {
756 }
757 memset((void *) pi, 0, sizeof(procinfo));
758 //pi->language=LANG_NONE;
760 }
761 return FALSE;
762}
int p
Definition cfModGcd.cc:4086
VAR Voice * currentVoice
Definition fevoices.cc:49
#define omFree(addr)
#define omFreeBin(addr, bin)
#define omFreeBinAddr(addr)
VAR omBin procinfo_bin
Definition subexpr.cc:42

◆ piProcinfo()

const char * piProcinfo ( procinfov pi,
const char * request )

Definition at line 702 of file ipid.cc.

703{
704 if((pi == NULL)||(pi->language==LANG_NONE)) return "empty proc";
705 else if (strcmp(request, "libname") == 0) return pi->libname;
706 else if (strcmp(request, "procname") == 0) return pi->procname;
707 else if (strcmp(request, "type") == 0)
708 {
709 switch (pi->language)
710 {
711 case LANG_SINGULAR: return "singular"; break;
712 case LANG_C: return "object"; break;
713 case LANG_NONE: return "none"; break;
714 default: return "unknown language";
715 }
716 }
717 else if (strcmp(request, "ref") == 0)
718 {
719 char p[8];
720 snprintf(p,8, "%d", pi->ref);
721 return omStrDup(p); // MEMORY-LEAK
722 }
723 return "??";
724}
#define omStrDup(s)

◆ piShowProcinfo()

void piShowProcinfo ( procinfov pi,
char * txt )

◆ RingDependend()

BOOLEAN RingDependend ( int t)
inline

Definition at line 142 of file subexpr.h.

142{ return (BEGIN_RING<t)&&(t<END_RING); }
@ END_RING
Definition grammar.cc:311
@ BEGIN_RING
Definition grammar.cc:283

◆ 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}
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition blackbox.cc:17
int l
Definition cfEzgcd.cc:100
int m
Definition cfEzgcd.cc:128
int i
Definition cfEzgcd.cc:132
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
@ 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
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
@ VMAXMULT
Definition grammar.cc:308
@ MODUL_CMD
Definition grammar.cc:288
@ VMAXDEG
Definition grammar.cc:307
@ SMATRIX_CMD
Definition grammar.cc:292
@ VECTOR_CMD
Definition grammar.cc:293
@ RESOLUTION_CMD
Definition grammar.cc:291
@ BIGINTVEC_CMD
Definition grammar.cc:279
@ NUMBER_CMD
Definition grammar.cc:289
@ POLY_CMD
Definition grammar.cc:290
@ VMINPOLY
Definition grammar.cc:310
@ RING_CMD
Definition grammar.cc:282
@ VNOETHER
Definition grammar.cc:309
VAR omBin sip_command_bin
Definition ipid.cc:45
BOOLEAN piKill(procinfov pi)
Definition ipid.cc:726
VAR coeffs coeffs_BIGINT
Definition ipid.cc:50
ip_command * command
Definition ipid.h:23
void rKill(ring r)
Definition ipshell.cc:6182
#define assume(x)
Definition mod2.h:387
slists * lists
The main handler for Singular numbers which are suitable for Singular polynomials.
static void p_Delete(poly *p, const ring r)
Definition p_polys.h:901
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
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
@ BIGINT_CMD
Definition tok.h:38
@ CRING_CMD
Definition tok.h:56
@ LIST_CMD
Definition tok.h:118
@ VSHORTOUT
Definition tok.h:216
@ VPRINTLEVEL
Definition tok.h:217
@ INTVEC_CMD
Definition tok.h:101
@ PACKAGE_CMD
Definition tok.h:150
@ CMATRIX_CMD
Definition tok.h:46
@ DEF_CMD
Definition tok.h:58
@ VECHO
Definition tok.h:210
@ CNUMBER_CMD
Definition tok.h:47
@ LINK_CMD
Definition tok.h:117
@ TRACE
Definition tok.h:214
@ STRING_CMD
Definition tok.h:187
@ VTIMER
Definition tok.h:212
@ VRTIMER
Definition tok.h:213
@ VOICE
Definition tok.h:215
@ CPOLY_CMD
Definition tok.h:48
@ INT_CMD
Definition tok.h:96
@ MAX_TOK
Definition tok.h:220
#define NONE
Definition tok.h:223
#define COMMAND
Definition tok.h:29
#define ANY_TYPE
Definition tok.h:30

◆ syMake()

void syMake ( leftv v,
const char * name,
package pa = NULL )

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 * name )

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

EXTERN_VAR omBin libstack_bin

Definition at line 176 of file subexpr.h.

◆ procinfo_bin

EXTERN_VAR omBin procinfo_bin

Definition at line 175 of file subexpr.h.

◆ siq

Definition at line 76 of file subexpr.h.

◆ sLastPrinted

EXTERN_INST_VAR sleftv sLastPrinted

Definition at line 143 of file subexpr.h.

◆ sSubexpr_bin

EXTERN_VAR omBin sSubexpr_bin

Definition at line 174 of file subexpr.h.