diff --git a/gappy/gap_includes.pxd b/gappy/gap_includes.pxd index bd8f93e..3f4a2a3 100644 --- a/gappy/gap_includes.pxd +++ b/gappy/gap_includes.pxd @@ -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; diff --git a/gappy/gapobj.pyx b/gappy/gapobj.pyx index 0b84ea5..bf45c8d 100644 --- a/gappy/gapobj.pyx +++ b/gappy/gapobj.pyx @@ -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: @@ -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()