-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Markus Pfeiffer
committed
Aug 16, 2018
1 parent
01e44a1
commit 3f7dd1c
Showing
13 changed files
with
359 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,3 +86,6 @@ doc/gapmacrodoc.idx | |
/hpcgap/ward | ||
|
||
/builds/ | ||
|
||
/libgap.la | ||
/.libs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,6 +177,10 @@ GAPInput | |
|
||
;; | ||
|
||
testlibgap) | ||
make testlibgap | ||
;; | ||
|
||
*) | ||
if [[ ! -f $SRCDIR/tst/${TEST_SUITE}.g ]] | ||
then | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
// LibGAP API - API for using GAP as shared library. | ||
|
||
#include "libgap-api.h" | ||
|
||
#include "bool.h" | ||
#include "calls.h" | ||
#include "gapstate.h" | ||
#include "gvars.h" | ||
#include "intobj.h" | ||
#include "opers.h" | ||
#include "plist.h" | ||
#include "stringobj.h" | ||
|
||
Obj FuncREAD_ALL_COMMANDS( | ||
Obj self, Obj instream, Obj echo, Obj capture, Obj resultCallback); | ||
|
||
// Setup and initialisation | ||
|
||
void GAP_Initialize(int argc, | ||
char ** argv, | ||
char ** env, | ||
CallbackFunc markBagsCallback, | ||
CallbackFunc errorCallback) | ||
{ | ||
InitializeGap(&argc, argv, env); | ||
SetExtraMarkFuncBags(markBagsCallback); | ||
STATE(JumpToCatchCallback) = errorCallback; | ||
} | ||
|
||
void GAP_Finalize(void) | ||
{ | ||
FinishBags(); | ||
} | ||
|
||
|
||
/*************************************************************************/ | ||
/*** Integer *************************************************************/ | ||
/*************************************************************************/ | ||
|
||
Obj GAP_IntObj_Int(Int value) | ||
{ | ||
return INTOBJ_INT(value); | ||
} | ||
|
||
Int GAP_Int_IntObj(Obj value) | ||
{ | ||
return INT_INTOBJ(value); | ||
} | ||
|
||
/*************************************************************************/ | ||
/*** Strings *************************************************************/ | ||
/*************************************************************************/ | ||
|
||
char * GAP_CSTR_STRING(Obj str) | ||
{ | ||
return CSTR_STRING(str); | ||
} | ||
|
||
Obj GAP_MakeString(char * str) | ||
{ | ||
return MakeString(str); | ||
} | ||
|
||
/*************************************************************************/ | ||
/*** List ****************************************************************/ | ||
/*************************************************************************/ | ||
|
||
Obj GAP_NewPList(UInt length) | ||
{ | ||
return NEW_PLIST(T_PLIST, length); | ||
} | ||
|
||
void GAP_SetLenPList(Obj list, Int len) | ||
{ | ||
SET_LEN_PLIST(list, len); | ||
} | ||
|
||
void GAP_AssPList(Obj list, Int pos, Obj elem) | ||
{ | ||
AssPlist(list, pos, elem); | ||
} | ||
|
||
void GAP_SetElmPList(Obj list, Int pos, Obj elem) | ||
{ | ||
SET_ELM_PLIST(list, pos, elem); | ||
} | ||
|
||
Obj GAP_ElmPList(Obj list, Int pos) | ||
{ | ||
return ELM_PLIST(list, pos); | ||
} | ||
|
||
Int GAP_LenPList(Obj list) | ||
{ | ||
return LEN_PLIST(list); | ||
} | ||
|
||
/*************************************************************************/ | ||
/*** GVars ***************************************************************/ | ||
/*************************************************************************/ | ||
|
||
Obj GAP_ValGVar(const char * name) | ||
{ | ||
UInt gvar = GVarName(name); | ||
if (gvar != 0) { | ||
return ValGVar(gvar); | ||
} | ||
else { | ||
return NULL; | ||
} | ||
} | ||
|
||
/*************************************************************************/ | ||
/*** Functions ***********************************************************/ | ||
/*************************************************************************/ | ||
|
||
Obj GAP_CallFuncList(Obj func, Obj arg_list) | ||
{ | ||
return CallFuncList(func, arg_list); | ||
} | ||
|
||
Obj GAP_EvalString(const char * cmd) | ||
{ | ||
Obj instream; | ||
Obj res; | ||
Obj viewObjFunc, streamFunc; | ||
|
||
streamFunc = GAP_ValGVar("InputTextString"); | ||
viewObjFunc = GAP_ValGVar("ViewObj"); | ||
|
||
instream = DoOperation1Args(streamFunc, MakeString(cmd)); | ||
res = FuncREAD_ALL_COMMANDS(0L, instream, False, True, viewObjFunc); | ||
return res; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
// LibGAP API - API for using GAP as shared library. | ||
// Most functions defined here are just wrappers of | ||
// internal GAP kernel functions. | ||
|
||
// The corresponding kernel functions are written before the functions | ||
// declarations. Please see their documentation for more details. | ||
|
||
#ifndef LIBGAP_API_H | ||
#define LIBGAP_API_H | ||
|
||
#include "gap.h" | ||
|
||
typedef void (*CallbackFunc)(void); | ||
|
||
// Initialisation and finalization | ||
void GAP_Initialize(int argc, | ||
char ** argv, | ||
char ** env, | ||
CallbackFunc markBagsCallback, | ||
CallbackFunc errorCallback); | ||
|
||
void GAP_Finalize(void); | ||
|
||
/*************************************************************************/ | ||
/*** Integer *************************************************************/ | ||
/*************************************************************************/ | ||
|
||
// INTOBJ_INT | ||
Obj GAP_IntObj_Int(Int); | ||
|
||
// INT_INTOBJ | ||
Int GAP_Int_IntObj(Obj); | ||
|
||
/*************************************************************************/ | ||
/*** Strings *************************************************************/ | ||
/*************************************************************************/ | ||
|
||
// CSTR_STRING | ||
char * GAP_CSTR_STRING(Obj); | ||
|
||
// MakeString | ||
Obj GAP_MakeString(char *); | ||
|
||
/*************************************************************************/ | ||
/*** List ****************************************************************/ | ||
/*************************************************************************/ | ||
|
||
// NEW_PLIST( T_PLIST, length ) | ||
Obj GAP_NewPList(UInt length); | ||
|
||
// SET_LEN_PLIST | ||
void GAP_SetLenPList(Obj, Int); | ||
|
||
// AssPlist | ||
void GAP_AssPList(Obj list, Int pos, Obj elem); | ||
|
||
// SET_ELM_PLIST | ||
void GAP_SetElmPList(Obj, Int, Obj); | ||
|
||
// ELM_PLIST | ||
Obj GAP_ElmPList(Obj, Int); | ||
|
||
// LEN_PLIST | ||
Int GAP_LenPList(Obj); | ||
|
||
/*************************************************************************/ | ||
/*** GVars ***************************************************************/ | ||
/*************************************************************************/ | ||
|
||
// Combines GVarName and ValGVar. For a given string, it returns the value | ||
// of the gvar with name <name>, or NULL if the global variable is not | ||
// defined. | ||
Obj GAP_ValGVar(const char * name); | ||
|
||
/*************************************************************************/ | ||
/*** Functions ***********************************************************/ | ||
/*************************************************************************/ | ||
|
||
// CallFuncList | ||
Obj GAP_CallFuncList(Obj, Obj); | ||
|
||
|
||
Obj GAP_EvalString(const char * cmd); | ||
|
||
#endif |
Oops, something went wrong.