Exceptions support for C. exception_order test shows how to use type information to achieve correct catching order. Examples cleanup.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@10671 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
03d275e42f
commit
88facfd390
27 changed files with 223 additions and 429 deletions
|
|
@ -1,15 +1,7 @@
|
|||
/* File : example.c */
|
||||
|
||||
/* A global variable */
|
||||
double Foo = 3.0;
|
||||
|
||||
double *Foo_ptr = &Foo;
|
||||
char *my_str = "hello, world!";
|
||||
char *array_of_strs[] = { "one", "two" };
|
||||
|
||||
char *get_str(int i, void* ptr, float ff) {
|
||||
return array_of_strs[i];
|
||||
}
|
||||
double Foo = 3.0;
|
||||
|
||||
/* Compute the greatest common divisor of positive integers */
|
||||
int gcd(int x, int y) {
|
||||
|
|
@ -22,3 +14,5 @@ int gcd(int x, int y) {
|
|||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,6 @@
|
|||
%module example
|
||||
|
||||
%inline %{
|
||||
extern int gcd(int x, int y);
|
||||
extern double Foo;
|
||||
extern double *Foo_ptr;
|
||||
extern char *my_str;
|
||||
extern char **array_of_strs;
|
||||
extern char *get_str(int i, void* ptr, float ff);
|
||||
extern int gcd(int x, int y);
|
||||
%}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,6 @@ int main(int argc, char **argv) {
|
|||
int a = 35;
|
||||
int b = 15;
|
||||
printf("Foo is %f\n", Foo);
|
||||
printf("Foo by ptr is \%f\n", *Foo_ptr);
|
||||
printf("my_str is: %s\n", my_str);
|
||||
printf("GCD(%d, %d)=%d\n", a, b, gcd(a, b));
|
||||
printf("array_of_strs contains %s and %s\n", get_str(0, 0, 0), get_str(1, 0, 0));
|
||||
return 0;
|
||||
SWIG_exit(0);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue