Added support for the D programming languge.
It is still a bit rough around some edges, particularly with regard to multi-threading and operator overloading, and there are some documentation bits missing, but it should be fine for basic use. The test-suite should build and run fine with the current versions of DMD, LDC and Tango (at least) on Linux x86_64 and Mac OS X 10.6. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12299 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a355d2d46a
commit
03aefbc6e9
176 changed files with 16449 additions and 29 deletions
92
Lib/d/dmemberfunctionpointers.swg
Normal file
92
Lib/d/dmemberfunctionpointers.swg
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
/* -----------------------------------------------------------------------------
|
||||
* dmemberfunctionpointers.swg
|
||||
*
|
||||
* Typemaps for member function pointers.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
%typemap(cwtype) SWIGTYPE (CLASS::*) "char *"
|
||||
%typemap(dwtype) SWIGTYPE (CLASS::*) "char*"
|
||||
%typemap(dptype) SWIGTYPE (CLASS::*) "$dclassname"
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER)
|
||||
SWIGTYPE (CLASS::*)
|
||||
""
|
||||
|
||||
|
||||
/*
|
||||
* Conversion generation typemaps.
|
||||
*/
|
||||
|
||||
%typemap(in, fragment="SWIG_UnPackData") SWIGTYPE (CLASS::*) %{
|
||||
SWIG_UnpackData($input, (void *)&$1, sizeof($1));
|
||||
%}
|
||||
%typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{
|
||||
char buf[128];
|
||||
char *data = SWIG_PackData(buf, (void *)&$1, sizeof($1));
|
||||
*data = '\0';
|
||||
$result = SWIG_d_string_callback(buf);
|
||||
%}
|
||||
|
||||
%typemap(directorin) SWIGTYPE (CLASS::*) "$input = (void *) $1;"
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE (CLASS::*)
|
||||
"$result = ($1_ltype)$input;"
|
||||
|
||||
%typemap(ddirectorin) SWIGTYPE (CLASS::*)
|
||||
"($winput is null) ? null : new $dclassname($winput, false)"
|
||||
%typemap(ddirectorout) SWIGTYPE (CLASS::*) "$dclassname.swigGetCPtr($dpcall)"
|
||||
|
||||
%typemap(din) SWIGTYPE (CLASS::*) "$dclassname.swigGetCMemberPtr($dinput)"
|
||||
%typemap(dout, excode=SWIGEXCODE) SWIGTYPE (CLASS::*) {
|
||||
char* cMemberPtr = $wcall;
|
||||
$dclassname ret = (cMemberPtr is null) ? null : new $dclassname(cMemberPtr, $owner);$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Helper functions to pack/unpack arbitrary binary data (member function
|
||||
* pointers in this case) into a string.
|
||||
*/
|
||||
|
||||
%fragment("SWIG_PackData", "header") {
|
||||
/* Pack binary data into a string */
|
||||
SWIGINTERN char * SWIG_PackData(char *c, void *ptr, size_t sz) {
|
||||
static const char hex[17] = "0123456789abcdef";
|
||||
register const unsigned char *u = (unsigned char *) ptr;
|
||||
register const unsigned char *eu = u + sz;
|
||||
for (; u != eu; ++u) {
|
||||
register unsigned char uu = *u;
|
||||
*(c++) = hex[(uu & 0xf0) >> 4];
|
||||
*(c++) = hex[uu & 0xf];
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("SWIG_UnPackData", "header") {
|
||||
/* Unpack binary data from a string */
|
||||
SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
|
||||
register unsigned char *u = (unsigned char *) ptr;
|
||||
register const unsigned char *eu = u + sz;
|
||||
for (; u != eu; ++u) {
|
||||
register char d = *(c++);
|
||||
register unsigned char uu;
|
||||
if ((d >= '0') && (d <= '9'))
|
||||
uu = ((d - '0') << 4);
|
||||
else if ((d >= 'a') && (d <= 'f'))
|
||||
uu = ((d - ('a'-10)) << 4);
|
||||
else
|
||||
return (char *) 0;
|
||||
d = *(c++);
|
||||
if ((d >= '0') && (d <= '9'))
|
||||
uu |= (d - '0');
|
||||
else if ((d >= 'a') && (d <= 'f'))
|
||||
uu |= (d - ('a'-10));
|
||||
else
|
||||
return (char *) 0;
|
||||
*u = uu;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue