"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
ExternalStream subclass:#NonPositionableExternalStream
instanceVariableNames:'typeIfStandard'
classVariableNames:''
poolDictionaries:''
category:'Streams-External'
!
NonPositionableExternalStream comment:'
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
this one stands all non-positionable external streams; there are
terminal streams, pipe streams etc.
$Header: /cvs/stx/stx/libbasic/NonPositionableExternalStream.st,v 1.5 1993-11-08 02:31:05 claus Exp $
'!
%{
#include <stdio.h>
%}
!NonPositionableExternalStream class methodsFor:'instance creation'!
forStdin
^ self basicNew initializeForStdin
!
forStdout
^ self basicNew initializeForStdout
!
forStderr
^ self basicNew initializeForStderr
! !
!NonPositionableExternalStream methodsFor:'private'!
initializeForStdin
mode := #readonly.
buffered := true.
typeIfStandard := #Stdin.
%{
_INST(filePointer) = MKOBJ(stdin);
%}
!
initializeForStdout
mode := #readwrite.
buffered := false.
typeIfStandard := #Stdout.
%{
_INST(filePointer) = MKOBJ(stdout);
%}
!
initializeForStderr
mode := #readwrite.
buffered := false.
typeIfStandard := #Stderr.
%{
_INST(filePointer) = MKOBJ(stderr);
%}
!
reOpen
"if I am one of the standard streams, reopen is easy"
(typeIfStandard == #Stdin) ifTrue:[
^ self initializeForStdin
].
(typeIfStandard == #Stdout) ifTrue:[
^ self initializeForStdout
].
(typeIfStandard == #Stderr) ifTrue:[
^ self initializeForStderr
].
^ super reOpen
! !
!NonPositionableExternalStream methodsFor:'redefind basic'!
size
"report an error that this stream has no concept of size"
self shouldNotImplement
!
position
"report an error that this stream has no concept of position"
self shouldNotImplement
!
position:anInteger
"report an error that this stream has no concept of position"
self shouldNotImplement
! !