diff options
Diffstat (limited to 'module')
-rw-r--r-- | module/ice-9/boot-9.scm | 2 | ||||
-rw-r--r-- | module/ice-9/format.scm | 21 | ||||
-rw-r--r-- | module/ice-9/i18n.scm | 45 | ||||
-rw-r--r-- | module/ice-9/popen.scm | 4 | ||||
-rw-r--r-- | module/ice-9/pretty-print.scm | 2 | ||||
-rw-r--r-- | module/ice-9/r4rs.scm | 10 | ||||
-rw-r--r-- | module/language/tree-il/analyze.scm | 8 | ||||
-rw-r--r-- | module/rnrs/io/ports.scm | 2 | ||||
-rw-r--r-- | module/texinfo/string-utils.scm | 4 | ||||
-rw-r--r-- | module/web/http.scm | 2 | ||||
-rw-r--r-- | module/web/request.scm | 2 | ||||
-rw-r--r-- | module/web/response.scm | 2 |
12 files changed, 64 insertions, 40 deletions
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index 1780b843c..e929c4d58 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -161,7 +161,7 @@ non-locally, that exit determines the continuation." (set! with-throw-handler (lambda (k thunk pre-unwind-handler) "Add @var{handler} to the dynamic context as a throw handler -for key @var{key}, then invoke @var{thunk}." +for key @var{k}, then invoke @var{thunk}." (if (not (or (symbol? k) (eqv? k #t))) (scm-error 'wrong-type-arg "with-throw-handler" "Wrong type argument in position ~a: ~a" diff --git a/module/ice-9/format.scm b/module/ice-9/format.scm index c62348d9f..d038ace5a 100644 --- a/module/ice-9/format.scm +++ b/module/ice-9/format.scm @@ -1,5 +1,5 @@ ;;;; "format.scm" Common LISP text output formatter for SLIB -;;; Copyright (C) 2010, 2011 Free Software Foundation, Inc. +;;; Copyright (C) 2010, 2011, 2012 Free Software Foundation, Inc. ;;; ;;; This library is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU Lesser General Public @@ -31,6 +31,7 @@ (define-module (ice-9 format) #:autoload (ice-9 pretty-print) (pretty-print truncated-print) + #:autoload (ice-9 i18n) (%global-locale number->locale-string) #:replace (format)) (define format:version "3.0") @@ -272,6 +273,24 @@ ((#\D) ; Decimal (format:out-num-padded modifier (next-arg) params 10) (anychar-dispatch)) + ((#\H) ; Localized number + (let* ((num (next-arg)) + (locale (case modifier + ((colon) (next-arg)) + (else %global-locale))) + (argc (length params)) + (width (format:par params argc 0 #f "width")) + (decimals (format:par params argc 1 #t "decimals")) + (padchar (integer->char + (format:par params argc 2 format:space-ch + "padchar"))) + (str (number->locale-string num decimals + locale))) + (format:out-str (if (and width + (< (string-length str) width)) + (string-pad str width padchar) + str))) + (anychar-dispatch)) ((#\X) ; Hexadecimal (format:out-num-padded modifier (next-arg) params 16) (anychar-dispatch)) diff --git a/module/ice-9/i18n.scm b/module/ice-9/i18n.scm index ce04aa304..ca949b4f3 100644 --- a/module/ice-9/i18n.scm +++ b/module/ice-9/i18n.scm @@ -1,6 +1,6 @@ ;;;; i18n.scm --- internationalization support -*- coding: utf-8 -*- -;;;; Copyright (C) 2006, 2007, 2009, 2010 Free Software Foundation, Inc. +;;;; Copyright (C) 2006, 2007, 2009, 2010, 2012 Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -101,13 +101,10 @@ ;;; ;; Helper macro: Define a procedure named NAME that maps its argument to -;; NL-ITEMS (when `nl-langinfo' is provided) or DEFAULTS (when `nl-langinfo' -;; is not provided). -(define-macro (define-vector-langinfo-mapping name nl-items defaults) +;; NL-ITEMS. Gnulib guarantees that these items are available. +(define-macro (define-vector-langinfo-mapping name nl-items) (let* ((item-count (length nl-items)) - (defines (if (provided? 'nl-langinfo) - `(define %nl-items (vector #f ,@nl-items)) - `(define %defaults (vector #f ,@defaults)))) + (defines `(define %nl-items (vector #f ,@nl-items))) (make-body (lambda (result) `(if (and (integer? item) (exact? item)) (if (and (>= item 1) (<= item ,item-count)) @@ -116,28 +113,21 @@ (throw 'wrong-type-arg "wrong argument type" item))))) `(define (,name item . locale) ,defines - ,(make-body (if (provided? 'nl-langinfo) - '(apply nl-langinfo (vector-ref %nl-items item) locale) - '(vector-ref %defaults item)))))) + ,(make-body '(apply nl-langinfo (vector-ref %nl-items item) locale))))) (define-vector-langinfo-mapping locale-day-short - (ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7) - ("Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat")) + (ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7)) (define-vector-langinfo-mapping locale-day - (DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7) - ("Sunday" "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday")) + (DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7)) (define-vector-langinfo-mapping locale-month-short (ABMON_1 ABMON_2 ABMON_3 ABMON_4 ABMON_5 ABMON_6 - ABMON_7 ABMON_8 ABMON_9 ABMON_10 ABMON_11 ABMON_12) - ("Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec")) + ABMON_7 ABMON_8 ABMON_9 ABMON_10 ABMON_11 ABMON_12)) (define-vector-langinfo-mapping locale-month - (MON_1 MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 MON_8 MON_9 MON_10 MON_11 MON_12) - ("January" "February" "March" "April" "May" "June" "July" "August" - "September" "October" "November" "December")) + (MON_1 MON_2 MON_3 MON_4 MON_5 MON_6 MON_7 MON_8 MON_9 MON_10 MON_11 MON_12)) @@ -145,9 +135,13 @@ ;;; Date and time. ;;; -;; Helper macro: Define a procedure NAME that gets langinfo item ITEM. +;; Define a procedure NAME that gets langinfo item ITEM. Gnulib's +;; `nl_langinfo' does not guarantee that all these items are supported +;; (for instance, `GROUPING' is lacking on Darwin and Gnulib provides no +;; replacement), so use DEFAULT as the default value when ITEM is not +;; available. (define-macro (define-simple-langinfo-mapping name item default) - (let ((body (if (and (provided? 'nl-langinfo) (defined? item)) + (let ((body (if (defined? item) `(apply nl-langinfo ,item locale) default))) `(define (,name . locale) @@ -182,13 +176,18 @@ ;;; Monetary information. ;;; +;; Define a procedure NAME that gets item LOCAL-ITEM or INTL-ITEM, +;; depending on whether the caller asked for the international version +;; or not. Since Gnulib's `nl_langinfo' module doesn't guarantee that +;; all these items are available, use DEFAULT/LOCAL and DEFAULT/INTL as +;; default values when the system does not support them. (define-macro (define-monetary-langinfo-mapping name local-item intl-item default/local default/intl) (let ((body - (let ((intl (if (and (provided? 'nl-langinfo) (defined? intl-item)) + (let ((intl (if (defined? intl-item) `(apply nl-langinfo ,intl-item locale) default/intl)) - (local (if (and (provided? 'nl-langinfo) (defined? local-item)) + (local (if (defined? local-item) `(apply nl-langinfo ,local-item locale) default/local))) `(if intl? ,intl ,local)))) diff --git a/module/ice-9/popen.scm b/module/ice-9/popen.scm index b3def4a1e..b9debd444 100644 --- a/module/ice-9/popen.scm +++ b/module/ice-9/popen.scm @@ -136,7 +136,7 @@ "Executes the program @var{command} with optional arguments @var{args} (all strings) in a subprocess. A port to the process (based on pipes) is created and returned. -@var{modes} specifies whether an input, an output or an input-output +@var{mode} specifies whether an input, an output or an input-output port to the process is created: it should be the value of @code{OPEN_READ}, @code{OPEN_WRITE} or @code{OPEN_BOTH}." (let* ((port/pid (apply open-process mode command args)) @@ -148,7 +148,7 @@ port to the process is created: it should be the value of (define (open-pipe command mode) "Executes the shell command @var{command} (a string) in a subprocess. A port to the process (based on pipes) is created and returned. -@var{modes} specifies whether an input, an output or an input-output +@var{mode} specifies whether an input, an output or an input-output port to the process is created: it should be the value of @code{OPEN_READ}, @code{OPEN_WRITE} or @code{OPEN_BOTH}." (open-pipe* mode "/bin/sh" "-c" command)) diff --git a/module/ice-9/pretty-print.scm b/module/ice-9/pretty-print.scm index 5ea66c7e5..8a0c0b855 100644 --- a/module/ice-9/pretty-print.scm +++ b/module/ice-9/pretty-print.scm @@ -298,7 +298,7 @@ port directly after OBJ, like (pretty-print OBJ PORT)." (width 79) (display? #f) (breadth-first? #f)) - "Print @var{obj}, truncating the output, if necessary, to make it fit + "Print @var{x}, truncating the output, if necessary, to make it fit into @var{width} characters. By default, @var{x} will be printed using @code{write}, though that behavior can be overriden via the @var{display?} keyword argument. diff --git a/module/ice-9/r4rs.scm b/module/ice-9/r4rs.scm index 86b6e9454..072c8c6b4 100644 --- a/module/ice-9/r4rs.scm +++ b/module/ice-9/r4rs.scm @@ -39,14 +39,14 @@ (@call-with-values producer consumer)) (define (dynamic-wind in thunk out) "All three arguments must be 0-argument procedures. -@var{in_guard} is called, then @var{thunk}, then -@var{out_guard}. +Guard @var{in} is called, then @var{thunk}, then +guard @var{out}. If, any time during the execution of @var{thunk}, the continuation of the @code{dynamic_wind} expression is escaped -non-locally, @var{out_guard} is called. If the continuation of -the dynamic-wind is re-entered, @var{in_guard} is called. Thus -@var{in_guard} and @var{out_guard} may be called any number of +non-locally, @var{out} is called. If the continuation of +the dynamic-wind is re-entered, @var{in} is called. Thus +@var{in} and @var{out} may be called any number of times. @lisp (define x 'normal-binding) diff --git a/module/language/tree-il/analyze.scm b/module/language/tree-il/analyze.scm index 04687a8c9..28312514a 100644 --- a/module/language/tree-il/analyze.scm +++ b/module/language/tree-il/analyze.scm @@ -1,6 +1,6 @@ ;;; TREE-IL -> GLIL compiler -;; Copyright (C) 2001, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +;; Copyright (C) 2001, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. ;;;; This library is free software; you can redistribute it and/or ;;;; modify it under the terms of the GNU Lesser General Public @@ -1334,6 +1334,12 @@ accurate information is missing from a given `tree-il' element." ;; We don't have enough info to determine the exact number ;; of args, but we could determine a lower bound (TODO). (values 'any 'any)) + ((#\h #\H) + (let ((argc (if (memq #\: params) 2 1))) + (loop (cdr chars) 'literal '() + conditions end-group + (+ argc min-count) + (+ argc max-count)))) (else (loop (cdr chars) 'literal '() conditions end-group (+ 1 min-count) (+ 1 max-count))))) diff --git a/module/rnrs/io/ports.scm b/module/rnrs/io/ports.scm index 246e46b39..fddb4914b 100644 --- a/module/rnrs/io/ports.scm +++ b/module/rnrs/io/ports.scm @@ -237,7 +237,7 @@ if the port has no transcoder." (not (port-encoding port))) (define (textual-port? port) - "Always returns @var{#t}, as all ports can be used for textual I/O in + "Always returns @code{#t}, as all ports can be used for textual I/O in Guile." #t) diff --git a/module/texinfo/string-utils.scm b/module/texinfo/string-utils.scm index eff914369..767514952 100644 --- a/module/texinfo/string-utils.scm +++ b/module/texinfo/string-utils.scm @@ -160,7 +160,7 @@ characters. Any needed padding is done by character @var{chr}, which defaults to @samp{#\\space}. If @var{rchr} is provided, then the padding to the right will use it instead. See the examples below. left and @var{rchr} on the right. The default @var{width} is 80. The -default @var{lchr} and @var{rchr} is @samp{#\\space}. The string is +default @var{chr} and @var{rchr} is @samp{#\\space}. The string is never truncated. @lisp (center-string \"Richard Todd\" 24) @@ -392,7 +392,7 @@ in @code{make-text-wrapper}." (define (fill-string str . kwargs) "Wraps the text given in string @var{str} according to the parameters -provided in @var{keywds}, or the default setting if they are not +provided in @var{kwargs}, or the default setting if they are not given. Returns a single string with the wrapped text. Valid keyword arguments are discussed in @code{make-text-wrapper}." (string-join (apply string->wrapped-lines str kwargs) diff --git a/module/web/http.scm b/module/web/http.scm index b060af91e..c15bc3ed7 100644 --- a/module/web/http.scm +++ b/module/web/http.scm @@ -205,7 +205,7 @@ header with name @var{sym}." (define (write-header sym val port) "Writes the given header name and value to @var{port}. If @var{sym} is a known header, uses the specific writer registered for that header. -Otherwise the value is written using @var{display}." +Otherwise the value is written using @code{display}." (display (header->string sym) port) (display ": " port) ((header-writer sym) val port) diff --git a/module/web/request.scm b/module/web/request.scm index c9204a4bf..8259887c0 100644 --- a/module/web/request.scm +++ b/module/web/request.scm @@ -217,7 +217,7 @@ on @var{port}, perhaps using some transfer encoding." (bytevector-length bv) nbytes)))))) (define (write-request-body r bv) - "Write @var{body}, a bytevector, to the port corresponding to the HTTP + "Write @var{bv}, a bytevector, to the port corresponding to the HTTP request @var{r}." (put-bytevector (request-port r) bv)) diff --git a/module/web/response.scm b/module/web/response.scm index 62837721c..f49a602f0 100644 --- a/module/web/response.scm +++ b/module/web/response.scm @@ -226,7 +226,7 @@ on @var{port}, perhaps using some transfer encoding." (bytevector-length bv) nbytes)))))) (define (write-response-body r bv) - "Write @var{body}, a bytevector, to the port corresponding to the HTTP + "Write @var{bv}, a bytevector, to the port corresponding to the HTTP response @var{r}." (put-bytevector (response-port r) bv)) |