added some pointer support and fixed style problem

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11415 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Baozeng Ding 2009-07-17 16:21:54 +00:00
commit 93a0308e21
14 changed files with 368 additions and 244 deletions

View file

@ -23,9 +23,12 @@ char cvar = 0;
float fvar = 0;
double dvar = 0;
char *strvar=0;
char name[5] = "Dave";
double *Foo1;
double *Foo2;
int *pivar;
short *psvar;
char **foo;
/* A debugging function to print out their values */
@ -43,6 +46,7 @@ void print_vars() {
printf("dvar = %g\n", dvar);
printf("cvar = %c\n", cvar);
printf("strvar = %s\n",strvar);
printf("name = %c%c%c%c%c\n", name[0],name[1],name[2],name[3],name[4]);
}

View file

@ -17,8 +17,12 @@
extern float fvar;
extern double dvar;
extern char *strvar;
extern char name[256];
extern double *Foo1;
extern double *Foo2;
extern int *pivar;
extern short *psvar;
extern char **foo;
%}

View file

@ -18,8 +18,16 @@ cvar_set ("S");
fvar_set (3.14159);
dvar_set (2.1828);
strvar_set("Hello World");
name_set ("Bill");
Foo1_set([1,2,3;4,5,6]);
Foo2_set([1+2*%i,2+3*%i;3+4*%i,7+8*%i]);
pivar_set(int32([ 1 2 3 4 5;
6 7 8 9 10;
11 12 13 14 15]));
psvar_set(int16([ 1 2 3 4 5;
6 7 8 9 10;
11 12 13 14 15]));
foo_set(["sample", "strings", "manipulation"; "with","gateway","API"]);
// Now print out the values of the variables
@ -37,10 +45,16 @@ printf("fvar = %f\n", fvar_get());
printf("dvar = %f\n", dvar_get());
printf("cvar = %s\n", cvar_get());
printf("strvar = %s\n", strvar_get());
printf("name = %s\n", name_get());
Foo1_get()
Foo2_get()
pivar_get()
psvar_get()
foo_get()
printf("\nVariables (values printed from C)\n");
print_vars();
print_vars()
exit