SWIGTYPE && input typemaps now assume object has been moved
Replicated Java implementation. Fully implemented for: - C# - D - Guile - Javascript (UTL) - Lua - MzScheme - Octave (UTL) - Perl (UTL) - PHP - Python (UTL) - Ruby (UTL) - Tcl (UTL) PHP std::auto_ptr std::unique_ptr minor tweaks and testcase corrections
This commit is contained in:
parent
0634883089
commit
e139a36511
31 changed files with 931 additions and 46 deletions
|
|
@ -4,12 +4,33 @@
|
|||
* Guile-specific typemaps
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* These are defined with a view to eventually merging with those defined for other target languages in swigtypemaps.swg and exception.swg */
|
||||
#define %set_output(obj) $result = obj
|
||||
#define %set_varoutput(obj) $result = obj
|
||||
#define %argument_fail(_code, _type, _name, _argn) scm_wrong_type_arg((char *) FUNC_NAME, _argn, $input)
|
||||
#define %as_voidptr(ptr) (void*)(ptr)
|
||||
#define %argument_nullref(_type, _name, _argn) scm_misc_error(FUNC_NAME, "invalid null reference for argument " #_argn " of type '" _type "'", SCM_EOL)
|
||||
#define %releasenotowned_fail(_code, _type, _name, _argn) scm_misc_error(FUNC_NAME, "cannot release ownership as memory is not owned for argument " #_argn " of type '" _type "'", SCM_EOL)
|
||||
|
||||
/* Pointers */
|
||||
|
||||
%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
%typemap(in) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
$1 = ($1_ltype)SWIG_MustGetPtr($input, $descriptor, $argnum, 0);
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "";
|
||||
%typemap(in, noblock=1, fragment="<memory>") SWIGTYPE && (void *argp = 0, int res = 0, std::unique_ptr<$*1_ltype> rvrdeleter) {
|
||||
res = SWIG_ConvertPtr($input, &argp, $descriptor, SWIG_POINTER_RELEASE);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
if (res == SWIG_ERROR_RELEASE_NOT_OWNED) {
|
||||
%releasenotowned_fail(res, "$1_type", $symname, $argnum);
|
||||
} else {
|
||||
%argument_fail(res, "$1_type", $symname, $argnum);
|
||||
}
|
||||
}
|
||||
if (!argp) { %argument_nullref("$1_type", $symname, $argnum); }
|
||||
$1 = ($1_ltype)argp;
|
||||
rvrdeleter.reset($1);
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] ""
|
||||
|
||||
%typemap(in) void * {
|
||||
$1 = ($1_ltype)SWIG_MustGetPtr($input, NULL, $argnum, 0);
|
||||
|
|
@ -372,11 +393,6 @@ typedef unsigned long SCM;
|
|||
* taken from typemaps/swigtype.swg
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
#define %set_output(obj) $result = obj
|
||||
#define %set_varoutput(obj) $result = obj
|
||||
#define %argument_fail(code, type, name, argn) scm_wrong_type_arg((char *) FUNC_NAME, argn, $input);
|
||||
#define %as_voidptr(ptr) (void*)(ptr)
|
||||
|
||||
%typemap(in) SWIGTYPE (CLASS::*) {
|
||||
int res = SWIG_ConvertMember($input, %as_voidptr(&$1), sizeof($1), $descriptor);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue