remove "discouraged" infrastructure
[bpt/guile.git] / doc / ref / guile.texi
CommitLineData
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
a7c5a2e5 7@set MANUAL-REVISION 1
38a93523 8@c %**end of header
d3830c6b 9@include version.texi
b89c4943 10@include lib-version.texi
22b5f518 11@include effective-version.texi
d3830c6b
KR
12
13@copying
a7c5a2e5 14This manual documents Guile version @value{VERSION}.
d3830c6b 15
0f7e6c56 16Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2009, 2010 Free
83c3d755 17Software Foundation.
d3830c6b 18
3229f68b 19Permission is granted to copy, distribute and/or modify this document
31d328de 20under the terms of the GNU Free Documentation License, Version 1.3 or
31c73458 21any later version published by the Free Software Foundation; with
3229f68b
MV
22no Invariant Sections, with the Front-Cover Texts being ``A GNU
23Manual,'' and with the Back-Cover Text ``You are free to copy and
24modify this GNU Manual.''. A copy of the license is included in the
e03bb21b 25section 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
95x
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
a7c5a2e5 139@subtitle Edition @value{EDITION}, revision @value{MANUAL-REVISION}, for use with Guile @value{VERSION}
24dbb5ed 140@c @subtitle $Id: guile.texi,v 1.49 2008-03-19 22:51:23 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 169* Preface::
3d9af0c9 170* Introduction::
9401323e 171
45a272c5 172* Hello Guile!::
d665f75f
NJ
173* Hello Scheme!::
174
3229f68b
MV
175* Programming in Scheme::
176* Programming in C::
38a93523 177
3229f68b 178* API Reference::
38a93523 179
3229f68b 180* Guile Modules::
c55cb58a 181* Standard Library::
38a93523 182
eb12b401
NJ
183* GOOPS::
184
090d51ed 185* Guile Implementation::
8680d53b 186
92826dd0
LC
187* Autoconf Support::
188
c6ae9c77
MV
189Appendices
190
191* GNU Free Documentation License:: The license of this manual.
192
38a93523
NJ
193Indices
194
195* Concept Index::
196* Procedure Index::
197* Variable Index::
198* Type Index::
255ea784 199* R5RS Index::
38a93523
NJ
200
201@end menu
202
05c4ffe1
KR
203@contents
204
38a93523
NJ
205@include preface.texi
206
38a93523
NJ
207@include intro.texi
208
45a272c5 209@include tour.texi
45a272c5 210
d665f75f 211@include scheme-ideas.texi
d665f75f
NJ
212@include scheme-reading.texi
213
3229f68b
MV
214@node Programming in Scheme
215@chapter Programming in Scheme
9401323e 216
1d84577c
NJ
217Guile's core language is Scheme, and a lot can be achieved simply by using Guile
218to write and run Scheme programs --- as opposed to having to dive into C code.
219In this part of the manual, we explain how to use Guile in this mode, and
220describe the tools that Guile provides to help you with script writing,
221debugging and packaging your programs for distribution.
ce9d0562 222
3229f68b
MV
223For detailed reference information on the variables, functions
224etc. that make up Guile's application programming interface (API),
225@xref{API Reference}.
226
227@menu
3229f68b
MV
228* Guile Scheme:: Guile's implementation of Scheme.
229* Guile Scripting:: How to write Guile scripts.
46f7666d
NJ
230* Using Guile Interactively:: Guile's REPL features.
231* Using Guile in Emacs:: Guile and Emacs.
3229f68b 232@end menu
9401323e 233
38a93523 234@include scheme-intro.texi
07d83abe 235@include scheme-scripts.texi
46f7666d 236@include scheme-using.texi
9401323e 237
3229f68b
MV
238@node Programming in C
239@chapter Programming in C
240
241This part of the manual explains the general concepts that you need to
242understand when interfacing to Guile from C. You will learn about how
243the latent typing of Scheme is embedded into the static typing of C, how
244the garbage collection of Guile is made available to C code, and how
245continuations influence the control flow in a C program.
246
247This knowledge should make it straightforward to add new functions to
248Guile that can be called from Scheme. Adding new data types is also
249possible and is done by defining @dfn{smobs}.
250
251The @ref{Programming Overview} section of this part contains general
252musings and guidelines about programming with Guile. It explores
8c3fa3e5 253different ways to design a program around Guile, or how to embed Guile
3229f68b
MV
254into existing programs.
255
0f7e6c56
AW
256For a pedagogical yet detailed explanation of how the data representation of
257Guile is implemented, @xref{Data Representation}. You don't need to know the
258details given there to use Guile from C, but they are useful when you want to
259modify Guile itself or when you are just curious about how it is all done.
3229f68b
MV
260
261For detailed reference information on the variables, functions
262etc. that make up Guile's application programming interface (API),
263@xref{API Reference}.
264
265@menu
266* Linking Programs With Guile:: More precisely, with the libguile library.
267* Linking Guile with Libraries:: To extend Guile itself.
268* General Libguile Concepts:: General concepts for using libguile.
269* Defining New Types (Smobs):: Adding new types to Guile.
270* Function Snarfing:: A way to define new functions.
271* Programming Overview:: An overview of Guile programming.
272@end menu
273
274@include libguile-linking.texi
275@include libguile-extensions.texi
276@include libguile-concepts.texi
277@include libguile-smobs.texi
278@include libguile-snarf.texi
237be238 279@include libguile-program.texi
ce9d0562 280
3229f68b
MV
281@node API Reference
282@chapter API Reference
9401323e 283
a7a7bb95
NJ
284Guile provides an application programming interface (@dfn{API}) to
285developers in two core languages: Scheme and C. This part of the manual
286contains reference documentation for all of the functionality that is
287available through both Scheme and C interfaces.
288
3229f68b
MV
289@menu
290* API Overview:: Overview of the Guile API.
029fa896 291* Discouraged and Deprecated:: Obsolete back-compatible APIs.
98f445f4 292* The SCM Type:: The fundamental data type for C code.
3229f68b
MV
293* Initialization:: Initializing Guile.
294* Snarfing Macros:: Macros for snarfing initialization actions.
295* Simple Data Types:: Numbers, strings, booleans and so on.
296* Compound Data Types:: Data types for holding other data.
297* Smobs:: Defining new data types in C.
e4955559
AW
298* Procedures:: Procedures.
299* Macros:: Extending the syntax of Scheme.
3229f68b
MV
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.
2115b8eb 304* LALR(1) Parsing:: Generating LALR(1) parsers.
00ce5125 305* Read/Load/Eval/Compile:: Reading and evaluating Scheme code.
3229f68b
MV
306* Memory Management:: Memory management and garbage collection.
307* Objects:: Low level object orientation support.
308* Modules:: Designing reusable code libraries.
726b8ba3 309* Foreign Function Interface:: Interacting with C procedures and data.
3229f68b
MV
310* Scheduling:: Threads, mutexes, asyncs and dynamic roots.
311* Options and Config:: Configuration, features and runtime options.
e6709db6 312* Other Languages:: Emacs Lisp, ECMAScript, and more.
089a0a34 313* Internationalization:: Support for gettext, etc.
c9ef3741 314* Debugging:: Debugging infrastructure and Scheme interface.
36b5e394 315* Code Coverage:: Gathering code coverage data.
3229f68b
MV
316@end menu
317
07d83abe 318@include api-overview.texi
029fa896 319@include api-discdepr.texi
07d83abe
MV
320@include api-scm.texi
321@include api-init.texi
322@include api-snarf.texi
323@include api-data.texi
324@include api-compound.texi
325@include api-smobs.texi
326@include api-procedures.texi
e4955559 327@include api-macros.texi
07d83abe
MV
328@include api-utility.texi
329@include api-binding.texi
330@include api-control.texi
331@include api-io.texi
2115b8eb 332@include api-lalr.texi
07d83abe
MV
333@include api-evaluation.texi
334@include api-memory.texi
335@include api-modules.texi
726b8ba3 336@include api-foreign.texi
07d83abe 337@include api-scheduling.texi
38a93523 338@c object orientation support here
07d83abe 339@include api-options.texi
e6709db6 340@include api-languages.texi
089a0a34 341@include api-i18n.texi
07d83abe 342@include api-debug.texi
36b5e394 343@include api-coverage.texi
38a93523 344
3229f68b
MV
345@node Guile Modules
346@chapter Guile Modules
347
348@menu
349* SLIB:: Using the SLIB Scheme library.
350* POSIX:: POSIX system calls and networking.
351* getopt-long:: Command line handling.
352* SRFI Support:: Support for various SRFIs.
845cbcfe 353* R6RS Support:: Modules defined by the R6RS.
3229f68b 354* Readline Support:: Module for using the readline library.
3229f68b
MV
355* Pretty Printing:: Nicely formatting Scheme objects for output.
356* Formatted Output:: The @code{format} procedure.
3229f68b
MV
357* File Tree Walk:: Traversing the file system.
358* Queues:: First-in first-out queuing.
71abb271 359* Streams:: Sequences of values.
40296bab 360* Buffered Input:: Ports made from a reader function.
3229f68b 361* Expect:: Controlling interactive programs with Guile.
400a5dcb 362* sxml-match:: Pattern matching of SXML.
3229f68b 363* The Scheme shell (scsh):: Using scsh interfaces in Guile.
24dbb5ed 364* Tracing:: Tracing program execution.
3229f68b 365@end menu
38a93523
NJ
366
367@include slib.texi
368@include posix.texi
3229f68b 369@include mod-getopt-long.texi
fc8529c7 370@include srfi-modules.texi
845cbcfe 371@include r6rs.texi
fc8529c7 372@include repl-modules.texi
c2537425 373@include misc-modules.texi
38a93523 374@include expect.texi
400a5dcb
LC
375
376@c XXX: Would be nicer if it were close to the (sxml simple) documentation.
377@include sxml-match.texi
378
38a93523 379@include scsh.texi
24dbb5ed 380@include scheme-debugging.texi
38a93523 381
c55cb58a
AW
382@node Standard Library
383@chapter Standard Library
384
385@lowersections
386@include standard-library.texi
387@raisesections
388
eb12b401
NJ
389@include goops.texi
390
090d51ed
AW
391@node Guile Implementation
392@chapter Guile Implementation
8680d53b 393
0b8f3ac5
AW
394At some point, after one has been programming in Scheme for some time,
395another level of Scheme comes into view: its implementation. Knowledge
396of how Scheme can be implemented turns out to be necessary to become
397an expert hacker. As Peter Norvig notes in his retrospective on
398PAIP@footnote{PAIP is the common abbreviation for @cite{Paradigms of
399Artificial Intelligence Programming}, an old but still useful text on
400Lisp. Norvig's retrospective sums up the lessons of PAIP, and can be
401found at @uref{http://norvig.com/Lisp-retro.html}.}, ``The expert Lisp
402programmer eventually develops a good `efficiency model'.''
403
404By this Norvig means that over time, the Lisp hacker eventually
405develops an understanding of how much her code ``costs'' in terms of
406space and time.
407
408This chapter describes Guile as an implementation of Scheme: its
409history, how it represents and evaluates its data, and its compiler.
410This knowledge can help you to make that step from being one who is
411merely familiar with Scheme to being a real hacker.
8680d53b
AW
412
413@menu
0f7e6c56
AW
414* History:: A brief history of Guile.
415* Data Representation:: How Guile represents Scheme data.
416* A Virtual Machine for Guile:: How compiled procedures work.
417* Compiling to the Virtual Machine:: Not as hard as you might think.
8680d53b
AW
418@end menu
419
420@include history.texi
3229f68b 421@include data-rep.texi
8680d53b
AW
422@include vm.texi
423@include compiler.texi
424
ca445ba5
AW
425@include autoconf.texi
426
31d328de
LC
427@node GNU Free Documentation License
428@appendix GNU Free Documentation License
429
c6ae9c77
MV
430@include fdl.texi
431
38a93523
NJ
432@iftex
433@page
434@unnumbered{Indices}
435@end iftex
436
437@include indices.texi
9401323e 438@include scheme-indices.texi
38a93523 439
38a93523 440@bye