;============================================================================
; WinLisp:
;
;               A B B R E V I A T I O N    P A C K A G E
;
; Copyright (c) Stephan POPOVITCH 1988-1989
; Author: Stephan POPOVITCH
;============================================================================

(defvar errnotasym	"not a symbol")
(defvar errsxt 		"bad {} abreviation")
(defvar errbracesxt	"} without matching {")
(defvar errnotanabbrev 	"not an abbreviation")

(dmd defabbrev (symbol long-name)
    `(put-abbrev ',symbol ',long-name))

(de put-abbrev (symbol long-name)
    (unless (symbolp symbol) (error 'put-abbrev 'errnotasym symbol))
    (unless (symbolp long-name) (error 'put-abbrev 'errnotasym long-name))
    (putprop symbol long-name 'abbrev))

(de get-abbrev (symbol)
    (unless (and (symbolp symbol) (abbrevp symbol))
            (error 'get-abbrev errnotanabbrev symbol))
    (getprop symbol 'abbrev))

(de abbrevp (symbol)
    (when (memq 'abbrev (plist symbol)) t))

(dmc |}| ()
     (error '|}| errbracesxt ()))

(dmc |{| ()
    (let ((l (read-delimited-list #/})))
         (unless (and (consp l) (symbolp (car l)) (null (cdr l)))
                 (error '|{| errsxt l))
         (if (<> (peekcn) #/:)
	     (get-abbrev (car l))
	     (let ((#:winlisp:colon (get-abbrev (car l))))
		  (read)))))

