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

Function rComposeVar

Singular/ipshell.cc:2435–2478  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2433}
2434
2435static inline BOOLEAN rComposeVar(const lists L, ring R)
2436{
2437 assume(R!=NULL);
2438 if (L->m[1].Typ()==LIST_CMD)
2439 {
2440 lists v=(lists)L->m[1].Data();
2441 R->N = v->nr+1;
2442 if (R->N<=0)
2443 {
2444 WerrorS("no ring variables");
2445 return TRUE;
2446 }
2447 R->names = (char **)omAlloc0(R->N * sizeof(char_ptr));
2448 int i;
2449 for(i=0;i<R->N;i++)
2450 {
2451 if (v->m[i].Typ()==STRING_CMD)
2452 R->names[i]=omStrDup((char *)v->m[i].Data());
2453 else if (v->m[i].Typ()==POLY_CMD)
2454 {
2455 poly p=(poly)v->m[i].Data();
2456 int nr=pIsPurePower(p);
2457 if (nr>0)
2458 R->names[i]=omStrDup(currRing->names[nr-1]);
2459 else
2460 {
2461 Werror("var name %d must be a string or a ring variable",i+1);
2462 return TRUE;
2463 }
2464 }
2465 else
2466 {
2467 Werror("var name %d must be `string` (not %d)",i+1, v->m[i].Typ());
2468 return TRUE;
2469 }
2470 }
2471 }
2472 else
2473 {
2474 WerrorS("variable must be given as `list`");
2475 return TRUE;
2476 }
2477 return FALSE;
2478}
2479
2480static inline BOOLEAN rComposeOrder(const lists L, const BOOLEAN check_comp, ring R)
2481{

Callers 1

rComposeFunction · 0.85

Calls 5

WerrorSFunction · 0.85
omAlloc0Function · 0.85
WerrorFunction · 0.85
TypMethod · 0.45
DataMethod · 0.45

Tested by

no test coverage detected