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

Function pyobject_Op2

Singular/dyn_modules/pyobject/pyobject.cc:562–585  ·  view source on GitHub ↗

blackbox support - binary operations

Source from the content-addressed store, hash-verified

560
561/// blackbox support - binary operations
562BOOLEAN pyobject_Op2(int op, leftv res, leftv arg1, leftv arg2)
563{
564 PythonCastStatic<> lhs(arg1);
565
566 switch(op) // built-in return types and special cases first
567 {
568 case '<': case '>': case EQUAL_EQUAL: case NOTEQUAL: case GE: case LE:
569 {
570 res->data = (void *)(long)(lhs.compare(op, PythonCastDynamic(arg2)));
571 res->rtyp = INT_CMD;
572 return FALSE;
573 }
574 case '.': case COLONCOLON: case ATTRIB_CMD:
575 return lhs.attr(get_attrib_name(arg2)).assign_to(res);
576 }
577
578 PythonCastDynamic rhs(arg2);
579 if (!lhs(op, rhs).assign_to(res))
580 return FALSE;
581
582 BOOLEAN newstruct_Op2(int, leftv, leftv, leftv); // forward declaration
583 return newstruct_Op2(op, res, arg1, arg2);
584
585}
586
587/// blackbox support - ternary operations
588BOOLEAN pyobject_Op3(int op, leftv res, leftv arg1, leftv arg2, leftv arg3)

Callers

nothing calls this directly

Calls 6

PythonCastDynamicClass · 0.85
get_attrib_nameFunction · 0.85
newstruct_Op2Function · 0.85
assign_toMethod · 0.80
attrMethod · 0.80
compareMethod · 0.45

Tested by

no test coverage detected