Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed JuliaTuple #155

Merged
merged 1 commit into from
Nov 14, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions JuliaInterface/src/JuliaInterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -497,35 +497,6 @@ static Obj Func_ConvertedFromJulia_record_dict(Obj self, Obj dict)
return return_list;
}

// Converts the GAP list <list> into a julia tuple and returns the julia
// object GAP object which holds the pointer to that tuple.
static Obj FuncJuliaTuple(Obj self, Obj list)
{
if (!IS_PLIST(list)) {
ErrorMayQuit("argument is not a plain list", 0, 0);
}

jl_datatype_t * tuple_type = 0;
jl_svec_t * params = 0;
jl_svec_t * param_types = 0;
jl_value_t * result = 0;

BEGIN_JULIA
int len = LEN_PLIST(list);
params = jl_alloc_svec(len);
param_types = jl_alloc_svec(len);
for (int i = 0; i < len; i++) {
jl_value_t * current_obj =
_ConvertedToJulia_internal(ELM_PLIST(list, i + 1));
jl_svecset(params, i, current_obj);
jl_svecset(param_types, i, jl_typeof(current_obj));
}
tuple_type = jl_apply_tuple_type(param_types);
result = jl_new_structv(tuple_type, jl_svec_data(params), len);
END_JULIA
return NewJuliaObj(result);
}

// Returns a julia object GAP object that holds the pointer to a julia symbol
// :<name>.
static Obj FuncJuliaSymbol(Obj self, Obj name)
Expand Down Expand Up @@ -652,7 +623,6 @@ static StructGVarFunc GVarFuncs[] = {
GVAR_FUNC(_JuliaGetGlobalVariable, 1, "name"),
GVAR_FUNC(_JuliaGetGlobalVariableByModule, 2, "name,module"),
GVAR_FUNC(JuliaGetFieldOfObject, 2, "obj,name"),
GVAR_FUNC(JuliaTuple, 1, "list"),
GVAR_FUNC(JuliaSymbol, 1, "name"),
GVAR_FUNC(JuliaModule, 1, "name"),
GVAR_FUNC(_ConvertedFromJulia_record_dict, 1, "dict"),
Expand Down
10 changes: 5 additions & 5 deletions JuliaInterface/tst/utils.tst
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ gap> JuliaGetGlobalVariable("foo");
1

##
gap> JuliaTuple([]);
gap> Julia.Core.Tuple([]);
<Julia: ()>
gap> JuliaTuple([1]);
gap> Julia.Core.Tuple([1]);
<Julia: (1,)>
gap> JuliaTuple([1,true,fail]);
gap> Julia.Core.Tuple([1,true,fail]);
<Julia: (1, true, GAP: fail)>
gap> JuliaTuple(1);
Error, argument is not a plain list
gap> Julia.Core.Tuple(1);
<Julia: (1,)>

##
gap> JuliaSymbol("someSymbol");
Expand Down