03/12/2006: mutandiz

[allegrocl]
	    Add INPUT/OUTPUT typemaps for bool.
	    Generate c++ style wrappers for struct/unions when
	    -cwrap option specified.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9004 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mikel Bancroft 2006-03-12 20:38:57 +00:00
commit 6fc01f1cb7
3 changed files with 48 additions and 24 deletions

View file

@ -1,6 +1,12 @@
Version 1.3.29 (March 8, 2006) Version 1.3.29 (March 8, 2006)
============================== ==============================
03/12/2006: mutandiz
[allegrocl]
fix up INPUT/OUTPUT typemaps for bool.
Generate c++ style wrapper functions for struct/union members
when -cwrap option specified.
03/10/2006: mutandiz 03/10/2006: mutandiz
[allegrocl] [allegrocl]
Fix bug in C wrapper generation introduced by last allegrocl Fix bug in C wrapper generation introduced by last allegrocl

View file

@ -6,15 +6,13 @@
*/ */
%define INOUT_TYPEMAP(type_) %define INOUT_TYPEMAP(type_, OUTresult_, INbind_)
// OUTPUT map. // OUTPUT map.
%typemap(lin,numinputs=0) type_ *OUTPUT %typemap(lin,numinputs=0) type_ *OUTPUT, type_ &OUTPUT
%{ %{(let (($out (ff:allocate-fobject '$*in_fftype :c)))
(let (($out (ff:allocate-fobject '$*in_fftype :c)))
$body $body
(push (ff:fslot-value-typed '$*in_fftype :c $out) ACL_result) OUTresult_
(ff:free-fobject $out)) (ff:free-fobject $out)) %}
%}
// INPUT map. // INPUT map.
%typemap(in) type_ *INPUT, type_ &INPUT %typemap(in) type_ *INPUT, type_ &INPUT
@ -25,29 +23,49 @@
// INOUT map. // INOUT map.
%typemap(lin,numinputs=1) type_ *INOUT, type_ &INOUT %typemap(lin,numinputs=1) type_ *INOUT, type_ &INOUT
%{ %{(let (($out (ff:allocate-fobject '$*in_fftype :c)))
(let (($out (ff:allocate-fobject '$*in_fftype :c))) INbind_
(setf (ff:fslot-value-typed '$*in_fftype :c $out) $in)
$body $body
(push (ff:fslot-value-typed $*in_fftype :c $out) ACL_result) OUTresult_
(ff:free-fobject $out)) (ff:free-fobject $out)) %}
%}
%enddef %enddef
// $in, $out, $lclass, // $in, $out, $lclass,
// $in_fftype, $*in_fftype // $in_fftype, $*in_fftype
INOUT_TYPEMAP(int); INOUT_TYPEMAP(int,
INOUT_TYPEMAP(short); (push (ff:fslot-value-typed (quote $*in_fftype) :c $out) ACL_result),
INOUT_TYPEMAP(long); (setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) $in));
INOUT_TYPEMAP(unsigned int); INOUT_TYPEMAP(short,
INOUT_TYPEMAP(unsigned short); (push (ff:fslot-value-typed (quote $*in_fftype) :c $out) ACL_result),
INOUT_TYPEMAP(unsigned long); (setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) $in));
INOUT_TYPEMAP(char); INOUT_TYPEMAP(long,
INOUT_TYPEMAP(bool); (push (ff:fslot-value-typed (quote $*in_fftype) :c $out) ACL_result),
INOUT_TYPEMAP(float); (setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) $in));
INOUT_TYPEMAP(double); INOUT_TYPEMAP(unsigned int,
(push (ff:fslot-value-typed (quote $*in_fftype) :c $out) ACL_result),
(setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) $in));
INOUT_TYPEMAP(unsigned short,
(push (ff:fslot-value-typed (quote $*in_fftype) :c $out) ACL_result),
(setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) $in));
INOUT_TYPEMAP(unsigned long,
(push (ff:fslot-value-typed (quote $*in_fftype) :c $out) ACL_result),
(setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) $in));
INOUT_TYPEMAP(char,
(push (ff:fslot-value-typed (quote $*in_fftype) :c $out) ACL_result),
(setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) $in));
INOUT_TYPEMAP(float,
(push (ff:fslot-value-typed (quote $*in_fftype) :c $out) ACL_result),
(setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) $in));
INOUT_TYPEMAP(double,
(push (ff:fslot-value-typed (quote $*in_fftype) :c $out) ACL_result),
(setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) $in));
INOUT_TYPEMAP(bool,
(push (not (zerop (ff:fslot-value-typed (quote $*in_fftype) :c $out)))
ACL_result),
(setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) (if $in 1 0)));
// long long support not yet complete // long long support not yet complete
// INOUT_TYPEMAP(long long); // INOUT_TYPEMAP(long long);
// INOUT_TYPEMAP(unsigned long long); // INOUT_TYPEMAP(unsigned long long);

View file

@ -2839,7 +2839,7 @@ int ALLEGROCL :: classHandler(Node *n) {
Strcmp(kind, "class") == 0 || Strcmp(kind, "class") == 0 ||
Strcmp(kind, "union") == 0) Strcmp(kind, "union") == 0)
{ {
if (CPlusPlus) if (Generate_Wrapper)
return cppClassHandler(n); return cppClassHandler(n);
else else
return cClassHandler(n); return cClassHandler(n);