[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-49-g6b1c5d

From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.2-49-g6b1c5d9
Date: Thu, 18 Aug 2011 12:07:24 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

The branch, stable-2.0 has been updated
       via  6b1c5d9d67acd35a2b0c6e994dea21c3b5d8d39a (commit)
       via  fb031aba42d3b0d22538c50ef92a666496a8e326 (commit)
       via  5261e74281b1150e3b2594c92e571d8887a4900d (commit)
      from  81bda963e969db7e2ecc878982286daa5b0aacff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 6b1c5d9d67acd35a2b0c6e994dea21c3b5d8d39a
Author: Andy Wingo <address@hidden>
Date:   Thu Aug 18 12:56:14 2011 +0200

    fix order of importing modules and resolving duplicates handlers
    * module/ice-9/boot-9.scm (define-module*): Resolve duplicates handlers
      only after importing modules.  Fixes a bug in which a module with
      #:use-module (oop goops) but whose merge-generics handler got resolved
      to noop instead of the real merge-generics handler.  I can't think of
      an easy way to test this, though.
      Thanks to David Pirotte for the report!

commit fb031aba42d3b0d22538c50ef92a666496a8e326
Author: Andy Wingo <address@hidden>
Date:   Thu Aug 18 11:54:20 2011 +0200

    fix a couple of leaks
    * libguile/bytevectors.h:
    * libguile/bytevectors.c (scm_c_take_gc_bytevector): Rename this
      internal function, from scm_c_take_bytevector.  This indicates that
      unlike the other scm_take_* functions, this one takes GC-managed
    * libguile/objcodes.c (scm_objcode_to_bytecode):
    * libguile/vm.c (really_make_boot_program): Use
      scm_gc_malloc_pointerless, not scm_malloc.  Thanks to Stefan
      Israelsson Tampe!
    * libguile/r6rs-ports.c:
    * libguile/strings.c: Adapt to renames.

commit 5261e74281b1150e3b2594c92e571d8887a4900d
Author: Andy Wingo <address@hidden>
Date:   Thu Aug 18 11:13:34 2011 +0200

    reword open-file docs
    * doc/ref/api-io.texi (File Ports): Refactor open-file docs.  Thanks to
      Bake Timmons for the report.


Summary of changes:
 doc/ref/api-io.texi     |   44 ++++++++++++++++++++++----------------------
 libguile/bytevectors.c  |    2 +-
 libguile/bytevectors.h  |    4 ++--
 libguile/objcodes.c     |    4 ++--
 libguile/r6rs-ports.c   |   10 +++++-----
 libguile/strings.c      |    2 +-
 libguile/vm.c           |    7 ++++---
 module/ice-9/boot-9.scm |   11 ++++++-----
 8 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/doc/ref/api-io.texi b/doc/ref/api-io.texi
index 19c0665..afcde57 100644
--- a/doc/ref/api-io.texi
+++ b/doc/ref/api-io.texi
@@ -838,34 +838,34 @@ setvbuf}
 Add line-buffering to the port.  The port output buffer will be
 automatically flushed whenever a newline character is written.
 @item b
-Use binary mode.  On DOS systems the default text mode converts CR+LF
-in the file to newline for the program, whereas binary mode reads and
-writes all bytes unchanged.  On Unix-like systems there is no such
-distinction, text files already contain just newlines and no
-conversion is ever made.  The @code{b} flag is accepted on all
-systems, but has no effect on Unix-like systems.
-(For reference, Guile leaves text versus binary up to the C library,
address@hidden here just adds @code{O_BINARY} to the underlying @code{open}
-call, when that flag is available.)
-Also, open the file using the 8-bit character encoding "ISO-8859-1",
-ignoring any coding declaration or port encoding.
-Note that, when reading or writing binary data with ports, the
-bytevector ports in the @code{(rnrs io ports)} module are preferred,
-as they return vectors, and not strings (@pxref{R6RS I/O Ports}).
+Use binary mode, ensuring that each byte in the file will be read as one
+Scheme character.
+To provide this property, the file will be opened with the 8-bit
+character encoding "ISO-8859-1", ignoring any coding declaration or port
+encoding.  @xref{Ports}, for more information on port encodings.
+Note that while it is possible to read and write binary data as
+characters or strings, it is usually better to treat bytes as octets,
+and byte sequences as bytevectors.  @xref{R6RS Binary Input}, and
address@hidden Binary Output}, for more.
+This option had another historical meaning, for DOS compatibility: in
+the default (textual) mode, DOS reads a CR-LF sequence as one LF byte.
+The @code{b} flag prevents this from happening, adding @code{O_BINARY}
+to the underlying @code{open} call.  Still, the flag is generally useful
+because of its port encoding ramifications.
 @end table
 If a file cannot be opened with the access
 requested, @code{open-file} throws an exception.
 When the file is opened, this procedure will scan for a coding
