From: William F. <wsf...@us...> - 2006-10-31 22:39:24
|
Update of /cvsroot/swig/SWIG/Doc/Manual In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv22784 Modified Files: Lisp.html Log Message: html fixes Index: Lisp.html =================================================================== RCS file: /cvsroot/swig/SWIG/Doc/Manual/Lisp.html,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Lisp.html 30 Sep 2006 19:03:52 -0000 1.5 --- Lisp.html 31 Oct 2006 22:39:20 -0000 1.6 *************** *** 51,54 **** --- 51,56 ---- <H2><a name="Lisp_nn3"></a>21.2 Common Foreign Function Interface(CFFI)</H2> + + <p> CFFI, the Common Foreign Function Interface, is a portable foreign *************** *** 77,80 **** --- 79,83 ---- <H3><a name="Lisp_nn4"></a>21.2.1 Additional Commandline Options </H3> + <p> The following table list the additional commandline options available for the CLISP module. They can also be seen by using: *************** *** 117,120 **** --- 120,124 ---- <H3><a name="Lisp_nn5"></a>21.2.2 Generating CFFI bindings</H3> + As we mentioned earlier the ideal way to use SWIG is to use interface files. To illustrate the use of it, lets assume that we have a *************** *** 164,168 **** ;;;SWIG wrapper code starts here ! (cl:defmacro defanonenum (&body enums) "Converts anonymous enums to defconstants." `(cl:progn ,@(cl:loop for value in enums --- 168,172 ---- ;;;SWIG wrapper code starts here ! (cl:defmacro defanonenum (&body enums) "Converts anonymous enums to defconstants." `(cl:progn ,@(cl:loop for value in enums *************** *** 174,179 **** (cl:eval-when (:compile-toplevel :load-toplevel) (cl:unless (cl:fboundp 'swig-lispify) ! (cl:defun swig-lispify (name flag cl:&optional (package cl:*package*)) ! (cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst))) (cl:cond ((cl:null lst) --- 178,183 ---- (cl:eval-when (:compile-toplevel :load-toplevel) (cl:unless (cl:fboundp 'swig-lispify) ! (cl:defun swig-lispify (name flag cl:&optional (package cl:*package*)) ! (cl:labels ((helper (lst last rest cl:&aux (c (cl:car lst))) (cl:cond ((cl:null lst) *************** *** 390,393 **** --- 394,398 ---- <H3><a name="Lisp_nn6"></a>21.2.3 Generating CFFI bindings for C++ code</H3> + <p>This feature to SWIG (for CFFI) is very new and still far from complete. Pitch in with your patches, bug reports and feature *************** *** 406,410 **** #include "Test/test.h" %} ! </div> <p> Also, while parsing the C++ file and generating C wrapper code SWIG --- 411,415 ---- #include "Test/test.h" %} ! </pre></div> <p> Also, while parsing the C++ file and generating C wrapper code SWIG *************** *** 421,425 **** %include "target/header.h" ! </div> Various features which were available for C headers can also be used here. The target header which we are going to use here is: --- 426,430 ---- %include "target/header.h" ! </pre></div> Various features which were available for C headers can also be used here. The target header which we are going to use here is: *************** *** 435,448 **** // vector addition ! Test operator+ (const Test& v) const {return Test (x+v.x);} // length squared ! float lengthSquared (void) const {return this->dot (*this);} ! static float distance (const Test& a, const Test& b){return(a-b).length();} ! inline Test parallelComponent (const Test& unitBasis) const { return unitBasis * projection; } ! Test setYtoZero (void) const {return Test (this->x);} static const Test zero; --- 440,453 ---- // vector addition ! Test operator+ (const Test& v) const {return Test (x+v.x);} // length squared ! float lengthSquared (void) const {return this->dot (*this);} ! static float distance (const Test& a, const Test& b){return(a-b).length();} ! inline Test parallelComponent (const Test& unitBasis) const { return unitBasis * projection; } ! Test setYtoZero (void) const {return Test (this->x);} static const Test zero; *************** *** 450,459 **** ! inline Test operator* (float s, const Test& v) {return v*s;} ! inline std::ostream& operator<< (std::ostream& o, const Test& v) { ! return o << "(" << v.x << ")"; } --- 455,464 ---- ! inline Test operator* (float s, const Test& v) {return v*s;} ! inline std::ostream& operator<< (std::ostream& o, const Test& v) { ! return o << "(" << v.x << ")"; } *************** *** 464,473 **** } } ! </div></pre> <p>The interface used is: </p> <div class="code"><pre> %module test %include "test.cpp" ! </div></pre> SWIG generates 3 files, the first one is a C wrap which we don't show, --- 469,478 ---- } } ! </pre></div> <p>The interface used is: </p> <div class="code"><pre> %module test %include "test.cpp" ! </pre></div> SWIG generates 3 files, the first one is a C wrap which we don't show, *************** *** 519,523 **** (cffi:defcfun ("_wrap_RandomUnitVectorOnXZPlane" RandomUnitVectorOnXZPlane) :pointer) ! </div></pre> The output is pretty good but it fails in disambiguating overloaded --- 524,528 ---- (cffi:defcfun ("_wrap_RandomUnitVectorOnXZPlane" RandomUnitVectorOnXZPlane) :pointer) ! </pre></div> The output is pretty good but it fails in disambiguating overloaded *************** *** 550,554 **** (clos:defmethod set-yto-zero ((obj test) (self test)) (Test_setYtoZero (ff-pointer obj) (ff-pointer self))) ! </div></pre> <p>I agree that the CFFI C++ module needs lot more work. But I hope it --- 555,559 ---- (clos:defmethod set-yto-zero ((obj test) (self test)) (Test_setYtoZero (ff-pointer obj) (ff-pointer self))) ! </pre></div> <p>I agree that the CFFI C++ module needs lot more work. But I hope it |