Next: guile-tools generate-autoload, Previous: guile-tools fspec2c, Up: Miscellaneous Tools
Usage: generate-METAINFO [options] PREFIX -- [[-o] KEY VALUE]...
Write the text of scheme module (PREFIX METAINFO) to stdout. Options:
-f, --fullname -- take PREFIX as full module name, do not add suffix
-p, --procname P -- use P for the exported procedure name [METAINFO]
The generated module exports a procedure that given KEY, returns VALUE
(normally a string), or #f if no such KEY exists. KEY can be a symbol,
string or keyword; matching is case-insensitive. Additionally, the
special key #t returns a list of available keys. The special token "-o"
means to save the VALUE as an object (its string representation from the
command-line is `read' first) rather than as a string. For example, the
invocation (note quotes to protect from the shell):
generate-METAINFO "(my stuff)" -- version 3.1415 creator jrhacker
displays the following text (reformatted for legibility):
(define-module (my stuff METAINFO) #:export (METAINFO))
(define (dsym obj) ...)
(define (METAINFO key)
(if (eq? #t key)
'(version creator)
(assq-ref `((version . "3.1415")
(creator . "jrhacker"))
(dsym key))))
If we instead specify `-o version 3.1415' on the command line then the
first pair of the alist becomes `(version . 3.1415)'. The quasiquote
is to handle cases where the value is not a string, character or number
(for example, a procedure object); these values preceded by a comma.
Usage from a Scheme program:
(generate-METAINFO module-name proc-name alist) => string
MODULE-NAME is a list of symbols, the complete name of the module (no
suffix added). PROC-NAME is a symbol. ALIST keys are downcased and made
into symbols, and the values are saved by `write'. The return value is
the same text that would have been sent to stdout in a shell invocation.