(m): New macro.
[bpt/guile.git] / doc / ref / guile.texi
1 \input texinfo
2 @c -*-texinfo-*-
3 @c %**start of header
4 @setfilename guile.info
5 @settitle Guile Reference Manual
6 @set guile
7 @set MANUAL-EDITION 1.1
8 @c %**end of header
9
10 @c Notes
11 @c
12 @c We no longer use the category "primitive" to distinguish C-defined
13 @c Scheme procedures from those defined in Scheme. Instead, the
14 @c reference manual now includes a C declaration as well as a Scheme
15 @c declaration for each procedure that is available in both Scheme and
16 @c C.
17 @c
18 @c When adding a new reference entry to the Guile manual, please
19 @c document it with @deffn using one of the following categories:
20 @c
21 @c {Scheme Procedure}
22 @c {Scheme Syntax}
23 @c {C Function}
24 @c {C Macro}
25 @c
26 @c If the entry is for a new primitive, it should have both a @deffn
27 @c {Scheme Procedure} line and a @deffnx {C Function} line; see the
28 @c manual source for plenty of existing examples of this.
29 @c
30 @c For {C Function} entries where the return type and all parameter
31 @c types are SCM, we omit the SCMs. This is easier to read and also
32 @c gets round the problem that Texinfo doesn't allow a @deftypefnx
33 @c inside a @deffn.
34 @c
35 @c For a list of Guile primitives that are not yet incorporated into the
36 @c reference manual, see the file `new-docstrings.texi', which holds all
37 @c the docstrings snarfed from the libguile C sources for primitives
38 @c that are not in the reference manual. If you have worked with some
39 @c of these concepts, implemented them, or just happen to know what they
40 @c do, please write up a little explanation -- it would be a big help.
41 @c Alternatively, if you know of any reason why some of these should
42 @c *not* go in the manual, please let the mailing list
43 @c <guile-devel@gnu.org> know.
44
45 @c Define indices that are used in the Guile Scheme part of the
46 @c reference manual to group stuff according to whether it is R5RS or a
47 @c Guile extension.
48 @defcodeindex rn
49
50 @include version.texi
51
52 @c vnew - For (some) new items, indicates the Guile version in which
53 @c item first appeared. In future, this could be made to expand to
54 @c something like a "New in Guile 45!" banner.
55 @macro vnew{VERSION}
56 @end macro
57
58 @c @m{T,N} is $T$ in tex or @math{N} otherwise. This is an easy way to give
59 @c different forms for math in tex and info.
60 @iftex
61 @macro m {T,N}
62 @tex$\T\$@end tex
63 @end macro
64 @end iftex
65 @ifnottex
66 @macro m {T,N}
67 @math{\N\}
68 @end macro
69 @end ifnottex
70
71 @c @iftex
72 @c @cropmarks
73 @c @end iftex
74
75 @dircategory The Algorithmic Language Scheme
76 @direntry
77 * Guile Reference: (guile). The Guile reference manual.
78 @end direntry
79
80 @setchapternewpage off
81
82 @ifinfo
83 Guile Reference Manual
84 Copyright (C) 1996 Free Software Foundation @*
85 Copyright (C) 1997 Free Software Foundation @*
86 Copyright (C) 2000 Free Software Foundation @*
87 Copyright (C) 2001 Free Software Foundation @*
88 Copyright (C) 2002 Free Software Foundation
89
90 Permission is granted to make and distribute verbatim copies of
91 this manual provided the copyright notice and this permission notice
92 are preserved on all copies.
93
94 @ignore
95 Permission is granted to process this file through TeX and print the
96 results, provided the printed document carries copying permission
97 notice identical to this one except for the removal of this paragraph
98 (this paragraph not being relevant to the printed manual).
99 @end ignore
100
101 Permission is granted to copy and distribute modified versions of this
102 manual under the conditions for verbatim copying, provided that the entire
103 resulting derived work is distributed under the terms of a permission
104 notice identical to this one.
105
106 Permission is granted to copy and distribute translations of this manual
107 into another language, under the above conditions for modified versions,
108 except that this permission notice may be stated in a translation approved
109 by the Free Software Foundation.
110 @end ifinfo
111
112 @titlepage
113 @sp 10
114 @comment The title is printed in a large font.
115 @title Guile Reference Manual
116 @subtitle Edition @value{MANUAL-EDITION}, for use with Guile @value{VERSION}
117 @subtitle $Id: guile.texi,v 1.21 2003-05-10 03:58:37 kryde Exp $
118
119 @c AUTHORS
120
121 @c The Guile reference and tutorial manuals were written and edited
122 @c largely by Mark Galassi and Jim Blandy. In particular, Jim wrote the
123 @c original tutorial on Guile's data representation and the C API for
124 @c accessing Guile objects.
125
126 @c Significant portions were contributed by Gary Houston (contributions
127 @c to POSIX system calls and networking, expect, I/O internals and
128 @c extensions, slib installation, error handling) and Tim Pierce
129 @c (sections on script interpreter triggers, alists, function tracing).
130
131 @c Tom Lord contributed a great deal of material with early Guile
132 @c snapshots; although most of this text has been rewritten, all of it
133 @c was important, and some of the structure remains.
134
135 @c Aubrey Jaffer wrote the SCM Scheme implementation and manual upon
136 @c which the Guile program and manual are based. Some portions of the
137 @c SCM and SLIB manuals have been included here verbatim.
138
139 @c Since Guile 1.4, Neil Jerram has been maintaining and improving the
140 @c reference manual. Among other contributions, he wrote the Basic
141 @c Ideas chapter, developed the tools for keeping the manual in sync
142 @c with snarfed libguile docstrings, and reorganized the structure so as
143 @c to accommodate docstrings for all Guile's primitives.
144
145 @c Martin Grabmueller has made substantial contributions throughout the
146 @c reference manual in preparation for the Guile 1.6 release, including
147 @c filling out a lot of the documentation of Scheme data types, control
148 @c mechanisms and procedures. In addition, he wrote the documentation
149 @c for Guile's SRFI modules and modules associated with the Guile REPL.
150
151 @author Mark Galassi
152 @author Cygnus Solution and Los Alamos National Laboratory
153 @author @email{rosalia@@cygnus.com}
154 @author
155 @author Jim Blandy
156 @author Free Software Foundation and MIT AI Lab
157 @author @email{jimb@@red-bean.com}
158 @author
159 @author Gary Houston
160 @author @email{ghouston@@arglist.com}
161 @author
162 @author Tim Pierce
163 @author @email{twp@@skepsis.com}
164 @author
165 @author Neil Jerram
166 @author @email{neil@@ossau.uklinux.net}
167 @author
168 @author Martin Grabmueller
169 @author @email{mgrabmue@@cs.tu-berlin.de}
170
171 @c The following two commands start the copyright page.
172 @page
173 @vskip 0pt plus 1filll
174 @vskip 0pt plus 1filll
175 Copyright @copyright{} 1996 Free Software Foundation
176
177 Copyright @copyright{} 1997 Free Software Foundation
178
179 Copyright @copyright{} 2000 Free Software Foundation
180
181 Copyright @copyright{} 2001 Free Software Foundation
182
183 Copyright @copyright{} 2002 Free Software Foundation
184
185 Permission is granted to make and distribute verbatim copies of
186 this manual provided the copyright notice and this permission notice
187 are preserved on all copies.
188
189 Permission is granted to copy and distribute modified versions of this
190 manual under the conditions for verbatim copying, provided that the entire
191 resulting derived work is distributed under the terms of a permission
192 notice identical to this one.
193
194 Permission is granted to copy and distribute translations of this manual
195 into another language, under the above conditions for modified versions,
196 except that this permission notice may be stated in a translation approved
197 by Free Software Foundation.
198 @end titlepage
199
200 @c @smallbook
201 @finalout
202 @headings double
203
204 @c Where to find Guile examples.
205 @set example-dir doc/examples
206
207 @ifnottex
208 @node Top, Guile License, (dir), (dir)
209 @top The Guile Reference Manual
210
211 This reference manual documents Guile, GNU's Ubiquitous Intelligent
212 Language for Extensions. It describes how to use Guile in many useful
213 and interesting ways.
214
215 This Info file contains edition @value{MANUAL-EDITION} of the reference
216 manual, corresponding to Guile version @value{VERSION}.
217 @end ifnottex
218
219 @menu
220 Preface
221
222 * Guile License:: Conditions for copying and using Guile.
223 * Manual Layout:: How to read the rest of this manual.
224 * Manual Conventions:: Conventional terminology.
225
226 Part I: Introduction to Guile
227
228 * What is Guile?:: And what does it do?
229 * Whirlwind Tour:: An introductory whirlwind tour.
230 * Obtaining and Installing Guile::
231 * Reporting Bugs:: Reporting bugs in Guile or this manual.
232
233 Part II: Writing and Running Guile Scheme
234
235 * Running Intro:: Introduction to this part.
236 * Guile Scheme:: Guile's implementation of Scheme.
237 * Guile Scripting:: How to write Guile scripts.
238 * Command Line Handling:: Command line options and arguments.
239 * Debugging Features:: Features for debugging errors.
240 * Autoconf Support:: Guile-specific configure.in macros.
241 * Miscellaneous Tools:: Snarfing, linting, etc.
242 * Basic Ideas:: Basic ideas in Scheme.
243 * Further Reading:: Where to find out more about Scheme.
244
245 Part III: Guile as an Extension Language
246
247 * Programming Intro:: Introduction to this part.
248 * Libguile Intro:: Using Guile as an extension language.
249 * Programming Overview:: An overview of Guile programming.
250 * Data Representation:: Data representation in Guile.
251 * GH:: The deprecated GH interface.
252
253 Part IV: Guile API Reference
254
255 * Reference Intro:: Introduction to the Guile API reference.
256 * API Overview:: Overview of the Guile API.
257 * Simple Data Types:: Numbers, strings, booleans and so on.
258 * Compound Data Types:: Data types for holding other data.
259 * Procedures and Macros:: Procedures and macros.
260 * Utility Functions:: General utility functions.
261 * Binding Constructs:: Definitions and variable bindings.
262 * Control Mechanisms:: Controlling the flow of program execution.
263 * Input and Output:: Ports, reading and writing.
264 * Read/Load/Eval:: Reading and evaluating Scheme code.
265 * Memory Management:: Memory management and garbage collection.
266 * Objects:: Low level object orientation support.
267 * Modules:: Designing reusable code libraries.
268 * Scheduling:: Threads, mutexes, asyncs and dynamic roots.
269 * Options and Config:: Configuration, features and runtime options.
270 * Translation:: Support for translating other languages.
271 * Debugging:: Internal debugging interface.
272 * Deprecated:: Features that are planned to disappear.
273
274 Part V: Guile Modules
275
276 * SLIB:: Using the SLIB Scheme library.
277 * POSIX:: POSIX system calls and networking.
278 * SRFI Support:: Support for various SRFIs.
279 * Readline Support:: Module for using the readline library.
280 * Value History:: Maintaining a value history in the REPL.
281 * Pretty Printing:: Nicely formatting Scheme objects for output.
282 * Formatted Output:: The @code{format} procedure.
283 * Rx Regexps:: The Rx regular expression library.
284 * Expect:: Controlling interactive programs with Guile.
285 * The Scheme shell (scsh):: Using scsh interfaces in Guile.
286
287 Indices
288
289 * Concept Index::
290 * Procedure Index::
291 * Variable Index::
292 * Type Index::
293 * R5RS Index::
294
295 @end menu
296
297 @include preface.texi
298
299 @iftex
300 @page
301 @unnumbered{Part I: Introduction to Guile}
302 @end iftex
303
304 @include intro.texi
305
306 @page
307 @node Running Intro
308 @unnumbered Part II: Writing and Running Guile Scheme
309
310 Guile's core language is Scheme, and an awful lot can be achieved simply
311 by using Guile to write and run Scheme programs. In this part of the
312 manual, we explain how to use Guile in this mode, and describe the tools
313 that Guile provides to help you with script writing, debugging and
314 packaging your programs for distribution.
315
316 For readers who are not yet familiar with the Scheme language, this part
317 includes a chapter that presents the basic concepts of the language, and
318 gives references to freely available Scheme tutorial material on the
319 web.
320
321 For detailed reference information on the variables, functions etc. that
322 make up Guile's application programming interface (API), please refer to
323 Part IV (@pxref{Reference Intro,,Part IV --- Guile API Reference}).
324
325 @include scheme-intro.texi
326 @include scripts.texi
327 @include script-getopt.texi
328 @include debugging.texi
329 @include autoconf.texi
330 @include tools.texi
331 @include scheme-ideas.texi
332 @include scheme-reading.texi
333
334 @page
335 @node Programming Intro
336 @unnumbered Part III: Guile as an Extension Language
337
338 In this part of the manual, we aim to present a wide ranging picture of
339 what it means to use Guile as an application extension language, to
340 provide guidance, practical guidelines and tips for @emph{how} to
341 program in Guile, and to document the tools that are available to help
342 you with your programming. For detailed reference information on the
343 variables, functions etc. that make up Guile's application programming
344 interface (API), please refer to Part IV (@pxref{Reference Intro,,Part
345 IV --- Guile API Reference}).
346
347 @include extend.texi
348 @include program.texi
349 @include data-rep.texi
350 @include gh.texi
351
352 @page
353 @node Reference Intro
354 @unnumbered Part IV: Guile API Reference
355
356 Guile provides an application programming interface (@dfn{API}) to
357 developers in two core languages: Scheme and C. This part of the manual
358 contains reference documentation for all of the functionality that is
359 available through both Scheme and C interfaces.
360
361 @include scm.texi
362 @include scheme-data.texi
363 @include scheme-compound.texi
364 @include scheme-procedures.texi
365 @include scheme-utility.texi
366 @include scheme-binding.texi
367 @include scheme-control.texi
368 @include scheme-io.texi
369 @include scheme-evaluation.texi
370 @include scheme-memory.texi
371 @include scheme-modules.texi
372 @include scheme-scheduling.texi
373 @c object orientation support here
374 @include scheme-options.texi
375 @include scheme-translation.texi
376 @include scheme-debug.texi
377 @include deprecated.texi
378
379 @iftex
380 @page
381 @unnumbered{Part V: Guile Modules}
382 @end iftex
383
384 @include slib.texi
385 @include posix.texi
386 @include srfi-modules.texi
387 @include repl-modules.texi
388 @include misc-modules.texi
389 @include expect.texi
390 @include scsh.texi
391
392 @iftex
393 @page
394 @unnumbered{Indices}
395 @end iftex
396
397 @include indices.texi
398 @include scheme-indices.texi
399
400 @contents
401
402 @bye