4 This directory contains Scheme programs, some useful in maintaining Guile.
5 On "make install", these programs are copied to PKGDATADIR/VERSION/scripts.
7 You can invoke a program from the shell, or alternatively, load its file
8 as a Guile Scheme module, and use its exported procedure(s) from Scheme code.
9 Typically for any PROGRAM:
11 (use-modules (scripts PROGRAM))
12 (PROGRAM ARG1 ARG2 ...)
14 For programs that write to stdout, you might try, instead:
16 (use-modules (scripts PROGRAM))
17 (with-output-to-string (lambda () (PROGRAM ARG1 ARG2 ...)))
19 Note that all args must be strings.
21 To see PROGRAM's commentary, which may or may not be helpful:
23 (help (scripts PROGRAM))
25 To see all commentaries and module dependencies, try: "make overview".
27 If you want to try the programs before installing Guile, you will probably
28 need to set environment variable GUILE_LOAD_PATH to be the parent directory.
29 This can be done in Bourne-compatible shells like so:
31 GUILE_LOAD_PATH=`(cd .. ; pwd)`
32 export GUILE_LOAD_PATH
34 [FIXME: Can someone supply the csh-compatible equivalent?]
41 See template file PROGRAM for a quick start.
43 Programs must follow the "executable module" convention, documented here:
45 - The file name must not end in ".scm".
47 - The file must be executable (chmod +x).
49 - The module name must be "(scripts PROGRAM)". A procedure named PROGRAM w/
50 signature "(PROGRAM . args)" must be exported. Basically, use some variant
53 (define-module (scripts PROGRAM)
56 Feel free to export other definitions useful in the module context.
58 - There must be the alias:
62 However, `main' must NOT be exported.
64 - The beginning of the file must use the following invocation sequence:
67 main='(module-ref (resolve-module '\''(scripts PROGRAM)) '\'main')'
68 exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
71 Following these conventions allows the program file to be used as module
72 (scripts PROGRAM) in addition to as a standalone executable. Please also
73 include a helpful Commentary section w/ some usage info.