From ba8e2e02277321336178516c3c59ca971485774b Mon Sep 17 00:00:00 2001 From: Didier Verna Date: Fri, 11 May 2012 18:45:15 +0200 Subject: [PATCH] *current-context* -> *context*. ChangeLog entries: 2012-05-11 Didier Verna * src/context.lisp (*context*): Rename from *current-context*. * src/context.lisp (progname): * src/context.lisp (remainder): * src/context.lisp (cmdline-options-p): * src/context.lisp (cmdline-p): * src/context.lisp (help): * src/context.lisp (getopt): * src/context.lisp (getopt-cmdline): * src/context.lisp (multiple-value-getopt-cmdline): * src/context.lisp (do-cmdline-options): * src/context.lisp (make-context): * src/context.lisp (with-context): * package.lisp (:com.dvlsoft.clon): * doc/user.texi (Using Multiple Contexts): * doc/user.texi (Runtime Phase API): Update accordingly. 2012-05-11 Didier Verna * INSTALL: Propagate changes from user.texi. --- INSTALL | 28 +++++++++++++++------------- doc/user.texi | 40 ++++++++++++++++++++-------------------- package.lisp | 2 +- src/context.lisp | 26 +++++++++++++------------- 4 files changed, 49 insertions(+), 47 deletions(-) diff --git a/INSTALL b/INSTALL index 0616819..c6ddcd6 100644 --- a/INSTALL +++ b/INSTALL @@ -3,10 +3,11 @@ ************** Clon currently works on Unix (including MacOS X) and Windows (Cygwin or -MinGW) with SBCL, CMUCL, CCL, ECL, Allegro (both standard and modern) -CLISP and ABCL. Clon is provided as an ASDF 2 system, but has no -mandatory dependency. CFFI may optionally be used with CLISP. *Note -Supported Platforms::, for more information. +MinGW) with SBCL, CMUCL, CCL, ECL, CLISP, ABCL, Allegro (both standard +and modern) and Lispworks. Clon is provided as an ASDF 2 system, but +has no mandatory dependency. CFFI may optionally be used with CLISP, +Allegro and Lispworks. *Note Supported Platforms::, for more +information. In addition to the library itself, the Clon distribution offers documentation in the form of 3 different manuals, some data files that @@ -96,7 +97,7 @@ A.3 Supported Platforms ======================= Clon currently works on Unix (including MacOS X) and Windows (Cygwin or -MinGW) and has been ported to 7 Common Lisp implementations. The +MinGW) and has been ported to 8 Common Lisp implementations. The following table lists the supported platforms. Compiler Minimum Version Dependencies @@ -106,14 +107,15 @@ CMU-CL 20b CCL ECL 11.1.2(1) CLISP `cffi' (optional) -Allegro(2) `cffi' (optional) -ABCL 0.24.0(3) +ABCL 0.24.0(2) +Allegro(3) `cffi' (optional) +Lispworks `cffi' (optional) -Allegro and CLISP specificities -------------------------------- +CLISP, Allegro and Lispworks specificities +------------------------------------------ -As mentioned in the above table, Allegro and CLISP's dependency on -`cffi' is optional. They need `cffi' in order to implement terminal +As mentioned in the above table, CLISP, Allegro and Lispworks dependency +on `cffi' is optional. They need `cffi' in order to implement terminal autodetection only (note that many other implementations come with their own foreign function interface). If `cffi' cannot be found when the ASDF system is loaded (or in the case of CLISP, if it has been @@ -137,7 +139,7 @@ Clon's ABCL port currently has two limitations: (1) more precisely, git revision 3e2e5f9dc3c5176ef6ef8d7794bfa43f1af8f8db - (2) both standard and modern images are supported + (2) more precisely, svn trunk revision 13156 - (3) more precisely, svn trunk revision 13156 + (3) both standard and modern images are supported diff --git a/doc/user.texi b/doc/user.texi index 1d67e8a..dd7844d 100644 --- a/doc/user.texi +++ b/doc/user.texi @@ -2288,12 +2288,12 @@ Did you also notice that after creating a context, there is actually never any explicit reference to it anymore? So again, where is the magick? In fact, there's no magick at all involved here either. -@vindex *current-context* -@cfiaindex{make-context,:make-current} -@clon{} has a global variable named @code{*current-context*} which holds -the@dots{} current context, yeah. When you create a context with -@code{make-context}, it is automatically made current, unless you use -the @code{:make-current} initarg with a value of @code{nil}. +@vindex *context* +@cfiaindex{make-context,:make-current}@c +@clon{} has a global variable named @code{*context*} which holds the +current context. When you create a context with @code{make-context}, it +is automatically made current, unless you use the @code{:make-current} +initarg with a value of @code{nil}. @cindex Runtime Phase @findex progname @@ -2315,14 +2315,14 @@ achieve this. @enumerate @item -@vindex *current-context* +@vindex *context* At any time in your program, you may change the value of -@code{*current-context*}. All subsequent calls to the runtime phase API +@code{*context*}. All subsequent calls to the runtime phase API will hence use this other context. @item @clon{} also provides a macro which changes the current context for you. @defun with-context CONTEXT &body BODY -Execute @var{BODY} with @code{*current-context*} bound to @var{CONTEXT}. +Execute @var{BODY} with @code{*context*} bound to @var{CONTEXT}. @end defun @item @fkindex{progname,:context}@c @@ -3024,7 +3024,7 @@ Different Command-Lines}. @node Runtime Phase API, Extension API, Initialization Phase API, API Quick Reference @section Runtime Phase API -@defopt *current-context* +@defopt *context* @xref{Using Multiple Contexts}. @end defopt @@ -3032,39 +3032,39 @@ Different Command-Lines}. @xref{Using Multiple Contexts}. @end defun -@defun progname &key (CONTEXT *current-context*) +@defun progname &key (CONTEXT *context*) @fkindex{progname,:context} See @ref{Contextual Information} and @ref{Using Multiple Contexts}. @end defun -@defun remainder &key (CONTEXT *current-context*) +@defun remainder &key (CONTEXT *context*) @fkindex{remainder,:context} See @ref{Contextual Information} and @ref{Using Multiple Contexts}. @end defun -@defun cmdline-options-p &key (CONTEXT *current-context*) +@defun cmdline-options-p &key (CONTEXT *context*) @fkindex{cmdline-options-p,:context} See @ref{Command-Line Polling} and @ref{Using Multiple Contexts}. @end defun -@defun cmdline-p &key (CONTEXT *current-context*) +@defun cmdline-p &key (CONTEXT *context*) @fkindex{cmdline-p,:context} See @ref{Command-Line Polling} and @ref{Using Multiple Contexts}. @end defun -@defun getopt &key (CONTEXT *current-context*) SHORT-NAME LONG-NAME @ +@defun getopt &key (CONTEXT *context*) SHORT-NAME LONG-NAME @ OPTION @fkindex{getopt,:context} @fkindex{getopt,:short-name} @fkindex{getopt,:long-name} @fkindex{getopt,:option} -@vindex *current-context* +@vindex *context* See @ref{Explicit Retrieval} and @ref{Using Multiple Contexts}. @end defun -@defun getopt-cmdline &key (CONTEXT *current-context*) +@defun getopt-cmdline &key (CONTEXT *context*) @fkindex{getopt-cmdline,:context} -@vindex *current-context* +@vindex *context* See @ref{Sequential Retrieval} and @ref{Using Multiple Contexts}. @end defun @@ -3084,7 +3084,7 @@ See @ref{Sequential Retrieval} and @ref{Using Multiple Contexts}. @xref{Sequential Retrieval}. @end deffn -@defun help &key (CONTEXT *current-context*) @ +@defun help &key (CONTEXT *context*) @ (ITEM (synopsis context)) @ (OUTPUT-STREAM *standard-output*) @ (SEARCH-PATH (search-path context)) @ @@ -3098,7 +3098,7 @@ See @ref{Sequential Retrieval} and @ref{Using Multiple Contexts}. @fkindex{help,:search-path} @fkindex{help,:line-width} @fkindex{help,:highlight} -@vindex *current-context* +@vindex *context* @vindex *standard-output* @xref{Help}, @ref{Using Multiple Contexts} and @ref{Programmatic Help Strings}. diff --git a/package.lisp b/package.lisp index 3ef7e2a..77cdcee 100644 --- a/package.lisp +++ b/package.lisp @@ -88,7 +88,7 @@ :*default-synopsis* :make-synopsis :defsynopsis ;; From src/context.lisp: - :*current-context* + :*context* :make-context :with-context :progname diff --git a/src/context.lisp b/src/context.lisp index bae6f8c..e3ee3b8 100644 --- a/src/context.lisp +++ b/src/context.lisp @@ -30,7 +30,7 @@ (in-package :com.dvlsoft.clon) (in-readtable :com.dvlsoft.clon) -(defvar *current-context* nil "The current context.") +(defvar *context* nil "The current context.") @@ -193,19 +193,19 @@ This class represents the associatiion of a synopsis and a set of command-line options based on it.")) -(defun progname (&key (context *current-context*)) +(defun progname (&key (context *context*)) "Return CONTEXT's program name." (slot-value context 'progname)) -(defun remainder (&key (context *current-context*)) +(defun remainder (&key (context *context*)) "Return CONTEXT's remainder." (slot-value context 'remainder)) -(defun cmdline-options-p (&key (context *current-context*)) +(defun cmdline-options-p (&key (context *context*)) "Return T if CONTEXT has any unprocessed options left." (if (cmdline-options context) t nil)) -(defun cmdline-p (&key (context *current-context*)) +(defun cmdline-p (&key (context *context*)) "Return T if CONTEXT has anything on its command-line." (or (cmdline-options-p :context context) (remainder :context context))) @@ -260,7 +260,7 @@ options based on it.")) ;; option for OUTPUT-STREAM. At the end-user level, you can redirect to a file ;; from the shell. -(defun help (&key (context *current-context*) +(defun help (&key (context *context*) (item (synopsis context)) (output-stream *standard-output*) (search-path (search-path context)) @@ -356,7 +356,7 @@ When such an option exists, return two values: ;; ========================================================================== (defun getopt (&rest keys - &key (context *current-context*) short-name long-name option) + &key (context *context*) short-name long-name option) "Get an option's value in CONTEXT. The option can be specified either by SHORT-NAME, LONG-NAME, or directly via an OPTION object. @@ -401,7 +401,7 @@ Return two values: (slot-boundp option 'default-value)) (values (default-value option) :default))) -(defun getopt-cmdline (&key (context *current-context*)) +(defun getopt-cmdline (&key (context *context*)) "Get the next command-line option in CONTEXT. When there is no next command-line option, return nil. Otherwise, return four values: @@ -422,7 +422,7 @@ Otherwise, return four values: OPTION, NAME and VALUE are bound to the values returned by GETOPT-CMDLINE. BODY is executed only if there is a next command-line option." `(multiple-value-bind (,option ,name ,value ,source) - (getopt-cmdline :context (or ,context *current-context*)) + (getopt-cmdline :context (or ,context *context*)) (when ,option ,@body))) @@ -432,7 +432,7 @@ BODY is executed only if there is a next command-line option." OPTION, NAME and VALUE are bound to each option's object, name used on the command-line and retrieved value." (let ((ctx (gensym "context"))) - `(let ((,ctx (or ,context *current-context*))) + `(let ((,ctx (or ,context *context*))) (do () ((null (cmdline-options ,ctx))) (multiple-value-getopt-cmdline (,option ,name ,value ,source :context ,ctx) @@ -773,7 +773,7 @@ or FITNESS FOR A PARTICULAR PURPOSE.~%" (let ((context (apply #'make-instance 'context (remove-keys keys :make-current)))) (when make-current - (setq *current-context* context)) + (setq *context* context)) context)) @@ -783,8 +783,8 @@ or FITNESS FOR A PARTICULAR PURPOSE.~%" ;; ========================================================================== (defmacro with-context (context &body body) - "Execute BODY with *current-context* bound to CONTEXT." - `(let ((*current-context* ,context)) + "Execute BODY with *context* bound to CONTEXT." + `(let ((*context* ,context)) ,@body)) -- 2.11.4.GIT