diff options
Diffstat (limited to 'doc/ref')
-rw-r--r-- | doc/ref/api-compound.texi | 6 | ||||
-rw-r--r-- | doc/ref/api-data.texi | 12 | ||||
-rw-r--r-- | doc/ref/api-debug.texi | 40 | ||||
-rw-r--r-- | doc/ref/api-evaluation.texi | 49 | ||||
-rw-r--r-- | doc/ref/api-foreign.texi | 2 | ||||
-rw-r--r-- | doc/ref/srfi-modules.texi | 4 |
6 files changed, 107 insertions, 6 deletions
diff --git a/doc/ref/api-compound.texi b/doc/ref/api-compound.texi index 0b14c4889..055de9935 100644 --- a/doc/ref/api-compound.texi +++ b/doc/ref/api-compound.texi @@ -1,7 +1,7 @@ @c -*-texinfo-*- @c This is part of the GNU Guile Reference Manual. -@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -@c 2007, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. +@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, +@c 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc. @c See the file guile.texi for copying conditions. @node Compound Data Types @@ -673,6 +673,8 @@ that vectors are the special case of one dimensional non-uniform arrays and that most array procedures operate happily on vectors (@pxref{Arrays}). +Also see @ref{SRFI-43}, for a comprehensive vector library. + @menu * Vector Syntax:: Read syntax for vectors. * Vector Creation:: Dynamic vector creation and validation. diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi index ba00603b8..96f9fd017 100644 --- a/doc/ref/api-data.texi +++ b/doc/ref/api-data.texi @@ -5543,6 +5543,8 @@ approach to properties, see @ref{Object Properties}. @node Symbol Read Syntax @subsubsection Extended Read Syntax for Symbols +@cindex r7rs-symbols + The read syntax for a symbol is a sequence of letters, digits, and @dfn{extended alphabetic characters}, beginning with a character that cannot begin a number. In addition, the special cases of @code{+}, @@ -5603,6 +5605,16 @@ double quotes. |\| is a vertical bar| @end example +Note that there's also an @code{r7rs-symbols} print option +(@pxref{Scheme Write}). To enable the use of this notation, evaluate +one or both of the following expressions: + +@example +(read-enable 'r7rs-symbols) +(print-enable 'r7rs-symbols) +@end example + + @node Symbol Uninterned @subsubsection Uninterned Symbols diff --git a/doc/ref/api-debug.texi b/doc/ref/api-debug.texi index 5dabb8403..9b0e56448 100644 --- a/doc/ref/api-debug.texi +++ b/doc/ref/api-debug.texi @@ -17,8 +17,9 @@ infrastructure that builds on top of those calls. @menu * Evaluation Model:: Evaluation and the Scheme stack. * Source Properties:: From expressions to source locations. -* Programmatic Error Handling:: Debugging when an error occurs. +* Programmatic Error Handling:: Debugging when an error occurs. * Traps:: Breakpoints, tracepoints, oh my! +* GDB Support:: C-level debugging with GDB. @end menu @node Evaluation Model @@ -1478,6 +1479,43 @@ This is a stepping trap, used to implement the ``step'', ``next'', ``step-instruction'', and ``next-instruction'' REPL commands. @end deffn +@node GDB Support +@subsection GDB Support + +@cindex GDB support + +Sometimes, you may find it necessary to debug Guile applications at the +C level. Doing so can be tedious, in particular because the debugger is +oblivious to Guile's @code{SCM} type, and thus unable to display +@code{SCM} values in any meaningful way: + +@example +(gdb) frame +#0 scm_display (obj=0xf04310, port=0x6f9f30) at print.c:1437 +@end example + +To address that, Guile comes with an extension of the GNU Debugger (GDB) +that contains a ``pretty-printer'' for @code{SCM} values. With this GDB +extension, the C frame in the example above shows up like this: + +@example +(gdb) frame +#0 scm_display (obj=("hello" GDB!), port=#<port file 6f9f30>) at print.c:1437 +@end example + +@noindent +Here GDB was able to decode the list pointed to by @var{obj}, and to +print it using Scheme's read syntax. + +That extension is a @code{.scm} file installed alongside the +@file{libguile} shared library. When GDB 7.8 or later is installed and +compiled with support for extensions written in Guile, the extension is +automatically loaded when debugging a program linked against +@file{libguile} (@pxref{Auto-loading,,, gdb, Debugging with GDB}). Note +that the directory where @file{libguile} is installed must be among +GDB's auto-loading ``safe directories'' (@pxref{Auto-loading safe +path,,, gdb, Debugging with GDB}). + @c Local Variables: @c TeX-master: "guile.texi" diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi index dde164372..a23cf1ae4 100644 --- a/doc/ref/api-evaluation.texi +++ b/doc/ref/api-evaluation.texi @@ -23,6 +23,7 @@ loading, evaluating, and compiling Scheme code at run time. * Local Evaluation:: Evaluation in a local lexical environment. * Local Inclusion:: Compile-time inclusion of one file in another. * REPL Servers:: Serving a REPL over a socket. +* Cooperative REPL Servers:: REPL server for single-threaded applications. @end menu @@ -1267,6 +1268,54 @@ with no arguments. @deffn {Scheme Procedure} stop-server-and-clients! Closes the connection on all running server sockets. + +Please note that in the current implementation, the REPL threads are +cancelled without unwinding their stacks. If any of them are holding +mutexes or are within a critical section, the results are unspecified. +@end deffn + +@node Cooperative REPL Servers +@subsection Cooperative REPL Servers + +@cindex Cooperative REPL server + +The procedures in this section are provided by +@lisp +(use-modules (system repl coop-server)) +@end lisp + +Whereas ordinary REPL servers run in their own threads (@pxref{REPL +Servers}), sometimes it is more convenient to provide REPLs that run at +specified times within an existing thread, for example in programs +utilizing an event loop or in single-threaded programs. This allows for +safe access and mutation of a program's data structures from the REPL, +without concern for thread synchronization. + +Although the REPLs are run in the thread that calls +@code{spawn-coop-repl-server} and @code{poll-coop-repl-server}, +dedicated threads are spawned so that the calling thread is not blocked. +The spawned threads read input for the REPLs and to listen for new +connections. + +Cooperative REPL servers must be polled periodically to evaluate any +pending expressions by calling @code{poll-coop-repl-server} with the +object returned from @code{spawn-coop-repl-server}. The thread that +calls @code{poll-coop-repl-server} will be blocked for as long as the +expression takes to be evaluated or if the debugger is entered. + +@deffn {Scheme Procedure} spawn-coop-repl-server [server-socket] +Create and return a new cooperative REPL server object, and spawn a new +thread to listen for connections on @var{server-socket}. Proper +functioning of the REPL server requires that +@code{poll-coop-repl-server} be called periodically on the returned +server object. +@end deffn + +@deffn {Scheme Procedure} poll-coop-repl-server coop-server +Poll the cooperative REPL server @var{coop-server} and apply a pending +operation if there is one, such as evaluating an expression typed at the +REPL prompt. This procedure must be called from the same thread that +called @code{spawn-coop-repl-server}. @end deffn @c Local Variables: diff --git a/doc/ref/api-foreign.texi b/doc/ref/api-foreign.texi index 381c10d63..c2c49ec48 100644 --- a/doc/ref/api-foreign.texi +++ b/doc/ref/api-foreign.texi @@ -604,7 +604,7 @@ Unpack the pointer value from a pointer object. Wrapped pointers are untyped, so they are essentially equivalent to C @code{void} pointers. As in C, the memory region pointed to by a pointer can be accessed at the byte level. This is achieved using -@emph{bytevectors} (@pxref{Bytevectors}). The @code{(rnrs bytevector)} +@emph{bytevectors} (@pxref{Bytevectors}). The @code{(rnrs bytevectors)} module contains procedures that can be used to convert byte sequences to Scheme objects such as strings, floating point numbers, or integers. diff --git a/doc/ref/srfi-modules.texi b/doc/ref/srfi-modules.texi index 161d3725e..882b7d371 100644 --- a/doc/ref/srfi-modules.texi +++ b/doc/ref/srfi-modules.texi @@ -4626,8 +4626,8 @@ comparisons are performed is unspecified. @subsubsection SRFI-43 Selectors @deffn {Scheme Procedure} vector-ref vec i -Return the value that the location in @var{vec} at @var{i} is mapped to -in the store. Indexing is based on zero. +Return the element at index @var{i} in @var{vec}. Indexing is based on +zero. @end deffn @deffn {Scheme Procedure} vector-length vec |