;============================================================================
; WinLisp:
;
;    S T A N D A R D   D E F S H A R P   M A C R O - C H A R A C T E R S
;
; Copyright (c) Stephan POPOVITCH 1988-1989
; Author: Stephan POPOVITCH
;============================================================================

(dmc || ()			   	;CTRL-L character
     (list 'loadfile (readstring)))

(defsharp |/| ()	    ; returns ascii code of a character
    (readcn))
 
(defsharp \\ ()		    ; returns ascii code of a symbolic character
    (let ((l (read)))
         (let ((n (getprop l '#:sharp:value)))
              (if n
                  n
                  (error '#:sharp:value "undefined value" l)))))
 
(mapc
   (lambda (x y) (putprop x y '#:sharp:value))
   '(null bell bs tab lf return cr  esc sp del rubout)
   '(0    7    8  9   10 13     13  27  32 127 127))
 
(defsharp |^| ()	    ; returns the ascii code of a control character
    (logand 31 (readcn)))
 
(defsharp |"| ()	    ; returns a list of the ASCII codes of the string
   (let ((l) (i))
        (untilexit eoc
           (if (= (setq i (readcn)) #/")
               (if (= (peekcn) #/")
                   (newl l (readcn))
                   (exit eoc (reverse l)))
               (newl l i)))))
 
(defsharp |:| ()	    ; to restore ":" character as package separator 
    (typecn #/: 'cpkgc) 
    (protect (read) 
             (typecn #/: 'cmacro)))

(dmc |]| () (error |]| "syntax error" "must appear after a ["))

(defsharp |[| () 	  ; to read a constant vector as :  #[1 2 (a b)]
    (apply 'vector (read-delimited-list #/])))

(defsharp |.| () 
    (eval (read)))
