[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:
parent
d741223959
commit
ca9c273546
3 changed files with 38 additions and 11 deletions
|
|
@ -1,6 +1,15 @@
|
||||||
|
2007-11-21 Mikel Bancroft <mikel@franz.com>
|
||||||
|
|
||||||
Version 1.3.33 (in progress)
|
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
|
11/20/2007: olly
|
||||||
[Python] Fill in Python Dictionary functions list (patch from
|
[Python] Fill in Python Dictionary functions list (patch from
|
||||||
Jelmer Vernooij posted to swig-devel).
|
Jelmer Vernooij posted to swig-devel).
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,12 @@ namespace std {
|
||||||
%typemap(lisptype) string "cl:string";
|
%typemap(lisptype) string "cl:string";
|
||||||
%typemap(lout) string "(cl::setq ACL_ffresult $body)";
|
%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(ctype) wstring "wchar_t *";
|
||||||
%typemap(in) wstring "$1.assign($input);";
|
%typemap(in) wstring "$1.assign($input);";
|
||||||
%typemap(out) wstring "$result = (wchar_t *)(&$1)->c_str();";
|
%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
|
%typemap(lout) wstring "(cl::setq ACL_ffresult (excl:native-to-string $body
|
||||||
:external-format #+little-endian :fat-le #-little-endian :fat))";
|
: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 */
|
/* Overloading check */
|
||||||
// %typemap(in) string {
|
// %typemap(in) string {
|
||||||
// if (caml_ptr_check($input))
|
// if (caml_ptr_check($input))
|
||||||
|
|
|
||||||
|
|
@ -735,22 +735,21 @@ String *internal_compose_foreign_type(SwigType *ty) {
|
||||||
|
|
||||||
String *compose_foreign_type(SwigType *ty, String *id = 0) {
|
String *compose_foreign_type(SwigType *ty, String *id = 0) {
|
||||||
|
|
||||||
|
Hash *lookup_res = Swig_typemap_search("ffitype", ty, id, 0);
|
||||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||||
Printf(stderr, "compose_foreign_type: ENTER (%s)...\n ", ty);
|
Printf(stderr, "compose_foreign_type: ENTER (%s)...\n ", ty);
|
||||||
String *id_ref = SwigType_str(ty, id);
|
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",
|
Printf(stderr, "looking up typemap for %s, found '%s'(%x)\n",
|
||||||
id_ref, lookup_res ? Getattr(lookup_res, "code") : 0, lookup_res);
|
id_ref, lookup_res ? Getattr(lookup_res, "code") : 0, lookup_res);
|
||||||
#endif
|
#endif
|
||||||
/* should we allow named lookups in the typemap here? YES! */
|
/* should we allow named lookups in the typemap here? YES! */
|
||||||
if(id) { /* and we should probably allow unnamed lookups here as well */
|
/* unnamed lookups should be found in get_ffi_type, called
|
||||||
Hash *lookup_res = Swig_typemap_search("ffitype", ty, id, 0);
|
by internal_compose_foreign_type(), below. */
|
||||||
if(lookup_res) {
|
if(id && lookup_res) {
|
||||||
#ifdef ALLEGROCL_TYPE_DEBUG
|
#ifdef ALLEGROCL_TYPE_DEBUG
|
||||||
Printf(stderr, "compose_foreign_type: EXIT-1 (%s)\n ", Getattr(lookup_res, "code"));
|
Printf(stderr, "compose_foreign_type: EXIT-1 (%s)\n ", Getattr(lookup_res, "code"));
|
||||||
#endif
|
#endif
|
||||||
return NewString(Getattr(lookup_res, "code"));
|
return NewString(Getattr(lookup_res, "code"));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SwigType *temp = SwigType_strip_qualifiers(ty);
|
SwigType *temp = SwigType_strip_qualifiers(ty);
|
||||||
|
|
@ -1155,9 +1154,17 @@ void emit_full_class(Node *n) {
|
||||||
if (!Strcmp(childDecl, "0"))
|
if (!Strcmp(childDecl, "0"))
|
||||||
childDecl = NewString("");
|
childDecl = NewString("");
|
||||||
|
|
||||||
SwigType *childType = NewStringf("%s%s", childDecl,
|
SwigType *childType;
|
||||||
Getattr(c, "type"));
|
String *cname;
|
||||||
String *cname = (access && Strcmp(access, "public")) ? NewString("nil") : Copy(Getattr(c, "name"));
|
|
||||||
|
// 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)) {
|
if (!SwigType_isfunction(childType)) {
|
||||||
// Printf(slotdefs, ";;; member functions don't appear as slots.\n ");
|
// Printf(slotdefs, ";;; member functions don't appear as slots.\n ");
|
||||||
|
|
@ -1559,7 +1566,7 @@ int ALLEGROCL::top(Node *n) {
|
||||||
"(defpackage :%s\n"
|
"(defpackage :%s\n"
|
||||||
" (:use :common-lisp :ff :excl)\n"
|
" (:use :common-lisp :ff :excl)\n"
|
||||||
" (:export #:*swig-identifier-converter* #:*swig-module-name*\n"
|
" (:export #:*swig-identifier-converter* #:*swig-module-name*\n"
|
||||||
" #:*void* #:*swig-expoert-list*))\n"
|
" #:*void* #:*swig-export-list*))\n"
|
||||||
"(in-package :%s)\n\n"
|
"(in-package :%s)\n\n"
|
||||||
"(eval-when (compile load eval)\n"
|
"(eval-when (compile load eval)\n"
|
||||||
" (defparameter *swig-identifier-converter* '%s)\n"
|
" (defparameter *swig-identifier-converter* '%s)\n"
|
||||||
|
|
@ -2912,7 +2919,6 @@ int ALLEGROCL::typedefHandler(Node *n) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Delete(ff_type);
|
Delete(ff_type);
|
||||||
if (lookup) Delete(lookup);
|
|
||||||
|
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue