1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%
3% File:         PU:READ1MACROS.SL
4% Description:  First part of some specilized reader macros
5% Author:       Don Morrison, Hewlett-Packard CRC
6% Created:      Wednesday, 12 May 1982
7% Modified:     6 May 1984 1558-PDT
8% Package:      Utilities
9% Status:       Open Source: BSD License
10%
11% (c) Copyright 1982, University of Utah
12%
13% Redistribution and use in source and binary forms, with or without
14% modification, are permitted provided that the following conditions are met:
15%
16%    * Redistributions of source code must retain the relevant copyright
17%      notice, this list of conditions and the following disclaimer.
18%    * Redistributions in binary form must reproduce the above copyright
19%      notice, this list of conditions and the following disclaimer in the
20%      documentation and/or other materials provided with the distribution.
21%
22% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24% THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25% PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNERS OR
26% CONTRIBUTORS
27% BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28% CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29% SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30% INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31% CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32% ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33% POSSIBILITY OF SUCH DAMAGE.
34%
35%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
36%
37% Revisions:
38%
39% 6 May 1984 1538-PDT (Nancy Kendzierski)
40%  Split read-macros.sl into two parts to allow them to be separately
41%  compilable without requiring itself.  This part defines the
42%  ` (backquote) read-macro necessary to compile the second part.
43%  Since char-macro is being moved out of the kernel into useful, and
44%  char-macro.sl needs this backquote stuff, modified this file to
45%  not use CHAR.
46% 19 Jan 1984 1449-PST (Brian Beach)
47%   Added standard header.
48% 1 Feb 1983 1400-PST  (Cris Perdue)
49%   Dochar moved into "nonkernel", "C" for "CONTROL", etc. commented out.
50%   Many miscellaneous symbolic names for characters removed.
51%
52%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53
54(compiletime (load backquote))
55
56((lambda (o-table)
57   (setq LispScanTable* (TotalCopy o-table)) % in case it's in pure space
58   (cond ((eq CurrentScanTable* o-table)
59	   (setq CurrentScanTable* LispScanTable*))))
60  LispScanTable*)
61
62% plug backquote and friends into the lisp reader via read macros
63% ` for backquote, , for unquote, ,@ for unquotel, and ,. for unquoted
64
65(de backquote-read-macro (channel qt)
66  (list 'backquote (ChannelReadTokenWithHooks channel)))
67
68(de unquote-read-macro (channel qt)
69  (list 'unquote (ChannelReadTokenWithHooks channel)))
70
71(de unquotel-read-macro (channel qt)
72  (list 'unquotel (ChannelReadTokenWithHooks channel)))
73
74(de unquoted-read-macro (channel qt)
75  (list 'unquoted (ChannelReadTokenWithHooks channel)))
76
77(putv LispScanTable* 96 11)   % CHAR not yet defined;  96 = (char !`)
78
79(putv LispScanTable* 44 13)   % CHAR not yet defined;  44 = (char !,)
80
81(put '!, (getv LispScanTable* 256) '((!@ . !,!@)(!. . !,!.)))
82
83(deflist
84  '((!` backquote-read-macro)
85    (!, unquote-read-macro)
86    (!,!@ unquotel-read-macro)
87    (!,!. unquoted-read-macro))
88  'LispReadMacro)
89
90% End of file.
91
92