/* * SWIG Typemap library for Java * Various useful typemaps. * */ /* * char **STRING_ARRAY typemaps. * These typemaps are for C String arrays which are NULL terminated. * char *values[] = { "one", "two", "three", NULL }; // note NULL * char ** is mapped to a Java String[]. * * Example usage wrapping: * %apply char **STRING_ARRAY { char **input }; * char ** foo(char **input); * * Java usage: * String numbers[] = { "one", "two", "three" }; * String[] ret = modulename.foo( numbers }; */ %typemap(jni) char **STRING_ARRAY "jobjectArray" %typemap(jtype) char **STRING_ARRAY "String[]" %typemap(jstype) char **STRING_ARRAY "String[]" %typemap(in) char **STRING_ARRAY (jint size) { int i = 0; size = JCALL1(GetArrayLength, jenv, $input); #ifdef __cplusplus $1 = new char*[size+1]; #else $1 = (char **)calloc(size+1, sizeof(char *)); #endif for (i = 0; i