"
COPYRIGHT (c) 1989-92 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-92 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.3 1993-10-13 00:16:43 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.
typeIfStandard := #Stdin.
%{
_INST(filePointer) = MKOBJ(stdin);
%}
!
initializeForStdout
mode := #readwrite.
unBuffered := true.
typeIfStandard := #Stdout.
%{
_INST(filePointer) = MKOBJ(stdout);
%}
!
initializeForStderr
mode := #readwrite.
unBuffered := true.
typeIfStandard := #Stderr.
%{
_INST(filePointer) = MKOBJ(stderr);
%}
!
reOpen
"if I am one of the standard streams, reopen is easy"
'reopen NPExtStr' printNewline.
(typeIfStandard == #Stdin) ifTrue:[
^ self initializeForStdin
].
(typeIfStandard == #Stdout) ifTrue:[
^ self initializeForStdout
].
(typeIfStandard == #Stderr) ifTrue:[
^ self initializeForStderr
].
^ super reOpen
! !
!NonPositionableExternalStream methodsFor:'error handling'!
errorNotPositionable
^ self error:'positioning not allowd'
! !
!NonPositionableExternalStream methodsFor:'positioning'!
position
^ 0
!
position:anInteger
self errorNotPositionable
! !