My Project
Loading...
Searching...
No Matches
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 1544 of file subexpr.cc.

1545{
1546 if (h->e!=NULL)
1547 {
1548 leftv hh=h->LData();
1549 if (h!=hh) return assumeStdFlag(h->LData());
1550 }
1551 if (!hasFlag(h,FLAG_STD))
1552 {
1553 if (!TEST_VERB_NSB)
1554 {
1555 if (TEST_V_ALLWARN)
1556 Warn("%s is no standard basis in >>%s<<",h->Name(),my_yylinebuf);
1557 else
1558 Warn("%s is no standard basis",h->Name());
1559 }
1560 return FALSE;
1561 }
1562 return TRUE;
1563}
#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:1544

◆ 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:57
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 1570 of file subexpr.cc.

1571{
1572 /* resolv an identifier: (to DEF_CMD, if siq>0)
1573 * 1) reserved id: done by scanner
1574 * 2) `basering` / 'Current`
1575 * 3) existing identifier, local
1576 * 4) ringvar, ringpar, local ring
1577 * 5) existing identifier, global
1578 * 6a) int/bigint
1579 * 6b) monom (resp. number), local ring: consisting of:
1580 * 6') ringvar, ringpar,global ring
1581 * 6'') monom (resp. number), local ring
1582 * 7) monom (resp. number), non-local ring
1583 * 8) basering
1584 * 9) `_`
1585 * 10) everything else is of type 0
1586 */
1587#ifdef TEST
1588 if ((*id<' ')||(*id>(char)126))
1589 {
1590 Print("wrong id :%s:\n",id);
1591 }
1592#endif
1593 idhdl save_ring=currRingHdl;
1594 v->Init();
1595 if(pa != NULL)
1596 {
1597 v->req_packhdl = pa;
1598 }
1599 else v->req_packhdl = currPack;
1600// if (v->req_packhdl!=basePack)
1601// Print("search %s in %s\n",id,v->req_packhdl->libname);
1602 idhdl h=NULL;
1603#ifdef SIQ
1604 if (siq<=0)
1605#endif
1606 {
1607 if (strcmp(id,"basering")==0)
1608 {
1609 if (currRingHdl!=NULL)
1610 {
1611 if (id!=IDID(currRingHdl)) omFreeBinAddr((ADDRESS)id);
1612 h=currRingHdl;
1613 goto id_found;
1614 }
1615 else
1616 {
1617 v->name = id;
1618 return; /* undefined */
1619 }
1620 }
1621 else if (strcmp(id,"Current")==0)
1622 {
1623 if (currPackHdl!=NULL)
1624 {
1626 h=currPackHdl;
1627 goto id_found;
1628 }
1629 else
1630 {
1631 v->name = id;
1632 return; /* undefined */
1633 }
1634 }
1635 if(v->req_packhdl!=currPack)
1636 {
1637 h=v->req_packhdl->idroot->get(id,myynest);
1638 }
1639 else
1640 {
1641 h=ggetid(id);
1642 }
1643 /* 3) existing identifier, local */
1644 if ((h!=NULL) && (IDLEV(h)==myynest))
1645 {
1646 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1647 goto id_found;
1648 }
1650 {
1652 }
1653 /* 4. local ring: ringvar */
1655 /*&& (!yyInRingConstruction)*/)
1656 {
1657 int vnr;
1658 if ((vnr=r_IsRingVar(id, currRing->names,currRing->N))>=0)
1659 {
1660 poly p=pOne();
1661 pSetExp(p,vnr+1,1);
1662 pSetm(p);
1663 v->data = (void *)p;
1664 v->name = id;
1665 v->rtyp = POLY_CMD;
1666 return;
1667 }
1668 if((n_NumberOfParameters(currRing->cf)>0)
1669 &&((vnr=r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1670 n_NumberOfParameters(currRing->cf))>=0)))
1671 {
1672 BOOLEAN ok=FALSE;
1673 poly p = pmInit(id,ok);
1674 if (ok && (p!=NULL))
1675 {
1676 v->data = pGetCoeff(p);
1677 pGetCoeff(p)=NULL;
1678 pLmFree(p);
1679 v->rtyp = NUMBER_CMD;
1680 v->name = id;
1681 return;
1682 }
1683 }
1684 }
1685 /* 5. existing identifier, global */
1686 if (h!=NULL)
1687 {
1688 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1689 goto id_found;
1690 }
1691 /* 6a: int/bigint */
1692 if (strlen(id)<=MAX_INT_LEN)
1693 {
1694 int i;
1695 i=0;
1696 if (id[0]=='-') { i=1; }
1697 while(isdigit(id[i])) i++;
1698 if (id[i]=='\0')
1699 {
1700 int j=atoi(id);
1701 char tmp[MAX_INT_LEN+5];
1702 sprintf(tmp,"%d",j);
1703 if ((j>MAX_INT_LEN) || (strcmp(tmp,id)!=0))
1704 {
1705 number n;
1706 n_Read(id,&n,coeffs_BIGINT);
1707 v->rtyp=BIGINT_CMD;
1708 v->data = n;
1709 }
1710 else
1711 {
1712 v->data=(void*)(long)j;
1713 v->rtyp=INT_CMD;
1714 }
1716 return;
1717 }
1718 }
1719 /* 6b local ring: number/poly */
1721 {
1722 BOOLEAN ok=FALSE;
1723 /*poly p = (!yyInRingConstruction) ? pmInit(id,ok) : (poly)NULL;*/
1724 poly p = pmInit(id,ok);
1725 if (ok)
1726 {
1727 if (p==NULL)
1728 {
1729 v->data = (void *)nInit(0);
1730 v->rtyp = NUMBER_CMD;
1731 #ifdef HAVE_PLURAL
1732 // in this case we may have monomials equal to 0 in p_Read
1733 v->name = id;
1734 #else
1736 #endif
1737 }
1738 else if (pIsConstant(p))
1739 {
1740 v->data = pGetCoeff(p);
1741 pGetCoeff(p)=NULL;
1742 pLmFree(p);
1743 v->rtyp = NUMBER_CMD;
1744 v->name = id;
1745 }
1746 else
1747 {
1748 v->name = id;
1749 #ifdef HAVE_SHIFTBBA
1750 if ((currRing->isLPring!=0)
1751 && (p_Totaldegree(p,currRing)>1))
1752 {
1754 /* v->rtyp = UNKNOWN; - already set */
1755 return; /* error, report "unknown id" */
1756 }
1757 #endif
1758 v->data = p;
1759 v->rtyp = POLY_CMD;
1760 }
1761 return;
1762 }
1763 }
1764 /* 7. non-local ring: number/poly */
1765 {
1766 BOOLEAN ok=FALSE;
1767 poly p = ((currRing!=NULL) /* ring required */
1768 && (currRingHdl!=NULL)
1769 /*&& (!yyInRingConstruction) - not in decl */
1770 && (IDLEV(currRingHdl)!=myynest)) /* already in case 4/6 */
1771 ? pmInit(id,ok) : (poly)NULL;
1772 if (ok)
1773 {
1774 if (p==NULL)
1775 {
1776 v->data = (void *)nInit(0);
1777 v->rtyp = NUMBER_CMD;
1779 }
1780 else
1781 if (pIsConstant(p))
1782 {
1783 v->data = pGetCoeff(p);
1784 pGetCoeff(p)=NULL;
1785 pLmFree(p);
1786 v->rtyp = NUMBER_CMD;
1787 v->name = id;
1788 }
1789 else
1790 {
1791 v->data = p;
1792 v->rtyp = POLY_CMD;
1793 v->name = id;
1794 }
1795 //if (TEST_V_ALLWARN /*&& (myynest>0)*/
1796 //&& ((r_IsRingVar(id, currRing->names,currRing->N)>=0)
1797 // || ((n_NumberOfParameters(currRing->cf)>0)
1798 // &&(r_IsRingVar(id, (char**)n_ParameterNames(currRing->cf),
1799 // n_NumberOfParameters(currRing->cf))>=0))))
1800 //{
1801 //// WARNING: do not use ring variable names in procedures
1802 // Warn("use of variable >>%s<< in a procedure in line %s",id,my_yylinebuf);
1803 //}
1804 return;
1805 }
1806 }
1807 /* 8. basering ? */
1808 if ((myynest>1)&&(currRingHdl!=NULL))
1809 {
1810 if (strcmp(id,IDID(currRingHdl))==0)
1811 {
1812 if (IDID(currRingHdl)!=id) omFreeBinAddr((ADDRESS)id); /*assume strlen (id) <1000 */
1813 h=currRingHdl;
1814 goto id_found;
1815 }
1816 }
1817 if((v->req_packhdl!=basePack) && (v->req_packhdl==currPack))
1818 {
1819 h=basePack->idroot->get(id,myynest);
1820 if (h!=NULL)
1821 {
1822 if (id!=IDID(h)) omFreeBinAddr((ADDRESS)id); /*assume strlen(id) <1000 */
1823 v->req_packhdl=basePack;
1824 goto id_found;
1825 }
1826 }
1827 }
1828#ifdef SIQ
1829 else
1830 v->rtyp=DEF_CMD;
1831#endif
1832 /* 9: _ */
1833 if (strcmp(id,"_")==0)
1834 {
1836 v->Copy(&sLastPrinted);
1837 }
1838 else
1839 {
1840 /* 10: everything else */
1841 /* v->rtyp = UNKNOWN;*/
1842 v->name = id;
1843 }
1844 currRingHdl=save_ring;
1845 return;
1846id_found: // we have an id (in h) found, to set the data in from h
1847 if (IDTYP(h)!=ALIAS_CMD)
1848 {
1849 v->rtyp = IDHDL;
1850 v->flag = IDFLAG(h);
1851 v->attribute=IDATTR(h);
1852 }
1853 else
1854 {
1855 v->rtyp = ALIAS_CMD;
1856 }
1857 v->name = IDID(h);
1858 v->data = (char *)h;
1859 currRingHdl=save_ring;
1860}
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 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:595
static BOOLEAN pa(leftv res, leftv args)
Definition: cohomo.cc:3723
int j
Definition: facHensel.cc:110
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
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: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 1862 of file subexpr.cc.

1863{
1864 if (!isdigit(id[0]))
1865 {
1866 Print("non-digit:%s\n",id);
1867 }
1868 /* resolv an identifier: (to DEF_CMD, if siq>0)
1869 * 6) monom (resp. number), local ring
1870 * 7) monom (resp. number), non-local ring
1871 * 10) everything else is of type 0
1872 */
1873#ifdef TEST
1874 if ((*id<' ')||(*id>(char)126))
1875 {
1876 Print("wrong id :%s:\n",id);
1877 }
1878#endif
1879 idhdl save_ring=currRingHdl;
1880 v->Init();
1881 v->req_packhdl = currPack;
1882#ifdef SIQ
1883 if (siq<=0)
1884#endif
1885 {
1886 /* 6. local ring: number/poly */
1887 BOOLEAN ok=FALSE;
1888 poly p = pmInit(id,ok);
1889 if (ok)
1890 {
1891 if (p==NULL)
1892 {
1893 v->data = (void *)nInit(0);
1894 v->rtyp = NUMBER_CMD;
1895 #ifdef HAVE_PLURAL
1896 // in this case we may have monomials equal to 0 in p_Read
1897 if (rIsPluralRing(currRing)) v->name = omStrDup(id);
1898 #endif
1899 }
1900 else if (pIsConstant(p))
1901 {
1902 v->data = pGetCoeff(p);
1903 pGetCoeff(p)=NULL;
1904 pLmFree(p);
1905 v->rtyp = NUMBER_CMD;
1906 }
1907 else
1908 {
1909 v->name = omStrDup(id);
1910 #ifdef HAVE_SHIFTBBA
1911 if ((currRing->isLPring!=0)
1912 && (p_Totaldegree(p,currRing)>1))
1913 {
1915 /* v->rtyp = UNKNOWN; - already set */
1916 return; /* error, report "unknown id" */
1917 }
1918 #endif
1919 v->data = p;
1920 v->rtyp = POLY_CMD;
1921 }
1922 return;
1923 }
1924 }
1925#ifdef SIQ
1926 else
1927 {
1928 v->rtyp=DEF_CMD;
1929 }
1930#endif
1931 /* 9: _ */
1932 if (strcmp(id,"_")==0)
1933 {
1934 v->Copy(&sLastPrinted);
1935 }
1936 else
1937 {
1938 /* 10: everything else */
1939 /* v->rtyp = UNKNOWN;*/
1940 v->name = omStrDup(id);
1941 }
1942 currRingHdl=save_ring;
1943}
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.