Commit | Line | Data |
---|---|---|
38a93523 NJ |
1 | \input texinfo |
2 | @c -*-texinfo-*- | |
3 | @c %**start of header | |
4 | @setfilename guile.info | |
5 | @settitle Guile Reference Manual | |
370babab | 6 | @set guile |
c73543af | 7 | @set MANUAL-EDITION 1.1 |
38a93523 | 8 | @c %**end of header |
d3830c6b | 9 | @include version.texi |
b89c4943 | 10 | @include lib-version.texi |
d3830c6b KR |
11 | |
12 | @copying | |
13 | This reference manual documents Guile, GNU's Ubiquitous Intelligent | |
3229f68b | 14 | Language for Extensions. This is edition @value{MANUAL-EDITION} |
d3830c6b KR |
15 | corresponding to Guile @value{VERSION}. |
16 | ||
83c3d755 KR |
17 | Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005 Free |
18 | Software Foundation. | |
d3830c6b | 19 | |
3229f68b MV |
20 | Permission is granted to copy, distribute and/or modify this document |
21 | under the terms of the GNU Free Documentation License, Version 1.2 or | |
22 | any later version published by the Free Software Foundation; with the | |
23 | no Invariant Sections, with the Front-Cover Texts being ``A GNU | |
24 | Manual,'' and with the Back-Cover Text ``You are free to copy and | |
25 | modify this GNU Manual.''. A copy of the license is included in the | |
e03bb21b | 26 | section entitled ``GNU Free Documentation License''. |
d3830c6b KR |
27 | @end copying |
28 | ||
38a93523 | 29 | |
2a946b44 | 30 | @c Notes |
370babab | 31 | @c |
2a946b44 NJ |
32 | @c We no longer use the category "primitive" to distinguish C-defined |
33 | @c Scheme procedures from those defined in Scheme. Instead, the | |
34 | @c reference manual now includes a C declaration as well as a Scheme | |
35 | @c declaration for each procedure that is available in both Scheme and | |
36 | @c C. | |
370babab | 37 | @c |
2a946b44 NJ |
38 | @c When adding a new reference entry to the Guile manual, please |
39 | @c document it with @deffn using one of the following categories: | |
40 | @c | |
41 | @c {Scheme Procedure} | |
42 | @c {Scheme Syntax} | |
43 | @c {C Function} | |
44 | @c {C Macro} | |
45 | @c | |
46 | @c If the entry is for a new primitive, it should have both a @deffn | |
47 | @c {Scheme Procedure} line and a @deffnx {C Function} line; see the | |
48 | @c manual source for plenty of existing examples of this. | |
49 | @c | |
50 | @c For {C Function} entries where the return type and all parameter | |
51 | @c types are SCM, we omit the SCMs. This is easier to read and also | |
52 | @c gets round the problem that Texinfo doesn't allow a @deftypefnx | |
53 | @c inside a @deffn. | |
38a93523 | 54 | @c |
370babab NJ |
55 | @c For a list of Guile primitives that are not yet incorporated into the |
56 | @c reference manual, see the file `new-docstrings.texi', which holds all | |
57 | @c the docstrings snarfed from the libguile C sources for primitives | |
58 | @c that are not in the reference manual. If you have worked with some | |
59 | @c of these concepts, implemented them, or just happen to know what they | |
60 | @c do, please write up a little explanation -- it would be a big help. | |
2a946b44 NJ |
61 | @c Alternatively, if you know of any reason why some of these should |
62 | @c *not* go in the manual, please let the mailing list | |
63 | @c <guile-devel@gnu.org> know. | |
38a93523 NJ |
64 | |
65 | @c Define indices that are used in the Guile Scheme part of the | |
66 | @c reference manual to group stuff according to whether it is R5RS or a | |
67 | @c Guile extension. | |
5c4b24e1 | 68 | @defcodeindex rn |
38a93523 | 69 | |
0624ce33 NJ |
70 | @c vnew - For (some) new items, indicates the Guile version in which |
71 | @c item first appeared. In future, this could be made to expand to | |
72 | @c something like a "New in Guile 45!" banner. | |
198586ed NJ |
73 | @macro vnew{VERSION} |
74 | @end macro | |
75 | ||
20685804 | 76 | |
17bf4bfa KR |
77 | @c The following, @le{} and @ge{}, are standard tex directives, given |
78 | @c definitions for use in non-tex. | |
79 | @c | |
80 | @ifnottex | |
81 | @macro ge | |
82 | >= | |
83 | @end macro | |
84 | @macro le | |
85 | <= | |
86 | @end macro | |
87 | @end ifnottex | |
88 | ||
27281a53 KR |
89 | @c @cross{} is a \times symbol in tex, or an "x" in info. In tex it works |
90 | @c inside or outside $ $. | |
91 | @tex | |
92 | \gdef\cross{\ifmmode\times\else$\times$\fi} | |
93 | @end tex | |
94 | @ifnottex | |
95 | @macro cross | |
96 | x | |
97 | @end macro | |
98 | @end ifnottex | |
99 | ||
d6f53bd5 KR |
100 | @c @m{T,N} is $T$ in tex or @math{N} otherwise. This is an easy way to give |
101 | @c different forms for math in tex and info. | |
102 | @iftex | |
103 | @macro m {T,N} | |
104 | @tex$\T\$@end tex | |
105 | @end macro | |
106 | @end iftex | |
107 | @ifnottex | |
108 | @macro m {T,N} | |
109 | @math{\N\} | |
110 | @end macro | |
111 | @end ifnottex | |
112 | ||
7ac44f03 KR |
113 | @c @nicode{S} is plain S in info, or @code{S} elsewhere. This can be used |
114 | @c when the quotes that @code{} gives in info aren't wanted, but the | |
115 | @c fontification in tex or html is wanted. @alias is used rather | |
116 | @c than @macro because backslashes don't work properly in an @macro. | |
20685804 | 117 | @ifinfo |
7ac44f03 | 118 | @alias nicode=asis |
20685804 KR |
119 | @end ifinfo |
120 | @ifnotinfo | |
7ac44f03 | 121 | @alias nicode=code |
20685804 KR |
122 | @end ifnotinfo |
123 | ||
124 | ||
38a93523 NJ |
125 | @c @iftex |
126 | @c @cropmarks | |
127 | @c @end iftex | |
128 | ||
129 | @dircategory The Algorithmic Language Scheme | |
130 | @direntry | |
c16da59f | 131 | * Guile Reference: (guile). The Guile reference manual. |
38a93523 NJ |
132 | @end direntry |
133 | ||
3229f68b | 134 | @setchapternewpage odd |
38a93523 | 135 | |
38a93523 NJ |
136 | @titlepage |
137 | @sp 10 | |
138 | @comment The title is printed in a large font. | |
139 | @title Guile Reference Manual | |
c73543af | 140 | @subtitle Edition @value{MANUAL-EDITION}, for use with Guile @value{VERSION} |
24dbb5ed | 141 | @c @subtitle $Id: guile.texi,v 1.49 2008-03-19 22:51:23 ossau Exp $ |
391b4ae0 MV |
142 | |
143 | @c See preface.texi for the list of authors | |
144 | @author The Guile Developers | |
370babab | 145 | |
38a93523 NJ |
146 | @c The following two commands start the copyright page. |
147 | @page | |
148 | @vskip 0pt plus 1filll | |
149 | @vskip 0pt plus 1filll | |
d3830c6b | 150 | @insertcopying |
38a93523 NJ |
151 | @end titlepage |
152 | ||
153 | @c @smallbook | |
154 | @finalout | |
155 | @headings double | |
156 | ||
157 | @c Where to find Guile examples. | |
158 | @set example-dir doc/examples | |
159 | ||
801892e7 | 160 | @ifnottex |
3229f68b | 161 | @node Top, Preface, (dir), (dir) |
38a93523 NJ |
162 | @top The Guile Reference Manual |
163 | ||
d3830c6b KR |
164 | @insertcopying |
165 | @sp 1 | |
801892e7 | 166 | @end ifnottex |
38a93523 NJ |
167 | |
168 | @menu | |
9401323e | 169 | |
3229f68b MV |
170 | * Preface:: |
171 | * Introduction to Guile:: | |
9401323e | 172 | |
3229f68b MV |
173 | * Programming in Scheme:: |
174 | * Programming in C:: | |
38a93523 | 175 | |
3229f68b | 176 | * API Reference:: |
38a93523 | 177 | |
3229f68b | 178 | * Guile Modules:: |
38a93523 | 179 | |
090d51ed | 180 | * Guile Implementation:: |
8680d53b | 181 | |
92826dd0 LC |
182 | * Autoconf Support:: |
183 | ||
c6ae9c77 MV |
184 | Appendices |
185 | ||
186 | * GNU Free Documentation License:: The license of this manual. | |
187 | ||
38a93523 NJ |
188 | Indices |
189 | ||
190 | * Concept Index:: | |
191 | * Procedure Index:: | |
192 | * Variable Index:: | |
193 | * Type Index:: | |
255ea784 | 194 | * R5RS Index:: |
38a93523 NJ |
195 | |
196 | @end menu | |
197 | ||
05c4ffe1 KR |
198 | @contents |
199 | ||
38a93523 NJ |
200 | @include preface.texi |
201 | ||
38a93523 NJ |
202 | @include intro.texi |
203 | ||
3229f68b MV |
204 | @node Programming in Scheme |
205 | @chapter Programming in Scheme | |
9401323e | 206 | |
ce9d0562 NJ |
207 | Guile's core language is Scheme, and an awful lot can be achieved simply |
208 | by using Guile to write and run Scheme programs. In this part of the | |
209 | manual, we explain how to use Guile in this mode, and describe the tools | |
210 | that Guile provides to help you with script writing, debugging and | |
211 | packaging your programs for distribution. | |
38a93523 | 212 | |
ce9d0562 NJ |
213 | For readers who are not yet familiar with the Scheme language, this part |
214 | includes a chapter that presents the basic concepts of the language, and | |
215 | gives references to freely available Scheme tutorial material on the | |
216 | web. | |
217 | ||
3229f68b MV |
218 | For detailed reference information on the variables, functions |
219 | etc. that make up Guile's application programming interface (API), | |
220 | @xref{API Reference}. | |
221 | ||
222 | @menu | |
223 | * Basic Ideas:: Basic ideas in Scheme. | |
224 | * Guile Scheme:: Guile's implementation of Scheme. | |
225 | * Guile Scripting:: How to write Guile scripts. | |
46f7666d NJ |
226 | * Using Guile Interactively:: Guile's REPL features. |
227 | * Using Guile in Emacs:: Guile and Emacs. | |
3229f68b MV |
228 | * Further Reading:: Where to find out more about Scheme. |
229 | @end menu | |
9401323e | 230 | |
3229f68b | 231 | @include scheme-ideas.texi |
38a93523 | 232 | @include scheme-intro.texi |
07d83abe | 233 | @include scheme-scripts.texi |
46f7666d | 234 | @include scheme-using.texi |
9401323e NJ |
235 | @include scheme-reading.texi |
236 | ||
3229f68b MV |
237 | @node Programming in C |
238 | @chapter Programming in C | |
239 | ||
240 | This part of the manual explains the general concepts that you need to | |
241 | understand when interfacing to Guile from C. You will learn about how | |
242 | the latent typing of Scheme is embedded into the static typing of C, how | |
243 | the garbage collection of Guile is made available to C code, and how | |
244 | continuations influence the control flow in a C program. | |
245 | ||
246 | This knowledge should make it straightforward to add new functions to | |
247 | Guile that can be called from Scheme. Adding new data types is also | |
248 | possible and is done by defining @dfn{smobs}. | |
249 | ||
250 | The @ref{Programming Overview} section of this part contains general | |
251 | musings and guidelines about programming with Guile. It explores | |
8c3fa3e5 | 252 | different ways to design a program around Guile, or how to embed Guile |
3229f68b MV |
253 | into existing programs. |
254 | ||
255 | There is also a pedagogical yet detailed explanation of how the data | |
8680d53b AW |
256 | representation of Guile is implemented, see @ref{Data Representation in |
257 | Scheme} and @ref{The Libguile Runtime Environment}. | |
258 | ||
3229f68b MV |
259 | You don't need to know the details given there to use Guile from C, |
260 | but they are useful when you want to modify Guile itself or when you | |
261 | are just curious about how it is all done. | |
262 | ||
263 | For detailed reference information on the variables, functions | |
264 | etc. that make up Guile's application programming interface (API), | |
265 | @xref{API Reference}. | |
266 | ||
267 | @menu | |
268 | * Linking Programs With Guile:: More precisely, with the libguile library. | |
269 | * Linking Guile with Libraries:: To extend Guile itself. | |
270 | * General Libguile Concepts:: General concepts for using libguile. | |
271 | * Defining New Types (Smobs):: Adding new types to Guile. | |
272 | * Function Snarfing:: A way to define new functions. | |
273 | * Programming Overview:: An overview of Guile programming. | |
274 | @end menu | |
275 | ||
276 | @include libguile-linking.texi | |
277 | @include libguile-extensions.texi | |
278 | @include libguile-concepts.texi | |
279 | @include libguile-smobs.texi | |
280 | @include libguile-snarf.texi | |
237be238 | 281 | @include libguile-program.texi |
ce9d0562 | 282 | |
3229f68b MV |
283 | @node API Reference |
284 | @chapter API Reference | |
9401323e | 285 | |
a7a7bb95 NJ |
286 | Guile provides an application programming interface (@dfn{API}) to |
287 | developers in two core languages: Scheme and C. This part of the manual | |
288 | contains reference documentation for all of the functionality that is | |
289 | available through both Scheme and C interfaces. | |
290 | ||
3229f68b MV |
291 | @menu |
292 | * API Overview:: Overview of the Guile API. | |
98f445f4 | 293 | * The SCM Type:: The fundamental data type for C code. |
3229f68b MV |
294 | * Initialization:: Initializing Guile. |
295 | * Snarfing Macros:: Macros for snarfing initialization actions. | |
296 | * Simple Data Types:: Numbers, strings, booleans and so on. | |
297 | * Compound Data Types:: Data types for holding other data. | |
298 | * Smobs:: Defining new data types in C. | |
299 | * Procedures and Macros:: Procedures and macros. | |
300 | * Utility Functions:: General utility functions. | |
301 | * Binding Constructs:: Definitions and variable bindings. | |
302 | * Control Mechanisms:: Controlling the flow of program execution. | |
303 | * Input and Output:: Ports, reading and writing. | |
00ce5125 | 304 | * Read/Load/Eval/Compile:: Reading and evaluating Scheme code. |
3229f68b MV |
305 | * Memory Management:: Memory management and garbage collection. |
306 | * Objects:: Low level object orientation support. | |
307 | * Modules:: Designing reusable code libraries. | |
308 | * Scheduling:: Threads, mutexes, asyncs and dynamic roots. | |
309 | * Options and Config:: Configuration, features and runtime options. | |
310 | * Translation:: Support for translating other languages. | |
089a0a34 | 311 | * Internationalization:: Support for gettext, etc. |
c9ef3741 | 312 | * Debugging:: Debugging infrastructure and Scheme interface. |
3229f68b MV |
313 | @end menu |
314 | ||
07d83abe MV |
315 | @include api-overview.texi |
316 | @include api-scm.texi | |
317 | @include api-init.texi | |
318 | @include api-snarf.texi | |
319 | @include api-data.texi | |
320 | @include api-compound.texi | |
321 | @include api-smobs.texi | |
322 | @include api-procedures.texi | |
323 | @include api-utility.texi | |
324 | @include api-binding.texi | |
325 | @include api-control.texi | |
326 | @include api-io.texi | |
327 | @include api-evaluation.texi | |
328 | @include api-memory.texi | |
329 | @include api-modules.texi | |
330 | @include api-scheduling.texi | |
38a93523 | 331 | @c object orientation support here |
07d83abe MV |
332 | @include api-options.texi |
333 | @include api-translation.texi | |
089a0a34 | 334 | @include api-i18n.texi |
07d83abe | 335 | @include api-debug.texi |
38a93523 | 336 | |
3229f68b MV |
337 | @node Guile Modules |
338 | @chapter Guile Modules | |
339 | ||
340 | @menu | |
341 | * SLIB:: Using the SLIB Scheme library. | |
342 | * POSIX:: POSIX system calls and networking. | |
343 | * getopt-long:: Command line handling. | |
344 | * SRFI Support:: Support for various SRFIs. | |
345 | * Readline Support:: Module for using the readline library. | |
346 | * Value History:: Maintaining a value history in the REPL. | |
347 | * Pretty Printing:: Nicely formatting Scheme objects for output. | |
348 | * Formatted Output:: The @code{format} procedure. | |
3229f68b MV |
349 | * File Tree Walk:: Traversing the file system. |
350 | * Queues:: First-in first-out queuing. | |
71abb271 | 351 | * Streams:: Sequences of values. |
40296bab | 352 | * Buffered Input:: Ports made from a reader function. |
3229f68b MV |
353 | * Expect:: Controlling interactive programs with Guile. |
354 | * The Scheme shell (scsh):: Using scsh interfaces in Guile. | |
24dbb5ed | 355 | * Tracing:: Tracing program execution. |
3229f68b | 356 | @end menu |
38a93523 NJ |
357 | |
358 | @include slib.texi | |
359 | @include posix.texi | |
3229f68b | 360 | @include mod-getopt-long.texi |
fc8529c7 | 361 | @include srfi-modules.texi |
fc8529c7 | 362 | @include repl-modules.texi |
c2537425 | 363 | @include misc-modules.texi |
38a93523 NJ |
364 | @include expect.texi |
365 | @include scsh.texi | |
24dbb5ed | 366 | @include scheme-debugging.texi |
38a93523 | 367 | |
92826dd0 LC |
368 | @include autoconf.texi |
369 | ||
090d51ed AW |
370 | @node Guile Implementation |
371 | @chapter Guile Implementation | |
8680d53b | 372 | |
090d51ed AW |
373 | Things that aren't necessary to know to use guile, but that are |
374 | interesting once you decide that Guile is interesting. | |
375 | ||
376 | Also Schemers as closet compiler writers. | |
8680d53b AW |
377 | |
378 | @menu | |
090d51ed | 379 | * History:: A brief history of Guile. |
8680d53b AW |
380 | * Data Representation in Scheme:: Why things aren't just totally |
381 | straightforward, in general terms. | |
382 | * The Libguile Runtime Environment:: Low-level details on Guile's C | |
383 | runtime library. | |
384 | * A Virtual Machine for Guile:: Foo. | |
385 | * Compiling to the Virtual Machine:: Bar. | |
386 | @end menu | |
387 | ||
388 | @include history.texi | |
3229f68b | 389 | @include data-rep.texi |
8680d53b AW |
390 | @include vm.texi |
391 | @include compiler.texi | |
392 | ||
c6ae9c77 MV |
393 | @include fdl.texi |
394 | ||
38a93523 NJ |
395 | @iftex |
396 | @page | |
397 | @unnumbered{Indices} | |
398 | @end iftex | |
399 | ||
400 | @include indices.texi | |
9401323e | 401 | @include scheme-indices.texi |
38a93523 | 402 | |
38a93523 | 403 | @bye |