2004-10-03 16:07:48 -04:00
|
|
|
IN: scratchpad
|
|
|
|
USE: namespaces
|
|
|
|
USE: streams
|
|
|
|
USE: stdio
|
|
|
|
USE: test
|
2004-11-28 21:56:58 -05:00
|
|
|
USE: stack
|
|
|
|
USE: generic
|
2004-10-03 16:07:48 -04:00
|
|
|
|
|
|
|
[ "xyzzy" ] [ [ "xyzzy" write ] with-string ] unit-test
|
|
|
|
|
2004-11-28 21:56:58 -05:00
|
|
|
TRAITS: xyzzy-stream
|
|
|
|
|
|
|
|
M: xyzzy-stream fwrite-attr ( str style stream -- )
|
|
|
|
[
|
|
|
|
drop "<" delegate get fwrite
|
|
|
|
delegate get fwrite
|
|
|
|
">" delegate get fwrite
|
|
|
|
] bind ;M
|
|
|
|
|
|
|
|
M: xyzzy-stream fclose ( stream -- )
|
|
|
|
drop ;M
|
|
|
|
|
|
|
|
M: xyzzy-stream fflush ( stream -- )
|
|
|
|
drop ;M
|
|
|
|
|
|
|
|
M: xyzzy-stream fauto-flush ( stream -- )
|
|
|
|
drop ;M
|
|
|
|
|
|
|
|
C: xyzzy-stream ( stream -- stream )
|
|
|
|
[ delegate set ] extend ;C
|
|
|
|
|
2004-10-03 16:07:48 -04:00
|
|
|
[
|
|
|
|
"<xyzzy>"
|
|
|
|
] [
|
|
|
|
[
|
2004-11-29 23:14:12 -05:00
|
|
|
stdio get <xyzzy-stream> [
|
2004-10-03 16:07:48 -04:00
|
|
|
"xyzzy" write
|
2004-11-28 21:56:58 -05:00
|
|
|
] with-stream
|
2004-10-03 16:07:48 -04:00
|
|
|
] with-string
|
|
|
|
] unit-test
|