home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / pdl / gaddsgn.doc < prev    next >
Encoding:
Text File  |  1988-05-03  |  263.3 KB  |  4,466 lines

  1.                                   GGGGG  RRRRRR   AAAA   PPPPPP  HH  HH  IIIIII   CCCCC
  2.                                  GG      RR  RR  AA  AA  PP  PP  HH  HH    II    CC
  3.                                  GG      RRRR    AAAAAA  PPPPPP  HHHHHH    II    CC
  4.                                  GG  GG  RR  RR  AA  AA  PP      HH  HH    II    CC
  5.                                   GGGG   RR  RR  AA  AA  PP      HH  HH  IIIIII   CCCCC
  6.  
  7.  
  8.                                                   AAAA   DDDDD    AAAA
  9.                                                  AA  AA  DD  DD  AA  AA
  10.                                                  AAAAAA  DD  DD  AAAAAA
  11.                                                  AA  AA  DD  DD  AA  AA
  12.                                                  AA  AA  DD DD   AA  AA
  13.  
  14.  
  15.                              DDDDD   EEEEEE   SSSSS  IIIIII   GGGGG  NN  NN  EEEEEE  RRRRRR
  16.                              DD  DD  EE      SS        II    GG      NNN NN  EE      RR  RR
  17.                              DD  DD  EEEE     SSSS     II    GG      NNNNNN  EEEE    RRRRR
  18.                              DD  DD  EE          SS    II    GG  GG  NN NNN  EE      RR  RR
  19.                              DDDDD   EEEEEE  SSSSS   IIIIII   GGGG   NN  NN  EEEEEE  RR  RR
  20.  
  21.  
  22.                                              D E S I G N   D O C U M E N T
  23.  
  24.                                                   Preliminary  Version
  25.  
  26.                                                        JULY 1985
  27.  
  28.  
  29.                                                   Ada Technology Group
  30.                                                   SYSCON Corporation
  31.                                                   3990 Sherman Street
  32.                                                   San Diego, California 92110
  33.                                                    Table of Contents
  34.  
  35.                       Section                                                                Page
  36.                       ----------------------------------------------------------------------------
  37.                       1       INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
  38.  
  39.                       1.1    Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
  40.                       1.2    Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
  41.                       1.3    Background  . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
  42.  
  43.                       2      REQUIREMENTS SUMMARY  . . . . . . . . . . . . . . . . . . . . . 2-1
  44.  
  45.                       2.1    Feature Overview  . . . . . . . . . . . . . . . . . . . . . . . 2-1
  46.                       2.2    Functional Requirements . . . . . . . . . . . . . . . . . . . . 2-2
  47.                       2.2.1  Graphics Design Functions . . . . . . . . . . . . . . . . . . . 2-2
  48.                       2.2.2  Ada PDL Production Functions  . . . . . . . . . . . . . . . . . 2-3
  49.                       2.2.3  File Management Functions . . . . . . . . . . . . . . . . . . . 2-5
  50.                       2.2.4  MMI Functions . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
  51.                       2.3    Data Structure Requirements . . . . . . . . . . . . . . . . . . 2-8
  52.                       2.3.1  PDL Information   . . . . . . . . . . . . . . . . . . . . . . . 2-10
  53.                       2.3.2  Graphics Information  . . . . . . . . . . . . . . . . . . . . . 2-11
  54.  
  55.                       3      TOP-LEVEL DESIGN  . . . . . . . . . . . . . . . . . . . . . . . 3-1
  56.  
  57.                       4      MACROSCOPIC DESIGN  . . . . . . . . . . . . . . . . . . . . . . 4-1
  58.  
  59.                       4.1    RUN_GAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
  60.                       4.2    GRAPH_TREE_ACCESS . . . . . . . . . . . . . . . . . . . . . . .
  61.                       4.3    MMI . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  62.                       4.4    PDL_GEN . . . . . . . . . . . . . . . . . . . . . . . . . . . .
  63.                       4.5    GRAPHICS_DRIVER . . . . . . . . . . . . . . . . . . . . . . . .
  64.                       4.6    GKS_PRIME . . . . . . . . . . . . . . . . . . . . . . . . . . .
  65.                       4.7    VIRTUAL_TERMINAL  . . . . . . . . . . . . . . . . . . . . . . .
  66.  
  67.                                                  List of Illustrations
  68.                        Figure   Title                                                        Page
  69.                        --------------------------------------------------------------------------
  70.                        2-1     GAD Interfaces . . . . . . . . . . . . . . . . . . . . . . . 2-2
  71.                        2-2     Ada Graphic Notation Conventions . . . . . . . . . . . . . . 2-4
  72.                        2-3     MMI Menu Netowrk Organization  . . . . . . . . . . . . . . . 2-6
  73.                        2-4     MMI Menu Network Overview  . . . . . . . . . . . . . . . . . 2-7
  74.                        2-5     Major Data Structure Overview  . . . . . . . . . . . . . . . 2-10
  75.                        3-1     GAD II Architectural Diagram . . . . . . . . . . . . . . . . 3-2
  76.                        3-2     GAD II Control Flow Diagram  . . . . . . . . . . . . . . . . 3-3
  77.                        4-1     Run_GAD Procedure Design Diagram . . . . . . . . . . . . . . 4-3
  78.                        4-2     Graph_Tree_Access OODD . . . . . . . . . . . . . . . . . . .
  79.                        4-3     MMI OODD . . . . . . . . . . . . . . . . . . . . . . . . . .
  80.                        4-4     PDL_Generator OODD . . . . . . . . . . . . . . . . . . . . .
  81.                        4-5     Graphic_Driver OODD. . . . . . . . . . . . . . . . . . . . .
  82.                        4-6     GKS_Prime OODD . . . . . . . . . . . . . . . . . . . . . . .
  83.                        4-7     Virtual_Terminal_Interface OODD. . . . . . . . . . . . . . .
  84.  
  85.                                                      List of Tables
  86.                        Table   Title                                                        Page
  87.                        -------------------------------------------------------------------------
  88.                        4-1     Macroscopic Design Library . . . . . . . . . . . . . . . . . 4-2
  89.                        4-2     RUN_GAD Dependencies List  . . . . . . . . . . . . . . . . . 4-3
  90.                        4-3     GRAPH_TREE_ACCESS Dependencies List. . . . . . . . . . . . .
  91.                        4-4     MMI Dependencies List  . . . . . . . . . . . . . . . . . . .
  92.                        4-5     PDL_GENERATOR Dependencies List. . . . . . . . . . . . . . .
  93.                        4-6     GRAPHICS_DRIVER Dependencies List. . . . . . . . . . . . . .
  94.                        4-7     GKS_PRIME Dependencies List. . . . . . . . . . . . . . . . .
  95.                        4-8     VIRTUAL_TERMINAL_INTERFACE Dependencies List . . . . . . . .
  96.  
  97. 1.    INTRODUCTION
  98.  
  99. The Graphic Ada Designer (GAD)  is a tool principally targeted to assist with generation of design diagrams and Program
  100. Design Language (PDL) in support of the development of Ada software.  GAD is designed to create graphical Object
  101. Oriented Design Diagrams (OODDs) for Ada programs and high level PDL representations associated with each OODD.  GAD is
  102. written in Ada, hosted on VAX computer systems utilizing the VMS operating system and utilizes the capabilities of a
  103. VT100 compatible color bit mapped graphics terminal..
  104.  
  105. 1.1        PURPOSE
  106.  
  107. The development of GAD utilizes the Ada-based development methodology consisting of the following steps:
  108.  
  109.     o    Concept formulation
  110.     o    Requirements
  111.     o    Macroscopic design
  112.     o    Microscopic design
  113.     o    Code/debug
  114.     o    Integration/test
  115.     o    Evaluation
  116.  
  117. The macroscopic design phase is the point in the methodology where the Ada language is introduced in the form of OODDs
  118. and corresponding Ada-based PDL.  This document serves as the reference document for GAD tool development to the
  119. macroscopic level of design.  This document, together with the GAD User's Manual, forms the basis for the Critical
  120. Design Review (CDR) of the GAD tool development.
  121.  
  122.  
  123. 1.2        SCOPE
  124.  
  125. The design of GAD is presented in the remaining three sections.  The Requirements Summary Section provides an overview
  126. of GAD requirements based on the functional descriptions contained in the User's Manual.  The Top-Level Design Section
  127. identifies the major functional components of GAD and their architectural relationships.  The Macroscopic Design Section
  128. provides textual overview, the formal design OODDs and the corresponding PDL for the package specifications for each
  129. module that reflects the microscopic level of design.
  130.  
  131. 1.3        BACKGROUND
  132.  
  133. The GAD represents a major enhancement of a tool previously prototyped by SYSCON Corporation.  The GAD is designed to
  134. support the Ada Graphic Notation conventions derived by SYSCON from the Object Oriented Design work of Grady Booch and
  135. the Ada-based graphical representation techniques for analysis given by Dr. R. Buhr of Carleton University (see
  136. "Software Engineering with Ada" by Grady Booch and "System Design with Ada" by R.J.A. Buhr).  The development of the
  137. tool incorporates the SYSCON Ada software development methodology, which includes the use of the Ada Graphic Notation
  138. and the Ada PDL that this tool is designed to support.
  139.  
  140. 2.1        FEATURE OVERVIEW
  141.  
  142. The GAD is designed to use the capabilities of a color bit-mapped graphics terminal to build graphic representations of
  143. Ada program structures.  This tool will make use of available advanced hardware features, such as windowing, cursor
  144. control device input, internal memory and graphic segment manipulation capabilities, to provide an efficient interactive
  145. graphics environment.
  146.  
  147. The GAD will be hosted on a VAX, using the VMS operating system, and is written in Ada.  Initially the program will be
  148. compiled using the TeleSoft Ada compiler (Version 1.5).  The program will be written in machine and compiler independent
  149. Ada.  It will only be dependent on the graphics terminal and printer used. The hardware dependencies are to be localized
  150. to greatest extent possible.  The interaction of GAD with the user, host operating system and file system, and graphics
  151. terminal and printer is illustrated in Figure 2-1.
  152.  
  153. The design diagrams developed using GAD are stored in a tree-like representation form maintained by GAD and preserved in
  154. a file structure.  GAD uses the CRT to provide a "window" onto the diagram with the capability of pan and zoom. At
  155. standard zoom (ie. no magnification) the user can view an entire design diagram.  At maximum zoom, approximately 25% of
  156. the diagram will be displayed in the window.
  157.  
  158.                                                             VAX/VMS HOST
  159.                                        ---------------------------------------------------
  160.                                        |                     GAD                         |
  161.                                        |         -----------------------------------     |
  162.                                        |         | Functional  | Memory Resident   |     |
  163.                                        |         | Modules     | Tree Based Forms  |     |
  164.                                        |         -----------------------------------     |
  165.                                        |         |     Ada Runtime System          |     |
  166.                                        |         -----------------------------------     |
  167.                                        ---------------------------------------------------
  168.                                (* Keyboard &           ^      |    |     ^
  169.                                 Cursor Control Device) |      |    |     |
  170.                                    User Input *  ------+      |    |     +---> Design File
  171.                                 Graphics Output  <------------+    +---------> PDL File
  172.                                           |
  173.                                           v
  174.                                 Graphics Hardcopy
  175.  
  176.                                               Figure 2.1-1 GAD Interfaces
  177.  
  178. 2.2        Functional Requirements
  179.  
  180. The basic functions of GAD fall into four (4) major catagories.  The Graphics Design functions provide the capability to
  181. create, display and modify OODD diagrams on the graphics terminal.  The PDL Production functions provide the capability
  182. to extract the necessary syntax and semantic information from the design diagram data structures and generate PDL text
  183. files.  The Storage Management functions provide for the automatic creation and access to GAD files.  The MMI functions
  184. provide the user interface through which the design operator orchestrates all GAD operations.
  185.  
  186. 2.2.1    Graphics Design Functions
  187.  
  188. GAD provides a graphics design capability which consists of creating, deleting, and editing Object Oriented Design
  189. Diagrams formed of entities representing Ada structures (e.g., packages, subprograms, tasks, or bodies), and connections
  190. which represent relationships between entities. Strict Ada (PDL) syntax to the appropriate level of detail will be
  191. enforced in the graphs at the completion of each operation.  The graphics design capabilities will be in accordance with
  192. the Ada Graphic Design conventions summarized in figure 2-2 and described in detail in Section 3 of the GAD User's
  193. Manual.
  194.  
  195. 2.2.2    Ada PDL Production Functions
  196.  
  197. GAD provides a command to generate the PDL corresponding to the current graph design.  The program generates the PDL and
  198. places it in an ASCII text file of the name supplied by the user.
  199.  
  200. The Ada PDL that is produced will be syntactically correct, and compilable if context clause (with statement) is added
  201. for the DESIGN_SUPPORT_PACKAGE documented in the GAD User's manual.  For PDL generation, the general guideline will be
  202. to generate as much code as possible and permit the user to delete what is not needed. The code produced will be a mix
  203. of Ada and embedded English comment statements.
  204.  
  205. ENTITY DECLARATIONS                         CONTROL FLOW INDICATORS                         DATA FLOW INDICATORS
  206. (<name>)   - type declaration               ------>* - guarded entry                        o-*-*-*->
  207. :<name>:   - object declaration             T----->  - timed call on entry                  <-*-*-*-o
  208. <<name>>   - exception declaration          C----->  - conditional call on entry            <-*-*-*->
  209. |<name>|   - subprogram                     T----->* - timed call on guarded entry
  210. /<name>/   - task entry                     C----->* - conditional call on guarded entry
  211. |<name[]>| - subprogram with parameters     ------>  - caller-callee (subprograms, tasks)
  212. /<name[]>/ - task entry with parameters
  213.  
  214. IMPORT DECLARATIONS                                    EXPORT DECLARATIONS
  215. ------>  <name> - package/subprogram reference         ( )     - type
  216. ----->>  <name> - virtual package reference            : :     - object
  217.                                                        < >     - exception
  218.                                                        | |     - subprogram
  219.                                                        / /     - task entry
  220.  
  221.     VIRTUAL_PACKAGE             PACKAGE                             TASK                 SUBPROGRAM
  222.  <name>                   <name>(gd | gi)                  <name>
  223.  - - - - - - - - - - -    ---------------------            ---------------------        =====================
  224.                           |                   |        /<name>/      1         /        |<name>(gi | gd)    |
  225.  |                   |    |                   |            /                   /        |===================|
  226.                           |                   |        /<name1>/     2         /        |                   |
  227.  |                   |    |                   |        /<name2>/               /        ---------------------
  228.                           |                   |            /                   /        <name> -  procedure
  229.  |                   |    |                   |        /<name3>/     3         /       =<name> -  function
  230.                           |                   |        /<name4>/               /         gd - generic declaration
  231.  |                   |    |                   |            /                   /         gi - generic instantiation
  232.                           |                   |        /<name5>/     4         /
  233.  - - - - - - - - - - -    ---------------------            ---------------------
  234.                           gd - generic declaration          tt - task type          PACKAGE, SUBPROGRAM OR TASK BODY
  235.                           gi - generic instantiation             (not supported)          ---
  236.                                                              1 - single entry            /   \      O
  237.                                                              2 - selective wait          \   /
  238.                                                              3 - serial entries           ---
  239.                                                              4 - entry family
  240.  
  241.                                   Figure 2-2 Ada Graphic Notation Conventions Summary
  242. 2.2.3    File Management Functions
  243.  
  244. GAD provides mechanisms to save and restore graphs between invocations of the tool.  The necessary graphics and syntax
  245. information is saved in a file, one graph per file.  There are no relationships maintained by GAD between files,
  246. although a user may create a series of graphs depicting the evolution of a design.
  247.  
  248. The PDL text file is an ouput-only structure from the perspective of the GAD tool.  There are no editing capabilities
  249. provided with which to alter this file.  The file is strictly created from the design structures.  The PDL file is a
  250. standard VMS text file which can be accessed by source line editors or word processors, print utilities and Ada
  251. compiler(s) hosted on the system.
  252.  
  253. 2.2.4    MMI Functions
  254.  
  255. The GAD MMI provides an efficient means for designing Ada OODDs.  The MMI approach is predicated on utilizing the full
  256. capabilities of the graphics terminal (including color bit-mapped graphics, tone generation, cursor control device, and
  257. keyboard with definable 'soft' keys, if available).  The basic MMI goals are itemized below as:
  258.  
  259.     o     Minimize keyboard interaction
  260.     o    Maximize use of cursor control device
  261.     o     Support pick and move operations at terminal
  262.      o     Implement drawing using cursor control device to mark graph points
  263.     o     Provide menu support for 'pickable' command icons
  264.      o     Provide quick response by using the terminal's internal memory and segment operation capabilities
  265.  
  266. Figure 2-3 illustrates the MMI menu network.  Figure 2-4 illustrates the menu options and control flows through the MMI
  267. menu netork.
  268.  
  269.                                                                     ------------
  270.                                                                     | GENERIC  |        --------------
  271.                                                      +------------->| MENU     |        | PARAMETER  |
  272.                                                      |              ------------        | STATUS     |
  273.                                                      +-----------------------------+--->| MENU       |
  274.                                                 ----------          ------------   |    --------------
  275.                                       +-------->| CREATE |          |CONNECTOR |   |    --------------
  276.                                       |         | MENU   |--------->|MENU      |------->| CALL STATUS|
  277.                                       |         ----------          ------------   |    | MENU       |
  278.                                  ----------     ----------          ------------   |    --------------
  279.                                  | DESIGN |     | EDIT   |          |ANNOTATING|---+    --------------
  280.                             +--->| MENU   |---->| MENU   |--------->|MENU      |------->| ENTRY POINT|
  281.                             |    ----------     ----------          ------------        | STATUS     |
  282.                             |                        |                   |              --------------
  283.                             |                        |                   v
  284.                         --------                     |               ----------
  285.                         | MAIN |                     +-------------->|CONFIRM |
  286.                         | MENU |                                     |MENU    |
  287.                         --------                                     ----------
  288.                            |    --------------
  289.                            +--->| ATTRIBUTES |                             ------------
  290.                                 | MENU       |                     +------>| LINE     |
  291.                                 --------------                     |       | MENU     |
  292.                                        |         ---------------   |       ------------
  293.                                        +-------->| CHANGE TYPE |---+       ------------
  294.                                                  | MENU        |---------->| COLOR    |
  295.                                                  ---------------           | MENU     |
  296.                                                                            ------------
  297.  
  298.                                         Figure 2-3 MMI Menu Network Organization
  299. +--> Design Menu                     +-----> Create Menu       +--------> Generic Menu       +--> Parameter Status Menu
  300. |  ====================              |  ===================    |    =======================  |    =====================
  301. |  | CREATE           |--------------+  | VIRTUAL_PACKAGE |    |    | DECLARATION         |  |    | HAS PARAMETERS    |
  302. |  | EDIT             |------------+    | PACKAGE         |--->+    | INSTANTIATION       |  |    | NO PARAMETERS     |
  303. |  | DELETE           |---------+  |    | PROCEDURE       |--->+-+  | NON-GENERIC         |  |    =====================
  304. |  | MOVE             |         |  |    | FUNCTION        |--->+-+  =======================  |
  305. |  | ZOOM-IN          |         |  |    | TASK            |      +---------------------------+
  306. |  | ZOOM-OUT         |         |  |    | CONNECTION      |----------> Connector Menu        ^
  307. |  | PAN RIGHT        |         |  |    | BODY            |         =======================  |
  308. |  | PAN LEFT         |         |  |    ===================         | CALL                |------> Call Status Menu
  309. |  | PAN UP           |         |  +-----> Edit Menu                | DATA                |  |  =====================
  310. |  | PAN DOWN         |         |       ===================         =======================  |  | CONDITIONAL       |
  311. |  ====================         |       |  ADD            |-------------> Annotating Menu    |  | NORMAL            |
  312. +----------------+              |       |  MODIFY         |         =======================  |  | TIMED             |
  313.   Main Menu      |              |       |  REMOVE         |--+      | TASK ENTRY          |->+  =====================
  314. ===============  |              |       ===================  |      | EXPORT TYPE         |  |
  315. | DESIGN      |->+              +--------> Delete Menu <-----+      | EXPORT OBJECT       |  +---> Entry Point Menu
  316. | ATTRIBUTES  |------>+                 ===================         | EXPORT EXCEPTION    |     =====================
  317. | GENERATE PDL|       |                 | CONFIRM         |         | EXPORT PROCEDURE    |     | IS GUARDED        |
  318. | FILE        |       |                 | CANCEL          |         | EXPORT FUNCTION     |     | NOT GUARDED       |
  319. | PRINT       |       |                 ===================         | EXPORT TASK         |     =====================
  320. | QUIT        |       |         +-------> Change Type Menu          | EXPORT_TYPE         |
  321. | EXIT        |       |         |       ===================         | EXPORT_OBJECT       |
  322. ===============       |         |       | LINE            |---+     | EXPORT_EXCEPTION    |
  323.     Attributes Menu <-+         |       | COLOR           |-+ |     | EXPORT_PROCEDURE    |
  324. =====================           |       =================== | |     | EXPORT_FUNCTION     |
  325. | CONDITIONAL CALL  |-->+-------+        Color Menu    <----+ |     | EXPORT_TASK         |
  326. | TIMED CALL        |-->+               ===================   |     | IMPORT_V_PACKAGE    |
  327. | NORMAL REFERENCE  |-->+               | RED             |   |     | IMPORT_PACKAGE      |
  328. | VIRTUAL REFERENCE |-->+               | YELLOW          |   |     | IMPORT_PROCEDURE    |
  329. | GUARDED ENTRY     |-->+               | GREEN           |   |     | IMPORT_FUNCTION     |
  330. | CALL CONNECTION   |-->+               | VIOLET          |   |     =======================
  331. | DATA CONNECTION   |-->+               | ORANGE          |   +----->  Line Menu
  332. | SUBPROGRAM        |-->+               | BLACK           |         ===================
  333. | VIRTUAL PACKAGE   |-->+               | BROWN           |         |  SOLID          |
  334. | PACKAGE           |-->+               | BLUE            |         |  DASHED         |
  335. | TASK              |-->+               ===================         |  DOTTED         |
  336. =====================                                               ===================
  337.                                           Figure 2-4 MMI Menu Network Overview
  338.  
  339.  
  340. 2.3         DATA STRUCTURE REQUIREMENTS
  341.  
  342. The problem posed to GAD is to formulate a major data structure design that achieves a two-fold purpose.  The first is
  343. to provide a correlation between the graphic conventions for Ada entities (reference User's Manual, Section 3) and the
  344. Ada language semantic/syntax associated with each entity.  The second is to maintain the interrelationshps (e.g.
  345. scoping, call dependencies and data dependencies) between entities.
  346.  
  347. The data structures utilized by GAD are to capture the Ada syntax and graphical information associated with the graph as
  348. they are created, edited and positioned within the design diagram.  The data structures must support:
  349.  
  350.     o     PDL Generation
  351.     o     Regeneration of graphs between sessions
  352.      o     Detection of severed connections (due to move or delete operations)
  353.      o     Syntax and semantic information verification
  354.  
  355. To be able to perform the required functions, the data structure must support the ability to trace relations in multiple
  356. directions, such as parent-child and caller-callee.
  357.  
  358. The design of choice is to specify two different but related structures:  Syntax_Tree and Graph_Tree structures.  Figure
  359. 2-5 presents a structural overview of the major data structures.  The Syntax_Tree is comprised of two substructures,
  360. Tree_Node and Entity_List structures.  The Tree_Node structures contain basic information about the entity they
  361. represent, such as name, scope and generic attributes (if applicable).  Each Tree_Node contains a set of pointers to the
  362. various Entity_List structures which contain lists of information unique to the entity with which it is associated.  The
  363. types of Entity_List structures that will be maintained are:
  364.  
  365.     o  Contained_Lists
  366.     o  Callee_Lists
  367.     o  Data_Connect_Lists
  368.     o  Entry_Lists
  369.     o  Imported_Lists
  370.     o  Exported_Lists
  371.     o  Exception_Lists
  372.     o  Object_Lists
  373.     o  Type_Lists
  374.  
  375. The Graph_Tree structures consist of nodes which contain the basic graphic information about an entity, such as location
  376. and size.  The Syntax_Tree and Graph_Tree structures both contain different kinds of information about the objects being
  377. diagramed.
  378.  
  379. It should be noted that the data structure figure is a simplified representation.  In actuality, the various nodes and
  380. associated entity pointers are multi-threaded (for example, there exist forward and backward pointers between the nodes
  381. of the Syntax_Tree and Graph_Tree).  The structure takes on a more n-dimensional characteristic which is not
  382. representable on two-dimensional media.
  383.  
  384.                                              SYNTAX_TREE                          GRAPH_TREE
  385.                            ------------------------------------------------       -----------
  386.                            |    Tree Nodes  +------------------------------------>| Node 1  |
  387.                            |    ----------  |              List Nodes     |       |         |
  388.                            |    |  Root  |  |             -----------     |       |---------|
  389.                            | +->|        |--|------------>|         |     |   +-->| Node 2  |
  390.                            | |  ----------  |           ----------- |--+  |   |   |         |
  391.                            | |              | +-------->|         |--  |  |   |   |---------|
  392.                            | |  ----------  | |       ----------- |--+ |  |   |   |         |
  393.                            | +--| Node 1 |--+ |       |         |--  | |  |   |   |         |
  394.                            | +->|        |----+     ----------- |    | |  |   |   |---------|
  395.                            | |  ----------          |         |--    | |  |   |   |         |
  396.                            | |      ^               |         |      | |  |   |   |    :    |
  397.                            | |      |               -----------      | |  |   |   |    :    |
  398.                            | |      +----------------------------------+  |   |   |    :    |
  399.                            | |                                       |    |   |   |    :    |
  400.                            | |                                       |    |   |   |    :    |
  401.                            | |  ----------                           |    |   |   |         |
  402.                            | |  | Node n |<--------------------------+    |   |   |---------|
  403.                            | +__|        |--------------------------------|---+   | Node m  |
  404.                            |    ----------                                |       |         |
  405.                            |                                              |       -----------
  406.                            ------------------------------------------------
  407.  
  408.                                         Figure 2-5 Major Data Structure Overview
  409.  
  410. 2.3.1    PDL INFORMATION
  411.  
  412. Generation of the PDL requires information on each entity for which code is to be generated.  This information includes
  413. 1) the name, 2) the enclosing scope, 3) the type of entity, 4) a list of what it encloses, 5) it's relationship with
  414. other entities including whether it is exported, and 6) miscellaneous entity specific information (e.g., generic
  415. status).
  416.  
  417. The basic syntax information is provided in a tree-like arrangement of the structures described in Section 2.3 above.
  418. Much of the scope and relationship information required can be provided in a structure of this type.  Walking the tree
  419. to detect all references to particular entity (node) can be excessively time consuming.  For this reason, the basic
  420. Syntax_Tree is enhanced to include back pointers for each possible relationship (including parent-child).
  421.  
  422. 2.3.2    GRAPHICS INFORMATION
  423.  
  424. The minimum graphics information required for each entity is its size and position on the graph.  This information, and
  425. all other required graphics information, is stored in the Graph_Tree data structure described in Section 2.3.  The
  426. approach will be to use the terminal's hardware capabilities to simplify user selection, movement, and deletion
  427. operations.  This requires the maintenance of the graphic segment identifiers corresponding to each entity in the
  428. design.
  429.  
  430. The Software Architecture of GAD will resemble that of the prototype version of the tool.  Figure 3-1 illustrates the
  431. hierarchical organization of the functional modules.  The following is a brief overview of the GAD functional components
  432. or modules:
  433.  
  434.     RUN_GAD:
  435.      The MAIN procedure (Program Unit) of the tool.  It controls the initialization, execution, and termination of GAD.
  436.  
  437.     GRAPH_TREE_ACCESS_PKG:
  438.      This module defines the tree structure which holds the semantic and graphics data associated with the graph.  It
  439.      provides the necessary primitives to manipulate and access the tree.  It provides I/O routines for the capture and
  440.      preservation of design diagrams between editing sessions.
  441.  
  442.     MMI:
  443.      This module provides the MMI required to allow operation interaction with the tool.
  444.  
  445.     PDL_GEN:
  446.      This module implements the subprograms which generate the Ada PDL from the Graph Tree.
  447.  
  448.     GRAPHICS_DRIVER:
  449.      This module provides the routines to perform the graphics functions of GAD.
  450.  
  451.     GKS_PRIME:
  452.      This module provides a proper subset of the Graphics_Kernel_System (GKS).  This module encapsulates all terminal
  453.      specific characteristics of the system.
  454.  
  455.     VIRTUAL_TERMINAL:
  456.      This module provides a set of standard routines and data structures for ASCII Text I/O operations on a VT100 type
  457.      terminal.
  458.  
  459. Figure 3-2 uses Ada Graphic Notation to illustrate the control flow relationships of the GAD components.
  460.  
  461.          ------------------------------------------    ---------------------      ---------------------
  462.          |           |           |   PDL_         |    |                   |      |                   |
  463.          |           |           |    GENERATOR   |    |                   |      |                   |
  464.          | RUN_GAD   |   MMI     |----------------|    |                   |      |                   |
  465.          |           |           |   GRAPH_       |    |                   |      |                   |
  466.          |           |           |    TREE_       |    | Compiler Packages |      |                   |
  467.          |           |           |     ACCESS     |    | Run-Time System   |      |                   |
  468.          |----------------------------------------|    |                   |      |     VAX/VMS       |
  469.                              |                         |                   |    ->|    OPERATING      |
  470.                              v                         |                   |      |     SYSTEM        |
  471.          |----------------------------------------|    |-------------------|      |   ENVIRONMENT     |
  472.          |           GRAPHICS_DRIVER              |  ->|     SYSTEM        |      |                   |
  473.          |----------------------------------------|    |-------------------|      |                   |
  474.                    |                  |              ->|    CALENDAR       |      |                   |
  475.                    v                  v                |-------------------|      |                   |
  476.          |----------------------------------------|  ->|     TEXT_IO       |      |-------------------|
  477.          |    VIRTUAL_       |                    |    |-------------------|      |      SYSTEM       |
  478.          |     TERMINAL_     |    GKS_PRIME       |    |                   |      |                   |
  479.          |      INTERFACE    |                    |  ->|     DIRECT_IO     |      |    INTERFACES     |
  480.          ------------------------------------------    ---------------------      ---------------------
  481.  
  482.                                           Figure 3-1 GAD Architectural Diagram
  483. ----------------------------------------------------------------------------------------------------------------
  484. |                                                  GRAPH_TREE_ACCESS                                           |
  485. |         =====================                    - - - - - - - - - - -                                       |
  486. |         | RUN_GAD           |                                                                                |
  487. |         |===================|                    |                   |->+--------------------------->| DIRECT_IO |
  488. |         |                   |                 -------                   ^                                    |
  489. |         |                   |->+->+------+--->|     |                |  |                                    |
  490. |         |                   |  |  |      ^    -------                   |          VIRTUAL_TERMINAL          |
  491. |         ---------------------  |  |      |       |                   |  |          - - - - - - -             |
  492. |                                |  |      |       - - - - - - - - - - -  |                                    |
  493. |                                |  |      +------------------------------+          |            |            |
  494. |                                |  |                                     |       -------                      |
  495. |                                |  +-------------------------------------+------>|     |         |            |
  496. |                                |  |              PDL_GENERATOR          |       -------                      |
  497. |                                |  |              - - - - - - - - - - -  |          |            |-+          |
  498. |                                |  |              |                   |  |          - - - - - - -  |          |
  499. | +------------------------------+  |           -------                   |                         |          |
  500. | |                                 +---------->|     |                |  |                         |          |
  501. | |                                 |           -------                   |          GKS_PRIME      |          |
  502. | |                                 |              |                   |--+          - - - - - - -  v          |
  503. | |                                 |              - - - - - - - - - - -             |            |-+->| TEXT_IO |
  504. | |        MMI                      |              GRAPHICS_DRIVER                                             |
  505. | |        - - - - - - - - - - -    |              - - - - - - - - - - -             |            |            |
  506. | |                                 |                                             -------                      |
  507. | |        |                   |    |              |                   |     +--->|     |         |            |
  508. | |                                 |                                        |    -------                      |
  509. | |     -------                     |           -------                      |       |            |            |
  510. | +---->|     |                |----+---------->|     |                |     |       - - - - - - -             |
  511. |       -------                                 -------                 -----+------------------------->| CALENDER |
  512. |          |                   |                   |                   |                                       |
  513. |          - - - - - - - - - - -                   - - - - - - - - - - -                                       |
  514. ----------------------------------------------------------------------------------------------------------------
  515.  
  516.                                           Figure 3-2 GAD Control Flow Diagram
  517.  
  518.  
  519.  
  520.  
  521.  
  522.                                                                   SECTION 4
  523.                                                               Macroscopic Design
  524.  
  525.            The Macroscopic Design specifies the high-level design approach to providing the functions described in Section 2.4,
  526.  
  527.            Functional Requirements, Section 3, Top-Level Design, and based on the functional requirements described in the GAD
  528.  
  529.            User's Manual.  The functional modules described in Section 2.4 are each considered a "virtual package" in the
  530.  
  531.            Macroscopic Design phase of the methodology.  A virtual package is a conceptual encapsulation of those data structures,
  532.  
  533.            compilation units and dependencies that cumulatively makeup the functional module in question.
  534.  
  535.  
  536.            This section contains the contains supporting diagrams, the OODD virtual package representations and the PDL listings
  537.  
  538.            for the GAD Macroscopic Design virtual package specifications.  The order of presentation is in reverse of the
  539.  
  540.            compilation order as follows:
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.  
  558.  
  559.  
  560.  
  561.  
  562.  
  563.  
  564.  
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.                                                                     4 - 1
  572.  
  573.  
  574.  
  575.                                                                   SECTION 4
  576.                                                               Macroscopic Design
  577.  
  578.                                                 Table 4-1 Graphic Ada Designer Design Library
  579.              Virtual Packag Name           Module Name          Source File Name                      Comments
  580.            ========================================================================================================================
  581.            |                       | RUN_GAD                 |  RUNSKT.TXT        |  Main Sketcher Program Unit                   |
  582.            |-----------------------+-------------------------+--------------------+-----------------------------------------------|
  583.            |  GRAPH_TREE_ACCESS    | TREE_DATA               |  TREEDATA.TXT      |  Syntax Tree Data Structures Library Unit     |
  584.            |                       | TREE_IO                 |  TREEIO.TXT        |  Syntax Tree I/O Routines Library Unit        |
  585.            |                       | TREE_OPS                |  TREEOPS.TXT       |  Syntax Tree Manipulation Routine Library Unit|
  586.            |-----------------------+-------------------------+--------------------+-----------------------------------------------|
  587.            |  MMI                  | MMI_PARAMETERS          |  MMIPARAM.TXT      | Data Structures Library Unit                  |
  588.            |                       | UTILITIES               |  MMIUTIL.TXT       | Utility Routines Library Unit                 |
  589.            |                       | MMI                     |  MMIOPS.TXT        | Main Menu Control Routines Library Unit       |
  590.            |                       | MMI_ATTRIBUTES          |  MMIATTRIB.TXT     | Attribute Menu Control Routines Library Unit  |
  591.            |                       | MMI_DESIGN              |  MMIDESIGN.TXT     | Design Menu Control Routines Library Unit     |
  592.            |                       | MMI_MENU                |  MMIMENU.TXT       |                                               |
  593.            |-----------------------+-------------------------+--------------------+-----------------------------------------------|
  594.            |  PDL_GENERATOR        | PDL_GEN                 |  PDLGEN.TXT        | PDL Generation Routines Library Unit          |
  595.            |-----------------------+-------------------------+--------------------+-----------------------------------------------|
  596.            |  GRAPHICS_DRIVER      | GRAPHICS_DATA           |  GRPHDATA.TXT      |  GAD Specific Graphics Structures Library Unit|
  597.            |                       |                         |  GRPHDRVR.TXT      |  GAD Specific Graphics Routines Library Unit  |
  598.            |-----------------------+-------------------------+--------------------+-----------------------------------------------|
  599.            |  GKS_PRIME            | GKS_SPECIFICATION       |  GKSPEC.TXT        |  GKS Data Structures Library Unit             |
  600.            |                       |                         |  PRIORITYC.TXT     |  for termacces.env only                       |
  601.            |                       | MINI_MATH_PAC           |  MATHPACK.TXT      |  Math Routines Library Unit                   |
  602.            |                       | TERMINAL_ACCESS         |  TERMACCES.TXT     |  GKS Terminal Specific Library Unit           |
  603.            |                       |                         |  GKSPRIME.TXT      |  GKS Terminal Independent Library Unit        |
  604.            |-----------------------+-------------------------+--------------------+-----------------------------------------------|
  605.            |  VIRTUAL_TERMINAL_    | VIRTUAL_TERMINAL_       |  VTI.TXT           |  VT100 Terminal Driver Library Unit           |
  606.            |      INTERFACE        |     INTERFACE           |                    |                                               |
  607.            |-----------------------+-------------------------+--------------------+-----------------------------------------------|
  608.            |                       |                         |  DESIGNPKG.TXT     |  Design Library Unit                          |
  609.            |                       |                         |  TRACE.TXT         |  Debug Utility Library Unit                   |
  610.            |                       |                         |  ENVSPEC.TXT       |  Envision Hardware Library Unit               |
  611.            |                       |                         |  TXTCNVRT.TXT      |  Envision Hardware Library Unit               |
  612.            |                       |                         |  CNTLSET.TXT       |  Envision Hardware Library Unit               |
  613.            |                       |                         |  DSPLST.TXT        |  Envision Hardware Library Unit               |
  614.            |                       |                         |  DRAWING.TXT       |  Envision Hardware Library Unit               |
  615.            |                       |                         |  SGMTOPS.TXT       |  Envision Hardware Library Unit               |
  616.            -----------------------------------------------------------------------------------------------------------------------
  617.  
  618.  
  619.  
  620.  
  621.  
  622.                                                                     4 - 2
  623.  
  624.  
  625.  
  626.                                                                   SECTION 4
  627.                                                               Macroscopic Design
  628.  
  629.            4.1       RUN_GAD
  630.  
  631.  
  632.            This procedure is the main procedure (outer most Ada compilation unit) for the GAD tool.  It provides routines to
  633.  
  634.            control initialization, termination (normal and abnormal), and vectoring of operator control to the MMI virtual package
  635.  
  636.            for operator interaction with the tool.  The design characteristics of the Run_GAD virtual package are as follows:
  637.  
  638.  
  639.                                                      Table 4-2 RUN_GAD Dependencies List
  640.  
  641.                                  COMPILATION UNITS       TYPE          COMMENTS           DEPENDENCIES
  642. +                                _____________________________________________________________________
  643.                                  Run_GAD                 Procedure     Program Unit       System
  644.                                                                                           Design_Pkg
  645.                                                                                           MMI
  646.                                                                                           Graph_Tree_Access
  647.  
  648.  
  649.                                           =========================================
  650.                                           | RUN_GAD                               |
  651.                                           |=======================================|
  652.                                           |                                       |
  653.                                           |                                -------------------------
  654.                                           |                                <  SYSTEM               >
  655.                                           |                                <  DESIGN_PKG           >
  656.                                           |                      +--->(A)--<< MMI                 >>
  657.                                           |                      +--->(B)--<< GRAPH_TREE_ACCESS   >>
  658.                                           |                      ^         -------------------------
  659.                                           |                      |                |
  660.                                           |                   ----                |
  661.                                           |                  /    \               |
  662.                                           |                  \    /               |
  663.                                           |                   ----                |
  664.                                           -----------------------------------------
  665.  
  666.                                                  Figure 4-1 Run_GAD Procedure Design Diagram
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674.  
  675.                                                                     4 - 3
  676.  
  677.  
  678.  
  679.                                                                   SECTION 4
  680.                                                               Macroscopic Design
  681.  
  682.  
  683.            Opening runskt.text
  684.  
  685.  
  686.                     1: pragma source_info(on);
  687.                     2:
  688.                     3: with SYSTEM ;
  689.                     4: with MMI ;       use MMI ;
  690.                     5: with UTILITIES ; use UTILITIES ;
  691.                     6: with TREE_IO ;   use TREE_IO ;
  692.                     7: with TEXT_IO ;   use TEXT_IO ;
  693.                     8:
  694.                     9: -- controlled by BOB MAREK
  695.                    10: -- version 85-07-18 10:05 by RAM
  696.                    11:
  697.                    12: procedure RUN_GAD is
  698.                    13: -- =======================================================
  699.                    14: --
  700.                    15: --  This is the main procedure of GAD and it will
  701.                    16: --  control and execute the procedures and packages needed
  702.                    17: --  to operate GAD.  It will control the opening,
  703.                    18: --  closing, creating, and renaming of the data files;
  704.                    19: --  initialization of the program, and top level error
  705.                    20: --  handling.
  706.                    21: --
  707.                    22: --  Requirements:
  708.                    23: --   1) create working file
  709.                    24: --   2) open existing file and copy into working file,
  710.                    25: --      close when completed.
  711.                    26: --   3) invoke MMI_OPERATIONS command processor
  712.                    27: --   4) handle error conditions (exceptions)
  713.                    28: --   5) delete or rename working file as appropriate
  714.                    29: --
  715.                    30: -- ==================================================================
  716.                    31:    SESSION_EXTENTION : constant String := ".GPH" ;
  717.                    32:    SESSION_FILE      : TEXT_IO.FILE_TYPE ;
  718.                    33:    SESSION_FILE_NAME : String ( 1..12 ) ;
  719.                    34:    OLD_SESSION_NAME  : Boolean := True ;
  720.                    35:
  721.                    36: begin
  722.                    37:    MMI.INITIALIZE ;       --  initialize global and package specific data
  723.                    38:    --  get new_filename
  724.                    39:    SESSION_FILE_NAME := UTILITIES.GET_FILE_HANDLE & SESSION_EXTENTION ;
  725.                    40:    --  set up tree file name
  726.                                                                     4 - 4
  727.  
  728.  
  729.  
  730.                                                                   SECTION 4
  731.                                                               Macroscopic Design
  732.  
  733.                    41:    TREE_IO.DATA_FILENAME ( 1..12 ) := SESSION_FILE_NAME ;
  734.                    42:    CHECK_FOR_OLD_SESSION_NAME :
  735.                    43:       declare -- CHECK_FOR_OLD_SESSION_NAME
  736.                    44:       begin -- CHECK_FOR_OLD_SESSION_NAME
  737.                    45:          if SESSION_FILE_NAME ( 1..8 ) /= TREE_IO.DEFAULT_FILENAME then
  738.                    46:             -- see if file currently exists
  739.                    47:             TEXT_IO.OPEN ( SESSION_FILE ,
  740.                    48:                            TEXT_IO.IN_FILE ,
  741.                    49:                            SESSION_FILE_NAME ) ;
  742.                    50:             -- close file for tree_io.read
  743.                    51:             TEXT_IO.CLOSE ( SESSION_FILE ) ;
  744.                    52:             --  filename is used so read it in to initialize the GRAPH_TREE
  745.                    53:             TREE_IO.READ ( TREE_IO.DATA_FILENAME ) ;
  746.                    54:             --  now draw the tree
  747.                    55:             UTILITIES.DRAW_GRAPH_TREE ;
  748.                    56:          end if ;
  749.                    57:       exception -- CHECK_FOR_OLD_SESSION_NAME
  750.                    58:          when NAME_ERROR =>
  751.                    59:             OLD_SESSION_NAME := False ;
  752.                    60:          when others =>
  753.                    61:             -- unknown error so pass it on
  754.                    62:             raise ;
  755.                    63:       end CHECK_FOR_OLD_SESSION_NAME ;
  756.                    64:    MMI.PROCESS_COMMAND ;  --  invoke GAD command processor
  757.                    65:
  758.                    66:    --{  catch any unhandled exceptions and notify the user.
  759.                    67:    --{  attempt to save the work file.
  760.                    68:    exception
  761.                    69:       when OTHERS =>
  762.                    70:          MMI.PANIC_EXIT ;
  763.                    71:          -- FILE_HANDLING_ON_EXIT := PANIC_SAVE;
  764.                    72:          -- GRAPH_TREE_IO.CLOSE_WORK_FILE (FILE_HANDLING_ON_EXIT);
  765.                    73:
  766.                    74:          TEXT_IO.PUT_LINE(" PANIC EXIT PROCESS COMPLETED ");
  767.                    75:          raise;
  768.                    76:
  769.                    77: end RUN_GAD ;
  770.            Compilation complete
  771.             Syntax errors: 0  Semantic errors: 0  Lines compiled: 77
  772.  
  773.  
  774.  
  775.  
  776.  
  777.                                                                     4 - 5
  778. 4.2        GRAPH_TREE_ACCESS
  779.  
  780. The virtual package GRAPH_TREE_ACCESS provides three major services; the type declarations and objects which comprise
  781. the primary data structure for GAD, primitive routines for the manipulation of the data structure and I/O routines to
  782. preserve the data structures in a file for multi-session editing.  The Tree_Data package provides the declarations and
  783. objects for the Graph Tree which holds all the graphical, syntax, and semantic information required by the program.  The
  784. tree contains TREE, LIST and GRAPH nodes.  The TREE nodes represent Ada entities (structures) which are connected in a
  785. hierarchal order (tree) indicating the scope of each entity.  The LIST nodes are used to store relationships (e.g.,
  786. context clauses) and annotations (e.g., exported type declarations).  The GRAPH nodes contain the graphical data
  787. associated with each TREE node.  The Tree_IO package provides all the necessary operations to read and write the graph
  788. tree from the graphics files in the host file system.  This package manipulates data files which consist of copies of
  789. the graph tree nodes.  The node types (GRAPH, TREE, and LIST) are stored in arrays in the package TREE_DATA.  This
  790. TREE_IO package will copy the graph tree by copying the arrays to the specified data file.  The requirements on this
  791. package are to 1) provide the read and write operations needed to maintain the graphics files, and 2) detect corrupted
  792. data files.  The Tree_Operations package provides a set of operations on the data structures declared in the package
  793. Tree_Data.  These operations include the management of indices into the arrays of GRAPH, LIST, and TREE nodes.  The
  794. Get_Node functions will return the index value and initialize the corresponding node to be the specified variant of the
  795. record.  The Release_Node procedures remove all references to the node, and mark the node being released as unused (and
  796. hence available for reuse).  The operations set also includes functions such as general list manipulation facilities,
  797. and methods for walking the tree.
  798.  
  799.                                      Table 4-3 GRAPH_TREE_ACCESS Dependencies List
  800.  
  801.                    COMPILATION UNITS       TYPE          COMMENTS                     DEPENDENCIES
  802.                    Graph_Tree_Data         Package       Syntax/Semantic/Entity       System
  803.                                                          List Structure               Direct_IO
  804.                    Tree_Operations         Package       Tree List Primitives         Design_Pkg
  805.                    Tree_IO                 Package       Design File I/O Routines
  806.  
  807.           GRAPH_TREE_ACCESS_VIRTUAL_PACKAGE
  808.            - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  809.           |                                                                                                |
  810.    --------------------                 TREE_DATA
  811.    ( TREE_DATA_TYPES  )<---------+      -------------------------------                         ---------------------
  812.    < TREE_OPS_EXCEPTS ><----+    |      |                             |                         <  SYSTEM           >
  813.    ( TREE_IO_TYPES    )<-+  |    +---( DECLARATIONS )     -----       |   +---------------->(A)-<  DIRECT_IO        >
  814.    : TREE_IO_OBJECTS  :<-+  |           |                /     \      |   |                     << DESIGN_PKG       >
  815.    < TREE_IO_EXCEPTS  )<-+  |           |                \     /      |   |                     ---------------------
  816.    --------------------  |  |           |                 -----       |   |
  817.           |              |  |           -------------------------------   |                                |
  818.                          |  |           TREE_IO                           |
  819.           |              |  |           -------------------------------   |                                |
  820.                          |  |           |              ===========    |   |
  821.           |              |  +-------(DECLARATIONS)     | WRITE[] |    |   |                                |
  822.                          |              |       +----->|=========|    |   |
  823.           |              |              |       |   ===========  |------->+                                |
  824.       ----------         |             -------  |+->| READ[]  |---    |   |
  825.       |        |---------------------->|     |--+|  |=========|       |   |                                |
  826.       |        |---------------------->|     |---+  |         |__________>+
  827.       ----------         |             -------      -----------       |                                    |
  828.           |              |              -------------------------------
  829.                          |               TREE_OPERATIONS                                                   |
  830.           |              |               ---------------------------------------------------
  831.                          |               |                    =========================    |               |
  832.           |              +----------(DECLARATIONS) +--------->| =GET_NEW_GRAPH_NODE[] |    |
  833.                                          |         |          |=======================|    |               |
  834.           |                              |         |          |                       |    |
  835.                                          |         |          _________________________    |               |
  836.                                          |         o                      o                |
  837.           |                              |         o                      o                |               |
  838.                                          |         |          =========================    |
  839.           |                              |         |+-------->| =FIND_NODE_REFERENCE[]|    |               |
  840.       ---------                       -------      ||         |=======================|    |
  841.       |       |---------------------->|     |------+|     =========================   |    |               |
  842.       |       |---------------------->|     |-------+     | =FIND_NODE_REFERENCE[]|----    |
  843.       |       |---------------------->|     |------------>|=======================|        |               |
  844.       ---------                       -------             |                       |        |
  845.           |                              |                -------------------------        |               |
  846.                                          ---------------------------------------------------
  847.           - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  848.                               Figure 4-2 GRAPH_TREE_ACCESS Virtual Package Design Diagram
  849.          1:    with GRAPHICS_DATA; use GRAPHICS_DATA;
  850.          2:
  851.          3:    -- controlled by JOHN REDDAN
  852.          4:    -- version 85-07-24 14:10 by RAM
  853.          5:
  854.          6:    package TREE_DATA is
  855.          7:    -------------------------------------------------------------------------
  856.          8:    --
  857.          9:    -- This package provides the declarations and objects for the
  858.         10:    -- Graph Tree which holds all the graphical, syntax, and
  859.         11:    -- semantic information required by the program.  The tree contains
  860.         12:    -- TREE, LIST and GRAPH nodes.  The TREE nodes represent Ada
  861.         13:    -- entities (structures) and are connected in a hierarchal order (tree)
  862.         14:    -- indicating the scope of each entity.  The LIST nodes are used to
  863.         15:    -- store relationships (e.g., context clauses) and annotations (e.g.,
  864.         16:    -- exported type declarations).  The GRAPH nodes contain the graphical
  865.         17:    -- data associated with each TREE node.
  866.         18:    --
  867.         19:    -------------------------------------------------------------------------
  868.         20:
  869.         21:       ----------------------------------------------------------------------
  870.         22:       --  All of the Ada entities, one for each type of TREE node.
  871.         23:       ----------------------------------------------------------------------
  872.         24:       type ENTITY_TYPE is (UNUSED,
  873.         25:                            ROOT,
  874.         26:                            TYPE_VIRTUAL_PACKAGE,
  875.         27:                            TYPE_PACKAGE,
  876.         28:                            TYPE_PROCEDURE,
  877.         29:                            TYPE_FUNCTION,
  878.         30:                            TYPE_TASK,
  879.         31:                            TYPE_ENTRY_POINT,
  880.         32:                            TYPE_BODY,
  881.         33:                            IMPORTED_VIRTUAL_PACKAGE,
  882.         34:                            IMPORTED_PACKAGE,
  883.         35:                            IMPORTED_PROCEDURE,
  884.         36:                            IMPORTED_FUNCTION,
  885.         37:                            EXPORTED_PROCEDURE,
  886.         38:                            EXPORTED_FUNCTION,
  887.         39:                            EXPORTED_TASK,
  888.         40:                            EXPORTED_ENTRY_POINT,
  889.         41:                            EXPORTED_TYPE,
  890.         42:                            EXPORTED_OBJECT,
  891.         43:                            EXPORTED_EXCEPTION,
  892.         44:                            CONNECTION_BY_CALL,
  893.         45:                            CONNECTION_FOR_DATA);
  894.         46:
  895.         47:       ----------------------------------------------------------------------
  896.         48:       --  ENTITY Names
  897.         49:       ----------------------------------------------------------------------
  898.         50:       MAXIMUM_NAME_LENGTH : constant POSITIVE := 80;
  899.         51:       subtype NAME_TYPE is STRING (1..MAXIMUM_NAME_LENGTH);
  900.         52:       NULL_NAME : constant NAME_TYPE := "                              "&
  901.         53:                     "                                                  ";
  902.         54:
  903.         55:       ----------------------------------------------------------------------
  904.         56:       --  GENERIC information
  905.         57:       ----------------------------------------------------------------------
  906.         58:       type GENERIC_STATUS_TYPE is (NOT_GENERIC,
  907.         59:                                    GENERIC_DECLARATION,
  908.         60:                                    GENERIC_INSTANTIATION);
  909.         61:
  910.         62:
  911.         63:       ----------------------------------------------------------------------
  912.         64:       --  TASK information
  913.         65:       ----------------------------------------------------------------------
  914.         66:       type TASK_STATUS_TYPE is (NORMAL_TASK,
  915.         67:                                 TASK_TYPE_DECLARATION,
  916.         68:                                 TASK_TYPE_OBJECT);
  917.         69:
  918.         70:
  919.         71:       ----------------------------------------------------------------------
  920.         72:       --  The ACCESS types
  921.         73:       ----------------------------------------------------------------------
  922.         74:       -- The access type for GRAPH_NODEs, implemented as an
  923.         75:       -- index into GRAPH array.
  924.         76:       subtype GRAPH_NODE_ACCESS_TYPE is INTEGER;
  925.         77:
  926.         78:       -- The access type for LIST_NODEs, implemented as an
  927.         79:       -- index into LIST array.
  928.         80:       subtype LIST_NODE_ACCESS_TYPE is INTEGER;
  929.         81:
  930.         82:       --  The access index of TREE_NODE_TYPEs.  A negative number
  931.         83:       --  will indicate a 'NULL' pointer.
  932.         84:       subtype TREE_NODE_ACCESS_TYPE is INTEGER;
  933.         85:
  934.         86:       -- To be used to initialize the access values to indicate it
  935.         87:       -- is not currently pointing to anything.
  936.         88:       NULL_POINTER : INTEGER := -1;
  937.         89:
  938.         90:       ----------------------------------------------------------------------
  939.         91:       --  The graphical data for each tree node, stored in the
  940.         92:       --  GRAPH_DATA_ARRAY.  A null OWNING_TREE_NODE indicates that
  941.         93:       --  the node is unused.
  942.         94:       ----------------------------------------------------------------------
  943.         95:       type GRAPH_NODE_TYPE is
  944.         96:          record
  945.         97:             OWNING_TREE_NODE : TREE_NODE_ACCESS_TYPE := NULL_POINTER;
  946.         98:             DATA             : GRAPHICS_DATA.GRAPHICS_DATA_TYPE;
  947.         99:          end record;
  948.        100:
  949.        101:
  950.        102:       ----------------------------------------------------------------------
  951.        103:       --  LINE type
  952.        104:       ----------------------------------------------------------------------
  953.        105:       MAXIMUM_NO_LINE_SEGMENTS : constant INTEGER := 20;
  954.        106:       subtype POINTS is GRAPH_NODE_ACCESS_TYPE;
  955.        107:       type LINE_TYPE is array (1..MAXIMUM_NO_LINE_SEGMENTS) of POINTS;
  956.        108:
  957.        109:       NULL_LINE : constant LINE_TYPE := (-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
  958.        110:                                          -1,-1,-1,-1,-1,-1,-1,-1,-1,-1);
  959.        111:
  960.        112:       ----------------------------------------------------------------------
  961.        113:       --  The possible Call Connection types.
  962.        114:       ----------------------------------------------------------------------
  963.        115:       type CALL_CONNECTION_TYPE is (NO_CONNECTION,
  964.        116:                                     NORMAL,
  965.        117:                                     TIMED,
  966.        118:                                     CONDITIONAL);
  967.        119:
  968.        120:
  969.        121:       ----------------------------------------------------------------------
  970.        122:       --  The various LISTS occuring in the tree are declared below.
  971.        123:       --  The list format to be used to create specific kinds of lists.
  972.        124:       --  A doubly linked list is required for forward and back tracing.
  973.        125:       ----------------------------------------------------------------------
  974.        126:       --  The lists contained in a Tree Node.  The order of the Lists
  975.        127:       --  is the order of the List scan during a tree walk.
  976.        128:
  977.        129:       type LIST_TYPE is (START,          -- for starting node list scans
  978.        130:                          CONTAINED_LIST,
  979.        131:                          CALLEE_LIST,
  980.        132:                          DATA_CONNECT_LIST,
  981.        133:                          ENTRY_LIST,
  982.        134:                          EXPORTED_LIST,
  983.        135:                          IMPORTED_LIST,
  984.        136:                          NULL_LIST);
  985.        137:
  986.        138:       --  The list structures of the Tree are created from the list
  987.        139:       --  nodes declared below, which link Tree nodes.  Each List
  988.        140:       --  node is associated with a Tree node (ITEM), and hence a null
  989.        141:       --  ITEM indicates an unused node.
  990.        142:       type LIST_NODE_TYPE is
  991.        143:          record
  992.        144:             ITEM : TREE_NODE_ACCESS_TYPE := NULL_POINTER;
  993.        145:             PRIOR : LIST_NODE_ACCESS_TYPE := NULL_POINTER;
  994.        146:             NEXT : LIST_NODE_ACCESS_TYPE := NULL_POINTER;
  995.        147:             -- for use in Membership Lists
  996.        148:             REF_COUNT : NATURAL := 0;  -- count of refs by ITEM to List Owner
  997.        149:             MEMBER_OF : LIST_TYPE := NULL_LIST;  -- the refering list type
  998.        150:          end record;
  999.        151:
  1000.        152:       --  A list of all called entities and their connections.
  1001.        153:       subtype CALLEE_LIST_TYPE is LIST_NODE_ACCESS_TYPE;
  1002.        154:       --  A list of all contained entities.
  1003.        155:       subtype CONTAINED_ENTITY_LIST_TYPE is LIST_NODE_ACCESS_TYPE;
  1004.        156:       --  A list of all Data connections for an entity
  1005.        157:       subtype DATA_CONNECT_LIST_TYPE is LIST_NODE_ACCESS_TYPE;
  1006.        158:       --  A list of all the entries for a task.
  1007.        159:       subtype ENTRY_LIST_TYPE is LIST_NODE_ACCESS_TYPE;
  1008.        160:       --  A list of all exported entities.
  1009.        161:       subtype EXPORTED_LIST_TYPE is LIST_NODE_ACCESS_TYPE;
  1010.        162:       --  A list of all imported entities.
  1011.        163:       subtype IMPORTED_LIST_TYPE is LIST_NODE_ACCESS_TYPE;
  1012.        164:
  1013.        165:       ----------------------------------------------------------------------
  1014.        166:       --  The definition of the MEMBERSHIP list.
  1015.        167:       ----------------------------------------------------------------------
  1016.        168:       -- The MEMBERSHIP list exists to maintain a back pointer for
  1017.        169:       -- relations established by other lists.  The TREE_OPS package
  1018.        170:       -- should be the only manipulator of this list.
  1019.        171:       --
  1020.        172:       -- The access type for the MEMBERSHIP list, is implemented as an
  1021.        173:       -- index into LIST array.  This is done to minimize the number
  1022.        174:       -- of node types to be handled.
  1023.        175:
  1024.        176:       subtype MEMBERSHIP_LIST_TYPE is LIST_NODE_ACCESS_TYPE;
  1025.        177:
  1026.        178:       ----------------------------------------------------------------------
  1027.        179:       --  The definition of the tree structure.  A variant record
  1028.        180:       --  is not possible if this record is to be output using
  1029.        181:       --  an instantiation of DIRECT_IO (see TREE_IO).
  1030.        182:       ----------------------------------------------------------------------
  1031.        183:       type TREE_NODE_TYPE (NODE_TYPE: ENTITY_TYPE := UNUSED) is
  1032.        184:          record
  1033.        185:             NAME : NAME_TYPE := NULL_NAME;  -- the name of this node
  1034.        186:             PARENT : TREE_NODE_ACCESS_TYPE := NULL_POINTER;  -- the parent
  1035.        187:             GRAPH_DATA : GRAPH_NODE_ACCESS_TYPE := NULL_POINTER;
  1036.        188:             -------------------------------------------------------------------
  1037.        189:             -- A list of all list nodes pointing to this node
  1038.        190:             -------------------------------------------------------------------
  1039.        191:             MEMBERSHIP : MEMBERSHIP_LIST_TYPE := NULL_POINTER;
  1040.        192:             -------------------------------------------------------------------
  1041.        193:             -- The lists pointing to connected, contained, or related nodes
  1042.        194:             -------------------------------------------------------------------
  1043.        195:             case NODE_TYPE is
  1044.        196:                when ROOT .. TYPE_TASK =>
  1045.        197:                   CONTAINED_ENTITY_LIST : CONTAINED_ENTITY_LIST_TYPE := NULL_POINTER;
  1046.        198:                   case NODE_TYPE is
  1047.        199:                      when TYPE_VIRTUAL_PACKAGE .. TYPE_TASK =>
  1048.        200:                         BODY_PTR : TREE_NODE_ACCESS_TYPE := NULL_POINTER;
  1049.        201:                         case NODE_TYPE is
  1050.        202:                            when TYPE_VIRTUAL_PACKAGE .. TYPE_FUNCTION =>
  1051.        203:                               GENERIC_STATUS : GENERIC_STATUS_TYPE := NOT_GENERIC;
  1052.        204:                               CU_INSTANTIATED : NAME_TYPE := NULL_NAME;
  1053.        205:                               DATA_CONNECT_LIST : DATA_CONNECT_LIST_TYPE := NULL_POINTER;
  1054.        206:                               case NODE_TYPE is
  1055.        207:                                  when TYPE_VIRTUAL_PACKAGE | TYPE_PACKAGE =>
  1056.        208:                                     EXPORTED_LIST : EXPORTED_LIST_TYPE := NULL_POINTER;
  1057.        209:                                     IMPORTED_LIST : IMPORTED_LIST_TYPE := NULL_POINTER;
  1058.        210:                                  when TYPE_FUNCTION | TYPE_PROCEDURE =>
  1059.        211:                                     HAS_PARAMETERS : BOOLEAN := FALSE;
  1060.        212:                                  when others =>
  1061.        213:                                     null;
  1062.        214:                               end case;
  1063.        215:                            when TYPE_TASK =>
  1064.        216:                               TASK_STATUS : TASK_STATUS_TYPE := NORMAL_TASK;
  1065.        217:                               ENTRY_LIST : ENTRY_LIST_TYPE := NULL_POINTER;
  1066.        218:                            when others =>
  1067.        219:                               null;
  1068.        220:                         end case;
  1069.        221:                      when others =>
  1070.        222:                         null ;
  1071.        223:                   end case ;
  1072.        224:                when TYPE_ENTRY_POINT =>
  1073.        225:                   IS_GUARDED : BOOLEAN := FALSE; -- for task entry points
  1074.        226:                   WITH_PARAMETERS : BOOLEAN := FALSE;
  1075.        227:                when TYPE_BODY =>
  1076.        228:                   CALLEE_LIST : CALLEE_LIST_TYPE := NULL_POINTER;
  1077.        229:                when EXPORTED_PROCEDURE .. CONNECTION_FOR_DATA =>
  1078.        230:                   CALL_VARIETY : CALL_CONNECTION_TYPE := NO_CONNECTION;
  1079.        231:                   CONNECTEE : TREE_NODE_ACCESS_TYPE := NULL_POINTER ;
  1080.        232:                   LINE : LINE_TYPE := NULL_LINE ;
  1081.        233:                when others =>
  1082.        234:                   null;
  1083.        235:             end case;
  1084.        236:          end record;
  1085.        237:
  1086.        238:       ----------------------------------------------------------------------
  1087.        239:       -- The arrays containing GRAPH, LIST, and TREE nodes.
  1088.        240:       ----------------------------------------------------------------------
  1089.        241:       type GRAPH_ARRAY is array (GRAPH_NODE_ACCESS_TYPE range <>)
  1090.        242:          of GRAPH_NODE_TYPE;
  1091.        243:       type LIST_ARRAY is array (LIST_NODE_ACCESS_TYPE range <>)
  1092.        244:          of LIST_NODE_TYPE;
  1093.        245:       type TREE_ARRAY is array (TREE_NODE_ACCESS_TYPE range <>)
  1094.        246:          of TREE_NODE_TYPE;
  1095.        247:
  1096.        248:       ----------------------------------------------------------------------
  1097.        249:       -- The size of the arrays
  1098.        250:       ----------------------------------------------------------------------
  1099.        251:       MAX_GRAPH_NODES : constant GRAPH_NODE_ACCESS_TYPE := 199;
  1100.        252:       MAX_LIST_NODES : constant LIST_NODE_ACCESS_TYPE := 199;
  1101.        253:       MAX_TREE_NODES : constant TREE_NODE_ACCESS_TYPE := 99;
  1102.        254:
  1103.        255:       ----------------------------------------------------------------------
  1104.        256:       -- The array declarations
  1105.        257:       ----------------------------------------------------------------------
  1106.        258:       GRAPH : GRAPH_ARRAY (1..MAX_GRAPH_NODES);
  1107.        259:       LIST  : LIST_ARRAY (1..MAX_LIST_NODES);
  1108.        260:       TREE  : TREE_ARRAY (1..MAX_TREE_NODES);
  1109.        261:       -- The first element of the TREE is defined to be the ROOT
  1110.        262:
  1111.        263:       ----------------------------------------------------------------------
  1112.        264:       -- The Root Node of the TREE
  1113.        265:       ----------------------------------------------------------------------
  1114.        266:       ROOT_NODE : constant TREE_NODE_ACCESS_TYPE := 1;
  1115.        267:
  1116.        268:    end TREE_DATA;
  1117.        269:
  1118.        270:    package body TREE_DATA is
  1119.        271:    begin
  1120.        272:       -- initialize the root of the tree.
  1121.        273:       TREE(ROOT_NODE) := (ROOT,              -- NODE_TYPE
  1122.        274:                           NULL_NAME,         -- NAME
  1123.        275:                           NULL_POINTER,      -- PARENT
  1124.        276:                           NULL_POINTER,      -- GRAPH_DATA
  1125.        277:                           NULL_POINTER,      -- MEMBERSHIP
  1126.        278:                           NULL_POINTER);     -- CONTAINED_ENTITY_LIST
  1127.        279:    end TREE_DATA;
  1128. Compilation complete
  1129.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 279
  1130.          1: pragma source_info ( on ) ;
  1131.          2:
  1132.          3:    with TREE_DATA;  use TREE_DATA;
  1133.          4:
  1134.          5: -- controlled by JOHN REDDAN
  1135.          6: -- version 85-07-18 07:50 by RAM
  1136.          7:
  1137.          8:    package TREE_IO is
  1138.          9:    --  This package provides all the necessary operations to
  1139.         10:    --  read and write the graph tree from the graphics
  1140.         11:    --  files in the host file system.
  1141.         12:    --
  1142.         13:    --  This package manipulates data files which consist of copies
  1143.         14:    --  of the graph tree nodes.  The node types (GRAPH, TREE,
  1144.         15:    --  and LIST) are stored in arrays in the package
  1145.         16:    --  TREE_DATA.  This TREE_IO package will
  1146.         17:    --  copy the graph tree by copying the arrays to the
  1147.         18:    --  specified data file.
  1148.         19:    --
  1149.         20:    --  Requirements:
  1150.         21:    --   1) provide the read and write operations needed to
  1151.         22:    --      maintain the graphics files.
  1152.         23:    --   2) detect corrupted data files.
  1153.         24:    --
  1154.         25:
  1155.         26:       --  type to hold filenames
  1156.         27:       subtype FILENAME_TYPE is STRING (1..80);
  1157.         28:
  1158.         29:       --  null filename for setting FILENAME_TYPE objects
  1159.         30:       NULL_FILENAME : constant FILENAME_TYPE := "                    "&
  1160.         31:         "                                                            ";
  1161.         32:
  1162.         33:       --  name of file containing original data used
  1163.         34:       DATA_FILENAME : FILENAME_TYPE := NULL_FILENAME;
  1164.         35:
  1165.         36:       --  name of default file for initialization
  1166.         37:       DEFAULT_FILENAME : constant String := "DATAFILE" ;
  1167.         38:
  1168.         39:       --  the graphics data file control parameters
  1169.         40:       type FILE_HANDLING_TYPE is (SAVE,
  1170.         41:                                   NO_SAVE,
  1171.         42:                                   PANIC_SAVE);
  1172.         43:       FILE_HANDLING_ON_EXIT : FILE_HANDLING_TYPE := SAVE;
  1173.         44:
  1174.         45:       procedure READ (FILE: in FILENAME_TYPE);
  1175.         46:       --  read the specified page into the arrays in
  1176.         47:       --  the package TREE_DATA.  Set all necessary
  1177.         48:       --  parameters based on the values in the file
  1178.         49:       --  (possibly number of nodes).
  1179.         50:
  1180.         51:       procedure WRITE (FILE: in FILENAME_TYPE);
  1181.         52:       --  Write the contents of the arrays in the
  1182.         53:       --  package TREE_DATA to the specified file.
  1183.         54:
  1184.         55:       INVALID_FILE_SPECIFIER : exception;
  1185.         56:       FILE_OPERATION_FAILURE : exception;
  1186.         57:
  1187.         58:    end TREE_IO;
  1188.         59:
  1189.         60:
  1190.         61:    with DIRECT_IO;
  1191.         62:    with TEXT_IO;
  1192.         63:    package body TREE_IO is
  1193.         64:
  1194.        205:    end TREE_IO;
  1195. Compilation complete
  1196.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 205
  1197.          1:    with TREE_DATA;  use TREE_DATA;
  1198.          2:    package TREE_OPS is
  1199.          3:
  1200.          4:    -- Controlled by John Reddan
  1201.          5:    -- version 7-25-85 0900 by JL
  1202.          6:    --------------------------------------------------------------------------
  1203.          7:    --  Declare the operations needed to use the TREE
  1204.          8:    --------------------------------------------------------------------------
  1205.          9:
  1206.         10:       -----------------------------------------------------------------------
  1207.         11:       --  These subprograms manage the indices into the arrays of GRAPH,
  1208.         12:       --  LIST, and TREE nodes.  The Get Node functions will return the
  1209.         13:       --  index value and initialize the corresponding node to be the
  1210.         14:       --  specified variant of the record.  The Release Node procedures
  1211.         15:       --  mark the node being released as unused (and hence available for
  1212.         16:       --  reuse).
  1213.         17:       -----------------------------------------------------------------------
  1214.         18:
  1215.         19:       function GET_NEW_GRAPH_NODE (OWNING_TREE: in TREE_NODE_ACCESS_TYPE)
  1216.         20:                                   return GRAPH_NODE_ACCESS_TYPE;
  1217.         21:       -- Get a new Graph Node, and set the OWNING_TREE_NODE field to
  1218.         22:       -- the specified Tree Node.
  1219.         23:       procedure RELEASE_GRAPH_NODE (NODE: in GRAPH_NODE_ACCESS_TYPE);
  1220.         24:       -- This procedure releases the specified Graph Node.
  1221.         25:
  1222.         26:       function GET_NEW_LIST_NODE (ITEM: in TREE_NODE_ACCESS_TYPE)
  1223.         27:                                  return LIST_NODE_ACCESS_TYPE;
  1224.         28:       -- Get a new List Node, and set the ITEM field to the specified
  1225.         29:       -- value.  The ITEM pointer must not be null, as this indicates
  1226.         30:       -- an used List Node.
  1227.         31:       procedure RELEASE_LIST_NODE (NODE: in LIST_NODE_ACCESS_TYPE);
  1228.         32:       -- This procedure releases the specified list node.
  1229.         33:
  1230.         34:
  1231.         35:       function GET_NEW_TREE_NODE (NODE_TYPE: in ENTITY_TYPE)
  1232.         36:                                  return TREE_NODE_ACCESS_TYPE;
  1233.         37:       -- Initialize the NODE to the correct type and set all values
  1234.         38:       -- to NULL (or the equivalent);
  1235.         39:       procedure RELEASE_TREE_NODE (NODE: in TREE_NODE_ACCESS_TYPE);
  1236.         40:       -- This procedure deletes the specified TREE_NODE and all of
  1237.         41:       -- its children (if any).  It will remove any dependencies
  1238.         42:       -- which exist on this node as well.
  1239.         43:
  1240.         44:       -----------------------------------------------------------------------
  1241.         45:       -- The following subprograms provide operations to help
  1242.         46:       -- use the tree.
  1243.         47:       -----------------------------------------------------------------------
  1244.         48:
  1245.         49:       procedure SET_PARENT (CHILD : in TREE_NODE_ACCESS_TYPE;
  1246.         50:                             PARENT : in TREE_NODE_ACCESS_TYPE;
  1247.         51:                             RELATION : IN LIST_TYPE);
  1248.         52:       -- Set the Parent Field of the Child Node, and Place the
  1249.         53:       -- Child in the specified List of the Parent.
  1250.         54:
  1251.         55:       procedure START_TREE_WALK (PARENT : in TREE_NODE_ACCESS_TYPE);
  1252.         56:       function TREE_WALK return TREE_NODE_ACCESS_TYPE;
  1253.         57:       -- This procedure and function are used to walk the tree which
  1254.         58:       -- has the Parent as its root.  The function TREE_WALK will
  1255.         59:       -- return NULL_POINTER when all the children have been visited.
  1256.         60:       -- The tree walk excludes the Membership list.  Only one tree
  1257.         61:       -- walk can be executed at a time (it is not re-entrant).
  1258.         62:
  1259.         63:
  1260.         64:       -----------------------------------------------------------------------
  1261.         65:       -- These subprograms perform LIST manipulation functions
  1262.         66:       -- and check to make sure that the LIST_NODE pointed to is
  1263.         67:       -- the LIST header node (null back pointer).
  1264.         68:       --
  1265.         69:       -- The subprograms will also add or remove the corresponding
  1266.         70:       -- node from the MEMBERSHIP list of the TREE_NODE pointed to
  1267.         71:       -- by the node(s).
  1268.         72:       -----------------------------------------------------------------------
  1269.         73:
  1270.         74:       function GET_LIST_HEAD (LIST_OWNER: in TREE_NODE_ACCESS_TYPE;
  1271.         75:                               REQUESTED_LIST: in LIST_TYPE)
  1272.         76:                              return LIST_NODE_ACCESS_TYPE;
  1273.         77:       -- Get the List Head for the REQUESTED_LIST of the specified
  1274.         78:       -- Tree Node LIST_OWNER.  This function raises a constraint
  1275.         79:       -- error if the REQUESTED_LIST is not valid for the node type
  1276.         80:       -- of LIST_OWNER.
  1277.         81:
  1278.         82:       procedure SET_LIST_HEAD (LIST_OWNER: in TREE_NODE_ACCESS_TYPE;
  1279.         83:                                REQUESTED_LIST: in LIST_TYPE;
  1280.         84:                                NEW_LIST_HEAD: in LIST_NODE_ACCESS_TYPE);
  1281.         85:       -- Set the List Head for the REQUESTED_LIST of the specificed
  1282.         86:       -- Tree Node LIST_OWNER.
  1283.         87:
  1284.         88:       procedure DELETE_LIST (LIST_OWNER: in TREE_NODE_ACCESS_TYPE;
  1285.         89:                              REQUESTED_LIST: in LIST_TYPE);
  1286.         90:       -- Delete the entire REQUESTED_LIST, resulting in a NULL_POINTER
  1287.         91:       -- for the LIST_HEAD.
  1288.         92:
  1289.         93:       procedure ADD_NODE_TO_LIST (LIST_OWNER: in TREE_NODE_ACCESS_TYPE;
  1290.         94:                                   REQUESTED_LIST: in LIST_TYPE;
  1291.         95:                                   NODE_TO_BE_ADDED : in LIST_NODE_ACCESS_TYPE);
  1292.         96:       -- Add the Node to the end of the current list.  Start a new
  1293.         97:       -- LIST if the current one is NULL.  Place a reference to the
  1294.         98:       -- LIST_OWNER in the MEMBERSHIP list of the ITEM of the list
  1295.         99:       -- node NODE_TO_BE_ADDED.
  1296.        100:
  1297.        101:       procedure REMOVE_NODE_FROM_LIST (LIST_OWNER: in TREE_NODE_ACCESS_TYPE;
  1298.        102:                                        REQUESTED_LIST: in LIST_TYPE;
  1299.        103:                                        NODE: in LIST_NODE_ACCESS_TYPE);
  1300.        104:       -- Remove the specified node from the List.  Set LIST_HEAD to NULL
  1301.        105:       -- if this is the last element being removed.  Remove the
  1302.        106:       -- reference to the LIST_OWNER from the MEMBERSHIP list of the
  1303.        107:       -- ITEM pointed to by the list node NODE.
  1304.        108:
  1305.        109:       function FIND_NODE_REFERENCE (LIST_HEAD : in LIST_NODE_ACCESS_TYPE;
  1306.        110:                                     NODE : in TREE_NODE_ACCESS_TYPE)
  1307.        111:                                     return LIST_NODE_ACCESS_TYPE;
  1308.        112:       -- Search the specified list for a reference to the specified node,
  1309.        113:       -- and return the List Node with the reference.  If no reference is
  1310.        114:       -- found, then return a NULL_POINTER.
  1311.        115:
  1312.        116:       function NEXT_LIST_TO_SCAN (SCANNED_NODE: in TREE_NODE_ACCESS_TYPE;
  1313.        117:                                   CURRENT_LIST : in LIST_TYPE := START)
  1314.        118:                                   return LIST_TYPE;
  1315.        119:       -- Return the type of the next list to be scanned for the node
  1316.        120:       -- specified.  If no more lists are to be scanned, return a value
  1317.        121:       -- of NULL_LIST.
  1318.        122:
  1319.        123:       -----------------------------------------------------------------------
  1320.        124:       -- These are the exceptions which will occur if the operations fail.
  1321.        125:       -----------------------------------------------------------------------
  1322.        126:
  1323.        127:       INVALID_LIST_SPECIFIED : exception;
  1324.        128:       INVALID_OPERATION_REQUESTED : exception;
  1325.        129:       INVALID_NODE_SPECIFIED : exception;
  1326.        130:       LIST_CORRUPTED : exception;  -- invalid list pointers detected
  1327.        131:       MISMATCHED_DEPENDENCIES : exception;
  1328.        132:       NODE_SUPPLY_EXHAUSTED : exception;
  1329.        133:       WALK_STACK_OVERFLOW : exception;
  1330.        134:       TREE_CORRUPTED : exception;
  1331.        135:
  1332.        136:    end TREE_OPS;
  1333.        137:
  1334.        138:
  1335.        139:    with TRACE_PKG ;
  1336.        140:    package body TREE_OPS is
  1337.  
  1338.        993:    end TREE_OPS;
  1339. Compilation complete
  1340.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 993
  1341. 4.3        MMI
  1342.  
  1343. The MMI virtual package provides the MMI functions of GAD.  The operator interactively makes requests from the terminal
  1344. input devices (keyboard/cursor control device) to which the MMI routines respond according to the input.  Graphics
  1345. outputs and command inputs are requested via the Graphics_Driver virtual package.  Normal text outputs and inputs are
  1346. requested via the Virtual_Terminal virtual package.  The syntax tree structure is maintained (according the graphics
  1347. operation currently in progress) via calls to the Graph_Tree_Access virtual package primitives.  Control is passed to
  1348. the PDL_Generator virtual package when the PDL generation function is requested.  The tool is exited normally upon
  1349. operator request, which transfers control back to the Run_GAD procedure.
  1350.  
  1351. The MMI package provides the MMI and implements the requested graphics operations for the GAD program.  It inputs the
  1352. commands from the user via the GRAPHICS_DRIVER to isolate it from device dependencies.  The decoded commands are then
  1353. passed to the appropriate routine(s) of the MMI_OPERATIONS package body.  The requirements on this package are to; 1)
  1354. decode commands entered by the user, and 2) implement the commands required in the GAD User's Manual.
  1355.  
  1356. The MMI package is supported by a Utilities package which provides the common MMI functions, implemented so as to use
  1357. the formated screen and selected command features of the GRAPHICS_INTERFACE.  This package provides the help facility
  1358. for each command level.
  1359.  
  1360.                                     Table 4-4 MMI Virtual Package Dependencies List
  1361.  
  1362.                      COMPILATION UNITS        TYPE        COMMENTS                DEPENDENCIES LIST
  1363.                      MMI_Parameters           Package     Data Structures         System
  1364.                      Utilities                Package     Includes Help Routines  Design_Pkg
  1365.                      MMI_Attributes           Package     Attributes Menu         Graph_Tree_Access
  1366.                                                             Control Routines      PDL_Generator
  1367.                      MMI_Design               Package     Design Menu Control     Graphics_Driver
  1368.                      MMI_Menu                 Package     Menu Display Routines   Virtual_Terminal
  1369.                      MMIops                   Package
  1370.  
  1371.    MMI
  1372.     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1373.                MMI                                            MMI_PARAMETERS
  1374.    |           --------------------------------------         -----------------         --------------------------------
  1375.                |              ===================== |         |               |         <  SYSTEM
  1376.    |           |    +-------->| INITIALIZE        | |       (DECLARATIONS)    |    (A)--<  DESIGN_PKG                  >
  1377.                |    |         |===================| |         |               |    (B)--<  GKS_PRIME                   >
  1378.    |           |    |      =====================  | |         -----------------    (C)--<< GRAPH_TREE_ACCESS          >>
  1379. -------     ------- | +--->| PROCESS_COMMANDS  |--- |                              (D)--<< VIRTUAL_TERMINAL_INTERFACE >>
  1380. |     |---->|     |-+ |    |===================|    |                              (E)--<< GRAPHICS_DRIVER            >>
  1381. |     |---->|     |---+ =====================  |------------------->+              (F)--<< PDL_GENERATOR              >>
  1382. |     |---->|     |---->| PANIC_EXIT        |---    |               |                   --------------------------------
  1383. -------     -------     |===================|       |               |        MMI_CONTROL_MENUS
  1384.    |           |        |                   |       |               |        ------------------------------------ |
  1385.                |        ---------------------       |               |     -------     ========================  |
  1386.    |           --------------------------------------               | +-->|     |---->|=CONFIRM              |  | |
  1387.                                                                     | +-->|  o  |     |======================|  |
  1388.    |           MMI_ATTRIBUTES                                       | +-->|  o  |  ========================  |----->+
  1389.                ---------------------------------------     +--------|-+-->|     |->|=CONTROL_GENERIC_MENU |---  |   |
  1390.    |        -------    ==========================    |     |        |     -------  |======================|     | | |
  1391.             |     |--->|CONTROL_ATTRIBUTES_MENU |    |     |        |        |     |                      |-------->+
  1392.    |        -------    |========================|--------->+        |        |     ------------------------     | | |
  1393.                |       |                        |------------------>+        ------------------------------------   |
  1394.    |           |       --------------------------    |     |        +<----------------------------------------------+
  1395.                ---------------------------------------     |        |        UTILITIES
  1396.    |           MMI_DESIGN                                  |        |        ------------------------------------ |
  1397.                ---------------------------------------     |        |    ----------------                       |
  1398.    |        -------    ==========================    |     |        |    ( DECLARATIONS )                       | |
  1399.             |     |--->|CONTROL_DESIGN_MENU     |    |     |        |    ----------------                       |
  1400.    |        -------    |========================|--------->+        |        |           =====================  | |
  1401.                |       |                        |------------------>+        |   +------>|=DISPLAY_AND_IDENT |  |
  1402.    |           |       --------------------------    |              |    ------- |       |===================|  | |
  1403.                ---------------------------------------              +--->|     |-+     ===================== |  |
  1404.    |                                                                +--->|  o  |   +-->|=GET_FILE_HANDLE[] |--  | |
  1405.                                                                     +--->|  o  |   |   |===================|    |
  1406. -------                                                             +--->|     |---+ ===================== |    | |
  1407. |     |----------------------------------------------------------------->|     |---->| SIGN_ON           |--    |
  1408. -------                                                                  -------     |===================|      | |
  1409.                                                                              |       |                   |      |
  1410.    |                                                                         |       ---------------------      | |
  1411.                                                                              ------------------------------------
  1412.     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1413.                                                MMI Virtual Package Design Diagram
  1414.          1: pragma source_info(on) ;
  1415.          2:
  1416.          3: with SYSTEM ;
  1417.          4: with VIRTUAL_TERMINAL_INTERFACE ; use VIRTUAL_TERMINAL_INTERFACE ;
  1418.          5: with GKS_SPECIFICATION          ; use GKS_SPECIFICATION ;
  1419.          6: with GRAPHICS_DATA              ; use GRAPHICS_DATA ;
  1420.          7: with GRAPHIC_DRIVER             ; use GRAPHIC_DRIVER ;
  1421.          8:
  1422.          9: -- controlled by JERRY BAKER
  1423.         10: -- version 85-07-17 13:10 by RAM
  1424.         11:
  1425.         12: package MMI_PARAMETERS is     -- version 85-07-16-0830 by JL
  1426.         13: -- ==============================================================
  1427.         14: --
  1428.         15: --  This package declares the parameters (types and objects)
  1429.         16: --  used to implement the Man-Machine Interface.  The parameters
  1430.         17: --  are a key part of the interaction between the MMI control
  1431.         18: --  routines and the GRAPHICS_DRIVER.
  1432.         19: --
  1433.         20: --
  1434.         21: -- ===============================================================
  1435.         22:
  1436.         23:
  1437.         24:    package GRAPHICS renames GRAPHICS_DATA ;
  1438.         25:
  1439.         26:    subtype FORMAT_FCT  is VIRTUAL_TERMINAL_INTERFACE.FORMAT_FUNCTION ;
  1440.         27:    subtype CURSOR_ADDR is VIRTUAL_TERMINAL_INTERFACE.CURSOR_ADDRESS ;
  1441.         28:    subtype ROW_NO      is VIRTUAL_TERMINAL_INTERFACE.ROW_TYPE ;
  1442.         29:    subtype COL_NO      is VIRTUAL_TERMINAL_INTERFACE.COLUMN_TYPE ;
  1443.         30:
  1444.         31:    -----------------------------------------------------
  1445.         32:    -- list of GRAPHICS_GENERATOR icons used in each menu
  1446.         33:    --   *** order of icons is critical do not alter ***
  1447.         34:    -----------------------------------------------------
  1448.         35:    type COMMAND_TYPE is (
  1449.         36:       -- commands common to all menus
  1450.         37:       -- ( excluding the backup command from the main menu )
  1451.         38:          HELP_CMD ,
  1452.         39:          RESTART_CMD ,
  1453.         40:          BACKUP_CMD ,
  1454.         41:
  1455.         42:       -- commands in MAIN_MENU
  1456.         43:          DESIGN_CMD ,
  1457.         44:          ATTRIBUTES_CMD ,
  1458.         45:          GEN_PDL_CMD ,
  1459.         46:          FILE_CMD ,
  1460.         47:          PRINT_CMD ,
  1461.         48:          QUIT_CMD ,
  1462.         49:          FINISHED_CMD ,
  1463.         50:
  1464.         51:       -- commands in DESIGN_MENU
  1465.         52:          CREATE_CMD ,
  1466.         53:          DELETE_CMD ,
  1467.         54:          EDIT_CMD ,
  1468.         55:          MOVE_OBJECT_CMD ,
  1469.         56:          ZOOM_IN_CMD ,
  1470.         57:          ZOOM_OUT_CMD ,
  1471.         58:          PAN_UP_CMD ,
  1472.         59:          PAN_DOWN_CMD ,
  1473.         60:          PAN_LEFT_CMD,
  1474.         61:          PAN_RIGHT_CMD ,
  1475.         62:
  1476.         63:       -- commands in ATTRIBUTES_MENU
  1477.         64:          COND_CALL_CMD ,
  1478.         65:          TIMED_CALL_CMD ,
  1479.         66:          NORM_REF_CALL_CMD ,
  1480.         67:          VIRT_REF_CALL_CMD ,
  1481.         68:          GUARD_ENTRY_CMD ,
  1482.         69:          CALL_LINE_CMD ,
  1483.         70:          DATA_LINE_CMD ,
  1484.         71:          SUBPROGRAM_CMD ,
  1485.         72:
  1486.         73:       -- commands common to ATTRIBUTES_MENU and CREATE_MENU
  1487.         74:          VIRT_PACKAGE_CMD ,
  1488.         75:          PACKAGE_CMD ,
  1489.         76:          TASK_CMD ,
  1490.         77:
  1491.         78:       -- commands in CREATE_MENU
  1492.         79:          PROCEDURE_CMD ,
  1493.         80:          FUNCTION_CMD ,
  1494.         81:          CONNECTION_CMD ,
  1495.         82:          BODY_CMD ,
  1496.         83:
  1497.         84:       -- commands in EDIT_MENU
  1498.         85:          ADD_CMD ,
  1499.         86:          MODIFY_CMD ,
  1500.         87:          REMOVE_CMD ,
  1501.         88:
  1502.         89:       -- commands in CHANGE_TYPE_MENU
  1503.         90:          PEN_COLOR_CMD ,
  1504.         91:          SYMBOL_CMD ,
  1505.         92:
  1506.         93:       -- commands in GENERIC_MENU
  1507.         94:          DECLARATION_CMD ,
  1508.         95:          INSTANTIATION_CMD ,
  1509.         96:          NON_GENERIC_CMD ,
  1510.         97:
  1511.         98:       -- commands in CONNECTION_MENU
  1512.         99:          CALL_CMD ,
  1513.        100:          DATA_CMD ,
  1514.        101:
  1515.        102:       -- commands in ANNOTATING_MENU
  1516.        103:          TASK_ENTRY_CMD ,
  1517.        104:          EXPORT_TYPE_CMD ,
  1518.        105:          EXPORT_OBJ_CMD ,
  1519.        106:          EXPORT_EXCEPT_CMD ,
  1520.        107:          EXPORT_PROC_CMD ,
  1521.        108:          EXPORT_FUNC_CMD ,
  1522.        109:          EXPORT_TASK_CMD ,
  1523.        110:          IMPORT_VP_CMD ,
  1524.        111:          IMPORT_PKG_CMD ,
  1525.        112:          IMPORT_PROC_CMD ,
  1526.        113:          IMPORT_FUNC_CMD ,
  1527.        114:
  1528.        115:       -- commands in CONFIRM_MENU
  1529.        116:          CONFIRM_CMD ,
  1530.        117:          CANCEL_CMD ,
  1531.        118:
  1532.        119:       -- commands in COLOR_MENU
  1533.        120:          RED_CMD ,
  1534.        121:          ORANGE_CMD ,
  1535.        122:          YELLOW_CMD ,
  1536.        123:          VIOLET_CMD ,
  1537.        124:          BLUE_CMD ,
  1538.        125:          GREEN_CMD ,
  1539.        126:          BROWN_CMD ,
  1540.        127:          BLACK_CMD ,
  1541.        128:
  1542.        129:       -- commands in LINE_MENU
  1543.        130:          SOLID_CMD ,
  1544.        131:          DASHED_CMD ,
  1545.        132:          DOTTED_CMD ,
  1546.        133:
  1547.        134:       -- commands in PARAMETER_STATUS_MENU
  1548.        135:          HAS_PARAMETERS ,
  1549.        136:          NO_PARAMETERS ,
  1550.        137:
  1551.        138:       -- commands in CALL_STATUS_MENU
  1552.        139:          CONDITIONAL ,
  1553.        140:          NORMAL ,
  1554.        141:          TIMED ,
  1555.        142:
  1556.        143:       -- commands in ENTRY_POINT_STATUS_MENU
  1557.        144:          IS_GUARDED ,
  1558.        145:          NOT_GUARDED ,
  1559.        146:
  1560.        147:       -- commands in NULL_MENU
  1561.        148:          NULL_CMD ) ;
  1562.        149:
  1563.        150:    subtype COMMON_MENU_CMD        is COMMAND_TYPE range
  1564.        151:                                   HELP_CMD..BACKUP_CMD ;
  1565.        152:    subtype MAIN_MENU_CMD          is COMMAND_TYPE range
  1566.        153:                                   DESIGN_CMD..FINISHED_CMD ;
  1567.        154:    subtype DESIGN_MENU_CMD        is COMMAND_TYPE range
  1568.        155:                                   CREATE_CMD..PAN_RIGHT_CMD ;
  1569.        156:    subtype ATTRIBUTES_MENU_CMD    is COMMAND_TYPE range
  1570.        157:                                   COND_CALL_CMD..TASK_CMD ;
  1571.        158:    subtype CREATE_MENU_CMD        is COMMAND_TYPE range
  1572.        159:                                   VIRT_PACKAGE_CMD..CONNECTION_CMD ;
  1573.        160:    subtype EDIT_MENU_CMD          is COMMAND_TYPE range
  1574.        161:                                   ADD_CMD..REMOVE_CMD ;
  1575.        162:    subtype CHANGE_TYPE_MENU_CMD   is COMMAND_TYPE range
  1576.        163:                                   PEN_COLOR_CMD..SYMBOL_CMD ;
  1577.        164:    subtype GENERIC_MENU_CMD       is COMMAND_TYPE range
  1578.        165:                                   DECLARATION_CMD..NON_GENERIC_CMD ;
  1579.        166:    subtype CONNECTION_MENU_CMD    is COMMAND_TYPE range
  1580.        167:                                   CALL_CMD..DATA_CMD ;
  1581.        168:    subtype CONFIRM_MENU_CMD       is COMMAND_TYPE range
  1582.        169:                                   CONFIRM_CMD..CANCEL_CMD ;
  1583.        170:    subtype ANNOTATING_MENU_CMD    is COMMAND_TYPE range
  1584.        171:                                   TASK_ENTRY_CMD..IMPORT_FUNC_CMD ;
  1585.        172:    subtype COLOR_MENU_CMD         is COMMAND_TYPE range
  1586.        173:                                   RED_CMD..BLACK_CMD ;
  1587.        174:    subtype LINE_MENU_CMD          is COMMAND_TYPE range
  1588.        175:                                   SOLID_CMD..DOTTED_CMD ;
  1589.        176:    subtype PARAMETER_STATUS_CMD   is COMMAND_TYPE range
  1590.        177:                                   HAS_PARAMETERS..NO_PARAMETERS ;
  1591.        178:    subtype CALL_STATUS_CMD        is COMMAND_TYPE range
  1592.        179:                                   CONDITIONAL..TIMED ;
  1593.        180:    subtype ENTRY_POINT_STATUS_CMD is COMMAND_TYPE range
  1594.        181:                                   IS_GUARDED..NOT_GUARDED ;
  1595.        182:    subtype NULL_MENU_CMD          is COMMAND_TYPE range
  1596.        183:                                   NULL_CMD..NULL_CMD ;
  1597.        184:
  1598.        185:    type MENU_ID is ( MAIN_MENU ,
  1599.        186:                      DESIGN_MENU ,
  1600.        187:                      ATTRIBUTES_MENU ,
  1601.        188:                      CREATE_MENU ,
  1602.        189:                      CONFIRM_MENU ,
  1603.        190:                      EDIT_MENU ,
  1604.        191:                      CHANGE_TYPE_MENU ,
  1605.        192:                      GENERIC_MENU ,
  1606.        193:                      CONNECTION_MENU ,
  1607.        194:                      ANNOTATING_MENU ,
  1608.        195:                      COLOR_MENU ,
  1609.        196:                      LINE_MENU ,
  1610.        197:                      PARAMETER_STATUS_MENU ,
  1611.        198:                      CALL_STATUS_MENU ,
  1612.        199:                      ENTRY_POINT_STATUS_MENU ,
  1613.        200:                      NULL_MENU ) ;
  1614.        201:
  1615.        202:    -----------------------------------------------------------------
  1616.        203:    --  The identifiers for icon locations.
  1617.        204:    -----------------------------------------------------------------
  1618.        205:    subtype ICON_ID is POSITIVE range 1..20 ;
  1619.        206:
  1620.        207:    -----------------------------------------------------------------
  1621.        208:    --  This table allows the translation of icon ID's into commands.
  1622.        209:    -----------------------------------------------------------------
  1623.        210:    MAX_NAME_SIZE : constant POSITIVE := 13 ;
  1624.        211:    NULL_NAME : STRING( 1..MAX_NAME_SIZE ) := "* null cmd * ";
  1625.        212:
  1626.        213:    type MENU_TABLE_ENTRY is
  1627.        214:       record
  1628.        215:          COMMAND        : COMMAND_TYPE := NULL_CMD ;
  1629.        216:          NAME           : STRING ( 1..MAX_NAME_SIZE ) := NULL_NAME ;
  1630.        217:       end record ;
  1631.        218:
  1632.        219:    MENU_TABLE : array ( MENU_ID , ICON_ID ) of MENU_TABLE_ENTRY ;
  1633.        220:
  1634.        221:    SESSION_NAME : STRING (1..40) :=              -- A FILENAME
  1635.        222:     "                                        " ;
  1636.        223:
  1637.        224:    -----------------------------------------------------------------
  1638.        225:    -- Define the array containing the segment numbers of the menu
  1639.        226:    -- icons indexed by menu and icon.
  1640.        227:    -----------------------------------------------------------------
  1641.        228:    ICON_SEGMENTS : array ( MENU_ID ) of
  1642.        229:       GRAPHICS_DATA.SEGMENT_LIST_TYPE( ICON_ID'first..ICON_ID'last ) :=
  1643.        230:       ( MAIN_MENU..NULL_MENU => ( ICON_ID'first..ICON_ID'last =>
  1644.        231:                                   GRAPHICS_DATA.NULL_SEGMENT ));
  1645.        232:
  1646.        233:    ----------------------------------------------------------------
  1647.        234:    --  icon location to id cross reference of lower BOUNDARY
  1648.        235:    ----------------------------------------------------------------
  1649.        236:    type BOUNDARY_VALUES is
  1650.        237:       record
  1651.        238:          UPPER : GKS_SPECIFICATION.WC ;
  1652.        239:          LOWER : GKS_SPECIFICATION.WC ;
  1653.        240:       end record ;
  1654.        241:    ICON_BOUNDARY : array ( ICON_ID ) of BOUNDARY_VALUES ;
  1655.        242:
  1656.        243:    ----------------------------------------------------------------
  1657.        244:    -- Minimum and maximum X values for menu rectangle.
  1658.        245:    ----------------------------------------------------------------
  1659.        246:    MENU_X_MIN, MENU_X_MAX : GKS_SPECIFICATION.WC ;
  1660.        247:
  1661.        248:    ----------------------------------------------------------------
  1662.        249:    --  Menu which is currently displayed to operator.
  1663.        250:    ----------------------------------------------------------------
  1664.        251:    CURRENT_MENU : MENU_ID := NULL_MENU ;
  1665.        252:
  1666.        253:    ----------------------------------------------------------------
  1667.        254:    --  Local exceptions indicating an invalid symbol was selected or
  1668.        255:    --  the user attempted to improperly use a command.
  1669.        256:    ----------------------------------------------------------------
  1670.        257:    INVALID_COMMAND_SELECTED : exception ;
  1671.        258:    IMPROPER_COMMAND_USAGE   : exception ;
  1672.        259:
  1673.        260: end MMI_PARAMETERS;
  1674.        261:
  1675.        262:
  1676.        263:
  1677.        264: package body MMI_PARAMETERS is
  1678.  
  1679.        556: end MMI_PARAMETERS ;
  1680. Compilation complete
  1681.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 556
  1682.          1: pragma source_info(on);
  1683.          2:
  1684.          3: with SYSTEM             ;
  1685.          4: with GKS_SPECIFICATION  ; use GKS_SPECIFICATION ;
  1686.          5: with GRAPHICS_DATA      ; use GRAPHICS_DATA  ;
  1687.          6: with MMI_PARAMETERS     ; use MMI_PARAMETERS ;
  1688.          7: with TREE_DATA          ; use TREE_DATA ;
  1689.          8:
  1690.          9: -- controlled by JERRY BAKER
  1691.         10: -- version 85-07-24 16:25 by JL
  1692.         11:
  1693.         12: package UTILITIES is
  1694.         13: -- ===========================================================
  1695.         14: --
  1696.         15: --  This package provides the common MMI functions, implemented
  1697.         16: --  so as to use the formated screen and mouse selected command
  1698.         17: --  features of the GRAPHICS_INTERFACE.
  1699.         18: --
  1700.         19: --  This package provides the help facility.  Help can be provided
  1701.         20: --  on each command level.
  1702.         21: --
  1703.         22: --  The specification is null for compilation under compiler
  1704.         23: --  version 1.5
  1705.         24: --
  1706.         25: -- ==========================================================
  1707.         26:
  1708.         27:    package GRAPHICS renames GRAPHICS_DATA ;
  1709.         28:
  1710.         29:    --{{  Utilities to be placed here as they are recognized, one
  1711.         30:    --{{  example is given below.
  1712.         31:
  1713.         32:    subtype FILE_NAME is STRING( 1..8 ) ;
  1714.         33:
  1715.         34:    function GET_FILE_HANDLE
  1716.         35:    return FILE_NAME ;
  1717.         36:    -- ===================================================
  1718.         37:    --  This function prompts the user for a filename and
  1719.         38:    --  opens the file returning the FILE_TYPE needed to
  1720.         39:    --  access the file.
  1721.         40:    -- ===================================================
  1722.         41:
  1723.         42:    procedure HELP ( MENU : in MENU_ID ) ;
  1724.         43:    -- ========================================================
  1725.         44:    --  This procedure provides help for the current
  1726.         45:    --  Command Level and all levels beneath it.  The format of
  1727.         46:    --  the help will be textual (i.e., it will be implemented
  1728.         47:    --  on the Text plane of the terminal so as to not interfere
  1729.         48:    --  with the graphics.
  1730.         49:    -- =========================================================
  1731.         50:
  1732.         51:    procedure SIGN_ON ;
  1733.         52:    -- ==========================================================
  1734.         53:    --  This routine provides initial system start up utilities
  1735.         54:    --  such as clearing the terminal screen, displaying a
  1736.         55:    --  copyright message, etc.
  1737.         56:    -- ==========================================================
  1738.         57:
  1739.         58:    procedure DISPLAY_MENU_AND_GET_COMMAND
  1740.         59:              ( MENU        : in MENU_ID ;
  1741.         60:                NEW_COMMAND : out COMMAND_TYPE );
  1742.         61:    -- ==========================================================
  1743.         62:    --  Display the appropriate menu and get the user selected
  1744.         63:    --  command.
  1745.         64:    -- ==========================================================
  1746.         65:
  1747.         66:    procedure DISPLAY_MENU
  1748.         67:              ( MENU    : in MENU_ID ;
  1749.         68:                COMMAND : in COMMAND_TYPE ) ;
  1750.         69:    -- ==========================================================
  1751.         70:    --  Display the appropriate menu and highlight the specified
  1752.         71:    --  command.
  1753.         72:    -- ==========================================================
  1754.         73:
  1755.         74:    procedure DISPLAY_ERROR
  1756.         75:               ( DISPLAY_STRING : in STRING );
  1757.         76:    -- =========================================================
  1758.         77:    --  This procedure displays the received string to the
  1759.         78:    --  operator, waits for an operator acknowledgement, and
  1760.         79:    --  clears the displayed line.
  1761.         80:    -- =========================================================
  1762.         81:
  1763.         82:    procedure REFERENCE_MARKER
  1764.         83:              ( MODE     : in GKS_SPECIFICATION.SEGMENT_VISIBILITY ;
  1765.         84:                LOCATION : in GKS_SPECIFICATION.POINT ) ;
  1766.         85:    -- ==========================================================
  1767.         86:    --  Place the system marker segment at the specified location
  1768.         87:    --  and set the segment visible or invisible.
  1769.         88:    -- ==========================================================
  1770.         89:
  1771.         90:    function SCOPE_CHECK
  1772.         91:              ( NEW_ENTITY_POINT : in GKS_SPECIFICATION.POINT ;
  1773.         92:                PARENT           : in TREE_DATA.TREE_NODE_ACCESS_TYPE )
  1774.         93:              return BOOLEAN ;
  1775.         94:    -- ==========================================================
  1776.         95:    --  If the specified new entity being drawn is within the
  1777.         96:    --  boundary of the Parent's reference and size points then
  1778.         97:    --  return true; else return false.
  1779.         98:    -- ==========================================================
  1780.         99:
  1781.        100:    function SCOPE_SEARCH
  1782.        101:              ( REFERENCE_POINT : in GKS_SPECIFICATION.POINT )
  1783.        102:              return TREE_DATA.TREE_NODE_ACCESS_TYPE ;
  1784.        103:    -- ==========================================================
  1785.        104:    --  Return a Tree Pointer to the Parent of the user
  1786.        105:    --  specified reference point.  The Parent is the object
  1787.        106:    --  whose reference and size points contain the user
  1788.        107:    --  specified reference point.
  1789.        108:    -- ==========================================================
  1790.        109:
  1791.        110:    function TRUNCATE_NAME
  1792.        111:              ( USER_NAME   : in STRING ;
  1793.        112:                SPACE_WIDTH : in NATURAL )
  1794.        113:    return STRING;
  1795.        114:    -- ==========================================================
  1796.        115:    --  Truncate the user name to a width which will fit into
  1797.        116:    --  the user specified space width, and return the
  1798.        117:    --  truncate name.
  1799.        118:    -- ==========================================================
  1800.        119:
  1801.        120:    procedure REQUEST_CONNECTION
  1802.        121:              (LINE_PARENT : in TREE_DATA.TREE_NODE_ACCESS_TYPE ;
  1803.        122:               START_POINT : in GKS_SPECIFICATION.POINT ;
  1804.        123:               END_POINT   : in GKS_SPECIFICATION.POINT ;
  1805.        124:               CONNECTION  : in out TREE_DATA.LINE_TYPE ) ;
  1806.        125:    -----------------------------------------------------------------
  1807.        126:    --  This procedure performs the operations necessary to
  1808.        127:    --  have the User enter the points which define a series
  1809.        128:    --  of line segments which form a connection between the
  1810.        129:    --  starting and ending points.
  1811.        130:    -----------------------------------------------------------------
  1812.        131:
  1813.        132:    procedure REQUEST_POINT
  1814.        133:               ( DISPLAY_STRING  : in STRING ;
  1815.        134:                 REFERENCE_POINT : out GKS_SPECIFICATION.POINT ;
  1816.        135:                 PARENT          : out TREE_DATA.TREE_NODE_ACCESS_TYPE ) ;
  1817.        136:    -- =========================================================
  1818.        137:    --  This procedure displays the received string to the
  1819.        138:    --  operator, and returns an operator specified point and
  1820.        139:    --  the associated parent entity.
  1821.        140:    -- =========================================================
  1822.        141:
  1823.        142:    procedure REQUEST_POINTS
  1824.        143:               ( REFERENCE_POINT : out GKS_SPECIFICATION.POINT ;
  1825.        144:                 SIZE_POINT      : out GKS_SPECIFICATION.POINT ;
  1826.        145:                 PARENT          : out TREE_DATA.TREE_NODE_ACCESS_TYPE );
  1827.        146:    -- =========================================================
  1828.        147:    --  This procedure request the operator to input the upper
  1829.        148:    --  left and lower right points of the rectangle which
  1830.        149:    --  delineates the area enclosing the entity to be drawn.
  1831.        150:    -- =========================================================
  1832.        151:
  1833.        152:    procedure REQUEST_LABEL
  1834.        153:              ( LABEL  : in out TREE_DATA.NAME_TYPE ) ;
  1835.        154:    -- ==========================================================
  1836.        155:    --  Prompt the operator for the label of a graphical entity,
  1837.        156:    --  and verify the validity of the label.
  1838.        157:    -- ==========================================================
  1839.        158:
  1840.        159:    procedure REQUEST_LABEL
  1841.        160:              ( LABEL  : in out TREE_DATA.NAME_TYPE ;
  1842.        161:                PROMPT : in STRING ) ;
  1843.        162:    -- ==========================================================
  1844.        163:    --  Prompt the operator for the label of a graphical entity,
  1845.        164:    --  and verify the validity of the label.
  1846.        165:    -- ==========================================================
  1847.        166:
  1848.        167:    procedure DIMENSION_CHECK
  1849.        168:              ( SHAPE   : in GRAPHICS_DATA.SHAPE_TYPE ;
  1850.        169:                POINT_A : in GKS_SPECIFICATION.POINT ;
  1851.        170:                POINT_B : in out GKS_SPECIFICATION.POINT ) ;
  1852.        171:    -- =========================================================
  1853.        172:    --  This procedure checks that point b has the minimum
  1854.        173:    --  magnitudes from point a in the x & y directions based
  1855.        174:    --  on the type of object being drawn. If any errors occur
  1856.        175:    --  then the user is notified and the new point b position
  1857.        176:    --  is drawn and confirmation is required.
  1858.        177:    -- =========================================================
  1859.        178:
  1860.        179:    procedure DRAW_GRAPH_TREE ;
  1861.        180:    -- =========================================================
  1862.        181:    --  This procedure draws the contents of the graph tree to
  1863.        182:    --  the graphics display.
  1864.        183:    -- =========================================================
  1865.        184:
  1866.        185:    function CHECK_IF_GENERIC_INSTAN
  1867.        186:             ( TREE_NODE : TREE_NODE_ACCESS_TYPE )
  1868.        187:    return BOOLEAN ;
  1869.        188:    -- =====================================================================
  1870.        189:    --  This procedure returns true if the TREE_NODE passed to it is
  1871.        190:    --  a generic instantiation.
  1872.        191:    -- =====================================================================
  1873.        192:
  1874.        193:    procedure PICK_GRAPH_ENTITY ( PROMPT : in STRING ;
  1875.        194:         GRAPH_NODE : out TREE_DATA.GRAPH_NODE_ACCESS_TYPE ) ;
  1876.        195:    -- =========================================================
  1877.        196:    --  This procedure performs the prompt display and graph node
  1878.        197:    --  lookup for a picked graphic entity.
  1879.        198:    --  The routine exits with the window being
  1880.        199:    --  the GRAPH_VIEW_PORT.
  1881.        200:    -- =========================================================
  1882.        201:
  1883.        202:    function ENTITY_TO_FIGURE_TYPE ( PARENT : ENTITY_TYPE ) return
  1884.        203:         GRAPHICS_DATA.GRAPHIC_ENTITY ;
  1885.        204:    -- =========================================================
  1886.        205:    --  This procedure returns the graphic_entity declaration
  1887.        206:    --  for the corresponding entity_type declaration.
  1888.        207:    -- =========================================================
  1889.        208:
  1890.        209:    function DISPLAY_AND_IDENTIFY ( ENTITY_ITEM : ENTITY_TYPE ;
  1891.        210:                                    ENTITY_NAME : TREE_DATA.NAME_TYPE ;
  1892.        211:                                    LABEL_POINT : GKS_SPECIFICATION.POINT ;
  1893.        212:                                    COLOR : GRAPHICS_DATA.COLOR_TYPE ) return
  1894.        213:         GKS_SPECIFICATION.SEGMENT_IDENTIFIER ;
  1895.        214:    -- =========================================================
  1896.        215:    --  This procedure displays the entity and returns the
  1897.        216:    --  segment identifier.
  1898.        217:    -- =========================================================
  1899.        218:
  1900.        219:    ---------------------------------------------------------------
  1901.        220:    --  This exception is raised if an utility subprogram is unable
  1902.        221:    --  to properly complete the requested operation.
  1903.        222:    ---------------------------------------------------------------
  1904.        223:    UTILITY_FAILED : exception ;
  1905.        224:
  1906.        225: end UTILITIES ;
  1907.        226:
  1908.        227: -- pragma PAGE ;
  1909.        228:
  1910.        229: with GRAPHIC_DRIVER               ;  use GRAPHIC_DRIVER ;
  1911.        230: with VIRTUAL_TERMINAL_INTERFACE   ;  use VIRTUAL_TERMINAL_INTERFACE ;
  1912.        231: with TEXT_IO                      ;  use TEXT_IO;
  1913.        232: with TREE_IO                      ;
  1914.        233: with TREE_OPS                     ;
  1915.        234: with TRACE_PKG                    ;
  1916.        235:
  1917.        236: package body UTILITIES is
  1918.  
  1919.       1719: end UTILITIES ;
  1920. Compilation complete
  1921.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 1719
  1922.          1: pragma source_info ( on ) ;
  1923.          2:
  1924.          3: -- controlled by JOHN LONG
  1925.          4: -- version 85-07-16 0845 by JL
  1926.          5:
  1927.          6: package MMI_ATTRIBUTES is
  1928.          7: -- =============================================================
  1929.          8: --
  1930.          9: --  This package implements the attribute control capability of
  1931.         10: --  the Man-Machine Interface.  It controls the ATTRIBUTES_MENU
  1932.         11: --  and all subordinate menus, both in terms of displaying
  1933.         12: --  the menus and implementing their implied functionality.
  1934.         13: --
  1935.         14: -- =============================================================
  1936.         15:
  1937.         16:    procedure CONTROL_ATTRIBUTES_MENU ;
  1938.         17:    -- =========================================================
  1939.         18:    --  This procedure performs operations required to implement
  1940.         19:    --  the attributes menu commands.
  1941.         20:    -- =========================================================
  1942.         21:
  1943.         22: end MMI_ATTRIBUTES ;
  1944.         23:
  1945.         24: with GRAPHICS_DATA               ;  use GRAPHICS_DATA ;
  1946.         25: with MMI_PARAMETERS              ;  use MMI_PARAMETERS ;
  1947.         26: with UTILITIES                   ;  use UTILITIES ;
  1948.         27: with VIRTUAL_TERMINAL_INTERFACE  ;  use VIRTUAL_TERMINAL_INTERFACE ;
  1949.         28:
  1950.         29: package body MMI_ATTRIBUTES is
  1951.  
  1952.        441: end MMI_ATTRIBUTES ;
  1953. Compilation complete
  1954.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 441
  1955.          1: pragma source_info ( on ) ;
  1956.          2:
  1957.          3: -- controlled by JOHN REDDAN
  1958.          4: -- version 85-07-25 0935 by JL
  1959.          5:
  1960.          6: package MMI_DESIGN is
  1961.          7: -- =============================================================
  1962.          8: --
  1963.          9: --  This package implements the design capability of the
  1964.         10: --  Man-Machine Interface.  It controls the DESIGN_MENU
  1965.         11: --  and all subordinate menus, both in terms of displaying
  1966.         12: --  the menus and implementing their implied functionality.
  1967.         13: --
  1968.         14: -- =============================================================
  1969.         15:
  1970.         16:    procedure CONTROL_DESIGN_MENU ;
  1971.         17:    -- =========================================================
  1972.         18:    --  This procedure performs operations required to implement
  1973.         19:    --  the design menu commands.
  1974.         20:    -- =========================================================
  1975.         21:
  1976.         22: end MMI_DESIGN ;
  1977.         23:
  1978.         24:
  1979.         25: with GKS_SPECIFICATION           ;  use GKS_SPECIFICATION ;
  1980.         26: with GRAPHICS_DATA               ;  use GRAPHICS_DATA ;
  1981.         27: with GRAPHIC_DRIVER              ;  use GRAPHIC_DRIVER ;
  1982.         28: with MMI_CONTROL_MENUS           ;  use MMI_CONTROL_MENUS ;
  1983.         29: with MMI_PARAMETERS              ;  use MMI_PARAMETERS ;
  1984.         30: with TRACE_PKG                   ;
  1985.         31: with TREE_DATA                   ;  use TREE_DATA ;
  1986.         32: with TREE_OPS                    ;  use TREE_OPS ;
  1987.         33: with UTILITIES                   ;  use UTILITIES ;
  1988.         34: with VIRTUAL_TERMINAL_INTERFACE  ;  use VIRTUAL_TERMINAL_INTERFACE ;
  1989.         35:
  1990.         36: package body MMI_DESIGN is
  1991.  
  1992.        936: end MMI_DESIGN ;
  1993. Compilation complete
  1994.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 936
  1995.          1: pragma source_info ( on ) ;
  1996.          2:
  1997.          3: -- controlled by JOHN REDDAN
  1998.          4: -- version 85-07-24 12:45 by JL
  1999.          5:
  2000.          6: with MMI_PARAMETERS              ;  use MMI_PARAMETERS ;
  2001.          7:
  2002.          8: package MMI_CONTROL_MENUS is
  2003.          9: -- =============================================================
  2004.         10: --
  2005.         11: --  This package contains the menu control subprograms
  2006.         12: --  used by the Design functions of the Man-Machine
  2007.         13: --  Interface.
  2008.         14: --
  2009.         15: -- =============================================================
  2010.         16:
  2011.         17:    function CONTROL_GENERIC_MENU return COMMAND_TYPE ;
  2012.         18:    -- =========================================================
  2013.         19:    --  This procedure performs operations required to implement
  2014.         20:    --  the generic menu commands.
  2015.         21:    -- =========================================================
  2016.         22:
  2017.         23:    function CONTROL_PARAMETER_STATUS_MENU return COMMAND_TYPE ;
  2018.         24:    -- =========================================================
  2019.         25:    --  This procedure performs operations required to implement
  2020.         26:    --  the parameter status menu commands.
  2021.         27:    -- =========================================================
  2022.         28:
  2023.         29:    function CONTROL_CALL_STATUS_MENU return COMMAND_TYPE ;
  2024.         30:    -- =========================================================
  2025.         31:    --  This procedure performs operations required to implement
  2026.         32:    --  the call status menu commands.
  2027.         33:    -- =========================================================
  2028.         34:
  2029.         35:    function CONTROL_ENTRY_POINT_STATUS_MENU return COMMAND_TYPE ;
  2030.         36:    -- =========================================================
  2031.         37:    --  This procedure performs operations required to implement
  2032.         38:    --  the entry point status menu commands.
  2033.         39:    -- =========================================================
  2034.         40:
  2035.         41:    function CONTROL_CONNECTION_MENU return COMMAND_TYPE ;
  2036.         42:    -- =========================================================
  2037.         43:    --  This procedure performs operations required to implement
  2038.         44:    --  the connection menu commands.
  2039.         45:    -- =========================================================
  2040.         46:
  2041.         47:    function CONTROL_ANNOTATING_MENU return COMMAND_TYPE ;
  2042.         48:    -- =========================================================
  2043.         49:    --  This procedure performs operations required to implement
  2044.         50:    --  the add menu commands.
  2045.         51:    -- =========================================================
  2046.         52:
  2047.         53:    function CONFIRM return COMMAND_TYPE ;
  2048.         54:    -- ==========================================================
  2049.         55:    --  This function returns true if the user wishes to confirm
  2050.         56:    --  the execution of the operation in progress.  Any response
  2051.         57:    --  but confirm will return false.
  2052.         58:    -- ==========================================================
  2053.         59:
  2054.         60: end MMI_CONTROL_MENUS ;
  2055.         61:
  2056.         62:
  2057.         63: with GKS_SPECIFICATION           ;  use GKS_SPECIFICATION ;
  2058.         64: with GRAPHICS_DATA               ;  use GRAPHICS_DATA ;
  2059.         65: with GRAPHIC_DRIVER              ;  use GRAPHIC_DRIVER ;
  2060.         66: with TRACE_PKG                   ;
  2061.         67: with TREE_DATA                   ;  use TREE_DATA ;
  2062.         68: with TREE_OPS                    ;  use TREE_OPS ;
  2063.         69: with UTILITIES                   ;  use UTILITIES ;
  2064.         70: with VIRTUAL_TERMINAL_INTERFACE  ;  use VIRTUAL_TERMINAL_INTERFACE ;
  2065.         71:
  2066.         72: package body MMI_CONTROL_MENUS is
  2067.  
  2068.        595: end MMI_CONTROL_MENUS ;
  2069. Compilation complete
  2070.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 595
  2071.          1: pragma source_info(on);
  2072.          2:
  2073.          3: with SYSTEM ;
  2074.          4:
  2075.          5: -- controlled by JERRY BAKER
  2076.          6: -- version 85-07-18 08:30 by RAM
  2077.          7:
  2078.          8: package MMI is
  2079.          9: -- ==============================================================
  2080.         10: --
  2081.         11: --  This package provides the Man-Machine Interface and
  2082.         12: --  implements the requested graphics operations for
  2083.         13: --  the GAD program.  It inputs the commands from
  2084.         14: --  the user via the GRAPHICS_DRIVER to isolate it from
  2085.         15: --  device dependencies.  The decoded commands are then
  2086.         16: --  passed to the appropriate routine(s) of the MMI_OPERATIONS
  2087.         17: --  package body.
  2088.         18: --
  2089.         19: --  Requirements:
  2090.         20: --   1) decode commands entered by the user.
  2091.         21: --   2) implement the commands required in the GAD
  2092.         22: --      User Manual.
  2093.         23: --
  2094.         24: -- ===============================================================
  2095.         25:
  2096.         26:    procedure INITIALIZE ;
  2097.         27:    -- ========================================================
  2098.         28:    --  This procedure will initialize the command derefencing
  2099.         29:    --  table and download all terminal dependent command
  2100.         30:    --  data.
  2101.         31:    -- ========================================================
  2102.         32:
  2103.         33:    procedure PROCESS_COMMAND ;
  2104.         34:    -- ======================================================
  2105.         35:    --
  2106.         36:    --  This procedure will input commands from the user
  2107.         37:    --  via the GRAPHICS_DRIVER.  The selected commands are
  2108.         38:    --  then passed to the MMI_OPERATIONS package.
  2109.         39:    -- =======================================================
  2110.         40:
  2111.         41:    procedure PANIC_EXIT ;
  2112.         42:    -- ========================================================
  2113.         43:    --  This procedure orchestrates an abnormal termination
  2114.         44:    --  condition detected by the program unit.
  2115.         45:    -- ========================================================
  2116.         46:
  2117.         47: end MMI ;
  2118.         48:
  2119.         49: -- pragma PAGE ;
  2120.         50: with MMI_PARAMETERS             ; use MMI_PARAMETERS ;
  2121.         51: with MMI_DESIGN                 ;
  2122.         52: with MMI_ATTRIBUTES             ;
  2123.         53: with VIRTUAL_TERMINAL_INTERFACE ; use VIRTUAL_TERMINAL_INTERFACE ;
  2124.         54: with GKS_SPECIFICATION          ; use GKS_SPECIFICATION ;
  2125.         55: with GRAPHICS_DATA              ; use GRAPHICS_DATA ;
  2126.         56: with GRAPHIC_DRIVER             ; use GRAPHIC_DRIVER ;
  2127.         57: with PDL_GEN                    ;
  2128.         58: with TRACE_PKG                  ; use TRACE_PKG ;
  2129.         59: with TREE_IO                    ;
  2130.         60: with UTILITIES                  ; use UTILITIES ;
  2131.         61:
  2132.         62: package body MMI is
  2133.  
  2134. Compilation complete
  2135.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 333
  2136. 4.4        PDL_GENERATOR
  2137.  
  2138. The virtual package PDL_GEN contains the subprograms which will generate the Ada PDL corresponding to the current Ada
  2139. Graph being developed.
  2140.  
  2141. The PDL_Generator package will create the Ada PDL corresponding to the information stored in the current graph tree (as
  2142. stored in TREE_DATA).
  2143.  
  2144.                                Table 4-5 PDL_GENERATOR Virtual Package Dependencies List
  2145.  
  2146.                            COMPILATION UNITS  TYPE        COMMENTS          DEPENDENCIES
  2147.                            PDL_Generator      Package                       System
  2148.                                                                             Direct_IO
  2149.                                                                             Design_Pkg
  2150.                                                                             Graph_Tree_Access
  2151.  
  2152.        PDL_GENERATOR
  2153.         - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2154.        |                       PDL_GEN                                                                  |
  2155.                                -----------------------------------------------------         -----------------------
  2156. ---------------------     ----------------                                         |     (A)-<  SYSTEM             >
  2157. : PDL_GEN_OBJECTS   :  <--( DECLARATIONS )                                         |  +->(B)-<  DIRECT_IO          >
  2158. ---------------------     ----------------                                         |  |  (C)-<  DESIGN_PKG         >
  2159.                                |                       =========================== |  |  (D)-<< GRAPH_TREE_ACCESS >>
  2160.        |                       |      +--------------->|   TRACE[]               | |  |      -----------------------
  2161.                                |      |                |=========================| |  |
  2162.        |                       |      |              =========================== | |  |                 |
  2163.                                |      +------------->|   INDENT                | | |  |
  2164.        |                       |      |              |=========================|-- |  |                 |
  2165.                                |      |            =========================== |   |  |
  2166.        |                       |      +----------->|   INCREMENT_INDENTATION | |   |  |                 |
  2167.                                |      |            |=========================|--   |  |
  2168.        |                       |      |          =========================== |     |  |                 |
  2169.                                |      +--------->|   DECREMENT_INDENTATION | |     |  |
  2170.        |                       |      |          |=========================|--     |  |                 |
  2171.                                |      |        =========================== |       |  |
  2172.        |                       |      +------->| = EXTRACT[]             | |       |  |                 |
  2173.                                |      |        |=========================|--       |  |
  2174.        |                       |      |      =========================== |         |  |                 |
  2175.                                |      +----->|   EMIT_SPECS[]          | |         |  |
  2176.        |                       |      |      |=========================|--         |  |                 |
  2177.                                |      |    =========================== |           |  |
  2178.        |                       |      +--->|   EMIT_BODIES[]         | |           |  |                 |
  2179.                                |      |    |=========================|--           |  |
  2180.        |                       |      |    |                         |             |  |                 |
  2181.                                |      |    ---------------------------             |  |
  2182.        |                       |      +-------------------------+                  |  |                 |
  2183.    ---------                 -----       =====================  |                  |  |
  2184.    |       |---------------->|   |------>| GENERATE_PDL[]    |  |                  |  |                 |
  2185.    ---------                 -----       |===================|  |                  |  |
  2186.        |                       |         |                   |--+---------------------+                 |
  2187.                                |         ---------------------                     |
  2188.        |                       -----------------------------------------------------                    |
  2189.         - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2190.                                 Figure 4 -  PDL_GENERATOR Virtual Package Design Diagram
  2191.          1: -- controlled by John Reddan
  2192.          2: -- version dated:  16 July 1985  17:20
  2193.          3:
  2194.          4: package PDL_GEN is
  2195.          5: ------------------------------------------------------------------------
  2196.          6: --
  2197.          7: --  This package will create the Ada PDL corresponding to the
  2198.          8: --  information stored in the current graph tree (as stored
  2199.          9: --  in TREE_DATA).
  2200.         10: ------------------------------------------------------------------------
  2201.         11:
  2202.         12:    ---------------------------------------------------------------------
  2203.         13:    --
  2204.         14:    --  The following are the parameters controlling PDL generation.
  2205.         15:    --
  2206.         16:    ---------------------------------------------------------------------
  2207.         17:
  2208.         18:    TRACE_GENERATION : BOOLEAN := False ; -- TRUE;
  2209.         19:    --  Trace the PDL Generation process with an emphasis on
  2210.         20:    --  tracking the nodes traversed.
  2211.         21:
  2212.         22:    INDENTATION_INCREMENT : NATURAL range 1..8 := 3;
  2213.         23:    --  The number of spaces indented for each nesting level.
  2214.         24:
  2215.         25:    MAX_INDENTATION : NATURAL range 0..40 := INDENTATION_INCREMENT*10;
  2216.         26:    --  The greatest amount of indentation allowed, should always be
  2217.         27:    --  an multiple of the INDENTATION_INCREMENT
  2218.         28:
  2219.         29:    MAX_LINE_LENGTH : NATURAL range 50..256 := 80;
  2220.         30:    --  The longest line output in PDL generation
  2221.         31:
  2222.         32:    UNTRANSLATABLE_CODE_COMMENT_SYMBOL : CHARACTER := '/';
  2223.         33:    --  The character appended to a standard Ada comment symbol
  2224.         34:    --  to denote an untranslatable code statement (for example,
  2225.         35:    --  a virtual package declaration).
  2226.         36:    --
  2227.         37:
  2228.         38:    ---------------------------------------------------------------------
  2229.         39:    --  The following procedure is invoked to cause the PDL generation
  2230.         40:    --  to occur
  2231.         41:    ---------------------------------------------------------------------
  2232.         42:
  2233.         43:    procedure GENERATE_PDL (PDL_FILE_NAME: in STRING);
  2234.         44:    --
  2235.         45:    --  This procedure walks the current Graph Tree and emits the
  2236.         46:    --  corresponding Ada PDL in the file designated by the user.
  2237.         47:    --  The procedure expects that PDL_FILE is an handle on
  2238.         48:    --  an open file into which the PDL should be placed.  The
  2239.         49:    --  file will be not be closed by GENERATE_PDL.
  2240.         50:    --
  2241.         51:
  2242.         52: end PDL_GEN;
  2243.         53:
  2244.         54:
  2245.         55:
  2246.         56: with TEXT_IO;
  2247.         57: with TREE_DATA; use TREE_DATA;
  2248.         58: with TREE_OPS; use TREE_OPS;
  2249.         59: package body PDL_GEN is
  2250.  
  2251.        794: end PDL_GEN;
  2252.        795:
  2253. Compilation complete
  2254.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 795
  2255. 4.5        GRAPHICS_DRIVER
  2256.  
  2257. The GRAPHICS_DRIVER virtual package provides the primitives required by GAD to communicate with the graphics device(s)
  2258. it is using.  The Graphics_Data package provides the data type containing the graphic information (location and
  2259. attributes) for each entity in the graph.  The pointer to the owning TREE_NODE is maintained in a record which includes
  2260. the record type declared below.  This data will be maintained in arrays, which will allow fairly fast searchs to be
  2261. conducted.  The Graphics_Driver package provides all the necessary screen and graphic manipulation functions needed to
  2262. perform editing of Graphic Ada Notation.  The requirements on the Graphics_Driver package are summarized as follows:
  2263.  
  2264.     1) Draw graphical entities
  2265.     2) Erase graphical entities
  2266.     3) Move graphical entities
  2267.     4) Save and restore graphical entities
  2268.     5) Initialize the graphics device
  2269.     6) Restore the graphics device to VT-100 compatibility mode
  2270.     7) Provide a device and compiler independent interface
  2271.  
  2272. This package is designed to perform the low level graphics functions associated with the Graphic Ada Designer, which
  2273. will use a VT-100 compatible bit-mapped graphics device. This package will be independent of the bit-mapped oriented
  2274. characteristics of the actual terminal.  The package needs to group symbols into hierarchies so that related symbols can
  2275. be moved together (e.g., the name (label) of a package (box)).  The terminal display list capability is utilized to meet
  2276. part of this requirement.
  2277.  
  2278.                               Table 4-6 GRAPHICS_DRIVER Virtual Package Dependencies List
  2279.  
  2280.                     COMPILATION UNITS       TYPE        COMMENTS                  DEPENDENCIES
  2281.                     Graphics_Data           Package     Graphics List Structures  System
  2282.                     Graphics_Driver         Package                               Calendar
  2283.                                                                                   Graph_Tree_Access
  2284.                                                                                   GKS_Prime
  2285.  
  2286.       GRAPHICS_DRIVER
  2287.        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2288.                                  GRAPHICS_DATA
  2289.       |                          ----------------                                                          |
  2290. -------------------------     ----------------  |                                        -------------------------------
  2291. ( GRAPHICS_DATA_TYPES   )<----( DECLARATIONS )  |                                        <  SYSTEM                     >
  2292. ( GRAPHIC_DRIVER_EXCEPTS)<-+  ----------------  |                                        <  DESIGN_PKG                 >
  2293. -------------------------  |     |              |                                        << GRAPH_TREE_ACCESS         >>
  2294.       |                    |     |              |                                      +-<< GKS_PRIME                 >>
  2295.                            |     |              |                                      +-<< VIRTUAL_TERMINAL_INTERFACE>>
  2296.       |                    |     ----------------                                      | -------------------------------
  2297.                            |               GRAPHIC_DRIVER                              +----+
  2298.       |                    |               ----------------------------------------------   |              |
  2299.                            |               |                                            |   |
  2300.       |                    |         ----------------                                   |   |              |
  2301.                            +---------( DECLARATIONS )                                   |   |
  2302.       |                              ----------------                                   |   |              |
  2303.                                            |                =======================     |   |
  2304.       |                                    |           +--->| ZOOM                |     |   |              |
  2305.                                            |           |    |=====================|     |   |
  2306.       |                                    |           |    |                     |     |   |              |
  2307.                                            |           |    |                     |-------->+
  2308.       |                                    |           |    -----------------------     |   |              |
  2309.    -------                              ------         |                o               |   o
  2310.    |     |----------------------------->|    |---------+                o               |   o              |
  2311.    |  o  |----------------------------->|  o |                          o               |   o
  2312.    |  o  |----------------------------->|  o |              =======================     |   |              |
  2313.    |     |----------------------------->|    |------------->| CLEAR_MENU          |     |   |
  2314.    -------                              ------              |=====================|     |   |              |
  2315.                                            |                |                     |     |   |
  2316.       |                                    |                |                     |-------->+              |
  2317.                                            |                -----------------------     |
  2318.       |                                    ----------------------------------------------                  |
  2319.        - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2320.                                Figure 4 - 5 GRAPHIC_DRIVER Virtual Package Design Diagram
  2321.          1: pragma source_info(on);
  2322.          2:
  2323.          3: with DESIGN_PKG        ; use DESIGN_PKG    ;
  2324.          4: with GKS_SPECIFICATION ; use GKS_SPECIFICATION ;
  2325.          5:
  2326.          6: -- controlled by BOB MAREK
  2327.          7: -- version 85-07-24-14:45 by RAM
  2328.          8:
  2329.          9: package GRAPHICS_DATA is
  2330.         10: -- ================================================================
  2331.         11: --
  2332.         12: --  This package provides the data types containing the graphic
  2333.         13: --  information (location and attributes) for each entity in
  2334.         14: --  the graph.  Some of the data is device dependent, and hence
  2335.         15: --  this declaration is separated from the GRAPH_TREE_ACCESS_PACKAGE.
  2336.         16: --  The pointer to the owning TREE_NODE is maintained in a record
  2337.         17: --  which includes the record type declared below.  This data
  2338.         18: --  will be maintained in arrays, which will allow fairly fast
  2339.         19: --  searchs to be conducted.
  2340.         20: --
  2341.         21: -- ==================================================================
  2342.         22:
  2343.         23:    ----------------------------------
  2344.         24:    --   The three windows of GAD
  2345.         25:    ----------------------------------
  2346.         26:    type WINDOW_TYPE is
  2347.         27:         ( GRAPH_VIEW_PORT,     -- The graph viewport window
  2348.         28:           MENU_VIEW_PORT ,     -- The command window
  2349.         29:           TEXT_VIEW_PORT ) ;   -- Text interaction window
  2350.         30:
  2351.         31:    ------------------------------------------------
  2352.         32:    --  The angular direction used in whole degrees.
  2353.         33:    ------------------------------------------------
  2354.         34:    subtype ANGLE_TYPE is NATURAL range 1..360 ;
  2355.         35:
  2356.         36:    --------------------------------------
  2357.         37:    --  ID number of a segment of objects.
  2358.         38:    --------------------------------------
  2359.         39:    NULL_SEGMENT : constant GKS_SPECIFICATION.SEGMENT_IDENTIFIER :=
  2360.         40:                   GKS_SPECIFICATION.SEGMENT_IDENTIFIER'first ;
  2361.         41:
  2362.         42:    --------------------------------------
  2363.         43:    --  Define a list of segments.
  2364.         44:    --------------------------------------
  2365.         45:    type SEGMENT_LIST_TYPE is array( NATURAL range <> )
  2366.         46:         of GKS_SPECIFICATION.SEGMENT_IDENTIFIER ;
  2367.         47:
  2368.         48:    --------------------------------------
  2369.         49:    --  Define a null point
  2370.         50:     -------------------------------------
  2371.         51:    NULL_POINT : constant GKS_SPECIFICATION.POINT := ( X => 0 , Y => 0 ) ;
  2372.         52:
  2373.         53:    -------------------------------------------------------
  2374.         54:    --  The scale factor to be utilized for software zoom.
  2375.         55:    -------------------------------------------------------
  2376.         56:    subtype SCALE_FACTOR_TYPE is NATURAL range 1..8 ;
  2377.         57:
  2378.         58:    -------------------------------------------------------
  2379.         59:    --  Define the zoom direction.
  2380.         60:    -------------------------------------------------------
  2381.         61:    type ZOOM_DIRECTION is ( ZOOM_IN, ZOOM_OUT );
  2382.         62:
  2383.         63:    -------------------------------------------------------
  2384.         64:    --  Define the pan direction.
  2385.         65:    -------------------------------------------------------
  2386.         66:    type PAN_DIRECTION is ( PAN_LEFT, PAN_RIGHT, PAN_UP, PAN_DOWN );
  2387.         67:
  2388.         68:    -------------------------------------------------------
  2389.         69:    --  The line type to be utilized in drawing lines.
  2390.         70:    -------------------------------------------------------
  2391.         71:    type LINE_TYPE is
  2392.         72:         ( SOLID, DASHED, DOTTED ) ;
  2393.         73:
  2394.         74:    -------------------------------------------------------
  2395.         75:    --  End of line terminators for use in drawing connectors.
  2396.         76:    -------------------------------------------------------
  2397.         77:    type TERMINATOR_TYPE is
  2398.         78:         ( NONE, LEFT_ARROW, RIGHT_ARROW, PLUS_SIGN ) ;
  2399.         79:
  2400.         80:    ------------------------------------------------------------------
  2401.         81:    --  Define the available colors.
  2402.         82:    ------------------------------------------------------------------
  2403.         83:    type COLOR_TYPE is
  2404.         84:         ( ORANGE, GREEN, YELLOW, VIOLET, RED, BLUE,
  2405.         85:           BLACK, WHITE, BROWN, DARK_RED, CYAN,
  2406.         86:           PINK, MAGENTA, PEACH, GRAY, DARK_PURPLE ) ;
  2407.         87:
  2408.         88:    ----------------------------
  2409.         89:    -- Graphics data declaration
  2410.         90:    ----------------------------
  2411.         91:    type GRAPHICS_DATA_TYPE is
  2412.         92:       record
  2413.         93:          WINDOW       : WINDOW_TYPE := GRAPH_VIEW_PORT ;
  2414.         94:          LABEL_SEG_ID : GKS_SPECIFICATION.SEGMENT_IDENTIFIER := NULL_SEGMENT ;
  2415.         95:          SEGMENT_ID   : GKS_SPECIFICATION.SEGMENT_IDENTIFIER := NULL_SEGMENT ;
  2416.         96:          LOCATION     : GKS_SPECIFICATION.POINT := NULL_POINT ;
  2417.         97:          SIZE         : GKS_SPECIFICATION.POINT := NULL_POINT ;
  2418.         98:          COLOR        : COLOR_TYPE := BLACK ;
  2419.         99:       end record ;
  2420.        100:
  2421.        101:    ------------------------
  2422.        102:    --  GENERIC informations
  2423.        103:    ------------------------
  2424.        104:    type GENERIC_STATUS_TYPE is
  2425.        105:         ( NON_GENERIC, GENERIC_DECLARATION, GENERIC_INSTANTIATION ) ;
  2426.        106:
  2427.        107:    ---------------------------------------
  2428.        108:    --  The possible Call Connection types.
  2429.        109:    ---------------------------------------
  2430.        110:    type CALL_CONNECTION_TYPE is
  2431.        111:         ( NO_CONNECTION, NORMAL, TIMED, CONDITIONAL ) ;
  2432.        112:
  2433.        113:    -------------------------------------------
  2434.        114:    -- General signal parameter for operations.
  2435.        115:    -------------------------------------------
  2436.        116:    type MODE_TYPE is ( ON , OFF ) ;
  2437.        117:
  2438.        118:    ------------------
  2439.        119:    --  ENTITY Names
  2440.        120:    ------------------
  2441.        121:    MAXIMUM_NAME_LENGTH : constant POSITIVE := 80 ;
  2442.        122:    subtype NAME_TYPE is STRING ( 1..MAXIMUM_NAME_LENGTH ) ;
  2443.        123:
  2444.        124:    type IMPORT_EXPORT_SYMBOL_TYPE is array (1..2) of STRING (1..1) ;
  2445.        125:
  2446.        126:    PKG_DECL          : IMPORT_EXPORT_SYMBOL_TYPE := ("#","#") ;
  2447.        127:    VIRT_PKG_DECL     : IMPORT_EXPORT_SYMBOL_TYPE := ("%","%") ;
  2448.        128:    TYPE_DECL         : IMPORT_EXPORT_SYMBOL_TYPE := ("(",")") ;
  2449.        129:    OBJECT_DECL       : IMPORT_EXPORT_SYMBOL_TYPE := (":",":") ;
  2450.        130:    EXCEPTION_DECL    : IMPORT_EXPORT_SYMBOL_TYPE := ("<",">") ;
  2451.        131:    SUBPROG_DECL      : IMPORT_EXPORT_SYMBOL_TYPE := ("|","|") ;
  2452.        132:    PARAMS_DECL       : IMPORT_EXPORT_SYMBOL_TYPE := ("[","]") ;
  2453.        133:    TASK_ENTRY_DECL   : IMPORT_EXPORT_SYMBOL_TYPE := ("/","/") ;
  2454.        134:    SERIAL_ENTRY_DECL : IMPORT_EXPORT_SYMBOL_TYPE := ("/","}") ;
  2455.        135:    ENTRY_FAMILY_DECL : IMPORT_EXPORT_SYMBOL_TYPE := ("(",")") ;
  2456.        136:
  2457.        137:    subtype INDICATOR_LENGTH_1 is STRING ( 1..1 ) ;
  2458.        138:    subtype INDICATOR_LENGTH_2 is STRING ( 1..2 ) ;
  2459.        139:    subtype INDICATOR_LENGTH_4 is STRING ( 1..4 ) ;
  2460.        140:
  2461.        141:    FUNCTION_SYMBOL          : INDICATOR_LENGTH_1 := "=" ;
  2462.        142:    NORMAL_REFERENCE_SYMBOL  : INDICATOR_LENGTH_1 := ">" ;
  2463.        143:    VIRTUAL_REFERENCE_SYMBOL : INDICATOR_LENGTH_2 := ">>" ;
  2464.        144:    TIMED_CALL_SYMBOL        : INDICATOR_LENGTH_1 := "T" ;
  2465.        145:    CONDITIONAL_CALL_SYMBOL  : INDICATOR_LENGTH_1 := "C" ;
  2466.        146:    GUARDED_ENTRY_SYMBOL     : INDICATOR_LENGTH_1 := "*" ;
  2467.        147:    GENERIC_DECL_SYMBOL      : INDICATOR_LENGTH_2 := "gd" ;
  2468.        148:    GENERIC_INST_SYMBOL      : INDICATOR_LENGTH_2 := "gi" ;
  2469.        149:    TASK_TYPE_SYMBOL         : INDICATOR_LENGTH_4 := "(tt)" ;
  2470.        150:
  2471.        151:    ------------------------------------------------------------
  2472.        152:    --  This structure defines the shape to be drawn for
  2473.        153:    --  each of the entities which can be graphed.
  2474.        154:    ------------------------------------------------------------
  2475.        155:    type SHAPE_TYPE is
  2476.        156:         ( SINGLE_RECTANGLE,
  2477.        157:           STACKED_RECTANGLE,
  2478.        158:           SQUARE,
  2479.        159:           PARALLELOGRAM,
  2480.        160:           CIRCLE ) ;
  2481.        161:
  2482.        162:    ------------------------------------------------------------
  2483.        163:    --  Define the supported graphic entities.
  2484.        164:    ------------------------------------------------------------
  2485.        165:    type GRAPHIC_ENTITY is
  2486.        166:         ( VIRTUAL_PKG_FIGURE,
  2487.        167:           PACKAGE_FIGURE,
  2488.        168:           SUBPROGRAM_FIGURE,
  2489.        169:           TASK_FIGURE,
  2490.        170:           BODY_FIGURE,
  2491.        171:           CALL_CONNECT_LINE,
  2492.        172:           DATA_CONNECT_LINE ) ;
  2493.        173:
  2494.        174:
  2495.        175:    ------------------------------------------------------------
  2496.        176:    --  Define the supported graphic entities which consist of
  2497.        177:    --  a line, and those which consist a figure.
  2498.        178:    ------------------------------------------------------------
  2499.        179:    subtype LINE_ENTITY is GRAPHIC_ENTITY
  2500.        180:            range CALL_CONNECT_LINE..DATA_CONNECT_LINE ;
  2501.        181:
  2502.        182:    subtype FIGURE_ENTITY is GRAPHIC_ENTITY
  2503.        183:            range VIRTUAL_PKG_FIGURE..BODY_FIGURE ;
  2504.        184:
  2505.        185:    ------------------------------------------------------------
  2506.        186:    --  Define the arrays containing the current attributes for
  2507.        187:    --  each of the supported graphic entities.
  2508.        188:    ------------------------------------------------------------
  2509.        189:    type SHAPE_ARRAY is array ( FIGURE_ENTITY )  of SHAPE_TYPE ;
  2510.        190:
  2511.        191:    type LINE_ARRAY  is array ( GRAPHIC_ENTITY ) of LINE_TYPE ;
  2512.        192:
  2513.        193:    type COLOR_ARRAY is array ( GRAPHIC_ENTITY ) of COLOR_TYPE ;
  2514.        194:
  2515.        195:    -------------------------------------------------------------------
  2516.        196:    -- Initialize the arrays containing the current attributes for
  2517.        197:    -- each of the supported graphic entities.
  2518.        198:    -------------------------------------------------------------------
  2519.        199:
  2520.        200:    ENTITY_SHAPE : SHAPE_ARRAY := (
  2521.        201:      VIRTUAL_PKG_FIGURE => SHAPE_TYPE'( SINGLE_RECTANGLE ),
  2522.        202:      PACKAGE_FIGURE     => SHAPE_TYPE'( SINGLE_RECTANGLE ),
  2523.        203:      SUBPROGRAM_FIGURE  => SHAPE_TYPE'( STACKED_RECTANGLE ),
  2524.        204:      TASK_FIGURE        => SHAPE_TYPE'( PARALLELOGRAM ),
  2525.        205:      BODY_FIGURE        => SHAPE_TYPE'( CIRCLE ) );
  2526.        206:
  2527.        207:    ENTITY_LINE : LINE_ARRAY := (
  2528.        208:      VIRTUAL_PKG_FIGURE => LINE_TYPE'( DASHED ),
  2529.        209:      PACKAGE_FIGURE     => LINE_TYPE'( SOLID ),
  2530.        210:      SUBPROGRAM_FIGURE  => LINE_TYPE'( SOLID ),
  2531.        211:      TASK_FIGURE        => LINE_TYPE'( SOLID ),
  2532.        212:      BODY_FIGURE        => LINE_TYPE'( SOLID ),
  2533.        213:      CALL_CONNECT_LINE  => LINE_TYPE'( SOLID ),
  2534.        214:      DATA_CONNECT_LINE  => LINE_TYPE'( DOTTED ) );
  2535.        215:
  2536.        216:    ENTITY_COLOR : COLOR_ARRAY := (
  2537.        217:      VIRTUAL_PKG_FIGURE => COLOR_TYPE'( BLACK ),
  2538.        218:      PACKAGE_FIGURE     => COLOR_TYPE'( BLACK ),
  2539.        219:      SUBPROGRAM_FIGURE  => COLOR_TYPE'( BLACK ),
  2540.        220:      TASK_FIGURE        => COLOR_TYPE'( BLACK ),
  2541.        221:      BODY_FIGURE        => COLOR_TYPE'( BLACK ),
  2542.        222:      CALL_CONNECT_LINE  => COLOR_TYPE'( BLACK ),
  2543.        223:      DATA_CONNECT_LINE  => COLOR_TYPE'( BLACK ) );
  2544.        224:
  2545.        225:    -------------------------------------------------
  2546.        226:    -- ICON Structure Definition
  2547.        227:    -------------------------------------------------
  2548.        228:    subtype ICON_TYPE is POSITIVE range 1 .. 100 ;
  2549.        229:
  2550.        230:    -------------------------------------------------
  2551.        231:    -- offset constants for labels
  2552.        232:    -------------------------------------------------
  2553.        233:    ENITITY_NAME_Y_OFFSET  : GKS_SPECIFICATION.WC ;
  2554.        234:    IMPORT_EXPORT_X_OFFSET : GKS_SPECIFICATION.WC ;
  2555.        235:    CHARACTER_WIDTH_OFFSET : GKS_SPECIFICATION.WC ;
  2556.        236:    STACKED_SIZE           : GKS_SPECIFICATION.WC ;
  2557.        237:
  2558.        238:
  2559.        239: end GRAPHICS_DATA ;
  2560.        240:
  2561.        241:
  2562.        242: package body GRAPHICS_DATA is
  2563.  
  2564.        254: end GRAPHICS_DATA ;
  2565. Compilation complete
  2566.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 254
  2567.          1: pragma source_info(on) ;
  2568.          2:
  2569.          3: with DESIGN_PKG        ; use DESIGN_PKG    ;
  2570.          4: with GRAPHICS_DATA     ; use GRAPHICS_DATA ;
  2571.          5: with GKS_SPECIFICATION ; use GKS_SPECIFICATION ;
  2572.          6:
  2573.          7: -- controlled by BOB MAREK
  2574.          8: -- version 85-07-22 13:20 by RAM
  2575.          9:
  2576.         10: package GRAPHIC_DRIVER is
  2577.         11: -- ================================================================
  2578.         12: --
  2579.         13: --  This package provides all the necessary screen and graphic
  2580.         14: --  manipulation functions needed to perform editing of Graphic
  2581.         15: --  Ada Notation.
  2582.         16: --
  2583.         17: --  Requirements:
  2584.         18: --   1) draw graphical entities
  2585.         19: --   2) erase graphical entities
  2586.         20: --   3) move graphical entities
  2587.         21: --   4) save and restore graphical entities
  2588.         22: --   5) initialize the graphics device
  2589.         23: --   6) restore the graphics device to VT-100 compatibility mode
  2590.         24: --   7) provide a device and compiler independent interface
  2591.         25: --
  2592.         26: --  This package is designed to perform the low level graphics
  2593.         27: --  functions associated with the Graphic Ada Designer, which
  2594.         28: --  will use on a VT-100 compatible bit-mapped graphics device.
  2595.         29: --  This package will be independent of the bit-mapped oriented
  2596.         30: --  characteristics of the actual terminal.  This is accomplished
  2597.         31: --  by using the VIRTUAL_DISPLAY_INTERFACE (similar to that used by
  2598.         32: --  the GKS graphics system).  Specific features of the VT-100 terminal
  2599.         33: --  will be supported by this package.
  2600.         34: --
  2601.         35: --  The package needs to group symbols into hierarchies so that
  2602.         36: --  related symbols can be moved together (e.g., the name (label)
  2603.         37: --  of a package (box)).  If the display list capability is
  2604.         38: --  utilized, it will be utilized to meet this requirement.
  2605.         39: --
  2606.         40: -- ==================================================================
  2607.         41:
  2608.         42:    package GRAPHICS renames GRAPHICS_DATA ;
  2609.         43:
  2610.         44:    procedure CLEAR_MENU
  2611.         45:              ( MENU       : in GRAPHICS.SEGMENT_LIST_TYPE ) ;
  2612.         46:    -- ======================================================
  2613.         47:    --  Clear the selected menu in the menu window.
  2614.         48:    -- ======================================================
  2615.         49:
  2616.         50:    procedure CLOSE_SEGMENT ;
  2617.         51:    -- ===============================================================
  2618.         52:    --  Close the currently active drawing segment.
  2619.         53:    -- ==============================================================
  2620.         54:
  2621.         55:    procedure DELETE_SEGMENT
  2622.         56:              ( SEGMENT : in GKS_SPECIFICATION.SEGMENT_IDENTIFIER ) ;
  2623.         57:    -- ===============================================================
  2624.         58:    --  Delete a segment from the graphic output.
  2625.         59:    -- ==============================================================
  2626.         60:
  2627.         61:    procedure DISPLAY_MENU
  2628.         62:              ( MENU       : in GRAPHICS.SEGMENT_LIST_TYPE ) ;
  2629.         63:    -- ======================================================
  2630.         64:    --  Display the selected menu in the menu window.
  2631.         65:    -- ======================================================
  2632.         66:
  2633.         67:    function DRAW_BOX
  2634.         68:              ( COLOR       : in GRAPHICS.COLOR_TYPE ;
  2635.         69:                FILL        : in GKS_SPECIFICATION.INTERIOR_STYLE_TYPE ;
  2636.         70:                LINE        : in GRAPHICS.LINE_TYPE ;
  2637.         71:                UPPER_LEFT  : in GKS_SPECIFICATION.POINT ;
  2638.         72:                LOWER_RIGHT : in GKS_SPECIFICATION.POINT )
  2639.         73:    return GKS_SPECIFICATION.SEGMENT_IDENTIFIER ;
  2640.         74:    -- ========================================================
  2641.         75:    --  Procedure draws a box of defined parameters, used for
  2642.         76:    --  creating menus and icons only.
  2643.         77:    -- ========================================================
  2644.         78:
  2645.         79:    function DRAW_FIGURE
  2646.         80:             ( DRAWING_ENTITY : GRAPHICS.FIGURE_ENTITY ;
  2647.         81:               BEGIN_POINT    : GKS_SPECIFICATION.POINT ;
  2648.         82:               END_POINT      : GKS_SPECIFICATION.POINT )
  2649.         83:    return GKS_SPECIFICATION.SEGMENT_IDENTIFIER ;
  2650.         84:    -- ======================================================
  2651.         85:    --  Draw the specified graphic entity at the specified
  2652.         86:    --  position using the currently defined attributes for
  2653.         87:    --  the graphic entity, and return its SEGMENT_ID.
  2654.         88:    -- ======================================================
  2655.         89:
  2656.         90:    function DRAW_LINE
  2657.         91:             ( DRAWING_ENTITY : GRAPHICS.LINE_ENTITY ;
  2658.         92:               STARTING_POINT : GKS_SPECIFICATION.POINT ;
  2659.         93:               ENDING_POINT   : GKS_SPECIFICATION.POINT  )
  2660.         94:    return GKS_SPECIFICATION.SEGMENT_IDENTIFIER ;
  2661.         95:    -- ======================================================
  2662.         96:    --  Draw a line at the specified position using the
  2663.         97:    --  currently defined attributes for the specified
  2664.         98:    --  graphic entity, and return its SEGMENT_ID.
  2665.         99:    -- ======================================================
  2666.        100:
  2667.        101:    function GET_GRAPHICS_CURSOR_POSITION
  2668.        102:    return GKS_SPECIFICATION.POINT ;
  2669.        103:    -- =====================================================
  2670.        104:    --  Return the position of the graphics cursor in world
  2671.        105:    --  coordinates.
  2672.        106:    -- =====================================================
  2673.        107:
  2674.        108:    procedure GRAPHICS_SCREEN
  2675.        109:              ( MODE : in MODE_TYPE ) ;
  2676.        110:    -- =====================================================
  2677.        111:    --  Activates or Deactivates the visibility of the
  2678.        112:    --  graphics screen.
  2679.        113:    -- =====================================================
  2680.        114:
  2681.        115:    procedure HILITE_SEGMENT
  2682.        116:              ( SEGMENT_ID : in GKS_SPECIFICATION.SEGMENT_IDENTIFIER;
  2683.        117:                MODE       : in GKS_SPECIFICATION.SEGMENT_HIGHLIGHTING ) ;
  2684.        118:    -- ======================================================
  2685.        119:    --  Turn the selected segment highlight on or off.
  2686.        120:    -- ======================================================
  2687.        121:
  2688.        122:    procedure INITIALIZE_GRAPHICS_MODE ;
  2689.        123:    -- ========================================================
  2690.        124:    --  Initialize device for graphics capability.
  2691.        125:    -- ========================================================
  2692.        126:
  2693.        127:    procedure INIT_SCREEN
  2694.        128:              ( NEW_COLOR : in  GRAPHICS.COLOR_TYPE ;
  2695.        129:                MENU_AREA : out GKS_SPECIFICATION.RECTANGLE ) ;
  2696.        130:    -- ========================================================
  2697.        131:    --  Set the screen parameters as needed.  This will include
  2698.        132:    --  establishing a scroll region on the bottom two lines.
  2699.        133:    -- ========================================================
  2700.        134:
  2701.        135:    function LABEL
  2702.        136:             ( LOCATION         : in GKS_SPECIFICATION.POINT ;
  2703.        137:               NAME             : in String ;
  2704.        138:               CHARACTER_COLOR  : in GRAPHICS.COLOR_TYPE ;
  2705.        139:               BACKGROUND_COLOR : in GRAPHICS.COLOR_TYPE := WHITE )
  2706.        140:    return GKS_SPECIFICATION.SEGMENT_IDENTIFIER ;
  2707.        141:    -- ======================================================
  2708.        142:    --  Place the specified label on the graph and associate it with
  2709.        143:    --  the specified object, returning the label SEGMENT_ID.
  2710.        144:    -- ======================================================
  2711.        145:
  2712.        146:    procedure MOVE
  2713.        147:              ( SEGMENT_ID   : in GKS_SPECIFICATION.SEGMENT_IDENTIFIER ;
  2714.        148:                NEW_LOCATION : in GKS_SPECIFICATION.POINT ) ;
  2715.        149:    -- ======================================================
  2716.        150:    --  Move the specified segment to its new location.
  2717.        151:    -- ======================================================
  2718.        152:
  2719.        153:    function OPEN_SEGMENT
  2720.        154:    return GKS_SPECIFICATION.SEGMENT_IDENTIFIER ;
  2721.        155:    -- ===============================================================
  2722.        156:    --  Create and open a segment for graphic output.
  2723.        157:    -- ==============================================================
  2724.        158:
  2725.        159:    procedure PAN
  2726.        160:              ( DIRECTION : in GRAPHICS.PAN_DIRECTION ) ;
  2727.        161:    -- ======================================================
  2728.        162:    --  Pan away from the current display.
  2729.        163:    -- ======================================================
  2730.        164:
  2731.        165:    function PICK_SEGMENT
  2732.        166:    return GKS_SPECIFICATION.SEGMENT_IDENTIFIER ;
  2733.        167:    -- ======================================================
  2734.        168:    --  Ask the operator to pick a graphical object and return
  2735.        169:    --  its SEGMENT_ID.
  2736.        170:    -- ======================================================
  2737.        171:
  2738.        172:    procedure REFRESH_SCREEN ;
  2739.        173:    -- ==========================================================
  2740.        174:    --  This procedure rewrites the entire screen with
  2741.        175:    --  the contents of the current  window on the graphics
  2742.        176:    --  page.  This will be done using the display list
  2743.        177:    --  capability.  If the window has not yet been defined it
  2744.        178:    --  will default to a window on (0,0) with scaling of 1.
  2745.        179:    -- ===========================================================
  2746.        180:
  2747.        181:    procedure SEGMENT_VISIBILITY
  2748.        182:              ( SEGMENT : in GKS_SPECIFICATION.SEGMENT_IDENTIFIER ;
  2749.        183:                MODE    : in GKS_SPECIFICATION.SEGMENT_VISIBILITY ) ;
  2750.        184:    -- ======================================================
  2751.        185:    --  Change the segment visibility.
  2752.        186:    -- ======================================================
  2753.        187:
  2754.        188:    procedure SELECT_WINDOW
  2755.        189:              ( WINDOW : in GRAPHICS.WINDOW_TYPE ) ;
  2756.        190:    -- =============================================================
  2757.        191:    --  Set the currently active window.
  2758.        192:    -- =============================================================
  2759.        193:
  2760.        194:    procedure TERMINATE_GRAPHICS_MODE ;
  2761.        195:    -- ========================================================
  2762.        196:    --  Restore the device to VT100 mode.
  2763.        197:    -- ========================================================
  2764.        198:
  2765.        199:    procedure UPDATE_COLOR_ATTRIBUTE
  2766.        200:              ( DRAWING_ENTITY : in  GRAPHICS.GRAPHIC_ENTITY ;
  2767.        201:                NEW_COLOR      : in  GRAPHICS.COLOR_TYPE ) ;
  2768.        202:    -- ======================================================
  2769.        203:    --  Update the value of the currently defined color
  2770.        204:    --  attribute for the specified graphic entity.
  2771.        205:    -- ======================================================
  2772.        206:
  2773.        207:    procedure UPDATE_LINE_ATTRIBUTE
  2774.        208:              ( DRAWING_ENTITY : in  GRAPHICS.GRAPHIC_ENTITY ;
  2775.        209:                NEW_LINE       : in  GRAPHICS.LINE_TYPE ) ;
  2776.        210:    -- ======================================================
  2777.        211:    --  Update the value of the currently defined line
  2778.        212:    --  attribute for the specified graphic entity.
  2779.        213:    -- ======================================================
  2780.        214:
  2781.        215:    procedure UPDATE_SHAPE_ATTRIBUTE
  2782.        216:              ( DRAWING_ENTITY : in  GRAPHICS.FIGURE_ENTITY ;
  2783.        217:                NEW_SHAPE      : in  GRAPHICS.SHAPE_TYPE ) ;
  2784.        218:    -- ======================================================
  2785.        219:    --  Update the value of the currently defined shape
  2786.        220:    --  attribute for the specified graphic entity.
  2787.        221:    -- ======================================================
  2788.        222:
  2789.        223:    procedure ZOOM
  2790.        224:              ( DIRECTION : in GRAPHICS.ZOOM_DIRECTION ) ;
  2791.        225:    -- ======================================================
  2792.        226:    --  Zoom in or out from the current display.
  2793.        227:    -- ======================================================
  2794.        228:
  2795.        229:    ---------------------------------------------------------
  2796.        230:    -- The following exceptions can be raised in this package:
  2797.        231:    --
  2798.        232:    --  INVALID_SEGMENT_ID
  2799.        233:    --     Raised if an illegal SEGMENT_ID is specified.
  2800.        234:    -- INVALID_GRAPHICS_OPERATION
  2801.        235:    --     Raised if an invalid, illegal, or unimplementable graphics
  2802.        236:    --     operation is requested.
  2803.        237:    -- INVALID_LOCATION
  2804.        238:    --     Raised if an invalid location is specified for the graphing
  2805.        239:    --     of an object.  For example if a label is not placed on its
  2806.        240:    --     associated object this exception will be raised.
  2807.        241:    -----------------------------------------------------------------
  2808.        242:    INVALID_SEGMENT_ID         : exception ;
  2809.        243:    INVALID_GRAPHICS_OPERATION : exception ;
  2810.        244:    INVALID_LOCATION           : exception ;
  2811.        245:
  2812.        246: end GRAPHIC_DRIVER ;
  2813.        247:
  2814.        248: --pragma PAGE ;
  2815.        249: with GKS_SPECIFICATION          ; use GKS_SPECIFICATION ;
  2816.        250: with GKS_PRIME                  ; use GKS_PRIME ;
  2817.        251: with VIRTUAL_TERMINAL_INTERFACE ; use VIRTUAL_TERMINAL_INTERFACE ;
  2818.        252: with TRACE_PKG                  ; use TRACE_PKG ;
  2819.        253: with TEXT_IO                    ; use TEXT_IO ;
  2820.        254:
  2821.        255: package body GRAPHIC_DRIVER is
  2822.  
  2823.       1500: end GRAPHIC_DRIVER ;
  2824. Compilation complete
  2825.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 1500
  2826. 4.6        GKS_PRIME
  2827.  
  2828. The GKS_Specification package declares the types and operations declared below,  reflect the facilities required by the
  2829. Graphic Ada Designer.  Unused operations may be commented out to reduce compilation overhead.  The operations for each
  2830. level are segmented into separately compilable packages for compilation efficiency reasons.  The GKS_PRIME package
  2831. implements a subset of the GKS developed by SYSCON Corporation for use with the Graphic Ada Designer.  The specification
  2832. is based on: 1) The Ada Phase I GKS developed by Harris Corp, and 2) draft GKS Binding to ANSI Ada.  This implementation
  2833. will initially be a partial subset, with only those operations required by the Graphic Ada Designer implemented.
  2834. Although the semantics of the functions implemented are intended to be faithful to those decribed in the GKS Binding,
  2835. the goal of efficiency and compactness may result in the implementation code ignoring certain arguments (e.g., opening a
  2836. workstation may be unnecessary and implemented as a null operation).  The code will directly manipulate primitives of
  2837. the target graphics device, without the intermediate operations associated with GKS.  The implementation and utilization
  2838. of this package will be faithful enough to the real GKS to permit the Graphic Ada Designer to be easily converted to
  2839. using a real version of GKS.  The Terminal_Access package implements a version of the GKS developed by SYSCON
  2840. Corporation for use to the target terminal type. Calls to this package will originate only from package GKS. The only
  2841. calls originating from this package will be to the target terminal drivers. This package is the standard interface for
  2842. all target terminal accesses.
  2843.  
  2844.                                  Table 4-7 GKS_PRIME Virtual Package Dependencies List
  2845.  
  2846.                           COMPILATION UNITS      TYPE      COMMENTS               DEPENDENCIES
  2847.                           GKS_Specification      Package   GKS Type Declarations  System
  2848.                           GKS_Prime              Package                          Text_IO
  2849.                           Terminal_Access        Package   Terminal Specific      Design_Pkg
  2850.                                                               Routines            Envision_Pkg
  2851.  
  2852.     GKS_PRIME
  2853.      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2854.                        GKS_SPECIFICATION
  2855.     |                  ---------------------                                                                       |
  2856. ----------------       |                   |                                                   -----------------------
  2857. ( GKS_TYPES    )<---( DECLARATIONS )       |                                                   <  SYSTEM             >
  2858. ----------------       |                   |                                              (A)--<  TEXT_IO            >
  2859.     |                  ---------------------                                                   <  DESIGN_PKG         >
  2860.     |        GKS_PRIME                                                                    (B)--<  ENVISION_PACKAGES  >
  2861.              --------------------------------------             TERMINAL_ACCESS                -----------------------
  2862.     |        |                                    |             -----------------------------------------
  2863.              |                   LEVEL_0A         |             |                 ===================== |          |
  2864.     |        |                   ---------------  |         ---------------- +--->| SET_CURRENT_WINDOW| |
  2865.              |                   |             |  |         ( DECLARATIONS ) |    |===================| |          |
  2866.     |        |                -------          |  |         ---------------- |    |                   |---->+->(A,B)
  2867.              |          +---->|     |          |  |             |            |    --------------------- |   |      |
  2868.     |        |          |     -------          |------->+   ---------        |             o            |   |
  2869.              |          |        ---------------  |     +-->|       |--------+    ===================== |   |      |
  2870.     |        |          |        LEVEL_0B         |     +-->|       |------------>| INIT_TERMINAL     | |   |
  2871.              |          |        ---------------  |     |   ---------             |===================| |   |      |
  2872.     |        |          |        |             |  |     |       |                 |                   |---->+->(A,B)
  2873.              |          |     -------          |  |     |       |                 --------------------- |   |      |
  2874.  ------    -----        |  +->|     |          |  |     |       ----------------------------------------|   |
  2875.  |    |--->|   |--------+  |  -------          |------->+   +-----------------------------------------------+      |
  2876.  |    |--->|   |-----------+     ---------------  |     |   |   MINI_MATH_PAC
  2877.  |    |--->|   |--------+        LEVEL_1A         |     |   |   ---------------------------------------------      |
  2878.  |    |--->|   |-------+|        ---------------  |     |   |   |                     ===================== |
  2879.  ------    -----       ||        |             |  |     |   | ----------------   +--->|=SINE[]            | |      |
  2880.     |        |         ||     -------          |  |     |   | ( DECLARATIONS )   |    |===================| |      |
  2881.              |         |+---->|     |          |  |     |   | ----------------   |    |                   | |
  2882.     |        |         |      -------          |------->+   |   |                |    --------------------- |      |
  2883.              |         |         ---------------  |     |   | -------            |             o            |
  2884.     |        |         |         LEVEL_1B         |     +---+>|     |------------+    ===================== |      |
  2885.              |         |         ---------------  |     +---+>|     |---------------->|=SQRT[]            | |
  2886.     |        |         |         |             |  |     |     -------                 |===================| |      |
  2887.              |         |      -------          |  |     |       |                     |                   | |
  2888.     |        |         +----->|     |          |  |     |       |                     --------------------- |      |
  2889.              |                -------          |------->+       ---------------------------------------------
  2890.     |        |                   ---------------  |                                                                |
  2891.              --------------------------------------
  2892.      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  2893.                                               GKS_PRIME Virtual Package Design Diagram
  2894.          1: pragma source_info(on);
  2895.          2:
  2896.          3: with DESIGN_PKG ; use DESIGN_PKG ;
  2897.          4:
  2898.          5: -- controlled by BOB MAREK
  2899.          6: -- VERSION 85-07-16-12:45 by RAM
  2900.          7:
  2901.          8: package GKS_SPECIFICATION is
  2902.          9: -- ==============================================================
  2903.         10: --  This package implements the type declarations for the
  2904.         11: --  version of the Graphical Kernel System (GKS) developed
  2905.         12: --  by SYSCON Corporation for use with the Graphic Ada Designer.
  2906.         13: --  The specification is based on:
  2907.         14: --
  2908.         15: --      1) The Ada Phase I GKS developed by Harris Corp.
  2909.         16: --      2) Draft GKS Binding to ANSI Ada
  2910.         17: --
  2911.         18: --  The types and operations declared below, reflect the
  2912.         19: --  facilities required by the Graphic Ada Designer.  Unused
  2913.         20: --  operations may be commented out to reduce compilation
  2914.         21: --  overhead.
  2915.         22: -- ==============================================================
  2916.         23:
  2917.         24:    type WORKSTATION_ID is
  2918.         25:         ( ENVISION_230 ,
  2919.         26:           TEKTRONIX_4107 ,
  2920.         27:           NONE ) ;
  2921.         28:
  2922.         29:    type WORKSTATION_ID_LIST is array ( 1 .. 1 ) of WORKSTATION_ID ;
  2923.         30:
  2924.         31:    type CONNECTION_ID is ( UNIT_I ) ;
  2925.         32:
  2926.         33:    type WORKSTATION_TYPE is ( COLOUR_OUTPUT ) ;
  2927.         34:
  2928.         35:    type WORKSTATION_TYPE_LIST is array ( 1 .. 1 ) of WORKSTATION_TYPE ;
  2929.         36:
  2930.         37:    subtype MEMORY_UNITS is POSITIVE ;
  2931.         38:
  2932.         39:    ------------------------------------------
  2933.         40:    -- Define segment as VISIBLE or INVISIBLE
  2934.         41:    ------------------------------------------
  2935.         42:    type SEGMENT_VISIBILITY is
  2936.         43:         ( VISIBLE ,
  2937.         44:           INVISIBLE ) ;
  2938.         45:
  2939.         46:    ---------------------------------------------------------------
  2940.         47:    -- Define segment as DETECTABLE or UNDETECTABLE for pick input.
  2941.         48:    ---------------------------------------------------------------
  2942.         49:    type SEGMENT_DETECTABILITY is
  2943.         50:         ( UNDETECTABLE ,
  2944.         51:           DETECTABLE ) ;
  2945.         52:
  2946.         53:    -------------------------------------------
  2947.         54:    -- Define segment as HIGHLIGHTED or NORMAL.
  2948.         55:    -------------------------------------------
  2949.         56:    type SEGMENT_HIGHLIGHTING is
  2950.         57:         ( NORMAL ,
  2951.         58:           HIGHLIGHTED ) ;
  2952.         59:
  2953.         60:    ------------------------------------------------------------------
  2954.         61:    -- Record containing initialization data for locator input device.
  2955.         62:    ------------------------------------------------------------------
  2956.         63:    type LOCATOR_DATA_RECORD is
  2957.         64:          record
  2958.         65:             TBD : DESIGN_PKG.T_B_D ;
  2959.         66:          end record ;
  2960.         67:
  2961.         68:    --{ type SEGMENT_PRIORITY is digits 5 range 0.0 .. 1.0 ;
  2962.         69:    --{ NUMBER_OF_DEVICES : constant := 1 ;
  2963.         70:    --{ type DEVICE_NUMBER is range 1 .. NUMBER_OF_DEVICES ;
  2964.         71:
  2965.         72:    subtype SEGMENT_PRIORITY is FLOAT ;
  2966.         73:            NUMBER_OF_DEVICES : constant POSITIVE := 1 ;
  2967.         74:    subtype DEVICE_NUMBER    is POSITIVE range 1 .. NUMBER_OF_DEVICES ;
  2968.         75:
  2969.         76:    -----------------------------------------
  2970.         77:    -- Definition of pick identifier values.
  2971.         78:    -----------------------------------------
  2972.         79:    subtype PICK_VALUE_TYPE is INTEGER ;
  2973.         80:
  2974.         81:    ---------------------------------------------------------------
  2975.         82:    -- Contains initialization values which are passed to the pick
  2976.         83:    -- logical input device when the device is initialized.
  2977.         84:    ---------------------------------------------------------------
  2978.         85:    type PICK_DATA_RECORD is
  2979.         86:          record
  2980.         87:             TBD : DESIGN_PKG.T_B_D ;
  2981.         88:          end record ;
  2982.         89:
  2983.         90:    ---------------------------------------------------------
  2984.         91:    -- The following structure declarations define the
  2985.         92:    -- GKS World Coordinate System space:
  2986.         93:    --
  2987.         94:    -- WC       : Definition for World Coordinate (WC) system variables.
  2988.         95:    -- LIMITS   : World coordinate system boundary values.
  2989.         96:    -- POINT    : Definition of point in world coordinate system.
  2990.         97:    -- VECTOR   : Definition of vector in world coordinate system.
  2991.         98:    -- SIZE     : Character size in world coordinate system.
  2992.         99:    -- RECTANGLE: Rectangle in world coordinate system.
  2993.        100:    ---------------------------------------------------------
  2994.        101:    --{ subtype WC is FLOAT ;
  2995.        102:    MAX_WC : constant NATURAL := 32_767 ;
  2996.        103:    MIN_WC : constant NATURAL :=      0 ;
  2997.        104:    subtype WC is NATURAL range MIN_WC..MAX_WC ;
  2998.        105:
  2999.        106:    type    LIMITS is
  3000.        107:       record
  3001.        108:          MIN : WC ;
  3002.        109:          MAX : WC ;
  3003.        110:       end record ;
  3004.        111:    type POINT is
  3005.        112:       record
  3006.        113:          X : WC ;
  3007.        114:          Y : WC ;
  3008.        115:       end record ;
  3009.        116:    type POINT_LIST is array ( integer range <> ) of POINT ;
  3010.        117:
  3011.        118:    type VECTOR     is
  3012.        119:       record
  3013.        120:          X : WC ;
  3014.        121:          Y : WC ;
  3015.        122:       end record ;
  3016.        123:
  3017.        124:    type SIZE is
  3018.        125:       record
  3019.        126:          X : WC ;
  3020.        127:          Y : WC ;
  3021.        128:       end record ;
  3022.        129:
  3023.        130:    type RECTANGLE is
  3024.        131:       record
  3025.        132:          X : LIMITS ;
  3026.        133:          Y : LIMITS ;
  3027.        134:       end record ;
  3028.        135:
  3029.        136:    -----------------------------------------------------------
  3030.        137:    -- The following structure declarations define the
  3031.        138:    -- Device Coordinate System Space.
  3032.        139:    --
  3033.        140:    -- DC           : Definition for Device Coordinate (DC) system variables.
  3034.        141:    -- LIMITS_DC    : Device coordinate system boundary values.
  3035.        142:    -- POINT_DC     : Definition of point in device coordinate system.
  3036.        143:    -- RECTANGLE_DC : Rectangle in device coordinate system.
  3037.        144:    -- SIZE_DC      : Workstation maximum display size.
  3038.        145:    ------------------------------------------------------------
  3039.        146:    --{ subtype DC          is FLOAT ;
  3040.        147:    subtype DC is WC ;
  3041.        148:
  3042.        149:    type    DC_UNITS    is
  3043.        150:            ( METRES ,
  3044.        151:              OTHER ) ;
  3045.        152:
  3046.        153:    subtype LIMITS_DC is LIMITS ;
  3047.        154: --   type LIMITS_DC is
  3048.        155: --      record
  3049.        156: --         MIN : DC ;
  3050.        157: --         MAX : DC ;
  3051.        158: --      end record ;
  3052.        159:
  3053.        160:    subtype POINT_DC is POINT ;
  3054.        161: --   type POINT_DC is
  3055.        162: --      record
  3056.        163: --         X : DC ;
  3057.        164: --         Y : DC ;
  3058.        165: --      end record ;
  3059.        166:
  3060.        167:    subtype POINT_DC_LIST is POINT_LIST ;
  3061.        168: --   type POINT_DC_LIST is array ( integer range <> ) of POINT_DC ;
  3062.        169:
  3063.        170:    subtype RECTANGLE_DC is RECTANGLE ;
  3064.        171: --   type RECTANGLE_DC is
  3065.        172: --      record
  3066.        173: --         X : LIMITS_DC ;
  3067.        174: --         Y : LIMITS_DC ;
  3068.        175: --      end record ;
  3069.        176:
  3070.        177:    subtype SIZE_DC is SIZE ;
  3071.        178: --   type SIZE_DC is
  3072.        179: --      record
  3073.        180: --         X : DC ;
  3074.        181: --         Y : DC ;
  3075.        182: --      end record ;
  3076.        183:
  3077.        184:    -- scale_factor range 0.0 .. 1.0
  3078.        185:    subtype SCALE_FACTOR is FLOAT ;
  3079.        186:
  3080.        187:    -----------------------------------------------------------------
  3081.        188:    -- Define scale factors and translation factors used to
  3082.        189:    -- perform transformations.
  3083.        190:    -----------------------------------------------------------------
  3084.        191:    type SCALING_FACTOR is
  3085.        192:       record
  3086.        193:          X : SCALE_FACTOR ;
  3087.        194:          Y : SCALE_FACTOR ;
  3088.        195:       end record ;
  3089.        196:
  3090.        197:    type TRANSLATE_FACTOR is
  3091.        198:       record
  3092.        199:          A : SCALE_FACTOR;
  3093.        200:          B : SCALE_FACTOR;
  3094.        201:       end record;
  3095.        202:
  3096.        203:    --------------------------------------
  3097.        204:    -- Definition of text character paths.
  3098.        205:    --------------------------------------
  3099.        206:    type TEXT_PATH is
  3100.        207:         ( RIGHT ,
  3101.        208:           LEFT ,
  3102.        209:           UP ,
  3103.        210:           DOWN ) ;
  3104.        211:
  3105.        212:    type TEXT_PRECISION is
  3106.        213:         ( STRING_PRECISION ,
  3107.        214:           STROKE_PRECISION ,
  3108.        215:           CHAR_PRECISION ) ;
  3109.        216:
  3110.        217:    type FONT_TYPE is
  3111.        218:         ( STD ,
  3112.        219:           MILITARY ) ;
  3113.        220:
  3114.        221:    type TEXT_FONT_PRECISION is
  3115.        222:       record
  3116.        223:          FONT      : FONT_TYPE ;
  3117.        224:          PRECISION : TEXT_PRECISION ;
  3118.        225:       end record ;
  3119.        226:
  3120.        227:    subtype PICK_IDENTIFIER       is NATURAL ;
  3121.        228:    subtype SEGMENT_IDENTIFIER    is NATURAL range 0..6000 ; -- 0=null_segment
  3122.        229:    type TEXT_FONT_PRECISION_LIST is array ( 1 .. 2 ) of TEXT_FONT_PRECISION ;
  3123.        230:    subtype CHAR_EXPANSION        is NATURAL ;
  3124.        231:    subtype CHAR_SPACING          is NATURAL ;
  3125.        232:    subtype CHAR_HEIGHT           is NATURAL ;
  3126.        233:
  3127.        234:    -- intensity range 0.0 .. 1.0
  3128.        235:    subtype INTENSITY is NATURAL ;
  3129.        236:
  3130.        237:    type COLOUR_REP is
  3131.        238:       record
  3132.        239:          RED   : INTENSITY ;
  3133.        240:          GREEN : INTENSITY ;
  3134.        241:          BLUE  : INTENSITY ;
  3135.        242:       end record ;
  3136.        243:
  3137.        244:    -- colour_index range 0..15
  3138.        245:    subtype COLOUR_INDEX is NATURAL ;
  3139.        246:
  3140.        247:    -- marker_type range 1..5
  3141.        248:    subtype MARKER_TYPE is POSITIVE ;
  3142.        249:
  3143.        250:    -- line_type range 1..4
  3144.        251:    subtype LINE_TYPE is POSITIVE ;
  3145.        252:
  3146.        253:    type INTERIOR_STYLE_TYPE is
  3147.        254:         ( HOLLOW ,
  3148.        255:           SOLID );
  3149.        256:
  3150.        257:    ---------------------------------------------------------------------
  3151.        258:    -- Determine type of generalized drawing primitive (GDP) requested.
  3152.        259:    --  All GDP functions based on a two point definition point list
  3153.        260:    --  to completely describe the location of the entity, the two points
  3154.        261:    --  define a box that is used for a rectangle or show the outer limits
  3155.        262:    --  of the circles location using the first (upper left) point as the
  3156.        263:    --  standard reference.
  3157.        264:    ---------------------------------------------------------------------
  3158.        265:    type GDP_ID is
  3159.        266:         ( GDP_CIRCLE ,
  3160.        267:           GDP_RECTANGLE ) ;
  3161.        268:
  3162.        269:    type GDP_ID_LIST is array ( 1 .. 1 ) of GDP_ID ;
  3163.        270:
  3164.        271:    type ESCAPE_IDENTIFIER is
  3165.        272:         ( ALPHA_BACKGROUND ,
  3166.        273:           ALPHA_WRITING ,
  3167.        274:           GRAPHIC_BACKGROUND ,
  3168.        275:           GRAPHICS_VISIBILITY ,
  3169.        276:           MAP_WINDOW_TO_VIEWPORT ,
  3170.        277:           SEGMENT_MOVEMENT ,
  3171.        278:           SELECT_WINDOW ) ;
  3172.        279:
  3173.        280:    type ESCAPE_RECORD ( IDENTIFIER : ESCAPE_IDENTIFIER ) is
  3174.        281:       record
  3175.        282:          case IDENTIFIER is
  3176.        283:             when ALPHA_BACKGROUND | ALPHA_WRITING | GRAPHIC_BACKGROUND =>
  3177.        284:                COLOUR           : COLOUR_INDEX ;
  3178.        285:             when GRAPHICS_VISIBILITY =>
  3179.        286:                GRAPHICS_ON      : Boolean ;
  3180.        287:             when SEGMENT_MOVEMENT =>
  3181.        288:                SEGMENT          : SEGMENT_IDENTIFIER ;
  3182.        289:                POSITION         : POINT ;
  3183.        290:             when SELECT_WINDOW =>
  3184.        291:                WINDOW           : Natural ;
  3185.        292:             when MAP_WINDOW_TO_VIEWPORT =>
  3186.        293:                VIEW_WINDOW_ID   : Natural ;
  3187.        294:                WINDOW_RECTANGLE ,
  3188.        295:                VIEW_RECTANGLE   : RECTANGLE ;
  3189.        296:             when others =>
  3190.        297:                null ;
  3191.        298:          end case ; -- IDENTIFIER
  3192.        299:       end record ; -- ESCAPE_RECORD
  3193.        300:
  3194.        301:
  3195.        302:    --{ This portion defines the GKS state list, the workstation state
  3196.        303:    --{ list, and the workstation description table.  The table
  3197.        304:    --{ definitions contain only a subset of the table fields defined
  3198.        305:    --{ by GKS.  The defined table entries support the version of
  3199.        306:    --{ GKS developed by SYSCON Corporation.
  3200.        307:
  3201.        308:    ------------------
  3202.        309:    -- GKS STATE LIST
  3203.        310:    ------------------
  3204.        311:    type GKS_STATE_LIST is
  3205.        312:       record
  3206.        313:          -- Current line attributes
  3207.        314:          CURRENT_LINETYPE                   : LINE_TYPE    := 1;
  3208.        315:          CURRENT_LINEWIDTH_SCALE_FACTOR     : SCALE_FACTOR := 1.0;
  3209.        316:          CURRENT_POLYLINE_COLOUR_INDEX      : COLOUR_INDEX := 0;
  3210.        317:          -- Current marker attributes
  3211.        318:          CURRENT_MARKER_TYPE                : MARKER_TYPE  := 1;
  3212.        319:          CURRENT_MARKER_SIZE_SCALE_FACTOR   : SCALE_FACTOR := 1.0;
  3213.        320:          CURRENT_POLYMARKER_COLOUR_INDEX    : COLOUR_INDEX := 0;
  3214.        321:          -- Current text attributes
  3215.        322:          CURRENT_TEXT_FONT_AND_PRECISION    : TEXT_FONT_PRECISION :=
  3216.        323:                                               (STD,STRING_PRECISION);
  3217.        324:          CURRENT_CHARACTER_EXPANSION_FACTOR : CHAR_EXPANSION := 0;
  3218.        325:          CURRENT_CHARACTER_SPACING          : CHAR_SPACING   := 1;
  3219.        326:          CURRENT_TEXT_COLOUR_INDEX          : COLOUR_INDEX   := 0;
  3220.        327:          CURRENT_CHARACTER_HEIGHT           : CHAR_HEIGHT    := 1;
  3221.        328:          CURRENT_CHARACTER_UP_VECTOR        : VECTOR         := (0,1);
  3222.        329:          CURRENT_TEXT_PATH                  : TEXT_PATH      := RIGHT;
  3223.        330:          -- Current fill area attributes
  3224.        331:          CURRENT_FILL_AREA_INTERIOR_STYLE   : INTERIOR_STYLE_TYPE :=
  3225.        332:                                               ( HOLLOW ) ;
  3226.        333:          CURRENT_FILL_AREA_COLOUR_INDEX     : COLOUR_INDEX := 0;
  3227.        334:          CURRENT_PATTERN_SIZE               : SIZE ;
  3228.        335:          CURRENT_PATTERN_REFERENCE_POINT    : POINT ;
  3229.        336:          CURRENT_FILL_AREA_LINETYPE         : LINE_TYPE    := 1;
  3230.        337:          -- Current normalization transformation window.
  3231.        338:          CURRENT_WINDOW   : RECTANGLE       := ((WC'FIRST,WC'LAST),
  3232.        339:                                                 (WC'FIRST,WC'LAST));
  3233.        340:       end record;
  3234.        341:
  3235.        342:    --------------------------
  3236.        343:    -- WORKSTATION STATE LIST
  3237.        344:    -------------------------
  3238.        345:    type WK_STATE_LIST is
  3239.        346:       record
  3240.        347:          -- Current workstation viewport
  3241.        348:          CURRENT_WS_VIEWPORT : RECTANGLE_DC ;
  3242.        349:       end record;
  3243.        350:
  3244.        351:    ---------------------------------
  3245.        352:    -- WORKSTATION DESCRIPTION TABLE
  3246.        353:    ---------------------------------
  3247.        354:    type WK_DESC_TABLE is
  3248.        355:       record
  3249.        356:          WKST_TYPE         : WORKSTATION_TYPE := COLOUR_OUTPUT;
  3250.        357:          DEV_COORD_UNITS   : DC_UNITS := OTHER;
  3251.        358:       end record;
  3252.        359:
  3253.        360:    -- GKS exceptions
  3254.        361:       -- STATE_ERRORs
  3255.        362:    GKS_ERROR_1 ,  -- GKS not in proper state: GKS should be in state GKCL
  3256.        363:    GKS_ERROR_2 ,  -- GKS not in proper state: GKS should be in state GKOP
  3257.        364:    GKS_ERROR_3 ,  -- GKS not in proper state: GKS should be in state WSAC
  3258.        365:    GKS_ERROR_4 ,  -- GKS not in proper state: GKS should be in state SGOP
  3259.        366:    GKS_ERROR_5 ,  -- GKS not in proper state: GKS should be
  3260.        367:                   -- either in the state WSAC or in the state SGOP
  3261.        368:    GKS_ERROR_6 ,  -- GKS not in proper state: GKS should be
  3262.        369:                   -- either in the state WSOP or in the state WSAC
  3263.        370:    GKS_ERROR_7 ,  -- GKS not in proper state: GKS should be
  3264.        371:                   -- in one of the states WSOP, WSAC, or SGOP
  3265.        372:    GKS_ERROR_8 ,  -- GKS not in proper state: GKS should be
  3266.        373:                   -- in one of the states GKOP, WSOP, WSAC, or SGOP
  3267.        374:       -- WS_ERRORs
  3268.        375:    GKS_ERROR_20 , -- Specified workstation identifier is invalid
  3269.        376:    GKS_ERROR_21 , -- Specified connection identifier is invalid
  3270.        377:    GKS_ERROR_22 , -- Specified workstation type is invalid
  3271.        378:    GKS_ERROR_23 , -- Specified workstation type does not exist
  3272.        379:    GKS_ERROR_24 , -- Specified workstation is open
  3273.        380:    GKS_ERROR_25 , -- Specified workstation is not open
  3274.        381:    GKS_ERROR_26 , -- Workstation Independent Segment Storage is not open
  3275.        382:    GKS_ERROR_29 , -- Specified workstation is active
  3276.        383:    GKS_ERROR_30 , -- Specified workstation is not active
  3277.        384:    GKS_ERROR_31 , -- Specified workstation is of category MO
  3278.        385:    GKS_ERROR_32 , -- Specified workstation is not of category MO
  3279.        386:    GKS_ERROR_33 , -- Specified workstation is of category MI
  3280.        387:    GKS_ERROR_37 , -- Specified workstation is not of category OUTIN
  3281.        388:    GKS_ERROR_39 , -- Specified workstation is not category INPUT or OUTIN
  3282.        389:       -- TRANSFORMATION_ERRORs
  3283.        390:    GKS_ERROR_50 , -- Transformation number is invalid
  3284.        391:    GKS_ERROR_51 , -- Rectangle definition is invalid
  3285.        392:       -- OUTPUT_ATTRIBUTE_ERRORs
  3286.        393:    GKS_ERROR_60 , -- Polyline index is invalid
  3287.        394:       -- INPUT_ERRORs
  3288.        395:    GKS_ERROR_147 , -- Input queue has overflowed
  3289.        396:    GKS_ERROR_150 , -- No input value of the correct class is in event report
  3290.        397:       -- OTHER_ERRORs implementation defined
  3291.        398:    GKS_ERROR_900 , -- Locator read failure
  3292.        399:       -- UNKNOWN_OTHER_ERROR
  3293.        400:    GKS_ERROR_999  -- unknown GKS detected error
  3294.        401:                 : EXCEPTION ;
  3295.        402:
  3296.        403: end GKS_SPECIFICATION ;
  3297. Compilation complete
  3298.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 403
  3299.          1: pragma SOURCE_INFO(ON);
  3300.          2:
  3301.          3: -- controlled by BOB MAREK
  3302.          4: -- version 85-07-15:10:35 by RAM
  3303.          5:
  3304.          6: package MINI_MATH_PAC is
  3305.          7: -- =====================================================
  3306.          8: --
  3307.          9: --
  3308.         10: -- =====================================================
  3309.         11:    ------------------------------------
  3310.         12:    -- Math Constant Declarations
  3311.         13:    ------------------------------------
  3312.         14:    PI : constant FLOAT := 3.141_592_654 ;
  3313.         15:    E  : constant FLOAT := 2.718_281_828_459_045 ;
  3314.         16:
  3315.         17:    function FACTORIAL
  3316.         18:             ( UNIT : in INTEGER )
  3317.         19:    return INTEGER ;
  3318.         20:    -- ====================================================
  3319.         21:    -- produces the factorial result of the input UNIT such
  3320.         22:    -- that UNIT=X then  X!=X*(X-1)*...*1
  3321.         23:    -- =====================================================
  3322.         24:
  3323.         25:    function EXP
  3324.         26:             ( X : FLOAT )
  3325.         27:    return FLOAT ;
  3326.         28:    -- ==================================================
  3327.         29:    -- produces the exponant x of constant e
  3328.         30:    --   such that EXP(x) = e ** X, where e @= 2.718....
  3329.         31:    -- ==================================================
  3330.         32:
  3331.         33:    function LN
  3332.         34:            ( X : FLOAT )
  3333.         35:    return FLOAT ;
  3334.         36:    -- ====================================================
  3335.         37:    -- produces the natural logrithm of the input X from a constant e
  3336.         38:    --   such that ln(X)=1/e**X , where e @= 2.718....
  3337.         39:    -- ====================================================
  3338.         40:
  3339.         41:    function SQRT
  3340.         42:             ( X : FLOAT )
  3341.         43:    return FLOAT ;
  3342.         44:    -- ====================================================
  3343.         45:    -- produces the square root of the input X such that
  3344.         46:    --   X_root**2 = X within the accuracy specified
  3345.         47:    -- ====================================================
  3346.         48:
  3347.         49:    function RANDOM
  3348.         50:    return FLOAT ;
  3349.         51:    -- ====================================================
  3350.         52:    -- produces a random number between 0.0 and 1.0 .
  3351.         53:    -- ====================================================
  3352.         54:
  3353.         55:    function MAGNATUDE
  3354.         56:             ( FIRST_X ,
  3355.         57:               FIRST_Y ,
  3356.         58:               SECOND_X ,
  3357.         59:               SECOND_Y : in FLOAT )
  3358.         60:    return FLOAT;
  3359.         61:    -- ====================================================
  3360.         62:    -- produces the magnatude from first point to the second point.
  3361.         63:    -- ====================================================
  3362.         64:
  3363.         65:    function SIN
  3364.         66:             ( X : FLOAT )
  3365.         67:    return FLOAT;
  3366.         68:    -- ====================================================
  3367.         69:    -- input values are in radians.
  3368.         70:    -- ====================================================
  3369.         71:
  3370.         72:    function COS
  3371.         73:             ( X : FLOAT )
  3372.         74:    return FLOAT;
  3373.         75:    -- ====================================================
  3374.         76:    -- input values are in radians.
  3375.         77:    -- ====================================================
  3376.         78:
  3377.         79:    -- ====================================================
  3378.         80:    -- indicators for unhandled exceptions in functions
  3379.         81:    -- ====================================================
  3380.         82:    MINI_MATH_PAC_FACTORIAL_ERROR ,
  3381.         83:    MINI_MATH_PAC_EXP_ERROR ,
  3382.         84:    MINI_MATH_PAC_LN_ERROR ,
  3383.         85:    MINI_MATH_PAC_SQRT_ERROR ,
  3384.         86:    MINI_MATH_PAC_MAGNATUDE_ERROR ,
  3385.         87:    MINI_MATH_PAC_SIN_ERROR ,
  3386.         88:    MINI_MATH_PAC_COS_ERROR ,
  3387.         89:    MINI_MATH_PAC_RANDOM_ERROR : EXCEPTION ;
  3388.         90:
  3389.         91: end MINI_MATH_PAC ;
  3390.         92:
  3391.         93:  with CALENDAR; use CALENDAR;
  3392.         94:
  3393.         95: package body MINI_MATH_PAC is
  3394.  
  3395.        341: end MINI_MATH_PAC;
  3396. Compilation complete
  3397.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 341
  3398.          1: pragma source_info(on) ;
  3399.          2:
  3400.          3: with GKS_SPECIFICATION ; use GKS_SPECIFICATION ;
  3401.          4:
  3402.          5: -- controlled by BOB MAREK
  3403.          6: -- VERSION 85-07-25 08:50 by RAM
  3404.          7:
  3405.          8: package TERMINAL_ACCESS is
  3406.          9: -- ==================================================================
  3407.         10: --  This package implements a version of the Graphical
  3408.         11: --  Kernel System (GKS) developed by SYSCON Corporation
  3409.         12: --  for use to the target terminal type.
  3410.         13: --  Calls to this package will originate only from package GKS.
  3411.         14: --  The only calls originating from this package will be to
  3412.         15: --  the target terminal drivers. This package is the standard interface
  3413.         16: --  for all target terminal accesses.
  3414.         17: -- ===================================================================
  3415.         18:
  3416.         19:    package GKS_SPEC renames GKS_SPECIFICATION ;
  3417.         20:
  3418.         21:    -------------------------------
  3419.         22:    -- operations available to GKS
  3420.         23:    -------------------------------
  3421.         24:    type OPERATIONS_TYPE is
  3422.         25:         ( USE_BOX ,
  3423.         26:           USE_CIRCLE ,
  3424.         27:           USE_MARKER ,
  3425.         28:           USE_POLYGON ,
  3426.         29:           USE_POLYLINE ,
  3427.         30:           USE_POLYMARKER ,
  3428.         31:           USE_REG_POLYGON ,
  3429.         32:           USE_TEXT ) ;
  3430.         33:
  3431.         34:    -------------------------------------------------------------------
  3432.         35:    -- dedicated operation to use for an object draw
  3433.         36:    -------------------------------------------------------------------
  3434.         37:    subtype CIRCLE_OPERATIONS_TYPE is OPERATIONS_TYPE
  3435.         38:            range USE_CIRCLE..USE_CIRCLE ;
  3436.         39:    subtype FILL_AREA_OPERATIONS_TYPE is OPERATIONS_TYPE
  3437.         40:            range USE_POLYGON..USE_POLYGON ;
  3438.         41:    subtype POLYLINE_OPERATIONS_TYPE is OPERATIONS_TYPE
  3439.         42:            range USE_POLYLINE..USE_POLYLINE ;
  3440.         43:    subtype POLYMARKER_OPERATIONS_TYPE is OPERATIONS_TYPE
  3441.         44:            range USE_MARKER..USE_MARKER ;
  3442.         45:    subtype RECTANGLE_OPERATIONS_TYPE is OPERATIONS_TYPE
  3443.         46:            range USE_BOX..USE_BOX ;
  3444.         47:    subtype TEXT_OPERATIONS_TYPE is OPERATIONS_TYPE
  3445.         48:            range USE_TEXT..USE_TEXT ;
  3446.         49:
  3447.         50:    -----------------------------------------
  3448.         51:    -- kinds of segment operation to perform
  3449.         52:    -----------------------------------------
  3450.         53:    type SEGMENT_OPERATIONS_TYPE is
  3451.         54:         ( START ,
  3452.         55:           FINISH ,
  3453.         56:           DESTROY ,
  3454.         57:           REDRAW ) ;
  3455.         58:
  3456.         59:    ----------------------------------------------------------------
  3457.         60:    -- record to congregate all parameters needed by draw procedure
  3458.         61:    --
  3459.         62:    --          type OBJECT_DATA_RECORD  field usage       --
  3460.         63:    ---------------------------------------------------------
  3461.         64:    --                      |            USE_ type         --
  3462.         65:    --                      |--------------------------------
  3463.         66:    --                      |   |   |   |   |- - POLYnnn - -|
  3464.         67:    --       record         | B | C | M | T | G | L | M | R |
  3465.         68:    --        field         | O | I | A | E | O | I | A | E |
  3466.         69:    --                      | X | R | R | X | N | N | R | G |
  3467.         70:    --                      |   | C | K | T |   | E | K | G |
  3468.         71:    --                      |   | L | E |   |   |   | E | O |
  3469.         72:    --                      |   | E | R |   |   |   | R | N |
  3470.         73:    ------------------------- - - - - - - - - - - - - - - - -
  3471.         74:    --  REFERENCE_POINT     | * | * | * | * |   |   |   | * |
  3472.         75:    ------------------------- - - - - - - - - - - - - - - - -
  3473.         76:    --  SIZE_POINT          | * | * |   |   |   |   |   | * |
  3474.         77:    ------------------------- - - - - - - - - - - - - - - - -
  3475.         78:    --  SIDES               |   |   |   |   |   |   |   | * |
  3476.         79:    ------------------------- - - - - - - - - - - - - - - - -
  3477.         80:    --  SHAPE_DATA_LIST     |   |   |   |   |   |   | * |   |
  3478.         81:    ------------------------- - - - - - - - - - - - - - - - -
  3479.         82:    --  TEXT                |   |   |   | * |   |   |   |   |
  3480.         83:    ------------------------- - - - - - - - - - - - - - - - -
  3481.         84:    -- POLY_SHAPE_DATA_LIST |   |   |   |   | * | * | * |   |
  3482.         85:    ------------------------- - - - - - - - - - - - - - - - -
  3483.         86:    type OBJECT_DATA_RECORD ( DESCRIPTION : OPERATIONS_TYPE ) is
  3484.         87:       record
  3485.         88:          case DESCRIPTION is -- 1
  3486.         89:             when   USE_BOX    | USE_CIRCLE
  3487.         90:                  | USE_MARKER | USE_REG_POLYGON | USE_TEXT =>
  3488.         91:                REFERENCE_POINT : GKS_SPEC.POINT ;
  3489.         92:                case DESCRIPTION is -- 2
  3490.         93:                   when USE_BOX | USE_CIRCLE | USE_REG_POLYGON =>
  3491.         94:                      SIZE_POINT : GKS_SPEC.POINT ;
  3492.         95:                      case DESCRIPTION is -- 3
  3493.         96:                         when USE_REG_POLYGON =>
  3494.         97:                            SIDES : Natural ;
  3495.         98:                         when others => null ;
  3496.         99:                      end case ; -- DESCRIPTION 3
  3497.        100:                   when USE_TEXT =>
  3498.        101:                      TEXT        : STRING ( 1..80 ) :=
  3499.        102:                         "                    " & -- 20 SPACES
  3500.        103:                         "                    " & -- 20 SPACES
  3501.        104:                         "                    " & -- 20 SPACES
  3502.        105:                         "                    " ; -- 20 SPACES
  3503.        106:                      TEXT_LENGTH : Natural := 80 ;
  3504.        107:                   when others => null ;
  3505.        108:                end case ; -- DESCRIPTION 2
  3506.        109:             when USE_POLYGON | USE_POLYLINE | USE_POLYMARKER =>
  3507.        110:                SHAPE_DATA_LIST   : GKS_SPEC.POINT_LIST ( 1..100 ) ;
  3508.        111:                SHAPE_LIST_LENGTH : Natural ;
  3509.        112:             when others =>
  3510.        113:                null ;
  3511.        114:          end case ;
  3512.        115:       end record ;
  3513.        116:
  3514.        117:    -------------------------
  3515.        118:    -- kinds of styles to use
  3516.        119:    -------------------------
  3517.        120:    type STYLES_TYPE is
  3518.        121:         ( FILL_PATTERN ,
  3519.        122:           LINE_PATTERN ,
  3520.        123:           MARKER_PATTERN ) ;
  3521.        124:
  3522.        125:    -------------------------------------------------------------------------
  3523.        126:    -- record type to congregate all parameters needed by set style procedure
  3524.        127:    -------------------------------------------------------------------------
  3525.        128:    type STYLE_RECORD ( DESCRIPTION : STYLES_TYPE ) is
  3526.        129:       record
  3527.        130:          case DESCRIPTION is
  3528.        131:             when LINE_PATTERN   => LINE   : GKS_SPEC.LINE_TYPE ;
  3529.        132:             when FILL_PATTERN   => FILL   : GKS_SPEC.INTERIOR_STYLE_TYPE ;
  3530.        133:             when MARKER_PATTERN => MARKER : GKS_SPEC.MARKER_TYPE ;
  3531.        134:          end case ;
  3532.        135:       end record ;
  3533.        136:
  3534.        137:    type COLOR_OBJECTS is
  3535.        138:         ( ALPHA_COLOR ,
  3536.        139:           ALPHA_BACKGROUND ,
  3537.        140:           GRAPHIC_BACKGROUND ,
  3538.        141:           FILL_COLOR ,
  3539.        142:           LINE_COLOR ,
  3540.        143:           MARKER_COLOR ,
  3541.        144:           TEXT_COLOR ) ;
  3542.        145:
  3543.        146:    ------------------------------------------------------
  3544.        147:    -- dedicated color index parameter variable selectors
  3545.        148:    ------------------------------------------------------
  3546.        149:    subtype FOR_ALPHA_BACKGROUND_TYPE is COLOR_OBJECTS
  3547.        150:            range ALPHA_BACKGROUND..ALPHA_BACKGROUND ;
  3548.        151:    subtype FOR_ALPHA_WRITING_TYPE is COLOR_OBJECTS
  3549.        152:            range ALPHA_COLOR..ALPHA_COLOR ;
  3550.        153:    subtype FOR_GRAPHIC_BACKGROUND_TYPE is COLOR_OBJECTS
  3551.        154:            range GRAPHIC_BACKGROUND..GRAPHIC_BACKGROUND ;
  3552.        155:    subtype FOR_CHARACTER_COLOR_TYPE is COLOR_OBJECTS
  3553.        156:            range TEXT_COLOR..TEXT_COLOR ;
  3554.        157:    subtype FOR_FILL_STYLE_COLOR_TYPE is COLOR_OBJECTS
  3555.        158:            range FILL_COLOR..FILL_COLOR ;
  3556.        159:    subtype FOR_LINE_STYLE_COLOR_TYPE is COLOR_OBJECTS
  3557.        160:            range LINE_COLOR..LINE_COLOR ;
  3558.        161:    subtype FOR_MARKERS_COLOR_TYPE is COLOR_OBJECTS
  3559.        162:            range MARKER_COLOR..MARKER_COLOR ;
  3560.        163:
  3561.        164:    procedure INIT_TERMINAL
  3562.        165:              ( TERM_TYPE : out GKS_SPECIFICATION.WORKSTATION_ID ) ;
  3563.        166:    -- =========================================================
  3564.        167:    -- Initialize the terminal for graphics operations.
  3565.        168:    -- =========================================================
  3566.        169:
  3567.        170:    procedure CLOSE_TERMINAL ;
  3568.        171:    -- =========================================================
  3569.        172:    -- End graphics operations at terminal and cleanup.
  3570.        173:    -- =========================================================
  3571.        174:
  3572.        175:    procedure DRAW
  3573.        176:              ( OBJECT_DEFINITION : in OBJECT_DATA_RECORD ) ;
  3574.        177:    -- =========================================================
  3575.        178:    -- draw the object described by the object definition
  3576.        179:    -- =========================================================
  3577.        180:
  3578.        181:    procedure GRAPHICS_SCREEN
  3579.        182:              ( GRAPHICS_VISIBILITY : in Boolean ) ;
  3580.        183:    -- =========================================================
  3581.        184:    -- Turn the graphics screen on and off.
  3582.        185:    -- =========================================================
  3583.        186:
  3584.        187:    procedure SET_COLOR_INDEX
  3585.        188:              ( FIGURE : in COLOR_OBJECTS;
  3586.        189:                COLOUR : in GKS_SPEC.COLOUR_INDEX ) ;
  3587.        190:    -- =========================================================
  3588.        191:    -- Set the colour index for use with the figure type.
  3589.        192:    -- Effect : The current figure colour index is set to the
  3590.        193:    --          specified value.
  3591.        194:    -- =========================================================
  3592.        195:
  3593.        196:    procedure SET_STYLE
  3594.        197:              ( STYLE_DEFINITION : STYLE_RECORD ) ;
  3595.        198:    -- =========================================================
  3596.        199:    -- Set the specified style type parameter for line, fill and marker.
  3597.        200:    -- Effect : The current style type is set to the specified value.
  3598.        201:    --      item     Linetypes:   markertypes:
  3599.        202:    --        1  -     solid          dot
  3600.        203:    --        2  -     dashed         plus sign
  3601.        204:    --        3  -     dotted         asterisk
  3602.        205:    --        4  -   * dashed-dotted  circle
  3603.        206:    --        5  -                  * diagonal cross
  3604.        207:    --    * - implementation dependent
  3605.        208:    -- =========================================================
  3606.        209:
  3607.        210:    procedure SET_TEXT_PATH
  3608.        211:              ( PATH : in GKS_SPEC.TEXT_PATH ) ;
  3609.        212:    -- =========================================================
  3610.        213:    -- Select the text path RIGHT, LEFT, UP, or DOWN
  3611.        214:    -- Effect : Set the text path of character strings to the specified
  3612.        215:    --          values for all subsequent text output primitives until
  3613.        216:    --          the values are reset by another call to this function.
  3614.        217:    -- =========================================================
  3615.        218:
  3616.        219:    procedure DEFINE_COLOR
  3617.        220:              ( INDEX  : in GKS_SPEC.COLOUR_INDEX ;
  3618.        221:                COLOUR : in GKS_SPEC.COLOUR_REP ) ;
  3619.        222:    -- =========================================================
  3620.        223:    -- Define the colour to be associated with a colour index on
  3621.        224:    -- Effect : Redefines the entries in the colour look up table pointed
  3622.        225:    --          at by the colour index.
  3623.        226:    -- =========================================================
  3624.        227:
  3625.        228:    function REQUEST_LOCATOR
  3626.        229:             ( DEVICE    : in  GKS_SPEC.DEVICE_NUMBER )
  3627.        230:    return GKS_SPEC.POINT ;
  3628.        231:    -- =========================================================
  3629.        232:    -- Request position in WC and normalization transformation number
  3630.        233:    -- from a locator device
  3631.        234:    -- Effect : Perform a request on the specified locator device.
  3632.        235:    -- =========================================================
  3633.        236:
  3634.        237:    procedure SEGMENT_OPERATION
  3635.        238:              ( SELECTION  : in SEGMENT_OPERATIONS_TYPE ;
  3636.        239:                SEGMENT_ID : in SEGMENT_IDENTIFIER ) ;
  3637.        240:    -- =========================================================
  3638.        241:    -- FINISH Segment construction finished
  3639.        242:    -- Effect : Close the currently open segment.  Primitives may no longer
  3640.        243:    --          be added to the closed segment.
  3641.        244:    -- START a segment and start constructing it
  3642.        245:    -- Effect : Create a segment.  Subsequent calls to output primitive
  3643.        246:    --          functions will place the primitives into the currently
  3644.        247:    --          open segment.
  3645.        248:    -- DESTROY a segment
  3646.        249:    -- Effect : Delete all copies of the specified segment stored in
  3647.        250:    --          GKS.  The segment name may be reused.
  3648.        251:    -- REDRAW a visible segment.
  3649.        252:    -- Effect : For the specified workstation, the visible segment
  3650.        253:    --  is displayed.
  3651.        254:    -- =========================================================
  3652.        255:
  3653.        256:    procedure MOVE_SEGMENT
  3654.        257:              ( SEGMENT_ID : in GKS_SPEC.SEGMENT_IDENTIFIER ;
  3655.        258:                LOCATION   : in GKS_SPEC.POINT ) ;
  3656.        259:    -- =========================================================
  3657.        260:    -- relocates segment
  3658.        261:    -- Effect : Sets the reference point of the segment to new location.
  3659.        262:    -- =========================================================
  3660.        263:
  3661.        264:    procedure RENAME_SEGMENT
  3662.        265:              ( OLD_SEGMENT_NAME : in GKS_SPEC.SEGMENT_IDENTIFIER ;
  3663.        266:                NEW_SEGMENT_NAME : in GKS_SPEC.SEGMENT_IDENTIFIER ) ;
  3664.        267:    -- =========================================================
  3665.        268:    -- Change name of a segment
  3666.        269:    -- Effect : Rename the specified segment.  The old segment name
  3667.        270:    --          may be reused.
  3668.        271:    -- =========================================================
  3669.        272:
  3670.        273:    procedure SET_HIGHLIGHTING
  3671.        274:              ( SEGMENT_ID : in GKS_SPEC.SEGMENT_IDENTIFIER ;
  3672.        275:                HIGHLIGHT  : in GKS_SPEC.SEGMENT_HIGHLIGHTING ) ;
  3673.        276:    -- =========================================================
  3674.        277:    -- Mark segment normal or highlighted
  3675.        278:    -- Effect : Set the highlighting attribute to the value
  3676.        279:    --          HIGHLIGHTED or NORMAL.
  3677.        280:    -- =========================================================
  3678.        281:
  3679.        282:    procedure SET_SEGMENT_PRIORITY
  3680.        283:              ( SEGMENT_ID : in GKS_SPEC.SEGMENT_IDENTIFIER ;
  3681.        284:                PRIORITY   : in GKS_SPEC.SEGMENT_PRIORITY ) ;
  3682.        285:    -- =========================================================
  3683.        286:    -- Set priority of a segment
  3684.        287:    -- Effect : Set the priority of the specified segment to the specified
  3685.        288:    --          priority.  Priority is a value in the range 0 to 1.
  3686.        289:    -- =========================================================
  3687.        290:
  3688.        291:    procedure REDRAW_ALL_SEGMENTS;
  3689.        292:    -- =========================================================
  3690.        293:    -- Redraw all visible segments stored.
  3691.        294:    -- Effect : For the specified workstation, all deferred actions are
  3692.        295:    --          executed, the display surface is cleared if not empty,
  3693.        296:    --          and all visible segments are displayed.
  3694.        297:    -- =========================================================
  3695.        298:
  3696.        299:    procedure SET_VISIBILITY
  3697.        300:              ( SEGMENT_ID : in GKS_SPEC.SEGMENT_IDENTIFIER ;
  3698.        301:                VISIBILITY : in GKS_SPEC.SEGMENT_VISIBILITY ) ;
  3699.        302:    -- =========================================================
  3700.        303:    -- Mark segment visible or invisible
  3701.        304:    -- Effect : Set the visibility attributes of the specified segment
  3702.        305:    --          to VISIBLE or INVISIBLE.
  3703.        306:    -- =========================================================
  3704.        307:
  3705.        308:    function REQUEST_PICK
  3706.        309:             ( DEVICE : in  GKS_SPEC.DEVICE_NUMBER )
  3707.        310:    return GKS_SPEC.PICK_VALUE_TYPE ;
  3708.        311:    -- =========================================================
  3709.        312:    -- Request segment name, pick identifier and pick status from a
  3710.        313:    -- pick device
  3711.        314:    -- Effect : Perform a request on the specified pick device.
  3712.        315:    -- =========================================================
  3713.        316:
  3714.        317:    procedure SET_DETECTABILITY
  3715.        318:              ( SEGMENT_ID    : in GKS_SPEC.SEGMENT_IDENTIFIER ;
  3716.        319:                DETECTABILITY : in GKS_SPEC.SEGMENT_DETECTABILITY ) ;
  3717.        320:    -- =========================================================
  3718.        321:    -- Mark segment undetectable or detectable
  3719.        322:    -- Effect : Set the detectability attributes of the specified segment
  3720.        323:    --          to DETECTABLE or UNDETECTABLE.
  3721.        324:    -- =========================================================
  3722.        325:
  3723.        326:    procedure MAP_WINDOW_TO_VIEWPORT
  3724.        327:              ( WINDOW               : in NATURAL ;
  3725.        328:                UPPER_LEFT_WINDOW ,
  3726.        329:                LOWER_RIGHT_WINDOW ,
  3727.        330:                UPPER_LEFT_VIEWPORT ,
  3728.        331:                LOWER_RIGHT_VIEWPORT : in GKS_SPEC.POINT ) ;
  3729.        332:    -- =========================================================
  3730.        333:    -- Creates windows at the terminal.
  3731.        334:    -- Effect : All subsequent window references will occur in the
  3732.        335:    --          selected viewport.
  3733.        336:    -- =========================================================
  3734.        337:
  3735.        338:    procedure SET_CURRENT_WINDOW
  3736.        339:              ( WINDOW : in NATURAL ) ;
  3737.        340:    -- =========================================================
  3738.        341:    -- Selects the current active window
  3739.        342:    -- Effect : All subsequent drawing will occur in the new current
  3740.        343:    -- window.
  3741.        344:    -- =========================================================
  3742.        345:
  3743.        346:    -- exception conditions to be handled by user packages
  3744.        347:    LOCATOR_INPUT_ERROR : exception ;
  3745.        348:
  3746.        349: end TERMINAL_ACCESS;
  3747.        350: -- pragma PAGE ;
  3748.        351:
  3749.        352: with ENVISION_SPECIFICATION ; use ENVISION_SPECIFICATION ;
  3750.        353: with CONTROL_AND_SETUP ;      use CONTROL_AND_SETUP ;
  3751.        354: with GRAPH_DRAWING ;          use GRAPH_DRAWING ;
  3752.        355: with SEGMENT_OPERATIONS ;     use SEGMENT_OPERATIONS ;
  3753.        356: with DISPLAY_LIST_CONTROL ;   use DISPLAY_LIST_CONTROL ;
  3754.        357: with MINI_MATH_PAC ;          use MINI_MATH_PAC ;
  3755.        358: with PRIORITY_CALCULATOR ;    use PRIORITY_CALCULATOR ;
  3756.        359:
  3757.        360: with TRACE_PKG ; use TRACE_PKG ;
  3758.        361:
  3759.        362: package body TERMINAL_ACCESS is
  3760.  
  3761.       1553: end TERMINAL_ACCESS ;
  3762. Compilation complete
  3763.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 1553
  3764.          1: pragma source_info(on) ;
  3765.          2:
  3766.          3: with DESIGN_PKG        ; use DESIGN_PKG ;
  3767.          4: with GKS_SPECIFICATION ; use GKS_SPECIFICATION ;
  3768.          5:
  3769.          6: --controlled by BOB MAREK
  3770.          7: -- VERSION 85-07-16-12:00 by RAM
  3771.          8:
  3772.          9: package GKS_PRIME is
  3773.         10: -- ============================================================
  3774.         11: --  This package implements a version of the Graphical
  3775.         12: --  Kernel System (GKS) developed by SYSCON Corporation
  3776.         13: --  for use with the Graphic Ada Designer.  The specification
  3777.         14: --  is based on:
  3778.         15: --
  3779.         16: --      1) The Ada Phase I GKS developed by Harris Corp.
  3780.         17: --      2) Draft GKS Binding to ANSI Ada
  3781.         18: --
  3782.         19: --  This implementation will initially be a partial subset,
  3783.         20: --  with only those operations required by the Graphic Ada
  3784.         21: --  Designer implemented.  Although the semantics of the
  3785.         22: --  functions implemented are intended to be faithful to those
  3786.         23: --  decribed in the GKS Binding, the goal of efficiency and
  3787.         24: --  compactness may result in the implementation code ignoring
  3788.         25: --  certain arguments (e.g., opening a workstation may be
  3789.         26: --  unnecessary and implemented as a null operation).  The
  3790.         27: --  code will directly manipulate primitives of the target
  3791.         28: --  graphics device, without the intermediate operations
  3792.         29: --  associated with GKS.  The implementation and utilization
  3793.         30: --  of this package will be faithful enough to the real GKS,
  3794.         31: --  to permit the Graphic Ada Designer to be easily converted
  3795.         32: --  to using a real version of GKS.
  3796.         33: -- ============================================================
  3797.         34:
  3798.         35:    package GKS_SPEC renames GKS_SPECIFICATION ;
  3799.         36:
  3800.         37:    package LEVEL_0A is
  3801.         38:    -- ========================================================
  3802.         39:    --  This packages declares the Level 0A operations of GKS.
  3803.         40:    -- ========================================================
  3804.         41:
  3805.         42:       procedure CLOSE_GKS ;
  3806.         43:       -- ==============================================================
  3807.         44:       -- Stop working with GKS
  3808.         45:       -- ISO/DIS 7942, section 5.2, page 79
  3809.         46:       -- Effect : GKS is closed and all termination processing required
  3810.         47:       --          by the implementation is performed.
  3811.         48:       -- ==============================================================
  3812.         49:
  3813.         50:       procedure CLOSE_WORKSTATION ( WK_ID : in WORKSTATION_ID ) ;
  3814.         51:       -- =============================================================
  3815.         52:       -- Release the connection between a workstation and GKS
  3816.         53:       -- ISO/DIS 7942, section 5.2, page 80
  3817.         54:       -- Effect : For the specified workstation, an implicit UPDATE
  3818.         55:       --          WORKSTATION is performed, and the connection to the
  3819.         56:       --          workstation is released.
  3820.         57:       -- =============================================================
  3821.         58:
  3822.         59:       procedure EMERGENCY_CLOSE_GKS ;
  3823.         60:       -- ===============================================================
  3824.         61:       -- Tries to close GKS in case of an error, saving as much information
  3825.         62:       -- as possible
  3826.         63:       -- ISO/DIS 7942, section 5.11, page 202
  3827.         64:       -- Effect : GKS is emergency closed.  The function is called when it
  3828.         65:       --          is not possible to recover from an error.
  3829.         66:       -- ===============================================================
  3830.         67:
  3831.         68:       procedure ERROR_HANDLING
  3832.         69:                 ( ERROR_NUMBER : in INTEGER ;
  3833.         70:                   ID           : in STRING ;
  3834.         71:                   ERROR_FILE   : in STRING ) ;
  3835.         72:       -- ===============================================================
  3836.         73:       -- A procedure called by GKS when an error is detected.  It may be
  3837.         74:       -- user supplied
  3838.         75:       -- ISO/DIS 7942, section 5.11, page 202
  3839.         76:       -- Effect : The GKS detected error is logged via a call to
  3840.         77:       --          ERROR_LOGGING and control is returned to the GKS
  3841.         78:       --          function where the error has been detected.
  3842.         79:       -- ==============================================================
  3843.         80:
  3844.         81:       procedure ERROR_LOGGING
  3845.         82:                 ( ERROR_NUMBER : in INTEGER ;
  3846.         83:                   ID           : in STRING ;
  3847.         84:                   ERROR_FILE   : in STRING ) ;
  3848.         85:       -- ==============================================================
  3849.         86:       -- A procedure called by the standard GKS error handling procedure.
  3850.         87:       -- It prints an error message and function identification on the
  3851.         88:       -- error file
  3852.         89:       -- ISO/DIS 7942, section 5.11, page 203
  3853.         90:       -- Effect : An error message and GKS function identification is
  3854.         91:       --          written to the error file.
  3855.         92:       -- ==============================================================
  3856.         93:
  3857.         94:       procedure ESCAPE
  3858.         95:                 ( ESCAPE_ID   : ESCAPE_IDENTIFIER ;
  3859.         96:                   ESCAPE_DATA : ESCAPE_RECORD ) ;
  3860.         97:       -- =====================================================
  3861.         98:       -- A standard way of invoking non-standard features
  3862.         99:       -- ISO/DIS 7942, section 5.2, page 86
  3863.        100:       -- Effect : The specified non-standard specific escape
  3864.        101:       --          function is invoked.
  3865.        102:       -- =====================================================
  3866.        103:
  3867.        104:       procedure FILL_AREA ( POINTS   : in POINT_LIST ;
  3868.        105:                             LINETYPE : in LINE_TYPE ) ;
  3869.        106:       -- ================================================================
  3870.        107:       -- Generate a polygon which may be filled with a colour, a hatch or
  3871.        108:       -- a pattern or may be hollow
  3872.        109:       -- ISO/DIS 7942, section 5.3, page 88
  3873.        110:       -- Effect : A FILL AREA primitive is generated, and the current values
  3874.        111:       --          of the fill area attributes are bound to the primitive.
  3875.        112:       --          The attributes are listed in section 4.4.2, page 21.
  3876.        113:       -- ================================================================
  3877.        114:
  3878.        115:       procedure GDP
  3879.        116:                 ( POINTS          : in POINT_LIST ;
  3880.        117:                   GDP_IDENTIFIER  : in GDP_ID ) ;
  3881.        118:       -- ================================================================
  3882.        119:       -- Generate a generalized drawing primitive defined by a sequence
  3883.        120:       -- of points in WC and a data record
  3884.        121:       -- ISO/DIS 7942, section 5.3, page 91
  3885.        122:       -- Effect : A generalized drawing primitive (GDP) of the type
  3886.        123:       --          indicated by the GDP identifier is generated on the basis
  3887.        124:       --          of the given points and the GDP data record.
  3888.        125:       -- ================================================================
  3889.        126:
  3890.        127:       procedure OPEN_GKS
  3891.        128:                 ( ERROR_FILE       : in STRING ;
  3892.        129:                   AMOUNT_OF_MEMORY : in MEMORY_UNITS := 1000 ) ;
  3893.        130:       -- =============================================================
  3894.        131:       --  Start working with GKS
  3895.        132:       -- ISO/DIS 7942, section 5.2, page 79
  3896.        133:       -- Effect : GKS is opened and all initialization processing required
  3897.        134:       --          by the implementation is performed.
  3898.        135:       -- ==============================================================
  3899.        136:
  3900.        137:       procedure OPEN_WORKSTATION
  3901.        138:                 ( WK_ID   : in out WORKSTATION_ID ;
  3902.        139:                   CONN_ID : in CONNECTION_ID ;
  3903.        140:                   WK_TYPE : in WORKSTATION_TYPE ) ;
  3904.        141:       -- ============================================================
  3905.        142:       -- Create a connection between a workstation and GKS
  3906.        143:       -- ISO/DIS 7942, section 5.2, page 79
  3907.        144:       -- Effect : Specifies the number to be used to identify the
  3908.        145:       --          workstation, requests the specified connection to
  3909.        146:       --          the workstation, and, if needed, clears the display
  3910.        147:       --          surface.
  3911.        148:       -- ============================================================
  3912.        149:
  3913.        150:       procedure POLYLINE ( POINTS : in POINT_LIST ) ;
  3914.        151:       -- ============================================================
  3915.        152:       -- Generate a polyline defined by points in WC
  3916.        153:       -- ISO/DIS 7942, section 5.3, page 87
  3917.        154:       -- Effect : A sequence of connected straight lines is generated,
  3918.        155:       --          starting at the first point and ending at the last point.
  3919.        156:       -- ============================================================
  3920.        157:
  3921.        158:       procedure POLYMARKER ( POINTS : in POINT_LIST ) ;
  3922.        159:       -- ============================================================
  3923.        160:       -- Generate markers of a given type at positions in WC
  3924.        161:       -- ISO/DIS 7942, section 5.3, page 87
  3925.        162:       -- Effect : A sequence of markers is generated to identify all the
  3926.        163:       --          given positions.
  3927.        164:       -- ============================================================
  3928.        165:
  3929.        166:       procedure SET_COLOUR_REP
  3930.        167:                 ( WK_ID  : in WORKSTATION_ID ;
  3931.        168:                   INDEX  : in COLOUR_INDEX ;
  3932.        169:                   COLOUR : in COLOUR_REP ) ;
  3933.        170:       -- ============================================================
  3934.        171:       -- Define the colour to be associated with a colour index on
  3935.        172:       -- a workstation
  3936.        173:       -- ISO/DIS 7942, section 5.4, page 110
  3937.        174:       -- Effect : Redefines the entries in the colour look up table pointed
  3938.        175:       --          at by the colour index.
  3939.        176:       -- ============================================================
  3940.        177:
  3941.        178:       procedure SET_FILL_AREA_COLOUR_INDEX ( COLOUR : in COLOUR_INDEX ) ;
  3942.        179:       -- ============================================================
  3943.        180:       -- Set the fill area colour index for use when the corresponding
  3944.        181:       -- ASF is INDIVIDUAL
  3945.        182:       -- ISO/DIS 7942, section 5.4, page 103
  3946.        183:       -- Effect : The current fill area colour index is set to the
  3947.        184:       --          specified value.
  3948.        185:       -- ============================================================
  3949.        186:
  3950.        187:       procedure SET_FILL_AREA_INTERIOR_STYLE
  3951.        188:                 ( STYLE : in INTERIOR_STYLE_type ) ;
  3952.        189:       -- ============================================================
  3953.        190:       -- Set the fill area interior style for use when the corresponding
  3954.        191:       -- ASF is INDIVIDUAL
  3955.        192:       -- ISO/DIS 7942, section 5.4, page 102
  3956.        193:       -- Effect : The current fill area interior style is set to the
  3957.        194:       --          specified value.
  3958.        195:       -- ============================================================
  3959.        196:
  3960.        197:       procedure SET_LINETYPE ( LINETYPE : in LINE_TYPE ) ;
  3961.        198:       -- ============================================================
  3962.        199:       -- Set the linetype for use when the corresponding ASF
  3963.        200:       -- is INDIVIDUAL
  3964.        201:       -- ISO/DIS 7942, section 5.4, page 94
  3965.        202:       -- Effect : The current line type is set to the specified value.
  3966.        203:       -- Linetypes:
  3967.        204:       --        1 - solid
  3968.        205:       --        2  - dashed
  3969.        206:       --        3  - dotted
  3970.        207:       --        4  - dashed-dotted
  3971.        208:       --        >4 - implementation dependent
  3972.        209:       -- ============================================================
  3973.        210:
  3974.        211:       procedure SET_MARKER_TYPE ( MARKERTYPE : in MARKER_TYPE ) ;
  3975.        212:       -- ============================================================
  3976.        213:       -- Set the marker type for use when the corresponding ASF
  3977.        214:       -- is INDIVIDUAL
  3978.        215:       -- ISO/DIS 7942, section 5.4, page 96
  3979.        216:       -- Effect : The current marker type is set to the specified value.
  3980.        217:       -- Marker types:
  3981.        218:       --        1  - dot
  3982.        219:       --        2  - plus sign
  3983.        220:       --        3  - asterisk
  3984.        221:       --        4  - circle
  3985.        222:       --        5  - diagonal cross
  3986.        223:       --        >5 - implementation dependent
  3987.        224:       -- ============================================================
  3988.        225:
  3989.        226:       procedure SET_POLYLINE_COLOUR_INDEX ( COLOUR : in COLOUR_INDEX ) ;
  3990.        227:       -- ============================================================
  3991.        228:       -- Set the polyline colour index for use when the corresponding ASF
  3992.        229:       -- is INDIVIDUAL
  3993.        230:       -- ISO/DIS 7942, section 5.4, page 95
  3994.        231:       -- Effect : The current polyline colour index is set to the
  3995.        232:       --          specified value.
  3996.        233:       -- ============================================================
  3997.        234:
  3998.        235:       procedure SET_POLYMARKER_COLOUR_INDEX ( COLOUR : in COLOUR_INDEX ) ;
  3999.        236:       -- ============================================================
  4000.        237:       -- Set the polymarker colour index for use when the corresponding
  4001.        238:       -- ASF is INDIVIDUAL
  4002.        239:       -- ISO/DIS 7942, section 5.4, page 97
  4003.        240:       -- Effect : The current polymarker colour index is set to the
  4004.        241:       --          specified value.
  4005.        242:       -- ============================================================
  4006.        243:
  4007.        244:       procedure SET_TEXT_COLOUR_INDEX ( COLOUR : in COLOUR_INDEX ) ;
  4008.        245:       -- ============================================================
  4009.        246:       -- Set the text colour index for use when the corresponding
  4010.        247:       -- ASF is INDIVIDUAL
  4011.        248:       -- ISO/DIS 7942, section 5.4, page 99
  4012.        249:       -- Effect : The current text colour index is set to the
  4013.        250:       --          specified value.
  4014.        251:       -- ============================================================
  4015.        252:
  4016.        253:       procedure SET_TEXT_PATH ( PATH : in TEXT_PATH ) ;
  4017.        254:       -- ============================================================
  4018.        255:       -- Select the text path RIGHT, LEFT, UP, or DOWN
  4019.        256:       -- ISO/DIS 7942, section 5.4, page 101
  4020.        257:       -- Effect : Set the text path of character strings to the specified
  4021.        258:       --          values for all subsequent text output primitives until
  4022.        259:       --          the values are reset by another call to this function.
  4023.        260:       -- ============================================================
  4024.        261:
  4025.        262:       procedure SET_WINDOW
  4026.        263:                 ( LIMITS    : in RECTANGLE ) ;
  4027.        264:       -- ============================================================
  4028.        265:       -- Set window in WC of a normalization transformation
  4029.        266:       -- ISO/DIS 7942, section 5.5, page 112
  4030.        267:       -- Effect : Defines a window for the specified normalization
  4031.        268:       --          transformation.
  4032.        269:       -- ============================================================
  4033.        270:
  4034.        271:       procedure SET_WORKSTATION_VIEWPORT
  4035.        272:                 ( WK_ID  : in WORKSTATION_ID ;
  4036.        273:                   LIMITS : in RECTANGLE_DC ) ;
  4037.        274:       -- ============================================================
  4038.        275:       -- Set workstation viewport in DC
  4039.        276:       -- ISO/DIS 7942, section 5.5, page 114
  4040.        277:       -- Effect : Specifies where on the workstation display the view
  4041.        278:       --          of NDC space will appear.
  4042.        279:       -- ============================================================
  4043.        280:
  4044.        281:       procedure TEXT
  4045.        282:                 ( POSITION    : in POINT ;
  4046.        283:                   TEXT_STRING : in STRING ) ;
  4047.        284:       -- ============================================================
  4048.        285:       -- Generate a text string at the given position in WC
  4049.        286:       -- ISO/DIS 7942, section 5.3, page 87
  4050.        287:       -- Effect : Generates the specified text string at the specified
  4051.        288:       --          position.
  4052.        289:       -- ============================================================
  4053.        290:
  4054.        291:    end LEVEL_0A ;
  4055.        292:
  4056.        293:    package LEVEL_0B is
  4057.        294:    -- ============================================================
  4058.        295:    --  This package declares the GKS Level 0B operations.
  4059.        296:    -- ============================================================
  4060.        297:
  4061.        298:       procedure REQUEST_LOCATOR
  4062.        299:                 ( WK_ID     : in WORKSTATION_ID ;
  4063.        300:                   DEVICE    : in DEVICE_NUMBER ;
  4064.        301:                   POSITION  : out POINT ) ;
  4065.        302:       -- ============================================================
  4066.        303:       -- Request position in WC and normalization transformation number
  4067.        304:       -- from a locator device
  4068.        305:       -- ISO/DIS 7942, section 5.7, page 134
  4069.        306:       -- Effect : Perform a request on the specified locator device.
  4070.        307:       -- ============================================================
  4071.        308:
  4072.        309:    end LEVEL_0B ;
  4073.        310:
  4074.        311:    package LEVEL_1A is
  4075.        312:    -- ============================================================
  4076.        313:    --  This package declares the GKS Level 1A operations.
  4077.        314:    -- ============================================================
  4078.        315:
  4079.        316:       procedure CLOSE_SEGMENT ;
  4080.        317:       -- ============================================================
  4081.        318:       -- Segment construction finished
  4082.        319:       -- ISO/DIS 7942, section 5.6, page 116
  4083.        320:       -- Effect : Close the currently open segment.  Primitives may no longer
  4084.        321:       --          be added to the closed segment.
  4085.        322:       -- ============================================================
  4086.        323:
  4087.        324:       procedure CREATE_SEGMENT ( SEGMENT_ID : in SEGMENT_IDENTIFIER ) ;
  4088.        325:       -- ============================================================
  4089.        326:       -- Create a segment and start constructing it
  4090.        327:       -- ISO/DIS 7942, section 5.6, page 116
  4091.        328:       -- Effect : Create a segment.  Subsequent calls to output primitive
  4092.        329:       --          functions will place the primitives into the currently
  4093.        330:       --          open segment.
  4094.        331:       -- ============================================================
  4095.        332:
  4096.        333:       procedure DELETE_SEGMENT ( SEGMENT_ID : in SEGMENT_IDENTIFIER ) ;
  4097.        334:       -- ============================================================
  4098.        335:       -- Delete a segment
  4099.        336:       -- ISO/DIS 7942, section 5.6, page 117
  4100.        337:       -- Effect : Delete all copies of the specified segment stored in
  4101.        338:       --          GKS.  The segment name may be reused.
  4102.        339:       -- ============================================================
  4103.        340:
  4104.        341:       procedure REDRAW_ALL_SEGMENTS_ON_WORKSTATION
  4105.        342:                 ( WK_ID : in WORKSTATION_ID ) ;
  4106.        343:       -- ============================================================
  4107.        344:       -- Redraw all visible segments stored on a workstation
  4108.        345:       -- ISO/DIS 7942, section 5.2, page 83
  4109.        346:       -- Effect : For the specified workstation, all deferred actions are
  4110.        347:       --          executed, the display surface is cleared if not empty,
  4111.        348:       --          and all visible segments are displayed.
  4112.        349:       -- ============================================================
  4113.        350:
  4114.        351:       procedure RENAME_SEGMENT
  4115.        352:                 ( OLD_SEGMENT_NAME : in SEGMENT_IDENTIFIER ;
  4116.        353:                   NEW_SEGMENT_NAME : in SEGMENT_IDENTIFIER ) ;
  4117.        354:       -- ============================================================
  4118.        355:       -- Change name of a segment
  4119.        356:       -- ISO/DIS 7942, section 5.6, page 116
  4120.        357:       -- Effect : Rename the specified segment.  The old segment name
  4121.        358:       --          may be reused.
  4122.        359:       -- ============================================================
  4123.        360:
  4124.        361:       procedure SET_HIGHLIGHTING
  4125.        362:                 ( SEGMENT_ID : in SEGMENT_IDENTIFIER ;
  4126.        363:                   HIGHLIGHT  : in SEGMENT_HIGHLIGHTING ) ;
  4127.        364:       -- ============================================================
  4128.        365:       -- Mark segment normal or highlighted
  4129.        366:       -- ISO/DIS 7942, section 5.6, page 121
  4130.        367:       -- Effect : Set the highlighting attribute to the value
  4131.        368:       --          HIGHLIGHTED or NORMAL.
  4132.        369:       -- ============================================================
  4133.        370:
  4134.        371:       procedure SET_SEGMENT_PRIORITY
  4135.        372:                 ( SEGMENT_ID : in SEGMENT_IDENTIFIER ;
  4136.        373:                   PRIORITY   : in SEGMENT_PRIORITY ) ;
  4137.        374:       -- ============================================================
  4138.        375:       -- Set priority of a segment
  4139.        376:       -- ISO/DIS 7942, section 5.6, page 122
  4140.        377:       -- Effect : Set the priority of the specified segment to the specified
  4141.        378:       --          priority.  Priority is a value in the range 0 to 1.
  4142.        379:       -- ============================================================
  4143.        380:
  4144.        381:       procedure SET_VISIBILITY
  4145.        382:                 ( SEGMENT_ID : in SEGMENT_IDENTIFIER ;
  4146.        383:                   VISIBILITY : in SEGMENT_VISIBILITY ) ;
  4147.        384:       -- ============================================================
  4148.        385:       -- Mark segment visible or invisible
  4149.        386:       -- ISO/DIS 7942, section 5.6, page 121
  4150.        387:       -- Effect : Set the visibility attributes of the specified segment
  4151.        388:       --          to VISIBLE or INVISIBLE.
  4152.        389:       -- ============================================================
  4153.        390:
  4154.        391:    end LEVEL_1A ;
  4155.        392:
  4156.        393:    package LEVEL_1B is
  4157.        394:    -- ============================================================
  4158.        395:    --  This package declares the GKS Level 1B operations.
  4159.        396:    -- ============================================================
  4160.        397:
  4161.        398:       procedure REQUEST_PICK
  4162.        399:                 ( WK_ID  : in WORKSTATION_ID ;
  4163.        400:                   DEVICE : in DEVICE_NUMBER ;
  4164.        401:                   PICK   : out PICK_VALUE_TYPE ) ;
  4165.        402:       -- ============================================================
  4166.        403:       -- Request segment name, pick identifier and pick status from a
  4167.        404:       -- pick device
  4168.        405:       -- ISO/DIS 7942, section 5.7, page 137
  4169.        406:       -- Effect : Perform a request on the specified pick device.
  4170.        407:       -- ============================================================
  4171.        408:
  4172.        409:       procedure SET_DETECTABILITY
  4173.        410:                 ( SEGMENT_ID    : in SEGMENT_IDENTIFIER ;
  4174.        411:                   DETECTABILITY : in SEGMENT_DETECTABILITY ) ;
  4175.        412:       -- ============================================================
  4176.        413:       -- Mark segment undetectable or detectable
  4177.        414:       -- ISO/DIS 7942, section 5.6, page 123
  4178.        415:       -- Effect : Set the detectability attributes of the specified segment
  4179.        416:       --          to DETECTABLE or UNDETECTABLE.
  4180.        417:       -- ============================================================
  4181.        418:
  4182.        419:    end LEVEL_1B ;
  4183.        420:
  4184.        421: end GKS_PRIME ;
  4185.        422: -- pragma PAGE ;
  4186.        423:
  4187.        424: with TEXT_IO         ; use TEXT_IO ; -- used for error and journal files
  4188.        425: with TERMINAL_ACCESS ; use TERMINAL_ACCESS ;
  4189.        426: with TRACE_PKG       ; use TRACE_PKG ;
  4190.        427:
  4191.        428: package body GKS_PRIME is
  4192.  
  4193.       1363: end GKS_PRIME ;
  4194. Compilation complete
  4195.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 1363
  4196. 4.7        VIRTUAL_TERMINAL
  4197.  
  4198. The VIRTUAL_TERMINAL_INTERFACE package provides a device independent set of subprograms which provide alphanumeric text
  4199. services. The primary function of this package is to support text I/O to the alphanumeric window.  In particular this
  4200. package will support a region of two lines on the bottom of the terminal screen for use in prompting for and reading
  4201. interactive text.
  4202.  
  4203.                               Table 4-8 VIRTUAL_TERMINAL Virtual Package Dependencies List
  4204.  
  4205.                               COMPILATION UNITS     TYPE      COMMENTS        DEPENDENCIES
  4206.                               Virtual_Terminal      Package                   System
  4207.                                                                               Text_IO
  4208.                                                                               Design_Pkg
  4209.  
  4210.   VIRTUAL_TERMINAL
  4211.   - - - -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  4212.   |                     VIRTUAL_TERMINAL_INTERFACE                                                                     |
  4213.                         -------------------------------------------                                ---------------------
  4214. -------------------  ----------------                             |                                < SYSTEM            >
  4215. ( VTI_TYPE        )<-( DECLARATIONS )       ===================== |    +-----------------------+-->< TEXT_IO           >
  4216. -------------------  ----------------  +--->| SCREEN_WIDTH_132  | |    ^                       ^   ---------------------
  4217.                          |             |    |===================| |    |                       |
  4218.    |                     |          +--+   =====================|----->+                       +-------------------+|
  4219.                          |          |+---->| SCREEN_WIDTH_80   |- |    |    VT100_SCREEN_CONTROL                   |
  4220.    |                     |          ||     |===================|  |    |    -------------------------------------- ||
  4221. -------               -------       ||    =====================|------>+    |                                    | |
  4222. |     |-------------->|     |-------+|+-->| KEY_PAD_IO =      |-  |    |  ----------------                       | | |
  4223. |     |-------------->|     |--------+|   |===================|   |    |  ( DECLARATIONS )                       | |
  4224. |     |-------------->|     |---------+  =====================|------->+  ----------------  =====================| | |
  4225. |     |-------------->|     |----------->| FORMAT_LINE[]     |-   |    |    |     +-------->| POSITION_CURSOR[] || |
  4226. |     |-------------->|     |--------+   |===================|    |    |    |     |         |===================|| | |
  4227. |     |-------------->|     |-------+|  =====================|-------->+    |     |        =====================|->+
  4228. |     |-------------->|     |------+|+->| REALIO[]          |-    |    |    |     |+------>| HOME_CURSOR       ||  | |
  4229. |     |-------------->|     |-----+||   |===================|     |    |    |     ||       |===================||  |
  4230. |     |-------------->|     |---+ |||  =====================|--------->+    |     ||      =====================|->+ |
  4231. -------               -------   | ||+->| INTEGERIO[]       |-     |    |    |     ||+---->| ERASE_SCREEN      |-|  |
  4232.    |                     |      | ||   |===================|      |    |  ------  |||     |===================| |  | |
  4233.                          |      | ||  =====================|---------->+->|    |--+||    =====================|--->+
  4234.    |                     |      | |+->| CHARACTERIO[]     |-      |    +->|    |---+|+-->| ERASE_LINE        |- |  | |
  4235.                          |      | |   |===================|       |    +->|    |----+|   |===================|  |  |
  4236.    |                     |      | |  =====================|----------->+->|    |-----+  =====================|---->+ |
  4237.                          |      | +->| STRINGIO[]        |-       |    |+>|    |------->| RESET             |-  |  |
  4238.    |                     |      |    |===================|        |    || ------        |===================|   |  | |
  4239.                          |      |   =====================|------------>+|   |           |                   |----->+
  4240.    |                     |      +-->| VTI_INIT          |-        |     |   |           ---------------------   |    |
  4241.                          |          |===================|         |     |   -------------------------------------
  4242.    |                     |          |                   |---------------+                                            |
  4243.                          |          ---------------------         |
  4244.    |                     ------------------------------------------                                                  |
  4245.     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  4246.                               Figure 4 -  Virtual_Terminal Virtual Package Design Diagram
  4247.          1: pragma source_info(on) ;
  4248.          2:
  4249.          3: with SYSTEM     ;
  4250.          4:
  4251.          5: -- controlled by BOB MAREK
  4252.          6: -- version 85-07-16-1530 by JL
  4253.          7:
  4254.          8: package VIRTUAL_TERMINAL_INTERFACE is
  4255.          9: -- ==================================================================
  4256.         10: --
  4257.         11: --  The VIRTUAL_TERMINAL_INTERFACE package provides a device
  4258.         12: --  independent set of subprograms which provide alphanumeric text
  4259.         13: --  services. The primary function of this package is to support
  4260.         14: --  alphanumeric I/O to the alphanumeric window.
  4261.         15: --
  4262.         16: --  In particular this package will support a scroll region of two
  4263.         17: --  lines on the bottom of the terminal screen for use in prompting
  4264.         18: --  for and reading interactive text.
  4265.         19: --
  4266.         20: -- ===================================================================
  4267.         21:
  4268.         22:    --{{ Suggested pragmas to speed performance of this critical
  4269.         23:    --{{ low level interface
  4270.         24:    -- pragma suppress ( division_check ) ;
  4271.         25:    -- pragma suppress ( overflow_check ) ;
  4272.         26:    -- pragma suppress ( index_check ) ;
  4273.         27:    -- pragma suppress ( range_check ) ;
  4274.         28:    -- pragma suppress ( length_check ) ;
  4275.         29:
  4276.         30:    ------------------------------------------------------------
  4277.         31:    --  One enumeration value for each possible keypad key value
  4278.         32:    --  (including usage of the GOLD key).
  4279.         33:    -------------------------------------------------------------
  4280.         34:    type KEYPAD_KEY_TYPE is
  4281.         35:         ( GOLD , PF2 , PF3 , PF4 , KP7 , KP8 , KP9 ,
  4282.         36:           KPhypen , KP4 , KP5 , KP6 , KPcomma ,
  4283.         37:           KP1 , KP2 , KP3 , KP0 , KPdot , ENTER ,
  4284.         38:           GOLD_PF2 , GOLD_PF3 , GOLD_PF4 , GOLD_KP7 ,
  4285.         39:           GOLD_KP8 , GOLD_KP9 , GOLD_KPhypen ,
  4286.         40:           GOLD_KP4 , GOLD_KP5 , GOLD_KP6 , GOLD_KPcomma ,
  4287.         41:           GOLD_KP1 , GOLD_KP2 , GOLD_KP3 , GOLD_KP0 ,
  4288.         42:           GOLD_KPdot , GOLD_ENTER ,
  4289.         43:           UP_ARROW , DOWN_ARROW , LEFT_ARROW , RIGHT_ARROW ) ;
  4290.         44:
  4291.         45:    ----------------------------------------------------
  4292.         46:    --  The type used to communication with from the
  4293.         47:    --  graphics terminal operator .
  4294.         48:    ----------------------------------------------------
  4295.         49:    subtype USER_REQUEST  is STRING ( 1 .. 80 ) ;
  4296.         50:    subtype USER_RESPONSE is STRING ( 1 .. 80 ) ;
  4297.         51:
  4298.         52:    ------------------------------------------------------------
  4299.         53:    -- The following declarations define various terminal screen
  4300.         54:    -- I/O structures.
  4301.         55:    --  ROW_TYPE    => screen row cursor position identifier.
  4302.         56:    --  COLUMN_TYPE => screen column cursor position identifier.
  4303.         57:    --  ESC         => String definition of an ASCII escape.
  4304.         58:    --  DEL         => String definition of an ASCII delete.
  4305.         59:    --  NUL         => String definition of an ASCII nul.
  4306.         60:    ------------------------------------------------------------
  4307.         61:    subtype ROW_TYPE    is INTEGER range 1 .. 24 ;
  4308.         62:    subtype COLUMN_TYPE is INTEGER range 1 .. 132 ;
  4309.         63:
  4310.         64:    MAXCOL  : constant COLUMN_TYPE := 80 ;
  4311.         65:    MAXROW  : constant ROW_TYPE := 24 ;
  4312.         66:
  4313.         67:    ------------------------------------------------
  4314.         68:    -- Terminal Screen Format Operation Declarations
  4315.         69:    ------------------------------------------------
  4316.         70:    type FORMAT_FUNCTION is
  4317.         71:         ( CLEAR_SCREEN , CENTER_A_LINE , CLEAR_A_LINE ) ;
  4318.         72:
  4319.         73:    ------------------------------------------------
  4320.         74:    -- Terminal Screen I/O Operation Declarations
  4321.         75:    ------------------------------------------------
  4322.         76:    type CURSOR_ADDRESS is
  4323.         77:         ( READ_NO_ADDRESS , READ_WITH_ADDRESS ,
  4324.         78:           WRITE_NO_ADDRESS , WRITE_WITH_ADDRESS ) ;
  4325.         79:
  4326.         80:    type LOW_LEVEL_CRT_FUNCTIONS is
  4327.         81:         ( SCREEN_WIDTH_80 ,       -- Max line characters = 80.
  4328.         82:           SCREEN_WIDTH_132 ,
  4329.         83:           NEXT_LINE ,             -- Sets cursor @ begining of the next line.
  4330.         84:           SCROLL_UP ,             -- Scrolls the page text up one line.
  4331.         85:           SCROLL_DOWN ,           -- Scrolls the page text down one line.
  4332.         86:           HOME_CURSOR ,           -- Places cursor @ home position.
  4333.         87:           ERASE_CURSOR_TO_EOL ,   -- Erases from cursor position
  4334.         88:                                   --    to end of line.
  4335.         89:           ERASE_BOL_TO_CURSOR ,   -- Erases from begining of line
  4336.         90:                                   --    to cursor position.
  4337.         91:           ERASE_CURSOR_LINE ,     -- Erases  all text on current line.
  4338.         92:           ERASE_CURSOR_TO_EOS ,   -- Erases screen from cursor position
  4339.         93:                                   --    to end of screen.
  4340.         94:           ERASE_BOS_TO_CURSOR ,   -- Erases screen from begining of screen
  4341.         95:                                   --    to cursor position.
  4342.         96:           ERASE_CURSOR_SCREEN ,   -- Erases all text on current screen.
  4343.         97:           BLINK_CHARS ,           -- Blink following characters.
  4344.         98:           NEGATIVE_CHARS ,        -- Reverse image of following characters.
  4345.         99:           CLEAR_ATTRIBUTES ,      -- Clear graphic attributes.
  4346.        100:           ERASE_SCREEN ) ;        -- Erase Entire Screen
  4347.        101:
  4348.        102:    procedure LOW_LEVEL_OPERATIONS
  4349.        103:              ( FORMAT_FCT : in LOW_LEVEL_CRT_FUNCTIONS ) ;
  4350.        104:    -- ===========================================================
  4351.        105:    --  This routine provides the operations that provide the
  4352.        106:    --  screen formatting capabilities identified in the Crt_Functions
  4353.        107:    --  declaration list above.
  4354.        108:    -- ===========================================================
  4355.        109:
  4356.        110:    procedure SCROLLING_REGION
  4357.        111:              ( TOP_LINE, BOTTOM_LINE : in POSITIVE ) ;
  4358.        112:    -- =============================================================
  4359.        113:    -- Defines the region of the screen used for text operations.
  4360.        114:    -- =============================================================
  4361.        115:
  4362.        116:    procedure MOVE_CURSOR_UP
  4363.        117:              ( ROWS : in ROW_TYPE ) ;
  4364.        118:    -- =============================================================
  4365.        119:    -- Moves the alphanumeric cursor up n rows.
  4366.        120:    -- =============================================================
  4367.        121:
  4368.        122:    procedure MOVE_CURSOR_DOWN
  4369.        123:              ( ROWS : in ROW_TYPE ) ;
  4370.        124:    -- =============================================================
  4371.        125:    -- Moves the alphanumeric cursor down n rows.
  4372.        126:    -- =============================================================
  4373.        127:
  4374.        128:    procedure MOVE_CURSOR_RIGHT
  4375.        129:              ( COLUMNS : in COLUMN_TYPE ) ;
  4376.        130:    -- =============================================================
  4377.        131:    -- Moves the alphanumeric cursor right n columns.
  4378.        132:    -- =============================================================
  4379.        133:
  4380.        134:    procedure MOVE_CURSOR_LEFT
  4381.        135:              ( COLUMNS : in COLUMN_TYPE ) ;
  4382.        136:    -- =============================================================
  4383.        137:    -- Moves the alphanumeric cursor left n columns.
  4384.        138:    -- =============================================================
  4385.        139:
  4386.        140:    procedure MOVE_CURSOR_TO
  4387.        141:              ( ROW    : in ROW_TYPE ;
  4388.        142:                COLUMN : in COLUMN_TYPE ) ;
  4389.        143:    -- =============================================================
  4390.        144:    -- Moves the alphanumeric cursor to a specified row
  4391.        145:    --  and column location.
  4392.        146:    -- =============================================================
  4393.        147:
  4394.        148:    procedure VTI_INIT ;
  4395.        149:    -- ===========================================================
  4396.        150:    --  Initialize this version of the VIRTUAL_TERMINAL_INTERFACE
  4397.        151:    --  with the terminal specific data required.
  4398.        152:    -- ===========================================================
  4399.        153:
  4400.        154:    procedure STRINGIO
  4401.        155:              ( STRNG   : in out STRING ;
  4402.        156:                ADDRESS : in     CURSOR_ADDRESS ;
  4403.        157:                ROW     : in     ROW_TYPE ;
  4404.        158:                COL     : in     COLUMN_TYPE ) ;
  4405.        159:    -- =========================================================
  4406.        160:    --   This routine performs string I/O operations as per
  4407.        161:    --   the specified formal parameters.
  4408.        162:    -- =========================================================
  4409.        163:
  4410.        164:    procedure CHARACTERIO
  4411.        165:              ( CHAR    : in out CHARACTER ;
  4412.        166:                ADDRESS : in     CURSOR_ADDRESS ;
  4413.        167:                ROW     : in     ROW_TYPE ;
  4414.        168:                COL     : in     COLUMN_TYPE ) ;
  4415.        169:    -- =========================================================
  4416.        170:    --   This routine performs character I/O operations as per
  4417.        171:    --   the specified formal parameters.
  4418.        172:    -- =========================================================
  4419.        173:
  4420.        174:    procedure INTEGERIO
  4421.        175:              ( INT     : in out INTEGER ;
  4422.        176:                ADDRESS : in     CURSOR_ADDRESS ;
  4423.        177:                ROW     : in     ROW_TYPE ;
  4424.        178:                COL     : in     COLUMN_TYPE ) ;
  4425.        179:    -- =========================================================
  4426.        180:    --   This routine performs integer I/O operations as per
  4427.        181:    --   the specified formal parameters.
  4428.        182:    -- =========================================================
  4429.        183:
  4430.        184:    procedure REALIO
  4431.        185:              ( REAL_NO : in out FLOAT ;
  4432.        186:                ADDRESS : in     CURSOR_ADDRESS ;
  4433.        187:                ROW     : in     ROW_TYPE ;
  4434.        188:                COL     : in     COLUMN_TYPE ) ;
  4435.        189:    -- =========================================================
  4436.        190:    --   This routine performs real I/O operations as per
  4437.        191:    --   the specified formal parameters.
  4438.        192:    -- =========================================================
  4439.        193:
  4440.        194:    procedure FORMAT_LINE
  4441.        195:              ( STRNG   : in STRING ;
  4442.        196:                FORMAT  : in FORMAT_FUNCTION  ;
  4443.        197:                ROW     : in ROW_TYPE ) ;
  4444.        198:    -- =========================================================
  4445.        199:    --   This routine performs formatted string I/O operations
  4446.        200:    --   as per the specified formal parameters.
  4447.        201:    -- =========================================================
  4448.        202:
  4449.        203:    function KEY_PAD_IO
  4450.        204:      return KEYPAD_KEY_TYPE ;
  4451.        205:    -- ===============================================================
  4452.        206:    --  This routine provides keypad Input operations.
  4453.        207:    -- ===============================================================
  4454.        208:
  4455.        209: end VIRTUAL_TERMINAL_INTERFACE ;
  4456.        210:
  4457.        211: -- pragma PAGE ;
  4458.        212: with TEXT_IO             ; use TEXT_IO ;
  4459.        213:
  4460.        214: package body VIRTUAL_TERMINAL_INTERFACE is
  4461.  
  4462.        678: end VIRTUAL_TERMINAL_INTERFACE ;
  4463. Compilation complete
  4464.  Syntax errors: 0  Semantic errors: 0  Lines compiled: 678
  4465.  
  4466.