fixes some compiler warnings, and add better support

for member variables (in C++/python).


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5793 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-03-28 14:04:36 +00:00
commit 2e50998bd0
4 changed files with 24 additions and 9 deletions

View file

@ -85,13 +85,20 @@ Swig_clocal(SwigType *t, String_or_char *name, String_or_char *value) {
* This function only converts user defined types to pointers.
* ----------------------------------------------------------------------------- */
static int varref = 0;
String *
Swig_wrapped_var_type(SwigType *t) {
SwigType *ty;
ty = Copy(t);
if (SwigType_isclass(t)) {
SwigType_add_pointer(ty);
if (varref) {
SwigType_add_qualifier(ty, "const");
SwigType_add_reference(ty);
} else {
SwigType_add_qualifier(ty, "const");
SwigType_add_pointer(ty);
}
}
return ty;
}
@ -108,7 +115,12 @@ Swig_wrapped_var_deref(SwigType *t, String_or_char *name) {
static String *
Swig_wrapped_var_assign(SwigType *t, const String_or_char *name) {
if (SwigType_isclass(t)) {
return NewStringf("&%s",name);
if (varref) {
String* ty = SwigType_namestr(t);
return NewStringf("(const %s&)%s",ty, name);
} else {
return NewStringf("&%s",name);
}
} else {
return SwigType_lcaststr(t,name);
}
@ -562,7 +574,8 @@ Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_char *self)
* ----------------------------------------------------------------------------- */
String *
Swig_cmemberget_call(const String_or_char *name, SwigType *t, String_or_char *self) {
Swig_cmemberget_call(const String_or_char *name, SwigType *t,
String_or_char *self) {
String *func;
if (!self) self = NewString("(this)->");
else self = NewString(self);
@ -919,6 +932,7 @@ Swig_MembersetToFunction(Node *n, String *classname, int flags) {
String *membername;
String *mangled;
String *self= 0;
varref = flags & CWRAP_VAR_REFERENCE;
if (flags & CWRAP_SMART_POINTER) {
self = NewString("(*this)->");
@ -964,6 +978,7 @@ Swig_MembersetToFunction(Node *n, String *classname, int flags) {
Delete(membername);
Delete(mangled);
Delete(self);
varref = 0;
return SWIG_OK;
}
@ -983,6 +998,7 @@ Swig_MembergetToFunction(Node *n, String *classname, int flags) {
String *membername;
String *mangled;
String *self = 0;
varref = flags & CWRAP_VAR_REFERENCE;
if (flags & CWRAP_SMART_POINTER) {
self = NewString("(*this)->");
@ -1020,6 +1036,7 @@ Swig_MembergetToFunction(Node *n, String *classname, int flags) {
Delete(ty);
Delete(membername);
Delete(mangled);
varref = 0;
return SWIG_OK;
}

View file

@ -211,7 +211,7 @@ String *Swig_string_typecode(String *s) {
* A_get_value.
* ----------------------------------------------------------------------------- */
String *Swig_string_mangle(String *s) {
String *Swig_string_mangle(const String *s) {
#if 0
/* old mangling, not suitable for using in macros */
String *t = Copy(s);
@ -241,7 +241,7 @@ String *Swig_string_mangle(String *s) {
Printf(result,"_SS_");
}
space = 0;
Printf(result,"%c",c);
Printf(result,"%c",(int)c);
} else {
if (isspace((int)c)) {
@ -267,8 +267,6 @@ String *Swig_string_mangle(String *s) {
Append(result,"_");
++pc; ++pc;
continue;
} else {
c = 's';
}
break;
case '*':

View file

@ -758,7 +758,6 @@ String *SwigType_lcaststr(SwigType *s, const String_or_char *name) {
}
String *SwigType_manglestr_default(SwigType *s) {
char *c;
String *result,*base,*mbase;
SwigType *lt, *ltp;
SwigType *ss = 0;

View file

@ -406,7 +406,7 @@ extern void Swig_feature_set(Hash *features, const String_or_char *name, Sw
extern char *Swig_copy_string(const char *c);
extern void Swig_banner(File *f);
extern String *Swig_string_escape(String *s);
extern String *Swig_string_mangle(String *s);
extern String *Swig_string_mangle(const String *s);
extern String *Swig_scopename_prefix(String *s);
extern String *Swig_scopename_last(String *s);
extern String *Swig_scopename_first(String *s);
@ -463,6 +463,7 @@ extern int Swig_VarsetToFunction(Node *n);
#define CWRAP_EXTEND 0x01
#define CWRAP_SMART_POINTER 0x02
#define CWRAP_VAR_REFERENCE 0x04
/* --- Director Helpers --- */
extern Node *Swig_methodclass(Node *n);