|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T V
Length: 6936 (0x1b18)
Types: TextFile
Names: »V«
└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
└─⟦5cb1d1d7f⟧ »DATA«
└─⟦3b1ee7bd8⟧
└─⟦this⟧
--
-- DOCUMENT_HANDLER by Richard Conn, TI Ada Technology Branch
-- 27 Feb 85
--
with Text_Io, Machine_Dependencies, Token_Definition;
package Document_Handler is
--------------------------------------------------------------------------
-- Abstract : DOCUMENT_HANDLER provides input from a document, which
-- is specified to OPEN_SOURCE by a pathname/filename.
-- It returns a WORD from this document each time the routine
-- GET_WORD is called. When there are no more WORDs in the
-- document, the exception NO_MORE_WORDS is raised.
--
-- DOCUMENT_HANDLER can also create a second document, the
-- destination, or output, document. This facility is
-- enabled when the routine OPEN_DESTINATION is called,
-- where the pathname/filename of the new document is the
-- passed parameter. The destination document is a mirror
-- of the source document, except that selected words can
-- be replaced with other words via the RESTORE_WORD routine.
-- RESTORE_WORD replaces the last word returned by GET_WORD
-- with a new word.
--
-- The context, or lines surrounding the last word returned
-- by GET_WORD, can be obtained from the CONTEXT_OF_LAST_
-- GET_WORD routine. This routine returns LINES, which is
-- an array of strings, and an INDEX, which is the offset
-- to the first character of the last word returned by
-- GET_WORD, and LENGTH, which is the number of characters
-- in this word. The constant, TARGET_LINE_IN_CONTEXT,
-- is the index of the line of the context which contains
-- the indicated word.
--
--------------------------------------------------------------------------
subtype Token is Token_Definition.Token_Type;
Max_Line : constant Positive := Machine_Dependencies.File_Line_Length;
Number_Of_Lines_In_Context : constant Natural := 3;
Target_Line_In_Context : constant Natural := 2;
type Context_Element is
record
Line : String (1 .. Max_Line);
Last : Natural;
end record;
type Context is array (1 .. Number_Of_Lines_In_Context) of Context_Element;
-- Note: Exceptions from TEXT_IO may also be raised
Restore_Failed : exception;
No_More_Words : exception;
Source_Not_Open : exception;
procedure Open_Source (File_Name : String);
--------------------------------------------------------------------------
-- Abstract : The source document from which future words are to be
-- returned is opened for input. GET_WORD returns these
-- words.
--------------------------------------------------------------------------
-- Parameters : FILE_NAME - Pathname/Filename of file containing
-- document
--------------------------------------------------------------------------
procedure Open_Destination (File_Name : String);
--------------------------------------------------------------------------
-- Abstract : The destination document which is built of words from the
-- source document and new, correctly-spelled words provided
-- through RESTORE_WORD
--------------------------------------------------------------------------
-- Parameters : FILE_NAME - Pathname/Filename of file to contain
-- the destination document
--------------------------------------------------------------------------
procedure Close_Source_And_Destination;
--------------------------------------------------------------------------
-- Abstract : Close both the source document and destination document
-- files
--------------------------------------------------------------------------
-- Parameters : None
--------------------------------------------------------------------------
procedure Get_Word (Word : out Token; Word_In_Bounds : out Boolean);
--------------------------------------------------------------------------
-- Abstract : Return the next word from the Source Document
--------------------------------------------------------------------------
-- Parameters : WORD - the next word from the source document;
-- this structure includes the word itself
-- (as a string) and the word length
-- WORD_IN_BOUNDS - TRUE if WORD is small enough to fit in
-- a TOKEN; FALSE if WORD is larger than
-- the maximum size of a TOKEN; if FALSE,
-- the full word can be obtained from
-- the procedure CONTEXT
--------------------------------------------------------------------------
procedure Restore_Word (Word : String);
--------------------------------------------------------------------------
-- Abstract : Replace the last word obtained from GET_WORD with the
-- passed string (WORD); the replacement is done in the
-- destination document only (the source document is not
-- affected)
--------------------------------------------------------------------------
-- Parameters : WORD - the string containing the new word
--------------------------------------------------------------------------
procedure Context_Of_Last_Get_Word (Lines : out Context;
Index : out Natural;
Length : out Natural);
--------------------------------------------------------------------------
-- Abstract : Return the lines surrounding and including the last word
-- returned by GET_WORD; also return the INDEX and LENGTH
-- of the last word returned by GET_WORD which indicate
-- its position in the TARGET_LINE_IN_CONTEXT
--------------------------------------------------------------------------
-- Parameters : LINES - the context (lines) surrounding the last
-- word
-- INDEX - the offset to the first character of the
-- last word in TARGET_LINE_IN_CONTEXT
-- LENGTH - number of characters in the last word
-- in TARGET_LINE_IN_CONTEXT
--------------------------------------------------------------------------
end Document_Handler;