home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / windows / winlisp.zip / LISPLIB.LZH / MACROCH.WL < prev    next >
Text File  |  1989-09-22  |  2KB  |  52 lines

  1. ;============================================================================
  2. ; WinLisp:
  3. ;
  4. ;    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
  5. ;
  6. ; Copyright (c) Stephan POPOVITCH 1988-1989
  7. ; Author: Stephan POPOVITCH
  8. ;============================================================================
  9.  
  10. (dmc | | ()                   ;CTRL-L character
  11.      (list 'loadfile (readstring)))
  12.  
  13. (defsharp |/| ()        ; returns ascii code of a character
  14.     (readcn))
  15.  
  16. (defsharp \\ ()            ; returns ascii code of a symbolic character
  17.     (let ((l (read)))
  18.          (let ((n (getprop l '#:sharp:value)))
  19.               (if n
  20.                   n
  21.                   (error '#:sharp:value "undefined value" l)))))
  22.  
  23. (mapc
  24.    (lambda (x y) (putprop x y '#:sharp:value))
  25.    '(null bell bs tab lf return cr  esc sp del rubout)
  26.    '(0    7    8  9   10 13     13  27  32 127 127))
  27.  
  28. (defsharp |^| ()        ; returns the ascii code of a control character
  29.     (logand 31 (readcn)))
  30.  
  31. (defsharp |"| ()        ; returns a list of the ASCII codes of the string
  32.    (let ((l) (i))
  33.         (untilexit eoc
  34.            (if (= (setq i (readcn)) #/")
  35.                (if (= (peekcn) #/")
  36.                    (newl l (readcn))
  37.                    (exit eoc (reverse l)))
  38.                (newl l i)))))
  39.  
  40. (defsharp |:| ()        ; to restore ":" character as package separator 
  41.     (typecn #/: 'cpkgc) 
  42.     (protect (read) 
  43.              (typecn #/: 'cmacro)))
  44.  
  45. (dmc |]| () (error |]| "syntax error" "must appear after a ["))
  46.  
  47. (defsharp |[| ()       ; to read a constant vector as :  #[1 2 (a b)]
  48.     (apply 'vector (read-delimited-list #/])))
  49.  
  50. (defsharp |.| () 
  51.     (eval (read)))
  52.