1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +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:
Martin Grabmüller 2001-06-14 20:36:06 +00:00
parent 4927dd283b
commit 673509f84f
21 changed files with 236 additions and 60 deletions

View file

@ -107,14 +107,13 @@ box_set_x (SCM b, SCM value)
#undef FUNC_NAME
/* Create and initialize the new smob type, and register the
primitives withe the interpreter library.
This function must be declared a bit different from the example in
the ../box directory, because it will be called by
`scm_c_define_module', called from below. */
static void
init_box_type (void * unused)
/* This is the function which must be given to `load-extension' as the
second argument. In this example, the Scheme file box-module.scm
(or box-mixed.scm) is responsible for doing the load-extension
call. The Scheme modules are also responsible for placing the
procedure definitions in the correct module. */
void
scm_init_box ()
{
scm_tc16_box = scm_make_smob_type ("box", 0);
scm_set_smob_mark (scm_tc16_box, mark_box);
@ -123,26 +122,6 @@ init_box_type (void * unused)
scm_c_define_gsubr ("make-box", 0, 0, 0, make_box);
scm_c_define_gsubr ("box-set!", 2, 0, 0, box_set_x);
scm_c_define_gsubr ("box-ref", 1, 0, 0, box_ref);
/* This is new too: Since the procedures are now in a module, we
have to explicitly export them before they can be used. */
scm_c_export ("make-box", "box-set!", "box-ref", NULL);
}
/* This is the function which must be given to `load-extension' as the
second argument. It will initialize the shared, library, but will
place the definitions in a module called (box-module), so that an
additional (use-modules (box-module)) is needed to make them
accessible. In this example, the Scheme file box-module.scm is
responsible for doing the load-extension call. */
void
scm_init_box ()
{
/* Unlike the example in ../box, init_box_type is not called
directly, but by scm_c_define_module, which will create a module
named (box-module) and make this module current while called
init_box_type, thus placing the definitions into that module. */
scm_c_define_module ("box-module", init_box_type, NULL);
}
/* End of file. */