a better way to deal with constants and enums and some change about the doc
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@11515 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
c85685b60b
commit
b1a384dc3c
10 changed files with 223 additions and 255 deletions
|
|
@ -5,12 +5,12 @@
|
|||
|
||||
void enum_test(color c) {
|
||||
if (c == RED) {
|
||||
sciprint("color = RED, ");
|
||||
printf("color = RED\n");
|
||||
} else if (c == BLUE) {
|
||||
sciprint("color = BLUE, ");
|
||||
printf("color = BLUE\n ");
|
||||
} else if (c == GREEN) {
|
||||
sciprint("color = GREEN, ");
|
||||
printf("color = GREEN\n");
|
||||
} else {
|
||||
sciprint("color = Unknown color!, ");
|
||||
printf("color = Unknown color!\n");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +1,19 @@
|
|||
// loader the *.so
|
||||
exec loader.sce;
|
||||
|
||||
exec example.sce;
|
||||
|
||||
// Print out the value of some enums
|
||||
printf("*** color ***\n");
|
||||
printf(" RED = %i\n", color.RED);
|
||||
printf(" BLUE = %i\n", color.BLUE);
|
||||
printf(" GREEN = %i\n", color.GREEN);
|
||||
printf(" RED = %i\n", RED_get());
|
||||
printf(" BLUE = %i\n", BLUE_get());
|
||||
printf(" GREEN = %i\n", GREEN_get());
|
||||
|
||||
|
||||
printf("\nTesting use of enums with functions\n");
|
||||
|
||||
enum_test(color.RED);
|
||||
enum_test(color.BLUE);
|
||||
enum_test(color.GREEN);
|
||||
enum_test(1234);
|
||||
enum_test(RED_get());
|
||||
enum_test(BLUE_get());
|
||||
enum_test(GREEN_get());
|
||||
enum_test(int32(1234));
|
||||
|
||||
exit
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue