fix tcl + -namespace + constants(enum)
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6557 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
ddbcd6e42d
commit
ce999550ad
2 changed files with 12 additions and 6 deletions
|
|
@ -428,22 +428,22 @@
|
|||
/* --- Constants --- */
|
||||
|
||||
%typemap(consttab) int, unsigned int, short, unsigned short, long, unsigned long, unsigned char, signed char, bool, enum SWIGTYPE
|
||||
{ SWIG_TCL_INT, (char *)"$symname", (long) $value, 0, 0, 0}
|
||||
{ SWIG_TCL_INT, (char *)"$nsname", (long) $value, 0, 0, 0}
|
||||
|
||||
%typemap(consttab) float, double
|
||||
{ SWIG_TCL_FLOAT, (char*)"$symname", 0, (double) $value, 0, 0}
|
||||
{ SWIG_TCL_FLOAT, (char*)"$nsname", 0, (double) $value, 0, 0}
|
||||
|
||||
%typemap(consttab) char, char *
|
||||
{ SWIG_TCL_STRING, (char*)"$symname", 0, 0, (void *)"$value", 0}
|
||||
{ SWIG_TCL_STRING, (char*)"$nsname", 0, 0, (void *)"$value", 0}
|
||||
|
||||
%typemap(consttab) long long, unsigned long long
|
||||
{ SWIG_TCL_STRING, (char *) "$symname", 0, 0, (void *)"$value", 0}
|
||||
{ SWIG_TCL_STRING, (char *) "$nsname", 0, 0, (void *)"$value", 0}
|
||||
|
||||
%typemap(consttab) SWIGTYPE *, SWIGTYPE &, SWIGTYPE []
|
||||
{ SWIG_TCL_POINTER, (char*)"$symname", 0, 0, (void *)$value, &$1_descriptor}
|
||||
{ SWIG_TCL_POINTER, (char*)"$nsname", 0, 0, (void *)$value, &$1_descriptor}
|
||||
|
||||
%typemap(consttab) SWIGTYPE (CLASS::*)
|
||||
{ SWIG_TCL_BINARY, (char *)"$symname", sizeof($type), 0, (void *)&$value, &$1_descriptor}
|
||||
{ SWIG_TCL_BINARY, (char *)"$nsname", sizeof($type), 0, (void *)&$value, &$1_descriptor}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -614,6 +614,7 @@ public:
|
|||
virtual int constantWrapper(Node *n) {
|
||||
String *name = Getattr(n,"name");
|
||||
String *iname = Getattr(n,"sym:name");
|
||||
String *nsname = !nspace ? Copy(iname) : NewStringf("%s::%s",ns_name,iname);
|
||||
SwigType *type = Getattr(n,"type");
|
||||
String *value = Getattr(n,"value");
|
||||
String *tm;
|
||||
|
|
@ -626,21 +627,26 @@ public:
|
|||
Printf(f_wrappers, "static %s = %s;\n", SwigType_str(type,wname), value);
|
||||
value = Char(wname);
|
||||
}
|
||||
|
||||
if ((tm = Swig_typemap_lookup_new("consttab",n,name,0))) {
|
||||
Replaceall(tm,"$source",value);
|
||||
Replaceall(tm,"$target",name);
|
||||
Replaceall(tm,"$value",value);
|
||||
Replaceall(tm,"$nsname",nsname);
|
||||
Printf(const_tab,"%s,\n", tm);
|
||||
} else if ((tm = Swig_typemap_lookup_new("constcode", n, name, 0))) {
|
||||
Replaceall(tm,"$source", value);
|
||||
Replaceall(tm,"$target", name);
|
||||
Replaceall(tm,"$value",value);
|
||||
Replaceall(tm,"$nsname",nsname);
|
||||
Printf(f_init, "%s\n", tm);
|
||||
} else {
|
||||
Delete(nsname);
|
||||
Swig_warning(WARN_TYPEMAP_CONST_UNDEF,
|
||||
input_file, line_number, "Unsupported constant value.\n");
|
||||
return SWIG_NOWRAP;
|
||||
}
|
||||
Delete(nsname);
|
||||
return SWIG_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue