My Project
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 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

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

1537{
1538 if (h->e!=NULL)
1539 {
1540 leftv hh=h->LData();
1541 if (h!=hh) return assumeStdFlag(h->LData());
1542 }
1543 if (!hasFlag(h,FLAG_STD))
1544 {
1545 if (!TEST_VERB_NSB)
1546 {
1547 if (TEST_V_ALLWARN)
1548 Warn("%s is no standard basis in >>%s<<",h->Name(),my_yylinebuf);
1549 else
1550 Warn("%s is no standard basis",h->Name());
1551 }
1552 return FALSE;
1553 }
1554 return TRUE;
1555}
#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:144
#define TEST_VERB_NSB
Definition: options.h:138
BOOLEAN assumeStdFlag(leftv h)
Definition: subexpr.cc:1536

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

748{
749 (pi->ref)--;
750 if (pi->ref == 0)
751 {
752 if (pi->language==LANG_SINGULAR)
753 {
755 while (p!=NULL)
756 {
757 if (p->pi==pi && pi->ref <= 1)
758 {
759 Warn("`%s` in use, can not be killed",pi->procname);
760 return TRUE;
761 }
762 p=p->next;
763 }
764 }
765 if (pi->libname != NULL) // OB: ????
766 omFreeBinAddr((ADDRESS)pi->libname);
767 if (pi->procname != NULL) // OB: ????
768 omFreeBinAddr((ADDRESS)pi->procname);
769
770 if( pi->language == LANG_SINGULAR)
771 {
772 if (pi->data.s.body != NULL) // OB: ????
773 omFree((ADDRESS)pi->data.s.body);
774 }
775 if( pi->language == LANG_C)
776 {
777 }
778 memset((void *) pi, 0, sizeof(procinfo));
779 //pi->language=LANG_NONE;
781 }
782 return FALSE;
783}
void * ADDRESS
Definition: auxiliary.h:119
int p
Definition: cfModGcd.cc:4078
Definition: fevoices.h:59
VAR Voice * currentVoice
Definition: fevoices.cc:49
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
VAR omBin procinfo_bin
Definition: subexpr.cc:42

◆ piProcinfo()

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

Definition at line 723 of file ipid.cc.

724{
725 if((pi == NULL)||(pi->language==LANG_NONE)) return "empty proc";
726 else if (strcmp(request, "libname") == 0) return pi->libname;
727 else if (strcmp(request, "procname") == 0) return pi->procname;
728 else if (strcmp(request, "type") == 0)
729 {
730 switch (pi->language)
731 {
732 case LANG_SINGULAR: return "singular"; break;
733 case LANG_C: return "object"; break;
734 case LANG_NONE: return "none"; break;
735 default: return "unknown language";
736 }
737 }
738 else if (strcmp(request, "ref") == 0)
739 {
740 char p[8];
741 sprintf(p, "%d", pi->ref);
742 return omStrDup(p); // MEMORY-LEAK
743 }
744 return "??";
745}
#define omStrDup(s)
Definition: omAllocDecl.h:263

◆ 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:310
@ BEGIN_RING
Definition: grammar.cc:282

◆ s_internalDelete()

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

Definition at line 514 of file subexpr.cc.

