Skip to content

Commit

Permalink
add stringfeatures check typemap
Browse files Browse the repository at this point in the history
  • Loading branch information
sploving committed Jul 22, 2011
1 parent c3d0e6d commit 334cc39
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/interfaces/lua_modular/swig_typemaps.i
Expand Up @@ -197,6 +197,22 @@ TYPEMAP_SGMATRIX(float64_t)
/* input/output typemap for CStringFeatures */
%define TYPEMAP_STRINGFEATURES(SGTYPE, TYPECODE)

%typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) shogun::SGStringList<SGTYPE> {
if(!lua_istable(L, $input)) {
luaL_typerror(L, $input, "table");
$1 = 0;
}
else {
$1 = 1;
int numitems = 0;
numitems = lua_objlen(L, $input);
if(numitems == 0) {
luaL_argerror(L, $input, "empty table");
$1 = 0;
}
}
}

%typemap(in) shogun::SGStringList<SGTYPE> {
int32_t size = 0;
int32_t i;
Expand Down

0 comments on commit 334cc39

Please sign in to comment.