Skip to content

Commit

Permalink
fixed embray#22
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelontiveros committed May 1, 2024
1 parent 89a156b commit d7706ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
17 changes: 13 additions & 4 deletions gappy/gap_includes.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,29 @@ cdef extern from "gap/gasman.h" nogil:
"""
#define GAP_CollectBags(full) CollectBags(0, full)
"""
void GAP_MarkBag "MarkBag" (Obj bag)
void GAP_MarkBag(Obj bag)
UInt GAP_CollectBags(UInt full)


cdef extern from "gap/io.h" nogil:
UInt OpenOutputStream(Obj stream)
UInt CloseOutput()
"""
TypOutputFile output = {0};
inline UInt GAP_OpenOutputStream(Obj stream) {
return OpenOutputStream(&output, stream);
}
inline UInt GAP_CloseOutput( ) {
return CloseOutput(&output);
}
"""
UInt GAP_OpenOutputStream(Obj stream)
UInt GAP_CloseOutput()


# TODO: Replace this with a GAP_MakeStringWithLen from the public API;
# see https://github.com/gap-system/gap/issues/4211
cdef extern from "gap/stringobj.h" nogil:
"""
static inline Obj GAP_MakeStringWithLen(char *s, size_t len) {
inline Obj GAP_MakeStringWithLen(const char *s, size_t len) {
Obj ret;
C_NEW_STRING(ret, len, s);
return ret;
Expand Down
4 changes: 2 additions & 2 deletions gappy/gapobj.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ cdef void capture_stdout(Obj func, Obj obj, Obj out):
args[0] = out
args[1] = GAP_True
stream = GAP_CallFuncArray(output_text_string, 2, args)
stream_ok = OpenOutputStream(stream)
stream_ok = GAP_OpenOutputStream(stream)
sig_off()

if not stream_ok:
Expand All @@ -111,7 +111,7 @@ cdef void capture_stdout(Obj func, Obj obj, Obj out):
args[0] = obj
sig_on()
GAP_CallFuncArray(func, 1, args)
CloseOutput()
GAP_CloseOutput()
sig_off()
finally:
sig_GAP_Leave()
Expand Down

0 comments on commit d7706ce

Please sign in to comment.