unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* [PATCH] Document R7RS bytevector functions
@ 2023-01-13 18:05 lloda
  2023-01-14 14:56 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: lloda @ 2023-01-13 18:05 UTC (permalink / raw)
  To: guile-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 394 bytes --]

Hi

Right now the manual just mentions (scheme base), but not the contents. This patch at least makes sure that at least the bytevector-related R7RS functions appear in the index.

The patch documents a first group of purely bytevector functions and a second group of binary I/O that are not elsewhere in Guile/R6RS or that exist but have different definitions.

Regards

  Daniel



[-- Attachment #2: 0001-Document-R7RS-functions-related-to-bytevectors.patch --]
[-- Type: application/octet-stream, Size: 45325 bytes --]

From 2b751615071aca023dac59db866fb09894fa2b57 Mon Sep 17 00:00:00 2001
From: Daniel Llorens <lloda@sarc.name>
Date: Fri, 13 Jan 2023 16:26:17 +0100
Subject: [PATCH] Document R7RS functions related to bytevectors

* doc/ref/api-data.texi: Document: bytevector bytevector-copy
  bytevector-copy! bytevector-append
  (r6:bytevector-copy): Index need not be positive (can be 0).
* doc/ref/api-io.texi: Document: open-output-bytevector write-u8 read-u8 peek-u8
  get-output-bytevector open-input-bytevector read-bytevector! read-bytevector
  write-bytevector
---
 doc/ref/api-data.texi    | 102 ++++++++++++++++++++++++++++++---
 doc/ref/api-io.texi      | 121 +++++++++++++++++++++++++++++++++++++++
 lib/iconv_open-aix.h     |  68 +++++++++++-----------
 lib/iconv_open-hpux.h    |  92 ++++++++++++++---------------
 lib/iconv_open-irix.h    |  42 +++++++-------
 lib/iconv_open-osf.h     |  80 +++++++++++++-------------
 lib/iconv_open-solaris.h |  30 +++++-----
 7 files changed, 372 insertions(+), 163 deletions(-)

diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 30190f315..9c07e5e68 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -6188,9 +6188,9 @@ thus created is determined implicitly by the number of arguments given.
 Return a newly allocated vector composed of the
 given arguments.  Analogous to @code{list}.
 
-@lisp
+@example
 (vector 'a 'b 'c) @result{} #(a b c)
-@end lisp
+@end example
 @end deffn
 
 The inverse operation is @code{vector->list}:
@@ -6329,7 +6329,7 @@ in the range [@var{start} ... @var{end}). @var{start} defaults to 0 and
 @deffn {Scheme Procedure} vector-copy! dst at src [start [end]]
 Copy the block of elements from vector @var{src} in the range
 [@var{start} ... @var{end}) into vector @var{dst}, starting at position
-@var{at}. @var{at} and @var{start} default to 0 and @var{end} defaults
+@var{at}. @var{start} defaults to 0 and @var{end} defaults
 to the length of @var{src}.
 
 It is an error for @var{dst} to have a length less than @var{at} +
@@ -6635,7 +6635,7 @@ and writing.
 @cindex bytevector
 @cindex R6RS
 
-A @dfn{bytevector} is a raw bit string.  The @code{(rnrs bytevectors)}
+A @dfn{bytevector} is a raw byte string.  The @code{(rnrs bytevectors)}
 module provides the programming interface specified by the
 @uref{http://www.r6rs.org/, Revised^6 Report on the Algorithmic Language
 Scheme (R6RS)}.  It contains procedures to manipulate bytevectors and
@@ -6664,6 +6664,10 @@ they do not need to be quoted:
 Bytevectors can be used with the binary input/output primitives
 (@pxref{Binary I/O}).
 
+@ref{R7RS Support,R7RS} defines another set of bytevector functions in
+the module @code{(scheme base)}. These functions are also described in this
+section.
+
 @menu
 * Bytevector Endianness::       Dealing with byte order.
 * Bytevector Manipulation::     Creating, copying, manipulating bytevectors.
@@ -6726,9 +6730,10 @@ procedures and C functions.
 @deffnx {C Function} scm_c_make_bytevector (size_t len)
 Return a new bytevector of @var{len} bytes.  Optionally, if @var{fill}
 is given, fill it with @var{fill}; @var{fill} must be in the range
-[-128,255].
+[-128,255].@footnote{This function is defined both by R6RS in @code{(rnrs bytevectors)} and by @ref{R7RS Standard Libraries,R7RS} in @code{(scheme base)}.}.
 @end deffn
 
+@anchor{x-bytevector?}
 @deffn {Scheme Procedure} bytevector? obj
 @deffnx {C Function} scm_bytevector_p (obj)
 Return true if @var{obj} is a bytevector.
@@ -6757,26 +6762,32 @@ length and contents.
 @deffnx {C Function} scm_bytevector_fill_x (bv, fill)
 Fill positions [@var{start} ... @var{end}) of bytevector @var{bv} with
 byte @var{fill}. @var{start} defaults to 0 and @var{end} defaults to the
-length of @var{bv}.@footnote{R6RS defines @code{(bytevector-fill! bv
+length of @var{bv}.@footnote{R6RS only defines @code{(bytevector-fill! bv
 fill)}. Arguments @var{start} and @var{end} are a Guile extension
 (cf. @ref{x-vector-fill!,@code{vector-fill!}},
 @ref{x-string-fill!,@code{string-fill!}}).}
 @end deffn
 
+@anchor{x-r6:bytevector-copy!}
 @deffn {Scheme Procedure} bytevector-copy! source source-start target target-start len
 @deffnx {C Function} scm_bytevector_copy_x (source, source_start, target, target_start, len)
 Copy @var{len} bytes from @var{source} into @var{target}, starting
-reading from @var{source-start} (a positive index within @var{source})
+reading from @var{source-start} (an index index within @var{source})
 and writing at @var{target-start}.
 
 It is permitted for the @var{source} and @var{target} regions to
 overlap. In that case, copying takes place as if the source is first
 copied into a temporary bytevector and then into the destination.
+
+See also @ref{x-r7:bytevector-copy!,the R7RS version}.
 @end deffn
 
+@anchor{x-r6:bytevector-copy}
 @deffn {Scheme Procedure} bytevector-copy bv
 @deffnx {C Function} scm_bytevector_copy (bv)
 Return a newly allocated copy of @var{bv}.
+
+See also @ref{x-r7:bytevector-copy,the R7RS version}.
 @end deffn
 
 @deftypefn {C Function} scm_t_uint8 scm_c_bytevector_ref (SCM bv, size_t index)
@@ -6798,6 +6809,79 @@ Return the length in bytes of bytevector @var{bv}.
 Return a pointer to the contents of bytevector @var{bv}.
 @end deftypefn
 
+@subsubheading Bytevector functions in R7RS
+
+The following binary I/O functions defined in @code{(scheme base)}
+from the @ref{R7RS Standard Libraries} are not available in R6RS, or
+have different definitions in R7RS. Access these routines with
+
+@example
+(use-modules (scheme base))
+@end example
+
+@deffn {Scheme Procedure} bytevector arg @dots{}
+Return a newly allocated bytevector composed of the given arguments.
+Analogous to @code{list}.
+
+@lisp
+(bytevector 2 3 4) @result{} #vu8(2 3 4)
+@end lisp
+
+See also @ref{x-u8-list->bytevector,@code{u8-list->bytevector}}.
+@end deffn
+
+@anchor{x-r7:bytevector-copy}
+@deffn {Scheme Procedure} bytevector-copy bv [start [end]]
+Returns a newly allocated bytevector containing the elements of @var{bv}
+in the range [@var{start} ... @var{end}). @var{start} defaults to 0 and
+@var{end} defaults to the length of @var{bv}.
+
+@example
+(define bv #vu8(0 1 2 3 4 5))
+(bytevector-copy bv) @result{} #vu8(0 1 2 3 4 5)
+(bytevector-copy bv 2) @result{} #vu8(2 3 4 5)
+(bytevector-copy bv 2 4) @result{} #vu8(2 3)
+@end example
+
+See also @ref{x-r6:bytevector-copy,the R6RS version}.
+@end deffn
+
+@anchor{x-r7:bytevector-copy!}
+@deffn {Scheme Procedure} bytevector-copy! dst at src [start [end]]
+Copy the block of elements from bytevector @var{src} in the range
+[@var{start} ... @var{end}) into bytevector @var{dst}, starting at
+position @var{at}. @var{start} defaults to 0 and @var{end} defaults to
+the length of @var{src}. It is an error for @var{dst}
+to have a length less than @var{at} + (@var{end} - @var{start}).
+
+See also @ref{x-r6:bytevector-copy!,the R6RS version}. With
+
+@example
+(use-modules ((rnrs bytevectors) #:prefix r6:)
+             ((scheme base) #:prefix r7:))
+@end example
+
+the following calls are equivalent:
+
+@example
+(r6:bytevector-copy! source source-start target target-start len)
+(r7:bytevector-copy! target target-start source source-start (+ source-start len))
+@end example
+
+@end deffn
+
+@rnindex bytevector-append
+@deffn {Scheme Procedure} bytevector-append arg @dots{}
+Return a newly allocated bytevector whose characters form the
+concatenation of the given bytevectors @var{arg} @enddots{}
+
+@example
+(bytevector-append #vu8(0 1 2) #vu8(3 4 5))
+@result{} #vu8(0 1 2 3 4 5)
+@end example
+@end deffn
+
+
 
 @node Bytevectors as Integers
 @subsubsection Interpreting Bytevector Contents as Integers
@@ -6851,6 +6935,7 @@ Set the @var{size}-byte long signed integer at @var{index} to
 The following procedures are similar to the ones above, but specialized
 to a given integer size:
 
+@anchor{x-bytevector-u8-ref}
 @deffn {Scheme Procedure} bytevector-u8-ref bv index
 @deffnx {Scheme Procedure} bytevector-s8-ref bv index
 @deffnx {Scheme Procedure} bytevector-u16-ref bv index endianness
@@ -6872,6 +6957,7 @@ Return the unsigned @var{n}-bit (signed) integer (where @var{n} is 8,
 @var{endianness}.
 @end deffn
 
+@anchor{x-bytevector-u8-set!}
 @deffn {Scheme Procedure} bytevector-u8-set! bv index value
 @deffnx {Scheme Procedure} bytevector-s8-set! bv index value
 @deffnx {Scheme Procedure} bytevector-u16-set! bv index value endianness
@@ -6893,6 +6979,7 @@ Store @var{value} as an @var{n}-bit (signed) integer (where @var{n} is
 @var{endianness}.
 @end deffn
 
+
 Finally, a variant specialized for the host's endianness is available
 for each of these functions (with the exception of the @code{u8} and
 @code{s8} accessors, as endianness is about byte order and there is only
@@ -6951,6 +7038,7 @@ Return a newly allocated list of unsigned 8-bit integers from the
 contents of @var{bv}.
 @end deffn
 
+@anchor{x-u8-list->bytevector}
 @deffn {Scheme Procedure} u8-list->bytevector lst
 @deffnx {C Function} scm_u8_list_to_bytevector (lst)
 Return a newly allocated bytevector consisting of the unsigned 8-bit
diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi
index a0be2dd57..5eb22bc41 100644
--- a/doc/ref/api-io.texi
+++ b/doc/ref/api-io.texi
@@ -150,12 +150,14 @@ some different kind of port, that's not the case: all ports in Guile are
 both binary and textual ports.
 
 @cindex binary input
+@anchor{x-get-u8}
 @deffn {Scheme Procedure} get-u8 port
 @deffnx {C Function} scm_get_u8 (port)
 Return an octet read from @var{port}, an input port, blocking as
 necessary, or the end-of-file object.
 @end deffn
 
+@anchor{x-lookahead-u8}
 @deffn {Scheme Procedure} lookahead-u8 port
 @deffnx {C Function} scm_lookahead_u8 (port)
 Like @code{get-u8} but does not update @var{port}'s position to point
@@ -227,6 +229,7 @@ will be read again in last-in first-out order.
 To perform binary output on a port, use @code{put-u8} or
 @code{put-bytevector}.
 
+@anchor{x-put-u8}
 @deffn {Scheme Procedure} put-u8 port octet
 @deffnx {C Function} scm_put_u8 (port, octet)
 Write @var{octet}, an integer in the 0--255 range, to @var{port}, a
@@ -239,6 +242,124 @@ Write the contents of @var{bv} to @var{port}, optionally starting at
 index @var{start} and limiting to @var{count} octets.
 @end deffn
 
+@subsubheading Binary I/O in R7RS
+
+The following binary I/O functions are defined in @code{(scheme base)} from the @ref{R7RS Standard
+Libraries}. To access these routines, use
+
+@example
+(use-modules (scheme base))
+@end example
+
+@anchor{x-open-output-bytevector}
+@deffn {Scheme Procedure} open-output-bytevector
+Returns a binary output port that will accumulate bytes
+for retrieval by @ref{x-get-output-bytevector,@code{get-output-bytevector}}.
+@end deffn
+
+@deffn {Scheme Procedure} write-u8 byte [out]
+Writes @var{byte} to the given binary output port @var{out} and returns
+an unspecified value. @var{out} defaults to @code{(current-output-port)}.
+
+See also @ref{x-put-u8,@code{put-u8}}.
+@end deffn
+
+@deffn {Scheme Procedure} read-u8 [in]
+Returns the next byte available from the binary input port @var{in},
+updating the port to point to the following byte. If no more bytes are
+available, an end-of-file object is returned. @var{in} defaults to
+@code{(current-input-port)}.
+
+See also @ref{x-get-u8,@code{get-u8}}.
+@end deffn
+
+@deffn {Scheme Procedure} peek-u8 [in]
+Returns the next byte available from the binary input port @var{in},
+but without updating the port to point to the following
+byte. If no more bytes are available, an end-of-file object
+is returned. @var{in} defaults to @code{(current-input-port)}.
+
+See also @ref{x-lookahead-u8,@code{lookahead-u8}}.
+@end deffn
+
+@anchor{x-get-output-bytevector}
+@deffn {Scheme Procedure} get-output-bytevector port
+Returns a bytevector consisting of the bytes that have been output to
+@var{port} so far in the order they were output. It is an error if
+@var{port} was not created with
+@ref{x-open-output-bytevector,@code{open-output-bytevector}}.
+
+@example
+(define out (open-output-bytevector))
+(write-u8 1 out)
+(write-u8 2 out)
+(write-u8 3 out)
+(get-output-bytevector out) @result{} #vu8(1 2 3)
+@end example
+@end deffn
+
+@deffn {Scheme Procedure} open-input-bytevector bv
+Takes a bytevector @var{bv} and returns a binary input port that
+delivers bytes from @var{bv}.
+
+@example
+(define in (open-input-bytevector #vu8(1 2 3)))
+(read-u8 in) @result{} 1
+(peek-u8 in) @result{} 2
+(read-u8 in) @result{} 2
+(read-u8 in) @result{} 3
+(read-u8 in) @result{} #<eof>
+@end example
+@end deffn
+
+@deffn {Scheme Procedure} read-bytevector! bv [port [start [end]]]
+Reads the next @var{end} - @var{start} bytes, or as many as are
+available before the end of file, from the binary input port into the
+bytevector @var{bv} in left-to-right order beginning at the @var{start}
+position.  If @var{end} is not supplied, reads until the end of @var{bv}
+has been reached.  If @var{start} is not supplied, reads beginning at
+position 0.
+
+Returns the number of bytes read.  If no bytes are available, an
+end-of-file object is returned.
+
+@example
+(define in (open-input-bytevector #vu8(1 2 3)))
+(define bv (make-bytevector 5 0))
+(read-bytevector! bv in 1 3) @result{} 2
+bv @result{} #vu8(0 1 2 0 0 0)
+@end example
+
+@end deffn
+
+@deffn {Scheme Procedure} read-bytevector k in
+Reads the next @var{k} bytes, or as many as are available before the end
+of file if that is less than @var{k}, from the binary input port
+@var{in} into a newly allocated bytevector in left-to-right order, and
+returns the bytevector. If no bytes are available before the end of
+file, an end-of-file object is returned.
+
+@example
+(define bv #vu8(1 2 3))
+(read-bytevector 2 (open-input-bytevector bv)) @result{} #vu8(1 2)
+(read-bytevector 10 (open-input-bytevector bv)) @result{} #vu8(1 2 3)
+@end example
+
+@end deffn
+
+@deffn {Scheme Procedure} write-bytevector bv [port [start [end]]]
+Writes the bytes of bytevector @var{bv} from @var{start} to @var{end} in
+left-to-right order to the binary output @var{port}. @var{start}
+defaults to 0 and @var{end} defaults to the length of @var{bv}.
+
+@example
+(define out (open-output-bytevector))
+(write-bytevector #vu8(0 1 2 3 4) out 2 4)
+(get-output-bytevector out) @result{} #vu8(2 3)
+@end example
+
+@end deffn
+
 @node Encoding
 @subsection Encoding
 
diff --git a/lib/iconv_open-aix.h b/lib/iconv_open-aix.h
index 85ed7674b..fc08dc0fa 100644
--- a/lib/iconv_open-aix.h
+++ b/lib/iconv_open-aix.h
@@ -1,5 +1,5 @@
 /* ANSI-C code produced by gperf version 3.1 */
-/* Command-line: gperf -m 10 ./iconv_open-aix.gperf  */
+/* Command-line: gperf -m 10 ../../../src/guile3/lib/iconv_open-aix.gperf  */
 /* Computed positions: -k'4,$' */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -29,7 +29,7 @@
 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
 #endif
 
-#line 17 "./iconv_open-aix.gperf"
+#line 17 "../../../src/guile3/lib/iconv_open-aix.gperf"
 struct mapping { int standard_name; const char vendor_name[10 + 1]; };
 
 #define TOTAL_KEYWORDS 32
@@ -156,74 +156,74 @@ static const struct stringpool_t stringpool_contents =
 static const struct mapping mappings[] =
   {
     {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 59 "./iconv_open-aix.gperf"
+#line 59 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "IBM-eucTW"},
-#line 58 "./iconv_open-aix.gperf"
+#line 58 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, "IBM-eucKR"},
-#line 41 "./iconv_open-aix.gperf"
+#line 41 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, "IBM-852"},
-#line 57 "./iconv_open-aix.gperf"
+#line 57 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, "IBM-eucJP"},
-#line 30 "./iconv_open-aix.gperf"
+#line 30 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-2"},
-#line 43 "./iconv_open-aix.gperf"
+#line 43 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "IBM-857"},
-#line 40 "./iconv_open-aix.gperf"
+#line 40 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "IBM-850"},
-#line 35 "./iconv_open-aix.gperf"
+#line 35 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-7"},
-#line 49 "./iconv_open-aix.gperf"
+#line 49 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "IBM-932"},
-#line 56 "./iconv_open-aix.gperf"
+#line 56 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "IBM-eucCN"},
-#line 60 "./iconv_open-aix.gperf"
+#line 60 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "big5"},
-#line 39 "./iconv_open-aix.gperf"
+#line 39 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "IBM-437"},
     {-1},
-#line 33 "./iconv_open-aix.gperf"
+#line 33 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-5"},
-#line 38 "./iconv_open-aix.gperf"
+#line 38 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, "ISO8859-15"},
-#line 31 "./iconv_open-aix.gperf"
+#line 31 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, "ISO8859-3"},
-#line 47 "./iconv_open-aix.gperf"
+#line 47 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, "IBM-921"},
-#line 51 "./iconv_open-aix.gperf"
+#line 51 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, "IBM-1046"},
-#line 36 "./iconv_open-aix.gperf"
+#line 36 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str24, "ISO8859-8"},
-#line 42 "./iconv_open-aix.gperf"
+#line 42 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25, "IBM-856"},
-#line 53 "./iconv_open-aix.gperf"
+#line 53 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, "IBM-1125"},
-#line 34 "./iconv_open-aix.gperf"
+#line 34 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, "ISO8859-6"},
-#line 45 "./iconv_open-aix.gperf"
+#line 45 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str28, "IBM-865"},
-#line 48 "./iconv_open-aix.gperf"
+#line 48 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, "IBM-922"},
-#line 55 "./iconv_open-aix.gperf"
+#line 55 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, "IBM-1252"},
-#line 37 "./iconv_open-aix.gperf"
+#line 37 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, "ISO8859-9"},
     {-1},
-#line 50 "./iconv_open-aix.gperf"
+#line 50 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, "IBM-943"},
-#line 32 "./iconv_open-aix.gperf"
+#line 32 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34, "ISO8859-4"},
-#line 29 "./iconv_open-aix.gperf"
+#line 29 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, "ISO8859-1"},
     {-1}, {-1},
-#line 54 "./iconv_open-aix.gperf"
+#line 54 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, "IBM-1129"},
     {-1},
-#line 46 "./iconv_open-aix.gperf"
+#line 46 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str40, "IBM-869"},
-#line 52 "./iconv_open-aix.gperf"
+#line 52 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41, "IBM-1124"},
     {-1}, {-1},
-#line 44 "./iconv_open-aix.gperf"
+#line 44 "../../../src/guile3/lib/iconv_open-aix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str44, "IBM-861"}
   };
 
diff --git a/lib/iconv_open-hpux.h b/lib/iconv_open-hpux.h
index fe3c28932..5f69a13c4 100644
--- a/lib/iconv_open-hpux.h
+++ b/lib/iconv_open-hpux.h
@@ -1,5 +1,5 @@
 /* ANSI-C code produced by gperf version 3.1 */
-/* Command-line: gperf -m 10 ./iconv_open-hpux.gperf  */
+/* Command-line: gperf -m 10 ../../../src/guile3/lib/iconv_open-hpux.gperf  */
 /* Computed positions: -k'4,$' */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -29,7 +29,7 @@
 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
 #endif
 
-#line 17 "./iconv_open-hpux.gperf"
+#line 17 "../../../src/guile3/lib/iconv_open-hpux.gperf"
 struct mapping { int standard_name; const char vendor_name[9 + 1]; };
 
 #define TOTAL_KEYWORDS 44
@@ -180,93 +180,93 @@ static const struct stringpool_t stringpool_contents =
 static const struct mapping mappings[] =
   {
     {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 56 "./iconv_open-hpux.gperf"
+#line 56 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "cp1256"},
-#line 50 "./iconv_open-hpux.gperf"
+#line 50 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, "cp1250"},
-#line 51 "./iconv_open-hpux.gperf"
+#line 51 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, "cp1251"},
-#line 39 "./iconv_open-hpux.gperf"
+#line 39 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, "cp850"},
-#line 65 "./iconv_open-hpux.gperf"
+#line 65 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "tis620"},
-#line 54 "./iconv_open-hpux.gperf"
+#line 54 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "cp1254"},
-#line 32 "./iconv_open-hpux.gperf"
+#line 32 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "iso88596"},
-#line 69 "./iconv_open-hpux.gperf"
+#line 69 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "eucTW"},
-#line 29 "./iconv_open-hpux.gperf"
+#line 29 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "iso88591"},
-#line 35 "./iconv_open-hpux.gperf"
+#line 35 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "iso88599"},
-#line 55 "./iconv_open-hpux.gperf"
+#line 55 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "cp1255"},
-#line 70 "./iconv_open-hpux.gperf"
+#line 70 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "big5"},
-#line 41 "./iconv_open-hpux.gperf"
+#line 41 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "cp855"},
-#line 57 "./iconv_open-hpux.gperf"
+#line 57 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "cp1257"},
-#line 68 "./iconv_open-hpux.gperf"
+#line 68 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, "eucKR"},
-#line 42 "./iconv_open-hpux.gperf"
+#line 42 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, "cp857"},
-#line 31 "./iconv_open-hpux.gperf"
+#line 31 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, "iso88595"},
-#line 36 "./iconv_open-hpux.gperf"
+#line 36 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, "iso885915"},
-#line 47 "./iconv_open-hpux.gperf"
+#line 47 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str24, "cp866"},
-#line 33 "./iconv_open-hpux.gperf"
+#line 33 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25, "iso88597"},
-#line 43 "./iconv_open-hpux.gperf"
+#line 43 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, "cp861"},
-#line 48 "./iconv_open-hpux.gperf"
+#line 48 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, "cp869"},
-#line 49 "./iconv_open-hpux.gperf"
+#line 49 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str28, "cp874"},
-#line 45 "./iconv_open-hpux.gperf"
+#line 45 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, "cp864"},
-#line 52 "./iconv_open-hpux.gperf"
+#line 52 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, "cp1252"},
-#line 37 "./iconv_open-hpux.gperf"
+#line 37 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, "cp437"},
-#line 40 "./iconv_open-hpux.gperf"
+#line 40 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str32, "cp852"},
-#line 38 "./iconv_open-hpux.gperf"
+#line 38 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, "cp775"},
-#line 46 "./iconv_open-hpux.gperf"
+#line 46 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34, "cp865"},
-#line 67 "./iconv_open-hpux.gperf"
+#line 67 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, "eucJP"},
-#line 30 "./iconv_open-hpux.gperf"
+#line 30 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str36, "iso88592"},
-#line 71 "./iconv_open-hpux.gperf"
+#line 71 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str37, "sjis"},
-#line 58 "./iconv_open-hpux.gperf"
+#line 58 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, "cp1258"},
-#line 72 "./iconv_open-hpux.gperf"
+#line 72 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str39, "utf8"},
-#line 64 "./iconv_open-hpux.gperf"
+#line 64 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str40, "kana8"},
-#line 59 "./iconv_open-hpux.gperf"
+#line 59 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41, "roman8"},
-#line 62 "./iconv_open-hpux.gperf"
+#line 62 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str42, "hebrew8"},
-#line 66 "./iconv_open-hpux.gperf"
+#line 66 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str43, "hp15CN"},
-#line 34 "./iconv_open-hpux.gperf"
+#line 34 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str44, "iso88598"},
-#line 63 "./iconv_open-hpux.gperf"
+#line 63 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str45, "turkish8"},
-#line 61 "./iconv_open-hpux.gperf"
+#line 61 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str46, "greek8"},
-#line 60 "./iconv_open-hpux.gperf"
+#line 60 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str47, "arabic8"},
-#line 44 "./iconv_open-hpux.gperf"
+#line 44 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str48, "cp862"},
-#line 53 "./iconv_open-hpux.gperf"
+#line 53 "../../../src/guile3/lib/iconv_open-hpux.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str49, "cp1253"}
   };
 
diff --git a/lib/iconv_open-irix.h b/lib/iconv_open-irix.h
index 9eec04570..3152e084c 100644
--- a/lib/iconv_open-irix.h
+++ b/lib/iconv_open-irix.h
@@ -1,5 +1,5 @@
 /* ANSI-C code produced by gperf version 3.1 */
-/* Command-line: gperf -m 10 ./iconv_open-irix.gperf  */
+/* Command-line: gperf -m 10 ../../../src/guile3/lib/iconv_open-irix.gperf  */
 /* Computed positions: -k'1,$' */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -29,7 +29,7 @@
 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
 #endif
 
-#line 17 "./iconv_open-irix.gperf"
+#line 17 "../../../src/guile3/lib/iconv_open-irix.gperf"
 struct mapping { int standard_name; const char vendor_name[10 + 1]; };
 
 #define TOTAL_KEYWORDS 19
@@ -130,43 +130,43 @@ static const struct stringpool_t stringpool_contents =
 static const struct mapping mappings[] =
   {
     {-1}, {-1}, {-1}, {-1}, {-1},
-#line 40 "./iconv_open-irix.gperf"
+#line 40 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str5, "DOS855"},
-#line 45 "./iconv_open-irix.gperf"
+#line 45 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "eucTW"},
-#line 44 "./iconv_open-irix.gperf"
+#line 44 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, "eucKR"},
-#line 41 "./iconv_open-irix.gperf"
+#line 41 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, "WIN1251"},
-#line 46 "./iconv_open-irix.gperf"
+#line 46 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, "sjis"},
-#line 33 "./iconv_open-irix.gperf"
+#line 33 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-5"},
-#line 38 "./iconv_open-irix.gperf"
+#line 38 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "ISO8859-15"},
-#line 29 "./iconv_open-irix.gperf"
+#line 29 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-1"},
-#line 43 "./iconv_open-irix.gperf"
+#line 43 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "eucJP"},
-#line 39 "./iconv_open-irix.gperf"
+#line 39 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "KOI8"},
-#line 30 "./iconv_open-irix.gperf"
+#line 30 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "ISO8859-2"},
-#line 42 "./iconv_open-irix.gperf"
+#line 42 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "eucCN"},
-#line 37 "./iconv_open-irix.gperf"
+#line 37 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "ISO8859-9"},
-#line 36 "./iconv_open-irix.gperf"
+#line 36 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "ISO8859-8"},
-#line 35 "./iconv_open-irix.gperf"
+#line 35 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-7"},
-#line 34 "./iconv_open-irix.gperf"
+#line 34 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, "ISO8859-6"},
-#line 32 "./iconv_open-irix.gperf"
+#line 32 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, "ISO8859-4"},
-#line 31 "./iconv_open-irix.gperf"
+#line 31 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, "ISO8859-3"},
-#line 47 "./iconv_open-irix.gperf"
+#line 47 "../../../src/guile3/lib/iconv_open-irix.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, "TIS620"}
   };
 
diff --git a/lib/iconv_open-osf.h b/lib/iconv_open-osf.h
index cf23c0832..594388cce 100644
--- a/lib/iconv_open-osf.h
+++ b/lib/iconv_open-osf.h
@@ -1,5 +1,5 @@
 /* ANSI-C code produced by gperf version 3.1 */
-/* Command-line: gperf -m 10 ./iconv_open-osf.gperf  */
+/* Command-line: gperf -m 10 ../../../src/guile3/lib/iconv_open-osf.gperf  */
 /* Computed positions: -k'4,$' */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -29,7 +29,7 @@
 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
 #endif
 
-#line 17 "./iconv_open-osf.gperf"
+#line 17 "../../../src/guile3/lib/iconv_open-osf.gperf"
 struct mapping { int standard_name; const char vendor_name[10 + 1]; };
 
 #define TOTAL_KEYWORDS 38
@@ -168,84 +168,84 @@ static const struct stringpool_t stringpool_contents =
 static const struct mapping mappings[] =
   {
     {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-#line 57 "./iconv_open-osf.gperf"
+#line 57 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "cp1255"},
-#line 40 "./iconv_open-osf.gperf"
+#line 40 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7, "cp775"},
-#line 52 "./iconv_open-osf.gperf"
+#line 52 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str8, "cp1250"},
-#line 63 "./iconv_open-osf.gperf"
+#line 63 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str9, "eucTW"},
-#line 62 "./iconv_open-osf.gperf"
+#line 62 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "eucKR"},
-#line 66 "./iconv_open-osf.gperf"
+#line 66 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "TACTIS"},
-#line 33 "./iconv_open-osf.gperf"
+#line 33 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-5"},
-#line 38 "./iconv_open-osf.gperf"
+#line 38 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-15"},
-#line 64 "./iconv_open-osf.gperf"
+#line 64 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "big5"},
-#line 43 "./iconv_open-osf.gperf"
+#line 43 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "cp855"},
-#line 60 "./iconv_open-osf.gperf"
+#line 60 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "cp1258"},
-#line 41 "./iconv_open-osf.gperf"
+#line 41 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "cp850"},
-#line 47 "./iconv_open-osf.gperf"
+#line 47 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "cp865"},
-#line 61 "./iconv_open-osf.gperf"
+#line 61 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "eucJP"},
-#line 59 "./iconv_open-osf.gperf"
+#line 59 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str20, "cp1257"},
-#line 58 "./iconv_open-osf.gperf"
+#line 58 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str21, "cp1256"},
-#line 36 "./iconv_open-osf.gperf"
+#line 36 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str22, "ISO8859-8"},
-#line 65 "./iconv_open-osf.gperf"
+#line 65 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str23, "SJIS"},
     {-1},
-#line 37 "./iconv_open-osf.gperf"
+#line 37 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str25, "ISO8859-9"},
-#line 35 "./iconv_open-osf.gperf"
+#line 35 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str26, "ISO8859-7"},
-#line 34 "./iconv_open-osf.gperf"
+#line 34 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str27, "ISO8859-6"},
     {-1},
-#line 44 "./iconv_open-osf.gperf"
+#line 44 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str29, "cp857"},
-#line 54 "./iconv_open-osf.gperf"
+#line 54 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str30, "cp1252"},
-#line 49 "./iconv_open-osf.gperf"
+#line 49 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str31, "cp869"},
-#line 51 "./iconv_open-osf.gperf"
+#line 51 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str32, "KSC5601"},
-#line 48 "./iconv_open-osf.gperf"
+#line 48 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str33, "cp866"},
-#line 39 "./iconv_open-osf.gperf"
+#line 39 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str34, "cp437"},
-#line 53 "./iconv_open-osf.gperf"
+#line 53 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str35, "cp1251"},
-#line 30 "./iconv_open-osf.gperf"
+#line 30 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str36, "ISO8859-2"},
-#line 56 "./iconv_open-osf.gperf"
+#line 56 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str37, "cp1254"},
-#line 50 "./iconv_open-osf.gperf"
+#line 50 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str38, "cp874"},
-#line 42 "./iconv_open-osf.gperf"
+#line 42 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str39, "cp852"},
-#line 55 "./iconv_open-osf.gperf"
+#line 55 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str40, "cp1253"},
-#line 29 "./iconv_open-osf.gperf"
+#line 29 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str41, "ISO8859-1"},
-#line 46 "./iconv_open-osf.gperf"
+#line 46 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str42, "cp862"},
-#line 32 "./iconv_open-osf.gperf"
+#line 32 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str43, "ISO8859-4"},
     {-1}, {-1},
-#line 31 "./iconv_open-osf.gperf"
+#line 31 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str46, "ISO8859-3"},
-#line 45 "./iconv_open-osf.gperf"
+#line 45 "../../../src/guile3/lib/iconv_open-osf.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str47, "cp861"}
   };
 
diff --git a/lib/iconv_open-solaris.h b/lib/iconv_open-solaris.h
index b38b16c84..6b4b2d3aa 100644
--- a/lib/iconv_open-solaris.h
+++ b/lib/iconv_open-solaris.h
@@ -1,5 +1,5 @@
 /* ANSI-C code produced by gperf version 3.1 */
-/* Command-line: gperf -m 10 ./iconv_open-solaris.gperf  */
+/* Command-line: gperf -m 10 ../../../src/guile3/lib/iconv_open-solaris.gperf  */
 /* Computed positions: -k'10' */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -29,7 +29,7 @@
 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
 #endif
 
-#line 17 "./iconv_open-solaris.gperf"
+#line 17 "../../../src/guile3/lib/iconv_open-solaris.gperf"
 struct mapping { int standard_name; const char vendor_name[10 + 1]; };
 
 #define TOTAL_KEYWORDS 13
@@ -132,32 +132,32 @@ static const struct stringpool_t stringpool_contents =
 static const struct mapping mappings[] =
   {
     {-1}, {-1}, {-1}, {-1}, {-1},
-#line 35 "./iconv_open-solaris.gperf"
+#line 35 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str5, "646"},
-#line 46 "./iconv_open-solaris.gperf"
+#line 46 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str6, "ansi-1251"},
-#line 34 "./iconv_open-solaris.gperf"
+#line 34 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str7},
     {-1}, {-1},
-#line 36 "./iconv_open-solaris.gperf"
+#line 36 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str10, "ISO8859-1"},
-#line 45 "./iconv_open-solaris.gperf"
+#line 45 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str11, "ISO8859-15"},
-#line 44 "./iconv_open-solaris.gperf"
+#line 44 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str12, "ISO8859-9"},
-#line 43 "./iconv_open-solaris.gperf"
+#line 43 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str13, "ISO8859-8"},
-#line 42 "./iconv_open-solaris.gperf"
+#line 42 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str14, "ISO8859-7"},
-#line 41 "./iconv_open-solaris.gperf"
+#line 41 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str15, "ISO8859-6"},
-#line 40 "./iconv_open-solaris.gperf"
+#line 40 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str16, "ISO8859-5"},
-#line 39 "./iconv_open-solaris.gperf"
+#line 39 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str17, "ISO8859-4"},
-#line 38 "./iconv_open-solaris.gperf"
+#line 38 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str18, "ISO8859-3"},
-#line 37 "./iconv_open-solaris.gperf"
+#line 37 "../../../src/guile3/lib/iconv_open-solaris.gperf"
     {(int)(size_t)&((struct stringpool_t *)0)->stringpool_str19, "ISO8859-2"}
   };
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Document R7RS bytevector functions
  2023-01-13 18:05 [PATCH] Document R7RS bytevector functions lloda
@ 2023-01-14 14:56 ` Ludovic Courtès
  2023-01-15 22:06   ` lloda
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2023-01-14 14:56 UTC (permalink / raw)
  To: lloda; +Cc: guile-devel

Hi Daniel,

lloda <lloda@sarc.name> skribis:

> Right now the manual just mentions (scheme base), but not the contents. This patch at least makes sure that at least the bytevector-related R7RS functions appear in the index.
>
> The patch documents a first group of purely bytevector functions and a second group of binary I/O that are not elsewhere in Guile/R6RS or that exist but have different definitions.

Nice.

> From 2b751615071aca023dac59db866fb09894fa2b57 Mon Sep 17 00:00:00 2001
> From: Daniel Llorens <lloda@sarc.name>
> Date: Fri, 13 Jan 2023 16:26:17 +0100
> Subject: [PATCH] Document R7RS functions related to bytevectors
>
> * doc/ref/api-data.texi: Document: bytevector bytevector-copy
>   bytevector-copy! bytevector-append
>   (r6:bytevector-copy): Index need not be positive (can be 0).
> * doc/ref/api-io.texi: Document: open-output-bytevector write-u8 read-u8 peek-u8
>   get-output-bytevector open-input-bytevector read-bytevector! read-bytevector
>   write-bytevector

Please specify the node names (see ‘git log’ for examples).

>  doc/ref/api-data.texi    | 102 ++++++++++++++++++++++++++++++---
>  doc/ref/api-io.texi      | 121 +++++++++++++++++++++++++++++++++++++++
>  lib/iconv_open-aix.h     |  68 +++++++++++-----------
>  lib/iconv_open-hpux.h    |  92 ++++++++++++++---------------
>  lib/iconv_open-irix.h    |  42 +++++++-------
>  lib/iconv_open-osf.h     |  80 +++++++++++++-------------
>  lib/iconv_open-solaris.h |  30 +++++-----

I guess the lib/ changes are unintended.  :-)

> +++ b/doc/ref/api-data.texi
> @@ -6188,9 +6188,9 @@ thus created is determined implicitly by the number of arguments given.
>  Return a newly allocated vector composed of the
>  given arguments.  Analogous to @code{list}.
>  
> -@lisp
> +@example
>  (vector 'a 'b 'c) @result{} #(a b c)
> -@end lisp
> +@end example

Please keep @lisp as this gives information that can then be exploited
for syntax highlighting (‘texinfo --html’ doesn’t take advantage of it
so far, but in Guix we have machinery to do that.)

> +@ref{R7RS Support,R7RS} defines another set of bytevector functions in
> +the module @code{(scheme base)}. These functions are also described in this
> +section.

Please leave two spaces after and end-of-sentence period, to ease
navigation in Emacs and to please Texinfo (info "(texinfo) Ending a
Sentence").

Maybe these two sentences should go to the intro of the new subsection
(see below).

> @@ -6726,9 +6730,10 @@ procedures and C functions.
>  @deffnx {C Function} scm_c_make_bytevector (size_t len)
>  Return a new bytevector of @var{len} bytes.  Optionally, if @var{fill}
>  is given, fill it with @var{fill}; @var{fill} must be in the range
> -[-128,255].
> +[-128,255].@footnote{This function is defined both by R6RS in @code{(rnrs bytevectors)} and by @ref{R7RS Standard Libraries,R7RS} in @code{(scheme base)}.}.
>  @end deffn
>  
> +@anchor{x-bytevector?}
>  @deffn {Scheme Procedure} bytevector? obj
>  @deffnx {C Function} scm_bytevector_p (obj)
>  Return true if @var{obj} is a bytevector.
> @@ -6757,26 +6762,32 @@ length and contents.
>  @deffnx {C Function} scm_bytevector_fill_x (bv, fill)
>  Fill positions [@var{start} ... @var{end}) of bytevector @var{bv} with
>  byte @var{fill}. @var{start} defaults to 0 and @var{end} defaults to the
> -length of @var{bv}.@footnote{R6RS defines @code{(bytevector-fill! bv
> +length of @var{bv}.@footnote{R6RS only defines @code{(bytevector-fill! bv
>  fill)}. Arguments @var{start} and @var{end} are a Guile extension
>  (cf. @ref{x-vector-fill!,@code{vector-fill!}},
>  @ref{x-string-fill!,@code{string-fill!}}).}
>  @end deffn
>  
> +@anchor{x-r6:bytevector-copy!}
>  @deffn {Scheme Procedure} bytevector-copy! source source-start target target-start len
>  @deffnx {C Function} scm_bytevector_copy_x (source, source_start, target, target_start, len)
>  Copy @var{len} bytes from @var{source} into @var{target}, starting
> -reading from @var{source-start} (a positive index within @var{source})
> +reading from @var{source-start} (an index index within @var{source})
>  and writing at @var{target-start}.
>  
>  It is permitted for the @var{source} and @var{target} regions to
>  overlap. In that case, copying takes place as if the source is first
>  copied into a temporary bytevector and then into the destination.
> +
> +See also @ref{x-r7:bytevector-copy!,the R7RS version}.
>  @end deffn
>  
> +@anchor{x-r6:bytevector-copy}
>  @deffn {Scheme Procedure} bytevector-copy bv
>  @deffnx {C Function} scm_bytevector_copy (bv)
>  Return a newly allocated copy of @var{bv}.
> +
> +See also @ref{x-r7:bytevector-copy,the R7RS version}.
>  @end deffn

We should keep the manual in sync with docstrings in bytevectors.c.

Thus, my suggestion would be to not insert comments and footnotes about
R7RS in the existing sections, but instead to do that in the new section.

> +@subsubheading Bytevector functions in R7RS

Please capitalize and use “procedure”:

  Bytevector Procedures in R7RS.

Here maybe you could first put the two intro sentences that you had
above, possibly listing procedures that are the same in both (rnrs
bytevectors) and (scheme base)?

After than you’d like the new procedures and those that are different,
like you already did.

> +@subsubheading Binary I/O in R7RS

This part LGTM.

Thanks!

Ludo’.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Document R7RS bytevector functions
  2023-01-14 14:56 ` Ludovic Courtès
@ 2023-01-15 22:06   ` lloda
  2023-01-17  9:17     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: lloda @ 2023-01-15 22:06 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guile-devel@gnu.org

[-- Attachment #1: Type: text/plain, Size: 729 bytes --]


Hi Ludovic, 

thanks for the review. Second version attached.

> We should keep the manual in sync with docstrings in bytevectors.c.
> 
> Thus, my suggestion would be to not insert comments and footnotes about
> R7RS in the existing sections, but instead to do that in the new section.

Following this, I've removed the footnotes & references to R7RS in the main section.

Patch aside:

I still think the links are useful, so I'd like to find a way to put them back. I think someone who finds their way into the doc for r6rs bytevector-copy should be told that there are in fact different versions of this procedure. Just in general, I think there should be many more links in the doc.

Regards

  Daniel



[-- Attachment #2: 0001-Document-R7RS-functions-related-to-bytevectors.patch --]
[-- Type: application/octet-stream, Size: 13987 bytes --]

From 547bd47887d7096e5568c31edb0b1661b1ac23ec Mon Sep 17 00:00:00 2001
From: Daniel Llorens <lloda@sarc.name>
Date: Sun, 15 Jan 2023 22:41:48 +0100
Subject: [PATCH] Document R7RS functions related to bytevectors

* doc/ref/api-data.texi (Bytevectors): Document R7RS bytevector,
  bytevector-copy, bytevector-copy!, bytevector-append.
  Fix typo in (r6:bytevector-copy), index need not be positive.
  Fix typos in bytevector-length, bytevector=, bytevector-fill!.
* doc/ref/api-io.texi (Binary I/O): Document R7RS
  open-output-bytevector, write-u8, read-u8, peek-u8,
  get-output-bytevector, open-input-bytevector, read-bytevector!,
  read-bytevector, write-bytevector.
---
 doc/ref/api-data.texi | 102 ++++++++++++++++++++++++++++++++---
 doc/ref/api-io.texi   | 121 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 216 insertions(+), 7 deletions(-)

diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index d332aa997..e4f3978b4 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -6635,7 +6635,7 @@ and writing.
 @cindex bytevector
 @cindex R6RS
 
-A @dfn{bytevector} is a raw bit string.  The @code{(rnrs bytevectors)}
+A @dfn{bytevector} is a raw byte string.  The @code{(rnrs bytevectors)}
 module provides the programming interface specified by the
 @uref{http://www.r6rs.org/, Revised^6 Report on the Algorithmic Language
 Scheme (R6RS)}.  It contains procedures to manipulate bytevectors and
@@ -6722,6 +6722,7 @@ The objects denoting big- and little-endianness, respectively.
 Bytevectors can be created, copied, and analyzed with the following
 procedures and C functions.
 
+@anchor{x-make-bytevector}
 @deffn {Scheme Procedure} make-bytevector len [fill]
 @deffnx {C Function} scm_make_bytevector (len, fill)
 @deffnx {C Function} scm_c_make_bytevector (size_t len)
@@ -6730,6 +6731,7 @@ is given, fill it with @var{fill}; @var{fill} must be in the range
 [-128,255].
 @end deffn
 
+@anchor{x-bytevector?}
 @deffn {Scheme Procedure} bytevector? obj
 @deffnx {C Function} scm_bytevector_p (obj)
 Return true if @var{obj} is a bytevector.
@@ -6739,6 +6741,7 @@ Return true if @var{obj} is a bytevector.
 Equivalent to @code{scm_is_true (scm_bytevector_p (obj))}.
 @end deftypefn
 
+@anchor{x-bytevector-length}
 @deffn {Scheme Procedure} bytevector-length bv
 @deffnx {C Function} scm_bytevector_length (bv)
 Return the length in bytes of bytevector @var{bv}.
@@ -6750,31 +6753,33 @@ Likewise, return the length in bytes of bytevector @var{bv}.
 
 @deffn {Scheme Procedure} bytevector=? bv1 bv2
 @deffnx {C Function} scm_bytevector_eq_p (bv1, bv2)
-Return is @var{bv1} equals to @var{bv2}---i.e., if they have the same
+Return @code{#t} if @var{bv1} equals @var{bv2}---i.e., if they have the same
 length and contents.
 @end deffn
 
 @deffn {Scheme Procedure} bytevector-fill! bv fill [start [end]]
 @deffnx {C Function} scm_bytevector_fill_x (bv, fill)
 Fill positions [@var{start} ... @var{end}) of bytevector @var{bv} with
-byte @var{fill}. @var{start} defaults to 0 and @var{end} defaults to the
-length of @var{bv}.@footnote{R6RS defines @code{(bytevector-fill! bv
-fill)}. Arguments @var{start} and @var{end} are a Guile extension
+byte @var{fill}.  @var{start} defaults to 0 and @var{end} defaults to the
+length of @var{bv}.@footnote{R6RS only defines @code{(bytevector-fill! bv
+fill)}.  Arguments @var{start} and @var{end} are a Guile extension
 (cf. @ref{x-vector-fill!,@code{vector-fill!}},
 @ref{x-string-fill!,@code{string-fill!}}).}
 @end deffn
 
+@anchor{x-r6:bytevector-copy!}
 @deffn {Scheme Procedure} bytevector-copy! source source-start target target-start len
 @deffnx {C Function} scm_bytevector_copy_x (source, source_start, target, target_start, len)
 Copy @var{len} bytes from @var{source} into @var{target}, starting
-reading from @var{source-start} (a positive index within @var{source})
+reading from @var{source-start} (an index index within @var{source})
 and writing at @var{target-start}.
 
 It is permitted for the @var{source} and @var{target} regions to
-overlap. In that case, copying takes place as if the source is first
+overlap.  In that case, copying takes place as if the source is first
 copied into a temporary bytevector and then into the destination.
 @end deffn
 
+@anchor{x-r6:bytevector-copy}
 @deffn {Scheme Procedure} bytevector-copy bv
 @deffnx {C Function} scm_bytevector_copy (bv)
 Return a newly allocated copy of @var{bv}.
@@ -6799,6 +6804,86 @@ Return the length in bytes of bytevector @var{bv}.
 Return a pointer to the contents of bytevector @var{bv}.
 @end deftypefn
 
+@subsubheading Bytevector Procedures in R7RS
+
+@ref{R7RS Standard Libraries,R7RS} defines a set of bytevector
+manipulation procedures, accessible with
+
+@example
+(use-modules (scheme base))
+@end example
+
+Of these, @ref{x-make-bytevector,@code{make-bytevector}},
+@ref{x-bytevector?,@code{bytevector?}},
+@ref{x-bytevector-length,@code{bytevector-length}},
+@ref{x-bytevector-u8-ref,@code{bytevector-u8-ref}} and
+@ref{x-bytevector-u8-set!,@code{bytevector-u8-set!}} have the same
+definition as in R6RS.  The procedures listed below either have a
+different definition in R7RS and R6RS, or are not defined in R6RS.
+
+@deffn {Scheme Procedure} bytevector arg @dots{}
+Return a newly allocated bytevector composed of the given arguments.
+Analogous to @code{list}.
+
+@lisp
+(bytevector 2 3 4) @result{} #vu8(2 3 4)
+@end lisp
+
+See also @ref{x-u8-list->bytevector,@code{u8-list->bytevector}}.
+@end deffn
+
+@anchor{x-r7:bytevector-copy}
+@deffn {Scheme Procedure} bytevector-copy bv [start [end]]
+Returns a newly allocated bytevector containing the elements of @var{bv}
+in the range [@var{start} ... @var{end}).  @var{start} defaults to 0 and
+@var{end} defaults to the length of @var{bv}.
+
+@lisp
+(define bv #vu8(0 1 2 3 4 5))
+(bytevector-copy bv) @result{} #vu8(0 1 2 3 4 5)
+(bytevector-copy bv 2) @result{} #vu8(2 3 4 5)
+(bytevector-copy bv 2 4) @result{} #vu8(2 3)
+@end lisp
+
+See also @ref{x-r6:bytevector-copy,the R6RS version}.
+@end deffn
+
+@anchor{x-r7:bytevector-copy!}
+@deffn {Scheme Procedure} bytevector-copy! dst at src [start [end]]
+Copy the block of elements from bytevector @var{src} in the range
+[@var{start} ... @var{end}) into bytevector @var{dst}, starting at
+position @var{at}.  @var{start} defaults to 0 and @var{end} defaults to
+the length of @var{src}.  It is an error for @var{dst}
+to have a length less than @var{at} + (@var{end} - @var{start}).
+
+See also @ref{x-r6:bytevector-copy!,the R6RS version}.  With
+
+@lisp
+(use-modules ((rnrs bytevectors) #:prefix r6:)
+             ((scheme base) #:prefix r7:))
+@end lisp
+
+the following calls are equivalent:
+
+@lisp
+(r6:bytevector-copy! source source-start target target-start len)
+(r7:bytevector-copy! target target-start source source-start (+ source-start len))
+@end lisp
+
+@end deffn
+
+@rnindex bytevector-append
+@deffn {Scheme Procedure} bytevector-append arg @dots{}
+Return a newly allocated bytevector whose characters form the
+concatenation of the given bytevectors @var{arg} @enddots{}
+
+@lisp
+(bytevector-append #vu8(0 1 2) #vu8(3 4 5))
+@result{} #vu8(0 1 2 3 4 5)
+@end lisp
+@end deffn
+
+
 
 @node Bytevectors as Integers
 @subsubsection Interpreting Bytevector Contents as Integers
@@ -6852,6 +6937,7 @@ Set the @var{size}-byte long signed integer at @var{index} to
 The following procedures are similar to the ones above, but specialized
 to a given integer size:
 
+@anchor{x-bytevector-u8-ref}
 @deffn {Scheme Procedure} bytevector-u8-ref bv index
 @deffnx {Scheme Procedure} bytevector-s8-ref bv index
 @deffnx {Scheme Procedure} bytevector-u16-ref bv index endianness
@@ -6873,6 +6959,7 @@ Return the unsigned @var{n}-bit (signed) integer (where @var{n} is 8,
 @var{endianness}.
 @end deffn
 
+@anchor{x-bytevector-u8-set!}
 @deffn {Scheme Procedure} bytevector-u8-set! bv index value
 @deffnx {Scheme Procedure} bytevector-s8-set! bv index value
 @deffnx {Scheme Procedure} bytevector-u16-set! bv index value endianness
@@ -6952,6 +7039,7 @@ Return a newly allocated list of unsigned 8-bit integers from the
 contents of @var{bv}.
 @end deffn
 
+@anchor{x-u8-list->bytevector}
 @deffn {Scheme Procedure} u8-list->bytevector lst
 @deffnx {C Function} scm_u8_list_to_bytevector (lst)
 Return a newly allocated bytevector consisting of the unsigned 8-bit
diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi
index a0be2dd57..86f83e85e 100644
--- a/doc/ref/api-io.texi
+++ b/doc/ref/api-io.texi
@@ -150,12 +150,14 @@ some different kind of port, that's not the case: all ports in Guile are
 both binary and textual ports.
 
 @cindex binary input
+@anchor{x-get-u8}
 @deffn {Scheme Procedure} get-u8 port
 @deffnx {C Function} scm_get_u8 (port)
 Return an octet read from @var{port}, an input port, blocking as
 necessary, or the end-of-file object.
 @end deffn
 
+@anchor{x-lookahead-u8}
 @deffn {Scheme Procedure} lookahead-u8 port
 @deffnx {C Function} scm_lookahead_u8 (port)
 Like @code{get-u8} but does not update @var{port}'s position to point
@@ -227,6 +229,7 @@ will be read again in last-in first-out order.
 To perform binary output on a port, use @code{put-u8} or
 @code{put-bytevector}.
 
+@anchor{x-put-u8}
 @deffn {Scheme Procedure} put-u8 port octet
 @deffnx {C Function} scm_put_u8 (port, octet)
 Write @var{octet}, an integer in the 0--255 range, to @var{port}, a
@@ -239,6 +242,124 @@ Write the contents of @var{bv} to @var{port}, optionally starting at
 index @var{start} and limiting to @var{count} octets.
 @end deffn
 
+@subsubheading Binary I/O in R7RS
+
+@ref{R7RS Standard Libraries,R7RS} defines the following binary I/O
+procedures.  Access them with
+
+@example
+(use-modules (scheme base))
+@end example
+
+@anchor{x-open-output-bytevector}
+@deffn {Scheme Procedure} open-output-bytevector
+Returns a binary output port that will accumulate bytes
+for retrieval by @ref{x-get-output-bytevector,@code{get-output-bytevector}}.
+@end deffn
+
+@deffn {Scheme Procedure} write-u8 byte [out]
+Writes @var{byte} to the given binary output port @var{out} and returns
+an unspecified value.  @var{out} defaults to @code{(current-output-port)}.
+
+See also @ref{x-put-u8,@code{put-u8}}.
+@end deffn
+
+@deffn {Scheme Procedure} read-u8 [in]
+Returns the next byte available from the binary input port @var{in},
+updating the port to point to the following byte.  If no more bytes are
+available, an end-of-file object is returned.  @var{in} defaults to
+@code{(current-input-port)}.
+
+See also @ref{x-get-u8,@code{get-u8}}.
+@end deffn
+
+@deffn {Scheme Procedure} peek-u8 [in]
+Returns the next byte available from the binary input port @var{in},
+but without updating the port to point to the following
+byte.  If no more bytes are available, an end-of-file object
+is returned.  @var{in} defaults to @code{(current-input-port)}.
+
+See also @ref{x-lookahead-u8,@code{lookahead-u8}}.
+@end deffn
+
+@anchor{x-get-output-bytevector}
+@deffn {Scheme Procedure} get-output-bytevector port
+Returns a bytevector consisting of the bytes that have been output to
+@var{port} so far in the order they were output.  It is an error if
+@var{port} was not created with
+@ref{x-open-output-bytevector,@code{open-output-bytevector}}.
+
+@example
+(define out (open-output-bytevector))
+(write-u8 1 out)
+(write-u8 2 out)
+(write-u8 3 out)
+(get-output-bytevector out) @result{} #vu8(1 2 3)
+@end example
+@end deffn
+
+@deffn {Scheme Procedure} open-input-bytevector bv
+Takes a bytevector @var{bv} and returns a binary input port that
+delivers bytes from @var{bv}.
+
+@example
+(define in (open-input-bytevector #vu8(1 2 3)))
+(read-u8 in) @result{} 1
+(peek-u8 in) @result{} 2
+(read-u8 in) @result{} 2
+(read-u8 in) @result{} 3
+(read-u8 in) @result{} #<eof>
+@end example
+@end deffn
+
+@deffn {Scheme Procedure} read-bytevector! bv [port [start [end]]]
+Reads the next @var{end} - @var{start} bytes, or as many as are
+available before the end of file, from the binary input port into the
+bytevector @var{bv} in left-to-right order beginning at the @var{start}
+position.  If @var{end} is not supplied, reads until the end of @var{bv}
+has been reached.  If @var{start} is not supplied, reads beginning at
+position 0.
+
+Returns the number of bytes read.  If no bytes are available, an
+end-of-file object is returned.
+
+@example
+(define in (open-input-bytevector #vu8(1 2 3)))
+(define bv (make-bytevector 5 0))
+(read-bytevector! bv in 1 3) @result{} 2
+bv @result{} #vu8(0 1 2 0 0 0)
+@end example
+
+@end deffn
+
+@deffn {Scheme Procedure} read-bytevector k in
+Reads the next @var{k} bytes, or as many as are available before the end
+of file if that is less than @var{k}, from the binary input port
+@var{in} into a newly allocated bytevector in left-to-right order, and
+returns the bytevector.  If no bytes are available before the end of
+file, an end-of-file object is returned.
+
+@example
+(define bv #vu8(1 2 3))
+(read-bytevector 2 (open-input-bytevector bv)) @result{} #vu8(1 2)
+(read-bytevector 10 (open-input-bytevector bv)) @result{} #vu8(1 2 3)
+@end example
+
+@end deffn
+
+@deffn {Scheme Procedure} write-bytevector bv [port [start [end]]]
+Writes the bytes of bytevector @var{bv} from @var{start} to @var{end} in
+left-to-right order to the binary output @var{port}.  @var{start}
+defaults to 0 and @var{end} defaults to the length of @var{bv}.
+
+@example
+(define out (open-output-bytevector))
+(write-bytevector #vu8(0 1 2 3 4) out 2 4)
+(get-output-bytevector out) @result{} #vu8(2 3)
+@end example
+
+@end deffn
+
 @node Encoding
 @subsection Encoding
 
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Document R7RS bytevector functions
  2023-01-15 22:06   ` lloda
@ 2023-01-17  9:17     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2023-01-17  9:17 UTC (permalink / raw)
  To: lloda; +Cc: guile-devel@gnu.org

Hi Daniel,

lloda <lloda@sarc.name> skribis:

>> We should keep the manual in sync with docstrings in bytevectors.c.
>> 
>> Thus, my suggestion would be to not insert comments and footnotes about
>> R7RS in the existing sections, but instead to do that in the new section.
>
> Following this, I've removed the footnotes & references to R7RS in the main section.
>
> Patch aside:
>
> I still think the links are useful, so I'd like to find a way to put them back. I think someone who finds their way into the doc for r6rs bytevector-copy should be told that there are in fact different versions of this procedure. Just in general, I think there should be many more links in the doc.

Yes, I agree with that, I’m just not sure about the initial proposal.

> From 547bd47887d7096e5568c31edb0b1661b1ac23ec Mon Sep 17 00:00:00 2001
> From: Daniel Llorens <lloda@sarc.name>
> Date: Sun, 15 Jan 2023 22:41:48 +0100
> Subject: [PATCH] Document R7RS functions related to bytevectors
>
> * doc/ref/api-data.texi (Bytevectors): Document R7RS bytevector,
>   bytevector-copy, bytevector-copy!, bytevector-append.
>   Fix typo in (r6:bytevector-copy), index need not be positive.
>   Fix typos in bytevector-length, bytevector=, bytevector-fill!.
> * doc/ref/api-io.texi (Binary I/O): Document R7RS
>   open-output-bytevector, write-u8, read-u8, peek-u8,
>   get-output-bytevector, open-input-bytevector, read-bytevector!,
>   read-bytevector, write-bytevector.

[...]

> -A @dfn{bytevector} is a raw bit string.  The @code{(rnrs bytevectors)}
> +A @dfn{bytevector} is a raw byte string.  The @code{(rnrs bytevectors)}
>  module provides the programming interface specified by the
>  @uref{http://www.r6rs.org/, Revised^6 Report on the Algorithmic Language
>  Scheme (R6RS)}.  It contains procedures to manipulate bytevectors and
                  ^
Actually here we could insert something like:

  The R7RS also supports this interface with some additions and minor
  differences (@pxref{Bytevector Procedures in R7RS}).

> @@ -6799,6 +6804,86 @@ Return the length in bytes of bytevector @var{bv}.
>  Return a pointer to the contents of bytevector @var{bv}.
>  @end deftypefn
>  
> +@subsubheading Bytevector Procedures in R7RS

How about moving it at the bottom, after “Bytevectors as Uniform
Vectors”?

Also make sure to update the menu at the beginning of the “Bytevectors”
node (you can use ‘M-x texinfo-make-menu’ if you use Emacs).

OK for me with changes along these lines.

Thank you!

Ludo’.



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-17  9:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13 18:05 [PATCH] Document R7RS bytevector functions lloda
2023-01-14 14:56 ` Ludovic Courtès
2023-01-15 22:06   ` lloda
2023-01-17  9:17     ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).