summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSwati Sharma <itawswati@gmail.com>2012-08-18 14:47:39 +0000
committerSwati Sharma <itawswati@gmail.com>2012-08-18 14:47:39 +0000
commit2dee1a92e3d8f60a213e53f58f96117a15242b92 (patch)
treeadb530c84b2cb0797eeae9294b050ab2a1c3c858
parent342ea4bc2c1925699346869ba7a23a7cae172754 (diff)
downloadswig-2dee1a92e3d8f60a213e53f58f96117a15242b92.tar.gz
Fix for static constants.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-objc@13651 626c5289-ae23-0410-ae9c-e8d60b6d4f22
-rw-r--r--Source/Modules/objc.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/Source/Modules/objc.cxx b/Source/Modules/objc.cxx
index cec583525..130cdeee3 100644
--- a/Source/Modules/objc.cxx
+++ b/Source/Modules/objc.cxx
@@ -775,8 +775,17 @@ int OBJECTIVEC::constantWrapper(Node *n) {
}
Printf(constants_mm_code, "%s\n", tm);
Delete(imcall);
+ }else if (Getattr(n, "wrappedasconstant")) {
+ if (SwigType_type(type) == T_CHAR){
+ Printf(constants_mm_code, "%s %s= \'%s\';\n", crettype, symname, Getattr(n, "staticmembervariableHandler:value"));
+ }
+ else if (SwigType_type(type) == T_STRING){
+ Printf(constants_mm_code, "%s const %s= @\"%s\";\n", crettype, symname, Getattr(n, "staticmembervariableHandler:value"));
} else {
- if (SwigType_type(type) == T_STRING) {
+ Printf(constants_mm_code, "%s %s= %s;\n", crettype, symname, Getattr(n, "staticmembervariableHandler:value"));
+ }
+ } else {
+ if (SwigType_type(type) == T_STRING) {
// http://stackoverflow.com/questions/538996/constants-in-objective-c/539191#539191
Printf(constants_h_code, "extern %s const %s;\n", crettype, symname);
Printf(constants_mm_code, "%s const %s= @\"%s\";\n", crettype, symname, value);
@@ -788,7 +797,7 @@ int OBJECTIVEC::constantWrapper(Node *n) {
Printf(constants_mm_code, "%s %s= %s;\n", crettype, symname, value);
}
}
-
+
// Dump to generated files
if (proxy_flag) { // write to the proxy files
Printv(proxy_h_code, constants_h_code, NIL);