[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.7-40-g776491

From: Andy Wingo
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-40-g776491c
Date: Tue, 22 Jan 2013 08:21:58 +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  776491caa2802c990aa0c25415dbbc4b7c368c7b (commit)
      from  170410b607b5ea2b935dbb656c844b86720bf1ec (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 776491caa2802c990aa0c25415dbbc4b7c368c7b
Author: Andy Wingo <address@hidden>
Date:   Tue Jan 22 09:19:39 2013 +0100

    fix compilation of glil to assembly
    * libguile/vm-i-scheme.c (VM_VALIDATE_STRUCT): Fix the error message if
      the value was not a struct.
    * module/system/base/compile.scm (find-language-joint): Default to
      joining at the target language.
      (default-language-joiner): Allow sequences of one compiled expression
      to pass through.  Otherwise error as before.
      (read-and-parse): New helper; actually parses.
      (read-and-compile): Use read-and-parse, and fall back to
    Thanks to Nala Ginrut for the report.


Summary of changes:
 libguile/vm-i-scheme.c         |    4 ++--
 module/system/base/compile.scm |   25 +++++++++++++++++++++----
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/libguile/vm-i-scheme.c b/libguile/vm-i-scheme.c
index 5191b8e..b85d980 100644
--- a/libguile/vm-i-scheme.c
+++ b/libguile/vm-i-scheme.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -499,7 +499,7 @@ VM_DEFINE_INSTRUCTION (165, make_array, "make-array", 3, 
-1, 1)
  * Structs
 #define VM_VALIDATE_STRUCT(obj, proc)           \
-  VM_ASSERT (SCM_STRUCTP (obj), vm_error_not_a_pair (proc, obj))
+  VM_ASSERT (SCM_STRUCTP (obj), vm_error_not_a_struct (proc, obj))
 VM_DEFINE_FUNCTION (166, struct_p, "struct?", 1)
diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
index 1c3320a..0e44f36 100644
--- a/module/system/base/compile.scm
+++ b/module/system/base/compile.scm
@@ -181,12 +181,26 @@
   (let lp ((in (reverse (or (lookup-compilation-order from to)
                             (error "no way to compile" from "to" to))))
            (lang to))
-    (cond ((null? in)
-           (error "don't know how to join expressions" from to))
+    (cond ((null? in) to)
           ((language-joiner lang) lang)
            (lp (cdr in) (caar in))))))
+(define (default-language-joiner lang)
+  (lambda (exps env)
+    (if (and (pair? exps) (null? (cdr exps)))
+        (car exps)
+        (error
+         "Multiple expressions read and compiled, but language has no joiner"
+         lang))))
+(define (read-and-parse lang port cenv)
+  (let ((exp ((language-reader lang) port cenv)))
+    (cond
+     ((eof-object? exp) exp)
+     ((language-parser lang) => (lambda (parse) (parse exp)))
+     (else exp))))
 (define* (read-and-compile port #:key
                            (from (current-language))
                            (to 'objcode)
@@ -197,11 +211,14 @@
     (let ((joint (find-language-joint from to)))
       (with-fluids ((*current-language* from))
         (let lp ((exps '()) (env #f) (cenv env))
-          (let ((x ((language-reader (current-language)) port cenv)))
+          (let ((x (read-and-parse (current-language) port cenv)))
              ((eof-object? x)
               (close-port port)
-              (compile ((language-joiner joint) (reverse exps) env)
+              (compile ((or (language-joiner joint)
+                            (default-language-joiner joint))
+                        (reverse exps)
+                        env)
                        #:from joint #:to to
                        ;; env can be false if no expressions were read.
                        #:env (or env (default-environment joint))

GNU Guile

reply via email to

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