* scripts/README, scripts/hello.scm, safe/untrusted.scm,
safe/evil.scm, safe/README, modules/README, modules/main,
modules/module-0.scm, modules/module-1.scm, modules/module-2.scm:
Minor cleanup.
* README: Added intro stuff, restructured a bit.
* box-dynamic/README, box-module/README, box/README: Cleanup and
restructuring.
* box-dynamic-module/box-mixed.scm: New file, demonstrating usage
of extension library functionality, but without exporting
procedures from the library.
Thanks to Thomas Wawrzinek for the idea and example code!
* box-dynamic-module/box-module.scm: Add comments, export
make-box, box-ref, box-set!.
* box-dynamic-module/README: Integrate new module (box-mixed),
restructure and cleanup a bit.
2001-06-14 20:36:06 +00:00
|
|
|
-*- outline -*-
|
|
|
|
|
|
|
|
|
|
* Overview
|
2001-05-31 18:24:11 +00:00
|
|
|
|
|
|
|
|
This directory includes an example program for extending Guile with a
|
|
|
|
|
new (and even useful) data type, putting it into a shared library, so it
|
|
|
|
|
can be called from an unmodified guile interpreter.
|
|
|
|
|
|
* scripts/README, scripts/hello.scm, safe/untrusted.scm,
safe/evil.scm, safe/README, modules/README, modules/main,
modules/module-0.scm, modules/module-1.scm, modules/module-2.scm:
Minor cleanup.
* README: Added intro stuff, restructured a bit.
* box-dynamic/README, box-module/README, box/README: Cleanup and
restructuring.
* box-dynamic-module/box-mixed.scm: New file, demonstrating usage
of extension library functionality, but without exporting
procedures from the library.
Thanks to Thomas Wawrzinek for the idea and example code!
* box-dynamic-module/box-module.scm: Add comments, export
make-box, box-ref, box-set!.
* box-dynamic-module/README: Integrate new module (box-mixed),
restructure and cleanup a bit.
2001-06-14 20:36:06 +00:00
|
|
|
|
|
|
|
|
* Build Instructions
|
|
|
|
|
|
2001-05-31 18:24:11 +00:00
|
|
|
To build the example, simply type
|
|
|
|
|
|
|
|
|
|
make libbox
|
|
|
|
|
|
|
|
|
|
in this directory.
|
|
|
|
|
|
* scripts/README, scripts/hello.scm, safe/untrusted.scm,
safe/evil.scm, safe/README, modules/README, modules/main,
modules/module-0.scm, modules/module-1.scm, modules/module-2.scm:
Minor cleanup.
* README: Added intro stuff, restructured a bit.
* box-dynamic/README, box-module/README, box/README: Cleanup and
restructuring.
* box-dynamic-module/box-mixed.scm: New file, demonstrating usage
of extension library functionality, but without exporting
procedures from the library.
Thanks to Thomas Wawrzinek for the idea and example code!
* box-dynamic-module/box-module.scm: Add comments, export
make-box, box-ref, box-set!.
* box-dynamic-module/README: Integrate new module (box-mixed),
restructure and cleanup a bit.
2001-06-14 20:36:06 +00:00
|
|
|
|
|
|
|
|
* The Box Data Type
|
|
|
|
|
|
2001-05-31 18:24:11 +00:00
|
|
|
A box is simply an object for storing one other object in. It can be
|
|
|
|
|
used for passing parameters by reference, for example. You simply
|
|
|
|
|
store an object into a box, pass it to another procedure which can
|
|
|
|
|
store a new object into it and thus return a value via the box.
|
|
|
|
|
|
* scripts/README, scripts/hello.scm, safe/untrusted.scm,
safe/evil.scm, safe/README, modules/README, modules/main,
modules/module-0.scm, modules/module-1.scm, modules/module-2.scm:
Minor cleanup.
* README: Added intro stuff, restructured a bit.
* box-dynamic/README, box-module/README, box/README: Cleanup and
restructuring.
* box-dynamic-module/box-mixed.scm: New file, demonstrating usage
of extension library functionality, but without exporting
procedures from the library.
Thanks to Thomas Wawrzinek for the idea and example code!
* box-dynamic-module/box-module.scm: Add comments, export
make-box, box-ref, box-set!.
* box-dynamic-module/README: Integrate new module (box-mixed),
restructure and cleanup a bit.
2001-06-14 20:36:06 +00:00
|
|
|
|
|
|
|
|
** Usage
|
|
|
|
|
|
2001-05-31 18:24:11 +00:00
|
|
|
Box objects are created with `make-box', set with `box-set!' and
|
|
|
|
|
examined with `box-ref'. Note that these procedures are placed in a
|
|
|
|
|
module called (box-module) and can thus only be accessed after using
|
|
|
|
|
this module. See the following example session for usage details:
|
|
|
|
|
|
|
|
|
|
Extend your LD_LIBRARY_PATH variable (or equivalent) to include . and
|
|
|
|
|
.libs
|
|
|
|
|
|
* scripts/README, scripts/hello.scm, safe/untrusted.scm,
safe/evil.scm, safe/README, modules/README, modules/main,
modules/module-0.scm, modules/module-1.scm, modules/module-2.scm:
Minor cleanup.
* README: Added intro stuff, restructured a bit.
* box-dynamic/README, box-module/README, box/README: Cleanup and
restructuring.
* box-dynamic-module/box-mixed.scm: New file, demonstrating usage
of extension library functionality, but without exporting
procedures from the library.
Thanks to Thomas Wawrzinek for the idea and example code!
* box-dynamic-module/box-module.scm: Add comments, export
make-box, box-ref, box-set!.
* box-dynamic-module/README: Integrate new module (box-mixed),
restructure and cleanup a bit.
2001-06-14 20:36:06 +00:00
|
|
|
|
|
|
|
|
** Example Session
|
2001-05-31 18:24:11 +00:00
|
|
|
|
2001-07-09 19:13:21 +00:00
|
|
|
$ guile
|
2001-05-31 18:24:11 +00:00
|
|
|
guile> (load-extension "libbox" "scm_init_box")
|
|
|
|
|
guile> (define b (make-box))
|
|
|
|
|
guile> b
|
|
|
|
|
#<box #f>
|
|
|
|
|
guile> (box-set! b '(list of values))
|
|
|
|
|
guile> b
|
|
|
|
|
#<box (list of values)>
|
|
|
|
|
guile> (box-ref b)
|
|
|
|
|
(list of values)
|
|
|
|
|
guile> (quit)
|
|
|
|
|
$
|
* scripts/README, scripts/hello.scm, safe/untrusted.scm,
safe/evil.scm, safe/README, modules/README, modules/main,
modules/module-0.scm, modules/module-1.scm, modules/module-2.scm:
Minor cleanup.
* README: Added intro stuff, restructured a bit.
* box-dynamic/README, box-module/README, box/README: Cleanup and
restructuring.
* box-dynamic-module/box-mixed.scm: New file, demonstrating usage
of extension library functionality, but without exporting
procedures from the library.
Thanks to Thomas Wawrzinek for the idea and example code!
* box-dynamic-module/box-module.scm: Add comments, export
make-box, box-ref, box-set!.
* box-dynamic-module/README: Integrate new module (box-mixed),
restructure and cleanup a bit.
2001-06-14 20:36:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
* Module Installation
|
|
|
|
|
|
|
|
|
|
If you like this example so much that you want to have it available
|
|
|
|
|
for normal usage, install the dynamic libraries in the .libs directory
|
|
|
|
|
to the directory $(prefix)/lib
|