Go to the first, previous, next, last section, table of contents.


Runtime Options and Configuration

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.

General option interface

We will use the expression <group> to represent read, print, debug or evaluator.

Low level

Scheme Procedure: <group>-options-interface
Scheme Procedure: read-options-interface [SOME-INT]
Scheme Procedure: print-options-interface [SOME-INT]
Scheme Procedure: evaluator-traps-interface [SOME-INT]
Scheme Procedure: read-options-interface [SOME-INT]
[FIXME: I have just taken the comments for C routine scm_options that implements all of these. It needs to be presented better.]

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.

User level

Scheme Procedure: <group>-options [arg]
Scheme Procedure: read-options [arg]
Scheme Procedure: print-options [arg]
Scheme Procedure: debug-options [arg]
Scheme Procedure: traps [arg]
These functions list the options in their group. The optional argument arg is a symbol which modifies the form in which the options are presented.

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.

[FIXME: I don't think 'full is ever any different from 'help. What's up?]

Scheme Procedure: <group>-enable option-symbol
Scheme Procedure: read-enable option-symbol
Scheme Procedure: print-enable option-symbol
Scheme Procedure: debug-enable option-symbol
Scheme Procedure: trap-enable option-symbol
These functions set the specified option-symbol in their options group. They only work if the option is boolean, and throw an error otherwise.

Scheme Procedure: <group>-disable option-symbol
Scheme Procedure: read-disable option-symbol
Scheme Procedure: print-disable option-symbol
Scheme Procedure: debug-disable option-symbol
Scheme Procedure: trap-disable option-symbol
These functions turn off the specified option-symbol in their options group. They only work if the option is boolean, and throw an error otherwise.

syntax: <group>-set! option-symbol value
syntax: read-set! option-symbol value
syntax: print-set! option-symbol value
syntax: debug-set! option-symbol value
syntax: trap-set! option-symbol value
These functions set a non-boolean option-symbol to the specified value.

Reader options

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)

Printing options

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.

Evaluator options

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).

Evaluator trap options

[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.

apply-frame-handler: key cont tailp
Called when a procedure is being applied.

Called if:

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

exit-frame-handler: key cont retval
Called when a value is returned from a procedure.

Called if:

If cheap traps are enabled [debug-options interface], cont is a debug object, otherwise it is a restartable continuation.

retval is the return value.

Debugger options

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.

Examples of option use

Here is an example of a session in which some read and debug option handling procedures are used. In this example, the user

  1. Notices that the symbols abc and aBc are not the same
  2. Examines the read-options, and sees that case-insensitive is set to "no".
  3. Enables case-insensitive
  4. Verifies that now aBc and abc are the same
  5. Disables case-insensitive and enables debugging backtrace
  6. Reproduces the error of displaying 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>

Installation and Configuration Data

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.

Scheme Procedure: version
Scheme Procedure: major-version
Scheme Procedure: minor-version
Scheme Procedure: micro-version
C Function: scm_version ()
C Function: scm_major_version ()
C Function: scm_minor_version ()
C Function: scm_micro_version ()
Return a string describing Guile's version number, or its major, minor or micro version number, respectively.
(version) => "1.6.0"
(major-version) => "1"
(minor-version) => "6"
(micro-version) => "0"

Scheme Procedure: libguile-config-stamp
Return a string describing the date on which 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.

Scheme Procedure: %package-data-dir
C Function: scm_sys_package_data_dir ()
Return the name of the directory where Scheme packages, modules and libraries are kept. On most Unix systems, this will be `/usr/local/share/guile'.

Scheme Procedure: %library-dir
C Function: scm_sys_library_dir ()
Return the directory where the Guile Scheme library files are installed. E.g., may return "/usr/share/guile/1.3.5".

Scheme Procedure: %site-dir
C Function: scm_sys_site_dir ()
Return the directory where the Guile site files are installed. E.g., may return "/usr/share/guile/site".

Scheme Procedure: parse-path path [tail]
C Function: scm_parse_path (path, tail)
Parse path, which is expected to be a colon-separated string, into a list and return the resulting list with tail appended. If path is #f, tail is returned.

Scheme Procedure: search-path path filename [extensions]
C Function: scm_search_path (path, filename, extensions)
Search path for a directory containing a file named filename. The file must be readable, and not a directory. If we find one, return its full filename; otherwise, return #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.

Variable: %load-path
List of directories which should be searched for Scheme modules and libraries.

Variable: %guile-build-info
Alist of information collected during the building of a particular 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.

Feature Tracking

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.

Variable: *features*
A list of symbols describing available features of the 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.

Feature Manipulation

To check whether a particular feature is available, use the provided? procedure:

Scheme Procedure: provided? feature
Deprecated Scheme Procedure: feature? feature
Return #t if the specified feature is available, otherwise #f.

To advertise a feature from your own Scheme code, you can use the provide procedure:

Scheme Procedure: provide feature
Add feature to the list of available features in this Guile process.

For C code, the equivalent function takes its feature name as a char * argument for convenience:

C Function: void scm_add_feature (const char *str)
Add a symbol with name str to the list of available features in this Guile process.

Common Feature Symbols

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
Indicates support for arrays (see section Arrays).
array-for-each
Indicates availability of array-for-each and other array mapping procedures (see section Array Mapping).
char-ready?
Indicates that the char-ready? function is available (see section Reading).
complex
Indicates support for complex numbers.
current-time
Indicates availability of time-related functions: times, get-internal-run-time and so on (see section Time).
debug-extensions
Indicates that the debugging evaluator is available, together with the options for controlling it.
delay
Indicates support for promises (see section Delayed Evaluation).
EIDs
Indicates that the geteuid and getegid really return effective user and group IDs (see section Processes).
inexact
Indicates support for inexact numbers.
i/o-extensions
Indicates availability of the following extended I/O procedures: ftell, redirect-port, dup->fdes, dup2, fileno, isatty?, fdopen, primitive-move->fdes and fdes->ports (see section Ports and File Descriptors).
net-db
Indicates availability of network database functions: 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
Indicates support for POSIX functions: pipe, getgroups, kill, execl and so on (see section POSIX System Calls and Networking).
random
Indicates availability of random number generation functions: random, copy-random-state, random-uniform and so on (see section Random Number Generation).
reckless
Indicates that Guile was built with important checks omitted -- you should never see this!
regex
Indicates support for POSIX regular expressions using make-regexp, regexp-exec and friends (see section Regexp Functions).
socket
Indicates availability of socket-related functions: socket, bind, connect and so on (see section Network Sockets and Communication).
sort
Indicates availability of sorting and merging functions (see section Sorting).
system
Indicates that the system function is available (see section Processes).
threads
Indicates support for multithreading (see section Threads).
values
Indicates support for multiple return values using 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
Indicates that the defmacro macro is available (see section Lisp Style Macro Definitions).
describe
Indicates that the (oop goops describe) module has been loaded, which provides a procedure for describing the contents of GOOPS instances.
readline
Indicates that Guile has loaded in Readline support, for command line editing (see section Readline Support).
record
Indicates support for record definition using 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.