From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ian Price Newsgroups: gmane.lisp.guile.devel Subject: Re: Documenting (system repl server) Date: Thu, 28 Mar 2013 00:24:12 +0000 Message-ID: <87620c9xsj.fsf@Kagami.home> References: <87hak8r0qm.fsf@Kagami.home> <871ub0r1km.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1364430276 28591 80.91.229.3 (28 Mar 2013 00:24:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Mar 2013 00:24:36 +0000 (UTC) Cc: guile-devel@gnu.org To: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Mar 28 01:25:01 2013 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UL0eI-0001vM-JC for guile-devel@m.gmane.org; Thu, 28 Mar 2013 01:24:58 +0100 Original-Received: from localhost ([::1]:52079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UL0du-0001Qp-A9 for guile-devel@m.gmane.org; Wed, 27 Mar 2013 20:24:34 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UL0dr-0001QZ-4X for guile-devel@gnu.org; Wed, 27 Mar 2013 20:24:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UL0dl-0002PN-Ur for guile-devel@gnu.org; Wed, 27 Mar 2013 20:24:27 -0400 Original-Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:59037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UL0dl-0002PJ-Jl; Wed, 27 Mar 2013 20:24:25 -0400 Original-Received: by mail-wi0-f179.google.com with SMTP id hn17so2777421wib.0 for ; Wed, 27 Mar 2013 17:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=x-received:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=Xxyvo0yPRLgXOcqPiJlikqR/C4+uthJqCYYt1bveMpQ=; b=igODXWRod5qmTqQ81Yf+l5c3PuE416h6A4Wo66D0iWfY29fL3WnxtWRFyBJ0qbkUWI xrKUIMKQdJ1ZRVAN2j4TpW8aL5viinuHpEEZKbjvk2RiAJGrw501JSu/IkxRnDSN37vL WoVn8YJSdWJcJg6L4hkyLrRer7wCRCC75A5iNKEul8y7zplWj6qQmKs3xcKxRZEd70gN A7ppIpxDjePi1Y8UYpnsvrqk6kVcuVlVQESqAN5BINfFv0MWwsKnkxYoEiw9FNhb46vA X+b4ZECGS1nkabYwfXIpFWE/yiaV9h7ogKkGgrlUfdt71BSHLZ83fowzRP285Ul7zJcX arWQ== X-Received: by 10.194.109.35 with SMTP id hp3mr34951107wjb.15.1364430264332; Wed, 27 Mar 2013 17:24:24 -0700 (PDT) Original-Received: from Kagami.home (host86-143-194-152.range86-143.btcentralplus.com. [86.143.194.152]) by mx.google.com with ESMTPS id bq19sm12143627wib.7.2013.03.27.17.24.22 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 27 Mar 2013 17:24:23 -0700 (PDT) In-Reply-To: <871ub0r1km.fsf@gnu.org> ("Ludovic =?iso-8859-1?Q?Court=E8s?= =?iso-8859-1?Q?=22's?= message of "Wed, 27 Mar 2013 22:10:33 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::233 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:16041 Archived-At: --=-=-= Content-Type: text/plain; charset=iso-2022-jp-2 ludo@gnu.org (Ludovic Court$(D+2(Bs) writes: > I would add something like $B!H(BThe procedures of this module allow you to > spawn a @dfn{REPL server}, which permits interaction over a local or TCP > connection.$B!I(B Added. > Also, what about mentioning --listen, with a xref, as an example use? I had intended to, but it managed to slip my mind. >> +Returns a stream socket bound to a given address @var{addr} and port > > Should be $B!H(BReturn$B!I(B. Fixed. >> +@deffn {Scheme Procedure} run-server [server-socket] >> +@deffnx {Scheme Procedure} spawn-server [server-socket] >> +@code{run-server} creates and runs a repl, making it available over > > Rather $B!H(BCreate and run a REPL$B!I(B ($B!H(BREPL$B!I(B always uppercase). Fixed. -- Ian Price -- shift-reset.com "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled" --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Document-system-repl-server.patch Content-Description: (system repl server) documentation >From 25054bb245b73711298feb37056534c750e721a8 Mon Sep 17 00:00:00 2001 From: Ian Price Date: Mon, 18 Mar 2013 18:55:18 +0000 Subject: [PATCH] Document (system repl server) * doc/ref/api-evaluation.texi (REPL Servers): New Subsection. --- doc/ref/api-evaluation.texi | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-) diff --git a/doc/ref/api-evaluation.texi b/doc/ref/api-evaluation.texi index 5c932a7..9544a74 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 @@ -1219,6 +1220,50 @@ 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 + +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, see +@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: -- 1.7.7.6 --=-=-=--