MCPcopy Create free account
hub / github.com/Singular/Singular / rInit

Function rInit

Singular/ipshell.cc:5620–6009  ·  view source on GitHub ↗

/////////////// rInit itself: INPUT: pn: ch & parameter (names), rv: variable (names) ord: ordering (all !=NULL) RETURN: currRingHdl on success NULL on error NOTE: * makes new ring to current ring, on success considers input sleftv's as read-only

Source from the content-addressed store, hash-verified

5618// NOTE: * makes new ring to current ring, on success
5619// * considers input sleftv's as read-only
5620ring rInit(leftv pn, leftv rv, leftv ord)
5621{
5622 int float_len=0;
5623 int float_len2=0;
5624 ring R = NULL;
5625 //BOOLEAN ffChar=FALSE;
5626
5627 /* ch -------------------------------------------------------*/
5628 // get ch of ground field
5629
5630 // allocated ring
5631 R = (ring) omAlloc0Bin(sip_sring_bin);
5632
5633 coeffs cf = NULL;
5634
5635 assume( pn != NULL );
5636 const int P = pn->listLength();
5637
5638 if (pn->Typ()==CRING_CMD)
5639 {
5640 cf=(coeffs)pn->CopyD();
5641 leftv pnn=pn;
5642 if(P>1) /*parameter*/
5643 {
5644 pnn = pnn->next;
5645 const int pars = pnn->listLength();
5646 assume( pars > 0 );
5647 char ** names = (char**)omAlloc0(pars * sizeof(char_ptr));
5648
5649 if (rSleftvList2StringArray(pnn, names))
5650 {
5651 WerrorS("parameter expected");
5652 goto rInitError;
5653 }
5654
5655 TransExtInfo extParam;
5656
5657 extParam.r = rDefault( cf, pars, names); // Q/Zp [ p_1, ... p_pars ]
5658 for(int i=pars-1; i>=0;i--)
5659 {
5660 omFree(names[i]);
5661 }
5662 omFree(names);
5663
5664 cf = nInitChar(n_transExt, &extParam);
5665 }
5666 assume( cf != NULL );
5667 }
5668 else if (pn->Typ()==INT_CMD)
5669 {
5670 int ch = (int)(long)pn->Data();
5671 leftv pnn=pn;
5672
5673 /* parameter? -------------------------------------------------------*/
5674 pnn = pnn->next;
5675
5676 if (pnn == NULL) // no params!?
5677 {

Callers 2

jjRING3Function · 0.85
grammar.ccFile · 0.85

Calls 15

omAlloc0BinFunction · 0.85
omAlloc0Function · 0.85
rSleftvList2StringArrayFunction · 0.85
WerrorSFunction · 0.85
nInitCharFunction · 0.85
IsPrimeFunction · 0.85
WarnFunction · 0.85
si_minFunction · 0.85
n_MPZFunction · 0.85
n_DeleteFunction · 0.85
WerrorFunction · 0.85
rRenameVarsFunction · 0.85

Tested by

no test coverage detected