Merged changes from trunk up to revision 12416.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/szager-python-builtin@12417 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
9c796f0333
127 changed files with 2571 additions and 1771 deletions
|
|
@ -538,7 +538,7 @@ $result = C_SCHEME_UNDEFINED;
|
|||
* String & length
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typemap(in) (char *STRING, int LENGTH) {
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
|
||||
if ($input == C_SCHEME_FALSE) {
|
||||
swig_barf (SWIG_BARF1_BAD_ARGUMENT_TYPE, "Cannot use a null/#f string for a char*, int arguments");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,13 +51,12 @@ or you can use the %apply directive :
|
|||
|
||||
In C# you could then use it like this:
|
||||
double answer = modulename.fadd(10.0, 20.0);
|
||||
|
||||
*/
|
||||
|
||||
%define INPUT_TYPEMAP(TYPE, CTYPE, CSTYPE)
|
||||
%typemap(ctype) TYPE *INPUT, TYPE &INPUT "CTYPE"
|
||||
%typemap(imtype) TYPE *INPUT, TYPE &INPUT "CSTYPE"
|
||||
%typemap(cstype) TYPE *INPUT, TYPE &INPUT "CSTYPE"
|
||||
%typemap(ctype, out="void *") TYPE *INPUT, TYPE &INPUT "CTYPE"
|
||||
%typemap(imtype, out="IntPtr") TYPE *INPUT, TYPE &INPUT "CSTYPE"
|
||||
%typemap(cstype, out="$csclassname") TYPE *INPUT, TYPE &INPUT "CSTYPE"
|
||||
%typemap(csin) TYPE *INPUT, TYPE &INPUT "$csinput"
|
||||
%typemap(csdirectorin) TYPE *INPUT, TYPE &INPUT "$iminput"
|
||||
%typemap(csdirectorout) TYPE *INPUT, TYPE &INPUT "$cscall"
|
||||
|
|
@ -143,18 +142,16 @@ value returned in the second output parameter. In C# you would use it like this:
|
|||
|
||||
double dptr;
|
||||
double fraction = modulename.modf(5, out dptr);
|
||||
|
||||
*/
|
||||
|
||||
%define OUTPUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE)
|
||||
%typemap(ctype) TYPE *OUTPUT, TYPE &OUTPUT "CTYPE *"
|
||||
%typemap(imtype) TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
|
||||
%typemap(cstype) TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
|
||||
%typemap(ctype, out="void *") TYPE *OUTPUT, TYPE &OUTPUT "CTYPE *"
|
||||
%typemap(imtype, out="IntPtr") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
|
||||
%typemap(cstype, out="$csclassname") TYPE *OUTPUT, TYPE &OUTPUT "out CSTYPE"
|
||||
%typemap(csin) TYPE *OUTPUT, TYPE &OUTPUT "out $csinput"
|
||||
%typemap(csdirectorin) TYPE *OUTPUT, TYPE &OUTPUT "$iminput"
|
||||
%typemap(csdirectorout) TYPE *OUTPUT, TYPE &OUTPUT "$cscall"
|
||||
|
||||
|
||||
%typemap(in) TYPE *OUTPUT, TYPE &OUTPUT
|
||||
%{ $1 = ($1_ltype)$input; %}
|
||||
|
||||
|
|
@ -250,9 +247,9 @@ of the function return value.
|
|||
*/
|
||||
|
||||
%define INOUT_TYPEMAP(TYPE, CTYPE, CSTYPE, TYPECHECKPRECEDENCE)
|
||||
%typemap(ctype) TYPE *INOUT, TYPE &INOUT "CTYPE *"
|
||||
%typemap(imtype) TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
|
||||
%typemap(cstype) TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
|
||||
%typemap(ctype, out="void *") TYPE *INOUT, TYPE &INOUT "CTYPE *"
|
||||
%typemap(imtype, out="IntPtr") TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
|
||||
%typemap(cstype, out="$csclassname") TYPE *INOUT, TYPE &INOUT "ref CSTYPE"
|
||||
%typemap(csin) TYPE *INOUT, TYPE &INOUT "ref $csinput"
|
||||
%typemap(csdirectorin) TYPE *INOUT, TYPE &INOUT "$iminput"
|
||||
%typemap(csdirectorout) TYPE *INOUT, TYPE &INOUT "$cscall"
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
%define SWIGD_CLASS_BODIES(OP_EQUALS_RETURN)
|
||||
|
||||
// Unfortunately, the »package« visibility attribute does not work in D when the
|
||||
// module in question is in the root package (happens if no -package is specified
|
||||
// at the SWIG command line), so we are stuck with public visibility for
|
||||
|
|
@ -72,18 +72,14 @@ public this(void* cObject, bool ownCObject) {
|
|||
swigCMemOwn = ownCObject;
|
||||
}
|
||||
|
||||
public override OP_EQUALS_RETURN opEquals(Object rhs) {
|
||||
if (auto other = cast($dclassname)rhs) {
|
||||
return (swigCPtr == other.swigCPtr);
|
||||
}
|
||||
return super.opEquals(rhs);
|
||||
}
|
||||
|
||||
public static void* swigGetCPtr($dclassname obj) {
|
||||
return (obj is null) ? null : obj.swigCPtr;
|
||||
}
|
||||
|
||||
mixin $imdmodule.SwigOperatorDefinitions;
|
||||
%}
|
||||
|
||||
|
||||
%typemap(dbody_derived) SWIGTYPE %{
|
||||
private void* swigCPtr;
|
||||
|
||||
|
|
@ -92,16 +88,11 @@ public this(void* cObject, bool ownCObject) {
|
|||
swigCPtr = cObject;
|
||||
}
|
||||
|
||||
public override OP_EQUALS_RETURN opEquals(Object rhs) {
|
||||
if (auto other = cast($dclassname)rhs) {
|
||||
return (swigCPtr == other.swigCPtr);
|
||||
}
|
||||
return super.opEquals(rhs);
|
||||
}
|
||||
|
||||
public static void* swigGetCPtr($dclassname obj) {
|
||||
return (obj is null) ? null : obj.swigCPtr;
|
||||
}
|
||||
|
||||
mixin $imdmodule.SwigOperatorDefinitions;
|
||||
%}
|
||||
|
||||
|
||||
|
|
@ -120,16 +111,11 @@ protected this() {
|
|||
swigCPtr = null;
|
||||
}
|
||||
|
||||
public override OP_EQUALS_RETURN opEquals(Object rhs) {
|
||||
if (auto other = cast($dclassname)rhs) {
|
||||
return (swigCPtr == other.swigCPtr);
|
||||
}
|
||||
return super.opEquals(rhs);
|
||||
}
|
||||
|
||||
public static void* swigGetCPtr($dclassname obj) {
|
||||
return (obj is null) ? null : obj.swigCPtr;
|
||||
}
|
||||
|
||||
mixin $imdmodule.SwigOperatorDefinitions;
|
||||
%}
|
||||
|
||||
|
||||
|
|
@ -138,35 +124,19 @@ public static void* swigGetCPtr($dclassname obj) {
|
|||
*/
|
||||
|
||||
%typemap(dbody) SWIGTYPE (CLASS::*) %{
|
||||
private char* m_swigCMemberPtr;
|
||||
private char* swigCPtr;
|
||||
|
||||
public this(char* cMemberPtr, bool futureUse) {
|
||||
m_swigCMemberPtr = cMemberPtr;
|
||||
swigCPtr = cMemberPtr;
|
||||
}
|
||||
|
||||
protected this() {
|
||||
m_swigCMemberPtr = null;
|
||||
swigCPtr = null;
|
||||
}
|
||||
|
||||
public override OP_EQUALS_RETURN opEquals(Object rhs) {
|
||||
if (auto other = cast($dclassname)rhs) {
|
||||
return (m_swigCMemberPtr == other.m_swigCMemberPtr);
|
||||
}
|
||||
return super.opEquals(rhs);
|
||||
}
|
||||
|
||||
|
||||
package static char* swigGetCMemberPtr($dclassname obj) {
|
||||
return (obj is null) ? null : obj.m_swigCMemberPtr;
|
||||
return (obj is null) ? null : obj.swigCPtr;
|
||||
}
|
||||
|
||||
mixin $imdmodule.SwigOperatorDefinitions;
|
||||
%}
|
||||
%enddef
|
||||
|
||||
|
||||
#if SWIG_D_VERSION == 1
|
||||
SWIGD_CLASS_BODIES(int)
|
||||
#else
|
||||
SWIGD_CLASS_BODIES(bool)
|
||||
#endif
|
||||
|
||||
#undef SWIGD_CLASS_BODIES
|
||||
|
|
|
|||
|
|
@ -7,5 +7,4 @@
|
|||
#define %dmanifestconst %feature("d:manifestconst")
|
||||
#define %dconstvalue(value) %feature("d:constvalue",value)
|
||||
#define %dmethodmodifiers %feature("d:methodmodifiers")
|
||||
#define %dstripprefix %feature("d:stripprefix")
|
||||
#define %dnothrowexception %feature("except")
|
||||
|
|
|
|||
|
|
@ -4,15 +4,36 @@
|
|||
* Mapping of C++ operator overloading methods to D.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#if (SWIG_D_VERSION == 1)
|
||||
|
||||
%rename(opAdd) *::operator+;
|
||||
%pragma(d) imdmodulecode=%{
|
||||
template SwigOperatorDefinitions() {
|
||||
public override int opEquals(Object o) {
|
||||
if (auto rhs = cast(typeof(this))o) {
|
||||
if (swigCPtr == rhs.swigCPtr) return 1;
|
||||
static if (is(typeof(swigOpEquals(rhs)))) {
|
||||
return swigOpEquals(rhs) ? 1 : 0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return super.opEquals(o);
|
||||
}
|
||||
%}
|
||||
// opEquals is emitted in pure C mode as well to define two proxy classes
|
||||
// pointing to the same struct as equal.
|
||||
|
||||
#ifdef __cplusplus
|
||||
%rename(opPos) *::operator+();
|
||||
%rename(opPos) *::operator+() const;
|
||||
%rename(opNeg) *::operator-();
|
||||
%rename(opNeg) *::operator-() const;
|
||||
%rename(opCom) *::operator~();
|
||||
%rename(opCom) *::operator~() const;
|
||||
|
||||
%rename(opAdd) *::operator+;
|
||||
%rename(opAddAssign) *::operator+=;
|
||||
%rename(opSub) *::operator-;
|
||||
%rename(opNeg) *::operator-();
|
||||
%rename(opSubAssign) *::operator-=;
|
||||
%rename(opMul) *::operator*;
|
||||
%rename(opMulAssign) *::operator*=;
|
||||
|
|
@ -20,8 +41,6 @@
|
|||
%rename(opDivAssign) *::operator/=;
|
||||
%rename(opMod) *::operator%;
|
||||
%rename(opModAssign) *::operator%=;
|
||||
|
||||
%rename(opCom) *::operator~();
|
||||
%rename(opAnd) *::operator&;
|
||||
%rename(opAndAssign) *::operator&=;
|
||||
%rename(opOr) *::operator|;
|
||||
|
|
@ -34,44 +53,207 @@
|
|||
%rename(opShrAssign) *::operator>>=;
|
||||
|
||||
%rename(opIndex) *::operator[](unsigned) const;
|
||||
%rename(opIndexAssign) *::operator[](unsigned);
|
||||
%rename(opCall) *::operator();
|
||||
// opIndexAssign is not currently generated, it needs more extensive support
|
||||
// mechanisms.
|
||||
|
||||
%rename(opCall) *::operator();
|
||||
|
||||
// !a is not overrideable in D1.
|
||||
%ignoreoperator(LNOT) operator!;
|
||||
|
||||
// a != b is rewritten as !a.opEquals(b) in D.
|
||||
// For now, just ignore both of them, since there would be quite a bit of magic
|
||||
// needed to correctly generate a wrapper method for non-primitives types (there is
|
||||
// only one opEquals overload with an Object parameter in D).
|
||||
%ignoreoperator(EQ) operator==;
|
||||
%ignoreoperator(NOTEQUAL) operator!=;
|
||||
|
||||
// opCmp is used in D.
|
||||
%ignoreoperator(LT) operator<;
|
||||
%ignoreoperator(LTEQUAL) operator<=;
|
||||
%ignoreoperator(GT) operator>;
|
||||
%ignoreoperator(GTEQUAL) operator>=;
|
||||
%rename(swigOpEquals) *::operator==;
|
||||
%rename(swigOpLt) *::operator<;
|
||||
%rename(swigOpLtEquals) *::operator<=;
|
||||
%rename(swigOpGt) *::operator>;
|
||||
%rename(swigOpGtEquals) *::operator>=;
|
||||
|
||||
// a != b is rewritten as !a.opEquals(b) in D.
|
||||
%ignoreoperator(NOTEQUAL) operator!=;
|
||||
|
||||
// The logic operators are not overrideable in D.
|
||||
%ignoreoperator(LAND) operator&&;
|
||||
%ignoreoperator(LOR) operator||;
|
||||
|
||||
// ++/--a is rewritten as a +/-= 1 in D.
|
||||
%ignoreoperator(PLUSPLUS) operator++();
|
||||
%ignoreoperator(MINUSMINUS) operator--();
|
||||
%ignoreoperator(PLUSPLUS) operator++(int);
|
||||
%ignoreoperator(MINUSMINUS) operator--(int);
|
||||
// ++/--a is rewritten as a +/-= 1 in D1,so ignore the prefix operators.
|
||||
%ignoreoperator(PLUSPLUS) *::operator++();
|
||||
%ignoreoperator(MINUSMINUS) *::operator--();
|
||||
%rename(swigOpInc) *::operator++(int);
|
||||
%rename(swigOpDec) *::operator--(int);
|
||||
|
||||
// The C++ assignment operator does not translate well to D where custom types
|
||||
// have reference semantics.
|
||||
// The C++ assignment operator does not translate well to D where the proxy
|
||||
// classes have reference semantics.
|
||||
%ignoreoperator(EQ) operator=;
|
||||
|
||||
%pragma(d) imdmodulecode=%{
|
||||
public override int opCmp(Object o) {
|
||||
static if (is(typeof(swigOpLt(typeof(this).init) &&
|
||||
swigOpEquals(typeof(this).init)))) {
|
||||
if (auto rhs = cast(typeof(this))o) {
|
||||
if (swigOpLt(rhs)) {
|
||||
return -1;
|
||||
} else if (swigOpEquals(rhs)) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.opCmp(o);
|
||||
}
|
||||
|
||||
public typeof(this) opPostInc(T = int)(T unused = 0) {
|
||||
static assert(
|
||||
is(typeof(swigOpInc(int.init))),
|
||||
"opPostInc called on " ~ typeof(this).stringof ~ ", but no postfix " ~
|
||||
"increment operator exists in the corresponding C++ class."
|
||||
);
|
||||
return swigOpInc(int.init);
|
||||
}
|
||||
|
||||
public typeof(this) opPostDec(T = int)(T unused = 0) {
|
||||
static assert(
|
||||
is(typeof(swigOpDec(int.init))),
|
||||
"opPostInc called on " ~ typeof(this).stringof ~ ", but no postfix " ~
|
||||
"decrement operator exists in the corresponding C++ class."
|
||||
);
|
||||
return swigOpDec(int.init);
|
||||
}
|
||||
%}
|
||||
#endif
|
||||
|
||||
%pragma(d) imdmodulecode=%{
|
||||
}
|
||||
%}
|
||||
|
||||
#else
|
||||
%pragma(d) imdmodulecode=%{
|
||||
mixin template SwigOperatorDefinitions() {
|
||||
public override bool opEquals(Object o) {
|
||||
if (auto rhs = cast(typeof(this))o) {
|
||||
if (swigCPtr == rhs.swigCPtr) return true;
|
||||
static if (is(typeof(swigOpEquals(rhs)))) {
|
||||
return swigOpEquals(rhs);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.opEquals(o);
|
||||
}
|
||||
%}
|
||||
// opEquals is emitted in pure C mode as well to define two proxy classes
|
||||
// pointing to the same struct as equal.
|
||||
|
||||
// Operator overloading works completely different in D2, proper support will
|
||||
// probably need fairly extensive code generation support.
|
||||
#ifdef __cplusplus
|
||||
%rename(swigOpPos) *::operator+();
|
||||
%rename(swigOpPos) *::operator+() const;
|
||||
%rename(swigOpNeg) *::operator-();
|
||||
%rename(swigOpNeg) *::operator-() const;
|
||||
%rename(swigOpCom) *::operator~();
|
||||
%rename(swigOpCom) *::operator~() const;
|
||||
%rename(swigOpInc) *::operator++();
|
||||
%rename(swigOpDec) *::operator--();
|
||||
%ignoreoperator(PLUSPLUS) *::operator++(int);
|
||||
%ignoreoperator(MINUSMINUS) *::operator--(int);
|
||||
// The postfix increment/decrement operators are ignored because they are
|
||||
// rewritten to (auto t = e, ++e, t) in D2. The unary * operator (used for
|
||||
// pointer dereferencing in C/C++) isn't mapped to opUnary("*") by default,
|
||||
// despite this would be possible in D2 – the difference in member access
|
||||
// semantics would only lead to confusion in most cases.
|
||||
|
||||
%rename(swigOpAdd) *::operator+;
|
||||
%rename(swigOpSub) *::operator-;
|
||||
%rename(swigOpMul) *::operator*;
|
||||
%rename(swigOpDiv) *::operator/;
|
||||
%rename(swigOpMod) *::operator%;
|
||||
%rename(swigOpAnd) *::operator&;
|
||||
%rename(swigOpOr) *::operator|;
|
||||
%rename(swigOpXor) *::operator^;
|
||||
%rename(swigOpShl) *::operator<<;
|
||||
%rename(swigOpShr) *::operator>>;
|
||||
|
||||
%rename(swigOpAddAssign) *::operator+=;
|
||||
%rename(swigOpSubAssign) *::operator-=;
|
||||
%rename(swigOpMulAssign) *::operator*=;
|
||||
%rename(swigOpDivAssign) *::operator/=;
|
||||
%rename(swigOpModAssign) *::operator%=;
|
||||
%rename(swigOpAndAssign) *::operator&=;
|
||||
%rename(swigOpOrAssign) *::operator|=;
|
||||
%rename(swigOpXorAssign) *::operator^=;
|
||||
%rename(swigOpShlAssign) *::operator<<=;
|
||||
%rename(swigOpShrAssign) *::operator>>=;
|
||||
|
||||
%rename(opIndex) *::operator[];
|
||||
// opIndexAssign is not currently generated, it needs more extensive support
|
||||
// mechanisms.
|
||||
|
||||
%rename(opCall) *::operator();
|
||||
|
||||
%rename(swigOpEquals) *::operator==;
|
||||
%rename(swigOpLt) *::operator<;
|
||||
%rename(swigOpLtEquals) *::operator<=;
|
||||
%rename(swigOpGt) *::operator>;
|
||||
%rename(swigOpGtEquals) *::operator>=;
|
||||
|
||||
// a != b is rewritten as !a.opEquals(b) in D.
|
||||
%ignoreoperator(NOTEQUAL) operator!=;
|
||||
|
||||
// The logic operators are not overrideable in D.
|
||||
%ignoreoperator(LAND) operator&&;
|
||||
%ignoreoperator(LOR) operator||;
|
||||
|
||||
// The C++ assignment operator does not translate well to D where the proxy
|
||||
// classes have reference semantics.
|
||||
%ignoreoperator(EQ) operator=;
|
||||
|
||||
%pragma(d) imdmodulecode=%{
|
||||
public override int opCmp(Object o) {
|
||||
static if (__traits(compiles, swigOpLt(typeof(this).init) &&
|
||||
swigOpEquals(typeof(this).init))) {
|
||||
if (auto rhs = cast(typeof(this))o) {
|
||||
if (swigOpLt(rhs)) {
|
||||
return -1;
|
||||
} else if (swigOpEquals(rhs)) {
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.opCmp(o);
|
||||
}
|
||||
|
||||
private template swigOpBinary(string operator, string name) {
|
||||
enum swigOpBinary = `public void opOpAssign(string op, T)(T rhs) if (op == "` ~ operator ~
|
||||
`" && __traits(compiles, swigOp` ~ name ~ `Assign(rhs))) { swigOp` ~ name ~ `Assign(rhs);}` ~
|
||||
`public auto opBinary(string op, T)(T rhs) if (op == "` ~ operator ~
|
||||
`" && __traits(compiles, swigOp` ~ name ~ `(rhs))) { return swigOp` ~ name ~ `(rhs);}`;
|
||||
}
|
||||
mixin(swigOpBinary!("+", "Add"));
|
||||
mixin(swigOpBinary!("-", "Sub"));
|
||||
mixin(swigOpBinary!("*", "Mul"));
|
||||
mixin(swigOpBinary!("/", "Div"));
|
||||
mixin(swigOpBinary!("%", "Mod"));
|
||||
mixin(swigOpBinary!("&", "And"));
|
||||
mixin(swigOpBinary!("|", "Or"));
|
||||
mixin(swigOpBinary!("^", "Xor"));
|
||||
mixin(swigOpBinary!("<<", "Shl"));
|
||||
mixin(swigOpBinary!(">>", "Shr"));
|
||||
|
||||
private template swigOpUnary(string operator, string name) {
|
||||
enum swigOpUnary = `public auto opUnary(string op)() if (op == "` ~ operator ~
|
||||
`" && __traits(compiles, swigOp` ~ name ~ `())) { return swigOp` ~ name ~ `();}`;
|
||||
}
|
||||
mixin(swigOpUnary!("+", "Pos"));
|
||||
mixin(swigOpUnary!("-", "Neg"));
|
||||
mixin(swigOpUnary!("~", "Com"));
|
||||
mixin(swigOpUnary!("++", "Inc"));
|
||||
mixin(swigOpUnary!("--", "Dec"));
|
||||
%}
|
||||
#endif
|
||||
|
||||
%pragma(d) imdmodulecode=%{
|
||||
}
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
%typemap(ctype) SWIGTYPE & "void *"
|
||||
%typemap(imtype) SWIGTYPE & "void*"
|
||||
%typemap(dtype) SWIGTYPE & "$dclassname"
|
||||
%typemap(dtype, nativepointer="$dtype") SWIGTYPE & "$dclassname"
|
||||
|
||||
%typemap(ctype) SWIGTYPE *const& "void *"
|
||||
%typemap(imtype) SWIGTYPE *const& "void*"
|
||||
|
|
@ -131,11 +131,18 @@
|
|||
}
|
||||
$result = ($1_ltype)$input; %}
|
||||
|
||||
%typemap(ddirectorin) SWIGTYPE & "new $dclassname($winput, false)"
|
||||
%typemap(ddirectorout) SWIGTYPE & "$dclassname.swigGetCPtr($dcall)"
|
||||
%typemap(ddirectorin,
|
||||
nativepointer="cast($dtype)$winput"
|
||||
) SWIGTYPE & "new $dclassname($winput, false)"
|
||||
%typemap(ddirectorout,
|
||||
nativepointer="cast(void*)$dcall"
|
||||
) SWIGTYPE & "$dclassname.swigGetCPtr($dcall)"
|
||||
|
||||
%typemap(din) SWIGTYPE & "$dclassname.swigGetCPtr($dinput)"
|
||||
%typemap(dout, excode=SWIGEXCODE) SWIGTYPE & {
|
||||
%typemap(din,
|
||||
nativepointer="cast(void*)$dinput"
|
||||
) SWIGTYPE & "$dclassname.swigGetCPtr($dinput)"
|
||||
%typemap(dout, excode=SWIGEXCODE,
|
||||
nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}") SWIGTYPE & {
|
||||
$dclassname ret = new $dclassname($imcall, $owner);$excode
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ In D you could then use it like this:
|
|||
*/
|
||||
|
||||
%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(ctype, out="void *") TYPE *INPUT, TYPE &INPUT "CTYPE"
|
||||
%typemap(imtype, out="void*") TYPE *INPUT, TYPE &INPUT "DTYPE"
|
||||
%typemap(dtype, out="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 "$dcall"
|
||||
|
|
@ -149,9 +149,9 @@ value returned in the second output parameter. In D you would use it like this:
|
|||
*/
|
||||
|
||||
%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(ctype, out="void *") TYPE *OUTPUT, TYPE &OUTPUT "CTYPE *"
|
||||
%typemap(imtype, out="void*") TYPE *OUTPUT, TYPE &OUTPUT "out DTYPE"
|
||||
%typemap(dtype, out="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 "$dcall"
|
||||
|
|
@ -176,8 +176,8 @@ value returned in the second output parameter. In D you would use it like this:
|
|||
|
||||
OUTPUT_TYPEMAP(bool, unsigned int, bool, BOOL_PTR)
|
||||
//OUTPUT_TYPEMAP(char, char, char, CHAR_PTR) // Why was this commented out?
|
||||
OUTPUT_TYPEMAP(signed char, signed char, ubyte, INT8_PTR)
|
||||
OUTPUT_TYPEMAP(unsigned char, unsigned char, byte, UINT8_PTR)
|
||||
OUTPUT_TYPEMAP(signed char, signed char, byte, INT8_PTR)
|
||||
OUTPUT_TYPEMAP(unsigned char, unsigned char, ubyte, UINT8_PTR)
|
||||
OUTPUT_TYPEMAP(short, short, short, INT16_PTR)
|
||||
OUTPUT_TYPEMAP(unsigned short, unsigned short, ushort, UINT16_PTR)
|
||||
OUTPUT_TYPEMAP(int, int, int, INT32_PTR)
|
||||
|
|
@ -254,9 +254,9 @@ of the function return value.
|
|||
*/
|
||||
|
||||
%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(ctype, out="void *") TYPE *INOUT, TYPE &INOUT "CTYPE *"
|
||||
%typemap(imtype, out="void*") TYPE *INOUT, TYPE &INOUT "ref DTYPE"
|
||||
%typemap(dtype, out="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 "$dcall"
|
||||
|
|
@ -279,8 +279,8 @@ of the function return value.
|
|||
|
||||
INOUT_TYPEMAP(bool, unsigned int, bool, BOOL_PTR)
|
||||
//INOUT_TYPEMAP(char, char, char, CHAR_PTR)
|
||||
INOUT_TYPEMAP(signed char, signed char, ubyte, INT8_PTR)
|
||||
INOUT_TYPEMAP(unsigned char, unsigned char, byte, UINT8_PTR)
|
||||
INOUT_TYPEMAP(signed char, signed char, byte, INT8_PTR)
|
||||
INOUT_TYPEMAP(unsigned char, unsigned char, ubyte, UINT8_PTR)
|
||||
INOUT_TYPEMAP(short, short, short, INT16_PTR)
|
||||
INOUT_TYPEMAP(unsigned short, unsigned short, ushort, UINT16_PTR)
|
||||
INOUT_TYPEMAP(int, int, int, INT32_PTR)
|
||||
|
|
|
|||
|
|
@ -12,83 +12,12 @@ typedef struct SWIGCDATA {
|
|||
%}
|
||||
|
||||
%typemap(gotype) SWIGCDATA %{ []byte %}
|
||||
%typemap(out) SWIGCDATA (swigcdata argp) {
|
||||
argp = _swig_makegobyteslice($1.data, $1.len);
|
||||
$result.data = (char*)argp.data;
|
||||
$result.len = (int)argp.len;
|
||||
}
|
||||
|
||||
/* The makegobyteslice function. */
|
||||
|
||||
%insert(runtime) %{
|
||||
typedef struct {
|
||||
char *data;
|
||||
int len;
|
||||
} swigcdata;
|
||||
|
||||
%typemap(out) SWIGCDATA %{
|
||||
$result.data = (char*)_swig_goallocate($1.len);
|
||||
memcpy($result.data, $1.data, $1.len);
|
||||
$result.len = (int)$1.len;
|
||||
%}
|
||||
|
||||
#ifndef SWIGGO_GCCGO
|
||||
%insert(runtime) %{
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
void _swig_gc_makegobyteslice(void *, int);
|
||||
static swigcdata _swig_makegobyteslice(const char *data, int len) {
|
||||
struct {
|
||||
const char *data;
|
||||
int len;
|
||||
swigcdata ret;
|
||||
} a;
|
||||
a.data = data;
|
||||
a.len = len;
|
||||
crosscall2(_swig_gc_makegobyteslice, &a, (int) sizeof a);
|
||||
return a.ret;
|
||||
}
|
||||
%}
|
||||
|
||||
%insert(gc_header) %{
|
||||
typedef struct {
|
||||
byte *data;
|
||||
int32 len;
|
||||
} swigcdata;
|
||||
extern void ·_swig_internal_makegobyteslice(void);
|
||||
#pragma dynexport _swig_gc_makegobyteslice _swig_gc_makegobyteslice
|
||||
void _swig_gc_makegobyteslice(void *a, int32 n) {
|
||||
cgocallback(·_swig_internal_makegobyteslice, a, n);
|
||||
}
|
||||
void ·_swig_allocategobyteslice(byte *data, int32 len, swigcdata ret) {
|
||||
ret.data = runtime·mal(len);
|
||||
runtime·mcpy(ret.data, data, len);
|
||||
ret.len = len;
|
||||
FLUSH(&ret);
|
||||
}
|
||||
%}
|
||||
|
||||
%insert(go_header) %{
|
||||
type swigcdata struct { data *byte; len int }
|
||||
func _swig_allocategobyteslice(*byte, int) swigcdata
|
||||
func _swig_internal_makegobyteslice(data *byte, len int) swigcdata {
|
||||
return _swig_allocategobyteslice(data, len)
|
||||
}
|
||||
%}
|
||||
|
||||
#else
|
||||
|
||||
%insert(runtime) %{
|
||||
static swigcdata _swig_makegobyteslice(const char *data, int len) {
|
||||
swigcdata ret;
|
||||
ret.data = (char*)__go_alloc(len);
|
||||
memcpy(ret.data, data, len);
|
||||
ret.len = (int)len;
|
||||
return ret;
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* %cdata(TYPE [, NAME])
|
||||
*
|
||||
|
|
|
|||
|
|
@ -157,8 +157,8 @@
|
|||
const float &,
|
||||
const double &
|
||||
%{
|
||||
$result = ($1_ltype)_swig_allocate(sizeof($*1_ltype));
|
||||
*$result = *($1_ltype)$input;
|
||||
$result = ($1_ltype)_swig_goallocate(sizeof($*1_ltype));
|
||||
*$result = *($1_ltype)&$input;
|
||||
%}
|
||||
|
||||
/* The size_t type. */
|
||||
|
|
@ -192,7 +192,7 @@
|
|||
|
||||
%typemap(directorout) const size_t &
|
||||
%{
|
||||
$result = ($1_ltype)_swig_allocate(sizeof($*1_ltype));
|
||||
$result = ($1_ltype)_swig_goallocate(sizeof($*1_ltype));
|
||||
*$result = *($1_ltype)$input;
|
||||
%}
|
||||
|
||||
|
|
@ -206,7 +206,7 @@
|
|||
|
||||
%typemap(out) SWIGTYPE (CLASS::*)
|
||||
%{
|
||||
$result = _swig_allocate(sizeof($1_ltype));
|
||||
$result = _swig_goallocate(sizeof($1_ltype));
|
||||
*($&1_ltype)$result = $1;
|
||||
%}
|
||||
|
||||
|
|
@ -215,7 +215,7 @@
|
|||
|
||||
%typemap(directorout) SWIGTYPE (CLASS::*)
|
||||
%{
|
||||
$result = _swig_allocate(sizeof($1_ltype));
|
||||
$result = _swig_goallocate(sizeof($1_ltype));
|
||||
*($&1_ltype)$result = $input;
|
||||
%}
|
||||
|
||||
|
|
@ -254,14 +254,6 @@
|
|||
%typemap(out) SWIGTYPE *const&
|
||||
%{ *($1_ltype)&$result = *$1; %}
|
||||
|
||||
/* Function pointers are translated by the code in go.cxx into
|
||||
_swig_fnptr. Member pointers are translated to _swig_memberptr. */
|
||||
|
||||
%insert(go_header) %{
|
||||
type _swig_fnptr *byte
|
||||
type _swig_memberptr *byte
|
||||
%}
|
||||
|
||||
/* References. */
|
||||
|
||||
/* Converting a C++ reference to Go has to be handled in the C++
|
||||
|
|
@ -341,6 +333,28 @@ type _swig_memberptr *byte
|
|||
unsigned char *, unsigned char *&, unsigned char[ANY], unsigned char[]
|
||||
%{ $result = ($1_ltype)$input.p; %}
|
||||
|
||||
/* String & length */
|
||||
|
||||
%typemap(gotype) (char *STRING, size_t LENGTH) "string"
|
||||
|
||||
%typemap(in) (char *STRING, size_t LENGTH)
|
||||
%{
|
||||
$1 = ($1_ltype)$input.p;
|
||||
$2 = ($2_ltype)$input.n;
|
||||
%}
|
||||
|
||||
%typemap(out) (char *STRING, size_t LENGTH)
|
||||
%{ $result = _swig_makegostring((char*)$1, (size_t)$2); %}
|
||||
|
||||
%typemap(directorin) (char *STRING, size_t LENGTH)
|
||||
%{ $input = _swig_makegostring((char*)$1_name, $2_name); %}
|
||||
|
||||
%typemap(directorout) (char *STRING, size_t LENGTH)
|
||||
%{
|
||||
$1 = ($1_ltype)$input.p;
|
||||
$2 = ($2_ltype)$input.n;
|
||||
%}
|
||||
|
||||
/* Enums. We can't do the right thing for enums in typemap(gotype) so
|
||||
we deliberately don't define them. The right thing would be to
|
||||
capitalize the name. This is instead done in go.cxx. */
|
||||
|
|
@ -508,6 +522,7 @@ type _swig_memberptr *byte
|
|||
SWIGTYPE [],
|
||||
SWIGTYPE (CLASS::*)
|
||||
""
|
||||
|
||||
/* Go keywords. */
|
||||
%include <gokw.swg>
|
||||
|
||||
|
|
|
|||
|
|
@ -30,57 +30,32 @@ swiggo_size_assert(swiggo_long_long, 8)
|
|||
swiggo_size_assert(float, 4)
|
||||
swiggo_size_assert(double, 8)
|
||||
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
extern "C" {
|
||||
#endif
|
||||
extern void crosscall2(void (*fn)(void *, int), void *, int);
|
||||
extern void _cgo_allocate(void *, int);
|
||||
extern void _cgo_panic(void *, int);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
void crosscall2(void (*fn)(void *, int), void *, int);
|
||||
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
void _swig_gc_allocate(void *, int);
|
||||
static void *_swig_allocate(int len) {
|
||||
static void *_swig_goallocate(size_t len) {
|
||||
struct {
|
||||
int len;
|
||||
size_t len;
|
||||
void *ret;
|
||||
} a;
|
||||
a.len = len;
|
||||
crosscall2(_swig_gc_allocate, &a, (int) sizeof a);
|
||||
crosscall2(_cgo_allocate, &a, (int) sizeof a);
|
||||
return a.ret;
|
||||
}
|
||||
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
void _swig_gc_makegostring(void *, int);
|
||||
static _gostring_ _swig_makegostring(const char *p, size_t l) {
|
||||
struct {
|
||||
const char *p;
|
||||
int l;
|
||||
_gostring_ ret;
|
||||
} a;
|
||||
a.p = p;
|
||||
a.l = l;
|
||||
crosscall2(_swig_gc_makegostring, &a, (int) sizeof a);
|
||||
return a.ret;
|
||||
}
|
||||
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
void _swig_gc_gopanic(void *, int);
|
||||
static void _swig_gopanic(const char *p) {
|
||||
struct {
|
||||
const char *p;
|
||||
int l;
|
||||
} a;
|
||||
a.p = p;
|
||||
a.l = strlen(p);
|
||||
crosscall2(_swig_gc_gopanic, &a, (int) sizeof a);
|
||||
crosscall2(_cgo_panic, &a, (int) sizeof a);
|
||||
}
|
||||
|
||||
%}
|
||||
|
|
@ -91,10 +66,6 @@ static void _swig_gopanic(const char *p) {
|
|||
#include "runtime.h"
|
||||
#include "cgocall.h"
|
||||
|
||||
#pragma dynimport initcgo initcgo "libcgo.so"
|
||||
#pragma dynimport libcgo_thread_start libcgo_thread_start "libcgo.so"
|
||||
#pragma dynimport libcgo_set_scheduler libcgo_set_scheduler "libcgo.so"
|
||||
|
||||
#ifdef _64BIT
|
||||
#define SWIG_PARM_SIZE 8
|
||||
#else
|
||||
|
|
@ -102,97 +73,56 @@ static void _swig_gopanic(const char *p) {
|
|||
#endif
|
||||
%}
|
||||
|
||||
/* 6g/8g C boilerplate that is only needed once in a program. This
|
||||
only gets added to the file if nothing is imported. */
|
||||
%insert(gc_once) %{
|
||||
|
||||
extern void ·_swig_internal_allocate(void);
|
||||
#pragma dynexport _swig_gc_allocate _swig_gc_allocate
|
||||
void _swig_gc_allocate(void *a, int32 n) {
|
||||
runtime·cgocallback(·_swig_internal_allocate, a, n);
|
||||
}
|
||||
|
||||
void ·_swig_allocatememory(int32 len, byte *ret) {
|
||||
ret = runtime·mal(len);
|
||||
FLUSH(&ret);
|
||||
}
|
||||
|
||||
extern void ·_swig_internal_makegostring(void);
|
||||
#pragma dynexport _swig_gc_makegostring _swig_gc_makegostring
|
||||
void _swig_gc_makegostring(void *a, int32 n) {
|
||||
runtime·cgocallback(·_swig_internal_makegostring, a, n);
|
||||
}
|
||||
|
||||
void ·_swig_allocatestring(byte *p, int32 l, String ret) {
|
||||
ret.str = runtime·mal(l+1);
|
||||
runtime·mcpy(ret.str, p, l);
|
||||
ret.len = l;
|
||||
FLUSH(&ret);
|
||||
}
|
||||
|
||||
extern void ·_swig_internal_gopanic(void);
|
||||
#pragma dynexport _swig_gc_gopanic _swig_gc_gopanic
|
||||
void _swig_gc_gopanic(void *a, int32 n) {
|
||||
runtime·cgocallback(·_swig_internal_gopanic, a, n);
|
||||
}
|
||||
|
||||
%}
|
||||
|
||||
/* Go code that is only needed once in a program. This is only added
|
||||
to the file if nothing is imported. */
|
||||
%insert(go_once) %{
|
||||
func _swig_allocatememory(int) *byte
|
||||
func _swig_internal_allocate(len int) *byte {
|
||||
return _swig_allocatememory(len)
|
||||
}
|
||||
|
||||
func _swig_allocatestring(*byte, int) string
|
||||
func _swig_internal_makegostring(p *byte, l int) string {
|
||||
return _swig_allocatestring(p, l)
|
||||
}
|
||||
|
||||
func _swig_internal_gopanic(p *byte, l int) {
|
||||
panic(_swig_allocatestring(p, l))
|
||||
}
|
||||
%}
|
||||
|
||||
#else
|
||||
|
||||
/* Boilerplate for C/C++ code when using gccgo. */
|
||||
%insert(runtime) %{
|
||||
#define SWIGGO_GCCGO
|
||||
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
extern "C" {
|
||||
#endif
|
||||
void *__go_alloc (size_t);
|
||||
|
||||
static void *_swig_allocate(int len) {
|
||||
return __go_alloc(len);
|
||||
}
|
||||
|
||||
static _gostring_ _swig_makegostring(const char *p, size_t l) {
|
||||
_gostring_ ret;
|
||||
ret.p = (char*)__go_alloc(l);
|
||||
memcpy(ret.p, p, l);
|
||||
ret.n = l;
|
||||
return ret;
|
||||
}
|
||||
|
||||
extern
|
||||
extern void *_cgo_allocate(size_t);
|
||||
extern void _cgo_panic(const char *);
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
}
|
||||
#endif
|
||||
void __go_panic_msg(const char *);
|
||||
#define _swig_gopanic __go_panic_msg
|
||||
|
||||
#define _swig_goallocate _cgo_allocate
|
||||
#define _swig_gopanic _cgo_panic
|
||||
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
%insert(runtime) %{
|
||||
|
||||
static _gostring_ _swig_makegostring(const char *p, size_t l) {
|
||||
_gostring_ ret;
|
||||
ret.p = (char*)_swig_goallocate(l + 1);
|
||||
memcpy(ret.p, p, l);
|
||||
ret.n = l;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define SWIG_contract_assert(expr, msg) \
|
||||
if (!(expr)) { _swig_gopanic(msg); } else
|
||||
%}
|
||||
|
||||
#ifndef SWIGGO_GCCGO
|
||||
|
||||
%insert(go_header) %{
|
||||
|
||||
import _ "runtime/cgo"
|
||||
|
||||
%}
|
||||
|
||||
#endif
|
||||
|
||||
/* Function pointers are translated by the code in go.cxx into
|
||||
_swig_fnptr. Member pointers are translated to _swig_memberptr. */
|
||||
|
||||
%insert(go_header) %{
|
||||
type _swig_fnptr *byte
|
||||
type _swig_memberptr *byte
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ typedef unsigned long SCM;
|
|||
* String & length
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typemap(in) (char *STRING, int LENGTH) {
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
|
||||
size_t temp;
|
||||
$1 = ($1_ltype) gh_scm2newstr($input, &temp);
|
||||
$2 = ($2_ltype) temp;
|
||||
|
|
|
|||
|
|
@ -1290,6 +1290,21 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
|
|||
/* const pointers */
|
||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||
|
||||
/* String & length */
|
||||
%typemap(jni) (char *STRING, size_t LENGTH) "jbyteArray"
|
||||
%typemap(jtype) (char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(jstype) (char *STRING, size_t LENGTH) "byte[]"
|
||||
%typemap(javain) (char *STRING, size_t LENGTH) "$javainput"
|
||||
%typemap(freearg) (char *STRING, size_t LENGTH) ""
|
||||
%typemap(in) (char *STRING, size_t LENGTH) {
|
||||
$1 = (char *) JCALL2(GetByteArrayElements, jenv, $input, 0);
|
||||
$2 = (size_t) JCALL1(GetArrayLength, jenv, $input);
|
||||
}
|
||||
%typemap(argout) (char *STRING, size_t LENGTH) {
|
||||
JCALL3(ReleaseByteArrayElements, jenv, $input, (jbyte *)$1, 0);
|
||||
}
|
||||
%apply (char *STRING, size_t LENGTH) { (char *STRING, int LENGTH) }
|
||||
|
||||
/* java keywords */
|
||||
%include <javakw.swg>
|
||||
|
||||
|
|
|
|||
|
|
@ -76,8 +76,7 @@
|
|||
$1 = ($1_ltype) Z_STRVAL_PP($input);
|
||||
}
|
||||
|
||||
%typemap(in) (char *STRING, int LENGTH)
|
||||
{
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
|
||||
convert_to_string_ex($input);
|
||||
$1 = ($1_ltype) Z_STRVAL_PP($input);
|
||||
$2 = ($2_ltype) Z_STRLEN_PP($input);
|
||||
|
|
@ -447,6 +446,12 @@
|
|||
_v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $1_descriptor, 0) >= 0);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
|
||||
{
|
||||
void *tmp;
|
||||
_v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $*1_descriptor, 0) >= 0);
|
||||
}
|
||||
|
||||
%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
|
||||
{
|
||||
void *tmp;
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ extern "C" {
|
|||
* String & length
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typemap(in, pikedesc="tStr") (char *STRING, int LENGTH) {
|
||||
%typemap(in) (char *STRING, int LENGTH), (char *STRING, size_t LENGTH) {
|
||||
if ($input.type != T_STRING)
|
||||
Pike_error("Bad argument: Expected a string.\n");
|
||||
$1 = ($1_ltype) STR0($input.u.string);
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@
|
|||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE *const& {
|
||||
void *vptr = 0;
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $*descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue