Reuse 'cmodtype' typemap and remove 'couttype' typemap completely.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2012-c@13681 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Leif Middelschulte 2012-08-20 13:23:18 +00:00
commit d906d3c73e
3 changed files with 12 additions and 44 deletions

View file

@ -147,11 +147,11 @@ explicit_same_type_all_primitive_types_but_void(ctype);
%typemap(cmodtype) const void&, const void* "const void *"
%typemap(cmodtype) void**, void*&, void*[ANY], void[ANY][ANY] "void **"
%typemap(cmodtype) const void**, const void*& "const void **"
// constant pointers
%typemap(cmodtype) void* * const "void* * const"
%typemap(cmodtype) const void* * const "const void* * const"
// unconst constant pointers
%typemap(cmodtype) void* * const "void* *"
%typemap(cmodtype) const void* * const "const void* *"
explicit_same_type_all_primitive_types_but_void(cmodtype);
explicit_same_type_unconsted_all_primitive_types_but_void(cmodtype);
// special cases of array passing - does not intended to be used for objects
%typemap(cmodtype) SWIGTYPE [] "$1_ltype"
@ -255,34 +255,6 @@ same_action_all_primitive_types_but_void(in, "$1 = ($1_ltype) $input;")
$1 = ($1_ltype) 0;
}
// typemaps for return values
// void
%typemap(couttype) void "void"
%typemap(couttype) void*, const void* "void *"
// constant pointers
%typemap(couttype) void * const "void * const"
%typemap(couttype) void* * const * const "void* *"
%typemap(couttype) const void* * const "void* *"
explicit_same_type_unconsted_all_primitive_types_but_void(couttype);
// objects
%typemap(couttype) SWIGTYPE "SwigObj *"
%typemap(couttype) SWIGTYPE * "/*aaaaaa*/SwigObj *"
%typemap(couttype) SWIGTYPE & "SwigObj *"
%typemap(couttype) SWIGTYPE *& "SwigObj **"
%typemap(couttype) SWIGTYPE [ANY] "/*SWIGTYPE [ANY]*/ SwigObj **"
%typemap(couttype) SWIGTYPE * [ANY] "/*SWIGTYPE *[ANY] */ SwigObj **"
%typemap(couttype) SWIGTYPE ** "/*SWIGTYPE ** */ SwigObj **"
%typemap(couttype) enum SWIGTYPE "int"
%typemap(couttype) enum SWIGTYPE &, enum SWIGTYPE * "int *"
%typemap(couttype, fragment="fptr_decl") SWIGTYPE (CLASS::*) "SWIG_CPP_FP"
%typemap(couttype, fragment="stdbool_inc") bool, bool *, const bool, const bool * "$1_ltype"
%typemap(couttype, fragment="stdbool_inc") bool & "$1_basetype*"
%typemap(couttype, fragment="stdbool_inc") const bool & "$1_basetype const *"
same_action_all_primitive_types_but_void(out, "$result = $1;")
%typemap(out) void ""

View file

@ -17,10 +17,6 @@ class string;
%typemap(ctype) string * "char *"
%typemap(ctype) string & "char *"
%typemap(ctype) const string & "char *"
%typemap(couttype) string "char *"
%typemap(couttype) string * "char *"
%typemap(couttype) string & "char *"
%typemap(couttype) const string & "char *"
%typemap(cppouttype, retobj="1") string "std::string*"
%typemap(cppouttype) const string &, string *, string & "std::string*"

View file

@ -764,19 +764,19 @@ ready:
if (IS_SET_TO_ONE(n, "c:objstruct")) {
Printv(return_type, SwigType_str(type, 0), NIL);
}
else if ((tm = Swig_typemap_lookup("couttype", n, "", 0))) {
String *ctypeout = Getattr(n, "tmap:couttype:out");
else if ((tm = Swig_typemap_lookup("cmodtype", n, "", 0))) {
String *ctypeout = Getattr(n, "tmap:cmodtype:out");
if (ctypeout)
{
tm = ctypeout;
Printf(stdout, "Obscure couttype:out found! O.o\n");
Printf(stdout, "Obscure cmodtype:out found! O.o\n");
}
Printf(return_type, "%s", tm);
// template handling
Replaceall(return_type, "$tt", SwigType_lstr(type, 0));
}
else {
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No couttype typemap defined for %s\n", SwigType_str(type, 0));
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No cmodtype typemap defined for %s\n", SwigType_str(type, 0));
}
return return_type;
}
@ -808,7 +808,7 @@ ready:
}
}
else {
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No couttype typemap defined for %s\n", SwigType_str(type, 0));
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No cmodtype typemap defined for %s\n", SwigType_str(type, 0));
}
Replaceall(return_type, "::", "_");
@ -1037,8 +1037,8 @@ ready:
if (IS_SET_TO_ONE(n, "c:objstruct")) {
Printv(return_type, SwigType_str(type, 0), NIL);
}
else if ((tm = Swig_typemap_lookup("couttype", n, "", 0))) {
String *ctypeout = Getattr(n, "tmap:couttype:out");
else if ((tm = Swig_typemap_lookup("cmodtype", n, "", 0))) {
String *ctypeout = Getattr(n, "tmap:cmodtype:out");
if (ctypeout)
{
tm = ctypeout;
@ -1049,7 +1049,7 @@ ready:
Replaceall(return_type, "$tt", SwigType_lstr(type, 0));
}
else {
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No couttype typemap defined for %s\n", SwigType_str(type, 0));
Swig_warning(WARN_C_TYPEMAP_CTYPE_UNDEF, input_file, line_number, "No cmodtype typemap defined for %s\n", SwigType_str(type, 0));
}
return return_type;
}