[cmucl-cvs] CMUCL commit: src (3 files)

Raymond Toy rtoy at common-lisp.net
Fri Sep 24 12:12:05 UTC 2010


    Date: Friday, September 24, 2010 @ 08:12:05
  Author: rtoy
    Path: /project/cmucl/cvsroot/src

Modified: compiler/fndb.lisp compiler/main.lisp general-info/release-20c.txt

Add :decoding-error arg to compile-file to specify how decoding errors
should be handled.

compiler/main.lisp:
o Add DECODING-ERROR slot to SOURCE-INFO structure.
o MAKE-FILE-SOURCE-INFO requires a decoding error argument so the
  SOURCE-INFO structure can be properly initialized.
o Add :DECODING-ERROR keyword arg to COMPILE-FILE to specify how
  decoding errors are handled.  Default is T, which means to signal an
  error.

compiler/fndb.lisp:
o Tell compiler about the new parameter.

general-info/release-20c.txt:
o Document change.


------------------------------+
 compiler/fndb.lisp           |    3 ++-
 compiler/main.lisp           |   29 ++++++++++++++++++++++-------
 general-info/release-20c.txt |   11 ++++++++++-
 3 files changed, 34 insertions(+), 9 deletions(-)


Index: src/compiler/fndb.lisp
diff -u src/compiler/fndb.lisp:1.146 src/compiler/fndb.lisp:1.147
--- src/compiler/fndb.lisp:1.146	Mon Jul 26 13:20:26 2010
+++ src/compiler/fndb.lisp	Fri Sep 24 08:12:05 2010
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /project/cmucl/cvsroot/src/compiler/fndb.lisp,v 1.146 2010-07-26 17:20:26 rtoy Exp $")
+  "$Header: /project/cmucl/cvsroot/src/compiler/fndb.lisp,v 1.147 2010-09-24 12:12:05 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -1152,6 +1152,7 @@
    (:entry-points list)
    (:byte-compile (member t nil :maybe))
    (:external-format symbol)
+   (:decoding-error (or null symbol function))
    (:xref t))
   (values (or pathname null) boolean boolean))
 
Index: src/compiler/main.lisp
diff -u src/compiler/main.lisp:1.158 src/compiler/main.lisp:1.159
--- src/compiler/main.lisp:1.158	Wed Sep 15 11:47:29 2010
+++ src/compiler/main.lisp	Fri Sep 24 08:12:05 2010
@@ -5,7 +5,7 @@
 ;;; Carnegie Mellon University, and has been placed in the public domain.
 ;;;
 (ext:file-comment
-  "$Header: /project/cmucl/cvsroot/src/compiler/main.lisp,v 1.158 2010-09-15 15:47:29 rtoy Exp $")
+  "$Header: /project/cmucl/cvsroot/src/compiler/main.lisp,v 1.159 2010-09-24 12:12:05 rtoy Exp $")
 ;;;
 ;;; **********************************************************************
 ;;;
@@ -718,14 +718,19 @@
   ;;
   ;; External format to use for the stream if the stream hasn't been opened
   #+unicode
-  (external-format :default))
+  (external-format :default)
+  ;;
+  ;; How to handle decoding errors when reading the source file.
+  ;; Default is T to signal an error.
+  #+unicode
+  (decoding-error t))
 
 
 ;;; Make-File-Source-Info  --  Internal
 ;;;
 ;;;    Given a list of pathnames, return a Source-Info structure.
 ;;;
-(defun make-file-source-info (files external-format)
+(defun make-file-source-info (files external-format decoding-error)
   (declare (list files))
   (let ((file-info
 	 (mapcar #'(lambda (x)
@@ -739,7 +744,9 @@
 		      :current-file file-info
 		      #+unicode :external-format
 		      #+unicode (stream::ef-name
-				 (stream::find-external-format external-format)))))
+				 (stream::find-external-format external-format))
+		      #+unicode :decoding-error
+		      #+unicode decoding-error)))
 
 
 ;;; MAKE-LISP-SOURCE-INFO  --  Interface
@@ -880,7 +887,9 @@
 	   (setf (source-info-stream info)
 		 (open name :direction :input
 		       #+unicode :external-format
-		       #+unicode (source-info-external-format info)))))))
+		       #+unicode (source-info-external-format info)
+		       #+unicode :decoding-error
+		       #+unicode (source-info-decoding-error info)))))))
 
 ;;; CLOSE-SOURCE-INFO  --  Internal
 ;;;
@@ -1744,6 +1753,7 @@
 			    (error-output t)
 			    (load nil)
 			    (external-format :default)
+		            (decoding-error t)
 			    ((:verbose *compile-verbose*) *compile-verbose*)
 			    ((:print *compile-print*) *compile-print*)
 			    ((:progress *compile-progress*) *compile-progress*)
@@ -1796,7 +1806,12 @@
       If non-NIL, enable recording of cross-reference information.  The default
       is the value of C:*RECORD-XREF-INFO*
    :External-Format
-      The external format to use when opening the source file"
+      The external format to use when opening the source file
+   :Decoding-Error
+      How to handle decoding errors in the external format when reading the
+      source file.  Default (T) is to signal an error.  Nil means silently
+      continue, replacing the invalid sequence with a suitable replacment
+      character."
   (let* ((fasl-file nil)
 	 (error-file-stream nil)
 	 (output-file-pathname nil)
@@ -1805,7 +1820,7 @@
 	 (compile-won nil)
 	 (error-severity nil)
 	 (source (verify-source-files source))
-	 (source-info (make-file-source-info source external-format))
+	 (source-info (make-file-source-info source external-format decoding-error))
 	 (default (pathname (first source))))
     (unwind-protect
 	(progn
Index: src/general-info/release-20c.txt
diff -u src/general-info/release-20c.txt:1.3 src/general-info/release-20c.txt:1.4
--- src/general-info/release-20c.txt:1.3	Fri Sep 17 12:01:05 2010
+++ src/general-info/release-20c.txt	Fri Sep 24 08:12:05 2010
@@ -20,11 +20,20 @@
 
   * Known issues:
 
-  * Feature enhancements:
+  * Feature enhancements
     - Update to Unicode 5.2.0.
     - Add support for character name completion.  This can be used by
       Slime to do character name completion.
 
+  * Changes
+    - COMPILE-FILE now accepts a :DECODING-ERROR argument that
+      indicates how to handle decoding errors when reading the file.
+      It has the same meaning and effect as the :DECODING-ERROR
+      argument to OPEN.  This defaults to T here so that decoding
+      errors are signaled on invalid sequences instead of silently
+      replacing the bad sequence with some kind of replacement
+      character.
+
   * ANSI compliance fixes:
 
   * Bugfixes:




More information about the cmucl-cvs mailing list