04/05/2006: mutandiz
[allegrocl] Fix output typemap of char so it produces a character instead of an integer. Also adds input/output typemaps for 'char *'. add command-line argument -isolate to generate an interface file that won't interfere with other SWIG generated files that may be used in the same application. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9042 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7b4adb3109
commit
497228ec04
5 changed files with 43 additions and 13 deletions
|
|
@ -1,6 +1,15 @@
|
|||
Version 1.3.29 (March 21, 2006)
|
||||
===============================
|
||||
|
||||
04/05/2006: mutandiz
|
||||
[allegrocl]
|
||||
Fix output typemap of char so it produces a character instead
|
||||
of an integer. Also adds input/output typemaps for 'char *'.
|
||||
|
||||
add command-line argument -isolate to generate an interface
|
||||
file that won't interfere with other SWIG generated files that
|
||||
may be used in the same application.
|
||||
|
||||
03/20/2005: mutandiz
|
||||
[allegrocl]
|
||||
More tweaks to INPUT/OUTPUT typemaps for bool.
|
||||
|
|
|
|||
|
|
@ -383,6 +383,11 @@ swig -allegrocl [ options ] filename
|
|||
for modules with simple interfaces. Can not handle all legal enum
|
||||
and constant constructs, or take advantage of SWIG customization features.
|
||||
|
||||
-isolate - With this command-line argument, all lisp helper functions are defined
|
||||
in a unique package named <tt>swig.<module-name></tt> rather than
|
||||
<tt>swig</tt>. This prevents conflicts when the module is
|
||||
intended to be used with other swig generated interfaces that may,
|
||||
for instance, make use of different identifier converters.
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ $body)"
|
|||
%insert("lisphead") %{
|
||||
;; $Id$
|
||||
|
||||
(eval-when (compile eval)
|
||||
(eval-when (compile load eval)
|
||||
|
||||
;;; You can define your own identifier converter if you want.
|
||||
;;; Use the -identifier-converter command line argument to
|
||||
|
|
@ -258,7 +258,7 @@ $body)"
|
|||
(let* ((info (second form))
|
||||
(id (car info))
|
||||
(id-args (cddr info)))
|
||||
(apply swig:*swig-identifier-converter* id id-args)))
|
||||
(apply *swig-identifier-converter* id id-args)))
|
||||
|
||||
(defmacro defswig1 (name (&rest args) &body body)
|
||||
`(progn (defmacro ,name ,args
|
||||
|
|
@ -268,7 +268,7 @@ $body)"
|
|||
(defmacro defswig2 (name (&rest args) &body body)
|
||||
`(progn (defmacro ,name ,args
|
||||
,@body)
|
||||
(excl::define-simple-parser ,name second)))
|
||||
b (excl::define-simple-parser ,name second)))
|
||||
|
||||
(defun read-symbol-from-string (string)
|
||||
(multiple-value-bind (result position)
|
||||
|
|
@ -332,7 +332,7 @@ $body)"
|
|||
(let ((args (list (if (consp symbol) (cadr symbol) symbol)
|
||||
(or package *package*))))
|
||||
(apply #'export args)
|
||||
(pushnew args swig::*swig-export-list*))
|
||||
(pushnew args *swig-export-list*))
|
||||
symbol))
|
||||
|
||||
(defmacro swig-insert-id (name namespace &key (type :type) class)
|
||||
|
|
|
|||
|
|
@ -53,7 +53,8 @@ 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),
|
||||
(push (code-char (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),
|
||||
|
|
@ -66,6 +67,12 @@ INOUT_TYPEMAP(bool,
|
|||
ACL_result),
|
||||
(setf (ff:fslot-value-typed (quote $*in_fftype) :c $out) (if $in 1 0)));
|
||||
|
||||
INOUT_TYPEMAP(char *,
|
||||
(push (ff:char*-to-string (ff:fslot-value-typed (quote $*in_fftype) :c $out))
|
||||
ACL_result),
|
||||
(setf (ff:fslot-value-typed (quote $*in_fftype) :c $out)
|
||||
(ff:string-to-char* $in)))
|
||||
|
||||
%typemap(lisptype) bool *INPUT, bool &INPUT "boolean";
|
||||
|
||||
// long long support not yet complete
|
||||
|
|
|
|||
|
|
@ -26,10 +26,13 @@ static File *f_cxx_header=0;
|
|||
static File *f_cxx_wrapper=0;
|
||||
|
||||
static String *module_name=0;
|
||||
static String *swig_package=0;
|
||||
|
||||
const char *identifier_converter="identifier-convert-null";
|
||||
|
||||
static bool CWrap = true; // generate wrapper file for C code by default. most correct.
|
||||
static bool Generate_Wrapper = false;
|
||||
static bool unique_swig_package = false;
|
||||
|
||||
static String *current_namespace=NewString("");
|
||||
static String *current_package=NewString("");
|
||||
|
|
@ -1496,6 +1499,9 @@ void ALLEGROCL :: main(int argc, char *argv[]) {
|
|||
} else if (!strcmp(argv[i], "-nocwrap")) {
|
||||
CWrap = false;
|
||||
Swig_mark_arg(i);
|
||||
} else if (!strcmp(argv[i], "-isolate")) {
|
||||
unique_swig_package = true;
|
||||
Swig_mark_arg(i);
|
||||
}
|
||||
|
||||
if (!strcmp(argv[i], "-help")) {
|
||||
|
|
@ -1524,6 +1530,9 @@ int ALLEGROCL :: top(Node *n) {
|
|||
String *cxx_filename=Getattr(n, "outfile");
|
||||
String *cl_filename=NewString("");
|
||||
|
||||
swig_package = unique_swig_package ?
|
||||
NewStringf("swig.%s", module_name) : NewString("swig");
|
||||
|
||||
Printf(cl_filename, "%s%s.cl", SWIG_output_directory(), module_name);
|
||||
|
||||
f_cl=NewFile(cl_filename, "w");
|
||||
|
|
@ -1556,18 +1565,18 @@ int ALLEGROCL :: top(Node *n) {
|
|||
|
||||
Printf(f_cl, ";; This is an automatically generated file. Make changes in\n"
|
||||
";; the definition file, not here.\n\n"
|
||||
"(defpackage :swig\n"
|
||||
"(defpackage :%s\n"
|
||||
" (:use :common-lisp :ff :excl)\n"
|
||||
" (:export #:*swig-identifier-converter* #:*swig-module-name*\n"
|
||||
" #:*void*))\n"
|
||||
"(in-package :swig)\n\n"
|
||||
" #:*void* #:*swig-expoert-list*))\n"
|
||||
"(in-package :%s)\n\n"
|
||||
"(eval-when (compile load eval)\n"
|
||||
" (defparameter *swig-identifier-converter* '%s)\n"
|
||||
" (defparameter *swig-module-name* :%s))\n\n",
|
||||
identifier_converter, module_name);
|
||||
swig_package, swig_package, identifier_converter, module_name);
|
||||
Printf(f_cl, "(defpackage :%s\n"
|
||||
" (:use :common-lisp :swig :ff :excl))\n\n",
|
||||
module_name);
|
||||
" (:use :common-lisp :%s :ff :excl))\n\n",
|
||||
module_name, swig_package);
|
||||
|
||||
Printf(f_clhead, "(in-package :%s)\n", module_name);
|
||||
|
||||
|
|
@ -1583,7 +1592,7 @@ int ALLEGROCL :: top(Node *n) {
|
|||
#endif
|
||||
emit_linked_types();
|
||||
|
||||
Printf(f_clwrap, "\n(in-package :swig)\n");
|
||||
Printf(f_clwrap, "\n(in-package :%s)\n", swig_package);
|
||||
Printf(f_clwrap, "\n(macrolet ((swig-do-export ()\n");
|
||||
Printf(f_clwrap, " `(dolist (s ',*swig-export-list*)\n");
|
||||
Printf(f_clwrap, " (apply #'export s))))\n");
|
||||
|
|
@ -2329,7 +2338,7 @@ int ALLEGROCL :: emit_defun(Node *n, File *f_cl) {
|
|||
|
||||
SwigType *result_type = Swig_cparse_type(Getattr(n,"tmap:ctype"));
|
||||
// prime the pump, with support for OUTPUT, INOUT typemaps.
|
||||
Printf(wrap->code,"(let ((ACL_ffresult swig:*void*)\n ACL_result)\n $body\n (if (eq ACL_ffresult swig:*void*)\n (values-list ACL_result)\n (values-list (cons ACL_ffresult ACL_result))))");
|
||||
Printf(wrap->code,"(let ((ACL_ffresult %s:*void*)\n ACL_result)\n $body\n (if (eq ACL_ffresult %s:*void*)\n (values-list ACL_result)\n (values-list (cons ACL_ffresult ACL_result))))", swig_package, swig_package);
|
||||
|
||||
Parm *p;
|
||||
int largnum = 0, argnum=0, first=1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue