@X @~
~V7 56 2 -5
~D10
~H                    MUSS
~
~
~D10
~H             LIB042A
~D10
~MMANCHESTER UNIVERSITY  -  CONFIDENTIAL
~
~
                                                           ISSUE 11~
~V9 -1
~P
~V9 1
~YLIB042A
~S1~M~OLIB IMPLEMENTATION DESCRIPTION
~
~M~OSection 4 Version 2A
~S1~OSection 4.2A Basic Input / Output Operations
~S1~O1. General Description
~BThis module and its associated sub-sections provides the basic
input/output functions for defining streams, managing them and for
performing simple input and output operations.
~S1~O2. Interfaces
~
~
Other modules used~
   LIB06 (Advanced input/output operations)~
   LIB07 (File and current file handling)~
~
Configuration parameters~
   NO.OF.STREAMS~
   NO.OF.IO.CONTROL.AREAS~
   MAX.STREAM.NO~
   NO.OF.BUFFERS~
   IO.BUFFER.BLOCK~
   IO.CONTROL.SEG~
   MAPPED.IO.CONTROL.SEG~
   SECT.SIZE.DEFAULT~
   WAIT.TIME
~S1~O2.1 Software Interface
~
~
1) NO.OF.STREAMS
~BThe total number of input and output stream available to a process.~
~
~
2) NO.OF.IO.CONTROL.AREAS
~BThe total number of I/O control areas available (equal to
NO.OF.STREAMS + 1)~.
~
~
3) MAX.STREAM.NO
~BThe maximum value of an input or output stream number.~
~
~
4) NO.OF.BUFFERS
~BThe number of buffer blocks availale for overlaying the
blocks of an X segment.~
~
~
5) IO.BUFFER.BLOCK
~BThe block number of the first buffer block in the I/O control
segment.~
~
~
6) IO.CONTROL.SEG
~BThe number of the segment to be used for I/O control areas.~
~
~
7) MAPPED.IO.CONTROL.SEG
~BThe preferred mapped segment number of the I/O control segment.~
~
~
8) SECT.SIZE.DEFAULT
~BThe default size of a section (normally the machine segment size).~
~
~
9) WAIT.TIME
~BThe maximum time to wait for a message or a stream.
~S1~O3. Implementation
~S1~O3.1 Outline of Operation
~BThe actual procedures for performing the input/output operations are
contained in the following sub-sections.~
~
~
   LIB042B Stream definition and enquiry~
   LIB042C Document name processing~
   LIB042D Stream section management~
   LIB042E Positioning operations and buffer management~
   LIB042F Character and record operations.
~S1~O3.2 Data Structures
~T% 30
~
~
IO.CONTROL.AREA~IA type defining the variables required to
control an input/output stream.~
   :NAME1~IPart of a document name.  The value depends on the
type of document, namely~
~IUSERNAME (File stream)~
~IPROCESSNAME (Message stream)~
   :NAME2~IPart of a document name.  Holds a machine name in the
case of a message stream.~
   :MODE~IMode of a stream, as defined in the user manual.~
   :SECTION.SIZE~ICurent size of a document.~
   :MAX.SECTION.SIZE~IMaximum size that a document can extend to.~
   :REC.START~IDisplacement from the start of a document to the
housekeeping information of the current record.~
   :REC.END~IDisplacement from the start of a document to the
first byte beyond the current record.~
   :PTR.START~IDisplacement from the start of a document to the
currently available block of I/O.~
   :PTR~IDisplacement from PTR.START of the current I/O position,
i.e. the next character to be read or the next availale space for
outputting a character.~
   :PTR.END~IDisplacement from PTR.END of the first position
beyond the currently available block of I/O.~
   :DOC.TYPE~IThe type of input/output document, as defined by
PROCESS.NAME.~
   :SECTION.NO~INumber of the current section on a stream.~
   :SEG~ISegment number of the buffered document.~
   :BLOCK~IBlock number of the X segment currently being
accessed.~
   :SEG.STATUS~ISegment status associated with SEG.~
   :REPLY.TO.STREAM~IStream number to be used for REPn* documents.~
   :IN.CHANNEL~IMessage channel to be used for input messages
(as given in CHn*).~
   :BUF~INumber of the buffer block currently holding the block of
an X segment.  Negative if unused.~
   :HDR~IA flag indicating that I/O operations are currently being
performed with the header of a document.~
   :HEADER~IA pointer to the header of a message document.~
   :BYTE.PTR~IA pointer to the currently accessible portion
of an I/O document.~
   :PROMPT.MESSAGE~IA pointer to the prompt message.~
   :IO.FILE~IA pointer to the filename of a file stream.
The filename itself is held in the message vector.~
   :PROC.INFO~IA vector of four integers holding the destination address
of a process, or the source address for a message input stream.~
   :MESSAGE~IA vector used to hold start message documents.  Also
holds a filename for file documents.~
~
IO.CONTROL~IA vector of I/O control areas, dynamically allocated
when a stream is defined.~
~
I.STREAM~
O.STREAM~IVectors indicating which I/O control area is
associated with a particular input or output stream.
Unallocated entries are initialised to the number of I/O control areas.~
~
CURRENT.IN~
CURRENT.OUT~IThe stream number of the currently selected input
or output stream.~
~
IO.AREA.COUNT~ICount of the number of I/O control areas currently
allocated.~
~
BUF.PTR~IA cyclic pointer used to indicate which of the buffers
should be used for overlaying the blocks of an X segment document.~
~
PROMPT.CHAR~IThe character to be output at the start of any
prompt message.~
~
INPUT~
OUTPUT~IPointers to the I/O control areas associated with the
current input and output streams.~
~
IO.BUFFER.VA~IVirtual address of the first overlay buffer block.~
~
BUFFER~IA vector indicating which I/O control area is
associated with an overlay buffer.
~Y
~V9 -1
~P
~V9 -1
~D15
~HFLOWCHARTS
~
~
~H                LIB042A
~V9 -1
~F
@TITLE LIB04(2A,11)

@COL 1S-2R-3R-4R-5R-6F

@FLOW 1-2-3-4-5-6

@BOX 1.0
BASIC INPUT / OUTPUT LIBRARY
@BOX 4.0
SUB-SECTIONS IN MODULE:
   B STREAM MANAGEMENT OPERATIONS
   C DOCUMENT NAME PROCESSING
   D DOCUMENT SECTION MANAGEMENT
   E POSITIONING OPERATIONS
   F CHARACTER AND BINARY INPUT/OUTPUT OPERATIONS
   G UNIT INPUT/OUTPUT OPERATIONS
   H RECORD INPUT/OUTPUT OPERATIONS
@BOX 6.0
END
@BOX 1.1
#LIB04/1
MODULE (
   INIT.IO, dEFINE.iNPUT, dEFINE.oUTPUT, dEFINE.io, DEFINE.STRING.IO,
   eND.iNPUT, eND.oUTPUT, CURRENT.INPUT,
   CURRENT.OUTPUT, I.MODE, O.MODE, I.SEG, O.SEG, I.SOURCE, I.ENQ,
   I.SIZE, O.SIZE, sELECT.iNPUT, sELECT.oUTPUT, CHANGE.DEST,
   I.DOC, O.DOC, R.SIZE,

   PROCESS.NAME,

   bREAK.iNPUT, bREAK.oUTPUT, PROMPT, SELECT.HEADER, SELECT.DOC,
   OUT.HDR, WIND, PROMPT.CH, END.POS,

   I.POS, O.POS, SET.IPOS, SET.OPOS, I.REC, O.REC, SET.IREC, SET.OREC,

   IN.CH, NEXT.CH, IN.BACKSPACE, IN.LINE, SKIP.LINE, IN.BIN,
   IN.REC, OUT.CH, OUT.LINE, OUT.BIN, OUT.REC, OUT.BACKSPACE,
   BACK.REC, LIB04.LAST.CH);
@BOX 2.1
LITERAL / INTEGER MESSAGE.SIZE = 80;
TYPE IO.CONTROL.AREA IS
   LOGICAL64 NAME1, NAME2
   INTEGER32 MODE, SECTION.SIZE, MAX.SECTION.SIZE
   INTEGER32 REC.START, REC.END, PREV.REC, PTR.START
   ADDR PTR, PTR.END
   INTEGER16 DOC.TYPE, SECTION.NO
   INTEGER16 SEG, BLOCK, SEG.STATUS, REPLY.TO.STREAM, IN.CHANNEL
   INTEGER16 OUT.CHANNEL, BUF, HDR
   ADDR [LOGICAL8] HEADER, BYTE.PTR, PROMPT.MESSAGE, IO.FILE
   INTEGER [4] PROC.INFO
   LOGICAL8 [MESSAGE.SIZE] MESSAGE;
