Commits (12)
tarball=gap-VERSION.tar.bz2
sha1=d5e531cc316a62da749930c615b18f539286b06d
md5=3d0add5948bff383e477f1037623bdc0
cksum=2953588995
tarball=gap-VERSION.tar.gz
sha1=26738783d7ea8d1347dc287738378e3657092cc8
md5=4daf98d3e2439cd78bafc0ec65cfaaa1
cksum=3066302550
#!/bin/sh
# GAP startup script, installed in $SAGE_LOCAL/bin/gap
if [ $SAGE_LOCAL"" = "" ]; then
echo "Set the environment variable SAGE_LOCAL."
exit 1
fi
GAP_DIR="$SAGE_LOCAL/gap/latest"
exec "$GAP_DIR/gap" -l "$GAP_DIR" -m 64m "$@"
Add Sage-specific options to the gap.sh source file
diff -ur old/gap.shi src/gap.shi
--- old/gap.shi 2012-02-20 20:04:01.000000000 +0000
+++ src/gap.shi 2012-09-02 10:44:27.488429081 +0100
@@ -8,7 +8,10 @@
## Then copy this file to a directory in your search path, e.g., '~/bin'.
## If you later move GAP to another location you must only change this file.
##
-
+if [ $SAGE_LOCAL"" = "" ]; then
+ echo "Set the environment variable SAGE_LOCAL."
+ exit 1
+fi
#############################################################################
##
@@ -20,7 +23,7 @@
## You won't have to change this unless you move the installation.
##
if [ "x$GAP_DIR" = "x" ]; then
-GAP_DIR="@gapdir@"
+ GAP_DIR="$SAGE_LOCAL/gap/latest"
fi
@@ -35,9 +38,9 @@
## in parallel with other programs you may want to set this value close
## to the amount of memory your computer has.
##
-#if [ "x$GAP_MEM" = "x" ]; then
-#GAP_MEM="-m 256m"
-#fi
+if [ "x$GAP_MEM" = "x" ]; then
+ GAP_MEM="-m 24m"
+fi
#############################################################################
......@@ -41,9 +41,6 @@ fi
cd src
# Use newer version of config.guess and config.sub (see Trac #19726)
cp "$SAGE_ROOT"/config/config.* cnf
# Configure
echo "Configuring GAP..."
./configure \
......@@ -56,16 +53,16 @@ if [[ $? -ne 0 ]]; then
fi
echo "Building GAP..."
# Building config only works with 1 thread
$MAKE -j1 config && $MAKE
$MAKE
if [[ $? -ne 0 ]]; then
echo >&2 "Error building GAP."
exit 1
fi
if [[ ! -f bin/gap.sh ]]; then
echo "Error building GAP ('gap.sh' not found)."
exit 1
fi
#if [[ ! -f bin/gap.sh ]]; then
# echo "Error building GAP ('gap.sh' not found)."
# exit 1
#fi
# Wipe the installation directory.
# This fixes https://trac.sagemath.org/ticket/22272
......@@ -73,7 +70,8 @@ echo "Removing previous installation of GAP..."
rm -rf "$INSTALL_DIR"
echo "Installing (copying) files..."
# gap has no notion of installing itself (similar to sage), copy everything
# GAP does net yet have a notion of installing itself (similar to sage)
# so we copy everything
# See http://trac.sagemath.org/13211 for rationale of the filesystem layout
mkdir -p "$SAGE_GAP" && mkdir "$INSTALL_DIR" && cp -R * "$INSTALL_DIR"
if [[ $? -ne 0 ]]; then
......@@ -87,9 +85,9 @@ ln -s "$GAP_DIR" "$SAGE_LOCAL/gap/latest"
echo "Copying GAP startup script..."
rm -f "$SAGE_LOCAL/bin/gap"
cp bin/gap.sh "$SAGE_LOCAL/bin/gap"
cp ../gap "$SAGE_LOCAL/bin/gap"
if [[ $? -ne 0 ]]; then
echo >&2 "Error copying customized GAP startup script."
echo >&2 "Error copying GAP startup script."
exit 1
fi
......@@ -111,3 +109,32 @@ fi
rm "$INSTALL_DIR"/tst/testinstall/ctblsolv.tst
rm "$INSTALL_DIR"/tst/testinstall/grppc.tst
rm "$INSTALL_DIR"/tst/testinstall/morpheus.tst
# When configuring with and without libgap, a couple different .o
# files are built differently by the current gap build system. So we
# need to reconfigure with --enable-libgap and for safety we make a
# full clean
$MAKE clean
echo "Configuring libGAP..."
./configure \
--prefix="$SAGE_LOCAL" PREFIX="$SAGE_LOCAL" \
--with-gmp="$SAGE_LOCAL" \
--enable-libgap \
CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS"
if [[ $? -ne 0 ]]; then
echo >&2 "Error configuring libGAP."
exit 1
fi
echo "Building libGAP..."
$MAKE libgap
if [ $? -ne 0 ]; then
echo >&2 "Error building libGAP."
exit 1
fi
echo "Installing libGAP..."
$MAKE install-libgap
if [ $? -ne 0 ]; then
echo >&2 "Error installing libGAP."
exit 1
fi
......@@ -55,7 +55,7 @@ rm -r !(Makefile.in)
# Write version to gap-version
cd "$SPKG_ROOT"
autoconf --trace='AC_INIT:$2' src/cnf/configure.in > src/gap-version
autoconf --trace='AC_INIT:$2' src/configure.ac > src/gap-version
rm -rf autom4te.cache
......
= libGAP =
== Description ==
This is the
== License ==
GPL v3+
== Upstream Contact ==
Volker Braun <vbraun.name@gmail.com>
== Dependencies ==
* GAP (that is, the gap-x.y.z.spkg of the same version)
== Special Update/Build Instructions ==
LibGAP is essentially a fork of the upstream GAP kernel. It is
developed in its own repository at
https://bitbucket.org/vbraun/libgap. This is also where the spkg
metadata is tracked. To build a new spkg, use the spkg/make-spkg.sh
script in the repository.
To update to a new version, you need to bump the version number in
configure.ac and rerun autotools (autoreconf -fiv).
Note that the repository in the spkg is just a dummy to make Sage
happy, any changes should be merged to the upstream repo.
Also, the spkg/libGAPify.py script requires the ply python package,
which is not part of sage. It is only required to make the spkg,
though. This scrip parses the GAP sources, identifies global
identifiers, and adds a libGAP_ prefix to them to avoid symbol
namespace collisions in Sage.
=== Patches ===
None
tarball=libgap-VERSION.tar.gz
sha1=996d925cdeae798219ab2dd7d5f4491f2e8f98f1
md5=dd5e20228a136a5fa8e86ad3f4bcf81a
cksum=1956377298
gap
----------
All lines of this file are ignored except the first.
It is copied by SAGE_ROOT/build/make/install into SAGE_ROOT/build/make/Makefile.
#!/usr/bin/env bash
cd src
make check
#!/usr/bin/env bash
if [ -z "$SAGE_LOCAL" ]; then
echo >&2 "SAGE_LOCAL undefined - exiting..."
echo >&2 "Maybe run 'sage -sh'?"
exit 1
fi
if [ "$SAGE64" = yes ]; then
if [ -z $CFLAG64 ]; then
CFLAG64=-m64
fi
CFLAGS="$CFLAGS $CFLAG64"
CXXFLAGS="$CXXFLAGS $CFLAG64"
echo "Building a 64-bit version of GAP (with '$CFLAG64')."
fi
if [ "$SAGE_DEBUG" == "yes" ] ; then
# Note that -g3 allows you to use preprocessor macros in gdb which are widely used
CFLAGS="$CFLAGS -O0 -g3 -DDEBUG_MASTERPOINTERS -DDEBUG_GLOBAL_BAGS -DDEBUG_FUNCTIONS_BAGS"
# -DDEBUG_HANDLER_REGISTRATION is broken
fi
source "$SAGE_LOCAL/gap/latest/sysinfo.gap"
echo "GAP was configured with $GAParch_system"
# location of the corresponding gap installation
# only used for the testsuite
CPPFLAGS="$CPPFLAGS"' -DSYS_DEFAULT_PATHS=\"'"$SAGE_LOCAL/gap/latest"'\"'
cd src
echo "Configuring libGAP..."
./configure --disable-static \
CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" CPPFLAGS="$CPPFLAGS" \
--libdir="$SAGE_LOCAL/lib" \
--with-gap_system_arch="$GAParch_system" \
--with-sage="$SAGE_LOCAL" --with-gmp="$SAGE_LOCAL" --prefix="$SAGE_LOCAL"
if [ $? -ne 0 ]; then
echo >&2 "Error configuring libGAP."
exit 1
fi
echo "Building libGAP..."
$MAKE
if [ $? -ne 0 ]; then
echo >&2 "Error building libGAP."
exit 1
fi
echo "Installing libGAP..."
$MAKE install
if [ $? -ne 0 ]; then
echo >&2 "Error installing libGAP."
exit 1
fi
......@@ -325,7 +325,7 @@ def PermutationGroup(gens=None, gap_group=None, domain=None, canonicalize=True,
sage: G = PermutationGroup([[(1,2,3),(4,5)],[(3,4)]])
sage: current_randstate().set_seed_gap()
sage: G._gap_().DerivedSeries()
[ Group( [ (3,4), (1,2,3)(4,5) ] ), Group( [ (1,5)(3,4), (1,5)(2,4), (1,5,3) ] ) ]
[ Group( [ (3,4), (1,2,3)(4,5) ] ), Group( [ (1,5)(3,4), (1,5)(2,4), (1,3,5) ] ) ]
TESTS::
......@@ -2980,6 +2980,8 @@ class PermutationGroup_generic(group.FiniteGroup):
[Subgroup of (Cyclic group of order 14 as a permutation group) generated by [()],
Subgroup of (Cyclic group of order 14 as a permutation group) generated by [(1,8)(2,9)(3,10)(4,11)(5,12)(6,13)(7,14)],
Subgroup of (Cyclic group of order 14 as a permutation group) generated by [(1,3,5,7,9,11,13)(2,4,6,8,10,12,14)],
Subgroup of (Cyclic group of order 14 as a permutation group) generated by [(1,2,3,4,5,6,7,8,9,10,11,12,13,14), (1,3,5,7,9,11,13)(2,4,6,8,10,12,14)]]
Subgroup of (Cyclic group of order 14 as a permutation group) generated by [(1,2,3,4,5,6,7,8,9,10,11,12,13,14)]]
AUTHOR:
......
......@@ -12,27 +12,27 @@ from .util cimport *
from sage.structure.sage_object cimport SageObject
from sage.structure.element cimport Element, ModuleElement, RingElement
cdef libGAP_Obj make_gap_list(sage_list) except NULL
cdef libGAP_Obj make_gap_record(sage_dict) except NULL
cdef libGAP_Obj make_gap_integer(sage_dict) except NULL
cdef libGAP_Obj make_gap_string(sage_string) except NULL
cdef Obj make_gap_list(sage_list) except NULL
cdef Obj make_gap_record(sage_dict) except NULL
cdef Obj make_gap_integer(sage_dict) except NULL
cdef Obj make_gap_string(sage_string) except NULL
cdef GapElement make_any_gap_element(parent, libGAP_Obj obj)
cdef GapElement make_GapElement(parent, libGAP_Obj obj)
cdef GapElement_List make_GapElement_List(parent, libGAP_Obj obj)
cdef GapElement_Record make_GapElement_Record(parent, libGAP_Obj obj)
cdef GapElement_Integer make_GapElement_Integer(parent, libGAP_Obj obj)
cdef GapElement_Rational make_GapElement_Rational(parent, libGAP_Obj obj)
cdef GapElement_String make_GapElement_String(parent, libGAP_Obj obj)
cdef GapElement_Boolean make_GapElement_Boolean(parent, libGAP_Obj obj)
cdef GapElement_Function make_GapElement_Function(parent, libGAP_Obj obj)
cdef GapElement make_any_gap_element(parent, Obj obj)
cdef GapElement make_GapElement(parent, Obj obj)
cdef GapElement_List make_GapElement_List(parent, Obj obj)
cdef GapElement_Record make_GapElement_Record(parent, Obj obj)
cdef GapElement_Integer make_GapElement_Integer(parent, Obj obj)
cdef GapElement_Rational make_GapElement_Rational(parent, Obj obj)
cdef GapElement_String make_GapElement_String(parent, Obj obj)
cdef GapElement_Boolean make_GapElement_Boolean(parent, Obj obj)
cdef GapElement_Function make_GapElement_Function(parent, Obj obj)
cdef class GapElement(RingElement):
# the pointer to the GAP object (memory managed by GASMAN)
cdef libGAP_Obj value
cdef Obj value
# comparison
cdef bint _compare_by_id
......@@ -41,7 +41,7 @@ cdef class GapElement(RingElement):
cpdef _set_compare_by_id(self)
cpdef _assert_compare_by_id(self)
cdef _initialize(self, parent, libGAP_Obj obj)
cdef _initialize(self, parent, Obj obj)
cpdef _type_number(self)
cpdef is_bool(self)
......@@ -77,11 +77,11 @@ cdef class GapElement_MethodProxy(GapElement_Function):
cdef GapElement first_argument
cdef class GapElement_Record(GapElement):
cpdef libGAP_UInt record_name_to_index(self, bytes py_name)
cpdef UInt record_name_to_index(self, bytes py_name)
cdef class GapElement_RecordIterator(object):
cdef GapElement_Record rec
cdef libGAP_UInt i
cdef UInt i
cdef class GapElement_List(GapElement):
pass
......
This diff is collapsed.
......@@ -8,11 +8,16 @@
# http://www.gnu.org/licenses/
###############################################################################
# Force including this Python header first to work around the name
# clashes between Python and GAP on T_BOOL, T_INT, T_CHAR, T_FLOAT,
# T_STRING, ... See #22626 for details
cdef extern from "<structmember.h>":
pass
cdef extern from "<gap/system.h>":
ctypedef char libGAP_Char
ctypedef int libGAP_Int
ctypedef unsigned char libGAP_UChar
ctypedef char Char
ctypedef int Int
ctypedef unsigned char UChar
cdef extern from "<gap/libgap.h>":
void libgap_initialize(int argc, char** argv)
......@@ -31,299 +36,299 @@ cdef extern from "<gap/libgap.h>":
void libgap_exit()
cdef extern from "<gap/code.h>":
ctypedef unsigned int libGAP_Stat
ctypedef libGAP_Stat* libGAP_PtrBody
ctypedef unsigned int Stat
ctypedef Stat* PtrBody
cdef extern from "<gap/gap.h>":
ctypedef unsigned int libGAP_UInt
ctypedef void* libGAP_ExecStatus
void libGAP_ViewObjHandler(void*)
void libGAP_InitializeGap(int*, char** argv)
void libGAP_set_system_variables(char**, char**)
cdef libGAP_UInt libGAP_Last
cdef libGAP_UInt libGAP_Last2
cdef libGAP_UInt libGAP_Last3
cdef libGAP_ExecStatus libGAP_STATUS_END
cdef libGAP_ExecStatus libGAP_STATUS_RETURN_VAL
cdef libGAP_ExecStatus libGAP_STATUS_RETURN_VOID
cdef libGAP_ExecStatus libGAP_STATUS_TNM
cdef libGAP_ExecStatus libGAP_STATUS_QUIT
cdef libGAP_ExecStatus libGAP_STATUS_EOF
cdef libGAP_ExecStatus libGAP_STATUS_ERROR
cdef libGAP_ExecStatus libGAP_STATUS_QQUIT
ctypedef unsigned int UInt
ctypedef void* ExecStatus
void ViewObjHandler(void*)
void InitializeGap(int*, char** argv)
void set_system_variables(char**, char**)
cdef UInt Last
cdef UInt Last2
cdef UInt Last3
cdef ExecStatus STATUS_END
cdef ExecStatus STATUS_RETURN_VAL
cdef ExecStatus STATUS_RETURN_VOID
cdef ExecStatus STATUS_TNM
cdef ExecStatus STATUS_QUIT
cdef ExecStatus STATUS_EOF
cdef ExecStatus STATUS_ERROR
cdef ExecStatus STATUS_QQUIT
cdef extern from "<gap/objects.h>":
ctypedef void* libGAP_Obj
libGAP_Obj libGAP_SHALLOW_COPY_OBJ(libGAP_Obj obj)
bint libGAP_IS_INTOBJ(libGAP_Obj obj)
libGAP_Obj libGAP_INTOBJ_INT(libGAP_Int)
libGAP_Int libGAP_INT_INTOBJ(libGAP_Obj)
libGAP_UInt libGAP_TNUM_OBJ(libGAP_Obj obj)
char* libGAP_TNAM_OBJ(libGAP_Obj obj)
cdef int libGAP_FIRST_REAL_TNUM
cdef int libGAP_FIRST_CONSTANT_TNUM
cdef int libGAP_T_INT
cdef int libGAP_T_INTPOS
cdef int libGAP_T_INTNEG
cdef int libGAP_T_RAT
cdef int libGAP_T_CYC
cdef int libGAP_T_FFE
cdef int libGAP_T_PERM2
cdef int libGAP_T_PERM4
cdef int libGAP_T_BOOL
cdef int libGAP_T_CHAR
cdef int libGAP_T_FUNCTION
cdef int libGAP_T_FLAGS
cdef int libGAP_T_MACFLOAT
cdef int libGAP_T_RESERVED_BY_GAP
cdef int libGAP_LAST_CONSTANT_TNUM
cdef int libGAP_IMMUTABLE
cdef int libGAP_FIRST_IMM_MUT_TNUM
cdef int libGAP_FIRST_RECORD_TNUM
cdef int libGAP_T_PREC
cdef int libGAP_LAST_RECORD_TNUM
cdef int libGAP_FIRST_LIST_TNUM
cdef int libGAP_FIRST_PLIST_TNUM
cdef int libGAP_T_PLIST
cdef int libGAP_T_PLIST_NDENSE
cdef int libGAP_T_PLIST_DENSE
cdef int libGAP_T_PLIST_DENSE_NHOM
cdef int libGAP_T_PLIST_DENSE_NHOM_SSORT
cdef int libGAP_T_PLIST_DENSE_NHOM_NSORT
cdef int libGAP_T_PLIST_EMPTY
cdef int libGAP_T_PLIST_HOM
cdef int libGAP_T_PLIST_HOM_NSORT
cdef int libGAP_T_PLIST_HOM_SSORT
cdef int libGAP_T_PLIST_TAB
cdef int libGAP_T_PLIST_TAB_NSORT
cdef int libGAP_T_PLIST_TAB_SSORT
cdef int libGAP_T_PLIST_TAB_RECT
cdef int libGAP_T_PLIST_TAB_RECT_NSORT
cdef int libGAP_T_PLIST_TAB_RECT_SSORT
cdef int libGAP_T_PLIST_CYC
cdef int libGAP_T_PLIST_CYC_NSORT
cdef int libGAP_T_PLIST_CYC_SSORT
cdef int libGAP_T_PLIST_FFE
cdef int libGAP_LAST_PLIST_TNUM
cdef int libGAP_T_RANGE_NSORT
cdef int libGAP_T_RANGE_SSORT
cdef int libGAP_T_BLIST
cdef int libGAP_T_BLIST_NSORT
cdef int libGAP_T_BLIST_SSORT
cdef int libGAP_T_STRING
cdef int libGAP_T_STRING_NSORT
cdef int libGAP_T_STRING_SSORT
cdef int libGAP_LAST_LIST_TNUM
cdef int libGAP_LAST_IMM_MUT_TNUM
cdef int libGAP_FIRST_EXTERNAL_TNUM
cdef int libGAP_T_COMOBJ
cdef int libGAP_T_POSOBJ
cdef int libGAP_T_DATOBJ
cdef int libGAP_T_WPOBJ
cdef int libGAP_LAST_EXTERNAL_TNUM
cdef int libGAP_LAST_REAL_TNUM
cdef int libGAP_LAST_VIRTUAL_TNUM
cdef int libGAP_FIRST_COPYING_TNUM
cdef int libGAP_COPYING
cdef int libGAP_LAST_COPYING_TNUM
cdef int libGAP_FIRST_TESTING_TNUM
cdef int libGAP_TESTING
cdef int libGAP_LAST_TESTING_TNUM
ctypedef void* Obj
Obj SHALLOW_COPY_OBJ(Obj obj)
bint IS_INTOBJ(Obj obj)
Obj INTOBJ_INT(Int)
Int INT_INTOBJ(Obj)
UInt TNUM_OBJ(Obj obj)
char* TNAM_OBJ(Obj obj)
cdef int FIRST_REAL_TNUM
cdef int FIRST_CONSTANT_TNUM
cdef int T_INT
cdef int T_INTPOS
cdef int T_INTNEG
cdef int T_RAT
cdef int T_CYC
cdef int T_FFE
cdef int T_PERM2
cdef int T_PERM4
cdef int T_BOOL
cdef int T_CHAR
cdef int T_FUNCTION
cdef int T_FLAGS
cdef int T_MACFLOAT
cdef int T_RESERVED_BY_GAP
cdef int LAST_CONSTANT_TNUM
cdef int IMMUTABLE
cdef int FIRST_IMM_MUT_TNUM
cdef int FIRST_RECORD_TNUM
cdef int T_PREC
cdef int LAST_RECORD_TNUM
cdef int FIRST_LIST_TNUM
cdef int FIRST_PLIST_TNUM
cdef int T_PLIST
cdef int T_PLIST_NDENSE
cdef int T_PLIST_DENSE
cdef int T_PLIST_DENSE_NHOM
cdef int T_PLIST_DENSE_NHOM_SSORT
cdef int T_PLIST_DENSE_NHOM_NSORT
cdef int T_PLIST_EMPTY
cdef int T_PLIST_HOM
cdef int T_PLIST_HOM_NSORT
cdef int T_PLIST_HOM_SSORT
cdef int T_PLIST_TAB
cdef int T_PLIST_TAB_NSORT
cdef int T_PLIST_TAB_SSORT
cdef int T_PLIST_TAB_RECT
cdef int T_PLIST_TAB_RECT_NSORT
cdef int T_PLIST_TAB_RECT_SSORT
cdef int T_PLIST_CYC
cdef int T_PLIST_CYC_NSORT
cdef int T_PLIST_CYC_SSORT
cdef int T_PLIST_FFE
cdef int LAST_PLIST_TNUM
cdef int T_RANGE_NSORT
cdef int T_RANGE_SSORT
cdef int T_BLIST
cdef int T_BLIST_NSORT
cdef int T_BLIST_SSORT
cdef int T_STRING
cdef int T_STRING_NSORT
cdef int T_STRING_SSORT
cdef int LAST_LIST_TNUM
cdef int LAST_IMM_MUT_TNUM
cdef int FIRST_EXTERNAL_TNUM
cdef int T_COMOBJ
cdef int T_POSOBJ
cdef int T_DATOBJ
cdef int T_WPOBJ
cdef int LAST_EXTERNAL_TNUM
cdef int LAST_REAL_TNUM
cdef int LAST_VIRTUAL_TNUM
cdef int FIRST_COPYING_TNUM
cdef int COPYING
cdef int LAST_COPYING_TNUM
cdef int FIRST_TESTING_TNUM
cdef int TESTING
cdef int LAST_TESTING_TNUM
cdef extern from "<gap/read.h>":
void* libGAP_ReadEvalCommand(libGAP_Obj context, libGAP_UInt *dualSemicolon)
void* libGAP_ReadEvalFile()
void* libGAP_ReadEvalResult
bint libGAP_READ_ERROR()
void* ReadEvalCommand(Obj context, UInt *dualSemicolon)
void* ReadEvalFile()
void* ReadEvalResult "TLS(ReadEvalResult)"
bint READ_ERROR()
cdef extern from "<gap/scanner.h>":
void libGAP_ClearError()
libGAP_UInt libGAP_NrError
libGAP_UInt libGAP_Symbol
void libGAP_GetSymbol()
void libGAP_Match (libGAP_UInt symbol, char* msg, libGAP_UInt skipto)
int libGAP_S_ILLEGAL
int libGAP_S_IDENT
int libGAP_S_UNBIND
int libGAP_S_ISBOUND
int libGAP_S_TRYNEXT
int libGAP_S_INFO
int libGAP_S_ASSERT
int libGAP_S_SAVEWS
int libGAP_S_LOADWS
int libGAP_S_LBRACK
int libGAP_S_LBRACE
int libGAP_S_BLBRACK
int libGAP_S_BLBRACE
int libGAP_S_RBRACK
int libGAP_S_RBRACE
int libGAP_S_DOT
int libGAP_S_BDOT
int libGAP_S_LPAREN
int libGAP_S_RPAREN
int libGAP_S_COMMA
int libGAP_S_DOTDOT
int libGAP_S_COLON
int libGAP_S_PARTIALINT
int libGAP_S_INT
int libGAP_S_TRUE
int libGAP_S_FALSE
int libGAP_S_CHAR
int libGAP_S_STRING
int libGAP_S_PARTIALSTRING
int libGAP_S_REC
int libGAP_S_FUNCTION
int libGAP_S_LOCAL
int libGAP_S_END
int libGAP_S_MAPTO
int libGAP_S_MULT
int libGAP_S_DIV
int libGAP_S_MOD
int libGAP_S_POW
int libGAP_S_PLUS
int libGAP_S_MINUS
int libGAP_S_EQ
int libGAP_S_LT
int libGAP_S_GT
int libGAP_S_NE
int libGAP_S_LE
int libGAP_S_GE
int libGAP_S_IN
int libGAP_S_NOT
int libGAP_S_AND
int libGAP_S_OR
int libGAP_S_ASSIGN
int libGAP_S_IF
int libGAP_S_FOR
int libGAP_S_WHILE
int libGAP_S_REPEAT
int libGAP_S_THEN
int libGAP_S_ELIF
int libGAP_S_ELSE
int libGAP_S_FI
int libGAP_S_DO
int libGAP_S_OD
int libGAP_S_UNTIL
int libGAP_S_BREAK
int libGAP_S_RETURN
int libGAP_S_QUIT
int libGAP_S_QQUIT
int libGAP_S_CONTINUE
int libGAP_S_SEMICOLON
int libGAP_S_EOF
void ClearError()
UInt NrError "TLS(NrError)"
UInt Symbol "TLS(Symbol)"
void GetSymbol()
void Match (UInt symbol, char* msg, UInt skipto)
int S_ILLEGAL
int S_IDENT
int S_UNBIND
int S_ISBOUND
int S_TRYNEXT
int S_INFO
int S_ASSERT
int S_SAVEWS
int S_LOADWS
int S_LBRACK
int S_LBRACE
int S_BLBRACK
int S_BLBRACE
int S_RBRACK
int S_RBRACE
int S_DOT
int S_BDOT
int S_LPAREN
int S_RPAREN
int S_COMMA
int S_DOTDOT
int S_COLON
int S_PARTIALINT
int S_INT
int S_TRUE
int S_FALSE
int S_CHAR
int S_STRING
int S_PARTIALSTRING
int S_REC
int S_FUNCTION
int S_LOCAL
int S_END
int S_MAPTO
int S_MULT
int S_DIV
int S_MOD
int S_POW
int S_PLUS
int S_MINUS
int S_EQ
int S_LT
int S_GT
int S_NE
int S_LE
int S_GE
int S_IN
int S_NOT
int S_AND
int S_OR
int S_ASSIGN
int S_IF
int S_FOR
int S_WHILE
int S_REPEAT
int S_THEN
int S_ELIF
int S_ELSE
int S_FI
int S_DO
int S_OD
int S_UNTIL
int S_BREAK
int S_RETURN
int S_QUIT
int S_QQUIT
int S_CONTINUE
int S_SEMICOLON
int S_EOF
cdef extern from "<gap/gvars.h>":
libGAP_UInt libGAP_GVarName(char* name)
void libGAP_AssGVar(libGAP_UInt gvar, libGAP_Obj val)
libGAP_Obj libGAP_VAL_GVAR(libGAP_UInt gvar)
UInt GVarName(char* name)
void AssGVar(UInt gvar, Obj val)
Obj VAL_GVAR(UInt gvar)
cdef extern from "<gap/string.h>":
char* libGAP_CSTR_STRING(libGAP_Obj list)
int libGAP_GET_LEN_STRING(libGAP_Obj list)
bint libGAP_IS_STRING(libGAP_Obj obj)
bint libGAP_IsStringConv(libGAP_Obj obj)
bint libGAP_ConvString(libGAP_Obj obj)
void libGAP_C_NEW_STRING(libGAP_Obj new_gap_string, int length, char* c_string)
char* CSTR_STRING(Obj list)
int GET_LEN_STRING(Obj list)
bint IS_STRING(Obj obj)
bint IsStringConv(Obj obj)
bint ConvString(Obj obj)
void C_NEW_STRING(Obj new_gap_string, int length, char* c_string)
cdef extern from "<gap/gasman.h>":
void libGAP_InitGlobalBag(libGAP_Obj* addr, char* cookie)
libGAP_Obj libGAP_NewBag(libGAP_UInt type, libGAP_UInt size)
void libGAP_CHANGED_BAG(libGAP_Obj bag)
void libGAP_MARK_BAG(libGAP_Obj bag)
bint libGAP_IS_MARKED_ALIVE(libGAP_Obj bag)
bint libGAP_IS_MARKED_DEAD(libGAP_Obj bag)
bint libGAP_IS_MARKED_HALFDEAD(libGAP_Obj bag)
cdef libGAP_UInt libGAP_NrAllBags
cdef libGAP_UInt libGAP_SizeAllBags
cdef libGAP_UInt libGAP_NrLiveBags
cdef libGAP_UInt libGAP_SizeLiveBags
cdef libGAP_UInt libGAP_NrDeadBags
cdef libGAP_UInt libGAP_SizeDeadBags
cdef libGAP_UInt libGAP_NrHalfDeadBags
libGAP_UInt libGAP_CollectBags(libGAP_UInt size, libGAP_UInt full)
void libGAP_CallbackForAllBags(void (*func)(libGAP_Obj))
char* libGAP_TNAM_BAG(libGAP_Obj obj)
libGAP_UInt libGAP_TNUM_BAG(libGAP_Obj)
libGAP_UInt libGAP_SIZE_BAG(libGAP_Obj)
void libGAP_CheckMasterPointers()
libGAP_Obj* libGAP_MptrBags
libGAP_Obj* libGAP_YoungBags
libGAP_Obj* libGAP_OldBags
libGAP_Obj* libGAP_AllocBags
libGAP_Obj* libGAP_MarkedBags
libGAP_Obj* libGAP_ChangedBags
void InitGlobalBag(Obj* addr, char* cookie)
Obj NewBag(UInt type, UInt size)
void CHANGED_BAG(Obj bag)
void MARK_BAG(Obj bag)
bint IS_MARKED_ALIVE(Obj bag)
bint IS_MARKED_DEAD(Obj bag)
bint IS_MARKED_HALFDEAD(Obj bag)
cdef UInt NrAllBags
cdef UInt SizeAllBags
cdef UInt NrLiveBags
cdef UInt SizeLiveBags
cdef UInt NrDeadBags
cdef UInt SizeDeadBags
cdef UInt NrHalfDeadBags
UInt CollectBags(UInt size, UInt full)
void CallbackForAllBags(void (*func)(Obj))
char* TNAM_BAG(Obj obj)
UInt TNUM_BAG(Obj)
UInt SIZE_BAG(Obj)
void CheckMasterPointers()
Obj* MptrBags
Obj* YoungBags
Obj* OldBags
Obj* AllocBags
Obj* MarkedBags
Obj* ChangedBags
# in gasman.c but not declared in gasman.h
cdef extern libGAP_Obj* libGAP_StopBags
cdef extern libGAP_Obj* libGAP_EndBags
cdef extern Obj* StopBags
cdef extern Obj* EndBags
cdef extern from "<gap/ariths.h>":
libGAP_Obj libGAP_SUM (libGAP_Obj, libGAP_Obj)
libGAP_Obj libGAP_DIFF(libGAP_Obj, libGAP_Obj)
libGAP_Obj libGAP_PROD(libGAP_Obj, libGAP_Obj)
libGAP_Obj libGAP_QUO(libGAP_Obj, libGAP_Obj)
libGAP_Obj libGAP_POW(libGAP_Obj, libGAP_Obj)
libGAP_Obj libGAP_MOD(libGAP_Obj, libGAP_Obj)
libGAP_Obj libGAP_CALL_0ARGS(libGAP_Obj f) # 0 arguments
libGAP_Obj libGAP_CALL_1ARGS(libGAP_Obj f, libGAP_Obj a1) # 1 argument
libGAP_Obj libGAP_CALL_2ARGS(libGAP_Obj f, libGAP_Obj a1, libGAP_Obj a2)
libGAP_Obj libGAP_CALL_3ARGS(libGAP_Obj f, libGAP_Obj a1, libGAP_Obj a2, libGAP_Obj a3)
libGAP_Obj libGAP_CALL_4ARGS(libGAP_Obj f, libGAP_Obj a1, libGAP_Obj a2, libGAP_Obj a3,
libGAP_Obj a4)
libGAP_Obj libGAP_CALL_5ARGS(libGAP_Obj f, libGAP_Obj a1, libGAP_Obj a2, libGAP_Obj a3,
libGAP_Obj a4, libGAP_Obj a5)
libGAP_Obj libGAP_CALL_6ARGS(libGAP_Obj f, libGAP_Obj a1, libGAP_Obj a2, libGAP_Obj a3,
libGAP_Obj a4, libGAP_Obj a5, libGAP_Obj a6)
libGAP_Obj libGAP_CALL_XARGS(libGAP_Obj f, libGAP_Obj args) # more than 6 arguments
bint libGAP_EQ(libGAP_Obj opL, libGAP_Obj opR)
bint libGAP_LT(libGAP_Obj opL, libGAP_Obj opR)
Obj SUM (Obj, Obj)
Obj DIFF(Obj, Obj)
Obj PROD(Obj, Obj)
Obj QUO(Obj, Obj)
Obj POW(Obj, Obj)
Obj MOD(Obj, Obj)
Obj CALL_0ARGS(Obj f) # 0 arguments
Obj CALL_1ARGS(Obj f, Obj a1) # 1 argument
Obj CALL_2ARGS(Obj f, Obj a1, Obj a2)
Obj CALL_3ARGS(Obj f, Obj a1, Obj a2, Obj a3)
Obj CALL_4ARGS(Obj f, Obj a1, Obj a2, Obj a3,
Obj a4)
Obj CALL_5ARGS(Obj f, Obj a1, Obj a2, Obj a3,
Obj a4, Obj a5)
Obj CALL_6ARGS(Obj f, Obj a1, Obj a2, Obj a3,
Obj a4, Obj a5, Obj a6)
Obj CALL_XARGS(Obj f, Obj args) # more than 6 arguments
bint EQ(Obj opL, Obj opR)
bint LT(Obj opL, Obj opR)
cdef extern from "<gap/calls.h>":
bint libGAP_IS_FUNC(libGAP_Obj)
bint IS_FUNC(Obj)
cdef extern from "<gap/plist.h>":
libGAP_Obj libGAP_NEW_PLIST(int type, int len)
bint libGAP_IS_PLIST(libGAP_Obj lst)
int libGAP_LEN_PLIST(libGAP_Obj lst)
libGAP_Obj libGAP_ELM_PLIST(libGAP_Obj lst, int pos)
Obj NEW_PLIST(int type, int len)
bint IS_PLIST(Obj lst)
int LEN_PLIST(Obj lst)
Obj ELM_PLIST(Obj lst, int pos)
cdef extern from "<gap/lists.h>":
void libGAP_UNB_LIST(libGAP_Obj list, int pos)
bint libGAP_IS_LIST(libGAP_Obj lst)
int libGAP_LEN_LIST(libGAP_Obj lst)
libGAP_Obj libGAP_ELM_LIST(libGAP_Obj lst, int pos)
void UNB_LIST(Obj list, int pos)
bint IS_LIST(Obj lst)
int LEN_LIST(Obj lst)
Obj ELM_LIST(Obj lst, int pos)
cdef extern from "<gap/listfunc.h>":
void libGAP_AddList(libGAP_Obj list, libGAP_Obj obj)
void libGAP_AddPlist(libGAP_Obj list, libGAP_Obj obj)
void AddList(Obj list, Obj obj)
void AddPlist(Obj list, Obj obj)
cdef extern from "<gap/records.h>":
char* libGAP_NAME_RNAM(libGAP_UInt rnam)
libGAP_UInt libGAP_RNamIntg(int i)
bint libGAP_IS_REC(libGAP_Obj obj)
libGAP_Obj libGAP_ELM_REC(libGAP_Obj rec, libGAP_UInt rnam)
libGAP_UInt libGAP_RNamName(libGAP_Char* name)
char* NAME_RNAM(UInt rnam)
UInt RNamIntg(int i)
bint IS_REC(Obj obj)
Obj ELM_REC(Obj rec, UInt rnam)
UInt RNamName(Char* name)
cdef extern from "<gap/precord.h>":
libGAP_Obj libGAP_NEW_PREC(int len)
int libGAP_LEN_PREC(libGAP_Obj rec)
int libGAP_GET_RNAM_PREC(libGAP_Obj rec, int i)
libGAP_Obj libGAP_GET_ELM_PREC(libGAP_Obj rec, int i)
void libGAP_AssPRec(libGAP_Obj rec, libGAP_UInt rnam, libGAP_Obj val)
void libGAP_UnbPRec(libGAP_Obj rec, libGAP_UInt rnam)
bint libGAP_IsbPRec(libGAP_Obj rec, libGAP_UInt rnam)
libGAP_Obj libGAP_ElmPRec(libGAP_Obj rec, libGAP_UInt rnam)
Obj NEW_PREC(int len)
int LEN_PREC(Obj rec)
int GET_RNAM_PREC(Obj rec, int i)
Obj GET_ELM_PREC(Obj rec, int i)
void AssPRec(Obj rec, UInt rnam, Obj val)
void UnbPRec(Obj rec, UInt rnam)
bint IsbPRec(Obj rec, UInt rnam)
Obj ElmPRec(Obj rec, UInt rnam)
cdef extern from "<gap/cyclotom.h>":
pass
cdef extern from "<gap/bool.h>":
cdef libGAP_Obj libGAP_True
cdef libGAP_Obj libGAP_False
cdef Obj True
cdef Obj False
cdef extern from "<gap/vars.h>":
cdef int libGAP_T_LVARS
libGAP_Obj libGAP_BottomLVars
cdef int T_LVARS
Obj BottomLVars "TLS(BottomLVars)"
......
......@@ -150,8 +150,10 @@ using the recursive expansion of the
Using the libGAP C library from Cython
======================================
.. TODO:: Update the following text
The lower-case ``libgap_foobar`` functions are ones that we added to
make the libGAP C shared library. The ``libGAP_foobar`` methods are
make the libGAP C shared library. The ``foobar`` methods are
the original GAP methods simply prefixed with the string
``libGAP_``. The latter were originally not designed to be in a
library, so some care needs to be taken to call them.
......@@ -166,12 +168,12 @@ the following pattern::
cdef f()
libgap_mark_stack_bottom()
libGAP_function()
function()
cdef g()
libgap_mark_stack_bottom();
f() # f() changed the stack bottom marker
libGAP_function() # boom
function() # boom
The solution is to re-order ``g()`` to first call ``f()``. In order to
catch this error, it is recommended that you wrap calls into libGAP in
......@@ -180,13 +182,13 @@ catch this error, it is recommended that you wrap calls into libGAP in
cdef f()
libgap_enter()
libGAP_function()
function()
libgap_exit()
cdef g()
f()
libgap_enter()
libGAP_function()
function()
libgap_exit()
If you accidentally call ``libgap_enter()`` twice then an error
......@@ -243,6 +245,7 @@ AUTHORS:
##############################################################################
from __future__ import print_function
cimport gap_includes
from .gap_includes cimport *
from sage.structure.sage_object cimport SageObject
......@@ -258,13 +261,13 @@ from sage.libs.gap.element cimport *
### Debugging ##############################################################
############################################################################
cdef void report(libGAP_Obj bag):
print(libGAP_TNAM_OBJ(bag), <int>libGAP_TNUM_BAG(bag), <int>libGAP_SIZE_BAG(bag))
cdef void report(Obj bag):
print(TNAM_OBJ(bag), <int>TNUM_BAG(bag), <int>SIZE_BAG(bag))
cdef void print_gasman_objects():
libgap_enter()
libGAP_CallbackForAllBags(report)
CallbackForAllBags(report)
libgap_exit()
......@@ -351,7 +354,7 @@ class Gap(Parent):
return make_GapElement_Record(self, make_gap_record(x))
elif isinstance(x, bool):
# attention: must come before int
return make_GapElement_Boolean(self, libGAP_True if x else libGAP_False)
return make_GapElement_Boolean(self, gap_includes.True if x else gap_includes.False)
elif isinstance(x, int):
return make_GapElement_Integer(self, make_gap_integer(x))
elif isinstance(x, basestring):
......@@ -787,7 +790,7 @@ class Gap(Parent):
sage: libgap.collect()
"""
libgap_enter()
rc = libGAP_CollectBags(0, 1)
rc = CollectBags(0, 1)
libgap_exit()
if rc != 1:
raise RuntimeError('Garbage collection failed.')
......
......@@ -15,9 +15,9 @@ from .gap_includes cimport *
############################################################################
cdef class ObjWrapper(object):
cdef libGAP_Obj value
cdef Obj value
cdef ObjWrapper wrap_obj(libGAP_Obj obj)
cdef ObjWrapper wrap_obj(Obj obj)
# a dictionary to keep all GAP elements
cdef dict owned_objects_refcount
......@@ -27,8 +27,8 @@ cpdef get_owned_objects()
# Reference count GAP objects that you want to prevent from being
# garbage collected
cdef void reference_obj(libGAP_Obj obj)
cdef void dereference_obj(libGAP_Obj obj)
cdef void reference_obj(Obj obj)
cdef void dereference_obj(Obj obj)
# callback from the GAP memory manager so we can mark all_gap_elements.values()
cdef void gasman_callback()
......@@ -51,8 +51,8 @@ cdef initialize()
# get deleted this works by assigning it to a global variable. This is
# very simple, but you can't use it to keep two objects alive. Be
# careful.
cdef libGAP_UInt reference_holder
cdef void hold_reference(libGAP_Obj obj)
cdef UInt reference_holder
cdef void hold_reference(Obj obj)
############################################################################
......@@ -60,7 +60,7 @@ cdef void hold_reference(libGAP_Obj obj)
############################################################################
# Evaluate a string
cdef libGAP_Obj gap_eval(str gap_string) except? NULL
cdef Obj gap_eval(str gap_string) except? NULL
############################################################################
......