My Project
Functions | Variables
subexpr.cc File Reference
#include "kernel/mod2.h"
#include "omalloc/omalloc.h"
#include "misc/intvec.h"
#include "misc/options.h"
#include "coeffs/numbers.h"
#include "coeffs/bigintmat.h"
#include "coeffs/ffields.h"
#include "polys/monomials/maps.h"
#include "polys/matpol.h"
#include "polys/monomials/ring.h"
#include "kernel/polys.h"
#include "kernel/ideals.h"
#include "kernel/GBEngine/kstd1.h"
#include "kernel/GBEngine/syz.h"
#include "kernel/oswrapper/timer.h"
#include "Singular/tok.h"
#include "Singular/ipid.h"
#include "Singular/ipshell.h"
#include "Singular/lists.h"
#include "Singular/attrib.h"
#include "Singular/links/silink.h"
#include "Singular/ipprint.h"
#include "Singular/subexpr.h"
#include "Singular/blackbox.h"
#include "Singular/number2.h"
#include <ctype.h>

Go to the source code of this file.

Functions

static 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 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

◆ s_internalCopy()

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

Definition at line 430 of file subexpr.cc.

431{
432 switch (t)
433 {
434 case CRING_CMD:
435 {
436 coeffs cf=(coeffs)d;
437 cf->ref++;
438 return (void*)d;
439 }
440#ifdef SINGULAR_4_2
441 case CNUMBER_CMD:
442 return (void*)n2Copy((number2)d);
443 case CPOLY_CMD:
444 return (void*)p2Copy((poly2)d);
445 case CMATRIX_CMD: // like BIGINTMAT
446#endif
447 case BIGINTMAT_CMD:
448 return (void*)bimCopy((bigintmat *)d);
449 case BUCKET_CMD:
450 return (void*)sBucketCopy((sBucket_pt)d);
451 case INTVEC_CMD:
452 case INTMAT_CMD:
453 return (void *)ivCopy((intvec *)d);
454 case MATRIX_CMD:
455 return (void *)mp_Copy((matrix)d, currRing);
456 case SMATRIX_CMD:
457 case IDEAL_CMD:
458 case MODUL_CMD:
459 return (void *)idCopy((ideal)d);
460 case STRING_CMD:
461 return (void *)omStrDup((char *)d);
462 case PACKAGE_CMD:
463 return (void *)paCopy((package) d);
464 case PROC_CMD:
465 return (void *)piCopy((procinfov) d);
466 case POLY_CMD:
467 case VECTOR_CMD:
468 return (void *)pCopy((poly)d);
469 case INT_CMD:
470 return d;
471 case NUMBER_CMD:
472 return (void *)nCopy((number)d);
473 case BIGINT_CMD:
474 return (void *)n_Copy((number)d, coeffs_BIGINT);
475 case MAP_CMD:
476 return (void *)maCopy((map)d, currRing);
477 case LIST_CMD:
478 return (void *)lCopy((lists)d);
479 case LINK_CMD:
480 return (void *)slCopy((si_link) d);
481 case RING_CMD:
482 {
483 ring r=(ring)d;
484 if (r!=NULL)
485 {
486 rIncRefCnt(r);
487 //Print("s_internalCopy:+ ring %lx, ref %d\n",r,r->ref);
488 }
489 return d;
490 }
491 case RESOLUTION_CMD:
492 return (void*)syCopy((syStrategy)d);
493 case DEF_CMD:
494 case NONE:
495 case 0: /* type in error case */
496 break; /* error recovery: do nothing */
497 //case COMMAND:
498 default:
499 {
500 if (t>MAX_TOK)
501 {
502 blackbox *b=getBlackboxStuff(t);
503 if (b!=NULL) return b->blackbox_Copy(b,d);
504 return NULL;
505 }
506 else
507 Warn("s_internalCopy: cannot copy type %s(%d)",
508 Tok2Cmdname(t),t);
509 }
510 }
511 return NULL;
512}
bigintmat * bimCopy(const bigintmat *b)
same as copy constructor - apart from it being able to accept NULL as input
Definition: bigintmat.cc:405
blackbox * getBlackboxStuff(const int t)
return the structure to the type given by t
Definition: blackbox.cc:17
CanonicalForm cf
Definition: cfModGcd.cc: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
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition: coeffs.h:448
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
@ MODUL_CMD
Definition: grammar.cc:287
@ 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
@ RING_CMD
Definition: grammar.cc:281
ideal idCopy(ideal A)
Definition: ideals.h:60
intvec * ivCopy(const intvec *o)
Definition: intvec.h:145
VAR coeffs coeffs_BIGINT
Definition: ipid.cc:50
package paCopy(package pack)
Definition: ipid.h:44
lists lCopy(lists L)
Definition: lists.cc:32
map maCopy(map theMap, const ring r)
Definition: maps.cc:32
matrix mp_Copy(matrix a, const ring r)
copies matrix a (from ring r to r)
Definition: matpol.cc:64
The main handler for Singular numbers which are suitable for Singular polynomials.
#define nCopy(n)
Definition: numbers.h:15
#define omStrDup(s)
Definition: omAllocDecl.h:263
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
#define pCopy(p)
return a copy of the poly
Definition: polys.h:185
static ring rIncRefCnt(ring r)
Definition: ring.h:837
sBucket_pt sBucketCopy(const sBucket_pt bucket)
Copy sBucket non-intrusive!!!
Definition: sbuckets.cc:70
ip_package * package
Definition: structs.h:43
procinfov piCopy(procinfov pi)
Definition: subexpr.h:149
syStrategy syCopy(syStrategy syzstr)
Definition: syz1.cc:1884
@ 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:149
@ 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:185
@ CPOLY_CMD
Definition: tok.h:48
@ INT_CMD
Definition: tok.h:96
@ MAX_TOK
Definition: tok.h:218
#define NONE
Definition: tok.h:221

◆ 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}
void * ADDRESS
Definition: auxiliary.h:119
int l
Definition: cfEzgcd.cc:100
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
int p
Definition: cfModGcd.cc:4078
@ 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
@ VMAXMULT
Definition: grammar.cc:307
@ VMAXDEG
Definition: grammar.cc:306
@ VMINPOLY
Definition: grammar.cc:309
@ VNOETHER
Definition: grammar.cc:308
VAR omBin sip_command_bin
Definition: ipid.cc:45
BOOLEAN piKill(procinfov pi)
Definition: ipid.cc:747
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
#define omFree(addr)
Definition: omAllocDecl.h:261
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259
#define omFreeBinAddr(addr)
Definition: omAllocDecl.h:258
static void p_Delete(poly *p, const ring r)
Definition: p_polys.h:899
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
@ VSHORTOUT
Definition: tok.h:214
@ VPRINTLEVEL
Definition: tok.h:215
@ VECHO
Definition: tok.h:208
@ TRACE
Definition: tok.h:212
@ VTIMER
Definition: tok.h:210
@ VRTIMER
Definition: tok.h:211
@ VOICE
Definition: tok.h:213
#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 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 *  id 
)

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

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.