// Streams.D -- Common declarations for stream stuff
// Copyright Xerox Corporation 1979
// Last modified July 11, 1979  7:05 PM by Taft

//---------------------------------------------------------------------------
structure ST:		// basic stream
//---------------------------------------------------------------------------
[
par1 word		// par words are used for various nefarious purposes
par2 word		// and sometimes exported by stream implementations.
close word
gets word
puts word
reset word
putback word
error word
endof word
stateof word
type word
par3 word
]
manifest lST = size ST/16

manifest		// Registered stream types
[
stTypeDisk = 10001b
stTypeDisplay = 10101b
stTypeKeys = 10201b
]

// This declaration (and its elaboration in FSp) must parallel the
// machine-language declaration in FastStreamsA.asm.
// The declaration of lFSp must be greater than the actual size of FSp

manifest lFSp = 12
//---------------------------------------------------------------------------
structure FS:		// Fast Stream
//---------------------------------------------------------------------------
[
@ST			// a standard stream, plus...
fsp word lFSp		// some stuff private to the fast stream module
]
manifest lFS = size FS/16

manifest
[
// Fast Stream item sizes
charItem = 1
wordItem = 2

// Disk Stream (KS) length
lKS = lFS+26

// KS types
ksTypeReadOnly = 1
ksTypeWriteOnly = 2
ksTypeReadWrite = 3
]

//--------------------------------------------------------------------------
structure SSD:		// Scan Stream Descriptor
//--------------------------------------------------------------------------
[
da word			// Disk address of last page returned
pageNumber word		// Page number
numChars word		// Number of characters in page
// Rest of SSD is private to the implementation
]

//--------------------------------------------------------------------------
structure DS:		// Display Stream (DspStreamsB.bcpl, ...A.asm)
//--------------------------------------------------------------------------
[
@ST =
   [
   fdcb word		// this is ST.par1; -> First dcb
   ldcb word		// this is ST.par2; -> Last dcb
   blank word 9		// skip over rest of stream definition except...
   cdcb word		// "Current" dcb in ST.par3
   ]
scroll	word		// User scroll routine if wanted
compact	word		// System compact routine
// Much, much more stuff you don't need
]
manifest lDS = (size DS/16) + 20

manifest
[			// DS options
DScompactleft = 1	// eliminate leading blank words
DScompactright = 2	// eliminate trailing blank words
DSstopright = 4		// discard rather than scroll on line overflow
DSstopbottom = 8	// discard rather than lose screen data
DSnone = 16		// so 0 can default to left+right

DSdelete = 1		// 'how' values for ShowDisplayStream
DSalone = 2
DSabove = 3
DSbelow = 4
]


// The following definitions don't have much to do with streams,
//  but they have to be in some OS declaration file,
//  and most users already get this one, so...
//--------------------------------------------------------------------------
structure ZN:		// Free Storage Zone (Alloc.bcpl)
//--------------------------------------------------------------------------
[
Allocate word		// Call0
Free word		// Call1
// plus much more stuff private to the allocator
]


manifest
[
// ** must match private definitions in Dirs.bcpl **
verNew = 140000b
verNewAlways = 160000b
verLatestCreate = 40000b+2
verLatest = 1
verOldest = 100000b

lHD = 3  // Hole Descriptor length
]