@BOX 3.1
*GLOBAL 9;
LITERAL / ADDR [LOGICAL8] NIL =;
LITERAL / LOGICAL32 DEFINED = %80(7), ASSIGNED = %40(7),
   DIRECT.ACCESS = %20(7), IN = %10(7), OUT = %80(6), STRING.IO = %40(6),
   STREAM.OPTION = %10, EXCLUSIVE = %20, ONLINE = %80, CONTINUATIONS = %80,
   HEADER.MODE = %100, SHORT.MSSGE = %100, DISCARD = %400,
   SAVE = %200, SEPARATE.SECTIONS = 8, FILE.SEP = 4,
   SEPARATE.RECORDS = 2, REC.SEP = 1;
LITERAL / INTEGER SP = %20, CRRGE.RETURN = %D;
LOGICAL8 [MAX.STREAM.NO] I.STREAM, O.STREAM;
IO.CONTROL.AREA [NO.OF.IO.CONTROL.AREAS] IO.CONTROL;
INTEGER CURRENT.IN, CURRENT.OUT, IO.AREA.COUNT, BUF.PTR, PROMPT.CHAR;
ADDR IO.CONTROL.AREA INPUT, OUTPUT;
ADDR IO.BUFFER.VA;
INTEGER [NO.OF.BUFFERS] BUFFER;
@BOX 4.1
*CODE 1;
#LIB04/2
@BOX 6.1
*END
@END
@TITLE LIB04/1(2A,11)
@COL 1S-2R-3R-4R
@FLOW 1-2-3-4
@BOX 1.0
OTHER MODULES REFERENCED
@BOX 4.0
SYS14 VIRTUAL STORE MANAGEMENT
LIB07 FILE MANIPULATION
@BOX 1.1
::EXTERNAL ENVIRONMENT
@BOX 2.1
IMPORT LITERAL BYTES.PER.WORD, WAIT.TIME, NO.OF.BUFFERS,
   NO.OF.STREAMS, NO.OF.IO.CONTROL.AREAS, MAX.STREAM.NO, MAX.STREAM.MASK,
   IO.CONTROL.SEG, MAPPED.IO.CONTROL.SEG, IO.BUFFER.BLOCK;
IMPORT LITERAL INTEGER32 SECT.SIZE.DEFAULT;
@BOX 4.1
IMPORT LITERAL SYS14.PAGE.SIZE, SYS14.PAGE.SHIFT, SYS14.PAGE.MASK,
   SYS14.SEG.SHIFT, SYS14.X.SEG.SIZE;
IMPORT LITERAL ADDR SYS14.SEG.SIZE;
PSPEC LIB07.CURRENT.FILE.AVAILABLE () / INTEGER;
PSPEC LIB07.RELEASE.BUFFER.SEG (INTEGER);
PSPEC LIB07.GET.CURRENT.FILE () / INTEGER;
PSPEC LIB07.MAKE.CURRENT.FILE (INTEGER);
PSPEC ENTER.TRAP (INTEGER, INTEGER);
PSPEC CAPTION (ADDR [LOGICAL8]);
PSPEC OUT.NAME (LOGICAL64);
PSPEC SPACES (INTEGER);
PSPEC OUT.TIME ();
PSPEC OUT.DATE ();
PSPEC OUT.I (INTEGER32, INTEGER);
ADDR PW0, PW1, PW2, PW3, PW4, PW5, PW6;
LOGICAL64 PWW1, PWW2, PWW3;
@END

@TITLE LIB04/2(2A,11)

@COL 1S

@BOX 1.0
INCLUDE OTHER MODULES
@BOX 1.1
**FLIP MU6S:LIB042B 1
LIB04/1
**IN
**FLIP MU6S:LIB042C 1
LIB04/1
**IN
**FLIP MU6S:LIB042D 1
LIB04/1
**IN
**FLIP MU6S:LIB042E 1
LIB04/1
**IN
**FLIP MU6S:LIB042F 1
LIB04/1
**IN
**FLIP MU6S:LIB042B 1
LIB04
**IN
**FLIP MU6S:LIB042C 1
LIB04
**IN
**FLIP MU6S:LIB042D 1
LIB04
**IN
**FLIP MU6S:LIB042E 1
LIB04
**IN
**FLIP MU6S:LIB042F 1
LIB04
**IN
@END



