03/17/2005: mutandiz

[allegrocl]
	    mangle names of constants generated via constantWrapper.

	    When using OUTPUT typemaps and the function has a non-void
	    return value, it should be first in the values-list, followed
	    by the OUTPUT mapped values.

	    Fix bug with boolean parameters, which needed to be
	    passed in as int values, rather than T or NIL.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9010 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mikel Bancroft 2006-03-18 01:18:36 +00:00
commit d1b3949aba
3 changed files with 29 additions and 10 deletions

View file

@ -1,6 +1,17 @@
Version 1.3.29 (March 8, 2006)
==============================
03/17/2005: mutandiz
[allegrocl]
mangle names of constants generated via constantWrapper.
When using OUTPUT typemaps and the function has a non-void
return value, it should be first in the values-list, followed
by the OUTPUT mapped values.
Fix bug with boolean parameters, which needed to be
passed in as int values, rather than T or NIL.
03/15/2006: mutandiz
[allegrocl]
Generate wrappers for constants when in C++ or -cwrap mode.

View file

@ -14,12 +14,12 @@
int, signed int, unsigned int,
long, signed long, unsigned long,
float, double, long double, char *, void *,
enum SWIGTYPE "(push $body ACL_result)";
enum SWIGTYPE "(setq ACL_ffresult $body)";
%typemap(lout) void "$body";
%typemap(lout) SWIGTYPE[ANY], SWIGTYPE *,
SWIGTYPE & "(push (make-instance '$lclass :foreign-address $body) ACL_result)";
SWIGTYPE & "(setq ACL_ffresult (make-instance '$lclass :foreign-address $body))";
%typemap(lout) SWIGTYPE "(let* ((address $body)\n (new-inst (make-instance '$lclass :foreign-address address)))\n (unless (zerop address)\n (excl:schedule-finalization new-inst #'$ldestructor))\n (push new-inst ACL_result))";
%typemap(lout) SWIGTYPE "(let* ((address $body)\n (new-inst (make-instance '$lclass :foreign-address address)))\n (unless (zerop address)\n (excl:schedule-finalization new-inst #'$ldestructor))\n (setq ACL_ffresult new-inst))";
%typemap(lisptype) bool "boolean";
%typemap(lisptype) char "character";
@ -162,9 +162,9 @@ SWIG_TYPECHECK_STRING_ARRAY 1140
$body)"
%typemap(out) wchar_t "$result = $1;";
%typemap(lout) wchar_t "(push (code-char $body) ACL_result)";
%typemap(lout) wchar_t* "(push (excl:native-to-string $body
:external-format #+little-endian :fat-le #-little-endian :fat) ACL_result)";
%typemap(lout) wchar_t "(setq ACL_ffresult (code-char $body))";
%typemap(lout) wchar_t* "(setq ACL_ffresult (excl:native-to-string $body
:external-format #+little-endian :fat-le #-little-endian :fat))";
%typemap(ffitype) wchar_t ":unsigned-short";
%typemap(lisptype) wchar_t "";

View file

@ -2323,13 +2323,17 @@ int ALLEGROCL :: emit_defun(Node *n, File *f_cl) {
Swig_typemap_attach_parms("lin", pl, wrap);
Swig_typemap_lookup_new("lout",n,"result",0);
SwigType *result_type = Swig_cparse_type(Getattr(n,"tmap:ctype"));
// prime the pump, with support for OUTPUT, INOUT typemaps.
Printf(wrap->code,"(let (ACL_result)\n $body\n (values-list ACL_result))");
if(Strcmp(result_type,"void")) {
Printf(wrap->code,"(let (ACL_result ACL_ffresult)\n $body\n (values-list (cons ACL_ffresult ACL_result)))");
} else {
Printf(wrap->code,"(let (ACL_result ACL_ffresult)\n $body\n (values-list ACL_result))");
}
Parm *p;
int largnum = 0, argnum=0, first=1;
// int varargs=0;
SwigType *result_type = Swig_cparse_type(Getattr(n,"tmap:ctype"));
if (Generate_Wrapper)
{
String *extra_parms = id_converter_arguments(n)->noname_str();
@ -2390,7 +2394,9 @@ int ALLEGROCL :: emit_defun(Node *n, File *f_cl) {
Delete(temp);
String *lisptype=get_lisp_type(argtype, argname);
// String *lisptype=get_lisp_type(argtype, argname);
String *lisptype=get_lisp_type(Getattr(p,"type"), Getattr(p,"name"));
Printf(stderr,"lisptype of '%s' '%s' = '%s'\n", argtype, Getattr(p,"name"), lisptype);
// while we're walking the parameters, generating LIN
// wrapper code...
@ -2734,9 +2740,11 @@ int ALLEGROCL :: constantWrapper(Node *n) {
if(Generate_Wrapper) {
// Setattr(n,"wrap:name",mangle_name(n, "ACLPP"));
String *ppcname = NewStringf("ACLppc_%s",Getattr(n,"name"));
Printf(f_cxx,"static const %s %s = %s;\n", Getattr(n,"type"),
Getattr(n,"sym:name"), Getattr(n,"value"));
ppcname, Getattr(n,"value"));
Setattr(n,"name",ppcname);
SetFlag(n,"feature:immutable");
return variableWrapper(n);
}