515{
516 assume(d!=NULL);
517 switch (t)
518 {
519 case CRING_CMD:
520 {
521 coeffs cf=(coeffs)d;
522 if ((cf->ref<1)&&
523 ((cf->type <=n_GF)
524 ||((cf->type >=n_long_C)&&(cf->type <=n_CF))))
525 {
526 Warn("cannot kill `%s`",nCoeffName(cf));
527 }
528 else // allow nKillChar for n_long_R, extensions, and user defined:
529 nKillChar((coeffs)d);
530 break;
531 }
532#ifdef SINGULAR_4_2
533 case CNUMBER_CMD:
534 {
535 number2 n=(number2)d;
536 n2Delete(n);
537 break;
538 }
539 case CPOLY_CMD:
540 {
541 poly2 n=(poly2)d;
542 p2Delete(n);
543 break;
544 }
545 case CMATRIX_CMD: //like BIGINTMAT
546#endif
547 case BIGINTMAT_CMD:
548 {
549 bigintmat *v=(bigintmat*)d;
550 delete v;
551 break;
552 }
553 case BUCKET_CMD:
554 {
557 break;
558 }
559 case INTVEC_CMD:
560 case INTMAT_CMD:
561 {
562 intvec *v=(intvec*)d;
563 delete v;
564 break;
565 }
566 case MAP_CMD:
567 {
568 map m=(map)d;
569 omFreeBinAddr((ADDRESS)m->preimage);
570 m->preimage=NULL;
571 /* no break: continue as IDEAL*/
572 }
573 case SMATRIX_CMD:
574 case MATRIX_CMD:
575 case IDEAL_CMD:
576 case MODUL_CMD:
577 {
578 ideal i=(ideal)d;
579 id_Delete(&i,r);
580 break;
581 }
582 case STRING_CMD:
583 omFree(d);
584 break;
585 //case PACKAGE_CMD:
586 // return (void *)paCopy((package) d);
587 case PROC_CMD:
588 piKill((procinfo*)d);
589 break;
590 case POLY_CMD:
591 case VECTOR_CMD:
592 {
593 poly p=(poly)d;
594 p_Delete(&p,r);
595 break;
596 }
597 case NUMBER_CMD:
598 {
599 number n=(number)d;
600 n_Delete(&n,r->cf);
601 break;
602 }
603 case BIGINT_CMD:
604 {
605 number n=(number)d;
607 break;
608 }
609 case LIST_CMD:
610 {
611 lists l=(lists)d;
612 l->Clean(r);
613 break;
614 }
615 case LINK_CMD:
616 {
617 si_link l=(si_link)d;
618 slKill(l);
619 break;
620 }
621 case RING_CMD:
622 {
623 ring R=(ring)d;
624 if ((R!=currRing)||(R->ref>=0))
625 rKill(R);
626 #ifdef TEST
627 else
628 Print("currRing? ref=%d\n",R->ref);
629 #endif
630 break;
631 }
632 case RESOLUTION_CMD:
633 {
635 if (s!=NULL) syKillComputation(s,r);
636 break;
637 }
638 case COMMAND:
639 {
640 command cmd=(command)d;
641 if (cmd->arg1.rtyp!=0) cmd->arg1.CleanUp(r);
642 if (cmd->arg2.rtyp!=0) cmd->arg2.CleanUp(r);
643 if (cmd->arg3.rtyp!=0) cmd->arg3.CleanUp(r);
645 break;
646 }
647 case INT_CMD:
648 case DEF_CMD:
649 case ALIAS_CMD:
650 case PACKAGE_CMD:
651 case IDHDL:
652 case NONE:
653 case ANY_TYPE:
654 case VECHO:
655 case VPRINTLEVEL:
656 case VCOLMAX:
657 case VTIMER:
658 case VRTIMER:
659 case VOICE:
660 case VMAXDEG:
661 case VMAXMULT:
662 case TRACE:
663 case VSHORTOUT:
664 case VNOETHER:
665 case VMINPOLY:
666 case 0: /* type in error case */
667 break; /* error recovery: do nothing */
668 //case COMMAND:
669 //case COMMAND:
670 default:
671 {
672 if (t>MAX_TOK)
673 {
674 blackbox *b=getBlackboxStuff(t);
675 if (b!=NULL) b->blackbox_destroy(b,d);
676 break;
677 }
678 else
679 Warn("s_internalDelete: cannot delete type %s(%d)",
680 Tok2Cmdname(t),t);
681 }
682 }
683}
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:4083
CanonicalForm b
Definition: cfModGcd.cc:4103
CanonicalForm map(const CanonicalForm &primElem, const Variable &alpha, const CanonicalForm &F, const Variable &beta)
map from to such that is mapped onto
Definition: cf_map_ext.cc:504
Matrices of numbers.
Definition: bigintmat.h:51
Definition: intvec.h:23
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:452
static FORCE_INLINE char * nCoeffName(const coeffs cf)
Definition: coeffs.h:960
void nKillChar(coeffs r)
undo all initialisations
Definition: numbers.cc:568
#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:284
@ MATRIX_CMD
Definition: grammar.cc:286
@ BUCKET_CMD
Definition: grammar.cc:283
@ BIGINTMAT_CMD
Definition: grammar.cc:278
@ MAP_CMD
Definition: grammar.cc:285
@ PROC_CMD
Definition: grammar.cc:280
@ INTMAT_CMD
Definition: grammar.cc:279
@ VMAXMULT
Definition: grammar.cc:307
@ MODUL_CMD
Definition: grammar.cc:287
@ VMAXDEG
Definition: grammar.cc:306
@ SMATRIX_CMD
Definition: grammar.cc:291
@ VECTOR_CMD
Definition: grammar.cc:292
@ RESOLUTION_CMD
Definition: grammar.cc:290
@ NUMBER_CMD
Definition: grammar.cc:288
@ POLY_CMD
Definition: grammar.cc:289
@ VMINPOLY
Definition: grammar.cc:309
@ RING_CMD
Definition: grammar.cc:281
@ VNOETHER
Definition: grammar.cc:308
VAR omBin sip_command_bin
Definition: ipid.cc:45
BOOLEAN piKill(procinfov pi)
Definition: ipid.cc:747
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:50
ip_command * command
Definition: ipid.h:23
void rKill(ring r)
Definition: ipshell.cc:6180
#define assume(x)
Definition: mod2.h:389
slists * lists
Definition: mpr_numeric.h:146
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:899
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:209
@ 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:214
@ VPRINTLEVEL
Definition: tok.h:215
@ INTVEC_CMD
Definition: tok.h:101
@ PACKAGE_CMD
Definition: tok.h:149
@ CMATRIX_CMD
Definition: tok.h:46
@ DEF_CMD
Definition: tok.h:58
@ VECHO
Definition: tok.h:208
@ CNUMBER_CMD
Definition: tok.h:47
@ LINK_CMD
Definition: tok.h:117
@ TRACE
Definition: tok.h:212
@ STRING_CMD
Definition: tok.h:185
@ VTIMER
Definition: tok.h:210
@ VRTIMER
Definition: tok.h:211
@ VOICE
Definition: tok.h:213
@ CPOLY_CMD
Definition: tok.h:48
@ INT_CMD
Definition: tok.h:96
@ MAX_TOK
Definition: tok.h:218
#define NONE
Definition: tok.h:221
#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 1562 of file subexpr.cc.

1563{
1564 /* resolv an identifier: (to DEF_CMD, if siq>0)
1565 * 1) reserved id: done by scanner
1566 * 2) `basering` / 'Current`
1567 * 3) existing identifier, local
1568 * 4) ringvar, ringpar, local ring
1569 * 5) existing identifier, global
1570 * 6) monom (resp. number), local ring: consisting of:
1571 * 6') ringvar, ringpar,global ring
1572 * 6'') monom (resp. number), local ring
1573 * 7) monom (resp. number), non-local ring
1574 * 8) basering
1575 * 9) `_`
1576 * 10) everything else is of type 0
1577 */
1578#ifdef TEST
1579 if ((*id<' ')||(*id>(char)126))
1580 {
1581 Print("wrong id :%s:\n",id);
1582 }
1583#endif
1584 idhdl save_ring=currRingHdl;
1585 v->Init();
1586 if(pa != NULL)
1587 {
1588 v->req_packhdl = pa;
1589 }
1590 else v->req_packhdl = currPack;
1591// if (v->req_packhdl!=basePack)
1592// Print("search %s in %s\n",id,v->req_packhdl->libname);
1593 idhdl h=NULL;
1594#ifdef SIQ
1595 if (siq<=0)
1596#endif
1597 {
1598 if (strcmp(id,"basering")==0)
1599 {
1600 if (currRingHdl!=NULL)
1601 {
1602 if (id!=IDID(currRingHdl)) omFreeBinAddr((ADDRESS)id);
1603 h=currRingHdl;
1604 goto id_found;
1605 }
1606 else
1607 {
1608 v->name = id;
1609 return; /* undefined */
1610 }
1611 }
1612 else if (strcmp(id,"Current")==0)
1613 {
1614 if (currPackHdl!=NULL)
1615 {
1617 h=currPackHdl;
1618 goto id_found;
1619 }
1620 else
1621 {
1622 v->name = id;
1623 return; /* undefined */
1624 }
1625 }
1626 if(v->req_packhdl!=currPack)
1627 {
1628 h=v->req_packhdl->idroot->get(id,myynest);
1629 }
1630 else
1631 {
1632 h=ggetid(id);
1633 }
1634 /* 3) existing identifier, local */
1635 if ((h!=NULL) && (IDLEV(h)==myynest))
1636 {
1637 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1638 goto id_found;
1639 }
1641 {
1643 }
1644 /* 4. local ring: ringvar */
1646 /*&& (!yyInRingConstruction)*/)
1647 {
1648 int vnr;
1649 if ((vnr=r_IsRingVar(id, currRing->names,currRing->N))>=0)
1650 {
1651 poly p=pOne();
1652 pSetExp(p,vnr+1,1);
1653 pSetm(p);
1654 v->data = (void *)p;
1655 v->name = id;
1656 v->rtyp = POLY_CMD;
1657 return;
1658 }
1659 if((n_NumberOfParameters(currRing->cf)>0)
1660 &&((vnr=r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1661 n_NumberOfParameters(currRing->cf))>=0)))
1662 {
1663 BOOLEAN ok=FALSE;
1664 poly p = pmInit(id,ok);
1665 if (ok && (p!=NULL))
1666 {
1667 v->data = pGetCoeff(p);
1668 pGetCoeff(p)=NULL;
1669 pLmFree(p);
1670 v->rtyp = NUMBER_CMD;
1671 v->name = id;
1672 return;
1673 }
1674 }
1675 }
1676 /* 5. existing identifier, global */
1677 if (h!=NULL)
1678 {
1679 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1680 goto id_found;
1681 }
1682 /* 6. local ring: number/poly */
1684 {
1685 BOOLEAN ok=FALSE;
1686 /*poly p = (!yyInRingConstruction) ? pmInit(id,ok) : (poly)NULL;*/
1687 poly p = pmInit(id,ok);
1688 if (ok)
1689 {
1690 if (p==NULL)
1691 {
1692 v->data = (void *)nInit(0);
1693 v->rtyp = NUMBER_CMD;
1694 #ifdef HAVE_PLURAL
1695 // in this case we may have monomials equal to 0 in p_Read
1696 v->name = id;
1697 #else
1699 #endif
1700 }
1701 else if (pIsConstant(p))
1702 {
1703 v->data = pGetCoeff(p);
1704 pGetCoeff(p)=NULL;
1705 pLmFree(p);
1706 v->rtyp = NUMBER_CMD;
1707 v->name = id;
1708 }
1709 else
1710 {
1711 v->name = id;
1712 #ifdef HAVE_SHIFTBBA
1713 if ((currRing->isLPring!=0)
1714 && (p_Totaldegree(p,currRing)>1))
1715 {
1717 /* v->rtyp = UNKNOWN; - already set */
1718 return; /* error, report "unknown id" */
1719 }
1720 #endif
1721 v->data = p;
1722 v->rtyp = POLY_CMD;
1723 }
1724 return;
1725 }
1726 }
1727 /* 7. non-local ring: number/poly */
1728 {
1729 BOOLEAN ok=FALSE;
1730 poly p = ((currRing!=NULL) /* ring required */
1731 && (currRingHdl!=NULL)
1732 /*&& (!yyInRingConstruction) - not in decl */
1733 && (IDLEV(currRingHdl)!=myynest)) /* already in case 4/6 */
1734 ? pmInit(id,ok) : (poly)NULL;
1735 if (ok)
1736 {
1737 if (p==NULL)
1738 {
1739 v->data = (void *)nInit(0);
1740 v->rtyp = NUMBER_CMD;
1742 }
1743 else
1744 if (pIsConstant(p))
1745 {
1746 v->data = pGetCoeff(p);
1747 pGetCoeff(p)=NULL;
1748 pLmFree(p);
1749 v->rtyp = NUMBER_CMD;
1750 v->name = id;
1751 }
1752 else
1753 {
1754 v->data = p;
1755 v->rtyp = POLY_CMD;
1756 v->name = id;
1757 }
1758 //if (TEST_V_ALLWARN /*&& (myynest>0)*/
1759 //&& ((r_IsRingVar(id, currRing->names,currRing->N)>=0)
1760 // || ((n_NumberOfParameters(currRing->cf)>0)
1761 // &&(r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1762 // n_NumberOfParameters(currRing->cf))>=0))))
1763 //{
1764 //// WARNING: do not use ring variable names in procedures
1765 // Warn("use of variable >>%s<< in a procedure in line %s",id,my_yylinebuf);
1766 //}
1767 return;
1768 }
1769 }
1770 /* 8. basering ? */
1771 if ((myynest>1)&&(currRingHdl!=NULL))
1772 {
1773 if (strcmp(id,IDID(currRingHdl))==0)
1774 {
1775 if (IDID(currRingHdl)!=id) omFreeBinAddr((ADDRESS)id); /*assume strlen (id) <1000 */
1776 h=currRingHdl;
1777 goto id_found;
1778 }
1779 }
1780 if((v->req_packhdl!=basePack) && (v->req_packhdl==currPack))
1781 {
1782 h=basePack->idroot->get(id,myynest);
1783 if (h!=NULL)
1784 {
1785 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1786 v->req_packhdl=basePack;
1787 goto id_found;
1788 }
1789 }
1790 }
1791#ifdef SIQ
1792 else
1793 v->rtyp=DEF_CMD;
1794#endif
1795 /* 9: _ */
1796 if (strcmp(id,"_")==0)
1797 {
1799 v->Copy(&sLastPrinted);
1800 }
1801 else
1802 {
1803 /* 10: everything else */
1804 /* v->rtyp = UNKNOWN;*/
1805 v->name = id;
1806 }
1807 currRingHdl=save_ring;
1808 return;
1809id_found: // we have an id (in h) found, to set the data in from h
1810 if (IDTYP(h)!=ALIAS_CMD)
1811 {
1812 v->rtyp = IDHDL;
1813 v->flag = IDFLAG(h);
1814 v->attribute=IDATTR(h);
1815 }
1816 else
1817 {
1818 v->rtyp = ALIAS_CMD;
1819 }
1820 v->name = IDID(h);
1821 v->data = (char *)h;
1822 currRingHdl=save_ring;
1823}
int BOOLEAN
Definition: auxiliary.h:87
char name() const
Definition: variable.cc:122
Definition: idrec.h:35
static FORCE_INLINE char const ** n_ParameterNames(const coeffs r)
Returns a (const!) pointer to (const char*) names of parameters.
Definition: coeffs.h:775
static FORCE_INLINE int n_NumberOfParameters(const coeffs r)
Returns the number of parameters.
Definition: coeffs.h:771
static BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:3723
VAR int myynest
Definition: febase.cc:41
VAR BOOLEAN yyInRingConstruction
Definition: grammar.cc:172
idhdl ggetid(const char *n)
Definition: ipid.cc:581
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
#define nInit(i)
Definition: numbers.h:24
static void p_LmDelete(poly p, const ring r)
Definition: p_polys.h:721
static long p_Totaldegree(poly p, const ring r)
Definition: p_polys.h:1505
#define pSetm(p)
Definition: polys.h:271
#define pIsConstant(p)
like above, except that Comp must be 0
Definition: polys.h:238
#define pmInit(a, b)
Definition: polys.h:289
static void pLmFree(poly p)
frees the space of the monomial m, assumes m != NULL coef is not freed, m is not advanced
Definition: polys.h:70
#define pSetExp(p, i, v)
Definition: polys.h:42
#define pOne()
Definition: polys.h:315
int r_IsRingVar(const char *n, char **names, int N)
Definition: ring.cc:212
INST_VAR sleftv sLastPrinted
Definition: subexpr.cc:46
VAR BOOLEAN siq
Definition: subexpr.cc:48

