diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2016-01-27 08:47:37 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2016-01-27 08:47:37 +0000 |
commit | 95eb6649ead4cb593e5e2c11f0899ac3b48c624d (patch) | |
tree | f1164362825a70d8ce883f11cb6efceb72e26abf | |
parent | 246c90e876b339da3dad7c5bc94a0fdb1969e5fa (diff) | |
download | swig-95eb6649ead4cb593e5e2c11f0899ac3b48c624d.tar.gz |
Expand char testing in enums and %constant
-rw-r--r-- | Examples/test-suite/char_constant.i | 26 | ||||
-rw-r--r-- | Examples/test-suite/enum_thorough.i | 64 |
2 files changed, 83 insertions, 7 deletions
diff --git a/Examples/test-suite/char_constant.i b/Examples/test-suite/char_constant.i index 5235b0581..96a0a520b 100644 --- a/Examples/test-suite/char_constant.i +++ b/Examples/test-suite/char_constant.i @@ -12,6 +12,32 @@ #define ESC_CONST '\1' #define NULL_CONST '\0' #define SPECIALCHAR 'á' +#define SPECIALCHAR2 '\n' +#define SPECIALCHARA 'A' +#define SPECIALCHARB '\102' // B +#define SPECIALCHARC '\x43' // C +#define SPECIALCHARD 0x44 // D +#define SPECIALCHARE 69 // E +#define SPECIALCHARAE1 'Æ' // AE (latin1 encoded) +#define SPECIALCHARAE2 '\306' // AE (latin1 encoded) +#define SPECIALCHARAE3 '\xC6' // AE (latin1 encoded) + +#if defined(SWIGJAVA) +%javaconst(1); +#endif + +#define X_ESC_CONST '\1' +#define X_NULL_CONST '\0' +#define X_SPECIALCHAR 'á' +#define X_SPECIALCHAR2 '\n' +#define X_SPECIALCHARA 'A' +#define X_SPECIALCHARB '\102' // B +#define X_SPECIALCHARC '\x43' // C +#define X_SPECIALCHARD 0x44 // D +#define X_SPECIALCHARE 69 // E +#define X_SPECIALCHARAE1 'Æ' // AE (latin1 encoded) +#define X_SPECIALCHARAE2 '\306' // AE (latin1 encoded) +#define X_SPECIALCHARAE3 '\xC6' // AE (latin1 encoded) %inline { diff --git a/Examples/test-suite/enum_thorough.i b/Examples/test-suite/enum_thorough.i index 70f02ac64..eb1052b69 100644 --- a/Examples/test-suite/enum_thorough.i +++ b/Examples/test-suite/enum_thorough.i @@ -587,10 +587,7 @@ int globalDifferentTypesTest(int n) { return n; } } %} -#if defined(SWIGJAVA) -%javaconst(0) enumcharC; -%javaconst(0) globalenumcharC; -#elif defined(SWIGCSHARP) +#if defined(SWIGCSHARP) %csconstvalue("1") globalenumchar1; %csconstvalue("'B'") globalenumcharB; %csconstvalue("1") enumchar1; @@ -605,7 +602,10 @@ enum { globalenumcharB = '\102', // B globalenumcharC = '\x43', // C globalenumcharD = 0x44, // D - globalenumcharE = 69 // E + globalenumcharE = 69, // E + globalenumcharAE1 = 'Æ', // AE (latin1 encoded) + globalenumcharAE2 = '\306', // AE (latin1 encoded) + globalenumcharAE3 = '\xC6' // AE (latin1 encoded) }; enum EnumChar { enumchar0 = '\0', @@ -615,7 +615,10 @@ enum EnumChar { enumcharB = '\102', // B enumcharC = '\x43', // C enumcharD = 0x44, // D - enumcharE = 69 // E + enumcharE = 69, // E + enumcharAE1 = 'Æ', // AE (latin1 encoded) + enumcharAE2 = '\306', // AE (latin1 encoded) + enumcharAE3 = '\xC6' // AE (latin1 encoded) }; struct EnumCharStruct { enum EnumChar { @@ -626,7 +629,10 @@ struct EnumCharStruct { enumcharB = '\102', // B enumcharC = '\x43', // C enumcharD = 0x44, // D - enumcharE = 69 // E + enumcharE = 69, // E + enumcharAE1 = 'Æ', // AE (latin1 encoded) + enumcharAE2 = '\306', // AE (latin1 encoded) + enumcharAE3 = '\xC6' // AE (latin1 encoded) }; }; %} @@ -638,6 +644,50 @@ struct EnumCharStruct { #endif %inline %{ +enum { + x_globalenumchar0 = '\0', + x_globalenumchar1 = '\1', + x_globalenumchar2 = '\n', + x_globalenumcharA = 'A', + x_globalenumcharB = '\102', // B + x_globalenumcharC = '\x43', // C + x_globalenumcharD = 0x44, // D + x_globalenumcharE = 69, // E + x_globalenumcharAE1 = 'Æ', // AE (latin1 encoded) + x_globalenumcharAE2 = '\306', // AE (latin1 encoded) + x_globalenumcharAE3 = '\xC6' // AE (latin1 encoded) +}; +enum X_EnumChar { + x_enumchar0 = '\0', + x_enumchar1 = '\1', + x_enumchar2 = '\n', + x_enumcharA = 'A', + x_enumcharB = '\102', // B + x_enumcharC = '\x43', // C + x_enumcharD = 0x44, // D + x_enumcharE = 69, // E + x_enumcharAE1 = 'Æ', // AE (latin1 encoded) + x_enumcharAE2 = '\306', // AE (latin1 encoded) + x_enumcharAE3 = '\xC6' // AE (latin1 encoded) +}; +struct X_EnumCharStruct { + enum X_EnumChar { + enumchar0 = '\0', + enumchar1 = '\1', + enumchar2 = '\n', + enumcharA = 'A', + enumcharB = '\102', // B + enumcharC = '\x43', // C + enumcharD = 0x44, // D + enumcharE = 69, // E + enumcharAE1 = 'Æ', // AE (latin1 encoded) + enumcharAE2 = '\306', // AE (latin1 encoded) + enumcharAE3 = '\xC6' // AE (latin1 encoded) + }; +}; +%} + +%inline %{ namespace DifferentSpace { enum DifferentTypesNoConst { typeint_noconst = 10, |