Merge branch 'lyze-cffi-export-package'

* lyze-cffi-export-package:
  Add user documentation to the export package extension.
  Extend the export feature in the CFFI module to support exporting to a particular package.
This commit is contained in:
William S Fulton 2015-09-09 22:32:43 +01:00
commit 0ee304188c
3 changed files with 20 additions and 10 deletions

View file

@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 3.0.8 (in progress)
===========================
2015-09-09: lyze
[CFFI] Extend the "export" feature in the CFFI module to support
exporting to a specified package.
2015-09-04: olly
[Python] Fix docstrings for %callback functions.

View file

@ -284,9 +284,11 @@ Let's edit the interface file such that the C type "div_t*" is changed
%feature("export");
%feature("inline") lispsort_double;
%feature("intern_function", "my-lispify") lispsort_double;
%feature("export", package="'some-other-package") lispsort_double;
%rename func123 renamed_cool_func;
%ignore "pointer_func";
%include "test.h"
@ -310,12 +312,13 @@ The feature <i>intern_function</i> ensures that all C names are
lispsort_double;</i>, here we are using an additional feature
which allows us to use our lispify function.
</p>
<p>The <i>export</i> feature allows us to export the symbols. The <i>inline</i>
feature declaims the declared function as inline. The <i>rename</i>
directive allows us to change the name(it is useful when
generating C wrapper code for handling overloaded
functions). The <i>ignore</i> directive ignores a certain
declaration.
<p>The <i>export</i> feature allows us to export the symbols. If
the <i>package</i> argument is given, then the symbol will be exported to
the specified Lisp package. The <i>inline</i> feature declaims the
declared function as inline. The <i>rename</i> directive allows us to
change the name(it is useful when generating C wrapper code for handling
overloaded functions). The <i>ignore</i> directive ignores a certain
declaration.
</p>
<p>There are several other things which are possible, to see some
example of usage of SWIG look at the Lispbuilder and wxCL
@ -381,7 +384,7 @@ The feature <i>intern_function</i> ensures that all C names are
(n :int)
(array :pointer))
(cl:export '#.(my-lispify "lispsort_double" 'function))
(cl:export '#.(my-lispify "lispsort_double" 'function) 'some-other-package)
(cffi:defcenum #.(swig-lispify "color" 'enumname)
#.(swig-lispify "RED" 'enumvalue :keyword)

View file

@ -860,8 +860,11 @@ void CFFI::emit_struct_union(Node *n, bool un = false) {
}
void CFFI::emit_export(Node *n, String *name) {
if (GetInt(n, "feature:export"))
Printf(f_cl, "\n(cl:export '%s)\n", name);
if (GetInt(n, "feature:export")) {
String* package = Getattr(n, "feature:export:package");
Printf(f_cl, "\n(cl:export '%s%s%s)\n", name, package ? " " : "",
package ? package : "");
}
}
void CFFI::emit_inline(Node *n, String *name) {