DataMuseum.dk

Presents historical artifacts from the history of:

Rational R1000/400 Tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Rational R1000/400 Tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - download
Index: ┃ T V

⟦757cfcf0d⟧ TextFile

    Length: 10200 (0x27d8)
    Types: TextFile
    Names: »V«

Derivation

└─⟦d10a02448⟧ Bits:30000409 8mm tape, Rational 1000, ENVIRONMENT, D_12_7_3
    └─ ⟦fc9b38f02⟧ »DATA« 
        └─⟦9b46a407a⟧ 
            └─⟦c84a2ac9b⟧ 
                └─⟦this⟧ 

TextFile

with Directory_Tools;
with Errors;
with Heap_Strings;
with System;

package Document is
    package Object renames Directory_Tools.Object;

    type Element is private;
    Nil_Element : constant Element;
    function Is_Nil (An_Element : Element) return Boolean;

    type Classes is (Postscript, Lineprinter, Document_Db, Markup, Unknown);

    subtype Devices is Classes range Postscript .. Lineprinter;

    type    Paragraph_Mark_Kinds is (Title, Number, None);
    subtype Paragraph_Mark       is String;

    type Element_States is (Nil, Unresolved, Unmarked, Valid);

    -- An element resolves to a particular library object and can
    --   mark a particular paragraph in that object.
    --
    -- The state of an element reflects this info :
    --
    --    ELEMENT_STATE  Reason for being in the state
    --    -------------  -----------------------------------
    --         NIL       Uninitialized or set to NIL_ELEMENT.
    --     UNRESOLVED    RESOLVE of ELEMENT failed, no object exists,
    --                     access violation or lock error.
    --      UNMARKED     RESOLVE worked but no mark was set or
    --                     mark did not exist in the object.
    --       MARKED      RESOLVE worked and paragraph mark was found.

    function State_Of (The_Element : Element) return Element_States;

    function Last_Status_Of (The_Element : Element) return Errors.Condition;
    -- NIL, MARKED and UNMARKED with no mark set return ERRORS.OK.


    procedure Resolve (An_Element  : in out Element;
                       To_Pathname :        String;
                       Class       :        Classes := Unknown;  
                       Status      : in out Errors.Condition);

    procedure Resolve (An_Element : in out Element;
                       To_Handle  :        Object.Handle;
                       Class      :        Classes := Unknown;
                       Status     : in out Errors.Condition);


    function Handle_Of (The_Element : Element) return Object.Handle;
    -- Returns a nil handle if the element is NIL or UNRESOLVED.

    function Pathname_Of (The_Element : Element) return String;
    -- Returns a null string if the element is NIL.

    function Class_Of (The_Element : Element) return Classes;
    -- Returns Unknown if the element is NIL or UNRESOLVED.


    procedure Set_Mark (Of_Element : in out Element;
                        With_Paragraph_Mark_Kind : Paragraph_Mark_Kinds := None;
                        With_Paragraph_Mark_Image : String := "";
                        Status : in out Errors.Condition);

    function Mark_Of (An_Element : Element;  
                      Which      : Paragraph_Mark_Kinds) return String;



    -----------------------------------------------------------
    -- ELEMENTs are not 'safe' objects. To save them in
    --  permanent objects (like files), they must be converted to
    --  ELEMENT_PERMANENT_REPRESENTATIONs.
    --
    -- ELEMENT_PERMANENT_REPRESENTATIONs of elements in any
    --  ELEMENT_STATE can be made. If, after conversion from
    --  PERMANENT_REPRESENTATION back to ELEMENT, a previously
    --  UNRESOLVED or UNMARKED element can now be resolved or
    --  who's set mark now exists, the element state is changed
    --  and queries (like HANDLE_OF) may return different results.
    --  Similarly, if the object or mark has disappeared while
    --  the element was permanently stored, a previously MARKED
    --  or RESOLVED element may be restored as UNRESOLVED or UNMARKED.
    -----------------------------------------------------------

    type Element_Permanent_Representation is new String;

    function Convert (An_Element : Element;  
                      Within     : String := "<SUBSYSTEM>")
                     return Element_Permanent_Representation;
    -- The WITHIN parameter specifies how fully qualified the
    -- representation is (or should be resolved). When converting from
    -- an element to a permanent representation, the values can be :
    --   <FULL>         - The element's fully qualified resolution is
    --                    returned.
    --   <SUBSYSTEM>    - The resolution of the element is subsystem
    --                    relative. Subsystem name and spec or load origin
    --                    is preserved.
    --   <VIEW>         - The resolution of the element is view relative.
    --                    No origin information is preserved.
    --
    -- Storage for <SUBSYSTEM> or <VIEW> representation are less than
    -- <FULL> but some origin information is lost.
    --

    procedure Convert (An_Element_Rep :        Element_Permanent_Representation;
                       Result         : out    Element;
                       Status         : in out Errors.Condition;
                       Within         :        String := "<DEFAULT>");
    -- When converting from a permanent representation to an element,
    -- an attempt is made to fill in any missing information in the
    -- permanent representation from the WITHIN parameter. So, in all
    -- cases, if the permanent representation was FULLy resolved the
    -- WITHIN parameter is ignored, otherwise :
    --   <DEFAULT>      - For <SUBSYSTEM>, the view selected by
    --                    the current activity for the stored subsystem is
    --                    used as the origin. The spec or load origin of the
    --                    representation is used to pick the specific view.
    --                    For <VIEW>, the current view context is used as
    --                    the origin.
    --   subsystem name - For <SUBSYSTEM>, same as <DEFAULT>.
    --                    For <VIEW>, the view selected by the current
    --                    activity for the specified subsystem is used.
    --                    The subsystem name can be followed by "'SPEC" or
    --                    "'LOAD" to force use of the spec view or load
    --                    view from the activity. (Defaults to Spec View)
    --   view name      - For <SUBSYSTEM>, if the subsystem containing the
    --                    specified view matches the representation's
    --                    subsystem, the specified view is used.
    --                    If no match, same as <DEFAULT>.
    --                    For <VIEW> the specified view is used.


    function Unique_Id (For_Element : Element) return Long_Integer;
    -- Generates a unique number for any element.
    -- Useful for building maps for elements.



    -------------------
    -- LIST operations
    -------------------

    type Element_List is private;
    Nil_List : constant Element_List;

    -- Assignment on a LIST  * * DOES NOT CAUSE A COPY TO BE MADE! * *
    -- Use COPY to do that.

    procedure Copy (From_List : Element_List; To_List : in out Element_List);

    procedure Add (An_Element : Element; To_List : in out Element_List);


    procedure Reset (A_List : in out Element_List);

    function Value (In_List : Element_List) return Element;

    procedure Next (In_List : in out Element_List);

    function Done (With_List : Element_List) return Boolean;


    -- These two operations return information relating to the cause/nature
    -- of the condition which caused FAILED to be raised.

    Failed : exception;

    function Diagnosis return String;
    function Status    return Errors.Condition;


    ---------------
    -- UTILITIES
    ---------------

    -------------------------------------------------
    -- Operations to bring up a window on an Element
    -------------------------------------------------
    procedure Definition (On_Element        :        Element;
                          In_Place          :        Boolean := False;
                          Edit              :        Boolean := False;
                          Library_Item_Only :        Boolean := False;
                          Status            : in out Errors.Condition);
    -- The LIBRARY_ITEM_ONLY parameter specifies if definition for
    --  UNMARKED elements is to bring up a window on the contents of
    --  the element or a Library OE window of the library containing
    --  the element with the element name highlighted.


    -- Hide these ...
    procedure Convert (An_Element_Rep :        Element_Permanent_Representation;
                       Result         : out    Element;
                       Status         : in out Errors.Condition;
                       Within         :        String := "<DEFAULT>";
                       Use_Heap       :        System.Segment);

    procedure Field_Copy (From_List :        Element_List;
                          To_List   : in out Element_List);
    -- If a data type contains a LIST and that data type is stored
    --   in a segmented heap and a selector on that pointed-to object
    --   returns a LIST, use this to get the LIST out.
    --   It will un-normalize the internal segmented heap pointers.

    function Debug_Image (Of_Element      : Element;
                          Level           : Natural;
                          Prefix          : String;
                          Expand_Pointers : Boolean) return String;

    function Debug_Image (Of_List         : Element_List;
                          Level           : Natural;
                          Prefix          : String;
                          Expand_Pointers : Boolean) return String;


    pragma Subsystem (Design_Facility, Closed);
    pragma Module_Name (4, 3581);
    pragma Bias_Key (27);

private

    type Element_Item;
    type Element is access Element_Item;
    pragma Segmented_Heap (Element);

    Nil_Element : constant Element := null;

    type Element_List_Item;
    type Element_List_Item_Pointer is access Element_List_Item;
    pragma Segmented_Heap (Element_List_Item_Pointer);


    type Element_List_Item is
        record
            An_Element : Element;
            Next       : Element_List_Item_Pointer;
        end record;

    type Element_List is
        record
            Root    : Element_List_Item_Pointer;
            Current : Element_List_Item_Pointer;
        end record;

    Nil_List : constant Element_List := (null, null);
end Document;