From 857a62425c7726d937ca4276a1c19e7280da3135 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 3 Jun 2017 13:47:26 +0100 Subject: [PATCH] Formatting fixes in Lisp docs --- Doc/Manual/Lisp.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Doc/Manual/Lisp.html b/Doc/Manual/Lisp.html index ba42f735c..7bf8562c5 100644 --- a/Doc/Manual/Lisp.html +++ b/Doc/Manual/Lisp.html @@ -122,9 +122,12 @@ swig -cffi -help

27.2.2 Generating CFFI bindings

+

+ As we mentioned earlier the ideal way to use SWIG is to use interface files. To illustrate the use of it, let's assume that we have a file named test.h with the following C code: +

 #define y 5
@@ -155,7 +158,10 @@ void lispsort_double (int n, double * array);
 enum color { RED, BLUE, GREEN};
 
+

Corresponding to this we will write a simple interface file: +

+
 %module test
 
@@ -163,7 +169,9 @@ Corresponding to this we will write a simple interface file:
 
 
+

The generated SWIG Code will be: +

 ;;;SWIG wrapper code starts here
@@ -430,8 +438,10 @@ Also, while parsing the C++ file and generating C wrapper code SWIG
 %include "target/header.h"
 
 
+

Various features which were available for C headers can also be used here. The target header which we are going to use here is: +

 namespace OpenDemo {
   class Test
@@ -478,8 +488,10 @@ namespace OpenDemo {
 %include "test.cpp"
 
+

SWIG generates 3 files, the first one is a C wrap which we don't show, the second is the plain CFFI wrapper which is as shown below: +

 (cffi:defcfun ("_wrap_Test_x_set" Test_x_set) :void
   (self :pointer)
@@ -528,11 +540,13 @@ SWIG generates 3 files, the first one is a C wrap which we don't show,
 (cffi:defcfun ("_wrap_RandomUnitVectorOnXZPlane" RandomUnitVectorOnXZPlane) :pointer)
 
+

The output is pretty good but it fails in disambiguating overloaded functions such as the constructor, in this case. One way of resolving this problem is to make the interface use the rename directiv, but hopefully there are better solutions. In addition SWIG also generates, a CLOS file +