diff options
author | Mark H Weaver <mhw@netris.org> | 2013-03-28 22:24:00 -0400 |
---|---|---|
committer | Mark H Weaver <mhw@netris.org> | 2013-03-28 22:24:00 -0400 |
commit | c33ecf96a41979be0af1d56a7e12ad7c1196f12b (patch) | |
tree | 35e2f32f49f210dced293e77612a7130445281c9 /doc/ref | |
parent | 26d148066f9cb20e395a7dc4fefdf2e2ef0b2fb0 (diff) | |
parent | 4702deb424633ad02c495c01d950b973c0ead8ea (diff) | |
download | guile-c33ecf96a41979be0af1d56a7e12ad7c1196f12b.tar.gz |
Merge remote-tracking branch 'origin/stable-2.0'
Diffstat (limited to 'doc/ref')
-rw-r--r-- | doc/ref/api-evaluation.texi | 47 | ||||
-rw-r--r-- | doc/ref/srfi-modules.texi | 12 |
2 files changed, 53 insertions, 6 deletions
diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi index c4e77a9b4..7afbcfaef 100644 --- a/doc/ref/api-evaluation.texi +++ b/doc/ref/api-evaluation.texi @@ -22,6 +22,7 @@ loading, evaluating, and compiling Scheme code at run time. * Delayed Evaluation:: Postponing evaluation until it is needed. * 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. @end menu @@ -1220,6 +1221,52 @@ the source files for a package (as you should!). It makes it possible to evaluate an installed file from source, instead of relying on the @code{.go} file being up to date. +@node REPL Servers +@subsection REPL Servers + +@cindex REPL server + +The procedures in this section are provided by +@lisp +(use-modules (system repl server)) +@end lisp + +When an application is written in Guile, it is often convenient to +allow the user to be able to interact with it by evaluating Scheme +expressions in a REPL. + +The procedures of this module allow you to spawn a @dfn{REPL server}, +which permits interaction over a local or TCP connection. Guile itself +uses them internally to implement the @option{--listen} switch, +@ref{Command-line Options}. + +@deffn {Scheme Procedure} make-tcp-server-socket [#:host=#f] @ + [#:addr] [#:port=37146] +Return a stream socket bound to a given address @var{addr} and port +number @var{port}. If the @var{host} is given, and @var{addr} is not, +then the @var{host} string is converted to an address. If neither is +given, we use the loopback address. +@end deffn + +@deffn {Scheme Procedure} make-unix-domain-server-socket [#:path="/tmp/guile-socket"] +Return a UNIX domain socket, bound to a given @var{path}. +@end deffn + +@deffn {Scheme Procedure} run-server [server-socket] +@deffnx {Scheme Procedure} spawn-server [server-socket] +Create and run a REPL, making it available over the given +@var{server-socket}. If @var{server-socket} is not provided, it +defaults to the socket created by calling @code{make-tcp-server-socket} +with no arguments. + +@code{run-server} runs the server in the current thread, whereas +@code{spawn-server} runs the server in a new thread. +@end deffn + +@deffn {Scheme Procedure} stop-server-and-clients! +Closes the connection on all running server sockets. +@end deffn + @c Local Variables: @c TeX-master: "guile.texi" @c End: diff --git a/doc/ref/srfi-modules.texi b/doc/ref/srfi-modules.texi index 8bf7c4126..365341dde 100644 --- a/doc/ref/srfi-modules.texi +++ b/doc/ref/srfi-modules.texi @@ -3844,7 +3844,7 @@ again. SRFI-41 can be made available with: SRFI-41 Streams are based on two mutually-recursive abstract data types: An object of the @code{stream} abstract data type is a promise that, -when forced, is either @code{stream-null} or is an object of type +when forced, is either @var{stream-null} or is an object of type @code{stream-pair}. An object of the @code{stream-pair} abstract data type contains a @code{stream-car} and a @code{stream-cdr}, which must be a @code{stream}. The essential feature of streams is the systematic @@ -3862,16 +3862,16 @@ stream, and is only forced on demand. @subsubsection SRFI-41 Stream Primitives This library provides eight operators: constructors for -@code{stream-null} and @code{stream-pair}s, type predicates for streams +@var{stream-null} and @code{stream-pair}s, type predicates for streams and the two kinds of streams, accessors for both fields of a @code{stream-pair}, and a lambda that creates procedures that return streams. -@deffn {Scheme Variable} stream-null +@defvr {Scheme Variable} stream-null A promise that, when forced, is a single object, distinguishable from -all other objects, that represents the null stream. @code{stream-null} +all other objects, that represents the null stream. @var{stream-null} is immutable and unique. -@end deffn +@end defvr @deffn {Scheme Syntax} stream-cons object-expr stream-expr Creates a newly-allocated stream containing a promise that, when forced, @@ -4003,7 +4003,7 @@ Returns a newly-allocated stream containing the elements from Returns a newly-allocated stream containing in its elements the characters on the port. If @var{port} is not given it defaults to the current input port. The returned stream has finite length and is -terminated by @code{stream-null}. +terminated by @var{stream-null}. It looks like one use of @code{port->stream} would be this: |