Java specific test to test the various.i typemap library.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5279 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2003-11-08 21:02:37 +00:00
commit 3a6d631b08
3 changed files with 101 additions and 1 deletions

View file

@ -0,0 +1,45 @@
/* Java various.i library tests */
%module java_lib_various
%include "various.i"
%apply char **STRING_ARRAY { char **received };
%apply char **STRING_ARRAY { char **get_names };
%apply char **STRING_ARRAY { char **languages };
%apply char *BYTE { char *chars };
%{
char *langs[] = { "Hungarian", "Afrikaans", "Norwegian", 0 };
%}
%immutable languages; /* TODO: fix, because there is a problem with setters */
%inline %{
char **languages = &langs[0];
%}
%inline %{
int check_animals(char **received) {
const char *expected[] = {"Cat","Dog","Cow","Goat", 0};
int strings_match = 1;
int i=0;
while (expected[i]) {
if (strcmp(received[i], expected[i]) != 0)
strings_match = 0;
i++;
}
return strings_match;
}
char **get_names() {
static char *values[] = { "Dave", "Mike", "Susan", "John", "Michelle", 0};
return &values[0];
}
void charout(char *chars) {
if(chars != NULL)
sprintf(chars, "by jove");
}
%}