[D] Replaced the term "wrap D module" with "intermediary D module" (including names derived from it).

This was suggested by wsfulton on the mailing list in order to bring the D module in line with the C# one, the naming scheme of which is intended to be language-independent.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12319 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
David Nadlinger 2010-11-28 23:12:03 +00:00
commit 3477a9dff1
19 changed files with 423 additions and 424 deletions

View file

@ -82,62 +82,62 @@
%}
%typemap (cwtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
%typemap (ctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void *"
%typemap (dwtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
%typemap (imtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "void*"
%typemap (dptype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
%typemap (dtype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dptype, TYPE)"
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dtype, TYPE)"
%typemap(din) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dptype, TYPE).swigGetCPtr($dinput)"
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& "$typemap(dtype, TYPE).swigGetCPtr($dinput)"
%typemap(dout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > {
void* cPtr = $wcall;
auto ret = (cPtr is null) ? null : new $typemap(dptype, TYPE)(cPtr, true);$excode
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > & {
void* cPtr = $wcall;
auto ret = (cPtr is null) ? null : new $typemap(dptype, TYPE)(cPtr, true);$excode
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > * {
void* cPtr = $wcall;
auto ret = (cPtr is null) ? null : new $typemap(dptype, TYPE)(cPtr, true);$excode
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *& {
void* cPtr = $wcall;
auto ret = (cPtr is null) ? null : new $typemap(dptype, TYPE)(cPtr, true);$excode
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) CONST TYPE {
auto ret = new $typemap(dptype, TYPE)($wcall, true);$excode
auto ret = new $typemap(dtype, TYPE)($imcall, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) CONST TYPE & {
auto ret = new $typemap(dptype, TYPE)($wcall, true);$excode
auto ret = new $typemap(dtype, TYPE)($imcall, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) CONST TYPE * {
void* cPtr = $wcall;
auto ret = (cPtr is null) ? null : new $typemap(dptype, TYPE)(cPtr, true);$excode
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
%typemap(dout, excode=SWIGEXCODE) TYPE *CONST& {
void* cPtr = $wcall;
auto ret = (cPtr is null) ? null : new $typemap(dptype, TYPE)(cPtr, true);$excode
void* cPtr = $imcall;
auto ret = (cPtr is null) ? null : new $typemap(dtype, TYPE)(cPtr, true);$excode
return ret;
}
@ -162,7 +162,7 @@ private void* swigCPtr;
private bool swigCMemOwn;
public this(void* cObject, bool ownCObject) {
super($wrapdmodule.$dclassnameSmartPtrUpcast(cObject), ownCObject);
super($imdmodule.$dclassnameSmartPtrUpcast(cObject), ownCObject);
swigCPtr = cObject;
swigCMemOwn = ownCObject;
}
@ -177,7 +177,7 @@ public static void* swigGetCPtr($dclassname obj) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
$wcall;
$imcall;
}
swigCPtr = null;
}
@ -189,7 +189,7 @@ public static void* swigGetCPtr($dclassname obj) {
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
$wcall;
$imcall;
}
swigCPtr = null;
super.dispose();

View file

@ -21,7 +21,7 @@
*/
%typemap(dconstructor, excode=SWIGEXCODE,directorconnect="\n swigDirectorConnect();") SWIGTYPE {
this($wcall, true);$excode$directorconnect
this($imcall, true);$excode$directorconnect
}
%typemap(ddestructor) SWIGTYPE %{
@ -38,7 +38,7 @@
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
$wcall;
$imcall;
}
swigCPtr = null;
}
@ -50,7 +50,7 @@
if (swigCPtr !is null) {
if (swigCMemOwn) {
swigCMemOwn = false;
$wcall;
$imcall;
}
swigCPtr = null;
super.dispose();
@ -88,7 +88,7 @@ public static void* swigGetCPtr($dclassname obj) {
private void* swigCPtr;
public this(void* cObject, bool ownCObject) {
super($wrapdmodule.$dclassnameUpcast(cObject), ownCObject);
super($imdmodule.$dclassnameUpcast(cObject), ownCObject);
swigCPtr = cObject;
}

View file

@ -9,9 +9,9 @@
* Typemaps for enumeration types.
*/
%typemap(cwtype) enum SWIGTYPE "int"
%typemap(dwtype) enum SWIGTYPE "int"
%typemap(dptype, cprimitive="1") enum SWIGTYPE "$dclassname"
%typemap(ctype) enum SWIGTYPE "int"
%typemap(imtype) enum SWIGTYPE "int"
%typemap(dtype, cprimitive="1") enum SWIGTYPE "$dclassname"
%typecheck(SWIG_TYPECHECK_POINTER) enum SWIGTYPE ""
@ -21,11 +21,11 @@
%typemap(directorout) enum SWIGTYPE %{ $result = ($1_ltype)$input; %}
%typemap(directorin) enum SWIGTYPE "$input = $1;"
%typemap(ddirectorin) enum SWIGTYPE "cast($dclassname)$winput"
%typemap(ddirectorout) enum SWIGTYPE "cast(int)$dpcall"
%typemap(ddirectorout) enum SWIGTYPE "cast(int)$dcall"
%typemap(din) enum SWIGTYPE "cast(int)$dinput"
%typemap(dout, excode=SWIGEXCODE) enum SWIGTYPE {
$dclassname ret = cast($dclassname)$wcall;$excode
$dclassname ret = cast($dclassname)$imcall;$excode
return ret;
}
@ -34,9 +34,9 @@
* Typemaps for (const) references to enumeration types.
*/
%typemap(cwtype) const enum SWIGTYPE & "int"
%typemap(dwtype) const enum SWIGTYPE & "int"
%typemap(dptype) const enum SWIGTYPE & "$*dclassname"
%typemap(ctype) const enum SWIGTYPE & "int"
%typemap(imtype) const enum SWIGTYPE & "int"
%typemap(dtype) const enum SWIGTYPE & "$*dclassname"
%typecheck(SWIG_TYPECHECK_POINTER) const enum SWIGTYPE & ""
@ -51,10 +51,10 @@
$result = &temp; %}
%typemap(ddirectorin) const enum SWIGTYPE & "cast($*dclassname)$winput"
%typemap(ddirectorout) const enum SWIGTYPE & "cast(int)$dpcall"
%typemap(ddirectorout) const enum SWIGTYPE & "cast(int)$dcall"
%typemap(din) const enum SWIGTYPE & "cast(int)$dinput"
%typemap(dout, excode=SWIGEXCODE) const enum SWIGTYPE & {
$*dclassname ret = cast($*dclassname)$wcall;$excode
$*dclassname ret = cast($*dclassname)$imcall;$excode
return ret;
}

View file

@ -6,7 +6,7 @@
// Code which is inserted into the dout typemaps and class constructors via
// excode if exceptions can be thrown.
%define SWIGEXCODE "\n if ($wrapdmodule.SwigPendingException.isPending) throw $wrapdmodule.SwigPendingException.retrieve();" %enddef
%define SWIGEXCODE "\n if ($imdmodule.SwigPendingException.isPending) throw $imdmodule.SwigPendingException.retrieve();" %enddef
%typemap(throws, canthrow=1) int,
long,

View file

@ -64,7 +64,7 @@ SWIGEXPORT void SWIGRegisterExceptionCallbacks_$module(
%}
#if (SWIG_D_VERSION == 1)
%pragma(d) wrapdmoduleimports=%{
%pragma(d) imdmoduleimports=%{
// Exception throwing support currently requires Tango, but there is no reason
// why it could not support Phobos.
static import tango.core.Exception;
@ -72,7 +72,7 @@ static import tango.core.Thread;
static import tango.stdc.stringz;
%}
%pragma(d) wrapdmodulecode=%{
%pragma(d) imdmodulecode=%{
private class SwigExceptionHelper {
static this() {
swigRegisterExceptionCallbacks(
@ -169,11 +169,11 @@ private:
alias void function(char* message) SwigExceptionCallback;
%}
#else
%pragma(d) wrapdmoduleimports=%{
%pragma(d) imdmoduleimports=%{
static import std.conv;
%}
%pragma(d) wrapdmodulecode=%{
%pragma(d) imdmodulecode=%{
private class SwigExceptionHelper {
static this() {
// The D1/Tango version maps C++ exceptions to multiple exception types.
@ -265,9 +265,9 @@ SWIGEXPORT void SWIGRegisterStringCallback_$module(SWIG_DStringHelperCallback ca
%}
#if (SWIG_D_VERSION == 1)
%pragma(d) wrapdmoduleimports = "static import tango.stdc.stringz;";
%pragma(d) imdmoduleimports = "static import tango.stdc.stringz;";
%pragma(d) wrapdmodulecode = %{
%pragma(d) imdmodulecode = %{
private class SwigStringHelper {
static this() {
swigRegisterStringCallback(&createString);
@ -281,12 +281,12 @@ private class SwigStringHelper {
alias char* function(char* cString) SwigStringCallback;
%}
#else
%pragma(d) wrapdmoduleimports = %{
%pragma(d) imdmoduleimports = %{
static import std.conv;
static import std.string;
%}
%pragma(d) wrapdmodulecode = %{
%pragma(d) imdmodulecode = %{
private class SwigStringHelper {
static this() {
swigRegisterStringCallback(&createString);

View file

@ -5,9 +5,9 @@
* ----------------------------------------------------------------------------- */
%typemap(cwtype) SWIGTYPE (CLASS::*) "char *"
%typemap(dwtype) SWIGTYPE (CLASS::*) "char*"
%typemap(dptype) SWIGTYPE (CLASS::*) "$dclassname"
%typemap(ctype) SWIGTYPE (CLASS::*) "char *"
%typemap(imtype) SWIGTYPE (CLASS::*) "char*"
%typemap(dtype) SWIGTYPE (CLASS::*) "$dclassname"
%typecheck(SWIG_TYPECHECK_POINTER)
SWIGTYPE (CLASS::*)
@ -34,11 +34,11 @@
%typemap(ddirectorin) SWIGTYPE (CLASS::*)
"($winput is null) ? null : new $dclassname($winput, false)"
%typemap(ddirectorout) SWIGTYPE (CLASS::*) "$dclassname.swigGetCPtr($dpcall)"
%typemap(ddirectorout) SWIGTYPE (CLASS::*) "$dclassname.swigGetCPtr($dcall)"
%typemap(din) SWIGTYPE (CLASS::*) "$dclassname.swigGetCMemberPtr($dinput)"
%typemap(dout, excode=SWIGEXCODE) SWIGTYPE (CLASS::*) {
char* cMemberPtr = $wcall;
char* cMemberPtr = $imcall;
$dclassname ret = (cMemberPtr is null) ? null : new $dclassname(cMemberPtr, $owner);$excode
return ret;
}

View file

@ -10,16 +10,16 @@
* cases are handeled below.
*/
%define SWIG_D_PRIMITIVE(TYPE, DTYPE)
%typemap(cwtype) TYPE, const TYPE & "TYPE"
%typemap(dwtype) TYPE, const TYPE & "DTYPE"
%typemap(dptype, cprimitive="1") TYPE, const TYPE & "DTYPE"
%typemap(ctype) TYPE, const TYPE & "TYPE"
%typemap(imtype) TYPE, const TYPE & "DTYPE"
%typemap(dtype, cprimitive="1") TYPE, const TYPE & "DTYPE"
%typemap(in) TYPE "$1 = ($1_ltype)$input;"
%typemap(out) TYPE "$result = $1;"
%typemap(directorin) TYPE "$input = $1;"
%typemap(directorout) TYPE "$result = ($1_ltype)$input;"
%typemap(ddirectorin) TYPE "$winput"
%typemap(ddirectorout) TYPE "$dpcall"
%typemap(ddirectorout) TYPE "$dcall"
%typemap(in) const TYPE & ($*1_ltype temp)
%{ temp = ($*1_ltype)$input;
@ -31,11 +31,11 @@
temp = ($*1_ltype)$input;
$result = &temp; %}
%typemap(ddirectorin) const TYPE & "$winput"
%typemap(ddirectorout) const TYPE & "$dpcall"
%typemap(ddirectorout) const TYPE & "$dcall"
%typemap(din) TYPE, const TYPE & "$dinput"
%typemap(dout, excode=SWIGEXCODE) TYPE, const TYPE & {
auto ret = $wcall;$excode
auto ret = $imcall;$excode
return ret;
}
%enddef
@ -60,8 +60,8 @@ SWIG_D_PRIMITIVE(double, double)
// The C++ boolean type needs some special casing since it is not part of the
// C standard and is thus represented as unsigned int in the C wrapper layer.
%typemap(cwtype) bool, const bool & "unsigned int"
%typemap(dwtype) bool, const bool & "uint"
%typemap(ctype) bool, const bool & "unsigned int"
%typemap(imtype) bool, const bool & "uint"
%typemap(in) bool "$1 = $input ? true : false;"
%typemap(in) const bool & ($*1_ltype temp)
@ -78,7 +78,7 @@ SWIG_D_PRIMITIVE(double, double)
%typemap(ddirectorin) bool "($winput ? true : false)"
%typemap(dout, excode=SWIGEXCODE) bool, const bool & {
bool ret = $wcall ? true : false;$excode
bool ret = $imcall ? true : false;$excode
return ret;
}

View file

@ -5,9 +5,9 @@
* ----------------------------------------------------------------------------- */
%define SWIGD_STRING_TYPEMAPS(DW_STRING_TYPE, DP_STRING_TYPE, FROM_STRINGZ, TO_STRINGZ)
%typemap(cwtype) char *, char *&, char[ANY], char[] "char *"
%typemap(dwtype) char *, char *&, char[ANY], char[] #DW_STRING_TYPE
%typemap(dptype) char *, char *&, char[ANY], char[] #DP_STRING_TYPE
%typemap(ctype) char *, char *&, char[ANY], char[] "char *"
%typemap(imtype) char *, char *&, char[ANY], char[] #DW_STRING_TYPE
%typemap(dtype) char *, char *&, char[ANY], char[] #DP_STRING_TYPE
/*
@ -19,7 +19,7 @@
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) char * %{ $result = ($1_ltype)$input; %}
%typemap(directorin) char * %{ $input = SWIG_d_string_callback((const char *)$1); %}
%typemap(ddirectorin) char * "FROM_STRINGZ($winput)"
%typemap(ddirectorout) char * "TO_STRINGZ($dpcall)"
%typemap(ddirectorout) char * "TO_STRINGZ($dcall)"
/*
@ -44,12 +44,12 @@
%typemap(directorin) char[ANY], char[] %{ $input = SWIG_d_string_callback((const char *)$1); %}
%typemap(ddirectorin) char[ANY], char[] "$winput"
%typemap(ddirectorout) char[ANY], char[] "$dpcall"
%typemap(ddirectorout) char[ANY], char[] "$dcall"
%typemap(din) char *, char *&, char[ANY], char[] "($dinput ? TO_STRINGZ($dinput) : null)"
%typemap(dout, excode=SWIGEXCODE) char *, char *&, char[ANY], char[] {
DP_STRING_TYPE ret = FROM_STRINGZ ## ($wcall);$excode
DP_STRING_TYPE ret = FROM_STRINGZ ## ($imcall);$excode
return ret;
}

View file

@ -4,25 +4,25 @@
* Typemaps for non-primitive types (C/C++ classes and structs).
* ----------------------------------------------------------------------------- */
%typemap(cwtype) SWIGTYPE "void *"
%typemap(dwtype) SWIGTYPE "void*"
%typemap(dptype) SWIGTYPE "$&dclassname"
%typemap(ctype) SWIGTYPE "void *"
%typemap(imtype) SWIGTYPE "void*"
%typemap(dtype) SWIGTYPE "$&dclassname"
%typemap(cwtype) SWIGTYPE [] "void *"
%typemap(dwtype) SWIGTYPE [] "void*"
%typemap(dptype) SWIGTYPE [] "$dclassname"
%typemap(ctype) SWIGTYPE [] "void *"
%typemap(imtype) SWIGTYPE [] "void*"
%typemap(dtype) SWIGTYPE [] "$dclassname"
%typemap(cwtype) SWIGTYPE * "void *"
%typemap(dwtype) SWIGTYPE * "void*"
%typemap(dptype, nativepointer="$dptype") SWIGTYPE * "$dclassname"
%typemap(ctype) SWIGTYPE * "void *"
%typemap(imtype) SWIGTYPE * "void*"
%typemap(dtype, nativepointer="$dtype") SWIGTYPE * "$dclassname"
%typemap(cwtype) SWIGTYPE & "void *"
%typemap(dwtype) SWIGTYPE & "void*"
%typemap(dptype) SWIGTYPE & "$dclassname"
%typemap(ctype) SWIGTYPE & "void *"
%typemap(imtype) SWIGTYPE & "void*"
%typemap(dtype) SWIGTYPE & "$dclassname"
%typemap(cwtype) SWIGTYPE *const& "void *"
%typemap(dwtype) SWIGTYPE *const& "void*"
%typemap(dptype) SWIGTYPE *const& "$*dclassname"
%typemap(ctype) SWIGTYPE *const& "void *"
%typemap(imtype) SWIGTYPE *const& "void*"
%typemap(dtype) SWIGTYPE *const& "$*dclassname"
%typecheck(SWIG_TYPECHECK_POINTER)
SWIGTYPE,
@ -66,11 +66,11 @@
$result = *($&1_ltype)$input; %}
%typemap(ddirectorin) SWIGTYPE "new $&dclassname($winput, false)"
%typemap(ddirectorout) SWIGTYPE "$&dclassname.swigGetCPtr($dpcall)"
%typemap(ddirectorout) SWIGTYPE "$&dclassname.swigGetCPtr($dcall)"
%typemap(din) SWIGTYPE "$&dclassname.swigGetCPtr($dinput)"
%typemap(dout, excode=SWIGEXCODE) SWIGTYPE {
$&dclassname ret = new $&dclassname($wcall, true);$excode
$&dclassname ret = new $&dclassname($imcall, true);$excode
return ret;
}
@ -88,21 +88,21 @@
"$result = ($1_ltype)$input;"
%typemap(ddirectorin,
nativepointer="cast($dptype)$winput"
nativepointer="cast($dtype)$winput"
) SWIGTYPE * "($winput is null) ? null : new $dclassname($winput, false)"
%typemap(ddirectorout,
nativepointer="cast(void*)$dpcall"
) SWIGTYPE * "$dclassname.swigGetCPtr($dpcall)"
nativepointer="cast(void*)$dcall"
) SWIGTYPE * "$dclassname.swigGetCPtr($dcall)"
%typemap(din,
nativepointer="cast(void*)$dinput"
) SWIGTYPE * "$dclassname.swigGetCPtr($dinput)"
%typemap(dout, excode=SWIGEXCODE,
nativepointer="{\n auto ret = cast($dptype)$wcall;$excode\n return ret;\n}"
nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}"
) SWIGTYPE * {
void* cPtr = $wcall;
void* cPtr = $imcall;
$dclassname ret = (cPtr is null) ? null : new $dclassname(cPtr, $owner);$excode
return ret;
}
@ -132,11 +132,11 @@
$result = ($1_ltype)$input; %}
%typemap(ddirectorin) SWIGTYPE & "new $dclassname($winput, false)"
%typemap(ddirectorout) SWIGTYPE & "$dclassname.swigGetCPtr($dpcall)"
%typemap(ddirectorout) SWIGTYPE & "$dclassname.swigGetCPtr($dcall)"
%typemap(din) SWIGTYPE & "$dclassname.swigGetCPtr($dinput)"
%typemap(dout, excode=SWIGEXCODE) SWIGTYPE & {
$dclassname ret = new $dclassname($wcall, $owner);$excode
$dclassname ret = new $dclassname($imcall, $owner);$excode
return ret;
}
@ -150,7 +150,7 @@
%typemap(din) SWIGTYPE [] "$dclassname.swigGetCPtr($dinput)"
%typemap(dout, excode=SWIGEXCODE) SWIGTYPE [] {
void* cPtr = $wcall;
void* cPtr = $imcall;
$dclassname ret = (cPtr is null) ? null : new $dclassname(cPtr, $owner);$excode
return ret;
}
@ -171,7 +171,7 @@
%typemap(din) SWIGTYPE *const& "$*dclassname.swigGetCPtr($dinput)"
%typemap(dout, excode=SWIGEXCODE) SWIGTYPE *const& {
void* cPtr = $wcall;
void* cPtr = $imcall;
$*dclassname ret = (cPtr is null) ? null : new $*dclassname(cPtr, $owner);$excode
return ret;
}

View file

@ -4,15 +4,15 @@
* Typemaps for handling void function return types and empty parameter lists.
* ----------------------------------------------------------------------------- */
%typemap(cwtype) void "void"
%typemap(dwtype) void "void"
%typemap(dptype, cprimitive="1") void "void"
%typemap(ctype) void "void"
%typemap(imtype) void "void"
%typemap(dtype, cprimitive="1") void "void"
%typemap(out, null="") void ""
%typemap(ddirectorin) void "$winput"
%typemap(ddirectorout) void "$dpcall"
%typemap(ddirectorout) void "$dcall"
%typemap(directorin) void ""
%typemap(dout, excode=SWIGEXCODE) void {
$wcall;$excode
$imcall;$excode
}

View file

@ -21,9 +21,9 @@ class string;
%define SWIGD_STD_STRING_TYPEMAPS(DW_STRING_TYPE, DP_STRING_TYPE, FROM_STRINGZ, TO_STRINGZ)
// string
%typemap(cwtype) string, const string & "char *"
%typemap(dwtype) string, const string & #DW_STRING_TYPE
%typemap(dptype) string, const string & #DP_STRING_TYPE
%typemap(ctype) string, const string & "char *"
%typemap(imtype) string, const string & #DW_STRING_TYPE
%typemap(dtype) string, const string & #DP_STRING_TYPE
%typemap(in, canthrow=1) string, const string &
%{ if (!$input) {
@ -44,7 +44,7 @@ class string;
%typemap(din) string, const string & "($dinput ? TO_STRINGZ($dinput) : null)"
%typemap(dout, excode=SWIGEXCODE) string, const string & {
DP_STRING_TYPE ret = FROM_STRINGZ($wcall);$excode
DP_STRING_TYPE ret = FROM_STRINGZ($imcall);$excode
return ret;
}
@ -68,7 +68,7 @@ class string;
$result = &$1_str; %}
%typemap(ddirectorin) string, const string & "FROM_STRINGZ($winput)"
%typemap(ddirectorout) string, const string & "TO_STRINGZ($dpcall)"
%typemap(ddirectorout) string, const string & "TO_STRINGZ($dcall)"
%typemap(throws, canthrow=1) string, const string &
%{ SWIG_DSetPendingException(SWIG_DException, $1.c_str());

View file

@ -21,11 +21,11 @@
%include <std_common.i>
// MACRO for use within the std::vector class body
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CONST_REFERENCE, CWTYPE...)
%define SWIG_STD_VECTOR_MINIMUM_INTERNAL(CONST_REFERENCE, CTYPE...)
#if (SWIG_D_VERSION == 1)
%typemap(dimports) std::vector< CWTYPE > "static import tango.core.Exception;"
%typemap(dcode) std::vector< CWTYPE > %{
public this($typemap(dptype, CWTYPE)[] values) {
%typemap(dimports) std::vector< CTYPE > "static import tango.core.Exception;"
%typemap(dcode) std::vector< CTYPE > %{
public this($typemap(dtype, CTYPE)[] values) {
this();
append(values);
}
@ -36,7 +36,7 @@ alias push_back opCatAssign;
alias size length;
alias opSlice slice;
public $typemap(dptype, CWTYPE) opIndexAssign($typemap(dptype, CWTYPE) value, size_t index) {
public $typemap(dtype, CTYPE) opIndexAssign($typemap(dtype, CTYPE) value, size_t index) {
if (index >= size()) {
throw new tango.core.Exception.NoSuchElementException("Tried to assign to element out of vector bounds.");
}
@ -44,28 +44,28 @@ public $typemap(dptype, CWTYPE) opIndexAssign($typemap(dptype, CWTYPE) value, si
return value;
}
public $typemap(dptype, CWTYPE) opIndex(size_t index) {
public $typemap(dtype, CTYPE) opIndex(size_t index) {
if (index >= size()) {
throw new tango.core.Exception.NoSuchElementException("Tried to read from element out of vector bounds.");
}
return getElement(index);
}
public void append($typemap(dptype, CWTYPE)[] value...) {
public void append($typemap(dtype, CTYPE)[] value...) {
foreach (v; value) {
add(v);
}
}
public $typemap(dptype, CWTYPE)[] opSlice() {
$typemap(dptype, CWTYPE)[] array = new $typemap(dptype, CWTYPE)[size()];
public $typemap(dtype, CTYPE)[] opSlice() {
$typemap(dtype, CTYPE)[] array = new $typemap(dtype, CTYPE)[size()];
foreach (i, ref value; array) {
value = getElement(i);
}
return array;
}
public int opApply(int delegate(ref $typemap(dptype, CWTYPE) value) dg) {
public int opApply(int delegate(ref $typemap(dtype, CTYPE) value) dg) {
int result;
size_t currentSize = size();
@ -77,7 +77,7 @@ public int opApply(int delegate(ref $typemap(dptype, CWTYPE) value) dg) {
return result;
}
public int opApply(int delegate(ref size_t index, ref $typemap(dptype, CWTYPE) value) dg) {
public int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg) {
int result;
size_t currentSize = size();
@ -104,10 +104,10 @@ public void capacity(size_t value) {
public:
typedef size_t size_type;
typedef CWTYPE value_type;
typedef CTYPE value_type;
typedef CONST_REFERENCE const_reference;
void clear();
void push_back(CWTYPE const& x);
void push_back(CTYPE const& x);
size_type size() const;
size_type capacity() const;
void reserve(size_type n) throw (std::length_error);
@ -115,8 +115,8 @@ public void capacity(size_t value) {
vector(const vector &other);
%extend {
vector(size_type capacity) throw (std::length_error) {
std::vector< CWTYPE >* pv = 0;
pv = new std::vector< CWTYPE >();
std::vector< CTYPE >* pv = 0;
pv = new std::vector< CTYPE >();
// Might throw std::length_error.
pv->reserve(capacity);
@ -133,7 +133,7 @@ public void capacity(size_t value) {
throw std::out_of_range("Tried to remove last element from empty vector.");
}
std::vector< CWTYPE >::const_reference value = $self->back();
std::vector< CTYPE >::const_reference value = $self->back();
$self->pop_back();
return value;
}
@ -143,8 +143,8 @@ public void capacity(size_t value) {
throw std::out_of_range("Tried to remove element with invalid index.");
}
std::vector< CWTYPE >::iterator it = $self->begin() + index;
std::vector< CWTYPE >::const_reference value = *it;
std::vector< CTYPE >::iterator it = $self->begin() + index;
std::vector< CTYPE >::const_reference value = *it;
$self->erase(it);
return value;
}
@ -161,11 +161,11 @@ public void capacity(size_t value) {
}
}
// Use CWTYPE const& instead of const_reference to work around SWIG code
// Use CTYPE const& instead of const_reference to work around SWIG code
// generation issue when using const pointers as vector elements (like
// std::vector< const int* >).
%extend {
void setElement(size_type index, CWTYPE const& val) throw (std::out_of_range) {
void setElement(size_type index, CTYPE const& val) throw (std::out_of_range) {
if ((index < 0) || ($self->size() <= index)) {
throw std::out_of_range("Tried to set value of element with invalid index.");
}
@ -179,15 +179,15 @@ public void capacity(size_t value) {
#else
%typemap(dimports) std::vector< CWTYPE > %{
%typemap(dimports) std::vector< CTYPE > %{
static import std.algorithm;
static import std.exception;
static import std.range;
static import std.traits;
%}
%typemap(dcode) std::vector< CWTYPE > %{
%typemap(dcode) std::vector< CTYPE > %{
alias size_t KeyType;
alias $typemap(dptype, CWTYPE) ValueType;
alias $typemap(dtype, CTYPE) ValueType;
this(ValueType[] values...) {
this();
@ -198,17 +198,17 @@ this(ValueType[] values...) {
}
struct Range {
private $typemap(dptype, std::vector< CWTYPE >) _outer;
private $typemap(dtype, std::vector< CTYPE >) _outer;
private size_t _a, _b;
this($typemap(dptype, std::vector< CWTYPE >) data, size_t a, size_t b) {
this($typemap(dtype, std::vector< CTYPE >) data, size_t a, size_t b) {
_outer = data;
_a = a;
_b = b;
}
@property bool empty() const {
assert((cast($typemap(dptype, std::vector< CWTYPE >))_outer).length >= _b);
assert((cast($typemap(dtype, std::vector< CTYPE >))_outer).length >= _b);
return _a >= _b;
}
@ -411,7 +411,7 @@ Range linearRemove(Range r) {
}
alias remove stableLinearRemove;
int opApply(int delegate(ref $typemap(dptype, CWTYPE) value) dg) {
int opApply(int delegate(ref $typemap(dtype, CTYPE) value) dg) {
int result;
size_t currentSize = size();
@ -423,7 +423,7 @@ int opApply(int delegate(ref $typemap(dptype, CWTYPE) value) dg) {
return result;
}
int opApply(int delegate(ref size_t index, ref $typemap(dptype, CWTYPE) value) dg) {
int opApply(int delegate(ref size_t index, ref $typemap(dtype, CTYPE) value) dg) {
int result;
size_t currentSize = size();
@ -442,11 +442,11 @@ int opApply(int delegate(ref size_t index, ref $typemap(dptype, CWTYPE) value) d
public:
typedef size_t size_type;
typedef CWTYPE value_type;
typedef CTYPE value_type;
typedef CONST_REFERENCE const_reference;
bool empty() const;
void clear();
void push_back(CWTYPE const& x);
void push_back(CTYPE const& x);
void pop_back();
size_type size() const;
size_type capacity() const;
@ -455,8 +455,8 @@ int opApply(int delegate(ref size_t index, ref $typemap(dptype, CWTYPE) value) d
vector(const vector &other);
%extend {
vector(size_type capacity) throw (std::length_error) {
std::vector< CWTYPE >* pv = 0;
pv = new std::vector< CWTYPE >();
std::vector< CTYPE >* pv = 0;
pv = new std::vector< CTYPE >();
// Might throw std::length_error.
pv->reserve(capacity);
@ -469,7 +469,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dptype, CWTYPE) value) d
throw std::out_of_range("Tried to remove last element from empty vector.");
}
std::vector< CWTYPE >::const_reference value = $self->back();
std::vector< CTYPE >::const_reference value = $self->back();
$self->pop_back();
return value;
}
@ -479,26 +479,26 @@ int opApply(int delegate(ref size_t index, ref $typemap(dptype, CWTYPE) value) d
throw std::out_of_range("Tried to remove element with invalid index.");
}
std::vector< CWTYPE >::iterator it = $self->begin() + index;
std::vector< CWTYPE >::const_reference value = *it;
std::vector< CTYPE >::iterator it = $self->begin() + index;
std::vector< CTYPE >::const_reference value = *it;
$self->erase(it);
return value;
}
void removeBack(size_type how_many) throw (std::out_of_range) {
std::vector< CWTYPE >::iterator end = $self->end();
std::vector< CWTYPE >::iterator start = end - how_many;
std::vector< CTYPE >::iterator end = $self->end();
std::vector< CTYPE >::iterator start = end - how_many;
$self->erase(start, end);
}
void linearRemove(size_type start_index, size_type end_index) throw (std::out_of_range) {
std::vector< CWTYPE >::iterator start = $self->begin() + start_index;
std::vector< CWTYPE >::iterator end = $self->begin() + end_index;
std::vector< CTYPE >::iterator start = $self->begin() + start_index;
std::vector< CTYPE >::iterator end = $self->begin() + end_index;
$self->erase(start, end);
}
void insertAt(size_type index, CWTYPE const& x) throw (std::out_of_range) {
std::vector< CWTYPE >::iterator it = $self->begin() + index;
void insertAt(size_type index, CTYPE const& x) throw (std::out_of_range) {
std::vector< CTYPE >::iterator it = $self->begin() + index;
$self->insert(it, x);
}
}
@ -513,11 +513,11 @@ int opApply(int delegate(ref size_t index, ref $typemap(dptype, CWTYPE) value) d
return (*$self)[index];
}
}
// Use CWTYPE const& instead of const_reference to work around SWIG code
// Use CTYPE const& instead of const_reference to work around SWIG code
// generation issue when using const pointers as vector elements (like
// std::vector< const int* >).
%extend {
void setElement(size_type index, CWTYPE const& val) throw (std::out_of_range) {
void setElement(size_type index, CTYPE const& val) throw (std::out_of_range) {
if ((index < 0) || ($self->size() <= index)) {
throw std::out_of_range("Tried to set value of element with invalid index.");
}
@ -532,7 +532,7 @@ int opApply(int delegate(ref size_t index, ref $typemap(dptype, CWTYPE) value) d
// Extra methods added to the collection class if operator== is defined for the class being wrapped
// The class will then implement IList<>, which adds extra functionality
%define SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CWTYPE...)
%define SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE...)
%extend {
}
%enddef
@ -541,11 +541,11 @@ int opApply(int delegate(ref size_t index, ref $typemap(dptype, CWTYPE) value) d
#define %arg(X...) X
// Macros for std::vector class specializations/enhancements
%define SWIG_STD_VECTOR_ENHANCED(CWTYPE...)
%define SWIG_STD_VECTOR_ENHANCED(CTYPE...)
namespace std {
template<> class vector<CWTYPE > {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(%arg(CWTYPE const&), %arg(CWTYPE))
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CWTYPE)
template<> class vector<CTYPE > {
SWIG_STD_VECTOR_MINIMUM_INTERNAL(%arg(CTYPE const&), %arg(CTYPE))
SWIG_STD_VECTOR_EXTRA_OP_EQUALS_EQUALS(CTYPE)
};
}
%enddef

View file

@ -53,13 +53,13 @@ In D you could then use it like this:
double answer = fadd(10.0, 20.0);
*/
%define INPUT_TYPEMAP(TYPE, CWTYPE, DTYPE)
%typemap(cwtype) TYPE *INPUT, TYPE &INPUT "CWTYPE"
%typemap(dwtype) TYPE *INPUT, TYPE &INPUT "DTYPE"
%typemap(dptype) TYPE *INPUT, TYPE &INPUT "DTYPE"
%define INPUT_TYPEMAP(TYPE, CTYPE, DTYPE)
%typemap(ctype) TYPE *INPUT, TYPE &INPUT "CTYPE"
%typemap(imtype) TYPE *INPUT, TYPE &INPUT "DTYPE"
%typemap(dtype) TYPE *INPUT, TYPE &INPUT "DTYPE"
%typemap(din) TYPE *INPUT, TYPE &INPUT "$dinput"
%typemap(ddirectorin) TYPE *INPUT, TYPE &INPUT "$winput"
%typemap(ddirectorout) TYPE *INPUT, TYPE &INPUT "$dpcall"
%typemap(ddirectorout) TYPE *INPUT, TYPE &INPUT "$dcall"
%typemap(in) TYPE *INPUT, TYPE &INPUT
%{ $1 = ($1_ltype)&$input; %}
@ -68,10 +68,10 @@ In D you could then use it like this:
%{ $result = ($1_ltype)&$input; %}
%typemap(directorin) TYPE &INPUT
%{ $input = (CWTYPE *)$1; %}
%{ $input = (CTYPE *)$1; %}
%typemap(directorin) TYPE *INPUT
%{ $input = (CWTYPE *)$1; %}
%{ $input = (CTYPE *)$1; %}
%typemap(typecheck) TYPE *INPUT = TYPE;
%typemap(typecheck) TYPE &INPUT = TYPE;
@ -93,7 +93,7 @@ INPUT_TYPEMAP(float, float, float)
INPUT_TYPEMAP(double, double, double)
INPUT_TYPEMAP(enum SWIGTYPE, unsigned int, int)
%typemap(dptype) enum SWIGTYPE *INPUT, enum SWIGTYPE &INPUT "$*dclassname"
%typemap(dtype) enum SWIGTYPE *INPUT, enum SWIGTYPE &INPUT "$*dclassname"
#undef INPUT_TYPEMAP
@ -148,13 +148,13 @@ value returned in the second output parameter. In D you would use it like this:
double fraction = modf(5, dptr);
*/
%define OUTPUT_TYPEMAP(TYPE, CWTYPE, DTYPE, TYPECHECKPRECEDENCE)
%typemap(cwtype) TYPE *OUTPUT, TYPE &OUTPUT "CWTYPE *"
%typemap(dwtype) TYPE *OUTPUT, TYPE &OUTPUT "out DTYPE"
%typemap(dptype) TYPE *OUTPUT, TYPE &OUTPUT "out DTYPE"
%define OUTPUT_TYPEMAP(TYPE, CTYPE, DTYPE, TYPECHECKPRECEDENCE)
%typemap(ctype) TYPE *OUTPUT, TYPE &OUTPUT "CTYPE *"
%typemap(imtype) TYPE *OUTPUT, TYPE &OUTPUT "out DTYPE"
%typemap(dtype) TYPE *OUTPUT, TYPE &OUTPUT "out DTYPE"
%typemap(din) TYPE *OUTPUT, TYPE &OUTPUT "$dinput"
%typemap(ddirectorin) TYPE *OUTPUT, TYPE &OUTPUT "$winput"
%typemap(ddirectorout) TYPE *OUTPUT, TYPE &OUTPUT "$dpcall"
%typemap(ddirectorout) TYPE *OUTPUT, TYPE &OUTPUT "$dcall"
%typemap(in) TYPE *OUTPUT, TYPE &OUTPUT
@ -190,7 +190,7 @@ OUTPUT_TYPEMAP(float, float, float, FLOAT_PTR)
OUTPUT_TYPEMAP(double, double, double, DOUBLE_PTR)
OUTPUT_TYPEMAP(enum SWIGTYPE, unsigned int, int, INT32_PTR)
%typemap(dptype) enum SWIGTYPE *OUTPUT, enum SWIGTYPE &OUTPUT "out $*dclassname"
%typemap(dtype) enum SWIGTYPE *OUTPUT, enum SWIGTYPE &OUTPUT "out $*dclassname"
#undef OUTPUT_TYPEMAP
@ -253,13 +253,13 @@ languages in that the scripting languages will return the output value as part
of the function return value.
*/
%define INOUT_TYPEMAP(TYPE, CWTYPE, DTYPE, TYPECHECKPRECEDENCE)
%typemap(cwtype) TYPE *INOUT, TYPE &INOUT "CWTYPE *"
%typemap(dwtype) TYPE *INOUT, TYPE &INOUT "ref DTYPE"
%typemap(dptype) TYPE *INOUT, TYPE &INOUT "ref DTYPE"
%define INOUT_TYPEMAP(TYPE, CTYPE, DTYPE, TYPECHECKPRECEDENCE)
%typemap(ctype) TYPE *INOUT, TYPE &INOUT "CTYPE *"
%typemap(imtype) TYPE *INOUT, TYPE &INOUT "ref DTYPE"
%typemap(dtype) TYPE *INOUT, TYPE &INOUT "ref DTYPE"
%typemap(din) TYPE *INOUT, TYPE &INOUT "$dinput"
%typemap(ddirectorin) TYPE *INOUT, TYPE &INOUT "$winput"
%typemap(ddirectorout) TYPE *INOUT, TYPE &INOUT "$dpcall"
%typemap(ddirectorout) TYPE *INOUT, TYPE &INOUT "$dcall"
%typemap(in) TYPE *INOUT, TYPE &INOUT
%{ $1 = ($1_ltype)$input; %}
@ -293,6 +293,6 @@ INOUT_TYPEMAP(float, float, float, FLOAT_PTR)
INOUT_TYPEMAP(double, double, double, DOUBLE_PTR)
INOUT_TYPEMAP(enum SWIGTYPE, unsigned int, int, INT32_PTR)
%typemap(dptype) enum SWIGTYPE *INOUT, enum SWIGTYPE &INOUT "ref $*dclassname"
%typemap(dtype) enum SWIGTYPE *INOUT, enum SWIGTYPE &INOUT "ref $*dclassname"
#undef INOUT_TYPEMAP