FEPSIvOutput.mesa
Copyright (C) Xerox Corporation 1985. All rights reserved.
last edited by castillo 19-Jun-85 10:04:22
DIRECTORY
FEPSMergerOps USING [OutputH],
Interpress USING [LongOperator],
NSSegment USING [PageCount, PageNumber],
Stream USING [Handle],
XeroxCompress USING [PutBitsProc];
FEPSIvOutput: DEFINITIONS
SHARES Interpress =
BEGIN OPEN IP: Interpress;
This module defines the interface to FEPS output routines whose
primary job is to write data to the output. This
interface was created to hide various output and efficiency
specifics from rest of FEPS merge routine. The implementation is
assumed NOT to be reentrant.
Initialize must be called first to start things off.
outputH ... is the handle to output object. Usually it
is FEPSMergerOps.OutputH which contains NSFile
handle. It could be different for the test
environment.
initialSize ... is the initial size of the output file in pages.
growIncrement ... is the size that the file should grow every
time the size is exceeded.
bufferSize ... is the size of the buffer to be used.
PutBits writes the specified number of bits to the output. The
bits can be up to 16 bits. This routine exists mainly for the
Xerox compression algorthm which deals with nibbles (ugh!).
PutBits can only be called while in Bit Mode. Bit Mode is
entered with EnterBitMode call; it is ended with ExitBitMode
call. All other output routine cannot be called while in Bit
Mode. (Primarily done for efficiency)
PutByte writes the specified number bytes to the output.
Retrieve reads, from the input stream, specified number of bytes
and writes it out to the output.
GetCurrentPosition is called to retrieve the current output
position of the output. SetPosition is called to set the current
position.
CloseOutput will get rid of output buffers and excess pages
allocated to the file. It should be called after all output has
been completed.
EmptyOutput will get rid of output buffers and set the size to
zero.
IP* calls are used to put Interpress operands and operators into
the output.
=====
TYPES
=====
Position: TYPE = RECORD [
page: NSSegment.PageNumber,
offset: LONG CARDINAL];
========
CONSTANTS
=========
startPos: Position = [0,0];
=======
SIGNALS
=======
ExceptionKind: TYPE = {noResources, unknown};
Exception: SIGNAL [code: ExceptionKind];
This signal is resumable if code is noResources
==========
PROCEDURES
==========
General output routines
Initialize: PROCEDURE [
output: FEPSMergerOps.OutputH,
initialSize: NSSegment.PageCount,
growIncrement: NSSegment.PageCount,
bufferSize: NSSegment.PageCount];
PutBits: XeroxCompress.PutBitsProc;
PutByte: PROCEDURE [val: CARDINAL];
PutWord: PROCEDURE [val: CARDINAL];
Retrieve: PROCEDURE [inputSH: Stream.Handle, byteCount: LONG CARDINAL];
GetCurrentPosition: PROCEDURE RETURNS [pos: Position];
SetPosition: PROCEDURE [pos: Position];
CloseOutput: PROCEDURE;
EmptyOutput: PROCEDURE;
Interpress output routines
IPDo: PROCEDURE = INLINE {OpOnly[do]};
IPFindDecompressor: PROCEDURE = INLINE {OpOnly[findDecompressor]};
IPIdentifier: PROCEDURE [s: LONG STRING];
IPInteger: PROCEDURE [n: LONG INTEGER, length: CARDINAL ¬ 0];
IPMakePixelArray: PROCEDURE = INLINE {OpOnly[makePixelArray]};
IPMaskPixel: PROCEDURE = INLINE {OpOnly[maskPixel]};
IPRational: PROCEDURE [num: LONG INTEGER, den: LONG CARDINAL];
IPScale: PROCEDURE = INLINE {OpOnly[scale]};
IPSeqCompressedPixel: PROCEDURE [size: LONG CARDINAL];
OpOnly: PRIVATE PROCEDURE [code: IP.LongOperator];
END...
LOG
6Sep84 - Okamoto - Conceived and created.
20Nov84 - Okamoto - Changed FreeOutput to CloseOutput and added EmptyOutput.
19Jun85 - castillo - copyright notice.