;;; -*- mode:lisp;package:user;base:10.;fonts:(cptfontb) -*- ;;; $Header: /ct/ctlisp/charmac.l,v 1.10 84/03/16 15:14:24 susan Exp $ ;;; $Log: /ct/ctlisp/charmac.l,v $ ;;; Edited Richard Mark Soley 14 August 1985 for Lambda port. ;;; ;;;Revision 1.10 84/03/16 15:14:24 susan ;;;Added ignore rather than the variable 'list-so-far ;;; ;;;Revision 1.9 83/12/23 10:11:03 john ;;;Fixed a bug in #$?, changed its name to #$. ;;; ;;; ;;;Revision 1.8 83/12/21 21:11:03 penny ;;;removed the ct_load on diana to avoid circularity ;;; ;;;Revision 1.7 83/12/20 09:52:58 john ;;;Added #$? to wrap (eval-when (compile load eval) ...) around next expression. ;;; ;;;Revision 1.6 83/12/18 14:49:36 penny ;;;made sure diana is loaded ;;; ;;;Revision 1.5 83/12/17 21:15:10 pozsvath ;;;changed #$% to do a diana_get rather than mess around with the diana representation ;;; ;;;Revision 1.4 83/10/26 22:34:12 penny ;;;changed #$% to expand to a get instead of a diana_get to save thousands of ;;;funcalls. (this is a little naughty, but thew original is commented out above). ;;; ;;;Revision 1.3 83/09/16 13:43:21 john ;;;Removed bug that caused infinite reading if no matching close ;;;comment for hash-bar comment beginner. ;;; ;;;Revision 1.2 83/07/06 09:52:57 penny ;;;repositioned mode line ;;; ;;;Revision 1.1 83/06/22 13:29:36 penny ;;;Initial revision ;;; ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; CHARMAC ;;; ;;; John L. Shelton & Mark L. Miller 4-April, 1983 ;;; ;;; ;;; ;;; HISTORY ;;; ;;; ;;; ;;; This file came, a long time ago, from the charmac package ;;; ;;; in the MIT compatibility package from Maryland. Jim Miller ;;; ;;; at C*T hacked the file to work here and made useful additions. ;;; ;;; Mark & John have consolidated some material, and then divided ;;; ;;; it between this file, and the CT_LOAD file, which requires ;;; ;;; character definitions. If you don't see what you want here, ;;; ;;; look there. ;;; ;;; On 4-Apr-83, we determined that the sharp macro definitions ;;; ;;; were not needed, since they already existed in bare Franz lisp. ;;; ;;; This file contains extensions to the standard sharp macro facil- ;;; ;;; ity. ;;; ;;; ;;; ;;; ;;; ;;; This file is part of a proprietary software project. Source ;;; ;;; code and documentation describing implementation details are ;;; ;;; available on a confidential, non-disclosure basis only. These ;;; ;;; materials, including this file in particular, are trade secrets ;;; ;;; of Computer * Thought Corporation. ;;; ;;; ;;; ;;; (c) Copyright 1982 and 1983, Computer * Thought Corporation. ;;; ;;; All Rights Reserved. ;;; ;;; ;;; ;;; Reference materials: ;;; ;;; Foderaro and Sklower, The FRANZ LISP Manual, September 1981. ;;; ;;; Weinreb and Moon, LISP MACHINE MANUAL, Symbolics, July 1981. ;;; ;;; Charniak et al., 1980. Artificial Intelligence Programming. ;;; ;;; Miller, 1982. The C*T Ada Tutor: Guide to the Implementation. ;;; ;;; The following code assumes familiarity with these materials. ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Ensure presence of needed files. (comment Assumes ct_load and some suitable file_map are present) ;;; Compiler Declarations and Global Variables -- #+franz (declare (macros t)) (declare (special *editor-lozenge-alist*)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Externally Call-able Functions/Macros -- ;;; Read until either a "|#", or until the end of file. #+franz (defsharp #/| (x) (do ((a (tyi) (tyi)) (b -1. a)) ((or (= a -1) (and (= a #/#) (= b #/|))) nil))) ;;; ALL RIGHT NOW. Here is THE WAY all Computer Thought read macros are done. ;;; Because of the danger of Symbolics defining a bunch of new sharp macros, all ;;; CT read macros will begin with #$. If necessary, we can change the $ to ;;; something else. ;;; This function is called whenever the reader sees #$. Our function will then ;;; TYI another character, then decide what to do. #+franz (defun ct_defsharp_dollar_dispatch (ignored_char_which_should_be_dollar_sign) (let ((ch (tyi))) (cond ;; macro for DIANA slots from pc ((eq ch #/%) `((diana_get pc ',(read)))) ;`((get (cdr pc) ',(read)))) ;; macro for DS variables. ((eq ch #/~) `((ds_get_var ',(read) pc))) ;; to get vars from mother ((eq ch #/^) `((ds_get_moms_var ',(read) pc))) ;; Template stuff. See ada_mode. ((eq ch #/\) `((,(cdr (assq (read) *editor-lozenge-alist*)) 25.))) ;; For mark. Wraps next expression in eval-when (c l e) ... ((eq ch #/.) `((eval-when (compile load eval) ,(read)))) (t (break unknown_sharp_dollar_macro_char t))))) #+franz (defsharp #/$ (x) (ct_defsharp_dollar_dispatch x)) ;;; You may need a VALUES here to splice stuff in. See the lisp machine. #+lispm (defun ct_defsharp_dollar_dispatch (ignore stream) (let ((ch (tyi stream))) (cond ;; macro for DIANA slots from pc ((eq ch #/%) `(diana_get pc ',(read stream))) ; ((eq ch #/%) `(get (cdr pc) ',(read stream))) ;; macro for DS variables. ((eq ch #/~) `(ds_get_var ',(read stream) pc)) ;; to get vars from mother ((eq ch #/^) `(ds_get_moms_var ',(read stream) pc)) ;; For use on Lisp Machine only. Used for reading in Template ;; lozenge characters. See Ada_mode for more info. ((eq ch #/\) `(,(cdr (assq (read stream) *editor-lozenge-alist*)) 25.)) ;; For Mark. Wraps next expression in eval-when (c l e) ... ((eq ch #/.) `(eval-when (compile load eval) ,(read stream))) (t (break "unknown_sharp_dollar_macro_char" t))))) #+lispm (set-syntax-#-macro-char #/$ #'ct_defsharp_dollar_dispatch) ;;; Don't use defvar since compat not loaded first. (setq *editor-lozenge-alist* '((identifier . "A") (statements . "B") (statement . "B") (code . "B") (condition . "C") (declarations . "D") (declaration . "D") (parameters . "E") (parameter . "E") (range . "F") (value . "G") (components . "H") (component_list . "H") )) ;;; eof ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;