Fix generated quoting when using %javaconst(1)/%csconst(1) for static const char member variables.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11760 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
d756b28611
commit
bf8ba3bf55
4 changed files with 29 additions and 3 deletions
|
|
@ -1,6 +1,16 @@
|
|||
Version 1.3.41 (in progress)
|
||||
============================
|
||||
|
||||
2009-11-29: wsfulton
|
||||
[Java, C#] Fix generated quoting when using %javaconst(1)/%csconst(1) for
|
||||
static const char member variables.
|
||||
|
||||
%javaconst(1) A;
|
||||
%csconst(1) A;
|
||||
struct X {
|
||||
static const char A = 'A';
|
||||
};
|
||||
|
||||
2009-11-26: wsfulton
|
||||
[Java, C#] Fix %javaconst(1)/%csconst(1) for static const member variables to
|
||||
use the actual constant value if it is specified, rather than the C++ code to
|
||||
|
|
|
|||
|
|
@ -6,9 +6,10 @@
|
|||
%module static_const_member
|
||||
|
||||
#if SWIGJAVA
|
||||
%javaconst(1) EN;
|
||||
%javaconst(1) CHARTEST;
|
||||
#elif SWIGCSHARP
|
||||
%csconst(1) EN;
|
||||
%csconst(1) CHARTEST;
|
||||
#endif
|
||||
|
||||
%inline %{
|
||||
|
|
@ -18,6 +19,7 @@ public:
|
|||
static const int PN = 0;
|
||||
static const int CN = 1;
|
||||
static const int EN = 2;
|
||||
static const char CHARTEST = 'A';
|
||||
};
|
||||
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -1394,7 +1394,14 @@ public:
|
|||
enum_constant_flag = false;
|
||||
} else {
|
||||
// Alternative constant handling will use the C syntax to make a true C# constant and hope that it compiles as C# code
|
||||
Printf(constants_code, "%s;\n", Getattr(n, "wrappedasconstant") ? Getattr(n, "staticmembervariableHandler:value") : Getattr(n, "value"));
|
||||
if (Getattr(n, "wrappedasconstant")) {
|
||||
if (SwigType_type(t) == T_CHAR)
|
||||
Printf(constants_code, "\'%s\';\n", Getattr(n, "staticmembervariableHandler:value"));
|
||||
else
|
||||
Printf(constants_code, "%s;\n", Getattr(n, "staticmembervariableHandler:value"));
|
||||
} else {
|
||||
Printf(constants_code, "%s;\n", Getattr(n, "value"));
|
||||
}
|
||||
}
|
||||
|
||||
// Emit the generated code to appropriate place
|
||||
|
|
|
|||
|
|
@ -1426,7 +1426,14 @@ public:
|
|||
enum_constant_flag = false;
|
||||
} else {
|
||||
// Alternative constant handling will use the C syntax to make a true Java constant and hope that it compiles as Java code
|
||||
Printf(constants_code, "%s;\n", Getattr(n, "wrappedasconstant") ? Getattr(n, "staticmembervariableHandler:value") : Getattr(n, "value"));
|
||||
if (Getattr(n, "wrappedasconstant")) {
|
||||
if (SwigType_type(t) == T_CHAR)
|
||||
Printf(constants_code, "\'%s\';\n", Getattr(n, "staticmembervariableHandler:value"));
|
||||
else
|
||||
Printf(constants_code, "%s;\n", Getattr(n, "staticmembervariableHandler:value"));
|
||||
} else {
|
||||
Printf(constants_code, "%s;\n", Getattr(n, "value"));
|
||||
}
|
||||
}
|
||||
|
||||
// Emit the generated code to appropriate place
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue