home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / pdl / gadtech.inf < prev    next >
Encoding:
Text File  |  1988-05-03  |  183.4 KB  |  3,953 lines

  1.  
  2.  
  3.  
  4.  
  5.             GGGGG  RRRRRR   AAAA   PPPPPP  HH  HH  IIIIII   CCCCC
  6.            GG      RR  RR  AA  AA  PP  PP  HH  HH    II    CC
  7.            GG      RRRR    AAAAAA  PPPPPP  HHHHHH    II    CC
  8.            GG  GG  RR  RR  AA  AA  PP      HH  HH    II    CC
  9.             GGGG   RR  RR  AA  AA  PP      HH  HH  IIIIII   CCCCC
  10.  
  11.  
  12.                             AAAA   DDDDD    AAAA    *
  13.                            AA  AA  DD  DD  AA  AA
  14.                            AAAAAA  DD  DD  AAAAAA
  15.                            AA  AA  DD  DD  AA  AA
  16.                            AA  AA  DD DD   AA  AA
  17.  
  18.  
  19.        DDDDD   EEEEEE   SSSSS  IIIIII   GGGGG  NN  NN  EEEEEE  RRRRRR
  20.        DD  DD  EE      SS        II    GG      NNN NN  EE      RR  RR
  21.        DD  DD  EEEE     SSSS     II    GG      NNNNNN  EEEE    RRRRR
  22.        DD  DD  EE          SS    II    GG  GG  NN NNN  EE      RR  RR
  23.        DDDDD   EEEEEE  SSSSS   IIIIII   GGGG   NN  NN  EEEEEE  RR  RR
  24.  
  25.  
  26.  
  27.  
  28.             T E C H N I C A L   I N F O R M A T I O N   R E P O R T
  29.  
  30.  
  31.  
  32.                                  FEBRUARY 1986
  33.  
  34.  
  35.  
  36.                                  Prepared for
  37.  
  38.                            Naval Ocean Systems Center,
  39.                             WIS Joint Program Office
  40.  
  41.  
  42.                                  Prepared by
  43.  
  44.                              Ada* Technology Group
  45.                               SYSCON Corportation
  46.                               3990 Sherman Street
  47.                           San Diego, California 92110
  48.                                 (619) 296-0085
  49.  
  50.  
  51.  
  52.  
  53.                   * Ada is a registered trademark of the
  54.              United States Government - Ada Joint Program Office
  55. <FF>
  56.  
  57.  
  58.         Table of Contents
  59.         -----------------
  60.  
  61.  
  62.     1.  INTRODUCTION
  63.     1.1    Background
  64.         1.2    Project Overview
  65.     1.3    Summary of Technology
  66.         1.4    References
  67.  
  68.     2.  ALGORITHMS, DATA STRUCTURES, AND FUNCTIONAL REQUIREMENTS
  69.     2.1    Functional Requirements
  70.     2.2    Data Structures        
  71.         2.3    Algorithms
  72.         2.3.1     Graph Creation 
  73.     2.3.2     OODD Editing 
  74.         2.3.3     Ada PDL Generation 
  75.  
  76.     3.  SOFTWARE ARCHITECTURE
  77.     3.1    GAD 
  78.         3.2    GRAPH_TREE_ACCESS
  79.         3.3    MMI              
  80.         3.4    PDL_GENERATOR    
  81.         3.5    GRAPHICS_DRIVER  
  82.         3.6    GKS_PRIME        
  83.         3.7    VIRTUAL_TERMINAL_INTERFACE
  84.  
  85.         4.  PROGRAM MAINTENANCE
  86.         4.1    Installation              
  87.         4.1.1     Program Compilation    
  88.         4.2    Parameter Controlled Features 
  89.         4.3    System Rehosting  
  90.         4.4    Graphics Terminal Retargeting 
  91.  
  92.         5.  DEVELOPMENT AND TECHNICAL ISSUES
  93.         5.1    Lessons Learned
  94.         5.2    Development Approach          
  95.         5.3    Ada Issues                    
  96.         5.3.1     Compiler Selection
  97.         5.3.2     Compiler Impact on Design and Implementation
  98.         5.3.3     Compiler Transition
  99.         5.4    Key Technology Assessment
  100.         5.4.1     Ada-based Intermediate Language with Graphics Attributes
  101.         5.4.2     Semantic Checking in Interactive Graphics Editing
  102.         5.4.3     GKS Utilization for Terminal Dependence Reduction
  103.         5.4.4     Implementation of a GKS Substitute
  104.         5.5    Productivity           
  105.         5.6    Methodology Adaptation 
  106.  
  107.         6.  TESTING 
  108.         6.1    Approach
  109.         6.2    Requirements
  110. <FF>
  111.  
  112.  
  113. 1.  INTRODUCTION
  114.  
  115. SYSCON Corporation has developed the Graphic Ada Designer (GAD) to
  116. support the creation of semantically valid Ada-based Object
  117. Oriented Design Diagrams (OODDs) which depict the structure of Ada
  118. programs.  The Graphic Ada Designer is an interactive graphics
  119. editor utilizing bit-mapped color graphics which can create and
  120. modify OODDs from which Ada Program Design Language (Ada PDL) code
  121. can be automatically generated.  The OODDs are highly useful in
  122. providing system architecture overviews and summaries of key design
  123. entities and their interactions.  The Graphic Ada Designer was
  124. designed to meet the requirements of NOSC solicitation N66002-84-
  125. R-0030 Item No. 013 under the terms of contract N66001-85-C-0037
  126. Item No. 0001. 
  127.  
  128. 1.1  Background
  129.  
  130. One of the purposes of the WWMCCS Upgrade program is to bring the
  131. WWMCCS capability into line with the current state-of-the-art by
  132. enchancing its functionality and expandability through integration
  133. of modern hardware and software.  A key element of this program
  134. will be the utilization of Ada*, a programming language
  135. designed by the DOD to facilitate and standardize the development
  136. of embedded computer systems.  Research into the use of Ada has
  137. emphasized the need for modern development methodologies in
  138. conjunction with a capable tool kit to achieve maximal cost
  139. savings;  and for this reason substantial effort is being expended
  140. on the development and refinement of Ada based PDLs.
  141.  
  142. As an evaluator of Ada language capabilities and Ada software
  143. development, and as a developer of Ada programming methodologies,
  144. SYSCON realized that Ada PDL did not effectively convey high level
  145. Ada structure information in a compact and easily reviewable form. 
  146. This led to the development of a graphic convention for depicting
  147. Ada structures. 
  148.  
  149. An Ada Graphic Notation was created based on the Object Oriented
  150. Design work of G. Booch [BOOCH] and a structure diagramming
  151. technique presented by Dr. R. Buhr [BUHR]. Ada Graphic Notation
  152. has been successfully applied to several Ada projects, and is
  153. reflected in SYSCON's Ada software methodology (see Section 5.). 
  154. As SYSCON refined its definition of a graphical representation of
  155. Ada structures, the concept of developing a tool to assist in
  156. graphics development quickly followed.  The result was the funding
  157. of an internal research and development effort named 'SKETCHER' to
  158. prototype an Ada graphics tool.  The GAD is an extension of
  159. SYSCON's prior and ongoing experience with Ada-based graphics. 
  160.  
  161. 1.2  Project Overview
  162.  
  163. The purpose of the Graphic Ada Designer is to support the
  164. development of Ada software through interactive development of
  165. graphical representations of Ada programs.  This will be
  166. accomplished by utilizing an Ada-based Intermediate Language with
  167. Graphics Attributes, which consists of a DIANA-like tree-based data
  168. structure with a direct correspondence to Ada constructs plus
  169. attributes for the associated graphics information.  The GAD
  170. supports interactive development with a single integrated tool
  171. which uses the Intermediate Language to store and access the
  172. semantic and graphic information describing an Ada program.  The
  173. GAD performs graphics editing which allows a user to interactively
  174. build graphs of Ada structures on the user's terminal (while
  175. simultaneously building a tree structured file of the OODD using
  176. the Intermediate Language), and produces Ada PDL which corresponds
  177. to the Ada program being designed. 
  178.  
  179. The development of the GAD involved the completion of the
  180. definition of the tool's user interfaces, the design of the
  181. software using SYSCON's Ada software development methodology, the
  182. writing and debugging of the code, the integration and test of the
  183. coded software and, finally, the installation of the software and
  184. delivery of the associated documentation.  Several key technical
  185. issues were addressed in the design and development of the GAD
  186. software.  These issues were identified based on prior work, and
  187. included:  how to best perform on-line semantic checking of Ada
  188. graphs, how to perform graphic manipulations which alter the
  189. lexical and/or semantic structure of the corresponding Ada program,
  190. and how to link graphs to permit the development of complete and
  191. consistent Ada designs and PDLs. SYSCON had already discovered many
  192. potential solutions, and the design process dealt with the
  193. selection of the most effective solution. 
  194.  
  195. 1.3  Summary of Technology 
  196.  
  197. The Graphic Ada Designer provides the capability to interactively
  198. edit graphic representations of Ada programs in a manner which
  199. guarantees limited semantic correctness.  This state-of-the-art
  200. software capability is provided by integrating a wide variety of
  201. software technologies in a synergistic fashion.  The integrated 
  202. technologies are:
  203.  
  204.      - The Graphical Kernel System.  A generalized interface
  205.        mechanism for use with color capable two-dimensional
  206.        graphics display devices.  See Sections 2.3.1, 3.6, and
  207.        5.4.3.
  208.      - An Ada Intermediate Language with Graphics Attributes.  
  209.        GAD uses this DIANA-like, tree structured intermediate 
  210.        representation form to store and access the syntactical 
  211.        and semantic information of the Ada program being designed, 
  212.        as well as the graphical data required to generate and 
  213.        manipulate the graphical representations of the OODDs.  
  214.        See Sections 2.2, 3.2, and 5.4.1.
  215.      - A PDL Generation approach based on the utilization of
  216.        the Ada Intermediate Language.  See Sections 2.3.3 and
  217.        3.4.
  218.  
  219. In addition to incorporating and/or adapting these existing
  220. technologies, the GAD develops the capability to perform
  221. syntactically and semantically sensitive interactive editing.
  222. Similar in scope to syntax-directed source editors with user
  223. invocable semantics checking, GAD addresses the problem of
  224. "on-the-fly" semantics checking using an intermediate form.  This
  225. is further described in Sections 2.3.2, 3.3, and 5.4.2. 
  226.  
  227. 1.4  References
  228.  
  229. [AdaGKS]  "Draft GKS Binding to ANSI Ada"; X3H3/83-95r2; 1985.
  230.  
  231. [AdaLRM]  "Reference Manual for the Ada Programming Language"; ANSI/
  232.           MIL-STD-1815A; United States Department of Defense; 1983.
  233.  
  234. [BOOCH]   "Software Engineering with Ada"; Grady Booch; Benjamin/
  235.           Cummings; 1983.
  236.  
  237. [BUHR]    "System Design with Ada"; R.J.A. Buhr; Prentice-Hall; 1984.
  238.  
  239. [FOLEY]   "Fundamentals of Interactive Computer Graphics"; J.D. Foley
  240.           and A. Van Dam; Addison-Wesley; 1982.
  241.  
  242. [GKS]     "Information Processing Systems Computer Graphics Graphical
  243.           Kernel System (ANS GKS)"; X3H3/83-25r3; 1984.
  244.  
  245. [HOPGOOD] "Introduction to the Graphical Kernel System"; Hopgood, Duce,
  246.           Gallop, and Sutcliffe; Academic Press; 1983.
  247.  
  248. [USER]    "Graphic Ada Designer User's Manual"; SYSCON Corporation;
  249.           1985.
  250.  
  251. <FF>
  252.  
  253. 2.  ALGORITHMS, DATA STRUCTURES, AND FUNCTIONAL REQUIREMENTS
  254.  
  255. The GAD is designed to use the capabilities of a color bit-mapped
  256. graphics terminal to build graphic representations of Ada program
  257. structures.  This tool will make use of available advanced graphics
  258. hardware features, such as windowing, cursor control device input,
  259. internal memory and graphic segment manipulation capabilities, to
  260. provide an efficient interactive graphics environment. 
  261.  
  262. The GAD is hosted on a VAX*, using the VMS* operating system,
  263. and is written in Ada.  The initial program development was
  264. performed using the TeleSoft Ada compiler (Version 1.5), and the
  265. program was transitioned to DEC* Ada approximately midway through
  266. the development phase.  The program is written in machine and
  267. compiler independent Ada, and is only dependent on the graphics
  268. terminal and printer used, and these dependencies are localized
  269. within the code.  The interaction of GAD with the user, host
  270. operating system, file system, graphics terminal and printer
  271. is illustrated in Figure 2-1. 
  272.  
  273. The design diagrams developed using GAD are stored in a tree-like
  274. representation form maintained by GAD and preserved in a file
  275. structure.  GAD uses the CRT to provide a "window" onto the OODD
  276. with the capability of pan and zoom. At standard zoom (ie. no
  277. magnification) the user can view an entire design diagram.  At
  278. maximum zoom, approximately 6% of the diagram will be displayed in
  279. the window. 
  280.  
  281.                              VAX/VMS HOST
  282.            ---------------------------------------------------
  283.            |                     GAD                         |
  284.            |         -----------------------------------     |
  285.            |         | Functional  | Memory Resident   |     |
  286.            |         | Modules     | Tree Based Forms  |     |
  287.            |         -----------------------------------     |
  288.            |         |  Virtual_Terminal_ |  GKS_      |     |
  289.            |         |     Interface      |   Prime    |     |
  290.            |         -----------------------------------     |
  291.            |         |     Ada Runtime System &        |     |
  292.            |         |      Predefined Packages        |     |
  293.            |         -----------------------------------     |
  294.            ---------------------------------------------------
  295.   (* Keyboard &           ^      |    |     ^
  296.    Cursor Control Device) |      |    |     |
  297.       User Input *  ------+      |    |     +---> Design File
  298.    Graphics Output  <------------+    +---------> PDL File
  299.           |
  300.           v
  301.    Graphics Hardcopy
  302.  
  303.                        Figure 2.1-1 GAD Interfaces
  304.  
  305. * DEC, VAX, and VMS are trademarks of the Digital Equipment Corp.
  306.  
  307. 2.1  Functional Requirements
  308.  
  309. The basic functions of GAD fall into four (4) major categories. The
  310. Graphics Design functions which provide the capability to create,
  311. display and modify OODD diagrams on the graphics terminal; the PDL
  312. Production functions provide the capability to extract the
  313. necessary syntax and semantic information from the OODD Syntax Tree
  314. data structure and generate PDL text files;  the Storage Management
  315. functions which provide for the automatic creation of, and access
  316. to GAD files;  and the MMI functions provide the user interface
  317. through which the designer orchestrates all GAD operations. 
  318.  
  319. 2.1.1    Graphics Design Functions
  320.  
  321. GAD provides a graphics design capability which consists of
  322. creating, deleting, and editing OODDs formed of entities
  323. representing Ada structures (e.g., packages, subprograms, tasks, or
  324. bodies), and connections which represent relationships between
  325. entities.  Strict Ada (PDL) syntax and semantics to the appropriate
  326. level of detail will be enforced in the graphs at the completion of
  327. each operation.  The graphics design capabilities will be in
  328. accordance with the Ada Graphic Notation conventions (described in
  329. detail in Section 3 of the GAD User's Manual [USER]). 
  330.  
  331. The minimum graphics information required for each entity is its
  332. size and position on the graph.  This information, and all other
  333. required graphics information, is stored in the Graph_Tree data
  334. structure described in Section 2.2.  The GAD approach is to use
  335. the terminal's hardware capabilities to simplify user selection,
  336. movement, and deletion operations.  This requires the maintenance
  337. of the graphic segment identifiers corresponding to each entity in
  338. the design (see Section 2.3.1). 
  339.  
  340. 2.1.2    Ada PDL Production Functions
  341.  
  342. GAD provides a command to generate the PDL corresponding to the
  343. current OODD.  The program generates the PDL and places it in an
  344. ASCII text file of the name "<Session File Name>.<PDL File
  345. Extension>". 
  346.  
  347. The Ada PDL that is produced will be syntactically correct and
  348. compilable, if context and visibility clauses (with and use
  349. statements) are added for the SUPPORT_PACKAGE documented in the GAD
  350. User's Manual (this is a selectable option).  For PDL generation,
  351. the general guideline will be to generate as much code as possible
  352. and permit the user to delete what is not needed. The code produced
  353. will be a mix of Ada and embedded English comment statements. 
  354.  
  355. Generation of the PDL requires information on each entity for which
  356. code is to be generated.  This information includes 1) the name, 2)
  357. the enclosing scope, 3) the type of entity, 4) a list of what it
  358. encloses, 5) it's relationship with other entities including
  359. whether it is exported, and 6) miscellaneous entity specific
  360. information (e.g., generic status). 
  361.  
  362. The basic syntax information is provided in a tree-like arrangement
  363. of the structures described in Section 2.2. Walking the tree to
  364. detect all references to particular entity (node) can be
  365. excessively time consuming, and for this reason, the basic Syntax_Tree
  366. is enhanced to include back pointers for each possible relationship
  367. (including parent-child). 
  368.  
  369. 2.1.3    File Management Functions
  370.  
  371. GAD provides mechanisms to save and restore graphs between
  372. invocations of the tool.  The necessary graphics, syntax, and 
  373. semantic information is saved in a file, one graph per file.  There
  374. are no relationships maintained by GAD between files, although a
  375. user may create a series of graphs depicting the evolution of a
  376. design. 
  377.  
  378. The PDL text file is an output-only structure from the perspective
  379. of the GAD tool.  There are no editing capabilities provided with
  380. which to alter this file.  The file is created from the OODD data
  381. structures, and the PDL file is a standard text file (created via
  382. TEXT_IO) which can be accessed by source line editors or word
  383. processors, print utilities and Ada compiler(s) hosted on the
  384. system. 
  385.  
  386. 2.1.4    MMI Functions
  387.  
  388. The GAD MMI provides an efficient means for designing Ada OODDs. 
  389. The MMI approach is predicated on utilizing the full capabilities
  390. of the graphics terminal (including color bit-mapped graphics, and
  391. cursor control device ). The basic MMI goals are itemized below as:
  392.  
  393.     o     Minimize keyboard interaction
  394.     o    Maximize use of cursor control device
  395.     o     Support pick and move operations at terminal
  396.         o     Implement drawing using cursor control device to 
  397.                 mark graph points
  398.     o     Provide menu support for 'pickable' command icons
  399.         o     Provide quick response by using the terminal's 
  400.                 internal memory and segment operation capabilities
  401.  
  402.  
  403. 2.2  Data Structures
  404.  
  405. The problem posed to GAD was to formulate a major data structure
  406. design that: stores the graphic data needed to generate and
  407. manipulate the OODD graphic symbols;  provides a correlation
  408. between the graphics data and the Ada language structure it
  409. represents; maintains the interrelationshps (e.g. scoping, call
  410. dependencies and data dependencies) between entities; and stores
  411. the required syntax and semantic information for each Ada language
  412. structure. 
  413.  
  414. The data structures utilized by GAD capture the Ada semantic 
  415. and graphical information associated with the graph as they are
  416. created, edited and positioned within the design diagram.  The data
  417. structures must support: 
  418.  
  419.      o     PDL Generation
  420.      o  Regeneration of graphs between sessions
  421.      o     Detection of severed connections (due to move or delete operations)
  422.      o     Syntax and semantic information verification
  423.  
  424. To be able to perform the required functions, the data structure
  425. must support the ability to trace relations in multiple directions,
  426. such as parent-child and caller-callee. 
  427.  
  428. The design utilized specifies two different but related
  429. structures:  Syntax_Tree and Graph_Tree structures.  Figure 2.2-1
  430. presents a structural overview of the major data structures.  The
  431. Syntax_Tree is comprised of two substructures, Tree Node and
  432. List Node structures.  The Tree Node structures contain basic
  433. information about the entity they represent, such as name, scope
  434. and generic attributes (if applicable).  Each Tree Node contains a
  435. set of pointers to the various List Node structures which contain
  436. lists of information unique to the entity with which it is
  437. associated.  The types of List Node structures that will be
  438. maintained are: 
  439.  
  440.     o  Contained_Lists
  441.     o  Callee_Lists
  442.     o  Data_Connect_Lists
  443.     o  Entry_Lists
  444.     o  Imported_Lists
  445.     o  Exported_Lists
  446.  
  447. The Graph_Tree structures consist of nodes which contain the basic
  448. graphic information about an entity, such as location and size. 
  449. The Syntax_Tree and Graph_Tree structures both contain different
  450. kinds of information about the objects being diagramed. 
  451.  
  452. It should be noted that the data structure figure is a simplified
  453. representation.  In actuality, the various nodes and associated
  454. entity pointers are multi-threaded (for example, there exist
  455. forward and backward pointers between the nodes of the Syntax_Tree
  456. and Graph_Tree).  The structure actually takes on a more n-dimensional
  457. characteristic which is not representable on two-dimensional media.
  458.  
  459. <FF>
  460.                        SYNTAX_TREE                          GRAPH_TREE
  461.      ------------------------------------------------       -----------
  462.      |    Tree Nodes  +------------------------------------>| Node 1  |
  463.      |    ----------  |              List Nodes     |       |         |
  464.      |    |  Root  |  |             -----------     |       |---------|
  465.      | +->|        |--|------------>|         |     |   +-->| Node 2  |
  466.      | |  ----------  |           ----------- |--+  |   |   |         |
  467.      | |              | +-------->|         |--  |  |   |   |---------|
  468.      | |  ----------  | |       ----------- |--+ |  |   |   |         |
  469.      | +--| Node 1 |--+ |       |         |--  | |  |   |   |         |
  470.      | +->|        |----+     ----------- |    | |  |   |   |---------|
  471.      | |  ----------          |         |--    | |  |   |   |         |
  472.      | |      ^               |         |      | |  |   |   |    :    |
  473.      | |      |               -----------      | |  |   |   |    :    |
  474.      | |      +----------------------------------+  |   |   |    :    |
  475.      | |                                       |    |   |   |    :    |
  476.      | |                                       |    |   |   |    :    |
  477.      | |  ----------                           |    |   |   |         |
  478.      | |  | Node n |<--------------------------+    |   |   |---------|
  479.      | +__|        |--------------------------------|---+   | Node m  |
  480.      |    ----------                                |       |         |
  481.      |                                              |       -----------
  482.      ------------------------------------------------
  483.  
  484.                 Figure 2.2-1.  Major Data Structure Overview
  485.  
  486.  
  487. The primary data structure of the GAD is the Syntax Tree, whichs
  488. stores the syntactic and semantic information which describes the
  489. Ada program depicted in the OODD under construction.  This data
  490. structure also contains all the necessary graphic information
  491. (through pointers to nodes of the Graph Tree) needed to manipulate
  492. and recreate the graphic representation of an OODD.  The following
  493. extract from the TREE_DATA package illustrates the construction and
  494. function of this data structure. 
  495.  
  496.  
  497.    package TREE_DATA is
  498.    -------------------------------------------------------------------------
  499.    --
  500.    -- This package provides the declarations and objects for the 
  501.    -- Graph Tree which holds all the graphical, syntax, and
  502.    -- semantic information required by the program.  The tree contains
  503.    -- TREE, LIST and GRAPH nodes.  The TREE nodes represent Ada 
  504.    -- entities (structures) and are connected in a hierarchal order (tree)
  505.    -- indicating the scope of each entity.  The LIST nodes are used to
  506.    -- store relationships (e.g., context clauses) and annotations (e.g.,
  507.    -- exported type declarations).  The GRAPH nodes contain the graphical
  508.    -- data associated with each TREE node.
  509.    --
  510.    -------------------------------------------------------------------------
  511.    
  512.       ----------------------------------------------------------------------   
  513.       --  All of the Ada entities, one for each type of TREE node.
  514.       ----------------------------------------------------------------------   
  515.       type ENTITY_TYPE is (UNUSED,
  516.                            ROOT,
  517.                            TYPE_VIRTUAL_PACKAGE,
  518.                            TYPE_PACKAGE,        
  519.                            TYPE_PROCEDURE,      
  520.                            TYPE_FUNCTION,       
  521.                            TYPE_TASK,           
  522.                            TYPE_ENTRY_POINT,
  523.                            TYPE_BODY,
  524.                            IMPORTED_VIRTUAL_PACKAGE,
  525.                            IMPORTED_PACKAGE,
  526.                            IMPORTED_PROCEDURE,
  527.                            IMPORTED_FUNCTION,
  528.                            EXPORTED_PROCEDURE,
  529.                            EXPORTED_FUNCTION,
  530.                            EXPORTED_ENTRY_POINT,
  531.                            EXPORTED_TYPE,
  532.                            EXPORTED_OBJECT,
  533.                            EXPORTED_EXCEPTION,
  534.                            CONNECTION_BY_CALL,
  535.                            CONNECTION_FOR_DATA);
  536.    
  537.    
  538.  
  539.          -- this was extracted from package GRAPHICS_DATA 
  540.          ----------------------------
  541.          -- Graphics data declaration
  542.          ----------------------------
  543.          type GRAPHICS_DATA_TYPE is
  544.             record
  545.                WINDOW        : WINDOW_TYPE := GRAPH_VIEW_PORT ;
  546.                LABEL_SEG_ID  : GKS_SPECIFICATION.SEGMENT_NAME := NULL_SEGMENT ;
  547.                LABEL2_SEG_ID : GKS_SPECIFICATION.SEGMENT_NAME := NULL_SEGMENT ;
  548.                SEGMENT_ID    : GKS_SPECIFICATION.SEGMENT_NAME := NULL_SEGMENT ;
  549.                LOCATION      : POINT := NULL_POINT ;
  550.                SIZE          : POINT := NULL_POINT ;
  551.                COLOR         : COLOR_TYPE := BLACK ;
  552.             end record ;
  553.  
  554.  
  555.       ----------------------------------------------------------------------   
  556.       --  The graphical data for each tree node, stored in the 
  557.       --  GRAPH_DATA_ARRAY.  A null OWNING_TREE_NODE indicates that
  558.       --  the node is unused.
  559.       ----------------------------------------------------------------------   
  560.       type GRAPH_NODE_TYPE is
  561.          record
  562.             OWNING_TREE_NODE : TREE_NODE_ACCESS_TYPE := NULL_POINTER;
  563.             DATA             : GRAPHICS_DATA.GRAPHICS_DATA_TYPE;
  564.          end record;
  565.    
  566.    
  567.       ----------------------------------------------------------------------   
  568.       --  The LINE type is used to define connecting lines between
  569.       --  graphic entities (Call, Export, and Ada 'Use' connections).
  570.       --  A line is a series of points which define line segments
  571.       --  comprising the connection line.
  572.       ----------------------------------------------------------------------   
  573.  
  574.  
  575.       ----------------------------------------------------------------------   
  576.       --  The various LISTS occuring in the tree are declared below.
  577.       --  The list format to be used to create specific kinds of lists.
  578.       --  A doubly linked list is required for forward and back tracing.
  579.       ----------------------------------------------------------------------   
  580.       --  The lists contained in a Tree Node.  The order of the Lists
  581.       --  is the order of the List scan during a tree walk.
  582.  
  583.       type LIST_TYPE is (START,          -- for starting node list scans
  584.                          CONTAINED_LIST,
  585.                          CALLEE_LIST,
  586.                          DATA_CONNECT_LIST,
  587.                          ENTRY_LIST,
  588.                          EXPORTED_LIST,
  589.                          IMPORTED_LIST,
  590.                          NULL_LIST);
  591.  
  592.  
  593.       ----------------------------------------------------------------------   
  594.       --  The definition of the MEMBERSHIP list.
  595.       ----------------------------------------------------------------------   
  596.       -- The MEMBERSHIP list exists to maintain a back pointer for
  597.       -- relations established by other lists.  The TREE_OPS package
  598.       -- should be the only manipulator of this list.
  599.       --
  600.       -- The access type for the MEMBERSHIP list is implemented as an
  601.       -- index into LIST array.  This is done to minimize the number
  602.       -- of node types to be handled.
  603.  
  604.  
  605.       ----------------------------------------------------------------------   
  606.       --  The definition of the TREE node structure.  This data structure
  607.       --  is combined using the LIST data structure to form a DIANA like
  608.       --  syntax tree which stores the syntactical and semantic information
  609.       --  concerning the Ada program which is represented by the OODD under
  610.       --  construction.  A predefined Root Node is as the starting point
  611.       --  of each Tree.
  612.       ----------------------------------------------------------------------   
  613.       type TREE_NODE_TYPE (NODE_TYPE: ENTITY_TYPE := UNUSED) is
  614.       record
  615.          NAME : NAME_TYPE := NULL_NAME;  -- the name of this node
  616.          PARENT : TREE_NODE_ACCESS_TYPE := NULL_POINTER;  -- the parent
  617.          GRAPH_DATA : GRAPH_NODE_ACCESS_TYPE := NULL_POINTER; 
  618.          -------------------------------------------------------------------
  619.          -- A list of all list nodes pointing to this node
  620.          -------------------------------------------------------------------
  621.          MEMBERSHIP : MEMBERSHIP_LIST_TYPE := NULL_POINTER;
  622.          -------------------------------------------------------------------
  623.          -- The Node Type specific data which includes lists pointing 
  624.          -- to connected, contained, or related nodes, and which includes
  625.          -- semantic information concerning the current node (e.g.,
  626.          -- generic status of a subprogram).
  627.          -------------------------------------------------------------------
  628.          case NODE_TYPE is
  629.          when ROOT | TYPE_VIRTUAL_PACKAGE | TYPE_PACKAGE |
  630.               TYPE_PROCEDURE | TYPE_FUNCTION | TYPE_TASK =>
  631.             CONTAINED_ENTITY_LIST : CONTAINED_ENTITY_LIST_TYPE := NULL_POINTER;
  632.             case NODE_TYPE is      
  633.             when TYPE_VIRTUAL_PACKAGE | TYPE_PACKAGE |
  634.                  TYPE_PROCEDURE | TYPE_FUNCTION | TYPE_TASK =>
  635.                PROLOGUE_PTR : PROLOGUE_NODE_ACCESS_TYPE := NULL_POINTER;
  636.                BODY_PTR : TREE_NODE_ACCESS_TYPE := NULL_POINTER;
  637.                DATA_CONNECT_LIST : DATA_CONNECT_LIST_TYPE := NULL_POINTER;
  638.                case NODE_TYPE is
  639.                when TYPE_VIRTUAL_PACKAGE | TYPE_PACKAGE |
  640.                     TYPE_PROCEDURE | TYPE_FUNCTION =>
  641.                   GENERIC_STATUS : GENERIC_STATUS_TYPE := NOT_GENERIC;
  642.                   CU_INSTANTIATED : NAME_TYPE := NULL_NAME;
  643.                   case NODE_TYPE is      
  644.                   when TYPE_VIRTUAL_PACKAGE | TYPE_PACKAGE =>
  645.                      EXPORTED_LIST : EXPORTED_LIST_TYPE := NULL_POINTER;
  646.                      IMPORTED_LIST : IMPORTED_LIST_TYPE := NULL_POINTER;
  647.                   when TYPE_FUNCTION | TYPE_PROCEDURE =>
  648.                      HAS_PARAMETERS : BOOLEAN := FALSE;
  649.                   when others =>
  650.                      null;
  651.                   end case;
  652.                when TYPE_TASK =>
  653.                   TASK_STATUS : TASK_STATUS_TYPE := NORMAL_TASK;
  654.                   ENTRY_LIST : ENTRY_LIST_TYPE := NULL_POINTER;
  655.                when others =>
  656.                   null;
  657.                end case;
  658.             when others =>
  659.                null ;
  660.             end case ;
  661.          when TYPE_ENTRY_POINT =>
  662.             IS_GUARDED : BOOLEAN := FALSE; -- for task entry points
  663.             WITH_PARAMETERS : BOOLEAN := FALSE;
  664.          when TYPE_BODY =>
  665.             CALLEE_LIST : CALLEE_LIST_TYPE := NULL_POINTER;
  666.          when EXPORTED_PROCEDURE | EXPORTED_FUNCTION |
  667.               EXPORTED_ENTRY_POINT | EXPORTED_TYPE | EXPORTED_OBJECT |
  668.               EXPORTED_EXCEPTION | CONNECTION_BY_CALL | 
  669.               CONNECTION_FOR_DATA =>
  670.             CALL_VARIETY : CALL_CONNECTION_TYPE := NO_CONNECTION;
  671.             CONNECTEE : TREE_NODE_ACCESS_TYPE := NULL_POINTER ;
  672.             LINE : LINE_TYPE := NULL_LINE ;
  673.          when others =>
  674.             null;
  675.          end case;
  676.       end record;
  677.  
  678.    
  679.       ----------------------------------------------------------------------   
  680.       -- The Primary array declarations
  681.       ----------------------------------------------------------------------   
  682.       GRAPH : GRAPH_ARRAY (1..MAX_GRAPH_NODES);
  683.       LIST  : LIST_ARRAY (1..MAX_LIST_NODES);
  684.       TREE  : TREE_ARRAY (1..MAX_TREE_NODES);
  685.       PROLOGUE : PROLOGUE_ARRAY (1..MAX_PROLOGUE_NODES);
  686.  
  687.       ----------------------------------------------------------------------   
  688.       -- The Root Node of the TREE
  689.       ----------------------------------------------------------------------   
  690.       ROOT_NODE : constant TREE_NODE_ACCESS_TYPE := TREE'first ;
  691.  
  692.    end TREE_DATA;
  693.  
  694.  
  695. 2.3  Algorithms
  696.  
  697. 2.3.1  Graph Creation
  698.  
  699. The GAD is an interactive graphics editor used in the design
  700. process to construct and modify graphic representations of Ada
  701. program structures. The tool makes use of terminal hardware
  702. features, such as segment attribute manipulation, to provide an
  703. efficient MMI.  The utilization of these features to create graphs
  704. is described in the following paragraphs. 
  705.  
  706. Graphic operations performed by GAD are based on the concept
  707. of segments.  A segment is a logically related collection of
  708. graphics objects stored in terminal memory, which the terminal,
  709. and the GAD, manipulate as a single object.  The number of
  710. graphic objects which can be placed in a segment ranges from
  711. a single object to all the objects contained in the display.
  712. The operations which may be performed on a previously created
  713. segment are:
  714.  
  715.      - executing a segment transformation, which performs segment
  716.        translation ( movement ), scaling, and rotation;
  717.      - defining segment visibility, which determines whether or
  718.        not a segment is currently displayed;
  719.      - defining segment highlighting, which determines whether 
  720.        or not a segment is highlighted;
  721.      - defining segment priority, which determines the display
  722.        priority of a specified segment; and
  723.      - setting segment detectability, which defines whether or 
  724.        not a segment can be selected by a pick input device.
  725.  
  726. GAD creates and manipulates segments to support the MMI (e.g., menu
  727. icons), and to support the implementation of operator selected
  728. commands.  The MMI virtual package determines which segment(s) must
  729. be created.  The graphic entity contained in the segment may be
  730. (among others) a menu icon, a text label, or package icon. 
  731.  
  732. The request to create the graphic entity is passed to the
  733. GRAPHICS_DRIVER, which utilizes the subprograms contained in
  734. the GKS_PRIME virtual package to create a segment, to build
  735. the requested graphic entity in the segment, and to close the
  736. segment.  During the process of segment creation the GKS_PRIME
  737. package utilizes the TERMINAL_ACCESS package to generate the
  738. terminal specific command sequences.
  739.  
  740. The identifier associated with the created segment is returned
  741. to the MMI virtual package.  If manipulations of the created
  742. entity are required then the operations are performed on the
  743. segment specified by the segment identifier.
  744.  
  745.  
  746.                     ------------------------
  747.                     |  MMI VIRTUAL PACKAGE |
  748.                     ------------------------
  749.                           |          ^
  750.     Create specified      |          |     Segment
  751.     graph entity          |          |     Identifier
  752.                           |          |
  753.                           v          |
  754.                  -----------------------------------
  755.                  | GRAPHICS_DRIVER VIRTUAL PACKAGE |
  756.                  -----------------------------------
  757.                           |
  758.     Open specified        |
  759.     segment               |
  760.                           |
  761.     Draw graph entity     |
  762.                           |
  763.     Close specified       |
  764.     segment               |
  765.                           |
  766.                           v
  767.             ------------------------------------
  768.             |        GKS_PRIME PACKAGE         |
  769.             | ( in GKS_PRIME VIRTUAL PACKAGE ) |
  770.             ------------------------------------
  771.                           |
  772.     Terminal Level        |
  773.      operations           |
  774.                           |
  775.                           V
  776.             ------------------------------------
  777.             |      TERMINAL_ACCESS PACKAGE     |
  778.             | ( in GKS_PRIME VIRTUAL PACKAGE ) |
  779.             ------------------------------------
  780.                           |
  781.     Terminal specific     |
  782.      command sequences    |
  783.                           V
  784.                  ---------------------
  785.                  | Graphics Terminal |
  786.                  ---------------------
  787. <FF>
  788. 2.3.2  OODD Editing
  789.  
  790. The principal goal of the GAD is to support the interactive editing
  791. of OODDs which describe the semantic architecture of an Ada
  792. program.  To accomplish this task, the MMI of this program is
  793. required to perform a series of functions which 
  794.  
  795.      1) Obtain and validate the necessary information required to 
  796.         describe the syntax and semantics of an Ada program.  This
  797.         includes name, scope, and interrelationships.
  798.  
  799.      2) Create and store the graphically related information
  800.         needed to generate the graphical representation of the
  801.         Ada program being designed.  This includes location
  802.         and segment (see the preceding Section 2.3.1) information.
  803.  
  804. The implementation of these two functions is decidedly intertwined. 
  805. The semantic information (e.g., scoping relationship) of Ada 
  806. entities being created is derived from their location on the 
  807. graphical representation.  Conversely, the location information is 
  808. stored in a tree form which parallels the semantic relationships of 
  809. the entities.
  810.  
  811. The interactive editing of OODDs consist of three primary types of 
  812. operations.  These operations are:
  813.  
  814.      1) Creation of Entities and their relationships including
  815.         Connections.
  816.  
  817.      2) Modification of Entity attributes.
  818.  
  819.      3) Deletion of Entities and Connections.
  820.  
  821. Each of these operations involve common functions which include:
  822. interaction with the GAD User, modification of the primary GAD data
  823. structure (see Section 2.2), and utilization of the target graphics
  824. terminal which results in the alteration of the OODD displayed on
  825. it.  The steps involved in creating a new entity on a OODD are
  826. shown in Table 2.3-1. 
  827. <FF>
  828.  
  829.           Table 2.3-1.  Steps in Creating a New Entity
  830.           --------------------------------------------
  831.  
  832.      - Obtain all parameter values using submenus.  This includes
  833.        information on generic, parameter, and entry point status.
  834.  
  835.      - Obtain the point(s) which describe the scope and location
  836.        of the entity to be created.  During multi-point processing,
  837.        insure that both points have the same scope.  Allow the user 
  838.        to quit the operation by selecting the ABORT icon.
  839.  
  840.      - Validate the scope of the points obtained.  If an invalid
  841.        scope was selected then notify the user and abort the 
  842.        operation.
  843.  
  844.      - Create the Tree Node to be used to store the data concerning
  845.        the entity being created.  Insert the Node in the tree to
  846.        reflect its scope.
  847.  
  848.      - Create the Graph Node to be used to store the graphical
  849.        data associated with the entity being created.  Establish
  850.        the linkage between the Graph Node and the Tree Node.
  851.        Place the location information from the points previously
  852.        obtained in the Node.
  853.  
  854.      - If a primary entity is being created (e.g., package or 
  855.        subprogram), then draw a figure representing the entity and
  856.        store the segment number created in the Graph Node.
  857.  
  858.      - Obtain the name of the entity being created if one is 
  859.        required.  Continue name processing until the user enters
  860.        a name having a valid syntax for an Ada identifier.  Add
  861.        the name to the Tree Node.
  862.  
  863.      - Label the figure with the name, and store the segment 
  864.        number in the Graph Node.  If the entity is an import 
  865.        or export, then the label constitutes the primary figure.
  866.  
  867.      - Obtain the prologue information for primary entities.  
  868.        Create a Prologue Node and place the information in it.
  869.        Establish the linkage between the Prologue Node and the
  870.        Tree Node.
  871.  
  872.      - Obtain any other required name information (e.g., name of
  873.        generic unit being instantiated).  Continue name processing 
  874.        until the user enters a name having a valid syntax for an 
  875.        Ada identifier.
  876.  
  877.      - Label the figure with any other name information, and store
  878.        the segment numbers in the Graph Node.
  879.  
  880. The steps involved in modification of Entities are similar to the
  881. steps in creation.  Once an entity has been selected for
  882. modification, GAD prompts the user for new values for the
  883. non-location type user entered information shown in Table 2.3-1.
  884. During modification operations however, the new information
  885. replaces the old information in existing nodes and no new nodes are
  886. created. 
  887.  
  888. The steps involved in deletion of Entities and Connections are much
  889. simpler.  Once an entity or connection has been identified for
  890. deletion by the user, GAD highlights what will be deleted and
  891. requests user confirmation of the delete operation.  If the
  892. deletion is confirmed, the highlighted portion of the OODD is erased
  893. and the various nodes released.  If the deletion is canceled the
  894. OODD is restored to its previous state.  The complexity of a delete
  895. operation is in determining what must be deleted to maintain the
  896. semantic integrity of the graph, and in correctly removing the
  897. various nodes without leaving any dangling pointers. 
  898.  
  899. 2.3.3  Ada PDL Generation
  900.  
  901. The package performing Ada PDL generation includes routines to
  902. generate PDL by walking the tree which contains the information
  903. describing the OODD currently being edited.  A two pass PDL
  904. generation algorithm is implemented by using two subprograms, one
  905. to generate the specifications for the PDL and the other to
  906. generate the bodies for the PDL.  Both subprograms use a recursive
  907. descent approach to generate the PDL, wherein each subprogram will
  908. perform the code generation by writing the PDL appropriate for the
  909. current node and using recursive invocations of itself to process
  910. its child nodes. 
  911.  
  912. The pseudo code (structure english language narrative) for the
  913. primary procedure used to generate the PDL follows.  For the 
  914. complete PDL see the file PDL_GEN_BODY.ADA.
  915.  
  916.  
  917.    procedure GENERATE_PDL ( PDL_FILE_NAME : in TREE_IO.FILENAME_TYPE ) is
  918.       --  
  919.       --  This procedure walks the current Graph Tree and emits the
  920.       --  corresponding Ada PDL in the file designated by the user.
  921.       --  The procedure expects that PDL_FILE_NAME is the name of
  922.       --  PDL file to be created.
  923.       --  
  924.    begin
  925.       -- create the PDL output file with TEXT_IO calls
  926.       declare
  927.          use TEXT_IO ;
  928.       begin
  929.          TEXT_IO.CREATE ( PDL_FILE ,
  930.                           OUT_FILE ,
  931.                           TREE_IO.COMPLETE_FILE_NAME ( PDL_FILE_NAME ,
  932.                                                        FILENAME_EXTENSION ) ) ;
  933.       end ;
  934.  
  935.       -- If write to screen was requested then initialize the screen.
  936.       if WRITE_PDL_TO_SCREEN then
  937.          INITIALIZE_SCREEN_DISPLAY ;
  938.       end if ;
  939.  
  940.       -- initialize the DECLARED array to show nothing yet declared
  941.       -- initialize the Indentation level and line length to
  942.       -- permit multiple invocations of GENERATE_PDL
  943.  
  944.       -- write the Support Package if that option was requested
  945.       if INCLUDE_SUPPORT_PACKAGE then
  946.          WRITE_SUPPORT_PACKAGE ;
  947.       end if ;
  948.  
  949.       -- starting from the ROOT_NODE, generate the PDL for the
  950.       -- specs of each contained entity
  951.       PTR := TREE(ROOT_NODE).CONTAINED_ENTITY_LIST;
  952.       while PTR /= NULL_POINTER loop
  953.          EMIT_SPECS (LIST(PTR).ITEM);
  954.          PTR := LIST(PTR).NEXT;
  955.       end loop;
  956.  
  957.       -- output blank line between the SPEC and BODY
  958.       NEW_LINE ;
  959.  
  960.       -- starting from the ROOT_NODE, generate the PDL for the
  961.       -- bodies of each contained entity
  962.       PTR := TREE(ROOT_NODE).CONTAINED_ENTITY_LIST;
  963.       while PTR /= NULL_POINTER loop
  964.          EMIT_BODIES (LIST(PTR).ITEM);
  965.          PTR := LIST(PTR).NEXT;
  966.       end loop;
  967.  
  968.       -- close the PDL file
  969.       TEXT_IO.CLOSE (PDL_FILE);
  970.  
  971.       -- terminate the PDL display of the screen
  972.       if WRITE_PDL_TO_SCREEN then
  973.          TERMINATE_SCREEN_DISPLAY ;
  974.       end if ;
  975.  
  976.    exception
  977.       when others =>
  978.          if TEXT_IO.IS_OPEN (PDL_FILE) then
  979.             -- write an error message indication unsuccessful completion
  980.             WRITE_LINE (" PDL generation unsuccessfully completed ");
  981.             -- close the PDL file
  982.             TEXT_IO.CLOSE (PDL_FILE);
  983.          else
  984.             raise;
  985.          end if;
  986.  
  987.    end GENERATE_PDL;
  988.  
  989. The PDL for the procedures used to generate the PDL for the 
  990. specifications and bodies is as follows:
  991.  
  992.  
  993.    ------------------------------------------------------------------------
  994.    --  The procedure to emit the PDL for the specifications
  995.    ------------------------------------------------------------------------
  996.    procedure EMIT_SPECS (NODE: in TREE_NODE_ACCESS_TYPE) is
  997.       --  This procedure emits the PDL for the spec of the current 
  998.       --  Tree node, and recursively invokes itself for contained
  999.       --  entities of the current node.
  1000.    begin
  1001.       -- Check if the current NODE is valid.
  1002.       -- Skip this Tree NODE if it has already been declared.
  1003.          case TREE(NODE).NODE_TYPE is
  1004.             when TYPE_VIRTUAL_PACKAGE | TYPE_PACKAGE =>
  1005.                -- Scan the IMPORTED_LIST and write the 'with's.
  1006.  
  1007.                -- Write the support package if not nested and the
  1008.                -- the user has requested it.
  1009.  
  1010.                -- If this declaration is generic, write the generic statement.
  1011.  
  1012.                -- Write the 'start' of the (virtual) package.
  1013.  
  1014.                -- If this is a generic instantiation then 
  1015.                   -- complete the declaration.
  1016.                   -- Write the prologue.
  1017.                else
  1018.                   -- Write a non generic declaration.
  1019.                   -- Write the prologue.
  1020.  
  1021.                   -- Scan the EXPORTED_LIST for visible types, objects,
  1022.                   -- and exceptions.
  1023.  
  1024.                   -- Scan the EXPORTED_LIST for remaining items, that is
  1025.                   -- packages, subprograms, and tasks.
  1026.  
  1027.                   -- Write the 'end' of the package specification.
  1028.                end if;
  1029.  
  1030.             when TYPE_PROCEDURE =>
  1031.                -- Write the support package if not nested and the
  1032.                -- the user has requested it.
  1033.  
  1034.                -- If this declaration is generic, write the generic statement.
  1035.  
  1036.                -- Write the subprogram declaration including the name.
  1037.  
  1038.                -- If this is a generic instantiation
  1039.                   -- Complete the generic instantiation.
  1040.                   -- Generic actual parameters currently not handled.
  1041.                else 
  1042.                   -- If the subprogram has calling parameters then 
  1043.                   -- write them.
  1044.                end if ;
  1045.  
  1046.                -- Write the end of the procedure declaration.
  1047.                -- Write the prologue.
  1048.  
  1049.             when TYPE_FUNCTION =>
  1050.                -- Write the support package if not nested and the
  1051.                -- the user has requested it.
  1052.  
  1053.                -- If this declaration is generic, write the generic statement.
  1054.                -- Write the function declaration including the name.
  1055.  
  1056.                -- If this is a generic instantiation
  1057.                   -- then complete the instantiation.
  1058.                   -- Generic actual parameters currently not handled.
  1059.                else
  1060.                   -- If the function has calling parameters then write them.
  1061.                   -- Write the return part (not needed for generic inst.).
  1062.                end if ;
  1063.  
  1064.                -- Write the end of the function declaration.
  1065.                -- Write the prologue.
  1066.  
  1067.             when TYPE_TASK =>
  1068.                -- Write the task declarative statement.
  1069.                -- Write the prologue.
  1070.  
  1071.                -- Scan the ENTRY_LIST for the entry points.
  1072.                   -- Write an entry statement for each entry found.
  1073.                   -- Write calling parameters if they exist.
  1074.                   -- Mark the node as declared.
  1075.                   -- Process the next imported item.
  1076.                end loop;
  1077.  
  1078.                -- Write the 'end' of the task declaration.
  1079.  
  1080.             when TYPE_BODY =>
  1081.                -- No body code placed in the specs.
  1082.                null;
  1083.  
  1084.             when EXPORTED_PROCEDURE .. EXPORTED_EXCEPTION =>
  1085.                -- If this Exported declaration is Connected to
  1086.                -- the exported item of a contained package, then 
  1087.                -- all the exported items of that package
  1088.                -- must be made visible.
  1089.  
  1090.                   -- If connected to another export then declare the
  1091.                   -- Parent.
  1092.                   else
  1093.                      -- Write declaration using actual declaration.
  1094.                      EMIT_SPECS (TREE_PTR);
  1095.                   end if;
  1096.  
  1097.                else
  1098.                   -- Process all non-connected exports.
  1099.                   case TREE(NODE).NODE_TYPE is
  1100.                      when EXPORTED_PROCEDURE =>
  1101.                         -- Write the procedure declaration.
  1102.                      when EXPORTED_FUNCTION =>
  1103.                         -- Write the function declaration.
  1104.                      when EXPORTED_TYPE =>
  1105.                         -- Write the type declaration.
  1106.                      when EXPORTED_OBJECT =>
  1107.                         -- Write the object declaration.
  1108.                      when EXPORTED_EXCEPTION =>
  1109.                         -- Write the exception declaration.
  1110.                      when others =>
  1111.                         null;
  1112.                   end case;
  1113.                   -- Mark valid CONNECTEEs as declared.
  1114.                   end if;
  1115.                end if;
  1116.  
  1117.             when others =>
  1118.                -- Should not occur here!  Send an error message to the
  1119.                -- user and attempt to continue.
  1120.          end case;
  1121.          -- Mark the current NODE as declared.
  1122.          -- Reset the nesting level.
  1123.       end if;
  1124.    end EMIT_SPECS;
  1125.  
  1126.    ------------------------------------------------------------------------
  1127.    --  The procedure to emit the PDL for the bodies
  1128.    ------------------------------------------------------------------------
  1129.    procedure EMIT_BODIES (NODE: in TREE_NODE_ACCESS_TYPE) is
  1130.    --  This procedure emits the PDL for the body of the current 
  1131.    --  Tree node, and recursively invokes itself for contained
  1132.    --  entities of the current node.
  1133.    begin
  1134.       -- check if NODE is valid
  1135.       -- Increment the nesting level to show inside a body.
  1136.  
  1137.       case TREE(NODE).NODE_TYPE is
  1138.          when TYPE_VIRTUAL_PACKAGE | TYPE_PACKAGE =>
  1139.             -- Skip this node if it is a Generic Instantiation.
  1140.                -- If the package is not already declared then declare it now.
  1141.  
  1142.                -- Write the 'WITH' statements of visible units.
  1143.                -- Write the 'start' of the package body.
  1144.  
  1145.                -- Scan the DATA_CONNECT_LIST and write the 'use's.
  1146.  
  1147.                -- Scan the CONTAINED_ENTITY_LIST for undeclared components,
  1148.                -- processing generic declarations in the first pass, and 
  1149.                -- all others in the second pass.
  1150.  
  1151.                -- Loop and process the non-declared entities which are not 
  1152.                -- generic declarations.
  1153.  
  1154.                -- Scan the EXPORTED_LIST for visible subprograms and
  1155.                -- packages which are not connected to other entities
  1156.                -- and hence should be declared as 'separate'
  1157.  
  1158.                -- Scan the CONTAINED_ENTITY_LIST and write the nested 
  1159.                -- components.
  1160.  
  1161.                -- If a body exists then process for possible call connections.
  1162.  
  1163.                -- Write the 'end' of the package body.
  1164.             end if;
  1165.  
  1166.          when TYPE_PROCEDURE =>
  1167.             -- Skip this node if it is a Generic Instantiation.
  1168.  
  1169.             -- Write the subprogram declaration.
  1170.             -- If the procedure has calling parameters then write them.
  1171.  
  1172.             -- Begin writing the declarative section.
  1173.             -- Write the prologue.
  1174.  
  1175.             -- Scan the DATA_CONNECT_LIST and write the 'use's.
  1176.  
  1177.             -- Scan the CONTAINED_ENTITY_LIST and write the nested components.
  1178.  
  1179.             -- End the declarative section.
  1180.  
  1181.             -- If a body exists then process for possible call connections.
  1182.                EMIT_BODIES (TREE(NODE).BODY_PTR);
  1183.             else
  1184.                -- Write the 'begin' followed by a null statement to permit
  1185.                -- compilation.
  1186.             end if;
  1187.  
  1188.             -- Write the 'end' statement.
  1189.  
  1190.          when TYPE_FUNCTION =>
  1191.             -- Skip if this node is a Generic Instantiation.
  1192.  
  1193.             -- Write the function declaration.
  1194.             -- If the procedure has calling parameters then write them.
  1195.             -- Write the return portion of the declaration.
  1196.  
  1197.             -- Begin writing the declarative section.
  1198.             -- Write the prologue.
  1199.  
  1200.             -- Scan the DATA_CONNECT_LIST and write the 'use's.
  1201.  
  1202.             -- Scan the CONTAINED_ENTITY_LIST and write any nested components.
  1203.             -- End the declarative section.
  1204.  
  1205.             -- If a body exists then process for possible call connections.
  1206.                EMIT_BODIES (TREE(NODE).BODY_PTR);
  1207.             else
  1208.                -- Write the 'begin' statement.
  1209.             end if;
  1210.  
  1211.             -- Write the return statement to permit compilation.
  1212.             -- Write the 'end' statement.
  1213.  
  1214.          when TYPE_TASK =>
  1215.             -- Write the task declarative statement.
  1216.  
  1217.             -- Begin writing the declarative section.
  1218.  
  1219.             -- Write the prologue.
  1220.  
  1221.             -- Scan the DATA_CONNECT_LIST and write the 'use's.
  1222.  
  1223.             -- Scan the CONTAINED_ENTITY_LIST and write any nested components.
  1224.  
  1225.             -- If a body exists then process for possible call connections.
  1226.                EMIT_BODIES (TREE(NODE).BODY_PTR);
  1227.             else
  1228.                -- Write the 'begin' statement.
  1229.             end if;
  1230.  
  1231.             -- Start writing the executable portion of the task body.
  1232.             -- Scan the ENTRY_LIST for the entry points and write
  1233.             -- the corresponding accept statements.
  1234.                -- Write a select structure if one or more entry points exists.
  1235.                   -- Write a guard condition if the entry point is guarded.
  1236.                   -- Write calling parameters if the entry point has them.
  1237.             else
  1238.                -- Write a null statement to permit compilation.
  1239.                WRITE_LINE ("null ;") ;
  1240.             end if;
  1241.             -- Write the 'end' of the task declaration.
  1242.  
  1243.          when TYPE_BODY =>
  1244.             -- Output the start of the body
  1245.             -- Write the code for calls by traversing CALLEE_LIST.
  1246.  
  1247.                -- If no calls exist, then write a null body.
  1248.  
  1249.                   -- If this call is for conditional or timed 
  1250.                   --  then write the first part of this call type.
  1251.  
  1252.                   -- Callee List points to connections.
  1253.  
  1254.                   -- If a connection is to an exported entity, check if it
  1255.                   -- is connected to an inner level.
  1256.  
  1257.                   -- For function calls write a variable for the return value.
  1258.  
  1259.                   -- Write the name of the subprogram called.
  1260.  
  1261.                   -- If this call is conditional or timed then
  1262.                   --  write the closing part.
  1263.  
  1264.                   -- Process next call in the list.
  1265.  
  1266.                end loop;
  1267.             end if ;
  1268.  
  1269.          when others =>
  1270.             -- Should not occur here!  Send an error message to the
  1271.             -- user an attempt to continue.
  1272.       end case;
  1273.  
  1274.    end EMIT_BODIES;
  1275.  
  1276. <FF>
  1277.  
  1278.  
  1279.  
  1280. 3.  SOFTWARE ARCHITECTURE
  1281.  
  1282. 3.1  GAD
  1283.  
  1284. The Software Architecture of GAD will resemble that of the
  1285. prototype version of the tool.  Figure 3.1-1 illustrates the
  1286. hierarchical organization of the functional modules.  The following
  1287. is a brief overview of the GAD functional components or modules: 
  1288.  
  1289.  
  1290.   ------------------------------------------    -------     -------
  1291.   |           |           |   PDL_         |    |  A  |     |     |
  1292.   |           |           |    GENERATOR   |  ->|  D  |     |  V  |
  1293.   |    GAD    |   MMI     |----------------|    |  A  |     |  A  |
  1294.   |           |           |   GRAPH_       |    |     |     |  X  |
  1295.   |           |           |    TREE_       |    |  P  |     |  /  |
  1296.   |           |           |     ACCESS     |    |  R  |     |  V  |
  1297.   ------------------------------------------    |  E  |     |  M  |
  1298.                       |                         |  D  |   ->|  S  |
  1299.                       v                         |  E  |     |     |
  1300.   ------------------------------------------    |  F  |     |  O  |
  1301.   |           GRAPHICS_DRIVER              |    |  I  |     |  P  |
  1302.   |                                        |    |  N  |     |     |
  1303.   ------------------------------------------    |  E  |     |  S  |
  1304.             |                  |                |  D  |     |  Y  |
  1305.             v                  v                |     |     |  S  |
  1306.   ------------------------------------------    |  P  |     |  T  |
  1307.   |    VIRTUAL_       |                    |    |  K  |     |  E  |
  1308.   |     TERMINAL_     |    GKS_PRIME       |  ->|  G  |     |  M  |
  1309.   |      INTERFACE    |                    |    |  S  |     |     |
  1310.   ------------------------------------------    -------     -------
  1311.  
  1312.                   Figure 3.1-1 GAD Architectural Diagram
  1313.  
  1314.  
  1315.      GAD:
  1316.      The MAIN procedure (Program Unit) of the tool.  It controls the 
  1317.      initialization, execution, and termination of GAD.
  1318.  
  1319.      GRAPH_TREE_ACCESS:
  1320.      This virtual package defines the data structure which holds the
  1321.      semantic and graphics data associated with the graph.  It
  1322.      provides the necessary primitives to manipulate and access the
  1323.      tree.  It provides I/O routines for the capture and
  1324.      preservation of design diagrams between editing sessions. 
  1325.  
  1326.      MMI:
  1327.      This virtual package provides the MMI required to allow 
  1328.      operator interaction with the tool. 
  1329.  
  1330.      PDL_GENERATOR:
  1331.      This virtual package implements the subprograms which generate the
  1332.      Ada PDL from the Syntax Tree. 
  1333.  
  1334.      GRAPHICS_DRIVER:
  1335.      This virtual package provides the routines to perform the graphics
  1336.      functions of GAD. 
  1337.  
  1338.      GKS_PRIME:
  1339.      This virtual package provides a proper subset of the
  1340.      Graphical Kernel System (GKS).  This module encapsulates all
  1341.      terminal specific characteristics of the system. 
  1342.  
  1343.      VIRTUAL_TERMINAL_INTERFACE:
  1344.      This package provides a set of standard routines and data
  1345.      structures for ASCII Text I/O operations on a VT100 type
  1346.      terminals (actually ANSI X3.64). 
  1347.  
  1348. Figure 3.1-2 uses Ada Graphic Notation to illustrate the control flow
  1349. relationships of the GAD components. 
  1350.  
  1351.  
  1352. ------------------------------------------------------------------------
  1353. |                           GRAPH_TREE_ACCESS                          |
  1354. |    ==============           - - - - - - -                            |
  1355. |    | RUN_GAD    |                                                    |
  1356. |    |============|           |           |->+-------------------->|DIRECT_IO |
  1357. |    |            |        -------           ^                         |
  1358. |    |            |->+--+->|     |        |  |                         |
  1359. |    |            |  |  ^  -------           |      VIRTUAL_TERMINAL   |
  1360. |    --------------  |  |     |           |  |        - -  - - - -     |
  1361. |                    |  |     - - - - - - -  |                         |
  1362. |                    |  +--------------------+        |          |     |
  1363. |                    |                       |     -------             |
  1364. |                    +-----------------------+---->|     |       |     |
  1365. |                    |        PDL_GENERATOR  |     -------             |
  1366. |                    |        - - - - - - -  |        |          |-+   |
  1367. |                    |        |           |  |        - -  - - - - |   |
  1368. | +------------------+     -------           |                     |   |
  1369. | |                  +---->|     |        |  |                     |   |
  1370. | |                  |     -------           |        GKS_PRIME   /    |
  1371. | |                  |        |           |--+        - -  - - -  v    |
  1372. | |                  |        - - - - - - -           |         |-+->|TEXT_IO |
  1373. | |     MMI          |       GRAPHICS_DRIVER                           |
  1374. | |     - - -  - - - |        - - - - - - -           |         |      |
  1375. | |                  |                             -------             |
  1376. | |     |          | |        |           |   +--->|     |      |      |
  1377. | |                  |                        |    -------             |
  1378. | |  -------         |     -------            |       |         |      |
  1379. | +->|     |       |-+---->|     |        |   |       - -  - - -       |
  1380. |    -------               -------         ---+                        |
  1381. |       |          |          |           |                            |
  1382. |       - - -  - - -          - - - - - - -                            |
  1383. ------------------------------------------------------------------------
  1384.  
  1385.                   Figure 3.1-2 GAD Control Flow Diagram
  1386.  
  1387.  
  1388. 3.2  GRAPH_TREE_ACCESS
  1389.  
  1390. The virtual package GRAPH_TREE_ACCESS contains the packages and
  1391. subprograms which encapsulate the major data structure of the GAD. 
  1392. The virtual package provides three major facilities: the type
  1393. declarations and objects which comprise the Syntax and Graph Trees,
  1394. primitive routines for the manipulation of the Syntax Tree, and IO
  1395. routines to preserve the data structures in a file between session.
  1396. The compilations units are shown below, and the OODD of the
  1397. GRAPH_TREE_ACCESS virtual package, which reflects its dependencies,
  1398. is shown in Figure 3.2-1. 
  1399.  
  1400.      TREE_DATA:
  1401.      The TREE_DATA package provides the declarations and objects
  1402.      for the Syntax and Graph Tree which holds all the graphical, 
  1403.      syntax, and semantic information required by GAD.  The tree is 
  1404.      composed of TREE, LIST, GRAPH, and PROLOGUE nodes.  See
  1405.      Section 2.2 for further details.
  1406.  
  1407.      TREE_OPS:
  1408.      The TREE_OPS package provides a set of operations on the
  1409.      Syntax Tree data structures declared in TREE_DATA.  These
  1410.      operations include storage management for the nodes making
  1411.      up the tree (i.e., the allocation and release of the array 
  1412.      elements which are the nodes), and operations which create, 
  1413.      traverse, and delete subtrees utilizing the LIST nodes to 
  1414.      store relations.  The purpose of the TREE_OPS package is to 
  1415.      centralize the structural manipulations of the Syntax Tree 
  1416.      to avoid its accidental corruption.
  1417.      
  1418.      TREE_IO:
  1419.      The TREE_IO package provides all the necessary operations to
  1420.      read and write the Syntax Tree to/from files on the host
  1421.      file system.  This package manipulates these data files which
  1422.      are Ada DIRECT_IO files composed of records containing
  1423.      the Node array elements used to store the Syntax and Graph Tree 
  1424.      information, and a single record storing the symbol attributes
  1425.      utilized (thereby preserving changed attributes between 
  1426.      sessions).
  1427.  
  1428.  
  1429. <FF>
  1430.  
  1431.         GRAPH_TREE_ACCESS_VIRTUAL_PACKAGE   
  1432.         - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1433.         |                                                         |
  1434.  ( TREE_DATA_TYPES ) ----------+      TREE_DATA                    
  1435.  : TREE_DATA_OBJECTS : ------+ |      -------------------         |
  1436.  < TREE_OPS_EXCEPTS >-----+  | |      |                 |          
  1437.  ( TREE_IO_TYPES )--------+  | +---( DECLARATIONS )     |  +-- < DIRECT_IO >
  1438.  : TREE_IO_OBJECTS  :--+  |  |        |                 |  +--<< GRAPHICS_DR >>
  1439.  < TREE_IO_EXCEPTS >---+  |  +---- : DATA_OBJECTS :     |  |      |
  1440.                        |  |           |                 |  |       
  1441.         |              |  |           -------------------  |      |
  1442.                        |  |           TREE_IO              |       
  1443.         |              |  |           -------------------  |      |
  1444.                        |  |           |                 |  |       
  1445.         |              |  +-------( DECLARATIONS )      |  |      |
  1446.                        |              |                 |  |       
  1447.     |io_operations|---------------|io_operations|       |  |      |
  1448.                        |              |                 |--+       
  1449.         |              |              |                 |         |
  1450.                        |              -------------------          
  1451.         |              |               TREE_OPERATIONS            |
  1452.                        |           --------------------------      
  1453.         |              |           |                        |     |
  1454.                        +-------( DECLARATIONS )             |      
  1455.         |                          |                        |     |
  1456.                                    |                        |      
  1457.     |tree_ops|-----------------|tree_ops|                   |     |
  1458.                                    |                        |      
  1459.         |                          |                        |     |
  1460.                                    --------------------------      
  1461.         - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1462.  
  1463.         Figure 3.2-1  GRAPH_TREE_ACCESS Virtual Package Design Diagram
  1464.  
  1465. 3.3  MMI
  1466.  
  1467. The MMI virtual package provides the MMI functions of GAD.  The
  1468. operator interactively makes requests via the terminal input
  1469. devices (keyboard and cursor control devices) to which the MMI
  1470. routines respond in accordance with the requested function.  Along
  1471. with providing access to PDL generation and file management, all
  1472. the design operations are processed within the MMI routines. 
  1473.  
  1474. The software architecture of the MMI is presented in Figure 3.3-1.
  1475. The scope of the MMI is enclosed in the virtual package MMI. Within
  1476. the scope of the virtual package are five packages which contain
  1477. the MMI subprograms, variables, and declarations.  The six packages
  1478. are MMI, MMI_DESIGN, MMI_ATTRIBUTES, MMI_CONTROL_MENUS,
  1479. MMI_PARAMETERS, and UTILITIES.  Imported packages to the virtual
  1480. package provide the lower level routines needed for the MMI
  1481. operations.  Those routines include such items as the terminal
  1482. interface, graphic functions, and tree operations. Exports from the
  1483. virtual package provide the access to the the MMI software. 
  1484.  
  1485.      MMI:
  1486.      The package MMI contains the subprograms which are exported
  1487.      from the virtual package MMI.  The three procedures
  1488.      (INITIALIZE, PANIC_EXIT, and PROCESS_COMMAND) provide the access
  1489.      to the MMI software.  The INTIALIZE procedure is called during
  1490.      the start-up of the GAD to setup the menus and the terminal
  1491.      characteristics. PANIC_EXIT handles the saving of the current
  1492.      design file if the GAD program falls into a non-recoverable
  1493.      state.  PROCESS_COMMAND is the main procedure for accepting
  1494.      user commands and then determining the path for program
  1495.      operation. 
  1496.  
  1497.      MMI_DESIGN:
  1498.      MMI_DESIGN is the package in which most of the entity creation
  1499.      is performed.  The processing of input during the creation of
  1500.      virtual packages, packages, subprograms, tasks, and executing
  1501.      bodies is within MMI_DESIGN, as are the modification routines.
  1502.  
  1503.      MMI_ATTRIBUTES:
  1504.      MMI_ATTRIBUTES exports two subprograms which provide access to
  1505.      the package routines.  CONTROL_ANNOTATING_MENU contains the code
  1506.      for specifying import and export declarations and for creating
  1507.      connections.  The MMI interactions that enable the user to alter
  1508.      the graphic color and line characteristics are within the function
  1509.      CONTROL_ATTRIBUTES_MENU. 
  1510.  
  1511.      MMI_CONTROL_MENUS:
  1512.      MMI_CONTROL_MENUS handles the sub-menus of GAD.  The sub-menus
  1513.      request the selection of the status of design structures. 
  1514.      The prompts for call status, parameter status, and generic
  1515.      status are examples of items controlled in this package.  The
  1516.      delete operations are within MMI_CONTROL_MENUS along with the
  1517.      MOVE_AND_RESIZE procedure. 
  1518.  
  1519.      MMI_PARAMETERS:
  1520.      MMI_PARAMETERS contains the MMI variable and constant
  1521.      declarations.  All of the items associated with the menu
  1522.      operations are defined within this package.  The menu
  1523.      structure, commands, and icons are declared. 
  1524.  
  1525.      UTILITIES:
  1526.      The virtual package UTILITIES contains the subprograms which
  1527.      implement repetitive functions performed at the MMI level.  
  1528.      These functions access lower level packages such as TREE_OPS
  1529.      and GRAPHICS_DRIVER, often manipulating details which detract
  1530.      from normal MMI processing.  This package contributes strongly
  1531.      to the maintainability and understandability of other MMI
  1532.      packages.
  1533. <FF>
  1534.  
  1535.   MMI
  1536.   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1537.   |      MMI                                                          |
  1538.          ---------------------                             <SYSTEM           >
  1539.   |      |                   |                             <GKS_SPECIFICATION>
  1540. ----     |                   |                             <GRAPHICS_DATA    >
  1541. |  |   |  INITIALIZE      |  |                             <GRAPHIC_DRIVER   >
  1542. |  |-->|  PANIC_EXIT      |  |                             <PDL_GEN          >
  1543. |  |   |  PROCESS_COMMAND |  |                             <TREE_DATA        >
  1544. ----     |                   |---+                         <TREE_OPS         >
  1545.   |      |                   |   |                         <TREE_IO          >
  1546.          ---------------------   |                         <TEXT_IO          >
  1547.   |                              |                         <VIRTUAL_TERMINAL_>
  1548.                                  |                            INTERFACE      >
  1549.   |  ----------------------------+                                    |
  1550.     /                            |                                    
  1551.   | |                            |                                    |
  1552.     |    MMI_DESIGN              |    MMI_CONTROL_MENUS                
  1553.   | |    -------------------     |    ---------------------------     |
  1554.     |    |                 |     |    |                         |     
  1555.   | |    |                 |     V    |                         |     |
  1556.     +->|  CONTROL_      |  |--+->+->| =CONTROL_CALL_STATUS_ME | |     
  1557.     |  |    DESIGN_MENU |  |  |  |  | =CONTROL_DELETE_MENU |    |     |
  1558.     |    |                 |  |  |  | =CONTROL_ENTRY_POINT_ST | |     
  1559.   | |    |                 |  |  |  | =CONTROL_GENERIC_STATUS | |     |
  1560.     |    -------------------  |  |  | =CONTROL_PAN_AND_ZOOM_M | |     
  1561.   | |                         |  |  | =CONTROL_PARAMETER_STAT | |     |
  1562.     | ------------------------+  |  | =CONTROL_PDL_STATUS_MEN | |     
  1563.   | |/                           |  |  DELETE |                 |     |
  1564.     |                            |  |  DELETE_CONNECTION |      |     
  1565.   | |    MMI_ATTRIBUTES          |  |  MOVE_AND_RESIZE |        |     |
  1566.     |    ------------------      |    |                         |-+   
  1567.   | |    |                |      |    |                         | |   |
  1568.     |    |                |------+    --------------------------- |   
  1569.   | +->| CONTROL_      |  |      |                                |   |
  1570.        |   ANNOTATING_ |  |      | -------------------------------+   
  1571.   |    |     MENU      |  |      |/                                   |
  1572.        | CONTROL_      |  |      |    MMI_PARAMETERS                   
  1573.   |    |   ANNOTATING_ |  |      |    ---------------                 |
  1574.        |     MENU      |  |      |    |             |                  
  1575.   |      |                |      +->(DECLARATIONS)  |                 |
  1576.          |                |      |    |             |                  
  1577.   |      ------------------      |    ---------------                 |
  1578.                                  |                                     
  1579.   |                              |    UTILITIES                       |
  1580.                                  |    ---------------                   
  1581.   |                              |    |             |                 |
  1582.                                  +->(SUBPROGRAMS)   |                 
  1583.   |                                   |             |                 |
  1584.                                       ---------------                 
  1585.   |                                                                   |
  1586.   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1587.             Figure 3.3-1  MMI Virtual Package Design Diagram
  1588.  
  1589. 3.4  PDL_GENERATOR
  1590.  
  1591. The virtual package PDL_GENERATOR contains the packages and
  1592. subprograms which will generate the Ada PDL corresponding to the
  1593. current OODD being developed.  The compilation units are shown
  1594. below, along with the OODD of the PDL_GENERATOR virtual package,
  1595. which reflects its dependencies, is shown in Figure 3.4-1. 
  1596.  
  1597.      PDL_GEN:
  1598.      This package contains the subprograms which perform the 
  1599.      generation of the Ada PDL corresponding to the OODD
  1600.      described in the Syntax Tree.  It exports parameters
  1601.      which control the PDL Generation, and a single 
  1602.      procedure which implements the generation algorithm
  1603.      (See Section 2.3.3).  The package also contains the numerous
  1604.      local subprograms required in PDL generation, which perform 
  1605.      utility functions including specialized IO subprograms
  1606.      which perform the (optional) simultaneous writes to
  1607.      both a text file and the user's terminal.
  1608.  
  1609.  
  1610.       PDL_GENERATOR                                                  
  1611.       - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1612.                                                              
  1613.       |                  PDL_GEN                            |
  1614.                          ---------------------------    < GRAPHICS_DATA >
  1615.       |                  |                         |        |
  1616.   : PARAMETERS : --- : PARAMETERS :                |  +-< TEXT_IO >     
  1617.       |                  |                         |  +-<< GRAPH_TREE_ACCESS >>
  1618.                          |                         |  +-< VIRTUAL_TERMINAL_IN >
  1619.       |                  |                         |  +-< UTILITIES >
  1620.                          |                         |  |      
  1621.       |                  |     =================   |  |     |
  1622.   |GENERATE_PDL|------>|   |-->| GENERATE_PDL[]|   |  |      
  1623.       |                  |     |===============|   |  |     |
  1624.                          |     |               |   |  |      
  1625.       |                  |     |               |------+     |
  1626.                          |     |               |   |         
  1627.       |                  |     -----------------   |        |
  1628.                          |                         |         
  1629.       |                  ---------------------------        |
  1630.       - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1631.  
  1632.       Figure 3.4-1  PDL_GENERATOR Virtual Package Design Diagram
  1633.  
  1634. <FF>
  1635. 3.5  GRAPHICS_DRIVER
  1636.  
  1637. The virtual package GRAPHICS_DRIVER contains the packages and
  1638. subprograms which provide the primitives required by GAD to
  1639. communicate with the graphics features of the target terminal. The
  1640. virtual package provides:  the type declarations containing the
  1641. graphic information for each entity in the graph, and the screen
  1642. and graphic manipulation functions required to support GAD.  The
  1643. compilation units are shown below, and the OODD of the
  1644. GRAPHICS_DRIVER virtual package, which reflects its dependencies,
  1645. is shown in Figure 3.5-1. 
  1646.  
  1647.      GRAPHICS_DATA:
  1648.      The GRAPHICS_DATA package provides the data types containing
  1649.      the graphic information (location and attributes) for each
  1650.      entity type in the graph, provides the type declarations which
  1651.      define the graphics world coordinate space utilized by GAD,
  1652.      defines the colors available to GAD, and provides the display
  1653.      attributes required to support GAD graphical primitives.
  1654.  
  1655.      GRAPHICS_DRIVER:
  1656.      The GRAPHICS_DRIVER package is designed to perform the low
  1657.      level graphics functions required by the GAD, and provides
  1658.      all the necessary screen and graphic manipulation functions
  1659.      needed to perform editing of GAD graphs.  The target terminal
  1660.      is a VT-100 compatible bit-mapped graphics device; however,
  1661.      the package is independent of the bit-mapped oriented
  1662.      characteristics of the terminal.  The requirements on the
  1663.      GRAPHICS_DRIVER package are as follows: 
  1664.         - draw graphical entities,
  1665.         - erase graphical entities,
  1666.         - move graphical entities,
  1667.         - save and restore graphical entities,
  1668.         - initialize the graphics device,
  1669.         - restore the graphics device to VT-100 compatibility
  1670.           mode, and
  1671.         - provide a device and compiler independent interface.
  1672.  
  1673.  
  1674. <FF>
  1675.     GRAPHIC_DRIVER 
  1676.     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1677.     |                       GRAPHICS_DATA                               |
  1678.                             ----------------    < GRAPH_TREE_ACCESS          >
  1679.     |                       |              |    < GKS_PRIME                  >
  1680. ( GRAPHICS_DATA )<------( DECLARATIONS )   |    < GKS_NON_STANDARD           >
  1681. (   TYPES       )           |              |    < GKS_SPECIFICATION          >
  1682.                             ----------------    < VIRTUAL_TERMINAL_INTERFACE >
  1683.     |                                                                   |
  1684.                           GRAPHIC_DRIVER
  1685.     |                     --------------------------------              |
  1686. ( GRAPHIC_DRIVER )        |                              |               
  1687. (    EXCEPTIONS  )<---( DECLARATIONS )                   |              |
  1688.     |                     |                              |               
  1689.  |     |-------------->|  CLEAR_MENU                   | |              |
  1690.  |     |-------------->|  CLOSE_SEGMENT                | |
  1691.  |     |-------------->|  DELETE_SEGMENT               | |              |
  1692.  |     |-------------->|  DISPLAY_MENU                 | |
  1693.  |     |-------------->|  DRAW_ABORT_ICON              | |              |
  1694.  |     |-------------->|  DRAW_BOX                     | |
  1695.  |     |-------------->|  DRAW_FIGURE                  | |              |
  1696.  |     |-------------->|  DRAW_LINE                    | |
  1697.  |     |-------------->|  GET_GRAPHICS_CURSOR_POSITION | |              |
  1698.  |     |-------------->|  GRAPHICS_SCREEN              | |
  1699.  |     |-------------->|  HILITE_SEGMENT               | |              |
  1700.  |     |-------------->|  INITIALIZE_GRAPHICS_MODE     | |
  1701.  |     |-------------->|  INIT_SCREEN                  | |              |
  1702.  |     |-------------->|  LABEL                        | |
  1703.  |     |-------------->|  LOCATION_IN_GRAPHIC_VIEWPORT | |              |
  1704.  |     |-------------->|  MOVE                         | |
  1705.  |     |-------------->|  OPEN_SEGMENT                 | |              |
  1706.  |     |-------------->|  PAN                          | |
  1707.  |     |-------------->|  PAN_AND_ZOOM_DISPLAY         | |              |
  1708.  |     |-------------->|  PICK_SEGMENT                 | |
  1709.  |     |-------------->|  PLACE_CURSOR                 | |              |
  1710.  |     |-------------->|  PRINT_SCREEN                 | |
  1711.  |     |-------------->|  REFRESH_SCREEN               | |              |
  1712.  |     |-------------->|  SELECT_WINDOW                | |
  1713.  |     |-------------->|  SET_ABORT_CAPABILITY         | |              |
  1714.  |     |-------------->|  SET_CHARACTER_SIZE_ATTRIBUTES| |
  1715.  |     |-------------->|  SET_DRAWING_PRIORITY         | |              |
  1716.  |     |-------------->|  SET_SEGMENT_VISIBILITY       | |
  1717.  |     |-------------->|  TERMINATE_GRAPHICS_MODE      | |              |
  1718.  |     |-------------->|  UPDATE_COLOR_ATTRIBUTE       | |
  1719.  |     |-------------->|  UPDATE_LINE_ATTRIBUTE        | |              |
  1720.  |     |-------------->|  UPDATE_SHAPE_ATTRIBUTE       | |
  1721.  |     |-------------->|  ZOOM                         | |              |
  1722.                           |                              |
  1723.     |                     --------------------------------              |
  1724.     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1725.                 GRAPHIC_DRIVER Virtual Package Design Diagram
  1726.                                 Figure 3.5-1
  1727. <FF>
  1728. 3.6  GKS_PRIME
  1729.  
  1730. The virtual package GKS_PRIME contains the packages and subprograms
  1731. which implement a version of the Graphical Kernel System (GKS)
  1732. developed by SYSCON Corporation for use with the GAD. This virtual
  1733. package provides a proper subset of the GKS, and implements those
  1734. operations required by the GAD.  ( Refer to section 5.4.3 for
  1735. further information regarding GKS_Prime. ) The virtual package
  1736. provides:  the type declarations and objects utilized by GKS_PRIME,
  1737. and the functions defined by the GKS standard which are utilized by
  1738. GAD.  The compilation units are shown below, and the OODD of the
  1739. GKS_PRIME virtual package, which reflects its dependencies, is
  1740. shown in Figure 3.6-1. 
  1741.  
  1742.      GKS_SPECIFICATION:
  1743.      The GKS_SPECIFICATION package provides the type declarations,
  1744.      objects, the various coordinate system spaces required to
  1745.      support GKS_PRIME and GKS_NON_STANDARD.  The definitions
  1746.      which are contained in the GKS_SPECIFICATION package are
  1747.      those defined in the Draft GKS Binding to ANSI Ada [AdaGKS].
  1748.  
  1749.      GKS_PRIME:
  1750.      The package GKS_PRIME provides the functions which implement
  1751.      a version of the Graphical Kernel System (GKS) developed by
  1752.      SYSCON Corporation.  This package provides a proper subset
  1753.      of the GKS, and implements those operations required by the
  1754.      GAD.  The subprogram calls which are contained in GKS_PRIME
  1755.      are those defined in the Draft GKS Binding to ANSI Ada
  1756.      [AdaGKS].
  1757.  
  1758.      GKS_NON_STANDARD:
  1759.      The package GKS_NON_STANDARD provides the functions which
  1760.      require access to terminal hardware capabilities not 
  1761.      addressed by standard GKS.  The functions implemented
  1762.      in this package would be implemented via the ESCAPE and
  1763.      GDP functions defined in the standard.
  1764.  
  1765.      TERMINAL_ACCESS:
  1766.      The TERMINAL_ACCESS package provides a device independent
  1767.      set of subprograms which support graphic operations services.
  1768.      The primary function of this package is to support graphic
  1769.      operations in the graphic window.  ( Refer to section 4.4 for
  1770.      a list of services provided by this package. )
  1771.  
  1772.  
  1773. <FF>
  1774.      GKS_PRIME
  1775.   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1776.   |                     GKS_SPECIFICATION                                 |
  1777.                         ------------------
  1778.   |                     |                |                                |
  1779. ( GKS_TYPES )<-------( DECLARATIONS )    |
  1780.   |                     |                |                                |
  1781.                         ------------------ 
  1782.   |                                                                       |
  1783.          GKS_PRIME
  1784.   |       -----------------------------         TERMINAL_ACCESS           |
  1785.          |                            |         ---------------
  1786.   |      |               LEVEL_0A     |         |             |           |  
  1787.          |               -----------  |         |             |
  1788.   |      |               |         |  |      ( DECLARATIONS ) |           |
  1789.          |      +---->|     |      |----->+     |             |            
  1790.   |      |      |        -----------  |   |     |             |           |
  1791.          |      |        LEVEL_0B     |   +-->| .ALL |        |
  1792.   |      |      |        -----------  |   |     |             |-+         |
  1793.          |      |        |         |  |   |     |             | |
  1794.   |      |      |  +->|     |      |----->+     --------------- |         |
  1795. |   |-->|   |---+  |     ----------- |----->+                   |          
  1796. |   |-->|   |------+     -----------  |   |                     |         |
  1797. |   |-->|   |----+       LEVEL_1A     |   |                     |          
  1798. |   |-->|   |--+ |       -----------  |   |                     +->< SYSTEM  >
  1799.                | |       |         |  |   |                        < TEXT_IO > 
  1800.   |       |    | +--->|     |      |----->+                               |
  1801.           |    |         -----------      |
  1802.   |       |    |         LEVEL_1B     |   |                               |
  1803.           |    |         -----------  |   |                                
  1804.   |       |    |         |         |  |   |                               |
  1805.           |    +----->|     |      |----->+
  1806.   |       |              -----------  |   |                               |
  1807.           -----------------------------   |
  1808.   |                                       |                               |
  1809.           GKS_NON_STANDARD                |                                
  1810.   |       -----------------------------   |                               |
  1811.           |              LEVEL_0A     |   |                                
  1812.   |       |              -----------  |   |                               |
  1813.                          |         |  |   |                                
  1814. |   |-->|   |-------->|     |      |----->+                               |
  1815.           |              -----------  |                                    
  1816.   |       -----------------------------                                   |
  1817.   - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1818.                    GKS_PRIME Virtual Package Design Diagram
  1819.                                  Figure 3.6-1.
  1820. <FF>
  1821.  
  1822. 3.7 VIRTUAL_TERMINAL_INTERFACE
  1823.  
  1824. The virtual package VIRTUAL_TERMINAL_INTERFACE contains the
  1825. subprograms which provide alphanumeric text services.  The primary
  1826. function of this virtual package is to support alphanumeric I/O to
  1827. the alphanumeric window of the graphics terminal.  The compilation
  1828. units are shown below, and the OODD of the VIRTUAL_TERMINAL_
  1829. INTERFACE virtual package, which reflects its dependencies, is
  1830. shown in Figure 3.7-1. 
  1831.  
  1832.      VIRTUAL_TERMINAL_INTERFACE:
  1833.      The VIRTUAL_TERMINAL_INTERFACE package provides a set of
  1834.      device independent subprograms which support alphanumeric
  1835.      text services.  The services provided by this package
  1836.      include cursor positioning, scrolling, string I/O, character
  1837.      I/O, integer I/O, real I/O, and screen erase features.  The
  1838.      communcation codes generated by this package are targeted
  1839.      for a terminal which supports the ANSI X3.64 screen editing
  1840.      commands.
  1841.  
  1842.  
  1843.     VIRTUAL_TERMINAL 
  1844.     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1845.     |                                                                     |
  1846.                           VIRTUAL_TERMINAL_INTERFACE                       
  1847.     |                     --------------------------------                |
  1848.                           |                              |                 
  1849. ( CRT_ROW         )       |                              |                |
  1850. ( CRT_COL         )<--( DECLARATIONS )                   |        <  SYSTEM   >
  1851. ( FORMAT_FUNCTION )       |                              |        <  TEXT_IO  >
  1852. ( CURSOR_ADDRESS  )       |                              |                 
  1853.     |                     |                              |                |
  1854.  -------               ------------------------          |
  1855.  |     |-------------->| VTI_INIT             |          |                |
  1856.  |     |-------------->| SCROLLING_REGION     |          |
  1857.  |     |-------------->| MOVE_CURSOR_UP       |          |                |
  1858.  |     |-------------->| MOVE_CURSOR_DOWN     |          |
  1859.  |     |-------------->| MOVE_CURSOR_RIGHT    |          |                |
  1860.  |     |-------------->| MOVE_CURSOR_LEFT     |          |
  1861.  |     |-------------->| MOVE_CURSOR_TO       |          |                |
  1862.  |     |-------------->| LOW_LEVEL_OPERATIONS |          |
  1863.  |     |-------------->| STRINGIO             |          |                |
  1864.  |     |-------------->| CHARACTERIO          |          |
  1865.  |     |-------------->| INTEGERIO            |          |                |
  1866.  |     |-------------->| REALIO               |          |
  1867.  |     |-------------->| FORMAT_LINE          |          |                |
  1868.  |     |-------------->| KEY_PAD_IO           |          |
  1869.  -------               ------------------------          |                |
  1870.                           |                              |
  1871.     |                     --------------------------------                |
  1872.     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1873.              Virtual_Interface_VP Virtual Package Design Diagram
  1874.                                 Figure 3.7-1
  1875. <FF>
  1876.  
  1877.  
  1878. 4.  PROGRAM MAINTENANCE
  1879.  
  1880. 4.1  Installation
  1881.  
  1882. To install the Graphic Ada Designer onto a new host system, a
  1883. system compatible Executable Image file must be created.  GAD was
  1884. delivered for the DEC VAX/VMS operating system version 4.2.  If the
  1885. new host system is running this exact version of the VMS operating
  1886. system, all that will be required to install the program is to load
  1887. the delivered Executable Image onto the system.  To run the program 
  1888. simply enter the command:
  1889.  
  1890.      $ RUN device:[directory]GAD  ! from other than the directory
  1891.                                   ! on which GAD is installed 
  1892.      $ RUN GAD                    ! from the directory on which
  1893.                                   ! GAD is installed 
  1894.  
  1895.  
  1896. If the new host system is running a different version of VMS level
  1897. 4, then the GAD Program Library must be loaded onto the system, and
  1898. the program relinked to avoid Ada Run Time System incompatibility
  1899. problems. The command to perform this is: 
  1900.  
  1901.      $ SET DEF [directory containing the GAD program library]
  1902.      $ ACS SET LIBRARY [.ADALIB]
  1903.      $ ACS LINK GAD
  1904.  
  1905. For all other host/operating system combinations, the GAD program
  1906. will have to be rebuilt from the source.  The compilation of the 
  1907. GAD is discussed in Section 4.1.1.  Possible rehosting adaptations
  1908. are discussed in Section 4.3. 
  1909.  
  1910. To make help available, the GAD Help File ("GADHELP.HLP") must be 
  1911. loaded onto the host system, and on VMS systems, the following 
  1912. assignment statement placed in user login files:
  1913.  
  1914.      $ ASSIGN device:[directory]GADHELP.HLP HELP_FILE
  1915.  
  1916.  
  1917.  
  1918. 4.1.1  Program Compilation 
  1919.  
  1920. To compile the GAD, the source must first be loaded onto a single
  1921. directory on the host system.  The compilation units and the
  1922. corresponding source file names (for the VMS system used to develop
  1923. the program) are shown in Table 4.1-1. 
  1924.  
  1925. <FF>
  1926.  
  1927. Table 4.1-1  Compilation Unit List
  1928.  
  1929.      Compilation Unit                VMS Source File Name
  1930.      ----------------            ----------------------------
  1931.  
  1932.      DIRECT_IO
  1933.          Predefined Generic Package 
  1934.  
  1935.      GAD
  1936.          Procedure body
  1937.              Source file:        GAD.ADA
  1938.  
  1939.      GKS_COORDINATE_SYSTEM
  1940.          Generic package declaration
  1941.              Source file:        GKS_SPECIFICATION_SPEC.ADA
  1942.  
  1943.      GKS_NON_STANDARD
  1944.          Package specification
  1945.              Source file:        GKS_NON_STANDARD_SPEC.ADA
  1946.          Package body
  1947.              Source file:        GKS_NON_STANDARD_BODY.ADA
  1948.  
  1949.      GKS_PRIME
  1950.          Package specification
  1951.              Source file:        GKS_PRIME_SPEC.ADA
  1952.          Package body
  1953.              Source file:        GKS_PRIME_BODY.ADA
  1954.  
  1955.      GKS_SPECIFICATION
  1956.          Package specification
  1957.              Source file:        GKS_SPECIFICATION_SPEC.ADA
  1958.  
  1959.      GRAPHICS_DATA
  1960.          Package specification
  1961.              Source file:        GRAPHICS_DATA_SPEC.ADA
  1962.  
  1963.      GRAPHIC_DRIVER
  1964.          Package specification
  1965.              Source file:        GRAPHIC_DRIVER_SPEC.ADA
  1966.          Package body
  1967.              Source file:        GRAPHIC_DRIVER_BODY.ADA
  1968.  
  1969.      IO_EXCEPTIONS
  1970.          Predefined Package 
  1971.  
  1972.      MATH_LIB
  1973.          Predefined Generic Package 
  1974. <FF>
  1975.  
  1976. Table 4.1-1  Compilation Unit List continued
  1977.  
  1978.      Compilation Unit                VMS Source File Name
  1979.      ----------------            ----------------------------
  1980.  
  1981.      MMI
  1982.          Package specification
  1983.              Source file:        MMI_SPEC.ADA
  1984.          Package body
  1985.              Source file:        MMI_BODY.ADA
  1986.  
  1987.      MMI_ATTRIBUTES
  1988.          Package specification
  1989.              Source file:        MMI_ATTRIBUTES_SPEC.ADA
  1990.          Package body
  1991.              Source file:        MMI_ATTRIBUTES_BODY.ADA
  1992.  
  1993.      MMI_CONTROL_MENUS
  1994.          Package specification
  1995.              Source file:        MMI_CONTROL_MENUS_SPEC.ADA
  1996.          Package body
  1997.              Source file:        MMI_CONTROL_MENUS_BODY.ADA
  1998.  
  1999.      MMI_DESIGN
  2000.          Package specification
  2001.              Source file:        MMI_DESIGN_SPEC.ADA
  2002.          Package body
  2003.              Source file:        MMI_DESIGN_BODY.ADA
  2004.  
  2005.      MMI_PARAMETERS
  2006.          Package specification
  2007.              Source file:        MMI_PARAMETERS_SPEC.ADA
  2008.  
  2009.      PDL_GEN
  2010.          Package specification
  2011.              Source file:        PDL_GEN_SPEC.ADA
  2012.          Package body
  2013.              Source file:        PDL_GEN_BODY.ADA
  2014.  
  2015.      SYSTEM
  2016.          Predefined Package
  2017.  
  2018.      TEKDRIVER
  2019.          Package specification
  2020.              Source file:        TEKDRIVER_.ADA
  2021.          Package body
  2022.              Source file:        TEKDRIVER.ADA
  2023.  
  2024.      TERMINAL_ACCESS
  2025.          Package specification
  2026.              Source file:        TERMINAL_ACCESS_SPEC.ADA
  2027.          Package body
  2028.              Source file:        TERMINAL_ACCESS_TEK_BODY.ADA
  2029. <FF>
  2030.  
  2031. Table 4.1-1  Compilation Unit List continued
  2032.  
  2033.      Compilation Unit                VMS Source File Name
  2034.      ----------------            ----------------------------
  2035.  
  2036.      TEXT_IO
  2037.          Predefined Package 
  2038.  
  2039.      TRACE_PKG
  2040.          Package specification
  2041.              Source file:        TRACE_PKG_SPEC.ADA
  2042.          Package body
  2043.              Source file:        TRACE_PKG_BODY.ADA
  2044.  
  2045.      TREE_DATA
  2046.          Package specification
  2047.              Source file:        TREE_DATA_SPEC.ADA
  2048.          Package body
  2049.              Source file:        TREE_DATA_BODY.ADA
  2050.  
  2051.      TREE_IO
  2052.          Package specification
  2053.              Source file:        TREE_IO_SPEC.ADA
  2054.          Package body
  2055.              Source file:        TREE_IO_BODY.ADA
  2056.  
  2057.      TREE_OPS
  2058.          Package specification
  2059.              Source file:         TREE_OPS_SPEC.ADA
  2060.          Package body
  2061.              Source file:        TREE_OPS_BODY.ADA
  2062.  
  2063.      UTILITIES
  2064.          Package specification
  2065.              Source file:        UTILITIES_SPEC.ADA
  2066.          Package body
  2067.              Source file:        UTILITIES_BODY.ADA
  2068.  
  2069.      UTIL_FOR_TREE
  2070.          Package specification
  2071.              Source file:        UTIL_FOR_TREE_SPEC.ADA
  2072.          Package body
  2073.              Source file:        UTIL_FOR_TREE_BODY.ADA
  2074.  
  2075.      VIRTUAL_TERMINAL_INTERFACE
  2076.          Package specification
  2077.              Source file:        VIRTUAL_TERMINAL_INTERFACE_SPEC.ADA
  2078.          Package body
  2079.              Source file:        VIRTUAL_TERMINAL_INTERFACE_BODY.ADA
  2080.  
  2081.  
  2082. To compile the program, a new program library must be created, and 
  2083. each of the compilation units entered into it.  Using DEC Ada, the
  2084. following commands would be required: 
  2085.  
  2086.      $ ACS CREATE LIBRARY [.ADALIB]
  2087.      $ ADA source_file_name          ! for each source unit.
  2088.  
  2089. The compilation units should be entered into the program library in
  2090. compilation order, and this order is shown in Table 4.1-2. The unit
  2091. names given in this Table are the compilation units names (e.g.,
  2092. package names), and do not reflect the file names given for any
  2093. particular host system.  Once the program has been entered into the
  2094. program library, then further compilations (e.g., after compile
  2095. time parameter changes) can be performed with the command on
  2096.      $ ACS COMPILE GAD
  2097.  
  2098.  
  2099. Table 4.1-2.  Graphic Ada Designer Compilation Order
  2100. ----------------------------------------------------
  2101.      
  2102.       GKS_COORDINATE_SYSTEM_specification
  2103.       GKS_SPECIFICATION_specification
  2104.       GRAPHICS_DATA_specification
  2105.       TEKDRIVER_specification
  2106.       TEKDRIVER_body
  2107.       TRACE_PKG_specification
  2108.       TRACE_PKG_body
  2109.       TREE_DATA_specification
  2110.       TREE_DATA_body
  2111.       TERMINAL_ACCESS_specification
  2112.       TERMINAL_ACCESS_body
  2113.       VIRTUAL_TERMINAL_INTERFACE_specification
  2114.       VIRTUAL_TERMINAL_INTERFACE_body
  2115.       TREE_OPS_specification
  2116.       TREE_OPS_body
  2117.       TREE_IO_specification
  2118.       TREE_IO_body
  2119.       GKS_NON_STANDARD_specification
  2120.       GKS_NON_STANDARD_body
  2121.       GKS_PRIME_specification
  2122.       GKS_PRIME_body
  2123.       GRAPHIC_DRIVER_specification
  2124.       GRAPHIC_DRIVER_body
  2125.       MMI_PARAMETERS_specification
  2126. <FF>
  2127.  
  2128. Table 4.1-2.  Graphic Ada Designer Compilation Order continued
  2129. --------------------------------------------------------------
  2130.      
  2131.       UTILITIES_specification
  2132.       UTILITIES_body
  2133.       PDL_GEN_specification
  2134.       PDL_GEN_body
  2135.       UTIL_FOR_TREE_specification
  2136.       UTIL_FOR_TREE_body
  2137.       MMI_CONTROL_MENUS_specification
  2138.       MMI_CONTROL_MENUS_body
  2139.       MMI_ATTRIBUTES_specification
  2140.       MMI_ATTRIBUTES_body
  2141.       MMI_DESIGN_specification
  2142.       MMI_DESIGN_body
  2143.       MMI_specification
  2144.       MMI_body
  2145.       GAD
  2146.  
  2147.  
  2148. 4.2  Parameter Controlled Features
  2149.  
  2150. Numerous compile-time parameters are located within the source code
  2151. of the GAD program, that enable the maintainer to adapt the
  2152. functionality of the GAD program to alternate user environments and
  2153. methodologies.  Table 4.2-1 presents a logical grouping of the
  2154. parameter description.  The implementer should be able to determine
  2155. the parameters that need changing to suit a particular situation. 
  2156. Listed with the parameters is the package in which the parameter is
  2157. declared.  Table 4.2-2 lists the packages in alphabetical order,
  2158. along with each of the parameters the package contains.  The
  2159. ordering of the parameters within each package follows the order
  2160. presented in Table 4.2-1. A futher description of the parameter is
  2161. provided along with instructions on modifying the value. 
  2162.  
  2163.  
  2164. Table 4.2-1.  LOGICAL GROUPING OF PARAMETERS
  2165. --------------------------------------------
  2166.  
  2167. SCREEN BACKROUND COLOR                  MMI (BODY)
  2168. CHARACTER BACKROUND COLOR               GRAPHICS_DATA (BODY)
  2169.  
  2170. CHARACTER WIDTH                         GRAPHICS_DATA (SPEC)
  2171. CHARACTER HEIGHT                        GRAPHICS_DATA (SPEC)
  2172. CHARACTER WIDTH SPACING                 GRAPHICS_DATA (SPEC)
  2173. CHARACTER HEIGHT SPACING                GRAPHICS_DATA (SPEC)
  2174. CHARACTER WIDTH OFFSET                  GRAPHICS_DATA (SPEC)
  2175. CHARACTER HEIGHT OFFSET                 GRAPHICS_DATA (SPEC)
  2176. <FF>
  2177.  
  2178. Table 4.2-1.  LOGICAL GROUPING OF PARAMETERS continued
  2179. ------------------------------------------------------
  2180.  
  2181. INITIAL COLOR ATTRIBUTES                GRAPHICS_DATA (SPEC)
  2182. INITIAL LINE TYPE ATTRIBUTES            GRAPHICS_DATA (SPEC)
  2183. INITIAL VIEW WINDOW (PAN/ZOOM)          GRAPHICS_DATA (BODY)
  2184.  
  2185. SYMBOLS DEFINING IMPORTS AND EXPORTS    GRAPHICS_DATA (SPEC)
  2186. FUNCTION SYMBOL                         GRAPHICS_DATA (SPEC)
  2187. TIMED CALL CONNECTION SYMBOL            GRAPHICS_DATA (SPEC)
  2188. CONDITIONAL CALL CONNECTION SYMBOL      GRAPHICS_DATA (SPEC)
  2189. GUARDED ENTRY POINT SYMBOL              GRAPHICS_DATA (SPEC)
  2190. GENERIC DECLARATION SYMBOL              GRAPHICS_DATA (SPEC)
  2191. GENERIC INSTANTIATION SYMBOL            GRAPHICS_DATA (SPEC)
  2192. VISIBILITY CLAUSE CONNECTION SYMBOL     GRAPHICS_DATA (SPEC)
  2193. REFERENCE MARKER ICON SYMBOL            UTILITIES (BODY)
  2194.  
  2195. MENU ICONS                              MMI_PARAMETERS (SPEC)
  2196.  
  2197. MAXIMUM TREE NODES                      TREE_DATA (SPEC)
  2198. MAXIMUM GRAPH NODES                     TREE_DATA (SPEC)
  2199. MAXIMUM LIST NODES                      TREE_DATA (SPEC)
  2200. MAXIMUM PROLOGUE NODES                  TREE_DATA (SPEC)
  2201.  
  2202. NUMBER OF PROLOGUE LINES                TREE_DATA (SPEC)
  2203. MAXIMUM LINE SEGMENTS PER LINE          TREE_DATA (SPEC)
  2204. MAXIMUM ENTITY NAME LENGTH              TREE_DATA (SPEC)
  2205. FILE ID LENGTH                          TREE_IO (SPEC)
  2206. STACK SIZE                              TREE_OPS (SPEC)
  2207. MAXIMUM NESTING LEVEL                   GRAPHICS_DATA (SPEC)
  2208.  
  2209. HELP FILE TEXT                          SYSTEM FILE: GADHELP.HLP
  2210. ERROR MESSAGES                          throughout code
  2211. PROMPTS                                 throughout code
  2212.  
  2213. <FF>
  2214. Table 4.2-2.  INFORMATION FOR MODIFICATION OF PARAMETERS
  2215. --------------------------------------------------------
  2216.  
  2217. GRAPHICS_DATA (BODY)
  2218.  
  2219.      CHARACTER BACKROUND COLOR
  2220.           The backround color of the alphanumeric text.
  2221.  
  2222.           CURRENT_TEXT_BACKROUND_COLOR : GRAPHICS_DATA.COLOR_TYPE := 
  2223.                GRAPHICS_DATA.YELLOW ;
  2224.  
  2225.      INITIAL VIEW WINDOW (PAN/ZOOM)
  2226.           The initial setting of the view window on the 
  2227.           design page when GAD is executed.  The range of
  2228.           values is 1 (full zoom in) to 16 (full zoom out).
  2229.  
  2230.           INITIAL_WINDOW_SIZE : constant INTEGER := 8 ;
  2231.  
  2232.  
  2233. GRAPHICS_DATA (SPEC)
  2234.  
  2235.      CHARACTER HEIGHT, CHARACTER WIDTH, CHARACTER HEIGHT SPACING,
  2236.      CHARACTER WIDTH SPACING, CHARACTER HEIGHT OFFSET, 
  2237.      CHARACTER WIDTH OFFSET
  2238.           Constants for character sizing.  The offset values are
  2239.           used to position the labels on the graph.  The user 
  2240.           should be prepared to test several iterations when 
  2241.           changing these variables because they can be difficult 
  2242.           to "fine tune".  The values are scaled on the world
  2243.           coordinates range of 0 .. 32767.
  2244.  
  2245.           DEFAULT_CHARACTER_HEIGHT  : constant WC := 200 ;
  2246.           DEFAULT_CHARACTER_WIDTH   : constant WC := 150 ;
  2247.           DEFAULT_CHARACTER_HEIGHT_SPACING : constant WC := 100 ;
  2248.           DEFAULT_CHARACTER_WIDTH_SPACING : constant WC := 75 ;
  2249.           CHARACTER_HEIGHT_OFFSET   : constant WC := 
  2250.            DEFAULT_CHARACTER_HEIGHT + DEFAULT_CHARACTER_HEIGHT_SPACING ;
  2251.           CHARACTER_WIDTH_OFFSET    : constant WC := 
  2252.            DEFAULT_CHARACTER_WIDTH + DEFAULT_CHARACTER_WIDTH_SPACING ;
  2253.  
  2254.      INITIAL COLOR ATTRIBUTES
  2255.           The colors to be used in drawing.  Note that the
  2256.           defined values are (ORANGE, GREEN, YELLOW, VIOLET, RED, 
  2257.           BLUE, BLACK, BROWN).
  2258.  
  2259.           ENTITY_COLOR : COLOR_ARRAY := (
  2260.                VIRTUAL_PKG_FIGURE => COLOR_TYPE'( BLACK ),
  2261.                PACKAGE_FIGURE     => COLOR_TYPE'( BLACK ),
  2262.                SUBPROGRAM_FIGURE  => COLOR_TYPE'( BLACK ),
  2263.                TASK_FIGURE        => COLOR_TYPE'( BLACK ),
  2264.                BODY_FIGURE        => COLOR_TYPE'( BLACK ),
  2265.                CALL_CONNECT_LINE  => COLOR_TYPE'( BLACK ),
  2266.                DATA_CONNECT_LINE  => COLOR_TYPE'( BLACK ) ,
  2267.                EXPORT_CONNECT_LINE  => COLOR_TYPE'( BLACK ) );
  2268. <FF>
  2269.  
  2270. Table 4.2-2.  INFORMATION FOR MODIFICATION OF PARAMETERS continued
  2271. ------------------------------------------------------------------
  2272.  
  2273. GRAPHICS_DATA (SPEC) (cont.)
  2274.  
  2275.  
  2276.      INITIAL LINE TYPE ATTRIBUTES
  2277.           The line types to be used in drawing lines.  Note that the
  2278.           defined values are (SOLID, DASHED, DOTTED).
  2279.  
  2280.           ENTITY_LINE : LINE_ARRAY := (
  2281.                VIRTUAL_PKG_FIGURE => LINE_TYPE'( DASHED ),
  2282.                PACKAGE_FIGURE     => LINE_TYPE'( SOLID ),
  2283.                SUBPROGRAM_FIGURE  => LINE_TYPE'( SOLID ),
  2284.                TASK_FIGURE        => LINE_TYPE'( SOLID ),
  2285.                BODY_FIGURE        => LINE_TYPE'( SOLID ),
  2286.                CALL_CONNECT_LINE  => LINE_TYPE'( SOLID ),
  2287.                DATA_CONNECT_LINE  => LINE_TYPE'( DOTTED ) ,
  2288.                EXPORT_CONNECT_LINE  => LINE_TYPE'( DOTTED ) );
  2289.  
  2290.  
  2291.      SYMBOLS DEFINING IMPORTS AND EXPORTS
  2292.           The symbols defining the various kinds of imports and
  2293.           exports.  Note that the declaration of the parent type is
  2294.           IMPORT_EXPORT_SYMBOL_TYPE is array (1..2) of STRING (1..1) ;
  2295.  
  2296.           PKG_DECL          : IMPORT_EXPORT_SYMBOL_TYPE := ("#","#") ;
  2297.           VIRT_PKG_DECL     : IMPORT_EXPORT_SYMBOL_TYPE := ("%","%") ;
  2298.           TYPE_DECL         : IMPORT_EXPORT_SYMBOL_TYPE := ("(",")") ;
  2299.           OBJECT_DECL       : IMPORT_EXPORT_SYMBOL_TYPE := (":",":") ;
  2300.           EXCEPTION_DECL    : IMPORT_EXPORT_SYMBOL_TYPE := ("<",">") ;
  2301.           SUBPROG_DECL      : IMPORT_EXPORT_SYMBOL_TYPE := ("|","|") ;
  2302.           PARAMS_DECL       : IMPORT_EXPORT_SYMBOL_TYPE := ("[","]") ;
  2303.           TASK_ENTRY_DECL   : IMPORT_EXPORT_SYMBOL_TYPE := ("/","/") ;
  2304.  
  2305.  
  2306.      FUNCTION SYMBOL, TIMED CALL CONNECTION SYMBOL, CONDITIONAL CALL 
  2307.      CONNECTION SYMBOL, GUARDED ENTRY POINT SYMBOL, GENERIC DECLARATION
  2308.      SYMBOL, GENERIC INSTANTIATION SYMBOL, WITH&USE CLAUSE CONNECTION 
  2309.      SYMBOL
  2310.           The graphical symbols defining the information
  2311.           parameters.  Note that the length of the string should
  2312.           not be changed.
  2313.  
  2314.           FUNCTION_SYMBOL          : INDICATOR_LENGTH_1 := "=" ;
  2315.           TIMED_CALL_SYMBOL        : INDICATOR_LENGTH_1 := "T" ;
  2316.           CONDITIONAL_CALL_SYMBOL  : INDICATOR_LENGTH_1 := "C" ;
  2317.           GUARDED_ENTRY_SYMBOL     : INDICATOR_LENGTH_1 := "*" ;
  2318.           GENERIC_DECL_SYMBOL      : INDICATOR_LENGTH_2 := "gd" ;
  2319.           GENERIC_INST_SYMBOL      : INDICATOR_LENGTH_2 := "gi" ;
  2320.           DATA_ORIGIN_SYMBOL       : INDICATOR_LENGTH_1 := "D" ;
  2321. <FF>
  2322.  
  2323. Table 4.2-2.  INFORMATION FOR MODIFICATION OF PARAMETERS continued
  2324. ------------------------------------------------------------------
  2325.  
  2326. GRAPHICS_DATA (SPEC) (cont.)
  2327.  
  2328.  
  2329.      MAXIMUM ENTITY NAME LENGTH
  2330.           The maximum length for entity names.
  2331.  
  2332.           MAXIMUM_NAME_LENGTH : constant POSITIVE := 80 ;
  2333.  
  2334.  
  2335.      MAXIMUM NESTING LEVEL
  2336.           The maximum nesting level for enclosing objects when
  2337.           creating graphs.
  2338.  
  2339.           MAX_NESTING_LEVEL : constant INTEGER := 6 ;
  2340.  
  2341.  
  2342. MMI (BODY)
  2343.  
  2344.      SCREEN BACKROUND COLOR
  2345.           The backround color of the graphics screen.
  2346.  
  2347.           DEFAULT_SCREEN_COLOR : constant COLOR_TYPE := WHITE ;
  2348.  
  2349.  
  2350. MMI_PARAMETERS (SPEC)
  2351.  
  2352.      MENU ICONS
  2353.           The text displayed within the menu icons can be
  2354.           modified by replacing the string initialization.
  2355.           These are just two examples of the many string 
  2356.           values.  Note that all the icons string lengths
  2357.           must be equal.
  2358.  
  2359.           ( MAIN_MENU =>
  2360.             (1 => HELP_CMD ,  "    HELP     "),
  2361.                .
  2362.                .
  2363.             (5 => DESIGN_CMD, "   DESIGN    "),
  2364.  
  2365. <FF>
  2366. Table 4.2-2.  INFORMATION FOR MODIFICATION OF PARAMETERS continued
  2367. ------------------------------------------------------------------
  2368.  
  2369. TREE_DATA (SPEC)
  2370.  
  2371.      MAXIMUM TREE NODES, MAXIMUM GRAPH NODES,
  2372.      MAXIMUM LIST NODES, MAXIMUM PROLOGUE NODES
  2373.           The number of nodes within the tree structure.  These
  2374.           variables limit the size of the GAD design files.  Since
  2375.           the memory is statically allocated, the values should not 
  2376.           be dramatically increased.  Any alteration of these values
  2377.           will invalidate previously created GAD design files.
  2378.  
  2379.           MAX_TREE_NODES : constant TREE_NODE_ACCESS_TYPE := 99 ;
  2380.           MAX_GRAPH_NODES : constant GRAPH_NODE_ACCESS_TYPE := 199 ;
  2381.           MAX_LIST_NODES : constant LIST_NODE_ACCESS_TYPE := 199 ;
  2382.           MAX_PROLOGUE_NODES : constant PROLOGUE_NODE_ACCESS_TYPE := 99 ;
  2383.  
  2384.      NUMBER OF PROLOGUE LINES
  2385.           The number of lines available for prologues of
  2386.           graphical entities.  Any alteration of this values
  2387.           will invalidate previously created GAD design files.
  2388.           If this value is increased, it is possible the record
  2389.           length of the GAD file will need to be increased
  2390.           (reference the Section 4.3 below).
  2391.  
  2392.           PROLOGUE_COUNT : constant NATURAL := 3 ;
  2393.  
  2394.      MAXIMUM LINE SEGMENTS PER LINE
  2395.           The number of line segments available when creating
  2396.           lines on the graph.
  2397.  
  2398.           MAXIMUM_NO_SEGEMENTS : constant INTEGER := 20 ;
  2399.  
  2400. TREE_IO (SPEC)
  2401.  
  2402.      FILE ID LENGTH
  2403.           The number of characters available when creating
  2404.           file names within GAD.  The value should be set
  2405.           to the system limit (before adding the extension).
  2406.  
  2407.           MAX_FILENAME_SIZE : constant INTEGER := 43 ;
  2408.  
  2409. TREE_OPS (SPEC)
  2410.  
  2411.      STACK SIZE
  2412.           The maximum depth of the stack when executing a tree
  2413.           walk operation.  This value should only be altered if 
  2414.           the maximum nesting level for entities is increased.
  2415.  
  2416.           STACK_SIZE : constant NATURAL := 20 ;
  2417.  
  2418. <FF>
  2419.  
  2420. Table 4.2-2.  INFORMATION FOR MODIFICATION OF PARAMETERS continued
  2421. ------------------------------------------------------------------
  2422.  
  2423. UTILITIES (BODY)
  2424.  
  2425.      REFERENCE MARKER ICON SYMBOL
  2426.           The character that is displayed when a cursor
  2427.           control device reference point is marked on the
  2428.           graph.  The character should be a designated GKS
  2429.           marker such as ".", "+", "*", "o", "x".
  2430.  
  2431.           MARKER_ICON : constant STRING(1..1) := "*" ;
  2432.  
  2433.  
  2434. SYSTEM FILE: GADHELP.HLP
  2435.  
  2436.      HELP FILE TEXT
  2437.           The text of the help file can be altered using
  2438.           the system editor.  The structure of the file
  2439.           should not be changed.  A discussion on the help
  2440.           file is in Appendix A of the GAD User's Guide.          
  2441.  
  2442. throughout code
  2443.  
  2444.      ERROR MESSAGES, PROMPTS
  2445.           If the text of error messages and prompts needs
  2446.           to be altered, the implementer must locate the
  2447.           string(s) in question.  A simple replacement of
  2448.           the string should be sufficient.  Note that,
  2449.           if there is a corresponding assignment of the
  2450.           string to a variable, the length of the string
  2451.           should remain constant.
  2452.  
  2453. 4.3  System Rehosting
  2454.  
  2455. The Graphic Ada Designer initial host environment is a VAX, using
  2456. the VMS operating system version 4.2.  The VAX Ada compiler and
  2457. program library manager (ACS) were used for the development of the
  2458. GAD program. GAD is written in machine and compiler independent
  2459. Ada, and GAD will only be dependent on the graphics terminal and
  2460. printer used.  The GAD Ada source code should rehost to a system
  2461. with an Ada Programming Support Environment and standard ANSI
  2462. communications (RS232).  A recompilation of the source code, and
  2463. the appropriate system link with the new host's Ada Run Time System
  2464. (RTS), is all that should be necessary.  Anyone considering
  2465. rehosting the GAD should read this entire report, paying particular
  2466. attention to Sections 2 through 4, and consulting Section 4.4 for
  2467. information on Graphics Terminal Retargeting. 
  2468.  
  2469. Should the implementer encounter a problem when rehosting the GAD,
  2470. it should be with an "implementation defined" feature of Ada. 
  2471. Presented below are the Ada features with implementation
  2472. dependencies, which could present problems during rehosting.
  2473.  
  2474. The IO operations of the VAX Ada Run Time System are performed by
  2475. the Record Management System (RMS)  of the VMS operating system. 
  2476. RMS does not allow true character IO operations, and is dependent
  2477. on a carriage return for termination of an IO operation. Therefore,
  2478. the GAD does not contain dependencies on true character IO
  2479. operations. If it appears the GAD program is working with character
  2480. data (e.g., character GETs and PUTs), it is still doing so within
  2481. the framework of record based (line-at-a-time) IO operations. 
  2482.  
  2483. GAD utilizes an instantiation of DIRECT_IO to read and write the
  2484. data files which store the Syntax Tree. The instantiation of
  2485. DIRECT_IO, when working with the VMS operating system and Ada
  2486. environment, is performed in the package body of TREE_IO.  It is
  2487. possible that the implementer's operating environment may require
  2488. the handling of the instantiation differently.  Essentially, the
  2489. current GAD instantiates DIRECT_IO by:
  2490.  
  2491.      with DIRECT_IO ;
  2492.      package body TREE_IO is
  2493.         .
  2494.         .
  2495.         type DATA_RECORD_TYPE is ( NODE_RECORD, 
  2496.                                    ATTRIBUTE_HEADER_REORD ) ;
  2497.         type IO_NODE_TYPE ( RECORD_TYPE : DATA_RECORD_TYPE ) is
  2498.            record
  2499.               .
  2500.               .
  2501.            end record ;
  2502.         package NODE_IO is new DIRECT_IO (IO_NODE_TYPE) ;
  2503.         use NODE_IO ;
  2504.         .
  2505.         .
  2506.      end TREE_IO ;
  2507.  
  2508. RMS requires that DIRECT_IO files of variant records set the
  2509. record length of the file during file creation.  File creations are
  2510. also performed in package body of TREE_IO, and the value, which is
  2511. currently set to 512, is specified in bytes and must be big enough
  2512. to hold a data record consisting of a GRAPH_NODE, LIST_NODE,
  2513. PROLOGUE_NODE, and TREE_NODE. The declaration of the record length
  2514. is part of a "CREATE" call, and utilizes the FORM parameter to pass 
  2515. a string with the record size to the RMS facilities of VMS.
  2516.  
  2517.      CREATE (FILE_HANDLE ,
  2518.              OUT_FILE ,        
  2519.              FILE ,
  2520.              FORM => "RECORD , SIZE 512 " ) ; 
  2521.  
  2522. Also, within the record structure of the GAD graphics file is a
  2523. variant part.  The tree node length varies depending on the graphic
  2524. entity that it represents.  Note that in VAX Ada, all array and
  2525. record components are aligned on byte boundaries by default.  Due
  2526. to significant differences in storage allocation and alignment
  2527. between RTS, it is highly unlikely that GAD data files will be
  2528. interchangeable between GAD versions operating on different Ada
  2529. RTSs. 
  2530.  
  2531. Another important IO characteristic of the GAD is the format of the
  2532. data transmitted to the graphics terminal. The GAD currently
  2533. operates with eight-bit, no parity data.  Eight-bit bytes are a
  2534. requirement because of the construction of the various escape
  2535. sequences needed to communicate graphics data between the GAD
  2536. program and the graphics terminal.  All experimentation with
  2537. alternate data formats (other than 8 bit) to date have resulted in
  2538. failure. 
  2539.  
  2540. 4.4  Graphics Terminal Retargeting
  2541.  
  2542. Communication with the graphics terminal is performed by two
  2543. packages of the GAD program, the Virtual Terminal Interface
  2544. package, and the GKS_Prime package (anyone considering rehosting
  2545. the Graphic Ada Designer should read this entire report,
  2546. paying particular attention to Sections 2 through 4, for more
  2547. information of the items discussed in this section). Since the
  2548. graphics terminal supported by these packages is the Tektronix
  2549. 4107, any terminal which is under consideration as a new target
  2550. terminal for the GAD should have hardware capabilities similar to
  2551. the current target terminal. 
  2552.  
  2553. The hardware capabilities of the Tektronix 4107 which are
  2554. utilized by the GAD are:
  2555.    - ANSI X3.64 screen editing commands,
  2556.    - bit-mapped colors,
  2557.    - selectable line types,
  2558.    - selectable marker types,
  2559.    - multiple views,
  2560.    - support for segment operations, including open/create,
  2561.      rename, close, delete, visibility, and highlighting
  2562.    - separate display surfaces for graphic operations and
  2563.      alphanumeric text,
  2564.    - graphics input ( cursor screen location ).
  2565.  
  2566. The Virtual Terminal Interface package consists of a device
  2567. independent set of subprograms which provide alphanumeric text
  2568. services. The primary function of this package is to support
  2569. alphanumeric I/O to the alphanumeric window.  Services provided
  2570. by this package include cursor positioning, scrolling, string I/O,
  2571. character I/O, integer I/O, real I/O, and screen erase features.
  2572. The communication codes generated by this package are targeted for
  2573. a terminal which supports the ANSI X3.64 screen editing commands. 
  2574.  
  2575. The GKS_Prime virtual package is a set of packages which implement
  2576. a version of the GKS developed by SYSCON Corporation for use with
  2577. the GAD.  This package provides a proper subset of the GKS, and
  2578. implements those operations required by the GAD.  ( Refer to
  2579. Section 5.4.3 for further information regarding GKS_Prime. ) 
  2580. Another package of the GKS_Prime virtual package, the Terminal
  2581. Access package, provides a level of abstraction between the
  2582. GKS_Prime package and the graphics hardware, and all communication
  2583. between the GKS_Prime package and the graphics features of the
  2584. terminal hardware is performed through this package.  The Terminal
  2585. Access package is functionally embedded within the GKS_Prime
  2586. virtual package. 
  2587.  
  2588. The Terminal Access package consists of a device independent set
  2589. of subprograms which provides graphic operations services.  The
  2590. primary function of this package is to support graphic operations
  2591. to the graphic window.  Services provided by this package include:
  2592.    - terminal initialization and termination,
  2593.    - operations to support segment operations, including 
  2594.      creation, manipulation, deletion, visibility, and
  2595.      highlighting,
  2596.    - window to viewport mapping,
  2597.    - world coordinate to terminal coordinate mapping
  2598.    - the generation of graphic entities, including polygons,
  2599.      polymarkers, and graphic text,
  2600.    - color selection,
  2601.    - marker selection,
  2602.    - line style selection,
  2603.    - and graphic input.
  2604.  
  2605. If the GAD is transitioned to a different graphics terminal, the
  2606. new terminal should have hardware capabilities similar to those
  2607. found on the Tektronix 4107.  If the new terminal supports the
  2608. ANSI X3.64 screen editing commands, then no changes are required
  2609. to the Virtual Terminal Interface package; if the terminal does
  2610. not support this standard, then the Virtual Terminal Interface
  2611. package must be updated to provide the alphanumeric text services
  2612. currently supported by this package.
  2613.  
  2614. Since all communication between the GKS_Prime package and the
  2615. graphics hardware is performed through the Terminal Access package,
  2616. this package will have to be be rewritten to provide the graphics
  2617. operations services which the package currently supports.  All
  2618. terminal hardware characteristics are encapsulated in the Terminal
  2619. Access package so no changes would be required to any other
  2620. package of the GAD program, with the possible exception of the
  2621. Virtual Terminal Interface package when the program is retargeted
  2622. to a new graphics terminal.  The amount of rewriting required to
  2623. this package will be a function of how closely the new target
  2624. terminal hardware capabilities parallel the capabilities of the
  2625. Tektronix 4107.
  2626.  
  2627. It is possible to transition the GAD to new graphics terminals
  2628. which lack the hardware capabilities of the Tektronix 4107.
  2629. However, the graphics services previously provided by the hardware
  2630. must be implemented by software embedded in the Terminal Access
  2631. package or GAD functionality will be impaired.
  2632.  
  2633. The graphics services required by the GAD are multiple views,
  2634. segment operations, separate display surfaces for graphics
  2635. and alphanumeric text, and graphics input ( cursor screen
  2636. location ).  These capabilities must be provided by the the
  2637. Terminal Access package.  It is possible to implement some of
  2638. these capabilities in software, but at a cost of degraded GAD
  2639. performance.  For example, implementing a package to support
  2640. segment operations would require utilizing this package for
  2641. nearly every terminal activity, since the GAD graphic operations
  2642. are built on the concept of graphic segments.
  2643.  
  2644. Other graphics services utilized by the GAD, but which are not
  2645. essential for GAD performance, include selectable colors, line
  2646. types, and marker types.  These features are not required for
  2647. correct GAD execution, but the lack of these features would have a
  2648. detrimental impact on the MMI.  For example, it is possible to
  2649. transition the GAD to a graphics terminal which has no color
  2650. capabilities.  However, the ability to differentiate among graphic
  2651. objects by their individual colors, and the ability to highlight
  2652. segments by altering the display colors, would be lost. 
  2653.  
  2654. <FF>
  2655.  
  2656. 5.  DEVELOPMENT AND TECHNICAL ISSUES
  2657.  
  2658. 5.1  Lessons Learned
  2659.  
  2660. Numerous lessons were learned and/or re-enforced during the 
  2661. development of the Graphic Ada Designer.  The results of many of 
  2662. these lessons are reflected in other Sections of this report.  The 
  2663. items listed below summarize the lessons learned on this project 
  2664. and cross-reference others sections when appropriate.
  2665.  
  2666.      o Rapid Prototyping is an excellent approach to developing
  2667.        Ada software.  This is particularly true for interactive 
  2668.        tools where usage and functionality need to be investigated.
  2669.        The use of rapid prototyping provides feedback on the 
  2670.        design's characteristics early in the project lifecycle, 
  2671.        and permits feedback to be incorporated without requiring 
  2672.        major design and documentation overhauls.  See Section 5.2 
  2673.        for a discussion of the Development Approach used.  
  2674.  
  2675.      o The successful use of rapid prototyping as a software
  2676.        development approach requires constant attention to
  2677.        architectural and maintenance issues as the software
  2678.        iterates to its final configuration.  Care must be taken
  2679.        to avoid unnecessary duplication of code, and loss of
  2680.        abstraction as new details are added.  During GAD 
  2681.        development, identifying 'utility' functions, particularly
  2682.        in the MMI, was a continuous effort.
  2683.  
  2684.      o The addition of a Man-Machine Interface review between the
  2685.        Critical Design Review and Product Delivery Review contributed
  2686.        significantly to the quality of the tool, particularly in
  2687.        terms of its usability.  Outside evaluation of the man-machine
  2688.        aspects of the tool provided extremely useful alternate
  2689.        views, and permited timely 'tweaking' of the interface which 
  2690.        would not have been possible if it had occured at the Product
  2691.        Delivery Review.
  2692.  
  2693.      o During the development of portable device-dependent 
  2694.        software, it is an excellent practice to isolate the device
  2695.        dependencies.  This was done very effectively on the GAD, and
  2696.        a terminal retarget (on a separate project) has been performed 
  2697.        to confirm the effectiveness of this approach.  A strong
  2698.        point of the Ada language is its package feature, which
  2699.        provides an excellent information hiding mechanism.  GAD 
  2700.        incorporates GKS (see Section 5.4.3) as one layer of 
  2701.        abstraction.
  2702.  
  2703.      o The use of the Graphical Kernel System on the GAD project
  2704.        had mixed results.  The Ada binding had not been completely
  2705.        defined when the project began, so a substitute (GKS_PRIME) was 
  2706.        developed.  During the project, questions arose concerning the
  2707.        semantic interpretation of the GKS standard, and the semantic
  2708.        correctness of GKS_PRIME.  The use of GKS provided an 
  2709.        excellent starting point for creating software to isolate 
  2710.        device dependencies.  As the project proceeded, however, 
  2711.        several occassions occurred where the limitations of GKS had to 
  2712.        be circumvented (use of non-standard features), or assumptions made 
  2713.        concerning device driver implementations, to prevent a reduction 
  2714.        in the effectivenss of the tool.
  2715.  
  2716.      o During the project, the software was transitioned from one 
  2717.        compiler to another.  Overall this was done very easily, 
  2718.        which is a testament to the inherent transportability of Ada
  2719.        and our design.  Some problems were detected with the second
  2720.        Ada compiler, which slipped through the first, showing
  2721.        the importance of good error detection in the development
  2722.        compiler.  Perhaps the most difficult task faced during the
  2723.        transition was debugging a large integrated piece of code
  2724.        with tools with which the staff was unfamilar.  The most severe
  2725.        problems had to do with IO, and these are discussed in the
  2726.        next paragraph.
  2727.  
  2728.      o Our experience with Ada on this project shows that the area
  2729.        of IO continues to be one of the major obstacles to 
  2730.        portability.  Our problem occurred due to the difference in
  2731.        functionality of the character-read subprogram of package
  2732.        TEXT_IO.  The first compiler used on this project supported
  2733.        true character IO, which is what is best suited to this
  2734.        application.  The second compiler did not complete character
  2735.        reads until an end-of-record was detected.  This is (was) a real
  2736.        problem, particularly when writing terminal driver software
  2737.        which must process escape code sequences from the terminal
  2738.        in a reasonable time frame.  Although this problem was overcome
  2739.        for GAD, several other similar tools SYSCON has developed have
  2740.        required the use of non-portable system service calls.  The
  2741.        use of system service calls to perform IO has been observed
  2742.        to be incompatible with standard IO calls on these same past
  2743.        projects.
  2744.  
  2745.  
  2746. 5.2  Development Approach
  2747.  
  2748. The development approach used by SYSCON in the development of the 
  2749. GAD is a multi-phased approach intended to optimize the quality of
  2750. the interactive tool under development. The phases of the
  2751. development are shown in Table 5.2-1. 
  2752.  
  2753. <FF>
  2754.  
  2755. Table 5.2-1  GAD Development Phases
  2756. -----------------------------------
  2757.  
  2758.      Concept Formulation
  2759.          Establish Objectives and Requirements
  2760.          Define Functionality (User's Manual)
  2761.          Define Hardware Environment
  2762.  
  2763.      Design 
  2764.          Prototyping of Key Features
  2765.          Macroscopic Design
  2766.          Microscopic Design
  2767.  
  2768.      Code and Debug              \
  2769.                                   \
  2770.      Integration and Testing       >  Iterative
  2771.                                   /
  2772.      Evaluation                  /
  2773.          (including MMI Design Review)
  2774.  
  2775. Several of the phases and sub-phases contributed significantly to 
  2776. the quality of the final product.  Prototyping was used early in 
  2777. the design phase to obtain a thorough understanding of the 
  2778. operation of the terminal and optimal methods for interacting with 
  2779. it, and to develop a set of packages implementing and manipulating 
  2780. the central data structure of the GAD, the Syntax Tree (see Section 
  2781. 2.2).
  2782.  
  2783. The iterative application of the final three phases (Code and 
  2784. Debug, Integration and Testing, and Evaluation) provided a 
  2785. mechanism for refining the functionality and performance of the 
  2786. GAD.  Although the first development phase includes the definition 
  2787. of the Man-Machine Interface, SYSCON recognized that only 
  2788. experience with usage of the tool itself will provide adequate 
  2789. understanding of the interface (especially given the newness of the 
  2790. application).  The iterative approach results in a significant 
  2791. strengthening of the MMI functionality and usability by 
  2792. incorporating feedback obtained during several evaluation cycles.
  2793.  
  2794. The development approach also made extensive use several 
  2795. development techniques/methods to assist in optimal utilization of 
  2796. advanced software engineering practises and Ada in the development 
  2797. effort.  The techniques and their benefits were:
  2798.  
  2799.      Usage of the Ada Graphic Notation Conventions to construct
  2800.      OODDs describing the intended architecture of the program.
  2801.           - provide a clear view of program architecture
  2802.           - evaluate interconnectivity of program modules
  2803.           - provide aid in managing development of the program
  2804.  
  2805.      Usage of prototyping to evaluate, validate and investigate critical 
  2806.      aspects of the design such as hardware functionality, low 
  2807.      level software interfaces and utilities, and MMIs.
  2808.           - avoid redesign due to misuse of hardware facilities
  2809.           - provide stable low-level software interfaces and utilities
  2810.           - provide a stable and realistic MMI
  2811.  
  2812.      Utilize compilable and executable Ada PDL to establish and enforce 
  2813.      desirable design characteristics, and provide a testbed for
  2814.      integrating software as it is developed.
  2815.           - provide design consistency
  2816.           - provide correct usage of Ada language features
  2817.           - establish a uniform level of design detail
  2818.           - emphasize early data type definitions
  2819.           - provide software integration mechanism
  2820.  
  2821. 5.3  Ada Issues
  2822.  
  2823. Ada provides a powerful implementation language that is well suited
  2824. to the writing of a rehostable and retargetable interactive
  2825. graphics editor such as the GAD.  Several significant issues
  2826. relating to the use of Ada are relevent to the development and
  2827. maintenance of the GAD software. These issues are 1) compiler
  2828. selection, 2) the impact of utilizing an incomplete non-production
  2829. quality Ada compiler during design, 3) the impact of transitioning
  2830. the GAD to the DEC Ada compiler midway through the development
  2831. effort, and 4) the possible methods of adapting the GAD packages to
  2832. rehost and/or retarget the software.  The last issue is discussed
  2833. extensively in Sections 4.3 and 4.4. 
  2834.  
  2835. 5.3.1  Compiler Selection
  2836.  
  2837. The design and development activities of the Graphic Ada Designer
  2838. project were initially conducted using the Government supplied
  2839. target compiler, which was the most recent release (at the time) of
  2840. the TeleSoft Ada compiler.  The TeleSoft compiler release utilized
  2841. contained two Ada compiler versions:  Version 2.1, which is a
  2842. certified pre-release version of the TeleSoft Ada compiler awaiting
  2843. validation, and Version 1.5, which is an incomplete Ada compiler
  2844. with near-production quality performance in terms of compilation
  2845. speed. 
  2846.  
  2847. The project was initiated using the Version 2.1 compiler in the
  2848. hopes of utilizing full Ada, with its significant advantages for
  2849. developing generalized code. Unfortunately, the performance and
  2850. support facilities of the Version 2.1 compiler were too poor to
  2851. continue using it beyond several early prototyping efforts. This
  2852. necessitated a conversion of the project and the design to the
  2853. TeleSoft Version 1.5 compiler.  The following shortcomings were the
  2854. principal factors leading to the decision to disgard the Version
  2855. 2.1 compiler: 
  2856.  
  2857.      - Extremely slow compilation speed.  During algorithm and
  2858.        hardware prototyping activities, turnaround times normally
  2859.        exceeded one hour, and averaged over two hours during normal 
  2860.        business hours.  Extrapolating the turnaround time for
  2861.        the full implementation indicated that it was highly probable
  2862.        that two or fewer compilations of the GAD software would be 
  2863.        possible per day.
  2864.      - The program library facility was extremely primitive.  Each
  2865.        time a main program unit was to be recompiled, special 
  2866.        TeleSoft utilities had to be invoked to reset the tables used
  2867.        to track compilation units in the library.  The library reset
  2868.        facility was slow and subject to errors (i.e., it was easy to
  2869.        remove too many or too few units) which would necessitate the
  2870.        reinitialization of the library (including recompilation of
  2871.        all units).
  2872.      - The TeleSoft Ada development system lacked any interactive
  2873.        debugging and tracing facilities.  Thus, debugging was usually
  2874.        reduced to an iterative process consisting of manually
  2875.        inserting trace statements in the code under development, 
  2876.        followed by recompilation and additional testing.
  2877.  
  2878. The primitive state of the debugging facilities in the TeleSoft
  2879. compiler system made rapid and reliable compilation turnaround a
  2880. necessity.  This fact, in combination with the poor compilation
  2881. speed and unreliable program library facilities, made the risk of
  2882. continuing development with the TeleSoft Version 2.1 compiler too
  2883. great. 
  2884.  
  2885. Part way through the project Digital Equipment Corporation
  2886. announced the availability of a validated Ada compiler for use with
  2887. its VAX/VMS operating system.  Evaluation of the DEC Ada compiler
  2888. by SYSCON and other DoD and Industry teams soon established its
  2889. performance characteristics as far superior to those of the
  2890. TeleSoft compiler in use.  After a brief period of experimentation
  2891. with an early copy of the TeleSoft Production Quality compiler,
  2892. SYSCON elected to purchase and install a copy of the DEC Ada
  2893. compiler on its VAX.  Shortly thereafter, with the approval of the
  2894. WIS/JPMO, the GAD project was transitioned to the DEC Ada compiler.
  2895.  
  2896. 5.3.2  Compiler Impact on Design and Implementation
  2897.  
  2898. The TeleSoft Version 1.5 compiler was used to perform the initial
  2899. design and development of the packages comprising the GAD. This
  2900. compiler lacked numerous Ada features, several of which had a
  2901. significant impact on the design and implementation of the system. 
  2902. These features are: 
  2903.  
  2904.      - generics
  2905.      - named associations for aggregates and calling parameters
  2906.      - dynamic record constructs
  2907.      - type attributes (incomplete)
  2908.      - universal expressions 
  2909.      - derived types
  2910.      - support for 32-bit Integer arithmetic
  2911.  
  2912. These missing features impacted the design by forcing a shift from
  2913. full Ada to the subset effectively supported by the compiler.  This 
  2914. shift altered the design in the following fashion:
  2915.  
  2916.      - prevented the use of dynamic calculations to define, 
  2917.        initialize, and manipulate data structure components, 
  2918.        which altered the top-level program architecture and 
  2919.        program initialization code.
  2920.      - prevented the use of generics forcing the development 
  2921.        of generalized and often replicated code in place of 
  2922.        instantiations of utility subprograms. 
  2923.      - prevented the use of derived types in segregating
  2924.        unrelated integer type data.
  2925.      - forced the splitting of packages (instead of the use of 
  2926.        subunits) due to restrictions on the maximum size of
  2927.        compilation units.
  2928.  
  2929.  
  2930. 5.3.3  Compiler Transition
  2931.  
  2932. As initially discussed in Section 5.2, the GAD project transitioned
  2933. during the Code and Debug development phase from the TeleSoft
  2934. Version 1.5 compiler to the DEC Ada compiler. The utilization of
  2935. this compiler enhanced the productivity of the staff and the
  2936. quality of GAD software by providing the following facilities: 
  2937.  
  2938.      - substantial increase in compilation rates.
  2939.      - complete Program Library Facilities including automatic
  2940.        minimal recompilation of programs and version control.
  2941.      - support for the full Ada language.
  2942.      - an interactive source level debugger.
  2943.  
  2944. The transition effort required approximately two calendar weeks to 
  2945. complete, and resulted in the expected quality and productivity 
  2946. improvements.  The major problem encountered in performing the 
  2947. transition was removing the errors previously tolerated by the 
  2948. TeleSoft compiler (e.g., contraints errors and improper type 
  2949. conversions).  These errors were uniformly distributed throughout 
  2950. the software, and effectively required the debugging of the entire 
  2951. program at once (this certainly forced us to quickly learn how to 
  2952. use the interactive debugger).  Some other interesting conversion
  2953. activities which occured were:
  2954.  
  2955.      - The development of a routine to remove the leading space from
  2956.        the INTEGER'image function for use in generating escape
  2957.        sequences to the terminal.  TeleSoft had not generated
  2958.        the space as required by the [AdaLRM].
  2959.      - The insertion of a compiler specific "Form" parameter in the 
  2960.        Create call for DIRECT_IO to establish the maximum record 
  2961.        size.
  2962.      - Moderate rework of the IO packages due to the different 
  2963.        handling of character IO by the DEC Run Time System (RTS).  
  2964.        The DEC RTS only completes IO calls after an entire record 
  2965.        (generally denoted by a <CR>) has been entered.  This was 
  2966.        by far the most persistent of the problems, and continues 
  2967.        to hamper the achievement of the desired level of robustness.
  2968.  
  2969. During the remaining portion of the development activities, most of 
  2970. the non-architectural shortcomings of the design forced by initial 
  2971. use of a subset compiler were removed.  The initialization sections 
  2972. of the code were virtually completely redone, and numerous other 
  2973. changes were made which consolidated code fragments and resulted in 
  2974. significantly more maintainable code.  Nevertheless,  the early 
  2975. subset compiler influence can still be seen in the architectural 
  2976. decomposition of the program.
  2977.  
  2978. 5.4  Key Technology Assessment
  2979.  
  2980. 5.4.1  Ada-based Intermediate Language with Graphics Attributes
  2981.  
  2982. The GAD utilizes an Ada-based Intermediate Language, whose Ada
  2983. binding is the Syntax Tree data structure described in Section 2.2.
  2984. The Intermediate Language is the corner stone of the GAD in that
  2985. all graph editing functions which can be performed require the use
  2986. of the Syntax Tree.  These functions include: 
  2987.  
  2988.      - entity and connection deletion
  2989.      - entity attribute modification
  2990.      - entity creation
  2991.      - scope search
  2992.      - semantic checking
  2993.  
  2994. Each of these functions require access to the information stored in
  2995. the nodes of the Syntax Tree and, more importantly, in the
  2996. relationships which exist (or can exist) between the nodes.  For
  2997. example, in a scope search the Syntax Tree is walked by traversing
  2998. the node relationships looking for the entity which most tightly
  2999. encloses the selected point (by examining the location information
  3000. associated with each entities node).  The graphical implications of
  3001. the Ada semantics (non-overlapping scopes) permits a tree-pruning
  3002. approach to locating the entity, which is significantly more 
  3003. efficient than an exhaustive search. 
  3004.  
  3005. The existing and potential capabilities of the GAD are defined by
  3006. the information which can be represented in the Intermediate
  3007. Language.  The addition and/or deletion of attribute information to
  3008. the various node types is fairly straightforward, such as might be
  3009. done in providing information on parameter modes, generic
  3010. parameters, expanded prologues, and data and object types. 
  3011.  
  3012. Alteration of the structural binding of the nodes is not nearly so
  3013. easy, and thus the inter-node relationships are the primary factor
  3014. in defining the capabilities and restrictions on the functionality
  3015. of the GAD.  The nature of the currently defined relations
  3016. (implemented largely as Lists) is one of Ada semantics, which tends
  3017. to force the semantic correctness of any graph created as well as
  3018. limiting the programs flexibility in terms of performing functions
  3019. which produce graphs without proper Ada semantic equivalence.  For
  3020. this reason, the Syntax Tree was one of two critical areas
  3021. prototyped during the design phase. 
  3022.  
  3023. The implementation of the Ada-based Intermediate Language in Ada 
  3024. has shown several significant advantages over other languages.  
  3025. Each node was described as a variant record which contained some or 
  3026. all of the previously defined inter-node relationships.  Algorithms 
  3027. for manipulating nodes and lists could be very general because of 
  3028. the constraint checking performed by Ada language, i.e., Ada 
  3029. exception handling automatically caught invalid operations, thereby 
  3030. eliminating the extensive code otherwise required to perform the
  3031. same checking. 
  3032.  
  3033. 5.4.2  Semantic Checking in Interactive Graphics Editing
  3034.  
  3035. A unique feature of the GAD is the semantic checking which it
  3036. performs during the editing of graphs.  The program forces the user
  3037. to create OODDs which are semantically correct from an
  3038. architectural perspective.  SYSCON observed and addressed a number
  3039. of issues in implementing the GAD with this capability. 
  3040.  
  3041. The semantic checking implemented by the GAD is performed
  3042. "on-the-fly", such that each successive state transition (and hence
  3043. state) is semantically checked.  This is in contrast to the other
  3044. primary approach to semantic checking, wherein checking is
  3045. performed "on-request".  SYSCON elected to implement the GAD with
  3046. "on-the-fly" checking due to several potential difficulties with
  3047. implementing "on-request" semantic checking.  These difficulties
  3048. center around the problems of locating errors which have a
  3049. graphical (positional) origin, particularly for the notational
  3050. conventions which are supported. It is conceivable that a user
  3051. could create an invalid graph whose corresponding graph could never
  3052. be uncorrupted (i.e., reduced to an unambiguous semantic state). 
  3053. Another problem with using an "on-request" approach is the
  3054. difficultly in providing automatic support for correctly completing
  3055. a operation, since there is no notion of correctness in
  3056. intermediate states. 
  3057.  
  3058. Using the "on-the-fly" approach to create semantically correct
  3059. OODDs, the number of design options available to the designer have
  3060. been intentionally limited to those which are correct. In some
  3061. cases, a user of the GAD may wish to represent and/or consider a
  3062. design which is not semantically correct Ada.  This could occur on
  3063. a mixed development language project, as an intermediate state
  3064. during a reorganization of the design, or because the designer
  3065. wishes to show abstractions in a way which is not valid Ada.  In
  3066. SYSCON's experience with the non-semantic checking predecessor of
  3067. the GAD, a common phenomena was the expression of a valid Ada
  3068. program with semantically invalid graphs which the human reader
  3069. could easily and logically complete correctly.  The non-valid
  3070. graphs were esthetically more pleasing and felt to be as
  3071. informative, even if not as semantically correct.  The utilization
  3072. of incorrect graphs is not permited by GAD, and experience with GAD
  3073. has shown that many of this type of problem can be overcome with
  3074. experience in using the tool. 
  3075.  
  3076. This introduces the issue of design detail or abstraction.  The
  3077. creation of semantically correct graphs tends to force the creation
  3078. and manipulation of a large volume of details.  For example, GAD
  3079. does not allow a non-local subprogram to be called unless it has
  3080. been exported to an appropriate visible level.  This is despite the
  3081. fact that it may be obvious to the designer/reviewer that a
  3082. non-exported subprogram is (or should be) intuitively exported
  3083. after a non-local call has been made to it.  This exactly parallels
  3084. what is required in the alteration of Ada programs at the source
  3085. level (without the recompilation overhead). The GAD implements
  3086. several features to assist the designer with detail manipulation,
  3087. including a restriction on the level of detail permitted, and the
  3088. ability to export stand-alone subprograms. 
  3089.  
  3090. The previous example illustrates another of the issues, which deals
  3091. with the visibility of entities within a graph.  SYSCON has chosen
  3092. to implement visibility requirements in the strict Ada sense, in
  3093. keeping with the general philosophy of semantic correctness.  The
  3094. strictest possible implementation of this would result in an
  3095. extensive burden on the designer to establish visibility prior to
  3096. utilization.  This potential burden is ameliorated by the
  3097. implementation of automatic visibility for each entity on all other
  3098. entities at the same scoping level.  This results in the automatic
  3099. insertion of "with" statements for all top-level units which are
  3100. referenced, and the declaration of all local entities such they
  3101. would be visible to all other entities within the same inner scope.
  3102.  
  3103. 5.4.3  GKS Utilization for Terminal Dependence Reduction
  3104.  
  3105. The Graphical Kernel System ( GKS ) is a international ( ISO )
  3106. and national ( ANSI ) standard for an application level interface
  3107. to computer graphics systems.  GKS defines a set of language
  3108. independent functions for a standard display-device independent
  3109. interface to two-dimensional, color-capable graphics systems.  The
  3110. set of GKS functions, which support a wide range of capabilities,
  3111. from output primitives to interactive graphics, is intended to be
  3112. implementable in many programming languages.
  3113.  
  3114. A language binding for a specific programming language defines the
  3115. syntactical interface between GKS and graphics application programs
  3116. written in that language.  Language bindings to ANSI languages,
  3117. including Ada, are included as part of the GKS standard.
  3118.  
  3119. The motivation for use of GKS is to increase the portability of
  3120. graphic application programs and graphics systems, and to
  3121. facilitate application program development.  Utilizing the GKS as
  3122. the interface between a graphics application program and the
  3123. graphics hardware minimizes device dependencies embedded in the
  3124. program.  A graphics application program which communicates with
  3125. the graphics hardware through the GKS uses the standard GKS
  3126. interfaces and, in general, does not require knowledge of graphic
  3127. hardware features and characteristics.  Transitioning the graphics
  3128. program to different graphics hardware when the hardware is
  3129. supported by a GKS implementation is simplified since device
  3130. dependencies are limited to GKS. 
  3131.  
  3132. The use of GKS can have a positive effect on application code by 
  3133. reducing its terminal dependence, thereby promoting its portability 
  3134. and maintainability.  SYSCON felt that the use of GKS on the GAD
  3135. project had a positive effect, particularly as a means of providing
  3136. an interface for isolating terminal dependencies from a more
  3137. experienced perspective (particularly for hardware with which we
  3138. were not familar).  The usage of GKS had three primary drawbacks,
  3139. which were: 
  3140.  
  3141.      o The unavailability of an implementation of an Ada binding
  3142.        of GKS.  The implementation of SYSCON's GKS substitute is
  3143.        discussed in the next section.
  3144.  
  3145.      o The level of feature support in GKS for advanced graphics
  3146.        features (which are becoming quite common) is low.  This
  3147.        forces programs to use the extension mechanisms built into
  3148.        GKS which reduces portability.
  3149.  
  3150.      o The effects of certain graphics operations in GKS is not
  3151.        rigidly defined.  For example, there are numerous ways of
  3152.        implementing highlighting.  Interactive graphics tools, such
  3153.        as the GAD, require assumptions about the implementation of
  3154.        operations if they are to be used in place of extensions.
  3155.        The result is that tool retargeting will normally require
  3156.        at least some IO driver rewriting (as opposed to using off-
  3157.        the-shelf drivers).
  3158.  
  3159. These drawbacks are not sufficient to warrant discontinuing the use 
  3160. of GKS.  However, projects and/or programs contemplating the use of 
  3161. GKS should be aware that it is an aid to achieving improved 
  3162. portability, and not a panacea for all problems.
  3163.  
  3164.  
  3165. 5.4.4  Implementation of a GKS Substitute
  3166.  
  3167. No Ada language binding to GKS was available for the GAD project
  3168. at the time of development, so SYSCON implemented a version of GKS
  3169. for use with the GAD.  The functions implemented comprise a subset
  3170. of GKS, referenced by the name GKS_PRIME.  Only the operations and
  3171. functions required by the GAD were implemented, and operations
  3172. and functions not used were not implemented.  The type definitions
  3173. and subprogram calls which are contained in GKS_PRIME are those
  3174. defined in the Draft GKS Binding to ANSI Ada [AdaGKS].  The
  3175. implementation of this package is close enough to the real GKS,
  3176. that its utilization permits the Graphic Ada Designer to be easily
  3177. converted to using a real version of GKS.  Table 5.4-1 summarizes 
  3178. the differences between GKS_PRIME and GKS, and the following 
  3179. paragraphs elaborate on these differences.
  3180.  
  3181. <FF>
  3182.  
  3183. Table 5.4-1.  GKS_PRIME Differences From GKS
  3184. --------------------------------------------
  3185.  
  3186.      o The precedence of calls that an implementation of
  3187.        GKS might require is ignored if not functionally
  3188.        required by GKS_PRIME.  Specifically, workstation 
  3189.        level calls (e.g., open and close) are not required 
  3190.        or supported.
  3191.  
  3192.      o GKS_PRIME and its associated drivers implement
  3193.        color highlighting, which is needed by GAD but not
  3194.        required by the GKS standard.
  3195.  
  3196.      o All non-standard calls permitted by GKS (as ESCAPE and
  3197.        GDP [generalized drawing primitive] calls) are encapsulated
  3198.        in the package GKS_NON_STANDARD.  
  3199.  
  3200.      o The values of unrequired input and output parameters
  3201.        are ignored.
  3202.  
  3203.  
  3204. While the syntax of the implemented functions correspond to the
  3205. draft language binding, in some cases the semantics do not; i.e.,
  3206. while the appropriate call parameters are input to and received
  3207. from a GKS_PRIME subprogram, the parameter values may not be set
  3208. properly if their use is not required by GKS_PRIME or by the GAD.
  3209.  
  3210. The possibility also exists that functions which have been
  3211. implemented in GKS_PRIME may operate differently when run on a
  3212. true GKS implementation.  As an example, a GKS implementation
  3213. utilizing the Tektronix 4107 may use the hardware highlight
  3214. capabilities, a segment blink, whereas GKS_PRIME utilizes a
  3215. color highlight which provides a more conducive man-machine
  3216. interface.
  3217.  
  3218. All references to terminal graphic capabilities are performed
  3219. through two packages, GKS_PRIME and GKS_NON_STANDARD.  The
  3220. GKS_NON_STANDARD package implements graphic functions which require
  3221. access to terminal hardware capabilities which are not addressed by
  3222. standard GKS (e.g., character background color).  The rationale for
  3223. having another graphics interface package is to distinctively
  3224. separate the functions which are not addressed by the standard GKS.
  3225. The ESCAPE and the GDP functions defined in the standard GKS
  3226. provide a way of specifying non-standard activites in GKS, but the
  3227. actual handling of these functions in Ada had not been defined
  3228. at the time of our design of GKS_PRIME.  The ESCAPE function allows
  3229. an application program to control hardware capabilities not
  3230. addressed by the standard GKS functions, while the GDP function
  3231. allows an application program to specify non-standard output
  3232. primitives.  The GAD-required functions implemented in the
  3233. GKS_NON_STANDARD package would be implemented via the ESCAPE and
  3234. GDP functions defined in the standard. 
  3235.  
  3236. 5.5  Productivity
  3237.  
  3238. The GAD was developed entirely in Ada utilizing a compilable Ada
  3239. PDL to assist with the rapid prototyping of the tool (see Section
  3240. 5.2).  Tables 5.5-1 and 5.5-2 give the results of a Statement
  3241. Analysis which was performed on the GAD software. Specifically,
  3242. these tables show the constituent constructs of the software
  3243. comprising the GAD.  Table 5.5-3 gives the man hours by category
  3244. used to the develop the software.  In interpreting the data
  3245. provided by these tables, care must be taken not to overlook the
  3246. research aspects of the project.  The rapid prototyping approach
  3247. was utilized to provide a vehicle for gaining understanding of the
  3248. issues and problems involved with the development of an interactive
  3249. graphics design tool which performs semantic checking. 
  3250. <FF>
  3251.  
  3252. Table 5.5-1.  GAD Statement Analysis Breakdown
  3253.  
  3254. --------------------------------------------------------------------------
  3255. |   -    COMPILATION UNIT |        |        |        |         |         |
  3256. |     -                   |        |        |        |         |         |
  3257. |       -                 | GAD    |GRAPH_  |MMI     |PDL      |GRAPHICS_|
  3258. |         -               |        |TREE_   |        |GENERATOR|DRIVER   |
  3259. |           -             |        |ACCESS  |        |         |         |
  3260. |             -           |PROGRAM |VIRTUAL |VIRTUAL |VIRTUAL  |VIRTUAL  |
  3261. |               -         |UNIT    |PACKAGE |PACKAGE |PACKAGE  |PACKAGE  |
  3262. |                 -       |        |        |        |         |         |
  3263. |   STATEMENT TYPE -      |SUBTOTAL|SUBTOTAL|SUBTOTAL|SUBTOTALS|SUBTOTALS|
  3264. --------------------------|--------|--------|--------|---------|---------|
  3265. |LEXICAL ELEMENTS         |                                              |
  3266. | Comments                |      39     1064     1668       336       854|
  3267. | Pragmas                 |       0        0        0         0         0|
  3268. |DECLARATIONS AND TYPES   |                                              |
  3269. | Object Declarations     |       2      199      337        41       160|
  3270. | Number Declarations     |       0        0        0         0         0|
  3271. | Type Declarations       |       0       22        6         2        25|
  3272. | Subtype Declarations    |       0       18       30         0        11|
  3273. | Integer Types           |       0        0        0         0         0|
  3274. | Real Types              |       0        0        0         0         0|
  3275. |   Floating Point        |       0        0        0         0         0|
  3276. |   Fixed Point           |       0        0        0         0         0|
  3277. | Array Types             |       0        8        0         0         6|
  3278. | Record Types            |       0        7        2         0         6|
  3279. | Access Types            |       0        0        0         0         0|
  3280. |NAMES AND EXPRESSIONS    |                                              |
  3281. | Attributes              |       0       56       43        14        16|
  3282. | Allocators              |       0        0        0         0         0|
  3283. |STATEMENTS               |                                              |
  3284. | Assignment Statements   |       6      310      468        90       225|
  3285. | If Statements           |       1      172      200        86        83|
  3286. | Case Statements         |       0       20       29         3         5|
  3287. | Loop Statements         |       0       59       56        26        10|
  3288. | Block Statements        |       1       11       36         4         2|
  3289. | Exit Statements         |       0       44       26         3         2|
  3290. | Return Statements       |       0       77       23        10         8|
  3291. | Goto Statements         |       0        0        0         0         0|
  3292. | Label Statements        |       0        0        0         0         0|
  3293. |SUBPROGRAMS              |                                              |
  3294. | Subprogram Declarations |       0       54       29         1        34|
  3295. | Subprogram Bodies       |       0       60       49        18        37|
  3296. | Subprogram Calls        |      12      181      749       214       141|
  3297. --------------------------------------------------------------------------
  3298. <FF>
  3299.  
  3300. Table 5.5-1.  GAD Statement Analysis Breakdown continued
  3301.  
  3302. --------------------------------------------------------------------------
  3303. |   -    COMPILATION UNIT |        |        |        |         |         |
  3304. |     -                   |        |        |        |         |         |
  3305. |       -                 | GAD    |GRAPH_  |MMI     |PDL      |GRAPHICS_|
  3306. |         -               |        |TREE_   |        |GENERATOR|DRIVER   |
  3307. |           -             |        |ACCESS  |        |         |         |
  3308. |             -           |PROGRAM |VIRTUAL |VIRTUAL |VIRTUAL  |VIRTUAL  |
  3309. |               -         |UNIT    |PACKAGE |PACKAGE |PACKAGE  |PACKAGE  |
  3310. |                 -       |        |        |        |         |         |
  3311. |   STATEMENT TYPE -      |SUBTOTAL|SUBTOTAL|SUBTOTAL|SUBTOTALS|SUBTOTALS|
  3312. --------------------------|--------|--------|--------|---------|---------|
  3313. |PACKAGES                 |                                              |
  3314. | Package Specifications  |       0        4        6         2         2|
  3315. | Package Bodies          |       0        4        5         1         1|
  3316. | Private Types           |       0        1        0         0         0|
  3317. | Limited Types           |       0        0        0         0         0|
  3318. |VISABILITY RULES         |                                              |
  3319. | Use Clauses             |       6       15       47         6         9|
  3320. | Renaming Declarations   |       0        5        2         0         6|
  3321. |TASKS  (Not Used)        |                                              |
  3322. |PROGRAM STRUCTURE        |                                              |
  3323. | With Clauses            |       7       21       65         7         9|
  3324. | Subunits (is separate)  |       0        0        0         0         0|
  3325. |EXCEPTIONS               |                                              |
  3326. | Exception Declarations  |       0       13       19         0         6|
  3327. | Exception Handlers      |       3       24      117         4         1|
  3328. | Raise Statements        |       2       43      124         1         5|
  3329. |GENERIC UNITS            |                                              |
  3330. | Generic Declarations    |       0        0        0         0         0|
  3331. | Generic Instantiations  |       0        1        0         0         0|
  3332. |REPRESENTATION CLAUSES   |                                              |
  3333. | Length Clauses          |       0        0        0         0         0|
  3334. | Enumeration Rep Clauses |       0        0        0         0         0|
  3335. | Record Rep Clauses      |       0        0        0         0         0|
  3336. | Address Clauses         |       0        0        0         0         0|
  3337. |GENERAL INFORMATION      |                                              |
  3338. | Total Lines             |      98     4073     6771      1221      2741|
  3339. | Total Statements        |      38     1490     2364       521       848|
  3340. --------------------------------------------------------------------------
  3341. <FF>
  3342. Table 5.5-2.  GAD Statement Analysis Breakdown
  3343.  
  3344. --------------------------------------------------------------------------
  3345. |   -    COMPILATION UNIT |         |         |         |         |      |
  3346. |     -                   |         |         |         |         |      |
  3347. |       -                 |GKS_     |VIRTUAL_ |TERMINAL_|OTHER    |GAD   |
  3348. |         -               |PRIME    |TERMINAL_|  ACCESS |         |      |
  3349. |           -             |         |INTERFACE|         |         |      |
  3350. |             -           |VIRTUAL  |VIRTUAL  |VIRTUAL  |COMP     |SYSTEM|
  3351. |               -         |PACKAGE  |PACKAGE  |PACKAGE  |UNITS    |      |
  3352. |                 -       |         |         |         |         |      |
  3353. |   STATEMENT TYPE -      |SUBTOTALS|SUBTOTALS|SUBTOTALS|SUBTOTALS|TOTALS|
  3354. --------------------------|---------|---------|---------|---------|------|
  3355. |LEXICAL ELEMENTS         |                                       |      |
  3356. | Comments                |      797       250       918        26|  5952|
  3357. | Pragmas                 |        0         0         0         0|     0|
  3358. |DECLARATIONS AND TYPES   |                                       |      |
  3359. | Object Declarations     |       56        17       266         2|  1080|
  3360. | Number Declarations     |        0         0         0         0|     0|
  3361. | Type Declarations       |        7         4        38         0|   104|
  3362. | Subtype Declarations    |        2         4        35         0|   100|
  3363. | Integer Types           |        0         0         0         0|     0|
  3364. | Real Types              |        0         0         0         0|     0|
  3365. |   Floating Point        |        0         0         0         0|     0|
  3366. |   Fixed Point           |        0         0         0         0|     0|
  3367. | Array Types             |        1         0         0         0|    15|
  3368. | Record Types            |        6         0         6         0|    27|
  3369. | Access Types            |        0         0         0         0|     0|
  3370. |NAMES AND EXPRESSIONS    |                                       |      |
  3371. | Attributes              |       39        12        71         0|   251|
  3372. | Allocators              |        0         0         0         0|     0|
  3373. |STATEMENTS               |                                       |      |
  3374. | Assignment Statements   |       53        41       324         1|  1518|
  3375. | If Statements           |       44        30        83         2|   701|
  3376. | Case Statements         |        5         5         5         0|    72|
  3377. | Loop Statements         |        1         2        12         0|   166|
  3378. | Block Statements        |        0         0         2         0|    56|
  3379. | Exit Statements         |        0         0         0         0|    75|
  3380. | Return Statements       |        0         2        12         0|   132|
  3381. | Goto Statements         |        0         0         0         0|     0|
  3382. | Label Statements        |        0         0         0         0|     0|
  3383. |SUBPROGRAMS              |                                       |      |
  3384. | Subprogram Declarations |       40        14       104         2|   278|
  3385. | Subprogram Bodies       |       40        18       116         2|   340|
  3386. | Subprogram Calls        |       88        67       360         4|  1816|
  3387. --------------------------------------------------------------------------
  3388. <FF>
  3389. Table 5.5-2.  GAD Statement Analysis Breakdown continued
  3390.  
  3391. --------------------------------------------------------------------------
  3392. |   -    COMPILATION UNIT |         |         |         |         |      |
  3393. |     -                   |         |         |         |         |      |
  3394. |       -                 |GKS_     |VIRTUAL_ |TERMINAL_|OTHER    |GAD   |
  3395. |         -               |PRIME    |TERMINAL_|  ACCESS |         |      |
  3396. |           -             |         |INTERFACE|         |         |      |
  3397. |             -           |VIRTUAL  |VIRTUAL  |VIRTUAL  |COMP     |SYSTEM|
  3398. |               -         |PACKAGE  |PACKAGE  |PACKAGE  |UNITS    |      |
  3399. |                 -       |         |         |         |         |      |
  3400. |   STATEMENT TYPE -      |SUBTOTALS|SUBTOTALS|SUBTOTALS|SUBTOTALS|TOTALS|
  3401. --------------------------|---------|---------|---------|---------|------|
  3402. |PACKAGES                 |                                       |      |
  3403. | Package Specifications  |        8         1         2         1|    26|
  3404. | Package Bodies          |        7         1         2         1|    22|
  3405. | Private Types           |        0         0         0         0|     1|
  3406. | Limited Types           |        0         0         0         0|     0|
  3407. |VISABILITY RULES         |                                       |      |
  3408. | Use Clauses             |        7         4         6         1|   101|
  3409. | Renaming Declarations   |        2         0         1         0|    16|
  3410. |TASKS  (Not Used)        |                                       |      |
  3411. |PROGRAM STRUCTURE        |                                       |      |
  3412. | With Clauses            |        7         3         7         1|   127|
  3413. | Subunits (is separate)  |        0         0         0         0|     0|
  3414. |EXCEPTIONS               |                                       |      |
  3415. | Exception Declarations  |        0         0         2         0|    40|
  3416. | Exception Handlers      |        5         1        32         1|   188|
  3417. | Raise Statements        |        5         0        32         0|   212|
  3418. |GENERIC UNITS            |                                       |      |
  3419. | Generic Declarations    |        1         0         0         0|     1|
  3420. | Generic Instantiations  |        0         2         1         0|     4|
  3421. |REPRESENTATION CLAUSES   |                                       |      |
  3422. | Length Clauses          |        0         0         0         0|     0|
  3423. | Enumeration Rep Clauses |        0         0         0         0|     0|
  3424. | Record Rep Clauses      |        0         0         0         0|     0|
  3425. | Address Clauses         |        0         0         0         0|     0|
  3426. |GENERAL INFORMATION      |                                       |      |
  3427. | Total Lines             |     1761       725      4240        68| 21698|
  3428. | Total Statements        |      459       249      1574        17|  7560|
  3429. --------------------------------------------------------------------------
  3430. <FF>
  3431.  
  3432. Table 5.5-3.  Project Man Power Utilization 
  3433.  
  3434.  
  3435.      WORK BREAKDOWN STRUCTURE         HOURS EXPENDED
  3436.         ELEMENTS                      TOTAL
  3437.      
  3438.      Task 1 - Define User Interface
  3439.      SPA HOURS                               16
  3440.      SSA HOURS                              239
  3441.      
  3442.      Task 2 - Design
  3443.      SPA HOURS                              254
  3444.      SSA HOURS                            1,022
  3445.      
  3446.      Task 3 - Code and Debug
  3447.      SPA HOURS                              373
  3448.      SSA HOURS                              276
  3449.      SA HOURS                               526
  3450.      
  3451.      Task 4 - Integrate and Test
  3452.      SPA HOURS                              385
  3453.      SSA HOURS                              320
  3454.      SA HOURS                               257
  3455.      
  3456.      Task 5 - Deliverable Preparation
  3457.      SPA HOURS                              388
  3458.      SSA HOURS                              350
  3459.      SA HOURS                               250
  3460.      
  3461.      Task 6 - Management 
  3462.      PE HOURS                               337
  3463.      SPA HOURS                               84
  3464.      
  3465.      
  3466.      Summary by Labor Category
  3467.      PE                                     337
  3468.      SPA                                  1,500
  3469.      SSA                                  2,207
  3470.      SA                                   1,033
  3471.      
  3472.      Total Hours                              5,077
  3473.      
  3474.  
  3475. 5.6    Methodology Adaptation
  3476.  
  3477. The GAD is a high-level design tool intended to support the design
  3478. and development of the structures of an Ada program.  The tool, as
  3479. currently implemented, forces top-down structural decomposition
  3480. utilizing a series of step-wise refinements.  Other implementation
  3481. strategies exist, and the GAD can be adapted to utilize some of the
  3482. various ideas they embody including: 
  3483.  
  3484.      Graphic Notations Conventions
  3485.      Top-Down Design Approach
  3486.      Virtual Package Concept
  3487.      Modularity
  3488.      Enforcement of Semantic Correctness
  3489.  
  3490. The GAD is not suited to some design techniques.  For example, the 
  3491. detailed representations contained in low-level flowcharts are 
  3492. not within the scope of the GAD. 
  3493.  
  3494. This section includes a brief discussion on the GAD's inherent
  3495. design techniques and methodologies.  Some of these items can be
  3496. adapted to fit alternate implementation strategies.  Note that the
  3497. implementer should consult Section 4.2 for information on altering
  3498. user adaptable compile-time parameters.  Two popular design
  3499. decomposition techniques, Bottom-Up and Data Flow, are addressed at
  3500. the end of this section as possible candidates to which an
  3501. implementer might adapt GAD. 
  3502.  
  3503. Ada Graphic Notations Conventions define the symbology of the
  3504. GAD.  These items can be altered if the implementer wants a
  3505. different symbology.  The shapes of the graphical representations
  3506. of the Ada entities can be changed, but this is not recommended. 
  3507.  
  3508. Structured Top-Down Decomposition is implemented by the GAD. 
  3509. Placement of entities to be created are at the outermost scope
  3510. or within a previously created entity.  Annotations for entities
  3511. are added after entity creation.  Calls and connections are made
  3512. after the connected entities have been created.  For adaptation of
  3513. the GAD from Top-Down to Bottom-Up designing, read the discussion
  3514. on adapting to the Bottom-Up Approach (see below). 
  3515.  
  3516. The Virtual Package Concept is a design abstraction that allows
  3517. the grouping of related Ada entities without requiring the 
  3518. creation/existence of a corresponding code structures in the 
  3519. implementation (e.g., subsystem grouping.)  The virtual package
  3520. embodies all the concepts of a package, except for allowing a
  3521. generic declaration. The implementer could eliminate the virtual
  3522. package from the GAD if, for example, it is not consistent with the
  3523. implementer's methodology.  The easiest way to accomplish this
  3524. would be to eliminate the icons that represent references to virtual
  3525. packages and imported virtual packages. 
  3526.  
  3527. Modularity is included as a by-product of working with an
  3528. Ada-based tool.  The GAD does have one feature which enforces a
  3529. modular design.  The nesting level for enclosing Ada entities is
  3530. limited by GAD.  By raising the allowable value, the implementer
  3531. essentially eliminates the possibility of encountering a nesting
  3532. limit.  The value associated with the nesting level is an
  3533. adaptable, compile-time parameter. 
  3534.  
  3535. The Enforcement of Semantic Correctness is an excellent feature of
  3536. the GAD tool. Automatic detection of design errors during creation
  3537. of an OODD prevents the loss of design time due to structure error.
  3538.  Errors discovered during creation include violations of scoping
  3539. rules when placing entities and violations of visibility rules when
  3540. calling subprograms and entry points. The implementer can remove
  3541. the Enforcement of Semantic Correctness from the GAD with extensive
  3542. editing of the MMI Software.  Elimination of the error detections
  3543. is not recommended. 
  3544.  
  3545. The Bottom-Up Approach to design builds higher-level abstractions
  3546. from lower-level declarations and processing units.  During the initial 
  3547. design of GAD, it was impossible to create an entity that enclosed a
  3548. previously created entity.  The new out-of-scope features added to
  3549. the GAD program have made scope altering operations possible,
  3550. thereby adapting GAD to use with Bottom-Up Approachs.  This is
  3551. particularly true for out-of-scope creation, which permits the
  3552. encapsulation of existing entities as required by Bottom-Up
  3553. Approachs. 
  3554.  
  3555. Data Flow Diagrams are used to show data flow between graphically
  3556. represented modules (called bubbles or clouds).  The diagrams are
  3557. different from static structure diagrams that contain items such
  3558. as nested program units or subprogram call connections.  Since
  3559. the GAD graphical entities can be applied to Ada data flow
  3560. diagram representations, the basic creation and manipulation
  3561. operations needed for diagram production are provided with GAD.
  3562. Note that the use of the virtual package as a uncommitted bubble
  3563. in the diagram would be appropriate.  But, the adaptation of the GAD
  3564. to support the creation of complete data flow diagrams would
  3565. demand extensive additions and revisions.  One addition would be
  3566. the definition and representation of a data flow connector
  3567. symbol.  A label describing the action on the data should be
  3568. associated with each occurrence of an individual connection. 
  3569. Also more detail must be added to the declaration of graphical
  3570. representations.  Current labeling should expand to include
  3571. information on the manipulation of data within the scope of
  3572. entities.  Ada types, objects, and exceptions need explicit
  3573. definitions, rather than relying on good name selections,   to
  3574. insure proper understanding when using these variables. Parameter
  3575. declaration would need elaboration to include information on
  3576. in/out status.  In addition, the MMI software operations that are
  3577. pertinent to structured graph production could be removed to
  3578. enhance the operations. 
  3579. <FF>
  3580.  
  3581. 6.  TESTING
  3582.  
  3583. 6.1  Approach
  3584.  
  3585. The purpose of the testing of the Graphic Ada Designer is to
  3586. establish if GAD meets its Functional Requirements, as described by
  3587. the User's Manual (and approved at the Man-Machine Interface (MMI)
  3588. Review).  In assessing compliance with the Functional Requirements
  3589. the testor needs to establish that GAD 1) provides all of the
  3590. documented functions (e.g., the ability to create a graphic entity
  3591. representing a package), and 2) that all of the functions are
  3592. consistently and correctly implemented (e.g., the aforementioned
  3593. operation produces the correct symbol, has the proper properties,
  3594. and is represented correctly during PDL generation). 
  3595.  
  3596. Section 6.2, Test Requirements,  details the Functional
  3597. Requirements of GAD.  Because both GAD and the test requirements
  3598. are functionally oriented, testing is conducted by performing each
  3599. of the functions described in the Section 6.2.  This approach
  3600. was/will be utilized to perform the Functional Testing of the
  3601. GAD and to define the acceptance criteria at the Product Delivery
  3602. Review. 
  3603.  
  3604.  
  3605. 6.2  Test Requirements
  3606.  
  3607. This section documents the functional test requirements needed to
  3608. test the software modules comprising the GAD.
  3609.  
  3610. 6.2.1  Graphics Design 
  3611.  
  3612.    Create entities and connections
  3613.       Functional test requirements:
  3614.          A) The specified entity name should not exceed the width of
  3615.             the created entity.
  3616.          B) Contained entities must be entirely inside the containing
  3617.             entity.
  3618.          C) Maximum level of nesting is six.
  3619.          D) The selected entity is created.
  3620.          E) The current graphic attributes ( color, line type, etc.)
  3621.             are used to draw an entity.
  3622.          F) The graphic attributes can be modified.
  3623.          G) Invalid Ada identifiers (e.g., trailing underscore) and
  3624.             excessively long identifiers cannot be used.
  3625.  
  3626.    Create Virtual Package
  3627.       Functional test requirements:
  3628.          A) Virtual package cannot be a generic.
  3629.          B) Virtual packages can be created as stand alone or
  3630.             nested entities.
  3631.          C) A prologue consisting of up to three lines of ASCII
  3632.             text is requested and stored.
  3633.  
  3634.    Create Package
  3635.       Functional test requirements:
  3636.          A) The generic status is requested and displayed.
  3637.          B) If this is a generic instantiation then a valid Ada 
  3638.             identifier is requested and displayed as the name of 
  3639.             instantiated unit.
  3640.          C) Packages can be created as stand alone or
  3641.             nested entities.
  3642.          D) A prologue consisting of up to three lines of ASCII
  3643.             text is requested and stored.
  3644.          E) No contained entities may be created inside of an
  3645.             instantiated package.
  3646.  
  3647.    Create Procedure
  3648.       Functional test requirements:
  3649.          A) The generic status is requested and displayed.
  3650.          B) If this is a generic instantiation then a valid Ada 
  3651.             identifier is requested and displayed as the name of 
  3652.             instantiated unit.
  3653.          C) If specified, the presence of parameters is displayed.
  3654.          D) Required parameters are indicated on generic declaration.
  3655.          E) Procedures can be created as stand alone or
  3656.             nested entities.
  3657.          F) A prologue consisting of up to three lines of ASCII
  3658.             text is requested and stored.
  3659.          G) No contained entities may be placed inside an instantiated
  3660.             procedure.
  3661.  
  3662.    Create Function
  3663.       Functional test requirements:
  3664.          A) The generic status is requested and displayed.
  3665.          B) If this is a generic instantiation then a valid Ada 
  3666.             identifier is requested and displayed as the name of 
  3667.             instantiated unit.
  3668.          C) If specified, the presence of parameters is displayed.
  3669.          D) Name of function is preceded by = on display.
  3670.          E) Required parameters are indicated on generic declaration.
  3671.          F) Functions can be created as stand alone or
  3672.             nested entities.
  3673.          G) No contained entities are allowed in an instantiation.
  3674.          H) A function name may overload Ada predefined operators
  3675.             such as "*" and "+".
  3676.          I) A prologue consisting of up to three lines of ASCII
  3677.             text is requested and stored.
  3678.  
  3679.    Create Task
  3680.       Functional test requirements:
  3681.          A) Tasks may only be nested entities, no stand-alone tasks may
  3682.             be created.
  3683.          B) Task types are not supported.
  3684.          C) A prologue consisting of up to three lines of ASCII
  3685.             text is requested and stored.
  3686.  
  3687.    Create Body
  3688.       Functional test requirements:
  3689.          A) Bodies may be created only as nested entities within
  3690.             - packages
  3691.             - virtual packages
  3692.             - procedures
  3693.             - functions
  3694.             - tasks.
  3695.          B) No contained entities may be created within executable
  3696.         bodies.
  3697.          C) Call connections can originate within executable bodies.
  3698.  
  3699.    Create Annotating Entities
  3700.       Functional test requirements:
  3701.          A) The annotating entities which may be created are:
  3702.             - Task Entry Point
  3703.             - Exported Type
  3704.             - Exported Object
  3705.             - Exported Exception
  3706.             - Exported Procedure
  3707.             - Exported Function
  3708.             - Exported Task Entry
  3709.             - Imported Virtual Package
  3710.             - Imported Package
  3711.             - Imported Procedure
  3712.             - Imported Function
  3713.          B) The Task Entry Point annotation is valid only
  3714.             on task entities.
  3715.             - If specified, guard conditions are displayed.
  3716.         - If specified, the presence of parameters is displayed.
  3717.          C) Exported and Imported annotating entities are valid
  3718.             only on package and virtual package entities.
  3719.          D) Exported entities are always shown on the left side of an 
  3720.             entity.
  3721.          E) Imported entities are always shown on the right side of an 
  3722.             entity.
  3723.          F) Where "name" denotes a valid Ada identifier, annotating 
  3724.             entities have following formats:
  3725.             - ( name )   for type declaration
  3726.             - : name :   for object declaration
  3727.             - < name >   for exception declaration
  3728.             - | name |   for subprogram
  3729.             - / name /   for task entry
  3730.             - /* name /  for guarderd task entry
  3731.             - # name #   for packages
  3732.             - % name %   for virtual packages
  3733.  
  3734. <FF>
  3735.  
  3736.    Create Connections
  3737.       Functional test requirements:
  3738.          A) The allowed connections are:
  3739.             - Unconditional Call
  3740.             - Timed Call
  3741.             - Conditional Call
  3742.             - Visibility connection
  3743.             - Exports connection
  3744.          B) Generated control flow indicators are:
  3745.             ------- subprogram or unguarded entry call
  3746.             T------ timed call on entry
  3747.             C------ conditional call on entry or subprogram
  3748.             V...... Visibility connection
  3749.          C) Call connections originate from body of procedure, function
  3750.             task, package, or virtual package.
  3751.          D) Data dependencies for packages and virtual packages can
  3752.             originate anywhere within the entity symbol.
  3753.          E) Exports connections originate at right-hand side of export 
  3754.             symbol.
  3755.          F) Calls terminate at
  3756.             - appropriate export symbol left-hand side
  3757.             - within subprogram boundaries
  3758.          F) Call connections must have correct visibility.  The Unit 
  3759.             containing the body originating the call must have the 
  3760.             proper visibility on the subprogram at which the call 
  3761.             terminates.
  3762.          G) The creation of call connections showing recursion are 
  3763.             allowed.
  3764.          H) Export connections can only terminate at entities of the 
  3765.             same type.
  3766.          I) An exported item may only be connected to one contained
  3767.             item inside the exporting entity.
  3768.          J) A warning message will be issued any time an export 
  3769.             connections is created between two entities which do not
  3770.             have identical names (identifiers).
  3771.          K) Near vertical or horizontal connecting lines are automatically
  3772.             made vertical or horizontal.
  3773.  
  3774.    Delete entities and connections
  3775.       Functional test requirements:
  3776.          A) When an entity is deleted all severed
  3777.             connections must be deleted.
  3778.          B) Entities which may be deleted are
  3779.             - Virtual Package
  3780.             - Package
  3781.             - Procedure
  3782.             - Function
  3783.             - Task
  3784.             - Body
  3785.             - Task Entry Point
  3786.             - Exported Type
  3787.             - Exported Object
  3788.             - Exported Exception
  3789.             - Exported Procedure
  3790.             - Exported Function
  3791.             - Exported Task Entry
  3792.             - Imported Virtual Package
  3793.             - Imported Package
  3794.             - Imported Procedure
  3795.             - Imported Function
  3796.             - call connections
  3797.             - visibility connections
  3798.             - exports connections
  3799.          C) Operator has opportunity to confirm or cancel the operation.
  3800.          D) Deleted entities may be stand alone or nested.
  3801.          E) All contained entities are deleted and associated connections
  3802.             severed.
  3803.  
  3804.    Modify entities 
  3805.       Functional test requirements:
  3806.          A) The names (Ada identifiers) of the following entities may 
  3807.             be modified:
  3808.             - Virtual Package
  3809.             - Package
  3810.             - Procedure
  3811.             - Function
  3812.             - Task
  3813.             - Task Entry Point
  3814.             - Exported Type
  3815.             - Exported Object
  3816.             - Exported Exception
  3817.             - Exported Procedure
  3818.             - Exported Function
  3819.             - Exported Task Entry
  3820.             - Imported Virtual Package
  3821.             - Imported Package
  3822.             - Imported Procedure
  3823.             - Imported Function
  3824.          B) The parameter status of subprograms and entry points may be
  3825.             altered.
  3826.          C) The guard status of entry points may be altered.
  3827.          D) The Prologues of entities which can have them may be edited.
  3828.          E) The call status of call connections may be altered.
  3829.  
  3830.    Move and Resize entities 
  3831.       Functional test requirements:
  3832.          A) The following entities may be specified for moving
  3833.             and/or resizing:
  3834.             - Virtual Package
  3835.             - Package
  3836.             - Procedure
  3837.             - Function
  3838.             - Task
  3839.             - Body
  3840.          B) The following entities may be specified for moving:
  3841.             - Task Entry Point
  3842.             - Exported Type
  3843.             - Exported Object
  3844.             - Exported Exception
  3845.             - Exported Procedure
  3846.             - Exported Function
  3847.             - Exported Task Entry
  3848.             - Imported Virtual Package
  3849.             - Imported Package
  3850.             - Imported Procedure
  3851.             - Imported Function
  3852.          C) When an entity is moved an identitical translation is
  3853.             performed on all contained entities and annotations.
  3854.          D) For all connections spanning the boundary of the outer
  3855.             most moved entity (and hence are severed), verify that 
  3856.             the program:
  3857.             - remarks the endpoints of line segments composing the
  3858.               connection line
  3859.             - attempts to redraw the line and request operator
  3860.               confirmation of altered connection
  3861.             - upon cancelation, forces the operator to redraw the
  3862.               the connection 
  3863.          E) Verify that the entities listed in (A) may be moved
  3864.             anywhere on the graph that is not already occupied.
  3865.          F) Verify that entities may not be moved too close to the
  3866.             graph boundaries such that a label/annotation will not
  3867.             fit on the graph.
  3868.          G) Verify that move and resize operations do not corrupt
  3869.             or alter the syntax tree (the semantic meaning of the
  3870.             graph).
  3871.          H) If the move is not allowed by GAD because of entity
  3872.             overlap or improper scoping, verify the display of an
  3873.             appropriate error (and information) message.
  3874.  
  3875. 6.2.2  PDL Production 
  3876.       Functional test requirements:
  3877.          A) PDL reflects generic status of packages, procedures
  3878.             and functions.
  3879.          B) PDL reflects required formal parameters for procedures,
  3880.             functions, and task entries.
  3881.          C) PDL reflects required task entry guard conditions.
  3882.          D) Exported entities are shown in specification of packages
  3883.             and virtual packages.
  3884.          E) The presence of imported entites generates 'with' clauses.
  3885.          F) Visibility connections between contained entity and imported
  3886.             entity result in 'use' clause in declarative section
  3887.             of contained entity.
  3888.          G) The PDL generated will be placed in a file with the
  3889.             current session file name and the PDL file extension.
  3890.          H) The PDL will be syntactically correct.  The program generated
  3891.             PDL will be semantically correct if the support package
  3892.             is placed in the PDL file.  The user input portion of the
  3893.             PDL may not be semantically correct (e.g., duplicate 
  3894.             identifiers, or non-existent units in visibility clauses).
  3895.          I) The following should be verified for each entity:
  3896.             - the type of entity
  3897.             - enclosing scope of entity
  3898.             - what the entity encloses
  3899.             - the relationship with other entities in terms of
  3900.               exported and imported objects
  3901.             - entity specified information such as generic status
  3902.          J) The usage of TBD items will be such that removal of the
  3903.             SUPPORT_PACKAGE will result in compilation errors at
  3904.             the location of each usage.
  3905.  
  3906. 6.2.3  File Management 
  3907.       Functional test requirements:
  3908.          A) The program will automatically prompt the user for the name
  3909.             of a file to read in when the program initializes.  If the
  3910.             file does not exist, a null design will be presented to the
  3911.             user.  The filename specified will become the session file
  3912.             name, if a null name is entered then the default name is used.
  3913.          A) The graphics and syntax information representing the current
  3914.             design can be written to an operator specified file.
  3915.          B) A previously saved design can be restored from an operator
  3916.             specified file.  The file read in will become the new session
  3917.             file.
  3918.          C) The operator may EXIT the program and save the current design
  3919.             automatically in a new version of the current session file.
  3920.          D) The operator may QUIT the program and not save the current
  3921.             design.
  3922.  
  3923. 6.2.4  MMI Functions
  3924.  
  3925. The following MMI functions are those which might not be exercised
  3926. by tests designed to verify the functions in sections 6.2.1, 6.2.2,
  3927. 6.2.3; i.e., MMI functions which will be exercised are not listed. 
  3928.  
  3929.       Functional test requirements:
  3930.          A) Backup commands work in the menus where backup is available.
  3931.          B) Help is available for each menu and for each command in each menu.
  3932.          C) Main menu command works where the command is available.
  3933.          D) Pan and zoom are available to the operator.
  3934.          E) Device is restored to VT100 mode following termination.
  3935.          F) Scroll region is on bottom two lines of terminal (generally).
  3936.          G) Read in file or new file creation is performed on demand 
  3937.             with confirmation of old file deletion.
  3938.          H) Write out file is performed on demand.
  3939.          I) Abort is available and operable whenever cursor is in graph
  3940.             viewport, and returns user to previous top level menu.
  3941.          J) The program correctly recovers from improper user input,
  3942.             for example, keyboard input when mouse input is expected.
  3943.  
  3944. 6.2.5  Capacity
  3945.  
  3946.       Functional test requirements:
  3947.          A) The program gracefully recovers from exhausting the
  3948.             terminal display list.
  3949.          B) The program gracefully recovers from exhausting the
  3950.             available supply of TREE, GRAPH, LIST, and PROLOGUE
  3951.             nodes.
  3952.  
  3953.