diff options
author | Leif Middelschulte <leif.middelschulte@gmail.com> | 2012-08-20 13:23:18 +0000 |
---|---|---|
committer | Leif Middelschulte <leif.middelschulte@gmail.com> | 2012-08-20 13:23:18 +0000 |
commit | d906d3c73e29f586f26cc5329293889ab23da974 (patch) | |
tree | caa0c0baef31cd48adb7dc6a4c3d2a75872e6944 | |
parent | 5aa23f9bdbd99954c07069f54b39e669e16aa591 (diff) | |
download | swig-d906d3c73e29f586f26cc5329293889ab23da974.tar.gz |
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
-rw-r--r-- | Lib/c/c.swg | 36 | ||||
-rw-r--r-- | Lib/c/std_string.i | 4 | ||||
-rw-r--r-- | Source/Modules/c.cxx | 16 |
3 files changed, 12 insertions, 44 deletions
diff --git a/Lib/c/c.swg b/Lib/c/c.swg index b67128c76..9a2525852 100644 --- a/Lib/c/c.swg +++ b/Lib/c/c.swg @@ -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 "" diff --git a/Lib/c/std_string.i b/Lib/c/std_string.i index c8e2dff9d..9b70a460b 100644 --- a/Lib/c/std_string.i +++ b/Lib/c/std_string.i @@ -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*" diff --git a/Source/Modules/c.cxx b/Source/Modules/c.cxx index 0fac1cd3e..2acdcf661 100644 --- a/Source/Modules/c.cxx +++ b/Source/Modules/c.cxx @@ -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; } |