mixin.lisp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. (in-package :trivial-gray-streams)
  2. (defclass trivial-gray-stream-mixin () ())
  3. #+lispworks
  4. (progn
  5. (defgeneric stream-read-sequence (stream sequence &optional start end))
  6. (defgeneric stream-write-sequence (stream sequence &optional start end))
  7. (defmethod stream:stream-read-sequence
  8. ((s trivial-gray-stream-mixin) seq start end)
  9. (stream-read-sequence seq start end))
  10. (defmethod stream:stream-write-sequence
  11. ((s trivial-gray-stream-mixin) seq start end)
  12. (stream-read-sequence seq start end)))
  13. #+openmcl
  14. (progn
  15. (defgeneric stream-read-sequence (stream sequence &optional start end))
  16. (defgeneric stream-write-sequence (stream sequence &optional start end))
  17. (defmethod ccl:stream-read-vector
  18. ((s trivial-gray-stream-mixin) seq start end)
  19. (stream-read-sequence seq start end))
  20. (defmethod ccl:stream-write-vector
  21. ((s trivial-gray-stream-mixin) seq start end)
  22. (stream-write-sequence seq start end)))
  23. #+clisp
  24. (progn
  25. (defgeneric stream-read-sequence (stream sequence &optional start end))
  26. (defgeneric stream-write-sequence (stream sequence &optional start end))
  27. (defmethod gray:stream-read-byte-sequence
  28. ((s trivial-gray-stream-mixin)
  29. seq
  30. &optional start end no-hang interactive)
  31. (when no-hang
  32. (error "this stream does not support the NO-HANG argument"))
  33. (when interactive
  34. (error "this stream does not support the INTERACTIVE argument"))
  35. (stream-read-sequence seq start end))
  36. (defmethod gray:stream-write-byte-sequence
  37. ((s trivial-gray-stream-mixin)
  38. seq
  39. &optional start end no-hang interactive)
  40. (when no-hang
  41. (error "this stream does not support the NO-HANG argument"))
  42. (when interactive
  43. (error "this stream does not support the INTERACTIVE argument"))
  44. (stream-write-sequence seq start end)))