My Project
Loading...
Searching...
No Matches
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 char * piProcinfo (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

◆ proc_object

struct proc_object

Definition at line 39 of file subexpr.h.

Data Fields
BOOLEAN(*)(leftv res, leftv v) function

◆ 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

typedef sleftv* leftv

Definition at line 79 of file subexpr.h.

◆ libstackv

typedef libstack* libstackv

Definition at line 159 of file subexpr.h.

◆ procinfov

typedef procinfo* 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 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

◆ 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 724 of file ipid.cc.

725{
726 (pi->ref)--;
727 if (pi->ref == 0)
728 {
729 if (pi->language==LANG_SINGULAR)
730 {
732 while (p!=NULL)
733 {
734 if (p->pi==pi && pi->ref <= 1)
735 {
736 Warn("`%s` in use, can not be killed",pi->procname);
737 return TRUE;
738 }
739 p=p->next;
740 }
741 }
742 if (pi->libname != NULL) // OB: ????
743 omFreeBinAddr((ADDRESS)pi->libname);
744 if (pi->procname != NULL) // OB: ????
745 omFreeBinAddr((ADDRESS)pi->procname);
746
747 if( pi->language == LANG_SINGULAR)
748 {
749 if (pi->data.s.body != NULL) // OB: ????
750 omFree((ADDRESS)pi->data.s.body);
751 }
752 if( pi->language == LANG_C)
753 {
754 }
755 memset((void *) pi, 0, sizeof(procinfo));
756 //pi->language=LANG_NONE;
758 }
759 return FALSE;
760}
void * ADDRESS
Definition auxiliary.h:120
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 700 of file ipid.cc.

701{
702 if((pi == NULL)||(pi->language==LANG_NONE)) return "empty proc";
703 else if (strcmp(request, "libname") == 0) return pi->libname;
704 else if (strcmp(request, "procname") == 0) return pi->procname;
705 else if (strcmp(request, "type") == 0)
706 {
707 switch (pi->language)
708 {
709 case LANG_SINGULAR: return "singular"; break;
710 case LANG_C: return "object"; break;
711 case LANG_NONE: return "none"; break;
712 default: return "unknown language";
713 }
714 }
715 else if (strcmp(request, "ref") == 0)
716 {
717 char p[8];
718 snprintf(p,8, "%d", pi->ref);
719 return omStrDup(p); // MEMORY-LEAK
720 }
721 return "??";
722}
#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 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}
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
@ 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
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
@ 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:724
ip_command * command
Definition ipid.h:23
void rKill(ring r)
Definition ipshell.cc:6174
#define assume(x)
Definition mod2.h:389
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:903
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
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 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 * name )

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

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.