From 2da2f79d6761667bbc8fa511961d28bd2c7ca37b Mon Sep 17 00:00:00 2001
From: John Lenz
CHICKEN can be downloaded from http://www.call-with-current-continuation.org/chicken.html
+ href="http://www.call-with-current-continuation.org/">http://www.call-with-current-continuation.org/
You may want to look at any of the examples in Examples/chicken/
or Examples/GIFPlot/Chicken for the basic steps to run SWIG
@@ -133,9 +134,8 @@
Given a C variable, function or constant declaration named
Foo_Bar_to_Foo_Baz, the declaration will be available
in CHICKEN as an identifier ending with
- foo-bar->foo-baz. That is, an underscore is converted
- to a dash, '_to_' is converted to an arro, and all characters
- are sent to lowercase.
+ Foo-Bar->Foo-Baz. That is, an underscore is converted
+ to a dash and '_to_' is converted to an arrow.
@@ -143,7 +143,8 @@
specified with the -mixed option on the SWIG command
line. In this mode, the above rules apply with the addition
that changes in case are indications to SWIG CHICKEN to place a
- dash in the CHICKEN identifier. For example, a C declartaion
+ dash in the CHICKEN identifier and the name is converted to lowercase.
+ For example, a C declartaion
named someDeclaration_xyz will be available as the
CHICKEN identifier ending with some-declaration-xyz.
@@ -175,7 +176,7 @@
Normally, for a C declaration Foo_Bar with a module
name of 'example', the corresponding CHICKEN identifier will be
- example:foo-bar. The module name and a colon is
+ example:Foo-Bar. The module name and a colon is
prefixed to the CHICKEN identifier (following normal
naming conventions).
@@ -201,7 +202,7 @@
In all cases, the constants may be accessed from with CHICKEN
- using the form (myconstant1); that is, the constants
+ using the form (MYCONSTANT1); that is, the constants
may be accessed using the read-only parameter form.
- All the following examples assume that the module is named - 'example' and the following occurs when run: -
-- Substitute /usr/local/share/chicken as appropriate for - your platform. - - -% chicken-config -home -CHICKEN_HOME=/usr/local/share/chicken-
- We will assume your files are in a directory - /home/jonah/examples. Make a file as follows: -
-;; precsi.scm -(declare (unit precsi)) -(declare (uses example)) - -;; any other code you want run before the main interpreter is executed -- - Run SWIG on your interface file as usual, create the 2 wrapper - object files, and then either - -
-- or --% cd /usr/local/share/chicken -% chicken /usr/local/share/chicken/src/csi.scm -optimize-level 3 -quiet \ - -include-path /usr/local/share/chicken/src \ - -prologue /usr/local/share/chicken/src/build.scm \ - -prelude "(declare (uses posix precsi))" \ - -output-file /home/jonah/examples/csi-example.c -% cd /home/jonah/examples -% chicken precsi.scm -optimize-level 3 --explicit-use \ - -output-file precsi.c -% gcc precsi.c csi.c wrapper_object_files \ - `chicken-config -libs` `chicken-config -extra-libs` -o csi-example ---
-- - + The easiest way to use SWIG and CHICKEN is to use the csc compiler + wrapper provided by CHICKEN. Assume you have a SWIG interface file + in example.i and the C functions being wrapped are in example_impl.c. -% extend-csi precsi -output-file csi-example-
+ ++ $ swig -chicken example.i + $ csc -svk example.scm example_impl.c example_wrap.c + $ csi example.so test_script.scm +
+ You must be careful not to name the example_impl.c file example.c because + when compiling example.scm, csc compiles that into example.c! +
+ +Again, we can easily use csc to build a binary.
+ ++ ++ $ swig -chicken example.i + $ csc -vk example.scm example_impl.c example_wrap.c test_script.scm -o example + $ ./example +
@@ -488,7 +467,7 @@ CHICKEN_HOME=/usr/local/share/chicken
-@@ -521,7 +500,7 @@ CHICKEN_HOME=/usr/local/share/chicken type.
-