update swig on windows

This commit is contained in:
Bassem Girgis
2019-08-04 21:38:19 -05:00
parent 8414b7136b
commit 76ad52be58
5943 changed files with 91790 additions and 71892 deletions

View File

@@ -0,0 +1,3 @@
CXXSRCS = example.cxx
include $(SRCDIR)../example.mk

View File

@@ -0,0 +1,37 @@
/* File : example.c */
#include "example.h"
#include <stdio.h>
void Foo::enum_test(speed s) {
if (s == IMPULSE) {
printf("IMPULSE speed\n");
} else if (s == WARP) {
printf("WARP speed\n");
} else if (s == LUDICROUS) {
printf("LUDICROUS speed\n");
} else {
printf("Unknown speed\n");
}
}
void enum_test(color c, Foo::speed s) {
if (c == RED) {
printf("color = RED, ");
} else if (c == BLUE) {
printf("color = BLUE, ");
} else if (c == GREEN) {
printf("color = GREEN, ");
} else {
printf("color = Unknown color!, ");
}
if (s == Foo::IMPULSE) {
printf("speed = IMPULSE speed\n");
} else if (s == Foo::WARP) {
printf("speed = WARP speed\n");
} else if (s == Foo::LUDICROUS) {
printf("speed = LUDICROUS speed\n");
} else {
printf("speed = Unknown speed!\n");
}
}

View File

@@ -0,0 +1,12 @@
/* File : example.h */
enum color { RED, BLUE, GREEN };
class Foo {
public:
Foo() { }
enum speed { IMPULSE, WARP, LUDICROUS };
void enum_test(speed s);
};
void enum_test(color c, Foo::speed s);

View File

@@ -0,0 +1,12 @@
/* File : example.i */
%module swigexample
%feature("autodoc", 1);
%{
#include "example.h"
%}
/* Let's just grab the original header file here */
%include "example.h"

View File

@@ -0,0 +1,33 @@
# do not dump Octave core
if exist("crash_dumps_octave_core", "builtin")
crash_dumps_octave_core(0);
endif
swigexample
# ----- Object creation -----
# Print out the value of some enums
printf("*** color ***\n");
printf(" RED = %i\n", swigexample.RED);
printf(" BLUE = %i\n", swigexample.BLUE);
printf(" GREEN = %i\n", swigexample.GREEN);
printf("\n*** Foo::speed ***\n");
printf(" Foo_IMPULSE = %i\n", swigexample.Foo_IMPULSE);
printf(" Foo_WARP = %i\n", swigexample.Foo_WARP);
printf(" Foo_LUDICROUS = %i\n", swigexample.Foo_LUDICROUS);
printf("\nTesting use of enums with functions\n");
swigexample.enum_test(swigexample.RED, swigexample.Foo_IMPULSE);
swigexample.enum_test(swigexample.BLUE, swigexample.Foo_WARP);
swigexample.enum_test(swigexample.GREEN, swigexample.Foo_LUDICROUS);
swigexample.enum_test(1234,5678)
printf("\nTesting use of enum with class method\n");
f = swigexample.Foo();
f.enum_test(swigexample.Foo_IMPULSE);
f.enum_test(swigexample.Foo_WARP);
f.enum_test(swigexample.Foo_LUDICROUS);