1 | ;;; with-standard-io-syntax.lisp |
---|
2 | ;;; |
---|
3 | ;;; Copyright (C) 2003 Peter Graves |
---|
4 | ;;; $Id: with-standard-io-syntax.lisp,v 1.1 2003-09-29 18:10:36 piso Exp $ |
---|
5 | ;;; |
---|
6 | ;;; This program is free software; you can redistribute it and/or |
---|
7 | ;;; modify it under the terms of the GNU General Public License |
---|
8 | ;;; as published by the Free Software Foundation; either version 2 |
---|
9 | ;;; of the License, or (at your option) any later version. |
---|
10 | ;;; |
---|
11 | ;;; This program is distributed in the hope that it will be useful, |
---|
12 | ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
13 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
14 | ;;; GNU General Public License for more details. |
---|
15 | ;;; |
---|
16 | ;;; You should have received a copy of the GNU General Public License |
---|
17 | ;;; along with this program; if not, write to the Free Software |
---|
18 | ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
19 | |
---|
20 | ;;; From CMUCL. |
---|
21 | |
---|
22 | (defun %with-standard-io-syntax (function) |
---|
23 | (let ((*package* (find-package "CL-USER")) |
---|
24 | (*print-array* t) |
---|
25 | (*print-base* 10) |
---|
26 | (*print-case* :upcase) |
---|
27 | (*print-circle* nil) |
---|
28 | (*print-escape* t) |
---|
29 | (*print-gensym* t) |
---|
30 | (*print-length* nil) |
---|
31 | (*print-level* nil) |
---|
32 | (*print-lines* nil) |
---|
33 | (*print-miser-width* nil) |
---|
34 | (*print-pretty* nil) |
---|
35 | (*print-radix* nil) |
---|
36 | (*print-readably* t) |
---|
37 | (*print-right-margin* nil) |
---|
38 | (*read-base* 10) |
---|
39 | (*read-default-float-format* 'single-float) |
---|
40 | (*read-eval* t) |
---|
41 | (*read-suppress* nil) |
---|
42 | #+nil ; FIXME |
---|
43 | (*readtable* std-lisp-readtable)) |
---|
44 | (funcall function))) |
---|
45 | |
---|
46 | (defmacro with-standard-io-syntax (&body body) |
---|
47 | "Bind the reader and printer control variables to values that enable READ |
---|
48 | to reliably read the results of PRINT. These values are: |
---|
49 | *PACKAGE* The COMMON-LISP-USER package |
---|
50 | *PRINT-ARRAY* T |
---|
51 | *PRINT-BASE* 10 |
---|
52 | *PRINT-CASE* :UPCASE |
---|
53 | *PRINT-CIRCLE* NIL |
---|
54 | *PRINT-ESCAPE* T |
---|
55 | *PRINT-GENSYM* T |
---|
56 | *PRINT-LENGTH* NIL |
---|
57 | *PRINT-LEVEL* NIL |
---|
58 | *PRINT-LINES* NIL |
---|
59 | *PRINT-MISER-WIDTH* NIL |
---|
60 | *PRINT-PRETTY* NIL |
---|
61 | *PRINT-RADIX* NIL |
---|
62 | *PRINT-READABLY* T |
---|
63 | *PRINT-RIGHT-MARGIN* NIL |
---|
64 | *READ-BASE* 10 |
---|
65 | *READ-DEFAULT-FLOAT-FORMAT* SINGLE-FLOAT |
---|
66 | *READ-EVAL* T |
---|
67 | *READ-SUPPRESS* NIL |
---|
68 | *READTABLE* the standard readtable." |
---|
69 | `(%with-standard-io-syntax #'(lambda () ,@body))) |
---|