-declaration (@pxref{Character Encoding of Source Files}). If present
-will use that encoding for interpreting the file.  Otherwise, the
-port's encoding will be used.  To suppress this behavior, open
-the file in binary mode and then set the port encoding explicitly
-using @code{set-port-encoding!}.
+declaration (@pxref{Character Encoding of Source Files}). If a coding
+declaration is found, it will be used to interpret the file.  Otherwise,
+the port's encoding will be used.  To suppress this behavior, open the
+file in binary mode and then set the port encoding explicitly using
 In theory we could create read/write ports which were buffered
 in one direction only.  However this isn't included in the
diff --git a/libguile/bytevectors.c b/libguile/bytevectors.c
index 14159d2..4aeae63 100644
--- a/libguile/bytevectors.c
+++ b/libguile/bytevectors.c
@@ -285,7 +285,7 @@ scm_i_make_typed_bytevector (size_t len, 
scm_t_array_element_type element_type)
 /* Return a bytevector of size LEN made up of CONTENTS.  The area pointed to
    by CONTENTS must have been allocated using `scm_gc_malloc ()'.  */
-scm_c_take_bytevector (signed char *contents, size_t len)
+scm_c_take_gc_bytevector (signed char *contents, size_t len)
   return make_bytevector_from_buffer (len, contents, 
diff --git a/libguile/bytevectors.h b/libguile/bytevectors.h
index 431b7dd..8bafff3 100644
--- a/libguile/bytevectors.h
+++ b/libguile/bytevectors.h
@@ -1,7 +1,7 @@
-/* Copyright (C) 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2009, 2011 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 License
@@ -138,7 +138,7 @@ SCM_INTERNAL void scm_bootstrap_bytevectors (void);
 SCM_INTERNAL void scm_init_bytevectors (void);
 SCM_INTERNAL SCM scm_i_native_endianness;
-SCM_INTERNAL SCM scm_c_take_bytevector (signed char *, size_t);
+SCM_INTERNAL SCM scm_c_take_gc_bytevector (signed char *, size_t);
 SCM_INTERNAL int scm_i_print_bytevector (SCM, SCM, scm_print_state *);
diff --git a/libguile/objcodes.c b/libguile/objcodes.c
index 526751a..6223362 100644
--- a/libguile/objcodes.c
+++ b/libguile/objcodes.c
@@ -315,10 +315,10 @@ SCM_DEFINE (scm_objcode_to_bytecode, "objcode->bytecode", 
1, 0, 0,
   len = sizeof (struct scm_objcode) + SCM_OBJCODE_TOTAL_LEN (objcode);
-  s8vector = scm_malloc (len);
+  s8vector = scm_gc_malloc_pointerless (len, FUNC_NAME);
   memcpy (s8vector, SCM_OBJCODE_DATA (objcode), len);
-  return scm_c_take_bytevector (s8vector, len);
+  return scm_c_take_gc_bytevector (s8vector, len);
 #undef FUNC_NAME
diff --git a/libguile/r6rs-ports.c b/libguile/r6rs-ports.c
index 6eff97d..e867429 100644
--- a/libguile/r6rs-ports.c
+++ b/libguile/r6rs-ports.c
@@ -618,7 +618,7 @@ SCM_DEFINE (scm_get_bytevector_some, "get-bytevector-some", 
1, 0, 0,
          c_len = (unsigned) c_total;
-      result = scm_c_take_bytevector ((signed char *) c_bv, c_len);
+      result = scm_c_take_gc_bytevector ((signed char *) c_bv, c_len);
   return result;
@@ -677,7 +677,7 @@ SCM_DEFINE (scm_get_bytevector_all, "get-bytevector-all", 
1, 0, 0,
          c_len = (unsigned) c_total;
-      result = scm_c_take_bytevector ((signed char *) c_bv, c_len);
+      result = scm_c_take_gc_bytevector ((signed char *) c_bv, c_len);
   return result;
@@ -919,7 +919,7 @@ SCM_SMOB_APPLY (bytevector_output_port_procedure,
   bop_buffer_init (buf);
   if (result_buf.len == 0)
-    bv = scm_c_take_bytevector (NULL, 0);
+    bv = scm_c_take_gc_bytevector (NULL, 0);
       if (result_buf.total_len > result_buf.len)
@@ -929,8 +929,8 @@ SCM_SMOB_APPLY (bytevector_output_port_procedure,
-      bv = scm_c_take_bytevector ((signed char *) result_buf.buffer,
-                                      result_buf.len);
+      bv = scm_c_take_gc_bytevector ((signed char *) result_buf.buffer,
+                                     result_buf.len);
   return bv;
diff --git a/libguile/strings.c b/libguile/strings.c
index 24c82fc..5b15ddc 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -1489,7 +1489,7 @@ scm_from_stringn (const char *str, size_t len, const char 
       buf = scm_gc_malloc_pointerless (len, "bytevector");
       memcpy (buf, str, len);
-      bv = scm_c_take_bytevector (buf, len);
+      bv = scm_c_take_gc_bytevector (buf, len);
       scm_decoding_error (__func__, errno,
                          "input locale conversion error", bv);
diff --git a/libguile/vm.c b/libguile/vm.c
index b9d613a..6cb85b7 100644
--- a/libguile/vm.c
+++ b/libguile/vm.c
@@ -384,13 +384,14 @@ really_make_boot_program (long nargs)
   text[1] = (scm_t_uint8)nargs;
-  bp = scm_malloc (sizeof (struct scm_objcode) + sizeof (text));
+  bp = scm_gc_malloc_pointerless (sizeof (struct scm_objcode) + sizeof (text),
+                                  "boot-program");
   memcpy (SCM_C_OBJCODE_BASE (bp), text, sizeof (text));
   bp->len = sizeof(text);
   bp->metalen = 0;
-  u8vec = scm_c_take_bytevector ((scm_t_int8*)bp,
-                                 sizeof (struct scm_objcode) + sizeof (text));
+  u8vec = scm_c_take_gc_bytevector ((scm_t_int8*)bp,
+                                    sizeof (struct scm_objcode) + sizeof 
   ret = scm_make_program (scm_bytecode_to_objcode (u8vec),
                           SCM_BOOL_F, SCM_BOOL_F);
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index 8a938ec..b7e9f7f 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -2656,10 +2656,6 @@ VALUE."
               (error "expected list of integers for version"))
           (set-module-version! module version)
           (set-module-version! (module-public-interface module) version)))
-    (if (pair? duplicates)
-        (let ((handlers (lookup-duplicates-handlers duplicates)))
-          (set-module-duplicates-handlers! module handlers)))
     (let ((imports (resolve-imports imports)))
        (lambda ()
@@ -2679,7 +2675,12 @@ VALUE."
              (error "expected re-exports to be a list of symbols or symbol 
          ;; FIXME
          (if (not (null? autoloads))
-             (apply module-autoload! module autoloads)))))
+             (apply module-autoload! module autoloads))
+         ;; Wait until modules have been loaded to resolve duplicates
+         ;; handlers.
+         (if (pair? duplicates)
+             (let ((handlers (lookup-duplicates-handlers duplicates)))
+               (set-module-duplicates-handlers! module handlers))))))
     (if transformer
         (if (and (pair? transformer) (list-of symbol? transformer))

GNU Guile

reply via email to

[Prev in Thread] Current Thread [Next in Thread]