4 @setfilename guile.info
5 @settitle Guile Reference Manual
7 @set MANUAL-EDITION 1.1
12 This reference manual documents Guile, GNU's Ubiquitous Intelligent
13 Language for Extensions. This is edition @value{MANUAL-EDITION}
14 corresponding to Guile @value{VERSION}.
16 Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005 Free
19 Permission is granted to copy, distribute and/or modify this document
20 under the terms of the GNU Free Documentation License, Version 1.2 or
21 any later version published by the Free Software Foundation; with the
22 no Invariant Sections, with the Front-Cover Texts being ``A GNU
23 Manual,'' and with the Back-Cover Text ``You are free to copy and
24 modify this GNU Manual.''. A copy of the license is included in the
25 section entitled ``GNU Free Documentation License''.
31 @c We no longer use the category "primitive" to distinguish C-defined
32 @c Scheme procedures from those defined in Scheme. Instead, the
33 @c reference manual now includes a C declaration as well as a Scheme
34 @c declaration for each procedure that is available in both Scheme and
37 @c When adding a new reference entry to the Guile manual, please
38 @c document it with @deffn using one of the following categories:
45 @c If the entry is for a new primitive, it should have both a @deffn
46 @c {Scheme Procedure} line and a @deffnx {C Function} line; see the
47 @c manual source for plenty of existing examples of this.
49 @c For {C Function} entries where the return type and all parameter
50 @c types are SCM, we omit the SCMs. This is easier to read and also
51 @c gets round the problem that Texinfo doesn't allow a @deftypefnx
54 @c For a list of Guile primitives that are not yet incorporated into the
55 @c reference manual, see the file `new-docstrings.texi', which holds all
56 @c the docstrings snarfed from the libguile C sources for primitives
57 @c that are not in the reference manual. If you have worked with some
58 @c of these concepts, implemented them, or just happen to know what they
59 @c do, please write up a little explanation -- it would be a big help.
60 @c Alternatively, if you know of any reason why some of these should
61 @c *not* go in the manual, please let the mailing list
62 @c <guile-devel@gnu.org> know.
64 @c Define indices that are used in the Guile Scheme part of the
65 @c reference manual to group stuff according to whether it is R5RS or a
69 @c vnew - For (some) new items, indicates the Guile version in which
70 @c item first appeared. In future, this could be made to expand to
71 @c something like a "New in Guile 45!" banner.
76 @c The following, @le{} and @ge{}, are standard tex directives, given
77 @c definitions for use in non-tex.
88 @c @cross{} is a \times symbol in tex, or an "x" in info. In tex it works
89 @c inside or outside $ $.
91 \gdef\cross{\ifmmode\times\else$\times$\fi}
99 @c @m{T,N} is $T$ in tex or @math{N} otherwise. This is an easy way to give
100 @c different forms for math in tex and info.
112 @c @nicode{S} is plain S in info, or @code{S} elsewhere. This can be used
113 @c when the quotes that @code{} gives in info aren't wanted, but the
114 @c fontification in tex or html is wanted. @alias is used rather
115 @c than @macro because backslashes don't work properly in an @macro.
128 @dircategory The Algorithmic Language Scheme
130 * Guile Reference: (guile). The Guile reference manual.
133 @setchapternewpage odd
137 @comment The title is printed in a large font.
138 @title Guile Reference Manual
139 @subtitle Edition @value{MANUAL-EDITION}, for use with Guile @value{VERSION}
140 @c @subtitle $Id: guile.texi,v 1.40 2005-03-04 14:22:41 mvo Exp $
142 @c See preface.texi for the list of authors
143 @author The Guile Developers
145 @c The following two commands start the copyright page.
147 @vskip 0pt plus 1filll
148 @vskip 0pt plus 1filll
156 @c Where to find Guile examples.
157 @set example-dir doc/examples
160 @node Top, Preface, (dir), (dir)
161 @top The Guile Reference Manual
170 * Introduction to Guile::
172 * Programming in Scheme::
181 * Data Representation:: All the details.
182 * GNU Free Documentation License:: The license of this manual.
196 @include preface.texi
200 @node Programming in Scheme
201 @chapter Programming in Scheme
203 Guile's core language is Scheme, and an awful lot can be achieved simply
204 by using Guile to write and run Scheme programs. In this part of the
205 manual, we explain how to use Guile in this mode, and describe the tools
206 that Guile provides to help you with script writing, debugging and
207 packaging your programs for distribution.
209 For readers who are not yet familiar with the Scheme language, this part
210 includes a chapter that presents the basic concepts of the language, and
211 gives references to freely available Scheme tutorial material on the
214 For detailed reference information on the variables, functions
215 etc. that make up Guile's application programming interface (API),
216 @xref{API Reference}.
219 * Basic Ideas:: Basic ideas in Scheme.
220 * Guile Scheme:: Guile's implementation of Scheme.
221 * Guile Scripting:: How to write Guile scripts.
222 * Debugging Features:: Features for finding errors.
223 * Further Reading:: Where to find out more about Scheme.
226 @include scheme-ideas.texi
227 @include scheme-intro.texi
228 @include scheme-scripts.texi
229 @include scheme-debugging.texi
230 @include scheme-reading.texi
232 @node Programming in C
233 @chapter Programming in C
235 This part of the manual explains the general concepts that you need to
236 understand when interfacing to Guile from C. You will learn about how
237 the latent typing of Scheme is embedded into the static typing of C, how
238 the garbage collection of Guile is made available to C code, and how
239 continuations influence the control flow in a C program.
241 This knowledge should make it straightforward to add new functions to
242 Guile that can be called from Scheme. Adding new data types is also
243 possible and is done by defining @dfn{smobs}.
245 The @ref{Programming Overview} section of this part contains general
246 musings and guidelines about programming with Guile. It explores
247 different ways to design aprogram around Guile, or how to embed Guile
248 into existing programs.
250 There is also a pedagogical yet detailed explanation of how the data
251 representation of Guile is implemented, @xref{Data Representation}.
252 You don't need to know the details given there to use Guile from C,
253 but they are useful when you want to modify Guile itself or when you
254 are just curious about how it is all done.
256 For detailed reference information on the variables, functions
257 etc. that make up Guile's application programming interface (API),
258 @xref{API Reference}.
261 * Linking Programs With Guile:: More precisely, with the libguile library.
262 * Linking Guile with Libraries:: To extend Guile itself.
263 * General Libguile Concepts:: General concepts for using libguile.
264 * Defining New Types (Smobs):: Adding new types to Guile.
265 * Function Snarfing:: A way to define new functions.
266 * Programming Overview:: An overview of Guile programming.
269 @include libguile-linking.texi
270 @include libguile-extensions.texi
271 @include libguile-concepts.texi
272 @include libguile-smobs.texi
273 @include libguile-snarf.texi
274 @include libguile-program.texi
277 @chapter API Reference
279 Guile provides an application programming interface (@dfn{API}) to
280 developers in two core languages: Scheme and C. This part of the manual
281 contains reference documentation for all of the functionality that is
282 available through both Scheme and C interfaces.
285 * API Overview:: Overview of the Guile API.
286 * The SCM Type:: The fundamental data type for C code.
287 * Initialization:: Initializing Guile.
288 * Snarfing Macros:: Macros for snarfing initialization actions.
289 * Simple Data Types:: Numbers, strings, booleans and so on.
290 * Compound Data Types:: Data types for holding other data.
291 * Smobs:: Defining new data types in C.
292 * Procedures and Macros:: Procedures and macros.
293 * Utility Functions:: General utility functions.
294 * Binding Constructs:: Definitions and variable bindings.
295 * Control Mechanisms:: Controlling the flow of program execution.
296 * Input and Output:: Ports, reading and writing.
297 * Read/Load/Eval:: Reading and evaluating Scheme code.
298 * Memory Management:: Memory management and garbage collection.
299 * Objects:: Low level object orientation support.
300 * Modules:: Designing reusable code libraries.
301 * Scheduling:: Threads, mutexes, asyncs and dynamic roots.
302 * Options and Config:: Configuration, features and runtime options.
303 * Translation:: Support for translating other languages.
304 * Internationalization:: Support for gettext, etc.
305 * Debugging:: Internal debugging interface.
306 * GH:: The deprecated GH interface.
309 @include api-overview.texi
310 @include api-scm.texi
311 @include api-init.texi
312 @include api-snarf.texi
313 @include api-data.texi
314 @include api-compound.texi
315 @include api-smobs.texi
316 @include api-procedures.texi
317 @include api-utility.texi
318 @include api-binding.texi
319 @include api-control.texi
321 @include api-evaluation.texi
322 @include api-memory.texi
323 @include api-modules.texi
324 @include api-scheduling.texi
325 @c object orientation support here
326 @include api-options.texi
327 @include api-translation.texi
328 @include api-i18n.texi
329 @include api-debug.texi
333 @chapter Guile Modules
336 * SLIB:: Using the SLIB Scheme library.
337 * POSIX:: POSIX system calls and networking.
338 * getopt-long:: Command line handling.
339 * SRFI Support:: Support for various SRFIs.
340 * Readline Support:: Module for using the readline library.
341 * Value History:: Maintaining a value history in the REPL.
342 * Pretty Printing:: Nicely formatting Scheme objects for output.
343 * Formatted Output:: The @code{format} procedure.
344 * Rx Regexps:: The Rx regular expression library.
345 * File Tree Walk:: Traversing the file system.
346 * Queues:: First-in first-out queuing.
347 * Streams:: Sequences of values.
348 * Expect:: Controlling interactive programs with Guile.
349 * The Scheme shell (scsh):: Using scsh interfaces in Guile.
354 @include mod-getopt-long.texi
355 @include srfi-modules.texi
356 @include repl-modules.texi
357 @include misc-modules.texi
361 @include data-rep.texi
369 @include indices.texi
370 @include scheme-indices.texi