scilab: fix issue #755

This commit is contained in:
Simon Marchetto 2016-07-29 11:52:26 +02:00
parent 8c8937dbdb
commit 95a5def328
4 changed files with 28 additions and 2 deletions

View File

@ -13,7 +13,6 @@ top_builddir = ../@top_builddir@
C_TEST_CASES += \ C_TEST_CASES += \
scilab_consts \ scilab_consts \
scilab_enums \
scilab_identifier_name \ scilab_identifier_name \
CPP_TEST_CASES += \ CPP_TEST_CASES += \
@ -21,6 +20,7 @@ CPP_TEST_CASES += \
primitive_types \ primitive_types \
scilab_li_matrix \ scilab_li_matrix \
scilab_multivalue \ scilab_multivalue \
scilab_enums \
scilab_pointer_conversion_functions \ scilab_pointer_conversion_functions \
CPP_STD_TEST_CASES += \ CPP_STD_TEST_CASES += \

View File

@ -24,4 +24,13 @@ checkEnum(TYPEDEF_ENUM_1_2, 22);
checkEnum(TYPEDEF_ENUM_2_1, 31); checkEnum(TYPEDEF_ENUM_2_1, 31);
checkEnum(TYPEDEF_ENUM_2_2, 32); checkEnum(TYPEDEF_ENUM_2_2, 32);
checkEnum(ENUM_REF_1, 1);
checkEnum(ENUM_REF_2, 10);
checkEnum(clsEnum_CLS_ENUM_1, 100);
checkEnum(clsEnum_CLS_ENUM_2, 101);
checkEnum(clsEnum_CLS_ENUM_REF_1, 101);
checkEnum(clsEnum_CLS_ENUM_REF_2, 110);
exec("swigtest.quit", -1); exec("swigtest.quit", -1);

View File

@ -35,4 +35,21 @@ typedef enum TYPEDEF_ENUM_2 {
TYPEDEF_ENUM_2_2 = 32 TYPEDEF_ENUM_2_2 = 32
} TYPEDEF_ENUM_2; } TYPEDEF_ENUM_2;
enum ENUM_REF {
ENUM_REF_1 = 1,
ENUM_REF_2 = ENUM_REF_1 + 9
};
class clsEnum {
public:
enum CLS_ENUM {
CLS_ENUM_1 = 100,
CLS_ENUM_2 = 101
};
enum CLS_ENUM_REF {
CLS_ENUM_REF_1 = 101,
CLS_ENUM_REF_2 = CLS_ENUM_REF_1 + 9
};
};
%} %}

View File

@ -664,7 +664,7 @@ public:
if (isConstant || isEnum) { if (isConstant || isEnum) {
if (isEnum) { if (isEnum) {
Setattr(node, "type", "double"); Setattr(node, "type", "double");
constantValue = Getattr(node, "enumvalue"); constantValue = Getattr(node, "value");
} }
constantTypemap = Swig_typemap_lookup("scilabconstcode", node, nodeName, 0); constantTypemap = Swig_typemap_lookup("scilabconstcode", node, nodeName, 0);