display-char.sl 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %
  3. % DISPLAY-CHAR.SL
  4. %
  5. % Author: Alan Snyder
  6. % Hewlett-Packard/CRC
  7. % Date: 8 October 1982
  8. %
  9. % This file defines MACROS. Load it at Compile Time!
  10. %
  11. % Display characters are ASCII characters that are "tagged" with display
  12. % enhancement bits. They are used by the Windows package. This file defines
  13. % macros for creating and manipulating display characters.
  14. %
  15. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  16. (load fast-int)
  17. (put 'INVERSE-VIDEO 'enhancement-bits 1)
  18. (put 'BLINK 'enhancement-bits 2)
  19. (put 'UNDERLINE 'enhancement-bits 4)
  20. (put 'INTENSIFY 'enhancement-bits 8)
  21. (dm dc-make-enhancement-mask (form)
  22. (setf form (cdr form))
  23. (let ((mask 0) bits)
  24. (for (in keyword form)
  25. (do (if (setf bits (get keyword 'enhancement-bits))
  26. (setf mask (| mask bits))
  27. (StdError (BldMsg "Undefined enhancement: %p" keyword))
  28. )))
  29. (<< mask 8)))
  30. (defmacro dc-make-font-mask (font-number)
  31. `(<< ,font-number 12))
  32. (defmacro display-character-cons (enhancement-mask font-mask char-code)
  33. `(| (| ,enhancement-mask ,font-mask) ,char-code))
  34. (defmacro dc-enhancement-mask (dc)
  35. `(& ,dc 16#F00))
  36. (defmacro dc-enhancement-index (dc)
  37. % Use this to index an array.
  38. `(& (>> ,dc 8) 16#F))
  39. (defmacro dc-font-mask (dc)
  40. `(& ,dc 16#F000))
  41. (defmacro dc-font-number (dc)
  42. `(>> ,dc 12))
  43. (defmacro dc-character-code (dc)
  44. `(& ,dc 16#FF))