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 KR |
9 | @include version.texi |
10 | ||
11 | @copying | |
12 | This reference manual documents Guile, GNU's Ubiquitous Intelligent | |
3229f68b | 13 | Language for Extensions. This is edition @value{MANUAL-EDITION} |
d3830c6b KR |
14 | corresponding to Guile @value{VERSION}. |
15 | ||
83c3d755 KR |
16 | Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005 Free |
17 | Software Foundation. | |
d3830c6b | 18 | |
3229f68b MV |
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 | |
e03bb21b | 25 | section entitled ``GNU Free Documentation License''. |
d3830c6b KR |
26 | @end copying |
27 | ||
38a93523 | 28 | |
2a946b44 | 29 | @c Notes |
370babab | 30 | @c |
2a946b44 NJ |
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 | |
35 | @c C. | |
370babab | 36 | @c |
2a946b44 NJ |
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: | |
39 | @c | |
40 | @c {Scheme Procedure} | |
41 | @c {Scheme Syntax} | |
42 | @c {C Function} | |
43 | @c {C Macro} | |
44 | @c | |
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. | |
48 | @c | |
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 | |
52 | @c inside a @deffn. | |
38a93523 | 53 | @c |
370babab NJ |
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. | |
2a946b44 NJ |
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. | |
38a93523 NJ |
63 | |
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 | |
66 | @c Guile extension. | |
5c4b24e1 | 67 | @defcodeindex rn |
38a93523 | 68 | |
0624ce33 NJ |
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. | |
198586ed NJ |
72 | @macro vnew{VERSION} |
73 | @end macro | |
74 | ||
20685804 | 75 | |
17bf4bfa KR |
76 | @c The following, @le{} and @ge{}, are standard tex directives, given |
77 | @c definitions for use in non-tex. | |
78 | @c | |
79 | @ifnottex | |
80 | @macro ge | |
81 | >= | |
82 | @end macro | |
83 | @macro le | |
84 | <= | |
85 | @end macro | |
86 | @end ifnottex | |
87 | ||
27281a53 KR |
88 | @c @cross{} is a \times symbol in tex, or an "x" in info. In tex it works |
89 | @c inside or outside $ $. | |
90 | @tex | |
91 | \gdef\cross{\ifmmode\times\else$\times$\fi} | |
92 | @end tex | |
93 | @ifnottex | |
94 | @macro cross | |
95 | x | |
96 | @end macro | |
97 | @end ifnottex | |
98 | ||
d6f53bd5 KR |
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. | |
101 | @iftex | |
102 | @macro m {T,N} | |
103 | @tex$\T\$@end tex | |
104 | @end macro | |
105 | @end iftex | |
106 | @ifnottex | |
107 | @macro m {T,N} | |
108 | @math{\N\} | |
109 | @end macro | |
110 | @end ifnottex | |
111 | ||
7ac44f03 KR |
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. | |
20685804 | 116 | @ifinfo |
7ac44f03 | 117 | @alias nicode=asis |
20685804 KR |
118 | @end ifinfo |
119 | @ifnotinfo | |
7ac44f03 | 120 | @alias nicode=code |
20685804 KR |
121 | @end ifnotinfo |
122 | ||
123 | ||
38a93523 NJ |
124 | @c @iftex |
125 | @c @cropmarks | |
126 | @c @end iftex | |
127 | ||
128 | @dircategory The Algorithmic Language Scheme | |
129 | @direntry | |
c16da59f | 130 | * Guile Reference: (guile). The Guile reference manual. |
38a93523 NJ |
131 | @end direntry |
132 | ||
3229f68b | 133 | @setchapternewpage odd |
38a93523 | 134 | |
38a93523 NJ |
135 | @titlepage |
136 | @sp 10 | |
137 | @comment The title is printed in a large font. | |
138 | @title Guile Reference Manual | |
c73543af | 139 | @subtitle Edition @value{MANUAL-EDITION}, for use with Guile @value{VERSION} |
46f7666d | 140 | @c @subtitle $Id: guile.texi,v 1.45 2006-08-01 21:33:17 ossau Exp $ |
391b4ae0 MV |
141 | |
142 | @c See preface.texi for the list of authors | |
143 | @author The Guile Developers | |
370babab | 144 | |
38a93523 NJ |
145 | @c The following two commands start the copyright page. |
146 | @page | |
147 | @vskip 0pt plus 1filll | |
148 | @vskip 0pt plus 1filll | |
d3830c6b | 149 | @insertcopying |
38a93523 NJ |
150 | @end titlepage |
151 | ||
152 | @c @smallbook | |
153 | @finalout | |
154 | @headings double | |
155 | ||
156 | @c Where to find Guile examples. | |
157 | @set example-dir doc/examples | |
158 | ||
801892e7 | 159 | @ifnottex |
3229f68b | 160 | @node Top, Preface, (dir), (dir) |
38a93523 NJ |
161 | @top The Guile Reference Manual |
162 | ||
d3830c6b KR |
163 | @insertcopying |
164 | @sp 1 | |
801892e7 | 165 | @end ifnottex |
38a93523 NJ |
166 | |
167 | @menu | |
9401323e | 168 | |
3229f68b MV |
169 | * Preface:: |
170 | * Introduction to Guile:: | |
9401323e | 171 | |
3229f68b MV |
172 | * Programming in Scheme:: |
173 | * Programming in C:: | |
38a93523 | 174 | |
3229f68b | 175 | * API Reference:: |
38a93523 | 176 | |
3229f68b | 177 | * Guile Modules:: |
38a93523 | 178 | |
c6ae9c77 MV |
179 | Appendices |
180 | ||
3229f68b | 181 | * Data Representation:: All the details. |
c6ae9c77 MV |
182 | * GNU Free Documentation License:: The license of this manual. |
183 | ||
38a93523 NJ |
184 | Indices |
185 | ||
186 | * Concept Index:: | |
187 | * Procedure Index:: | |
188 | * Variable Index:: | |
189 | * Type Index:: | |
255ea784 | 190 | * R5RS Index:: |
38a93523 NJ |
191 | |
192 | @end menu | |
193 | ||
05c4ffe1 KR |
194 | @contents |
195 | ||
38a93523 NJ |
196 | @include preface.texi |
197 | ||
38a93523 NJ |
198 | @include intro.texi |
199 | ||
3229f68b MV |
200 | @node Programming in Scheme |
201 | @chapter Programming in Scheme | |
9401323e | 202 | |
ce9d0562 NJ |
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. | |
38a93523 | 208 | |
ce9d0562 NJ |
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 | |
212 | web. | |
213 | ||
3229f68b MV |
214 | For detailed reference information on the variables, functions |
215 | etc. that make up Guile's application programming interface (API), | |
216 | @xref{API Reference}. | |
217 | ||
218 | @menu | |
219 | * Basic Ideas:: Basic ideas in Scheme. | |
220 | * Guile Scheme:: Guile's implementation of Scheme. | |
221 | * Guile Scripting:: How to write Guile scripts. | |
46f7666d NJ |
222 | * Using Guile Interactively:: Guile's REPL features. |
223 | * Using Guile in Emacs:: Guile and Emacs. | |
3229f68b MV |
224 | * Debugging Features:: Features for finding errors. |
225 | * Further Reading:: Where to find out more about Scheme. | |
226 | @end menu | |
9401323e | 227 | |
3229f68b | 228 | @include scheme-ideas.texi |
38a93523 | 229 | @include scheme-intro.texi |
07d83abe | 230 | @include scheme-scripts.texi |
46f7666d | 231 | @include scheme-using.texi |
07d83abe | 232 | @include scheme-debugging.texi |
9401323e NJ |
233 | @include scheme-reading.texi |
234 | ||
3229f68b MV |
235 | @node Programming in C |
236 | @chapter Programming in C | |
237 | ||
238 | This part of the manual explains the general concepts that you need to | |
239 | understand when interfacing to Guile from C. You will learn about how | |
240 | the latent typing of Scheme is embedded into the static typing of C, how | |
241 | the garbage collection of Guile is made available to C code, and how | |
242 | continuations influence the control flow in a C program. | |
243 | ||
244 | This knowledge should make it straightforward to add new functions to | |
245 | Guile that can be called from Scheme. Adding new data types is also | |
246 | possible and is done by defining @dfn{smobs}. | |
247 | ||
248 | The @ref{Programming Overview} section of this part contains general | |
249 | musings and guidelines about programming with Guile. It explores | |
8c3fa3e5 | 250 | different ways to design a program around Guile, or how to embed Guile |
3229f68b MV |
251 | into existing programs. |
252 | ||
253 | There is also a pedagogical yet detailed explanation of how the data | |
254 | representation of Guile is implemented, @xref{Data Representation}. | |
255 | You don't need to know the details given there to use Guile from C, | |
256 | but they are useful when you want to modify Guile itself or when you | |
257 | are just curious about how it is all done. | |
258 | ||
259 | For detailed reference information on the variables, functions | |
260 | etc. that make up Guile's application programming interface (API), | |
261 | @xref{API Reference}. | |
262 | ||
263 | @menu | |
264 | * Linking Programs With Guile:: More precisely, with the libguile library. | |
265 | * Linking Guile with Libraries:: To extend Guile itself. | |
266 | * General Libguile Concepts:: General concepts for using libguile. | |
267 | * Defining New Types (Smobs):: Adding new types to Guile. | |
268 | * Function Snarfing:: A way to define new functions. | |
269 | * Programming Overview:: An overview of Guile programming. | |
270 | @end menu | |
271 | ||
272 | @include libguile-linking.texi | |
273 | @include libguile-extensions.texi | |
274 | @include libguile-concepts.texi | |
275 | @include libguile-smobs.texi | |
276 | @include libguile-snarf.texi | |
237be238 | 277 | @include libguile-program.texi |
ce9d0562 | 278 | |
3229f68b MV |
279 | @node API Reference |
280 | @chapter API Reference | |
9401323e | 281 | |
a7a7bb95 NJ |
282 | Guile provides an application programming interface (@dfn{API}) to |
283 | developers in two core languages: Scheme and C. This part of the manual | |
284 | contains reference documentation for all of the functionality that is | |
285 | available through both Scheme and C interfaces. | |
286 | ||
3229f68b MV |
287 | @menu |
288 | * API Overview:: Overview of the Guile API. | |
98f445f4 | 289 | * The SCM Type:: The fundamental data type for C code. |
3229f68b MV |
290 | * Initialization:: Initializing Guile. |
291 | * Snarfing Macros:: Macros for snarfing initialization actions. | |
292 | * Simple Data Types:: Numbers, strings, booleans and so on. | |
293 | * Compound Data Types:: Data types for holding other data. | |
294 | * Smobs:: Defining new data types in C. | |
295 | * Procedures and Macros:: Procedures and macros. | |
296 | * Utility Functions:: General utility functions. | |
297 | * Binding Constructs:: Definitions and variable bindings. | |
298 | * Control Mechanisms:: Controlling the flow of program execution. | |
299 | * Input and Output:: Ports, reading and writing. | |
300 | * Read/Load/Eval:: Reading and evaluating Scheme code. | |
301 | * Memory Management:: Memory management and garbage collection. | |
302 | * Objects:: Low level object orientation support. | |
303 | * Modules:: Designing reusable code libraries. | |
304 | * Scheduling:: Threads, mutexes, asyncs and dynamic roots. | |
305 | * Options and Config:: Configuration, features and runtime options. | |
306 | * Translation:: Support for translating other languages. | |
089a0a34 | 307 | * Internationalization:: Support for gettext, etc. |
3229f68b | 308 | * Debugging:: Internal debugging interface. |
3229f68b MV |
309 | * GH:: The deprecated GH interface. |
310 | @end menu | |
311 | ||
07d83abe MV |
312 | @include api-overview.texi |
313 | @include api-scm.texi | |
314 | @include api-init.texi | |
315 | @include api-snarf.texi | |
316 | @include api-data.texi | |
317 | @include api-compound.texi | |
318 | @include api-smobs.texi | |
319 | @include api-procedures.texi | |
320 | @include api-utility.texi | |
321 | @include api-binding.texi | |
322 | @include api-control.texi | |
323 | @include api-io.texi | |
324 | @include api-evaluation.texi | |
325 | @include api-memory.texi | |
326 | @include api-modules.texi | |
327 | @include api-scheduling.texi | |
38a93523 | 328 | @c object orientation support here |
07d83abe MV |
329 | @include api-options.texi |
330 | @include api-translation.texi | |
089a0a34 | 331 | @include api-i18n.texi |
07d83abe | 332 | @include api-debug.texi |
3229f68b | 333 | @include gh.texi |
38a93523 | 334 | |
3229f68b MV |
335 | @node Guile Modules |
336 | @chapter Guile Modules | |
337 | ||
338 | @menu | |
339 | * SLIB:: Using the SLIB Scheme library. | |
340 | * POSIX:: POSIX system calls and networking. | |
341 | * getopt-long:: Command line handling. | |
342 | * SRFI Support:: Support for various SRFIs. | |
343 | * Readline Support:: Module for using the readline library. | |
344 | * Value History:: Maintaining a value history in the REPL. | |
345 | * Pretty Printing:: Nicely formatting Scheme objects for output. | |
346 | * Formatted Output:: The @code{format} procedure. | |
3229f68b MV |
347 | * File Tree Walk:: Traversing the file system. |
348 | * Queues:: First-in first-out queuing. | |
71abb271 | 349 | * Streams:: Sequences of values. |
3229f68b MV |
350 | * Expect:: Controlling interactive programs with Guile. |
351 | * The Scheme shell (scsh):: Using scsh interfaces in Guile. | |
352 | @end menu | |
38a93523 NJ |
353 | |
354 | @include slib.texi | |
355 | @include posix.texi | |
3229f68b | 356 | @include mod-getopt-long.texi |
fc8529c7 | 357 | @include srfi-modules.texi |
fc8529c7 | 358 | @include repl-modules.texi |
c2537425 | 359 | @include misc-modules.texi |
38a93523 NJ |
360 | @include expect.texi |
361 | @include scsh.texi | |
38a93523 | 362 | |
3229f68b | 363 | @include data-rep.texi |
c6ae9c77 MV |
364 | @include fdl.texi |
365 | ||
38a93523 NJ |
366 | @iftex |
367 | @page | |
368 | @unnumbered{Indices} | |
369 | @end iftex | |
370 | ||
371 | @include indices.texi | |
9401323e | 372 | @include scheme-indices.texi |
38a93523 | 373 | |
38a93523 | 374 | @bye |