package.lisp 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #+xcvb (module ())
  2. (in-package :cl-user)
  3. #+:abcl
  4. (eval-when (:compile-toplevel :load-toplevel :execute)
  5. (require :gray-streams))
  6. #+cmu
  7. (eval-when (:compile-toplevel :load-toplevel :execute)
  8. (require :gray-streams))
  9. #+allegro
  10. (eval-when (:compile-toplevel :load-toplevel :execute)
  11. (unless (fboundp 'excl:stream-write-string)
  12. (require "streamc.fasl")))
  13. #+ecl
  14. (eval-when (:compile-toplevel :load-toplevel :execute)
  15. (gray::redefine-cl-functions))
  16. (macrolet
  17. ((frob ()
  18. (let ((gray-class-symbols
  19. '(#:fundamental-stream
  20. #:fundamental-input-stream #:fundamental-output-stream
  21. #:fundamental-character-stream #:fundamental-binary-stream
  22. #:fundamental-character-input-stream #:fundamental-character-output-stream
  23. #:fundamental-binary-input-stream #:fundamental-binary-output-stream))
  24. (gray-function-symbols
  25. '(#:stream-read-char
  26. #:stream-unread-char #:stream-read-char-no-hang
  27. #:stream-peek-char #:stream-listen #:stream-read-line
  28. #:stream-clear-input #:stream-write-char #:stream-line-column
  29. #:stream-start-line-p #:stream-write-string #:stream-terpri
  30. #:stream-fresh-line #:stream-finish-output #:stream-force-output
  31. #:stream-clear-output #:stream-advance-to-column
  32. #:stream-read-byte #:stream-write-byte)))
  33. `(progn
  34. (defpackage impl-specific-gray
  35. (:use :cl)
  36. (:import-from
  37. #+sbcl :sb-gray
  38. #+allegro :excl
  39. #+cmu :ext
  40. #+(or clisp ecl mocl) :gray
  41. #+openmcl :ccl
  42. #+lispworks :stream
  43. #+abcl :gray-streams
  44. #-(or sbcl allegro cmu clisp openmcl lispworks ecl abcl mocl) ...
  45. ,@gray-class-symbols
  46. ,@gray-function-symbols)
  47. (:export
  48. ,@gray-class-symbols
  49. ,@gray-function-symbols))
  50. (defpackage :trivial-gray-streams
  51. (:use :cl)
  52. (:import-from #:impl-specific-gray
  53. ;; We import and re-export only
  54. ;; function symbols;
  55. ;; But we define our own classes
  56. ;; mirroring the gray class hierarchy
  57. ;; of the lisp implementation (this
  58. ;; is necessary to define our methods
  59. ;; for particular generic functions)
  60. ,@gray-function-symbols)
  61. (:export ,@gray-class-symbols
  62. ,@gray-function-symbols
  63. ;; extension functions
  64. #:stream-read-sequence
  65. #:stream-write-sequence
  66. #:stream-file-position
  67. ;; deprecated
  68. #:trivial-gray-stream-mixin))))))
  69. (frob))