Guile's behaviour can be modified by setting options. For example, is the language that Guile accepts case sensitive, or should the debugger automatically show a backtrace on error?
Guile has two levels of interface for managing options: a low-level control interface, and a user-level interface which allows the enabling or disabling of options.
Moreover, the options are classified in groups according to whether they configure reading, printing, debugging or evaluating.
We will use the expression <group> to represent read,
print, debug or evaluator.
If scm_options is called without arguments, the current option setting is returned. If the argument is an option setting, options are altered and the old setting is returned. If the argument isn't a list, a list of sublists is returned, where each sublist contains option name, value and documentation string.
With no arguments, <group>-options returns the values of the
options in that particular group. If arg is 'help, a
description of each option is given. If arg is 'full,
programmers' options are also shown.
arg can also be a list representing the state of all options. In this case, the list contains single symbols (for enabled boolean options) and symbols followed by values.
Here is the list of reader options generated by typing
(read-options 'full) in Guile. You can also see the default
values.
keywords #f Style of keyword recognition: #f or 'prefix case-insensitive no Convert symbols to lower case. positions yes Record positions of source code expressions. copy no Copy source code expressions.
Notice that while Standard Scheme is case insensitive, to ease translation of other Lisp dialects, notably Emacs Lisp, into Guile, Guile is case-sensitive by default.
To make Guile case insensitive, you can type
(read-enable 'case-insensitive)
Here is the list of print options generated by typing
(print-options 'full) in Guile. You can also see the default
values.
source no Print closures with source. closure-hook #f Hook for printing closures.
These are the evaluator options with their default values, as they are
printed by typing (eval-options 'full) in Guile.
stack 22000 Size of thread stacks (in machine words).
[FIXME: These flags, together with their corresponding handlers, are not user level options. Probably this entire section should be moved to the documentation about the low-level programmer debugging interface.]
Here is the list of evaluator trap options generated by typing
(traps 'full) in Guile. You can also see the default values.
exit-frame no Trap when exiting eval or apply. apply-frame no Trap when entering apply. enter-frame no Trap when eval enters new frame. traps yes Enable evaluator traps.
Called if:
apply-frame is enabled [traps interface], or
If cheap traps are enabled [debug-options interface], cont is a debug object, otherwise it is a restartable continuation.
tailp is true if this is a tail call
Called if:
exit-frame is enabled [traps interface], or
If cheap traps are enabled [debug-options interface], cont is a debug object, otherwise it is a restartable continuation.
retval is the return value.
Here is the list of print options generated by typing
(debug-options 'full) in Guile. You can also see the default
values.
stack 20000 Stack size limit (0 = no check). debug yes Use the debugging evaluator. backtrace no Show backtrace on error. depth 20 Maximal length of printed backtrace. maxdepth 1000 Maximal number of stored backtrace frames. frames 3 Maximum number of tail-recursive frames in backtrace. indent 10 Maximal indentation in backtrace. backwards no Display backtrace in anti-chronological order. procnames yes Record procedure names at definition. trace no *Trace mode. breakpoints no *Check for breakpoints. cheap yes *Flyweight representation of the stack at traps.
Here is an example of a session in which some read and debug option handling procedures are used. In this example, the user
abc and aBc are not the same
read-options, and sees that case-insensitive
is set to "no".
case-insensitive
aBc and abc are the same
case-insensitive and enables debugging backtrace
aBc with backtracing enabled
[FIXME: this last example is lame because there is no depth in the
backtrace. Need to give a better example, possibly putting debugging
option examples in a separate session.]
guile> (define abc "hello") guile> abc "hello" guile> aBc ERROR: In expression aBc: ERROR: Unbound variable: aBc ABORT: (misc-error) Type "(backtrace)" to get more information. guile> (read-options 'help) keywords #f Style of keyword recognition: #f or 'prefix case-insensitive no Convert symbols to lower case. positions yes Record positions of source code expressions. copy no Copy source code expressions. guile> (debug-options 'help) stack 20000 Stack size limit (0 = no check). debug yes Use the debugging evaluator. backtrace no Show backtrace on error. depth 20 Maximal length of printed backtrace. maxdepth 1000 Maximal number of stored backtrace frames. frames 3 Maximum number of tail-recursive frames in backtrace. indent 10 Maximal indentation in backtrace. backwards no Display backtrace in anti-chronological order. procnames yes Record procedure names at definition. trace no *Trace mode. breakpoints no *Check for breakpoints. cheap yes *Flyweight representation of the stack at traps. guile> (read-enable 'case-insensitive) (keywords #f case-insensitive positions) guile> aBc "hello" guile> (read-disable 'case-insensitive) (keywords #f positions) guile> (debug-enable 'backtrace) (stack 20000 debug backtrace depth 20 maxdepth 1000 frames 3 indent 10 procnames cheap) guile> aBc Backtrace: 0* aBc ERROR: In expression aBc: ERROR: Unbound variable: aBc ABORT: (misc-error) guile>
It is often useful to have site-specific information about the current Guile installation. This chapter describes how to find out about Guile's configuration at run time.
(version) => "1.6.0" (major-version) => "1" (minor-version) => "6" (micro-version) => "0"
libguile was
configured. This is used to determine whether the Guile core
interpreter and the ice-9 runtime have grown out of date with one
another.
#f, tail
is returned.
#f. If filename is absolute, return it unchanged.
If given, extensions is a list of strings; for each
directory in path, we search for filename
concatenated with each extension.
guile program. Entries can be grouped into one of several
categories: directories, env vars, and versioning info.
Briefly, here are the keys in %guile-build-info, by group:
Values are all strings. The value for LIBS is typically found also as
a part of "guile-config link" output. The value for guileversion has
form X.Y.Z, and should be the same as returned by version. The value
for libguileinterface is libtool compatible and has form
CURRENT:REVISION:AGE. The value for buildstamp is the output of the
date(1) command.
In the source, %guile-build-info is initialized from
libguile/libpath.h, which is completely generated, so deleting this file
before a build guarantees up-to-date values for that build.
Guile has a Scheme level variable *features* that keeps track to
some extent of the features that are available in a running Guile.
*features* is a list of symbols, for example threads, each
of which describes a feature of the running Guile process.
You shouldn't modify the *features* variable directly using
set!. Instead, see the procedures that are provided for this
purpose in the following subsection.
To check whether a particular feature is available, use the
provided? procedure:
#t if the specified feature is available, otherwise
#f.
To advertise a feature from your own Scheme code, you can use the
provide procedure:
For C code, the equivalent function takes its feature name as a
char * argument for convenience:
In general, a particular feature may be available for one of two reasons. Either because the Guile library was configured and compiled with that feature enabled -- i.e. the feature is built into the library on your system. Or because some C or Scheme code that was dynamically loaded by Guile has added that feature to the list.
In the first category, here are the features that the current version of Guile may define (depending on how it is built), and what they mean.
array
array-for-each
array-for-each and other array mapping
procedures (see section Array Mapping).
char-ready?
char-ready? function is available
(see section Reading).
complex
current-time
times,
get-internal-run-time and so on (see section Time).
debug-extensions
delay
EIDs
geteuid and getegid really return
effective user and group IDs (see section Processes).
inexact
i/o-extensions
ftell, redirect-port, dup->fdes, dup2,
fileno, isatty?, fdopen,
primitive-move->fdes and fdes->ports (see section Ports and File Descriptors).
net-db
scm_gethost, scm_getnet, scm_getproto,
scm_getserv, scm_sethost, scm_setnet, scm_setproto,
scm_setserv, and their `byXXX' variants (see section Network Databases).
posix
pipe, getgroups,
kill, execl and so on (see section POSIX System Calls and Networking).
random
random, copy-random-state, random-uniform and so on
(see section Random Number Generation).
reckless
regex
make-regexp, regexp-exec and friends (see section Regexp Functions).
socket
socket,
bind, connect and so on (see section Network Sockets and Communication).
sort
system
system function is available
(see section Processes).
threads
values
values and
call-with-values (see section Returning and Accepting Multiple Values).
Available features in the second category depend, by definition, on what additional code your Guile process has loaded in. The following table lists features that you might encounter for this reason.
defmacro
defmacro macro is available (see section Lisp Style Macro Definitions).
describe
(oop goops describe) module has been loaded,
which provides a procedure for describing the contents of GOOPS
instances.
readline
record
make-record-type
and friends (see section Records).
Although these tables may seem exhaustive, it is probably unwise in
practice to rely on them, as the correspondences between feature symbols
and available procedures/behaviour are not strictly defined. If you are
writing code that needs to check for the existence of some procedure, it
is probably safer to do so directly using the defined? procedure
than to test for the corresponding feature using feature?.
Go to the first, previous, next, last section, table of contents.