Skip to content

Commit

Permalink
gh-35895: gap: make libgap APIs for function calls available
Browse files Browse the repository at this point in the history
    
... and use them in two places. The rest will be dealt with in a future
PR.
    
URL: #35895
Reported by: Max Horn
Reviewer(s): Marc Mezzarobba
  • Loading branch information
Release Manager committed Jul 8, 2023
2 parents 0d8231f + c715f0c commit 6a1fdee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/sage/libs/gap/element.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ cdef char *capture_stdout(Obj func, Obj obj):
GAP_Enter()
s = NEW_STRING(0)
output_text_string = GAP_ValueGlobalVariable("OutputTextString")
stream = CALL_2ARGS(output_text_string, s, GAP_True)
stream = GAP_CallFunc2Args(output_text_string, s, GAP_True)

l = GAP_NewPlist(1)
GAP_AssList(l, 1, obj)

CALL_WITH_STREAM = GAP_ValueGlobalVariable("CALL_WITH_STREAM")
CALL_3ARGS(CALL_WITH_STREAM, stream, func, l)
GAP_CallFunc3Args(CALL_WITH_STREAM, stream, func, l)
return GAP_CSTR_STRING(s)
finally:
GAP_Leave()
Expand Down
7 changes: 7 additions & 0 deletions src/sage/libs/gap/gap_includes.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ cdef extern from "gap/libgap-api.h" nogil:
cdef Obj GAP_True
cdef Obj GAP_False

Obj GAP_CallFuncList(Obj func, Obj args);
Obj GAP_CallFuncArray(Obj func, UInt narg, Obj * args);
Obj GAP_CallFunc0Args(Obj func);
Obj GAP_CallFunc1Args(Obj func, Obj a1);
Obj GAP_CallFunc2Args(Obj func, Obj a1, Obj a2);
Obj GAP_CallFunc3Args(Obj func, Obj a1, Obj a2, Obj a3);

bint GAP_IsMacFloat(Obj obj)
double GAP_ValueMacFloat(Obj obj)

Expand Down

0 comments on commit 6a1fdee

Please sign in to comment.