From dd3b60cf464d2843776c232dd44381dca1ff1fca Mon Sep 17 00:00:00 2001 From: Joel Andersson Date: Tue, 5 Jul 2016 12:08:34 -0500 Subject: [PATCH] Issue #67 Fixed enums.i --- Examples/test-suite/enums.i | 32 ++++++++++++++---------- Examples/test-suite/matlab/enums_runme.m | 1 - 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Examples/test-suite/enums.i b/Examples/test-suite/enums.i index 14c6efbbabc..07c90c4499a 100644 --- a/Examples/test-suite/enums.i +++ b/Examples/test-suite/enums.i @@ -12,7 +12,7 @@ %inline %{ -typedef enum { +typedef enum { CSP_ITERATION_FWD, CSP_ITERATION_BWD = 11 } foo1; @@ -28,7 +28,7 @@ bar1(foo1 x) {} void bar2(enum foo2 x) {} -void +void bar3(foo3 x) {} enum sad { boo, hoo = 5 }; @@ -55,7 +55,7 @@ typedef struct _Foo { %} - + %warnfilter(SWIGWARN_RUBY_WRONG_NAME) _iFoo; #ifdef SWIGD @@ -65,26 +65,33 @@ typedef struct _Foo { #ifndef __cplusplus %inline %{ -typedef struct _iFoo -{ - enum { +typedef struct _iFoo +{ + enum { Phoo = +50, Char = 'a' } e; -} iFoo; +} iFoo; %} #else %inline %{ -struct iFoo -{ - enum { +struct iFoo +{ + enum { Phoo = +50, Char = 'a' - }; -}; + }; +}; %} #endif +/* MATLAB/Octave not (always) case sensitive */ +#ifdef SWIGMATLAB +%rename(slap_) slap; +%rename(mine_) mine; +%rename(thigh_) thigh; +#endif + // enum declaration and initialization %inline %{ enum Exclamation { @@ -99,4 +106,3 @@ enum ContainYourself { thigh } Slap = slap, Mine = mine, Thigh = thigh, *pThigh = &Thigh, arrayContainYourself[3] = {slap, mine, thigh}; %} - diff --git a/Examples/test-suite/matlab/enums_runme.m b/Examples/test-suite/matlab/enums_runme.m index b0481103164..2b39e1da483 100644 --- a/Examples/test-suite/matlab/enums_runme.m +++ b/Examples/test-suite/matlab/enums_runme.m @@ -17,4 +17,3 @@ if (enums.Thigh ~= 12) error end -