[allegrocl] multiple small fixes to interface. have const std::string *'s automacitally marshalled to lisp strings.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10162 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Mikel Bancroft 2007-11-21 21:33:42 +00:00
commit ca9c273546
3 changed files with 38 additions and 11 deletions

View file

@ -1,6 +1,15 @@
2007-11-21 Mikel Bancroft <mikel@franz.com>
Version 1.3.33 (in progress)
============================
11/21/2007: mikel
[allegrocl] omit private slot type info in the classes/types
defined on the lisp side. Fix bug in mapping of C/++ types
to lisp types. Fix typo in modules generated defpackage form.
Have std::string *'s automatically marshalled between foreign
and lisp strings.
11/20/2007: olly
[Python] Fill in Python Dictionary functions list (patch from
Jelmer Vernooij posted to swig-devel).

View file

@ -102,6 +102,12 @@ namespace std {
%typemap(lisptype) string "cl:string";
%typemap(lout) string "(cl::setq ACL_ffresult $body)";
%typemap(ctype) const string *"char *";
%typemap(in) const string * "$1.assign($input);";
%typemap(out) const string * "$result = (char *)($1)->c_str();";
%typemap(lisptype) const string * "cl:string";
%typemap(lout) const string * "(cl::setq ACL_ffresult $body)";
%typemap(ctype) wstring "wchar_t *";
%typemap(in) wstring "$1.assign($input);";
%typemap(out) wstring "$result = (wchar_t *)(&$1)->c_str();";
@ -109,6 +115,12 @@ namespace std {
%typemap(lout) wstring "(cl::setq ACL_ffresult (excl:native-to-string $body
:external-format #+little-endian :fat-le #-little-endian :fat))";
%typemap(ctype) const wstring *"char *";
%typemap(in) const wstring * "$1.assign($input);";
%typemap(out) const wstring * "$result = (char *)($1)->c_str();";
%typemap(lisptype) const wstring * "cl:string";
%typemap(lout) const wstring * "(cl::setq ACL_ffresult $body)";
/* Overloading check */
// %typemap(in) string {
// if (caml_ptr_check($input))

View file

@ -735,22 +735,21 @@ String *internal_compose_foreign_type(SwigType *ty) {
String *compose_foreign_type(SwigType *ty, String *id = 0) {
Hash *lookup_res = Swig_typemap_search("ffitype", ty, id, 0);
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "compose_foreign_type: ENTER (%s)...\n ", ty);
String *id_ref = SwigType_str(ty, id);
Hash *lookup_res = Swig_typemap_search("ffitype", ty, id, 0);
Printf(stderr, "looking up typemap for %s, found '%s'(%x)\n",
id_ref, lookup_res ? Getattr(lookup_res, "code") : 0, lookup_res);
#endif
/* should we allow named lookups in the typemap here? YES! */
if(id) { /* and we should probably allow unnamed lookups here as well */
Hash *lookup_res = Swig_typemap_search("ffitype", ty, id, 0);
if(lookup_res) {
/* unnamed lookups should be found in get_ffi_type, called
by internal_compose_foreign_type(), below. */
if(id && lookup_res) {
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "compose_foreign_type: EXIT-1 (%s)\n ", Getattr(lookup_res, "code"));
#endif
return NewString(Getattr(lookup_res, "code"));
}
return NewString(Getattr(lookup_res, "code"));
}
SwigType *temp = SwigType_strip_qualifiers(ty);
@ -1155,9 +1154,17 @@ void emit_full_class(Node *n) {
if (!Strcmp(childDecl, "0"))
childDecl = NewString("");
SwigType *childType = NewStringf("%s%s", childDecl,
Getattr(c, "type"));
String *cname = (access && Strcmp(access, "public")) ? NewString("nil") : Copy(Getattr(c, "name"));
SwigType *childType;
String *cname;
// don't include types for private slots (yet). spr33959.
if(access && Strcmp(access,"public")) {
childType = NewStringf("int");
cname = NewString("nil");
} else {
childType = NewStringf("%s%s", childDecl, Getattr(c, "type"));
cname = Copy(Getattr(c, "name"));
}
if (!SwigType_isfunction(childType)) {
// Printf(slotdefs, ";;; member functions don't appear as slots.\n ");
@ -1559,7 +1566,7 @@ int ALLEGROCL::top(Node *n) {
"(defpackage :%s\n"
" (:use :common-lisp :ff :excl)\n"
" (:export #:*swig-identifier-converter* #:*swig-module-name*\n"
" #:*void* #:*swig-expoert-list*))\n"
" #:*void* #:*swig-export-list*))\n"
"(in-package :%s)\n\n"
"(eval-when (compile load eval)\n"
" (defparameter *swig-identifier-converter* '%s)\n"
@ -2912,7 +2919,6 @@ int ALLEGROCL::typedefHandler(Node *n) {
#endif
Delete(ff_type);
if (lookup) Delete(lookup);
return SWIG_OK;
}