◆ syMakeMonom()

void syMakeMonom ( leftv  v,
const char *  name 
)

Definition at line 1825 of file subexpr.cc.

1826{
1827 if (!isdigit(id[0]))
1828 {
1829 Print("non-digit:%s\n",id);
1830 }
1831 /* resolv an identifier: (to DEF_CMD, if siq>0)
1832 * 6) monom (resp. number), local ring
1833 * 7) monom (resp. number), non-local ring
1834 * 10) everything else is of type 0
1835 */
1836#ifdef TEST
1837 if ((*id<' ')||(*id>(char)126))
1838 {
1839 Print("wrong id :%s:\n",id);
1840 }
1841#endif
1842 idhdl save_ring=currRingHdl;
1843 v->Init();
1844 v->req_packhdl = currPack;
1845#ifdef SIQ
1846 if (siq<=0)
1847#endif
1848 {
1849 /* 6. local ring: number/poly */
1850 BOOLEAN ok=FALSE;
1851 poly p = pmInit(id,ok);
1852 if (ok)
1853 {
1854 if (p==NULL)
1855 {
1856 v->data = (void *)nInit(0);
1857 v->rtyp = NUMBER_CMD;
1858 #ifdef HAVE_PLURAL
1859 // in this case we may have monomials equal to 0 in p_Read
1860 if (rIsPluralRing(currRing)) v->name = omStrDup(id);
1861 #endif
1862 }
1863 else if (pIsConstant(p))
1864 {
1865 v->data = pGetCoeff(p);
1866 pGetCoeff(p)=NULL;
1867 pLmFree(p);
1868 v->rtyp = NUMBER_CMD;
1869 }
1870 else
1871 {
1872 v->name = omStrDup(id);
1873 #ifdef HAVE_SHIFTBBA
1874 if ((currRing->isLPring!=0)
1875 && (p_Totaldegree(p,currRing)>1))
1876 {
1878 /* v->rtyp = UNKNOWN; - already set */
1879 return; /* error, report "unknown id" */
1880 }
1881 #endif
1882 v->data = p;
1883 v->rtyp = POLY_CMD;
1884 }
1885 return;
1886 }
1887 }
1888#ifdef SIQ
1889 else
1890 {
1891 v->rtyp=DEF_CMD;
1892 }
1893#endif
1894 /* 9: _ */
1895 if (strcmp(id,"_")==0)
1896 {
1897 v->Copy(&sLastPrinted);
1898 }
1899 else
1900 {
1901 /* 10: everything else */
1902 /* v->rtyp = UNKNOWN;*/
1903 v->name = omStrDup(id);
1904 }
1905 currRingHdl=save_ring;
1906}
static BOOLEAN rIsPluralRing(const ring r)
we must always have this test!
Definition: ring.h:400

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.