mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 09:10:22 +02:00
* 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.
This commit is contained in:
parent
4927dd283b
commit
673509f84f
21 changed files with 236 additions and 60 deletions
|
@ -1,4 +1,6 @@
|
|||
-*- text -*-
|
||||
-*- outline -*-
|
||||
|
||||
* Overview
|
||||
|
||||
This directory includes an example program for extending Guile with a
|
||||
new (and even useful) data type.
|
||||
|
@ -9,6 +11,9 @@ interpreter in this directory will place all defined primitive
|
|||
procedures in a module called (box-module). That means that this
|
||||
module must be used before the primitives can be accessed.
|
||||
|
||||
|
||||
* Build Instructions
|
||||
|
||||
To build the example, simply type
|
||||
|
||||
make box
|
||||
|
@ -18,16 +23,25 @@ in this directory.
|
|||
The resulting `box' program is a Guile interpreter which has one
|
||||
additional data type called `box'.
|
||||
|
||||
|
||||
* The Box Data Type
|
||||
|
||||
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.
|
||||
|
||||
|
||||
** Usage
|
||||
|
||||
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:
|
||||
|
||||
|
||||
** Example Session
|
||||
|
||||
$ ./box
|
||||
guile> (use-modules (box-module))
|
||||
guile> (define b (make-box))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue