home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / gks / gksma.src < prev    next >
Encoding:
Text File  |  1988-05-03  |  815.0 KB  |  23,619 lines

  1. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2. --:UDD:GKSADACM:CODE:MA:IMPORT_READ.ADA
  3. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4. ------------------------------------------------------------------
  5. --
  6. --  NAME: IMPORT_READ
  7. --  IDENTIFIER: GDMXXX.1(1)
  8. --  DISCREPANCY REPORTS:
  9. --
  10. ------------------------------------------------------------------
  11. -- FILE : IMPORT_READ
  12.      
  13. with SYSTEM;
  14.      
  15. package IMPORT_READ  is
  16.      
  17. -- This package is designed to import the assembly language
  18. -- routine that actually does the majority of the communication
  19. -- from the Lexidata 3700 hardware. The SYSTEM package is used to
  20. -- allow the use of the address type. This is used in passing the
  21. -- location of an array.
  22.      
  23.    procedure ADA_PHREAD
  24.       (BUFFER : SYSTEM.ADDRESS;
  25.        COUNT  : INTEGER;
  26.        WAIT   : BOOLEAN);
  27.    pragma interface(masm,ADA_PHREAD);
  28.    pragma entry_point(ADA_PHREAD, "PHREAD");
  29.      
  30. -- The PRAGMA INTERFACE tells the compiler in what language the
  31. -- procedure is written. MASM is a macro assembler and ADA_PHREAD
  32. -- is the name of the procedure, so the front end of the procedure is
  33. -- in Ada and the code is in macro assembly language.
  34. --
  35. -- The PRAGMA ENTRY_POINT defines the symbol at which to begin
  36. -- execution of the foreign program interfaced into the Ada
  37. -- environment.
  38. --
  39. -- The procedure ADA_PHREAD is the interface between Ada and
  40. -- the assembly language.
  41. --
  42. -- BUFFER - This is the starting address in memory to read from.
  43. -- COUNT  - This variable contains the number of elements to read.
  44. -- WAIT   - This tells the assembly language to wait until the
  45. --          read operation is finished. It WAIT is set to false, it
  46. --          is possible that the main program finishs and the assembly
  47. --          language has placed data from the LEXIDATA 3700 into the
  48. --          buffer that the user does not know about.
  49.      
  50. end IMPORT_READ;
  51. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  52. --:UDD:GKSADACM:CODE:MA:IMPORT_WRITE.ADA
  53. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  54. ------------------------------------------------------------------
  55. --
  56. --  NAME: IMPORT_WRITE
  57. --  IDENTIFIER: GDMXXX.1(1)
  58. --  DISCREPANCY REPORTS:
  59. --
  60. ------------------------------------------------------------------
  61. -- FILE : IMPORT_WRITE
  62.      
  63. with SYSTEM;
  64.      
  65. package IMPORT_WRITE is
  66.      
  67. -- This package is designed to import the assembly language
  68. -- routine that actually does the writing of commands to the
  69. -- Lexidata 3700 hardware. The SYSTEM package is used to allow
  70. -- the use of the address type. This is used in passing the
  71. -- location of an array
  72.      
  73.    procedure ADA_PHWRIT
  74.       (BUFFER : SYSTEM.ADDRESS;
  75.        COUNT  : INTEGER;
  76.        WAIT   : BOOLEAN);
  77.    pragma interface(masm,ADA_PHWRIT);
  78.    pragma entry_point(ADA_PHWRIT, "PHWRIT");
  79.      
  80. -- The PRAGMA INTERFACE tells the compiler in what language the
  81. -- procedure is written. MASM is a macro assembler and ADA_PHWRIT
  82. -- is the name of the procedure, so the front end of the procedure is
  83. -- in Ada and the code is in macro assembly language.
  84. --
  85. -- The PRAGMA ENTRY_POINT defines the symbol at which to begin
  86. -- execution of the foreign program interfaced into the Ada
  87. -- environment.
  88. --
  89. -- The procedure ADA_PHWRIT is the interface between Ada and
  90. -- the assembly language.
  91. --
  92. -- BUFFER - This is the starting address in memory to read from.
  93. -- COUNT  - This variable contains the number of elements to read.
  94. -- WAIT   - This tells the assembly language to wait until the
  95. --          write operation is finished. If WAIT is set to false and
  96. --          the main program finished before the assembly language
  97. --          has had enough time to send the buffer to the LEXIDATA 3700,
  98. --          it is possible that there will be unsent data remaining in
  99. --          the buffer.
  100.      
  101. end IMPORT_WRITE;
  102. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  103. --:UDD:GKSADACM:CODE:MA:IMPORT_VARIABLES.ADA
  104. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  105. ------------------------------------------------------------------
  106. --
  107. --  NAME: IMPORT_VARIABLES
  108. --  IDENTIFIER: GDMXXX.1(1)
  109. --  DISCREPANCY REPORTS:
  110. --
  111. ------------------------------------------------------------------
  112. -- FILE : IMPORT_VARIABLES.ADA
  113.      
  114. package IMPORT_VARIABLES is
  115.      
  116. -- This package specification is designed to allow the assembly
  117. -- block of VARIABLES of data to be visible. PHBLK.SR is imported
  118. -- into the Ada environment.
  119.      
  120. end IMPORT_VARIABLES;
  121. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  122. --:UDD:GKSADACM:CODE:MA:IMPORT_WAIT.ADA
  123. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  124. ------------------------------------------------------------------
  125. --
  126. --  NAME: IMPORT_WAIT
  127. --  IDENTIFIER: GDMXXX.1(1)
  128. --  DISCREPANCY REPORTS:
  129. --
  130. ------------------------------------------------------------------
  131. -- FILE : IMPORT_WAIT.ADA
  132.      
  133. package IMPORT_WAIT is
  134.      
  135. -- This package imports the assembly language routine PHOWT.
  136. -- This is used to pause the software until the hardware has
  137. -- completed the current task and sends an interrupt to the PHOWT.
  138.      
  139.    procedure ADA_PHOWT;
  140.    pragma interface(masm,ADA_PHOWT);
  141.    pragma entry_point(ADA_PHOWT,"PHOWT");
  142.      
  143. -- The PRAGMA INTERFACE tells the compiler in what language the
  144. -- procedure is written. MASM is a macro assembler and ADA_PHOWT
  145. -- is the name of the procedure, so the front end of the procedure is
  146. -- in Ada and the code is in macro assembly language.
  147. --
  148. -- The PRAGMA ENTRY_POINT defines the symbol at which to begin
  149. -- execution of the foreign program interfaced into the Ada
  150. -- environment.
  151.      
  152. end IMPORT_WAIT;
  153. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  154. --:UDD:GKSADACM:CODE:MA:IMPORT_OPEN.ADA
  155. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  156. ------------------------------------------------------------------
  157. --
  158. --  NAME: IMPORT_OPEN
  159. --  IDENTIFIER: GDMXXX.1(1)
  160. --  DISCREPANCY REPORTS:
  161. --
  162. ------------------------------------------------------------------
  163. -- FILE : IMPORT_OPEN.ADA
  164.      
  165. package IMPORT_OPEN is
  166.      
  167. -- This package specification is used to import the assembly
  168. -- language routine PHDOPN.
  169.      
  170.   procedure ADA_PHDOPN
  171.      (INPUT_DEVICE   : INTEGER;
  172.       OUTPUT_DEVICE  : INTEGER;
  173.       ERROR          : out INTEGER);
  174.   pragma interface (masm,ADA_PHDOPN);
  175.   pragma entry_point (ADA_PHDOPN,"PHDOPN");
  176.      
  177. -- The PRAGMA INTERFACE tells the compiler in what language the
  178. -- procedure is written. MASM is a macro assembler and ADA_PHDOPN
  179. -- is the name of the procedure, so the front end of the procedure is
  180. -- in Ada and the code is in macro assembly language.
  181. --
  182. -- The PRAGMA ENTRY_POINT defines the symbol at which to begin
  183. -- execution of the foreign program interfaced into the Ada
  184. -- environment.
  185. --
  186. -- This procedure is designed to open the Lexidata 3700 with an input
  187. -- device channel and a output device channel. This procedure will
  188. -- produce an error message. The value of 0 on the DATA GENERAL will
  189. -- be returned if opened successfully.
  190. --
  191. -- INPUT_DEVICE  - contains the physical channel to communicate to
  192. -- the device.
  193. -- OUTPUT_DEVICE - contains the physical channel to communicate from
  194. -- the device.
  195. -- ERROR         - contains the host system defined error number.
  196.      
  197. end IMPORT_OPEN;
  198. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  199. --:UDD:GKSADACM:CODE:MA:GKS_CONFIGURATION_MA.ADA
  200. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  201. ------------------------------------------------------------------
  202. --
  203. --  NAME:  GKS_CONFIGURATION
  204. --  IDENTIFIER: GIMXXX.1(1)
  205. --  DISCREPANCY REPORTS:
  206. --
  207. ------------------------------------------------------------------
  208. -- file:  gks_configuration_ma.ada
  209. -- level: ma
  210.      
  211. package GKS_CONFIGURATION is
  212.      
  213. -- This package is external to GKS and contains implementation-defined
  214. -- constants used by a particular level ma implementation of GKS.  It
  215. -- also contains default declarations used by an application program in
  216. -- its implementation of GKS.
  217.      
  218.    MAX_MEMORY_UNITS              : constant := 0;
  219.      
  220.    MAX_NUMBER_OPEN_WS            : constant := 100;
  221.      
  222.    MAX_NUMBER_ACTIVE_WS          : constant := 100;
  223.      
  224.    MAX_NORMALIZATION_TRANSFORMATION_NUMBER
  225.                                  : constant := 1;
  226.      
  227.    MAX_WS_TYPE                   : constant := 100;
  228.      
  229.    PRECISION                     : constant := 6;
  230.      
  231.    DEFAULT_ERROR_FILE            : constant STRING :=
  232.                                               "gks_error_file";
  233.      
  234.    LEXIDATA_3700_OUTPUT_TYPE     : constant := 1;
  235.      
  236. end GKS_CONFIGURATION;
  237. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  238. --:UDD:GKSADACM:CODE:MA:GKS_COOR_SYS.ADA
  239. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  240. ------------------------------------------------------------------
  241. --
  242. --  NAME: GKS_COORDINATE_SYSTEM
  243. --  IDENTIFIER: GIMXXX.1(1)
  244. --  DISCREPANCY REPORTS:
  245. --
  246. ------------------------------------------------------------------
  247. -- file:  gks_coor_sys.ada
  248. -- level: ma, 0a, 1a, 2a
  249.      
  250. with GKS_CONFIGURATION;
  251.      
  252. generic
  253.      
  254.    type COORDINATE_COMPONENT_TYPE is digits <>;
  255.    -- Coordinate_component_types in the system are floating point
  256.    -- values.  Values on both axes are of the same type.
  257.      
  258. package GKS_COORDINATE_SYSTEM is
  259.      
  260. -- This generic package contains the specification for the coordinate
  261. -- systems template.  It defines a Cartesian coordinate_component_type
  262. -- system for use by GKS.
  263.      
  264.    type POINT is
  265.       record
  266.          X : COORDINATE_COMPONENT_TYPE;
  267.          Y : COORDINATE_COMPONENT_TYPE;
  268.       end record;
  269.    -- Defines a point in the COORDINATE_COMPONENT_TYPE system.
  270.      
  271.    type POINT_ARRAY is array (POSITIVE range <>) of POINT;
  272.    -- Defines an array of points.
  273.      
  274.    subtype SMALL_NATURAL is NATURAL range 0..500;
  275.    -- This is a temporary subtype declaration which allows for
  276.    -- unconstrained POINT_LIST objects without causing the
  277.    -- exception STORAGE_ERROR to be raised.
  278.      
  279.    type POINT_LIST (LENGTH: SMALL_NATURAL := 0) is
  280.       record
  281.          POINTS : POINT_ARRAY (1..LENGTH);
  282.       end record;
  283.    -- This defines the point list.  The record construct with a
  284.    -- discriminant allows a user to index into a list of points
  285.    -- that is user settable.
  286.      
  287.    type VECTOR is new POINT;
  288.    -- Defines a vector in the COORDINATE_COMPONENT_TYPE system.
  289.      
  290.    type RECTANGLE_LIMITS is
  291.       record
  292.          XMIN : COORDINATE_COMPONENT_TYPE;
  293.          XMAX : COORDINATE_COMPONENT_TYPE;
  294.          YMIN : COORDINATE_COMPONENT_TYPE;
  295.          YMAX : COORDINATE_COMPONENT_TYPE;
  296.       end record;
  297.    -- Defines a rectangle in the COORDINATE_COMPONENT_TYPE system.
  298.      
  299.    type MAGNITUDE_BASE_TYPE is digits GKS_CONFIGURATION.PRECISION;
  300.    -- Defines type used to define subtype MAGNITUDE.
  301.      
  302.    subtype MAGNITUDE is MAGNITUDE_BASE_TYPE range
  303.       COORDINATE_COMPONENT_TYPE'SAFE_SMALL..
  304.          COORDINATE_COMPONENT_TYPE'SAFE_LARGE;
  305.    -- Defines the length of an object in the COORDINATE_COMPONENT_TYPE
  306.    -- system.
  307.      
  308.      
  309.    type SIZE is
  310.       record
  311.          XAXIS : MAGNITUDE;
  312.          YAXIS : MAGNITUDE;
  313.       end record;
  314.    -- Defines the size of an object in the COORDINATE_COMPONENT_TYPE
  315.    -- system as length along the X and Y axes.
  316.      
  317.    type RANGE_OF_MAGNITUDES is
  318.       record
  319.          MIN : MAGNITUDE;
  320.          MAX : MAGNITUDE;
  321.       end record;
  322.    -- Defines the extent of a rectangle in the COORDINATE_COMPONENT_TYPE
  323.    -- system parallel to the X and Y axes.
  324.      
  325. end GKS_COORDINATE_SYSTEM;
  326. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  327. --:UDD:GKSADACM:CODE:MA:GKS_MATRIX_UTILITIES.ADA
  328. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  329. ------------------------------------------------------------------
  330. --
  331. --  NAME: GKS_MATRIX_UTILITIES
  332. --  IDENTIFIER: GIMXXX.1(1)
  333. --  DISCREPANCY REPORTS:
  334. --
  335. ------------------------------------------------------------------
  336. -- file:  gks_matrix_utilities.ada
  337. -- level: ma, 0a, 1a, 2a
  338.      
  339. generic
  340.      
  341.    type ELEMENT_TYPE is private;
  342.      
  343. package GKS_MATRIX_UTILITIES is
  344.      
  345. -- The generic package declared in this file is the specification of
  346. -- a MATRIX UTILITY package which defines generic matrix types.  This
  347. -- package is instantiated by GKS_TYPES to provide matrices of colour
  348. -- and pixel colour indices for describing Cell Arrays, Pixel Arrays,
  349. -- etc.
  350.      
  351.    type MATRIX_OF is array (POSITIVE range <>, POSITIVE range <>)
  352.       of ELEMENT_TYPE;
  353.    -- This type specifies an unconstrained array to be used for
  354.    -- the matrix specification in this generic package.
  355.      
  356.    subtype SMALL_NATURAL is NATURAL range 0..500;
  357.    -- This is a temporary subtype declaration which allows for
  358.    -- unconstrained VARIABLE_MATRIX_OF objects without causing
  359.    -- the exception STORAGE_ERROR to be raised.
  360.      
  361.    type VARIABLE_MATRIX_OF (DX : SMALL_NATURAL := 0;
  362.                             DY : SMALL_NATURAL := 0)
  363.       is record
  364.          MATRIX : MATRIX_OF (1..DX, 1..DY);
  365.       end record;
  366.    -- This record type specifies a user defineable matrix by
  367.    -- using a record discriminant which establishes the upper
  368.    -- bounds of the matrix of generic types.
  369.      
  370. end GKS_MATRIX_UTILITIES;
  371. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  372. --:UDD:GKSADACM:CODE:MA:GKS_LIST_UTILITIES.ADA
  373. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  374. ------------------------------------------------------------------
  375. --
  376. --  NAME: GKS_LIST_UTILITIES
  377. --  IDENTIFIER: GIMXXX.1(1)
  378. --  DISCREPANCY REPORTS:
  379. --
  380. ------------------------------------------------------------------
  381. -- file:  gks_list_utilities.ada
  382. -- level: all levels
  383.      
  384. generic
  385.      
  386.    type ELEMENT_TYPE is private;
  387.      
  388. package GKS_LIST_UTILITIES is
  389.      
  390. -- The generic package declared in this file is the specification of
  391. -- a LIST UTILITY package which defines an unordered list type and its
  392. -- operations to support the GKS list type.  The package defines the
  393. -- LIST_OF type as private so that an implementation is free to choose
  394. -- a list type which is optimal for its strategy.
  395.      
  396.    type LIST_OF is private;
  397.      
  398.    NULL_LIST : constant LIST_OF;
  399.      
  400.    procedure ADD_TO_LIST
  401.       (ELEMENT    : in ELEMENT_TYPE;
  402.        LIST       : in out LIST_OF);
  403.      
  404.    procedure DELETE_FROM_LIST
  405.       (ELEMENT      : in ELEMENT_TYPE;
  406.        LIST         : in out LIST_OF);
  407.      
  408.    function SIZE_OF_LIST
  409.       (LIST : in LIST_OF) return NATURAL;
  410.      
  411.    function IS_IN_LIST
  412.       (ELEMENT : ELEMENT_TYPE;
  413.        LIST    : LIST_OF) return BOOLEAN;
  414.      
  415.    function LIST_ELEMENT
  416.       (I    : in POSITIVE;
  417.        LIST : in LIST_OF) return ELEMENT_TYPE;
  418.      
  419.    type LIST_VALUES is array (POSITIVE range <>) of ELEMENT_TYPE;
  420.    -- Definition of an unconstrained array of ELEMENT_TYPE.
  421.    -- Type used by applications to define an array and then
  422.    -- simply calling function LIST to initialize a list.
  423.      
  424.    function LIST
  425.       (VALUES : in LIST_VALUES) return LIST_OF;
  426.      
  427. private
  428.      
  429.    -- Lists are implemented as an access type to an array to hold
  430.    -- the components of the list.  An empty list is a null pointer.
  431.      
  432.    type LIST_OF is access LIST_VALUES;
  433.      
  434.    NULL_LIST : constant LIST_OF := null;
  435.      
  436. end GKS_LIST_UTILITIES;
  437. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  438. --:UDD:GKSADACM:CODE:MA:GKS_LIST_UTILITIES_B.ADA
  439. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  440. ------------------------------------------------------------------
  441. --
  442. --  NAME: GKS_LIST_UTILITIES - BODY
  443. --  IDENTIFIER: GIMXXX.1(1)
  444. --  DISCREPANCY REPORTS:
  445. --
  446. ------------------------------------------------------------------
  447. -- file:  gks_list_utilities_b.ada
  448. -- level: all levels
  449.      
  450. with UNCHECKED_DEALLOCATION;
  451.      
  452. package body GKS_LIST_UTILITIES is
  453.      
  454.    procedure FREE is new UNCHECKED_DEALLOCATION (LIST_VALUES, LIST_OF);
  455.      
  456.    procedure ADD_TO_LIST
  457.       (ELEMENT : in ELEMENT_TYPE;
  458.        LIST    : in out LIST_OF) is
  459.      
  460.    -- This procedure adds ELEMENT to the list pointed to by
  461.    -- LIST_OF.
  462.    --
  463.    -- ELEMENT - Item to be added to LIST.
  464.    -- LIST - A list.
  465.      
  466.       NEW_LIST  : LIST_OF;
  467.       -- Temporary object used to point to a new list.
  468.      
  469.    begin
  470.      
  471.       if LIST /= NULL_LIST then
  472.          if not IS_IN_LIST (ELEMENT, LIST) then
  473.             NEW_LIST := new LIST_VALUES'(LIST.all & ELEMENT);
  474.             FREE (LIST);
  475.             LIST := NEW_LIST;
  476.          end if;
  477.       else
  478.          LIST := new LIST_VALUES'(1 => ELEMENT);
  479.      end if;
  480.      
  481.    end ADD_TO_LIST;
  482.      
  483.    procedure DELETE_FROM_LIST
  484.        (ELEMENT   : in ELEMENT_TYPE;
  485.        LIST      : in out LIST_OF) is
  486.      
  487.    -- This procedure deletes ELEMENT from the list pointed
  488.    -- to by LIST.
  489.    --
  490.    -- ELEMENT - Item to be deleted from LIST.
  491.    -- LIST - A list.
  492.      
  493.       INDEX           : NATURAL;
  494.       -- Object used as an index into LIST.
  495.      
  496.       ITEM_FOUND      : BOOLEAN;
  497.       -- Object used to as a flag and is set to TRUE if
  498.       -- ELEMENT is found in LIST.
  499.      
  500.       NEW_LIST        : LIST_OF;
  501.       -- Temporary object used to point to a new list.
  502.      
  503.    begin
  504.      
  505.       if LIST /= NULL_LIST then
  506.          INDEX := 1;
  507.          ITEM_FOUND := FALSE;
  508.          while INDEX <= LIST'LENGTH loop
  509.             if LIST(INDEX) = ELEMENT then
  510.                ITEM_FOUND := TRUE;
  511.                exit;
  512.             end if;
  513.             INDEX := INDEX + 1;
  514.          end loop;
  515.      
  516.          if ITEM_FOUND then
  517.             if LIST'LENGTH = 1 then
  518.                FREE(LIST);
  519.                LIST := NULL_LIST;
  520.             else
  521.                NEW_LIST := new LIST_VALUES(1..LIST'LENGTH - 1);
  522.                NEW_LIST.all := LIST(1..INDEX - 1) &
  523.                                   LIST(INDEX + 1..LIST'LENGTH);
  524.                FREE (LIST);
  525.                LIST := NEW_LIST;
  526.             end if;
  527.          end if;
  528.       end if;
  529.      
  530.    end DELETE_FROM_LIST;
  531.      
  532.    function SIZE_OF_LIST
  533.       (LIST  : in LIST_OF) return NATURAL is
  534.      
  535.    -- This function returns the number of elements in the
  536.    -- list pointed to by LIST.
  537.    --
  538.    -- LIST - A list.
  539.      
  540.    begin
  541.      
  542.       if LIST = NULL_LIST then
  543.          return 0;
  544.       else
  545.          return LIST'LENGTH;
  546.       end if;
  547.      
  548.    end SIZE_OF_LIST;
  549.      
  550.    function IS_IN_LIST
  551.       (ELEMENT  : ELEMENT_TYPE;
  552.        LIST     : LIST_OF) return BOOLEAN is
  553.      
  554.    -- This function returns TRUE if ELEMENT is found in the list
  555.    -- pointed to by LIST.
  556.    --
  557.    -- ELEMENT - Item to be found in LIST.
  558.    -- LIST - A list.
  559.      
  560.    begin
  561.      
  562.       if LIST /= NULL_LIST then
  563.          for INDEX in 1..LIST'LENGTH loop
  564.             if LIST(INDEX) = ELEMENT then
  565.                return TRUE;
  566.             end if;
  567.          end loop;
  568.       end if;
  569.       return FALSE;
  570.      
  571.    end IS_IN_LIST;
  572.      
  573.    function LIST_ELEMENT
  574.       (I        : in POSITIVE;
  575.        LIST     : in LIST_OF) return ELEMENT_TYPE is
  576.      
  577.    -- This function returns the Ith element in the list pointed
  578.    -- to by LIST.
  579.    --
  580.    -- I - Element's position in LIST that will be returned.
  581.    -- LIST - A list.
  582.      
  583.       DUMMY_ELEMENT: ELEMENT_TYPE;
  584.       -- In the event an invalid position for the list is input,
  585.       -- garbage is returned.
  586.      
  587.    begin
  588.      
  589.       if LIST = NULL_LIST then
  590.          return DUMMY_ELEMENT;
  591.       elsif I <= LIST'LENGTH then
  592.          return LIST(I);
  593.       else
  594.          return DUMMY_ELEMENT;
  595.       end if;
  596.      
  597.    end LIST_ELEMENT;
  598.      
  599.    function LIST
  600.       (VALUES : in LIST_VALUES) return LIST_OF is
  601.      
  602.    -- This function creates a list using the elements from the
  603.    -- array VALUES.  A pointer to the list created is returned.
  604.    --
  605.    -- VALUES - the array to be placed in the specified list.
  606.      
  607.    begin
  608.      
  609.       if VALUES'LENGTH = 0 then
  610.          return NULL_LIST;
  611.       else
  612.          return new LIST_VALUES'(VALUES);
  613.       end if;
  614.      
  615.    end LIST;
  616.      
  617. end GKS_LIST_UTILITIES;
  618. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  619. --:UDD:GKSADACM:CODE:MA:GKS_TYPES_A.ADA
  620. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  621. ------------------------------------------------------------------
  622. --
  623. --  NAME: GKS_TYPES
  624. --  IDENTIFIER: GIMXXX.2(1)
  625. --  DISCREPANCY REPORTS:
  626. --  DR002  5-2-85  "SEGMENT_DETECTABILITY missing from GKS_TYPES"
  627. ------------------------------------------------------------------
  628. -- file:  gks_types_la.ada
  629. -- level: ma, 0a, 1a, 2a
  630.      
  631. with GKS_LIST_UTILITIES;
  632. with GKS_CONFIGURATION;
  633. with GKS_COORDINATE_SYSTEM;
  634. with GKS_MATRIX_UTILITIES;
  635.      
  636. use GKS_CONFIGURATION;
  637.      
  638. package GKS_TYPES is
  639.      
  640. -- This package contains all the data type definitions used to define
  641. -- the Ada binding to GKS.  Some of the declarations employ constant
  642. -- values in the definition.  These constant declarations are
  643. -- collected into a separate package called GKS_CONFIGURATION.
  644.      
  645.      
  646.    package SCALE_FACTOR_TYPE is
  647.      
  648.    -- This package contains the data type definition for SCALE_FACTOR.
  649.      
  650.      
  651.       -- SCALE_FACTOR                            LEVEL ma
  652.      
  653.       type SCALE_FACTOR is digits PRECISION;
  654.      
  655.       -- The type used for unitless scaling factors.
  656.      
  657.      
  658.    end SCALE_FACTOR_TYPE;
  659.      
  660.    use SCALE_FACTOR_TYPE;
  661.      
  662.    subtype SMALL_NATURAL is NATURAL range 0..500;
  663.      
  664.    -- This is a temporary subtype declaration which allows for
  665.    -- unconstrained record objects for various record types defined
  666.    -- below without causing the exception STORAGE_ERROR to
  667.    -- be raised.
  668.      
  669.      
  670.    -- ASF                                        LEVEL 0a
  671.      
  672.    type ASF is (BUNDLED,
  673.                 INDIVIDUAL);
  674.      
  675.    -- This type defines an aspect source flag whose
  676.    -- value indicates whether individual attributes
  677.    -- are to be used, or attributes as specified in
  678.    -- a bundle table.
  679.      
  680.      
  681.    -- ASF_LIST                                   LEVEL 0a
  682.      
  683.    type ASF_LIST is
  684.       record
  685.          LINETYPE                : ASF;
  686.          LINE_WIDTH              : ASF;
  687.          LINE_COLOUR             : ASF;
  688.          MARKER_TYPE             : ASF;
  689.          MARKER_SIZE             : ASF;
  690.          MARKER_COLOUR           : ASF;
  691.          TEXT_FONT_PRECISION     : ASF;
  692.          CHAR_EXPANSION          : ASF;
  693.          CHAR_SPACING            : ASF;
  694.          TEXT_COLOUR             : ASF;
  695.          INTERIOR_STYLE          : ASF;
  696.          STYLE_INDEX             : ASF;
  697.          FILL_AREA_COLOUR        : ASF;
  698.       end record;
  699.      
  700.    -- A list containing all of the aspect source flags,
  701.    -- with components indicating the specific flag.
  702.      
  703.      
  704.    -- ATTRIBUTES_FLAG                            LEVEL 0a
  705.      
  706.    type ATTRIBUTES_FLAG is (CURRENT,
  707.                             SPECIFIED);
  708.      
  709.    -- Indicates whether output attributes used are to
  710.    -- be as currently set, or as explicitly specified.
  711.      
  712.      
  713.    -- ATTRIBUTES_USED_TYPE                       LEVEL 0a
  714.      
  715.    type ATTRIBUTES_USED_TYPE is (POLYLINE_ATTRIBUTES,
  716.                                  POLYMARKER_ATTRIBUTES,
  717.                                  TEXT_ATTRIBUTES,
  718.                                  FILL_AREA_ATTRIBUTES);
  719.      
  720.    -- The types of attributes which may be used in gen-
  721.    -- erating output.
  722.      
  723.      
  724.    -- ATTRIBUTES_USED                            LEVEL 0a
  725.      
  726.    package ATTRIBUTES_USED is new GKS_LIST_UTILITIES
  727.       (ATTRIBUTES_USED_TYPE);
  728.      
  729.    -- Provides for a list of the attributes used.
  730.      
  731.    function "&" (LEFT, RIGHT: ATTRIBUTES_USED.LIST_VALUES) return
  732.       ATTRIBUTES_USED.LIST_VALUES renames ATTRIBUTES_USED."&";
  733.      
  734.      
  735.    -- CHAR_EXPANSION                             LEVEL ma
  736.      
  737.    type CHAR_EXPANSION is new SCALE_FACTOR range
  738.       SCALE_FACTOR'SAFE_SMALL..SCALE_FACTOR'LAST;
  739.      
  740.    -- Defines a character expansion factor.  Factors are unitless
  741.    -- and must be greater than zero.
  742.      
  743.      
  744.    -- CHAR_SPACING                               LEVEL ma
  745.      
  746.    type CHAR_SPACING is new SCALE_FACTOR;
  747.      
  748.    -- Defines a character spacing factor.  The factors are
  749.    -- unitless.  A positive value indicates the amount of
  750.    -- space between characters in a text string, and a
  751.    -- negative value indicates the amound of overlap between
  752.    -- characters in a text string.
  753.      
  754.      
  755.    -- CLIPPING_INDICATOR                         LEVEL ma
  756.      
  757.    type CLIPPING_INDICATOR is (CLIP,
  758.                                NOCLIP);
  759.      
  760.    -- Indicates whether or not clipping is to be performed.
  761.      
  762.      
  763.    -- COLOUR_AVAILABLE                           LEVEL ma
  764.      
  765.    type COLOUR_AVAILABLE is (COLOUR,
  766.                              MONOCHROME);
  767.      
  768.    -- Indicates whether colour output is available on
  769.    -- a workstation.
  770.      
  771.      
  772.    -- PIXEL_COLOUR_INDEX                         LEVEL 0a
  773.      
  774.    type PIXEL_COLOUR_INDEX is new INTEGER range -1..INTEGER'LAST;
  775.      
  776.    --  Represents a pixel colour where the value -1 represents an
  777.    --  invalid colour index.
  778.      
  779.      
  780.    -- COLOUR_INDEX                               LEVEL ma
  781.      
  782.    subtype COLOUR_INDEX is PIXEL_COLOUR_INDEX range
  783.       0..PIXEL_COLOUR_INDEX'LAST;
  784.      
  785.    -- Indices into colour tables are of this type.
  786.      
  787.      
  788.    -- COLOUR_INDICES                             LEVEL ma
  789.      
  790.    package COLOUR_INDICES is new GKS_LIST_UTILITIES (COLOUR_INDEX);
  791.      
  792.    -- Provides for a list of colour indices which are available
  793.    -- on a particular workstation.
  794.      
  795.    function "&" (LEFT, RIGHT: COLOUR_INDICES.LIST_VALUES) return
  796.       COLOUR_INDICES.LIST_VALUES renames COLOUR_INDICES."&";
  797.      
  798.      
  799.    -- COLOUR_MATRICES                            LEVEL ma
  800.      
  801.    package COLOUR_MATRICES is new GKS_MATRIX_UTILITIES (COLOUR_INDEX);
  802.      
  803.    -- Provides for matrices containing colour indices corresponding
  804.    -- to a cell array or a pattern array.
  805.      
  806.      
  807.    -- INTENSITY                                  LEVEL ma
  808.      
  809.    type INTENSITY is digits PRECISION range 0.0..1.0;
  810.      
  811.    -- Defines the range of possible intensities of a colour.
  812.      
  813.      
  814.    -- COLOUR_REPRESENTATION                      LEVEL ma
  815.      
  816.    type COLOUR_REPRESENTATION is
  817.       record
  818.          RED   : INTENSITY;
  819.          GREEN : INTENSITY;
  820.          BLUE  : INTENSITY;
  821.       end record;
  822.      
  823.    -- Defines the representation of a colour as a
  824.    -- combination of intensities in an RGB colour system.
  825.      
  826.      
  827.    -- CONNECTION_ID                              LEVEL ma
  828.      
  829.    subtype CONNECTION_ID is string;
  830.      
  831.    -- Defines the type for a connection identifier.  The
  832.    -- string must correspond to an external device or
  833.    -- file as defined by the GKS implementation.
  834.      
  835.      
  836.    -- CONTROL_FLAG                               LEVEL ma
  837.      
  838.    type CONTROL_FLAG is (CONDITIONALLY,
  839.                          ALWAYS);
  840.      
  841.    -- The control flag is used to indicate the conditions
  842.    -- under which the display surface should be cleared.
  843.      
  844.      
  845.    -- DC_TYPE                                    LEVEL ma
  846.      
  847.    type DC_TYPE is digits PRECISION;
  848.      
  849.    -- The type of a coordinate in the Device Coordinate
  850.    -- System.
  851.      
  852.      
  853.    -- DC                                         LEVEL ma
  854.      
  855.    package DC is new GKS_COORDINATE_SYSTEM (DC_TYPE);
  856.      
  857.    -- Defines the Device Coordinate System.
  858.      
  859.    function "=" (LEFT, RIGHT: DC.POINT) return BOOLEAN
  860.       renames DC."=";
  861.      
  862.    function "&" (LEFT, RIGHT: DC.POINT_ARRAY) return
  863.       DC.POINT_ARRAY renames DC."&";
  864.      
  865.    function "=" (LEFT, RIGHT: DC.VECTOR) return BOOLEAN
  866.       renames DC."=";
  867.      
  868.    function "=" (LEFT, RIGHT: DC.RECTANGLE_LIMITS) return BOOLEAN
  869.       renames DC."=";
  870.      
  871.    function "=" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  872.       renames DC."=";
  873.      
  874.    function "<" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  875.       renames DC."<";
  876.      
  877.    function "<=" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  878.       renames DC."<=";
  879.      
  880.    function ">" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  881.       renames DC.">";
  882.      
  883.    function ">=" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  884.       renames DC.">=";
  885.      
  886.    function "+" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return
  887.       DC.MAGNITUDE_BASE_TYPE renames DC."+";
  888.      
  889.    function "-" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return
  890.       DC.MAGNITUDE_BASE_TYPE renames DC."-";
  891.      
  892.    function "*" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return
  893.       DC.MAGNITUDE_BASE_TYPE renames DC."*";
  894.      
  895.    function "/" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return
  896.       DC.MAGNITUDE_BASE_TYPE renames DC."/";
  897.      
  898.    function "=" (LEFT, RIGHT: DC.SIZE) return BOOLEAN
  899.       renames DC."=";
  900.      
  901.    function "=" (LEFT, RIGHT: DC.RANGE_OF_MAGNITUDES) return BOOLEAN
  902.       renames DC."=";
  903.      
  904.      
  905.    -- DC_UNITS                                   LEVEL ma
  906.      
  907.    type DC_UNITS is (METRES,
  908.                      OTHER);
  909.      
  910.    -- Device coordinate units for a particular workstation
  911.    -- may be in meters, or some other unit (such as inches).
  912.      
  913.      
  914.    -- DEFERRAL_MODE                              LEVEL 0a
  915.      
  916.    type DEFERRAL_MODE is (ASAP,
  917.                           BNIG,
  918.                           BNIL,
  919.                           ASTI);
  920.      
  921.    -- Defines the GKS deferral modes.
  922.      
  923.      
  924.    -- DISPLAY_CLASS                              LEVEL 0a
  925.      
  926.    type DISPLAY_CLASS is (VECTOR_DISPLAY,
  927.                           RASTER_DISPLAY,
  928.                           OTHER_DISPLAY);
  929.      
  930.    -- The classification of a workstation of category OUTPUT or OUTIN.
  931.      
  932.      
  933.    -- DISPLAY_SURFACE_EMPTY                      LEVEL 0a
  934.      
  935.    type DISPLAY_SURFACE_EMPTY is (EMPTY,
  936.                                   NOTEMPTY);
  937.      
  938.    -- Indicates whether the display surface is empty.
  939.      
  940.      
  941.    -- DYNAMIC_MODIFICATION                       LEVEL 1a
  942.      
  943.    type DYNAMIC_MODIFICATION is (IRG,
  944.                                  IMM);
  945.      
  946.    -- Indicates whether an update to the state list is per-
  947.    -- formed immediately (IMM) or is implicitly regenerated
  948.    -- (IRG).
  949.      
  950.      
  951.    -- ERROR_FILE_TYPE                            LEVEL ma
  952.      
  953.    subtype ERROR_FILE_TYPE is STRING;
  954.      
  955.    -- Defines the type for error file specification.  The
  956.    -- name used must conform to an external file name as
  957.    -- defined for the host system implementation.
  958.      
  959.      
  960.    -- ERROR_INDICATOR                            LEVEL ma
  961.      
  962.    type ERROR_INDICATOR is new INTEGER;
  963.      
  964.    -- Defines the type for error indicator values.
  965.      
  966.      
  967.    -- FILL_AREA_INDEX                            LEVEL 0a
  968.      
  969.    type FILL_AREA_INDEX is new POSITIVE;
  970.      
  971.    -- Defines the type for fill area bundle table indices.
  972.      
  973.      
  974.    -- FILL_AREA_INDICES                          LEVEL 0a
  975.      
  976.    package FILL_AREA_INDICES is new GKS_LIST_UTILITIES
  977.       (FILL_AREA_INDEX);
  978.      
  979.    -- Provides for list of fill area bundle table indices.
  980.      
  981.    function "&" (LEFT, RIGHT: FILL_AREA_INDICES.LIST_VALUES) return
  982.       FILL_AREA_INDICES.LIST_VALUES renames FILL_AREA_INDICES."&";
  983.      
  984.      
  985.    -- GDP_ID                                     LEVEL 0a
  986.      
  987.    type GDP_ID is new INTEGER;
  988.      
  989.    -- Defines a type for selecting a Generalized Drawing Primitive.
  990.      
  991.      
  992.    -- GDP_IDS                                    LEVEL 0a
  993.      
  994.    package GDP_IDS is new GKS_LIST_UTILITIES (GDP_ID);
  995.      
  996.    -- Provides for lists of Generalized Drawing Primitive ID's.
  997.      
  998.    function "&" (LEFT, RIGHT: GDP_IDS.LIST_VALUES) return
  999.       GDP_IDS.LIST_VALUES renames GDP_IDS."&";
  1000.      
  1001.      
  1002.    -- GKS_LEVEL                                  LEVEL ma
  1003.      
  1004.    type GKS_LEVEL is (Lma,
  1005.                       Lmb,
  1006.                       Lmc,
  1007.                       L0a,
  1008.                       L0b,
  1009.                       L0c,
  1010.                       L1a,
  1011.                       L1b,
  1012.                       L1c,
  1013.                       L2a,
  1014.                       L2b,
  1015.                       L2c);
  1016.      
  1017.    -- The valid Levels of GKS.
  1018.      
  1019.      
  1020.    -- GKSM_ITEM_TYPE                             LEVEL 0a
  1021.      
  1022.    type GKSM_ITEM_TYPE is new NATURAL;
  1023.      
  1024.    -- The type of an item contained in a GKSM metafile.
  1025.      
  1026.      
  1027.    -- STYLE_INDEX                                LEVEL 0a
  1028.      
  1029.    type STYLE_INDEX is new INTEGER;
  1030.      
  1031.    -- Defines a fill area style index.
  1032.      
  1033.      
  1034.    -- HATCH_STYLE                                LEVEL ma
  1035.      
  1036.    subtype HATCH_STYLE is STYLE_INDEX;
  1037.      
  1038.    -- Defines the fill area hatch styles type.
  1039.      
  1040.      
  1041.    -- HATCH_STYLES                               LEVEL ma
  1042.      
  1043.    package HATCH_STYLES is new GKS_LIST_UTILITIES (HATCH_STYLE);
  1044.      
  1045.    -- Provides for a list of hatch styles.
  1046.      
  1047.    function "&" (LEFT, RIGHT: HATCH_STYLES.LIST_VALUES) return
  1048.       HATCH_STYLES.LIST_VALUES renames HATCH_STYLES."&";
  1049.      
  1050.      
  1051.    -- HORIZONTAL_ALIGNMENT                       LEVEL ma
  1052.      
  1053.    type HORIZONTAL_ALIGNMENT is (NORMAL,
  1054.                                  LEFT,
  1055.                                  CENTRE,
  1056.                                  RIGHT);
  1057.      
  1058.    -- The alignment of the text extent rectangle with
  1059.    -- respect to the horizontal positioning of the text.
  1060.      
  1061.      
  1062.    -- INTERIOR_STYLE                             LEVEL ma
  1063.      
  1064.    type INTERIOR_STYLE is (HOLLOW,
  1065.                            SOLID,
  1066.                            PATTERN,
  1067.                            HATCH);
  1068.      
  1069.    -- Defines the fill area interior styles.
  1070.      
  1071.      
  1072.    -- INTERIOR_STYLES                            LEVEL ma
  1073.      
  1074.    package INTERIOR_STYLES is new GKS_LIST_UTILITIES (INTERIOR_STYLE);
  1075.      
  1076.    -- Provides for lists of interior styles.
  1077.      
  1078.    function "&" (LEFT, RIGHT: INTERIOR_STYLES.LIST_VALUES) return
  1079.       INTERIOR_STYLES.LIST_VALUES renames INTERIOR_STYLES."&";
  1080.      
  1081.      
  1082.    -- INVALID_VALUES_INDICATOR                   LEVEL 0a
  1083.      
  1084.    type INVALID_VALUES_INDICATOR is (ABSENT,
  1085.                                      PRESENT);
  1086.      
  1087.    -- Indicates whether invalid values are contained
  1088.    -- in a pixel array or matrix.
  1089.      
  1090.      
  1091.    -- LINETYPE                                   LEVEL ma
  1092.      
  1093.    type LINETYPE is new INTEGER;
  1094.      
  1095.    -- Defines the types of line styles provided by GKS.
  1096.      
  1097.      
  1098.    -- LINE_WIDTH                                 LEVEL ma
  1099.      
  1100.    type LINE_WIDTH is new SCALE_FACTOR
  1101.       range 0.0..SCALE_FACTOR'LAST;
  1102.      
  1103.    -- The width of a line is indicated by a scale factor.
  1104.      
  1105.      
  1106.    -- LINETYPES                                  LEVEL ma
  1107.      
  1108.    package LINETYPES is new GKS_LIST_UTILITIES (LINETYPE);
  1109.      
  1110.    -- Provides for lists of line types.
  1111.      
  1112.    function "&" (LEFT, RIGHT: LINETYPES.LIST_VALUES) return
  1113.       LINETYPES.LIST_VALUES renames LINETYPES."&";
  1114.      
  1115.      
  1116.    -- MARKER_TYPE                                LEVEL ma
  1117.      
  1118.    type MARKER_TYPE is new INTEGER;
  1119.      
  1120.    -- Defines the type for markers provided by GKS.
  1121.      
  1122.      
  1123.    -- MARKER_SIZE                                LEVEL ma
  1124.      
  1125.    type MARKER_SIZE is new SCALE_FACTOR
  1126.       range 0.0..SCALE_FACTOR'LAST;
  1127.      
  1128.    -- The size of a marker is indicated by a scale factor.
  1129.      
  1130.      
  1131.    -- MARKER_TYPES                               LEVEL ma
  1132.      
  1133.    package MARKER_TYPES is new GKS_LIST_UTILITIES (MARKER_TYPE);
  1134.      
  1135.    -- Provides for lists of marker types.
  1136.      
  1137.    function "&" (LEFT, RIGHT: MARKER_TYPES.LIST_VALUES) return
  1138.       MARKER_TYPES.LIST_VALUES renames MARKER_TYPES."&";
  1139.      
  1140.      
  1141.    -- MEMORY_UNITS                               LEVEL ma
  1142.      
  1143.    type MEMORY_UNITS is range 0..MAX_MEMORY_UNITS;
  1144.      
  1145.    -- Defines the type of the units of memory that may be
  1146.    -- allocated for GKS.
  1147.      
  1148.      
  1149.    -- NDC_TYPE                                   LEVEL ma
  1150.      
  1151.    type NDC_TYPE is digits PRECISION;
  1152.      
  1153.    -- Defines the type of a coordinate in the Normalized
  1154.    -- Device Coordinate System.
  1155.      
  1156.      
  1157.    -- NDC                                        LEVEL ma
  1158.      
  1159.    package NDC is new GKS_COORDINATE_SYSTEM (NDC_TYPE);
  1160.      
  1161.    -- Defines the Normalized Device Coordinate System.
  1162.      
  1163.    function "=" (LEFT, RIGHT: NDC.POINT) return BOOLEAN
  1164.       renames NDC."=";
  1165.      
  1166.    function "&" (LEFT, RIGHT: NDC.POINT_ARRAY) return
  1167.       NDC.POINT_ARRAY renames NDC."&";
  1168.      
  1169.    function "=" (LEFT, RIGHT: NDC.VECTOR) return BOOLEAN
  1170.       renames NDC."=";
  1171.      
  1172.    function "=" (LEFT, RIGHT: NDC.RECTANGLE_LIMITS) return BOOLEAN
  1173.       renames NDC."=";
  1174.      
  1175.    function "=" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1176.       renames NDC."=";
  1177.      
  1178.    function "<" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1179.       renames NDC."<";
  1180.      
  1181.    function "<=" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1182.       renames NDC."<=";
  1183.      
  1184.    function ">" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1185.       renames NDC.">";
  1186.      
  1187.    function ">=" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1188.       renames NDC.">=";
  1189.      
  1190.    function "+" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return
  1191.       NDC.MAGNITUDE_BASE_TYPE renames NDC."+";
  1192.      
  1193.    function "-" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return
  1194.       NDC.MAGNITUDE_BASE_TYPE renames NDC."-";
  1195.      
  1196.    function "*" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return
  1197.       NDC.MAGNITUDE_BASE_TYPE renames NDC."*";
  1198.      
  1199.    function "/" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return
  1200.       NDC.MAGNITUDE_BASE_TYPE renames NDC."/";
  1201.      
  1202.    function "=" (LEFT, RIGHT: NDC.SIZE) return BOOLEAN
  1203.       renames NDC."=";
  1204.      
  1205.    function "=" (LEFT, RIGHT: NDC.RANGE_OF_MAGNITUDES) return BOOLEAN
  1206.       renames NDC."=";
  1207.      
  1208.      
  1209.    -- NEW_FRAME_NECESSARY                        LEVEL 0a
  1210.      
  1211.    type NEW_FRAME_NECESSARY is (NO,
  1212.                                 YES);
  1213.      
  1214.    -- Indicates whether a new frame action is necessary at
  1215.    -- update.
  1216.      
  1217.      
  1218.    -- OPERATING_STATE                            LEVEL 0a
  1219.      
  1220.    type OPERATING_STATE is (GKCL,
  1221.                             GKOP,
  1222.                             WSOP,
  1223.                             WSAC,
  1224.                             SGOP);
  1225.      
  1226.    -- Defines the five GKS operating states.
  1227.      
  1228.      
  1229.    -- PATTERN_INDEX                              LEVEL 0a
  1230.      
  1231.    subtype PATTERN_INDEX is STYLE_INDEX range 1..STYLE_INDEX'LAST;
  1232.      
  1233.    -- Defines the range of pattern table indices.
  1234.      
  1235.      
  1236.    -- PATTERN_INDICES                            LEVEL 0a
  1237.      
  1238.    package PATTERN_INDICES is new GKS_LIST_UTILITIES (PATTERN_INDEX);
  1239.      
  1240.    -- Provides for lists of pattern table indices.
  1241.      
  1242.    function "&" (LEFT, RIGHT: PATTERN_INDICES.LIST_VALUES) return
  1243.       PATTERN_INDICES.LIST_VALUES renames PATTERN_INDICES."&";
  1244.      
  1245.      
  1246.    -- PIXEL_COLOUR_MATRICES                      LEVEL 0a
  1247.      
  1248.    package PIXEL_COLOUR_MATRICES is new GKS_MATRIX_UTILITIES
  1249.       (PIXEL_COLOUR_INDEX);
  1250.      
  1251.    -- Provides for variable sized matrices of pixel colours.
  1252.      
  1253.      
  1254.    -- POLYLINE_INDEX                             LEVEL 0a
  1255.      
  1256.    type POLYLINE_INDEX is new POSITIVE;
  1257.      
  1258.    -- Defines the range of polyline indices.
  1259.      
  1260.      
  1261.    -- POLYLINE_INDICES                           LEVEL 0a
  1262.      
  1263.    package POLYLINE_INDICES is new GKS_LIST_UTILITIES (POLYLINE_INDEX);
  1264.      
  1265.    -- Provides for lists of polyline indices.
  1266.      
  1267.    function "&" (LEFT, RIGHT: POLYLINE_INDICES.LIST_VALUES) return
  1268.       POLYLINE_INDICES.LIST_VALUES renames POLYLINE_INDICES."&";
  1269.      
  1270.      
  1271.    -- POLYMARKER_INDEX                           LEVEL 0a
  1272.      
  1273.    type POLYMARKER_INDEX is new POSITIVE;
  1274.      
  1275.    -- Defines the range of polymarker bundle table indices.
  1276.      
  1277.      
  1278.    -- POLYMARKER_INDICES                         LEVEL 0a
  1279.      
  1280.    package POLYMARKER_INDICES is new GKS_LIST_UTILITIES
  1281.       (POLYMARKER_INDEX);
  1282.      
  1283.    -- Provides for lists of polymarker indices.
  1284.      
  1285.    function "&" (LEFT, RIGHT: POLYMARKER_INDICES.LIST_VALUES) return
  1286.       POLYMARKER_INDICES.LIST_VALUES renames POLYMARKER_INDICES."&";
  1287.      
  1288.      
  1289.    -- RADIANS                                    LEVEL 1a
  1290.      
  1291.    type RADIANS is digits PRECISION;
  1292.      
  1293.    -- Values used in performing segment transformations
  1294.    -- (rotation angle).  Positive indicates an anticlock-
  1295.    -- wise direction.
  1296.      
  1297.      
  1298.    -- RANGE_OF_EXPANSIONS                        LEVEL 0a
  1299.      
  1300.    type RANGE_OF_EXPANSIONS is
  1301.       record
  1302.          MIN : CHAR_EXPANSION;
  1303.          MAX : CHAR_EXPANSION;
  1304.       end record;
  1305.      
  1306.    -- Provides a range of character expansion factors.
  1307.      
  1308.      
  1309.    -- RASTER_UNITS                               LEVEL ma
  1310.      
  1311.    type RASTER_UNITS is new POSITIVE;
  1312.      
  1313.    -- Defines the range of raster units.
  1314.      
  1315.      
  1316.    -- RASTER_UNIT_SIZE                           LEVEL ma
  1317.      
  1318.    type RASTER_UNIT_SIZE is
  1319.       record
  1320.          X : RASTER_UNITS;
  1321.          Y : RASTER_UNITS;
  1322.       end record;
  1323.      
  1324.    -- Defines the size of an object in raster units on a raster device.
  1325.      
  1326.      
  1327.    -- REGENERATION_MODE                          LEVEL 0a
  1328.      
  1329.    type REGENERATION_MODE is (SUPPRESSED,
  1330.                               ALLOWED);
  1331.      
  1332.    -- Indicates whether implicit regeneration of the display is
  1333.    -- suppressed or allowed.
  1334.      
  1335.      
  1336.    -- RELATIVE_PRIORITY                          LEVEL ma
  1337.      
  1338.    type RELATIVE_PRIORITY is (HIGHER,
  1339.                               LOWER);
  1340.      
  1341.    -- Indicates the relative priority between two normalization
  1342.    -- transformations.
  1343.      
  1344.      
  1345.    -- RETURN_VALUE_TYPE                          LEVEL ma
  1346.      
  1347.    type RETURN_VALUE_TYPE is (SET,
  1348.                               REALIZED);
  1349.      
  1350.    -- Indicates whether the returned values should be as
  1351.    -- they were set by the program or as they were actually
  1352.    -- realized on the device.
  1353.      
  1354.      
  1355.    -- SEGMENT_DETECTABILITY                      LEVEL 1a
  1356.      
  1357.    type SEGMENT_DETECTABILITY is (UNDETECTABLE,
  1358.                                   DETECTABLE);
  1359.      
  1360.    -- Indicates whether a segment is detectable or not.
  1361.      
  1362.      
  1363.    -- SEGMENT_HIGHLIGHTING                       LEVEL 1a
  1364.      
  1365.    type SEGMENT_HIGHLIGHTING is (NORMAL,
  1366.                                  HIGHLIGHTED);
  1367.      
  1368.    -- Indicates whether a segment is highlighted or not.
  1369.      
  1370.      
  1371.    -- SEGMENT_NAME                               LEVEL 1a
  1372.      
  1373.    type SEGMENT_NAME is new POSITIVE;
  1374.      
  1375.    --  Defines the range of segment names.
  1376.      
  1377.      
  1378.    -- SEGMENT_NAMES                              LEVEL 1a
  1379.      
  1380.    package SEGMENT_NAMES is new GKS_LIST_UTILITIES (SEGMENT_NAME);
  1381.      
  1382.    -- Provides for lists of segment names.
  1383.      
  1384.    function "&" (LEFT, RIGHT: SEGMENT_NAMES.LIST_VALUES) return
  1385.       SEGMENT_NAMES.LIST_VALUES renames SEGMENT_NAMES."&";
  1386.      
  1387.      
  1388.    -- SEGMENT_PRIORITY                           LEVEL 1a
  1389.      
  1390.    type SEGMENT_PRIORITY is digits PRECISION range 0.0..1.0;
  1391.      
  1392.    --  Defines the priority of a segment.
  1393.      
  1394.      
  1395.    -- SEGMENT_VISIBILITY                         LEVEL 1a
  1396.      
  1397.    type SEGMENT_VISIBILITY is (VISIBLE,
  1398.                                INVISIBLE);
  1399.      
  1400.    -- Indicates whether a segment is visible or not.
  1401.      
  1402.      
  1403.    -- SUBPROGRAM_NAME                            LEVEL ma
  1404.      
  1405.    subtype SUBPROGRAM_NAME is STRING;
  1406.      
  1407.    -- Defines the name of a GKS function detecting an error.
  1408.      
  1409.      
  1410.    -- VERTICAL_ALIGNMENT                         LEVEL ma
  1411.      
  1412.    type VERTICAL_ALIGNMENT is (NORMAL,
  1413.                                TOP,
  1414.                                CAP,
  1415.                                HALF,
  1416.                                BASE,
  1417.                                BOTTOM);
  1418.      
  1419.    -- The alignment of the text extent parallelogram with
  1420.    -- respect to the vertical positioning of the text.
  1421.      
  1422.      
  1423.    -- TEXT_ALIGNMENT                             LEVEL ma
  1424.      
  1425.    type TEXT_ALIGNMENT is
  1426.       record
  1427.          HORIZONTAL : HORIZONTAL_ALIGNMENT;
  1428.          VERTICAL   : VERTICAL_ALIGNMENT;
  1429.       end record;
  1430.      
  1431.    -- The type of the attribute controlling the positioning
  1432.    -- of the text extent parallelogram in relation to the text
  1433.    -- position, having horizontal and vertical components as
  1434.    -- defined above.
  1435.      
  1436.      
  1437.    -- WC_TYPE                                    LEVEL ma
  1438.      
  1439.    type WC_TYPE is digits PRECISION;
  1440.      
  1441.    --  Defines the range of accuracy for World Coordinate types.
  1442.      
  1443.      
  1444.    -- WC                                         LEVEL ma
  1445.      
  1446.    package WC is new GKS_COORDINATE_SYSTEM (WC_TYPE);
  1447.      
  1448.    -- Defines the World Coordinate System.
  1449.      
  1450.    function "=" (LEFT, RIGHT: WC.POINT) return BOOLEAN
  1451.       renames WC."=";
  1452.      
  1453.    function "&" (LEFT, RIGHT: WC.POINT_ARRAY) return
  1454.       WC.POINT_ARRAY renames WC."&";
  1455.      
  1456.    function "=" (LEFT, RIGHT: WC.VECTOR) return BOOLEAN
  1457.       renames WC."=";
  1458.      
  1459.    function "=" (LEFT, RIGHT: WC.RECTANGLE_LIMITS) return BOOLEAN
  1460.       renames WC."=";
  1461.      
  1462.    function "=" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1463.       renames WC."=";
  1464.      
  1465.    function "<" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1466.       renames WC."<";
  1467.      
  1468.    function "<=" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1469.       renames WC."<=";
  1470.      
  1471.    function ">" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1472.       renames WC.">";
  1473.      
  1474.    function ">=" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1475.       renames WC.">=";
  1476.      
  1477.    function "+" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return
  1478.       WC.MAGNITUDE_BASE_TYPE renames WC."+";
  1479.      
  1480.    function "-" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return
  1481.       WC.MAGNITUDE_BASE_TYPE renames WC."-";
  1482.      
  1483.    function "*" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return
  1484.       WC.MAGNITUDE_BASE_TYPE renames WC."*";
  1485.      
  1486.    function "/" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return
  1487.       WC.MAGNITUDE_BASE_TYPE renames WC."/";
  1488.      
  1489.    function "=" (LEFT, RIGHT: WC.SIZE) return BOOLEAN
  1490.       renames WC."=";
  1491.      
  1492.    function "=" (LEFT, RIGHT: WC.RANGE_OF_MAGNITUDES) return BOOLEAN
  1493.       renames WC."=";
  1494.      
  1495.      
  1496.    -- TEXT_EXTENT_PARALLELOGRAM                  LEVEL ma
  1497.      
  1498.    type TEXT_EXTENT_PARALLELOGRAM is
  1499.       record
  1500.          LOWER_LEFT  : WC.POINT;
  1501.          LOWER_RIGHT : WC.POINT;
  1502.          UPPER_LEFT  : WC.POINT;
  1503.          UPPER_RIGHT : WC.POINT;
  1504.       end record;
  1505.      
  1506.    -- Defines the corner points of the text extent parallelogram
  1507.    -- with respect to the vertical positioning of the text.
  1508.      
  1509.      
  1510.    -- TEXT_FONT                                  LEVEL ma
  1511.      
  1512.    type TEXT_FONT is new INTEGER;
  1513.      
  1514.    -- Defines the types of fonts provided by the implementation.
  1515.      
  1516.      
  1517.      
  1518.    -- TEXT_PRECISION                             LEVEL ma
  1519.      
  1520.    type TEXT_PRECISION is (STRING_PRECISION,
  1521.                            CHAR_PRECISION,
  1522.                            STROKE_PRECISION);
  1523.      
  1524.    -- The precision with which text appears.
  1525.      
  1526.    -- TEXT_FONT_PRECISION                        LEVEL ma
  1527.      
  1528.    type TEXT_FONT_PRECISION is
  1529.       record
  1530.          FONT      : TEXT_FONT;
  1531.          PRECISION : TEXT_PRECISION;
  1532.       end record;
  1533.      
  1534.    -- This type defines a record describing the text font and
  1535.    -- precision aspect.
  1536.      
  1537.      
  1538.    -- TEXT_FONT_PRECISIONS                       LEVEL ma
  1539.      
  1540.    package TEXT_FONT_PRECISIONS is new GKS_LIST_UTILITIES
  1541.       (TEXT_FONT_PRECISION);
  1542.      
  1543.    --  Provides for lists of text font and precision pairs.
  1544.      
  1545.    function "&" (LEFT, RIGHT: TEXT_FONT_PRECISIONS.LIST_VALUES) return
  1546.       TEXT_FONT_PRECISIONS.LIST_VALUES renames
  1547.          TEXT_FONT_PRECISIONS."&";
  1548.      
  1549.      
  1550.    -- TEXT_INDEX                                 LEVEL 0a
  1551.      
  1552.    type TEXT_INDEX is new POSITIVE;
  1553.      
  1554.    -- Defines the range of text bundle table indices.
  1555.      
  1556.      
  1557.    -- TEXT_INDICES                               LEVEL 0a
  1558.      
  1559.    package TEXT_INDICES is new GKS_LIST_UTILITIES (TEXT_INDEX);
  1560.      
  1561.    -- Provides for lists of text indices.
  1562.      
  1563.    function "&" (LEFT, RIGHT: TEXT_INDICES.LIST_VALUES) return
  1564.       TEXT_INDICES.LIST_VALUES renames TEXT_INDICES."&";
  1565.      
  1566.      
  1567.    -- TEXT_PATH                                  LEVEL ma
  1568.      
  1569.    type TEXT_PATH is (RIGHT,
  1570.                       LEFT,
  1571.                       UP,
  1572.                       DOWN);
  1573.      
  1574.    --  The direction taken by a text string.
  1575.      
  1576.      
  1577.    -- TRANSFORMATION_FACTOR                      LEVEL 1a
  1578.      
  1579.    type TRANSFORMATION_FACTOR is
  1580.       record
  1581.          X : NDC_TYPE;
  1582.          Y : NDC_TYPE;
  1583.       end record;
  1584.      
  1585.    -- Scale factors used in building transformation
  1586.    -- matrices for performing segment transformations.
  1587.      
  1588.      
  1589.    -- TRANSFORMATION_MATRIX                      LEVEL 1a
  1590.      
  1591.    type TRANSFORMATION_MATRIX is array (1..2, 1..3) of NDC_TYPE;
  1592.      
  1593.    -- For segment transformation mapping within NDC space.
  1594.      
  1595.      
  1596.    -- TRANSFORMATION_NUMBER                      LEVEL ma
  1597.      
  1598.    type TRANSFORMATION_NUMBER is new NATURAL;
  1599.      
  1600.    -- A normalization transformation number.
  1601.      
  1602.      
  1603.    -- TRANSFORMATION_PRIORITY_ARRAY              LEVEL ma
  1604.      
  1605.    type TRANSFORMATION_PRIORITY_ARRAY is array (POSITIVE range <>) of
  1606.       TRANSFORMATION_NUMBER;
  1607.      
  1608.    -- Defines the type to store transformation numbers.
  1609.      
  1610.      
  1611.    -- TRANSFORMATION_PRIORITY_LIST               LEVEL ma
  1612.      
  1613.    type TRANSFORMATION_PRIORITY_LIST (LENGTH : SMALL_NATURAL := 0) is
  1614.       record
  1615.          CONTENTS : TRANSFORMATION_PRIORITY_ARRAY (1..LENGTH);
  1616.       end record;
  1617.      
  1618.    -- Provides for a prioritized list of transformation numbers.
  1619.      
  1620.      
  1621.    -- UPDATE_REGENERATION_FLAG                   LEVEL 0a
  1622.      
  1623.    type UPDATE_REGENERATION_FLAG is (PERFORM,
  1624.                                      POSTPONE);
  1625.      
  1626.    -- Flag indicating regeneration action on display.
  1627.      
  1628.      
  1629.    -- UPDATE_STATE                               LEVEL ma
  1630.      
  1631.    type UPDATE_STATE is (NOTPENDING,
  1632.                          PENDING);
  1633.      
  1634.    -- Indicates whether or not a workstation transformation
  1635.    -- change has been requested and not yet provided.
  1636.      
  1637.      
  1638.    -- VARIABLE_CONNECTION_ID                     LEVEL ma
  1639.      
  1640.    type VARIABLE_CONNECTION_ID (LENGTH : SMALL_NATURAL := 0) is
  1641.       record
  1642.          CONNECT : CONNECTION_ID (1..LENGTH);
  1643.       end record;
  1644.      
  1645.    -- Defines a variable length connection id for INQ_WS_CONNECTION_
  1646.    -- AND_TYPE.
  1647.      
  1648.      
  1649.    -- VARIABLE_SUBPROGRAM_NAME                   LEVEL ma
  1650.      
  1651.    type VARIABLE_SUBPROGRAM_NAME (LENGTH : SMALL_NATURAL := 0) is
  1652.       record
  1653.          CONTENTS : SUBPROGRAM_NAME (1..LENGTH);
  1654.       end record;
  1655.      
  1656.    -- Defines a variable length subprogram name.
  1657.      
  1658.      
  1659.    -- WS_CATEGORY                                LEVEL 0a
  1660.      
  1661.    type WS_CATEGORY is (OUTPUT,
  1662.                         INPUT,
  1663.                         OUTIN,
  1664.                         WISS,
  1665.                         MO,
  1666.                         MI);
  1667.      
  1668.    -- Type for GKS workstation categories.
  1669.      
  1670.      
  1671.    -- WS_ID                                      LEVEL ma
  1672.      
  1673.    type WS_ID is new POSITIVE;
  1674.      
  1675.    -- Defines the range of workstation identifiers.
  1676.      
  1677.      
  1678.    -- WS_IDS                                     LEVEL ma
  1679.      
  1680.    package WS_IDS is new GKS_LIST_UTILITIES (WS_ID);
  1681.      
  1682.    -- Provides for lists of workstation identifiers.
  1683.      
  1684.    function "&" (LEFT, RIGHT: WS_IDS.LIST_VALUES) return
  1685.       WS_IDS.LIST_VALUES renames WS_IDS."&";
  1686.      
  1687.      
  1688.    -- WS_STATE                                   LEVEL 0a
  1689.      
  1690.    type WS_STATE is (INACTIVE,
  1691.                      ACTIVE);
  1692.      
  1693.    -- The state of a workstation.
  1694.      
  1695.      
  1696.    -- WS_TYPE                                    LEVEL ma
  1697.      
  1698.    type WS_TYPE is range 1..MAX_WS_TYPE;
  1699.      
  1700.    -- Range of values corresponding to valid workstation
  1701.    -- types.  Constants specifying names for the various
  1702.    -- types of workstations should be provided by an
  1703.    -- implementation in the GKS_CONFIGURATION package.
  1704.      
  1705.      
  1706.    -- WS_TYPES                                   LEVEL 0a
  1707.      
  1708.    package WS_TYPES is new GKS_LIST_UTILITIES (WS_TYPE);
  1709.      
  1710.    -- Provides for lists of workstation types.
  1711.      
  1712.    function "&" (LEFT, RIGHT: WS_TYPES.LIST_VALUES) return
  1713.       WS_TYPES.LIST_VALUES renames WS_TYPES."&";
  1714.      
  1715.    -- INDIVIDUAL_ATTRIBUTE_VALUES
  1716.      
  1717.    type INDIVIDUAL_ATTRIBUTE_VALUES is
  1718.       record
  1719.          CURRENT_LINETYPE          :  LINETYPE;
  1720.          CURRENT_LINE_WIDTH        :  LINE_WIDTH;
  1721.          CURRENT_POLYLINE_COLOUR   :  COLOUR_INDEX;
  1722.          CURRENT_MARKER_TYPE       :  MARKER_TYPE;
  1723.          CURRENT_POLYMARKER_SIZE   :  MARKER_SIZE;
  1724.          CURRENT_POLYMARKER_COLOUR :  COLOUR_INDEX;
  1725.          CURRENT_FONT_PRECISION    :  TEXT_FONT_PRECISION;
  1726.          CURRENT_CHAR_EXPANSION    :  CHAR_EXPANSION;
  1727.          CURRENT_CHAR_SPACING      :  CHAR_SPACING;
  1728.          CURRENT_TEXT_COLOUR       :  COLOUR_INDEX;
  1729.          CURRENT_INTERIOR_STYLE    :  INTERIOR_STYLE;
  1730.          CURRENT_STYLE_INDEX       :  STYLE_INDEX;
  1731.          CURRENT_FILL_AREA_COLOUR  :  COLOUR_INDEX;
  1732.          CURRENT_ASF_LIST          :  ASF_LIST;
  1733.       end record;
  1734.      
  1735.    -- A record containing all of the current individual
  1736.    -- attributes.
  1737.      
  1738.      
  1739.    -- PRIMITIVE_ATTRIBUTE_VALUES
  1740.      
  1741.    type PRIMITIVE_ATTRIBUTE_VALUES is
  1742.       record
  1743.          CURRENT_POLYLINE_INDEX          :  POLYLINE_INDEX;
  1744.          CURRENT_POLYMARKER_INDEX        :  POLYMARKER_INDEX;
  1745.          CURRENT_TEXT_INDEX              :  TEXT_INDEX;
  1746.          CURRENT_CHAR_HEIGHT             :  WC.MAGNITUDE;
  1747.          CURRENT_CHAR_UP_VECTOR          :  WC.VECTOR;
  1748.          CURRENT_CHAR_WIDTH              :  WC.MAGNITUDE;
  1749.          CURRENT_CHAR_BASE_VECTOR        :  WC.VECTOR;
  1750.          CURRENT_TEXT_PATH               :  TEXT_PATH;
  1751.          CURRENT_TEXT_ALIGNMENT          :  TEXT_ALIGNMENT;
  1752.          CURRENT_FILL_AREA_INDEX         :  FILL_AREA_INDEX;
  1753.          CURRENT_PATTERN_WIDTH_VECTOR    :  WC.VECTOR;
  1754.          CURRENT_PATTERN_HEIGHT_VECTOR   :  WC.VECTOR;
  1755.          CURRENT_PATTERN_REFERENCE_POINT :  WC.POINT;
  1756.       end record;
  1757.      
  1758.    -- A record containing all of the current primitive
  1759.    -- attributes.
  1760.      
  1761.      
  1762.    -- The following exceptions correspond to the classes of
  1763.    -- errors defined by the GKS specification.  Each of these
  1764.    -- exceptions cover one or more error numbers.
  1765.      
  1766.    ESCAPE_ERROR                   : exception;
  1767.      
  1768.    IMPLEMENTATION_DEPENDENT_ERROR : exception;
  1769.      
  1770.    INPUT_ERROR                    : exception;
  1771.      
  1772.    LANGUAGE_BINDING_ERROR         : exception;
  1773.      
  1774.    METAFILE_ERROR                 : exception;
  1775.      
  1776.    MISC_ERROR                     : exception;
  1777.      
  1778.    OUTPUT_ATTRIBUTE_ERROR         : exception;
  1779.      
  1780.    OUTPUT_PRIMITIVE_ERROR         : exception;
  1781.      
  1782.    SEGMENT_ERROR                  : exception;
  1783.      
  1784.    STATE_ERROR                    : exception;
  1785.      
  1786.    SYSTEM_ERROR                   : exception;
  1787.      
  1788.    TRANSFORMATION_ERROR           : exception;
  1789.      
  1790.    WS_ERROR                       : exception;
  1791.      
  1792. end GKS_TYPES;
  1793. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1794. --:UDD:GKSADACM:CODE:MA:LEXI3700_COMM.ADA
  1795. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1796. ------------------------------------------------------------------
  1797. --
  1798. --  NAME: LEXI3700_COMMUNICATION
  1799. --  IDENTIFIER: GDMXXX.1(1)
  1800. --  DISCREPANCY REPORTS:
  1801. --
  1802. ------------------------------------------------------------------
  1803. -- FILE : LEXI3700_COMM.ADA
  1804. -- LEVEL: ALL
  1805.      
  1806. package LEXI3700_COMMUNICATION is
  1807.      
  1808. -- This package communicates with the Lexidata Graphics Device.
  1809.      
  1810.     type BIT_16 is range 16#0000# .. 16#FFFF#;
  1811.     -- The upper range FFFF will allow a 16 bit value to be stored here.
  1812.     -- If 7FFF is used for the upper range, the Ada compiler allocates
  1813.     -- a 16 bit word instead of the 32 bit word. This will cause the
  1814.     -- assembly language routine to work incorrectly.
  1815.      
  1816.     type LEXIDATA_ARRAY is array (POSITIVE range <>) of BIT_16;
  1817.     -- LEXIDATA_ARRAY is an unconstrained array of a 16 bit value
  1818.     -- that is sent to the Lexidata 3700.
  1819.      
  1820.     procedure CLOSE_LEXIDATA;
  1821.      
  1822.     procedure FLUSH_BUFFER
  1823.        (WAIT_TO_FINISH : BOOLEAN := true);
  1824.      
  1825.     procedure OPEN_LEXIDATA
  1826.        (CHANNEL_IN  : INTEGER;
  1827.         CHANNEL_OUT : INTEGER;
  1828.         ERROR_CODE  : out INTEGER);
  1829.      
  1830.     procedure READ_FROM_BUFFER
  1831.        (READ_BUFFER   : in out LEXIDATA_ARRAY);
  1832.      
  1833.     procedure WRITE_TO_BUFFER
  1834.        (WRITE_BUFFER  : LEXIDATA_ARRAY);
  1835.      
  1836. end LEXI3700_COMMUNICATION;
  1837. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1838. --:UDD:GKSADACM:CODE:MA:LEXI3700_COMM_B.ADA
  1839. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1840. ------------------------------------------------------------------
  1841. --
  1842. --  NAME: LEXI3700_COMMUNICATION - BODY
  1843. --  IDENTIFIER: GDMXXX.1(1)
  1844. --  DISCREPANCY REPORTS:
  1845. --
  1846. ------------------------------------------------------------------
  1847. -- FILE : LEXI3700_COMM_B.ADA
  1848. -- LEVEL: ALL
  1849.      
  1850. with IMPORT_OPEN;
  1851. with IMPORT_VARIABLES;
  1852. with IMPORT_WRITE;
  1853. with IMPORT_WAIT;
  1854. with IMPORT_READ;
  1855. with SYS_CALLS;
  1856.      
  1857. package body LEXI3700_COMMUNICATION is
  1858.      
  1859. -- The body of this package uses the assembly language interface
  1860. -- procedures to communicate with the device.
  1861.      
  1862.    MAX_BUFFER_SIZE : constant := 256;
  1863.    -- The size of one buffer.
  1864.      
  1865.    subtype LEXI_BUFFER is LEXIDATA_ARRAY (1 .. MAX_BUFFER_SIZE * 2);
  1866.    -- LEXI_BUFFER is the double buffer used to buffer commands to
  1867.    -- send to the Lexidata 3700.
  1868.      
  1869.    BUF_START    : INTEGER := 1;
  1870.    -- Dynamically changing pointer to the first position of the current
  1871.    -- buffer.
  1872.      
  1873.    BUF_POINTER  : INTEGER := 1;
  1874.    -- Dynamically changing pointer to the last word written in the
  1875.    -- buffer.
  1876.      
  1877.    OUT_BUFFER   : LEXI_BUFFER;
  1878.    -- Internally maintained buffer of data going to the Lexidata 3700.
  1879.      
  1880.    procedure CLOSE_LEXIDATA is
  1881.      
  1882.    -- CLOSE_LEXIDATA is a system dependant procedure which actually
  1883.    -- makes a Data General system call to close the channel/device.
  1884.      
  1885.         AC0     : INTEGER := 0;
  1886.         -- AC0 - System register required for Data General system calls.
  1887.      
  1888.         AC1     : INTEGER := 0;
  1889.         -- AC1 - System register required for Data General system calls.
  1890.      
  1891.         AC2     : INTEGER := 0;
  1892.         -- AC2 - System register required for Data General system calls.
  1893.      
  1894.         ER      : SYS_CALLS.ERROR_CODE;
  1895.         -- ER - Error return parameter not used in this call.
  1896.      
  1897.     begin
  1898.      
  1899.        IMPORT_WRITE.ADA_PHWRIT (0, 0, true);
  1900.        SYS_CALLS.SYS (SYS_CALLS.DDIS, AC0, AC1, AC2, ER);
  1901.      
  1902.     end CLOSE_LEXIDATA;
  1903.      
  1904.     procedure FLUSH_BUFFER
  1905.        (WAIT_TO_FINISH : BOOLEAN := true) is
  1906.      
  1907.     -- This procedure flushs the current buffer and waits until
  1908.     -- the assembly language routine is finished.
  1909.     --
  1910.     -- WAIT_TO_FINISH - flag set on buffer contents check.
  1911.      
  1912.     begin
  1913.      
  1914.        IMPORT_WAIT.ADA_PHOWT;
  1915.        -- check to make sure buffer has contents.
  1916.        if BUF_POINTER /= BUF_START then
  1917.           IMPORT_WRITE.ADA_PHWRIT(OUT_BUFFER(BUF_START)'ADDRESS,
  1918.                                BUF_POINTER - BUF_START,
  1919.                                WAIT_TO_FINISH);
  1920.           -- switch buffers.
  1921.           if BUF_START = 1 then
  1922.              BUF_START   := MAX_BUFFER_SIZE + 1;
  1923.              BUF_POINTER := MAX_BUFFER_SIZE + 1;
  1924.           else
  1925.              BUF_START   := 1;
  1926.              BUF_POINTER := 1;
  1927.           end if;
  1928.        end if;
  1929.     end FLUSH_BUFFER;
  1930.      
  1931.    procedure OPEN_LEXIDATA
  1932.       (CHANNEL_IN  : INTEGER;
  1933.        CHANNEL_OUT : INTEGER;
  1934.        ERROR_CODE  : out INTEGER) is
  1935.      
  1936.    -- This procedure opens up communication to the device.
  1937.    --
  1938.    -- CHANNEL_IN  - is the I/O channel used for output from the host.
  1939.    -- CHANNEL_OUT - is the I/O channel used for input to the host.
  1940.    -- ERROR_CODE  - is an error that is passed back to the caller. This
  1941.    --               error number is host dependent.
  1942.      
  1943.    begin
  1944.      
  1945.       IMPORT_OPEN.ADA_PHDOPN(CHANNEL_IN, CHANNEL_OUT, ERROR_CODE);
  1946.      
  1947.    end OPEN_LEXIDATA;
  1948.      
  1949.    procedure READ_FROM_BUFFER
  1950.        (READ_BUFFER : in out LEXIDATA_ARRAY) is
  1951.      
  1952.     -- This procedure reads from the device.
  1953.     --
  1954.     -- READ_BUFFER - contains the array of data read from the device.
  1955.      
  1956.     begin
  1957.      
  1958.         -- call the assembly routine
  1959.      
  1960.         IMPORT_READ.ADA_PHREAD(READ_BUFFER(1)'address, READ_BUFFER'length,
  1961.                            true);
  1962.      
  1963.     end READ_FROM_BUFFER;
  1964.      
  1965.     procedure WRITE_TO_BUFFER
  1966.        (WRITE_BUFFER : LEXIDATA_ARRAY) is
  1967.      
  1968.     -- This procedure double buffers data sent to the display processor.
  1969.     --
  1970.     -- This procedure uses two buffers to send data to the display.
  1971.     -- Once one buffer is full, that full buffer is sent to the assembly
  1972.     -- language routine to start transmitting. While one buffer is being
  1973.     -- transmitted to the display processor, the other buffer can be used.
  1974.     -- There is a wait assembly routine that makes sure the transmit
  1975.     -- assembly routine is finished with one buffer before receiving
  1976.     -- another buffer to transmit.
  1977.     --
  1978.     -- WRITE_BUFFER - buffer of data to be sent to the LEXIDATA.
  1979.      
  1980.     CURRENT_POINTER : INTEGER;
  1981.     -- pointer of incoming buffer
  1982.      
  1983.     WORD_COUNT : INTEGER;
  1984.     -- counts the number of items in the incoming buffer
  1985.      
  1986.     REMAINING_SPACE : INTEGER;
  1987.     -- contains the amount of REMAINING_SPACE in the output buffer
  1988.      
  1989.     begin
  1990.      
  1991.      -- Check to see if the incoming buffer fits into the current buffer.
  1992.      -- Initialize loop that runs while the word count is greater than
  1993.      -- or equal to the REMAINING_SPACE available in the current buffer.
  1994.      -- Then copy as many words that will fit in the current buffer and
  1995.      -- call FLUSH. FLUSH passes out the current buffer and switch
  1996.      -- the buffers to continue packing the incoming buffer.
  1997.      
  1998.        WORD_COUNT := WRITE_BUFFER'LENGTH;
  1999.        CURRENT_POINTER := WRITE_BUFFER'FIRST;
  2000.        REMAINING_SPACE  := BUF_START + MAX_BUFFER_SIZE - BUF_POINTER;
  2001.        while (WORD_COUNT >= REMAINING_SPACE) loop
  2002.              OUT_BUFFER(BUF_POINTER .. (BUF_POINTER + REMAINING_SPACE - 1)) :=
  2003.                    WRITE_BUFFER(CURRENT_POINTER .. (CURRENT_POINTER + REMAINING_
  2004. SPACE - 1));
  2005.              CURRENT_POINTER := CURRENT_POINTER + REMAINING_SPACE;
  2006.              BUF_POINTER := BUF_POINTER + REMAINING_SPACE;
  2007.              FLUSH_BUFFER(false);
  2008.              WORD_COUNT := WORD_COUNT - REMAINING_SPACE;
  2009.              REMAINING_SPACE  := BUF_START + MAX_BUFFER_SIZE - BUF_POINTER;
  2010.         end loop;
  2011.      
  2012.         -- The remaining words of the incoming buffer will fit into the
  2013.         -- current buffer. Therefore the loop is exited and the
  2014.         -- rest of the incoming buffer is packed into the current buffer.
  2015.         -- If WORD_COUNT is equal to zero, then it was packed in and flushed.
  2016.      
  2017.         if WORD_COUNT > 0 then
  2018.            OUT_BUFFER(BUF_POINTER .. BUF_POINTER + WORD_COUNT - 1) :=
  2019.                 WRITE_BUFFER(CURRENT_POINTER .. CURRENT_POINTER + WORD_COUNT - 1
  2020. );
  2021.            BUF_POINTER := BUF_POINTER + WORD_COUNT;
  2022.         end if;
  2023.      
  2024.     end WRITE_TO_BUFFER;
  2025.      
  2026. end LEXI3700_COMMUNICATION;
  2027. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2028. --:UDD:GKSADACM:CODE:MA:LEXI3700_CONFIG.ADA
  2029. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2030. ------------------------------------------------------------------
  2031. --
  2032. --  NAME: LEXI3700_CONFIGURATION
  2033. --  IDENTIFIER: GDMXXX.2(1)
  2034. --  DISCREPANCY REPORTS:
  2035. --  DR012  Text character spacing.
  2036. ------------------------------------------------------------------
  2037. -- FILE : LEXI3700_CONFIG.ADA
  2038. -- LEVEL: ALL
  2039.      
  2040. PACKAGE LEXI3700_CONFIGURATION is
  2041.      
  2042. -- This package contains device specific values that control
  2043. -- the appearance of output on the display.
  2044.      
  2045.    NUM_OF_BITS_USED_FOR_SYSTEM       : constant := 8;
  2046.    -- Number of bits used to describe each pixel in the lookup table.
  2047.    -- This number of bits provide the possible intensity values available.
  2048.      
  2049.    NUM_OF_BITS_USED_FOR_SIZE_OF_CLUT : constant := 8;
  2050.    -- This refers to the amount of memory space available in a lookup table.
  2051.      
  2052.    LEXI_MAXIMUM_PLANE_VALUE : constant :=
  2053.         (2 ** NUM_OF_BITS_USED_FOR_SYSTEM) - 1;
  2054.    -- Is used to mask different planes for different operations.
  2055.      
  2056.    LEXI_MAXIMUM_COLOUR_INDEX : constant :=
  2057.         (2 ** (NUM_OF_BITS_USED_FOR_SIZE_OF_CLUT - 1));
  2058.    -- The number of valid colour indices supported, the last plane is
  2059.    -- used for edge fill for filling polygons.
  2060.      
  2061.    LEXI_MAXIMUM_COLOUR_INTENSITY : constant :=
  2062.         (2 ** NUM_OF_BITS_USED_FOR_SYSTEM) - 1;
  2063.    -- Is the maximum colour intensity allowed to specified each colour
  2064.    -- index.
  2065.      
  2066.    LEXI_NUMBER_OF_LINE_TYPES : constant := 4;
  2067.    -- Tells how many line types the device offers.
  2068.      
  2069.    LEXI_NUMBER_OF_MARKER_TYPES : constant := 5;
  2070.    -- Tells how many marker types the device offers.
  2071.      
  2072.    LEXI_NOMINAL_LINE_WIDTH : constant := 1;
  2073.    LEXI_MINIMUM_LINE_WIDTH : constant := 1;
  2074.    LEXI_MAXIMUM_LINE_WIDTH : constant := 50;
  2075.    -- Tells the range of line widths the device offers.
  2076.      
  2077.    LEXI_NOMINAL_TEXT_SIZE  : constant := 1;
  2078.    LEXI_MINIMUM_TEXT_SIZE  : constant := 1;
  2079.    LEXI_MAXIMUM_TEXT_SIZE  : constant := 50;
  2080.    -- Tells the range of text sizes that the device offers.
  2081.      
  2082.    LEXI_FILL_PLANE_VALUE : constant := 2 ** (NUM_OF_BITS_USED_FOR_SYSTEM - 1);
  2083.    -- Is the plane used for fill area.
  2084.      
  2085.    LEXI_CHARACTER_FONT_HEIGHT : constant := 12;
  2086.    LEXI_CHARACTER_FONT_WIDTH  : constant := 9;
  2087.    -- This includes a pixel space on both sides.
  2088.    LEXI_CHARACTER_FONT        : constant := 9.0 / 12.0;
  2089.    LEXI_CHARACTER_FONT_CAP_TOP : constant := 1.0 / 12.0;
  2090.    LEXI_CHARACTER_FONT_BASE_BOTTOM : constant := 1.0 / 12.0;
  2091.    -- Describes the hardware text font designer.
  2092.      
  2093.    LEXI_X_MAXIMUM : constant := 1279;
  2094.    LEXI_Y_MAXIMUM : constant := 1023;
  2095.    -- Tells the maximum screen size .
  2096.      
  2097. end LEXI3700_CONFIGURATION;
  2098. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2099. --:UDD:GKSADACM:CODE:MA:LEXI3700_TYPES.ADA
  2100. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2101. ------------------------------------------------------------------
  2102. --
  2103. --  NAME: LEXI3700_TYPES
  2104. --  IDENTIFIER: GDMXXX.2(1)
  2105. --  DISCREPANCY REPORTS:
  2106. --  Not listed
  2107. ------------------------------------------------------------------
  2108. -- FILE : LEXI3700_TYPES.ADA
  2109. -- LEVEL: ALL
  2110.      
  2111. with LEXI3700_CONFIGURATION;
  2112.      
  2113. use  LEXI3700_CONFIGURATION;
  2114.      
  2115. package LEXI3700_TYPES is
  2116.      
  2117. -- The package LEXI3700_CONFIGURATION contains the specific values
  2118. -- that control the appearance of output on the display.
  2119.      
  2120.    type LEXI_PATTERN_SIZE is new INTEGER;
  2121.    -- LEXI_PATTERN_SIZE is used to describe the pattern size for vectors
  2122.    -- and arcs. Used with procedure SET_DISPLAY_PARAMETERS.
  2123.      
  2124.    type LEXI_RADIUS_TYPE is range 1 .. LEXI_X_MAXIMUM;
  2125.    --LEXI_RADIUS_TYPE is used to describe the radius of circles and
  2126.    -- arcs.
  2127.      
  2128.    type LEXI_PLANE_VALUE is range 0 .. LEXI_MAXIMUM_PLANE_VALUE;
  2129.    -- LEXI_PLANE_VALUE describes the display memory planes available.
  2130.      
  2131.    type LEXI_COORDINATE is range 0 .. LEXI_X_MAXIMUM;
  2132.    -- LEXI_COORDINATE describes the range of coordinates for the Lexidata.
  2133.      
  2134.    type LEXI_COUNT_VALUE is new NATURAL;
  2135.    -- LEXI_COUNT_VALUE describes the range of arc size and starting
  2136.    -- position for the DISPLAY_ARC procedure.
  2137.      
  2138.    type LEXI_PLANE_ADDRESS is new INTEGER;
  2139.    -- LEXI_PLANE_ADDRESS describes the range of values for the Red,
  2140.    -- Green, and Blue plane address.
  2141.      
  2142.    type LEXI_POINT is record
  2143.         X : LEXI_COORDINATE;
  2144.         Y : LEXI_COORDINATE;
  2145.    end record;
  2146.    -- LEXI_POINT describes a record for the x and y coordinates of a
  2147.    -- point.
  2148.      
  2149.    type LEXI_POINTS is array (POSITIVE range <>) of LEXI_POINT;
  2150.    -- LEXI_POINTS creates a unconstrained array of x and y coordinates.
  2151.      
  2152.    type LEXI_COLOUR_INDEX is range 0 .. LEXI_MAXIMUM_COLOUR_INDEX;
  2153.    -- LEXI_COLOUR_INDEX is the range of valid colour indices.
  2154.      
  2155.    type LEXI_COLOUR_INTENSITY is range 0 .. LEXI_MAXIMUM_COLOUR_INTENSITY;
  2156.    -- LEXI_COLOUR_INTENSITY is the range of valid intensity values.
  2157.      
  2158.    type LEXI_PIXEL_COLOUR is record
  2159.         RED   : LEXI_COLOUR_INTENSITY;
  2160.         BLUE  : LEXI_COLOUR_INTENSITY;
  2161.         GREEN : LEXI_COLOUR_INTENSITY;
  2162.    end record;
  2163.    -- LEXI_PIXEL_COLOUR is a record made up of Red, Blue, and Green
  2164.    -- intensities.
  2165.      
  2166.    type LEXI_PIXEL_ARRAY_INDEX is array (POSITIVE range <>)
  2167.         of LEXI_COLOUR_INDEX;
  2168.    -- LEXI_PIXEL_ARRAY_INDEX is an unconstrained array of Red, Blue,
  2169.    -- and Green intensity values that make up a colour index.
  2170.      
  2171.    type LEXI_CHARACTER_PATH is (LEFT_TO_RIGHT,
  2172.                                 RIGHT_TO_LEFT,
  2173.                                 BOTTOM_TO_TOP,
  2174.                                 TOP_TO_BOTTOM);
  2175.    -- LEXI_CHARACTER_PATH describes the offered character paths for
  2176.    -- the Lexidata 3700.
  2177.      
  2178.    type LEXI_ROTATE_CODE is    (NO_ROTATION,
  2179.                                 ROTATION_90,
  2180.                                 ROTATION_180,
  2181.                                 ROTATION_270);
  2182.    -- LEXI_ROTATE_CODE describes the offered character rotations
  2183.    -- for the Lexidata 3700.
  2184.      
  2185.    type LEXI_CURSOR_TYPE is (NON_INTERLACED_CROSSHAIR,
  2186.                              NON_INTERLACED_MATRIX,
  2187.                              INTERLACED_CROSSHAIR,
  2188.                              INTERLACED_MATRIX);
  2189.    -- LEXI_CURSOR_TYPE describes the four cursor types offered for the
  2190.    -- Lexidata 3700.
  2191.      
  2192.    type LEXI_MARKER_TYPE is (PERIOD,
  2193.                              PLUS,
  2194.                              ASTERISK,
  2195.                              ZERO,
  2196.                              X_CHAR);
  2197.    -- LEXI_MARKER_TYPE defines the list of valid markers.
  2198.      
  2199.    type LEXI_TEXT_SIZE is range
  2200.         LEXI_MINIMUM_TEXT_SIZE .. LEXI_MAXIMUM_TEXT_SIZE;
  2201.    -- LEXI_TEXT_SIZE defines the range of text sizes.
  2202.      
  2203.    type LEXI_LINE_TYPE is (SOLID_LINE,
  2204.                            DASHED_LINE,
  2205.                            DOTTED_LINE,
  2206.                            DASHED_DOTTED_LINE);
  2207.    -- LEXI_LINE_TYPE is the list of valid line types that the
  2208.    -- Lexidata 3700 offers.
  2209.      
  2210.    type LEXI_LINE_WIDTH_TYPE is range
  2211.         LEXI_MINIMUM_LINE_WIDTH .. LEXI_MAXIMUM_LINE_WIDTH;
  2212.    -- LEXI_LINE_WIDTH_TYPE is the range of line widths.
  2213.      
  2214.    type LEXI_INTERIOR_STYLE is (HOLLOW, SOLID);
  2215.    -- LEXI_INTERIOR_STYLE defines the two interior styles offered.
  2216.      
  2217. end LEXI3700_TYPES;
  2218. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2219. --:UDD:GKSADACM:CODE:MA:LEXI_OUT_DRIVER.ADA
  2220. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2221. ------------------------------------------------------------------
  2222. --
  2223. --  NAME: LEXI3700_OUTPUT_DRIVER
  2224. --  IDENTIFIER: GDMXXX.2(1)
  2225. --  DISCREPANCY REPORTS:
  2226. --  Not listed
  2227. ------------------------------------------------------------------
  2228. -- FILE : LEXI_OUT_DRIVER.ADA
  2229. -- LEVEL: ALL
  2230.      
  2231. with LEXI3700_TYPES;
  2232. with LEXI3700_CONFIGURATION;
  2233.      
  2234. use  LEXI3700_TYPES;
  2235.      
  2236. package LEXI3700_OUTPUT_DRIVER is
  2237.      
  2238. -- This package defines the procedure interface to the Lexidata 3700
  2239. -- graphics display device. This is a subset of the procedures supplied
  2240. -- by the Lexidata to support the GKS.
  2241. -- The naming convention used here to name the procedures in the
  2242. -- LEXI3700_DRIVER is the definition title found in the FUNCTION
  2243. -- DESCRIPTIONS Section 3 of the Lexidata manual. The definition title
  2244. -- is the definition of each function found on the top of each page
  2245. -- that describes a firmware function.
  2246. -- An example of this naming convention is the Lexidata library
  2247. -- call DSCLR with the definition title of CLEAR DISPLAY. So this is
  2248. -- the name that is used for the procedure name.
  2249.      
  2250.    LEXI_MARKER             : constant array (LEXI_MARKER_TYPE)
  2251.                              of STRING(1 .. 1) :=
  2252.                              (PERIOD   => ".",
  2253.                               PLUS     => "+",
  2254.                               ASTERISK => "*",
  2255.                               ZERO     => "o",
  2256.                               X_CHAR   => "x");
  2257.    -- LEXI_MARKER is an array of valid marker types.
  2258.      
  2259.     procedure CLEAR_DISPLAY
  2260.        (PLANE : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last);
  2261.      
  2262.     procedure DEFINE_WRITE_CHANNELS
  2263.        (TEXT_CHANNEL  : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last;
  2264.         GRAPH_CHANNEL : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last;
  2265.         IMAGE_CHANNEL : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last);
  2266.      
  2267.     procedure DISPLAY_ARC
  2268.        (CENTER      : LEXI_POINT;
  2269.         RADIUS      : LEXI_RADIUS_TYPE;
  2270.         COLOUR      : LEXI_COLOUR_INDEX;
  2271.         START       : LEXI_COUNT_VALUE;
  2272.         PIXEL_COUNT : LEXI_COUNT_VALUE);
  2273.      
  2274.     procedure DISPLAY_CHAINED_VECTORS
  2275.        (COLOUR : LEXI_COLOUR_INDEX;
  2276.         POINTS : LEXI_POINTS);
  2277.      
  2278.     procedure DISPLAY_CIRCLE
  2279.        (CENTER : LEXI_POINT;
  2280.         RADIUS : LEXI_RADIUS_TYPE;
  2281.         COLOUR : LEXI_COLOUR_INDEX);
  2282.      
  2283.     procedure DISPLAY_TEXT
  2284.        (TEXT : STRING);
  2285.      
  2286.     procedure FLUSH;
  2287.      
  2288.     procedure OPEN
  2289.        (CHANNEL_IN  : INTEGER;
  2290.         CHANNEL_OUT : INTEGER;
  2291.         ERROR_CODE  : out INTEGER);
  2292.      
  2293.     procedure POLYGON_EDGE_FLAG_FILL
  2294.        (FILL_VALUE      : LEXI_COLOUR_INDEX;
  2295.         LEXI_PLANE_MASK : LEXI_PLANE_VALUE :=
  2296.               LEXI3700_CONFIGURATION.LEXI_FILL_PLANE_VALUE);
  2297.      
  2298.     procedure RANDOM_PIXEL_READ
  2299.        (POINTS      : LEXI_POINTS;
  2300.         PIXEL_ARRAY : out LEXI_PIXEL_ARRAY_INDEX);
  2301.      
  2302.     procedure RANDOM_PIXEL_WRITE
  2303.        (POINTS  : LEXI_POINTS;
  2304.         COLOURS : LEXI_PIXEL_ARRAY_INDEX);
  2305.      
  2306.     procedure READ_FROM_LUT
  2307.        (COLOUR_INDEX : LEXI_COLOUR_INDEX;
  2308.         COLOUR_VALUE : out LEXI_PIXEL_COLOUR);
  2309.      
  2310.     procedure SET_DISPLAY_PARAMETERS
  2311.        (WIDTH : LEXI_LINE_WIDTH_TYPE;
  2312.         LINE  : LEXI_LINE_TYPE;
  2313.         FILL  : LEXI_INTERIOR_STYLE;
  2314.         SIZE  : LEXI_PATTERN_SIZE := 2);
  2315.      
  2316.     procedure SET_HARDWARE_CURSOR
  2317.        (CURSOR : LEXI_CURSOR_TYPE := NON_INTERLACED_MATRIX;
  2318.         XOFF   : LEXI_COORDINATE := 0;
  2319.         YOFF   : LEXI_COORDINATE := 0);
  2320.      
  2321.     procedure SET_RECTANGULAR_LIMIT
  2322.        (UPPER_LEFT  : LEXI_POINT;
  2323.         LOWER_RIGHT : LEXI_POINT);
  2324.      
  2325.     procedure SET_TEXT_CHARACTER_ROTATION
  2326.        (ROTATION : LEXI_ROTATE_CODE);
  2327.      
  2328.     procedure SET_TEXT_PARAMETERS
  2329.        (POSITION : LEXI_POINT;
  2330.         COLOUR   : LEXI_COLOUR_INDEX;
  2331.         PATH     : LEXI_CHARACTER_PATH;
  2332.         SIZE     : LEXI_TEXT_SIZE);
  2333.      
  2334.     procedure SET_TEXT_WINDOW
  2335.        (UPPER_LEFT  : LEXI_POINT;
  2336.         LOWER_RIGHT : LEXI_POINT);
  2337.      
  2338.     procedure SEQUENTIAL_PIXEL_WRITE
  2339.        (PIXEL_ARRAY : LEXI_PIXEL_ARRAY_INDEX);
  2340.      
  2341.     procedure WRITE_TO_LUT
  2342.        (COLOUR_INDEX : LEXI_COLOUR_INDEX;
  2343.         COLOUR_VALUE : LEXI_PIXEL_COLOUR);
  2344.      
  2345. end LEXI3700_OUTPUT_DRIVER;
  2346. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2347. --:UDD:GKSADACM:CODE:MA:LEXI_OUT_DRIVER_B.ADA
  2348. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2349. ------------------------------------------------------------------
  2350. --
  2351. --  NAME: LEXI3700_OUTPUT_DRIVER - BODY
  2352. --  IDENTIFIER: GDMXXX.2(2)
  2353. --  DISCREPANCY REPORTS:
  2354. --  DR034  Fix pline clip.
  2355. ------------------------------------------------------------------
  2356. -- FILE : LEXI_OUT_DRIVER_B.ADA
  2357. -- LEVEL: ALL
  2358.      
  2359. with LEXI3700_COMMUNICATION;
  2360.      
  2361. use  LEXI3700_COMMUNICATION;
  2362.      
  2363. package body LEXI3700_OUTPUT_DRIVER is
  2364.      
  2365. -- The LEXI3700_COMMUNICATION package communicates with the Lexidata
  2366. -- graphics display.
  2367.      
  2368.    CLEAR_DISPLAY_OP               : constant := 3;
  2369.    -- Clear the display
  2370.      
  2371.    DEFINE_WRITE_CHANNELS_OP       : constant := 2;
  2372.    -- Fill area
  2373.      
  2374.    DISPLAY_ARC_OP                 : constant := 43;
  2375.    -- Arc for clipping circle
  2376.      
  2377.    DISPLAY_CHAINED_VECTORS_OP     : constant := 41;
  2378.    -- Polyline, Fill area
  2379.      
  2380.    DISPLAY_CIRCLE_OP              : constant := 14;
  2381.    -- Circle
  2382.      
  2383.    DISPLAY_TEXT_OP                : constant := 9;
  2384.    -- Polymarker, Text
  2385.      
  2386.    POLYGON_EDGE_FLAG_FILL_OP      : constant := 48;
  2387.    -- Fill area
  2388.      
  2389.    RANDOM_PIXEL_READ_OP           : constant := 16;
  2390.    -- Inq_Pixel_Ar, Inq_Pixel
  2391.      
  2392.    RANDOM_PIXEL_WRITE_OP          : constant := 17;
  2393.    -- Cell_Array
  2394.      
  2395.    READ_FROM_LUT_OP               : constant := 21;
  2396.    -- Inq_Pixel_Ar, Inq_Pixel
  2397.      
  2398.    SET_DISPLAY_PARAMETERS_OP      : constant := 40;
  2399.    -- Polyline,Fill area,Circle
  2400.      
  2401.    SET_HARDWARE_CURSOR_OP         : constant := 26;
  2402.    -- Erases the hardware cursor
  2403.      
  2404.    SET_RECTANGULAR_LIMIT_OP       : constant := 1;
  2405.    -- Fill area
  2406.      
  2407.    SET_TEXT_CHARACTER_ROTATION_OP : constant := 93;
  2408.    -- Character up vector
  2409.      
  2410.    SET_TEXT_PARAMETERS_OP         : constant := 19;
  2411.    -- Polymarker and Text attribute
  2412.      
  2413.    SET_TEXT_WINDOW_OP             : constant := 100;
  2414.    -- String precision
  2415.      
  2416.    SEQUENTIAL_PIXEL_WRITE_OP      : constant := 4;
  2417.    -- cell array
  2418.      
  2419.    WRITE_TO_LUT_OP                : constant := 20;
  2420.    -- Set_Clr_Rep
  2421.      
  2422.    RED_PLANE_ADDRESS   : constant LEXI_PLANE_ADDRESS :=
  2423.          1* LEXI_PLANE_ADDRESS(LEXI_PLANE_VALUE'last + 1);
  2424.    GREEN_PLANE_ADDRESS : constant LEXI_PLANE_ADDRESS :=
  2425.          2* LEXI_PLANE_ADDRESS(LEXI_PLANE_VALUE'last + 1);
  2426.    BLUE_PLANE_ADDRESS  : constant LEXI_PLANE_ADDRESS :=
  2427.          3* LEXI_PLANE_ADDRESS(LEXI_PLANE_VALUE'last + 1);
  2428.    -- These constants address the physical memory locations of
  2429.    -- the colour planes to write an intensity value.
  2430.      
  2431.    LEXI_CHARACTER_ROTATION : constant array (LEXI_ROTATE_CODE)
  2432.                              of INTEGER :=
  2433.                              (NO_ROTATION  => 0,
  2434.                               ROTATION_90  => 1,
  2435.                               ROTATION_180 => 2,
  2436.                               ROTATION_270 => 3);
  2437.    -- LEXI_CHARACTER_ROTATION is an array of valid character rotations.
  2438.      
  2439.    LEXI_LINE               : constant array (LEXI_LINE_TYPE)
  2440.                              of INTEGER :=
  2441.                              (SOLID_LINE         => 8#147777#,
  2442.                               DASHED_LINE        => 8#147007#,
  2443.                               DOTTED_LINE        => 8#146000#,
  2444.                               DASHED_DOTTED_LINE => 8#147431#);
  2445.    -- LEXI_LINE is an array of valid line types.
  2446.      
  2447.    LEXI_PATH               : constant array (LEXI_CHARACTER_PATH)
  2448.                              of INTEGER :=
  2449.                              (LEFT_TO_RIGHT => 8#000#,
  2450.                               RIGHT_TO_LEFT => 8#200#,
  2451.                               BOTTOM_TO_TOP => 8#300#,
  2452.                               TOP_TO_BOTTOM => 8#100#);
  2453.    -- LEXI_PATH is an array of valid character paths.
  2454.      
  2455.    LEXI_FILL_VALUE         : constant array (LEXI_INTERIOR_STYLE)
  2456.                              of INTEGER :=
  2457.                              (HOLLOW => 8#000000#,
  2458.                               SOLID  => 8#130000#);
  2459.    -- LEXI_FILL_VALUE is an array of fill values offered.
  2460.      
  2461.    HARDWARE_CURSOR         : constant array (LEXI_CURSOR_TYPE)
  2462.                              of INTEGER :=
  2463.                              (NON_INTERLACED_CROSSHAIR => 0,
  2464.                               NON_INTERLACED_MATRIX    => 2,
  2465.                               INTERLACED_CROSSHAIR     => 8,
  2466.                               INTERLACED_MATRIX        => 10);
  2467.    -- HARDWARE_CURSOR is an array of hardware cursors the device supports.
  2468.      
  2469.     procedure CLEAR_DISPLAY
  2470.        (PLANE : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last) is
  2471.      
  2472.     -- This procedure clears data from all planes.
  2473.     --
  2474.     -- PLANE - Mask specifying planes to be erased.
  2475.     --
  2476.     -- Procedure name: DSCLR
  2477.      
  2478.     begin
  2479.      
  2480.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  2481.             ((BIT_16(CLEAR_DISPLAY_OP),
  2482.               BIT_16(PLANE)));
  2483.      
  2484.     end CLEAR_DISPLAY;
  2485.      
  2486.     procedure DEFINE_WRITE_CHANNELS
  2487.        (TEXT_CHANNEL  : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last;
  2488.         GRAPH_CHANNEL : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last;
  2489.         IMAGE_CHANNEL : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last) is
  2490.      
  2491.     -- This procedure defines the display memory planes used by the
  2492.     -- text, graphics, and image functions.
  2493.     --
  2494.     -- TEXT_CHANNEL  - plane enable mask for the text channel.
  2495.     -- GRAPH_CHANNEL - plane enable mask for the graphics channel.
  2496.     -- IMAGE_CHANNEL - plane enable mask for the image channel.
  2497.     --
  2498.     -- Procedure name: DSCHAN
  2499.      
  2500.     begin
  2501.      
  2502.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  2503.             ((BIT_16(DEFINE_WRITE_CHANNELS_OP),
  2504.               BIT_16(TEXT_CHANNEL),
  2505.               BIT_16(GRAPH_CHANNEL),
  2506.               BIT_16(IMAGE_CHANNEL)));
  2507.      
  2508.     end DEFINE_WRITE_CHANNELS;
  2509.      
  2510.     procedure DISPLAY_ARC
  2511.        (CENTER          : LEXI_POINT;
  2512.         RADIUS          : LEXI_RADIUS_TYPE;
  2513.         COLOUR          : LEXI_COLOUR_INDEX;
  2514.         START           : LEXI_COUNT_VALUE;
  2515.         PIXEL_COUNT     : LEXI_COUNT_VALUE) is
  2516.      
  2517.     -- This procedure displays the arc of a circle in the write mode
  2518.     -- previously specified by SET_DISPLAY_PARAMETERS.
  2519.     --
  2520.     -- CENTER    - Center point of the arc.
  2521.     -- RADIUS    - The radius of the arc.
  2522.     -- COLOUR    - Color intensity value written to display memory.
  2523.     -- START     - Starting position of arc, counted in pixels
  2524.     --             counterclockwise from 0 degrees.
  2525.     -- PIXEL_COUNT - Size of the arc in pixels, counted counterclockwise
  2526.     --               from start.
  2527.     --
  2528.     -- Procedure name: DSARC
  2529.      
  2530.     begin
  2531.      
  2532.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  2533.             ((BIT_16(DISPLAY_ARC_OP),
  2534.               BIT_16(CENTER.X),
  2535.               BIT_16(CENTER.Y),
  2536.               BIT_16(RADIUS),
  2537.               BIT_16(COLOUR),
  2538.               BIT_16(START),
  2539.               BIT_16(PIXEL_COUNT)));
  2540.      
  2541.     end DISPLAY_ARC;
  2542.      
  2543.     procedure DISPLAY_CHAINED_VECTORS
  2544.        (COLOUR : LEXI_COLOUR_INDEX;
  2545.         POINTS : LEXI_POINTS) is
  2546.      
  2547.     -- This procedure displays chained vectors as defined by coordinates
  2548.     -- in array POINTS with a color intensity defined by colour index.
  2549.     --
  2550.     -- COLOUR - Color intensity value to be written to display.
  2551.     -- POINTS - Array defining endpoints of the chained vectors.
  2552.     --
  2553.     -- Procedure name: DSCVEC
  2554.      
  2555.        SEND_BLOCK : LEXIDATA_ARRAY (1 .. (2 * POINTS'LENGTH) + 3);
  2556.        -- array containing information to be sent to the device.
  2557.      
  2558.     begin
  2559.      
  2560.        SEND_BLOCK (1 .. 3) := ((BIT_16(DISPLAY_CHAINED_VECTORS_OP),
  2561.                                BIT_16(COLOUR),
  2562.                                BIT_16(POINTS'LENGTH * 2)));
  2563.        for I in 1 .. POINTS'LENGTH loop
  2564.            SEND_BLOCK(2*I + 2) := BIT_16(POINTS(I).X);
  2565.            SEND_BLOCK(2*I + 3) := BIT_16(POINTS(I).Y);
  2566.        end loop;
  2567.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER(SEND_BLOCK);
  2568.      
  2569.     end DISPLAY_CHAINED_VECTORS;
  2570.      
  2571.     procedure DISPLAY_CIRCLE
  2572.        (CENTER : LEXI_POINT;
  2573.         RADIUS : LEXI_RADIUS_TYPE;
  2574.         COLOUR : LEXI_COLOUR_INDEX) is
  2575.      
  2576.     -- This procedure draws a circle with the specified center
  2577.     -- and radius.
  2578.     --
  2579.     -- CENTER - Center point of the circle.
  2580.     -- RADIUS - The radius of the circle.
  2581.     -- COLOUR - Color intensity index written to pixels comprising
  2582.     --          the circle.
  2583.     --
  2584.     -- Procedure name: DSCIR
  2585.      
  2586.     begin
  2587.      
  2588.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  2589.             ((BIT_16(DISPLAY_CIRCLE_OP),
  2590.               BIT_16(CENTER.X),
  2591.               BIT_16(CENTER.Y),
  2592.               BIT_16(RADIUS),
  2593.               BIT_16(COLOUR)));
  2594.      
  2595.     end DISPLAY_CIRCLE;
  2596.      
  2597.     procedure DISPLAY_TEXT
  2598.       (TEXT     : STRING) is
  2599.      
  2600.     -- This procedure writes text characters stored in TEXT to the
  2601.     -- planes enabled by the current DEFINE_WRITE_CHANNELS TEXT_CHANNEL
  2602.     -- value.  The procedure breaks down the character string into an
  2603.     -- array of integer, because the device only excepts integer values.
  2604.     --
  2605.     -- TEXT     - The buffer containing the text to be written.
  2606.     --
  2607.     -- Procedure name: DSTXT
  2608.      
  2609.        IS_ODD     : INTEGER := TEXT'LENGTH rem 2;
  2610.        -- IS_ODD     - Used to determine if value is odd or even.
  2611.      
  2612.        HALF_SIZE  : INTEGER := TEXT'LENGTH / 2;
  2613.        -- HALF_SIZE  - Used to determine size of array of integers.
  2614.      
  2615.        SEND_BLOCK : LEXIDATA_ARRAY(1 .. HALF_SIZE + IS_ODD + 2);
  2616.        -- SEND_BLOCK - Contains the checks to send to the LEXIDATA.
  2617.      
  2618.        INDEX      : INTEGER := 2;
  2619.        -- INDEX      - Index for SEND_BLOCK.
  2620.      
  2621.     begin
  2622.      
  2623.         SEND_BLOCK(1 .. 2) := ((BIT_16(DISPLAY_TEXT_OP),
  2624.                              BIT_16(TEXT'length)));
  2625.         for I in TEXT'first .. TEXT'first + HALF_SIZE - 1 loop
  2626.             INDEX := INDEX + 1;
  2627.             SEND_BLOCK(INDEX) := BIT_16(CHARACTER'POS(TEXT(2 * I - 1)) *
  2628.                               256 + CHARACTER'POS (TEXT (2 * I)));
  2629.         end loop;
  2630.         if IS_ODD = 1 then
  2631.            SEND_BLOCK (INDEX + 1) := BIT_16(CHARACTER'POS(TEXT(TEXT'LAST))
  2632.                                   * 256);
  2633.         end if;
  2634.         LEXI3700_COMMUNICATION.WRITE_TO_BUFFER(SEND_BLOCK);
  2635.      
  2636.     end DISPLAY_TEXT;
  2637.      
  2638.     procedure FLUSH is
  2639.      
  2640.     -- This procedure clears out the buffer.
  2641.      
  2642.     begin
  2643.      
  2644.        LEXI3700_COMMUNICATION.FLUSH_BUFFER;
  2645.      
  2646.     end FLUSH;
  2647.      
  2648.     procedure OPEN (CHANNEL_IN  : INTEGER;
  2649.                     CHANNEL_OUT : INTEGER;
  2650.                     ERROR_CODE  : out INTEGER) is
  2651.      
  2652.     -- This procedure establishes the connection of the device .
  2653.     --
  2654.     -- CHANNEL_IN  - The input channel.
  2655.     -- CHANNEL_OUT - The output channel.
  2656.     -- ERROR_CODE  - The error return code from OPEN.
  2657.      
  2658.        OPEN_ERROR : INTEGER;
  2659.        -- OPEN_ERROR contains the error value returned when the device
  2660.        -- cannot be connected.
  2661.      
  2662.     begin
  2663.      
  2664.        LEXI3700_COMMUNICATION.OPEN_LEXIDATA(CHANNEL_IN, CHANNEL_OUT,
  2665.              OPEN_ERROR);
  2666.        ERROR_CODE := OPEN_ERROR;
  2667.      
  2668.     end OPEN;
  2669.      
  2670.     procedure POLYGON_EDGE_FLAG_FILL
  2671.        (FILL_VALUE      : LEXI_COLOUR_INDEX;
  2672.         LEXI_PLANE_MASK : LEXI_PLANE_VALUE :=
  2673.               LEXI3700_CONFIGURATION.LEXI_FILL_PLANE_VALUE) is
  2674.      
  2675.     -- This procedure fills polygons according to the edge flag method
  2676.     -- of polygon filling.
  2677.     --
  2678.     -- FILL_VALUE - Pixel (color intensity) value used to fill polygon.
  2679.     -- LEXI_PLANE_MASK - Mask indicating planes containing edge flags.
  2680.     --
  2681.     -- Procedure name: DSEFIL
  2682.      
  2683.     begin
  2684.      
  2685.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  2686.             ((BIT_16(POLYGON_EDGE_FLAG_FILL_OP),
  2687.               BIT_16(LEXI_PLANE_MASK),
  2688.               BIT_16(FILL_VALUE)));
  2689.      
  2690.     end POLYGON_EDGE_FLAG_FILL;
  2691.      
  2692.     procedure RANDOM_PIXEL_READ
  2693.        (POINTS       : LEXI_POINTS;
  2694.         PIXEL_ARRAY  : out LEXI_PIXEL_ARRAY_INDEX) is
  2695.      
  2696.     -- This procedure causes the display processor to send back a number
  2697.     -- of pixel values from locations specified by POINTS, on planes
  2698.     -- enable by the current DEFINE_WRITE_CHANNELS IMAGE_CHANNEL value.
  2699.     --
  2700.     -- POINTS      - Number of pixels to be read.
  2701.     -- PIXEL_ARRAY - Buffer containing pixels to be read.
  2702.     --
  2703.     -- Procedure name: DSRNR
  2704.      
  2705.        PIXEL_POINTER   : LEXIDATA_ARRAY(1 .. 2 * POINTS'length + 2);
  2706.        -- PIXEL_POINTER - Array pointer for pixels.
  2707.      
  2708.        PIXEL_ARRAY_GET : LEXIDATA_ARRAY(1 .. PIXEL_ARRAY'length);
  2709.        -- PIXEL_ARRAY_GET - Array of pixels.
  2710.      
  2711.     begin
  2712.      
  2713.        PIXEL_POINTER(1) := BIT_16(RANDOM_PIXEL_READ_OP);
  2714.        PIXEL_POINTER(2) := BIT_16(POINTS'LENGTH);
  2715.        for I in POINTS'first .. POINTS'last loop
  2716.            PIXEL_POINTER(POSITIVE(I * 2 + 1)) :=
  2717.                 BIT_16(POINTS(I).X);
  2718.            PIXEL_POINTER(POSITIVE(I * 2 + 2)) :=
  2719.                 BIT_16(POINTS(I).Y);
  2720.        end loop;
  2721.      
  2722.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER(PIXEL_POINTER);
  2723.      
  2724.        LEXI3700_COMMUNICATION.FLUSH_BUFFER(FALSE);
  2725.      
  2726.        LEXI3700_COMMUNICATION.READ_FROM_BUFFER
  2727.             (PIXEL_ARRAY_GET);
  2728.      
  2729.        for I in PIXEL_ARRAY_GET'range loop
  2730.            PIXEL_ARRAY(I) := LEXI_COLOUR_INDEX(PIXEL_ARRAY_GET(I));
  2731.        end loop;
  2732.      
  2733.     end RANDOM_PIXEL_READ;
  2734.      
  2735.     procedure RANDOM_PIXEL_WRITE
  2736.        (POINTS  : LEXI_POINTS;
  2737.         COLOURS : LEXI_PIXEL_ARRAY_INDEX) is
  2738.      
  2739.     -- This procedure writes a value into a group for randomly addressed
  2740.     -- pixels to display memory planes enabled by the current DEFINE_
  2741.     -- WRITE_CHANNELS.
  2742.     --
  2743.     -- POINTS  - Number of pixels to be written.
  2744.     -- COLOURS - Buffer containing pixel coordinates and data.
  2745.     --
  2746.     -- Procedure name: DSRNW
  2747.      
  2748.        SEND_BLOCK  : LEXIDATA_ARRAY (1 .. ((3 * COLOURS'LENGTH + 2)));
  2749.        -- array containing information to send to device.
  2750.      
  2751.     begin
  2752.      
  2753.        SEND_BLOCK (1..2) := (RANDOM_PIXEL_WRITE_OP, COLOURS'LENGTH);
  2754.        for I in COLOURS'RANGE loop
  2755.            SEND_BLOCK (((I-1) * 3) + 3) := BIT_16(POINTS(I).X);
  2756.            SEND_BLOCK (((I-1) * 3) + 4) := BIT_16(POINTS(I).Y);
  2757.            SEND_BLOCK (((I-1) * 3) + 5) := BIT_16(COLOURS(I));
  2758.        end loop;
  2759.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER(SEND_BLOCK);
  2760.      
  2761.     end RANDOM_PIXEL_WRITE;
  2762.      
  2763.     procedure READ_FROM_LUT
  2764.        (COLOUR_INDEX : LEXI_COLOUR_INDEX;
  2765.         COLOUR_VALUE : out LEXI_PIXEL_COLOUR) is
  2766.      
  2767.     -- This procedure reads a value from the lookup table
  2768.     -- and returns the corresponding value to the host.
  2769.     --
  2770.     -- COLOUR_INDEX - The index to be read.
  2771.     -- COLOUR_VALUE - A record containing the index colour.
  2772.     --
  2773.     -- Procedure name: DSLRD
  2774.      
  2775.        CURRENT_OFFSET       : LEXIDATA_ARRAY (1..3);
  2776.        --  CURRENT_OFFSET - Contains the physical locations of the red,
  2777.        --                   green, and blue planes.
  2778.      
  2779.        PIXEL             : LEXIDATA_ARRAY (1 .. 1);
  2780.        --  PIXEL       - Contains information about the pixel.
  2781.      
  2782.        PIXEL_VALUE       : LEXIDATA_ARRAY (1..3);
  2783.        --  PIXEL_VALUE - Array that contains the intensity values
  2784.        --                returned from the LEXIDATA.
  2785.      
  2786.     begin
  2787.      
  2788.        CURRENT_OFFSET := (BIT_16(RED_PLANE_ADDRESS),
  2789.                        BIT_16(GREEN_PLANE_ADDRESS),
  2790.                        BIT_16(BLUE_PLANE_ADDRESS));
  2791.        for I in 1..3 loop
  2792.            LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  2793.                 ((BIT_16(READ_FROM_LUT_OP),
  2794.                   BIT_16(COLOUR_INDEX) + CURRENT_OFFSET(I),
  2795.                   1));
  2796.             FLUSH;
  2797.             LEXI3700_COMMUNICATION.READ_FROM_BUFFER(PIXEL);
  2798.             PIXEL_VALUE(I) := PIXEL(1);
  2799.        end loop;
  2800.        COLOUR_VALUE.RED   := LEXI_COLOUR_INTENSITY(PIXEL_VALUE(1));
  2801.        COLOUR_VALUE.GREEN := LEXI_COLOUR_INTENSITY(PIXEL_VALUE(2));
  2802.        COLOUR_VALUE.BLUE  := LEXI_COLOUR_INTENSITY(PIXEL_VALUE(3));
  2803.      
  2804.     end READ_FROM_LUT;
  2805.      
  2806.     procedure SET_DISPLAY_PARAMETERS
  2807.        (WIDTH     : LEXI_LINE_WIDTH_TYPE;
  2808.         LINE      : LEXI_LINE_TYPE;
  2809.         FILL      : LEXI_INTERIOR_STYLE;
  2810.         SIZE      : LEXI_PATTERN_SIZE := 2) is
  2811.      
  2812.     -- This procedure specifies the way vectors, circles, arcs, and
  2813.     -- rectangles are drawn.
  2814.     --
  2815.     -- WIDTH - Write mode and line weight.
  2816.     --    BITS  0 - 11 = Line weight (0 or 1 yields a one-pixel width
  2817.     --                      line).
  2818.     --    BITS 12 - 14 = Write mode:
  2819.     --                   000 = Replace Mode.  Replaces any previous
  2820.     --                         value in the selected planes with the
  2821.     --                         specified value.
  2822.     --
  2823.     --                   001 = OR or Set Mode.  ORs the value in the
  2824.     --                         selected planes with the specified value;
  2825.     --                         does not clear any bit.
  2826.     --
  2827.     --                   010 = Clear Mode. ANDs the value in the select-
  2828.     --                         ed planes with the complement of the
  2829.     --                         specified value; does not set any bit.
  2830.     --
  2831.     --                   011 = XOR or Complement Mode.  XORs the value
  2832.     --                         in the selected planes with the specified
  2833.     --                         value; complements the selected bits.
  2834.     --                         This mode is used to draw polygons that
  2835.     --                         are filled with DSEFIL.
  2836.     --
  2837.     --    BIT  15      = Edge flag enable bit
  2838.     --                   0 = Disabled.
  2839.     --                   1 = Enabled.
  2840.     --
  2841.     -- LINE  - Line pattern for vectors and arcs.
  2842.     --    BITS  0 - 11 = Pattern description specifying the on/off
  2843.     --                   pattern applied to all subsequent lines
  2844.     --                   after the call (most significant to least
  2845.     --                   significant).
  2846.     --
  2847.     --    BITS 12 - 15 = Pattern length (number of pattern bits to
  2848.     --                   be used).
  2849.     --                   0 = Solid line.
  2850.     --
  2851.     -- FILL  - The interior style.
  2852.     --
  2853.     -- SIZE  - Pattern size for vectors and arcs, and fill for circles
  2854.     --         and rectangles.
  2855.     --    BITS  0 - 11 = Number of replications of each bit in pattern.
  2856.     --                   (A 0 or 1 in this location specifies a single
  2857.     --                   pixel length.)
  2858.     --
  2859.     --    BIT  12      = Fill enable bit:
  2860.     --                   0 = Fill disabled.
  2861.     --                   1 = Fill enabled.
  2862.     --
  2863.     --    BITS 13 - 15 = Reserved; must be zero.
  2864.     --
  2865.     -- Procedure name: DSDISP
  2866.      
  2867.     begin
  2868.      
  2869.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  2870.             ((BIT_16(SET_DISPLAY_PARAMETERS_OP),
  2871.               BIT_16(WIDTH) + BIT_16(LEXI_FILL_VALUE(FILL)),
  2872.               BIT_16(LEXI_LINE(LINE)),
  2873.               BIT_16(SIZE)));
  2874.      
  2875.     end SET_DISPLAY_PARAMETERS;
  2876.      
  2877.     procedure SET_HARDWARE_CURSOR
  2878.        (CURSOR : LEXI_CURSOR_TYPE := NON_INTERLACED_MATRIX;
  2879.         XOFF   : LEXI_COORDINATE := 0;
  2880.         YOFF   : LEXI_COORDINATE := 0) is
  2881.      
  2882.     -- This procedure selects the hardware crosshair cursor or the user-
  2883.     -- defined matrix cursor and provides a variable offset to fine-tune
  2884.     -- the position of the cursor.
  2885.     --
  2886.     -- CURSOR - Cursor type
  2887.     --    0  = Non-interlaced crosshair.
  2888.     --    2  = Non-interlaced matrix.
  2889.     --    8  = Interlaced crosshair.
  2890.     --    10 = Interlaced matrix.
  2891.     --
  2892.     -- XOFF - X displacement from true location.
  2893.     -- YOFF - Y displacement from true location.
  2894.     --
  2895.     -- Procedure name: DSCSL
  2896.      
  2897.     begin
  2898.      
  2899.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  2900.             ((BIT_16(SET_HARDWARE_CURSOR_OP),
  2901.               BIT_16(HARDWARE_CURSOR(CURSOR)),
  2902.               BIT_16(XOFF),
  2903.               BIT_16(YOFF)));
  2904.      
  2905.     end SET_HARDWARE_CURSOR;
  2906.      
  2907.     procedure SET_RECTANGULAR_LIMIT
  2908.        (UPPER_LEFT  : LEXI_POINT;
  2909.         LOWER_RIGHT : LEXI_POINT) is
  2910.      
  2911.     -- This procedure defines a rectangular section of memory that
  2912.     -- is used to do edge fill.
  2913.     --
  2914.     -- UPPER_LEFT  - Coordinates of upper left corner.
  2915.     -- LOWER_RIGHT - Coordinates of lower right corner.
  2916.     --
  2917.     -- Procedure name: DSLIM
  2918.      
  2919.     begin
  2920.      
  2921.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  2922.             ((BIT_16(SET_RECTANGULAR_LIMIT_OP),
  2923.               BIT_16(UPPER_LEFT.X),
  2924.               BIT_16(UPPER_LEFT.Y),
  2925.               BIT_16(LOWER_RIGHT.X),
  2926.               BIT_16(LOWER_RIGHT.Y)));
  2927.      
  2928.     end SET_RECTANGULAR_LIMIT;
  2929.      
  2930.     procedure SET_TEXT_CHARACTER_ROTATION
  2931.        (ROTATION : LEXI_ROTATE_CODE) is
  2932.      
  2933.     -- This procedure determines the rotation of characters with respect
  2934.     -- to the character path.
  2935.     --
  2936.     -- ROTATION - Rotation of the characters with respect to the
  2937.     --            character path:
  2938.     --                  0 - No rotation (default).
  2939.     --                  1 - 90 degree rotation clockwise.
  2940.     --                  2 - 180 degree rotation clockwise (upside down
  2941.     --                      and backwards).
  2942.     --                  3 - 270 degree rotation clockwise.
  2943.     --
  2944.     -- Procedure name: DSSTR
  2945.      
  2946.     begin
  2947.      
  2948.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  2949.             ((BIT_16(SET_TEXT_CHARACTER_ROTATION_OP),
  2950.               BIT_16(LEXI_CHARACTER_ROTATION(ROTATION))));
  2951.      
  2952.     end SET_TEXT_CHARACTER_ROTATION;
  2953.      
  2954.     procedure SET_TEXT_PARAMETERS
  2955.        (POSITION : LEXI_POINT;
  2956.         COLOUR   : LEXI_COLOUR_INDEX;
  2957.         PATH     : LEXI_CHARACTER_PATH;
  2958.         SIZE     : LEXI_TEXT_SIZE) is
  2959.      
  2960.     -- This procedure sets the display parameters for text written with
  2961.     -- DSTXT.
  2962.     --
  2963.     -- POSITION - The X and Y coordinates of text starting position.
  2964.     -- COLOUR   - Value (color intensity index) written to text
  2965.     --            pixels.
  2966.     --
  2967.     -- PATH     - Flag word specifying several parameters.
  2968.     --
  2969.     --    FONT
  2970.     --         bit        description
  2971.     --          0 (LSB)   0 = character font 0
  2972.     --                    1 = font 1
  2973.     --    ADDITIVE
  2974.     --          1         0 = erasive
  2975.     --                    1 = additive write
  2976.     --    REVERSE
  2977.     --          2         0 = normal
  2978.     --                    1 = reverse video
  2979.     --    INCREMENT
  2980.     --         3          0 = enable
  2981.     --                    1 = disable incrementing to next character
  2982.     --    TEXT CURSOR
  2983.     --         4          0 = enable
  2984.     --                    1 = disable test cursor
  2985.     --    CONTROL DISABLE
  2986.     --          5         0 = enable  processing of control characters.
  2987.     --                    1 = disable processing of control characters.
  2988.     --    TEXT PATH
  2989.     --          6 - 7     00 = left to right
  2990.     --                    01 = bottom to top
  2991.     --                    10 = right to left
  2992.     --                    11 = top to bottom
  2993.     --    NOT USED
  2994.     --          8 - 15 (MSB)
  2995.     --
  2996.     -- SIZE - Multiplication factor for the 5 by 7 character font.
  2997.     --        The resulting character is (5 * size) by (7 * size).
  2998.     --
  2999.     -- Procedure name: DSSAO
  3000.      
  3001.     begin
  3002.      
  3003.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  3004.             ((BIT_16(SET_TEXT_PARAMETERS_OP),
  3005.               BIT_16(POSITION.X),
  3006.               BIT_16(POSITION.Y),
  3007.               BIT_16(COLOUR),
  3008.               BIT_16(LEXI_PATH(PATH)),
  3009.               BIT_16(SIZE)));
  3010.      
  3011.     end SET_TEXT_PARAMETERS;
  3012.      
  3013.     procedure SET_TEXT_WINDOW
  3014.        (UPPER_LEFT  : LEXI_POINT;
  3015.         LOWER_RIGHT : LEXI_POINT) is
  3016.      
  3017.     -- This procedure defines a text window beyond which no text is
  3018.     -- written.
  3019.     --
  3020.     -- UPPER_LEFT  - Coordinate of upper left portion of the
  3021.     --               text window.
  3022.     -- LOWER_RIGHT - Coordinate of lower right portion of the
  3023.     --               text window.
  3024.     --
  3025.     -- Procedure name: DSSTW
  3026.      
  3027.     begin
  3028.      
  3029.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  3030.              ((BIT_16(SET_TEXT_WINDOW_OP),
  3031.                BIT_16(UPPER_LEFT.X),
  3032.                BIT_16(UPPER_LEFT.Y),
  3033.                BIT_16(LOWER_RIGHT.X),
  3034.                BIT_16(LOWER_RIGHT.Y)));
  3035.      
  3036.     end SET_TEXT_WINDOW;
  3037.      
  3038. procedure SEQUENTIAL_PIXEL_WRITE
  3039.    (PIXEL_ARRAY : LEXI_PIXEL_ARRAY_INDEX) is
  3040.      
  3041. -- This procedure writes a number of colour indexs to the display
  3042. -- surface outlined by DSLIM which defines a rectangular limit.
  3043. -- The starting position is the upper left.
  3044.      
  3045. -- procedure DSPUT
  3046.      
  3047. SEND_BLOCK : LEXIDATA_ARRAY (1 .. PIXEL_ARRAY'LENGTH + 2);
  3048.     -- Contains information going to the device.
  3049.      
  3050.  begin
  3051.     SEND_BLOCK(1) := BIT_16(SEQUENTIAL_PIXEL_WRITE_OP);
  3052.     SEND_BLOCK(2) := BIT_16(PIXEL_ARRAY'LENGTH);
  3053.      
  3054.     for I in PIXEL_ARRAY'RANGE loop
  3055.         SEND_BLOCK(I - PIXEL_ARRAY'FIRST + 3) := BIT_16(PIXEL_ARRAY(I));
  3056.     end loop;
  3057.      
  3058.     LEXI3700_COMMUNICATION.WRITE_TO_BUFFER(SEND_BLOCK);
  3059.      
  3060. end SEQUENTIAL_PIXEL_WRITE;
  3061.      
  3062. procedure WRITE_TO_LUT
  3063.        (COLOUR_INDEX : LEXI_COLOUR_INDEX;
  3064.         COLOUR_VALUE : LEXI_PIXEL_COLOUR) is
  3065.      
  3066.     -- This procedure writes a record of colour intensity to the
  3067.     -- table(CLUT).
  3068.     --
  3069.     -- COLOUR_INDEX - The colour index to set the intensity values.
  3070.     -- COLOUR_VALUE - The intensity values to be written.
  3071.     --
  3072.     -- Procedure name: DSLWT
  3073.      
  3074.         CURRENT_OFFSET      : LEXIDATA_ARRAY (1..3);
  3075.         --  CUR_OFFSET  - Contains the physical locations of the red,
  3076.         --                green, and blue planes.
  3077.      
  3078.         PIXEL_VALUE      : LEXIDATA_ARRAY (1..3);
  3079.         --  PIXEL_VALUE - Array containing the intensity values returned
  3080.         --                by the LEXIDATA.
  3081.      
  3082.     begin
  3083.      
  3084.        CURRENT_OFFSET := (BIT_16(RED_PLANE_ADDRESS),
  3085.                        BIT_16(GREEN_PLANE_ADDRESS),
  3086.                        BIT_16(BLUE_PLANE_ADDRESS));
  3087.        PIXEL_VALUE := (BIT_16(COLOUR_VALUE.RED),
  3088.                        BIT_16(COLOUR_VALUE.GREEN),
  3089.                        BIT_16(COLOUR_VALUE.BLUE));
  3090.        for I in 1..3 loop
  3091.            LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  3092.                 ((BIT_16(WRITE_TO_LUT_OP),
  3093.                   BIT_16(COLOUR_INDEX) + CURRENT_OFFSET(I),
  3094.                   1));
  3095.            LEXI3700_COMMUNICATION.WRITE_TO_BUFFER((PIXEL_VALUE(I .. I)));
  3096.      
  3097.        end loop;
  3098.      
  3099.     end WRITE_TO_LUT;
  3100.      
  3101. end LEXI3700_OUTPUT_DRIVER;
  3102. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3103. --:UDD:GKSADACM:CODE:MA:OUT_ATTR_TYP.ADA
  3104. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3105. ------------------------------------------------------------------
  3106. --
  3107. --  NAME: OUTPUT_ATTRIBUTES_TYPE
  3108. --  IDENTIFIER: GDMXXX.1(1)
  3109. --  DISCREPANCY REPORTS:
  3110. --
  3111. ------------------------------------------------------------------
  3112. -- file: OUT_ATTR_TYP.ADA
  3113. -- level: ma, 0a, 1a, 2a
  3114.      
  3115. with GKS_TYPES;
  3116.      
  3117. use GKS_TYPES;
  3118.      
  3119. package OUTPUT_ATTRIBUTES_TYPE is
  3120.      
  3121. -- A grouping of all attributes which affect the display of output
  3122. -- primitives.
  3123.      
  3124.    type OUTPUT_ATTRIBUTES is record
  3125.      
  3126.       ASPECT_SOURCE_FLAGS                  : ASF_LIST;
  3127.      
  3128.       -- polyline attributes
  3129.      
  3130.       CURRENT_POLYLINE_INDEX               : POLYLINE_INDEX;
  3131.       CURRENT_LINETYPE                     : LINETYPE;
  3132.       CURRENT_LINEWIDTH_SCALE_FACTOR       : LINE_WIDTH;
  3133.       CURRENT_POLYLINE_COLOUR_INDEX        : COLOUR_INDEX;
  3134.      
  3135.       -- polymarker attributes
  3136.      
  3137.       CURRENT_POLYMARKER_INDEX             : POLYMARKER_INDEX;
  3138.       CURRENT_MARKER_TYPE                  : MARKER_TYPE;
  3139.       CURRENT_MARKER_SIZE_SCALE_FACTOR     : MARKER_SIZE;
  3140.       CURRENT_POLYMARKER_COLOUR_INDEX      : COLOUR_INDEX;
  3141.      
  3142.       -- text attributes
  3143.      
  3144.       CURRENT_TEXT_INDEX                   : TEXT_INDEX;
  3145.       CURRENT_TEXT_FONT_AND_PRECISION      : TEXT_FONT_PRECISION;
  3146.       CURRENT_CHAR_EXPANSION_FACTOR        : CHAR_EXPANSION;
  3147.       CURRENT_CHAR_SPACING                 : CHAR_SPACING;
  3148.       CURRENT_TEXT_COLOUR_INDEX            : COLOUR_INDEX;
  3149.      
  3150.       -- the following text attributes are not bundlable.
  3151.      
  3152.       CURRENT_CHAR_HEIGHT_VECTOR           : NDC.VECTOR;
  3153.       CURRENT_CHAR_WIDTH_VECTOR            : NDC.VECTOR;
  3154.       CURRENT_TEXT_PATH                    : TEXT_PATH;
  3155.       CURRENT_TEXT_ALIGNMENT               : TEXT_ALIGNMENT;
  3156.      
  3157.       -- fill area attributes.
  3158.      
  3159.       CURRENT_FILL_AREA_INDEX              : FILL_AREA_INDEX;
  3160.       CURRENT_FILL_AREA_INTERIOR_STYLE     : INTERIOR_STYLE;
  3161.       CURRENT_FILL_AREA_STYLE_INDEX        : STYLE_INDEX;
  3162.       CURRENT_FILL_AREA_COLOUR_INDEX       : COLOUR_INDEX;
  3163.      
  3164.       -- pattern attributes for pattern fills.
  3165.      
  3166.       CURRENT_PATTERN_WIDTH_VECTOR         : NDC.VECTOR;
  3167.       CURRENT_PATTERN_HEIGHT_VECTOR        : NDC.VECTOR;
  3168.       CURRENT_PATTERN_REFERENCE_POINT      : NDC.POINT;
  3169.      
  3170.       -- used for clipping to NDC space. The points are the lower left
  3171.       -- corner and the upper right corner.
  3172.      
  3173.       CLIPPING_RECTANGLE                   : NDC.RECTANGLE_LIMITS;
  3174.      
  3175.    end record;
  3176.      
  3177. end OUTPUT_ATTRIBUTES_TYPE;
  3178. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3179. --:UDD:GKSADACM:CODE:MA:CGI_MA.ADA
  3180. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3181. ------------------------------------------------------------------
  3182. --
  3183. --  NAME: CGI
  3184. --  IDENTIFIER: GDMXXX.2(1)
  3185. --  DISCREPANCY REPORTS:
  3186. --  DR004  Reduce size of CGI instruction
  3187. ------------------------------------------------------------------
  3188. -- file: cgi_ma.ada
  3189. -- level: ma
  3190.      
  3191. with GKS_TYPES;
  3192. with OUTPUT_ATTRIBUTES_TYPE;
  3193. with unchecked_deallocation;
  3194.      
  3195. use GKS_TYPES;
  3196.      
  3197. package CGI is
  3198.      
  3199. -- Uses the GKS_TYPES package to define the Computer Graphics
  3200. -- Interface (CGI) to the Workstation Manager.  The interface is
  3201. -- a DATA interface specified by the variant record CGI_INSTR where
  3202. -- the discriminant is the type CGI_OPCODES.
  3203. -- Package GKS_TYPES provides type definitions.
  3204. -- Package OUTPUT_ATTRIBUTES_TYPE provides a grouping of the attributes
  3205. -- which affect the display of output primitives.
  3206. -- Package unchecked_deallocation is a predefined generic library
  3207. -- function for storage deallocation of an object designated by a
  3208. -- value of an access type.
  3209.      
  3210.    type CGI_OPCODES is
  3211.       (NO_OP,
  3212.      
  3213.    -- LEVEL ma
  3214.    -- logical operation "ws_control"
  3215.      
  3216.       OPEN_WS,
  3217.       CLOSE_WS,
  3218.       ACTIVATE_WS,
  3219.       DEACTIVATE_WS,
  3220.       CLEAR_WS,
  3221.       UPDATE_WS,
  3222.      
  3223.    -- logical operation "output_primitives"
  3224.      
  3225.       POLYLINE,
  3226.       POLYMARKER,
  3227.       FILL_AREA,
  3228.       TEXT,
  3229.      
  3230.    -- logical operation "set_primitive_attributes_ma"
  3231.      
  3232.       SET_CHAR_VECTORS,
  3233.       SET_TEXT_ALIGNMENT,
  3234.      
  3235.    -- logical operation "set_individual_attributes_ma"
  3236.      
  3237.       SET_LINETYPE,
  3238.       SET_POLYLINE_COLOUR_INDEX,
  3239.       SET_MARKER_TYPE,
  3240.       SET_POLYMARKER_COLOUR_INDEX,
  3241.       SET_TEXT_COLOUR_INDEX,
  3242.       SET_FILL_AREA_INTERIOR_STYLE,
  3243.       SET_FILL_AREA_COLOUR_INDEX,
  3244.      
  3245.    -- logical operation "set_colour_table"
  3246.      
  3247.       SET_COLOUR_REPRESENTATION,
  3248.      
  3249.    -- logical operation "ws_transformation"
  3250.      
  3251.       SET_WS_WINDOW,
  3252.       SET_WS_VIEWPORT,
  3253.      
  3254.    -- logical operation "inq_ws_description_table_ma"
  3255.      
  3256.       INQ_DISPLAY_SPACE_SIZE,
  3257.       INQ_POLYLINE_FACILITIES,
  3258.       INQ_POLYMARKER_FACILITIES,
  3259.       INQ_TEXT_FACILITIES,
  3260.       INQ_FILL_AREA_FACILITIES,
  3261.       INQ_COLOUR_FACILITIES,
  3262.       INQ_MAX_LENGTH_OF_WS_STATE_TABLES,
  3263.      
  3264.    -- logical operation "inq_ws_state_list_ma"
  3265.      
  3266.       INQ_WS_CONNECTION_AND_TYPE,
  3267.       INQ_TEXT_EXTENT,
  3268.       INQ_LIST_OF_COLOUR_INDICES,
  3269.       INQ_COLOUR_REPRESENTATION,
  3270.       INQ_WS_TRANSFORMATION,
  3271.      
  3272.    -- logical operation "gks_normalization"
  3273.      
  3274.       SET_CLIPPING_RECTANGLE);
  3275.      
  3276.    type ACCESS_CONNECTION_ID_TYPE is ACCESS CONNECTION_ID;
  3277.    -- used to pass pointer to a connection id string
  3278.      
  3279.    type ACCESS_POINT_ARRAY_TYPE is ACCESS NDC.POINT_ARRAY;
  3280.    -- used to pass pointer to an array of points
  3281.      
  3282.    type ACCESS_STRING_TYPE is ACCESS STRING;
  3283.    -- used to pass pointer to a string
  3284.      
  3285.    -- instantiate unchecked deallocation for access types
  3286.      
  3287.    procedure FREE_CONNECTION_ID is new unchecked_deallocation
  3288.          (CONNECTION_ID,ACCESS_CONNECTION_ID_TYPE);
  3289.      
  3290.    procedure FREE_POINT_ARRAY is new unchecked_deallocation
  3291.          (NDC.POINT_ARRAY,ACCESS_POINT_ARRAY_TYPE);
  3292.      
  3293.    procedure FREE_STRING is new unchecked_deallocation
  3294.          (STRING,ACCESS_STRING_TYPE);
  3295.      
  3296.    type CGI_INSTR (OP : CGI_OPCODES := NO_OP) is
  3297.       record
  3298.          EI : ERROR_INDICATOR := 0;
  3299.    -- enumerate each opcode giving its appropriate arguments.
  3300.          case OP is
  3301.      
  3302.          when NO_OP =>
  3303.             null;
  3304.      
  3305.    -- logical operation "ws_control"
  3306.      
  3307.          when OPEN_WS =>
  3308.             WS_TO_OPEN       :       WS_ID;
  3309.             CONNECTION_OPEN  :       ACCESS_CONNECTION_ID_TYPE;
  3310.             TYPE_OF_WS_OPEN  :       WS_TYPE;
  3311.             ATTRIBUTES_AT_OPEN :     OUTPUT_ATTRIBUTES_TYPE.
  3312.                                      OUTPUT_ATTRIBUTES;
  3313.          when CLOSE_WS =>
  3314.             WS_TO_CLOSE      :       WS_ID;
  3315.          when ACTIVATE_WS =>
  3316.             WS_TO_ACTIVATE   :       WS_ID;
  3317.          when DEACTIVATE_WS =>
  3318.             WS_TO_DEACTIVATE :       WS_ID;
  3319.          when CLEAR_WS =>
  3320.             WS_TO_CLEAR      :       WS_ID;
  3321.             FLAG             :       CONTROL_FLAG;
  3322.          when UPDATE_WS =>
  3323.             WS_TO_UPDATE     :       WS_ID;
  3324.             REGENERATION     :       UPDATE_REGENERATION_FLAG;
  3325.      
  3326.    -- logical operation "output_primitives"
  3327.      
  3328.          when POLYLINE =>
  3329.             LINE_POINTS      :       ACCESS_POINT_ARRAY_TYPE;
  3330.          when POLYMARKER =>
  3331.             MARKER_POINTS    :       ACCESS_POINT_ARRAY_TYPE;
  3332.          when FILL_AREA =>
  3333.             FILL_AREA_POINTS :       ACCESS_POINT_ARRAY_TYPE;
  3334.          when TEXT =>
  3335.             TEXT_POSITION    :       NDC.POINT;
  3336.             TEXT_STRING      :       ACCESS_STRING_TYPE;
  3337.      
  3338.    -- logical operation "set_primitive_attributes_ma"
  3339.      
  3340.          when SET_CHAR_VECTORS =>
  3341.             CHAR_HEIGHT_VECTOR_SET   :       NDC.VECTOR;
  3342.             CHAR_WIDTH_VECTOR_SET    :       NDC.VECTOR;
  3343.          when SET_TEXT_ALIGNMENT =>
  3344.             TEXT_ALIGNMENT_SET       :       TEXT_ALIGNMENT;
  3345.      
  3346.    -- logical operation "set_individual_attributes_ma"
  3347.      
  3348.          when SET_LINETYPE =>
  3349.             LINETYPE_SET             :       LINETYPE;
  3350.          when SET_POLYLINE_COLOUR_INDEX =>
  3351.             POLYLINE_COLOUR_INDEX_SET :      COLOUR_INDEX;
  3352.          when SET_MARKER_TYPE =>
  3353.             MARKER_TYPE_SET          :       MARKER_TYPE;
  3354.          when SET_POLYMARKER_COLOUR_INDEX =>
  3355.             POLYMARKER_COLOUR_INDEX_SET :    COLOUR_INDEX;
  3356.          when SET_TEXT_COLOUR_INDEX =>
  3357.             TEXT_COLOUR_INDEX_SET    :       COLOUR_INDEX;
  3358.          when SET_FILL_AREA_INTERIOR_STYLE =>
  3359.             FILL_AREA_INTERIOR_STYLE_SET :   INTERIOR_STYLE;
  3360.          when SET_FILL_AREA_COLOUR_INDEX =>
  3361.             FILL_AREA_COLOUR_INDEX_SET :     COLOUR_INDEX;
  3362.      
  3363.    -- logical operation "set_colour_table"
  3364.      
  3365.          when SET_COLOUR_REPRESENTATION =>
  3366.             WS_TO_SET_COLOUR_REP     :       WS_ID;
  3367.             COLOUR_INDEX_TO_SET_COLOUR_REP :   COLOUR_INDEX;
  3368.             COLOUR_REP_SET           :       COLOUR_REPRESENTATION;
  3369.      
  3370.    -- logical operation "ws_transformation"
  3371.      
  3372.          when SET_WS_WINDOW =>
  3373.             WS_TO_SET_WINDOW      :  WS_ID;
  3374.             WS_WINDOW_LIMITS_SET  :  NDC.RECTANGLE_LIMITS;
  3375.          when SET_WS_VIEWPORT =>
  3376.             WS_TO_SET_VIEWPORT     : WS_ID;
  3377.             WS_VIEWPORT_LIMITS_SET : DC.RECTANGLE_LIMITS;
  3378.      
  3379.    -- logical operation "inq_ws_description_table_ma"
  3380.      
  3381.          when INQ_DISPLAY_SPACE_SIZE =>
  3382.             WS_TO_INQ_DISPLAY_SPACE_SIZE :   WS_TYPE;
  3383.             DISPLAY_SPACE_UNITS_INQ  :       DC_UNITS;
  3384.             MAX_DC_SIZE_INQ          :       DC.SIZE;
  3385.             MAX_RASTER_UNIT_SIZE_INQ :       RASTER_UNIT_SIZE;
  3386.          when INQ_POLYLINE_FACILITIES =>
  3387.             WS_TO_INQ_POLYLINE_FACILITIES :  WS_TYPE;
  3388.             LIST_OF_POLYLINE_TYPES_INQ :     LINETYPES.LIST_OF;
  3389.             NUMBER_OF_WIDTHS_INQ     :       NATURAL;
  3390.             NOMINAL_WIDTH_INQ        :       DC.MAGNITUDE;
  3391.             RANGE_OF_WIDTHS_INQ      :       DC.RANGE_OF_MAGNITUDES;
  3392.             NUMBER_OF_POLYLINE_INDICES_INQ : NATURAL;
  3393.          when INQ_POLYMARKER_FACILITIES =>
  3394.             WS_TO_INQ_POLYMARKER_FACILITIES : WS_TYPE;
  3395.             LIST_OF_POLYMARKER_TYPES_INQ:    MARKER_TYPES.LIST_OF;
  3396.             NUMBER_OF_SIZES_INQ      :       NATURAL;
  3397.             NOMINAL_SIZE_INQ         :       DC.MAGNITUDE;
  3398.             RANGE_OF_SIZES_INQ       :       DC.RANGE_OF_MAGNITUDES;
  3399.             NUMBER_OF_POLYMARKER_INDICES_INQ : NATURAL;
  3400.          when INQ_TEXT_FACILITIES =>
  3401.             WS_TO_INQ_TEXT_FACILITIES :      WS_TYPE;
  3402.             LIST_OF_FONT_PRECISION_PAIRS_INQ :
  3403.                                            TEXT_FONT_PRECISIONS.LIST_OF;
  3404.             NUMBER_OF_HEIGHTS_INQ    :       NATURAL;
  3405.             RANGE_OF_HEIGHTS_INQ     :       DC.RANGE_OF_MAGNITUDES;
  3406.             NUMBER_OF_EXPANSIONS_INQ :       NATURAL;
  3407.             RANGE_OF_EXPANSIONS_INQ  :       RANGE_OF_EXPANSIONS;
  3408.             NUMBER_OF_TEXT_INDICES_INQ :     NATURAL;
  3409.          when INQ_FILL_AREA_FACILITIES =>
  3410.             WS_TO_INQ_FILL_AREA_FACILITIES : WS_TYPE;
  3411.             LIST_OF_INTERIOR_STYLES_INQ :    INTERIOR_STYLES.LIST_OF;
  3412.             LIST_OF_HATCH_STYLES_INQ :       HATCH_STYLES.LIST_OF;
  3413.             NUMBER_OF_FILL_AREA_INDICES_INQ : NATURAL;
  3414.          when INQ_COLOUR_FACILITIES =>
  3415.             WS_TO_INQ_COLOUR_FACILITIES :    WS_TYPE;
  3416.             NUMBER_OF_COLOURS_INQ    :       NATURAL;
  3417.             AVAILABLE_COLOUR_INQ     :       COLOUR_AVAILABLE;
  3418.             NUMBER_OF_COLOUR_INDICES_INQ :   NATURAL;
  3419.          when INQ_MAX_LENGTH_OF_WS_STATE_TABLES =>
  3420.             WS_TO_INQ_MAX_LENGTH_OF_WS_STATE_TABLES : WS_TYPE;
  3421.             MAX_POLYLINE_ENTRIES_INQ :       NATURAL;
  3422.             MAX_POLYMARKER_ENTRIES_INQ :     NATURAL;
  3423.             MAX_TEXT_ENTRIES_INQ     :       NATURAL;
  3424.             MAX_FILL_AREA_ENTRIES_INQ :      NATURAL;
  3425.             MAX_PATTERN_INDICES_INQ  :       NATURAL;
  3426.             MAX_COLOUR_INDICES_INQ   :       NATURAL;
  3427.      
  3428.    -- logical operation "inq_ws_state_list_ma"
  3429.      
  3430.          when INQ_WS_CONNECTION_AND_TYPE =>
  3431.             WS_TO_INQ_CONNECTION_AND_TYPE :  WS_ID;
  3432.             CONNECTION_INQ   :       ACCESS_CONNECTION_ID_TYPE;
  3433.             TYPE_OF_WS_INQ   :       WS_TYPE;
  3434.          when INQ_TEXT_EXTENT =>
  3435.             WS_TO_INQ_TEXT_EXTENT :  WS_ID;
  3436.             POSITION_TEXT    :       NDC.POINT;
  3437.             CHAR_STRING      :       ACCESS_STRING_TYPE;
  3438.             CONCATENATION_POINT :    NDC.POINT;
  3439.             TEXT_EXTENT_LOWER_LEFT_INQ   : NDC.POINT;
  3440.             TEXT_EXTENT_LOWER_RIGHT_INQ  : NDC.POINT;
  3441.             TEXT_EXTENT_UPPER_LEFT_INQ   : NDC.POINT;
  3442.             TEXT_EXTENT_UPPER_RIGHT_INQ  : NDC.POINT;
  3443.          when INQ_LIST_OF_COLOUR_INDICES =>
  3444.             WS_TO_INQ_COLOUR_INDICES : WS_ID;
  3445.             LIST_OF_COLOUR_INDICES_INQ : COLOUR_INDICES.LIST_OF;
  3446.          when INQ_COLOUR_REPRESENTATION =>
  3447.             WS_TO_INQ_COLOUR_REP :   WS_ID;
  3448.             COLOUR_INDEX_TO_INQ_COLOUR_REP  : COLOUR_INDEX;
  3449.             RETURN_VALUE_TO_INQ_COLOUR_REP  : RETURN_VALUE_TYPE;
  3450.             COLOUR_REP_INQ                  : COLOUR_REPRESENTATION;
  3451.          when INQ_WS_TRANSFORMATION =>
  3452.             WS_TO_INQ_TRANSFORMATION :       WS_ID;
  3453.             UPDATE_INQ               :       UPDATE_STATE;
  3454.             REQUESTED_WINDOW_INQ     :       NDC.RECTANGLE_LIMITS;
  3455.             CURRENT_WINDOW_INQ       :       NDC.RECTANGLE_LIMITS;
  3456.             REQUESTED_VIEWPORT_INQ   :       DC.RECTANGLE_LIMITS;
  3457.             CURRENT_VIEWPORT_INQ     :       DC.RECTANGLE_LIMITS;
  3458.      
  3459.    -- logical operation "gks_normalization"
  3460.      
  3461.          when SET_CLIPPING_RECTANGLE =>
  3462.             CLIPPING_RECTANGLE_SET : NDC.RECTANGLE_LIMITS;
  3463.      
  3464.          end case;
  3465.       end record;
  3466.      
  3467.    -- Subtypes are defined to ensure the correct procedure is called
  3468.    -- from the Device Independent layer to the Workstation Manager(WSM)
  3469.    -- layer by restricting the opcode to one specified value.
  3470.      
  3471.    subtype CGI_NO_OP is
  3472.       CGI_INSTR(OP => NO_OP);
  3473.      
  3474.    -- LEVEL ma
  3475.    -- logical operation "ws_control"
  3476.      
  3477.    subtype CGI_OPEN_WS is
  3478.       CGI_INSTR(OP => OPEN_WS);
  3479.    subtype CGI_CLOSE_WS is
  3480.       CGI_INSTR(OP => CLOSE_WS);
  3481.    subtype CGI_ACTIVATE_WS is
  3482.       CGI_INSTR(OP => ACTIVATE_WS);
  3483.    subtype CGI_DEACTIVATE_WS is
  3484.       CGI_INSTR(OP => DEACTIVATE_WS);
  3485.    subtype CGI_CLEAR_WS is
  3486.       CGI_INSTR(OP => CLEAR_WS);
  3487.    subtype CGI_UPDATE_WS is
  3488.       CGI_INSTR(OP => UPDATE_WS);
  3489.      
  3490.    -- logical operation "output_primitives"
  3491.      
  3492.    subtype CGI_POLYLINE is
  3493.       CGI_INSTR(OP => POLYLINE);
  3494.    subtype CGI_POLYMARKER is
  3495.       CGI_INSTR(OP => POLYMARKER);
  3496.    subtype CGI_FILL_AREA is
  3497.       CGI_INSTR(OP => FILL_AREA);
  3498.    subtype CGI_TEXT is
  3499.       CGI_INSTR(OP => TEXT);
  3500.      
  3501.    -- logical operation "set_primitive_attributes_ma"
  3502.      
  3503.    subtype CGI_SET_CHAR_VECTORS is
  3504.       CGI_INSTR(OP => SET_CHAR_VECTORS);
  3505.    subtype CGI_SET_TEXT_ALIGNMENT is
  3506.       CGI_INSTR(OP => SET_TEXT_ALIGNMENT);
  3507.      
  3508.    -- logical operation "set_individual_attributes_ma"
  3509.      
  3510.    subtype CGI_SET_LINETYPE is
  3511.       CGI_INSTR(OP => SET_LINETYPE);
  3512.    subtype CGI_SET_POLYLINE_COLOUR_INDEX is
  3513.       CGI_INSTR(OP => SET_POLYLINE_COLOUR_INDEX);
  3514.    subtype CGI_SET_MARKER_TYPE is
  3515.       CGI_INSTR(OP => SET_MARKER_TYPE);
  3516.    subtype CGI_SET_POLYMARKER_COLOUR_INDEX is
  3517.       CGI_INSTR(OP => SET_POLYMARKER_COLOUR_INDEX);
  3518.    subtype CGI_SET_TEXT_COLOUR_INDEX is
  3519.       CGI_INSTR(OP => SET_TEXT_COLOUR_INDEX);
  3520.    subtype CGI_SET_FILL_AREA_INTERIOR_STYLE is
  3521.       CGI_INSTR(OP => SET_FILL_AREA_INTERIOR_STYLE);
  3522.    subtype CGI_SET_FILL_AREA_COLOUR_INDEX is
  3523.       CGI_INSTR(OP => SET_FILL_AREA_COLOUR_INDEX);
  3524.      
  3525.    -- logical operation "set_colour_table"
  3526.      
  3527.    subtype CGI_SET_COLOUR_REPRESENTATION is
  3528.       CGI_INSTR(OP => SET_COLOUR_REPRESENTATION);
  3529.      
  3530.    -- logical operation "ws_transformation"
  3531.      
  3532.    subtype CGI_SET_WS_WINDOW is
  3533.       CGI_INSTR(OP => SET_WS_WINDOW);
  3534.    subtype CGI_SET_WS_VIEWPORT is
  3535.       CGI_INSTR(OP => SET_WS_VIEWPORT);
  3536.      
  3537.    -- logical operation "inq_ws_description_table_ma"
  3538.      
  3539.    subtype CGI_INQ_DISPLAY_SPACE_SIZE is
  3540.       CGI_INSTR(OP => INQ_DISPLAY_SPACE_SIZE);
  3541.    subtype CGI_INQ_POLYLINE_FACILITIES is
  3542.       CGI_INSTR(OP => INQ_POLYLINE_FACILITIES);
  3543.    subtype CGI_INQ_POLYMARKER_FACILITIES is
  3544.       CGI_INSTR(OP => INQ_POLYMARKER_FACILITIES);
  3545.    subtype CGI_INQ_TEXT_FACILITIES is
  3546.       CGI_INSTR(OP => INQ_TEXT_FACILITIES);
  3547.    subtype CGI_INQ_FILL_AREA_FACILITIES is
  3548.       CGI_INSTR(OP => INQ_FILL_AREA_FACILITIES);
  3549.    subtype CGI_INQ_COLOUR_FACILITIES is
  3550.       CGI_INSTR(OP => INQ_COLOUR_FACILITIES);
  3551.    subtype CGI_INQ_MAX_LENGTH_OF_WS_STATE_TABLES is
  3552.       CGI_INSTR(OP => INQ_MAX_LENGTH_OF_WS_STATE_TABLES);
  3553.      
  3554.    -- logical operation "inq_ws_state_list_ma"
  3555.      
  3556.    subtype CGI_INQ_WS_CONNECTION_AND_TYPE is
  3557.       CGI_INSTR(OP => INQ_WS_CONNECTION_AND_TYPE);
  3558.    subtype CGI_INQ_TEXT_EXTENT is
  3559.       CGI_INSTR(OP => INQ_TEXT_EXTENT);
  3560.    subtype CGI_INQ_LIST_OF_COLOUR_INDICES is
  3561.       CGI_INSTR(OP => INQ_LIST_OF_COLOUR_INDICES);
  3562.    subtype CGI_INQ_COLOUR_REPRESENTATION is
  3563.       CGI_INSTR(OP => INQ_COLOUR_REPRESENTATION);
  3564.    subtype CGI_INQ_WS_TRANSFORMATION is
  3565.       CGI_INSTR(OP => INQ_WS_TRANSFORMATION);
  3566.      
  3567.    -- logical operation "gks_normalization"
  3568.      
  3569.    subtype CGI_SET_CLIPPING_RECTANGLE is
  3570.       CGI_INSTR(OP => SET_CLIPPING_RECTANGLE);
  3571.      
  3572. end CGI;
  3573. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3574. --:UDD:GKSADACM:CODE:MA:DICTIONARY.ADA
  3575. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3576. ------------------------------------------------------------------
  3577. --
  3578. --  NAME: DICTIONARY
  3579. --  IDENTIFIER: GDMXXX.1(1)
  3580. --  DISCREPANCY REPORTS:
  3581. --
  3582. ------------------------------------------------------------------
  3583. -- File: DICTIONARY.ADA
  3584. -- Level: all
  3585.      
  3586. generic
  3587.      
  3588.    type KEY_TYPE is private;
  3589.      
  3590.    with function "<" (LEFT, RIGHT : in     KEY_TYPE) return BOOLEAN;
  3591.      
  3592.    type VALUE_TYPE is private;
  3593.      
  3594.    type KEY_LIST_TYPE is array (POSITIVE range <>) of KEY_TYPE;
  3595.      
  3596.    type VALUE_LIST_TYPE is array (POSITIVE range <>) of VALUE_TYPE;
  3597.      
  3598. package DICTIONARY is
  3599.      
  3600. -- Package DICTIONARY defines an ASSOCIATION_TYPE and a DICTIONARY_TYPE.
  3601. --
  3602. -- An association between a KEY_TYPE value and a VALUE_TYPE value is
  3603. -- represented by an ASSOCIATION_TYPE value, which is a record with
  3604. -- components KEY, containing the KEY_TYPE value, and VALUE, containing
  3605. -- the VALUE_TYPE value associated with KEY.
  3606. --
  3607. -- A set of associations is called a dictionary, by analogy of the set
  3608. -- of associations between words and their definitions. Dictionaries may
  3609. -- be represented with objects of the type DICTIONARY_TYPE.
  3610. --
  3611. -- A dictionary serves as an associative memory, associating VALUE's to
  3612. -- KEY's.  For any KEY, the associated VALUE can be found.
  3613. --
  3614. -- A pure associative memory, like a set, imposes no order on the
  3615. -- entries.  This dictionary, like Webster's dictionary, is sorted.
  3616. -- The sorted order is used internally to speed-up searching for a KEY.
  3617. -- In order to impose a sorting order the "<" function is imported.  The
  3618. -- lists which can be derived from the dictionary, ASSOCIATION_LIST,
  3619. -- KEY_LIST, and VALUE_LIST, are returned in this sorted order.
  3620. --
  3621. -- DICTIONARY_TYPE is actually an access type.  Simple assignment of one
  3622. -- DICTIONARY_TYPE object to another only results in having two ways to
  3623. -- reference the same dictionary.  A COPY procedure is provided to
  3624. -- generate a new copy.
  3625.      
  3626.    type ASSOCIATION_TYPE is
  3627.       record
  3628.          KEY   : KEY_TYPE;
  3629.          VALUE : VALUE_TYPE;
  3630.       end record;
  3631.      
  3632.    type ASSOCIATION_LIST_TYPE is array (POSITIVE range <>)
  3633.          of ASSOCIATION_TYPE;
  3634.      
  3635.    type DICTIONARY_TYPE is private;
  3636.      
  3637.    KEY_IN_USE : exception;
  3638.      
  3639.    KEY_NOT_FOUND : exception;
  3640.      
  3641.    procedure CREATE
  3642.       (DICTIONARY : in out DICTIONARY_TYPE;
  3643.        ASSOCIATION : in     ASSOCIATION_TYPE);
  3644.      
  3645.    procedure CREATE
  3646.       (DICTIONARY : in out DICTIONARY_TYPE;
  3647.        KEY        : in     KEY_TYPE;
  3648.        VALUE      : in     VALUE_TYPE);
  3649.      
  3650.    procedure ALTER
  3651.       (DICTIONARY : in     DICTIONARY_TYPE;
  3652.        ASSOCIATION : in     ASSOCIATION_TYPE);
  3653.      
  3654.    procedure ALTER
  3655.       (DICTIONARY : in     DICTIONARY_TYPE;
  3656.        KEY        : in     KEY_TYPE;
  3657.        VALUE      : in     VALUE_TYPE);
  3658.      
  3659.    procedure ENTER
  3660.       (DICTIONARY : in out DICTIONARY_TYPE;
  3661.        ASSOCIATION : in     ASSOCIATION_TYPE);
  3662.      
  3663.    procedure ENTER
  3664.       (DICTIONARY : in out DICTIONARY_TYPE;
  3665.        KEY        : in     KEY_TYPE;
  3666.        VALUE      : in     VALUE_TYPE);
  3667.      
  3668.    procedure REMOVE
  3669.       (DICTIONARY : in out DICTIONARY_TYPE;
  3670.        KEY        : in     KEY_TYPE);
  3671.      
  3672.    procedure PURGE
  3673.       (DICTIONARY : in out DICTIONARY_TYPE;
  3674.        KEY        : in     KEY_TYPE);
  3675.      
  3676.    function IS_IN
  3677.       (DICTIONARY : in     DICTIONARY_TYPE;
  3678.        KEY        : in     KEY_TYPE) return BOOLEAN;
  3679.      
  3680.    function ASSOCIATION
  3681.       (DICTIONARY : in     DICTIONARY_TYPE;
  3682.        KEY        : in     KEY_TYPE) return ASSOCIATION_TYPE;
  3683.      
  3684.    function VALUE
  3685.       (DICTIONARY : in     DICTIONARY_TYPE;
  3686.        KEY        : in     KEY_TYPE) return VALUE_TYPE;
  3687.      
  3688.    function SIZE
  3689.       (DICTIONARY : in     DICTIONARY_TYPE) return NATURAL;
  3690.      
  3691.    function ASSOCIATION_LIST
  3692.       (DICTIONARY : in     DICTIONARY_TYPE) return ASSOCIATION_LIST_TYPE;
  3693.      
  3694.    function KEY_LIST
  3695.       (DICTIONARY : in     DICTIONARY_TYPE) return KEY_LIST_TYPE;
  3696.      
  3697.    function VALUE_LIST
  3698.       (DICTIONARY : in     DICTIONARY_TYPE) return VALUE_LIST_TYPE;
  3699.      
  3700.    function COPY
  3701.       (ORIGINAL : in     DICTIONARY_TYPE) return DICTIONARY_TYPE;
  3702.      
  3703. private
  3704.      
  3705.    type DICTIONARY_NODE_TYPE;
  3706.      
  3707.    type DICTIONARY_TYPE is access DICTIONARY_NODE_TYPE;
  3708.      
  3709. end DICTIONARY;
  3710. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3711. --:UDD:GKSADACM:CODE:MA:DICTIONARY_B.ADA
  3712. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3713. ------------------------------------------------------------------
  3714. --
  3715. --  NAME: DICTIONARY - BODY
  3716. --  IDENTIFIER: GDMXXX.1(1)
  3717. --  DISCREPANCY REPORTS:
  3718. --
  3719. ------------------------------------------------------------------
  3720. -- File: DICTIONARY_B.ADA
  3721. -- Level: all
  3722.      
  3723. with UNCHECKED_DEALLOCATION;
  3724.      
  3725. package body DICTIONARY is
  3726.      
  3727. -- UNCHECKED_DEALLOCATION is a generic procedure in the predefined
  3728. -- language environment. Here, FREE_TREE_NODE is instantiated to
  3729. -- provide a procedure to deallocate TREE_NODE_TYPE objects.
  3730.      
  3731.    -- First some auxiliary types and subprograms must be defined
  3732.      
  3733.    type TREE_NODE_TYPE;
  3734.      
  3735.    type TREE_TYPE is access TREE_NODE_TYPE;
  3736.      
  3737.    type TREE_NODE_TYPE is
  3738.       record
  3739.          ASSOCIATION : ASSOCIATION_TYPE;
  3740.          -- ASSOCIATION holds the KEY and VALUE.
  3741.          L_SON : TREE_TYPE;
  3742.          -- L_SON designates the left-hand son of this node
  3743.          R_SON : TREE_TYPE;
  3744.          -- R_SON designates the right-hand son of this node
  3745.       end record;
  3746.      
  3747.    -- The TREE_NODE_TYPE contains the ASSOCIATION and access
  3748.    -- to the left subtree (L_SON) and the right subtree (R_SON).
  3749.    -- Dynamically allocated TREE_NODE_TYPE objects may be linked
  3750.    -- by the L_SON and R_SON fields.
  3751.      
  3752.    -- In this case, TREE_NODE_TYPE is used to build a sorted binary
  3753.    -- tree of linked nodes.  On insertion into the tree, if `KEY < ROOT
  3754.    -- . ASSOCIATION . KEY' returns `TRUE', the ASSOCIATION is inserted
  3755.    -- into the left subtree, `ROOT . L_SON'.
  3756.    -- (It is assumed that "<" is antisymmetric. That is, `A = B or
  3757.    -- (A < B xor B < A)'.)
  3758.      
  3759.    procedure FREE_TREE_NODE is new UNCHECKED_DEALLOCATION
  3760.       (OBJECT => TREE_NODE_TYPE,
  3761.        NAME   => TREE_TYPE);
  3762.      
  3763.    -- Procedure FREE_TREE_NODE (X : in out TREE_TYPE) deallocates
  3764.    -- the memory used for the tree nodes.  Ada semantic rules do not
  3765.    -- require an Ada implementation to perform automatic "garbage
  3766.    -- collection" of inaccessible nodes.  It is therefore expedient
  3767.    -- to perform UNCHECKED_DEALLOCATION of unused designated objects.
  3768.    --
  3769.    -- X                 - the access value of a TREE_TYPE designated
  3770.    --                     object which is no longer needed.
  3771.      
  3772.    function COPY
  3773.       (TREE : in     TREE_TYPE) return TREE_TYPE;
  3774.      
  3775.    -- Function COPY creates an identical copy of the original tree;
  3776.    -- Contrast this with simple assignment (":=") which only copies the
  3777.    -- access value, resulting in two ways to access the same designated
  3778.    -- object.
  3779.    --
  3780.    -- Note that the ASSOCIATIONs in the tree are only assigned, not
  3781.    -- themselves COPY'ed.  This is a warning against the use of access
  3782.    -- types for VALUE_TYPE.
  3783.    --
  3784.    -- TREE              - an access value of the tree to be copied
  3785.      
  3786.    function COPY_NOT_NULL
  3787.       (TREE : in     TREE_TYPE) return TREE_TYPE;
  3788.      
  3789.    -- COPT_NOT_NULL is a helper function for COPY. It creates an
  3790.    -- identical copy of the original tree, which is assumed to be
  3791.    -- non-null.  This function is more efficient than a single
  3792.    -- COPY function, since it does not have to test for a null TREE.
  3793.    --
  3794.    -- TREE - non-null access value to a tree
  3795.      
  3796.    function SEARCH
  3797.       (IN_TREE : in     TREE_TYPE;
  3798.        KEY  : in     KEY_TYPE) return TREE_TYPE;
  3799.      
  3800.    -- Function SEARCH searches the binary tree, returning the access
  3801.    -- to the node equal to KEY.  On average, search time is O(log2
  3802.    -- SIZE(IN_TREE)). If no node is found, a null access is returned.
  3803.    --
  3804.    -- IN_TREE           - an access value of the tree to be searched
  3805.    -- KEY               - KEY value used to compare tree nodes
  3806.      
  3807.    procedure TAKE_OUT
  3808.       (TREE : in out TREE_TYPE);
  3809.      
  3810.    -- Procedure TAKE_OUT replaces the TREE with the merger of its
  3811.    -- left and right subtrees. The subtrees themselves are altered to
  3812.    -- merge them together.
  3813.    --
  3814.    -- TREE              - an access value which is replaced with an
  3815.    --                   access to the root of the merged subtrees.
  3816.      
  3817.    generic
  3818.      
  3819.       with procedure PROCESS
  3820.          (ASSOCIATION : in     ASSOCIATION_TYPE);
  3821.      
  3822.    procedure PROCESS_TREE
  3823.       (TREE : in     TREE_TYPE);
  3824.      
  3825.    -- Procedure PROCESS_TREE calls its generic parameter PROCESS once
  3826.    -- for each ASSOCIATION in TREE.  Inorder traversal of TREE is used.
  3827.    --
  3828.    -- TREE              - an access value of the tree to be processed
  3829.      
  3830.    --
  3831.    -- Define implementations for entities declared in package
  3832.    -- specification
  3833.    --
  3834.      
  3835.    type DICTIONARY_NODE_TYPE is
  3836.       record
  3837.          SIZE : NATURAL := 0;
  3838.          ROOT : TREE_TYPE;
  3839.       end record;
  3840.      
  3841.    -- The SIZE of the dictionary is explicitly stored along with an
  3842.    -- access value to the ROOT of a simple binary tree.  No attempt is
  3843.    -- made to keep the tree balanced. This yields good average behavior
  3844.    -- over randomly distributed keys, but the worst case is poor for
  3845.    -- "linearized trees".  Choose the AVL tree for those cases.
  3846.      
  3847.    --
  3848.    -- Define bodies of auxiliary subprograms
  3849.    --
  3850.      
  3851.    function SEARCH
  3852.       (IN_TREE : in     TREE_TYPE;
  3853.        KEY     : in     KEY_TYPE) return TREE_TYPE is
  3854.      
  3855.    -- Function SEARCH returns an access value to the node of `IN_TREE'
  3856.    -- which has an `ASSOCIATION . KEY' field equal to `KEY'. If `KEY'
  3857.    -- is not found, the returned value is `null'.
  3858.      
  3859.       TREE : TREE_TYPE := IN_TREE;
  3860.      
  3861.    begin
  3862.      
  3863.       while TREE /= null loop
  3864.      
  3865.          if KEY = TREE . ASSOCIATION . KEY then
  3866.      
  3867.             exit;
  3868.      
  3869.          elsif KEY < TREE . ASSOCIATION . KEY then
  3870.      
  3871.             TREE := TREE . L_SON;
  3872.      
  3873.          else
  3874.      
  3875.             TREE := TREE . R_SON;
  3876.      
  3877.          end if;
  3878.      
  3879.       end loop;
  3880.      
  3881.       return TREE;
  3882.      
  3883.    end SEARCH;
  3884.      
  3885.    procedure PROCESS_TREE
  3886.       (TREE : in     TREE_TYPE) is
  3887.      
  3888.    -- Procedure PROCESS_TREE calls its generic parameter PROCESS once
  3889.    -- for each ASSOCIATION in TREE.  Inorder traversal of TREE is used.
  3890.    --
  3891.    -- TREE              - an access value of the tree to be processed
  3892.      
  3893.    begin
  3894.      
  3895.       if TREE /= null then
  3896.      
  3897.          PROCESS_TREE (TREE . L_SON);
  3898.      
  3899.          PROCESS (TREE . ASSOCIATION);
  3900.      
  3901.          PROCESS_TREE (TREE . R_SON);
  3902.      
  3903.       end if;
  3904.      
  3905.    end PROCESS_TREE;
  3906.      
  3907.    function COPY
  3908.       (TREE : in     TREE_TYPE) return TREE_TYPE is
  3909.      
  3910.    -- Create an identical copy of the original tree.  Contrast this
  3911.    -- with simple assignment (":=").
  3912.    -- Note that the ASSOCIATIONs in the tree are only assigned, not
  3913.    -- COPY'ed, themselves.
  3914.    --
  3915.    -- TREE - Access to root of binary tree
  3916.      
  3917.    begin
  3918.      
  3919.       if TREE /= null then
  3920.      
  3921.          return  COPY_NOT_NULL (TREE);
  3922.      
  3923.       else
  3924.      
  3925.          return null;
  3926.      
  3927.       end if;
  3928.      
  3929.    end COPY;
  3930.      
  3931.    function COPY_NOT_NULL
  3932.       (TREE : in     TREE_TYPE) return TREE_TYPE is
  3933.      
  3934.    -- Create an identical copy of the original tree, assumed to be
  3935.    -- non-null.  This function is more efficient than a single
  3936.    -- COPY function, since it does not have to test for a null TREE.
  3937.    -- It does test for null sons of TREE, but these tests are paid
  3938.    -- back by avoiding over half of the procedure calls which would
  3939.    -- otherwise be wasted to produce a null value.  (For `N' interior
  3940.    -- nodes, there are `N+1' null values.)
  3941.    --
  3942.    -- TREE - non-null Access to root of binary tree
  3943.      
  3944.       TREE_L : TREE_TYPE;
  3945.       -- Access Object to designate new left subtree
  3946.      
  3947.       TREE_R : TREE_TYPE;
  3948.       -- Access Object to designate new right subtree
  3949.      
  3950.    begin
  3951.       -- We assume that TREE is non-null. We avoid any calls
  3952.       -- which would violate this assumption.
  3953.      
  3954.       -- Test TREE . L_SON to avoid recursion for null tree
  3955.      
  3956.       if TREE . L_SON /= null then
  3957.      
  3958.          TREE_L := COPY_NOT_NULL (TREE . L_SON);
  3959.      
  3960.       end if;
  3961.      
  3962.       -- Test TREE . R_SON to avoid recursion for null tree
  3963.      
  3964.       if TREE . R_SON /= null then
  3965.      
  3966.          TREE_R := COPY_NOT_NULL (TREE . R_SON);
  3967.      
  3968.       end if;
  3969.      
  3970.       return new TREE_NODE_TYPE' (
  3971.             L_SON       => TREE_L,
  3972.             R_SON       => TREE_R,
  3973.             ASSOCIATION => TREE . ASSOCIATION);
  3974.      
  3975.    end COPY_NOT_NULL;
  3976.      
  3977.    procedure TAKE_OUT
  3978.       (TREE : in out TREE_TYPE) is
  3979.      
  3980.    -- Procedure TAKE_OUT removes the node accessed by `TREE' and
  3981.    -- replaces it with another node.  The tree descending from `TREE'
  3982.    -- is reformed in a simple way to avoid increasing the depth of
  3983.    -- the tree.  After the two trivial cases, where one subtree is null,
  3984.    -- two other cases arise. In the first, the left subtree can simply
  3985.    -- be attached as `L_SON' of `TREE . R_SON', the successor of TREE.
  3986.    -- In the final case, the successor of `TREE' is moved from the end
  3987.    -- of the L_SON chain of `TREE . R_SON' to be the new root of the
  3988.    -- tree.
  3989.    --
  3990.    -- TREE - access to the node to be deleted.  Return value is
  3991.    --        root of the re-formed tree.  The initial value of TREE
  3992.    --        should not be null, or a CONSTRAINT_ERROR arises.
  3993.      
  3994.       TREE_L : TREE_TYPE := TREE . L_SON;
  3995.       -- TREE_L - Left son of the original root
  3996.      
  3997.       TREE_R : TREE_TYPE := TREE . R_SON;
  3998.       -- TREE_R - Right son of the original root
  3999.      
  4000.    begin
  4001.      
  4002.       -- Reclaim storage for deleted node (at TREE)
  4003.       -- We still have access to subtrees through TREE_L and TREE_R.
  4004.      
  4005.       FREE_TREE_NODE (TREE);
  4006.      
  4007.       -- The first two cases can be in arbitrary order
  4008.      
  4009.       if TREE_L = null then
  4010.      
  4011.          TREE := TREE_R;
  4012.      
  4013.       elsif TREE_R = null then
  4014.      
  4015.          TREE := TREE_L;
  4016.      
  4017.       else
  4018.          -- At this point, (TREE_L /= null) and (TREE_R /= null)
  4019.      
  4020.          -- TREE_L and TREE_R are two non-null subtrees to be merged.
  4021.          -- To preserve the sequence of in-order traversal, either the
  4022.          -- predecessor or the successor of the original TREE node can
  4023.          -- be installed as the new root node. We arbitrarily choose the
  4024.          -- successor, in the right subtree, as the new root.
  4025.      
  4026.          TREE := TREE_R;
  4027.      
  4028.          if TREE . L_SON = null then
  4029.      
  4030.             -- We only have to attach the left subtree
  4031.      
  4032.             TREE . L_SON := TREE_L;
  4033.      
  4034.          else
  4035.      
  4036.             -- Successor is at the end of the "L_SON" chain
  4037.      
  4038.             declare
  4039.      
  4040.                PREV : TREE_TYPE;
  4041.                -- Node from which TREE (the successor) is to be detached
  4042.      
  4043.             begin
  4044.      
  4045.                loop
  4046.      
  4047.                   PREV := TREE;
  4048.      
  4049.                   TREE := TREE . L_SON;
  4050.      
  4051.                   exit when TREE . L_SON = null;
  4052.      
  4053.                end loop;
  4054.      
  4055.                -- Replace PREV . L_SON with TREE . R_SON
  4056.                -- Note that, currently, TREE = PREV . L_SON;
  4057.      
  4058.                PREV . L_SON := TREE . R_SON;
  4059.      
  4060.                -- Attach left and right subtrees to TREE
  4061.      
  4062.                TREE . L_SON := TREE_L;
  4063.                TREE . R_SON := TREE_R;
  4064.      
  4065.             end;
  4066.      
  4067.          end if;
  4068.      
  4069.       end if;
  4070.      
  4071.    end TAKE_OUT;
  4072.      
  4073.    --
  4074.    -- Define implementations for subprograms declared in package
  4075.    -- specification
  4076.    --
  4077.      
  4078.    procedure CREATE
  4079.       (DICTIONARY : in out DICTIONARY_TYPE;
  4080.        ASSOCIATION : in     ASSOCIATION_TYPE) is
  4081.      
  4082.    -- CREATE adds a new association to the dictionary.  If ASSOCIATION .
  4083.    -- KEY already is used in an association, then KEY_IN_USE is raised.
  4084.    -- Exceptions:  KEY_IN_USE
  4085.    --
  4086.    -- DICTIONARY        - an access value of the dictionary in which
  4087.    --                   ASSOCIATION is to be inserted.  This parameter
  4088.    --                   must be `in out' mode because a newly allocated
  4089.    --                   access value is returned in place of a null
  4090.    --                   `in' value for DICTIONARY.
  4091.    -- ASSOCIATION       - a record representing the association of its
  4092.    --                   KEY component with its VALUE component.
  4093.      
  4094.       KEY : KEY_TYPE renames ASSOCIATION . KEY;
  4095.      
  4096.       procedure FIND
  4097.          (TREE : in out TREE_TYPE) is
  4098.      
  4099.       -- Procedure FIND moves down the TREE recursively searching
  4100.       -- for the point to insert the new ASSOCIATION.  Searching
  4101.       -- continues until either a node is found with an equal KEY, or
  4102.       -- an empty branch is taken.  KEY_IN_USE is raised if the key is
  4103.       -- found in the tree.  The null branch is replaced with a new
  4104.       -- node.
  4105.       --
  4106.       -- Procedure FIND originally had more work to do, updating
  4107.       -- the SIZE fields of each node along the access path. Now,
  4108.       -- the only SIZE field is in the DICTIONARY, not the TREE.
  4109.       -- An iterative version of CREATE could be made without using
  4110.       -- a recursive procedure.  However, the formal parameter TREE
  4111.       -- stands in for both the `TREE . L_SON' and `TREE . R_SON' calls
  4112.       -- in this version, resulting in a more compact and readable
  4113.       -- algorithm.
  4114.      
  4115.       -- WARNING: FIND uses `KEY' and `DICTIONARY . SIZE' from
  4116.       -- the enclosing scope.
  4117.      
  4118.       begin
  4119.      
  4120.          if TREE = null then
  4121.      
  4122.             TREE := new TREE_NODE_TYPE'
  4123.                  (L_SON        => null,
  4124.                   R_SON        => null,
  4125.                   ASSOCIATION => ASSOCIATION);
  4126.      
  4127.          elsif KEY = TREE . ASSOCIATION . KEY then
  4128.      
  4129.             raise KEY_IN_USE;
  4130.      
  4131.          elsif KEY < TREE . ASSOCIATION . KEY then
  4132.      
  4133.             FIND (TREE . L_SON);
  4134.      
  4135.          else
  4136.      
  4137.             FIND (TREE . R_SON);
  4138.      
  4139.          end if;
  4140.      
  4141.       end FIND;
  4142.      
  4143.    begin
  4144.      
  4145.       if DICTIONARY = null then
  4146.      
  4147.          DICTIONARY := new DICTIONARY_NODE_TYPE'
  4148.             (SIZE => 0, ROOT => null);
  4149.      
  4150.       end if;
  4151.      
  4152.       FIND (DICTIONARY . ROOT);
  4153.      
  4154.       -- if KEY_IN_USE is raised, the following is not executed
  4155.       DICTIONARY . SIZE := DICTIONARY . SIZE + 1;
  4156.      
  4157.    end CREATE;
  4158.      
  4159.    procedure CREATE
  4160.       (DICTIONARY : in out DICTIONARY_TYPE;
  4161.        KEY        : in     KEY_TYPE;
  4162.        VALUE      : in     VALUE_TYPE) is
  4163.      
  4164.    -- CREATE adds a new association to the dictionary linking KEY to its
  4165.    -- associated value. If KEY already has an association KEY_IN_USE is
  4166.    -- raised.
  4167.    -- Exceptions:  KEY_IN_USE
  4168.    --
  4169.    -- DICTIONARY        - an access value of the dictionary in which
  4170.    --                   ASSOCIATION is to be inserted.  This parameter
  4171.    --                   must be `in out' mode because a newly allocated
  4172.    --                   access value is returned in place of a null
  4173.    --                   `in' value for DICTIONARY.
  4174.    -- KEY               - the "handle" by which VALUE can be referenced
  4175.    --                   in the DICTIONARY. (Corresponds to the "word"
  4176.    --                   which is used to order and index the
  4177.    --                   dictionary.)
  4178.    -- VALUE             - the information which is to be associated with
  4179.    --                   KEY.  (Corresponds to the "definition" of KEY in
  4180.    --                   a dictionary.)
  4181.      
  4182.    begin
  4183.      
  4184.       CREATE (DICTIONARY, ASSOCIATION_TYPE' (KEY, VALUE));
  4185.      
  4186.    end CREATE;
  4187.      
  4188.    procedure ALTER
  4189.       (DICTIONARY  : in     DICTIONARY_TYPE;
  4190.        ASSOCIATION : in     ASSOCIATION_TYPE) is
  4191.      
  4192.    -- ALTER replaces a pre-existing association in the dictionary.
  4193.    -- If ASSOCIATION . KEY is not in DICTIONARY then KEY_NOT_FOUND is
  4194.    -- raised.
  4195.    -- Exceptions:  KEY_NOT_FOUND
  4196.    --
  4197.    -- DICTIONARY        - an access value of the dictionary in which
  4198.    --                   ASSOCIATION is to be altered.
  4199.    -- ASSOCIATION       - a record representing the association of its
  4200.    --                   KEY component with its VALUE component.
  4201.      
  4202.       KEY : KEY_TYPE renames ASSOCIATION . KEY;
  4203.      
  4204.       TREE : TREE_TYPE;
  4205.      
  4206.    begin
  4207.      
  4208.       if DICTIONARY = null then
  4209.      
  4210.          raise KEY_NOT_FOUND;
  4211.      
  4212.       end if;
  4213.      
  4214.       TREE := DICTIONARY . ROOT;
  4215.      
  4216.       while TREE /= null
  4217.       loop
  4218.      
  4219.          if KEY = TREE . ASSOCIATION . KEY then
  4220.      
  4221.             TREE . ASSOCIATION := ASSOCIATION;
  4222.             return;
  4223.      
  4224.          elsif KEY < TREE . ASSOCIATION . KEY then
  4225.      
  4226.             TREE := TREE . L_SON;
  4227.      
  4228.          else
  4229.      
  4230.             TREE := TREE . R_SON;
  4231.      
  4232.          end if;
  4233.      
  4234.       end loop;
  4235.      
  4236.       raise KEY_NOT_FOUND;
  4237.      
  4238.    end ALTER;
  4239.      
  4240.    procedure ALTER
  4241.       (DICTIONARY : in     DICTIONARY_TYPE;
  4242.        KEY        : in     KEY_TYPE;
  4243.        VALUE      : in     VALUE_TYPE) is
  4244.      
  4245.    -- ALTER sets the VALUE corresponding to KEY. KEY must already
  4246.    -- be in DICTIONARY or else KEY_NOT_FOUND is raised.
  4247.    -- Exceptions:  KEY_NOT_FOUND
  4248.    --
  4249.    -- DICTIONARY        - an access value of the dictionary in which
  4250.    --                   ASSOCIATION is to be inserted.
  4251.    -- KEY               - the "handle" by which VALUE can be referenced
  4252.    --                   in the DICTIONARY. (Corresponds to the "word"
  4253.    --                   which is used to order and index the
  4254.    --                   dictionary.)
  4255.    -- VALUE             - the information which is to be associated with
  4256.    --                   KEY.  (Corresponds to the "definition" of KEY in
  4257.    --                   a dictionary.)
  4258.      
  4259.       TREE : TREE_TYPE;
  4260.      
  4261.    begin
  4262.      
  4263.       if DICTIONARY = null then
  4264.      
  4265.          raise KEY_NOT_FOUND;
  4266.      
  4267.       end if;
  4268.      
  4269.       TREE := DICTIONARY . ROOT;
  4270.      
  4271.       while TREE /= null
  4272.       loop
  4273.      
  4274.          if KEY = TREE . ASSOCIATION . KEY then
  4275.      
  4276.             TREE . ASSOCIATION . VALUE := VALUE;
  4277.             return;
  4278.      
  4279.          elsif KEY < TREE . ASSOCIATION . KEY then
  4280.      
  4281.             TREE := TREE . L_SON;
  4282.      
  4283.          else
  4284.      
  4285.             TREE := TREE . R_SON;
  4286.      
  4287.          end if;
  4288.      
  4289.       end loop;
  4290.      
  4291.       raise KEY_NOT_FOUND;
  4292.      
  4293.    end ALTER;
  4294.      
  4295.    procedure ENTER
  4296.       (DICTIONARY  : in out DICTIONARY_TYPE;
  4297.        ASSOCIATION : in     ASSOCIATION_TYPE) is
  4298.      
  4299.    -- ENTER puts an ASSOCIATION in DICTIONARY.  ASSOCIATION . KEY may
  4300.    -- or may not already be in the dictionary.
  4301.    --
  4302.    -- DICTIONARY        - an access value of the dictionary in which
  4303.    --                   ASSOCIATION is to be inserted.  This parameter
  4304.    --                   must be `in out' mode because a newly allocated
  4305.    --                   access value is returned in place of a null
  4306.    --                   `in' value for DICTIONARY.
  4307.    -- ASSOCIATION       - a record representing the association of its
  4308.    --                   KEY component with its VALUE component.
  4309.      
  4310.       KEY : KEY_TYPE renames ASSOCIATION . KEY;
  4311.      
  4312.       procedure FIND
  4313.          (TREE : in out TREE_TYPE) is
  4314.      
  4315.       -- Procedure FIND moves down the TREE recursively searching
  4316.       -- for the point to insert the new ASSOCIATION.  Searching
  4317.       -- continues until either a node is found with an equal KEY, or
  4318.       -- an empty branch is taken.  If the key is found in the tree,
  4319.       -- the association of that node is replaced. A null branch is
  4320.       -- replaced with a new node.
  4321.       --
  4322.       -- Procedure FIND originally had more work to do, updating
  4323.       -- the SIZE fields of each node along the access path. Now,
  4324.       -- the only SIZE field is in the DICTIONARY, not the TREE.
  4325.       -- An iterative version of ENTER could be made without using
  4326.       -- a recursive procedure.  However, the formal parameter TREE
  4327.       -- stands in for both the `TREE . L_SON' and `TREE . R_SON' calls
  4328.       -- in this version, resulting in a more compact and readable
  4329.       -- algorithm.
  4330.      
  4331.       -- WARNING: FIND uses `KEY' and `DICTIONARY . SIZE' from
  4332.       -- the enclosing scope.
  4333.      
  4334.       begin
  4335.      
  4336.          if TREE = null then
  4337.      
  4338.             TREE := new TREE_NODE_TYPE' (
  4339.                   L_SON        => null,
  4340.                   R_SON        => null,
  4341.                   ASSOCIATION => ASSOCIATION);
  4342.      
  4343.             DICTIONARY . SIZE := DICTIONARY . SIZE + 1;
  4344.      
  4345.             return;
  4346.      
  4347.          elsif KEY = TREE . ASSOCIATION . KEY then
  4348.      
  4349.             TREE . ASSOCIATION := ASSOCIATION;
  4350.      
  4351.             return;
  4352.      
  4353.          elsif KEY < TREE . ASSOCIATION . KEY then
  4354.      
  4355.             FIND (TREE . L_SON);
  4356.      
  4357.          else
  4358.      
  4359.             FIND (TREE . R_SON);
  4360.      
  4361.          end if;
  4362.      
  4363.       end FIND;
  4364.      
  4365.    begin
  4366.      
  4367.       if DICTIONARY = null then
  4368.      
  4369.          DICTIONARY := new DICTIONARY_NODE_TYPE'
  4370.             (SIZE => 0, ROOT => null);
  4371.      
  4372.       end if;
  4373.      
  4374.       FIND (DICTIONARY . ROOT);
  4375.      
  4376.    end ENTER;
  4377.      
  4378.    procedure ENTER
  4379.       (DICTIONARY : in out DICTIONARY_TYPE;
  4380.        KEY        : in     KEY_TYPE;
  4381.        VALUE      : in     VALUE_TYPE) is
  4382.      
  4383.    -- ENTER associates VALUE with KEY in DICTIONARY.  KEY may
  4384.    -- or may not already be in the dictionary.
  4385.    --
  4386.    -- DICTIONARY        - an access value of the dictionary in which
  4387.    --                   ASSOCIATION is to be inserted.  This parameter
  4388.    --                   must be `in out' mode because a newly allocated
  4389.    --                   access value is returned in place of a null
  4390.    --                   `in' value for DICTIONARY.
  4391.    -- KEY               - the "handle" by which VALUE can be referenced
  4392.    --                   in the DICTIONARY. (Corresponds to the "word"
  4393.    --                   which is used to order and index the
  4394.    --                   dictionary.)
  4395.    -- VALUE             - the information which is to be associated with
  4396.    --                   KEY.  (Corresponds to the "definition" of KEY in
  4397.    --                   a dictionary.)
  4398.      
  4399.       procedure FIND
  4400.          (TREE : in out TREE_TYPE) is
  4401.      
  4402.       -- Procedure FIND moves down the TREE recursively searching
  4403.       -- for the point to insert the new ASSOCIATION.  Searching
  4404.       -- continues until either a node is found with an equal KEY, or
  4405.       -- an empty branch is taken.  If the key is found in the tree,
  4406.       -- the association of that node is replaced. A null branch is
  4407.       -- replaced with a new node.
  4408.       --
  4409.       -- TREE - The access value to the tree being searched
  4410.       --
  4411.       -- Procedure FIND originally had more work to do, updating
  4412.       -- the SIZE fields of each node along the access path. Now,
  4413.       -- the only SIZE field is in the DICTIONARY, not the TREE.
  4414.       -- An iterative version of ENTER could be made without using
  4415.       -- a recursive procedure.  However, the formal parameter TREE
  4416.       -- stands in for both the `TREE . L_SON' and `TREE . R_SON' calls
  4417.       -- in this version, resulting in a more compact and readable
  4418.       -- algorithm.
  4419.      
  4420.       -- WARNING: FIND uses `KEY' and `DICTIONARY . SIZE' from
  4421.       -- the enclosing scope.
  4422.      
  4423.       begin
  4424.      
  4425.          if TREE = null then
  4426.      
  4427.             TREE := new TREE_NODE_TYPE' (
  4428.                   L_SON        => null,
  4429.                   R_SON        => null,
  4430.                   ASSOCIATION => ASSOCIATION_TYPE' (KEY, VALUE));
  4431.      
  4432.             DICTIONARY . SIZE := DICTIONARY . SIZE + 1;
  4433.      
  4434.             return;
  4435.      
  4436.          elsif KEY = TREE . ASSOCIATION . KEY then
  4437.      
  4438.             TREE . ASSOCIATION . VALUE := VALUE;
  4439.      
  4440.             return;
  4441.      
  4442.          elsif KEY < TREE . ASSOCIATION . KEY then
  4443.      
  4444.             FIND (TREE . L_SON);
  4445.      
  4446.          else
  4447.      
  4448.             FIND (TREE . R_SON);
  4449.      
  4450.          end if;
  4451.      
  4452.       end FIND;
  4453.      
  4454.    begin
  4455.      
  4456.       if DICTIONARY = null then
  4457.      
  4458.          DICTIONARY := new DICTIONARY_NODE_TYPE'
  4459.             (SIZE => 0, ROOT => null);
  4460.      
  4461.       end if;
  4462.      
  4463.       FIND (DICTIONARY . ROOT);
  4464.      
  4465.       -- The following Code could replace this subprogram body and
  4466.       -- its "FIND" routine.  However, code space has been sacrificed
  4467.       -- to attempt to provide better run-time speed.
  4468.       -- ENTER (DICTIONARY, ASSOCIATION_TYPE' (KEY, VALUE));
  4469.       --
  4470.    end ENTER;
  4471.      
  4472.    procedure REMOVE
  4473.       (DICTIONARY : in out DICTIONARY_TYPE;
  4474.        KEY        : in     KEY_TYPE) is
  4475.      
  4476.    -- Remove the association of KEY to its VALUE in DICTIONARY.  If no
  4477.    -- association exists for KEY, raise KEY_NOT_FOUND.
  4478.    -- Exceptions:  KEY_NOT_FOUND
  4479.    --
  4480.    -- DICTIONARY        - an access value of the dictionary from which
  4481.    --                   KEY is to be removed.
  4482.    -- KEY               - value of the KEY field of the ASSOCIATION to
  4483.    --                   be removed from DICTIONARY.
  4484.      
  4485.       procedure FIND
  4486.          (TREE : in out TREE_TYPE) is
  4487.      
  4488.       -- Procedure FIND moves down the TREE recursively searching
  4489.       -- for the ASSOCIATION with the given KEY.  Searching
  4490.       -- continues until either a node is found with an equal KEY, or
  4491.       -- an empty branch is taken.  If the key is found in the tree,
  4492.       -- the association of that node is removed. If not found, the
  4493.       -- exception KEY_NOT_FOUND is raised.
  4494.       --
  4495.       -- TREE - Access to root of Tree in being searched
  4496.       --
  4497.       -- Procedure FIND originally had more work to do, updating
  4498.       -- the SIZE fields of each node along the access path. Now,
  4499.       -- the only SIZE field is in the DICTIONARY, not the TREE.
  4500.       -- An iterative version of ENTER could be made without using
  4501.       -- a recursive procedure.  However, the formal parameter TREE
  4502.       -- stands in for both the `TREE . L_SON' and `TREE . R_SON' calls
  4503.       -- in this version, resulting in a more compact and readable
  4504.       -- algorithm.
  4505.      
  4506.       -- WARNING: FIND uses `KEY' and `DICTIONARY . SIZE' from
  4507.       -- the enclosing scope.
  4508.      
  4509.       begin
  4510.      
  4511.          if TREE = null then
  4512.      
  4513.             raise KEY_NOT_FOUND;
  4514.      
  4515.          elsif KEY = TREE . ASSOCIATION . KEY then
  4516.      
  4517.             TAKE_OUT (TREE);
  4518.      
  4519.             DICTIONARY . SIZE := DICTIONARY . SIZE - 1;
  4520.      
  4521.             return;
  4522.      
  4523.          elsif KEY < TREE . ASSOCIATION . KEY then
  4524.      
  4525.             FIND (TREE . L_SON);
  4526.      
  4527.          else
  4528.      
  4529.             FIND (TREE . R_SON);
  4530.      
  4531.          end if;
  4532.      
  4533.       end FIND;
  4534.      
  4535.    begin
  4536.      
  4537.       if DICTIONARY = null then
  4538.      
  4539.          raise KEY_NOT_FOUND;
  4540.      
  4541.       end if;
  4542.      
  4543.       FIND (DICTIONARY . ROOT);
  4544.      
  4545.    end REMOVE;
  4546.      
  4547.    procedure PURGE
  4548.       (DICTIONARY : in out DICTIONARY_TYPE;
  4549.        KEY        : in     KEY_TYPE) is
  4550.      
  4551.    -- Remove any association of KEY to its (unknown) VALUE from
  4552.    -- DICTIONARY. If no association exists, just return.
  4553.    --
  4554.    -- DICTIONARY        - an access value of the dictionary from which
  4555.    --                   KEY is to be purged.
  4556.    -- KEY               - value of the KEY field of the ASSOCIATION to
  4557.    --                   be purged from DICTIONARY.
  4558.      
  4559.       procedure FIND
  4560.          (TREE : in out TREE_TYPE) is
  4561.      
  4562.       -- Procedure FIND moves down the TREE recursively searching
  4563.       -- for the ASSOCIATION with the given KEY.  Searching
  4564.       -- continues until either a node is found with an equal KEY, or
  4565.       -- an empty branch is taken.  If the key is found in the tree,
  4566.       -- the association of that node is removed. If not found, no
  4567.       -- action is taken.
  4568.       --
  4569.       -- TREE - Access to root of tree being searched
  4570.       --
  4571.       -- Procedure FIND originally had more work to do, updating
  4572.       -- the SIZE fields of each node along the access path. Now,
  4573.       -- the only SIZE field is in the DICTIONARY, not the TREE.
  4574.       -- An iterative version of ENTER could be made without using
  4575.       -- a recursive procedure.  However, the formal parameter TREE
  4576.       -- stands in for both the `TREE . L_SON' and `TREE . R_SON' calls
  4577.       -- in this version, resulting in a more compact and readable
  4578.       -- algorithm.
  4579.      
  4580.       -- WARNING: FIND uses `KEY' and `DICTIONARY . SIZE' from
  4581.       -- the enclosing scope.
  4582.      
  4583.       begin
  4584.      
  4585.          if TREE = null then
  4586.      
  4587.             return;
  4588.      
  4589.          elsif KEY = TREE . ASSOCIATION . KEY then
  4590.      
  4591.             TAKE_OUT (TREE);
  4592.      
  4593.             DICTIONARY . SIZE := DICTIONARY . SIZE - 1;
  4594.      
  4595.             return;
  4596.      
  4597.          elsif KEY < TREE . ASSOCIATION . KEY then
  4598.      
  4599.             FIND (TREE . L_SON);
  4600.      
  4601.          else
  4602.      
  4603.             FIND (TREE . R_SON);
  4604.      
  4605.          end if;
  4606.      
  4607.       end FIND;
  4608.      
  4609.    begin
  4610.      
  4611.       if DICTIONARY = null then
  4612.      
  4613.          return;
  4614.      
  4615.       end if;
  4616.      
  4617.       FIND (DICTIONARY . ROOT);
  4618.      
  4619.    end PURGE;
  4620.      
  4621.    function IS_IN
  4622.       (DICTIONARY : in     DICTIONARY_TYPE;
  4623.        KEY        : in     KEY_TYPE) return BOOLEAN is
  4624.      
  4625.    -- Function IS_IN returns TRUE if KEY has an ASSOCIATION in the
  4626.    -- DICTIONARY.
  4627.    --
  4628.    -- DICTIONARY        - an access value of the dictionary that is
  4629.    --                   searched for KEY.
  4630.    -- KEY               - value of the KEY field of the ASSOCIATION to
  4631.    --                   be matched in DICTIONARY.
  4632.      
  4633.    begin
  4634.      
  4635.       return DICTIONARY /= null and then
  4636.             SEARCH (DICTIONARY . ROOT, KEY) /= null;
  4637.      
  4638.    end IS_IN;
  4639.      
  4640.    function ASSOCIATION
  4641.       (DICTIONARY : in     DICTIONARY_TYPE;
  4642.        KEY        : in     KEY_TYPE) return ASSOCIATION_TYPE is
  4643.      
  4644.    -- Function ASSOCIATION returns the ASSOCIATION associated
  4645.    -- with KEY in the DICTIONARY.
  4646.    -- Exceptions:  KEY_NOT_FOUND
  4647.    -- DICTIONARY        - an access value of the dictionary that is
  4648.    --                   searched for KEY.
  4649.    -- KEY               - value of the KEY field of the ASSOCIATION to
  4650.    --                   be matched in DICTIONARY.
  4651.      
  4652.    begin
  4653.      
  4654.          if DICTIONARY = null then
  4655.      
  4656.          raise KEY_NOT_FOUND;
  4657.      
  4658.       end if;
  4659.      
  4660.       declare
  4661.      
  4662.          TREE : TREE_TYPE := SEARCH (DICTIONARY . ROOT, KEY);
  4663.      
  4664.       begin
  4665.      
  4666.          if TREE = null then
  4667.      
  4668.             raise KEY_NOT_FOUND;
  4669.      
  4670.          end if;
  4671.      
  4672.          return TREE . ASSOCIATION;
  4673.      
  4674.       end;
  4675.      
  4676.    end ASSOCIATION;
  4677.      
  4678.    function VALUE
  4679.       (DICTIONARY : in     DICTIONARY_TYPE;
  4680.        KEY        : in     KEY_TYPE) return VALUE_TYPE is
  4681.      
  4682.    -- Function VALUE returns the VALUE associated with KEY in the
  4683.    -- specified DICTIONARY.
  4684.    -- Exceptions:  KEY_NOT_FOUND
  4685.    -- DICTIONARY        - an access value of the dictionary that is
  4686.    --                   searched for KEY.
  4687.    -- KEY               - value of the KEY field of the ASSOCIATION to
  4688.    --                   be matched in DICTIONARY.
  4689.      
  4690.    begin
  4691.      
  4692.       return ASSOCIATION (DICTIONARY, KEY) . VALUE;
  4693.      
  4694.    end VALUE;
  4695.      
  4696.    function SIZE
  4697.       (DICTIONARY : in     DICTIONARY_TYPE) return NATURAL is
  4698.      
  4699.    -- Return the number of ASSOCIATIONS in DICTIONARY.
  4700.    -- DICTIONARY        - an access value of the dictionary
  4701.      
  4702.    begin
  4703.      
  4704.       if DICTIONARY = null then
  4705.      
  4706.          return 0;
  4707.      
  4708.       else
  4709.      
  4710.          return DICTIONARY . SIZE;
  4711.      
  4712.       end if;
  4713.      
  4714.    end SIZE;
  4715.      
  4716.    function ASSOCIATION_LIST
  4717.       (DICTIONARY : in    DICTIONARY_TYPE)
  4718.        return ASSOCIATION_LIST_TYPE is
  4719.      
  4720.    -- Return the list of ASSOCIATIONs currently in DICTIONARY.
  4721.    --
  4722.    -- Note on usage:
  4723.    -- Normally one does not return a unconstrained type, since
  4724.    -- the calling program must be able to handle the returned value
  4725.    -- without raising a CONSTRAINT_ERROR. This is perfectly feasible
  4726.    -- here because the calling program can use SIZE(DICTIONARY) to
  4727.    -- predict and conform to the constraint.
  4728.    --
  4729.    -- The order of the keys is ascending, as defined by generic
  4730.    -- parameter "<".
  4731.    --
  4732.    -- DICTIONARY - access to the dictionary
  4733.      
  4734.       LIST : ASSOCIATION_LIST_TYPE (1.. SIZE(DICTIONARY));
  4735.       -- Array to return list of associations.
  4736.      
  4737.       LIST_INDEX : NATURAL := 0;
  4738.       -- Current number of associations in LIST
  4739.      
  4740.       procedure APPEND_ASSOCIATION_TO_LIST
  4741.          (ASSOCIATION : in     ASSOCIATION_TYPE) is
  4742.      
  4743.       -- Helper procedure used to define instantiation of generic
  4744.       -- PROCESS_TREE.  APPEND_ASSOCIATION_TO_LIST adds the association
  4745.       -- to the end of the LIST of associations collected so far.
  4746.       --
  4747.       -- ASSOCIATION - next association to be added to LIST
  4748.       --
  4749.       -- LIST_INDEX and LIST come from the enclosing scope
  4750.      
  4751.       begin
  4752.      
  4753.          LIST_INDEX := LIST_INDEX + 1;
  4754.          LIST (LIST_INDEX) := ASSOCIATION;
  4755.      
  4756.       end APPEND_ASSOCIATION_TO_LIST;
  4757.      
  4758.       procedure BUILD_ASSOCIATION_LIST is new PROCESS_TREE
  4759.          (PROCESS => APPEND_ASSOCIATION_TO_LIST);
  4760.      
  4761.    begin
  4762.      
  4763.       if DICTIONARY /= null then
  4764.      
  4765.          BUILD_ASSOCIATION_LIST(DICTIONARY . ROOT);
  4766.      
  4767.       end if;
  4768.      
  4769.       return LIST;
  4770.      
  4771.    end ASSOCIATION_LIST;
  4772.      
  4773.    function KEY_LIST
  4774.       (DICTIONARY : in    DICTIONARY_TYPE)
  4775.          return KEY_LIST_TYPE is
  4776.      
  4777.    -- Return the list of KEYS currently used in DICTIONARY.
  4778.    --
  4779.    -- Note on usage:
  4780.    -- Normally one does not return a unconstrained type, since
  4781.    -- the calling program must be able to handle the returned value
  4782.    -- without raising a CONSTRAINT_ERROR. This is perfectly feasible
  4783.    -- here because the calling program can use SIZE(DICTIONARY) to
  4784.    -- predict and conform to the constraint.
  4785.    --
  4786.    -- The order of the keys is ascending, as defined by generic
  4787.    -- parameter "<".
  4788.    --
  4789.    -- DICTIONARY - access to the dictionary
  4790.      
  4791.       LIST : KEY_LIST_TYPE(1.. SIZE (DICTIONARY));
  4792.       -- Array to return list of keys.
  4793.      
  4794.       LIST_INDEX : NATURAL := 0;
  4795.       -- Current number of items in LIST
  4796.      
  4797.       procedure APPEND_KEY_TO_LIST
  4798.          (ASSOCIATION : in     ASSOCIATION_TYPE) is
  4799.      
  4800.       -- Helper procedure used to define instantiation of generic
  4801.       -- PROCESS_TREE.  APPEND_KEY_TO_LIST adds the key
  4802.       -- to the end of the LIST of keys collected so far.
  4803.       --
  4804.       -- ASSOCIATION - ASSOCIATION . KEY is next KEY to be added to LIST
  4805.       --
  4806.       -- LIST_INDEX and LIST come from the enclosing scope
  4807.      
  4808.       begin
  4809.      
  4810.          LIST_INDEX := LIST_INDEX + 1;
  4811.          LIST (LIST_INDEX) := ASSOCIATION . KEY;
  4812.      
  4813.       end APPEND_KEY_TO_LIST;
  4814.      
  4815.       procedure BUILD_KEY_LIST is new PROCESS_TREE
  4816.          (PROCESS => APPEND_KEY_TO_LIST);
  4817.      
  4818.    begin
  4819.      
  4820.       if DICTIONARY /= null then
  4821.      
  4822.          BUILD_KEY_LIST(DICTIONARY . ROOT);
  4823.      
  4824.       end if;
  4825.      
  4826.       return LIST;
  4827.      
  4828.    end KEY_LIST;
  4829.      
  4830.    function VALUE_LIST
  4831.       (DICTIONARY : in    DICTIONARY_TYPE) return VALUE_LIST_TYPE is
  4832.      
  4833.    -- Return the list of VALUES currently used in DICTIONARY.
  4834.    -- The order of the VALUES is identical to KEY_LIST.
  4835.    --
  4836.    -- Note on usage:
  4837.    -- Normally one does not return a unconstrained type, since
  4838.    -- the calling program must be able to handle the returned value
  4839.    -- without raising a CONSTRAINT_ERROR. This is perfectly feasible
  4840.    -- here because the calling program can use SIZE(DICTIONARY) to
  4841.    -- predict and conform to the constraint.
  4842.    --
  4843.      
  4844.       LIST : VALUE_LIST_TYPE(1.. SIZE (DICTIONARY));
  4845.       -- Array to return list of VALUEs
  4846.      
  4847.       LIST_INDEX : NATURAL := 0;
  4848.       -- Current number of items in LIST
  4849.      
  4850.       procedure APPEND_VALUE_TO_LIST
  4851.          (ASSOCIATION : in     ASSOCIATION_TYPE) is
  4852.      
  4853.       -- Helper procedure used to define instantiation of generic
  4854.       -- PROCESS_TREE.  APPEND_VALUE_TO_LIST adds the value
  4855.       -- to the end of the LIST of values collected so far.
  4856.       --
  4857.       -- ASSOCIATION - ASSOCIATION . VALUE is next VALUE to be added
  4858.       --
  4859.       -- LIST_INDEX and LIST come from the enclosing scope
  4860.      
  4861.       begin
  4862.      
  4863.          LIST_INDEX := LIST_INDEX + 1;
  4864.          LIST (LIST_INDEX) := ASSOCIATION . VALUE;
  4865.      
  4866.       end APPEND_VALUE_TO_LIST;
  4867.      
  4868.       procedure BUILD_VALUE_LIST is new PROCESS_TREE
  4869.          (PROCESS => APPEND_VALUE_TO_LIST);
  4870.      
  4871.    begin
  4872.      
  4873.       if DICTIONARY /= null then
  4874.      
  4875.          BUILD_VALUE_LIST(DICTIONARY . ROOT);
  4876.      
  4877.       end if;
  4878.      
  4879.       return LIST;
  4880.      
  4881.    end VALUE_LIST;
  4882.      
  4883.    function COPY
  4884.       (ORIGINAL : in     DICTIONARY_TYPE)
  4885.          return DICTIONARY_TYPE is
  4886.      
  4887.    -- Create an identical copy of the ORIGINAL dictionary.
  4888.    -- Contrast this with ":=".
  4889.    -- Note that the ASSOCIATIONs in the dictionary are
  4890.    -- only assigned, not COPY'ed.
  4891.    --
  4892.    -- ORIGINAL - Access to original DICTIONARY
  4893.      
  4894.    begin
  4895.      
  4896.       if ORIGINAL /= null then
  4897.      
  4898.          return new DICTIONARY_NODE_TYPE'
  4899.             (SIZE => ORIGINAL . SIZE,
  4900.              ROOT => COPY (ORIGINAL . ROOT));
  4901.      
  4902.       else
  4903.      
  4904.          return null;
  4905.      
  4906.       end if;
  4907.      
  4908.    end COPY;
  4909.      
  4910. end DICTIONARY;
  4911. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4912. --:UDD:GKSADACM:CODE:MA:CGI_OPEN_WS_OPS.ADA
  4913. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4914. ------------------------------------------------------------------
  4915. --
  4916. --  NAME: CGI_OPEN_WS_OPERATIONS
  4917. --  IDENTIFIER: GDMXXX.1(1)
  4918. --  DISCREPANCY REPORTS:
  4919. --
  4920. ------------------------------------------------------------------
  4921. -- file: CGI_OPEN_WS_OPS.ADA
  4922. -- level: ma, 0a, 1a, 2a
  4923.      
  4924. with GKS_TYPES;
  4925. with DICTIONARY;
  4926.      
  4927. use GKS_TYPES;
  4928.      
  4929. package CGI_OPEN_WS_OPERATIONS is
  4930.      
  4931. -- This package contains OPEN_WS package which is an instantiation
  4932. -- of a DICTIONARY package.  It provides the workstation manager level
  4933. -- the means to maintain a set of open ws ids and their associated
  4934. -- workstation types.
  4935. -- Package GKS_TYPES provides type definitions.
  4936.      
  4937.    type WS_ID_LIST is array (POSITIVE range <>) of
  4938.          WS_ID;
  4939.    -- Array of workstation ids returned by some subprograms from
  4940.    -- DICTIONARY package
  4941.      
  4942.    type WS_TYPE_LIST is array (POSITIVE range   <>)
  4943.          of WS_TYPE;
  4944.    -- Array of workstation types returned by some subprograms from
  4945.    -- DICTIONARY package
  4946.      
  4947.    package OPEN_WS is new DICTIONARY
  4948.       (KEY_TYPE  => WS_ID,
  4949.        "<" => "<",
  4950.        VALUE_TYPE =>  WS_TYPE,
  4951.        KEY_LIST_TYPE => WS_ID_LIST,
  4952.        VALUE_LIST_TYPE => WS_TYPE_LIST);
  4953.    -- Provides a dictionary and the appropriate operations for the
  4954.    -- association between a workstation id and a
  4955.    -- workstation type for each open workstation
  4956.      
  4957.    OPEN_DICTIONARY : OPEN_WS.DICTIONARY_TYPE;
  4958.    -- Association of the workstation id and workstation type for each
  4959.    -- open workstation
  4960.      
  4961. end CGI_OPEN_WS_OPERATIONS;
  4962. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4963. --:UDD:GKSADACM:CODE:MA:LEXI3700_WSD_MA.ADA
  4964. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4965. ------------------------------------------------------------------
  4966. --
  4967. --  NAME: LEXI3700_WSD
  4968. --  IDENTIFIER: GDMXXX.1(1)
  4969. --  DISCREPANCY REPORTS:
  4970. --
  4971. ------------------------------------------------------------------
  4972. -- file: LEXI3700_WSD_MA.ADA
  4973. -- level: ma
  4974.      
  4975. with CGI;
  4976. with GKS_TYPES;
  4977.      
  4978. use  CGI;
  4979. use  GKS_TYPES;
  4980.      
  4981. package LEXI3700_WSD is
  4982.      
  4983. -- This package LEXI3700_WSD is the LEXIDATA workstation driver. As
  4984. -- a workstation driver, it controls the flow of operations to the
  4985. -- device driver.
  4986. --
  4987. -- Package GKS_TYPES provides type definitions.
  4988. -- Package CGI provides the data interface from the workstation
  4989. -- manager. The data interface is a discriminant record made up of
  4990. -- an OPERATION and the corresponding parameters for the operation.
  4991. --
  4992. -- This package LEXI3700_WSD provides a single procedure LEXI3700_WSD
  4993. -- to perform the workstation operation which is encoded in the CGI
  4994. -- instruction.
  4995.      
  4996.    procedure LEXI3700_WSD
  4997.       (INSTR : in out CGI_INSTR;
  4998.        AFFECTED_WS_ID : in WS_ID);
  4999.      
  5000. end LEXI3700_WSD;
  5001. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5002. --:UDD:GKSADACM:CODE:MA:ERROR_ROUTINES_MA.ADA
  5003. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5004. ------------------------------------------------------------------
  5005. --
  5006. --  NAME: ERROR_ROUTINES
  5007. --  IDENTIFIER: GIMXXX.1(1)
  5008. --  DISCREPANCY REPORTS:
  5009. --
  5010. ------------------------------------------------------------------
  5011. -- file:  error_routines_ma.ada
  5012. -- level: ma
  5013.      
  5014. with GKS_TYPES;
  5015.      
  5016. use GKS_TYPES;
  5017.      
  5018. package ERROR_ROUTINES is
  5019.      
  5020. -- This package provides the procedures for gks error handling.
  5021.      
  5022.    procedure ERROR_LOGGING
  5023.       (EI  : in ERROR_INDICATOR;
  5024.       NAME : in SUBPROGRAM_NAME);
  5025.      
  5026. end ERROR_ROUTINES;
  5027. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5028. --:UDD:GKSADACM:CODE:MA:GKS_CONTROL.ADA
  5029. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5030. ------------------------------------------------------------------
  5031. --
  5032. --  NAME: GKS_CONTROL
  5033. --  IDENTIFIER: GIMXXX.1(1)
  5034. --  DISCREPANCY REPORTS:
  5035. --
  5036. ------------------------------------------------------------------
  5037. -- file:  gks_control.ada
  5038. -- level: all levels
  5039.      
  5040. with GKS_TYPES;
  5041. with GKS_CONFIGURATION;
  5042.      
  5043. use GKS_TYPES;
  5044.      
  5045. package GKS_CONTROL is
  5046.      
  5047. -- This package provides the functions for GKS
  5048. -- control.
  5049.      
  5050.    procedure OPEN_GKS
  5051.       (ERROR_FILE       : in ERROR_FILE_TYPE :=
  5052.                           GKS_CONFIGURATION.DEFAULT_ERROR_FILE;
  5053.       AMOUNT_OF_MEMORY  : in MEMORY_UNITS :=
  5054.                           GKS_CONFIGURATION.MAX_MEMORY_UNITS);
  5055.      
  5056.    procedure CLOSE_GKS;
  5057.      
  5058. end GKS_CONTROL;
  5059. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5060. --:UDD:GKSADACM:CODE:MA:GKS_NORM_MA.ADA
  5061. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5062. ------------------------------------------------------------------
  5063. --
  5064. --  NAME: GKS_NORMALIZATION
  5065. --  IDENTIFIER: GIMXXX.1(2)
  5066. --  DISCREPANCY REPORTS:
  5067. --  DR028  Normalization of primitive attributes.
  5068. ------------------------------------------------------------------
  5069. -- file:  gks_norm.ada
  5070. -- level: MA
  5071.      
  5072. with GKS_TYPES;
  5073.      
  5074. use GKS_TYPES;
  5075.      
  5076. package GKS_NORMALIZATION is
  5077.      
  5078. -- This package provides the normalization transformation
  5079. -- procedures for GKS.
  5080.      
  5081.    procedure SET_WINDOW
  5082.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  5083.       WINDOW_LIMITS   : in WC.RECTANGLE_LIMITS);
  5084.      
  5085.    procedure SET_VIEWPORT
  5086.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  5087.       VIEWPORT_LIMITS : in NDC.RECTANGLE_LIMITS);
  5088.      
  5089.    procedure SELECT_NORMALIZATION_TRANSFORMATION
  5090.       (TRANSFORMATION : in TRANSFORMATION_NUMBER);
  5091.      
  5092.    procedure SET_CLIPPING_INDICATOR
  5093.       (CLIPPING : in CLIPPING_INDICATOR);
  5094.      
  5095. end GKS_NORMALIZATION;
  5096. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5097. --:UDD:GKSADACM:CODE:MA:INQ_BUNDLE_IDX.ADA
  5098. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5099. ------------------------------------------------------------------
  5100. --
  5101. --  NAME: INQ_BUNDLE_INDICES
  5102. --  IDENTIFIER: GDMXXX.1(1)
  5103. --  DISCREPANCY REPORTS:
  5104. --
  5105. ------------------------------------------------------------------
  5106. -- file:  inq_bundle_idx.ada
  5107. -- level: all levels
  5108.      
  5109. with GKS_TYPES;
  5110.      
  5111. use GKS_TYPES;
  5112.      
  5113. package INQ_BUNDLE_INDICES is
  5114.      
  5115. -- This package provides the procedures for setting the
  5116. -- bundled primitive attributes.
  5117.      
  5118.    procedure INQ_POLYLINE_INDEX
  5119.       (EI   : out ERROR_INDICATOR;
  5120.       INDEX : out POLYLINE_INDEX);
  5121.      
  5122.    procedure INQ_POLYMARKER_INDEX
  5123.       (EI   : out ERROR_INDICATOR;
  5124.       INDEX : out POLYMARKER_INDEX);
  5125.      
  5126.    procedure INQ_FILL_AREA_INDEX
  5127.       (EI   : out ERROR_INDICATOR;
  5128.       INDEX : out FILL_AREA_INDEX);
  5129.      
  5130.    procedure INQ_TEXT_INDEX
  5131.       (EI   : out ERROR_INDICATOR;
  5132.       INDEX : out TEXT_INDEX);
  5133.      
  5134. end INQ_BUNDLE_INDICES;
  5135. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5136. --:UDD:GKSADACM:CODE:MA:INQ_GKS_DSCR_TBL_MA.ADA
  5137. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5138. ------------------------------------------------------------------
  5139. --
  5140. --  NAME: INQ_GKS_DESCRIPTION_TABLE_MA
  5141. --  IDENTIFIER: GIMXXX.1(1)
  5142. --  DISCREPANCY REPORTS:
  5143. --
  5144. ------------------------------------------------------------------
  5145. -- file:  inq_gks_dscr_tbl_ma.ada
  5146. -- level: all levels
  5147.      
  5148. with GKS_TYPES;
  5149.      
  5150. use GKS_TYPES;
  5151.      
  5152. package INQ_GKS_DESCRIPTION_TABLE_MA is
  5153.      
  5154. -- This package provides the inquiry procedures for inquiring
  5155. -- values of the GKS description table.
  5156.      
  5157.    procedure INQ_LEVEL_OF_GKS
  5158.       (EI   : out ERROR_INDICATOR;
  5159.       LEVEL : out GKS_LEVEL);
  5160.      
  5161. end INQ_GKS_DESCRIPTION_TABLE_MA;
  5162. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5163. --:UDD:GKSADACM:CODE:MA:INQ_GKS_ST_LST_MA.ADA
  5164. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5165. ------------------------------------------------------------------
  5166. --
  5167. --  NAME: INQ_GKS_STATE_LIST_MA
  5168. --  IDENTIFIER: GIMXXX.1(1)
  5169. --  DISCREPANCY REPORTS:
  5170. --
  5171. ------------------------------------------------------------------
  5172. -- file:  inq_gks_st_lst_ma.ada
  5173. -- level: all levels
  5174.      
  5175. with GKS_TYPES;
  5176.      
  5177. use GKS_TYPES;
  5178.      
  5179. package INQ_GKS_STATE_LIST_MA is
  5180.      
  5181. -- This package provides the inquiry procedures for inquiring
  5182. -- values of the GKS_STATE_LIST.
  5183.      
  5184.    procedure INQ_CURRENT_NORMALIZATION_TRANSFORMATION_NUMBER
  5185.       (EI            : out ERROR_INDICATOR;
  5186.       TRANSFORMATION : out TRANSFORMATION_NUMBER);
  5187.      
  5188.    procedure INQ_NORMALIZATION_TRANSFORMATION
  5189.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  5190.       EI              : out ERROR_INDICATOR;
  5191.       WINDOW_LIMITS   : out WC.RECTANGLE_LIMITS;
  5192.       VIEWPORT_LIMITS : out NDC.RECTANGLE_LIMITS);
  5193.      
  5194.    procedure INQ_CLIPPING
  5195.       (EI                : out ERROR_INDICATOR;
  5196.       CLIPPING           : out CLIPPING_INDICATOR;
  5197.       CLIPPING_RECTANGLE : out NDC.RECTANGLE_LIMITS);
  5198.      
  5199. end INQ_GKS_STATE_LIST_MA;
  5200. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5201. --:UDD:GKSADACM:CODE:MA:INQ_INDV_ATTR.ADA
  5202. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5203. ------------------------------------------------------------------
  5204. --
  5205. --  NAME: INQ_INDIVIDUAL_ATTRIBUTES
  5206. --  IDENTIFIER: GIMXXX.1(1)
  5207. --  DISCREPANCY REPORTS:
  5208. --
  5209. ------------------------------------------------------------------
  5210. -- file:  inq_indv_attr.ada
  5211. -- level: all levels
  5212.      
  5213. with GKS_TYPES;
  5214.      
  5215. use GKS_TYPES;
  5216.      
  5217. package INQ_INDIVIDUAL_ATTRIBUTES is
  5218.      
  5219. -- This package provides the procedures for inquiring the current
  5220. -- individual attribute values.  These procedures are a result of
  5221. -- the one-to-many mapping of the GKS function Inquire Current
  5222. -- Individual Attribute Values.  In addition, this package includes
  5223. -- a procedure INQ_CURRENT_INDIVIDUAL_ATTRIBUTE_VALUES that is a
  5224. -- one-to-one mapping of the GKS function.  This allows the application
  5225. -- to inquire all of the individual attributes in a single call.
  5226.      
  5227.    procedure INQ_LINETYPE
  5228.       (EI  : out ERROR_INDICATOR;
  5229.       LINE : out LINETYPE);
  5230.      
  5231.    procedure INQ_LINEWIDTH_SCALE_FACTOR
  5232.       (EI   : out ERROR_INDICATOR;
  5233.       WIDTH : out LINE_WIDTH);
  5234.      
  5235.    procedure INQ_POLYLINE_COLOUR_INDEX
  5236.       (EI    : out ERROR_INDICATOR;
  5237.       COLOUR : out COLOUR_INDEX);
  5238.      
  5239.    procedure INQ_POLYMARKER_TYPE
  5240.       (EI    : out ERROR_INDICATOR;
  5241.       MARKER : out MARKER_TYPE);
  5242.      
  5243.    procedure INQ_POLYMARKER_SIZE_SCALE_FACTOR
  5244.       (EI  : out ERROR_INDICATOR;
  5245.       SIZE : out MARKER_SIZE);
  5246.      
  5247.    procedure INQ_POLYMARKER_COLOUR_INDEX
  5248.       (EI    : out ERROR_INDICATOR;
  5249.       COLOUR : out COLOUR_INDEX);
  5250.      
  5251.    procedure INQ_TEXT_FONT_AND_PRECISION
  5252.       (EI            : out ERROR_INDICATOR;
  5253.       FONT_PRECISION : out TEXT_FONT_PRECISION);
  5254.      
  5255.    procedure INQ_CHAR_EXPANSION_FACTOR
  5256.       (EI       : out ERROR_INDICATOR;
  5257.       EXPANSION : out CHAR_EXPANSION);
  5258.      
  5259.    procedure INQ_CHAR_SPACING
  5260.       (EI     : out ERROR_INDICATOR;
  5261.       SPACING : out CHAR_SPACING);
  5262.      
  5263.    procedure INQ_TEXT_COLOUR_INDEX
  5264.       (EI    : out ERROR_INDICATOR;
  5265.       COLOUR : out COLOUR_INDEX);
  5266.      
  5267.    procedure INQ_FILL_AREA_INTERIOR_STYLE
  5268.       (EI   : out ERROR_INDICATOR;
  5269.       STYLE : out INTERIOR_STYLE);
  5270.      
  5271.    procedure INQ_FILL_AREA_STYLE_INDEX
  5272.       (EI   : out ERROR_INDICATOR;
  5273.       INDEX : out STYLE_INDEX);
  5274.      
  5275.    procedure INQ_FILL_AREA_COLOUR_INDEX
  5276.       (EI    : out ERROR_INDICATOR;
  5277.       COLOUR : out COLOUR_INDEX);
  5278.      
  5279.    procedure INQ_LIST_OF_ASF
  5280.       (EI  : out ERROR_INDICATOR;
  5281.       LIST : out ASF_LIST);
  5282.      
  5283.    procedure INQ_CURRENT_INDIVIDUAL_ATTRIBUTE_VALUES
  5284.       (EI         : out ERROR_INDICATOR;
  5285.       ATTRIBUTES  : out INDIVIDUAL_ATTRIBUTE_VALUES);
  5286.      
  5287. end INQ_INDIVIDUAL_ATTRIBUTES;
  5288. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5289. --:UDD:GKSADACM:CODE:MA:INQ_PRIM_ATTR.ADA
  5290. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5291. ------------------------------------------------------------------
  5292. --
  5293. --  NAME: INQ_PRIMITIVE_ATTRIBUTES
  5294. --  IDENTIFIER: GIMXXX.1(1)
  5295. --  DISCREPANCY REPORTS:
  5296. --
  5297. ------------------------------------------------------------------
  5298. -- file:  inq_prim_attr.ada
  5299. -- level: all levels
  5300.      
  5301. with GKS_TYPES;
  5302.      
  5303. use GKS_TYPES;
  5304.      
  5305. package INQ_PRIMITIVE_ATTRIBUTES is
  5306.      
  5307. -- This package provides the procedures for inquiring the
  5308. -- primitive attribute values.  These procedures are a result
  5309. -- of the one-to-many mapping of the GKS procedure Inquire
  5310. -- Current Primitive Attribute Values.  In addition, a procedure
  5311. -- INQ_CURRENT_PRIMITIVE_ATTRIBUTE_VALUES is included that is a
  5312. -- one-to-one mapping of the GKS procedure to allow the application
  5313. -- to inquire all of the primitive attributes in one call.
  5314.      
  5315.    procedure INQ_CHAR_HEIGHT
  5316.       (EI    : out ERROR_INDICATOR;
  5317.       HEIGHT : out WC.MAGNITUDE);
  5318.      
  5319.    procedure INQ_CHAR_UP_VECTOR
  5320.       (EI    : out ERROR_INDICATOR;
  5321.       VECTOR : out WC.VECTOR);
  5322.      
  5323.    procedure INQ_TEXT_PATH
  5324.       (EI  : out ERROR_INDICATOR;
  5325.       PATH : out TEXT_PATH);
  5326.      
  5327.    procedure INQ_TEXT_ALIGNMENT
  5328.       (EI       : out ERROR_INDICATOR;
  5329.       ALIGNMENT : out TEXT_ALIGNMENT);
  5330.      
  5331.    procedure INQ_PATTERN_REFERENCE_POINT
  5332.       (EI             : out ERROR_INDICATOR;
  5333.       REFERENCE_POINT : out WC.POINT);
  5334.      
  5335.    procedure INQ_PATTERN_HEIGHT_VECTOR
  5336.       (EI    : out ERROR_INDICATOR;
  5337.       VECTOR : out WC.VECTOR);
  5338.      
  5339.    procedure INQ_PATTERN_WIDTH_VECTOR
  5340.       (EI   : out ERROR_INDICATOR;
  5341.       WIDTH : out WC.VECTOR);
  5342.      
  5343.    procedure INQ_CHAR_WIDTH
  5344.       (EI   : out ERROR_INDICATOR;
  5345.       WIDTH : out WC.MAGNITUDE);
  5346.      
  5347.    procedure INQ_CHAR_BASE_VECTOR
  5348.       (EI    : out ERROR_INDICATOR;
  5349.       VECTOR : out WC.VECTOR);
  5350.      
  5351.    procedure INQ_CURRENT_PRIMITIVE_ATTRIBUTE_VALUES
  5352.       (EI         : out ERROR_INDICATOR;
  5353.        ATTRIBUTES : out PRIMITIVE_ATTRIBUTE_VALUES);
  5354.      
  5355. end INQ_PRIMITIVE_ATTRIBUTES;
  5356. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5357. --:UDD:GKSADACM:CODE:MA:INQ_WS_DSCR_TBL_MA.ADA
  5358. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5359. ------------------------------------------------------------------
  5360. --
  5361. --  NAME: INQ_WS_DESCRIPTION_TABLE_MA
  5362. --  IDENTIFIER: GIMXXX.1(1)
  5363. --  DISCREPANCY REPORTS:
  5364. --
  5365. ------------------------------------------------------------------
  5366. -- file:  inq_ws_dscr_tbl_ma.ada
  5367. -- level: all levels
  5368.      
  5369. with GKS_TYPES;
  5370.      
  5371. use GKS_TYPES;
  5372.      
  5373. package INQ_WS_DESCRIPTION_TABLE_MA is
  5374.      
  5375. -- This package provides the functions for calling the workstation
  5376. -- manager to inquire the workstation description tables for level ma.
  5377.      
  5378.    procedure INQ_DISPLAY_SPACE_SIZE
  5379.       (WS                  : in WS_TYPE;
  5380.       EI                   : out ERROR_INDICATOR;
  5381.       UNITS                : out DC_UNITS;
  5382.       MAX_DC_SIZE          : out DC.SIZE;
  5383.       MAX_RASTER_UNIT_SIZE : out RASTER_UNIT_SIZE);
  5384.      
  5385.    procedure INQ_POLYLINE_FACILITIES
  5386.       (WS               : in WS_TYPE;
  5387.       EI                : out ERROR_INDICATOR;
  5388.       LIST_OF_TYPES     : out LINETYPES.LIST_OF;
  5389.       NUMBER_OF_WIDTHS  : out NATURAL;
  5390.       NOMINAL_WIDTH     : out DC.MAGNITUDE;
  5391.       RANGE_OF_WIDTHS   : out DC.RANGE_OF_MAGNITUDES;
  5392.       NUMBER_OF_INDICES : out NATURAL);
  5393.      
  5394.    procedure INQ_POLYMARKER_FACILITIES
  5395.       (WS               : in WS_TYPE;
  5396.       EI                : out ERROR_INDICATOR;
  5397.       LIST_OF_TYPES     : out MARKER_TYPES.LIST_OF;
  5398.       NUMBER_OF_SIZES   : out NATURAL;
  5399.       NOMINAL_SIZE      : out DC.MAGNITUDE;
  5400.       RANGE_OF_SIZES    : out DC.RANGE_OF_MAGNITUDES;
  5401.       NUMBER_OF_INDICES : out NATURAL);
  5402.      
  5403.    procedure INQ_TEXT_FACILITIES
  5404.       (WS                  : in WS_TYPE;
  5405.       EI                   : out ERROR_INDICATOR;
  5406.       LIST_OF_FONT_PRECISION_PAIRS: out TEXT_FONT_PRECISIONS.LIST_OF;
  5407.       NUMBER_OF_HEIGHTS    : out NATURAL;
  5408.       RANGE_OF_HEIGHTS     : out DC.RANGE_OF_MAGNITUDES;
  5409.       NUMBER_OF_EXPANSIONS : out NATURAL;
  5410.       EXPANSION_RANGE      : out RANGE_OF_EXPANSIONS;
  5411.       NUMBER_OF_INDICES    : out NATURAL);
  5412.      
  5413.    procedure INQ_FILL_AREA_FACILITIES
  5414.       (WS                     : WS_TYPE;
  5415.       EI                      : out ERROR_INDICATOR;
  5416.       LIST_OF_INTERIOR_STYLES : out INTERIOR_STYLES.LIST_OF;
  5417.       LIST_OF_HATCH_STYLES    : out HATCH_STYLES.LIST_OF;
  5418.       NUMBER_OF_INDICES       : out NATURAL);
  5419.      
  5420.    procedure INQ_COLOUR_FACILITIES
  5421.       (WS                      : in WS_TYPE;
  5422.       EI                       : out ERROR_INDICATOR;
  5423.       NUMBER_OF_COLOURS        : out NATURAL;
  5424.       AVAILABLE_COLOUR         : out COLOUR_AVAILABLE;
  5425.       NUMBER_OF_COLOUR_INDICES : out NATURAL);
  5426.      
  5427.    procedure INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  5428.       (WS                    : in WS_TYPE;
  5429.       EI                     : out ERROR_INDICATOR;
  5430.       MAX_POLYLINE_ENTRIES   : out NATURAL;
  5431.       MAX_POLYMARKER_ENTRIES : out NATURAL;
  5432.       MAX_TEXT_ENTRIES       : out NATURAL;
  5433.       MAX_FILL_AREA_ENTRIES  : out NATURAL;
  5434.       MAX_PATTERN_INDICES    : out NATURAL;
  5435.       MAX_COLOUR_INDICES     : out NATURAL);
  5436.      
  5437. end INQ_WS_DESCRIPTION_TABLE_MA;
  5438. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5439. --:UDD:GKSADACM:CODE:MA:INQ_WS_ST_LST_MA.ADA
  5440. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5441. ------------------------------------------------------------------
  5442. --
  5443. --  NAME: INQ_WS_STATE_LIST_MA
  5444. --  IDENTIFIER: GIMXXX.1(1)
  5445. --  DISCREPANCY REPORTS:
  5446. --
  5447. ------------------------------------------------------------------
  5448. -- file:  inq_ws_st_lst_ma.ada
  5449. -- level: all levels
  5450.      
  5451. with GKS_TYPES;
  5452.      
  5453. use GKS_TYPES;
  5454.      
  5455. package INQ_WS_STATE_LIST_MA is
  5456.      
  5457. -- This package provides the procedures for calling the
  5458. -- workstation manager to inquire the workstation state list.
  5459.      
  5460.    procedure INQ_WS_CONNECTION_AND_TYPE
  5461.       (WS        : in WS_ID;
  5462.       EI         : out ERROR_INDICATOR;
  5463.       CONNECTION : out VARIABLE_CONNECTION_ID;
  5464.       TYPE_OF_WS : out WS_TYPE);
  5465.      
  5466.    procedure INQ_TEXT_EXTENT
  5467.       (WS                 : in WS_ID;
  5468.       POSITION            : in WC.POINT;
  5469.       CHAR_STRING         : in STRING;
  5470.       EI                  : out ERROR_INDICATOR;
  5471.       CONCATENATION_POINT : out WC.POINT;
  5472.       TEXT_EXTENT         : out TEXT_EXTENT_PARALLELOGRAM);
  5473.      
  5474.    procedure INQ_LIST_OF_COLOUR_INDICES
  5475.       (WS     : in WS_ID;
  5476.       EI      : out ERROR_INDICATOR;
  5477.       INDICES : out COLOUR_INDICES.LIST_OF);
  5478.      
  5479.    procedure INQ_COLOUR_REPRESENTATION
  5480.       (WS             : in WS_ID;
  5481.       INDEX           : in COLOUR_INDEX;
  5482.       RETURNED_VALUES : in RETURN_VALUE_TYPE;
  5483.       EI              : out ERROR_INDICATOR;
  5484.       COLOUR          : out COLOUR_REPRESENTATION);
  5485.      
  5486.    procedure INQ_WS_TRANSFORMATION
  5487.       (WS                : in WS_ID;
  5488.       EI                 : out ERROR_INDICATOR;
  5489.       UPDATE             : out UPDATE_STATE;
  5490.       REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  5491.       CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  5492.       REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  5493.       CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS);
  5494.      
  5495. end INQ_WS_STATE_LIST_MA;
  5496. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5497. --:UDD:GKSADACM:CODE:MA:OUT_PRIM.ADA
  5498. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5499. ------------------------------------------------------------------
  5500. --
  5501. --  NAME: OUTPUT_PRIMITIVES
  5502. --  IDENTIFIER: GIMXXX.1(1)
  5503. --  DISCREPANCY REPORTS:
  5504. --
  5505. ------------------------------------------------------------------
  5506. -- file:  out_prim.ada
  5507. -- level: all levels
  5508.      
  5509. with GKS_TYPES;
  5510.      
  5511. use GKS_TYPES;
  5512.      
  5513. package OUTPUT_PRIMITIVES is
  5514.      
  5515. -- This package provides the level ma output primitive functions.
  5516.      
  5517.    procedure POLYLINE
  5518.       (LINE_POINTS : in WC.POINT_ARRAY);
  5519.      
  5520.    procedure POLYMARKER
  5521.       (MARKER_POINTS : in WC.POINT_ARRAY);
  5522.      
  5523.    procedure FILL_AREA
  5524.       (FILL_AREA_POINTS : in WC.POINT_ARRAY);
  5525.      
  5526.    procedure TEXT
  5527.       (POSITION   : in WC.POINT;
  5528.       TEXT_STRING : in STRING);
  5529.      
  5530. end OUTPUT_PRIMITIVES;
  5531. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5532. --:UDD:GKSADACM:CODE:MA:SET_CLR_TBL.ADA
  5533. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5534. ------------------------------------------------------------------
  5535. --
  5536. --  NAME: SET_COLOUR_TABLE
  5537. --  IDENTIFIER: GIMXXX.1(1)
  5538. --  DISCREPANCY REPORTS:
  5539. --
  5540. ------------------------------------------------------------------
  5541. -- file:  set_clr_tbl.ada
  5542. -- level: all levels
  5543.      
  5544. with GKS_TYPES;
  5545.      
  5546. use GKS_TYPES;
  5547.      
  5548. package SET_COLOUR_TABLE is
  5549.      
  5550. -- This package provides the procedures for calling the workstation
  5551. -- manager to set the workstation attributes at level ma.
  5552.      
  5553.    procedure SET_COLOUR_REPRESENTATION
  5554.       (WS    : in WS_ID;
  5555.       INDEX  : in COLOUR_INDEX;
  5556.       COLOUR : in COLOUR_REPRESENTATION);
  5557.      
  5558. end SET_COLOUR_TABLE;
  5559. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5560. --:UDD:GKSADACM:CODE:MA:SET_INDV_ATTR_MA.ADA
  5561. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5562. ------------------------------------------------------------------
  5563. --
  5564. --  NAME: SET_INDIVIDUAL_ATTRIBUTES_MA
  5565. --  IDENTIFIER: GIMXXX.1(1)
  5566. --  DISCREPANCY REPORTS:
  5567. --
  5568. ------------------------------------------------------------------
  5569. -- file:  set_indv_attr_ma.ada
  5570. -- level: all levels
  5571.      
  5572. with GKS_TYPES;
  5573.      
  5574. use GKS_TYPES;
  5575.      
  5576. package SET_INDIVIDUAL_ATTRIBUTES_MA is
  5577.      
  5578. -- This package provides the functions for setting the individual
  5579. -- attributes for output primitives.
  5580.      
  5581.    procedure SET_LINETYPE
  5582.       (LINE : in LINETYPE);
  5583.      
  5584.    procedure SET_POLYLINE_COLOUR_INDEX
  5585.       (COLOUR : in COLOUR_INDEX);
  5586.      
  5587.    procedure SET_MARKER_TYPE
  5588.       (MARKER : in MARKER_TYPE);
  5589.      
  5590.    procedure SET_POLYMARKER_COLOUR_INDEX
  5591.       (COLOUR : in COLOUR_INDEX);
  5592.      
  5593.    procedure SET_TEXT_COLOUR_INDEX
  5594.       (COLOUR : in COLOUR_INDEX);
  5595.      
  5596.    procedure SET_FILL_AREA_INTERIOR_STYLE
  5597.       (STYLE : in INTERIOR_STYLE);
  5598.      
  5599.    procedure SET_FILL_AREA_COLOUR_INDEX
  5600.       (COLOUR : in COLOUR_INDEX);
  5601.      
  5602. end SET_INDIVIDUAL_ATTRIBUTES_MA;
  5603. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5604. --:UDD:GKSADACM:CODE:MA:SET_PRIM_ATTR_MA.ADA
  5605. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5606. ------------------------------------------------------------------
  5607. --
  5608. --  NAME: SET_PRIMITIVE_ATTRIBUTES_MA
  5609. --  IDENTIFIER: GIMXXX.1(1)
  5610. --  DISCREPANCY REPORTS:
  5611. --
  5612. ------------------------------------------------------------------
  5613. -- file:  set_prim_attr_ma.ada
  5614. -- level: all levels
  5615.      
  5616. with GKS_TYPES;
  5617.      
  5618. use GKS_TYPES;
  5619.      
  5620. package SET_PRIMITIVE_ATTRIBUTES_MA is
  5621.      
  5622. -- This package provides the procedures for setting the
  5623. -- primitive attribute values for level ma.
  5624.      
  5625.    procedure SET_CHAR_HEIGHT
  5626.       (HEIGHT : in WC.MAGNITUDE);
  5627.      
  5628.    procedure SET_CHAR_UP_VECTOR
  5629.       (CHAR_UP_VECTOR : IN WC.VECTOR);
  5630.      
  5631.    procedure SET_TEXT_ALIGNMENT
  5632.       (ALIGNMENT : in TEXT_ALIGNMENT);
  5633.      
  5634. end SET_PRIMITIVE_ATTRIBUTES_MA;
  5635. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5636. --:UDD:GKSADACM:CODE:MA:WS_CONTROL.ADA
  5637. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5638. ------------------------------------------------------------------
  5639. --
  5640. --  NAME: WS_CONTROL
  5641. --  IDENTIFIER: GIMXXX.1(1)
  5642. --  DISCREPANCY REPORTS:
  5643. --
  5644. ------------------------------------------------------------------
  5645. -- file:  ws_control.ada
  5646. -- level: all levels
  5647.      
  5648. with GKS_TYPES;
  5649.      
  5650. use GKS_TYPES;
  5651.      
  5652. package WS_CONTROL is
  5653.      
  5654. -- This package provides the workstation control functions.
  5655.      
  5656.    procedure OPEN_WS
  5657.       (WS         : in WS_ID;
  5658.        CONNECTION : in CONNECTION_ID;
  5659.        TYPE_OF_WS : in WS_TYPE);
  5660.      
  5661.    procedure CLOSE_WS
  5662.       (WS : in WS_ID);
  5663.      
  5664.    procedure ACTIVATE_WS
  5665.       (WS : in WS_ID);
  5666.      
  5667.    procedure DEACTIVATE_WS
  5668.       (WS : in WS_ID);
  5669.      
  5670.    procedure CLEAR_WS
  5671.       (WS  : in WS_ID;
  5672.       FLAG : in CONTROL_FLAG);
  5673.      
  5674.    procedure UPDATE_WS
  5675.       (WS           : in WS_ID;
  5676.       REGENERATION  : in UPDATE_REGENERATION_FLAG);
  5677.      
  5678. end WS_CONTROL;
  5679. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5680. --:UDD:GKSADACM:CODE:MA:WS_XFORM.ADA
  5681. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5682. ------------------------------------------------------------------
  5683. --
  5684. --  NAME: WS_TRANSFORMATION
  5685. --  IDENTIFIER: GDMXXX.1(1)
  5686. --  DISCREPANCY REPORTS:
  5687. --
  5688. ------------------------------------------------------------------
  5689. -- file:  ws_xform.ada
  5690. -- level: all levels
  5691.      
  5692. with GKS_TYPES;
  5693.      
  5694. use GKS_TYPES;
  5695.      
  5696. package WS_TRANSFORMATION is
  5697.      
  5698. -- This package provides the procedures for calling the
  5699. -- workstation manager to do the workstation transformations.
  5700.      
  5701.    procedure SET_WS_WINDOW
  5702.       (WS              : in WS_ID;
  5703.       WS_WINDOW_LIMITS : in NDC.RECTANGLE_LIMITS);
  5704.      
  5705.    procedure SET_WS_VIEWPORT
  5706.       (WS                : in WS_ID;
  5707.       WS_VIEWPORT_LIMITS : in DC.RECTANGLE_LIMITS);
  5708.      
  5709. end WS_TRANSFORMATION;
  5710. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5711. --:UDD:GKSADACM:CODE:MA:WS_TBL_TYP.ADA
  5712. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5713. -- File: WS_TBL_TYP.ADA
  5714. -- ALL LEVELS
  5715.      
  5716. with GKS_TYPES;
  5717.      
  5718. use GKS_TYPES;
  5719.      
  5720. package WS_TABLE_TYPES is
  5721.      
  5722. -- This package is designed to be `with'ed by the packages
  5723. -- WS_DESCRIPTION_TABLE and WS_STATE_LIST to allow them to use
  5724. -- the types declared here.
  5725.      
  5726.    type POLYLINE_BUNDLE is
  5727.       record
  5728.          L_TYPE  : LINETYPE;
  5729.          L_WIDTH : LINE_WIDTH;
  5730.          COLOUR  : COLOUR_INDEX;
  5731.       end record;
  5732.      
  5733.    type POLYLINE_BUNDLE_LIST is array (POSITIVE range <>)
  5734.                                        of POLYLINE_BUNDLE;
  5735.      
  5736.    type POLYMARKER_BUNDLE is
  5737.       record
  5738.          M_TYPE : MARKER_TYPE;
  5739.          M_SIZE : MARKER_SIZE;
  5740.          COLOUR : COLOUR_INDEX;
  5741.       end record;
  5742.      
  5743.    type POLYMARKER_BUNDLE_LIST is array (POSITIVE range <>)
  5744.                                          of POLYMARKER_BUNDLE;
  5745.      
  5746.    type TEXT_BUNDLE is
  5747.       record
  5748.          TEXT_FONT    : TEXT_FONT_PRECISION;
  5749.          CH_EXPANSION : CHAR_EXPANSION;
  5750.          CH_SPACE     : CHAR_SPACING;
  5751.          COLOUR       : COLOUR_INDEX;
  5752.       end record;
  5753.      
  5754.    type TEXT_BUNDLE_LIST is array (POSITIVE range <>) of TEXT_BUNDLE;
  5755.      
  5756.    type FILL_AREA_BUNDLE is
  5757.       record
  5758.          INT_STYLE : INTERIOR_STYLE;
  5759.          STYLE     : STYLE_INDEX;
  5760.          COLOUR    : COLOUR_INDEX;
  5761.       end record;
  5762.      
  5763.    type FILL_AREA_BUNDLE_LIST is array (POSITIVE range <>)
  5764.                                         of FILL_AREA_BUNDLE;
  5765.      
  5766.    type PATTERN_TABLE_LIST is array (NATURAL range <>)
  5767.                                      of COLOUR_MATRICES
  5768.                                          .VARIABLE_MATRIX_OF;
  5769.      
  5770.    type COLOUR_TABLE_LIST is array (COLOUR_INDEX range <>)
  5771.                                     of COLOUR_REPRESENTATION;
  5772.      
  5773.    type ATTR_USED_LIST is array (GDP_ID range <>)
  5774.                                  of ATTRIBUTES_USED.LIST_OF;
  5775.      
  5776.    subtype MAX_INTENSITIES_TYPE is INTEGER range 2 .. (2 ** 16) - 1;
  5777.      
  5778. end WS_TABLE_TYPES;
  5779. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5780. --:UDD:GKSADACM:CODE:MA:WS_DSCR_TBL_TYP.ADA
  5781. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5782. -- File: ws_dscr_tbl.ada
  5783. -- level ma - 2a
  5784.      
  5785. with GKS_TYPES;
  5786. with WS_TABLE_TYPES;
  5787.      
  5788. use GKS_TYPES;
  5789.      
  5790. package WS_DESCRIPTION_TABLE_TYPES is
  5791.      
  5792. -- All entries are implementation dependent
  5793.      
  5794.    type DYN_MOD_ACCEPTED_FOR_WS_ATTRIBUTES is
  5795.       record
  5796.          POLYLINE_BUNDLE_REP   : DYNAMIC_MODIFICATION;
  5797.          POLYMARKER_BUNDLE_REP : DYNAMIC_MODIFICATION;
  5798.          TEXT_BUNDLE_REP       : DYNAMIC_MODIFICATION;
  5799.          FILL_AREA_BUNDLE_REP  : DYNAMIC_MODIFICATION;
  5800.          PATTERN_REP           : DYNAMIC_MODIFICATION;
  5801.          COLOUR_REP            : DYNAMIC_MODIFICATION;
  5802.          WS_TRANSFORMATION     : DYNAMIC_MODIFICATION;
  5803.       end record;
  5804.      
  5805.    type DYN_MOD_ACCEPTED_FOR_SEGMENT_ATTRIBUTES is
  5806.       record
  5807.          SEGMENT_TRANSFORMATION     : DYNAMIC_MODIFICATION;
  5808.          VISIBILITY_TO_INVISIBLE    : DYNAMIC_MODIFICATION;
  5809.          VISIBILITY_TO_VISIBLE      : DYNAMIC_MODIFICATION;
  5810.          HIGHLIGHTING               : DYNAMIC_MODIFICATION;
  5811.          SEGMENT_PRIORITY           : DYNAMIC_MODIFICATION;
  5812.          ADDING_TO_OBSCURED_SEGMENT : DYNAMIC_MODIFICATION;
  5813.          DELETE_SEGMENT             : DYNAMIC_MODIFICATION;
  5814.       end record;
  5815.      
  5816.    subtype PLIN_INDEX is NATURAL      range 0 .. 5;
  5817.    subtype PMRK_INDEX is NATURAL      range 0 .. 5;
  5818.    subtype TXT_INDEX  is NATURAL      range 0 .. 5;
  5819.    subtype FA_INDEX   is NATURAL      range 0 .. 5;
  5820.    subtype PAT_INDEX  is NATURAL      range 0 .. 0;
  5821.    subtype CLR_INDEX  is COLOUR_INDEX range 0 .. 7;
  5822.    subtype GDP_INDEX  is GDP_ID       range 0 .. 3;
  5823.    -- The subtypes are declared to constrain the size of the
  5824.    -- discriminant components of the record WS_DESCRIPTION_TBL.
  5825.    -- These were put here so as not to raise a STORAGE ERROR at
  5826.    -- the time the object is declared of the type.
  5827.      
  5828.    -- The following record is the WS_DESCRIPTION_TABLE.
  5829.    type WS_DESCRIPTION_TBL
  5830.       (NUM_PREDEFINED_PLIN_BUNDLE   : PLIN_INDEX := 0;
  5831.        NUM_PREDEFINED_PMRK_BUNDLE   : PMRK_INDEX := 0;
  5832.        NUM_PREDEFINED_TEXT_BUNDLE   : TXT_INDEX  := 0;
  5833.        NUM_PREDEFINED_FA_BUNDLE     : FA_INDEX   := 0;
  5834.        NUM_PREDEFINED_PATTERN_TABLE : PAT_INDEX  := 0;
  5835.        LAST_PREDEFINED_COLOUR_REP   : CLR_INDEX  := 0;
  5836.        NUM_OF_GDP_ID                : GDP_INDEX  := 0)
  5837.    is record
  5838.      
  5839.       -- Entries in this group exist for all workstation categories.
  5840.      
  5841.       WORKSTATION_TYPE     : WS_TYPE;
  5842.       WORKSTATION_CATEGORY : WS_CATEGORY;
  5843.      
  5844.       -- Entries in this group exist for OUTPUT, INPUT, OUTIN
  5845.      
  5846.       DEVICE_COOR_UNITS                : DC_UNITS;
  5847.       MAX_DISPLAY_SURFACE_DC_UNITS     : DC.SIZE;
  5848.       MAX_DISPLAY_SURFACE_RASTER_UNITS : RASTER_UNIT_SIZE;
  5849.      
  5850.       -- Entries in this group exist for OUTPUT, OUTIN
  5851.      
  5852.       DISPLAY_TYPE        : DISPLAY_CLASS;
  5853.       WS_DYNAMICS         : DYN_MOD_ACCEPTED_FOR_WS_ATTRIBUTES;
  5854.       DEFER_MODE          : DEFERRAL_MODE;
  5855.       IMPLICIT_REGEN_MODE : REGENERATION_MODE;
  5856.      
  5857.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  5858.       -- linetypes.
  5859.      
  5860.       LIST_AVAILABLE_LTYPE : LINETYPES.LIST_OF;
  5861.       NUM_AVAILABLE_LWIDTH : NATURAL;
  5862.       NOMINAL_LWIDTH       : DC.MAGNITUDE;
  5863.       RANGE_OF_LWIDTH      : DC.RANGE_OF_MAGNITUDES;
  5864.      
  5865.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  5866.       -- polylines.
  5867.      
  5868.       PREDEFINED_PLIN_BUNDLES  : WS_TABLE_TYPES.POLYLINE_BUNDLE_LIST
  5869.             (1..NUM_PREDEFINED_PLIN_BUNDLE);
  5870.      
  5871.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  5872.       -- polymarkers.
  5873.      
  5874.       LIST_AVAILABLE_MARKER_TYPES : MARKER_TYPES.LIST_OF;
  5875.       NUM_AVAILABLE_MARKER_SIZES  : NATURAL;
  5876.       NOMINAL_MARKER_SIZE         : DC.MAGNITUDE;
  5877.       RANGE_OF_MARKER_SIZES       : DC.RANGE_OF_MAGNITUDES;
  5878.      
  5879.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  5880.       -- polymarker bundles.
  5881.       -- It is the list of predefined polymarker bundles.
  5882.      
  5883.       PREDEFINED_PMRK_BUNDLES : WS_TABLE_TYPES.POLYMARKER_BUNDLE_LIST
  5884.             (1..NUM_PREDEFINED_PMRK_BUNDLE);
  5885.      
  5886.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  5887.       -- the list text fonts.
  5888.      
  5889.       LIST_TEXT_FONT_AND_PRECISION :  TEXT_FONT_PRECISIONS.LIST_OF;
  5890.      
  5891.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  5892.       -- characters.
  5893.      
  5894.       NUM_AVAILABLE_CHAR_EXPANSIONS : NATURAL;
  5895.       RANGE_OF_CHAR_EXPANSIONS      : RANGE_OF_EXPANSIONS;
  5896.      
  5897.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  5898.       -- character heights.
  5899.      
  5900.       NUM_AVAILABLE_CHAR_HEIGHTS : NATURAL;
  5901.       RANGE_OF_CHAR_HEIGHTS      : DC.RANGE_OF_MAGNITUDES;
  5902.      
  5903.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  5904.       -- text bundles.
  5905.      
  5906.       PREDEFINED_TEXT_BUNDLES : WS_TABLE_TYPES.TEXT_BUNDLE_LIST
  5907.             (1..NUM_PREDEFINED_TEXT_BUNDLE);
  5908.      
  5909.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  5910.       -- fill areas. It is the list of predefined INTERIOR_STYLES,
  5911.       -- HATCH_STYLES, and FILL_AREA_BUNDLES.
  5912.      
  5913.       LIST_OF_AVAL_INTERIOR_STYLE : INTERIOR_STYLES.LIST_OF;
  5914.       LIST_OF_AVAL_HATCH_STYLE    : HATCH_STYLES.LIST_OF;
  5915.       PREDEFINED_FA_BUNDLES       : WS_TABLE_TYPES.FILL_AREA_BUNDLE_LIST
  5916.             (1..NUM_PREDEFINED_FA_BUNDLE);
  5917.      
  5918.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  5919.       -- pattern tables. It is the list of predefined patterns.
  5920.      
  5921.       PREDEFINED_PATTERN_REP : WS_TABLE_TYPES.PATTERN_TABLE_LIST
  5922.                                   (1..NUM_PREDEFINED_PATTERN_TABLE);
  5923.      
  5924.       -- entries in this group exist for OUTPUT, OUTIN and refer to
  5925.       -- colour tables.
  5926.      
  5927.       MAX_INTENSITIES             : WS_TABLE_TYPES.MAX_INTENSITIES_TYPE;
  5928.       NUM_OF_AVAL_COLOUR_INTENSITY : NATURAL;
  5929.       COLOUR_AVAL                  : COLOUR_AVAILABLE;
  5930.       PREDEFINED_COLOUR_REP        : WS_TABLE_TYPES.COLOUR_TABLE_LIST
  5931.                                         (0..LAST_PREDEFINED_COLOUR_REP);
  5932.      
  5933.       -- entries in this group exist for OUTPUT, OUTIN and refer to
  5934.       -- generalized drawing primitives (GDP)
  5935.      
  5936.       AVAL_GDP  : GDP_IDS.LIST_OF;
  5937.       ATTR_USED : WS_TABLE_TYPES.ATTR_USED_LIST (1 .. NUM_OF_GDP_ID);
  5938.      
  5939.       -- entries in this group exist for OUTPUT, OUTIN and refer to the
  5940.       -- the maximum number of predefined values for this implementation
  5941.      
  5942.       MAX_NUM_PLIN_BUNDLE_TBL_ENTRIES : NATURAL;
  5943.       MAX_NUM_PMRK_BUNDLE_TBL_ENTRIES : NATURAL;
  5944.       MAX_NUM_TEXT_BUNDLE_TBL_ENTRIES : NATURAL;
  5945.       MAX_NUM_FA_BUNDLE_TBL_ENTRIES   : NATURAL;
  5946.       MAX_NUM_PATTERN_INDICES         : NATURAL;
  5947.       MAX_NUM_COLOUR_INDICES          : NATURAL;
  5948.      
  5949.       -- entries in this group exist for OUTPUT, OUTIN and refer to
  5950.       -- segments
  5951.      
  5952.       NUM_OF_SEG_PRIO_SUPPORTED : NATURAL;
  5953.       SEGMENT_DYNAMICS        : DYN_MOD_ACCEPTED_FOR_SEGMENT_ATTRIBUTES;
  5954.      
  5955.    end record;
  5956.      
  5957. end WS_DESCRIPTION_TABLE_TYPES;
  5958. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5959. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_DSCR_MA.ADA
  5960. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5961. ------------------------------------------------------------------
  5962. --
  5963. --  NAME: WSR_INQ_WS_DESCRIPTION_TABLE_MA
  5964. --  IDENTIFIER: GDMXXX.1(1)
  5965. --  DISCREPANCY REPORTS:
  5966. --
  5967. ------------------------------------------------------------------
  5968. -- File:  WSR_INQ_WS_DSCR_MA.ADA
  5969. -- Level: MA
  5970.      
  5971. with GKS_TYPES;
  5972. with WS_DESCRIPTION_TABLE_TYPES;
  5973.      
  5974. use GKS_TYPES;
  5975.      
  5976. package WSR_INQ_WS_DESCRIPTION_TABLE_MA is
  5977.      
  5978. -- Package GKS_TYPES provides type definitions for the return
  5979. -- parameters.
  5980.      
  5981. -- Package WS_DESCRIPTION_TABLE_TYPES provides type definition for the
  5982. -- Workstation Description Table parameter.
  5983.      
  5984. procedure INQ_DISPLAY_SPACE_SIZE
  5985.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  5986.                                      WS_DESCRIPTION_TBL;
  5987.        DC_UNITS             :    out GKS_TYPES . DC_UNITS;
  5988.        MAX_DC_SIZE          :    out DC . SIZE;
  5989.        MAX_RASTER_UNIT_SIZE :    out RASTER_UNIT_SIZE);
  5990.      
  5991.    procedure INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  5992.       (WS_DT                  : in     WS_DESCRIPTION_TABLE_TYPES .
  5993.                                        WS_DESCRIPTION_TBL;
  5994.        MAX_POLYLINE_ENTRIES   :    out NATURAL;
  5995.        MAX_POLYMARKER_ENTRIES :    out NATURAL;
  5996.        MAX_TEXT_ENTRIES       :    out NATURAL;
  5997.        MAX_FILL_AREA_ENTRIES  :    out NATURAL;
  5998.        MAX_PATTERN_INDICES    :    out NATURAL;
  5999.        MAX_COLOUR_INDICES     :    out NATURAL);
  6000.      
  6001.    procedure INQ_POLYLINE_FACILITIES
  6002.       (WS_DT             : in     WS_DESCRIPTION_TABLE_TYPES .
  6003.                                   WS_DESCRIPTION_TBL;
  6004.        LIST_OF_LINETYPES :    out LINETYPES . LIST_OF;
  6005.        NUMBER_OF_WIDTHS  :    out NATURAL;
  6006.        NOMINAL_WIDTH     :    out DC . MAGNITUDE;
  6007.        RANGE_OF_WIDTHS   :    out DC . RANGE_OF_MAGNITUDES;
  6008.        NUMBER_OF_INDICES :    out NATURAL);
  6009.      
  6010.    procedure INQ_POLYMARKER_FACILITIES
  6011.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  6012.                                      WS_DESCRIPTION_TBL;
  6013.        LIST_OF_MARKER_TYPES :    out MARKER_TYPES . LIST_OF;
  6014.        NUMBER_OF_SIZES      :    out NATURAL;
  6015.        NOMINAL_SIZE         :    out DC . MAGNITUDE;
  6016.        RANGE_OF_SIZES       :    out DC . RANGE_OF_MAGNITUDES;
  6017.        NUMBER_OF_INDICES    :    out NATURAL);
  6018.      
  6019.    procedure INQ_TEXT_FACILITIES
  6020.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  6021.                                      WS_DESCRIPTION_TBL;
  6022.        LIST_OF_FONT_PRECISION_PAIRS :    out TEXT_FONT_PRECISIONS .
  6023.                                                  LIST_OF;
  6024.        NUMBER_OF_HEIGHTS            :    out NATURAL;
  6025.        RANGE_OF_HEIGHTS             :    out DC . RANGE_OF_MAGNITUDES;
  6026.        NUMBER_OF_EXPANSIONS         :    out NATURAL;
  6027.        RANGE_OF_CHAR_EXPANSIONS     :    out RANGE_OF_EXPANSIONS;
  6028.        NUMBER_OF_INDICES            :    out NATURAL);
  6029.      
  6030.    procedure INQ_FILL_AREA_FACILITIES
  6031.       (WS_DT                   : in     WS_DESCRIPTION_TABLE_TYPES .
  6032.                                         WS_DESCRIPTION_TBL;
  6033.        LIST_OF_INTERIOR_STYLES :    out INTERIOR_STYLES . LIST_OF;
  6034.        LIST_OF_HATCH_STYLES    :    out HATCH_STYLES . LIST_OF;
  6035.        NUMBER_OF_INDICES       :    out NATURAL);
  6036.      
  6037.    procedure INQ_COLOUR_FACILITIES
  6038.       (WS_DT             : in     WS_DESCRIPTION_TABLE_TYPES .
  6039.                                   WS_DESCRIPTION_TBL;
  6040.        NUMBER_OF_COLOURS :    out NATURAL;
  6041.        AVAILABLE_COLOUR  :    out COLOUR_AVAILABLE;
  6042.        NUMBER_OF_INDICES :    out NATURAL);
  6043.      
  6044. end WSR_INQ_WS_DESCRIPTION_TABLE_MA;
  6045. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6046. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_DSCR_MA_B.ADA
  6047. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6048. ------------------------------------------------------------------
  6049. --
  6050. --  NAME: WSR_INQ_WS_DESCRIPTION_MA - BODY
  6051. --  IDENTIFIER: GDMXXX.1(1)
  6052. --  DISCREPANCY REPORTS:
  6053. --
  6054. ------------------------------------------------------------------
  6055. -- File:  WSR_INQ_WS_DSCR_MA_B.ADA
  6056. -- Level: MA, 0A, 1A, 2A
  6057.      
  6058. package body WSR_INQ_WS_DESCRIPTION_TABLE_MA is
  6059.      
  6060. -- The procedures in this package provide a convenient mechanism for
  6061. -- returning groups of values from the Workstation Description Table.
  6062.      
  6063.    use GKS_TYPES;
  6064.      
  6065.    procedure INQ_DISPLAY_SPACE_SIZE
  6066.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  6067.                                      WS_DESCRIPTION_TBL;
  6068.        DC_UNITS             :    out GKS_TYPES . DC_UNITS;
  6069.        MAX_DC_SIZE          :    out DC . SIZE;
  6070.        MAX_RASTER_UNIT_SIZE :    out RASTER_UNIT_SIZE) is
  6071.      
  6072.    begin
  6073.      
  6074.       DC_UNITS             := WS_DT . DEVICE_COOR_UNITS;
  6075.       MAX_DC_SIZE          := WS_DT . MAX_DISPLAY_SURFACE_DC_UNITS;
  6076.       MAX_RASTER_UNIT_SIZE := WS_DT . MAX_DISPLAY_SURFACE_RASTER_UNITS;
  6077.      
  6078.    end INQ_DISPLAY_SPACE_SIZE;
  6079.      
  6080.    procedure INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  6081.       (WS_DT                  : in     WS_DESCRIPTION_TABLE_TYPES .
  6082.                                        WS_DESCRIPTION_TBL;
  6083.        MAX_POLYLINE_ENTRIES   :    out NATURAL;
  6084.        MAX_POLYMARKER_ENTRIES :    out NATURAL;
  6085.        MAX_TEXT_ENTRIES       :    out NATURAL;
  6086.        MAX_FILL_AREA_ENTRIES  :    out NATURAL;
  6087.        MAX_PATTERN_INDICES    :    out NATURAL;
  6088.        MAX_COLOUR_INDICES     :    out NATURAL) is
  6089.      
  6090.    begin
  6091.      
  6092.       MAX_POLYLINE_ENTRIES :=
  6093.             WS_DT . MAX_NUM_PLIN_BUNDLE_TBL_ENTRIES;
  6094.      
  6095.       MAX_POLYMARKER_ENTRIES :=
  6096.             WS_DT . MAX_NUM_PMRK_BUNDLE_TBL_ENTRIES;
  6097.      
  6098.       MAX_TEXT_ENTRIES :=
  6099.             WS_DT . MAX_NUM_TEXT_BUNDLE_TBL_ENTRIES;
  6100.      
  6101.       MAX_FILL_AREA_ENTRIES :=
  6102.             WS_DT . MAX_NUM_FA_BUNDLE_TBL_ENTRIES;
  6103.      
  6104.       MAX_PATTERN_INDICES :=
  6105.             WS_DT . MAX_NUM_PATTERN_INDICES;
  6106.      
  6107.       MAX_COLOUR_INDICES :=
  6108.             WS_DT . MAX_NUM_COLOUR_INDICES;
  6109.      
  6110.    end INQ_MAX_LENGTH_OF_WS_STATE_TABLES;
  6111.      
  6112.    procedure INQ_POLYLINE_FACILITIES
  6113.       (WS_DT             : in     WS_DESCRIPTION_TABLE_TYPES .
  6114.                                   WS_DESCRIPTION_TBL;
  6115.        LIST_OF_LINETYPES :    out LINETYPES . LIST_OF;
  6116.        NUMBER_OF_WIDTHS  :    out NATURAL;
  6117.        NOMINAL_WIDTH     :    out DC . MAGNITUDE;
  6118.        RANGE_OF_WIDTHS   :    out DC . RANGE_OF_MAGNITUDES;
  6119.        NUMBER_OF_INDICES :    out NATURAL) is
  6120.      
  6121.    begin
  6122.      
  6123.       LIST_OF_LINETYPES := WS_DT . LIST_AVAILABLE_LTYPE;
  6124.       NUMBER_OF_WIDTHS  := WS_DT . NUM_AVAILABLE_LWIDTH;
  6125.       NOMINAL_WIDTH     := WS_DT . NOMINAL_LWIDTH;
  6126.       RANGE_OF_WIDTHS   := WS_DT . RANGE_OF_LWIDTH;
  6127.       NUMBER_OF_INDICES := WS_DT . NUM_PREDEFINED_PLIN_BUNDLE;
  6128.      
  6129.    end INQ_POLYLINE_FACILITIES;
  6130.      
  6131.      
  6132.    procedure INQ_POLYMARKER_FACILITIES
  6133.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  6134.                                      WS_DESCRIPTION_TBL;
  6135.        LIST_OF_MARKER_TYPES :    out MARKER_TYPES . LIST_OF;
  6136.        NUMBER_OF_SIZES      :    out NATURAL;
  6137.        NOMINAL_SIZE         :    out DC . MAGNITUDE;
  6138.        RANGE_OF_SIZES       :    out DC . RANGE_OF_MAGNITUDES;
  6139.        NUMBER_OF_INDICES    :    out NATURAL) is
  6140.      
  6141.    begin
  6142.      
  6143.       LIST_OF_MARKER_TYPES := WS_DT . LIST_AVAILABLE_MARKER_TYPES;
  6144.       NUMBER_OF_SIZES      := WS_DT . NUM_AVAILABLE_MARKER_SIZES;
  6145.       NOMINAL_SIZE         := WS_DT . NOMINAL_MARKER_SIZE;
  6146.       RANGE_OF_SIZES       := WS_DT . RANGE_OF_MARKER_SIZES;
  6147.       NUMBER_OF_INDICES    := WS_DT . NUM_PREDEFINED_PMRK_BUNDLE;
  6148.      
  6149.    end INQ_POLYMARKER_FACILITIES;
  6150.      
  6151.    procedure INQ_TEXT_FACILITIES
  6152.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  6153.                                      WS_DESCRIPTION_TBL;
  6154.        LIST_OF_FONT_PRECISION_PAIRS :    out TEXT_FONT_PRECISIONS .
  6155.                                                  LIST_OF;
  6156.        NUMBER_OF_HEIGHTS        :    out NATURAL;
  6157.        RANGE_OF_HEIGHTS         :    out DC . RANGE_OF_MAGNITUDES;
  6158.        NUMBER_OF_EXPANSIONS     :    out NATURAL;
  6159.        RANGE_OF_CHAR_EXPANSIONS :    out RANGE_OF_EXPANSIONS;
  6160.        NUMBER_OF_INDICES        :    out NATURAL) is
  6161.      
  6162.    begin
  6163.      
  6164.       LIST_OF_FONT_PRECISION_PAIRS :=
  6165.             WS_DT . LIST_TEXT_FONT_AND_PRECISION;
  6166.      
  6167.       NUMBER_OF_HEIGHTS        := WS_DT . NUM_AVAILABLE_CHAR_HEIGHTS;
  6168.      
  6169.       RANGE_OF_HEIGHTS         := WS_DT . RANGE_OF_CHAR_HEIGHTS;
  6170.      
  6171.       NUMBER_OF_EXPANSIONS     := WS_DT . NUM_AVAILABLE_CHAR_EXPANSIONS;
  6172.      
  6173.       RANGE_OF_CHAR_EXPANSIONS := WS_DT . RANGE_OF_CHAR_EXPANSIONS;
  6174.      
  6175.       NUMBER_OF_INDICES        := WS_DT . NUM_PREDEFINED_TEXT_BUNDLE;
  6176.      
  6177.    end INQ_TEXT_FACILITIES;
  6178.      
  6179.    procedure INQ_FILL_AREA_FACILITIES
  6180.       (WS_DT                   : in     WS_DESCRIPTION_TABLE_TYPES .
  6181.                                         WS_DESCRIPTION_TBL;
  6182.        LIST_OF_INTERIOR_STYLES :    out INTERIOR_STYLES . LIST_OF;
  6183.        LIST_OF_HATCH_STYLES    :    out HATCH_STYLES . LIST_OF;
  6184.        NUMBER_OF_INDICES       :    out NATURAL) is
  6185.      
  6186.    begin
  6187.      
  6188.       LIST_OF_INTERIOR_STYLES := WS_DT . LIST_OF_AVAL_INTERIOR_STYLE;
  6189.       LIST_OF_HATCH_STYLES    := WS_DT . LIST_OF_AVAL_HATCH_STYLE;
  6190.       NUMBER_OF_INDICES       := WS_DT . NUM_PREDEFINED_FA_BUNDLE;
  6191.      
  6192.    end INQ_FILL_AREA_FACILITIES;
  6193.      
  6194.    procedure INQ_COLOUR_FACILITIES
  6195.       (WS_DT             : in     WS_DESCRIPTION_TABLE_TYPES .
  6196.                                   WS_DESCRIPTION_TBL;
  6197.        NUMBER_OF_COLOURS :    out NATURAL;
  6198.        AVAILABLE_COLOUR  :    out COLOUR_AVAILABLE;
  6199.        NUMBER_OF_INDICES :    out NATURAL) is
  6200.      
  6201.    begin
  6202.      
  6203.       NUMBER_OF_COLOURS := WS_DT . NUM_OF_AVAL_COLOUR_INTENSITY;
  6204.       AVAILABLE_COLOUR  := WS_DT . COLOUR_AVAL;
  6205.       NUMBER_OF_INDICES := NATURAL(WS_DT . LAST_PREDEFINED_COLOUR_REP + 1);
  6206.      
  6207.    end INQ_COLOUR_FACILITIES;
  6208.      
  6209. end WSR_INQ_WS_DESCRIPTION_TABLE_MA;
  6210. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6211. --:UDD:GKSADACM:CODE:MA:RECTANGLE_OPS.ADA
  6212. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6213. ------------------------------------------------------------------
  6214. --
  6215. --  NAME: RECTANGLE_LIMITS_OPS
  6216. --  IDENTIFIER: GDMXXX.1(1)
  6217. --  DISCREPANCY REPORTS:
  6218. --
  6219. ------------------------------------------------------------------
  6220. -- File: RECTANGLE_OPS.ADA
  6221. -- Level: all
  6222.      
  6223. generic
  6224.    type COORDINATE is digits <>;
  6225.      
  6226.    type RECTANGLE_LIMITS is private;
  6227.      
  6228.    with function XMIN(R : in RECTANGLE_LIMITS) return COORDINATE is <>;
  6229.    with function XMAX(R : in RECTANGLE_LIMITS) return COORDINATE is <>;
  6230.    with function YMIN(R : in RECTANGLE_LIMITS) return COORDINATE is <>;
  6231.    with function YMAX(R : in RECTANGLE_LIMITS) return COORDINATE is <>;
  6232.    with function RECTANGLE_LIMITS_MAKE
  6233.       (XMIN : in     COORDINATE;
  6234.        XMAX : in     COORDINATE;
  6235.        YMIN : in     COORDINATE;
  6236.        YMAX : in     COORDINATE) return  RECTANGLE_LIMITS is <>;
  6237.      
  6238. package RECTANGLE_LIMITS_OPS is
  6239.      
  6240.    UNIT_SQR : constant RECTANGLE_LIMITS :=
  6241.       RECTANGLE_LIMITS_MAKE
  6242.          (XMIN => 0.0, XMAX => 1.0,
  6243.           YMIN => 0.0, YMAX => 1.0);
  6244.      
  6245.    function IS_VALID
  6246.       (A : in     RECTANGLE_LIMITS) return BOOLEAN;
  6247.      
  6248.    function "<"
  6249.       (A : in     RECTANGLE_LIMITS;
  6250.        B : in     RECTANGLE_LIMITS) return BOOLEAN;
  6251.      
  6252.    function "<="
  6253.       (A : in     RECTANGLE_LIMITS;
  6254.        B : in     RECTANGLE_LIMITS) return BOOLEAN;
  6255.      
  6256.    function ">="
  6257.       (A : in     RECTANGLE_LIMITS;
  6258.        B : in     RECTANGLE_LIMITS) return BOOLEAN;
  6259.      
  6260.    function ">"
  6261.       (A : in     RECTANGLE_LIMITS;
  6262.        B : in     RECTANGLE_LIMITS) return BOOLEAN;
  6263.      
  6264.    function "or"
  6265.       (A : in     RECTANGLE_LIMITS;
  6266.        B : in     RECTANGLE_LIMITS) return RECTANGLE_LIMITS;
  6267.      
  6268.    function "and"
  6269.       (A : in     RECTANGLE_LIMITS;
  6270.        B : in     RECTANGLE_LIMITS) return RECTANGLE_LIMITS;
  6271.      
  6272. end RECTANGLE_LIMITS_OPS;
  6273. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6274. --:UDD:GKSADACM:CODE:MA:RECTANGLE_OPS_B.ADA
  6275. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6276. ------------------------------------------------------------------
  6277. --
  6278. --  NAME: RECTANGLE_LIMITS_OPS - BODY
  6279. --  IDENTIFIER: GDMXXX.1(1)
  6280. --  DISCREPANCY REPORTS:
  6281. --
  6282. ------------------------------------------------------------------
  6283. -- File: RECTANGLE_OPS_B.ADA
  6284. -- Level: all
  6285.      
  6286. package body RECTANGLE_LIMITS_OPS is
  6287.      
  6288. -- Package RECTANGLE_LIMITS_OPS provides functions useful in
  6289. -- comparing rectangles instantiated from the GKS_COORDINATE_SYSTEM
  6290. -- package.  To allow this package to be generic, it is necessary to
  6291. -- augment the record type RECTANGLE_LIMITS with access and aggregate
  6292. -- functions since the components are not visible here.
  6293.      
  6294.    -- Auxiliary function specificiations
  6295.      
  6296.    function MIN
  6297.       (A : in     COORDINATE;
  6298.        B : in     COORDINATE) return COORDINATE;
  6299.      
  6300.    function MAX
  6301.       (A : in     COORDINATE;
  6302.        B : in     COORDINATE) return COORDINATE;
  6303.      
  6304.    -- Implementations of subprograms in the package specification
  6305.      
  6306.    function IS_VALID
  6307.       (A : in     RECTANGLE_LIMITS) return BOOLEAN is
  6308.    -- Predicate returning `TRUE' when `A' is a positive rectangle.
  6309.      
  6310.    begin
  6311.      
  6312.       return XMIN(A) < XMAX(A) and then YMIN(A) < YMAX(A);
  6313.      
  6314.    end IS_VALID;
  6315.      
  6316.    function "<"
  6317.       (A : in     RECTANGLE_LIMITS;
  6318.        B : in     RECTANGLE_LIMITS) return BOOLEAN is
  6319.    -- Predicate returning `TRUE' when `A' is a proper subset of `B'.
  6320.      
  6321.    begin
  6322.      
  6323.       return   XMIN(B) < XMIN(A) and then XMAX(A) < XMAX(B)
  6324.       and then YMIN(B) < YMIN(A) and then YMAX(A) < YMAX(B);
  6325.      
  6326.    end "<";
  6327.      
  6328.    function "<="
  6329.       (A : in     RECTANGLE_LIMITS;
  6330.        B : in     RECTANGLE_LIMITS) return BOOLEAN is
  6331.    -- Predicate returning `TRUE' when `A' completely contained in `B'.
  6332.      
  6333.    begin
  6334.      
  6335.       return   XMIN(B) <= XMIN(A) and then XMAX(A) <= XMAX(B)
  6336.       and then YMIN(B) <= YMIN(A) and then YMAX(A) <= YMAX(B);
  6337.      
  6338.    end "<=";
  6339.      
  6340.    function ">="
  6341.       (A : in     RECTANGLE_LIMITS;
  6342.        B : in     RECTANGLE_LIMITS) return BOOLEAN is
  6343.    -- Predicate returning `TRUE' when `B' completely contained in `A'.
  6344.      
  6345.    begin
  6346.      
  6347.       return   XMIN(B) >= XMIN(A) and then XMAX(A) >= XMAX(B)
  6348.       and then YMIN(B) >= YMIN(A) and then YMAX(A) >= YMAX(B);
  6349.      
  6350.    end ">=";
  6351.      
  6352.    function ">"
  6353.       (A : in     RECTANGLE_LIMITS;
  6354.        B : in     RECTANGLE_LIMITS) return BOOLEAN is
  6355.    -- Predicate returning `TRUE' when `B' is a proper subset of `A'.
  6356.      
  6357.    begin
  6358.      
  6359.       return   XMIN(B) > XMIN(A) and then XMAX(A) > XMAX(B)
  6360.       and then YMIN(B) > YMIN(A) and then YMAX(A) > YMAX(B);
  6361.      
  6362.    end ">";
  6363.      
  6364.    function "or"
  6365.       (A : in     RECTANGLE_LIMITS;
  6366.        B : in     RECTANGLE_LIMITS) return RECTANGLE_LIMITS is
  6367.    -- Returns a RECTANGLE_LIMITS "enclosing" both `A' and `B'.
  6368.    -- Let `R' be the returned RECTANGLE_LIMITS.  Then the following
  6369.    -- predicate holds:  A <= R and B <= R.
  6370.      
  6371.    begin
  6372.      
  6373.       return RECTANGLE_LIMITS_MAKE (
  6374.             XMIN => MIN( XMIN(A) , XMIN(B) ),
  6375.             XMAX => MAX( XMAX(A) , XMAX(B) ),
  6376.             YMIN => MIN( YMIN(A) , YMIN(B) ),
  6377.             YMAX => MAX( YMAX(A) , YMAX(B) ));
  6378.      
  6379.    end "or";
  6380.      
  6381.    function "and"
  6382.       (A : in     RECTANGLE_LIMITS;
  6383.        B : in     RECTANGLE_LIMITS) return RECTANGLE_LIMITS is
  6384.    -- Returns a RECTANGLE_LIMITS "enclosed" by both `A' and `B'.
  6385.    -- Let `R' be the returned RECTANGLE_LIMITS.  Then the following
  6386.    -- predicate holds:  R <= A and R <= B.
  6387.      
  6388.    begin
  6389.      
  6390.       return RECTANGLE_LIMITS_MAKE (
  6391.             XMIN => MAX( XMIN(A) , XMIN(B) ),
  6392.             XMAX => MIN( XMAX(A) , XMAX(B) ),
  6393.             YMIN => MAX( YMIN(A) , YMIN(B) ),
  6394.             YMAX => MIN( YMAX(A) , YMAX(B) ));
  6395.      
  6396.    end "and";
  6397.      
  6398.    function MIN
  6399.       (A : in     COORDINATE;
  6400.        B : in     COORDINATE) return COORDINATE is
  6401.    -- Returns the minimum of `A' and `B'.
  6402.    -- Let `C' be the returned COORDINATE.  Then the following
  6403.    -- predicate holds:  C <= A and C <= B.
  6404.      
  6405.    begin
  6406.      
  6407.       if A < B then
  6408.          return A;
  6409.       else
  6410.          return B;
  6411.       end if;
  6412.      
  6413.    end MIN;
  6414.      
  6415.    function MAX
  6416.       (A : in     COORDINATE;
  6417.        B : in     COORDINATE) return COORDINATE is
  6418.    -- Returns the maximum of `A' and `B'.
  6419.    -- Let `C' be the returned COORDINATE.  Then the following
  6420.    -- predicate holds:  A <= C and B <= C.
  6421.      
  6422.    begin
  6423.      
  6424.       if B < A then
  6425.          return A;
  6426.       else
  6427.          return B;
  6428.       end if;
  6429.      
  6430.    end MAX;
  6431.      
  6432. end RECTANGLE_LIMITS_OPS;
  6433. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6434. --:UDD:GKSADACM:CODE:MA:DC_OPS_DEFS.ADA
  6435. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6436. ------------------------------------------------------------------
  6437. --
  6438. --  NAME: DC_OPS_DEFS
  6439. --  IDENTIFIER: GDMXXX.1(1)
  6440. --  DISCREPANCY REPORTS:
  6441. --
  6442. ------------------------------------------------------------------
  6443. -- File: DC_OPS_DEFS.ADA
  6444. -- Level: all
  6445.      
  6446. with GKS_TYPES;
  6447.      
  6448. use GKS_TYPES;
  6449.      
  6450. package DC_OPS_DEFS is
  6451.      
  6452.    -- Access
  6453.      
  6454.    function XMIN
  6455.       (RECT : in     DC . RECTANGLE_LIMITS) return DC_TYPE;
  6456.      
  6457.    function XMAX
  6458.       (RECT : in     DC . RECTANGLE_LIMITS) return DC_TYPE;
  6459.      
  6460.    function YMIN
  6461.       (RECT : in     DC . RECTANGLE_LIMITS) return DC_TYPE;
  6462.      
  6463.    function YMAX
  6464.       (RECT : in     DC . RECTANGLE_LIMITS) return DC_TYPE;
  6465.      
  6466.    -- Assignment
  6467.      
  6468.    procedure SET_XMIN
  6469.       (RECT  : in out DC . RECTANGLE_LIMITS;
  6470.        COORD : in     DC_TYPE);
  6471.      
  6472.    procedure SET_XMAX
  6473.       (RECT  : in out DC . RECTANGLE_LIMITS;
  6474.        COORD : in     DC_TYPE);
  6475.      
  6476.    procedure SET_YMIN
  6477.       (RECT  : in out DC . RECTANGLE_LIMITS;
  6478.        COORD : in     DC_TYPE);
  6479.      
  6480.    procedure SET_YMAX
  6481.       (RECT  : in out DC . RECTANGLE_LIMITS;
  6482.        COORD : in     DC_TYPE);
  6483.      
  6484.    -- Aggregate
  6485.      
  6486.    function RECTANGLE_LIMITS_MAKE
  6487.       (XMIN : in     DC_TYPE;
  6488.        XMAX : in     DC_TYPE;
  6489.        YMIN : in     DC_TYPE;
  6490.        YMAX : in     DC_TYPE)
  6491.        return  DC . RECTANGLE_LIMITS;
  6492.      
  6493. end DC_OPS_DEFS;
  6494. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6495. --:UDD:GKSADACM:CODE:MA:DC_OPS_DEFS_B.ADA
  6496. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6497. ------------------------------------------------------------------
  6498. --
  6499. --  NAME: DC_OPS_DEFS - BODY
  6500. --  IDENTIFIER: GDMXXX.1(1)
  6501. --  DISCREPANCY REPORTS:
  6502. --
  6503. ------------------------------------------------------------------
  6504. -- File: DC_OPS_DEFS_B.ADA
  6505. -- Level: all
  6506.      
  6507. package body DC_OPS_DEFS is
  6508.      
  6509.    -- Access functions provide functions to be used in a generic
  6510.    -- instantiation to access the values of components of the record.
  6511.    -- The name of each function is the name of its component.
  6512.      
  6513.    function XMIN
  6514.       (RECT : in     DC . RECTANGLE_LIMITS)
  6515.       return DC_TYPE is
  6516.    -- Return the XMIN component of RECT.
  6517.      
  6518.    begin
  6519.      
  6520.       return RECT . XMIN;
  6521.      
  6522.    end XMIN;
  6523.      
  6524.    function XMAX
  6525.       (RECT : in     DC . RECTANGLE_LIMITS)
  6526.       return DC_TYPE is
  6527.    -- Return the XMAX component of RECT.
  6528.      
  6529.    begin
  6530.      
  6531.       return RECT . XMAX;
  6532.      
  6533.    end XMAX;
  6534.      
  6535.    function YMIN
  6536.       (RECT : in     DC . RECTANGLE_LIMITS)
  6537.       return DC_TYPE is
  6538.    -- Return the YMIN component of RECT.
  6539.      
  6540.    begin
  6541.      
  6542.       return RECT . YMIN;
  6543.      
  6544.    end YMIN;
  6545.      
  6546.    function YMAX
  6547.       (RECT : in     DC . RECTANGLE_LIMITS)
  6548.       return DC_TYPE is
  6549.    -- Return the YMAX component of RECT.
  6550.      
  6551.    begin
  6552.      
  6553.       return RECT . YMAX;
  6554.      
  6555.    end YMAX;
  6556.      
  6557.    -- Assignment functions provide functions to be used in a generic
  6558.    -- instantiation to assign new values to components of the record.
  6559.    -- The name of each function is `SET_' & the name of its component.
  6560.      
  6561.    procedure SET_XMIN
  6562.       (RECT  : in out DC . RECTANGLE_LIMITS;
  6563.        COORD : in     DC_TYPE) is
  6564.    -- Assign COORD to the XMIN component of RECT.
  6565.      
  6566.    begin
  6567.      
  6568.       RECT . XMIN := COORD;
  6569.      
  6570.    end SET_XMIN;
  6571.      
  6572.    procedure SET_XMAX
  6573.       (RECT  : in out DC . RECTANGLE_LIMITS;
  6574.        COORD : in     DC_TYPE) is
  6575.    -- Assign COORD to the XMAX component of RECT.
  6576.      
  6577.    begin
  6578.      
  6579.       RECT . XMAX := COORD;
  6580.      
  6581.    end SET_XMAX;
  6582.      
  6583.    procedure SET_YMIN
  6584.       (RECT  : in out DC . RECTANGLE_LIMITS;
  6585.        COORD : in     DC_TYPE) is
  6586.    -- Assign COORD to the YMIN component of RECT.
  6587.      
  6588.    begin
  6589.      
  6590.       RECT . YMIN := COORD;
  6591.      
  6592.    end SET_YMIN;
  6593.      
  6594.    procedure SET_YMAX
  6595.       (RECT  : in out DC . RECTANGLE_LIMITS;
  6596.        COORD : in     DC_TYPE) is
  6597.    -- Assign COORD to the YMAX component of RECT.
  6598.      
  6599.    begin
  6600.      
  6601.       RECT . YMAX := COORD;
  6602.      
  6603.    end SET_YMAX;
  6604.      
  6605.    -- Aggregate
  6606.      
  6607.    function RECTANGLE_LIMITS_MAKE
  6608.       (XMIN : in     DC_TYPE;
  6609.        XMAX : in     DC_TYPE;
  6610.        YMIN : in     DC_TYPE;
  6611.        YMAX : in     DC_TYPE)
  6612.        return  DC . RECTANGLE_LIMITS is
  6613.    -- Return a rectangle formed from the corresponding input parameters.
  6614.      
  6615.    begin
  6616.      
  6617.       return DC . RECTANGLE_LIMITS'
  6618.          (XMIN => XMIN,
  6619.           XMAX => XMAX,
  6620.           YMIN => YMIN,
  6621.           YMAX => YMAX);
  6622.      
  6623.    end RECTANGLE_LIMITS_MAKE;
  6624.      
  6625. end DC_OPS_DEFS;
  6626. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6627. --:UDD:GKSADACM:CODE:MA:DC_OPS.ADA
  6628. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6629. ------------------------------------------------------------------
  6630. --
  6631. --  NAME: DC_OPS
  6632. --  IDENTIFIER: GDMXXX.1(1)
  6633. --  DISCREPANCY REPORTS:
  6634. --
  6635. ------------------------------------------------------------------
  6636. -- File: DC_OPS.ADA
  6637. -- Level: all
  6638.      
  6639. with RECTANGLE_LIMITS_OPS;
  6640. with GKS_TYPES;
  6641. with DC_OPS_DEFS;
  6642.      
  6643. use GKS_TYPES;
  6644.      
  6645. package DC_OPS is new RECTANGLE_LIMITS_OPS
  6646.    (COORDINATE            => DC_TYPE,
  6647.     RECTANGLE_LIMITS      => DC . RECTANGLE_LIMITS,
  6648.     XMIN                  => DC_OPS_DEFS . XMIN,
  6649.     XMAX                  => DC_OPS_DEFS . XMAX,
  6650.     YMIN                  => DC_OPS_DEFS . YMIN,
  6651.     YMAX                  => DC_OPS_DEFS . YMAX,
  6652.     RECTANGLE_LIMITS_MAKE => DC_OPS_DEFS . RECTANGLE_LIMITS_MAKE);
  6653.      
  6654. -- Package GKS_TYPES defines the DC_TYPE and the DC package.
  6655. -- Package DC_OPS_DEFS defines the access and aggregate subprograms
  6656. -- needed to instantiate RECTANGLE_LIMITS_OPS.
  6657. -- Package RECTANGLE_LIMITS_OPS is a generic package which defines
  6658. -- relational operations on rectangles.
  6659. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6660. --:UDD:GKSADACM:CODE:MA:NDC_OPS_DEFS.ADA
  6661. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6662. ------------------------------------------------------------------
  6663. --
  6664. --  NAME: NDC_OPS_DEFS
  6665. --  IDENTIFIER: GDMXXX.1(1)
  6666. --  DISCREPANCY REPORTS:
  6667. --
  6668. ------------------------------------------------------------------
  6669. -- File: NDC_OPS_DEFS.ADA
  6670. -- Level: all
  6671.      
  6672. with GKS_TYPES;
  6673.      
  6674. use GKS_TYPES;
  6675.      
  6676. package NDC_OPS_DEFS is
  6677.      
  6678.    -- Access
  6679.      
  6680.    function XMIN
  6681.       (RECT : in     NDC . RECTANGLE_LIMITS) return NDC_TYPE;
  6682.      
  6683.    function XMAX
  6684.       (RECT : in     NDC . RECTANGLE_LIMITS) return NDC_TYPE;
  6685.      
  6686.    function YMIN
  6687.       (RECT : in     NDC . RECTANGLE_LIMITS) return NDC_TYPE;
  6688.      
  6689.    function YMAX
  6690.       (RECT : in     NDC . RECTANGLE_LIMITS) return NDC_TYPE;
  6691.      
  6692.    -- Assignment
  6693.      
  6694.    procedure SET_XMIN
  6695.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  6696.        COORD : in     NDC_TYPE);
  6697.      
  6698.    procedure SET_XMAX
  6699.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  6700.        COORD : in     NDC_TYPE);
  6701.      
  6702.    procedure SET_YMIN
  6703.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  6704.        COORD : in     NDC_TYPE);
  6705.      
  6706.    procedure SET_YMAX
  6707.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  6708.        COORD : in     NDC_TYPE);
  6709.      
  6710.    -- Aggregate
  6711.      
  6712.    function RECTANGLE_LIMITS_MAKE
  6713.       (XMIN : in     NDC_TYPE;
  6714.        XMAX : in     NDC_TYPE;
  6715.        YMIN : in     NDC_TYPE;
  6716.        YMAX : in     NDC_TYPE)
  6717.        return  NDC . RECTANGLE_LIMITS;
  6718.      
  6719. end NDC_OPS_DEFS;
  6720. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6721. --:UDD:GKSADACM:CODE:MA:NDC_OPS_DEFS_B.ADA
  6722. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6723. ------------------------------------------------------------------
  6724. --
  6725. --  NAME: NDC_OPS_DEFS - BODY
  6726. --  IDENTIFIER: GDMXXX.1(1)
  6727. --  DISCREPANCY REPORTS:
  6728. --
  6729. ------------------------------------------------------------------
  6730. -- File: NDC_OPS_DEFS_B.ADA
  6731. -- Level: all
  6732.      
  6733. package body NDC_OPS_DEFS is
  6734.      
  6735.    -- Access functions provide functions to be used in a generic
  6736.    -- instantiation to access the values of components of the record.
  6737.    -- The name of each function is the name of its component.
  6738.      
  6739.    function XMIN
  6740.       (RECT : in     NDC . RECTANGLE_LIMITS)
  6741.       return NDC_TYPE is
  6742.    -- Return the XMIN component of RECT.
  6743.      
  6744.    begin
  6745.      
  6746.       return RECT . XMIN;
  6747.      
  6748.    end XMIN;
  6749.      
  6750.    function XMAX
  6751.       (RECT : in     NDC . RECTANGLE_LIMITS)
  6752.       return NDC_TYPE is
  6753.    -- Return the XMAX component of RECT.
  6754.      
  6755.    begin
  6756.      
  6757.       return RECT . XMAX;
  6758.      
  6759.    end XMAX;
  6760.      
  6761.    function YMIN
  6762.       (RECT : in     NDC . RECTANGLE_LIMITS)
  6763.       return NDC_TYPE is
  6764.    -- Return the YMIN component of RECT.
  6765.      
  6766.    begin
  6767.      
  6768.       return RECT . YMIN;
  6769.      
  6770.    end YMIN;
  6771.      
  6772.    function YMAX
  6773.       (RECT : in     NDC . RECTANGLE_LIMITS)
  6774.       return NDC_TYPE is
  6775.    -- Return the YMAX component of RECT.
  6776.      
  6777.    begin
  6778.      
  6779.       return RECT . YMAX;
  6780.      
  6781.    end YMAX;
  6782.      
  6783.    -- Assignment functions provide functions to be used in a generic
  6784.    -- instantiation to assign new values to components of the record.
  6785.    -- The name of each function is `SET_' & the name of its component.
  6786.      
  6787.    procedure SET_XMIN
  6788.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  6789.        COORD : in     NDC_TYPE) is
  6790.    -- Assign COORD to the XMIN component of RECT.
  6791.      
  6792.    begin
  6793.      
  6794.       RECT . XMIN := COORD;
  6795.      
  6796.    end SET_XMIN;
  6797.      
  6798.    procedure SET_XMAX
  6799.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  6800.        COORD : in     NDC_TYPE) is
  6801.    -- Assign COORD to the XMAX component of RECT.
  6802.      
  6803.    begin
  6804.      
  6805.       RECT . XMAX := COORD;
  6806.      
  6807.    end SET_XMAX;
  6808.      
  6809.    procedure SET_YMIN
  6810.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  6811.        COORD : in     NDC_TYPE) is
  6812.    -- Assign COORD to the YMIN component of RECT.
  6813.      
  6814.    begin
  6815.      
  6816.       RECT . YMIN := COORD;
  6817.      
  6818.    end SET_YMIN;
  6819.      
  6820.    procedure SET_YMAX
  6821.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  6822.        COORD : in     NDC_TYPE) is
  6823.    -- Assign COORD to the YMAX component of RECT.
  6824.      
  6825.    begin
  6826.      
  6827.       RECT . YMAX := COORD;
  6828.      
  6829.    end SET_YMAX;
  6830.      
  6831.    -- Aggregate
  6832.      
  6833.    function RECTANGLE_LIMITS_MAKE
  6834.       (XMIN : in     NDC_TYPE;
  6835.        XMAX : in     NDC_TYPE;
  6836.        YMIN : in     NDC_TYPE;
  6837.        YMAX : in     NDC_TYPE)
  6838.        return  NDC . RECTANGLE_LIMITS is
  6839.    -- Return a rectangle formed from the corresponding input parameters.
  6840.      
  6841.    begin
  6842.      
  6843.       return NDC . RECTANGLE_LIMITS'
  6844.          (XMIN => XMIN,
  6845.           XMAX => XMAX,
  6846.           YMIN => YMIN,
  6847.           YMAX => YMAX);
  6848.      
  6849.    end RECTANGLE_LIMITS_MAKE;
  6850.      
  6851. end NDC_OPS_DEFS;
  6852. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6853. --:UDD:GKSADACM:CODE:MA:NDC_OPS.ADA
  6854. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6855. ------------------------------------------------------------------
  6856. --
  6857. --  NAME: NDC_OPS
  6858. --  IDENTIFIER: GDMXXX.1(1)
  6859. --  DISCREPANCY REPORTS:
  6860. --
  6861. ------------------------------------------------------------------
  6862. -- File: NDC_OPS.ADA
  6863. -- Level: all
  6864.      
  6865. with RECTANGLE_LIMITS_OPS;
  6866. with GKS_TYPES;
  6867. with NDC_OPS_DEFS;
  6868.      
  6869. use GKS_TYPES;
  6870.      
  6871. package NDC_OPS is new RECTANGLE_LIMITS_OPS
  6872.    (COORDINATE            => NDC_TYPE,
  6873.     RECTANGLE_LIMITS      => NDC . RECTANGLE_LIMITS,
  6874.     XMIN                  => NDC_OPS_DEFS . XMIN,
  6875.     XMAX                  => NDC_OPS_DEFS . XMAX,
  6876.     YMIN                  => NDC_OPS_DEFS . YMIN,
  6877.     YMAX                  => NDC_OPS_DEFS . YMAX,
  6878.     RECTANGLE_LIMITS_MAKE => NDC_OPS_DEFS . RECTANGLE_LIMITS_MAKE);
  6879.      
  6880. -- Package GKS_TYPES defines the NDC_TYPE and the NDC package.
  6881. -- Package NDC_OPS_DEFS defines the access and aggregate subprograms
  6882. -- needed to instantiate RECTANGLE_LIMITS_OPS.
  6883. -- Package RECTANGLE_LIMITS_OPS is a generic package which defines
  6884. -- relational operations on rectangles.
  6885. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6886. --:UDD:GKSADACM:CODE:MA:DC_POINT_OPS.ADA
  6887. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6888. ------------------------------------------------------------------
  6889. --
  6890. --  NAME: DC_POINT_OPS
  6891. --  IDENTIFIER: GDMXXX.1(1)
  6892. --  DISCREPANCY REPORTS:
  6893. --
  6894. ------------------------------------------------------------------
  6895. -- File: DC_POINT_OPS.ADA
  6896. -- Level: all
  6897.      
  6898. with GKS_TYPES;
  6899.      
  6900. use GKS_TYPES;
  6901.      
  6902. package DC_POINT_OPS is
  6903.      
  6904. -- Package DC_POINT_OPS provides extended functionality to the POINT
  6905. -- and VECTOR types defined in package DC, an instance of
  6906. -- GKS_COORDINATE_SYSTEM.  The extensions are functions which perform
  6907. -- commonly desired operations on points and vectors.
  6908. --
  6909. -- The functions are grouped by the argument and result types, and
  6910. -- perform well-known mathematical functions:
  6911. --      DOT             vector dot product
  6912. --      NORM            the norm or length of a vector
  6913. --      DIST            Euclidean distance between points
  6914. --      "*"             Multiply VECTOR or POINT by a DC_TYPE or
  6915. --                      DC . MAGNITUDE and vice versa
  6916. --      "/"             Divide VECTOR or POINT by a DC_TYPE or
  6917. --                      DC . MAGNITUDE
  6918. --      "-"             Negative of a VECTOR or a POINT
  6919. --      "+","-"         Sum or difference of a VECTOR or a POINT
  6920. --      "+","-"         Mixed sums of VECTORs and POINTs with POINTs
  6921. --                      regarded as absolute positions and VECTORs as
  6922. --                      relative displacements.
  6923. --
  6924. -- One set of functions is somewhat unconventional:
  6925. --      "*","/"         Coordinate-wise multiply or divide of a VECTOR
  6926. --                      or a POINT
  6927. --
  6928. -- Because POINT and VECTOR are record types, not array types, it is
  6929. -- clumsy to use them as generic parameters, but see packages NDC_OPS and
  6930. -- DC_OPS for an instance of this technique. Instead of a generic
  6931. -- extension to GKS_COORDINATE_SYSTEM, this package directly implements
  6932. -- extensions to package DC.
  6933. --
  6934. -- IMPORTANT, IMPLEMENTATION RESTRICTION:
  6935. -- A sister package, NDC_POINT_OPS was generated from this one by
  6936. -- swapping all occurrences of the strings "NDC" and "DC".  By avoiding
  6937. -- any other use of these strings, an easy pseudo-generic instantiation
  6938. -- is made. Even comments should follow this rule.
  6939.      
  6940.    use DC;
  6941.      
  6942.    subtype COORD is DC_TYPE;
  6943.    subtype MAGNITUDE is DC . MAGNITUDE;
  6944.      
  6945. -- DOT(V, V) => S  DOT PRODUCT
  6946. -- NORM(V)   => S  [S := SQRT( DOT(V,V) );]
  6947.      
  6948.    function DOT
  6949.       (A : in     VECTOR;
  6950.        B : in     VECTOR) return COORD;
  6951.      
  6952.    function NORM
  6953.       (A : in     VECTOR) return COORD;
  6954.      
  6955.    function NORM
  6956.       (A : in     VECTOR) return MAGNITUDE;
  6957.      
  6958.    function DIST
  6959.       (A : in     POINT;
  6960.        B : in     POINT) return COORD;
  6961.      
  6962.    function DIST
  6963.       (A : in     POINT;
  6964.        B : in     POINT) return MAGNITUDE;
  6965.      
  6966. -- Scalar operations
  6967.      
  6968.    function "*"
  6969.       (V : in     VECTOR;
  6970.        S : in     COORD) return VECTOR;
  6971.      
  6972.    function "*"
  6973.       (S : in     COORD;
  6974.        V : in     VECTOR) return VECTOR;
  6975.      
  6976.    function "/"
  6977.       (V : in     VECTOR;
  6978.        S : in     COORD) return VECTOR;
  6979.      
  6980.    function "*"
  6981.       (V : in     VECTOR;
  6982.        S : in     MAGNITUDE) return VECTOR;
  6983.      
  6984.    function "*"
  6985.       (S : in     MAGNITUDE;
  6986.        V : in     VECTOR) return VECTOR;
  6987.      
  6988.    function "/"
  6989.       (V : in     VECTOR;
  6990.        S : in     MAGNITUDE) return VECTOR;
  6991.      
  6992.    function "*"
  6993.       (P : in     POINT;
  6994.        S : in     COORD) return POINT;
  6995.      
  6996.    function "*"
  6997.       (S : in     COORD;
  6998.        P : in     POINT) return POINT;
  6999.      
  7000.    function "/"
  7001.       (P : in     POINT;
  7002.        S : in     COORD) return POINT;
  7003.      
  7004.    function "*"
  7005.       (P : in     POINT;
  7006.        S : in     MAGNITUDE) return POINT;
  7007.      
  7008.    function "*"
  7009.       (S : in     MAGNITUDE;
  7010.        P : in     POINT) return POINT;
  7011.      
  7012.    function "/"
  7013.       (P : in     POINT;
  7014.        S : in     MAGNITUDE) return POINT;
  7015.      
  7016. -- - V   => V [for I in X..Y loop V(I) := - V(I); end loop;]
  7017. -- V + V => V [for I in X..Y loop V(I) := VA(I) + VB(I); end loop;]
  7018. -- V - V => V [for I in X..Y loop V(I) := VA(I) - VB(I); end loop;]
  7019. -- V * V => V [for I in X..Y loop V(I) := VA(I) * VB(I); end loop;]
  7020. -- V / V => V [for I in X..Y loop V(I) := VA(I) / VB(I); end loop;]
  7021.      
  7022.    function "-"
  7023.       (A: in     VECTOR) return VECTOR;
  7024.      
  7025.    function "+"
  7026.       (A : in     VECTOR;
  7027.        B : in     VECTOR) return VECTOR;
  7028.      
  7029.    function "-"
  7030.       (A : in     VECTOR;
  7031.        B : in     VECTOR) return VECTOR;
  7032.      
  7033.    function "*"
  7034.       (A : in     VECTOR;
  7035.        B : in     VECTOR) return VECTOR;
  7036.      
  7037.    function "/"
  7038.       (A : in     VECTOR;
  7039.        B : in     VECTOR) return VECTOR;
  7040.      
  7041.      
  7042. -- - P   => P [for I in X..Y loop P(I) := - P(I); end loop;]
  7043. -- P + P => P [for I in X..Y loop P(I) := PA(I) + PB(I); end loop;]
  7044. -- P - P => P [for I in X..Y loop P(I) := PA(I) - PB(I); end loop;]
  7045. -- P * P => P [for I in X..Y loop P(I) := PA(I) * PB(I); end loop;]
  7046. -- P / P => P [for I in X..Y loop P(I) := PA(I) / PB(I); end loop;]
  7047. --
  7048.    function "-"
  7049.       (A : in     POINT) return POINT;
  7050.      
  7051.    function "+"
  7052.       (A : in     POINT;
  7053.        B : in     POINT) return POINT;
  7054.      
  7055.    function "-"
  7056.       (A : in     POINT;
  7057.        B : in     POINT) return POINT;
  7058.      
  7059.    function "*"
  7060.       (A : in     POINT;
  7061.        B : in     POINT) return POINT;
  7062.      
  7063.    function "/"
  7064.        (A : in     POINT;
  7065.         B : in     POINT) return POINT;
  7066.      
  7067. -- P - P => V [for I in X..Y loop V(I) := PA(I) - PB(I); end loop;]
  7068.      
  7069.    function "-"
  7070.       (HEAD : in     POINT;
  7071.        TAIL : in     POINT) return VECTOR;
  7072.      
  7073. -- P + V => P [for I in X..Y loop P(I) := PA(I) + VB(I); end loop;]
  7074. -- V + P => P [for I in X..Y loop P(I) := VA(I) + PB(I); end loop;]
  7075. -- P - V => P [for I in X..Y loop P(I) := PA(I) - VB(I); end loop;]
  7076. -- V - P => P [for I in X..Y loop P(I) := VA(I) - PB(I); end loop;]
  7077.      
  7078.    function "+"
  7079.       (P : in     POINT;
  7080.        V : in     VECTOR) return POINT;
  7081.      
  7082.    function "+"
  7083.       (V : in     VECTOR;
  7084.        P : in     POINT) return POINT;
  7085.      
  7086.    function "-"
  7087.       (P : in     POINT;
  7088.        V : in     VECTOR) return POINT;
  7089.      
  7090.    function "-"
  7091.       (V : in     VECTOR;
  7092.        P : in     POINT) return POINT;
  7093.      
  7094. end DC_POINT_OPS;
  7095. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7096. --:UDD:GKSADACM:CODE:MA:DC_POINT_OPS_B.ADA
  7097. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7098. ------------------------------------------------------------------
  7099. --
  7100. --  NAME: DC_POINT_OPS - BODY
  7101. --  IDENTIFIER: GDMXXX.1(1)
  7102. --  DISCREPANCY REPORTS:
  7103. --
  7104. ------------------------------------------------------------------
  7105. -- File: DC_POINT_OPS_B.ADA
  7106. -- Level: all
  7107.      
  7108. package body DC_POINT_OPS is
  7109.      
  7110.    use GKS_TYPES;
  7111.    use DC;
  7112.      
  7113.    function SQRT
  7114.       (X : in    FLOAT) return FLOAT is
  7115.      
  7116.    -- Compute the square root of X.
  7117.    -- Normally, a square root function would test for X < 0.0, but this
  7118.    -- function is never called with a negative number here.
  7119.    --
  7120.    -- X - positive number to take the square root of
  7121.    --
  7122.    -- Implementation note: This function uses FLOAT because the
  7123.    -- difference R - R0 could be zero (truncation effects, or just
  7124.    -- luck).
  7125.    -- This implementation is based on Newton-Raphson iteration for the
  7126.    -- roots of the function F(R) = R**2 - X.
  7127.    -- The Newton-Raphson iteration is:
  7128.    --    R' := R - F(R)/F'(R)
  7129.    -- Substituting F(R) = R**2 - X, and F'(R) = 2*R we get:
  7130.    --    R' := R - (R**2 - X)/(2*R)
  7131.    -- Rearranging:
  7132.    --    R' := R - (R**2 / R - X / R) / 2
  7133.    --    R' := R - (R - X / R) / 2
  7134.    --    R' := (R * 2 - R + X / R) / 2
  7135.    --    R' := (R + X / R) / 2
  7136.    -- Strength reduction, multiply instead of divide, yields:
  7137.    --    R' := (R + X/R) * 0.5
  7138.      
  7139.       R0 : FLOAT := 1.0;
  7140.       -- Previous guess at square root
  7141.      
  7142.       R : FLOAT := X;
  7143.       -- Next quess at square root
  7144.      
  7145.    begin
  7146.      
  7147.       while abs ((R - R0) / R) > 0.000001 loop
  7148.      
  7149.          R0 := R;
  7150.      
  7151.          R := (R + X / R) * 0.5;
  7152.      
  7153.       end loop;
  7154.      
  7155.       return R;
  7156.      
  7157.    end SQRT;
  7158.      
  7159.    function SQRT
  7160.       (X : in    MAGNITUDE) return MAGNITUDE is
  7161.      
  7162.    -- Square root of a MAGNITUDE (which is always positive)
  7163.    --
  7164.    -- X - MAGNITUDE to take the square root of
  7165.      
  7166.    begin
  7167.      
  7168.       return MAGNITUDE ( FLOAT' ( SQRT ( FLOAT(X) ) ) );
  7169.      
  7170.    end SQRT;
  7171.      
  7172.    function DOT
  7173.       (A : in     VECTOR;
  7174.        B : in     VECTOR) return COORD is
  7175.      
  7176.    -- DOT product is sum of product of components
  7177.    --
  7178.    -- A - first vector of DOT product
  7179.    -- B - second vector of DOT product
  7180.      
  7181.    begin
  7182.      
  7183.       return (A.X * B.X) + (A.Y * B.Y);
  7184.      
  7185.    end DOT;
  7186.      
  7187.    function NORM
  7188.       (A : VECTOR) return MAGNITUDE is
  7189.      
  7190.    -- Return Euclidean length of a VECTOR as a MAGNITUDE
  7191.    --
  7192.    -- A - VECTOR whose length is sought
  7193.      
  7194.    begin
  7195.      
  7196.       return SQRT ( DC . MAGNITUDE ( DOT (A,A) ) );
  7197.       -- This is a simple algorithm.  Better numerical accuracy and
  7198.       -- greater functional domain can be had, but graphics do not
  7199.       -- require it.
  7200.      
  7201.    end NORM;
  7202.      
  7203.    function NORM
  7204.       (A : VECTOR) return COORD is
  7205.      
  7206.    -- Return Euclidean length of a VECTOR as a COORD
  7207.    --
  7208.    -- A - VECTOR whose length is sought
  7209.      
  7210.    begin
  7211.      
  7212.       return COORD ( MAGNITUDE' ( NORM(A) ) );
  7213.      
  7214.    end NORM;
  7215.      
  7216.    function DIST
  7217.       (A : in     POINT;
  7218.        B : in     POINT) return MAGNITUDE is
  7219.      
  7220.    -- Return Euclidean distance between two point as a MAGNITUDE
  7221.    --
  7222.    -- A - Starting point
  7223.    -- B - Ending point
  7224.      
  7225.    begin
  7226.      
  7227.       return NORM ( VECTOR' (A - B) );
  7228.      
  7229.    end DIST;
  7230.      
  7231.    function DIST
  7232.       (A : in     POINT;
  7233.        B : in     POINT) return COORD is
  7234.      
  7235.    -- Return Euclidean distance between two point as a COORD
  7236.    --
  7237.    -- A - Starting point
  7238.    -- B - Ending point
  7239.      
  7240.    begin
  7241.      
  7242.       return NORM ( VECTOR' (A - B) );
  7243.      
  7244.    end DIST;
  7245.      
  7246. -- Scalar operations: VECTOR and COORD
  7247.      
  7248.    function "*"
  7249.       (V : VECTOR;
  7250.        S : COORD) return VECTOR is
  7251.      
  7252.    -- Multiply a VECTOR by a COORD
  7253.    --
  7254.    -- V - Vector to be multiplied
  7255.    -- S - Scalar to multiply vector by
  7256.      
  7257.    begin
  7258.      
  7259.       return VECTOR '( V.X * S, V.Y * S);
  7260.      
  7261.    end "*";
  7262.      
  7263.    function "*"
  7264.       (S : COORD;
  7265.        V : VECTOR) return VECTOR is
  7266.      
  7267.    -- Multiply a COORD by a VECTOR
  7268.    --
  7269.    -- S - Scalar to multiply vector by
  7270.    -- V - Vector to be multiplied
  7271.      
  7272.    begin
  7273.      
  7274.       return VECTOR '( S * V.X, S * V.Y);
  7275.      
  7276.    end "*";
  7277.      
  7278.    function "/"
  7279.       (V : VECTOR;
  7280.        S : COORD) return VECTOR is
  7281.      
  7282.    -- Divide a VECTOR by a COORD
  7283.    --
  7284.    -- V - Vector to be divided
  7285.    -- S - Scalar to divide vector by
  7286.      
  7287.    begin
  7288.      
  7289.       return VECTOR '( V.X / S, V.Y / S);
  7290.      
  7291.    end "/";
  7292.      
  7293. -- Scalar operations: POINT and COORD
  7294.      
  7295.    function "*"
  7296.       (P : POINT;
  7297.        S : COORD) return POINT is
  7298.      
  7299.    -- Multiply a POINT by a COORD
  7300.    --
  7301.    -- P - POINT to be multiplied
  7302.    -- S - Scalar to multiply POINT by
  7303.      
  7304.    begin
  7305.      
  7306.       return POINT '( P.X * S, P.Y * S);
  7307.      
  7308.    end "*";
  7309.      
  7310.    function "*"
  7311.       (S : COORD;
  7312.        P : POINT) return POINT is
  7313.      
  7314.    -- Multiply a COORD by a POINT
  7315.    --
  7316.    -- S - Scalar to multiply POINT by
  7317.    -- P - POINT to be multiplied
  7318.      
  7319.    begin
  7320.      
  7321.       return POINT '( S * P.X, S * P.Y);
  7322.      
  7323.    end "*";
  7324.      
  7325.    function "/"
  7326.       (P : POINT;
  7327.        S : COORD) return POINT is
  7328.      
  7329.    -- Divide a POINT by a COORD
  7330.    --
  7331.    -- P - POINT to be divided
  7332.    -- S - Scalar to divide POINT by
  7333.      
  7334.    begin
  7335.      
  7336.       return POINT '( P.X / S, P.Y / S);
  7337.      
  7338.    end "/";
  7339.      
  7340. -- Scalar operations: VECTOR and MAGNITUDE
  7341.      
  7342.    function "*"
  7343.       (V : VECTOR;
  7344.        S : MAGNITUDE) return VECTOR is
  7345.      
  7346.    -- Multiply a VECTOR by a MAGNITUDE
  7347.    --
  7348.    -- V - Vector to be multiplied
  7349.    -- S - Scalar to multiply vector by
  7350.      
  7351.       C : COORD := COORD ( S );
  7352.       -- Convert S to a COORD
  7353.      
  7354.    begin
  7355.      
  7356.       return VECTOR '( V.X * C, V.Y * C);
  7357.      
  7358.    end "*";
  7359.      
  7360.    function "*"
  7361.       (S : MAGNITUDE;
  7362.        V : VECTOR) return VECTOR is
  7363.      
  7364.    -- Multiply a MAGNITUDE by a VECTOR
  7365.    --
  7366.    -- S - Scalar to multiply vector by
  7367.    -- V - Vector to be multiplied
  7368.      
  7369.       C : COORD := COORD ( S );
  7370.       -- Convert S to a COORD
  7371.      
  7372.    begin
  7373.      
  7374.       return VECTOR '( C * V.X, C * V.Y);
  7375.      
  7376.    end "*";
  7377.      
  7378.    function "/"
  7379.       (V : VECTOR;
  7380.        S : MAGNITUDE) return VECTOR is
  7381.      
  7382.    -- Divide a VECTOR by a MAGNITUDE
  7383.    --
  7384.    -- V - Vector to be divided
  7385.    -- S - Scalar to divide vector by
  7386.      
  7387.       C : COORD := COORD ( S );
  7388.       -- Convert S to a COORD
  7389.      
  7390.    begin
  7391.      
  7392.       return VECTOR '( V.X / C, V.Y / C);
  7393.      
  7394.    end "/";
  7395.      
  7396. -- Scalar operations: POINT and MAGNITUDE
  7397.      
  7398.    function "*"
  7399.       (P : POINT;
  7400.        S : MAGNITUDE) return POINT is
  7401.      
  7402.    -- Multiply a POINT by a MAGNITUDE
  7403.    --
  7404.    -- P - POINT to be multiplied
  7405.    -- S - Scalar to multiply POINT by
  7406.      
  7407.       C : COORD := COORD ( S );
  7408.       -- Convert S to a COORD
  7409.      
  7410.    begin
  7411.      
  7412.       return POINT '( P.X * C, P.Y * C);
  7413.      
  7414.    end "*";
  7415.      
  7416.    function "*"
  7417.       (S : MAGNITUDE;
  7418.        P : POINT) return POINT is
  7419.      
  7420.    -- Multiply a MAGNITUDE by a POINT
  7421.    --
  7422.    -- S - Scalar to multiply POINT by
  7423.    -- P - POINT to be multiplied
  7424.      
  7425.       C : COORD := COORD ( S );
  7426.       -- Convert S to a COORD
  7427.      
  7428.    begin
  7429.      
  7430.       return POINT '( C * P.X, C * P.Y);
  7431.      
  7432.    end "*";
  7433.      
  7434.    function "/"
  7435.       (P : POINT;
  7436.        S : MAGNITUDE) return POINT is
  7437.      
  7438.    -- Divide a POINT by a MAGNITUDE
  7439.    --
  7440.    -- P - POINT to be divided
  7441.    -- S - Scalar to divide POINT by
  7442.      
  7443.       C : COORD := COORD ( S );
  7444.       -- Convert S to a COORD
  7445.      
  7446.    begin
  7447.      
  7448.       return POINT '( P.X / C, P.Y / C);
  7449.      
  7450.    end "/";
  7451.      
  7452.    --
  7453.    -- VECTOR op VECTOR ==> VECTOR
  7454.    --
  7455.      
  7456.    function "-"
  7457.       ( A : VECTOR) return VECTOR is
  7458.      
  7459.    -- Negate a VECTOR
  7460.    --
  7461.    -- A - a VECTOR
  7462.      
  7463.    begin
  7464.      
  7465.       return VECTOR '( -A.X, -A.Y);
  7466.      
  7467.    end "-";
  7468.      
  7469.    function "-"
  7470.       (A : VECTOR;
  7471.        B : VECTOR) return VECTOR is
  7472.      
  7473.    -- Subtract two VECTORs
  7474.    --
  7475.    -- A - a VECTOR
  7476.    -- B - a VECTOR to subtract from `A'
  7477.      
  7478.    begin
  7479.      
  7480.       return VECTOR '( A.X - B.X, A.Y - B.Y);
  7481.      
  7482.    end "-";
  7483.      
  7484.    function "+"
  7485.       (A : VECTOR;
  7486.        B : VECTOR) return VECTOR is
  7487.      
  7488.    -- Add two VECTORs
  7489.    --
  7490.    -- A - a VECTOR
  7491.    -- B - a VECTOR to add to `A'
  7492.      
  7493.    begin
  7494.      
  7495.       return VECTOR '( A.X + B.X, A.Y + B.Y);
  7496.      
  7497.    end "+";
  7498.      
  7499.    function "*"
  7500.       (A : VECTOR;
  7501.        B : VECTOR) return VECTOR is
  7502.      
  7503.    -- Multiply two VECTORs
  7504.    --
  7505.    -- A - a VECTOR
  7506.    -- B - a VECTOR to multiply `A' by (component-wise)
  7507.      
  7508.    begin
  7509.      
  7510.       return VECTOR '( A.X * B.X, A.Y * B.Y);
  7511.      
  7512.    end "*";
  7513.      
  7514.    function "/"
  7515.       (A : VECTOR;
  7516.        B : VECTOR) return VECTOR is
  7517.      
  7518.    -- Divide two VECTORs
  7519.    --
  7520.    -- A - a VECTOR
  7521.    -- B - a VECTOR to divide `A' by (component-wise)
  7522.      
  7523.    begin
  7524.      
  7525.       return VECTOR '( A.X / B.X, A.Y / B.Y);
  7526.      
  7527.    end "/";
  7528.      
  7529.    --
  7530.    -- POINT op POINT ==> POINT
  7531.    --
  7532.      
  7533.    function "-"
  7534.       ( A : POINT) return POINT is
  7535.      
  7536.    -- Negate a POINT
  7537.    --
  7538.    -- A - a POINT
  7539.      
  7540.    begin
  7541.      
  7542.       return POINT '( -A.X, -A.Y);
  7543.      
  7544.    end "-";
  7545.      
  7546.    function "-"
  7547.       (A : POINT;
  7548.        B : POINT) return POINT is
  7549.      
  7550.    -- Subtract two POINTs
  7551.    --
  7552.    -- A - a POINT
  7553.    -- B - a POINT to subtract from `A'
  7554.      
  7555.    begin
  7556.      
  7557.       return POINT '( A.X - B.X, A.Y - B.Y);
  7558.      
  7559.    end "-";
  7560.      
  7561.    function "+"
  7562.       (A : POINT;
  7563.        B : POINT) return POINT is
  7564.      
  7565.    -- Add two POINTs
  7566.    --
  7567.    -- A - a POINT
  7568.    -- B - a POINT to add to `A'
  7569.      
  7570.    begin
  7571.      
  7572.       return POINT '( A.X + B.X, A.Y + B.Y);
  7573.      
  7574.    end "+";
  7575.      
  7576.    function "*"
  7577.       (A : POINT;
  7578.        B : POINT) return POINT is
  7579.      
  7580.    -- Multiply two POINTs
  7581.    --
  7582.    -- A - a POINT
  7583.    -- B - a POINT to multiply `A' by (component-wise)
  7584.      
  7585.    begin
  7586.      
  7587.       return POINT '( A.X * B.X, A.Y * B.Y);
  7588.      
  7589.    end "*";
  7590.      
  7591.    function "/"
  7592.       (A : POINT;
  7593.        B : POINT) return POINT is
  7594.      
  7595.    -- Divide two POINTs
  7596.    --
  7597.    -- A - a POINT
  7598.    -- B - a POINT to divide `A' by (component-wise)
  7599.      
  7600.    begin
  7601.      
  7602.       return POINT '( A.X / B.X, A.Y / B.Y);
  7603.      
  7604.    end "/";
  7605.      
  7606. -- Functions mixing VECTOR and POINT
  7607.      
  7608.    function "-"
  7609.       (HEAD : POINT;
  7610.        TAIL : POINT) return VECTOR is
  7611.      
  7612.    -- Subtract two POINTs yielding a VECTOR
  7613.    --
  7614.    -- A - a displacement POINT
  7615.    -- B - a reference POINT to subtract from `A'
  7616.      
  7617.    begin
  7618.      
  7619.       return VECTOR '( HEAD.X - TAIL.X, HEAD.Y - TAIL.Y);
  7620.      
  7621.    end "-";
  7622.      
  7623.    function "+"
  7624.       (P : POINT;
  7625.        V : VECTOR) return POINT is
  7626.      
  7627.    -- Add a VECTOR to a POINT yielding a POINT
  7628.    --
  7629.    -- P - a reference POINT
  7630.    -- V - a displacement VECTOR to add to `A'
  7631.      
  7632.    begin
  7633.      
  7634.       return POINT '( P.X + V.X, P.Y + V.Y);
  7635.      
  7636.    end "+";
  7637.      
  7638.    function "+"
  7639.       (V : VECTOR;
  7640.        P : POINT) return POINT is
  7641.      
  7642.    -- Add a VECTOR to a POINT yielding a POINT
  7643.    --
  7644.    -- V - a displacement VECTOR to add to `A'
  7645.    -- P - a reference POINT
  7646.      
  7647.    begin
  7648.      
  7649.       return POINT '( V.X + P.X, V.Y + P.Y);
  7650.      
  7651.    end "+";
  7652.      
  7653.    function "-"
  7654.       (P : POINT;
  7655.        V : VECTOR) return POINT is
  7656.      
  7657.    -- Subtract a VECTOR from a POINT yielding a POINT
  7658.    --
  7659.    -- P - a reference POINT
  7660.    -- V - a displacement VECTOR to subtract from `A'
  7661.      
  7662.    begin
  7663.      
  7664.       return POINT '( P.X - V.X, P.Y - V.Y);
  7665.      
  7666.    end "-";
  7667.      
  7668.    function "-"
  7669.       (V : VECTOR;
  7670.        P : POINT) return POINT is
  7671.      
  7672.    -- Subtract a VECTOR from a POINT yielding a POINT
  7673.    --
  7674.    -- V - a displacement VECTOR
  7675.    -- P - a reference POINT to subtract from `A'
  7676.      
  7677.    begin
  7678.      
  7679.       return POINT '( V.X - P.X, V.Y - P.Y);
  7680.      
  7681.    end "-";
  7682.      
  7683. end DC_POINT_OPS;
  7684. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7685. --:UDD:GKSADACM:CODE:MA:NDC_POINT_OPS.ADA
  7686. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7687. ------------------------------------------------------------------
  7688. --
  7689. --  NAME: NDC_POINT_OPS
  7690. --  IDENTIFIER: GDMXXX.1(1)
  7691. --  DISCREPANCY REPORTS:
  7692. --
  7693. ------------------------------------------------------------------
  7694. -- File: NDC_POINT_OPS.ADA
  7695. -- Level: all
  7696.      
  7697. with GKS_TYPES;
  7698.      
  7699. use GKS_TYPES;
  7700.      
  7701. package NDC_POINT_OPS is
  7702.      
  7703. -- Package NDC_POINT_OPS provides extended functionality to the POINT
  7704. -- and VECTOR types defined in package NDC, an instance of
  7705. -- GKS_COORDINATE_SYSTEM.  The extensions are functions which perform
  7706. -- commonly desired operations on points and vectors.
  7707. --
  7708. -- The functions are grouped by the argument and result types, and
  7709. -- perform well-known mathematical functions:
  7710. --      DOT             vector dot product
  7711. --      NORM            the norm or length of a vector
  7712. --      DIST            Euclidean distance between points
  7713. --      "*"             Multiply VECTOR or POINT by a NDC_TYPE or
  7714. --                      NDC . MAGNITUDE and vice versa
  7715. --      "/"             Divide VECTOR or POINT by a NDC_TYPE or
  7716. --                      NDC . MAGNITUDE
  7717. --      "-"             Negative of a VECTOR or a POINT
  7718. --      "+","-"         Sum or difference of a VECTOR or a POINT
  7719. --      "+","-"         Mixed sums of VECTORs and POINTs with POINTs
  7720. --                      regarded as absolute positions and VECTORs as
  7721. --                      relative displacements.
  7722. --
  7723. -- One set of functions is somewhat unconventional:
  7724. --      "*","/"         Coordinate-wise multiply or divide of a VECTOR
  7725. --                      or a POINT
  7726. --
  7727. -- Because POINT and VECTOR are record types, not array types, it is
  7728. -- clumsy to use them as generic parameters, but see packages DC_OPS and
  7729. -- NDC_OPS for an instance of this technique. Instead of a generic
  7730. -- extension to GKS_COORDINATE_SYSTEM, this package directly implements
  7731. -- extensions to package NDC.
  7732. --
  7733. -- IMPORTANT, IMPLEMENTATION RESTRICTION:
  7734. -- A sister package, DC_POINT_OPS was generated from this one by
  7735. -- swapping all occurrences of the strings "DC" and "NDC".  By avoiding
  7736. -- any other use of these strings, an easy pseudo-generic instantiation
  7737. -- is made. Even comments should follow this rule.
  7738.      
  7739.    use NDC;
  7740.      
  7741.    subtype COORD is NDC_TYPE;
  7742.    subtype MAGNITUDE is NDC . MAGNITUDE;
  7743.      
  7744. -- DOT(V, V) => S  DOT PRODUCT
  7745. -- NORM(V)   => S  [S := SQRT( DOT(V,V) );]
  7746.      
  7747.    function DOT
  7748.       (A : in     VECTOR;
  7749.        B : in     VECTOR) return COORD;
  7750.      
  7751.    function NORM
  7752.       (A : in     VECTOR) return COORD;
  7753.      
  7754.    function NORM
  7755.       (A : in     VECTOR) return MAGNITUDE;
  7756.      
  7757.    function DIST
  7758.       (A : in     POINT;
  7759.        B : in     POINT) return COORD;
  7760.      
  7761.    function DIST
  7762.       (A : in     POINT;
  7763.        B : in     POINT) return MAGNITUDE;
  7764.      
  7765. -- Scalar operations
  7766.      
  7767.    function "*"
  7768.       (V : in     VECTOR;
  7769.        S : in     COORD) return VECTOR;
  7770.      
  7771.    function "*"
  7772.       (S : in     COORD;
  7773.        V : in     VECTOR) return VECTOR;
  7774.      
  7775.    function "/"
  7776.       (V : in     VECTOR;
  7777.        S : in     COORD) return VECTOR;
  7778.      
  7779.    function "*"
  7780.       (V : in     VECTOR;
  7781.        S : in     MAGNITUDE) return VECTOR;
  7782.      
  7783.    function "*"
  7784.       (S : in     MAGNITUDE;
  7785.        V : in     VECTOR) return VECTOR;
  7786.      
  7787.    function "/"
  7788.       (V : in     VECTOR;
  7789.        S : in     MAGNITUDE) return VECTOR;
  7790.      
  7791.    function "*"
  7792.       (P : in     POINT;
  7793.        S : in     COORD) return POINT;
  7794.      
  7795.    function "*"
  7796.       (S : in     COORD;
  7797.        P : in     POINT) return POINT;
  7798.      
  7799.    function "/"
  7800.       (P : in     POINT;
  7801.        S : in     COORD) return POINT;
  7802.      
  7803.    function "*"
  7804.       (P : in     POINT;
  7805.        S : in     MAGNITUDE) return POINT;
  7806.      
  7807.    function "*"
  7808.       (S : in     MAGNITUDE;
  7809.        P : in     POINT) return POINT;
  7810.      
  7811.    function "/"
  7812.       (P : in     POINT;
  7813.        S : in     MAGNITUDE) return POINT;
  7814.      
  7815. -- - V   => V [for I in X..Y loop V(I) := - V(I); end loop;]
  7816. -- V + V => V [for I in X..Y loop V(I) := VA(I) + VB(I); end loop;]
  7817. -- V - V => V [for I in X..Y loop V(I) := VA(I) - VB(I); end loop;]
  7818. -- V * V => V [for I in X..Y loop V(I) := VA(I) * VB(I); end loop;]
  7819. -- V / V => V [for I in X..Y loop V(I) := VA(I) / VB(I); end loop;]
  7820.      
  7821.    function "-"
  7822.       (A: in     VECTOR) return VECTOR;
  7823.      
  7824.    function "+"
  7825.       (A : in     VECTOR;
  7826.        B : in     VECTOR) return VECTOR;
  7827.      
  7828.    function "-"
  7829.       (A : in     VECTOR;
  7830.        B : in     VECTOR) return VECTOR;
  7831.      
  7832.    function "*"
  7833.       (A : in     VECTOR;
  7834.        B : in     VECTOR) return VECTOR;
  7835.      
  7836.    function "/"
  7837.       (A : in     VECTOR;
  7838.        B : in     VECTOR) return VECTOR;
  7839.      
  7840.      
  7841. -- - P   => P [for I in X..Y loop P(I) := - P(I); end loop;]
  7842. -- P + P => P [for I in X..Y loop P(I) := PA(I) + PB(I); end loop;]
  7843. -- P - P => P [for I in X..Y loop P(I) := PA(I) - PB(I); end loop;]
  7844. -- P * P => P [for I in X..Y loop P(I) := PA(I) * PB(I); end loop;]
  7845. -- P / P => P [for I in X..Y loop P(I) := PA(I) / PB(I); end loop;]
  7846. --
  7847.    function "-"
  7848.       (A : in     POINT) return POINT;
  7849.      
  7850.    function "+"
  7851.       (A : in     POINT;
  7852.        B : in     POINT) return POINT;
  7853.      
  7854.    function "-"
  7855.       (A : in     POINT;
  7856.        B : in     POINT) return POINT;
  7857.      
  7858.    function "*"
  7859.       (A : in     POINT;
  7860.        B : in     POINT) return POINT;
  7861.      
  7862.    function "/"
  7863.        (A : in     POINT;
  7864.         B : in     POINT) return POINT;
  7865.      
  7866. -- P - P => V [for I in X..Y loop V(I) := PA(I) - PB(I); end loop;]
  7867.      
  7868.    function "-"
  7869.       (HEAD : in     POINT;
  7870.        TAIL : in     POINT) return VECTOR;
  7871.      
  7872. -- P + V => P [for I in X..Y loop P(I) := PA(I) + VB(I); end loop;]
  7873. -- V + P => P [for I in X..Y loop P(I) := VA(I) + PB(I); end loop;]
  7874. -- P - V => P [for I in X..Y loop P(I) := PA(I) - VB(I); end loop;]
  7875. -- V - P => P [for I in X..Y loop P(I) := VA(I) - PB(I); end loop;]
  7876.      
  7877.    function "+"
  7878.       (P : in     POINT;
  7879.        V : in     VECTOR) return POINT;
  7880.      
  7881.    function "+"
  7882.       (V : in     VECTOR;
  7883.        P : in     POINT) return POINT;
  7884.      
  7885.    function "-"
  7886.       (P : in     POINT;
  7887.        V : in     VECTOR) return POINT;
  7888.      
  7889.    function "-"
  7890.       (V : in     VECTOR;
  7891.        P : in     POINT) return POINT;
  7892.      
  7893. end NDC_POINT_OPS;
  7894. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7895. --:UDD:GKSADACM:CODE:MA:NDC_POINT_OPS_B.ADA
  7896. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7897. ------------------------------------------------------------------
  7898. --
  7899. --  NAME: NDC_POINT_OPS - BODY
  7900. --  IDENTIFIER: GDMXXX.1(1)
  7901. --  DISCREPANCY REPORTS:
  7902. --
  7903. ------------------------------------------------------------------
  7904. -- File: NDC_POINT_OPS_B.ADA
  7905. -- Level: all
  7906.      
  7907. package body NDC_POINT_OPS is
  7908.      
  7909.    use GKS_TYPES;
  7910.    use NDC;
  7911.      
  7912.    function SQRT
  7913.       (X : in    FLOAT) return FLOAT is
  7914.      
  7915.    -- Compute the square root of X.
  7916.    -- Normally, a square root function would test for X < 0.0, but this
  7917.    -- function is never called with a negative number here.
  7918.    --
  7919.    -- X - positive number to take the square root of
  7920.    --
  7921.    -- Implementation note: This function uses FLOAT because the
  7922.    -- difference R - R0 could be zero (truncation effects, or just
  7923.    -- luck).
  7924.    -- This implementation is based on Newton-Raphson iteration for the
  7925.    -- roots of the function F(R) = R**2 - X.
  7926.    -- The Newton-Raphson iteration is:
  7927.    --    R' := R - F(R)/F'(R)
  7928.    -- Substituting F(R) = R**2 - X, and F'(R) = 2*R we get:
  7929.    --    R' := R - (R**2 - X)/(2*R)
  7930.    -- Rearranging:
  7931.    --    R' := R - (R**2 / R - X / R) / 2
  7932.    --    R' := R - (R - X / R) / 2
  7933.    --    R' := (R * 2 - R + X / R) / 2
  7934.    --    R' := (R + X / R) / 2
  7935.    -- Strength reduction, multiply instead of divide, yields:
  7936.    --    R' := (R + X/R) * 0.5
  7937.      
  7938.       R0 : FLOAT := 1.0;
  7939.       -- Previous guess at square root
  7940.      
  7941.       R : FLOAT := X;
  7942.       -- Next quess at square root
  7943.      
  7944.    begin
  7945.      
  7946.       while abs ((R - R0) / R) > 0.000001 loop
  7947.      
  7948.          R0 := R;
  7949.      
  7950.          R := (R + X / R) * 0.5;
  7951.      
  7952.       end loop;
  7953.      
  7954.       return R;
  7955.      
  7956.    end SQRT;
  7957.      
  7958.    function SQRT
  7959.       (X : in    MAGNITUDE) return MAGNITUDE is
  7960.      
  7961.    -- Square root of a MAGNITUDE (which is always positive)
  7962.    --
  7963.    -- X - MAGNITUDE to take the square root of
  7964.      
  7965.    begin
  7966.      
  7967.       return MAGNITUDE ( FLOAT' ( SQRT ( FLOAT(X) ) ) );
  7968.      
  7969.    end SQRT;
  7970.      
  7971.    function DOT
  7972.       (A : in     VECTOR;
  7973.        B : in     VECTOR) return COORD is
  7974.      
  7975.    -- DOT product is sum of product of components
  7976.    --
  7977.    -- A - first vector of DOT product
  7978.    -- B - second vector of DOT product
  7979.      
  7980.    begin
  7981.      
  7982.       return (A.X * B.X) + (A.Y * B.Y);
  7983.      
  7984.    end DOT;
  7985.      
  7986.    function NORM
  7987.       (A : VECTOR) return MAGNITUDE is
  7988.      
  7989.    -- Return Euclidean length of a VECTOR as a MAGNITUDE
  7990.    --
  7991.    -- A - VECTOR whose length is sought
  7992.      
  7993.    begin
  7994.      
  7995.       return SQRT ( NDC . MAGNITUDE ( DOT (A,A) ) );
  7996.       -- This is a simple algorithm.  Better numerical accuracy and
  7997.       -- greater functional domain can be had, but graphics do not
  7998.       -- require it.
  7999.      
  8000.    end NORM;
  8001.      
  8002.    function NORM
  8003.       (A : VECTOR) return COORD is
  8004.      
  8005.    -- Return Euclidean length of a VECTOR as a COORD
  8006.    --
  8007.    -- A - VECTOR whose length is sought
  8008.      
  8009.    begin
  8010.      
  8011.       return COORD ( MAGNITUDE' ( NORM(A) ) );
  8012.      
  8013.    end NORM;
  8014.      
  8015.    function DIST
  8016.       (A : in     POINT;
  8017.        B : in     POINT) return MAGNITUDE is
  8018.      
  8019.    -- Return Euclidean distance between two point as a MAGNITUDE
  8020.    --
  8021.    -- A - Starting point
  8022.    -- B - Ending point
  8023.      
  8024.    begin
  8025.      
  8026.       return NORM ( VECTOR' (A - B) );
  8027.      
  8028.    end DIST;
  8029.      
  8030.    function DIST
  8031.       (A : in     POINT;
  8032.        B : in     POINT) return COORD is
  8033.      
  8034.    -- Return Euclidean distance between two point as a COORD
  8035.    --
  8036.    -- A - Starting point
  8037.    -- B - Ending point
  8038.      
  8039.    begin
  8040.      
  8041.       return NORM ( VECTOR' (A - B) );
  8042.      
  8043.    end DIST;
  8044.      
  8045. -- Scalar operations: VECTOR and COORD
  8046.      
  8047.    function "*"
  8048.       (V : VECTOR;
  8049.        S : COORD) return VECTOR is
  8050.      
  8051.    -- Multiply a VECTOR by a COORD
  8052.    --
  8053.    -- V - Vector to be multiplied
  8054.    -- S - Scalar to multiply vector by
  8055.      
  8056.    begin
  8057.      
  8058.       return VECTOR '( V.X * S, V.Y * S);
  8059.      
  8060.    end "*";
  8061.      
  8062.    function "*"
  8063.       (S : COORD;
  8064.        V : VECTOR) return VECTOR is
  8065.      
  8066.    -- Multiply a COORD by a VECTOR
  8067.    --
  8068.    -- S - Scalar to multiply vector by
  8069.    -- V - Vector to be multiplied
  8070.      
  8071.    begin
  8072.      
  8073.       return VECTOR '( S * V.X, S * V.Y);
  8074.      
  8075.    end "*";
  8076.      
  8077.    function "/"
  8078.       (V : VECTOR;
  8079.        S : COORD) return VECTOR is
  8080.      
  8081.    -- Divide a VECTOR by a COORD
  8082.    --
  8083.    -- V - Vector to be divided
  8084.    -- S - Scalar to divide vector by
  8085.      
  8086.    begin
  8087.      
  8088.       return VECTOR '( V.X / S, V.Y / S);
  8089.      
  8090.    end "/";
  8091.      
  8092. -- Scalar operations: POINT and COORD
  8093.      
  8094.    function "*"
  8095.       (P : POINT;
  8096.        S : COORD) return POINT is
  8097.      
  8098.    -- Multiply a POINT by a COORD
  8099.    --
  8100.    -- P - POINT to be multiplied
  8101.    -- S - Scalar to multiply POINT by
  8102.      
  8103.    begin
  8104.      
  8105.       return POINT '( P.X * S, P.Y * S);
  8106.      
  8107.    end "*";
  8108.      
  8109.    function "*"
  8110.       (S : COORD;
  8111.        P : POINT) return POINT is
  8112.      
  8113.    -- Multiply a COORD by a POINT
  8114.    --
  8115.    -- S - Scalar to multiply POINT by
  8116.    -- P - POINT to be multiplied
  8117.      
  8118.    begin
  8119.      
  8120.       return POINT '( S * P.X, S * P.Y);
  8121.      
  8122.    end "*";
  8123.      
  8124.    function "/"
  8125.       (P : POINT;
  8126.        S : COORD) return POINT is
  8127.      
  8128.    -- Divide a POINT by a COORD
  8129.    --
  8130.    -- P - POINT to be divided
  8131.    -- S - Scalar to divide POINT by
  8132.      
  8133.    begin
  8134.      
  8135.       return POINT '( P.X / S, P.Y / S);
  8136.      
  8137.    end "/";
  8138.      
  8139. -- Scalar operations: VECTOR and MAGNITUDE
  8140.      
  8141.    function "*"
  8142.       (V : VECTOR;
  8143.        S : MAGNITUDE) return VECTOR is
  8144.      
  8145.    -- Multiply a VECTOR by a MAGNITUDE
  8146.    --
  8147.    -- V - Vector to be multiplied
  8148.    -- S - Scalar to multiply vector by
  8149.      
  8150.       C : COORD := COORD ( S );
  8151.       -- Convert S to a COORD
  8152.      
  8153.    begin
  8154.      
  8155.       return VECTOR '( V.X * C, V.Y * C);
  8156.      
  8157.    end "*";
  8158.      
  8159.    function "*"
  8160.       (S : MAGNITUDE;
  8161.        V : VECTOR) return VECTOR is
  8162.      
  8163.    -- Multiply a MAGNITUDE by a VECTOR
  8164.    --
  8165.    -- S - Scalar to multiply vector by
  8166.    -- V - Vector to be multiplied
  8167.      
  8168.       C : COORD := COORD ( S );
  8169.       -- Convert S to a COORD
  8170.      
  8171.    begin
  8172.      
  8173.       return VECTOR '( C * V.X, C * V.Y);
  8174.      
  8175.    end "*";
  8176.      
  8177.    function "/"
  8178.       (V : VECTOR;
  8179.        S : MAGNITUDE) return VECTOR is
  8180.      
  8181.    -- Divide a VECTOR by a MAGNITUDE
  8182.    --
  8183.    -- V - Vector to be divided
  8184.    -- S - Scalar to divide vector by
  8185.      
  8186.       C : COORD := COORD ( S );
  8187.       -- Convert S to a COORD
  8188.      
  8189.    begin
  8190.      
  8191.       return VECTOR '( V.X / C, V.Y / C);
  8192.      
  8193.    end "/";
  8194.      
  8195. -- Scalar operations: POINT and MAGNITUDE
  8196.      
  8197.    function "*"
  8198.       (P : POINT;
  8199.        S : MAGNITUDE) return POINT is
  8200.      
  8201.    -- Multiply a POINT by a MAGNITUDE
  8202.    --
  8203.    -- P - POINT to be multiplied
  8204.    -- S - Scalar to multiply POINT by
  8205.      
  8206.       C : COORD := COORD ( S );
  8207.       -- Convert S to a COORD
  8208.      
  8209.    begin
  8210.      
  8211.       return POINT '( P.X * C, P.Y * C);
  8212.      
  8213.    end "*";
  8214.      
  8215.    function "*"
  8216.       (S : MAGNITUDE;
  8217.        P : POINT) return POINT is
  8218.      
  8219.    -- Multiply a MAGNITUDE by a POINT
  8220.    --
  8221.    -- S - Scalar to multiply POINT by
  8222.    -- P - POINT to be multiplied
  8223.      
  8224.       C : COORD := COORD ( S );
  8225.       -- Convert S to a COORD
  8226.      
  8227.    begin
  8228.      
  8229.       return POINT '( C * P.X, C * P.Y);
  8230.      
  8231.    end "*";
  8232.      
  8233.    function "/"
  8234.       (P : POINT;
  8235.        S : MAGNITUDE) return POINT is
  8236.      
  8237.    -- Divide a POINT by a MAGNITUDE
  8238.    --
  8239.    -- P - POINT to be divided
  8240.    -- S - Scalar to divide POINT by
  8241.      
  8242.       C : COORD := COORD ( S );
  8243.       -- Convert S to a COORD
  8244.      
  8245.    begin
  8246.      
  8247.       return POINT '( P.X / C, P.Y / C);
  8248.      
  8249.    end "/";
  8250.      
  8251.    --
  8252.    -- VECTOR op VECTOR ==> VECTOR
  8253.    --
  8254.      
  8255.    function "-"
  8256.       ( A : VECTOR) return VECTOR is
  8257.      
  8258.    -- Negate a VECTOR
  8259.    --
  8260.    -- A - a VECTOR
  8261.      
  8262.    begin
  8263.      
  8264.       return VECTOR '( -A.X, -A.Y);
  8265.      
  8266.    end "-";
  8267.      
  8268.    function "-"
  8269.       (A : VECTOR;
  8270.        B : VECTOR) return VECTOR is
  8271.      
  8272.    -- Subtract two VECTORs
  8273.    --
  8274.    -- A - a VECTOR
  8275.    -- B - a VECTOR to subtract from `A'
  8276.      
  8277.    begin
  8278.      
  8279.       return VECTOR '( A.X - B.X, A.Y - B.Y);
  8280.      
  8281.    end "-";
  8282.      
  8283.    function "+"
  8284.       (A : VECTOR;
  8285.        B : VECTOR) return VECTOR is
  8286.      
  8287.    -- Add two VECTORs
  8288.    --
  8289.    -- A - a VECTOR
  8290.    -- B - a VECTOR to add to `A'
  8291.      
  8292.    begin
  8293.      
  8294.       return VECTOR '( A.X + B.X, A.Y + B.Y);
  8295.      
  8296.    end "+";
  8297.      
  8298.    function "*"
  8299.       (A : VECTOR;
  8300.        B : VECTOR) return VECTOR is
  8301.      
  8302.    -- Multiply two VECTORs
  8303.    --
  8304.    -- A - a VECTOR
  8305.    -- B - a VECTOR to multiply `A' by (component-wise)
  8306.      
  8307.    begin
  8308.      
  8309.       return VECTOR '( A.X * B.X, A.Y * B.Y);
  8310.      
  8311.    end "*";
  8312.      
  8313.    function "/"
  8314.       (A : VECTOR;
  8315.        B : VECTOR) return VECTOR is
  8316.      
  8317.    -- Divide two VECTORs
  8318.    --
  8319.    -- A - a VECTOR
  8320.    -- B - a VECTOR to divide `A' by (component-wise)
  8321.      
  8322.    begin
  8323.      
  8324.       return VECTOR '( A.X / B.X, A.Y / B.Y);
  8325.      
  8326.    end "/";
  8327.      
  8328.    --
  8329.    -- POINT op POINT ==> POINT
  8330.    --
  8331.      
  8332.    function "-"
  8333.       ( A : POINT) return POINT is
  8334.      
  8335.    -- Negate a POINT
  8336.    --
  8337.    -- A - a POINT
  8338.      
  8339.    begin
  8340.      
  8341.       return POINT '( -A.X, -A.Y);
  8342.      
  8343.    end "-";
  8344.      
  8345.    function "-"
  8346.       (A : POINT;
  8347.        B : POINT) return POINT is
  8348.      
  8349.    -- Subtract two POINTs
  8350.    --
  8351.    -- A - a POINT
  8352.    -- B - a POINT to subtract from `A'
  8353.      
  8354.    begin
  8355.      
  8356.       return POINT
  8357.       ( A.X - B.X, A.Y - B.Y);
  8358.      
  8359.    end "-";
  8360.      
  8361.    function "+"
  8362.       (A : POINT;
  8363.        B : POINT) return POINT is
  8364.      
  8365.    -- Add two POINTs
  8366.    --
  8367.    -- A - a POINT
  8368.    -- B - a POINT to add to `A'
  8369.      
  8370.    begin
  8371.      
  8372.       return POINT '( A.X + B.X, A.Y + B.Y);
  8373.      
  8374.    end "+";
  8375.      
  8376.    function "*"
  8377.       (A : POINT;
  8378.        B : POINT) return POINT is
  8379.      
  8380.    -- Multiply two POINTs
  8381.    --
  8382.    -- A - a POINT
  8383.    -- B - a POINT to multiply `A' by (component-wise)
  8384.      
  8385.    begin
  8386.      
  8387.       return POINT '( A.X * B.X, A.Y * B.Y);
  8388.      
  8389.    end "*";
  8390.      
  8391.    function "/"
  8392.       (A : POINT;
  8393.        B : POINT) return POINT is
  8394.      
  8395.    -- Divide two POINTs
  8396.    --
  8397.    -- A - a POINT
  8398.    -- B - a POINT to divide `A' by (component-wise)
  8399.      
  8400.    begin
  8401.      
  8402.       return POINT '( A.X / B.X, A.Y / B.Y);
  8403.      
  8404.    end "/";
  8405.      
  8406. -- Functions mixing VECTOR and POINT
  8407.      
  8408.    function "-"
  8409.       (HEAD : POINT;
  8410.        TAIL : POINT) return VECTOR is
  8411.      
  8412.    -- Subtract two POINTs yielding a VECTOR
  8413.    --
  8414.    -- A - a displacement POINT
  8415.    -- B - a reference POINT to subtract from `A'
  8416.      
  8417.    begin
  8418.      
  8419.       return VECTOR '( HEAD.X - TAIL.X, HEAD.Y - TAIL.Y);
  8420.      
  8421.    end "-";
  8422.      
  8423.    function "+"
  8424.       (P : POINT;
  8425.        V : VECTOR) return POINT is
  8426.      
  8427.    -- Add a VECTOR to a POINT yielding a POINT
  8428.    --
  8429.    -- P - a reference POINT
  8430.    -- V - a displacement VECTOR to add to `A'
  8431.      
  8432.    begin
  8433.      
  8434.       return POINT '( P.X + V.X, P.Y + V.Y);
  8435.      
  8436.    end "+";
  8437.      
  8438.    function "+"
  8439.       (V : VECTOR;
  8440.        P : POINT) return POINT is
  8441.      
  8442.    -- Add a VECTOR to a POINT yielding a POINT
  8443.    --
  8444.    -- V - a displacement VECTOR to add to `A'
  8445.    -- P - a reference POINT
  8446.      
  8447.    begin
  8448.      
  8449.       return POINT '( V.X + P.X, V.Y + P.Y);
  8450.      
  8451.    end "+";
  8452.      
  8453.    function "-"
  8454.       (P : POINT;
  8455.        V : VECTOR) return POINT is
  8456.      
  8457.    -- Subtract a VECTOR from a POINT yielding a POINT
  8458.    --
  8459.    -- P - a reference POINT
  8460.    -- V - a displacement VECTOR to subtract from `A'
  8461.      
  8462.    begin
  8463.      
  8464.       return POINT '( P.X - V.X, P.Y - V.Y);
  8465.      
  8466.    end "-";
  8467.      
  8468.    function "-"
  8469.       (V : VECTOR;
  8470.        P : POINT) return POINT is
  8471.      
  8472.    -- Subtract a VECTOR from a POINT yielding a POINT
  8473.    --
  8474.    -- V - a displacement VECTOR
  8475.    -- P - a reference POINT to subtract from `A'
  8476.      
  8477.    begin
  8478.      
  8479.       return POINT '( V.X - P.X, V.Y - P.Y);
  8480.      
  8481.    end "-";
  8482.      
  8483. end NDC_POINT_OPS;
  8484. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8485. --:UDD:GKSADACM:CODE:MA:CONVERT_NDC_DC_MA.ADA
  8486. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8487. ------------------------------------------------------------------
  8488. --
  8489. --  NAME: CONVERT_NDC_DC
  8490. --  IDENTIFIER: GDMXXX.1(1)
  8491. --  DISCREPANCY REPORTS:
  8492. --
  8493. ------------------------------------------------------------------
  8494. -- File: CONVERT_NDC_DC_MA.ADA
  8495. -- Level: ma, 0a
  8496.      
  8497. with GKS_TYPES;
  8498.      
  8499. use GKS_TYPES;
  8500.      
  8501. package CONVERT_NDC_DC is
  8502.      
  8503. -- This package performs 2-D coordinate transformations between the NDC
  8504. -- and DC coordinate systems.
  8505. --
  8506. -- In support of levels m and 0, workstation transformations and their
  8507. -- inverse transforms are supported for POINT, VECTOR, POINT_ARRAY,
  8508. -- RECTANGLE_LIMITS and SIZE types.
  8509. --
  8510.    type NDC_DC_SCALE_TYPE is private;
  8511.    -- NDC_DC_SCALE_TYPE is an abstraction of the workstation
  8512.    -- transformation and its inverse transformation.
  8513.      
  8514.    subtype WINDOW_TYPE is NDC . RECTANGLE_LIMITS;
  8515.    -- WINDOW_TYPE is used to specify the window of the workstation
  8516.    -- transformation
  8517.      
  8518.    subtype VIEWPORT_TYPE is DC . RECTANGLE_LIMITS;
  8519.    -- VIEWPORT_TYPE is used to specify the viewport of the workstation
  8520.    -- transformation
  8521.      
  8522.    procedure SET_UNIFORM_SCALES
  8523.       (WINDOW   :        WINDOW_TYPE;
  8524.        VIEWPORT :        VIEWPORT_TYPE;
  8525.        SCALE    :    out NDC_DC_SCALE_TYPE);
  8526.      
  8527.    function DC_POINT
  8528.       (POINT : NDC . POINT;
  8529.        SCALE : NDC_DC_SCALE_TYPE) return DC . POINT;
  8530.      
  8531.    function DC_POINT_ARRAY
  8532.       (POINT_ARRAY : NDC . POINT_ARRAY;
  8533.        SCALE       : NDC_DC_SCALE_TYPE) return DC . POINT_ARRAY;
  8534.      
  8535.    function DC_RECTANGLE_LIMITS
  8536.       (RECTANGLE_LIMITS : NDC . RECTANGLE_LIMITS;
  8537.        SCALE            : NDC_DC_SCALE_TYPE)
  8538.        return DC . RECTANGLE_LIMITS;
  8539.      
  8540.    -- The following functions are for relative scaling only,
  8541.    -- not absolute positions
  8542.      
  8543.    function DC_VECTOR
  8544.       (VECTOR : NDC . VECTOR;
  8545.        SCALE  : NDC_DC_SCALE_TYPE) return DC . VECTOR;
  8546.      
  8547.    function DC_SIZE
  8548.       (SIZE  : NDC . SIZE;
  8549.        SCALE : NDC_DC_SCALE_TYPE) return DC . SIZE;
  8550.      
  8551.    -- Conversions from DC to NDC
  8552.      
  8553.    function NDC_POINT
  8554.       (POINT : DC . POINT;
  8555.        SCALE : NDC_DC_SCALE_TYPE) return NDC . POINT;
  8556.      
  8557.    function NDC_POINT_ARRAY
  8558.       (POINT_ARRAY : DC . POINT_ARRAY;
  8559.        SCALE       : NDC_DC_SCALE_TYPE) return NDC . POINT_ARRAY;
  8560.      
  8561.    function NDC_RECTANGLE_LIMITS
  8562.       (RECTANGLE_LIMITS : DC . RECTANGLE_LIMITS;
  8563.        SCALE           : NDC_DC_SCALE_TYPE)
  8564.        return NDC . RECTANGLE_LIMITS;
  8565.      
  8566.    -- The following functions are for relative scaling only,
  8567.    -- not absolute positions
  8568.      
  8569.    function NDC_VECTOR
  8570.       (VECTOR : DC . VECTOR;
  8571.        SCALE  : NDC_DC_SCALE_TYPE) return NDC . VECTOR;
  8572.      
  8573.    function NDC_SIZE
  8574.       (SIZE  : DC . SIZE;
  8575.        SCALE : NDC_DC_SCALE_TYPE) return NDC . SIZE;
  8576.      
  8577. private
  8578.      
  8579.    type NDC_DC_SCALE_TYPE is
  8580.       record
  8581.          V_SCALE : DC . POINT;
  8582.          V_SHIFT : DC . POINT;
  8583.          W_SCALE : NDC . POINT;
  8584.          W_SHIFT : NDC . POINT;
  8585.       end record;
  8586.    -- V_SCALE and V_SHIFT are used to transform to DC types.
  8587.    -- W_SCALE and W_SHIFT are used to transform to NDC types.
  8588.      
  8589. end CONVERT_NDC_DC;
  8590. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8591. --:UDD:GKSADACM:CODE:MA:CONVERT_NDC_DC_MA_B.ADA
  8592. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8593. ------------------------------------------------------------------
  8594. --
  8595. --  NAME: CONVERT_NDC_DC - BODY
  8596. --  IDENTIFIER: GDMXXX.1(1)
  8597. --  DISCREPANCY REPORTS:
  8598. --
  8599. ------------------------------------------------------------------
  8600. -- File: CONVERT_NDC_DC_MA_B.ADA
  8601. -- Level: ma, 0a
  8602.      
  8603. with DC_POINT_OPS;
  8604. with NDC_POINT_OPS;
  8605.      
  8606. use DC_POINT_OPS;
  8607. use NDC_POINT_OPS;
  8608.      
  8609. package body CONVERT_NDC_DC is
  8610.      
  8611. -- This package body implements the SCALING and TRANSFORMATION
  8612. -- functions used to convert between the NDC and DC coordinate systems.
  8613. --
  8614. -- Type NDC_DC_SCALE_TYPE contains the ready-to-use scale and shift
  8615. -- factors needed to perform the workstation transformation and its
  8616. -- inverse.
  8617. --
  8618.      
  8619.    -- Define index for range arrays
  8620.      
  8621.    type LIMIT is (MIN, MAX);
  8622.      
  8623.    -- Define a new kind of rectangle which is easier to manipulate,
  8624.    -- using NDC_POINT_OPS, than the GKS_COORDINATE_SYSTEM records
  8625.      
  8626.    type NDC_RECTANGLE is array (LIMIT) of NDC . POINT;
  8627.      
  8628.    type DC_RECTANGLE is array (LIMIT) of DC . POINT;
  8629.      
  8630.    --
  8631.    -- Define simple conversions
  8632.    --
  8633.      
  8634.    function NDC_POINT
  8635.       (POINT : DC . POINT ) return NDC . POINT;
  8636.      
  8637.    -- Convert each coordinate using basic conversion
  8638.      
  8639.    function NDC_VECTOR
  8640.       (VECTOR : DC . VECTOR ) return NDC . VECTOR;
  8641.      
  8642.    -- Convert each coordinate using basic conversion
  8643.      
  8644.    function DC_POINT
  8645.       (POINT : NDC . POINT ) return DC . POINT;
  8646.      
  8647.    -- Convert each coordinate using basic conversion
  8648.      
  8649.    function DC_VECTOR
  8650.       (VECTOR : NDC . VECTOR ) return DC . VECTOR;
  8651.      
  8652.    -- Convert each coordinate using basic conversion
  8653.      
  8654.    --
  8655.    -- Define scaling conversions
  8656.    --
  8657.      
  8658.    procedure SET_UNIFORM_SCALES
  8659.       (WINDOW   :        WINDOW_TYPE;
  8660.        VIEWPORT :        VIEWPORT_TYPE;
  8661.        SCALE    :    out NDC_DC_SCALE_TYPE) is
  8662.      
  8663.    -- Compute SCALE based on largest image of WINDOW fitting in the
  8664.    -- lower-left of VIEWPORT.  This retains the uniform scale factors.
  8665.    -- The NDC_DC_SCALE_TYPE is not, itself, restricted to uniform
  8666.    -- scaling; it is this procedure which produces restricted values.
  8667.    --
  8668.    -- WINDOW   - NDC units window of uniform transform
  8669.    -- VIEWPORT - DC units viewport of uniform transform
  8670.    -- SCALE    - private type holding returned scale values
  8671.      
  8672.       -- Get rectangles into two-point form, for readable operations
  8673.      
  8674.       W_RECT : NDC_RECTANGLE := NDC_RECTANGLE '(
  8675.             NDC . POINT '( WINDOW . XMIN, WINDOW . YMIN),
  8676.             NDC . POINT '( WINDOW . XMAX, WINDOW . YMAX));
  8677.       -- W_RECT is the window rectangle
  8678.      
  8679.       V_RECT : DC_RECTANGLE := DC_RECTANGLE '(
  8680.             DC . POINT '( VIEWPORT . XMIN, VIEWPORT . YMIN),
  8681.             DC . POINT '( VIEWPORT . XMAX, VIEWPORT . YMAX));
  8682.       -- V_RECT is the viewport rectangle
  8683.      
  8684.       -- Compute deltas
  8685.      
  8686.       W_DELTA : NDC . VECTOR := W_RECT (MAX) - W_RECT (MIN);
  8687.       -- W_DELTA is the size of the window
  8688.      
  8689.       V_DELTA :  DC . VECTOR := V_RECT (MAX) - V_RECT (MIN);
  8690.       -- V_DELTA is the size of the viewport
  8691.      
  8692.       W_SCALE : NDC . POINT;
  8693.       -- W_SCALE is the scale factors to transform to the window-space
  8694.      
  8695.       V_SCALE :  DC . POINT;
  8696.       -- V_SCALE is the scale factors to transform to the viewport-space
  8697.      
  8698.    begin
  8699.      
  8700.       begin
  8701.      
  8702.          W_SCALE . X := W_DELTA . X / NDC_TYPE (V_DELTA . X);
  8703.      
  8704.       exception
  8705.      
  8706.          when others =>
  8707.      
  8708.             -- V_DELTA . X may be zero resulting in overflow
  8709.             W_SCALE . X := 1.0;
  8710.      
  8711.       end;
  8712.      
  8713.       begin
  8714.      
  8715.          W_SCALE . Y := W_DELTA . Y / NDC_TYPE (V_DELTA . Y);
  8716.      
  8717.       exception
  8718.      
  8719.          when others =>
  8720.      
  8721.             -- V_DELTA . Y may be zero resulting in overflow
  8722.             W_SCALE . Y := 1.0;
  8723.      
  8724.       end;
  8725.      
  8726.       begin
  8727.      
  8728.          V_SCALE . X := V_DELTA . X / DC_TYPE (W_DELTA . X);
  8729.      
  8730.       exception
  8731.      
  8732.          when others =>
  8733.      
  8734.             -- W_DELTA . X may be zero resulting in overflow
  8735.             V_SCALE . X := 1.0;
  8736.      
  8737.       end;
  8738.      
  8739.       begin
  8740.      
  8741.          V_SCALE . Y := V_DELTA . Y / DC_TYPE (W_DELTA . Y);
  8742.      
  8743.       exception
  8744.      
  8745.          when others =>
  8746.      
  8747.             -- W_DELTA . Y may be zero resulting in overflow
  8748.             V_SCALE . Y := 1.0;
  8749.      
  8750.       end;
  8751.      
  8752.       -- To achieve a uniform scale, the dimension of V_SCALE with the
  8753.       -- smaller scale is allowed to dominate the other dimension .
  8754.      
  8755.       if V_SCALE . X < V_SCALE . Y then
  8756.      
  8757.          -- X scale dominates Y scale
  8758.          V_SCALE . Y := V_SCALE . X;
  8759.      
  8760.          -- W_SCALE follows V_SCALE proportions
  8761.          W_SCALE . Y := W_SCALE . X;
  8762.      
  8763.       else
  8764.      
  8765.          -- Y scale dominates X scale
  8766.          V_SCALE . X := V_SCALE . Y;
  8767.      
  8768.          -- W_SCALE follows V_SCALE proportions
  8769.          W_SCALE . X := W_SCALE . Y;
  8770.      
  8771.       end if;
  8772.      
  8773.       SCALE := NDC_DC_SCALE_TYPE' (
  8774.          V_SCALE => V_SCALE,
  8775.          V_SHIFT => V_RECT (MIN) - V_SCALE * DC_POINT (W_RECT (MIN)),
  8776.          W_SCALE => W_SCALE,
  8777.          W_SHIFT => W_RECT (MIN) - W_SCALE * NDC_POINT (V_RECT (MIN)));
  8778.      
  8779.    end SET_UNIFORM_SCALES;
  8780.      
  8781.    -- Define Conversion to DC types
  8782.      
  8783.    function DC_POINT
  8784.       (POINT  : NDC . POINT;
  8785.        SCALE  : NDC_DC_SCALE_TYPE) return DC . POINT  is
  8786.      
  8787.    -- Convert POINT to DC units using SCALE factor
  8788.    --
  8789.    -- POINT - input POINT
  8790.    -- SCALE - pre-computed scaling factors
  8791.      
  8792.    begin
  8793.      
  8794.       return DC_POINT (POINT) * SCALE . V_SCALE + SCALE . V_SHIFT;
  8795.      
  8796.    end DC_POINT;
  8797.      
  8798.    function DC_POINT_ARRAY
  8799.       (POINT_ARRAY : NDC . POINT_ARRAY;
  8800.        SCALE       : NDC_DC_SCALE_TYPE) return DC . POINT_ARRAY is
  8801.      
  8802.    -- Convert all POINTs in POINT_ARRAY to DC units using SCALE factor
  8803.    --
  8804.    -- POINT_ARRAY - array of input POINTs
  8805.    -- SCALE - pre-computed scaling factors
  8806.      
  8807.       POINTS : DC . POINT_ARRAY (POINT_ARRAY'RANGE);
  8808.       -- Array to hold converted points
  8809.      
  8810.    begin
  8811.      
  8812.       for I in POINT_ARRAY'RANGE loop
  8813.      
  8814.          POINTS (I) := DC_POINT (POINT_ARRAY (I), SCALE);
  8815.      
  8816.       end loop;
  8817.      
  8818.       return POINTS;
  8819.      
  8820.    end DC_POINT_ARRAY;
  8821.      
  8822.    function DC_RECTANGLE_LIMITS
  8823.       (RECTANGLE_LIMITS : NDC . RECTANGLE_LIMITS;
  8824.        SCALE             : NDC_DC_SCALE_TYPE)
  8825.        return DC . RECTANGLE_LIMITS is
  8826.      
  8827.    -- Convert RECTANGLE_LIMITS to DC units using SCALE factor
  8828.    --
  8829.    -- RECTANGLE_LIMITS - input RECTANGLE_LIMITS
  8830.    -- SCALE - pre-computed scaling factors
  8831.      
  8832.       SX : DC_TYPE renames SCALE . V_SCALE . X;
  8833.       SY : DC_TYPE renames SCALE . V_SCALE . Y;
  8834.       DX : DC_TYPE renames SCALE . V_SHIFT . X;
  8835.       DY : DC_TYPE renames SCALE . V_SHIFT . Y;
  8836.      
  8837.    begin
  8838.      
  8839.       return DC . RECTANGLE_LIMITS' (
  8840.             XMIN => DC_TYPE (RECTANGLE_LIMITS . XMIN) * SX + DX,
  8841.             XMAX => DC_TYPE (RECTANGLE_LIMITS . XMAX) * SX + DX,
  8842.             YMIN => DC_TYPE (RECTANGLE_LIMITS . YMIN) * SY + DY,
  8843.             YMAX => DC_TYPE (RECTANGLE_LIMITS . YMAX) * SY + DY);
  8844.      
  8845.       -- RECTANGLE_LIMITS are not compatible with DC_POINT_OPS, so
  8846.       -- component-by-component expressions are used.
  8847.      
  8848.    end DC_RECTANGLE_LIMITS;
  8849.      
  8850.    -- The following functions are for relative scaling only,
  8851.    -- not absolute positions
  8852.      
  8853.    function DC_VECTOR
  8854.       (VECTOR : NDC . VECTOR;
  8855.        SCALE  : NDC_DC_SCALE_TYPE) return DC . VECTOR is
  8856.      
  8857.    -- Convert VECTOR to DC units using SCALE factor
  8858.    --
  8859.    -- VECTOR - input VECTOR
  8860.    -- SCALE - pre-computed scaling factors
  8861.      
  8862.    begin
  8863.      
  8864.       return DC_VECTOR (VECTOR) * DC . VECTOR (SCALE . V_SCALE);
  8865.      
  8866.    end DC_VECTOR;
  8867.      
  8868.    function DC_SIZE
  8869.       (SIZE  : NDC . SIZE;
  8870.        SCALE : NDC_DC_SCALE_TYPE) return DC . SIZE is
  8871.      
  8872.    -- Convert SIZE to DC units using SCALE factor
  8873.    --
  8874.    -- SIZE - input SIZE
  8875.    -- SCALE - pre-computed scaling factors
  8876.      
  8877.       SX : DC . MAGNITUDE := DC . MAGNITUDE (abs SCALE . V_SCALE . X);
  8878.       -- Scale factor compatible with output type (DC . MAGNITUDE)
  8879.       SY : DC . MAGNITUDE := DC . MAGNITUDE (abs SCALE . V_SCALE . Y);
  8880.       -- Scale factor compatible with output type (DC . MAGNITUDE)
  8881.      
  8882.    begin
  8883.      
  8884.       return DC . SIZE' (
  8885.          XAXIS => DC . MAGNITUDE (SIZE . XAXIS) * SX,
  8886.          YAXIS => DC . MAGNITUDE (SIZE . YAXIS) * SY);
  8887.      
  8888.    end DC_SIZE;
  8889.      
  8890.    --
  8891.    -- Define bodies of simple conversions
  8892.    -- It is possible to use UNCHECKED_CONVERSIONS if the element types
  8893.    -- are the same.  However, explicit handling of each component is
  8894.    -- more general.
  8895.    --
  8896.      
  8897.    function DC_POINT
  8898.       (POINT : NDC . POINT ) return DC . POINT is
  8899.      
  8900.    -- Convert `POINT' to an equal `DC . POINT' (no scaling)
  8901.    --
  8902.    -- POINT - input NDC . POINT
  8903.      
  8904.    begin
  8905.      
  8906.       return DC . POINT'
  8907.          (DC_TYPE (POINT . X), DC_TYPE (POINT . Y));
  8908.      
  8909.    end DC_POINT;
  8910.      
  8911.    function DC_VECTOR
  8912.       (VECTOR : NDC . VECTOR ) return DC . VECTOR is
  8913.      
  8914.    -- Convert `VECTOR' to an equal `DC . VECTOR' (no scaling)
  8915.    --
  8916.    -- VECTOR - input NDC . VECTOR
  8917.      
  8918.    begin
  8919.      
  8920.       return DC . VECTOR'
  8921.             (DC_TYPE (VECTOR . X), DC_TYPE (VECTOR . Y));
  8922.      
  8923.    end DC_VECTOR;
  8924.      
  8925.    -- Define Conversion to NDC types
  8926.      
  8927.    function NDC_POINT
  8928.       (POINT : DC . POINT;
  8929.        SCALE : NDC_DC_SCALE_TYPE) return NDC . POINT is
  8930.      
  8931.    -- Convert POINT to DC units using SCALE factor
  8932.    --
  8933.    -- POINT - input POINT
  8934.    -- SCALE - pre-computed scaling factors
  8935.      
  8936.    begin
  8937.      
  8938.       return NDC_POINT (POINT) * SCALE . W_SCALE + SCALE . W_SHIFT;
  8939.      
  8940.    end NDC_POINT;
  8941.      
  8942.    function NDC_POINT_ARRAY
  8943.       (POINT_ARRAY  : DC . POINT_ARRAY;
  8944.        SCALE       : NDC_DC_SCALE_TYPE) return NDC . POINT_ARRAY is
  8945.      
  8946.    -- Convert all POINTs in POINT_ARRAY to NDC units using SCALE factor
  8947.    --
  8948.    -- POINT_ARRAY - array of input POINTs
  8949.    -- SCALE - pre-computed scaling factors
  8950.      
  8951.       POINTS : NDC . POINT_ARRAY (POINT_ARRAY'RANGE);
  8952.       -- Array to hold converted points
  8953.      
  8954.    begin
  8955.      
  8956.       for I in POINT_ARRAY'RANGE loop
  8957.      
  8958.          POINTS (I) := NDC_POINT (POINT_ARRAY (I),SCALE);
  8959.      
  8960.       end loop;
  8961.       return POINTS;
  8962.      
  8963.    end NDC_POINT_ARRAY;
  8964.      
  8965.    function NDC_RECTANGLE_LIMITS
  8966.       (RECTANGLE_LIMITS : DC . RECTANGLE_LIMITS;
  8967.        SCALE           : NDC_DC_SCALE_TYPE)
  8968.        return NDC . RECTANGLE_LIMITS is
  8969.      
  8970.    -- Convert RECTANGLE_LIMITS to NDC units using SCALE factor
  8971.    --
  8972.    -- RECTANGLE_LIMITS - input RECTANGLE_LIMITS
  8973.    -- SCALE - pre-computed scaling factors
  8974.      
  8975.       SX : NDC_TYPE renames SCALE . W_SCALE . X;
  8976.       SY : NDC_TYPE renames SCALE . W_SCALE . Y;
  8977.       DX : NDC_TYPE renames SCALE . W_SHIFT . X;
  8978.       DY : NDC_TYPE renames SCALE . W_SHIFT . Y;
  8979.      
  8980.    begin
  8981.      
  8982.       return NDC . RECTANGLE_LIMITS' (
  8983.             XMIN => NDC_TYPE (RECTANGLE_LIMITS . XMIN) * SX + DX,
  8984.             XMAX => NDC_TYPE (RECTANGLE_LIMITS . XMAX) * SX + DX,
  8985.             YMIN => NDC_TYPE (RECTANGLE_LIMITS . YMIN) * SY + DY,
  8986.             YMAX => NDC_TYPE (RECTANGLE_LIMITS . YMAX) * SY + DY);
  8987.      
  8988.       -- RECTANGLE_LIMITS are not compatible with DC_POINT_OPS, so
  8989.       -- component-by-component expressions are used.
  8990.      
  8991.    end NDC_RECTANGLE_LIMITS;
  8992.      
  8993.    -- The following functions are for relative scaling only,
  8994.    -- not absolute positions
  8995.      
  8996.    function NDC_VECTOR
  8997.       (VECTOR : DC . VECTOR;
  8998.        SCALE  : NDC_DC_SCALE_TYPE) return NDC . VECTOR is
  8999.      
  9000.    -- Convert VECTOR to NDC units using SCALE factor
  9001.    --
  9002.    -- VECTOR - input VECTOR
  9003.   -- SCALE - pre-computed scaling factors
  9004.      
  9005.    begin
  9006.      
  9007.       return NDC_VECTOR (VECTOR) * NDC . VECTOR (SCALE . W_SCALE);
  9008.      
  9009.    end NDC_VECTOR;
  9010.      
  9011.    function NDC_SIZE
  9012.       (SIZE  : DC . SIZE;
  9013.        SCALE : NDC_DC_SCALE_TYPE) return NDC . SIZE is
  9014.      
  9015.    -- Convert SIZE to NDC units using SCALE factor
  9016.    --
  9017.    -- SIZE - input SIZE
  9018.    -- SCALE - pre-computed scaling factors
  9019.      
  9020.       SX : NDC . MAGNITUDE := NDC . MAGNITUDE (abs SCALE . W_SCALE . X);
  9021.       -- Scale factor compatible with output type (NDC . MAGNITUDE)
  9022.       SY : NDC . MAGNITUDE := NDC . MAGNITUDE (abs SCALE . W_SCALE . Y);
  9023.       -- Scale factor compatible with output type (NDC . MAGNITUDE)
  9024.      
  9025.    begin
  9026.      
  9027.       return NDC . SIZE' (
  9028.             XAXIS => NDC . MAGNITUDE (SIZE . XAXIS) * SX,
  9029.             YAXIS => NDC . MAGNITUDE (SIZE . YAXIS) * SY);
  9030.      
  9031.    end NDC_SIZE;
  9032.      
  9033.    -- Define bodies of simple conversions
  9034.    -- It is possible to use UNCHECKED_CONVERSIONS if the element types
  9035.    -- are the same .   However, explicit handling of each component is
  9036.    -- more general .
  9037.      
  9038.    function NDC_POINT
  9039.       (POINT : DC . POINT ) return NDC . POINT is
  9040.      
  9041.    -- Convert `POINT' to an equal `NDC . POINT' (no scaling)
  9042.    --
  9043.    -- POINT - input DC . POINT
  9044.      
  9045.    begin
  9046.      
  9047.       return NDC . POINT'
  9048.             (NDC_TYPE (POINT . X), NDC_TYPE (POINT . Y));
  9049.      
  9050.    end NDC_POINT;
  9051.      
  9052.    function NDC_VECTOR
  9053.       (VECTOR : DC . VECTOR ) return NDC . VECTOR is
  9054.      
  9055.    -- Convert `VECTOR' to an equal `NDC . VECTOR' (no scaling)
  9056.    --
  9057.    -- VECTOR - input DC . VECTOR
  9058.      
  9059.    begin
  9060.      
  9061.       return NDC . VECTOR'
  9062.             (NDC_TYPE (VECTOR . X), NDC_TYPE (VECTOR . Y));
  9063.      
  9064.    end NDC_VECTOR;
  9065.      
  9066. end CONVERT_NDC_DC;
  9067. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9068. --:UDD:GKSADACM:CODE:MA:WS_ST_LST_TYP_MA.ADA
  9069. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9070. -- file:  ws_st_lst_typ_ma.ada
  9071. -- level: ma
  9072.      
  9073. with GKS_TYPES;
  9074. with OUTPUT_ATTRIBUTES_TYPE;
  9075. with WS_TABLE_TYPES;
  9076. with CONVERT_NDC_DC;
  9077.      
  9078. use GKS_TYPES;
  9079.      
  9080. package WS_STATE_LIST_TYPES is
  9081.      
  9082.    subtype CLR_INDEX  is COLOUR_INDEX     range 0 .. 127;
  9083.    -- The preceding subtype was declared so as not to raise a
  9084.    -- STORAGE ERROR at execution time.  The upper bound was chosen
  9085.    -- for the present implementation.  CLR_INDEX could be changed
  9086.    -- to support a larger colour table for other devices.
  9087.      
  9088.    type WS_STATE_LST
  9089.           (NUM_COLOUR_REPRESENTATION : CLR_INDEX := 0) is record
  9090.      
  9091.       -- The following is a copy of a subset of the GKS_STATE_LIST.
  9092.       OUTPUT_ATTR                     : OUTPUT_ATTRIBUTES_TYPE.
  9093.                                            OUTPUT_ATTRIBUTES;
  9094.      
  9095.       -- The application programmer's ID for a workstation.
  9096.       WORKSTATION_ID                  : WS_ID;
  9097.      
  9098.       -- The physical connection to the device.
  9099.       -- CONNECTION_ID must have default value to remain unconstrained
  9100.       CONNECT_ID                      : VARIABLE_CONNECTION_ID;
  9101.      
  9102.       -- The workstation category from the WS_DESCRIPTION_TABLE.
  9103.       WORKSTATION_CATEGORY            : WS_CATEGORY;
  9104.      
  9105.       -- The type of workstation.
  9106.       WORKSTATION_TYPE                : WS_TYPE;
  9107.      
  9108.       -- The workstation state, active or inactive.
  9109.       WS_STATE                        : GKS_TYPES.WS_STATE;
  9110.      
  9111.       -- Used for the deferral of output.
  9112.       WS_DEFERRAL_MODE                : DEFERRAL_MODE;
  9113.      
  9114.       -- Used to SUPPRESS or ALLOW implicit regeneration.
  9115.       WS_IMPLICIT_REGEN_MODE          : REGENERATION_MODE;
  9116.      
  9117.       -- Used to tell whether the display surface is EMPTY or not.
  9118.       WS_DISPLAY_SURFACE              : DISPLAY_SURFACE_EMPTY := EMPTY;
  9119.      
  9120.       -- Used to identify if a picture needs an implicit regeneration.
  9121.       WS_NEW_FRAME_ACTION             : NEW_FRAME_NECESSARY := NO;
  9122.      
  9123.       -- color table
  9124.      
  9125.       SET_OF_COLOUR_IDC          : COLOUR_INDICES.LIST_OF;
  9126.       COLOUR_TABLE               : WS_TABLE_TYPES.COLOUR_TABLE_LIST
  9127.                                        (0 .. NUM_COLOUR_REPRESENTATION);
  9128.      
  9129.       -- transformations
  9130.      
  9131.       -- Tells whether an update of the workstation transformation is
  9132.       -- needed.
  9133.       WS_XFORM_UPDATE_STATE      : UPDATE_STATE := NOTPENDING;
  9134.      
  9135.       -- The value to which the CURRENT_WS_WINDOW is set.
  9136.       REQUESTED_WS_WINDOW        : NDC.RECTANGLE_LIMITS :=
  9137.                                        (0.0, 1.0, 0.0, 1.0);
  9138.      
  9139.       -- The current workstation window.
  9140.       CURRENT_WS_WINDOW          : NDC.RECTANGLE_LIMITS :=
  9141.                                        (0.0, 1.0, 0.0, 1.0);
  9142.      
  9143.       -- The value to which the CURRENT_WS_VIEWPORT is set.
  9144.       REQUESTED_WS_VIEWPORT      : DC.RECTANGLE_LIMITS :=
  9145.                                        (0.0, 1.0, 0.0, 1.0);
  9146.      
  9147.       -- The current workstation viewport.
  9148.       CURRENT_WS_VIEWPORT        : DC.RECTANGLE_LIMITS :=
  9149.                                        (0.0, 1.0, 0.0, 1.0);
  9150.      
  9151.       -- clipping rectangle
  9152.      
  9153.       -- The computed clipping rectangle from the CURRENT_CLIPPING_
  9154.       -- RECTANGLE plus the CURRENT_WS_WINDOW.
  9155.      
  9156.       EFFECTIVE_CLIPPING_RECTANGLE : DC.RECTANGLE_LIMITS :=
  9157.                                         (0.0, 1.0, 0.0, 1.0);
  9158.      
  9159.       -- The following attributes are computed from the attributes
  9160.       -- in the GKS_STATE_LIST and the bundles in the WS_STATE_LIST
  9161.       -- depending on whether an ASF is BUNDLE or INDIVIDUAL.
  9162.      
  9163.       EFFECTIVE_POLYLINE_ATTR   : WS_TABLE_TYPES.POLYLINE_BUNDLE;
  9164.      
  9165.       EFFECTIVE_POLYMARKER_ATTR : WS_TABLE_TYPES.POLYMARKER_BUNDLE;
  9166.      
  9167.       EFFECTIVE_TEXT_ATTR       : WS_TABLE_TYPES.TEXT_BUNDLE;
  9168.      
  9169.       EFFECTIVE_FILL_AREA_ATTR  : WS_TABLE_TYPES.FILL_AREA_BUNDLE;
  9170.      
  9171.       -- The following is computed from the WS window and WS viewport
  9172.       -- and stored for easy access by the WS DRIVER.
  9173.      
  9174.       WS_TRANSFORM              : CONVERT_NDC_DC.NDC_DC_SCALE_TYPE;
  9175.      
  9176.    end record;
  9177.      
  9178.    type WS_STATE_LIST_PTR is access WS_STATE_LST;
  9179.      
  9180. end WS_STATE_LIST_TYPES;
  9181. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9182. --:UDD:GKSADACM:CODE:MA:LEXI3700_TBLS_MA.ADA
  9183. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9184. -- file : LEXI3700_TBLS_MA.ADA
  9185. -- level: ma
  9186.      
  9187. with OUTPUT_ATTRIBUTES_TYPE;
  9188. with WS_STATE_LIST_TYPES;
  9189. with WS_DESCRIPTION_TABLE_TYPES;
  9190. with GKS_TYPES;
  9191.      
  9192. use  GKS_TYPES;
  9193.      
  9194. package LEXI3700_WS_TABLES is
  9195.      
  9196. -- This package contains the specific WS_DESCRIPTION_TABLE and the list
  9197. -- of WS_STATE_LIST.  It also contains a function for retrieving a
  9198. -- pointer to a WS_STATE_LIST and a procedure that initializes a
  9199. -- WS_STATE_LIST and adds it to the list.  This package is used by
  9200. -- the WS driver.
  9201. -- The following packages are 'withed' for the following reasons:
  9202. -- The OUTPUT_ATTRIBUTES_TYPE package is the output attributes from
  9203. -- the GKS_STATE_LIST that are passed down as a parameter for the
  9204. -- workstation to keep track of.
  9205. -- The WS_STATE_LIST_TYPES package is used as a template to create a
  9206. -- new WS_STATE_LIST.
  9207. -- The WS_DESCRIPTION_TABLES_TYPES package is used as a template to
  9208. -- initialize LEXI3700_WS_DT.
  9209. -- The LEXI3700_CONFIGURATION package gives the capabilities of the
  9210. -- device to initialize LEXI3700_WS_DT.
  9211.      
  9212.    LEXI3700_WS_DT : WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL
  9213.       (NUM_PREDEFINED_PLIN_BUNDLE       => 0,
  9214.        NUM_PREDEFINED_PMRK_BUNDLE       => 0,
  9215.        NUM_PREDEFINED_TEXT_BUNDLE       => 0,
  9216.        NUM_PREDEFINED_FA_BUNDLE         => 0,
  9217.        NUM_PREDEFINED_PATTERN_TABLE     => 0,
  9218.        LAST_PREDEFINED_COLOUR_REP       => 7,
  9219.        NUM_OF_GDP_ID                    => 1);
  9220.      
  9221.    function GET_STATE_LIST_PTR
  9222.       (WS_ID : in GKS_TYPES.WS_ID) return
  9223.             WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9224.      
  9225.    procedure ADD_STATE_LIST_TO_LIST
  9226.       (WS_ID          : in GKS_TYPES.WS_ID;
  9227.        CONNECT_ID     : in VARIABLE_CONNECTION_ID;
  9228.        WS_TYPE        : in GKS_TYPES.WS_TYPE;
  9229.        ATTRIBUTES     : in OUTPUT_ATTRIBUTES_TYPE
  9230.                            .OUTPUT_ATTRIBUTES;
  9231.        EI             : out ERROR_INDICATOR);
  9232.      
  9233.    procedure DELETE_STATE_LIST_FROM_LIST
  9234.       (WS_ID : in GKS_TYPES.WS_ID);
  9235.      
  9236. end LEXI3700_WS_TABLES;
  9237. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9238. --:UDD:GKSADACM:CODE:MA:LEXI_UTILITIES.ADA
  9239. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9240. ------------------------------------------------------------------
  9241. --
  9242. --  NAME: LEXI_UTILITIES
  9243. --  IDENTIFIER: GDMXXX.1(1)
  9244. --  DISCREPANCY REPORTS:
  9245. --
  9246. ------------------------------------------------------------------
  9247. -- FILE: LEXI_UTILITIES.ADA
  9248. -- LEVEL : MA
  9249.      
  9250. with GKS_TYPES;
  9251. with LEXI3700_TYPES;
  9252.      
  9253. use GKS_TYPES;
  9254. use LEXI3700_TYPES;
  9255.      
  9256. package LEXI_UTILITIES is
  9257.      
  9258. -- This package contains utility functions specific to the LEXIDATA 3700
  9259.      
  9260.    function IDC
  9261.       (SINGLE_POINT : DC.POINT) return LEXI_POINT;
  9262.      
  9263.    function IDC
  9264.       (POINT_LIST  : DC.POINT_ARRAY) return LEXI_POINTS;
  9265.      
  9266. end LEXI_UTILITIES;
  9267. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9268. --:UDD:GKSADACM:CODE:MA:LEXI_UTILITIES_B.ADA
  9269. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9270. ------------------------------------------------------------------
  9271. --
  9272. --  NAME: LEXI_UTILITIES - BODY
  9273. --  IDENTIFIER: GDMXXX.1(1)
  9274. --  DISCREPANCY REPORTS:
  9275. --
  9276. ------------------------------------------------------------------
  9277. -- FILE: LEXI_UTILITIES_B.ADA
  9278. -- LEVEL : ma
  9279.      
  9280. with LEXI3700_WS_TABLES;
  9281.      
  9282. package body LEXI_UTILITIES is
  9283.      
  9284.    function IDC
  9285.       (POINT_LIST  : DC.POINT_ARRAY) return LEXI_POINTS is
  9286.      
  9287.    -- This function transforms coordinates from DC space to Integer
  9288.    -- Device Coordinates. It changes from a float type to an integer
  9289.    -- type. It also inverts the Y coordinates so that the origin is in
  9290.    -- the upper left corner of IDC instead of the lower left corner of
  9291.    -- DC. The first index of the array returned by this function will
  9292.    -- be 1 regardless of the indices of the array it received.
  9293.    --
  9294.    -- POINT_LIST is the list of points in DC to be converted to IDC.
  9295.      
  9296.    SCREEN_SIZE : RASTER_UNIT_SIZE;
  9297.    -- Contains the maximum X and Y dimensions on the Lexidata screen.
  9298.      
  9299.    IDC_POINTS : LEXI_POINTS(1 .. POINT_LIST'LENGTH);
  9300.    -- Contains the device coordinate points to be returned.
  9301.      
  9302.    IDC_COUNT : POSITIVE := 1;
  9303.    -- This is the index into the IDC_POINTS array. The value returned
  9304.    -- is guarenteed to begin at index #1.
  9305.      
  9306.    begin
  9307.      
  9308.       -- Assign to SCREEN_SIZE the value found in the description table.
  9309.       SCREEN_SIZE := LEXI3700_WS_TABLES.LEXI3700_WS_DT.
  9310.          MAX_DISPLAY_SURFACE_RASTER_UNITS;
  9311.      
  9312.       -- Repeat with each of the points in the input.
  9313.       for DC_COUNT in POINT_LIST'RANGE loop
  9314.      
  9315.          -- Convert the X coordinate of the point to an integer.
  9316.          IDC_POINTS(IDC_COUNT).X :=
  9317.             LEXI_COORDINATE(POINT_LIST(DC_COUNT).X);
  9318.      
  9319.          -- Invert the Y coordinate and convert it to an integer.
  9320.          IDC_POINTS(IDC_COUNT).Y := LEXI_COORDINATE
  9321.             (DC_TYPE(SCREEN_SIZE.Y) - POINT_LIST(DC_COUNT).Y -
  9322.              DC_TYPE'(1.0));
  9323.      
  9324.          IDC_COUNT := IDC_COUNT + 1;
  9325.      
  9326.       end loop;
  9327.      
  9328.       return IDC_POINTS;
  9329.      
  9330.    end IDC;
  9331.      
  9332.    function IDC
  9333.       (SINGLE_POINT : DC.POINT) return LEXI_POINT is
  9334.      
  9335.    -- This function transforms coordinates from DC space to Integer
  9336.    -- Device Coordinates. It changes from a float type to an integer
  9337.    -- type. It also inverts the Y coordinate so that the origin is in
  9338.    -- the upper left corner of IDC instead of the lower left corner of
  9339.    -- DC.
  9340.    --
  9341.    -- SINGLE_POINT is the point in DC to be converted to IDC.
  9342.      
  9343.    IDC_POINT : LEXI_POINT;
  9344.    -- Contains the device coordinate point to be returned.
  9345.      
  9346.    SCREEN_SIZE : RASTER_UNIT_SIZE;
  9347.    -- Contains the maximum X and Y dimensions on the Lexidata screen.
  9348.      
  9349.    begin
  9350.      
  9351.       -- Assign to SCREEN_SIZE the value found in the description table.
  9352.       SCREEN_SIZE := LEXI3700_WS_TABLES.LEXI3700_WS_DT.
  9353.          MAX_DISPLAY_SURFACE_RASTER_UNITS;
  9354.      
  9355.       -- Convert the X coordinate of the point to an integer.
  9356.       IDC_POINT.X := LEXI_COORDINATE(SINGLE_POINT.X);
  9357.      
  9358.       -- Invert the Y coordinate and convert it to an integer.
  9359.       IDC_POINT.Y := LEXI_COORDINATE
  9360.          (DC_TYPE(SCREEN_SIZE.Y) - SINGLE_POINT.Y - DC_TYPE'(1.0));
  9361.      
  9362.       return IDC_POINT;
  9363.      
  9364.    end IDC;
  9365.      
  9366. end LEXI_UTILITIES;
  9367. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9368. --:UDD:GKSADACM:CODE:MA:LEXI_OUT_PRIM_MA.ADA
  9369. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9370. ------------------------------------------------------------------
  9371. --
  9372. --  NAME: LEXI3700_OUTPUT_PRIMITIVES
  9373. --  IDENTIFIER: GDMXXX.2(1)
  9374. --  DISCREPANCY REPORTS:
  9375. --  Not listed
  9376. ------------------------------------------------------------------
  9377. -- FILE  : LEXI3700_OUT_PRIM.ADA
  9378. -- LEVEL : MA - 0A
  9379.      
  9380. with CGI;
  9381. with GKS_TYPES;
  9382. with WS_STATE_LIST_TYPES;
  9383.      
  9384. use  CGI;
  9385. use  GKS_TYPES;
  9386.      
  9387. package LEXI3700_OUTPUT_PRIMITIVES is
  9388.      
  9389. -- This package contains four output primitive procedures
  9390. -- for the Lexidata 3700 output device.
  9391.      
  9392.    procedure POLYLINE
  9393.       (WS_SL       : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9394.        LINE_POINTS : ACCESS_POINT_ARRAY_TYPE);
  9395.      
  9396.    procedure POLYMARKER
  9397.       (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9398.        MARKER_POINTS : ACCESS_POINT_ARRAY_TYPE);
  9399.      
  9400.    procedure FILL_AREA
  9401.       (WS_SL            : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9402.        FILL_AREA_POINTS : ACCESS_POINT_ARRAY_TYPE);
  9403.      
  9404.    procedure TEXT
  9405.       (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9406.        TEXT_POSITION : NDC.POINT;
  9407.        TEXT_STRING   : ACCESS_STRING_TYPE);
  9408.      
  9409. end LEXI3700_OUTPUT_PRIMITIVES;
  9410. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9411. --:UDD:GKSADACM:CODE:MA:WSR_SET_PRIM_MA.ADA
  9412. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9413. ------------------------------------------------------------------
  9414. --
  9415. --  NAME: WSR_SET_PRIMITIVE_ATTRIBUTES_MA
  9416. --  IDENTIFIER: GDMXXX.1(1)
  9417. --  DISCREPANCY REPORTS:
  9418. --
  9419. ------------------------------------------------------------------
  9420. -- file: WSR_SET_PRIM_MA.ADA
  9421. -- level: ma,0a,1a,2a
  9422.      
  9423. with GKS_TYPES;
  9424. with WS_STATE_LIST_TYPES;
  9425. with WS_DESCRIPTION_TABLE_TYPES;
  9426.      
  9427. use  GKS_TYPES;
  9428.      
  9429. package WSR_SET_PRIMITIVE_ATTRIBUTES_MA is
  9430.      
  9431. -- This package is a workstation resource package.  It can be used by
  9432. -- any workstation that needs to have the primitive attributes changed
  9433. -- in its workstation state list.
  9434.      
  9435.    procedure SET_CHAR_VECTORS
  9436.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9437.        CHAR_HEIGHT_VECTOR : in NDC.VECTOR;
  9438.        CHAR_WIDTH_VECTOR  : in NDC.VECTOR);
  9439.      
  9440.    procedure SET_TEXT_ALIGNMENT
  9441.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9442.        ALIGNMENT : in TEXT_ALIGNMENT);
  9443.      
  9444. end WSR_SET_PRIMITIVE_ATTRIBUTES_MA;
  9445. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9446. --:UDD:GKSADACM:CODE:MA:WSR_SET_PRIM_MA_B.ADA
  9447. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9448. ------------------------------------------------------------------
  9449. --
  9450. --  NAME: WSR_SET_PRIMITIVE_ATTRIBUTES_MA - BODY
  9451. --  IDENTIFIER: GDMXXX.1(1)
  9452. --  DISCREPANCY REPORTS:
  9453. --
  9454. ------------------------------------------------------------------
  9455. -- file: WSR_SET_PRIM_MA_B.ADA
  9456. -- level: ma,0a,1a,2a
  9457.      
  9458. package body WSR_SET_PRIMITIVE_ATTRIBUTES_MA is
  9459.      
  9460. -- The following procedures set the value specified by the parameter
  9461. -- in the WS_STATE_LIST.
  9462.      
  9463.    procedure SET_CHAR_VECTORS
  9464.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9465.        CHAR_HEIGHT_VECTOR : in NDC.VECTOR;
  9466.        CHAR_WIDTH_VECTOR  : in NDC.VECTOR) is separate;
  9467.      
  9468.    procedure SET_TEXT_ALIGNMENT
  9469.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9470.        ALIGNMENT : in TEXT_ALIGNMENT) is separate;
  9471.      
  9472. end WSR_SET_PRIMITIVE_ATTRIBUTES_MA;
  9473. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9474. --:UDD:GKSADACM:CODE:MA:WSR_SET_CHAR_VECS.ADA
  9475. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9476. ------------------------------------------------------------------
  9477. --
  9478. --  NAME: SET_CHAR_VECTORS
  9479. --  IDENTIFIER: GDMXXX.1(1)
  9480. --  DISCREPANCY REPORTS:
  9481. --
  9482. ------------------------------------------------------------------
  9483. -- file: WSR_SET_CHAR_VECS.ADA
  9484. -- level: ma,0a,1a,2a
  9485.      
  9486. separate (WSR_SET_PRIMITIVE_ATTRIBUTES_MA)
  9487.      
  9488. procedure SET_CHAR_VECTORS
  9489.    (WS_ST_LST      : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9490.     CHAR_HEIGHT_VECTOR : in NDC.VECTOR;
  9491.     CHAR_WIDTH_VECTOR  : in NDC.VECTOR) is
  9492.      
  9493. -- The CURRENT_HEIGHT_VECTOR and CURRENT_WIDTH_VECTOR entries in the
  9494. -- OUTPUT_ATTR record in the WS_STATE_LIST_TYPES package is set to
  9495. -- the values specified by the parameters.
  9496. --
  9497. -- The following parameters are used in this procedure :
  9498. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  9499. -- CHAR_HEIGHT_VECTOR - the upward direction that the character takes,
  9500. --                      as well as the height of the character.
  9501. -- CHAR_WIDTH_VECTOR - the vector in a 90 degree direction with the
  9502. --                     character height.  Also gives the width of the
  9503. --                     character.
  9504.      
  9505. begin
  9506.      
  9507.    WS_ST_LST.OUTPUT_ATTR.CURRENT_CHAR_HEIGHT_VECTOR :=
  9508.          CHAR_HEIGHT_VECTOR;
  9509.      
  9510.    WS_ST_LST.OUTPUT_ATTR.CURRENT_CHAR_WIDTH_VECTOR :=
  9511.          CHAR_WIDTH_VECTOR;
  9512.      
  9513. end SET_CHAR_VECTORS;
  9514. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9515. --:UDD:GKSADACM:CODE:MA:WSR_SET_TEXT_AL.ADA
  9516. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9517. ------------------------------------------------------------------
  9518. --
  9519. --  NAME: SET_TEXT_ALIGNMENT
  9520. --  IDENTIFIER: GDMXXX.1(1)
  9521. --  DISCREPANCY REPORTS:
  9522. --
  9523. ------------------------------------------------------------------
  9524. -- file: WSR_SET_TEXT_AL.ADA
  9525. -- level: ma - 2a
  9526.      
  9527. separate (WSR_SET_PRIMITIVE_ATTRIBUTES_MA)
  9528.      
  9529. procedure SET_TEXT_ALIGNMENT
  9530.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9531.     ALIGNMENT : in TEXT_ALIGNMENT) is
  9532.      
  9533. -- The CURRENT_TEXT_ALIGNMENT entry in the OUTPUT_ATTR record in the
  9534. -- WS_STATE_LIST_TYPES package is set to the value specified by the
  9535. -- parameter.
  9536. --
  9537. -- The following parameters are used in this procedure :
  9538. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  9539. -- TEXT_ALIGNMENT - the position where the text should line up for
  9540. --                  the starting (x, y) value. (i.e. (top,right),
  9541. --                  (normal,normal), or (centre, top) )
  9542.      
  9543. begin
  9544.      
  9545.    WS_ST_LST.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT := ALIGNMENT;
  9546.      
  9547. end SET_TEXT_ALIGNMENT;
  9548. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9549. --:UDD:GKSADACM:CODE:MA:WSR_SET_INDV_MA.ADA
  9550. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9551. ------------------------------------------------------------------
  9552. --
  9553. --  NAME: WSR_SET_INDIVIDUAL_ATTRIBUTES_MA
  9554. --  IDENTIFIER: GDMXXX.1(1)
  9555. --  DISCREPANCY REPORTS:
  9556. --
  9557. ------------------------------------------------------------------
  9558. -- file: WSR_SET_INDV_MA.ADA
  9559. -- level: ma,0a,1a,2a
  9560.      
  9561. with GKS_TYPES;
  9562. with WS_STATE_LIST_TYPES;
  9563. with WS_DESCRIPTION_TABLE_TYPES;
  9564.      
  9565. use GKS_TYPES;
  9566.      
  9567. package WSR_SET_INDIVIDUAL_ATTRIBUTES_MA is
  9568.      
  9569. -- This package is used by any workstation driver that needs to have
  9570. -- the individual attributes changed in its workstation state list.
  9571. -- The procedures first change the entry in the specified workstation
  9572. -- state list then they compute the EFFECTIVE ATTRIBUTES.  The EFFECTIVE
  9573. -- ATTRIBUTES are the attributes the primitives use when being output.
  9574. -- They are the combination of BUNDLED and INDIVIDUAL attributes stored
  9575. -- in a common place.  The EFFECTIVE ATTRIBUTES are an implementation
  9576. -- dependent feature used to optimize the output of primitives.
  9577.      
  9578.    procedure SET_LINETYPE
  9579.       (WS_ST_LST    : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9580.        WS_DSCR_TBL  : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  9581.        LINE         : in out LINETYPE);
  9582.      
  9583.    procedure SET_POLYLINE_COLOUR_INDEX
  9584.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9585.        COLOUR    : in COLOUR_INDEX);
  9586.      
  9587.    procedure SET_MARKER_TYPE
  9588.       (WS_ST_LST    : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9589.        WS_DSCR_TBL  : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  9590.        MARKER       : in out MARKER_TYPE);
  9591.      
  9592.    procedure SET_POLYMARKER_COLOUR_INDEX
  9593.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9594.        COLOUR    : in COLOUR_INDEX);
  9595.      
  9596.    procedure SET_TEXT_COLOUR_INDEX
  9597.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9598.        COLOUR    : in COLOUR_INDEX);
  9599.      
  9600.    procedure SET_FILL_AREA_INTERIOR_STYLE
  9601.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9602.        STYLE     : in INTERIOR_STYLE);
  9603.      
  9604.    procedure SET_FILL_AREA_COLOUR_INDEX
  9605.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9606.        COLOUR    : in COLOUR_INDEX);
  9607.      
  9608. end WSR_SET_INDIVIDUAL_ATTRIBUTES_MA;
  9609. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9610. --:UDD:GKSADACM:CODE:MA:WSR_SET_INDV_MA_B.ADA
  9611. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9612. ------------------------------------------------------------------
  9613. --
  9614. --  NAME: WSR_SET_INDIVIDUAL_ATTRIBUTES_MA - BODY
  9615. --  IDENTIFIER: GDMXXX.1(1)
  9616. --  DISCREPANCY REPORTS:
  9617. --
  9618. ------------------------------------------------------------------
  9619. -- file: WSR_SET_INDV_MA_B.ADA
  9620. -- level: ma,0a,1a,2a
  9621.      
  9622. package body WSR_SET_INDIVIDUAL_ATTRIBUTES_MA is
  9623.      
  9624. -- The following procedures set the value specified by the parameter
  9625. -- in the WS_STATE_LIST.  Some of the attributes chosen may not be
  9626. -- supported on a particular device.  This resource package only
  9627. -- checks the attributes that GKS defines to have a default value if
  9628. -- its not supported and will set it to the default value if not
  9629. -- supported.  The other attributes not having a default value but
  9630. -- defined as being implimentation dependent by GKS are set to the value
  9631. -- chosen by the application programmer.  The converting to a supported
  9632. -- value is left to the implementor of a WS DRIVER.
  9633.      
  9634.    procedure SET_LINETYPE
  9635.       (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9636.        WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  9637.        LINE        : in out LINETYPE) is separate;
  9638.      
  9639.    procedure SET_POLYLINE_COLOUR_INDEX
  9640.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9641.        COLOUR    : in COLOUR_INDEX) is separate;
  9642.      
  9643.    procedure SET_MARKER_TYPE
  9644.       (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9645.        WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  9646.        MARKER      : in out MARKER_TYPE) is separate;
  9647.      
  9648.    procedure SET_POLYMARKER_COLOUR_INDEX
  9649.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9650.        COLOUR    : in COLOUR_INDEX) is separate;
  9651.      
  9652.    procedure SET_TEXT_COLOUR_INDEX
  9653.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9654.        COLOUR    : in COLOUR_INDEX) is separate;
  9655.      
  9656.    procedure SET_FILL_AREA_INTERIOR_STYLE
  9657.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9658.        STYLE     : in INTERIOR_STYLE) is separate;
  9659.      
  9660.    procedure SET_FILL_AREA_COLOUR_INDEX
  9661.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9662.        COLOUR    : in COLOUR_INDEX) is separate;
  9663.      
  9664. end WSR_SET_INDIVIDUAL_ATTRIBUTES_MA;
  9665. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9666. --:UDD:GKSADACM:CODE:MA:WSR_SET_LINETYPE.ADA
  9667. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9668. ------------------------------------------------------------------
  9669. --
  9670. --  NAME: SET_LINETYPE
  9671. --  IDENTIFIER: GDMXXX.1(1)
  9672. --  DISCREPANCY REPORTS:
  9673. --
  9674. ------------------------------------------------------------------
  9675. -- file: WSR_SET_LINETYPE.ADA
  9676. -- level: ma,0a,1a,2a
  9677.      
  9678. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  9679.      
  9680. procedure SET_LINETYPE
  9681.    (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9682.     WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  9683.     LINE        : in out LINETYPE) is
  9684.      
  9685. -- The CURRENT_LINETYPE entry in the WS_STATE_LIST in the record
  9686. -- OUTPUT_ATTR is set to the value specified by the parameter. If
  9687. -- the value of the ASF is set to INDIVIDUAL the L_TYPE entry in the
  9688. -- EFFECTIVE_POLYLINE_ATTR is also set to the value specified
  9689. -- by the parameter.
  9690. --
  9691. -- The following parameters are used in this procedure:
  9692. -- WS_ST_LST - The WS_STATE_LIST to set the LINE_TYPE on.
  9693. -- WS_DSCR_TBL - The WS description table describing the specified
  9694. --               device.
  9695. -- LINE - the style line to be used.
  9696.      
  9697. begin
  9698.      
  9699.    if LINETYPES.IS_IN_LIST
  9700.           (LINE, WS_DSCR_TBL.LIST_AVAILABLE_LTYPE) then
  9701.       WS_ST_LST.OUTPUT_ATTR.CURRENT_LINETYPE := LINE;
  9702.    else
  9703.       -- If the line type is not supported on the specified workstation
  9704.       -- the GKS SPECIFICATION requires that the default be linetype 1;
  9705.       LINE := 1;
  9706.       WS_ST_LST.OUTPUT_ATTR.CURRENT_LINETYPE := LINE;
  9707.    end if;
  9708.      
  9709.    -- The following checks the ASF to set if it is set to INDIVIDUAL.
  9710.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS.LINETYPE =
  9711.                                                         INDIVIDUAL then
  9712.       WS_ST_LST.EFFECTIVE_POLYLINE_ATTR.L_TYPE := LINE;
  9713.    end if;
  9714.      
  9715. end SET_LINETYPE;
  9716. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9717. --:UDD:GKSADACM:CODE:MA:WSR_SET_PLIN_CLR_IDX.ADA
  9718. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9719. ------------------------------------------------------------------
  9720. --
  9721. --  NAME: SET_POLYLINE_COLOUR_INDEX
  9722. --  IDENTIFIER: GDMXXX.1(1)
  9723. --  DISCREPANCY REPORTS:
  9724. --
  9725. ------------------------------------------------------------------
  9726. -- file: WSR_SET_PLIN_CLR_IDX.ADA
  9727. -- level: ma - 2a
  9728.      
  9729. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  9730.      
  9731. procedure SET_POLYLINE_COLOUR_INDEX
  9732.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9733.     COLOUR    : in COLOUR_INDEX) is
  9734.      
  9735. -- The CURRENT_POLYLINE_COLOUR_INDEX  entry in the WS_STATE_LIST in the
  9736. -- OUTPUT_ATTR record is  set to the value specified by the parameter.
  9737. -- It only affects the display of subsequent POLYLINES if
  9738. -- its ASF is set to INDIVIDUAL.
  9739. --
  9740. -- The following parameters are used in this procedure:
  9741. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  9742. -- COLOUR - The specified colour to be used.
  9743.      
  9744. begin
  9745.      
  9746.    WS_ST_LST.OUTPUT_ATTR.CURRENT_POLYLINE_COLOUR_INDEX := COLOUR;
  9747.      
  9748.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  9749.    -- If it is, the entry COLOUR in EFFECTIVE_POLYLINE_ATTR will be
  9750.    -- set to the value specified by the parameter.
  9751.      
  9752.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  9753.          .LINE_COLOUR = INDIVIDUAL then
  9754.      
  9755.       WS_ST_LST.EFFECTIVE_POLYLINE_ATTR.COLOUR := COLOUR;
  9756.      
  9757.    end if;
  9758.      
  9759. end SET_POLYLINE_COLOUR_INDEX;
  9760. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9761. --:UDD:GKSADACM:CODE:MA:WSR_SET_PMRK_CLR_IDX.ADA
  9762. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9763. ------------------------------------------------------------------
  9764. --
  9765. --  NAME: SET_POLYMARKER_COLOUR_INDEX
  9766. --  IDENTIFIER: GDMXXX.1(1)
  9767. --  DISCREPANCY REPORTS:
  9768. --
  9769. ------------------------------------------------------------------
  9770. -- file: WSR_SET_PMRK_CLR_IDX.ADA
  9771. -- level: ma - 2a
  9772.      
  9773. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  9774.      
  9775. procedure SET_POLYMARKER_COLOUR_INDEX
  9776.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9777.     COLOUR    : in COLOUR_INDEX) is
  9778.      
  9779. -- The CURRENT_POLYMARKER_COLOUR_INDEX entry in the WS_STATE_LIST in the
  9780. -- OUTPUT_ATTR record is  set to the value specified by the parameter.
  9781. -- It only affects the display of subsequent POLYMARKERS if
  9782. -- its ASF is set to INDIVIDUAL.
  9783. --
  9784. -- The following parameters are used in this procedure:
  9785. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  9786. -- COLOUR - the specified colour to be used.
  9787.      
  9788. begin
  9789.      
  9790.    WS_ST_LST.OUTPUT_ATTR.CURRENT_POLYMARKER_COLOUR_INDEX := COLOUR;
  9791.      
  9792.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  9793.    -- If it is, the entry COLOUR in EFFECTIVE_POLYMARKER_ATTR is
  9794.    -- set to the value specified by the parameter.
  9795.      
  9796.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  9797.          .MARKER_COLOUR = INDIVIDUAL then
  9798.      
  9799.       WS_ST_LST.EFFECTIVE_POLYMARKER_ATTR.COLOUR := COLOUR;
  9800.      
  9801.    end if;
  9802.      
  9803. end SET_POLYMARKER_COLOUR_INDEX;
  9804. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9805. --:UDD:GKSADACM:CODE:MA:WSR_SET_TEXT_CLR_IDX.ADA
  9806. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9807. ------------------------------------------------------------------
  9808. --
  9809. --  NAME: SET_TEXT_COLOUR_INDEX
  9810. --  IDENTIFIER: GDMXXX.1(1)
  9811. --  DISCREPANCY REPORTS:
  9812. --
  9813. ------------------------------------------------------------------
  9814. -- file: WSR_SET_TEXT_CLR_IDX.ADA
  9815. -- level: ma - 2a
  9816.      
  9817. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  9818.      
  9819. procedure SET_TEXT_COLOUR_INDEX
  9820.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9821.     COLOUR    : in COLOUR_INDEX) is
  9822.      
  9823. -- The CURRENT_TEXT_COLOUR_INDEX entry in the WS_STATE_LIST in the
  9824. -- OUTPUT_ATTR record is  set to the value specified by the parameter.
  9825. -- If only affects the display of subsequent TEXT if its ASF is set to
  9826. -- INDIVIDUAL.
  9827. --
  9828. -- The following parameters are used in this procedure:
  9829. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  9830. -- COLOUR  - the specified colour to be used.
  9831.      
  9832. begin
  9833.      
  9834.    WS_ST_LST.OUTPUT_ATTR.CURRENT_TEXT_COLOUR_INDEX := COLOUR;
  9835.      
  9836.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  9837.    -- If it is, the entry COLOUR in EFFECTIVE_TEXT_ATTR is
  9838.    -- set to the value specified by the parameter.
  9839.      
  9840.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  9841.          .TEXT_COLOUR = INDIVIDUAL then
  9842.      
  9843.       WS_ST_LST.EFFECTIVE_TEXT_ATTR.COLOUR := COLOUR;
  9844.      
  9845.    end if;
  9846.      
  9847. end SET_TEXT_COLOUR_INDEX;
  9848. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9849. --:UDD:GKSADACM:CODE:MA:WSR_SET_FA_INT_STY.ADA
  9850. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9851. ------------------------------------------------------------------
  9852. --
  9853. --  NAME: SET_FILL_AREA_INTERIOR_STYLE
  9854. --  IDENTIFIER: GDMXXX.1(1)
  9855. --  DISCREPANCY REPORTS:
  9856. --
  9857. ------------------------------------------------------------------
  9858. -- file: WSR_SET_FA_INT_STY.ADA
  9859. -- level: ma - 2a
  9860.      
  9861. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  9862.      
  9863. procedure SET_FILL_AREA_INTERIOR_STYLE
  9864.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9865.     STYLE     : in INTERIOR_STYLE) is
  9866.      
  9867. -- The CURRENT_FILL_AREA_INTERIOR_STYLE entry in the WS_STATE_LIST in
  9868. -- the OUTPUT_ATTR record is set to the value specified by the
  9869. -- parameter.  It only affects the display of subsequent FILL_AREAs
  9870. -- if its ASF is set to INDIVIDUAL.
  9871. --
  9872. -- The following parameters are used in this procedure:
  9873. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  9874. -- STYLE - the specified intrior style to be used.
  9875.      
  9876. begin
  9877.      
  9878.    WS_ST_LST.OUTPUT_ATTR.CURRENT_FILL_AREA_INTERIOR_STYLE := STYLE;
  9879.      
  9880.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  9881.    -- If it is, the entry INT_STYLE in EFFECTIVE_FILL_AREA_ATTR is
  9882.    -- set to the value specified by the parameter.
  9883.      
  9884.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  9885.          .INTERIOR_STYLE = INDIVIDUAL then
  9886.      
  9887.       WS_ST_LST.EFFECTIVE_FILL_AREA_ATTR.INT_STYLE := STYLE;
  9888.      
  9889.    end if;
  9890.      
  9891. end SET_FILL_AREA_INTERIOR_STYLE;
  9892. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9893. --:UDD:GKSADACM:CODE:MA:WSR_SET_FA_CLR_IDX.ADA
  9894. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9895. ------------------------------------------------------------------
  9896. --
  9897. --  NAME: SET_FILL_AREA_COLOUR_INDEX
  9898. --  IDENTIFIER: GDMXXX.1(1)
  9899. --  DISCREPANCY REPORTS:
  9900. --
  9901. ------------------------------------------------------------------
  9902. -- file: WSR_SET_FA_CLR_IDX.ADA
  9903. -- level: ma - 2a
  9904.      
  9905. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  9906.      
  9907. procedure SET_FILL_AREA_COLOUR_INDEX
  9908.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9909.     COLOUR    : in COLOUR_INDEX) is
  9910.      
  9911. -- The CURRENT_FILL_AREA_COLOUR_INDEX entry in the WS_STATE_LIST in the
  9912. -- OUTPUT_ATTR record is set to the value specified by the parameter.
  9913. -- It only affects the display of subsequent FILL_AREAS if
  9914. -- its ASF is set to INDIVIDUAL.
  9915. --
  9916. -- The following parameters are used in this procedure:
  9917. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  9918. -- COLOUR - the specified colour to be used.
  9919.      
  9920. begin
  9921.      
  9922.    WS_ST_LST.OUTPUT_ATTR.CURRENT_FILL_AREA_COLOUR_INDEX := COLOUR;
  9923.      
  9924.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  9925.    -- If it is, the entry COLOUR in EFFECTIVE_FILL_AREA_ATTR is
  9926.    -- set to the value specified by the parameter.
  9927.      
  9928.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  9929.          .FILL_AREA_COLOUR = INDIVIDUAL then
  9930.      
  9931.       WS_ST_LST.EFFECTIVE_FILL_AREA_ATTR.COLOUR := COLOUR;
  9932.      
  9933.    end if;
  9934.      
  9935. end SET_FILL_AREA_COLOUR_INDEX;
  9936. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9937. --:UDD:GKSADACM:CODE:MA:WSR_SET_MARK_TYPE.ADA
  9938. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9939. ------------------------------------------------------------------
  9940. --
  9941. --  NAME: SET_MARKER_TYPE
  9942. --  IDENTIFIER: GDMXXX.1(1)
  9943. --  DISCREPANCY REPORTS:
  9944. --
  9945. -----------------------------------------------------------------
  9946. -- file: WSR_SET_MARK_TYPE.ADA
  9947. -- level: ma - 2a
  9948.      
  9949. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  9950.      
  9951. procedure SET_MARKER_TYPE
  9952.    (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  9953.     WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  9954.     MARKER      : in out MARKER_TYPE) is
  9955.      
  9956. -- The CURRENT_MARKER_TYPE  entry in the WS_STATE_LIST in the
  9957. -- OUTPUT_ATTR record is  set to the value specified by the parameter.
  9958. -- It only affects the display of subsequent POLYMARKERS if
  9959. -- its ASF is set to INDIVIDUAL.
  9960. --
  9961. -- The following parameters are used in this procedure:
  9962. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  9963. -- MARKER - the specified polymarker to be used.
  9964.      
  9965. begin
  9966.      
  9967.    if MARKER_TYPES.IS_IN_LIST
  9968.          (MARKER, WS_DSCR_TBL.LIST_AVAILABLE_MARKER_TYPES) then
  9969.      
  9970.       WS_ST_LST.OUTPUT_ATTR.CURRENT_MARKER_TYPE := MARKER;
  9971.      
  9972.    else
  9973.      
  9974.       -- If the specified polymarker is not supported on the specified
  9975.       -- workstation the GKS SPECIFICATION defines marker type 3 must
  9976.       -- be used.
  9977.       MARKER := 3;
  9978.       WS_ST_LST.OUTPUT_ATTR.CURRENT_MARKER_TYPE := MARKER;
  9979.      
  9980.    end if;
  9981.      
  9982.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  9983.    -- If it is, the entry M_TYPE in EFFECTIVE_POLYMARKER_ATTR will be
  9984.    -- set to the value specified by the parameter.
  9985.      
  9986.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS.MARKER_TYPE =
  9987.          INDIVIDUAL then
  9988.      
  9989.       WS_ST_LST.EFFECTIVE_POLYMARKER_ATTR.M_TYPE := MARKER;
  9990.      
  9991.    end if;
  9992.      
  9993. end SET_MARKER_TYPE;
  9994. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9995. --:UDD:GKSADACM:CODE:MA:WSR_WS_XFORM.ADA
  9996. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9997. ------------------------------------------------------------------
  9998. --
  9999. --  NAME: WSR_WS_TRANSFORMATION
  10000. --  IDENTIFIER: GDMXXX.1(1)
  10001. --  DISCREPANCY REPORTS:
  10002. --
  10003. ------------------------------------------------------------------
  10004. -- File:  WSR_WS_XFORM.ADA
  10005. -- Level: MA
  10006.      
  10007. with GKS_TYPES;
  10008. with WS_STATE_LIST_TYPES;
  10009.      
  10010. use GKS_TYPES;
  10011.      
  10012. package WSR_WS_TRANSFORMATION is
  10013.      
  10014. -- This package, WSR_WS_TRANSFORMATION, provides two procedures to
  10015. -- process requests to specify the Workstation Transformation, and
  10016. -- one procedure to update the workstation transformation.
  10017. --
  10018. -- Packages GKS_TYPES and WS_STATE_LIST_TYPES provide type definitions
  10019. -- for procedure parameters.  Note that packages NDC and DC are from the
  10020. -- GKS_TYPES package and are instantiations of the GKS_COORDINATE_SYSTEM
  10021. -- package.
  10022.      
  10023.    procedure SET_WS_WINDOW
  10024.       (DYNAMIC_MODIFICATION : in     GKS_TYPES . DYNAMIC_MODIFICATION;
  10025.        WS_SL     : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR;
  10026.        WS_WINDOW : in     NDC . RECTANGLE_LIMITS);
  10027.      
  10028.    procedure SET_WS_VIEWPORT
  10029.       (DYNAMIC_MODIFICATION : in     GKS_TYPES . DYNAMIC_MODIFICATION;
  10030.        WS_SL       : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR;
  10031.        WS_VIEWPORT : in     DC . RECTANGLE_LIMITS);
  10032.      
  10033.    procedure UPDATE_WS_TRANSFORMATION
  10034.       (WS_SL     : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR);
  10035.      
  10036. end WSR_WS_TRANSFORMATION;
  10037. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10038. --:UDD:GKSADACM:CODE:MA:WSR_WS_XFORM_B.ADA
  10039. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10040. ------------------------------------------------------------------
  10041. --
  10042. --  NAME: WSR_WS_TRANSFORMATION - BODY
  10043. --  IDENTIFIER: GDMXXX.1(1)
  10044. --  DISCREPANCY REPORTS:
  10045. --
  10046. ------------------------------------------------------------------
  10047. -- File:  WSR_WS_XFORM_B.ADA
  10048. -- Level: MA, 0A
  10049.      
  10050. package body WSR_WS_TRANSFORMATION is
  10051.      
  10052.    procedure SET_WS_WINDOW
  10053.       (DYNAMIC_MODIFICATION : in     GKS_TYPES . DYNAMIC_MODIFICATION;
  10054.        WS_SL     : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR;
  10055.        WS_WINDOW : in     NDC . RECTANGLE_LIMITS) is
  10056.      
  10057.    --     The overall function of SET_WS_WINDOW is to update the WS_SL
  10058.    -- to reflect the new WS_WINDOW of the Workstation Transformation.
  10059.    -- For efficiency's sake additional transformation matrices have been
  10060.    -- included in the WS_SL for use by the Workstation Driver. These
  10061.    -- must also be updated. In the same vein, an Effective Clipping
  10062.    -- Rectangle is computed. All of these efficiency measures are
  10063.    -- handled by the UPDATE_TRANSFORMATION subprogram.
  10064.    --
  10065.    -- Components of the WS_SL affected are as follows:
  10066.    -- REQUESTED_WS_WINDOW, WS_XFORM_UPDATE_STATE, WS_NEW_FRAME_ACTION,
  10067.    -- If UPDATE_TRANSFORMATION is called, then CURRENT_WS_WINDOW is set
  10068.    -- and additional calculations are done for updating the
  10069.    -- transformations and clipping rectangles.
  10070.    --
  10071.    -- DYNAMIC_MODIFICATION - specifies whether to update the CURRENT
  10072.    --       transformation immediately (IMM), or to cause an implicit
  10073.    --       regeneration (IRG).
  10074.    -- WS_SL - is the Workstation State List of the Workstation Driver.
  10075.    -- WS_WINDOW - specifies the Workstation Transformation window limits
  10076.    --       requested.
  10077.    --
  10078.    -- A note on the DYNAMIC_MODIFICATION parameter:  This should be
  10079.    -- equal to the value of the Workstation Description Table component
  10080.    -- WS_DYNAMICS . WS_TRANSFORMATION, but there are two ways for this
  10081.    -- to occur: 1) the Driver is written with a constant and the
  10082.    -- Workstation Description Table is defined in terms of the driver's
  10083.    -- behavior. 2) the Driver uses whatever value is in the Workstation
  10084.    -- Description Table to determine its actions. Case 1 can be used in
  10085.    -- most simple situations. In case 2, the Workstation Description
  10086.    -- Table component WS_DYNAMICS . WS_TRANSFORMATION should be passed.
  10087.      
  10088.    begin
  10089.      
  10090.       WS_SL . REQUESTED_WS_WINDOW := WS_WINDOW;
  10091.      
  10092.       if DYNAMIC_MODIFICATION = IMM or else
  10093.      
  10094.             WS_SL . WS_DISPLAY_SURFACE = EMPTY then
  10095.      
  10096.          UPDATE_WS_TRANSFORMATION(WS_SL);
  10097.      
  10098.       else
  10099.      
  10100.          WS_SL . WS_XFORM_UPDATE_STATE := PENDING;
  10101.      
  10102.          WS_SL . WS_NEW_FRAME_ACTION := YES;
  10103.      
  10104.       end if;
  10105.      
  10106.    end SET_WS_WINDOW;
  10107.      
  10108.    procedure SET_WS_VIEWPORT
  10109.       (DYNAMIC_MODIFICATION : in     GKS_TYPES . DYNAMIC_MODIFICATION;
  10110.        WS_SL       : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR;
  10111.        WS_VIEWPORT : in     DC . RECTANGLE_LIMITS) is
  10112.      
  10113.    --     The purpose of SET_WS_VIEWPORT to update the WS_SL to
  10114.    -- reflect the new WS_VIEWPORT of the Workstation Transformation. For
  10115.    -- efficiency's sake additional transformations have been included
  10116.    -- in the WS_SL for use by the Workstation Driver. These must
  10117.    -- also be updated. In the same vein, an Effective Clipping Rectangle
  10118.    -- is computed. All of these efficiency measures are handled by the
  10119.    -- UPDATE_TRANSFORMATION subprogram.
  10120.    --
  10121.    -- Components of the WS_SL affected are as follows:
  10122.    -- REQUESTED_WS_VIEWPORT, WS_XFORM_UPDATE_STATE, WS_NEW_FRAME_ACTION,
  10123.    -- If UPDATE_TRANSFORMATION is called, then CURRENT_WS_VIEWPORT is
  10124.    -- set and additional calculations are done for updating the
  10125.    -- transformations and clipping rectangles.
  10126.    --
  10127.    -- DYNAMIC_MODIFICATION - specifies whether to update the CURRENT
  10128.    --       transformation immediately (IMM), or to cause an implicit
  10129.    --       regeneration (IRG).
  10130.    -- WS_SL - is the Workstation State List of the Workstation Driver.
  10131.    -- WS_VIEWPORT - specifies the Workstation Transformation viewport
  10132.    --       limits requested.
  10133.    --
  10134.    -- A note on the DYNAMIC_MODIFICATION parameter:  This should be
  10135.    -- equal to the value of the Workstation Description Table component
  10136.    -- WS_DYNAMICS . WS_TRANSFORMATION, but there are two ways for this
  10137.    -- to occur: 1) the Driver is written with a constant and the
  10138.    -- Workstation Description Table is defined in terms of the driver's
  10139.    -- behavior. 2) the Driver uses whatever value is in the Workstation
  10140.    -- Description Table to determine its actions. Case 1 can be used in
  10141.    -- most simple situations. In case 2, the Workstation Description
  10142.    -- Table component WS_DYNAMICS . WS_TRANSFORMATION should be passed.
  10143.      
  10144.    begin
  10145.      
  10146.       WS_SL . REQUESTED_WS_VIEWPORT := WS_VIEWPORT;
  10147.      
  10148.       if DYNAMIC_MODIFICATION = IMM or else
  10149.      
  10150.             WS_SL . WS_DISPLAY_SURFACE = EMPTY then
  10151.      
  10152.          UPDATE_WS_TRANSFORMATION ( WS_SL );
  10153.      
  10154.       else
  10155.      
  10156.          WS_SL . WS_XFORM_UPDATE_STATE := PENDING;
  10157.      
  10158.          WS_SL . WS_NEW_FRAME_ACTION := YES;
  10159.      
  10160.       end if;
  10161.      
  10162.    end SET_WS_VIEWPORT;
  10163.      
  10164.    procedure UPDATE_WS_TRANSFORMATION
  10165.       (WS_SL     : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR) is
  10166.      
  10167.          separate;
  10168.      
  10169. end WSR_WS_TRANSFORMATION;
  10170. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10171. --:UDD:GKSADACM:CODE:MA:WSR_UPDATE_WS_XFORM.ADA
  10172. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10173. ------------------------------------------------------------------
  10174. --
  10175. --  NAME: UPDATE_WS_TRANSFORMATION
  10176. --  IDENTIFIER: GDMXXX.1(1)
  10177. --  DISCREPANCY REPORTS:
  10178. --
  10179. ------------------------------------------------------------------
  10180. -- File: WSR_UPDATE_WS_XFORM.ADA
  10181. -- Level: MA, 0A
  10182.      
  10183. with CONVERT_NDC_DC;
  10184. with NDC_OPS;
  10185.      
  10186. separate (WSR_WS_TRANSFORMATION)
  10187.      
  10188. procedure UPDATE_WS_TRANSFORMATION
  10189.    (WS_SL     : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR) is
  10190.      
  10191. -- Procedure UPDATE_WS_TRANSFORMATION updates the Workstation State List
  10192. -- `WS_SL' to reflect the current values of REQUESTED_WS_WINDOW and
  10193. -- REQUESTED_WS_VIEWPORT.  The CURRENT_WS_WINDOW and the
  10194. -- CURRENT_WS_VIEWPORT are updated. If there is any change in these
  10195. -- values, the WS_TRANSFORM and EFFECTIVE_CLIPPING_RECTANGLE are also
  10196. -- updated.
  10197.      
  10198. -- WS_SL is the Workstation State List (access value) to be updated.
  10199.      
  10200.    NDC_EFFECTIVE_CLIPPING_RECTANGLE : NDC . RECTANGLE_LIMITS;
  10201.    -- Intersection of `WS_SL . OUTPUT_ATTR . CLIPPING_RECTANGLE',
  10202.    -- with the `WS_SL . CURRENT_WS_WINDOW'.
  10203.      
  10204. begin
  10205.      
  10206.    -- Test if current WINDOW//VIEWPORT is up to date (equal requested)
  10207.    if WS_SL . CURRENT_WS_WINDOW /= WS_SL . REQUESTED_WS_WINDOW or else
  10208.       WS_SL . CURRENT_WS_VIEWPORT /= WS_SL . REQUESTED_WS_VIEWPORT then
  10209.      
  10210.       WS_SL . CURRENT_WS_WINDOW := WS_SL . REQUESTED_WS_WINDOW;
  10211.      
  10212.       WS_SL . CURRENT_WS_VIEWPORT := WS_SL . REQUESTED_WS_VIEWPORT;
  10213.      
  10214.       -- Compute and change the pre-computed transformation value
  10215.       --
  10216.       -- Note that the Workstation transformation is an EQUAL scaling
  10217.       -- in both X and Y --- no distortion is introduced into the NDC
  10218.       -- picture.  As far as scaling is concerned, the Workstation
  10219.       -- Viewport is reduced to the same X-Y proportion as the
  10220.       -- Workstation Window. Clipping is performed at the actual
  10221.       -- window.
  10222.      
  10223.       CONVERT_NDC_DC . SET_UNIFORM_SCALES
  10224.             (WS_SL . CURRENT_WS_WINDOW,
  10225.              WS_SL . CURRENT_WS_VIEWPORT,
  10226.              WS_SL . WS_TRANSFORM);
  10227.      
  10228.       -- Change `WS_SL . EFFECTIVE_CLIPPING_RECTANGLE'.
  10229.       -- The effective clipping rectangle is stored in Device
  10230.       -- Coordinates; hence it must be recomputed with each change
  10231.       -- to the Workstation Transformation.  This includes changes in
  10232.       -- the Workstation Viewport, not just when the Workstation Window
  10233.       -- changes.
  10234.       --   The current clipping rectangle, stored in NDC, is "and"ed
  10235.       -- with the workstation window and then converted to DC units.
  10236.      
  10237.       NDC_EFFECTIVE_CLIPPING_RECTANGLE := NDC_OPS . "and"
  10238.             (WS_SL . OUTPUT_ATTR . CLIPPING_RECTANGLE,
  10239.              WS_SL . CURRENT_WS_WINDOW);
  10240.      
  10241.       WS_SL . EFFECTIVE_CLIPPING_RECTANGLE :=
  10242.             CONVERT_NDC_DC . DC_RECTANGLE_LIMITS
  10243.             (NDC_EFFECTIVE_CLIPPING_RECTANGLE,
  10244.             WS_SL . WS_TRANSFORM);
  10245.      
  10246.    end if;
  10247.      
  10248.    WS_SL . WS_XFORM_UPDATE_STATE := NOTPENDING;
  10249.      
  10250. end UPDATE_WS_TRANSFORMATION;
  10251. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10252. --:UDD:GKSADACM:CODE:MA:GKS_ERRORS.ADA
  10253. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10254. ------------------------------------------------------------------
  10255. --
  10256. --  NAME: GKS_ERRORS
  10257. --  IDENTIFIER: GIMXXX.2(1)
  10258. --  DISCREPANCY REPORTS:
  10259. --  #022  06/13/85  "Add error #85 back into GKS_ERRORS"
  10260. ------------------------------------------------------------------
  10261. -- file : GKS_ERRORS.ADA
  10262. -- levels : all levels
  10263.      
  10264. with GKS_TYPES;
  10265.      
  10266. use GKS_TYPES;
  10267.      
  10268. package GKS_ERRORS is
  10269.      
  10270. -- This package defines error indicator constants to be used
  10271. -- in place of error indicator numbers within code.
  10272.      
  10273. -- IMPLEMENTATION DEPENDENT ERRORS
  10274.      
  10275.    SUCCESSFUL : constant ERROR_INDICATOR := 0;
  10276.      
  10277. -- STATE ERRORS
  10278.      
  10279. -- 1   GKS not in proper state: GKS shall be in state GKCL
  10280.    NOT_GKCL   : constant ERROR_INDICATOR := 1;
  10281.      
  10282. -- 2   GKS not in proper state: GKS shall be in state GKOP
  10283.    NOT_GKOP   : constant ERROR_INDICATOR := 2;
  10284.      
  10285. -- 3   GKS not in proper state: GKS shall be in state WSAC
  10286.    NOT_WSAC   : constant ERROR_INDICATOR := 3;
  10287.      
  10288. -- 4   GKS not in proper state: GKS shall be in state SGOP
  10289.    NOT_SGOP   : constant ERROR_INDICATOR := 4;
  10290.      
  10291. -- 5   GKS not in proper state: GKS shall be in either in
  10292. --     state WSAC or in state SGOP
  10293.    NOT_WSAC_SGOP  : constant ERROR_INDICATOR := 5;
  10294.      
  10295. -- 6   GKS not in proper state: GKS shall be in either state
  10296. --     WSOP or in state WSAC
  10297.    NOT_WSOP_WSAC  : constant ERROR_INDICATOR := 6;
  10298.      
  10299. -- 7   GKS not in proper state: GKS shall be in one of the
  10300. --     states WSOP, WSAC or SGOP
  10301.    NOT_WSOP_WSAC_SGOP  : constant ERROR_INDICATOR := 7;
  10302.      
  10303. -- 8   GKS not in proper state: GKS shall be in one of the
  10304. --     states GKOP, WSOP, WSAC or SGOP
  10305.    NOT_GKOP_WSOP_WSAC_SGOP : constant ERROR_INDICATOR := 8;
  10306.      
  10307.      
  10308. -- WS ERRORS
  10309.      
  10310. -- 21  Specified connection identifier is invalid
  10311.    INVALID_CONN_ID  : constant ERROR_INDICATOR := 21;
  10312.      
  10313. -- 23  Specified workstation type does not exist
  10314.    WS_TYPE_DOES_NOT_EXIST : constant ERROR_INDICATOR := 23;
  10315.      
  10316. -- 24  Specified workstation is open
  10317.    WS_IS_OPEN       : constant ERROR_INDICATOR := 24;
  10318.      
  10319. -- 25  Specified workstation is not open
  10320.    WS_NOT_OPEN      : constant ERROR_INDICATOR := 25;
  10321.      
  10322. -- 26  Specified workstation cannot be opened
  10323.    WS_CANNOT_OPEN   : constant ERROR_INDICATOR := 26;
  10324.      
  10325. -- 27  Workstation Independent Segment Storage is not open
  10326.    WISS_NOT_OPEN    : constant ERROR_INDICATOR := 27;
  10327.      
  10328. -- 28  Workstation Independent Segment Storage is already open
  10329.    WISS_ALREADY_OPEN : constant ERROR_INDICATOR := 28;
  10330.      
  10331. -- 29  Specified workstation is active
  10332.    WS_IS_ACTIVE     : constant ERROR_INDICATOR := 29;
  10333.      
  10334. -- 30  Specified workstation is not active
  10335.    WS_IS_NOT_ACTIVE : constant ERROR_INDICATOR := 30;
  10336.      
  10337. -- 31  Specified workstation is of category MO
  10338.    WS_CATEGORY_IS_MO : constant ERROR_INDICATOR := 31;
  10339.      
  10340. -- 32  Specified workstation is not of category MO
  10341.    WS_CATEGORY_NOT_MO  : constant ERROR_INDICATOR := 32;
  10342.      
  10343. -- 33  Specified workstation is of category MI
  10344.    WS_CATEGORY_IS_MI   : constant ERROR_INDICATOR := 33;
  10345.      
  10346. -- 34  Specified workstation is not of category MI
  10347.    WS_CATEGORY_NOT_MI  : constant ERROR_INDICATOR := 34;
  10348.      
  10349. -- 35  Specified workstation is of category INPUT
  10350.    WS_CATEGORY_IS_INPUT : constant ERROR_INDICATOR := 35;
  10351.      
  10352. -- 36  Specified workstation is Workstation Independent
  10353. --     Segment Storage
  10354.    WS_IS_WISS           : constant ERROR_INDICATOR := 36;
  10355.      
  10356. -- 37  Specified workstation is not of category OUTIN
  10357.    WS_CATEGORY_NOT_OUTIN : constant ERROR_INDICATOR := 37;
  10358.      
  10359. -- 38  Specified workstation is neither of category INPUT nor
  10360. --     of category OUTIN
  10361.    WS_NOT_INPUT_OUTIN    : constant ERROR_INDICATOR := 38;
  10362.      
  10363. -- 39  Specified workstation is neither of category OUTPUT nor
  10364. --     of category OUTIN
  10365.    WS_NOT_OUTPUT_OUTIN   : constant ERROR_INDICATOR := 39;
  10366.      
  10367. -- 40  Specified workstation has no pixel store readback
  10368. --     capability
  10369.    WS_CANNOT_PIXEL_READBACK : constant ERROR_INDICATOR := 40;
  10370.      
  10371. -- 41  Specified workstation type is not able to generate the
  10372. --     specified generalized drawing primitive
  10373.    WS_TYPE_CANNOT_GEN_GDP   : constant ERROR_INDICATOR := 41;
  10374.      
  10375. -- 42  Maximum number of simultaneously open workstations would
  10376. --     be exceeded
  10377.    MAX_NUM_OF_OPEN_WS       : constant ERROR_INDICATOR := 42;
  10378.      
  10379. -- 43  Maximum number of simultaneously active workstations would
  10380. --     be exceeded
  10381.    MAX_NUM_OF_ACTIVE_WS     : constant ERROR_INDICATOR := 43;
  10382.      
  10383.      
  10384. -- TRANSFORMATION ERRORS
  10385.      
  10386. -- 50  Transformation number is invalid
  10387.    INVALID_XFORM_NUMBER           : constant ERROR_INDICATOR :=50;
  10388.      
  10389. -- 51  Rectangle definition is invalid
  10390.    INVALID_RECTANGLE              : constant ERROR_INDICATOR :=51;
  10391.      
  10392. -- 52  Viewport is not within the Normalized Device Coordinate
  10393. --     unit square
  10394.    VIEWPORT_NOT_IN_NDC_UNIT_SQR        : constant ERROR_INDICATOR :=52;
  10395.      
  10396. -- 53  Workstation window is not within the Normalized Device
  10397. --     Coordinate unit square
  10398.    WS_WINDOW_NOT_IN_NDC_UNIT_SQR    : constant ERROR_INDICATOR :=53;
  10399.      
  10400. -- 54  Workstation viewport is not within the display space
  10401.    WS_VIEWPORT_NOT_IN_DISPLAY_SPACE : constant ERROR_INDICATOR :=54;
  10402.      
  10403.      
  10404. -- OUTPUT ATTRIBUTE ERRORS
  10405.      
  10406. -- 60  Polyline index is invalid
  10407. --     This error is precluded by the Ada language.
  10408.    INVALID_POLYLINE_INDEX     : constant ERROR_INDICATOR := 60;
  10409.      
  10410. -- 61  A representation for the specified polyline index has not
  10411. --     been defined on this workstation
  10412.    NO_POLYLINE_REP            : constant ERROR_INDICATOR := 61;
  10413.      
  10414. -- 62  A representation for the specified polyline index has not
  10415. --     been predefined on this workstation
  10416.    NO_PREDEF_POLYLINE_REP     : constant ERROR_INDICATOR := 62;
  10417.      
  10418. -- 63  Linetype is equal to zero
  10419.    LINETYPE_IS_ZERO           : constant ERROR_INDICATOR := 63;
  10420.      
  10421. -- 64  Specified linetype is not supported on this workstation
  10422.    LINETYPE_NOT_ON_WS         : constant ERROR_INDICATOR := 64;
  10423.      
  10424. -- 66  Polymarker index is invalid
  10425. --     This error is precluded by the Ada language.
  10426.    INVALID_POLYMARKER_INDEX   : constant ERROR_INDICATOR := 66;
  10427.      
  10428. -- 67  A representation for the specified polymarker index has
  10429. --     not been defined on this workstation
  10430.    NO_POLYMARKER_REP          : constant ERROR_INDICATOR := 67;
  10431.      
  10432. -- 68  A representation for the specified polymarker index has not
  10433. --     been predefined on this workstation
  10434.    NO_PREDEF_POLYMARKER_REP   : constant ERROR_INDICATOR := 68;
  10435.      
  10436. -- 69  Marker type is equal to zero
  10437.    MARKER_TYPE_IS_ZERO        : constant ERROR_INDICATOR := 69;
  10438.      
  10439. -- 70  Specified marker type is not supported on this workstation
  10440.    MARKER_TYPE_NOT_ON_WS      : constant ERROR_INDICATOR := 70;
  10441.      
  10442. -- 72  Text index is invalid
  10443. --     This error is precluded by the Ada language.
  10444.    INVALID_TEXT_INDEX         : constant ERROR_INDICATOR := 72;
  10445.      
  10446. -- 73  A representation for the specified text index has not been
  10447. --     defined on this workstation
  10448.    NO_TEXT_REP                : constant ERROR_INDICATOR := 73;
  10449.      
  10450. -- 74  A representation for the specified text index has not
  10451. --     been predefined on this workstation
  10452.    NO_PREDEF_TEXT_REP         : constant ERROR_INDICATOR := 74;
  10453.      
  10454. -- 75  Text font is equal to zero
  10455.    TEXT_FONT_IS_ZERO          : constant ERROR_INDICATOR := 75;
  10456.      
  10457. -- 76  Requested text font is not supported for the specified
  10458. --     precision on this workstation
  10459.    TEXT_FONT_NOT_ON_WS        : constant ERROR_INDICATOR := 76;
  10460.      
  10461. -- 79  Length of character up vector is zero
  10462.    CHAR_UP_VECTOR_IS_ZERO     : constant ERROR_INDICATOR := 79;
  10463.      
  10464. -- 80  Fill area index is invalid
  10465. --     This error is precluded by the Ada language.
  10466.    INVALID_FILL_AREA_INDEX    : constant ERROR_INDICATOR := 80;
  10467.      
  10468. -- 81  A representation for the specified fill area index has
  10469. --     not been defined on this workstation
  10470.    NO_FILL_AREA_REP           : constant ERROR_INDICATOR := 81;
  10471.      
  10472. -- 82  A representation for the specified fill area index has
  10473. --     not been predefined on this workstation
  10474.    NO_PREDEF_FILL_AREA_REP    : constant ERROR_INDICATOR := 82;
  10475.      
  10476. -- 83  Specified fill area interior style is not supported on
  10477. --     this workstation
  10478.    FILL_AREA_STYLE_NOT_ON_WS  : constant ERROR_INDICATOR := 83;
  10479.      
  10480. -- 84  Style (pattern or hatch) index is equal to zero
  10481.    STYLE_INDEX_IS_ZERO        : constant ERROR_INDICATOR :=84;
  10482.      
  10483. -- 85  Specified pattern index is invalid                      -- DR022
  10484.    INVALID_PATTERN_INDEX      : constant ERROR_INDICATOR :=85; -- DR022
  10485.                                                                -- DR022
  10486. -- 86  Specified hatch style is not supported on this workstation
  10487.    HATCH_STYLE_NOT_ON_WS      : constant ERROR_INDICATOR :=86;
  10488.      
  10489. -- 88  A representation for the specified pattern index has not
  10490. --     been defined on this workstation
  10491.    NO_PATTERN_REP             : constant ERROR_INDICATOR :=88;
  10492.      
  10493. -- 89  A representation for the specified pattern index has not
  10494. --     been predefined on this workstation
  10495.    NO_PREDEF_PATTERN_REP      : constant ERROR_INDICATOR :=89;
  10496.      
  10497. -- 90  Interior style PATTERN is not supported on this worksta-
  10498. --     tion
  10499.    PATTERN_STYLE_NOT_ON_WS    : constant ERROR_INDICATOR :=90;
  10500.      
  10501. -- 93  Colour index is invalid
  10502. --     This error is precluded by the Ada language.
  10503.    INVALID_COLOUR_INDEX       : constant ERROR_INDICATOR := 93;
  10504.      
  10505. -- 94  A representation for the specified colour index has not
  10506. --     been defined on this workstation
  10507.    NO_COLOUR_REP              : constant ERROR_INDICATOR := 94;
  10508.      
  10509. -- 95  A representation for the specified colour index has not
  10510. --     been predefined on this workstation
  10511.    NO_PREDEF_COLOUR_REP       : constant ERROR_INDICATOR := 95;
  10512.      
  10513.      
  10514. --   OUTPUT PRIMITIVE ERRORS
  10515.      
  10516. -- 100  Number of points is invalid
  10517.    INVALID_NUMBER_OF_POINTS        : constant ERROR_INDICATOR := 100;
  10518.      
  10519. -- 101  Invalid code in string
  10520.    INVALID_STRING_CODE        : constant ERROR_INDICATOR := 101;
  10521.      
  10522. -- 102  Generalized drawing primitive identifier is invalid
  10523.    INVALID_GDP_ID             : constant ERROR_INDICATOR := 102;
  10524.      
  10525. -- 103  Content of generalized drawing primitive data record
  10526. --       is invalid
  10527.    INVALID_GDP_DATA_RECORD    : constant ERROR_INDICATOR := 103;
  10528.      
  10529. -- 104  At least one active workstation is not able to generate
  10530. --      the specified generalized drawing primitive
  10531.    SOME_WS_CANNOT_GEN_GDP : constant ERROR_INDICATOR := 104;
  10532.      
  10533. -- 105  At least one active workstation is not able to generate
  10534. --      the specified generalized drawing primitive under the
  10535. --      current transformations and clipping rectangle
  10536.    SOME_WS_CANNOT_GEN_XFORM_CLIP_GDP : constant ERROR_INDICATOR := 105;
  10537.      
  10538. -- SEGMENT_ERROR
  10539.      
  10540. -- 121 Specified segment name is already in use
  10541.    SEGMENT_IN_USE              : constant ERROR_INDICATOR := 121;
  10542.      
  10543. -- 122 Specified segment does not exist
  10544.    SEGMENT_DOES_NOT_EXIST      : constant ERROR_INDICATOR := 122;
  10545.      
  10546. -- 123 Specified segment does not exist on specified workstation
  10547.    SEGMENT_NOT_ON_WS           : constant ERROR_INDICATOR := 123;
  10548.      
  10549. -- 124 Specified segment does not exist on Workstation
  10550. --     Independent segment storage
  10551.    SEGMENT_NOT_ON_WISS         : constant ERROR_INDICATOR := 124;
  10552.      
  10553. -- 125 Specified segment is open
  10554.    SEGMENT_IS_OPEN             : constant ERROR_INDICATOR := 125;
  10555.      
  10556.      
  10557. --      INPUT ERROR
  10558.      
  10559. -- 140 Specified input device is not present on workstation
  10560.    INPUT_DEVICE_NOT_ON_WS  : constant ERROR_INDICATOR := 140;
  10561.      
  10562. -- 141 Input device is not in REQUEST mode
  10563.    INPUT_DEVICE_NOT_REQUEST : constant ERROR_INDICATOR := 141;
  10564.      
  10565. -- 142 Input device is not in SAMPLE mode
  10566.    INPUT_DEVICE_NOT_SAMPLE : constant ERROR_INDICATOR := 142;
  10567.      
  10568. -- 143 EVENT and SAMPLE input mode are not available at
  10569. --     this level of GKS
  10570.    NO_EVENT_OR_SAMPLE      : constant ERROR_INDICATOR := 143;
  10571.      
  10572. -- 144 Specified prompt and echo type is not supported on
  10573. --     this workstation
  10574.    NO_PROMPT_AND_ECHO_ON_WS : constant ERROR_INDICATOR := 144;
  10575.      
  10576. -- 145 Echo area is outside display space
  10577.    ECHO_AREA_OUT_OF_DISPLAY : constant ERROR_INDICATOR := 145;
  10578.      
  10579. -- 146 Contents of input data record are invalid
  10580.    INVALID_INPUT_DATA_RECORD : constant ERROR_INDICATOR := 146;
  10581.      
  10582. -- 147 Input queue has overflowed
  10583.    INPUT_QUEUE_OVERFLOW     : constant ERROR_INDICATOR := 147;
  10584.      
  10585. -- 148 Input queue has not overflowed since GKS was opened or
  10586. --     the last invocation of INQUIRE INPUT QUEUE OVERFLOW
  10587.    NO_INPUT_QUEUE_OVERFLOW : constant ERROR_INDICATOR := 148;
  10588.      
  10589. -- 149 Input queue has overflowed, but associated workstation
  10590. --     has been closed
  10591.    INPUT_QUEUE_OVERFLOW_NO_WS : constant ERROR_INDICATOR := 149;
  10592.      
  10593. -- 150 No input value of the correct class is in the
  10594. --     current event report
  10595.    NO_INPUT_VALUE_FOR_CLASS : constant ERROR_INDICATOR := 150;
  10596.      
  10597. -- 152 Initial value is invalid
  10598.    INVALID_INITIAL_VALUE         : constant ERROR_INDICATOR := 152;
  10599.      
  10600. -- 153 Number of points in the initial stroke is greater than the
  10601. --     buffer size
  10602.    EXCEEDED_INITIAL_STROKE_POINTS : constant ERROR_INDICATOR := 153;
  10603.      
  10604. -- 154  Length of the initial string is greater than the buffer size
  10605.    EXCEEDED_INITIAL_STRING_LENGTH : constant ERROR_INDICATOR := 154;
  10606.      
  10607.      
  10608. -- METAFILE ERRORS
  10609.      
  10610. -- 160 Item type is not allowed for user items
  10611.    ITEM_TYPE_NOT_ALLOWED      : constant ERROR_INDICATOR := 160;
  10612.      
  10613. -- 161 Item length is invalid
  10614.    INVALID_ITEM_LENGTH        : constant ERROR_INDICATOR := 161;
  10615.      
  10616. -- 162 No item is left in GKS metafile input
  10617.    NO_ITEM_IN_GKSM_INPUT      : constant ERROR_INDICATOR := 162;
  10618.      
  10619. -- 163 Metafile item is invalid
  10620.    INVALID_METAFILE_ITEM      : constant ERROR_INDICATOR := 163;
  10621.      
  10622. -- 164 Item type is not a valid GKS item
  10623.    INVALID_GKS_ITEM_TYPE      : constant ERROR_INDICATOR := 164;
  10624.      
  10625. -- 165 Content of item data record is invalid for the specified
  10626. --     item type
  10627.    INVALID_ITEM_DATA_RECORD   : constant ERROR_INDICATOR := 165;
  10628.      
  10629. -- 167 User item cannot be interpreted
  10630.    CANNOT_INTERPRET_USER_ITEM   : constant ERROR_INDICATOR := 167;
  10631.      
  10632. -- 168 Specified function is not supported at this level of GKS
  10633.    FUNCTION_NOT_SUPPORTED     : constant ERROR_INDICATOR := 168;
  10634.      
  10635.      
  10636.      
  10637. -- ESCAPE ERRORS
  10638.      
  10639. -- 180 Specified escape function is not supported
  10640.    ESCAPE_FUNCTION_NOT_SUPPORTED : constant ERROR_INDICATOR := 180;
  10641.      
  10642. -- 181 Specified escape function identification is invalid
  10643.    INVALID_ESCAPE_ID           : constant ERROR_INDICATOR := 181;
  10644.      
  10645. -- 182 Contents of escape data record are invalid
  10646.    INVALID_ESCAPE_DATA_RECORD       : constant ERROR_INDICATOR := 182;
  10647.      
  10648.      
  10649.      
  10650. -- MISCELLANEOUS ERRORS
  10651.      
  10652. -- 200 Specified error file is invalid
  10653.    INVALID_ERROR_FILE          : constant ERROR_INDICATOR := 200;
  10654.      
  10655.      
  10656.      
  10657. -- SYSTEM ERRORS
  10658.      
  10659. -- 300 Storage overflow has occurred in GKS
  10660.    GKS_STORAGE_OVERFLOW       : constant ERROR_INDICATOR := 300;
  10661.      
  10662. -- 301 Storage overflow has occurred in segment storage
  10663.    SEGMENT_STORAGE_OVERFLOW   : constant ERROR_INDICATOR := 301;
  10664.      
  10665. -- 302 Input/Output error has occurred while reading
  10666.    IO_ERROR_WHILE_READING     : constant ERROR_INDICATOR := 302;
  10667.      
  10668. -- 303 Input/Output error has occurred while writing
  10669.    IO_ERROR_WHILE_WRITING     : constant ERROR_INDICATOR := 303;
  10670.      
  10671. -- 304 Input/Output error has occurred while sending data to a
  10672. --     workstation
  10673.    IO_ERROR_WHILE_SENDING_WS  : constant ERROR_INDICATOR := 304;
  10674.      
  10675. -- 305 Input/Output error has occurred while receiving data
  10676. --     from a workstation
  10677.    IO_ERROR_WHILE_RECEIVE_WS  : constant ERROR_INDICATOR := 305;
  10678.      
  10679. -- 306 Input/Output error has occurred during program library
  10680. --     management
  10681.    IO_ERROR_LIBRARY_MANAGEMENT  : constant ERROR_INDICATOR := 306;
  10682.      
  10683. -- 307 Input/Output error has occurred while reading workstation
  10684. --     description table
  10685.    IO_ERROR_READING_WS_DESCR  : constant ERROR_INDICATOR := 307;
  10686.      
  10687. -- 308 Arithmetic error has occurred
  10688.    ARITHMETIC                 : constant ERROR_INDICATOR := 308;
  10689.      
  10690.      
  10691.      
  10692. -- LANGUAGE BINDING ERRORS
  10693.      
  10694. -- 2500 Invalid use of input data record
  10695.    INVALID_USE_OF_INPUT_DATA  : constant ERROR_INDICATOR := 2500;
  10696.      
  10697.      
  10698. -- OTHERS
  10699.      
  10700. -- 2501 Unknown error occurred during processing.
  10701.    UNKNOWN               : constant ERROR_INDICATOR := 2501;
  10702.      
  10703. end GKS_ERRORS;
  10704. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10705. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_ST_MA.ADA
  10706. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10707. ------------------------------------------------------------------
  10708. --
  10709. --  NAME: WSR_INQ_WS_STATE_LIST_MA
  10710. --  IDENTIFIER: GDMXXX.2(1)
  10711. --  DISCREPANCY REPORTS:
  10712. --  DR004  Reduce storage size of CGI instruction.
  10713. ------------------------------------------------------------------
  10714. -- file:  WSR_INQ_WS_ST_MA.ADA
  10715. -- level: all levels
  10716.      
  10717. with GKS_TYPES;
  10718. with CGI;
  10719. with WS_STATE_LIST_TYPES;
  10720. with GKS_ERRORS;
  10721.      
  10722. use GKS_TYPES;
  10723. use CGI;
  10724.      
  10725. package WSR_INQ_WS_STATE_LIST_MA is
  10726.      
  10727. -- WS_STATE_LIST_PTR is declared in WS_STATE_LIST_TYPES; the
  10728. -- other parameter types are declared in GKS_TYPES.
  10729. -- Each procedure is called by the workstation driver which
  10730. -- passes a pointer to the workstation state list being inquired.
  10731.      
  10732.    procedure INQ_WS_CONNECTION_AND_TYPE
  10733.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10734.     CONNECTION    : out ACCESS_CONNECTION_ID_TYPE;
  10735.     TYPE_OF_WS    : out WS_TYPE);
  10736.      
  10737.    procedure INQ_LIST_OF_COLOUR_INDICES
  10738.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10739.     INDICES       : out COLOUR_INDICES.LIST_OF);
  10740.      
  10741.    procedure INQ_COLOUR_REPRESENTATION
  10742.    (WS_STATE_LIST   : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10743.     INDEX           : in COLOUR_INDEX;
  10744.     RETURNED_VALUES : in RETURN_VALUE_TYPE;
  10745.     COLOUR          : out COLOUR_REPRESENTATION;
  10746.     EI              : out ERROR_INDICATOR);
  10747.      
  10748.    procedure INQ_WS_TRANSFORMATION
  10749.    (WS_STATE_LIST      : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10750.     UPDATE             : out UPDATE_STATE;
  10751.     REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  10752.     CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  10753.     REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  10754.     CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS);
  10755.      
  10756. end WSR_INQ_WS_STATE_LIST_MA;
  10757. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10758. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_ST_MA_B.ADA
  10759. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10760. ------------------------------------------------------------------
  10761. --
  10762. --  NAME: WSR_INQ_WS_STATE_LIST_MA - BODY
  10763. --  IDENTIFIER: GDMXXX.2(1)
  10764. --  DISCREPANCY REPORTS:
  10765. --  DR004  Reduce storage size of CGI instruction.
  10766. ------------------------------------------------------------------
  10767. -- file:  WSR_INQ_WS_ST_MA_B.ADA
  10768. -- level: all levels
  10769.      
  10770. package body WSR_INQ_WS_STATE_LIST_MA is
  10771.      
  10772. --  The following procedures inquire into the specified workstation
  10773. --  state list accessed by the pointer passed as a parameter,
  10774. --  to retrieve the needed information.
  10775.      
  10776.    procedure INQ_WS_CONNECTION_AND_TYPE
  10777.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10778.     CONNECTION    : out ACCESS_CONNECTION_ID_TYPE;
  10779.     TYPE_OF_WS    : out WS_TYPE) is separate;
  10780.      
  10781.    procedure INQ_LIST_OF_COLOUR_INDICES
  10782.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10783.     INDICES       : out COLOUR_INDICES.LIST_OF) is separate;
  10784.      
  10785.    procedure INQ_COLOUR_REPRESENTATION
  10786.    (WS_STATE_LIST   : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10787.     INDEX           : in COLOUR_INDEX;
  10788.     RETURNED_VALUES : in RETURN_VALUE_TYPE;
  10789.     COLOUR          : out COLOUR_REPRESENTATION;
  10790.     EI              : out ERROR_INDICATOR) is separate;
  10791.      
  10792.    procedure INQ_WS_TRANSFORMATION
  10793.    (WS_STATE_LIST      : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10794.     UPDATE             : out UPDATE_STATE;
  10795.     REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  10796.     CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  10797.     REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  10798.     CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS) is separate;
  10799.      
  10800. end WSR_INQ_WS_STATE_LIST_MA;
  10801. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10802. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_CON_TYPE.ADA
  10803. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10804. ------------------------------------------------------------------
  10805. --
  10806. --  NAME: INQ_WS_CONNECTION_AND_TYPE
  10807. --  IDENTIFIER: GDMXXX.2(1)
  10808. --  DISCREPANCY REPORTS:
  10809. --  DR004  Reduce storage size of CGI instruction.
  10810. ------------------------------------------------------------------
  10811. -- file:  WSR_INQ_WS_CON_TYPE.ADA
  10812. -- level: all levels
  10813.      
  10814. separate (WSR_INQ_WS_STATE_LIST_MA)
  10815.      
  10816. procedure INQ_WS_CONNECTION_AND_TYPE
  10817.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10818.     CONNECTION    : out ACCESS_CONNECTION_ID_TYPE;
  10819.     TYPE_OF_WS    : out WS_TYPE) is
  10820.      
  10821. -- Return the values of connection identifier and workstation
  10822. -- type from the workstation state list, accessed by WS_STATE_LIST,
  10823. -- in the specified parameters.
  10824. --
  10825. -- The parameters in this procedure are used as follows:
  10826. --
  10827. -- WS_STATE_LIST  - pointer to the workstation state list.
  10828. -- CONNECTION     - pointer to the workstation identifier to return.
  10829. -- TYPE_OF_WS     - workstation type to return.
  10830. --
  10831. -- No errors are checked in this procedure.
  10832.      
  10833. begin
  10834.      
  10835.    -- Inquire connection identifier
  10836.    CONNECTION := new CONNECTION_ID'(WS_STATE_LIST.CONNECT_ID.CONNECT);
  10837.      
  10838.    -- Inquire workstation type
  10839.    TYPE_OF_WS := WS_STATE_LIST.WORKSTATION_TYPE;
  10840.      
  10841. end INQ_WS_CONNECTION_AND_TYPE;
  10842. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10843. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_XFORM.ADA
  10844. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10845. ------------------------------------------------------------------
  10846. --
  10847. --  NAME: INQ_WS_TRANSFORMATION
  10848. --  IDENTIFIER: GDMXXX.1(1)
  10849. --  DISCREPANCY REPORTS
  10850. --
  10851. ------------------------------------------------------------------
  10852. -- file:  WSR_INQ_WS_XFORM.ADA
  10853. -- level: all levels
  10854.      
  10855. separate (WSR_INQ_WS_STATE_LIST_MA)
  10856.      
  10857. procedure INQ_WS_TRANSFORMATION
  10858.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10859.     UPDATE        : out UPDATE_STATE;
  10860.     REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  10861.     CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  10862.     REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  10863.     CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS) is
  10864.      
  10865. -- Find the workstation transformation update state, the requested
  10866. -- workstation window, the current workstation window, the requested
  10867. -- workstation viewport and the current workstation viewport from
  10868. -- the workstation state list accessed by the pointer WS_STATE_LIST.
  10869. -- The workstation transformation state is PENDING if a workstation
  10870. -- transformation change has been requested but not yet provided.
  10871. --
  10872. -- The parameters in this procedure are used as follows:
  10873. --
  10874. -- WS_STATE_LIST                - pointer to the workstation state list.
  10875. -- UPDATE                       - update information
  10876. --                                (pending,not pending).
  10877. -- REQUESTED_WINDOW             - requested workstation window in
  10878. --                                NDC coordinates.
  10879. -- CURRENT_WINDOW               - current workstation window in
  10880. --                                NDC coordinates.
  10881. -- REQUESTED_VIEWPORT           - requested viewport in DC coordinates.
  10882. -- CURRENT_VIEWPORT             - current viewport in DC coordinates.
  10883.      
  10884. begin
  10885.      
  10886.    -- Inquire workstation transformation update state
  10887.    UPDATE := WS_STATE_LIST.WS_XFORM_UPDATE_STATE;
  10888.      
  10889.    -- Inquire requested workstation window
  10890.    REQUESTED_WINDOW := WS_STATE_LIST.REQUESTED_WS_WINDOW;
  10891.      
  10892.    -- Inquire current workstation window
  10893.    CURRENT_WINDOW := WS_STATE_LIST.CURRENT_WS_WINDOW;
  10894.      
  10895.    -- Inquire requested workstation viewport
  10896.    REQUESTED_VIEWPORT := WS_STATE_LIST.REQUESTED_WS_VIEWPORT;
  10897.      
  10898.    -- Inquire current workstation viewport
  10899.    CURRENT_VIEWPORT := WS_STATE_LIST.CURRENT_WS_VIEWPORT;
  10900.      
  10901. end INQ_WS_TRANSFORMATION;
  10902. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10903. --:UDD:GKSADACM:CODE:MA:WSR_INQ_LST_CLR_IDC.ADA
  10904. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10905. ------------------------------------------------------------------
  10906. --
  10907. --  NAME: INQ_LIST_OF_COLOUR_INDICES
  10908. --  IDENTIFIER: GIMXXX.1(1)
  10909. --  DISCREPANCY REPORTS:
  10910. --
  10911. ------------------------------------------------------------------
  10912. -- file:  WSR_INQ_LST_CLR_IDC.ADA
  10913. -- level: all levels
  10914.      
  10915. separate (WSR_INQ_WS_STATE_LIST_MA)
  10916.      
  10917. procedure INQ_LIST_OF_COLOUR_INDICES
  10918.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10919.     INDICES       : out COLOUR_INDICES.LIST_OF) is
  10920.      
  10921. -- Return the list of colour indices from the workstation state list,
  10922. -- accessed by the pointer WS_STATE_LIST, in the specified parameter.
  10923. --
  10924. -- The parameters in this procedure are used as follows:
  10925. --
  10926. -- WS_STATE_LIST     - pointer to the workstation state list.
  10927. -- INDICES           - list of colour indices to return.
  10928.      
  10929. begin
  10930.      
  10931.    -- Inquire the list of colour indices.
  10932.      
  10933.    INDICES := WS_STATE_LIST.SET_OF_COLOUR_IDC;
  10934.      
  10935. end INQ_LIST_OF_COLOUR_INDICES;
  10936. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10937. --:UDD:GKSADACM:CODE:MA:WSR_INQ_CLR_REP.ADA
  10938. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10939. ------------------------------------------------------------------
  10940. --
  10941. --  NAME: INQ_COLOUR_REPRESENTATION
  10942. --  IDENTIFIER: GDMXXX.1(1)
  10943. --  DISCREPANCY REPORTS:
  10944. --
  10945. ------------------------------------------------------------------
  10946. -- file:  WSR_INQ_CLR_REP.ADA
  10947. -- level: all levels
  10948.      
  10949. separate (WSR_INQ_WS_STATE_LIST_MA)
  10950.      
  10951. procedure INQ_COLOUR_REPRESENTATION
  10952.    (WS_STATE_LIST   : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  10953.     INDEX           : in COLOUR_INDEX;
  10954.     RETURNED_VALUES : in RETURN_VALUE_TYPE;
  10955.     COLOUR          : out COLOUR_REPRESENTATION;
  10956.     EI              : out ERROR_INDICATOR) is
  10957.      
  10958. -- This procedure returns information about
  10959. -- the colour table from the workstation state list accessed by
  10960. -- the WS_STATE_LIST pointer.
  10961. --
  10962. -- The parameters in this procedure are used as follows:
  10963. --
  10964. -- WS_STATE_LIST     - pointer to the workstation state list
  10965. --                     being inquired.
  10966. -- INDEX             - colour index.
  10967. -- RETURNED_VALUES   - indicates whether the returned values
  10968. --                   - should be as they were set by the program
  10969. --                   - or as they were actually realized by the
  10970. --                   - device.
  10971. -- COLOUR            - colour intensity.
  10972. -- EI                - used to log errors.
  10973. --
  10974. -- EI is set to NO_COLOUR_REP if a representation for the
  10975. -- specified colour index has not been defined on this
  10976. -- workstation.
  10977.      
  10978. begin
  10979.      
  10980.    -- set the error indicator to insure that a successful value
  10981.    -- is passed out when no errors occur.
  10982.    EI := GKS_ERRORS.SUCCESSFUL;
  10983.      
  10984.    -- set the default value of the out parameter.
  10985.    COLOUR := (0.0,0.0,0.0);
  10986.      
  10987.    if RETURNED_VALUES = REALIZED then
  10988.      
  10989.       if not COLOUR_INDICES.IS_IN_LIST
  10990.             (INDEX,WS_STATE_LIST.SET_OF_COLOUR_IDC) then
  10991.      
  10992.          -- the specified colour representation has not been
  10993.          -- defined on this workstation and RETURNED_VALUES
  10994.          -- has value REALIZED.  So return the values using
  10995.          -- the default index.
  10996.      
  10997.          COLOUR := WS_STATE_LIST.COLOUR_TABLE(1);
  10998.      
  10999.       else
  11000.      
  11001.          -- the index specified is within the colour table.
  11002.          -- return the value found in the workstation state list.
  11003.      
  11004.          COLOUR := WS_STATE_LIST.COLOUR_TABLE(INDEX);
  11005.      
  11006.       end if;
  11007.      
  11008.    else
  11009.      
  11010.       if INDEX not in WS_STATE_LIST.COLOUR_TABLE'RANGE then
  11011.      
  11012.          -- the specified colour index is invalid for this workstation.
  11013.          EI := GKS_ERRORS.INVALID_COLOUR_INDEX;
  11014.      
  11015.       elsif not COLOUR_INDICES.IS_IN_LIST(INDEX,WS_STATE_LIST
  11016.             .SET_OF_COLOUR_IDC) then
  11017.          -- the specified colour representation has not been
  11018.          -- defined on this workstation and RETURNED_VALUES
  11019.          -- has value SET.
  11020.      
  11021.          EI := GKS_ERRORS.NO_COLOUR_REP;
  11022.      
  11023.       else
  11024.      
  11025.          -- the index specified is within the colour table.
  11026.          -- return the value found in the workstation state list.
  11027.      
  11028.          COLOUR := WS_STATE_LIST.COLOUR_TABLE(INDEX);
  11029.      
  11030.       end if;
  11031.      
  11032.    end if;
  11033.      
  11034. end INQ_COLOUR_REPRESENTATION;
  11035. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11036. --:UDD:GKSADACM:CODE:MA:WSR_SET_CLR_TABLE.ADA
  11037. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11038. ------------------------------------------------------------------
  11039. --
  11040. --  NAME: WSR_SET_COLOUR_TABLE
  11041. --  IDENTIFIER: GDMXXX.1(1)
  11042. --  DISCREPANCY REPORTS:
  11043. --
  11044. ------------------------------------------------------------------
  11045. -- file : WSR_SET_CLR_TABLE.ADA
  11046. -- level: ma,0a,1a,2a
  11047.      
  11048. with GKS_TYPES;
  11049. with WS_STATE_LIST_TYPES;
  11050.      
  11051. use  GKS_TYPES;
  11052.      
  11053. package WSR_SET_COLOUR_TABLE  is
  11054.      
  11055. -- This package is a resource package.  It can be used by any device
  11056. -- that needs it.  It sets the colour table in the workstation state
  11057. -- list to the value specified by the parameter INDEX to the colour
  11058. -- specified by COLOUR.  It also needs the specified workstation state
  11059. -- list as a parameter to be passed to it.
  11060.      
  11061.    procedure SET_COLOUR_REPRESENTATION
  11062.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  11063.        INDEX     : in COLOUR_INDEX;
  11064.        COLOUR    : in COLOUR_REPRESENTATION;
  11065.        EI        : out ERROR_INDICATOR);
  11066.      
  11067. end WSR_SET_COLOUR_TABLE;
  11068. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11069. --:UDD:GKSADACM:CODE:MA:WSR_SET_CLR_TABLE_B.ADA
  11070. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11071. ------------------------------------------------------------------
  11072. --
  11073. --  NAME: WSR_SET_COLOUR_TABLE - BODY
  11074. --  IDENTIFIER: GDMXXX.1(1)
  11075. --  DISCREPANCY REPORTS:
  11076. --
  11077. ------------------------------------------------------------------
  11078. -- file:  WSR_SET_CLR_TABLE_B.ADA
  11079. -- level: ma,0a,1a,2a
  11080.      
  11081. with GKS_ERRORS;
  11082.      
  11083. package body WSR_SET_COLOUR_TABLE  is
  11084.      
  11085.    procedure SET_COLOUR_REPRESENTATION
  11086.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  11087.        INDEX     : in COLOUR_INDEX;
  11088.        COLOUR    : in COLOUR_REPRESENTATION;
  11089.        EI        : out ERROR_INDICATOR) is
  11090.      
  11091.    -- This procedure changes the colour specified by the index in
  11092.    -- the colour table of the WS_STATE_LIST specified by the parameter.
  11093.    -- It checks to see if the INDEX chosen is valid for the specified
  11094.    -- workstation.
  11095.    --
  11096.    -- The following parameters are used this procedure :
  11097.    -- WS_ST_LST -  the WS_STATE_LIST to which the colour is being
  11098.    --              directed.
  11099.    -- INDEX - the indexed colour being set.
  11100.    -- COLOUR - the intensities of red, green, blue to set the
  11101.    --          colour.
  11102.    -- EI - An error indicator used for logging errors.
  11103.      
  11104.    begin
  11105.      
  11106.       if INDEX not in WS_ST_LST.COLOUR_TABLE'range then
  11107.          EI := GKS_ERRORS.INVALID_COLOUR_INDEX;
  11108.       else
  11109.          EI := GKS_ERRORS.SUCCESSFUL;
  11110.      
  11111.          -- Set the specified WS_STATE_LIST to the
  11112.          -- value specified by the parameter.
  11113.          WS_ST_LST.COLOUR_TABLE (INDEX) := COLOUR;
  11114.      
  11115.          -- The index is added to the SET_OF_COLOUR_IDC in the WS_STATE
  11116.          -- LIST.  The set contains all the set indices on the device.
  11117.          COLOUR_INDICES.ADD_TO_LIST (INDEX,
  11118.                                      WS_ST_LST.SET_OF_COLOUR_IDC);
  11119.       end if;
  11120.      
  11121.    end SET_COLOUR_REPRESENTATION;
  11122.      
  11123. end WSR_SET_COLOUR_TABLE;
  11124. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11125. --:UDD:GKSADACM:CODE:MA:WSR_UTILITIES.ADA
  11126. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11127. ------------------------------------------------------------------
  11128. --
  11129. --  NAME: WSR_UTILITIES
  11130. --  IDENTIFIER: GDMXXX.1(1)
  11131. --  DISCREPANCY REPORTS:
  11132. --
  11133. ------------------------------------------------------------------
  11134. -- FILE : WSR_UTILITIES.ADA
  11135. -- LEVEL : all
  11136.      
  11137. with GKS_TYPES;
  11138.      
  11139. use  GKS_TYPES;
  11140.      
  11141. package WSR_UTILITIES is
  11142.      
  11143. -- The Workstation Resource Utilities contains procedures to handle
  11144. -- clipping of polylines and handling of text.
  11145.      
  11146.    type AREA;
  11147.      
  11148.    type LIST_OF_AREAS is access AREA;
  11149.      
  11150.    type AREA is
  11151.       record
  11152.          BORDER    : DC.POINT_LIST;
  11153.          NEXT_AREA : LIST_OF_AREAS;
  11154.       end record;
  11155.    -- The preceeding 3 declarations allow for the clip routine to return
  11156.    -- a variable number of areas.
  11157.      
  11158.    procedure PLINE_CLIP
  11159.       (POINTER_ARRAY  : DC.POINT_ARRAY;
  11160.        STARTING_PT    : out DC.POINT;
  11161.        STARTING_INDEX : in out POSITIVE;
  11162.        LAST_INDEX     : in out POSITIVE;
  11163.        FINISHING_PT   : out DC.POINT;
  11164.        CLIP_RECTANGLE : DC.RECTANGLE_LIMITS);
  11165.      
  11166.    function PMRK_CLIP
  11167.       (PTR_TO_LIST_OF_POINTS : DC.POINT_ARRAY;
  11168.        CLIP_RECTANGLE        : DC.RECTANGLE_LIMITS)
  11169.       return DC.POINT_LIST;
  11170.      
  11171.    procedure TEXT_CLIP
  11172.       (TEXT_POSITION   : DC.POINT;
  11173.        TEXT_LENGTH     : INTEGER;
  11174.        CLIP_RECTANGLE  : DC.RECTANGLE_LIMITS;
  11175.        OFFSET          : DC.POINT;
  11176.        FIRST_VIS_CHAR  : out POSITIVE;
  11177.        LAST_VIS_CHAR   : out POSITIVE);
  11178.      
  11179.    procedure TEXT_HANDLING
  11180.       (CAP_TOP          : DC_TYPE;
  11181.        BASE_BOTTOM      : DC_TYPE;
  11182.        T_PATH           : TEXT_PATH;
  11183.        T_ALIGNMENT      : TEXT_ALIGNMENT;
  11184.        CHAR_HEIGHT_VECT : DC.VECTOR;
  11185.        CHAR_WIDTH_VECT  : DC.VECTOR;
  11186.        CHAR_EXP_FACTOR  : CHAR_EXPANSION;
  11187.        CHAR_SPACE       : CHAR_SPACING;
  11188.        TEXT_POSITION    : in DC.POINT;
  11189.        TEXT_LENGTH      : INTEGER;
  11190.        CHARACTER_FONT   : DC_TYPE;
  11191.        START_POSITION   : out DC.POINT;
  11192.        OFFSET           : out DC.POINT;
  11193.        TEI_LOWER_LEFT   : out DC.POINT;
  11194.        TEI_LOWER_RIGHT  : out DC.POINT;
  11195.        TEI_UPPER_LEFT   : out DC.POINT;
  11196.        TEI_UPPER_RIGHT  : out DC.POINT);
  11197.      
  11198.    function TRANSFORM
  11199.       (INPUT_VALUE     : float;
  11200.        INPUT_UPPER     : float;
  11201.        INPUT_LOWER     : float;
  11202.        TRANSFORM_UPPER : integer;
  11203.        TRANSFORM_LOWER : integer) return integer;
  11204.      
  11205.    procedure AREA_CLIP
  11206.       (INPUT_AREA         : in DC.POINT_ARRAY;
  11207.        CLIPPING_RECTANGLE : in DC.RECTANGLE_LIMITS;
  11208.        OUTPUT_AREAS       : in out LIST_OF_AREAS);
  11209.    -- This procedure takes an input area and clips it by the CLIPPING_
  11210.    -- RECTANGLE.
  11211.      
  11212. end WSR_UTILITIES;
  11213. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11214. --:UDD:GKSADACM:CODE:MA:WSR_UTILITIES_B.ADA
  11215. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11216. ------------------------------------------------------------------
  11217. --
  11218. --  NAME: WSR_UTILITIES - BODY
  11219. --  IDENTIFIER: GDMXXX.1(1)
  11220. --  DISCREPANCY REPORTS:
  11221. --
  11222. ------------------------------------------------------------------
  11223. -- FILE: WSR_UTILITIES_B.ADA
  11224. -- LEVEL: all
  11225.      
  11226. with DC_POINT_OPS;
  11227.      
  11228. package body WSR_UTILITIES is
  11229.      
  11230.    type CLIP_INDICATOR is
  11231.       (OUT_OF_BOUNDS, NO_CLIPPING, FIRST, LAST, ERROR);
  11232.    -- Used to indicate what action was performed on the line.
  11233.      
  11234.    procedure LINE_CLIP
  11235.       (FIRST_POINT    : DC.POINT;
  11236.        LAST_POINT     : DC.POINT;
  11237.        CLIPPED_FIRST  : out DC.POINT;
  11238.        CLIPPED_LAST   : out DC.POINT;
  11239.        CLIP_RECTANGLE : DC.RECTANGLE_LIMITS;
  11240.        CLIP_FLAG      : out CLIP_INDICATOR) is separate;
  11241.      
  11242.    procedure PLINE_CLIP
  11243.       (POINTER_ARRAY  : DC.POINT_ARRAY;
  11244.        STARTING_PT    : out DC.POINT;
  11245.        STARTING_INDEX : in out POSITIVE;
  11246.        LAST_INDEX     : in out POSITIVE;
  11247.        FINISHING_PT   : out DC.POINT;
  11248.        CLIP_RECTANGLE : DC.RECTANGLE_LIMITS) is separate;
  11249.      
  11250.    function PMRK_CLIP
  11251.        (PTR_TO_LIST_OF_POINTS : DC.POINT_ARRAY;
  11252.         CLIP_RECTANGLE        : DC.RECTANGLE_LIMITS)
  11253.        return DC.POINT_LIST is separate;
  11254.      
  11255.    procedure TEXT_CLIP
  11256.       (TEXT_POSITION   : DC.POINT;
  11257.        TEXT_LENGTH     : INTEGER;
  11258.        CLIP_RECTANGLE  : DC.RECTANGLE_LIMITS;
  11259.        OFFSET          : DC.POINT;
  11260.        FIRST_VIS_CHAR  : out POSITIVE;
  11261.        LAST_VIS_CHAR   : out POSITIVE) is separate;
  11262.      
  11263.    procedure TEXT_HANDLING
  11264.       (CAP_TOP          : DC_TYPE;
  11265.        BASE_BOTTOM      : DC_TYPE;
  11266.        T_PATH           : TEXT_PATH;
  11267.        T_ALIGNMENT      : TEXT_ALIGNMENT;
  11268.        CHAR_HEIGHT_VECT : DC.VECTOR;
  11269.        CHAR_WIDTH_VECT  : DC.VECTOR;
  11270.        CHAR_EXP_FACTOR  : CHAR_EXPANSION;
  11271.        CHAR_SPACE       : CHAR_SPACING;
  11272.        TEXT_POSITION    : in DC.POINT;
  11273.        TEXT_LENGTH      : INTEGER;
  11274.        CHARACTER_FONT   : DC_TYPE;
  11275.        START_POSITION   : out DC.POINT;
  11276.        OFFSET           : out DC.POINT;
  11277.        TEI_LOWER_LEFT   : out DC.POINT;
  11278.        TEI_LOWER_RIGHT  : out DC.POINT;
  11279.        TEI_UPPER_LEFT   : out DC.POINT;
  11280.        TEI_UPPER_RIGHT  : out DC.POINT) is separate;
  11281.      
  11282.    function TRANSFORM
  11283.       (INPUT_VALUE     : float;
  11284.        INPUT_UPPER     : float;
  11285.        INPUT_LOWER     : float;
  11286.        TRANSFORM_UPPER : integer;
  11287.        TRANSFORM_LOWER : integer) return integer
  11288.       is separate;
  11289.      
  11290.      
  11291.    -- The following package contains procedures called by AREA_CLIP.
  11292.    package AREA_CLIPPING_UTILITIES is
  11293.      
  11294.       procedure CLIP_ON_RIGHT
  11295.          (INPUT_AREA    : in DC.POINT_ARRAY;
  11296.           RIGHT_BORDER  : in DC_TYPE;
  11297.           CLIPPED_AREAS : in out LIST_OF_AREAS);
  11298.      
  11299.       procedure CLIP_ON_BOTTOM
  11300.          (INPUT_AREA    : in DC.POINT_ARRAY;
  11301.           BOTTOM_BORDER : in DC_TYPE;
  11302.           CLIPPED_AREAS : in out LIST_OF_AREAS);
  11303.      
  11304.       procedure CLIP_ON_LEFT
  11305.          (INPUT_AREA    : in DC.POINT_ARRAY;
  11306.           LEFT_BORDER   : in DC_TYPE;
  11307.           CLIPPED_AREAS : in out LIST_OF_AREAS);
  11308.      
  11309.       procedure CLIP_ON_TOP
  11310.          (INPUT_AREA    : in DC.POINT_ARRAY;
  11311.           TOP_BORDER    : in DC_TYPE;
  11312.           CLIPPED_AREAS : in out LIST_OF_AREAS);
  11313.      
  11314.    end AREA_CLIPPING_UTILITIES;
  11315.      
  11316.    package body AREA_CLIPPING_UTILITIES is separate;
  11317.      
  11318.    procedure AREA_CLIP
  11319.       (INPUT_AREA         : in DC.POINT_ARRAY;
  11320.        CLIPPING_RECTANGLE : in DC.RECTANGLE_LIMITS;
  11321.        OUTPUT_AREAS       : in out LIST_OF_AREAS) is separate;
  11322.      
  11323. end WSR_UTILITIES;
  11324. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11325. --:UDD:GKSADACM:CODE:MA:LEXI_OUT_PRIM_MA_B.ADA
  11326. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11327. ------------------------------------------------------------------
  11328. --
  11329. --  NAME: LEXI3700_OUTPUT_PRIMITIVES - BODY
  11330. --  IDENTIFIER: GDMXXX.2(1)
  11331. --  DISCREPANCY REPORTS:
  11332. --  Not listed
  11333. ------------------------------------------------------------------
  11334. -- FILE : LEXI3700_OUT_PRIM_B.ADA
  11335. -- LEVEL : MA - 0A
  11336.      
  11337. with LEXI3700_CONFIGURATION;
  11338. with LEXI3700_TYPES;
  11339. with LEXI3700_OUTPUT_DRIVER;
  11340. with CONVERT_NDC_DC;
  11341. with DC_POINT_OPS;
  11342. with WSR_UTILITIES;
  11343. with LEXI_UTILITIES;
  11344.      
  11345. use  LEXI3700_TYPES;
  11346.      
  11347. package body LEXI3700_OUTPUT_PRIMITIVES is
  11348.      
  11349. -- The package LEXI3700_TYPES contains all types used by the device
  11350. -- driver.
  11351. --
  11352. -- The package LEXI3700_DRIVER contains all device specific calls
  11353. -- for the device driver.
  11354. --
  11355. -- The package WSD_UTILITIES contains the functions and procedures needed
  11356. -- by the workstation driver to perform transformations and clipping.
  11357.      
  11358.    procedure POLYLINE
  11359.       (WS_SL       : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  11360.        LINE_POINTS : ACCESS_POINT_ARRAY_TYPE) is separate;
  11361.      
  11362.    procedure POLYMARKER
  11363.       (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  11364.        MARKER_POINTS : ACCESS_POINT_ARRAY_TYPE) is separate;
  11365.      
  11366.    procedure FILL_AREA
  11367.       (WS_SL            : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  11368.        FILL_AREA_POINTS : ACCESS_POINT_ARRAY_TYPE) is separate;
  11369.      
  11370.    procedure TEXT
  11371.       (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  11372.        TEXT_POSITION : NDC.POINT;
  11373.        TEXT_STRING   : ACCESS_STRING_TYPE) is separate;
  11374.      
  11375. end LEXI3700_OUTPUT_PRIMITIVES;
  11376. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11377. --:UDD:GKSADACM:CODE:MA:WSR_PLINE_CLIP.ADA
  11378. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11379. ------------------------------------------------------------------
  11380. --
  11381. --  NAME: PLINE_CLIP
  11382. --  IDENTIFIER: GDMXXX.1(2)
  11383. --  DISCREPANCY REPORTS:
  11384. --  DR031  Polyline clipping.
  11385. ------------------------------------------------------------------
  11386. -- FILE: WSR_PLINE_CLIP.ADA
  11387. -- LEVEL: all
  11388.      
  11389. separate (WSR_UTILITIES)
  11390.      
  11391. procedure PLINE_CLIP
  11392.    (POINTER_ARRAY   : DC.POINT_ARRAY;
  11393.     STARTING_PT     : out DC.POINT;
  11394.     STARTING_INDEX  : in out POSITIVE;
  11395.     LAST_INDEX      : in out POSITIVE;
  11396.     FINISHING_PT    : out DC.POINT;
  11397.     CLIP_RECTANGLE  : DC.RECTANGLE_LIMITS) is
  11398.      
  11399. -- This procedure performs all of the clipping that is required for polylines.
  11400. -- In order for clipping to occur, the line drawn between the two points
  11401. -- must intersect a section of the viewing window.  The first step is
  11402. -- to determine if each point lies inside or outside of the clipping
  11403. -- window.  If both points lie inside the window, then no clipping is
  11404. -- required, and CLIPPING_CODE is set to "NO_CLIPPING".  If both points
  11405. -- do not lie inside, the next step is to determine if no intersection
  11406. -- occurs.  If both points are HIGH, LOW, RIGHT, or LEFT of the window,
  11407. -- then no intersection can occur, and CLIPPING_CODE is set to "OUT_OF_
  11408. -- BOUNDS".  The diagram below better represents the definitions:
  11409. --
  11410. --                         HIGH
  11411. --                       --------
  11412. --                  LEFT |  OK  | RIGHT
  11413. --                       --------
  11414. --                         LOW
  11415. --
  11416. -- If CLIPPING_CODE has not been modified, intersections are calculated
  11417. -- using a simple line-intersection equation, and the new points are
  11418. -- returned.
  11419. --
  11420. -- POINTER_ARRAY  - is the initial array of points.
  11421. -- STARTING_PT    - is the initial point (X1,Y1) entered.
  11422. -- STARTING_INDEX - is the index of the first point.
  11423. -- LAST_INDEX     - is the index of the last point.
  11424. -- FINISHING_PT  - is the ending point (X2,Y2) entered.
  11425.      
  11426. CLIP_FLAG     : CLIP_INDICATOR;
  11427. -- CLIP_FLAG returns action performed by LINE_CLIP.
  11428.      
  11429. RETURN_POINT1 : DC.POINT;
  11430. -- Contains the first clipped point.
  11431.      
  11432. RETURN_POINT2 : DC.POINT;
  11433. -- Contains the second clipped point.
  11434.      
  11435. START : POSITIVE := STARTING_INDEX;
  11436. -- Contains starting index.
  11437.      
  11438. NOT_FOUND_FIRST : BOOLEAN := TRUE;
  11439. -- Contains a flag indicating if the first valid point has been found.
  11440.      
  11441. begin
  11442.   for I in START .. (POINTER_ARRAY'last - 1) loop
  11443.       LINE_CLIP
  11444.          (POINTER_ARRAY(I), POINTER_ARRAY(I+1),
  11445.           RETURN_POINT1, RETURN_POINT2,
  11446.           CLIP_RECTANGLE, CLIP_FLAG);
  11447.      
  11448.       case CLIP_FLAG is
  11449.      
  11450.          when FIRST =>
  11451.             NOT_FOUND_FIRST := FALSE;
  11452.             STARTING_PT := RETURN_POINT1;
  11453.             STARTING_INDEX := I + 1;
  11454.             FINISHING_PT := POINTER_ARRAY(I+1);
  11455.             LAST_INDEX := I;
  11456.      
  11457.          when LAST  =>
  11458.             FINISHING_PT := RETURN_POINT2;
  11459.             LAST_INDEX := I;
  11460.             if NOT_FOUND_FIRST then
  11461.                STARTING_INDEX := I + 1;
  11462.                STARTING_PT := RETURN_POINT1;
  11463.             end if;
  11464.             exit;
  11465.      
  11466.          when OUT_OF_BOUNDS =>
  11467.             STARTING_INDEX := POINTER_ARRAY'LAST + 1;
  11468.      
  11469.          when NO_CLIPPING =>
  11470.             if NOT_FOUND_FIRST then
  11471.                STARTING_PT     := POINTER_ARRAY(I);
  11472.                STARTING_INDEX  := I + 1;
  11473.                -- The following two lines cover a polyline of two points
  11474.                FINISHING_PT := POINTER_ARRAY(I+1);
  11475.                LAST_INDEX := I;
  11476.                NOT_FOUND_FIRST := FALSE;
  11477.             end if;
  11478.             if I = (POINTER_ARRAY'LAST - 1) then
  11479.                FINISHING_PT := POINTER_ARRAY(POINTER_ARRAY'last);
  11480.                LAST_INDEX   := I;
  11481.             end if;
  11482.          when ERROR =>
  11483.              null;
  11484.       end case;
  11485.      
  11486.   end loop;
  11487. end PLINE_CLIP;
  11488. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11489. --:UDD:GKSADACM:CODE:MA:WSR_PMRK_CLIP.ADA
  11490. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11491. ------------------------------------------------------------------
  11492. --
  11493. --  NAME: PMRK_CLIP
  11494. --  IDENTIFIER: GDMXXX.1(1)
  11495. --  DISCREPANCY REPORTS:
  11496. --
  11497. ------------------------------------------------------------------
  11498. -- file: WSR_PMRK_CLIP.ADA
  11499. -- level: ma,0a,1a,2a
  11500.      
  11501. separate (WSR_UTILITIES)
  11502.      
  11503. function PMRK_CLIP
  11504.    (PTR_TO_LIST_OF_POINTS  : DC.POINT_ARRAY;
  11505.     CLIP_RECTANGLE  : DC.RECTANGLE_LIMITS) return DC.POINT_LIST is
  11506.      
  11507. -- This function receives a list of center points for polymarkers and a
  11508. -- a clipping rectangle. It determines if the center of the polymarker
  11509. -- is within the clipping rectangle.  If it is, it is stored in the
  11510. -- UNCLIPPED_POLYMARKERS array.  This function does not ensure
  11511. -- that the extent of the polymarker will not extend out of the clipping
  11512. -- rectangle, just that the center is within the clipping rectangle. Also
  11513. -- it does not check for polymarkers that have a center outside the
  11514. -- clipping rectangle, but extend into the clipping rectangle.
  11515. --
  11516. -- The following parameters are used in this function:
  11517. -- PTR_TO_LIST_OF_POINTS - A list of center points in device coordinates
  11518. --                         of the polymarkers to be displayed.
  11519. -- CLIP_RECTANGLE - The clipping rectangle to test the points against.
  11520.      
  11521. UNCLIPPED_POLYMARKERS : DC.POINT_ARRAY
  11522.                          (1 .. PTR_TO_LIST_OF_POINTS'length);
  11523. COUNTER : NATURAL := 0;
  11524.      
  11525. begin
  11526.    for I in PTR_TO_LIST_OF_POINTS'range loop
  11527.      
  11528.       if PTR_TO_LIST_OF_POINTS(I).X >= CLIP_RECTANGLE.XMIN and then
  11529.          PTR_TO_LIST_OF_POINTS(I).X <= CLIP_RECTANGLE.XMAX and then
  11530.          PTR_TO_LIST_OF_POINTS(I).Y >= CLIP_RECTANGLE.YMIN and then
  11531.          PTR_TO_LIST_OF_POINTS(I).Y <= CLIP_RECTANGLE.YMAX then
  11532.             COUNTER := COUNTER + 1;
  11533.             UNCLIPPED_POLYMARKERS(COUNTER) := PTR_TO_LIST_OF_POINTS(I);
  11534.       else
  11535.         null;
  11536.         -- point was out of the window.
  11537.       end if;
  11538.    end loop;
  11539.      
  11540.    return DC.POINT_LIST'(LENGTH => COUNTER,
  11541.       POINTS => UNCLIPPED_POLYMARKERS(1 .. COUNTER));
  11542.      
  11543. end PMRK_CLIP;
  11544. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11545. --:UDD:GKSADACM:CODE:MA:WSR_AREA_CLIP.ADA
  11546. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11547. ------------------------------------------------------------------
  11548. --
  11549. --  NAME: AREA_CLIP
  11550. --  IDENTIFIER: GDMXXX.1(1)
  11551. --  DISCREPANCY REPORTS:
  11552. --
  11553. ------------------------------------------------------------------
  11554. -- FILE : WSR_AREA_CLIP.ADA
  11555. -- LEVELS : all
  11556.      
  11557. with UNCHECKED_DEALLOCATION;
  11558.      
  11559. separate (WSR_UTILITIES)
  11560.      
  11561. procedure AREA_CLIP
  11562.    (INPUT_AREA         : in DC.POINT_ARRAY;
  11563.     CLIPPING_RECTANGLE : in DC.RECTANGLE_LIMITS;
  11564.     OUTPUT_AREAS       : in out LIST_OF_AREAS) is
  11565.      
  11566. -- This procedure accepts a list of points which define an area. The
  11567. -- portions of this area which are outside of the CLIPPING_RECTANGLE
  11568. -- are removed, and the areas which are left, if any, are returned to
  11569. -- the calling procedure. The algorithm used is a modification of
  11570. -- the Sutherland - Hodgman algorithm for clipping polygons against
  11571. -- convex polyhedrons. The algorithm was modified to use a rectangle
  11572. -- and to remove the extraneous edges formed when the result of the
  11573. -- clipping is more than one area.
  11574. --
  11575. -- INPUT_AREA         - the points which make up the area to be clipped.
  11576. -- CLIPPING_RECTANGLE - the rectangle used for clipping.
  11577. -- OUTPUT_AREAS       - a linked list of the areas which are interior to
  11578. --                      the clipping rectangle.
  11579.      
  11580.    RIGHT_CLIPPED_AREAS : LIST_OF_AREAS := null;
  11581.    -- This variable holds the intermediate results of clipping to the
  11582.    -- right edge of the clipping rectangle.
  11583.      
  11584.    BOTTOM_CLIPPED_AREAS : LIST_OF_AREAS := null;
  11585.    -- This variable holds the intermediate results of clipping the
  11586.    -- previous variable to the bottom edge of the clipping rectangle.
  11587.      
  11588.    LEFT_CLIPPED_AREAS : LIST_OF_AREAS := null;
  11589.    -- This variable holds the intermediate results of clipping the
  11590.    -- previous variable to the left edge of the clipping rectangle.
  11591.      
  11592.    procedure DISPOSE is new UNCHECKED_DEALLOCATION
  11593.       (OBJECT => AREA, NAME => LIST_OF_AREAS);
  11594.    -- This procedure is used to get rid of the intermediate areas after
  11595.    -- they have been used in the next stage.
  11596.      
  11597.    OLD_AREA : LIST_OF_AREAS;
  11598.    -- This variable is used when disposing of unneeded areas.
  11599.      
  11600.    function "=" (FIRST, LAST : DC.POINT) return BOOLEAN
  11601.       renames DC."=";
  11602.    -- This allows the function to be visible locally.
  11603.      
  11604. begin
  11605.      
  11606.    -- Test to see if the list of points already connects the last point
  11607.    -- with the first point.
  11608.    if INPUT_AREA (1) = INPUT_AREA (INPUT_AREA'LAST) then
  11609.      
  11610.       -- If so, send the original input points to a procedure which
  11611.       -- clips them on the right edge of the clipping rectangle.
  11612.       AREA_CLIPPING_UTILITIES.CLIP_ON_RIGHT
  11613.          (INPUT_AREA, CLIPPING_RECTANGLE.XMAX, RIGHT_CLIPPED_AREAS);
  11614.      
  11615.    else
  11616.       -- If not, then make the last point connect to the first one, and
  11617.       -- call the clipping procedure.
  11618.       declare
  11619.          COMPLETE_INPUT_AREA :
  11620.             DC.POINT_ARRAY (1 .. INPUT_AREA'LAST + 1);
  11621.       begin
  11622.          COMPLETE_INPUT_AREA (1 .. INPUT_AREA'LAST) := INPUT_AREA;
  11623.          COMPLETE_INPUT_AREA (INPUT_AREA'LAST + 1) := INPUT_AREA (1);
  11624.          AREA_CLIPPING_UTILITIES.CLIP_ON_RIGHT (COMPLETE_INPUT_AREA,
  11625.             CLIPPING_RECTANGLE.XMAX, RIGHT_CLIPPED_AREAS);
  11626.       end; -- block
  11627.      
  11628.    end if;
  11629.      
  11630.    -- Send the resulting area(s) to a procedure which clips them by
  11631.    -- the lower edge of the clipping rectangle.
  11632.    while RIGHT_CLIPPED_AREAS /= null loop
  11633.      
  11634.       AREA_CLIPPING_UTILITIES.CLIP_ON_BOTTOM
  11635.          (RIGHT_CLIPPED_AREAS.BORDER.POINTS, CLIPPING_RECTANGLE.YMIN,
  11636.           BOTTOM_CLIPPED_AREAS);
  11637.      
  11638.       -- Repeat with the next area and get rid of the old one.
  11639.       OLD_AREA := RIGHT_CLIPPED_AREAS;
  11640.       RIGHT_CLIPPED_AREAS := RIGHT_CLIPPED_AREAS.NEXT_AREA;
  11641.       DISPOSE (OLD_AREA);
  11642.      
  11643.    end loop;
  11644.      
  11645.    -- Send the resulting area(s) to a procedure which clips them by
  11646.    -- the left edge of the clipping rectangle.
  11647.    while BOTTOM_CLIPPED_AREAS /= null loop
  11648.      
  11649.       AREA_CLIPPING_UTILITIES.CLIP_ON_LEFT
  11650.          (BOTTOM_CLIPPED_AREAS.BORDER.POINTS, CLIPPING_RECTANGLE.XMIN,
  11651.           LEFT_CLIPPED_AREAS);
  11652.      
  11653.       -- Repeat with the next area and get rid of the old one.
  11654.       OLD_AREA := BOTTOM_CLIPPED_AREAS;
  11655.       BOTTOM_CLIPPED_AREAS := BOTTOM_CLIPPED_AREAS.NEXT_AREA;
  11656.       DISPOSE (OLD_AREA);
  11657.      
  11658.    end loop;
  11659.      
  11660.    OUTPUT_AREAS := null;
  11661.      
  11662.    -- Send the resulting area(s) to a procedure which clips them by
  11663.    -- the top edge of the clipping rectangle.
  11664.    while LEFT_CLIPPED_AREAS /= null loop
  11665.      
  11666.       AREA_CLIPPING_UTILITIES.CLIP_ON_TOP
  11667.          (LEFT_CLIPPED_AREAS.BORDER.POINTS, CLIPPING_RECTANGLE.YMAX,
  11668.           OUTPUT_AREAS);
  11669.      
  11670.       -- Repeat with the next area and get rid of the old one.
  11671.       OLD_AREA := LEFT_CLIPPED_AREAS;
  11672.       LEFT_CLIPPED_AREAS := LEFT_CLIPPED_AREAS.NEXT_AREA;
  11673.       DISPOSE (OLD_AREA);
  11674.      
  11675.    end loop;
  11676.      
  11677. end AREA_CLIP;
  11678. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11679. --:UDD:GKSADACM:CODE:MA:WSR_TEXT_CLIP.ADA
  11680. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11681. ------------------------------------------------------------------
  11682. --
  11683. --  NAME: TEXT_CLIP
  11684. --  IDENTIFIER: GDMXXX.1(4)
  11685. --  DISCREPANCY REPORTS:
  11686. --  DR029  Completely clipped string of text.
  11687. ------------------------------------------------------------------
  11688. -- FILE  : TEXT_CLIP.ADA
  11689. -- LEVEL : MA
  11690.      
  11691. separate (WSR_UTILITIES)
  11692.      
  11693. procedure TEXT_CLIP
  11694.    (TEXT_POSITION      : DC.POINT;
  11695.     TEXT_LENGTH        : INTEGER;
  11696.     CLIP_RECTANGLE     : DC.RECTANGLE_LIMITS;
  11697.     OFFSET             : DC.POINT;
  11698.     FIRST_VIS_CHAR     : out POSITIVE;
  11699.     LAST_VIS_CHAR      : out POSITIVE) is
  11700.      
  11701. -- This procedure does the clipping required for string precision,
  11702. -- it looks at the starting position to see if it is in the effective
  11703. -- clipping rectangle. The starting point can be in the rectangle and
  11704. -- part of the text could extend out.
  11705.      
  11706. TEXT_POS   : DC.POINT := ((TEXT_POSITION.X, TEXT_POSITION.Y));
  11707. -- Contains the TEXT_POS to enable us to change the value.
  11708.      
  11709. IN_WINDOW  : BOOLEAN := FALSE;
  11710. -- Contains a flag indicating if a point is in the window.
  11711.      
  11712. FIRST_CHAR : POSITIVE := 1;
  11713. -- Indicates the first character in the string that is visible.
  11714.      
  11715. LAST_CHAR  : POSITIVE := 1;
  11716. -- Indicates the last character in the string that is visible.
  11717.      
  11718. begin
  11719.      
  11720.   for I in 1 .. TEXT_LENGTH loop
  11721.      
  11722.       if (TEXT_POS.X < CLIP_RECTANGLE.XMIN) or
  11723.          (TEXT_POS.Y < CLIP_RECTANGLE.YMIN) or
  11724.          (TEXT_POS.X > CLIP_RECTANGLE.XMAX) or
  11725.          (TEXT_POS.Y > CLIP_RECTANGLE.YMAX) then
  11726.      
  11727.          if IN_WINDOW = FALSE then
  11728.             FIRST_CHAR := FIRST_CHAR + 1;
  11729.             LAST_CHAR := LAST_CHAR + 1;
  11730.             -- start of character in string is out of window
  11731.          else
  11732.             LAST_CHAR := LAST_CHAR - 1;
  11733.             exit;
  11734.             -- character in string is out of window, previous character
  11735.             -- is in the window.
  11736.             -- EXIT CONDITION RAISED.
  11737.          end if;
  11738.       else
  11739.          IN_WINDOW := TRUE;
  11740.          if LAST_CHAR = TEXT_LENGTH then
  11741.             exit;
  11742.          else
  11743.             LAST_CHAR := LAST_CHAR + 1;
  11744.          end if;
  11745.       end if;
  11746.       TEXT_POS.X := TEXT_POS.X + OFFSET.X;
  11747.       TEXT_POS.Y := TEXT_POS.Y + OFFSET.Y;
  11748.    end loop;
  11749.      
  11750.    if IN_WINDOW = false then
  11751.       FIRST_CHAR := 2; -- FORCES A NULL LOOP IN TEXT.
  11752.       LAST_CHAR  := 1;
  11753.       -- Covers the case where no characters are in the window.
  11754.    end if;
  11755.      
  11756.    FIRST_VIS_CHAR := FIRST_CHAR;
  11757.    LAST_VIS_CHAR  := LAST_CHAR;
  11758.      
  11759. end TEXT_CLIP;
  11760. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11761. --:UDD:GKSADACM:CODE:MA:WSR_LINE_CLIP.ADA
  11762. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11763. ------------------------------------------------------------------
  11764. --
  11765. --  NAME: LINE_CLIP
  11766. --  IDENTIFIER: GDMXXX.1(2)
  11767. --  DISCREPANCY REPORTS:
  11768. --  DR018  One case goes into infinite loop.
  11769. ------------------------------------------------------------------
  11770. -- FILE: WSR_LINE_CLIP.ADA
  11771. -- LEVEL: all
  11772.      
  11773. SEPARATE(WSR_UTILITIES)
  11774.      
  11775. procedure LINE_CLIP
  11776.    (FIRST_POINT    : DC.POINT;
  11777.     LAST_POINT     : DC.POINT;
  11778.     CLIPPED_FIRST  : out DC.POINT;
  11779.     CLIPPED_LAST   : out DC.POINT;
  11780.     CLIP_RECTANGLE : DC.RECTANGLE_LIMITS;
  11781.     CLIP_FLAG      : out CLIP_INDICATOR) is
  11782.      
  11783.    -- This procedure clips a single line made up of two points, FIRST_
  11784.    -- POINT and LAST_POINT. The line is clipped to the CLIP_RECTANGLE
  11785.    -- limits. This procedure returns a CLIP_FLAG that decribes the
  11786.    -- action performed from the applied clipping.
  11787.    --
  11788.    -- FIRST_POINT    - Contains the first point of the line.
  11789.    -- LAST_POINT     - Contains the last point of the line.
  11790.    -- CLIPPED_FIRST  - Contains the first clipped point.
  11791.    -- CLIPPED_LAST   - Contains the last clipped point.
  11792.    -- CLIP_RECTANGLE - Contains the clipping rectangle.
  11793.    -- CLIP_FLAG      - Contains the action performed on the points.
  11794.      
  11795.    type LOCATION is (OK, LEFT, TOP, RIGHT, BOTTOM);
  11796.    -- Contains the position of a point.
  11797.      
  11798.    type POSITION_STATUS is record
  11799.         X : LOCATION := OK;
  11800.         Y : LOCATION := OK;
  11801.    end record;
  11802.    -- Contains a record describing the point.
  11803.      
  11804.    STATUS_FIRST, STATUS_LAST : POSITION_STATUS;
  11805.    -- Keeps track of the position of each point.
  11806.      
  11807.    VALID_POINTS : INTEGER := 0;
  11808.    -- Number of valid points.
  11809.      
  11810.    CLIP_STATE : CLIP_INDICATOR := ERROR;
  11811.    -- Contains the state of clipping.
  11812.      
  11813.    X : DC_TYPE;
  11814.    -- Temporary X value
  11815.    Y : DC_TYPE;
  11816.    -- Temporary Y value
  11817.      
  11818.    XMIN        : DC_TYPE := CLIP_RECTANGLE.XMIN;
  11819.    YMIN        : DC_TYPE := CLIP_RECTANGLE.YMIN;
  11820.    XMAX        : DC_TYPE := CLIP_RECTANGLE.XMAX;
  11821.    YMAX        : DC_TYPE := CLIP_RECTANGLE.YMAX;
  11822.      
  11823.    INTERCEPT : array (LOCATION) of DC_TYPE := (0.0,XMIN,YMAX,XMAX,YMIN);
  11824.      
  11825. begin
  11826.      
  11827.    CLIPPED_FIRST := FIRST_POINT;
  11828.    CLIPPED_LAST  := LAST_POINT;
  11829.      
  11830.    if (FIRST_POINT.X < XMIN) then STATUS_FIRST.X := LEFT ; end if;
  11831.    if (FIRST_POINT.X > XMAX) then STATUS_FIRST.X := RIGHT; end if;
  11832.    if (FIRST_POINT.Y < YMIN) then STATUS_FIRST.Y := BOTTOM ; end if;
  11833.    if (FIRST_POINT.Y > YMAX) then STATUS_FIRST.Y := TOP ; end if;
  11834.      
  11835.    if (LAST_POINT.X < XMIN) then STATUS_LAST.X := LEFT ; end if;
  11836.    if (LAST_POINT.X > XMAX) then STATUS_LAST.X := RIGHT; end if;
  11837.    if (LAST_POINT.Y < YMIN) then STATUS_LAST.Y := BOTTOM ; end if;
  11838.    if (LAST_POINT.Y > YMAX) then STATUS_LAST.Y := TOP ; end if;
  11839.    -- finds the locations of both points.
  11840.      
  11841.    if STATUS_FIRST.X = OK and STATUS_FIRST.Y = OK then
  11842.       VALID_POINTS := VALID_POINTS + 1;
  11843.    end if;
  11844.      
  11845.    if STATUS_LAST.X = OK and STATUS_LAST.Y = OK then
  11846.       VALID_POINTS := VALID_POINTS + 1;
  11847.    end if;
  11848.      
  11849.    if VALID_POINTS = 2 then
  11850.       CLIP_STATE := NO_CLIPPING;
  11851.    end if;
  11852.      
  11853.    if STATUS_FIRST.X = STATUS_LAST.X and STATUS_FIRST.X /= OK then
  11854.       CLIP_STATE := OUT_OF_BOUNDS;
  11855.    end if;
  11856.      
  11857.    if STATUS_FIRST.Y = STATUS_LAST.Y and STATUS_FIRST.Y /= OK then
  11858.       CLIP_STATE := OUT_OF_BOUNDS;
  11859.    end if;
  11860.      
  11861.    if CLIP_STATE /= OUT_OF_BOUNDS and CLIP_STATE /= NO_CLIPPING then
  11862.      
  11863.       for I in LEFT .. BOTTOM loop
  11864.           if STATUS_FIRST.Y = I or STATUS_LAST.Y = I then
  11865.              X := (INTERCEPT(I) - FIRST_POINT.Y) *
  11866.                   (LAST_POINT.X - FIRST_POINT.X) /
  11867.                   (LAST_POINT.Y - FIRST_POINT.Y) + FIRST_POINT.X;
  11868.              -- Find the x intersection.
  11869.              if X >= XMIN and X <= XMAX then
  11870.                 if STATUS_FIRST.Y = I then
  11871.                    CLIPPED_FIRST.Y := INTERCEPT(I);
  11872.                    CLIPPED_FIRST.X := X;
  11873.                    if CLIP_STATE = ERROR then
  11874.                       CLIP_STATE := FIRST;
  11875.                    end if;
  11876.                 else
  11877.                    CLIPPED_LAST.Y := INTERCEPT(I);
  11878.                    CLIPPED_LAST.X := X;
  11879.                    CLIP_STATE := LAST;
  11880.                 end if;
  11881.                 VALID_POINTS := VALID_POINTS + 1;
  11882.              end if;
  11883.           end if;
  11884.           if VALID_POINTS = 2 then
  11885.              exit;
  11886.           end if;
  11887.      
  11888.           if STATUS_FIRST.X = I or STATUS_LAST.X = I then
  11889.              Y := (INTERCEPT(I) - FIRST_POINT.X) *
  11890.                   (LAST_POINT.Y - FIRST_POINT.Y) /
  11891.                   (LAST_POINT.X - FIRST_POINT.X) + FIRST_POINT.Y;
  11892.              -- Finds the Y intersection.
  11893.              if Y >= YMIN and Y <= YMAX then
  11894.                 if STATUS_FIRST.X = I then
  11895.                    CLIPPED_FIRST.X := INTERCEPT(I);
  11896.                    CLIPPED_FIRST.Y := Y;
  11897.                    if CLIP_STATE = ERROR then
  11898.                       CLIP_STATE := FIRST;
  11899.                    end if;
  11900.                 else
  11901.                    CLIPPED_LAST.X := INTERCEPT(I);
  11902.                    CLIPPED_LAST.Y := Y;
  11903.                    CLIP_STATE := LAST;
  11904.                 end if;
  11905.                 VALID_POINTS := VALID_POINTS + 1;
  11906.              end if;
  11907.           end if;
  11908.           if VALID_POINTS = 2 then
  11909.              exit;
  11910.           end if;
  11911.        end loop;
  11912.    end if;
  11913.    CLIP_FLAG := CLIP_STATE;
  11914. end LINE_CLIP;
  11915. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11916. --:UDD:GKSADACM:CODE:MA:WSR_TEXT_HANDLING.ADA
  11917. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11918. ------------------------------------------------------------------
  11919. --
  11920. --  NAME: TEXT_HANDLING
  11921. --  IDENTIFIER: GDMXXX.2(2)
  11922. --  DISCREPANCY REPORTS:
  11923. --  DR020  Text not working.
  11924. ------------------------------------------------------------------
  11925. -- FILE  : WSR_TEXT_HANDLING.ADA
  11926. -- LEVEL : MA
  11927.      
  11928. separate (WSR_UTILITIES)
  11929.      
  11930. procedure TEXT_HANDLING
  11931.    (CAP_TOP          : DC_TYPE;
  11932.     BASE_BOTTOM      : DC_TYPE;
  11933.     T_PATH           : TEXT_PATH;
  11934.     T_ALIGNMENT      : TEXT_ALIGNMENT;
  11935.     CHAR_HEIGHT_VECT : DC.VECTOR;
  11936.     CHAR_WIDTH_VECT  : DC.VECTOR;
  11937.     CHAR_EXP_FACTOR  : CHAR_EXPANSION;
  11938.     CHAR_SPACE       : CHAR_SPACING;
  11939.     TEXT_POSITION    : in DC.POINT;
  11940.     TEXT_LENGTH      : INTEGER;
  11941.     CHARACTER_FONT   : DC_TYPE;
  11942.     START_POSITION   : out DC.POINT;
  11943.     OFFSET           : out DC.POINT;
  11944.     TEI_LOWER_LEFT   : out DC.POINT;
  11945.     TEI_LOWER_RIGHT  : out DC.POINT;
  11946.     TEI_UPPER_LEFT   : out DC.POINT;
  11947.     TEI_UPPER_RIGHT  : out DC.POINT) is
  11948.      
  11949. -- This procedure defines the Starting Point and the X-Y Displacements
  11950. -- for displaying a given text string.  This procedure also calculates
  11951. -- the Text Extent Parallelogram.  The Starting Point returned is the
  11952. -- LEFT-BASE point of the first character to be displayed.  The Text
  11953. -- Extent Parallelogram consists of the Upper Left, Lower Left, Upper
  11954. -- Right, and Lower Right points of the text string.
  11955. --
  11956. -- Parameter definition section.
  11957. --
  11958. --  CAP_TOP          - The fraction of character height to Topline.
  11959. --  BASE_BOTTOM      - The fraction of character width to Bottomline.
  11960. --  T_PATH           - The text flow: Right, Left, Up, or Down.
  11961. --  T_ALIGNMENT      - The horizontal and vertical text position.
  11962. --  CHAR_HEIGHT_VECT - The Up/Down component vector.
  11963. --  CHAR_WIDTH_VECT  - The Left/Right component vector.
  11964. --  CHAR_EXP_FACTOR  - The width only ratio scale factor.
  11965. --  CHAR_SPACE       - The character spacing term.
  11966. --  TEXT_POSITION    - The requested starting position of the text.
  11967. --  TEXT_LENGTH      - The text string length.
  11968. --  CHARACTER_FONT   - The Font Height/Width ratio factor.
  11969. --  START_POSITION   - The returned starting position of the text.
  11970. --  OFFSET           - The text displacement for each character.
  11971. --  TEI_LOWER_LEFT   - The lower left part of the text parallelogram.
  11972. --  TEI_LOWER_RIGHT  - The lower right part of the text parallelogram.
  11973. --  TEI_UPPER_LEFT   - The upper left part of the text parallelogram.
  11974. --  TEI_UPPER_RIGHT  - The upper right part of the text parallelogram.
  11975.      
  11976. -- Variable section.
  11977.      
  11978. PHYS_CHAR_HT         : DC_TYPE;
  11979. -- The character height, from topline to bottomline, measured along
  11980. -- the character.
  11981.      
  11982. PHYS_CHAR_WT         : DC_TYPE;
  11983. --  The character width, from left to right, measured along the character.
  11984.      
  11985. X_COMP_HT_VECT       : DC_TYPE;
  11986. -- The X component of the Up Vector.
  11987.      
  11988. Y_COMP_HT_VECT       : DC_TYPE;
  11989. -- The Y component of the Up Vector.
  11990.      
  11991. X_COMP_WT_VECT       : DC_TYPE;
  11992. -- The X component of the Base Vector.
  11993.      
  11994. Y_COMP_WT_VECT       : DC_TYPE;
  11995. -- The Y component of the Base Vector.
  11996.      
  11997. TOTAL_CHAR_HT        : DC_TYPE;
  11998. -- The total height of the text string.
  11999.      
  12000. TOTAL_CHAR_WT        : DC_TYPE;
  12001. -- The total width of the text string.
  12002.      
  12003. BOTT_VALUE           : DC_TYPE;
  12004. -- A percentage of the character height.
  12005.      
  12006. TOP_VALUE            : DC_TYPE;
  12007. -- A percentage of the character height.
  12008.      
  12009. CHAR_HEIGHT          : DC_TYPE;
  12010. -- The character height determined from its vector.
  12011.      
  12012. CHAR_WIDTH           : DC_TYPE;
  12013. -- The character width determined from its vector.
  12014.      
  12015. TEXT_ALIGN           : TEXT_ALIGNMENT := T_ALIGNMENT;
  12016. -- A copy of the Text Alignment used to resolve any NORMAL components.
  12017.      
  12018. START_POINT          : DC.POINT;
  12019. -- A copy of Start Position used for calculations.
  12020.      
  12021. TEXT_LOWER_LEFT      : DC.POINT;
  12022. -- Temporary Text Extent Rectangle value.
  12023.      
  12024. TEXT_LOWER_RIGHT     : DC.POINT;
  12025. -- Temporary Text Extent Rectangle value.
  12026.      
  12027. TEXT_UPPER_LEFT      : DC.POINT;
  12028. -- Temporary Text Extent Rectangle value.
  12029.      
  12030. TEXT_UPPER_RIGHT     : DC.POINT;
  12031. -- Temporary Text Extent Rectangle value.
  12032.      
  12033. DISPLACE             : DC.POINT;
  12034. -- Temporary Offset value.
  12035.      
  12036. CHAR_SPACE_VALUE     : DC_TYPE;
  12037. -- Actual character spacing value.
  12038.      
  12039. -- Square Root routine using Newton-Raphson Method.
  12040.      
  12041. function SQRT (C : DC_TYPE) return DC_TYPE is
  12042.      
  12043. X0 : DC_TYPE := 1.0;
  12044. XK : DC_TYPE;
  12045. CT : INTEGER := 0;
  12046.      
  12047. begin
  12048.    XK := (C + (X0 * X0)) / (2.0 * X0);
  12049.      
  12050.    loop
  12051.       X0 := XK;
  12052.       XK := (C + (X0 * X0)) / (2.0 * X0);
  12053.       if XK > X0 then
  12054.          if (XK - X0) <= 0.00001 then
  12055.             exit;
  12056.          end if;
  12057.       else
  12058.          if (X0 - XK) <= 0.00001 then
  12059.             exit;
  12060.          end if;
  12061.       end if;
  12062.      
  12063.       CT := CT + 1;
  12064.       if CT > 50 then
  12065.          exit;
  12066.       end if;
  12067.    end loop;
  12068.      
  12069.    return XK;
  12070. end SQRT;
  12071.      
  12072. begin
  12073.      
  12074.    -- Initialize the Starting Position to the given Text Position.
  12075.      
  12076.    START_POINT.X := TEXT_POSITION.X;
  12077.    START_POINT.Y := TEXT_POSITION.Y;
  12078.      
  12079.    -- Resolve any NORMAL components of the Text Alignment.
  12080.    -- Horizontal component.
  12081.      
  12082.    if TEXT_ALIGN.HORIZONTAL = NORMAL then
  12083.       case T_PATH is
  12084.          when RIGHT     =>
  12085.                            TEXT_ALIGN.HORIZONTAL := LEFT;
  12086.      
  12087.          when LEFT      =>
  12088.                            TEXT_ALIGN.HORIZONTAL := RIGHT;
  12089.      
  12090.          when UP | DOWN =>
  12091.                            TEXT_ALIGN.HORIZONTAL := CENTRE;
  12092.       end case;
  12093.    end if;
  12094.      
  12095.    -- Vertical component.
  12096.      
  12097.    if TEXT_ALIGN.VERTICAL = NORMAL then
  12098.       case T_PATH is
  12099.          when DOWN              =>
  12100.                                    TEXT_ALIGN.VERTICAL := TOP;
  12101.      
  12102.          when RIGHT | LEFT | UP =>
  12103.                                    TEXT_ALIGN.VERTICAL := BASE;
  12104.       end case;
  12105.    end if;
  12106.      
  12107.    -- Determine the Character Height Vector and Character Width Vector
  12108.    -- components.  These components are used in place of SIN and COS to
  12109.    -- perform the vector calculations.
  12110.      
  12111.    CHAR_HEIGHT := SQRT ((CHAR_HEIGHT_VECT.X * CHAR_HEIGHT_VECT.X) +
  12112.         (CHAR_HEIGHT_VECT.Y * CHAR_HEIGHT_VECT.Y));
  12113.      
  12114.    CHAR_WIDTH := SQRT ((CHAR_WIDTH_VECT.X * CHAR_WIDTH_VECT.X) +
  12115.         (CHAR_WIDTH_VECT.Y * CHAR_WIDTH_VECT.Y));
  12116.      
  12117.    BOTT_VALUE := CHAR_HEIGHT * BASE_BOTTOM;
  12118.    TOP_VALUE := CHAR_HEIGHT * CAP_TOP;
  12119.      
  12120.    PHYS_CHAR_HT := CHAR_HEIGHT + BOTT_VALUE + TOP_VALUE;
  12121.    PHYS_CHAR_WT := CHAR_WIDTH * DC_TYPE (CHAR_EXP_FACTOR) *
  12122.         CHARACTER_FONT;
  12123.      
  12124.    X_COMP_HT_VECT := CHAR_HEIGHT_VECT.X / CHAR_HEIGHT;
  12125.    Y_COMP_HT_VECT := CHAR_HEIGHT_VECT.Y / CHAR_HEIGHT;
  12126.      
  12127.    X_COMP_WT_VECT := CHAR_WIDTH_VECT.X / CHAR_WIDTH;
  12128.    Y_COMP_WT_VECT := CHAR_WIDTH_VECT.Y / CHAR_WIDTH;
  12129.      
  12130.    CHAR_SPACE_VALUE := DC_TYPE (CHAR_SPACE) * CHAR_HEIGHT;
  12131.      
  12132.    -- Determine the Offsets.
  12133.      
  12134.    case T_PATH is
  12135.       when UP    =>
  12136.                     DISPLACE.X := (PHYS_CHAR_HT + CHAR_SPACE_VALUE) *
  12137.                        X_COMP_HT_VECT;
  12138.                     DISPLACE.Y := (PHYS_CHAR_HT + CHAR_SPACE_VALUE) *
  12139.                        Y_COMP_HT_VECT;
  12140.      
  12141.       when DOWN  =>
  12142.                     DISPLACE.X := 0.0 - ((PHYS_CHAR_HT +
  12143.                        CHAR_SPACE_VALUE) * X_COMP_HT_VECT);
  12144.                     DISPLACE.Y := 0.0 - ((PHYS_CHAR_HT +
  12145.                        CHAR_SPACE_VALUE) * Y_COMP_HT_VECT);
  12146.      
  12147.       when LEFT  =>
  12148.                     DISPLACE.X := 0.0 - ((PHYS_CHAR_WT +
  12149.                        CHAR_SPACE_VALUE) * X_COMP_WT_VECT);
  12150.                     DISPLACE.Y := 0.0 - ((PHYS_CHAR_WT +
  12151.                        CHAR_SPACE_VALUE) * Y_COMP_WT_VECT);
  12152.      
  12153.       when RIGHT =>
  12154.                     DISPLACE.X := (PHYS_CHAR_WT + CHAR_SPACE_VALUE) *
  12155.                        X_COMP_WT_VECT;
  12156.                     DISPLACE.Y := (PHYS_CHAR_WT + CHAR_SPACE_VALUE) *
  12157.                        Y_COMP_WT_VECT;
  12158.    end case;
  12159.      
  12160.    -- Determine the Total Character Height, the Total Character Width, the
  12161.    -- Text Alignment (TA) offset for the specified Text Path, and the
  12162.    -- proper X and Y components to be used.  All alignments are offset to
  12163.    -- the LEFT-BASE of the first text character during initial calculation.
  12164.      
  12165.    case T_PATH is
  12166.       when UP =>
  12167.                     TOTAL_CHAR_HT := (DC_TYPE (TEXT_LENGTH) *
  12168.                        (PHYS_CHAR_HT + CHAR_SPACE_VALUE)) -
  12169.                        CHAR_SPACE_VALUE;
  12170.      
  12171.                     TOTAL_CHAR_WT := PHYS_CHAR_WT;
  12172.      
  12173.                     -- Offset the Starting Point from CENTRE-BASE to
  12174.                     -- LEFT-BASE of the first character.
  12175.      
  12176.                     START_POINT.X := START_POINT.X -
  12177.                        ((PHYS_CHAR_WT / 2.0) * X_COMP_WT_VECT);
  12178.                     START_POINT.Y := START_POINT.Y -
  12179.                        ((PHYS_CHAR_WT / 2.0) * Y_COMP_WT_VECT);
  12180.      
  12181.       when DOWN =>
  12182.                     TOTAL_CHAR_HT := (DC_TYPE (TEXT_LENGTH) *
  12183.                        (PHYS_CHAR_HT + CHAR_SPACE_VALUE)) -
  12184.                        CHAR_SPACE_VALUE;
  12185.      
  12186.                     TOTAL_CHAR_WT := PHYS_CHAR_WT;
  12187.      
  12188.                     -- Offset the Starting Point from CENTRE-TOP to
  12189.                     --  LEFT-BASE of the first charactter.
  12190.      
  12191.                     START_POINT.X := START_POINT.X -
  12192.                        ((PHYS_CHAR_WT / 2.0) * X_COMP_WT_VECT);
  12193.                     START_POINT.Y := START_POINT.Y -
  12194.                        ((PHYS_CHAR_WT / 2.0) * Y_COMP_WT_VECT);
  12195.      
  12196.                     START_POINT.X := START_POINT.X -
  12197.                        ((PHYS_CHAR_HT - BOTT_VALUE) * X_COMP_HT_VECT);
  12198.                     START_POINT.Y := START_POINT.Y -
  12199.                        ((PHYS_CHAR_HT - BOTT_VALUE) * Y_COMP_HT_VECT);
  12200.      
  12201.       when LEFT =>
  12202.                     TOTAL_CHAR_HT := PHYS_CHAR_HT;
  12203.      
  12204.                     TOTAL_CHAR_WT := (DC_TYPE (TEXT_LENGTH) *
  12205.                        (PHYS_CHAR_WT + CHAR_SPACE_VALUE)) -
  12206.                        CHAR_SPACE_VALUE;
  12207.      
  12208.                     -- Offset the Starting Point from RIGHT-BASE to
  12209.                     -- LEFT-BASE of the first character.
  12210.      
  12211.                     START_POINT.X := START_POINT.X -
  12212.                        (PHYS_CHAR_WT * X_COMP_WT_VECT);
  12213.                     START_POINT.Y := START_POINT.Y -
  12214.                        (PHYS_CHAR_WT * Y_COMP_WT_VECT);
  12215.      
  12216.       when RIGHT =>
  12217.                     TOTAL_CHAR_HT := PHYS_CHAR_HT;
  12218.      
  12219.                     TOTAL_CHAR_WT := (DC_TYPE (TEXT_LENGTH) *
  12220.                        (PHYS_CHAR_WT + CHAR_SPACE_VALUE)) -
  12221.                        CHAR_SPACE_VALUE;
  12222.      
  12223.                     -- No Starting Point offset is required because the
  12224.                     -- default is already LEFT-BASE.
  12225.    end case;
  12226.      
  12227.    -- Determine the actual Starting Point.
  12228.    -- Horizontal component.
  12229.      
  12230.    case T_PATH is
  12231.       when UP =>
  12232.             case TEXT_ALIGN.HORIZONTAL is
  12233.                when CENTRE =>
  12234.                      null;
  12235.      
  12236.                when LEFT =>
  12237.                      START_POINT.X := START_POINT.X + ((TOTAL_CHAR_WT *
  12238.                         X_COMP_WT_VECT) / 2.0);
  12239.                      START_POINT.Y := START_POINT.Y + ((TOTAL_CHAR_WT *
  12240.                         Y_COMP_WT_VECT) / 2.0);
  12241.      
  12242.                when RIGHT =>
  12243.                      START_POINT.X := START_POINT.X - ((TOTAL_CHAR_WT *
  12244.                         X_COMP_WT_VECT) / 2.0);
  12245.                      START_POINT.Y := START_POINT.Y - ((TOTAL_CHAR_WT *
  12246.                         Y_COMP_WT_VECT) / 2.0);
  12247.      
  12248.                when NORMAL =>
  12249.                     null; -- Will never occur.
  12250.             end case;
  12251.      
  12252.             case TEXT_ALIGN.VERTICAL is
  12253.                when TOP =>
  12254.                      START_POINT.X := START_POINT.X - ((TOTAL_CHAR_HT -
  12255.                         BOTT_VALUE) * X_COMP_HT_VECT);
  12256.                      START_POINT.Y := START_POINT.Y - ((TOTAL_CHAR_HT -
  12257.                         BOTT_VALUE) * Y_COMP_HT_VECT);
  12258.      
  12259.                when CAP =>
  12260.                      START_POINT.X := START_POINT.X - ((TOTAL_CHAR_HT -
  12261.                         BOTT_VALUE - TOP_VALUE) * X_COMP_HT_VECT);
  12262.                      START_POINT.Y := START_POINT.Y - ((TOTAL_CHAR_HT -
  12263.                         BOTT_VALUE - TOP_VALUE) * Y_COMP_HT_VECT);
  12264.      
  12265.                when HALF =>
  12266.                      START_POINT.X := START_POINT.X - (((TOTAL_CHAR_HT -
  12267.                         BOTT_VALUE) * X_COMP_HT_VECT) / 2.0);
  12268.                      START_POINT.Y := START_POINT.Y - (((TOTAL_CHAR_HT -
  12269.                         BOTT_VALUE) * Y_COMP_HT_VECT) / 2.0);
  12270.      
  12271.                when BASE =>
  12272.                      null;
  12273.      
  12274.                when BOTTOM =>
  12275.                      START_POINT.X := START_POINT.X + (BOTT_VALUE *
  12276.                         X_COMP_HT_VECT);
  12277.                      START_POINT.Y := START_POINT.Y + (BOTT_VALUE *
  12278.                         Y_COMP_HT_VECT);
  12279.      
  12280.                when NORMAL =>
  12281.                      null; -- Will never occur.
  12282.             end case;
  12283.      
  12284.       when DOWN =>
  12285.             case TEXT_ALIGN.HORIZONTAL is
  12286.                when CENTRE =>
  12287.                      null;
  12288.      
  12289.                when LEFT =>
  12290.                      START_POINT.X := START_POINT.X + ((TOTAL_CHAR_WT *
  12291.                         X_COMP_WT_VECT) / 2.0);
  12292.                      START_POINT.Y := START_POINT.Y + ((TOTAL_CHAR_WT *
  12293.                         Y_COMP_WT_VECT) / 2.0);
  12294.      
  12295.                when RIGHT =>
  12296.                      START_POINT.X := START_POINT.X - ((TOTAL_CHAR_WT *
  12297.                         X_COMP_WT_VECT) / 2.0);
  12298.                      START_POINT.Y := START_POINT.Y - ((TOTAL_CHAR_WT *
  12299.                         Y_COMP_WT_VECT) / 2.0);
  12300.      
  12301.                when NORMAL =>
  12302.                     null; -- Will never occur.
  12303.             end case;
  12304.      
  12305.             case TEXT_ALIGN.VERTICAL is
  12306.                when TOP =>
  12307.                      null;
  12308.      
  12309.                when CAP =>
  12310.                      START_POINT.X := START_POINT.X + (TOP_VALUE *
  12311.                         X_COMP_HT_VECT);
  12312.                      START_POINT.Y := START_POINT.Y + (TOP_VALUE *
  12313.                         Y_COMP_HT_VECT);
  12314.      
  12315.                when HALF =>
  12316.                      START_POINT.X := START_POINT.X + ((TOTAL_CHAR_HT
  12317.                         * X_COMP_HT_VECT) / 2.0);
  12318.                      START_POINT.Y := START_POINT.Y + ((TOTAL_CHAR_HT
  12319.                         * Y_COMP_HT_VECT) / 2.0);
  12320.      
  12321.                when BASE =>
  12322.                      START_POINT.X := START_POINT.X + ((TOTAL_CHAR_WT -
  12323.                         BOTT_VALUE) * X_COMP_HT_VECT);
  12324.                      START_POINT.Y := START_POINT.Y + ((TOTAL_CHAR_HT -
  12325.                         BOTT_VALUE) * Y_COMP_HT_VECT);
  12326.      
  12327.                when BOTTOM =>
  12328.                      START_POINT.X := START_POINT.X + (TOTAL_CHAR_WT *
  12329.                         X_COMP_HT_VECT);
  12330.                      START_POINT.Y := START_POINT.Y + (TOTAL_CHAR_WT *
  12331.                         Y_COMP_HT_VECT);
  12332.      
  12333.                when NORMAL =>
  12334.                      null; -- Will never occur.
  12335.             end case;
  12336.      
  12337.       when LEFT =>
  12338.             case TEXT_ALIGN.HORIZONTAL is
  12339.                when CENTRE =>
  12340.                      START_POINT.X := START_POINT.X + ((TOTAL_CHAR_WT *
  12341.                         X_COMP_WT_VECT) / 2.0);
  12342.                      START_POINT.Y := START_POINT.Y + ((TOTAL_CHAR_WT *
  12343.                         Y_COMP_WT_VECT) / 2.0);
  12344.      
  12345.                when LEFT =>
  12346.                      START_POINT.X := START_POINT.X + (TOTAL_CHAR_WT *
  12347.                         X_COMP_WT_VECT);
  12348.                      START_POINT.Y := START_POINT.Y + (TOTAL_CHAR_WT *
  12349.                         Y_COMP_WT_VECT);
  12350.      
  12351.                when RIGHT =>
  12352.                      null;
  12353.      
  12354.                when NORMAL =>
  12355.                     null; -- Will never occur.
  12356.             end case;
  12357.      
  12358.             case TEXT_ALIGN.VERTICAL is
  12359.                when TOP =>
  12360.                      START_POINT.X := START_POINT.X - ((TOTAL_CHAR_HT -
  12361.                         BOTT_VALUE) * X_COMP_HT_VECT);
  12362.                      START_POINT.Y := START_POINT.Y - ((TOTAL_CHAR_HT -
  12363.                         BOTT_VALUE) * Y_COMP_HT_VECT);
  12364.      
  12365.                when CAP =>
  12366.                      START_POINT.X := START_POINT.X - ((TOTAL_CHAR_HT -
  12367.                         BOTT_VALUE - TOP_VALUE) * X_COMP_HT_VECT);
  12368.                      START_POINT.Y := START_POINT.Y - ((TOTAL_CHAR_HT -
  12369.                         BOTT_VALUE - TOP_VALUE) * Y_COMP_HT_VECT);
  12370.      
  12371.                when HALF =>
  12372.                      START_POINT.X := START_POINT.X - (((TOTAL_CHAR_HT -
  12373.                         BOTT_VALUE) * X_COMP_HT_VECT) / 2.0);
  12374.                      START_POINT.Y := START_POINT.Y - (((TOTAL_CHAR_HT -
  12375.                         BOTT_VALUE) * Y_COMP_HT_VECT) / 2.0);
  12376.      
  12377.                when BASE =>
  12378.                      null;
  12379.      
  12380.                when BOTTOM =>
  12381.                      START_POINT.X := START_POINT.X + (BOTT_VALUE *
  12382.                         X_COMP_HT_VECT);
  12383.                      START_POINT.Y := START_POINT.Y + (BOTT_VALUE *
  12384.                         Y_COMP_HT_VECT);
  12385.      
  12386.                when NORMAL =>
  12387.                      null; -- Will never occur.
  12388.             end case;
  12389.      
  12390.       when RIGHT =>
  12391.             case TEXT_ALIGN.HORIZONTAL is
  12392.                when CENTRE =>
  12393.                      START_POINT.X := START_POINT.X - ((TOTAL_CHAR_WT *
  12394.                         X_COMP_WT_VECT) / 2.0);
  12395.                      START_POINT.Y := START_POINT.Y - ((TOTAL_CHAR_WT *
  12396.                         Y_COMP_WT_VECT) / 2.0);
  12397.      
  12398.                when LEFT =>
  12399.                      null;
  12400.      
  12401.                when RIGHT =>
  12402.                      START_POINT.X := START_POINT.X - (TOTAL_CHAR_WT *
  12403.                         X_COMP_WT_VECT);
  12404.                      START_POINT.Y := START_POINT.Y - (TOTAL_CHAR_WT *
  12405.                         Y_COMP_WT_VECT);
  12406.      
  12407.                when NORMAL =>
  12408.                     null; -- Will never occur.
  12409.             end case;
  12410.      
  12411.             case TEXT_ALIGN.VERTICAL is
  12412.                when TOP =>
  12413.                      START_POINT.X := START_POINT.X - ((TOTAL_CHAR_HT -
  12414.                         BOTT_VALUE) * X_COMP_HT_VECT);
  12415.                      START_POINT.Y := START_POINT.Y - ((TOTAL_CHAR_HT -
  12416.                         BOTT_VALUE) * Y_COMP_HT_VECT);
  12417.      
  12418.                when CAP =>
  12419.                      START_POINT.X := START_POINT.X - ((TOTAL_CHAR_HT -
  12420.                         BOTT_VALUE - TOP_VALUE) * X_COMP_HT_VECT);
  12421.                      START_POINT.Y := START_POINT.Y - ((TOTAL_CHAR_HT -
  12422.                         BOTT_VALUE - TOP_VALUE) * Y_COMP_HT_VECT);
  12423.      
  12424.                when HALF =>
  12425.                      START_POINT.X := START_POINT.X - ((TOTAL_CHAR_HT
  12426.                         * X_COMP_HT_VECT) / 2.0);
  12427.                      START_POINT.Y := START_POINT.Y - ((TOTAL_CHAR_HT
  12428.                         * Y_COMP_HT_VECT) / 2.0);
  12429.      
  12430.                when BASE =>
  12431.                      null;
  12432.      
  12433.                when BOTTOM =>
  12434.                      START_POINT.X := START_POINT.X + (BOTT_VALUE *
  12435.                         X_COMP_HT_VECT);
  12436.                      START_POINT.Y := START_POINT.Y + (BOTT_VALUE *
  12437.                         Y_COMP_HT_VECT);
  12438.      
  12439.                when NORMAL =>
  12440.                      null; -- Will never occur.
  12441.             end case;
  12442.    end case;
  12443.      
  12444.    -- Calculate the all of the Text Extent Rectange coordinates.
  12445.      
  12446.    case T_PATH is
  12447.       when UP    =>
  12448.                     TEXT_LOWER_LEFT.X := START_POINT.X -
  12449.                        (BOTT_VALUE * X_COMP_HT_VECT);
  12450.                     TEXT_LOWER_LEFT.Y := START_POINT.Y -
  12451.                        (BOTT_VALUE * Y_COMP_HT_VECT);
  12452.      
  12453.                     TEXT_LOWER_RIGHT.X :=
  12454.                        TEXT_LOWER_LEFT.X + (PHYS_CHAR_WT *
  12455.                           X_COMP_WT_VECT);
  12456.                     TEXT_LOWER_RIGHT.Y :=
  12457.                        TEXT_LOWER_LEFT.Y + (PHYS_CHAR_WT *
  12458.                           Y_COMP_WT_VECT);
  12459.      
  12460.                     TEXT_UPPER_LEFT.X :=
  12461.                        TEXT_LOWER_LEFT.X + (DISPLACE.X *
  12462.                           DC_TYPE (TEXT_LENGTH));
  12463.                     TEXT_UPPER_LEFT.Y :=
  12464.                        TEXT_LOWER_LEFT.Y + (DISPLACE.Y *
  12465.                           DC_TYPE (TEXT_LENGTH));
  12466.      
  12467.                     TEXT_UPPER_RIGHT.X :=
  12468.                        TEXT_LOWER_RIGHT.X + (DISPLACE.X *
  12469.                           DC_TYPE (TEXT_LENGTH));
  12470.                     TEXT_UPPER_RIGHT.Y :=
  12471.                        TEXT_LOWER_RIGHT.Y + (DISPLACE.Y *
  12472.                           DC_TYPE (TEXT_LENGTH));
  12473.      
  12474.       when DOWN  =>
  12475.                     TEXT_UPPER_LEFT.X := START_POINT.X +
  12476.                        ((PHYS_CHAR_HT - BOTT_VALUE) * X_COMP_HT_VECT);
  12477.                     TEXT_UPPER_LEFT.Y := START_POINT.Y +
  12478.                        ((PHYS_CHAR_HT - BOTT_VALUE) * Y_COMP_HT_VECT);
  12479.      
  12480.                     TEXT_UPPER_RIGHT.X :=
  12481.                        TEXT_UPPER_LEFT.X + (PHYS_CHAR_WT *
  12482.                           X_COMP_WT_VECT);
  12483.                     TEXT_UPPER_RIGHT.Y :=
  12484.                        TEXT_UPPER_LEFT.Y + (PHYS_CHAR_WT *
  12485.                           Y_COMP_WT_VECT);
  12486.      
  12487.                     TEXT_LOWER_LEFT.X :=
  12488.                        TEXT_UPPER_LEFT.X + (DISPLACE.X *
  12489.                           DC_TYPE (TEXT_LENGTH));
  12490.                     TEXT_LOWER_LEFT.Y :=
  12491.                        TEXT_UPPER_LEFT.Y + (DISPLACE.Y *
  12492.                           DC_TYPE (TEXT_LENGTH));
  12493.      
  12494.                     TEXT_LOWER_RIGHT.X :=
  12495.                        TEXT_UPPER_RIGHT.X + (DISPLACE.X *
  12496.                           DC_TYPE (TEXT_LENGTH));
  12497.                     TEXT_LOWER_RIGHT.Y :=
  12498.                        TEXT_UPPER_RIGHT.Y + (DISPLACE.Y *
  12499.                           DC_TYPE (TEXT_LENGTH));
  12500.      
  12501.       when LEFT  =>
  12502.                     TEXT_LOWER_RIGHT.X := START_POINT.X - DISPLACE.X -
  12503.                        (BOTT_VALUE * X_COMP_HT_VECT);
  12504.                     TEXT_LOWER_RIGHT.Y := START_POINT.Y - DISPLACE.Y -
  12505.                        (BOTT_VALUE * Y_COMP_HT_VECT);
  12506.      
  12507.                     TEXT_UPPER_RIGHT.X := START_POINT.X - DISPLACE.X +
  12508.                        ((PHYS_CHAR_HT - BOTT_VALUE) * X_COMP_HT_VECT);
  12509.                     TEXT_UPPER_RIGHT.Y := START_POINT.Y - DISPLACE.Y +
  12510.                        ((PHYS_CHAR_HT - BOTT_VALUE) * Y_COMP_HT_VECT);
  12511.      
  12512.                     TEXT_LOWER_LEFT.X :=
  12513.                        TEXT_LOWER_RIGHT.X + (DISPLACE.X *
  12514.                           DC_TYPE (TEXT_LENGTH));
  12515.                     TEXT_LOWER_LEFT.Y :=
  12516.                        TEXT_LOWER_RIGHT.Y + (DISPLACE.Y *
  12517.                           DC_TYPE (TEXT_LENGTH));
  12518.      
  12519.                     TEXT_UPPER_LEFT.X :=
  12520.                        TEXT_UPPER_RIGHT.X + (DISPLACE.X *
  12521.                           DC_TYPE (TEXT_LENGTH));
  12522.                     TEXT_UPPER_LEFT.Y :=
  12523.                        TEXT_UPPER_RIGHT.Y + (DISPLACE.Y *
  12524.                           DC_TYPE (TEXT_LENGTH));
  12525.      
  12526.       when RIGHT =>
  12527.                     TEXT_LOWER_LEFT.X := START_POINT.X -
  12528.                        (BOTT_VALUE * X_COMP_HT_VECT);
  12529.                     TEXT_LOWER_LEFT.Y := START_POINT.Y -
  12530.                        (BOTT_VALUE * Y_COMP_HT_VECT);
  12531.      
  12532.                     TEXT_UPPER_LEFT.X := START_POINT.X +
  12533.                        ((PHYS_CHAR_HT - BOTT_VALUE) * X_COMP_HT_VECT);
  12534.                     TEXT_UPPER_LEFT.Y := START_POINT.Y +
  12535.                        ((PHYS_CHAR_HT - BOTT_VALUE) * Y_COMP_HT_VECT);
  12536.      
  12537.                     TEXT_LOWER_RIGHT.X :=
  12538.                        TEXT_LOWER_LEFT.X + (DISPLACE.X *
  12539.                           DC_TYPE (TEXT_LENGTH));
  12540.                     TEXT_LOWER_RIGHT.Y :=
  12541.                        TEXT_LOWER_LEFT.Y + (DISPLACE.Y *
  12542.                           DC_TYPE (TEXT_LENGTH));
  12543.      
  12544.                     TEXT_UPPER_RIGHT.X :=
  12545.                        TEXT_UPPER_LEFT.X + (DISPLACE.X *
  12546.                           DC_TYPE (TEXT_LENGTH));
  12547.                     TEXT_UPPER_RIGHT.Y :=
  12548.                        TEXT_UPPER_LEFT.Y + (DISPLACE.Y *
  12549.                           DC_TYPE (TEXT_LENGTH));
  12550.    end case;
  12551.      
  12552.    START_POSITION.X := START_POINT.X;
  12553.    START_POSITION.Y := START_POINT.Y;
  12554.      
  12555.    -- Set the out parameters of the Text Extent Rectangle to their proper
  12556.    -- values.
  12557.      
  12558.    TEI_LOWER_LEFT.X := TEXT_LOWER_LEFT.X;
  12559.    TEI_LOWER_LEFT.Y := TEXT_LOWER_LEFT.Y;
  12560.      
  12561.    TEI_LOWER_RIGHT.X := TEXT_LOWER_RIGHT.X;
  12562.    TEI_LOWER_RIGHT.Y := TEXT_LOWER_RIGHT.Y;
  12563.      
  12564.    TEI_UPPER_LEFT.X := TEXT_UPPER_LEFT.X;
  12565.    TEI_UPPER_LEFT.Y := TEXT_UPPER_LEFT.Y;
  12566.      
  12567.    TEI_UPPER_RIGHT.X := TEXT_UPPER_RIGHT.X;
  12568.    TEI_UPPER_RIGHT.Y := TEXT_UPPER_RIGHT.Y;
  12569.      
  12570.    OFFSET.X := DISPLACE.X;
  12571.    OFFSET.Y := DISPLACE.Y;
  12572.      
  12573. end TEXT_HANDLING;
  12574. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12575. --:UDD:GKSADACM:CODE:MA:WSR_TRANSFORM.ADA
  12576. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12577. ------------------------------------------------------------------
  12578. --
  12579. --  NAME: TRANSFORM
  12580. --  IDENTIFIER: GDMXXX.1(1)
  12581. --  DISCREPANCY REPORTS:
  12582. --
  12583. ------------------------------------------------------------------
  12584. -- FILE: WSR_TRANSFORM.ADA
  12585. -- LEVEL: all
  12586.      
  12587. separate (WSR_UTILITIES)
  12588.      
  12589. function TRANSFORM
  12590.    (INPUT_VALUE     : float;
  12591.     INPUT_UPPER     : float;
  12592.     INPUT_LOWER     : float;
  12593.     TRANSFORM_UPPER : integer;
  12594.     TRANSFORM_LOWER : integer) return integer is
  12595.      
  12596. -- This function returns a transformed value that is converted from
  12597. -- one range of values to another range of values.
  12598. --
  12599. -- INPUT_VALUE      - The value to be converted.
  12600. -- INPUT_UPPER      - The upper range of the input number.
  12601. -- INPUT_LOWER      - The lower range of the input number.
  12602. -- TRANSFORM_UPPER  - The upper range of the new transformed range.
  12603. -- TRANSFORM_LOWER  - The lower range of the new transformed range.
  12604.      
  12605. OLD_RANGE : float := INPUT_UPPER - INPUT_LOWER;
  12606. -- Contains the input value range.
  12607.      
  12608. NEW_RANGE : integer := TRANSFORM_UPPER - TRANSFORM_LOWER;
  12609. -- Contains the transformed value range.
  12610.      
  12611. INTERMEDIATE_VALUE : float;
  12612. -- Contains the value mapped into the new range.
  12613.      
  12614. LOCATE_RANGE : integer;
  12615. -- Contains the number of the range the INTERMEDIATE_VALUE is in.
  12616.      
  12617. TRANSFORM_VALUE : integer;
  12618. -- Contains the number in the transformed range.
  12619.      
  12620.    begin
  12621.       if INPUT_VALUE = INPUT_UPPER then
  12622.          TRANSFORM_VALUE := TRANSFORM_UPPER;
  12623.       elsif INPUT_VALUE = INPUT_LOWER then
  12624.          TRANSFORM_VALUE := TRANSFORM_LOWER;
  12625.       else
  12626.          INTERMEDIATE_VALUE := (float(TRANSFORM_LOWER) *
  12627.             (INPUT_UPPER - INPUT_VALUE) / OLD_RANGE) -
  12628.             (float(TRANSFORM_UPPER) * (INPUT_LOWER - INPUT_VALUE) /
  12629.             OLD_RANGE);
  12630.      
  12631.           LOCATE_RANGE :=  integer(INTERMEDIATE_VALUE -
  12632.              float(TRANSFORM_LOWER));
  12633.      
  12634.           TRANSFORM_VALUE := integer(INTERMEDIATE_VALUE +
  12635.               (float(LOCATE_RANGE) / float(NEW_RANGE)) - 0.5);
  12636.       end if;
  12637.       return TRANSFORM_VALUE;
  12638. end TRANSFORM;
  12639. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12640. --:UDD:GKSADACM:CODE:MA:LEXI_CLR_OPS.ADA
  12641. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12642. ------------------------------------------------------------------
  12643. --
  12644. --  NAME: LEXI3700_COLOUR_OPERATIONS
  12645. --  IDENTIFIER: GDMXXX.1(1)
  12646. --  DISCREPANCY REPORTS:
  12647. --
  12648. ------------------------------------------------------------------
  12649. -- FILE: LEXI_CLR_OPS.ADA
  12650. -- LEVEL: MA
  12651.      
  12652. with GKS_TYPES;
  12653. with WS_STATE_LIST_TYPES;
  12654.      
  12655. use  GKS_TYPES;
  12656.      
  12657. package LEXI3700_COLOUR_OPERATIONS is
  12658.      
  12659. -- This package contains a procedure that sets the colour values for the
  12660. -- colour lookup table.
  12661.      
  12662.    procedure SET_COLOUR_REPRESENTATION
  12663.       (WS_SL  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  12664.        INDEX  : COLOUR_INDEX;
  12665.        COLOUR : COLOUR_REPRESENTATION;
  12666.        ERROR  : out ERROR_INDICATOR);
  12667.      
  12668. end LEXI3700_COLOUR_OPERATIONS;
  12669. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12670. --:UDD:GKSADACM:CODE:MA:LEXI_CLR_OPS_B.ADA
  12671. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12672. ------------------------------------------------------------------
  12673. --
  12674. --  NAME: LEXI3700_COLOUR_OPERATIONS - BODY
  12675. --  IDENTIFIER: GDMXXX.1(1)
  12676. --  DISCREPANCY REPORTS:
  12677. --
  12678. ------------------------------------------------------------------
  12679. -- FILE: LEXI_CLR_OPS_B.ADA
  12680. -- LEVEL: MA
  12681.      
  12682. with LEXI3700_TYPES;
  12683. with LEXI3700_OUTPUT_DRIVER;
  12684. with GKS_ERRORS;
  12685. with WSR_SET_COLOUR_TABLE;
  12686. with WSR_UTILITIES;
  12687.      
  12688. use  LEXI3700_TYPES;
  12689.      
  12690. package body LEXI3700_COLOUR_OPERATIONS is
  12691.      
  12692. -- The procedure for setting the colour representation on the Lexidata
  12693. -- is found in a separate file.
  12694.      
  12695.    procedure SET_COLOUR_REPRESENTATION
  12696.       (WS_SL  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  12697.        INDEX  : COLOUR_INDEX;
  12698.        COLOUR : COLOUR_REPRESENTATION;
  12699.        ERROR  : out ERROR_INDICATOR) is separate;
  12700.      
  12701. end LEXI3700_COLOUR_OPERATIONS;
  12702. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12703. --:UDD:GKSADACM:CODE:MA:WSD_SET_CLR_REP.ADA
  12704. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12705. ------------------------------------------------------------------
  12706. --
  12707. --  NAME: SET_COLOUR_REPRESENTATION
  12708. --  IDENTIFIER: GDMXXX.1(1)
  12709. --  DISCREPANCY REPORTS:
  12710. --
  12711. ------------------------------------------------------------------
  12712. -- FILE: WSD_SET_CLR_REP.ADA
  12713. -- LEVEL : MA
  12714.      
  12715. separate (LEXI3700_COLOUR_OPERATIONS)
  12716.      
  12717. procedure SET_COLOUR_REPRESENTATION
  12718.    (WS_SL  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  12719.     INDEX  : COLOUR_INDEX;
  12720.     COLOUR : COLOUR_REPRESENTATION;
  12721.     ERROR  : out ERROR_INDICATOR) is
  12722.      
  12723. -- This procedure sets the requested entry in the color lookup table to
  12724. -- a particular colour value.
  12725. --
  12726. -- This procedure calls a procedure to set the colour in the workstation
  12727. -- state list, converts the colour density values into the device
  12728. -- dependent values, and calls another procedure in the device driver
  12729. -- which sets the colour.
  12730. --
  12731. -- WS_SL  - a pointer to the workstation state list.
  12732. -- INDEX  - contains the index into its colour lookup table.
  12733. -- COLOUR - contains the new intensity value for the three colours -
  12734. --          red, blue, and green.
  12735. -- ERROR  - returns an error_indicator.
  12736.      
  12737. EI : ERROR_INDICATOR;
  12738. -- Used to hold the returned error from WSR_SET_CLR_REP.
  12739.      
  12740. LEXI_COLOUR_VALUE : LEXI_PIXEL_COLOUR;
  12741. -- LEXI_COLOUR_VALUE - this contains COLOUR after its intensity values
  12742. -- are converted into Lexidata compatable intensity values.
  12743.      
  12744.    function CONVERT_TO_DEVICE_RANGE
  12745.      (STANDARD_INTENSITY : INTENSITY)
  12746.       return LEXI_COLOUR_INTENSITY is
  12747.      
  12748.    -- This function accepts intensity values which are in the range of
  12749.    -- the standard GKS intensities [0,1] and converts them into
  12750.    -- intensity values that can be sent to the device.
  12751.    --
  12752.    -- STANDARD_INTENSITY - the intensity value given as a percentage
  12753.    --                      between zero and one.
  12754.      
  12755.    begin
  12756.      
  12757.       -- A procedure is called in the Workstation Resource which will
  12758.       -- convert from a range of floating values into an even distri-
  12759.       -- bution of integer values.
  12760.       return LEXI_COLOUR_INTENSITY
  12761.          (WSR_UTILITIES.TRANSFORM
  12762.           (FLOAT (STANDARD_INTENSITY),
  12763.            FLOAT (INTENSITY'LAST),
  12764.            FLOAT (INTENSITY'FIRST),
  12765.            INTEGER (LEXI_COLOUR_INTENSITY'LAST),
  12766.            INTEGER (LEXI_COLOUR_INTENSITY'FIRST)));
  12767.    end CONVERT_TO_DEVICE_RANGE;
  12768.      
  12769. begin
  12770.      
  12771.    -- A procedure is called in the Workstation Resource which sets
  12772.    -- the Workstation's Colour Lookup Table entry at INDEX to COLOUR.
  12773.    WSR_SET_COLOUR_TABLE.SET_COLOUR_REPRESENTATION
  12774.       (WS_SL, INDEX, COLOUR, EI);
  12775.      
  12776.    -- If error #93 is not detected, further processing is done to set
  12777.    -- the colour on the Lexidata's own colour lookup table.
  12778.    if EI = GKS_ERRORS.SUCCESSFUL then
  12779.      
  12780.       -- The three intensity values are converted into values which are
  12781.       -- meaningful to the Lexidata.
  12782.       LEXI_COLOUR_VALUE.RED   := CONVERT_TO_DEVICE_RANGE (COLOUR.RED);
  12783.       LEXI_COLOUR_VALUE.BLUE  := CONVERT_TO_DEVICE_RANGE (COLOUR.BLUE);
  12784.       LEXI_COLOUR_VALUE.GREEN := CONVERT_TO_DEVICE_RANGE (COLOUR.GREEN);
  12785.      
  12786.       -- The Device Driver is called to set the colour value at INDEX.
  12787.       LEXI3700_OUTPUT_DRIVER.WRITE_TO_LUT
  12788.          (LEXI_COLOUR_INDEX(INDEX), LEXI_COLOUR_VALUE);
  12789.      
  12790.    end if;
  12791.      
  12792.    -- The value of the Error Indicator is returned.
  12793.    ERROR := EI;
  12794.      
  12795. end SET_COLOUR_REPRESENTATION;
  12796. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12797. --:UDD:GKSADACM:CODE:MA:WSR_GKS_NORM.ADA
  12798. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12799. ------------------------------------------------------------------
  12800. --
  12801. --  NAME: WSR_GKS_NORMALIZATION
  12802. --  IDENTIFIER: GDMXXX.1(1)
  12803. --  DISCREPANCY REPORTS:
  12804. --
  12805. ------------------------------------------------------------------
  12806. -- file : WSR_GKS_NORM.ADA
  12807. -- level: ma,0a,1a,2a
  12808.      
  12809. with GKS_TYPES;
  12810. with WS_STATE_LIST_TYPES;
  12811.      
  12812. use  GKS_TYPES;
  12813.      
  12814. package WSR_GKS_NORMALIZATION is
  12815.      
  12816. -- This package is a workstation resource package that can be used by
  12817. -- any workstation driver that needs to have the CLIPPING_RECTANGLE
  12818. -- set in the specified workstation state list.  It sets the value
  12819. -- in the WS_ST_LST to the specified value then it finds the inter-
  12820. -- section between the CLIP_RECTANGLE and the CURRENT_WS_WINDOW that
  12821. -- is in the workstation state list and sets the EFFECTIVE_CLIPPING_
  12822. -- RECTANGLE in the WS_ST_LST.
  12823.      
  12824.    procedure SET_CLIPPING_RECTANGLE
  12825.       (WS_ST_LST      : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  12826.        CLIP_RECTANGLE : in NDC.RECTANGLE_LIMITS);
  12827.      
  12828.  end WSR_GKS_NORMALIZATION;
  12829. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12830. --:UDD:GKSADACM:CODE:MA:WSR_GKS_NORM_B.ADA
  12831. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12832. ------------------------------------------------------------------
  12833. --
  12834. --  NAME: WSR_GKS_NORMALIZATION - BODY
  12835. --  IDENTIFIER: GDMXXX.1(1)
  12836. --  DISCREPANCY REPORTS:
  12837. --
  12838. ------------------------------------------------------------------
  12839. -- file : WSR_GKS_NORM_B.ADA
  12840. -- level: ma - 2a
  12841.      
  12842. with NDC_OPS;
  12843. with CONVERT_NDC_DC;
  12844.      
  12845. package body WSR_GKS_NORMALIZATION is
  12846.      
  12847.    procedure SET_CLIPPING_RECTANGLE
  12848.       (WS_ST_LST      : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  12849.        CLIP_RECTANGLE : in NDC.RECTANGLE_LIMITS) is
  12850.      
  12851.    -- This procedure sets the value for the CLIPPING_RECTANGLE in the
  12852.    -- WS_STATE_LIST to the value specified by the parameter.
  12853.    --
  12854.    -- The following parameters are used in this procedure:
  12855.    -- WS_ST_LST - The specified WS_STATE_LIST to set the clipping
  12856.    --             rectangle on.
  12857.    -- CLIP_RECTANGLE - The value to which the CLIPPING_RECTANGLE is set.
  12858.      
  12859.       NDC_CLIPPING_RECTANGLE : NDC.RECTANGLE_LIMITS;
  12860.       -- A temporary location for storage of the EFFECTIVE_CLIPPING
  12861.       -- RECTANGLE before it is transformed to DC points and stored in
  12862.       -- the WS_ST_LST.
  12863.      
  12864.    begin
  12865.      
  12866.       WS_ST_LST.OUTPUT_ATTR.CLIPPING_RECTANGLE := CLIP_RECTANGLE;
  12867.      
  12868.       -- Compute the EFFECTIVE_CLIPPING_RECTANGLE.
  12869.       NDC_CLIPPING_RECTANGLE :=
  12870.             NDC_OPS."and"(CLIP_RECTANGLE,WS_ST_LST.CURRENT_WS_WINDOW);
  12871.      
  12872.       -- Transform the clipping rectangle from NDC to DC.
  12873.       WS_ST_LST.EFFECTIVE_CLIPPING_RECTANGLE :=
  12874.             CONVERT_NDC_DC.DC_RECTANGLE_LIMITS
  12875.                (NDC_CLIPPING_RECTANGLE,WS_ST_LST.WS_TRANSFORM);
  12876.      
  12877.    end SET_CLIPPING_RECTANGLE;
  12878.      
  12879. end WSR_GKS_NORMALIZATION;
  12880. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12881. --:UDD:GKSADACM:CODE:MA:LEXI3700_TBLS_MA_B.ADA
  12882. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12883. ------------------------------------------------------------------
  12884. --
  12885. --  NAME: LEXI3700_WS_TABLES - BODY
  12886. --  IDENTIFIER: GDMXXX.1(2)
  12887. --  DISCREPANCY REPORTS:
  12888. --  DR015  Change the field for Deferral Mode.
  12889. ------------------------------------------------------------------
  12890. -- file : lexi3700_tbls_ma_b.ada
  12891. -- level: ma
  12892.      
  12893. with WS_TABLE_TYPES;
  12894. with LEXI3700_CONFIGURATION;
  12895. with GKS_CONFIGURATION;
  12896.      
  12897. package body LEXI3700_WS_TABLES is
  12898.      
  12899. -- This package initializes the LEXI3700_DT.  It uses the WS_DESCRIPTION
  12900. -- TABLE_TYPES package as a template and it fills in the fields.  Some
  12901. -- of the fields are based on values in the LEXI3700_CONFIGURATION
  12902. -- package, others are based on what GKS supports at level MA
  12903. -- while still others are strictly implementation dependent.
  12904.      
  12905.    -- The following subtype is declared to rename the COLOUR_TABLE in
  12906.    -- the WS_TABLE_TYPES package.
  12907.    subtype PRE_COLOUR_REP is GKS_TYPES.COLOUR_REPRESENTATION;
  12908.      
  12909.    -- The following constants are used to create lists of supported
  12910.    -- items in the GKS_LIST_UTILITIES package.
  12911.    LINE_TYPE_LIST : constant LINETYPES.LIST_VALUES := (1,2,3,4);
  12912.    MARKER_TYPE_LIST : constant MARKER_TYPES.LIST_VALUES := (1,2,3,4,5);
  12913.    INTERIOR_STYLE_LIST : constant INTERIOR_STYLES.LIST_VALUES :=
  12914.          (SOLID,HOLLOW);
  12915.    TEXT_FONT_AND_PRECISION_LIST : constant TEXT_FONT_PRECISIONS
  12916.          .LIST_VALUES := (1 => TEXT_FONT_PRECISION'
  12917.          (FONT => 1, PRECISION => STRING_PRECISION));
  12918.      
  12919.    -- A pointer to a WORKSTATION_STATE_LIST.  The initial value is
  12920.    -- NULL.  Since only one workstation can be opened at one time at
  12921.    -- level ma there is no need to create more than one state list at
  12922.    -- a time.
  12923.      
  12924.    LEXI_ST_LST : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  12925.      
  12926.    -- A function used to get a specified WS_STATE_LIST.
  12927.    function GET_STATE_LIST_PTR( WS_ID : in GKS_TYPES.WS_ID ) return
  12928.          WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR
  12929.    is separate;
  12930.      
  12931.    -- A procedure used to add a WS_STATE_LIST to the list.
  12932.    procedure ADD_STATE_LIST_TO_LIST
  12933.         (WS_ID       : in GKS_TYPES.WS_ID;
  12934.          CONNECT_ID  : in VARIABLE_CONNECTION_ID;
  12935.          WS_TYPE     : in GKS_TYPES.WS_TYPE;
  12936.          ATTRIBUTES  : in OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  12937.          EI          : out ERROR_INDICATOR)
  12938.    is separate;
  12939.      
  12940.    -- A procedure used for deleting a WS_STATE_LIST from the list.
  12941.    procedure DELETE_STATE_LIST_FROM_LIST
  12942.         (WS_ID : in GKS_TYPES.WS_ID)
  12943.    is separate;
  12944.      
  12945. begin
  12946.      
  12947.    LEXI3700_WS_DT.WORKSTATION_TYPE := GKS_CONFIGURATION
  12948.          .LEXIDATA_3700_OUTPUT_TYPE;
  12949.    LEXI3700_WS_DT.WORKSTATION_CATEGORY := OUTPUT;
  12950.      
  12951.    -- The coordinate units are not in meters they are in raster units.
  12952.    LEXI3700_WS_DT.DEVICE_COOR_UNITS    := OTHER;
  12953.      
  12954.    -- The size of the display in DC units.
  12955.    LEXI3700_WS_DT.MAX_DISPLAY_SURFACE_DC_UNITS  :=
  12956.          (DC.MAGNITUDE(LEXI3700_CONFIGURATION.LEXI_X_MAXIMUM),
  12957.           DC.MAGNITUDE(LEXI3700_CONFIGURATION.LEXI_Y_MAXIMUM));
  12958.      
  12959.    -- The size of the display surface in raster units.
  12960.    -- The plus one is added because the LEXIDATA physical addressing
  12961.    -- of the raster units starts at (0,0).
  12962.    LEXI3700_WS_DT.MAX_DISPLAY_SURFACE_RASTER_UNITS :=
  12963.          (LEXI3700_CONFIGURATION.LEXI_X_MAXIMUM + 1,
  12964.           LEXI3700_CONFIGURATION.LEXI_Y_MAXIMUM + 1);
  12965.      
  12966.    -- The display type (raster, vector etc)
  12967.    LEXI3700_WS_DT.DISPLAY_TYPE := RASTER_DISPLAY;
  12968.      
  12969.    -- The dynamic capabilities of the workstation.
  12970.    LEXI3700_WS_DT.WS_DYNAMICS := WS_DESCRIPTION_TABLE_TYPES
  12971.          .DYN_MOD_ACCEPTED_FOR_WS_ATTRIBUTES'
  12972.            (POLYLINE_BUNDLE_REP   => IRG,
  12973.             POLYMARKER_BUNDLE_REP => IRG,
  12974.             TEXT_BUNDLE_REP       => IRG,
  12975.             FILL_AREA_BUNDLE_REP  => IRG,
  12976.             PATTERN_REP           => IRG,
  12977.             COLOUR_REP            => IMM,
  12978.             WS_TRANSFORMATION     => IRG);
  12979.      
  12980.    -- The workstation deferral mode.  Set to AT SOME TIME.
  12981.    LEXI3700_WS_DT.DEFER_MODE    := ASAP;
  12982.      
  12983.    -- The implicit regeneration mode.  Set to SUPPRESS regeneration.
  12984.    LEXI3700_WS_DT.IMPLICIT_REGEN_MODE := SUPPRESSED;
  12985.      
  12986.    -- Initializes the LIST_OF_AVAILABLE_LTYPE entry.
  12987.    LEXI3700_WS_DT.LIST_AVAILABLE_LTYPE := LINETYPES.LIST
  12988.          ( LINE_TYPE_LIST );
  12989.      
  12990.    -- Only the default line width supported at level ma.
  12991.    LEXI3700_WS_DT.NUM_AVAILABLE_LWIDTH := 1;
  12992.      
  12993.    LEXI3700_WS_DT.NOMINAL_LWIDTH := DC.MAGNITUDE(LEXI3700_CONFIGURATION
  12994.                                     .LEXI_NOMINAL_LINE_WIDTH);
  12995.      
  12996.    -- Only the default line width is available.
  12997.    LEXI3700_WS_DT.RANGE_OF_LWIDTH := (1.0,1.0);
  12998.      
  12999.    -- Initializes the LIST_OF_AVAILABLE_MARKER_TYPES.
  13000.    LEXI3700_WS_DT.LIST_AVAILABLE_MARKER_TYPES := MARKER_TYPES.LIST
  13001.          ( MARKER_TYPE_LIST );
  13002.      
  13003.    -- The number of available marker sizes.
  13004.    -- There are no available marker sizes.  Just one predefined size.
  13005.    LEXI3700_WS_DT.NUM_AVAILABLE_MARKER_SIZES := 1;
  13006.      
  13007.    -- The normal marker size drawn.
  13008.    LEXI3700_WS_DT.NOMINAL_MARKER_SIZE := DC.MAGNITUDE
  13009.         (LEXI3700_CONFIGURATION.LEXI_NOMINAL_TEXT_SIZE);
  13010.      
  13011.    -- The range of available marker sizes.
  13012.    -- Only one marker size available at level ma.
  13013.    LEXI3700_WS_DT.RANGE_OF_MARKER_SIZES := (1.0,1.0);
  13014.      
  13015.    -- The list of text font and precisions.
  13016.    LEXI3700_WS_DT.LIST_TEXT_FONT_AND_PRECISION :=
  13017.          TEXT_FONT_PRECISIONS.LIST( TEXT_FONT_AND_PRECISION_LIST );
  13018.      
  13019.    -- The number of available character expansions.  However this
  13020.    -- device doesn't support character expansions.
  13021.    LEXI3700_WS_DT.NUM_AVAILABLE_CHAR_EXPANSIONS := 1;
  13022.      
  13023.    -- Lexi3700 does not support character expansion factors
  13024.    LEXI3700_WS_DT.RANGE_OF_CHAR_EXPANSIONS := (1.0,1.0);
  13025.      
  13026.    -- The number of available character heights.
  13027.    LEXI3700_WS_DT.NUM_AVAILABLE_CHAR_HEIGHTS :=
  13028.          (LEXI3700_CONFIGURATION.LEXI_MAXIMUM_TEXT_SIZE);
  13029.      
  13030.    -- The range of character heights available.
  13031.    -- The minimum character height to the maximum character height.
  13032.    LEXI3700_WS_DT.RANGE_OF_CHAR_HEIGHTS :=
  13033.         (DC.MAGNITUDE(LEXI3700_CONFIGURATION.LEXI_MINIMUM_TEXT_SIZE),
  13034.          DC.MAGNITUDE(LEXI3700_CONFIGURATION.LEXI_MAXIMUM_TEXT_SIZE));
  13035.      
  13036.    -- Initializes the LIST_OF_AVAL_INTERIOR_STYLE entry.
  13037.    LEXI3700_WS_DT.LIST_OF_AVAL_INTERIOR_STYLE :=
  13038.          INTERIOR_STYLES.LIST( INTERIOR_STYLE_LIST );
  13039.      
  13040.    -- Initializes the LIST_OF_AVAL_HATCH_STYLE entry.
  13041.    -- However out implementation does not support HATCH STYLES therefore
  13042.    -- the entry is NULL.
  13043.    LEXI3700_WS_DT.LIST_OF_AVAL_HATCH_STYLE := HATCH_STYLES.NULL_LIST;
  13044.      
  13045.    -- The number of available colours.  The LEXIDATA supports 255
  13046.    -- intensities for each colour (red, green, blue).  This would
  13047.    -- mean an application programmer can access up to approximately
  13048.    -- sixteen million colours.  We feel that this constitutes a
  13049.    -- continue ranges of colours available, therefore we have put a
  13050.    -- zero for the following entry.
  13051.      
  13052.    LEXI3700_WS_DT.NUM_OF_AVAL_COLOUR_INTENSITY := 0;
  13053.      
  13054.    -- Tells that there is colour available on the device.
  13055.    LEXI3700_WS_DT.COLOUR_AVAL := COLOUR;
  13056.      
  13057.    -- The list of predefined colours for the device.
  13058.    LEXI3700_WS_DT.PREDEFINED_COLOUR_REP :=  WS_TABLE_TYPES
  13059.          .COLOUR_TABLE_LIST'
  13060.          (0=> PRE_COLOUR_REP'( RED=>0.0,GREEN=>0.0,BLUE=>0.0), --black
  13061.           1=> PRE_COLOUR_REP'( RED=>1.0,GREEN=>1.0,BLUE=>1.0), --white
  13062.           2=> PRE_COLOUR_REP'( RED=>1.0,GREEN=>0.0,BLUE=>0.0), --red
  13063.           3=> PRE_COLOUR_REP'( RED=>0.0,GREEN=>1.0,BLUE=>0.0), --green
  13064.           4=> PRE_COLOUR_REP'( RED=>0.0,GREEN=>0.0,BLUE=>1.0), --blue
  13065.           5=> PRE_COLOUR_REP'( RED=>1.0,GREEN=>1.0,BLUE=>0.0), --yellow
  13066.           6=> PRE_COLOUR_REP'( RED=>1.0,GREEN=>0.0,BLUE=>1.0), --magenta
  13067.           7=> PRE_COLOUR_REP'( RED=>0.0,GREEN=>1.0,BLUE=>1.0));--cyan
  13068.      
  13069.    LEXI3700_WS_DT.MAX_NUM_PLIN_BUNDLE_TBL_ENTRIES := 0;
  13070.    LEXI3700_WS_DT.MAX_NUM_PMRK_BUNDLE_TBL_ENTRIES := 0;
  13071.    LEXI3700_WS_DT.MAX_NUM_TEXT_BUNDLE_TBL_ENTRIES := 0;
  13072.    LEXI3700_WS_DT.MAX_NUM_FA_BUNDLE_TBL_ENTRIES   := 0;
  13073.    LEXI3700_WS_DT.MAX_NUM_PATTERN_INDICES         := 0;
  13074.      
  13075.    -- There are 128 colour indices that can be accessed on the device,
  13076.    -- but we have reserved the eight plane on the device (which is
  13077.    -- accessed by colour index 128) for polygon fills.  Therefore the
  13078.    -- application programmer can only use colour indices 0 through 127.
  13079.      
  13080.    LEXI3700_WS_DT.MAX_NUM_COLOUR_INDICES :=
  13081.          NATURAL(LEXI3700_CONFIGURATION.LEXI_MAXIMUM_COLOUR_INDEX);
  13082.      
  13083. end LEXI3700_WS_TABLES;
  13084. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13085. --:UDD:GKSADACM:CODE:MA:ADD_ST_LST_TO_LST_MA.ADA
  13086. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13087. -- file: ADD_ST_LST_TO_LST_MA.ADA
  13088. -- level: ma
  13089.      
  13090. with WSR_WS_TRANSFORMATION;
  13091. with GKS_ERRORS;
  13092.      
  13093. separate (LEXI3700_WS_TABLES)
  13094.      
  13095. procedure ADD_STATE_LIST_TO_LIST
  13096.    (WS_ID      : in GKS_TYPES.WS_ID;
  13097.     CONNECT_ID : in VARIABLE_CONNECTION_ID;
  13098.     WS_TYPE    : in GKS_TYPES.WS_TYPE;
  13099.     ATTRIBUTES : in OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  13100.     EI         : out ERROR_INDICATOR) is
  13101.      
  13102. -- This procedure will create a WS state list and initialize it.
  13103. -- At level ma there is only one open WS at a time so it does not
  13104. -- need to add it to a list.
  13105.      
  13106. -- The following parameters are used in this procedure:
  13107. -- WS_ID - The workstation identifier choosen by the application
  13108. --         programmer to identify a particular workstation.
  13109. -- CONNECT_ID - The connection identifier to access the specified
  13110. --              device.
  13111. -- WS_TYPE - The type of workstation being opened.
  13112. -- ATTRIBUTES - A copy of the output attributes from the GKS_STATE_LIST
  13113. --              as they appeared at the time of this call.
  13114. -- EI - An error indicator used for logging errors.
  13115.      
  13116. -- The following constant is used to create a list of predefined colours
  13117. -- by the GKS_LIST_UTILITIES package.
  13118.      
  13119. COLOUR_IDC_LIST : constant COLOUR_INDICES.LIST_VALUES :=
  13120.                            (0,1,2,3,4,5,6,7);
  13121. begin
  13122.   declare
  13123.     begin
  13124.      
  13125.       -- Get a new WS_STATE_LIST.
  13126.       LEXI_ST_LST := new WS_STATE_LIST_TYPES.WS_STATE_LST
  13127.              (NUM_COLOUR_REPRESENTATION => WS_STATE_LIST_TYPES
  13128.                                          .CLR_INDEX( LEXI3700_WS_DT
  13129.                                          .MAX_NUM_COLOUR_INDICES - 1));
  13130.      
  13131.       -- Initialize the LEXI_ST_LST.
  13132.      
  13133.       -- The following are parameters passed in to the procedure.
  13134.      
  13135.       LEXI_ST_LST.OUTPUT_ATTR       := ATTRIBUTES;
  13136.       LEXI_ST_LST.WORKSTATION_ID    := WS_ID;
  13137.       LEXI_ST_LST.CONNECT_ID        := CONNECT_ID;
  13138.       LEXI_ST_LST.WORKSTATION_TYPE  := WS_TYPE;
  13139.      
  13140.       -- The following are initialized from the LEXI3700_WS_DT.
  13141.      
  13142.       LEXI_ST_LST.WS_DEFERRAL_MODE :=
  13143.             LEXI3700_WS_DT.DEFER_MODE;
  13144.       LEXI_ST_LST.WS_IMPLICIT_REGEN_MODE :=
  13145.             LEXI3700_WS_DT.IMPLICIT_REGEN_MODE;
  13146.      
  13147.       -- The colour table.
  13148.      
  13149.       LEXI_ST_LST.SET_OF_COLOUR_IDC :=
  13150.             COLOUR_INDICES.LIST(COLOUR_IDC_LIST);
  13151.      
  13152.       LEXI_ST_LST.COLOUR_TABLE
  13153.            (LEXI3700_WS_DT.PREDEFINED_COLOUR_REP'first ..
  13154.             LEXI3700_WS_DT.PREDEFINED_COLOUR_REP'last) :=
  13155.             LEXI3700_WS_DT.PREDEFINED_COLOUR_REP;
  13156.      
  13157.       -- This code sets the effective attributes in the ws state list.
  13158.       -- It is put here for now, but a future implementation could
  13159.       -- remove the following code into a procedure and make it more
  13160.       -- general to handle all workstations.
  13161.      
  13162.          LEXI_ST_LST.EFFECTIVE_POLYLINE_ATTR.L_TYPE :=
  13163.                LEXI_ST_LST.OUTPUT_ATTR.CURRENT_LINETYPE;
  13164.      
  13165.          LEXI_ST_LST.EFFECTIVE_POLYLINE_ATTR.L_WIDTH :=
  13166.                LEXI_ST_LST.OUTPUT_ATTR
  13167.                .CURRENT_LINEWIDTH_SCALE_FACTOR;
  13168.      
  13169.          LEXI_ST_LST.EFFECTIVE_POLYLINE_ATTR.COLOUR :=
  13170.                LEXI_ST_LST.OUTPUT_ATTR
  13171.                .CURRENT_POLYLINE_COLOUR_INDEX;
  13172.      
  13173.          LEXI_ST_LST.EFFECTIVE_POLYMARKER_ATTR.M_TYPE :=
  13174.                LEXI_ST_LST.OUTPUT_ATTR.CURRENT_MARKER_TYPE;
  13175.      
  13176.          LEXI_ST_LST.EFFECTIVE_POLYMARKER_ATTR.M_SIZE :=
  13177.                LEXI_ST_LST.OUTPUT_ATTR
  13178.                .CURRENT_MARKER_SIZE_SCALE_FACTOR;
  13179.      
  13180.          LEXI_ST_LST.EFFECTIVE_POLYMARKER_ATTR.COLOUR :=
  13181.                LEXI_ST_LST.OUTPUT_ATTR
  13182.                .CURRENT_POLYMARKER_COLOUR_INDEX;
  13183.      
  13184.          LEXI_ST_LST.EFFECTIVE_TEXT_ATTR.TEXT_FONT :=
  13185.                LEXI_ST_LST.OUTPUT_ATTR
  13186.                .CURRENT_TEXT_FONT_AND_PRECISION;
  13187.      
  13188.          LEXI_ST_LST.EFFECTIVE_TEXT_ATTR.CH_EXPANSION :=
  13189.                LEXI_ST_LST.OUTPUT_ATTR
  13190.                .CURRENT_CHAR_EXPANSION_FACTOR;
  13191.      
  13192.          LEXI_ST_LST.EFFECTIVE_TEXT_ATTR.CH_SPACE :=
  13193.                LEXI_ST_LST.OUTPUT_ATTR.CURRENT_CHAR_SPACING;
  13194.      
  13195.          LEXI_ST_LST.EFFECTIVE_TEXT_ATTR.COLOUR :=
  13196.                LEXI_ST_LST.OUTPUT_ATTR
  13197.                .CURRENT_TEXT_COLOUR_INDEX;
  13198.      
  13199.          LEXI_ST_LST.EFFECTIVE_FILL_AREA_ATTR.INT_STYLE :=
  13200.                LEXI_ST_LST.OUTPUT_ATTR
  13201.                .CURRENT_FILL_AREA_INTERIOR_STYLE;
  13202.      
  13203.          LEXI_ST_LST.EFFECTIVE_FILL_AREA_ATTR.STYLE :=
  13204.                LEXI_ST_LST.OUTPUT_ATTR
  13205.                .CURRENT_FILL_AREA_STYLE_INDEX;
  13206.      
  13207.          LEXI_ST_LST.EFFECTIVE_FILL_AREA_ATTR.COLOUR :=
  13208.                LEXI_ST_LST.OUTPUT_ATTR
  13209.                .CURRENT_FILL_AREA_COLOUR_INDEX;
  13210.      
  13211.          -- Convert REQUESTED_WS_VIEWPORT in the WS_STATE_LIST_TYPES
  13212.          -- package from the default (0.0,0.0), (1.0,1.0) to the
  13213.          -- maximum square that fits in the display space.
  13214.      
  13215.          LEXI_ST_LST.REQUESTED_WS_VIEWPORT := (0.0,1023.0,0.0,1023.0);
  13216.      
  13217.          -- A call is made here to initialize the WS_TRANSFORMATION
  13218.          -- and set the CURRENT_WS_VIEWPORT.
  13219.          WSR_WS_TRANSFORMATION.SET_WS_VIEWPORT
  13220.                (IMM,
  13221.                 LEXI_ST_LST,
  13222.                 LEXI_ST_LST.REQUESTED_WS_VIEWPORT);
  13223.      
  13224.       -- If the procedure gets to this point without raising an
  13225.       -- exception, the workstation was opened successfully.
  13226.       EI := GKS_ERRORS.SUCCESSFUL;
  13227.      
  13228.    end;
  13229.      
  13230.    exception
  13231.       when OTHERS =>
  13232.          EI := GKS_ERRORS.WS_CANNOT_OPEN;
  13233.      
  13234. end ADD_STATE_LIST_TO_LIST;
  13235. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13236. --:UDD:GKSADACM:CODE:MA:DEL_ST_LST_FR_LST_MA.ADA
  13237. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13238. -- file: DELETE_ST_LST_FR_LST_MA.ADA
  13239. -- level: ma
  13240.      
  13241. with UNCHECKED_DEALLOCATION;
  13242.      
  13243. separate (LEXI3700_WS_TABLES)
  13244.      
  13245. procedure DELETE_STATE_LIST_FROM_LIST
  13246.    (WS_ID : in GKS_TYPES.WS_ID) is
  13247.      
  13248. -- Given a WS_ID, this procedure deallocates the specified state list.
  13249. --
  13250. -- This procedure uses the UNCHECKED_DEALLOCATION package to free the
  13251. -- memory the state list used before it use closed.
  13252. --
  13253. -- Since this is a level ma procedure and only one workstation can be
  13254. -- opened at a time,  this code is simplified to minimize memory space.
  13255. --
  13256. -- The following parameter is used in this procedure:
  13257. -- WS_ID - The workstation identifier of the whose state list is deleted
  13258.      
  13259. procedure FREE_WS_ST_LST is new UNCHECKED_DEALLOCATION
  13260.    (WS_STATE_LIST_TYPES.WS_STATE_LST,
  13261.     WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR);
  13262.      
  13263. begin
  13264.      
  13265.    FREE_WS_ST_LST(LEXI_ST_LST);
  13266.      
  13267. end DELETE_STATE_LIST_FROM_LIST;
  13268. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13269. --:UDD:GKSADACM:CODE:MA:GET_ST_LST_PTR_MA.ADA
  13270. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13271. -- file: GET_ST_LST_PTR_MA.ADA
  13272. -- level: ma
  13273.      
  13274. separate (LEXI3700_WS_TABLES)
  13275.      
  13276. function GET_STATE_LIST_PTR
  13277.    (WS_ID : in GKS_TYPES.WS_ID) return
  13278.          WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR is
  13279.      
  13280. -- This procedure given a WS_ID returns a pointer to the
  13281. -- state list specified.
  13282. --
  13283. -- Since this is a level ma procedure and only one workstation can be
  13284. -- opened at a time,  this code is simplified to minimize memory space.
  13285. --
  13286. -- The following parameter is used in this procedure:
  13287. -- WS_ID - The workstation identifier of the whose state list pointer
  13288. --         is returned
  13289.      
  13290. begin
  13291.      
  13292.    return LEXI_ST_LST;
  13293.      
  13294. end GET_STATE_LIST_PTR;
  13295. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13296. --:UDD:GKSADACM:CODE:MA:LEXI_WS_CONT_MA.ADA
  13297. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13298. ------------------------------------------------------------------
  13299. --
  13300. --  NAME: LEXI3700_CONTROL_OPERATIONS
  13301. --  IDENTIFIER: GDMXXX.1(1)
  13302. --  DISCREPANCY REPORTS:
  13303. --
  13304. ------------------------------------------------------------------
  13305. -- file: LEXI_WS_CONT_MA.ADA
  13306. -- level: ma,0a
  13307.      
  13308. with GKS_TYPES;
  13309. with OUTPUT_ATTRIBUTES_TYPE;
  13310. with WS_STATE_LIST_TYPES;
  13311. with CGI;
  13312.      
  13313. use GKS_TYPES;
  13314.      
  13315. package LEXI3700_CONTROL_OPERATIONS is
  13316.      
  13317. -- This package is a workstation driver package used to control the
  13318. -- device.  It has direct access to the device driver procedures for
  13319. -- communication to the device.
  13320.      
  13321.    procedure OPEN_WS
  13322.       (WS          : in WS_ID;
  13323.        CONNECTION  : in CGI.ACCESS_CONNECTION_ID_TYPE;
  13324.        TYPE_OF_WS  : in WS_TYPE;
  13325.        ATTRIBUTES  : in out OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  13326.        EI          : out ERROR_INDICATOR);
  13327.      
  13328.    procedure CLOSE_WS
  13329.       (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR);
  13330.      
  13331.    procedure CLEAR_WS
  13332.       (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  13333.        FLAG        : in CONTROL_FLAG);
  13334.      
  13335.    procedure UPDATE_WS
  13336.       (WS_ST_LST    : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  13337.        REGENERATION : in UPDATE_REGENERATION_FLAG);
  13338.      
  13339. end LEXI3700_CONTROL_OPERATIONS;
  13340. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13341. --:UDD:GKSADACM:CODE:MA:LEXI_WS_CONT_MA_B.ADA
  13342. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13343. ------------------------------------------------------------------
  13344. --
  13345. --  NAME: LEXI3700_CONTROL_OPERATIONS
  13346. --  IDENTIFIER: GDMXXX.1(1)
  13347. --  DISCREPANCY REPORTS:
  13348. --
  13349. ------------------------------------------------------------------
  13350. -- file: LEXI_WS_CONT_MA_B.ADA
  13351. -- level: ma,0a
  13352.      
  13353. with LEXI3700_OUTPUT_DRIVER;
  13354. with LEXI3700_TYPES;
  13355. with GKS_ERRORS;
  13356.      
  13357. use  LEXI3700_TYPES;
  13358.      
  13359. package body LEXI3700_CONTROL_OPERATIONS is
  13360.      
  13361. -- The following packages are used in this package for the given
  13362. -- reasons:
  13363. -- The LEXI3700_OUTPUT_DRIVER package contains all procedures that are
  13364. -- used in the device driver.
  13365. -- The LEXI3700_TYPES package contains all types used by the device
  13366. -- driver.
  13367. -- The GKS_ERRORS package contain all the error constants.
  13368.      
  13369.    procedure OPEN_WS
  13370.       (WS         : in WS_ID;
  13371.        CONNECTION : in CGI.ACCESS_CONNECTION_ID_TYPE;
  13372.        TYPE_OF_WS : in WS_TYPE;
  13373.        ATTRIBUTES : in out OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  13374.        EI         : out ERROR_INDICATOR)
  13375.    is separate;
  13376.      
  13377.    procedure CLOSE_WS
  13378.       (WS_ST_LST  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR)
  13379.    is separate;
  13380.      
  13381.    procedure CLEAR_WS
  13382.       (WS_ST_LST  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  13383.        FLAG       : in CONTROL_FLAG)
  13384.    is separate;
  13385.      
  13386.    procedure UPDATE_WS
  13387.       (WS_ST_LST  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  13388.        REGENERATION : in UPDATE_REGENERATION_FLAG)
  13389.    is separate;
  13390.      
  13391. end LEXI3700_CONTROL_OPERATIONS;
  13392. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13393. --:UDD:GKSADACM:CODE:MA:WSD_OPEN_WS.ADA
  13394. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13395. ------------------------------------------------------------------
  13396. --
  13397. --  NAME: OPEN_WS
  13398. --  IDENTIFIER: GDMXXX.1(1)
  13399. --  DISCREPANCY REPORTS:
  13400. --
  13401. ------------------------------------------------------------------
  13402. -- file: WSD_OPEN_WS.ADA
  13403. -- level: ma,0a,1a,2a
  13404.      
  13405. with LEXI3700_COLOUR_OPERATIONS;
  13406. with LEXI3700_WS_TABLES;
  13407.      
  13408. separate (LEXI3700_CONTROL_OPERATIONS)
  13409.      
  13410. procedure OPEN_WS
  13411.    (WS         : in WS_ID;
  13412.     CONNECTION : in CGI.ACCESS_CONNECTION_ID_TYPE;
  13413.     TYPE_OF_WS : in WS_TYPE;
  13414.     ATTRIBUTES : in out OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  13415.     EI         : out ERROR_INDICATOR) is
  13416.      
  13417. -- This procedure calls the device driver procedure to open the device
  13418. -- and establish communication to it.  If there is no error in opening
  13419. -- the device it creates and initializes a WS_STATE_LIST from its
  13420. -- WS_DESCRIPTION_TABLE.  It initializes the OUTPUT_ATTR record in the
  13421. -- WS_STATE_LIST from the parameter ATTRIBUTES.
  13422. --
  13423. -- The parameters used in this procedure are:
  13424. -- WS - The workstation id the application programmer assigned to
  13425. --      associate the workstation with.
  13426. -- CONNECTION - The physical location the device driver needs to
  13427. --              decide which device to open.
  13428. -- TYPE_OF_WS - The type of workstation that is being opened.
  13429. -- ATTRIBUTES - A copy of the output attributes stored in the GKS_STATE_
  13430. --              LIST.
  13431. -- EI - contains any error that may be returned while
  13432. --      attempting to open the device.
  13433.      
  13434. CHANNEL_IN  : constant := 48;
  13435. CHANNEL_OUT : constant := 49;
  13436. -- The preceding define the communication channels to the device.
  13437. -- The present implimentation has them hard coded in for efficiency.
  13438. -- A future implimentation that supports multiple workstations from
  13439. -- the same host will need parameterize needs values to communicate
  13440. -- with the appropriate device.
  13441.      
  13442. CONNECTION_ID : VARIABLE_CONNECTION_ID(CONNECTION'length);
  13443. -- Creates an object the length of the string access type passed in.
  13444.      
  13445. ERROR_CONDITION : INTEGER;
  13446. -- This is the LEXIDATA ERROR CODE that is returned from the device.
  13447.      
  13448. begin
  13449.      
  13450.    -- Call the device driver to open the workstation
  13451.    LEXI3700_OUTPUT_DRIVER.OPEN(CHANNEL_IN,
  13452.                                CHANNEL_OUT,
  13453.                                ERROR_CONDITION);
  13454.      
  13455.    -- Check the error number from the device.  If it is anything but
  13456.    -- zero the device could not be opened successfully.
  13457.      
  13458.    If ERROR_CONDITION /= 0 then
  13459.       EI := GKS_ERRORS.WS_CANNOT_OPEN;
  13460.    else
  13461.       -- The device was opened succesfully.
  13462.       EI := GKS_ERRORS.SUCCESSFUL;
  13463.      
  13464.       -- Clears the display.
  13465.       LEXI3700_OUTPUT_DRIVER.CLEAR_DISPLAY;
  13466.      
  13467.       -- Defines the display memory planes on the device.
  13468.       LEXI3700_OUTPUT_DRIVER.DEFINE_WRITE_CHANNELS;
  13469.      
  13470.       -- Moves the cursor off the screen.
  13471.       LEXI3700_OUTPUT_DRIVER.SET_HARDWARE_CURSOR;
  13472.      
  13473.       -- Call the LEXI3700_WS_TBLS package to initialize the WS_STATE_
  13474.       -- LIST and add its WS_ID to the LIST_OF_WS_STATE_LISTS.
  13475.       CONNECTION_ID.CONNECT := CONNECTION.all;
  13476.      
  13477.       LEXI3700_WS_TABLES.ADD_STATE_LIST_TO_LIST
  13478.             (WS,
  13479.              CONNECTION_ID,
  13480.              TYPE_OF_WS,
  13481.              ATTRIBUTES,
  13482.              EI);
  13483.      
  13484.       declare
  13485.          WS_SL : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  13486.          ERROR : ERROR_INDICATOR;
  13487.          -- A dummy error indicator that will always be successful.
  13488.          -- When this error indicator is returned it is expected that
  13489.          -- it will be successful.  The device has already been opened
  13490.          -- and the ws state list allocated, therefore no other error
  13491.          -- can happen.  Since the colours and indices SET_COLOUR_
  13492.          -- REPRESENTATION procedure receives are from its own
  13493.          -- description table it is assumed that they are valid,
  13494.          -- therefore this error indicator does not need to be checked.
  13495.      
  13496.       begin
  13497.          WS_SL := LEXI3700_WS_TABLES.GET_STATE_LIST_PTR(WS);
  13498.          -- Initialize the Look up table on the device.
  13499.          for I in LEXI3700_WS_TABLES.LEXI3700_WS_DT
  13500.                .PREDEFINED_COLOUR_REP'range loop
  13501.             LEXI3700_COLOUR_OPERATIONS.SET_COLOUR_REPRESENTATION
  13502.                   (WS_SL,
  13503.                    COLOUR_INDEX(I),
  13504.                    LEXI3700_WS_TABLES.LEXI3700_WS_DT
  13505.                          .PREDEFINED_COLOUR_REP (I),
  13506.                    ERROR);
  13507.          end loop;
  13508.       end;
  13509.    end if;
  13510.      
  13511. end OPEN_WS;
  13512. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13513. --:UDD:GKSADACM:CODE:MA:WSD_CLOSE_WS_MA.ADA
  13514. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13515. ------------------------------------------------------------------
  13516. --
  13517. --  NAME: CLOSE_WS
  13518. --  IDENTIFIER: GDMXXX.1(1)
  13519. --  DISCREPANCY REPORTS:
  13520. --
  13521. ------------------------------------------------------------------
  13522. -- file: WSD_CLOSE_WS_MA.ADA
  13523. -- level: ma,0a
  13524.      
  13525. with LEXI3700_WS_TABLES;
  13526.      
  13527. separate (LEXI3700_CONTROL_OPERATIONS)
  13528.      
  13529. procedure CLOSE_WS
  13530.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR) is
  13531.      
  13532. -- This procedure calls a procedure in the device driver to
  13533. -- flush the device buffer.  It then calls the DELETE_WS_STATE_LIST_FROM
  13534. -- _LIST procedure in the LEXI3700_WS_TABLES package to deallocate the
  13535. -- WS_STATE_LIST.
  13536. --
  13537. -- note: The interface from the host to the target device that we
  13538. --       presently have does not allow us to close the device and
  13539. --       reopen it from the same process.  This is not acceptable
  13540. --       in GKS so we have decided not to close the device in this
  13541. --       procedure call for the LEXIDATA 3700 workstation.
  13542.      
  13543. begin
  13544.      
  13545.    LEXI3700_OUTPUT_DRIVER.FLUSH;
  13546.      
  13547.    -- Delete the WS_STATE_LIST from the list.
  13548.    LEXI3700_WS_TABLES.DELETE_STATE_LIST_FROM_LIST( WS_ST_LST
  13549.          .WORKSTATION_ID);
  13550.      
  13551. end CLOSE_WS;
  13552. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13553. --:UDD:GKSADACM:CODE:MA:WSD_CLEAR_WS_MA.ADA
  13554. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13555. ------------------------------------------------------------------
  13556. --
  13557. --  NAME: CLEAR_WS
  13558. --  IDENTIFIER: GDMXXX.1(2)
  13559. --  DISCREPANCY REPORTS:
  13560. --  DR021  Need to flush clear WS out of buffer.
  13561. ------------------------------------------------------------------
  13562. -- file: WSD_CLEAR_WS_MA.ADA
  13563. -- level: ma,0a
  13564.      
  13565. with WSR_WS_TRANSFORMATION;
  13566.      
  13567. separate (LEXI3700_CONTROL_OPERATIONS)
  13568.      
  13569. procedure CLEAR_WS
  13570.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  13571.     FLAG      : in CONTROL_FLAG) is
  13572.      
  13573. -- This procedure calls the FLUSH procedure that empties the device
  13574. -- buffer.  It then updates the WS_ST_LST and calls the device driver
  13575. -- procedure CLEAR_DISPLAY to clear the display.
  13576. --
  13577. -- The following parameters are used in this procedure:
  13578. -- WS_ST_LST - The workstation state list for the specified device.
  13579. -- FLAG - A flag used to control if the display surface should be
  13580. --        cleared needlessly.
  13581.      
  13582. begin
  13583.      
  13584.    -- Execute all deferred actions.
  13585.    LEXI3700_OUTPUT_DRIVER.FLUSH;
  13586.      
  13587.    -- Check the FLAG if it's ALWAYS or if the WS_DISPLAY_SURFACE is
  13588.    -- NOTEMPTY then clear the device.
  13589.    if FLAG = ALWAYS or else WS_ST_LST.WS_DISPLAY_SURFACE = NOTEMPTY then
  13590.       -- Clear the display.
  13591.       LEXI3700_OUTPUT_DRIVER.CLEAR_DISPLAY;
  13592.       -- Flush the buffer to get the CLEAR_DISPLAY out
  13593.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  13594.    end if;
  13595.      
  13596.    -- If the WS_XFORM_UPDATE_STATE entry in the WS_OUTPUT_STATE_
  13597.    -- LIST is PENDING, the CURRENT_WS_WINDOW and CURRENT_WS_
  13598.    -- VIEWPORT entries in the WS_OUTPUT_STATE LIST are assigned
  13599.    -- the values of the REQUESTED_WS_WINDOW and REQUESTED_WS_
  13600.    -- VIEWPORT entries; the WS_XFORM_UPDATE_STATE entry is set
  13601.    -- to NOTPENDING.  The package WSR_WS_TRANSFORMATION also
  13602.    -- computes the EFFECTIVE_CLIPPING_RECTANGLE.
  13603.      
  13604.    if WS_ST_LST.WS_XFORM_UPDATE_STATE = PENDING then
  13605.       WSR_WS_TRANSFORMATION.UPDATE_WS_TRANSFORMATION( WS_ST_LST );
  13606.    end if;
  13607.      
  13608.    -- The WS_NEW_FRAME_ACTION entry in the WS_OUTPUT_STATE_LIST
  13609.    -- is set to NO.
  13610.    WS_ST_LST.WS_NEW_FRAME_ACTION := NO;
  13611.      
  13612.    -- The WS_DISPLAY_SURFACE entry in the WS_OUTPUT_STATE_LIST
  13613.    -- is set to EMPTY.
  13614.    WS_ST_LST.WS_DISPLAY_SURFACE := EMPTY;
  13615.      
  13616. end CLEAR_WS;
  13617. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13618. --:UDD:GKSADACM:CODE:MA:WSD_UP_WS_MA.ADA
  13619. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13620. ------------------------------------------------------------------
  13621. --
  13622. --  NAME: UPDATE_WS
  13623. --  IDENTIFIER: GDMXXX.1(1)
  13624. --  DISCREPANCY REPORTS:
  13625. --
  13626. ------------------------------------------------------------------
  13627. -- file: WSD_UP_WS_MA.ADA
  13628. -- level: ma,0a
  13629.      
  13630. with WSR_WS_TRANSFORMATION;
  13631.      
  13632. separate (LEXI3700_CONTROL_OPERATIONS)
  13633.      
  13634. procedure UPDATE_WS
  13635.    (WS_ST_LST    : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  13636.     REGENERATION : in UPDATE_REGENERATION_FLAG) is
  13637.      
  13638. -- This procedure updates the workstation.  Since this is a level ma
  13639. -- and 0a procedure there is no implicit regeneration of all visible
  13640. -- segments stored on this workstation done in this procedure.
  13641. --
  13642. -- The following parameters are used in this procedure:
  13643. -- WS_ST_LST - The workstation state list for the specified device.
  13644. -- REGENERATION - A flag used to determine if an implicit regeneration
  13645. --                should be done with this UPDATE_WS call.
  13646.      
  13647. begin
  13648.      
  13649.    -- Call the device driver to flush all deferred actions.
  13650.    LEXI3700_OUTPUT_DRIVER.FLUSH;
  13651.      
  13652.    -- IF the REGENERATION flag is set to PERFORM and the
  13653.    -- WS_NEW_FRAME_ACTION entry in the WS_STATE_LIST is
  13654.    -- YES, then the following actions will be performed:
  13655.      
  13656.    if REGENERATION = PERFORM and WS_ST_LST
  13657.          .WS_NEW_FRAME_ACTION = YES then
  13658.      
  13659.       -- The display surface is cleared only if the WS_DISPLAY_
  13660.       -- SURFACE entry in the WS_STATE_LIST is NOTEMPTY.
  13661.       -- The entry is set to EMPTY.
  13662.      
  13663.       if WS_ST_LST.WS_DISPLAY_SURFACE = NOTEMPTY  then
  13664.      
  13665.          LEXI3700_OUTPUT_DRIVER.CLEAR_DISPLAY;
  13666.          WS_ST_LST.WS_DISPLAY_SURFACE := EMPTY;
  13667.      
  13668.       end if;
  13669.      
  13670.       -- If the WS_XFORM_UPDATE_STATE entry in the WS_STATE_LIST is
  13671.       -- PENDING, the CURRENT_WS_WINDOW and CURRENT_WS_VIEWPORT
  13672.       -- entries in the WS_OUTPUT_STATE LIST are assigned the values
  13673.       -- of the REQUESTED_WS_WINDOW and REQUESTED_WS_VIEWPORT entries;
  13674.       -- the WS_XFORM_UPDATE_STATE entry is set to NOTPENDING.
  13675.      
  13676.       if WS_ST_LST.WS_XFORM_UPDATE_STATE = PENDING then
  13677.          -- The following procedure updates the transformation state
  13678.          -- and compute the new EFFECTIVE_CLIPPING_RECTANGLE in the
  13679.          -- workstation state list.
  13680.          WSR_WS_TRANSFORMATION.UPDATE_WS_TRANSFORMATION( WS_ST_LST );
  13681.       end if;
  13682.      
  13683.       -- The WS_NEW_FRAME_ACTION entry in the WS_STATE_LIST
  13684.       -- is set to NO.
  13685.       WS_ST_LST.WS_NEW_FRAME_ACTION := NO;
  13686.      
  13687.    end if;
  13688.      
  13689. end UPDATE_WS;
  13690. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13691. --:UDD:GKSADACM:CODE:MA:LEXI_INQ_TEXT.ADA
  13692. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13693. ------------------------------------------------------------------
  13694. --
  13695. --  NAME: LEXI3700_INQ_TEXT
  13696. --  IDENTIFIER: GDMXXX.2(1)
  13697. --  DISCREPANCY REPORTS:
  13698. --  Not listed
  13699. ------------------------------------------------------------------
  13700. -- FILE: LEXI_INQ_TEXT.ADA
  13701. -- LEVEL: MA
  13702.      
  13703. with GKS_TYPES;
  13704. with CGI;
  13705. with WS_STATE_LIST_TYPES;
  13706.      
  13707. use  CGI;
  13708. use  GKS_TYPES;
  13709.      
  13710. package LEXI3700_INQ_TEXT is
  13711.      
  13712. -- This package contains a procedure that inquires the Text Extent of
  13713. -- a text string.
  13714.      
  13715.    procedure INQ_TEXT_EXTENT
  13716.       (WS_SL                   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  13717.        POSITION_TEXT           : NDC.POINT;
  13718.        CHAR_STRING             : ACCESS_STRING_TYPE;
  13719.        CONCATENATION_POINT     : out NDC.POINT;
  13720.        TEXT_EXTENT_LOWER_LEFT  : out NDC.POINT;
  13721.        TEXT_EXTENT_LOWER_RIGHT : out NDC.POINT;
  13722.        TEXT_EXTENT_UPPER_LEFT  : out NDC.POINT;
  13723.        TEXT_EXTENT_UPPER_RIGHT : out NDC.POINT);
  13724.      
  13725. end LEXI3700_INQ_TEXT;
  13726. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13727. --:UDD:GKSADACM:CODE:MA:LEXI_INQ_TEXT_B.ADA
  13728. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13729. ------------------------------------------------------------------
  13730. --
  13731. --  NAME: LEXI3700_INQ_TEXT - BODY
  13732. --  IDENTIFIER: GDMXXX.2(1)
  13733. --  DISCREPANCY REPORTS:
  13734. --  Not listed
  13735. ------------------------------------------------------------------
  13736. -- FILE: LEXI_INQ_TEXT_B.ADA
  13737. -- LEVEL: MA
  13738.      
  13739. with LEXI3700_CONFIGURATION;
  13740. with WSR_UTILITIES;
  13741. with CONVERT_NDC_DC;
  13742.      
  13743. package body LEXI3700_INQ_TEXT is
  13744.      
  13745.    procedure INQ_TEXT_EXTENT
  13746.       (WS_SL                   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  13747.        POSITION_TEXT           : NDC.POINT;
  13748.        CHAR_STRING             : ACCESS_STRING_TYPE;
  13749.        CONCATENATION_POINT     : out NDC.POINT;
  13750.        TEXT_EXTENT_LOWER_LEFT  : out NDC.POINT;
  13751.        TEXT_EXTENT_LOWER_RIGHT : out NDC.POINT;
  13752.        TEXT_EXTENT_UPPER_LEFT  : out NDC.POINT;
  13753.        TEXT_EXTENT_UPPER_RIGHT : out NDC.POINT) is separate;
  13754.      
  13755. end LEXI3700_INQ_TEXT;
  13756. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13757. --:UDD:GKSADACM:CODE:MA:WSD_INQ_TEXT_EXT.ADA
  13758. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13759. ------------------------------------------------------------------
  13760. --
  13761. --  NAME: INQ_TEXT_EXTENT
  13762. --  IDENTIFIER: GDMXXX.3(3)
  13763. --  DISCREPANCY REPORTS:
  13764. --  DR041  Miscellaneous updates.
  13765. ------------------------------------------------------------------
  13766. -- FILE  : WSD_INQ_TEXT_EXT.ADA
  13767. -- LEVEL : MA
  13768.      
  13769. with DC_POINT_OPS;
  13770. separate (LEXI3700_INQ_TEXT)
  13771.      
  13772.    procedure INQ_TEXT_EXTENT
  13773.       (WS_SL                   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  13774.        POSITION_TEXT           : NDC.POINT;
  13775.        CHAR_STRING             : ACCESS_STRING_TYPE;
  13776.        CONCATENATION_POINT     : out NDC.POINT;
  13777.        TEXT_EXTENT_LOWER_LEFT  : out NDC.POINT;
  13778.        TEXT_EXTENT_LOWER_RIGHT : out NDC.POINT;
  13779.        TEXT_EXTENT_UPPER_LEFT  : out NDC.POINT;
  13780.        TEXT_EXTENT_UPPER_RIGHT : out NDC.POINT) is
  13781.      
  13782. -- This procedure defines the Text Extent Rectangle for the input Text
  13783. -- string.  This procedure also returns the Concatenation Point, which
  13784. -- is used to position addition text as required.
  13785.      
  13786. -- Parameter definition section.
  13787.      
  13788. --  WS_SL            - A pointer to the work station state list.
  13789. --  POSITION_TEXT    - The requested starting position of the text.
  13790. --  CHAR_STRING      - The character string used in the calculations.
  13791. --  CONCATENATION_PT - The point used to append additional text.
  13792. --  TEXT_EXTENT_INQ  - The Text Extent Rectangle.
  13793.      
  13794. -- Variable section.
  13795.      
  13796. CAP_TOP              : DC_TYPE :=
  13797.       LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP;
  13798. -- CAP_TOP           - The fraction of character height to Topline.
  13799.      
  13800. BASE_BOTTOM          : DC_TYPE :=
  13801.       LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_BASE_BOTTOM;
  13802. -- BASE_BOTTOM       - The fraction of character width to Bottomline.
  13803.      
  13804. CHARACTER_FONT       : DC_TYPE :=
  13805.       LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT;
  13806. -- CHARACTER_FONT    - Describes the Width/Height ratio of the font.
  13807.      
  13808. CAT_POINT            : DC.POINT;
  13809. -- CAT_POINT         - The DC.POINT version of the Concatenation Point.
  13810.      
  13811. OFFSET               : DC.POINT;
  13812. -- OFFSET            - The X-Y displacements for text positioning.
  13813.      
  13814. START_POSITION       : DC.POINT;
  13815. -- START_POSITION    - The returned actual starting text position.
  13816.      
  13817. DC_POINT             : DC.POINT;
  13818. -- DC_POINT          - The input text position point.
  13819.      
  13820. TEI_LOWER_LEFT       : DC.POINT;
  13821. -- Contains the parallelogram containing the text string.
  13822.      
  13823. TEI_LOWER_RIGHT      : DC.POINT;
  13824. -- Contains the parallelogram containing the text string.
  13825.      
  13826. TEI_UPPER_LEFT       : DC.POINT;
  13827. -- Contains the parallelogram containing the text string.
  13828.      
  13829. TEI_UPPER_RIGHT      : DC.POINT;
  13830. -- Contains the parallelogram containing the text string.
  13831.      
  13832. HCOS                 : DC_TYPE;
  13833. -- The Cosine of the Height Vector.
  13834.      
  13835. HSIN                 : DC_TYPE;
  13836. -- The Sine of the Height Vector.
  13837.      
  13838. DC_CHAR_HEIGHT_VECTOR : DC.VECTOR;
  13839. -- Contains the vector in dc.
  13840.      
  13841. CHAR_HEIGHT : DC_TYPE;
  13842. -- Contains the sqrt of the height vector;
  13843.      
  13844. begin
  13845.    DC_POINT := CONVERT_NDC_DC.DC_POINT
  13846.       (POSITION_TEXT, WS_SL.WS_TRANSFORM);
  13847.      
  13848. -- Call the procedure TEXT_HANDLING to calculate the Offsets and Start
  13849. -- Position needed to calculate the Concatenation Point.  TEXT_HANDLING
  13850. -- calculates the Text Extent Rectangle, which is also returned.
  13851.      
  13852.    WSR_UTILITIES.TEXT_HANDLING
  13853.        (CAP_TOP,
  13854.         BASE_BOTTOM,
  13855.         WS_SL.OUTPUT_ATTR.CURRENT_TEXT_PATH,
  13856.         WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT,
  13857.         CONVERT_NDC_DC.DC_VECTOR
  13858.              (WS_SL.OUTPUT_ATTR.CURRENT_CHAR_HEIGHT_VECTOR,
  13859.               WS_SL.WS_TRANSFORM),
  13860.         CONVERT_NDC_DC.DC_VECTOR
  13861.              (WS_SL.OUTPUT_ATTR.CURRENT_CHAR_WIDTH_VECTOR,
  13862.               WS_SL.WS_TRANSFORM),
  13863.         WS_SL.OUTPUT_ATTR.CURRENT_CHAR_EXPANSION_FACTOR,
  13864.         WS_SL.OUTPUT_ATTR.CURRENT_CHAR_SPACING,
  13865.         DC_POINT,
  13866.         CHAR_STRING'LENGTH,
  13867.         CHARACTER_FONT,
  13868.         START_POSITION,
  13869.         OFFSET,
  13870.         TEI_LOWER_LEFT,
  13871.         TEI_LOWER_RIGHT,
  13872.         TEI_UPPER_LEFT,
  13873.         TEI_UPPER_RIGHT);
  13874.      
  13875. -- Determine the Concatenation Point.
  13876.      
  13877.    DC_CHAR_HEIGHT_VECTOR := CONVERT_NDC_DC.DC_VECTOR
  13878.       (WS_SL.OUTPUT_ATTR.CURRENT_CHAR_HEIGHT_VECTOR,
  13879.        WS_SL.WS_TRANSFORM);
  13880.      
  13881.    CHAR_HEIGHT := DC_POINT_OPS.NORM(DC_CHAR_HEIGHT_VECTOR);
  13882.      
  13883.    HCOS := DC_CHAR_HEIGHT_VECTOR.X / CHAR_HEIGHT;
  13884.    HSIN := DC_CHAR_HEIGHT_VECTOR.Y / CHAR_HEIGHT;
  13885.      
  13886.    case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_PATH is
  13887.       when UP =>
  13888.          case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  13889.             when TOP =>
  13890.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  13891.                   when CENTRE | NORMAL =>
  13892.                                  CAT_POINT.X := (TEI_LOWER_LEFT.X +
  13893.                                     TEI_LOWER_RIGHT.X) / 2.0;
  13894.                                  CAT_POINT.Y := (TEI_LOWER_LEFT.Y +
  13895.                                     TEI_LOWER_RIGHT.Y) / 2.0;
  13896.      
  13897.                   when LEFT =>   CAT_POINT.X := TEI_LOWER_LEFT.X;
  13898.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y;
  13899.      
  13900.                   when RIGHT =>  CAT_POINT.X := TEI_LOWER_RIGHT.X;
  13901.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y;
  13902.                end case;
  13903.      
  13904.             when CAP =>
  13905.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  13906.                   when CENTRE | NORMAL =>
  13907.                                  CAT_POINT.X := ((TEI_LOWER_LEFT.X +
  13908.                                     TEI_LOWER_RIGHT.X) / 2.0) +
  13909.                                     (BASE_BOTTOM * HCOS);
  13910.                                  CAT_POINT.Y := ((TEI_LOWER_LEFT.Y +
  13911.                                     TEI_LOWER_RIGHT.Y) / 2.0) +
  13912.                                     (BASE_BOTTOM * HSIN);
  13913.      
  13914.                   when LEFT =>   CAT_POINT.X := TEI_LOWER_LEFT.X +
  13915.                                     (BASE_BOTTOM * HCOS);
  13916.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y +
  13917.                                     (BASE_BOTTOM * HSIN);
  13918.      
  13919.                   when RIGHT =>  CAT_POINT.X := TEI_LOWER_RIGHT.X +
  13920.                                     (BASE_BOTTOM * HCOS);
  13921.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y +
  13922.                                     (BASE_BOTTOM * HSIN);
  13923.                end case;
  13924.      
  13925.             when HALF =>          CAT_POINT.X := START_POSITION.X;
  13926.                                   CAT_POINT.Y := START_POSITION.Y;
  13927.      
  13928.             when BASE | NORMAL =>
  13929.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  13930.                   when CENTRE | NORMAL =>
  13931.                                  CAT_POINT.X := ((TEI_UPPER_LEFT.X +
  13932.                                     TEI_UPPER_RIGHT.X) / 2.0) -
  13933.                                     (CAP_TOP * HCOS);
  13934.                                  CAT_POINT.Y := ((TEI_UPPER_LEFT.Y +
  13935.                                     TEI_UPPER_RIGHT.Y) / 2.0) -
  13936.                                     (CAP_TOP * HSIN);
  13937.      
  13938.                   when LEFT =>   CAT_POINT.X := TEI_UPPER_LEFT.X -
  13939.                                     (CAP_TOP * HCOS);
  13940.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y -
  13941.                                     (CAP_TOP * HSIN);
  13942.      
  13943.                   when RIGHT =>  CAT_POINT.X := TEI_UPPER_RIGHT.X -
  13944.                                     (CAP_TOP * HCOS);
  13945.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y -
  13946.                                     (CAP_TOP * HSIN);
  13947.                end case;
  13948.      
  13949.             when BOTTOM =>
  13950.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  13951.                   when CENTRE | NORMAL =>
  13952.                                  CAT_POINT.X := (TEI_UPPER_LEFT.X +
  13953.                                     TEI_UPPER_RIGHT.X) / 2.0;
  13954.                                  CAT_POINT.Y := (TEI_UPPER_LEFT.Y +
  13955.                                     TEI_UPPER_RIGHT.Y) / 2.0;
  13956.      
  13957.                   when LEFT =>   CAT_POINT.X := TEI_UPPER_LEFT.X;
  13958.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y;
  13959.      
  13960.                   when RIGHT =>  CAT_POINT.X := TEI_UPPER_RIGHT.X;
  13961.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y;
  13962.                end case;
  13963.          end case;
  13964.      
  13965.      
  13966.       when DOWN =>
  13967.          case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  13968.             when TOP | NORMAL =>
  13969.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  13970.                   when CENTRE | NORMAL =>
  13971.                                  CAT_POINT.X := (TEI_LOWER_LEFT.X +
  13972.                                     TEI_LOWER_RIGHT.X) / 2.0;
  13973.                                  CAT_POINT.Y := (TEI_LOWER_LEFT.Y +
  13974.                                     TEI_LOWER_RIGHT.Y) / 2.0;
  13975.      
  13976.                   when LEFT =>   CAT_POINT.X := TEI_LOWER_LEFT.X;
  13977.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y;
  13978.      
  13979.                   when RIGHT =>  CAT_POINT.X := TEI_LOWER_RIGHT.X;
  13980.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y;
  13981.                end case;
  13982.      
  13983.             when CAP =>
  13984.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  13985.                   when CENTRE | NORMAL =>
  13986.                                  CAT_POINT.X := ((TEI_LOWER_LEFT.X +
  13987.                                     TEI_LOWER_RIGHT.X) / 2.0) +
  13988.                                     (BASE_BOTTOM * HCOS);
  13989.                                  CAT_POINT.Y := ((TEI_LOWER_LEFT.Y +
  13990.                                     TEI_LOWER_RIGHT.Y) / 2.0) +
  13991.                                     (BASE_BOTTOM * HSIN);
  13992.      
  13993.                   when LEFT =>   CAT_POINT.X := TEI_LOWER_LEFT.X +
  13994.                                     (BASE_BOTTOM * HCOS);
  13995.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y +
  13996.                                     (BASE_BOTTOM * HSIN);
  13997.      
  13998.                   when RIGHT =>  CAT_POINT.X := TEI_LOWER_RIGHT.X +
  13999.                                     (BASE_BOTTOM * HCOS);
  14000.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y +
  14001.                                     (BASE_BOTTOM * HSIN);
  14002.                end case;
  14003.      
  14004.             when HALF =>          CAT_POINT.X := START_POSITION.X;
  14005.                                   CAT_POINT.Y := START_POSITION.Y;
  14006.      
  14007.             when BASE =>
  14008.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  14009.                   when CENTRE | NORMAL =>
  14010.                                  CAT_POINT.X := ((TEI_UPPER_LEFT.X +
  14011.                                     TEI_UPPER_RIGHT.X) / 2.0) -
  14012.                                     (CAP_TOP * HCOS);
  14013.                                  CAT_POINT.Y := ((TEI_UPPER_LEFT.Y +
  14014.                                     TEI_UPPER_RIGHT.Y) / 2.0) -
  14015.                                     (CAP_TOP * HSIN);
  14016.      
  14017.                   when LEFT =>   CAT_POINT.X := TEI_UPPER_LEFT.X -
  14018.                                     (CAP_TOP * HCOS);
  14019.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y -
  14020.                                     (CAP_TOP * HSIN);
  14021.      
  14022.                   when RIGHT =>  CAT_POINT.X := TEI_UPPER_RIGHT.X -
  14023.                                     (CAP_TOP * HCOS);
  14024.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y -
  14025.                                     (CAP_TOP * HSIN);
  14026.                end case;
  14027.      
  14028.             when BOTTOM =>
  14029.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  14030.                   when CENTRE | NORMAL =>
  14031.                                  CAT_POINT.X := (TEI_UPPER_LEFT.X +
  14032.                                     TEI_UPPER_RIGHT.X) / 2.0;
  14033.                                  CAT_POINT.Y := (TEI_UPPER_LEFT.Y +
  14034.                                     TEI_UPPER_RIGHT.Y) / 2.0;
  14035.      
  14036.                   when LEFT =>   CAT_POINT.X := TEI_UPPER_LEFT.X;
  14037.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y;
  14038.      
  14039.                   when RIGHT =>  CAT_POINT.X := TEI_UPPER_RIGHT.X;
  14040.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y;
  14041.                end case;
  14042.      
  14043.          end case;
  14044.      
  14045.      
  14046.    when LEFT =>
  14047.          case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  14048.             when LEFT =>
  14049.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  14050.                   when TOP =>  CAT_POINT.X := TEI_UPPER_RIGHT.X;
  14051.                                CAT_POINT.Y := TEI_UPPER_RIGHT.Y;
  14052.      
  14053.                   when CAP =>  CAT_POINT.X := TEI_UPPER_RIGHT.X -
  14054.                                   (CAP_TOP * HCOS);
  14055.                                CAT_POINT.Y := TEI_UPPER_RIGHT.Y -
  14056.                                   (CAP_TOP * HSIN);
  14057.      
  14058.                   when HALF => CAT_POINT.X := (TEI_LOWER_RIGHT.X +
  14059.                                   TEI_UPPER_RIGHT.X) / 2.0;
  14060.                                CAT_POINT.Y := (TEI_LOWER_RIGHT.Y +
  14061.                                   TEI_UPPER_RIGHT.Y) / 2.0;
  14062.      
  14063.                   when BASE | NORMAL =>
  14064.                                   CAT_POINT.X := TEI_LOWER_RIGHT.X +
  14065.                                      (BASE_BOTTOM * HCOS);
  14066.                                   CAT_POINT.Y := TEI_LOWER_RIGHT.Y +
  14067.                                      (BASE_BOTTOM * HSIN);
  14068.      
  14069.                   when BOTTOM =>  CAT_POINT.X := TEI_LOWER_RIGHT.X;
  14070.                                   CAT_POINT.Y := TEI_LOWER_RIGHT.Y;
  14071.                end case;
  14072.      
  14073.             when CENTRE =>        CAT_POINT.X := START_POSITION.X;
  14074.                                   CAT_POINT.Y := START_POSITION.Y;
  14075.      
  14076.             when RIGHT | NORMAL =>
  14077.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  14078.                   when TOP =>    CAT_POINT.X := TEI_UPPER_LEFT.X;
  14079.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y;
  14080.      
  14081.                   when CAP =>    CAT_POINT.X := TEI_UPPER_LEFT.X -
  14082.                                     (CAP_TOP * HCOS);
  14083.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y -
  14084.                                     (CAP_TOP * HSIN);
  14085.      
  14086.                   when HALF =>   CAT_POINT.X := (TEI_LOWER_LEFT.X +
  14087.                                     TEI_UPPER_LEFT.X) / 2.0;
  14088.                                  CAT_POINT.Y := (TEI_LOWER_LEFT.Y +
  14089.                                     TEI_UPPER_LEFT.Y) / 2.0;
  14090.      
  14091.                   when BASE | NORMAL =>
  14092.                                  CAT_POINT.X := TEI_LOWER_LEFT.X +
  14093.                                     (BASE_BOTTOM * HCOS);
  14094.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y +
  14095.                                     (BASE_BOTTOM * HSIN);
  14096.      
  14097.                   when BOTTOM => CAT_POINT.X := TEI_LOWER_LEFT.X;
  14098.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y;
  14099.                end case;
  14100.          end case;
  14101.      
  14102.      
  14103.       when RIGHT =>
  14104.          case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  14105.             when LEFT | NORMAL =>
  14106.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  14107.                   when TOP =>    CAT_POINT.X := TEI_UPPER_RIGHT.X;
  14108.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y;
  14109.      
  14110.                   when CAP =>    CAT_POINT.X := TEI_UPPER_RIGHT.X -
  14111.                                     (CAP_TOP * HCOS);
  14112.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y -
  14113.                                     (CAP_TOP * HSIN);
  14114.      
  14115.                   when HALF =>   CAT_POINT.X := (TEI_LOWER_RIGHT.X +
  14116.                                     TEI_UPPER_RIGHT.X) / 2.0;
  14117.                                  CAT_POINT.Y := (TEI_LOWER_RIGHT.Y +
  14118.                                     TEI_UPPER_RIGHT.Y) / 2.0;
  14119.      
  14120.                   when BASE | NORMAL =>
  14121.                                  CAT_POINT.X := TEI_LOWER_RIGHT.X +
  14122.                                     (BASE_BOTTOM * HCOS);
  14123.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y +
  14124.                                     (BASE_BOTTOM * HSIN);
  14125.      
  14126.                   when BOTTOM => CAT_POINT.X := TEI_LOWER_RIGHT.X;
  14127.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y;
  14128.                end case;
  14129.      
  14130.             when CENTRE =>        CAT_POINT.X := START_POSITION.X;
  14131.                                   CAT_POINT.Y := START_POSITION.Y;
  14132.      
  14133.             when RIGHT =>
  14134.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  14135.                   when TOP =>    CAT_POINT.X := TEI_UPPER_LEFT.X;
  14136.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y;
  14137.      
  14138.                   when CAP =>    CAT_POINT.X := TEI_UPPER_LEFT.X -
  14139.                                     (CAP_TOP * HCOS);
  14140.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y -
  14141.                                     (CAP_TOP * HSIN);
  14142.      
  14143.                   when HALF =>   CAT_POINT.X := (TEI_LOWER_LEFT.X +
  14144.                                     TEI_UPPER_LEFT.X) / 2.0;
  14145.                                  CAT_POINT.Y := (TEI_LOWER_LEFT.Y +
  14146.                                     TEI_UPPER_LEFT.Y) / 2.0;
  14147.      
  14148.                   when BASE | NORMAL =>
  14149.                                  CAT_POINT.X := TEI_LOWER_LEFT.X +
  14150.                                     (BASE_BOTTOM * HCOS);
  14151.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y +
  14152.                                     (BASE_BOTTOM * HSIN);
  14153.      
  14154.                   when BOTTOM => CAT_POINT.X := TEI_LOWER_LEFT.X;
  14155.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y;
  14156.                end case;
  14157.          end case;
  14158.    end case;
  14159.      
  14160.    CONCATENATION_POINT := CONVERT_NDC_DC.NDC_POINT
  14161.       (CAT_POINT, WS_SL.WS_TRANSFORM);
  14162.      
  14163.    TEXT_EXTENT_LOWER_LEFT  := CONVERT_NDC_DC.NDC_POINT
  14164.       (TEI_LOWER_LEFT, WS_SL.WS_TRANSFORM);
  14165.    TEXT_EXTENT_LOWER_RIGHT := CONVERT_NDC_DC.NDC_POINT
  14166.       (TEI_LOWER_RIGHT, WS_SL.WS_TRANSFORM);
  14167.    TEXT_EXTENT_UPPER_LEFT  := CONVERT_NDC_DC.NDC_POINT
  14168.       (TEI_UPPER_LEFT, WS_SL.WS_TRANSFORM);
  14169.    TEXT_EXTENT_UPPER_RIGHT := CONVERT_NDC_DC.NDC_POINT
  14170.       (TEI_UPPER_RIGHT, WS_SL.WS_TRANSFORM);
  14171.      
  14172. end INQ_TEXT_EXTENT;
  14173. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14174. --:UDD:GKSADACM:CODE:MA:LEXI3700_WSD_MA_B.ADA
  14175. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14176. ------------------------------------------------------------------
  14177. --
  14178. --  NAME: LEXI3700_WSD - BODY
  14179. --  IDENTIFIER: GDMXXX.1(1)
  14180. --  DISCREPANCY REPORTS:
  14181. --
  14182. ------------------------------------------------------------------
  14183. -- file: LEXI3700_WSD_MA_B.ADA
  14184. -- level: ma
  14185.      
  14186. with WS_STATE_LIST_TYPES;
  14187. with LEXI3700_WS_TABLES;
  14188.      
  14189. -- Workstation Driver operations for level ma
  14190. with LEXI3700_CONTROL_OPERATIONS;
  14191. with LEXI3700_OUTPUT_PRIMITIVES;
  14192. with LEXI3700_COLOUR_OPERATIONS;
  14193. with LEXI3700_INQ_TEXT;
  14194.      
  14195. -- Resource operations for level ma
  14196. with WSR_SET_PRIMITIVE_ATTRIBUTES_MA;
  14197. with WSR_SET_INDIVIDUAL_ATTRIBUTES_MA;
  14198. with WSR_WS_TRANSFORMATION;
  14199. with WSR_INQ_WS_DESCRIPTION_TABLE_MA;
  14200. with WSR_INQ_WS_STATE_LIST_MA;
  14201. with WSR_GKS_NORMALIZATION;
  14202.      
  14203. package body LEXI3700_WSD is
  14204.      
  14205. -- This package is the LEXIDATA workstation driver and
  14206. -- controls the flow of commands to the device driver.
  14207. --
  14208. -- Package WS_STATE_LIST_TYPES provides a type for access to a
  14209. -- workstation state list.
  14210. -- Package LEXI3700_WS_TABLES provides a procedure GET_STATE_LIST_PTR
  14211. -- to get the pointer of a workstation state list currently allocated
  14212. -- for the Lexidata device corresponding to the given workstation id.
  14213. -- If no state list has been allocated for the current id, a null
  14214. -- pointer is returned.
  14215.      
  14216.    procedure LEXI3700_WSD
  14217.       (INSTR : in out CGI_INSTR;
  14218.        AFFECTED_WS_ID : WS_ID) is
  14219.      
  14220.    -- The workstation id is used to find the appropriate workstation
  14221.    -- state list.  A pointer to the workstation state list is passed to
  14222.    -- all workstation resource (wsr) routines.
  14223.    --
  14224.    -- This procedure decodes the op_code that is passed from the
  14225.    -- workstation manager. Once the op_code has been decoded, this
  14226.    -- procedure calls a procedure in either a resource package for
  14227.    -- common functions among workstations or a LEXI3700 package for
  14228.    -- operations specific to the Lexidata.  The LEXI3700 packages
  14229.    -- produce a call to the device driver for actual output.
  14230.    --
  14231.    --
  14232.    -- INSTR - contains the operation and the related parameters.
  14233.    -- AFFECTED_WS_ID - the workstation id  of the workstation that is
  14234.    --                  affected by the current operation
  14235.      
  14236.    -- A pointer to the workstation state list corresponding to WS_ID
  14237.    WS_SL : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  14238.      
  14239.    -- The workstation description table used by this driver
  14240.    --        LEXI3700_WS_TABLES.LEXI3700_WS_DT
  14241.      
  14242.    begin
  14243.      
  14244.       WS_SL := LEXI3700_WS_TABLES.
  14245.             GET_STATE_LIST_PTR(AFFECTED_WS_ID);
  14246.      
  14247.       case INSTR.OP is
  14248.      
  14249.          when NO_OP =>
  14250.             null;
  14251.      
  14252.          -- logical operation "ws_control"
  14253.      
  14254.          when OPEN_WS =>
  14255.             LEXI3700_CONTROL_OPERATIONS.OPEN_WS
  14256.                (INSTR.WS_TO_OPEN,
  14257.                 INSTR.CONNECTION_OPEN,
  14258.                 INSTR.TYPE_OF_WS_OPEN,
  14259.                 INSTR.ATTRIBUTES_AT_OPEN,
  14260.                 INSTR.EI);
  14261.          when CLOSE_WS =>
  14262.             LEXI3700_CONTROL_OPERATIONS.CLOSE_WS(WS_SL);
  14263.          when ACTIVATE_WS =>
  14264.             WS_SL.WS_STATE := ACTIVE;
  14265.          when DEACTIVATE_WS =>
  14266.             WS_SL.WS_STATE := INACTIVE;
  14267.          when CLEAR_WS =>
  14268.             LEXI3700_CONTROL_OPERATIONS.CLEAR_WS
  14269.                (WS_SL,
  14270.                 INSTR.FLAG);
  14271.          when UPDATE_WS =>
  14272.             LEXI3700_CONTROL_OPERATIONS.UPDATE_WS
  14273.                (WS_SL,
  14274.                 INSTR.REGENERATION);
  14275.      
  14276.          -- logical operation "output_primitives"
  14277.      
  14278.          when POLYLINE =>
  14279.             LEXI3700_OUTPUT_PRIMITIVES.POLYLINE
  14280.                (WS_SL,
  14281.                 INSTR.LINE_POINTS);
  14282.          when POLYMARKER =>
  14283.             LEXI3700_OUTPUT_PRIMITIVES.POLYMARKER
  14284.                (WS_SL,
  14285.                 INSTR.MARKER_POINTS);
  14286.          when FILL_AREA =>
  14287.             LEXI3700_OUTPUT_PRIMITIVES.FILL_AREA
  14288.                (WS_SL,
  14289.                 INSTR.FILL_AREA_POINTS);
  14290.          when TEXT =>
  14291.             LEXI3700_OUTPUT_PRIMITIVES.TEXT
  14292.                (WS_SL,
  14293.                 INSTR.TEXT_POSITION,
  14294.                 INSTR.TEXT_STRING);
  14295.      
  14296.          -- logical operation "set_primitive_attributes_ma"
  14297.      
  14298.          when SET_CHAR_VECTORS =>
  14299.             WSR_SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_VECTORS
  14300.                   (WS_SL,
  14301.                    INSTR.CHAR_HEIGHT_VECTOR_SET,
  14302.                    INSTR.CHAR_WIDTH_VECTOR_SET);
  14303.          when SET_TEXT_ALIGNMENT =>
  14304.             WSR_SET_PRIMITIVE_ATTRIBUTES_MA.SET_TEXT_ALIGNMENT
  14305.                   (WS_SL,
  14306.                    INSTR.TEXT_ALIGNMENT_SET);
  14307.      
  14308.          -- logical operation "set_individual_attributes_ma"
  14309.      
  14310.          when SET_LINETYPE =>
  14311.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA.SET_LINETYPE
  14312.                   (WS_SL,
  14313.                    LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  14314.                    INSTR.LINETYPE_SET);
  14315.          when SET_POLYLINE_COLOUR_INDEX =>
  14316.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA.SET_POLYLINE_COLOUR_INDEX
  14317.                   (WS_SL,
  14318.                    INSTR.POLYLINE_COLOUR_INDEX_SET);
  14319.          when SET_MARKER_TYPE =>
  14320.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA.SET_MARKER_TYPE
  14321.                   (WS_SL,
  14322.                    LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  14323.                    INSTR.MARKER_TYPE_SET);
  14324.          when SET_POLYMARKER_COLOUR_INDEX =>
  14325.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA
  14326.                   .SET_POLYMARKER_COLOUR_INDEX
  14327.                   (WS_SL,
  14328.                    INSTR.POLYMARKER_COLOUR_INDEX_SET);
  14329.          when SET_TEXT_COLOUR_INDEX =>
  14330.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA.SET_TEXT_COLOUR_INDEX
  14331.                   (WS_SL,
  14332.                    INSTR.TEXT_COLOUR_INDEX_SET);
  14333.          when SET_FILL_AREA_INTERIOR_STYLE =>
  14334.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA
  14335.                   .SET_FILL_AREA_INTERIOR_STYLE
  14336.                   (WS_SL,
  14337.                    INSTR.FILL_AREA_INTERIOR_STYLE_SET);
  14338.          when SET_FILL_AREA_COLOUR_INDEX =>
  14339.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA.SET_FILL_AREA_COLOUR_INDEX
  14340.                   (WS_SL,
  14341.                    INSTR.FILL_AREA_COLOUR_INDEX_SET);
  14342.      
  14343.          -- logical operation "set_colour_table"
  14344.      
  14345.          when SET_COLOUR_REPRESENTATION =>
  14346.             LEXI3700_COLOUR_OPERATIONS.SET_COLOUR_REPRESENTATION
  14347.                   (WS_SL,
  14348.                    INSTR.COLOUR_INDEX_TO_SET_COLOUR_REP,
  14349.                    INSTR.COLOUR_REP_SET,
  14350.                    INSTR.EI);
  14351.      
  14352.          -- logical operation "ws_transformation"
  14353.      
  14354.          when SET_WS_WINDOW =>
  14355.             WSR_WS_TRANSFORMATION.SET_WS_WINDOW
  14356.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT.WS_DYNAMICS.
  14357.                          WS_TRANSFORMATION,
  14358.                    WS_SL,
  14359.                    INSTR.WS_WINDOW_LIMITS_SET);
  14360.          when SET_WS_VIEWPORT =>
  14361.             WSR_WS_TRANSFORMATION.SET_WS_VIEWPORT
  14362.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT.WS_DYNAMICS.
  14363.                          WS_TRANSFORMATION,
  14364.                    WS_SL,
  14365.                    INSTR.WS_VIEWPORT_LIMITS_SET);
  14366.      
  14367.          -- logical operation "inq_ws_description_table_ma"
  14368.      
  14369.          when INQ_DISPLAY_SPACE_SIZE =>
  14370.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_DISPLAY_SPACE_SIZE
  14371.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  14372.                    INSTR.DISPLAY_SPACE_UNITS_INQ,
  14373.                    INSTR.MAX_DC_SIZE_INQ,
  14374.                    INSTR.MAX_RASTER_UNIT_SIZE_INQ);
  14375.          when INQ_POLYLINE_FACILITIES =>
  14376.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_POLYLINE_FACILITIES
  14377.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  14378.                    INSTR.LIST_OF_POLYLINE_TYPES_INQ,
  14379.                    INSTR.NUMBER_OF_WIDTHS_INQ,
  14380.                    INSTR.NOMINAL_WIDTH_INQ,
  14381.                    INSTR.RANGE_OF_WIDTHS_INQ,
  14382.                    INSTR.NUMBER_OF_POLYLINE_INDICES_INQ);
  14383.          when INQ_POLYMARKER_FACILITIES =>
  14384.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_POLYMARKER_FACILITIES
  14385.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  14386.                    INSTR.LIST_OF_POLYMARKER_TYPES_INQ,
  14387.                    INSTR.NUMBER_OF_SIZES_INQ,
  14388.                    INSTR.NOMINAL_SIZE_INQ,
  14389.                    INSTR.RANGE_OF_SIZES_INQ,
  14390.                    INSTR.NUMBER_OF_POLYMARKER_INDICES_INQ);
  14391.          when INQ_TEXT_FACILITIES =>
  14392.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_TEXT_FACILITIES
  14393.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  14394.                    INSTR.LIST_OF_FONT_PRECISION_PAIRS_INQ,
  14395.                    INSTR.NUMBER_OF_HEIGHTS_INQ,
  14396.                    INSTR.RANGE_OF_HEIGHTS_INQ,
  14397.                    INSTR.NUMBER_OF_EXPANSIONS_INQ,
  14398.                    INSTR.RANGE_OF_EXPANSIONS_INQ,
  14399.                    INSTR.NUMBER_OF_TEXT_INDICES_INQ);
  14400.          when INQ_FILL_AREA_FACILITIES =>
  14401.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_FILL_AREA_FACILITIES
  14402.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  14403.                    INSTR.LIST_OF_INTERIOR_STYLES_INQ,
  14404.                    INSTR.LIST_OF_HATCH_STYLES_INQ,
  14405.                    INSTR.NUMBER_OF_FILL_AREA_INDICES_INQ);
  14406.          when INQ_COLOUR_FACILITIES =>
  14407.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_COLOUR_FACILITIES
  14408.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  14409.                    INSTR.NUMBER_OF_COLOURS_INQ,
  14410.                    INSTR.AVAILABLE_COLOUR_INQ,
  14411.                    INSTR.NUMBER_OF_COLOUR_INDICES_INQ);
  14412.          when INQ_MAX_LENGTH_OF_WS_STATE_TABLES =>
  14413.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.
  14414.                   INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  14415.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  14416.                    INSTR.MAX_POLYLINE_ENTRIES_INQ,
  14417.                    INSTR.MAX_POLYMARKER_ENTRIES_INQ,
  14418.                    INSTR.MAX_TEXT_ENTRIES_INQ,
  14419.                    INSTR.MAX_FILL_AREA_ENTRIES_INQ,
  14420.                    INSTR.MAX_PATTERN_INDICES_INQ,
  14421.                    INSTR.MAX_COLOUR_INDICES_INQ);
  14422.      
  14423.          -- logical operation "inq_ws_state_list_ma"
  14424.      
  14425.          when INQ_WS_CONNECTION_AND_TYPE =>
  14426.             WSR_INQ_WS_STATE_LIST_MA.INQ_WS_CONNECTION_AND_TYPE
  14427.                   (WS_SL,
  14428.                    INSTR.CONNECTION_INQ,
  14429.                    INSTR.TYPE_OF_WS_INQ);
  14430.          when INQ_TEXT_EXTENT =>
  14431.             LEXI3700_INQ_TEXT.INQ_TEXT_EXTENT
  14432.                   (WS_SL,
  14433.                    INSTR.POSITION_TEXT,
  14434.                    INSTR.CHAR_STRING,
  14435.                    INSTR.CONCATENATION_POINT,
  14436.                    INSTR.TEXT_EXTENT_LOWER_LEFT_INQ,
  14437.                    INSTR.TEXT_EXTENT_LOWER_RIGHT_INQ,
  14438.                    INSTR.TEXT_EXTENT_UPPER_LEFT_INQ,
  14439.                    INSTR.TEXT_EXTENT_UPPER_RIGHT_INQ);
  14440.          when INQ_LIST_OF_COLOUR_INDICES =>
  14441.             WSR_INQ_WS_STATE_LIST_MA.INQ_LIST_OF_COLOUR_INDICES
  14442.                   (WS_SL,
  14443.                    INSTR.LIST_OF_COLOUR_INDICES_INQ);
  14444.          when INQ_COLOUR_REPRESENTATION =>
  14445.             WSR_INQ_WS_STATE_LIST_MA.INQ_COLOUR_REPRESENTATION
  14446.                   (WS_SL,
  14447.                    INSTR.COLOUR_INDEX_TO_INQ_COLOUR_REP,
  14448.                    INSTR.RETURN_VALUE_TO_INQ_COLOUR_REP,
  14449.                    INSTR.COLOUR_REP_INQ,
  14450.                    INSTR.EI);
  14451.          when INQ_WS_TRANSFORMATION =>
  14452.             WSR_INQ_WS_STATE_LIST_MA.INQ_WS_TRANSFORMATION
  14453.                   (WS_SL,
  14454.                    INSTR.UPDATE_INQ,
  14455.                    INSTR.REQUESTED_WINDOW_INQ,
  14456.                    INSTR.CURRENT_WINDOW_INQ,
  14457.                    INSTR.REQUESTED_VIEWPORT_INQ,
  14458.                    INSTR.CURRENT_VIEWPORT_INQ);
  14459.      
  14460.          -- logical operation "gks_normalization"
  14461.      
  14462.          when SET_CLIPPING_RECTANGLE =>
  14463.             WSR_GKS_NORMALIZATION.SET_CLIPPING_RECTANGLE
  14464.                   (WS_SL,
  14465.                    INSTR.CLIPPING_RECTANGLE_SET);
  14466.      
  14467.       end case;
  14468.      
  14469.    end LEXI3700_WSD;
  14470.      
  14471. end LEXI3700_WSD;
  14472. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14473. --:UDD:GKSADACM:CODE:MA:WSM_MA.ADA
  14474. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14475. ------------------------------------------------------------------
  14476. --
  14477. --  NAME: WSM
  14478. --  IDENTIFIER: GDMXXX.1(1)
  14479. --  DISCREPANCY REPORTS:
  14480. --
  14481. ------------------------------------------------------------------
  14482. -- file:  wsm_ma.ada
  14483. -- level: ma
  14484.      
  14485. with CGI;
  14486.      
  14487. use CGI;
  14488.      
  14489. package WSM is
  14490.      
  14491. -- This is the single entry point for the GKS device independent layer
  14492. -- to interface to all "virtual" devices.  The Work Station manager has
  14493. -- the responsibility of accepting a CGI interface call from GKS,
  14494. -- performing any common operations for workstations and transmitting
  14495. -- the operation to the appropriate workstation drivers via the WS_
  14496. -- COMMUNICATION package.
  14497.      
  14498.    procedure WS_MANAGER
  14499.       (INSTR    : in out CGI_INSTR);
  14500.      
  14501. end WSM;
  14502. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14503. --:UDD:GKSADACM:CODE:MA:WS_COMM.ADA
  14504. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14505. ------------------------------------------------------------------
  14506. --
  14507. --  NAME: WS_COMMUNICATION
  14508. --  IDENTIFIER: GDMXXX.1(1)
  14509. --  DISCREPANCY REPORTS:
  14510. --
  14511. ------------------------------------------------------------------
  14512. -- file: WS_COMM.ADA
  14513. -- level: all levels
  14514.      
  14515. with CGI;
  14516. with GKS_TYPES;
  14517.      
  14518. use CGI;
  14519. use GKS_TYPES;
  14520.      
  14521. package WS_COMMUNICATION is
  14522.      
  14523. -- CGI_INSTR is declared in the CGI package.
  14524. -- WS_TYPE and WS_ID are declared in GKS_TYPES.
  14525. -- XMIT_ALL is passed a list of workstations for which
  14526. -- to transmit the instruction.
  14527.      
  14528.    procedure XMIT
  14529.       (INSTR      : in out CGI_INSTR;
  14530.        XMIT_WS_ID : in WS_ID);
  14531.      
  14532.    procedure XMIT_TYPE
  14533.       (INSTR      : in out CGI_INSTR;
  14534.        XMIT_TYPE  : in WS_TYPE);
  14535.      
  14536.    procedure XMIT_ALL
  14537.       (INSTR   : in out CGI_INSTR;
  14538.        WS_XMIT_LIST : in WS_IDS.LIST_OF);
  14539.      
  14540. end WS_COMMUNICATION;
  14541.      
  14542. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14543. --:UDD:GKSADACM:CODE:MA:WS_COMM_B.ADA
  14544. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14545. ------------------------------------------------------------------
  14546. --
  14547. --  NAME: WS_COMMUNICATION
  14548. --  IDENTIFIER: GDMXXX.1(1)
  14549. --  DISCREPANCY REPORTS:
  14550. --
  14551. ------------------------------------------------------------------
  14552. -- file: WS_COMM_B.ADA
  14553. -- level: all levels
  14554.      
  14555. package body WS_COMMUNICATION is
  14556.      
  14557. -- This package provides the data interface between
  14558. -- the WS_MANAGER and output device drivers.
  14559.      
  14560.    procedure XMIT
  14561.       (INSTR      : in out CGI_INSTR;
  14562.        XMIT_WS_ID : in WS_ID) is separate;
  14563.      
  14564.    procedure XMIT_TYPE
  14565.       (INSTR      : in out CGI_INSTR;
  14566.        XMIT_TYPE  : in WS_TYPE) is separate;
  14567.      
  14568.    procedure XMIT_ALL
  14569.       (INSTR        : in out CGI_INSTR;
  14570.        WS_XMIT_LIST : in WS_IDS.LIST_OF) is separate;
  14571.      
  14572. end WS_COMMUNICATION;
  14573. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14574. --:UDD:GKSADACM:CODE:MA:XMIT.ADA
  14575. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14576. ------------------------------------------------------------------
  14577. --
  14578. --  NAME: XMIT
  14579. --  IDENTIFIER: GDMXXX.1(1)
  14580. --  DISCREPANCY REPORTS:
  14581. --
  14582. ------------------------------------------------------------------
  14583. -- file: XMIT.ADA
  14584. -- level: ma
  14585.      
  14586. with GKS_CONFIGURATION;
  14587. with LEXI3700_WSD;
  14588. with CGI_OPEN_WS_OPERATIONS;
  14589.      
  14590. separate (WS_COMMUNICATION)
  14591.      
  14592. procedure XMIT
  14593.    (INSTR      : in out CGI_INSTR;
  14594.     XMIT_WS_ID : in WS_ID) is
  14595.      
  14596. -- This procedure may be rewritten at each level and
  14597. -- for each implementation of GKS due to changes in system
  14598. -- configuration of devices. Capabilities of GKS increase at
  14599. -- each level. Level a has output capabilities and level b
  14600. -- has some input capabilities. The case statement
  14601. -- in this procedure changes to reflect these capability
  14602. -- changes to include output devices at level a or to include
  14603. -- input or output devices at levels b and c.
  14604. -- Also, various implementations of GKS will have varied
  14605. -- devices and the case statement changes to reflect alternative
  14606. -- device selections.
  14607.      
  14608. XMIT_WS_TYPE : WS_TYPE;
  14609.      
  14610. begin
  14611.      
  14612.    -- Send the INSTR and the WS_ID to the workstation driver
  14613.    -- for the workstation type corresponding to the WS_ID.
  14614.    -- CGI_OPEN_WS_OPERATIONS contains the function which
  14615.    -- returns the workstation type, on which to case, for the
  14616.    -- given XMIT_WS_ID and dictionary in which it resides.
  14617.      
  14618.    XMIT_WS_TYPE := CGI_OPEN_WS_OPERATIONS.OPEN_WS.VALUE
  14619.          (CGI_OPEN_WS_OPERATIONS.OPEN_DICTIONARY,XMIT_WS_ID);
  14620.      
  14621.    case XMIT_WS_TYPE is
  14622.      
  14623.       when GKS_CONFIGURATION.LEXIDATA_3700_OUTPUT_TYPE  =>
  14624.             LEXI3700_WSD.LEXI3700_WSD(INSTR,XMIT_WS_ID);
  14625.       when others =>
  14626.             null;
  14627.    end case;
  14628.      
  14629. end XMIT;
  14630. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14631. --:UDD:GKSADACM:CODE:MA:XMIT_TYPE.ADA
  14632. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14633. ------------------------------------------------------------------
  14634. --
  14635. --  NAME: XMIT_TYPE
  14636. --  IDENTIFIER: GDMXXX.1(1)
  14637. --  DISCREPANCY REPORTS:
  14638. --
  14639. ------------------------------------------------------------------
  14640. -- file: XMIT_TYPE.ADA
  14641. -- level: ma
  14642.      
  14643. with GKS_CONFIGURATION;
  14644. with LEXI3700_WSD;
  14645.      
  14646. separate (WS_COMMUNICATION)
  14647.      
  14648. procedure XMIT_TYPE
  14649.    (INSTR      : in out CGI_INSTR;
  14650.     XMIT_TYPE  : in WS_TYPE) is
  14651.      
  14652. -- This procedure may be rewritten at each level and
  14653. -- for each implementation of GKS due to changes in system
  14654. -- configuration of devices. Capabilities of GKS increase at
  14655. -- each level. Level a has output capabilities and level b
  14656. -- has some input capabilities. The case statement
  14657. -- in this procedure changes to reflect these capability
  14658. -- changes to include output devices at level a or to include
  14659. -- input or output devices at levels b and c.
  14660. -- Also, various implementations of GKS will have varied
  14661. -- devices and the case statement changes to reflect alternative
  14662. -- device selections.
  14663.      
  14664. begin
  14665.      
  14666.    -- Send a workstation id as a dummy parameter with the INSTR
  14667.    -- to the workstation driver for the XMIT_TYPE specified
  14668.    -- by the parameter.
  14669.      
  14670.    case XMIT_TYPE is
  14671.       when GKS_CONFIGURATION.LEXIDATA_3700_OUTPUT_TYPE  =>
  14672.             LEXI3700_WSD.LEXI3700_WSD(INSTR,WS_ID'LAST);
  14673.       when others => null;
  14674.    end case;
  14675.      
  14676. end XMIT_TYPE;
  14677. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14678. --:UDD:GKSADACM:CODE:MA:XMIT_ALL.ADA
  14679. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14680. ------------------------------------------------------------------
  14681. --
  14682. --  NAME: XMIT_ALL
  14683. --  IDENTIFIER: GDMXXX.1(1)
  14684. --  DISCREPANCY REPORTS:
  14685. --
  14686. ------------------------------------------------------------------
  14687. -- file: XMIT_ALL.ADA
  14688. -- level: all levels
  14689.      
  14690. separate (WS_COMMUNICATION)
  14691.      
  14692. procedure XMIT_ALL
  14693.    (INSTR : in out CGI_INSTR;
  14694.     WS_XMIT_LIST : in WS_IDS.LIST_OF) is
  14695.      
  14696. begin
  14697.      
  14698.    -- The XMIT procedure is called for every workstation
  14699.    -- in the WS_XMIT_LIST.
  14700.      
  14701.    for I in 1..WS_IDS.SIZE_OF_LIST(WS_XMIT_LIST) loop
  14702.       XMIT(INSTR,WS_IDS.LIST_ELEMENT(I,WS_XMIT_LIST));
  14703.    end loop;
  14704.      
  14705. end XMIT_ALL;
  14706. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14707. --:UDD:GKSADACM:CODE:MA:WSM_MA_B.ADA
  14708. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14709. ------------------------------------------------------------------
  14710. --
  14711. --  NAME: WSM - BODY
  14712. --  IDENTIFIER: GDMXXX.1(2)
  14713. --  DISCREPANCY REPORTS:
  14714. --  #001 05/13/85  "No WS_ID in dictionary for use by XMIT"
  14715. ------------------------------------------------------------------
  14716. -- file:  wsm_ma_b.ada
  14717. -- level: ma
  14718.      
  14719. with GKS_TYPES;
  14720. with WS_COMMUNICATION;
  14721. with CGI_OPEN_WS_OPERATIONS;
  14722. with GKS_ERRORS;
  14723.      
  14724. use  GKS_TYPES;
  14725.      
  14726. package body WSM is
  14727.      
  14728. -- This is the single entry point for the GKS device independent layer
  14729. -- to interface to all "virtual" devices.  The Work Station manager has
  14730. -- the responsibility of accepting a CGI interface call from GKS,
  14731. -- performing any common operations for workstations and transmitting
  14732. -- the operation to the appropriate workstation drivers via the WS_
  14733. -- COMMUNICATION package.
  14734. -- Package GKS_TYPES provides type definitions.
  14735. -- Package WS_COMMUNICATIONS provides communication of instructions to
  14736. -- different workstation drivers.
  14737. -- Package CGI_OPEN_WS_OPERATIONS provides a dictionary of associations
  14738. -- between workstation ids and workstation types for each currently
  14739. -- open workstation.
  14740. -- Package GKS_ERRORS provides named constants for possible error
  14741. -- indicator values.
  14742.      
  14743.    LIST_OF_OPEN_WS : WS_IDS.LIST_OF;
  14744.    -- WS manager copy of list of currently open workstations
  14745.      
  14746.    LIST_OF_ACTIVE_WS : WS_IDS.LIST_OF;
  14747.    -- WS manager copy of list of currently active workstations
  14748.      
  14749.      
  14750.    procedure WS_MANAGER
  14751.       (INSTR  : in out CGI_INSTR) is
  14752.      
  14753.    -- Decodes all CGI interface instructions and invokes the
  14754.    -- appropriate procedure of WS_COMMUNICATION to transmit to a
  14755.    -- Workstation Driver.
  14756.      
  14757.    begin
  14758.      
  14759.       -- Call the appropriate WS_COMMUNICATION routine based on
  14760.       -- the CGI instruction opcode
  14761.      
  14762.       case INSTR.OP is
  14763.      
  14764.          when NO_OP =>
  14765.             null;
  14766.      
  14767.          -- logical operation "ws_control"
  14768.      
  14769.          when OPEN_WS =>
  14770.             -- Add association of ws id and ws type to dictionary
  14771.             CGI_OPEN_WS_OPERATIONS.OPEN_WS.ENTER               --DR001
  14772.                   (CGI_OPEN_WS_OPERATIONS.OPEN_DICTIONARY,     --DR001
  14773.                    INSTR.WS_TO_OPEN,                           --DR001
  14774.                    INSTR.TYPE_OF_WS_OPEN);                     --DR001
  14775.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_OPEN);     --DR001
  14776.             if  INSTR.EI = GKS_ERRORS.SUCCESSFUL then          --DR001
  14777.                -- Add workstation id to list of open workstations
  14778.                WS_IDS.ADD_TO_LIST(INSTR.WS_TO_OPEN,            --DR001
  14779.                      LIST_OF_OPEN_WS);                         --DR001
  14780.             else                                               --DR001
  14781.                -- remove ws id entry from open dictionary      --DR001
  14782.                CGI_OPEN_WS_OPERATIONS.OPEN_WS.PURGE            --DR001
  14783.                      (CGI_OPEN_WS_OPERATIONS.OPEN_DICTIONARY,  --DR001
  14784.                       INSTR.WS_TO_OPEN);                       --DR001
  14785.             end if;                                            --DR001
  14786.          when CLOSE_WS =>
  14787.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_CLOSE);
  14788.             -- remove ws id entry from open dictionary
  14789.             CGI_OPEN_WS_OPERATIONS.OPEN_WS.PURGE
  14790.                   (CGI_OPEN_WS_OPERATIONS.OPEN_DICTIONARY,
  14791.                    INSTR.WS_TO_CLOSE);
  14792.             -- Delete workstation id from list of open workstations
  14793.             WS_IDS.DELETE_FROM_LIST(INSTR.WS_TO_CLOSE,
  14794.                   LIST_OF_OPEN_WS);
  14795.          when ACTIVATE_WS =>
  14796.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_ACTIVATE);
  14797.             if  INSTR.EI = GKS_ERRORS.SUCCESSFUL then
  14798.                -- Add workstation id to list of active workstations
  14799.                WS_IDS.ADD_TO_LIST(INSTR.WS_TO_ACTIVATE,
  14800.                      LIST_OF_ACTIVE_WS);
  14801.             end if;
  14802.          when DEACTIVATE_WS =>
  14803.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_DEACTIVATE);
  14804.             -- Delete workstation id from list of active workstations
  14805.             WS_IDS.DELETE_FROM_LIST(INSTR.WS_TO_DEACTIVATE,
  14806.                   LIST_OF_ACTIVE_WS);
  14807.          when CLEAR_WS =>
  14808.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_CLEAR);
  14809.          when UPDATE_WS =>
  14810.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_UPDATE);
  14811.      
  14812.          -- logical operation "set_colour_table"
  14813.      
  14814.          when SET_COLOUR_REPRESENTATION =>
  14815.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_SET_COLOUR_REP);
  14816.      
  14817.          -- logical operation "ws_transformation"
  14818.      
  14819.          when SET_WS_WINDOW =>
  14820.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_SET_WINDOW);
  14821.          when SET_WS_VIEWPORT =>
  14822.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_SET_VIEWPORT);
  14823.      
  14824.          -- logical operation "inq_ws_description_table_ma"
  14825.      
  14826.          when INQ_DISPLAY_SPACE_SIZE =>
  14827.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  14828.                   INSTR.WS_TO_INQ_DISPLAY_SPACE_SIZE);
  14829.          when INQ_POLYLINE_FACILITIES =>
  14830.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  14831.                   INSTR.WS_TO_INQ_POLYLINE_FACILITIES);
  14832.          when INQ_POLYMARKER_FACILITIES =>
  14833.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  14834.                   INSTR.WS_TO_INQ_POLYMARKER_FACILITIES);
  14835.          when INQ_TEXT_FACILITIES =>
  14836.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  14837.                   INSTR.WS_TO_INQ_TEXT_FACILITIES);
  14838.          when INQ_FILL_AREA_FACILITIES =>
  14839.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  14840.                   INSTR.WS_TO_INQ_FILL_AREA_FACILITIES);
  14841.          when INQ_COLOUR_FACILITIES =>
  14842.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  14843.                   INSTR.WS_TO_INQ_COLOUR_FACILITIES);
  14844.          when INQ_MAX_LENGTH_OF_WS_STATE_TABLES =>
  14845.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  14846.                   INSTR.WS_TO_INQ_MAX_LENGTH_OF_WS_STATE_TABLES);
  14847.      
  14848.          -- logical operation "inq_ws_state_list_ma"
  14849.      
  14850.          when INQ_WS_CONNECTION_AND_TYPE =>
  14851.             WS_COMMUNICATION.XMIT(INSTR,
  14852.                   INSTR.WS_TO_INQ_CONNECTION_AND_TYPE);
  14853.          when INQ_TEXT_EXTENT =>
  14854.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_INQ_TEXT_EXTENT);
  14855.          when INQ_LIST_OF_COLOUR_INDICES =>
  14856.             WS_COMMUNICATION.XMIT(INSTR,
  14857.                   INSTR.WS_TO_INQ_COLOUR_INDICES);
  14858.          when INQ_COLOUR_REPRESENTATION =>
  14859.             WS_COMMUNICATION.XMIT(INSTR,
  14860.                   INSTR.WS_TO_INQ_COLOUR_REP);
  14861.          when INQ_WS_TRANSFORMATION =>
  14862.             WS_COMMUNICATION.XMIT(INSTR,
  14863.                   INSTR.WS_TO_INQ_TRANSFORMATION);
  14864.      
  14865. -- The following logical operations go to all ACTIVE workstations
  14866.      
  14867.          -- logical operation "output_primitives"
  14868.      
  14869.          when POLYLINE   |
  14870.               POLYMARKER |
  14871.               FILL_AREA  |
  14872.               TEXT =>
  14873.             WS_COMMUNICATION.XMIT_ALL(INSTR,LIST_OF_ACTIVE_WS);
  14874.      
  14875. -- The following logical operations go to all OPEN workstations
  14876.      
  14877.          -- logical operation "set_primitive_attributes_ma"
  14878.      
  14879.          when SET_CHAR_VECTORS             |
  14880.               SET_TEXT_ALIGNMENT           |
  14881.      
  14882.          -- logical operation "set_individual_attributes_ma"
  14883.      
  14884.               SET_LINETYPE                 |
  14885.               SET_POLYLINE_COLOUR_INDEX    |
  14886.               SET_MARKER_TYPE              |
  14887.               SET_POLYMARKER_COLOUR_INDEX  |
  14888.               SET_TEXT_COLOUR_INDEX        |
  14889.               SET_FILL_AREA_INTERIOR_STYLE |
  14890.               SET_FILL_AREA_COLOUR_INDEX   |
  14891.      
  14892.          -- logical operation "gks_normalization"
  14893.      
  14894.               SET_CLIPPING_RECTANGLE =>
  14895.      
  14896.             -- Send the instruction to all open workstations
  14897.             WS_COMMUNICATION.XMIT_ALL(INSTR,LIST_OF_OPEN_WS);
  14898.      
  14899.       end case;
  14900.      
  14901.    end WS_MANAGER;
  14902.      
  14903. end WSM;
  14904. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14905. --:UDD:GKSADACM:CODE:MA:GKS_ST_LST.ADA
  14906. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14907. ------------------------------------------------------------------
  14908. --
  14909. --  NAME: GKS_STATE_LIST
  14910. --  IDENTIFIER: GIMXXX.1(1)
  14911. --  DISCREPANCY REPORTS:
  14912. --
  14913. ------------------------------------------------------------------
  14914. -- file:   gks_st_lst.ada
  14915. -- levels: ma, 0a, 1a, 2a
  14916.      
  14917. with GKS_TYPES;
  14918. with GKS_CONFIGURATION;
  14919.      
  14920. use GKS_TYPES;
  14921.      
  14922. package GKS_STATE_LIST is
  14923.      
  14924.    LIST_OF_OPEN_WS                         : WS_IDS.LIST_OF;
  14925.      
  14926.    LIST_OF_ACTIVE_WS                       : WS_IDS.LIST_OF;
  14927.      
  14928.    CURRENT_ASPECT_SOURCE_FLAGS             : ASF_LIST;
  14929.      
  14930.    -- Polyline attributes
  14931.      
  14932.    CURRENT_POLYLINE_INDEX                  : POLYLINE_INDEX;
  14933.    CURRENT_LINETYPE                        : LINETYPE;
  14934.    CURRENT_LINEWIDTH_SCALE_FACTOR          : LINE_WIDTH;
  14935.    CURRENT_POLYLINE_COLOUR_INDEX           : COLOUR_INDEX;
  14936.      
  14937.    -- Polymarker attributes
  14938.      
  14939.    CURRENT_POLYMARKER_INDEX                : POLYMARKER_INDEX;
  14940.    CURRENT_MARKER_TYPE                     : MARKER_TYPE;
  14941.    CURRENT_MARKER_SIZE_SCALE_FACTOR        : MARKER_SIZE;
  14942.    CURRENT_POLYMARKER_COLOUR_INDEX         : COLOUR_INDEX;
  14943.      
  14944.    -- Text attributes
  14945.      
  14946.    CURRENT_TEXT_INDEX                      : TEXT_INDEX;
  14947.    CURRENT_TEXT_FONT_AND_PRECISION         : TEXT_FONT_PRECISION;
  14948.    CURRENT_CHAR_EXPANSION_FACTOR           : CHAR_EXPANSION;
  14949.    CURRENT_CHAR_SPACING                    : CHAR_SPACING;
  14950.    CURRENT_TEXT_COLOUR_INDEX               : COLOUR_INDEX;
  14951.      
  14952.    -- The following text attributes are not bundleable.
  14953.      
  14954.    CURRENT_CHAR_HEIGHT                     : WC.MAGNITUDE;
  14955.    CURRENT_CHAR_UP_VECTOR                  : WC.VECTOR;
  14956.    CURRENT_TEXT_PATH                       : TEXT_PATH;
  14957.    CURRENT_TEXT_ALIGNMENT                  : TEXT_ALIGNMENT;
  14958.    CURRENT_CHAR_WIDTH                      : WC.MAGNITUDE;
  14959.    CURRENT_CHAR_BASE_VECTOR                : WC.VECTOR;
  14960.      
  14961.    -- Fill area attributes.
  14962.      
  14963.    CURRENT_FILL_AREA_INDEX                 : FILL_AREA_INDEX;
  14964.    CURRENT_FILL_AREA_INTERIOR_STYLE        : INTERIOR_STYLE;
  14965.    CURRENT_FILL_AREA_STYLE_INDEX           : STYLE_INDEX;
  14966.    CURRENT_FILL_AREA_COLOUR_INDEX          : COLOUR_INDEX;
  14967.      
  14968.    -- Pattern attributes for pattern fills.
  14969.      
  14970.    CURRENT_PATTERN_REFERENCE_POINT         : WC.POINT;
  14971.    CURRENT_PATTERN_HEIGHT_VECTOR           : WC.VECTOR;
  14972.    CURRENT_PATTERN_WIDTH_VECTOR            : WC.VECTOR;
  14973.    CURRENT_NORMALIZATION_TRANSFORMATION    : TRANSFORMATION_NUMBER;
  14974.      
  14975.    -- Window and Viewport attributes for transforming between coordinate
  14976.    -- systems.  The factors contain the scale factor and translation
  14977.    -- factor.
  14978.      
  14979.    type NORMALIZATION_TRANSFORMATION is
  14980.       record
  14981.          WINDOW      : WC.RECTANGLE_LIMITS;
  14982.          VIEWPORT    : NDC.RECTANGLE_LIMITS;
  14983.          NDC_FACTORS : TRANSFORMATION_MATRIX; -- Factors for NDC to WC.
  14984.          WC_FACTORS  : TRANSFORMATION_MATRIX; -- Factors for WC to NDC.
  14985.       end record;
  14986.      
  14987.    type NORMALIZATION_TRANSFORMATION_ARRAY is array
  14988.       (TRANSFORMATION_NUMBER range <>) of NORMALIZATION_TRANSFORMATION;
  14989.      
  14990.    LIST_OF_NORMALIZATION_TRANSFORMATIONS :
  14991.       NORMALIZATION_TRANSFORMATION_ARRAY
  14992.          (0..GKS_CONFIGURATION.MAX_NORMALIZATION_TRANSFORMATION_NUMBER);
  14993.      
  14994.    PRIORITY_LIST_OF_TRANSFORMATIONS : TRANSFORMATION_PRIORITY_LIST;
  14995.      
  14996.    -- Clipping attributes
  14997.    CLIP_INDICATOR                        : CLIPPING_INDICATOR;
  14998.      
  14999.    procedure INITIALIZE;
  15000.      
  15001. end GKS_STATE_LIST;
  15002. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15003. --:UDD:GKSADACM:CODE:MA:TRANS_FACT.ADA
  15004. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15005. ------------------------------------------------------------------
  15006. --
  15007. --  NAME: TRANSLATION_FACTORS
  15008. --  IDENTIFIER: GIMXXX.1(1)
  15009. --  DISCREPANCY REPORTS:
  15010. --
  15011. ------------------------------------------------------------------
  15012. -- file:   trans_fact.ada
  15013. -- levels: ma, 0a, 1a, 2a
  15014.      
  15015. with GKS_TYPES;
  15016.      
  15017. use GKS_TYPES;
  15018.      
  15019. package TRANSLATION_FACTORS is
  15020.      
  15021. -- The package TRANSLATION_FACTORS contains functions that compute
  15022. -- the scale factor and translation factor used in translating points
  15023. -- from one coordinate system to another.
  15024.      
  15025.    function GET_NORMALIZATION_FACTORS
  15026.       (WINDOW   : WC.RECTANGLE_LIMITS;
  15027.        VIEWPORT : NDC.RECTANGLE_LIMITS)
  15028.    return TRANSFORMATION_MATRIX;
  15029.      
  15030.    function GET_NORMALIZATION_FACTORS
  15031.       (WINDOW   : NDC.RECTANGLE_LIMITS;
  15032.        VIEWPORT : WC.RECTANGLE_LIMITS)
  15033.    return TRANSFORMATION_MATRIX;
  15034.      
  15035. end TRANSLATION_FACTORS;
  15036.      
  15037. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15038. --:UDD:GKSADACM:CODE:MA:TRANS_FACT_B.ADA
  15039. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15040. ------------------------------------------------------------------
  15041. --
  15042. --  NAME: TRANSLATION_FACTORS - BODY
  15043. --  IDENTIFIER: GIMXXX.1(1)
  15044. --  DISCREPANCY REPORTS:
  15045. --
  15046. ------------------------------------------------------------------
  15047. -- file:  trans_fact_b.ada
  15048. -- level: ma, 0a, 1a, 2a
  15049.      
  15050. package body TRANSLATION_FACTORS is
  15051.      
  15052. -- The package TRANSLATION_FACTORS contains functions that compute
  15053. -- the scale factor and translation factor used in translating points
  15054. -- from one coordinate system to another.
  15055.      
  15056.    function GET_NORMALIZATION_FACTORS
  15057.       (WINDOW   : WC.RECTANGLE_LIMITS;
  15058.        VIEWPORT : NDC.RECTANGLE_LIMITS)
  15059.    return TRANSFORMATION_MATRIX is
  15060.      
  15061.    -- The function GET_NORMALIZATON_FACTORS computes the scale factor
  15062.    -- translation factor for going from world coordinates to normalized
  15063.    -- device coordinates.  The final matrix consists of
  15064.    -- SX - X scale factor.
  15065.    -- SY - Y scale factor.
  15066.    -- TX - X translation factor.
  15067.    -- TY - Y translation factor.
  15068.    -- The matrix to be returned is:
  15069.    --     SX  0.0 TX
  15070.    --     0.0 SY  TY
  15071.    --
  15072.    -- WINDOW - The window coordinates.
  15073.    --
  15074.    -- VIEWPORT - The viewport coordinates.
  15075.      
  15076.    TEMPORARY : TRANSFORMATION_MATRIX;
  15077.    -- The matrix to return.
  15078.      
  15079.    begin
  15080.      
  15081.       -- The X scale factor.
  15082.       TEMPORARY (1,1) :=
  15083.                      (VIEWPORT.XMAX - VIEWPORT.XMIN)/
  15084.            (NDC_TYPE (WINDOW.XMAX - WINDOW.XMIN));
  15085.      
  15086.       -- Not used in translations.
  15087.       TEMPORARY (1,2) := 0.0;
  15088.      
  15089.       -- The X translation factor.
  15090.       TEMPORARY (1,3) :=
  15091.                        (VIEWPORT.XMIN) -
  15092.          (TEMPORARY  (1,1) * (NDC_TYPE(WINDOW.XMIN)) );
  15093.      
  15094.       -- Not used in translations.
  15095.       TEMPORARY (2,1) := 0.0;
  15096.      
  15097.       -- The Y scale factor.
  15098.       TEMPORARY (2,2) :=
  15099.                      (VIEWPORT.YMAX - VIEWPORT.YMIN) /
  15100.            (NDC_TYPE (WINDOW.YMAX - WINDOW.YMIN));
  15101.      
  15102.       -- The Y translation factor.
  15103.       TEMPORARY (2,3) :=
  15104.                          (VIEWPORT.YMIN) -
  15105.                          (TEMPORARY (2,2) * (NDC_TYPE (WINDOW.YMIN)) );
  15106.      
  15107.       return TEMPORARY;
  15108.      
  15109.    end GET_NORMALIZATION_FACTORS;
  15110.      
  15111.    function GET_NORMALIZATION_FACTORS
  15112.       (WINDOW   : NDC.RECTANGLE_LIMITS;
  15113.        VIEWPORT : WC.RECTANGLE_LIMITS)
  15114.    return TRANSFORMATION_MATRIX is
  15115.      
  15116.    -- The function GET_NORMALIZATON_FACTORS computes the scale factor
  15117.    -- translation factor for going from normalized device coordinates
  15118.    -- to world coordinates.  The final matrix consists of
  15119.    -- SX - X scale factor.
  15120.    -- SY - Y scale factor.
  15121.    -- TX - X translation factor.
  15122.    -- TY - Y translation factor.
  15123.    -- The matrix to be returned is:
  15124.    --     SX  0.0 TX
  15125.    --     0.0 SY  TY
  15126.    --
  15127.    -- WINDOW - The window coordinates.
  15128.    --
  15129.    -- VIEWPORT - The viewport coordinates.
  15130.      
  15131.    TEMPORARY : TRANSFORMATION_MATRIX;
  15132.    -- The matrix to be returned.
  15133.      
  15134.    begin
  15135.      
  15136.       -- X scale factor.
  15137.       TEMPORARY (1,1) :=
  15138.                (NDC_TYPE (VIEWPORT.XMAX - VIEWPORT.XMIN) )/
  15139.                          (WINDOW.XMAX - WINDOW.XMIN);
  15140.      
  15141.       -- Not used in translation.
  15142.       TEMPORARY (1,2) := 0.0;
  15143.      
  15144.       -- X translation factor.
  15145.       TEMPORARY (1,3) :=
  15146.              (NDC_TYPE (VIEWPORT.XMIN) ) -
  15147.          (TEMPORARY  (1,1) * (WINDOW.XMIN) );
  15148.      
  15149.       -- Not used in translation.
  15150.       TEMPORARY (2,1) := 0.0;
  15151.      
  15152.       -- Y scale factor.
  15153.       TEMPORARY (2,2) :=
  15154.            (NDC_TYPE (VIEWPORT.YMAX - VIEWPORT.YMIN) ) /
  15155.                      (WINDOW.YMAX - WINDOW.YMIN);
  15156.      
  15157.       -- Y translation factor.
  15158.       TEMPORARY (2,3) :=
  15159.               (NDC_TYPE (VIEWPORT.YMIN)) -
  15160.          (TEMPORARY (2,2) * (WINDOW.YMIN) );
  15161.      
  15162.       return TEMPORARY;
  15163.      
  15164.    end GET_NORMALIZATION_FACTORS;
  15165.      
  15166. end TRANSLATION_FACTORS;
  15167. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15168. --:UDD:GKSADACM:CODE:MA:GKS_ST_LST_B.ADA
  15169. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15170. ------------------------------------------------------------------
  15171. --
  15172. --  NAME: GKS_STATE_LIST - BODY
  15173. --  IDENTIFIER: GIMXXX.1(1)
  15174. --  DISCREPANCY REPORTS:
  15175. --
  15176. ------------------------------------------------------------------
  15177. -- file:   gks_st_lst_b.ada
  15178. -- levels: ma, 0a, 1a, 2a
  15179.      
  15180. with TRANSLATION_FACTORS;
  15181.      
  15182. package body GKS_STATE_LIST is
  15183.      
  15184.    procedure INITIALIZE is
  15185.      
  15186.    -- This procedure initializes the GKS_STATE_LIST to the default
  15187.    -- values given in the GKS specification manual.  It is called
  15188.    -- by the GKS procedure OPEN_GKS.
  15189.      
  15190.       begin
  15191.      
  15192.          LIST_OF_OPEN_WS := WS_IDS.NULL_LIST;
  15193.      
  15194.          LIST_OF_ACTIVE_WS := WS_IDS.NULL_LIST;
  15195.      
  15196.          CURRENT_ASPECT_SOURCE_FLAGS  :=
  15197.             (OTHERS => INDIVIDUAL);
  15198.      
  15199.          -- The following are componants with their type of the record
  15200.          -- type ASF_LIST and their default values:
  15201.          -- LINETYPE                     : ASF := INDIVIDUAL;
  15202.          -- LINE_WIDTH                   : ASF := INDIVIDUAL;
  15203.          -- LINE_COLOUR                  : ASF := INDIVIDUAL;
  15204.          -- MARKER_TYPE                  : ASF := INDIVIDUAL;
  15205.          -- MARKER_SIZE                  : ASF := INDIVIDUAL;
  15206.          -- MARKER_COLOUR                : ASF := INDIVIDUAL;
  15207.          -- TEXT_FONT_PRECISION          : ASF := INDIVIDUAL;
  15208.          -- CHAR_EXPANSION               : ASF := INDIVIDUAL;
  15209.          -- CHAR_SPACING                 : ASF := INDIVIDUAL;
  15210.          -- TEXT_COLOUR                  : ASF := INDIVIDUAL;
  15211.          -- INTERIOR_STYLE               : ASF := INDIVIDUAL;
  15212.          -- STYLE_INDEX                  : ASF := INDIVIDUAL;
  15213.          -- FILL_AREA_COLOUR             : ASF := INDIVIDUAL;
  15214.      
  15215.          -- Polyline attributes
  15216.      
  15217.          CURRENT_POLYLINE_INDEX  := 1;
  15218.          CURRENT_LINETYPE := 1;
  15219.          CURRENT_LINEWIDTH_SCALE_FACTOR := 1.0;
  15220.          CURRENT_POLYLINE_COLOUR_INDEX  := 1;
  15221.      
  15222.          -- Polymarker attributes
  15223.      
  15224.          CURRENT_POLYMARKER_INDEX := 1;
  15225.          CURRENT_MARKER_TYPE := 3;
  15226.          CURRENT_MARKER_SIZE_SCALE_FACTOR := 1.0;
  15227.          CURRENT_POLYMARKER_COLOUR_INDEX  := 1;
  15228.      
  15229.          -- Text attributes
  15230.      
  15231.          CURRENT_TEXT_INDEX := 1;
  15232.          CURRENT_TEXT_FONT_AND_PRECISION :=
  15233.             (1, STRING_PRECISION);
  15234.          CURRENT_CHAR_EXPANSION_FACTOR := 1.0;
  15235.          CURRENT_CHAR_SPACING := 0.0;
  15236.          CURRENT_TEXT_COLOUR_INDEX := 1;
  15237.      
  15238.          -- The following text attributes are not bundleable.
  15239.      
  15240.          CURRENT_CHAR_HEIGHT := 0.01;
  15241.          CURRENT_CHAR_UP_VECTOR  := (0.0, 1.0);
  15242.          CURRENT_TEXT_PATH  := RIGHT;
  15243.          CURRENT_TEXT_ALIGNMENT := (NORMAL, NORMAL);
  15244.          CURRENT_CHAR_WIDTH := 0.01;
  15245.          CURRENT_CHAR_BASE_VECTOR := (1.0, 0.0);
  15246.      
  15247.          -- Fill area attributes.
  15248.      
  15249.          CURRENT_FILL_AREA_INDEX := 1;
  15250.          CURRENT_FILL_AREA_INTERIOR_STYLE := HOLLOW;
  15251.          CURRENT_FILL_AREA_STYLE_INDEX := 1;
  15252.          CURRENT_FILL_AREA_COLOUR_INDEX := 1;
  15253.      
  15254.          -- Pattern attributes for pattern fills.
  15255.      
  15256.          CURRENT_PATTERN_REFERENCE_POINT := (0.0, 0.0);
  15257.          CURRENT_PATTERN_HEIGHT_VECTOR := (0.0,1.0);
  15258.          CURRENT_PATTERN_WIDTH_VECTOR := (1.0,0.0);
  15259.          CURRENT_NORMALIZATION_TRANSFORMATION := 0;
  15260.      
  15261.          PRIORITY_LIST_OF_TRANSFORMATIONS := (LENGTH => SMALL_NATURAL
  15262.             (GKS_CONFIGURATION.MAX_NORMALIZATION_TRANSFORMATION_NUMBER)
  15263.             + SMALL_NATURAL(1),CONTENTS =>(OTHERS => 0));
  15264.      
  15265.          -- Window and Viewport Attributes.
  15266.      
  15267.          for I in TRANSFORMATION_NUMBER(0)..GKS_CONFIGURATION.
  15268.             MAX_NORMALIZATION_TRANSFORMATION_NUMBER loop
  15269.      
  15270.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(I).WINDOW :=
  15271.                (0.0, 1.0, 0.0, 1.0);
  15272.      
  15273.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(I).VIEWPORT :=
  15274.                (0.0, 1.0, 0.0, 1.0);
  15275.      
  15276.             -- Scale factor and translation factor used to translate
  15277.             -- WC to NDC
  15278.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(I).NDC_FACTORS :=
  15279.                TRANSLATION_FACTORS.GET_NORMALIZATION_FACTORS
  15280.                (LIST_OF_NORMALIZATION_TRANSFORMATIONS(0).WINDOW,
  15281.                LIST_OF_NORMALIZATION_TRANSFORMATIONS(0).VIEWPORT);
  15282.      
  15283.             -- Scale factor and translation factor use to translate
  15284.             -- NDC to WC.
  15285.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(I).WC_FACTORS :=
  15286.                TRANSLATION_FACTORS.GET_NORMALIZATION_FACTORS
  15287.                (LIST_OF_NORMALIZATION_TRANSFORMATIONS(0).VIEWPORT,
  15288.                LIST_OF_NORMALIZATION_TRANSFORMATIONS(0).WINDOW);
  15289.      
  15290.             PRIORITY_LIST_OF_TRANSFORMATIONS.CONTENTS(POSITIVE(1+I)) := I;
  15291.      
  15292.          end loop;
  15293.      
  15294.          -- Clipping attributes
  15295.          CLIP_INDICATOR  := CLIP;
  15296.      
  15297.       end INITIALIZE;
  15298.      
  15299. end GKS_STATE_LIST;
  15300. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15301. --:UDD:GKSADACM:CODE:MA:TRANS_MATH.ADA
  15302. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15303. ------------------------------------------------------------------
  15304. --
  15305. --  NAME: TRANSFORMATION_MATH
  15306. --  IDENTIFIER: GIMXXX.1(2)
  15307. --  DISCREPANCY REPORTS:
  15308. --  DR038  Text height problem with window and viewport.
  15309. ------------------------------------------------------------------
  15310. -- file:   trans_math.ada
  15311. -- levels: ma, 0a, 1a, 2a
  15312.      
  15313. with GKS_TYPES;
  15314.      
  15315. use GKS_TYPES;
  15316.      
  15317. package TRANSFORMATION_MATH is
  15318.      
  15319. -- The package TRANSFORMATION_MATH contains functions to compute
  15320. -- transformations.
  15321.      
  15322.    function WC_TO_NDC
  15323.       (MATRIX : TRANSFORMATION_MATRIX;
  15324.        POINT  : WC.POINT)
  15325.    return NDC.POINT;
  15326.      
  15327.    function WC_TO_NDC
  15328.       (MATRIX : TRANSFORMATION_MATRIX;
  15329.        POINTS : WC.POINT_ARRAY)
  15330.    return NDC.POINT_ARRAY;
  15331.      
  15332.    function NDC_TO_WC
  15333.       (MATRIX : TRANSFORMATION_MATRIX;
  15334.        POINT  : NDC.POINT)
  15335.    return WC.POINT;
  15336.      
  15337.    function NDC_TO_WC
  15338.       (MATRIX : TRANSFORMATION_MATRIX;
  15339.        POINTS : NDC.POINT_ARRAY)
  15340.    return WC.POINT_ARRAY;
  15341.      
  15342.    function WC_TO_NDC
  15343.       (MATRIX : TRANSFORMATION_MATRIX;
  15344.        VECTOR : WC.VECTOR)
  15345.    return NDC.VECTOR;
  15346.      
  15347. end TRANSFORMATION_MATH;
  15348. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15349. --:UDD:GKSADACM:CODE:MA:TRANS_MATH_B.ADA
  15350. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15351. ------------------------------------------------------------------
  15352. --
  15353. --  NAME: TRANSFORMATION_MATH - BODY
  15354. --  IDENTIFIER: GIMXXX.1(2)
  15355. --  DISCREPANCY REPORTS:
  15356. --  DR038  Text height problem with window and viewport.
  15357. ------------------------------------------------------------------
  15358. -- file:   trans_math_b.ada
  15359. -- levels: ma, 0a, 1a, 2a
  15360.      
  15361. package body TRANSFORMATION_MATH is
  15362.      
  15363. -- The package TRANSFORMATION_MATH contains functions to compute
  15364. -- transformations.
  15365.      
  15366.    function WC_TO_NDC
  15367.       (MATRIX : TRANSFORMATION_MATRIX;
  15368.        POINT  : WC.POINT)
  15369.    return NDC.POINT is
  15370.      
  15371.    -- The function WC_TO_NDC translates a world coordinate point into
  15372.    -- a normalized device coordinate point.
  15373.    -- The formula (Scale Factor * Point + Translation Factor) is used.
  15374.    --
  15375.    -- MATRIX - The scale factor and translation factor used in
  15376.    --          translation.
  15377.    --
  15378.    -- POINT - The world coordinate point to translate.
  15379.      
  15380.    begin
  15381.      
  15382.       return ( ( (NDC_TYPE (MATRIX (1,1)) * (NDC_TYPE (POINT.X)))
  15383.                 + NDC_TYPE (MATRIX (1,3)) ),
  15384.                ( (NDC_TYPE (MATRIX (2,2)) * (NDC_TYPE (POINT.Y)))
  15385.                 + NDC_TYPE (MATRIX (2,3)) ) );
  15386.      
  15387.    end WC_TO_NDC;
  15388.      
  15389.    function WC_TO_NDC
  15390.       (MATRIX : TRANSFORMATION_MATRIX;
  15391.        POINTS : WC.POINT_ARRAY)
  15392.    return NDC.POINT_ARRAY is
  15393.      
  15394.    -- The function WC_TO_NDC translates an array of world coordinate
  15395.    -- points into an array of normalized device coordinate points.
  15396.    -- The formula ( Scale Factor * Points + Translation Factor) is used.
  15397.    --
  15398.    -- MATRIX - The scale factor and translation factor used in the
  15399.    --          translation of points.
  15400.    --
  15401.    -- POINTS - The array of points to translate.
  15402.      
  15403.    TEMPORARY : NDC.POINT_ARRAY(POINTS'range);
  15404.    -- The array of points to return.
  15405.      
  15406.    begin
  15407.      
  15408.       -- Translate all of the points.
  15409.       for I in POINTS'range loop
  15410.      
  15411.          TEMPORARY(I) :=  ( ( (NDC_TYPE (MATRIX (1,1)) *
  15412.                                NDC_TYPE (POINTS(I).X))
  15413.                              + NDC_TYPE (MATRIX (1,3)) ),
  15414.                             ( (NDC_TYPE (MATRIX (2,2)) *
  15415.                                NDC_TYPE (POINTS(I).Y))
  15416.                              + NDC_TYPE (MATRIX (2,3)) ) );
  15417.      
  15418.       end loop;
  15419.      
  15420.       return TEMPORARY;
  15421.      
  15422.    end WC_TO_NDC;
  15423.      
  15424.    function NDC_TO_WC
  15425.       (MATRIX  : TRANSFORMATION_MATRIX;
  15426.        POINT   : NDC.POINT)
  15427.    return WC.POINT is
  15428.      
  15429.    -- The function NDC_TO_WC translates a normalized device coordinate
  15430.    -- point into a world coordinate point.
  15431.    -- MATRIX - The scale factor and translation factor used in the
  15432.    --          transformation.
  15433.    -- POINT - The point to transform.
  15434.      
  15435.    begin
  15436.      
  15437.       return ( ( (WC_TYPE (MATRIX (1,1)) * WC_TYPE(POINT.X) )
  15438.                 + WC_TYPE (MATRIX (1,3)) ),
  15439.                ( (WC_TYPE (MATRIX (2,2)) * WC_TYPE(POINT.Y) )
  15440.                 + WC_TYPE (MATRIX (2,3)) ) );
  15441.      
  15442.    end NDC_TO_WC;
  15443.      
  15444.    function NDC_TO_WC
  15445.       (MATRIX  : TRANSFORMATION_MATRIX;
  15446.        POINTS : NDC.POINT_ARRAY)
  15447.    return WC.POINT_ARRAY is
  15448.      
  15449.    -- The function NDC_TO_WC transforms an array of normalized device
  15450.    -- coordinate points into an array of world coordinate points.
  15451.    -- The formula (Scale Factor * Points + Translation Factor) is used.
  15452.    --
  15453.    -- MATRIX - The scale factor and translation factor used in the
  15454.    --          transformation.
  15455.    --
  15456.    -- POINTS - The array of points to transform.
  15457.      
  15458.    TEMPORARY : WC.POINT_ARRAY(POINTS'range);
  15459.    -- The array of points to return.
  15460.      
  15461.    begin
  15462.      
  15463.       -- Translate all of the points.
  15464.       for I in POINTS'range loop
  15465.      
  15466.          TEMPORARY(I) :=  ( ( (WC_TYPE (MATRIX (1,1)) *
  15467.                                WC_TYPE (POINTS(I).X) )
  15468.                              + WC_TYPE (MATRIX (1,3)) ),
  15469.                             ( (WC_TYPE (MATRIX (2,2)) *
  15470.                                WC_TYPE (POINTS(I).Y) )
  15471.                              + WC_TYPE (MATRIX (2,3)) ) );
  15472.      
  15473.       end loop;
  15474.      
  15475.       return TEMPORARY;
  15476.      
  15477.    end NDC_TO_WC;
  15478.      
  15479.    function WC_TO_NDC
  15480.       (MATRIX : TRANSFORMATION_MATRIX;
  15481.        VECTOR : WC.VECTOR)
  15482.    return NDC.VECTOR is
  15483.      
  15484.    -- The function WC_TO_NDC translates a world coordinate vedtor into
  15485.    -- a normalized device coordinate vector.
  15486.    -- The formula (Scale Factor * Vector) is used.
  15487.    --
  15488.    -- MATRIX - The scale factor and translation factor used in
  15489.    --          translation.
  15490.    --
  15491.    -- VECTOR - The world coordinate vector to translate.
  15492.      
  15493.    begin
  15494.      
  15495.       return ( (NDC_TYPE (MATRIX (1,1)) * (NDC_TYPE (VECTOR.X))),
  15496.                (NDC_TYPE (MATRIX (2,2)) * (NDC_TYPE (VECTOR.Y))) );
  15497.      
  15498.    end WC_TO_NDC;
  15499.      
  15500. end TRANSFORMATION_MATH;
  15501. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15502. --:UDD:GKSADACM:CODE:MA:GKS_OPERATING_ST_LST.ADA
  15503. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15504. ------------------------------------------------------------------
  15505. --
  15506. --  NAME: GKS_OPERATING_STATE_LIST
  15507. --  IDENTIFIER: GIMXXX.1(1)
  15508. --  DISCREPANCY REPORTS:
  15509. --
  15510. ------------------------------------------------------------------
  15511. -- file:  gks_operating_st_lst.ada
  15512. -- level: all levels
  15513.      
  15514. with GKS_TYPES;
  15515.      
  15516. use GKS_TYPES;
  15517.      
  15518. package GKS_OPERATING_STATE_LIST is
  15519.      
  15520. -- This package contains the variable for the current operating
  15521. -- state of GKS.
  15522.      
  15523.    CURRENT_OPERATING_STATE : OPERATING_STATE := GKCL;
  15524.      
  15525. end GKS_OPERATING_STATE_LIST;
  15526. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15527. --:UDD:GKSADACM:CODE:MA:GKS_DSCR_TBL_MA.ADA
  15528. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15529. ------------------------------------------------------------------
  15530. --
  15531. --  NAME: GKS_DESCRIPTION_TABLE
  15532. --  IDENTIFIER: GIMXXX.1(1)
  15533. --  DISCREPANCY REPORTS:
  15534. --
  15535. ------------------------------------------------------------------
  15536. -- file:  gks_dscr_tbl_ma.ada
  15537. -- level: ma
  15538.      
  15539. with GKS_CONFIGURATION;
  15540. with GKS_TYPES;
  15541.      
  15542. use GKS_TYPES;
  15543.      
  15544. package GKS_DESCRIPTION_TABLE is
  15545.      
  15546.    LEVEL_OF_GKS               : GKS_LEVEL := LMA;
  15547.      
  15548.    LIST_OF_AVAILABLE_WS_TYPES : WS_TYPES.LIST_OF;
  15549.      
  15550.    MAX_OPEN_WS                : POSITIVE  := GKS_CONFIGURATION
  15551.                                             .MAX_NUMBER_OPEN_WS;
  15552.      
  15553.    MAX_ACTIVE_WS              : POSITIVE  := GKS_CONFIGURATION
  15554.                                             .MAX_NUMBER_ACTIVE_WS;
  15555.      
  15556.    MAX_NORMALIZATION_TRANSFORMATION_NUMBER : TRANSFORMATION_NUMBER
  15557.         := GKS_CONFIGURATION.MAX_NORMALIZATION_TRANSFORMATION_NUMBER;
  15558.      
  15559. end GKS_DESCRIPTION_TABLE;
  15560. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15561. --:UDD:GKSADACM:CODE:MA:GKS_DSCR_TBL_MA_B.ADA
  15562. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15563. ------------------------------------------------------------------
  15564. --
  15565. --  NAME: GKS_DESCRIPTION_TABLE - BODY
  15566. --  IDENTIFIER: GDMXXX.1(2)
  15567. --  DISCREPANCY REPORTS:
  15568. --  DR026  Initialization of list of available ws types fix.
  15569. ------------------------------------------------------------------
  15570. -- file:  gks_dscr_tlb_ma_b.ada
  15571. -- level: ma
  15572.      
  15573. package body GKS_DESCRIPTION_TABLE is
  15574.      
  15575. -- This package body initializes the LIST_OF_AVAILABLE_WS_TYPES
  15576. -- variable listed in the specification part of the package.
  15577.      
  15578. begin
  15579.      
  15580.    WS_TYPES.ADD_TO_LIST
  15581.       (WS_TYPE(GKS_CONFIGURATION.LEXIDATA_3700_OUTPUT_TYPE),
  15582.        LIST_OF_AVAILABLE_WS_TYPES);
  15583.      
  15584. end GKS_DESCRIPTION_TABLE;
  15585. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15586. --:UDD:GKSADACM:CODE:MA:GKS_ERROR_ST_LST.ADA
  15587. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15588. ------------------------------------------------------------------
  15589. --
  15590. --  NAME: GKS_ERROR_STATE_LIST
  15591. --  IDENTIFIER: GDMXXX.1(1)
  15592. --  DISCREPANCY REPORTS:
  15593. --
  15594. ------------------------------------------------------------------
  15595. -- file:  gks_error_st_lst.ada
  15596. -- level: all levels
  15597.      
  15598. with GKS_TYPES;
  15599. with TEXT_IO;
  15600. with GKS_ERRORS;
  15601.      
  15602. use GKS_TYPES;
  15603. use GKS_ERRORS;
  15604.      
  15605. package GKS_ERROR_STATE_LIST is
  15606.      
  15607.    -- Declaration of the logical error file name.  This is necessary
  15608.    -- for the physical creating and opening of the error file in
  15609.    -- OPEN_GKS and ERROR_LOGGING.
  15610.      
  15611.    ERROR_DATA : TEXT_IO.FILE_TYPE;
  15612.      
  15613.    LAST_EI : ERROR_INDICATOR := SUCCESSFUL; -- Error 0
  15614.      
  15615.    LAST_SUBPROGRAM : VARIABLE_SUBPROGRAM_NAME;
  15616.      
  15617. end GKS_ERROR_STATE_LIST;
  15618. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15619. --:UDD:GKSADACM:CODE:MA:SQUARE_ROOT.ADA
  15620. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15621. ------------------------------------------------------------------
  15622. --
  15623. --  NAME: SQUARE_ROOT
  15624. --  IDENTIFIER: GIMXXX.1(1)
  15625. --  DISCREPANCY REPORTS:
  15626. --
  15627. ------------------------------------------------------------------
  15628. -- file:  square_root.ada
  15629. -- level: all levels
  15630.      
  15631. package SQUARE_ROOT is
  15632.      
  15633.    function SQRT
  15634.       (VALUE : float)
  15635.    return float;
  15636.      
  15637. end SQUARE_ROOT;
  15638. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15639. --:UDD:GKSADACM:CODE:MA:SQUARE_ROOT_B.ADA
  15640. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15641. ------------------------------------------------------------------
  15642. --
  15643. --  NAME: SQUARE_ROOT - BODY
  15644. --  IDENTIFIER: GIMXXX.1(1)
  15645. --  DISCREPANCY REPORTS:
  15646. --
  15647. ------------------------------------------------------------------
  15648. -- file:  square_root_b.ada
  15649. -- level: all levels
  15650.      
  15651. package body SQUARE_ROOT is
  15652.      
  15653.    function SQRT
  15654.       (VALUE : float)
  15655.    return float is
  15656.      
  15657.    -- The function SQRT uses the Newton-Raphson method of finding
  15658.    -- the square root.
  15659.    --
  15660.    -- VALUE - The value used to find the square root.
  15661.      
  15662.    R1       : float;
  15663.    -- Check for thrashing.
  15664.      
  15665.    R0       : float := 1.0;
  15666.    -- Initial guess.
  15667.      
  15668.    RESULT   : float := ( VALUE + (R0*R0) ) / (2.0 * R0);
  15669.    -- The final square root.
  15670.      
  15671.    PRECISION : float := 1.0 * 10.0 ** (- float'digits); --float'safe_small;
  15672.    -- The most precision expected in the answer.
  15673.      
  15674.    begin
  15675.      
  15676.       if VALUE <= 0.0 then
  15677.          raise numeric_error;
  15678.       end if;
  15679.      
  15680.       loop
  15681.      
  15682.          R1 := R0;
  15683.          R0 := RESULT;
  15684.          RESULT := ( VALUE + (R0*R0) ) / (2.0*R0);
  15685.      
  15686.          if (abs ((RESULT-R0)/R0) <= PRECISION) or
  15687.             (abs (R1 - RESULT) <= PRECISION) then
  15688.             exit;
  15689.          end if;
  15690.      
  15691.       end loop;
  15692.      
  15693.       return RESULT;
  15694.      
  15695.    end SQRT;
  15696.      
  15697. end SQUARE_ROOT;
  15698. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15699. --:UDD:GKSADACM:CODE:MA:GET_OUTPUT_ATTR.ADA
  15700. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15701. ------------------------------------------------------------------
  15702. --
  15703. --  NAME: GET_OUTPUT_ATTRIBUTES
  15704. --  IDENTIFIER: GIMXXX.1(1)
  15705. --  DISCREPANCY REPORTS:
  15706. --
  15707. ------------------------------------------------------------------
  15708. -- file:  get_output_attr.ada
  15709. -- level: ma - 2a
  15710.      
  15711. with GKS_TYPES;
  15712. with SQUARE_ROOT;
  15713. with OUTPUT_ATTRIBUTES_TYPE;
  15714. with TRANSFORMATION_MATH;
  15715.      
  15716. use GKS_TYPES;
  15717.      
  15718. package GET_OUTPUT_ATTRIBUTES IS
  15719.      
  15720.    procedure GET_ATTRIBUTES
  15721.              (LATEST_OUTPUT_ATTRIBUTES : out OUTPUT_ATTRIBUTES_TYPE.
  15722.                                              OUTPUT_ATTRIBUTES);
  15723.      
  15724. end GET_OUTPUT_ATTRIBUTES;
  15725. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15726. --:UDD:GKSADACM:CODE:MA:GET_OUTPUT_ATTR_B.ADA
  15727. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15728. ------------------------------------------------------------------
  15729. --
  15730. --  NAME: GET_OUTPUT_ATTRIBUTES - BODY
  15731. --  IDENTIFIER: GIMXXX.1(1)
  15732. --  DISCREPANCY REPORTS:
  15733. --
  15734. ------------------------------------------------------------------
  15735. -- file:  get_output_attr_b.ada
  15736. -- level: ma - 2a
  15737.      
  15738. with GKS_STATE_LIST;
  15739.      
  15740. package body GET_OUTPUT_ATTRIBUTES is
  15741.      
  15742.      
  15743.    function WC_VECTOR_TO_NDC_VECTOR
  15744.       (WC_VECTOR : in WC.VECTOR)
  15745.    return NDC.VECTOR is
  15746.      
  15747.    -- The function WC_VECTOR_TO_NDC_VECTOR converts a world coordinate
  15748.    -- vector into a normalized device coordinate vector.  It is
  15749.    -- converted by using the scale factor only.
  15750.    --
  15751.    -- WC_VECTOR - The world coordinate vector to be converted.
  15752.      
  15753.       TEMPORARY_POINT : NDC.VECTOR;
  15754.       -- A temporary holder of the vector to return.
  15755.      
  15756.       begin
  15757.      
  15758.          TEMPORARY_POINT.X :=
  15759.            ( (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  15760.                (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  15761.                 NDC_FACTORS(1,1)) * NDC_TYPE(WC_VECTOR.X) );
  15762.      
  15763.          TEMPORARY_POINT.Y :=
  15764.            ( (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  15765.                (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  15766.                 NDC_FACTORS(2,2)) * NDC_TYPE(WC_VECTOR.Y) );
  15767.      
  15768.          return TEMPORARY_POINT;
  15769.      
  15770.       end WC_VECTOR_TO_NDC_VECTOR;
  15771.      
  15772.    procedure GET_ATTRIBUTES
  15773.              (LATEST_OUTPUT_ATTRIBUTES : out OUTPUT_ATTRIBUTES_TYPE.
  15774.                                              OUTPUT_ATTRIBUTES) is
  15775.    -- The procedure GET_ATTRIBUTES outputs the latest attributes.
  15776.    -- Any WC values are converted to NDC.
  15777.    --
  15778.    -- LATEST_OUTPUT_ATTRIBUTES - The latest attributes to be returned.
  15779.      
  15780.       use WC;
  15781.      
  15782.       TEMP_ATTR : OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  15783.      
  15784.       CHAR_HEIGHT_VECTOR : WC.VECTOR;
  15785.      
  15786.       CHAR_WIDTH_VECTOR : WC.VECTOR;
  15787.      
  15788.       begin
  15789.      
  15790.          TEMP_ATTR.ASPECT_SOURCE_FLAGS := GKS_STATE_LIST.
  15791.                                           CURRENT_ASPECT_SOURCE_FLAGS;
  15792.          -- The following are components with their type of the record
  15793.          -- type ASF_LIST and their default values:
  15794.          -- LINETYPE                     : ASF := INDIVIDUAL;
  15795.          -- LINE_WIDTH                   : ASF := INDIVIDUAL;
  15796.          -- LINE_COLOUR                  : ASF := INDIVIDUAL;
  15797.          -- MARKER_TYPE                  : ASF := INDIVIDUAL;
  15798.          -- MARKER_SIZE                  : ASF := INDIVIDUAL;
  15799.          -- MARKER_COLOUR                : ASF := INDIVIDUAL;
  15800.          -- TEXT_FONT_PRECISION          : ASF := INDIVIDUAL;
  15801.          -- CHAR_EXPANSION               : ASF := INDIVIDUAL;
  15802.          -- CHAR_SPACING                 : ASF := INDIVIDUAL;
  15803.          -- TEXT_COLOUR                  : ASF := INDIVIDUAL;
  15804.          -- INTERIOR_STYLE               : ASF := INDIVIDUAL;
  15805.          -- STYLE_INDEX                  : ASF := INDIVIDUAL;
  15806.          -- FILL_AREA_COLOUR             : ASF := INDIVIDUAL;
  15807.      
  15808.          -- polyline attributes
  15809.      
  15810.          TEMP_ATTR.CURRENT_POLYLINE_INDEX
  15811.                    := GKS_STATE_LIST.CURRENT_POLYLINE_INDEX;
  15812.          TEMP_ATTR.CURRENT_LINETYPE
  15813.                    := GKS_STATE_LIST.CURRENT_LINETYPE;
  15814.          TEMP_ATTR.CURRENT_LINEWIDTH_SCALE_FACTOR
  15815.                    := GKS_STATE_LIST.CURRENT_LINEWIDTH_SCALE_FACTOR;
  15816.          TEMP_ATTR.CURRENT_POLYLINE_COLOUR_INDEX
  15817.                    := GKS_STATE_LIST.CURRENT_POLYLINE_COLOUR_INDEX;
  15818.      
  15819.          -- polymarker attributes
  15820.      
  15821.          TEMP_ATTR.CURRENT_POLYMARKER_INDEX
  15822.                    := GKS_STATE_LIST.CURRENT_POLYMARKER_INDEX;
  15823.          TEMP_ATTR.CURRENT_MARKER_TYPE
  15824.                    := GKS_STATE_LIST.CURRENT_MARKER_TYPE;
  15825.          TEMP_ATTR.CURRENT_MARKER_SIZE_SCALE_FACTOR
  15826.                    := GKS_STATE_LIST.CURRENT_MARKER_SIZE_SCALE_FACTOR;
  15827.          TEMP_ATTR.CURRENT_POLYMARKER_COLOUR_INDEX
  15828.                    := GKS_STATE_LIST.CURRENT_POLYMARKER_COLOUR_INDEX;
  15829.      
  15830.          -- text attributes
  15831.      
  15832.          TEMP_ATTR.CURRENT_TEXT_INDEX
  15833.                    := GKS_STATE_LIST.CURRENT_TEXT_INDEX;
  15834.          TEMP_ATTR.CURRENT_TEXT_FONT_AND_PRECISION
  15835.                    := GKS_STATE_LIST.CURRENT_TEXT_FONT_AND_PRECISION;
  15836.          TEMP_ATTR.CURRENT_CHAR_EXPANSION_FACTOR
  15837.                    := GKS_STATE_LIST.CURRENT_CHAR_EXPANSION_FACTOR;
  15838.          TEMP_ATTR.CURRENT_CHAR_SPACING
  15839.                    := GKS_STATE_LIST.CURRENT_CHAR_SPACING;
  15840.          TEMP_ATTR.CURRENT_TEXT_COLOUR_INDEX
  15841.                    := GKS_STATE_LIST.CURRENT_TEXT_COLOUR_INDEX;
  15842.      
  15843.          -- the following text attributes are not bundleable.
  15844.      
  15845.          -- the following calculations compute the character
  15846.          -- height and base vectors, then do the transformations
  15847.          -- from WC to NDC
  15848.      
  15849.          CHAR_HEIGHT_VECTOR.X := WC_TYPE(FLOAT(GKS_STATE_LIST.
  15850.            CURRENT_CHAR_HEIGHT) * FLOAT(GKS_STATE_LIST.
  15851.            CURRENT_CHAR_UP_VECTOR.X) / SQUARE_ROOT.SQRT
  15852.            (FLOAT(GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.X ** 2
  15853.            + GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.Y ** 2)));
  15854.      
  15855.          CHAR_HEIGHT_VECTOR.Y := WC_TYPE(FLOAT(GKS_STATE_LIST.
  15856.              CURRENT_CHAR_HEIGHT) * FLOAT(GKS_STATE_LIST.
  15857.              CURRENT_CHAR_UP_VECTOR.Y) / SQUARE_ROOT.SQRT
  15858.              (FLOAT(GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.X ** 2
  15859.              + GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.Y ** 2)));
  15860.      
  15861.          CHAR_WIDTH_VECTOR.X := WC_TYPE(FLOAT(GKS_STATE_LIST.
  15862.              CURRENT_CHAR_WIDTH) * FLOAT(GKS_STATE_LIST.
  15863.              CURRENT_CHAR_BASE_VECTOR.X) / SQUARE_ROOT.SQRT
  15864.              (FLOAT(GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  15865.              + GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2)));
  15866.      
  15867.          CHAR_WIDTH_VECTOR.Y := WC_TYPE(FLOAT(GKS_STATE_LIST.
  15868.              CURRENT_CHAR_WIDTH) * FLOAT(GKS_STATE_LIST.
  15869.              CURRENT_CHAR_BASE_VECTOR.Y) / SQUARE_ROOT.SQRT
  15870.              (FLOAT(GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  15871.              + GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2)));
  15872.      
  15873.          TEMP_ATTR.CURRENT_CHAR_HEIGHT_VECTOR := NDC.VECTOR
  15874.             (TRANSFORMATION_MATH.WC_TO_NDC(GKS_STATE_LIST.
  15875.             LIST_OF_NORMALIZATION_TRANSFORMATIONS
  15876.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  15877.             NDC_FACTORS, POINT(CHAR_HEIGHT_VECTOR)));
  15878.      
  15879.          TEMP_ATTR.CURRENT_CHAR_WIDTH_VECTOR := NDC.VECTOR
  15880.             (TRANSFORMATION_MATH.WC_TO_NDC(GKS_STATE_LIST.
  15881.             LIST_OF_NORMALIZATION_TRANSFORMATIONS
  15882.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  15883.             NDC_FACTORS, POINT(CHAR_WIDTH_VECTOR)));
  15884.      
  15885.          TEMP_ATTR.CURRENT_TEXT_PATH
  15886.                    := GKS_STATE_LIST.CURRENT_TEXT_PATH;
  15887.          TEMP_ATTR.CURRENT_TEXT_ALIGNMENT
  15888.                    := GKS_STATE_LIST.CURRENT_TEXT_ALIGNMENT;
  15889.      
  15890.          -- fill area attributes.
  15891.      
  15892.          TEMP_ATTR.CURRENT_FILL_AREA_INDEX
  15893.                    := GKS_STATE_LIST.CURRENT_FILL_AREA_INDEX;
  15894.          TEMP_ATTR.CURRENT_FILL_AREA_INTERIOR_STYLE
  15895.                    := GKS_STATE_LIST.CURRENT_FILL_AREA_INTERIOR_STYLE;
  15896.          TEMP_ATTR.CURRENT_FILL_AREA_STYLE_INDEX
  15897.                    := GKS_STATE_LIST.CURRENT_FILL_AREA_STYLE_INDEX;
  15898.          TEMP_ATTR.CURRENT_FILL_AREA_COLOUR_INDEX
  15899.                    := GKS_STATE_LIST.CURRENT_FILL_AREA_COLOUR_INDEX;
  15900.      
  15901.          -- pattern attributes for pattern fills.
  15902.      
  15903.          TEMP_ATTR.CURRENT_PATTERN_REFERENCE_POINT
  15904.                    := TRANSFORMATION_MATH.WC_TO_NDC
  15905.               ( ( GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  15906.                  (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  15907.                   NDC_FACTORS ),
  15908.                 ( GKS_STATE_LIST.CURRENT_PATTERN_REFERENCE_POINT ) );
  15909.          TEMP_ATTR.CURRENT_PATTERN_HEIGHT_VECTOR
  15910.                    := WC_VECTOR_TO_NDC_VECTOR
  15911.                          (GKS_STATE_LIST.CURRENT_PATTERN_HEIGHT_VECTOR);
  15912.          TEMP_ATTR.CURRENT_PATTERN_WIDTH_VECTOR
  15913.                    := WC_VECTOR_TO_NDC_VECTOR
  15914.                          (GKS_STATE_LIST.CURRENT_PATTERN_WIDTH_VECTOR);
  15915.      
  15916.          -- clipping attributes
  15917.      
  15918.          -- used for clipping to NDC space. The points are the lower
  15919.          -- left corner and the upper right corner.
  15920.      
  15921.          TEMP_ATTR.CLIPPING_RECTANGLE
  15922.                    := GKS_STATE_LIST.
  15923.                       LIST_OF_NORMALIZATION_TRANSFORMATIONS
  15924.                       (GKS_STATE_LIST.
  15925.                        CURRENT_NORMALIZATION_TRANSFORMATION).VIEWPORT;
  15926.      
  15927.          -- Initialize the output attribute list.
  15928.          LATEST_OUTPUT_ATTRIBUTES := TEMP_ATTR;
  15929.      
  15930.       end GET_ATTRIBUTES;
  15931.      
  15932.    end GET_OUTPUT_ATTRIBUTES;
  15933. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15934. --:UDD:GKSADACM:CODE:MA:SET_INDV_ATTR_MA_B.ADA
  15935. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15936. ------------------------------------------------------------------
  15937. --
  15938. --  NAME: SET_INDIVIDUAL_ATTRIBUTES - BODY
  15939. --  IDENTIFIER: GIMXXX.1(1)
  15940. --  DISCREPANCY REPORTS:
  15941. --
  15942. ------------------------------------------------------------------
  15943. -- file:  set_indv_attr_ma_b.ada
  15944. -- level: all levels
  15945.      
  15946. with WSM;
  15947. with CGI;
  15948. with ERROR_ROUTINES;
  15949. with GKS_OPERATING_STATE_LIST;
  15950. with GKS_ERRORS;
  15951. with GKS_STATE_LIST;
  15952.      
  15953. use WSM;
  15954. use CGI;
  15955. use ERROR_ROUTINES;
  15956. use GKS_OPERATING_STATE_LIST;
  15957. use GKS_ERRORS;
  15958.      
  15959. package body SET_INDIVIDUAL_ATTRIBUTES_MA is
  15960.      
  15961. -- This is the package body for setting individual attributes.
  15962. --
  15963. -- All of the procedures in this package first inquire the
  15964. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of
  15965. -- the states GKOP, WSOP, WSAC, or SGOP.  If it is not, error
  15966. -- 8 occurs and the procedure raises the exception STATE_
  15967. -- ERROR.  No error indicators above 0 are expected from the
  15968. -- workstation manager for these procedures.
  15969. --
  15970. -- If error indicator 8 occurs, these procedures call the
  15971. -- ERROR_LOGGING procedure of the package ERROR_ROUTINES
  15972. -- to log the error indicator and the name of the procedure
  15973. -- in the error file specified when the procedure OPEN_GKS
  15974. -- was called to begin this session of GKS operation.
  15975.      
  15976.    procedure SET_LINETYPE
  15977.       (LINE : in LINETYPE) is
  15978.      
  15979.    -- This procedure sets the value of the current linetype in the
  15980.    -- GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  15981.    --
  15982.    -- LINE - Indicates the line style to be used for subsequent
  15983.    --    polylines.
  15984.      
  15985.    GKS_INSTR : CGI_SET_LINETYPE;
  15986.      
  15987.    begin
  15988.      
  15989.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  15990.       -- to see if GKS is in the proper state before proceeding.
  15991.      
  15992.       if CURRENT_OPERATING_STATE = GKCL then
  15993.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  15994.                         "SET_LINETYPE");               -- Error 8
  15995.          raise STATE_ERROR;
  15996.      
  15997.       elsif LINE = 0 then
  15998.          ERROR_LOGGING (LINETYPE_IS_ZERO,
  15999.                         "SET_LINETYPE");               -- Error 63
  16000.          raise OUTPUT_ATTRIBUTE_ERROR;
  16001.      
  16002.       else
  16003.          GKS_STATE_LIST.CURRENT_LINETYPE := LINE;
  16004.      
  16005.          -- Call to WS_MANAGER with the new line type.
  16006.          GKS_INSTR.LINETYPE_SET := LINE;
  16007.          WS_MANAGER (GKS_INSTR);
  16008.      
  16009.       end if;
  16010.      
  16011.       exception
  16012.          when STATE_ERROR =>
  16013.             raise;
  16014.          when OUTPUT_ATTRIBUTE_ERROR =>
  16015.             raise;
  16016.          when OTHERS =>
  16017.             ERROR_LOGGING (UNKNOWN, "SET_LINETYPE");    -- Error 2501
  16018.             raise;
  16019.      
  16020.    end SET_LINETYPE;
  16021.      
  16022.    procedure SET_POLYLINE_COLOUR_INDEX
  16023.       (COLOUR : in COLOUR_INDEX) is
  16024.      
  16025.    -- This procedure sets the value of the current polyline colour
  16026.    -- index GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  16027.    --
  16028.    -- COLOUR - Indicates the colour to be used for subsequent polylines.
  16029.      
  16030.    GKS_INSTR : CGI_SET_POLYLINE_COLOUR_INDEX;
  16031.      
  16032.    begin
  16033.      
  16034.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16035.       -- to see if GKS is in the proper state before proceeding.
  16036.      
  16037.       if CURRENT_OPERATING_STATE = GKCL then
  16038.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  16039.                         "SET_POLYLINE_COLOUR_INDEX");      -- Error 8
  16040.          raise STATE_ERROR;
  16041.       else
  16042.          GKS_STATE_LIST.CURRENT_POLYLINE_COLOUR_INDEX := COLOUR;
  16043.      
  16044.          -- Call to WS_MANAGER with the new line colour.
  16045.      
  16046.          GKS_INSTR.POLYLINE_COLOUR_INDEX_SET := COLOUR;
  16047.          WS_MANAGER (GKS_INSTR);
  16048.      
  16049.       end if;
  16050.      
  16051.       exception
  16052.          when STATE_ERROR =>
  16053.             raise;
  16054.          when OTHERS =>
  16055.             ERROR_LOGGING (UNKNOWN,
  16056.                            "SET_POLYLINE_COLOUR_INDEX"); -- Error 2501
  16057.             raise;
  16058.      
  16059.    end SET_POLYLINE_COLOUR_INDEX;
  16060.      
  16061.    procedure SET_MARKER_TYPE
  16062.       (MARKER : in MARKER_TYPE) is
  16063.      
  16064.    -- This procedure sets the value of the current marker type in
  16065.    -- the GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  16066.    --
  16067.    -- MARKER - Indicates the marker style to be used for subsequent
  16068.    --    polymarkers.
  16069.      
  16070.    GKS_INSTR : CGI_SET_MARKER_TYPE;
  16071.      
  16072.    begin
  16073.      
  16074.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16075.       -- to see if GKS is in the proper state before proceeding.
  16076.      
  16077.       if CURRENT_OPERATING_STATE = GKCL then
  16078.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  16079.                         "SET_MARKER_TYPE");          -- Error 8
  16080.          raise STATE_ERROR;
  16081.      
  16082.       elsif MARKER = 0 then
  16083.          ERROR_LOGGING (MARKER_TYPE_IS_ZERO,
  16084.                         "SET_MARKER_TYPE");          -- Error 69
  16085.          raise OUTPUT_ATTRIBUTE_ERROR;
  16086.      
  16087.       else
  16088.          GKS_STATE_LIST.CURRENT_MARKER_TYPE := MARKER;
  16089.      
  16090.          -- Call to WS_MANAGER with the new marker type.
  16091.      
  16092.          GKS_INSTR.MARKER_TYPE_SET := MARKER;
  16093.          WS_MANAGER (GKS_INSTR);
  16094.       end if;
  16095.      
  16096.       exception
  16097.          when STATE_ERROR =>
  16098.             raise;
  16099.          when OUTPUT_ATTRIBUTE_ERROR =>
  16100.             raise;
  16101.          when OTHERS =>
  16102.             ERROR_LOGGING (UNKNOWN, "SET_MARKER_TYPE");  -- Error 2501
  16103.             raise;
  16104.      
  16105.    end SET_MARKER_TYPE;
  16106.      
  16107.    procedure SET_POLYMARKER_COLOUR_INDEX
  16108.       (COLOUR : in COLOUR_INDEX) is
  16109.      
  16110.    -- This procedure sets the value of the current polymarker
  16111.    -- colour index in the GKS_STATE_LIST and then sends the
  16112.    -- value to the WS_MANAGER.
  16113.    --
  16114.    -- COLOUR - Indicates the colour to be used for subsequent
  16115.    --    polymarkers.
  16116.      
  16117.    GKS_INSTR : CGI_SET_POLYMARKER_COLOUR_INDEX;
  16118.      
  16119.    begin
  16120.      
  16121.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16122.       -- to see if GKS is in the proper state before proceeding.
  16123.      
  16124.       if CURRENT_OPERATING_STATE = GKCL then
  16125.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  16126.                         "SET_POLYMARKER_COLOUR_INDEX");   -- Error 8
  16127.          raise STATE_ERROR;
  16128.      
  16129.       else
  16130.      
  16131.          GKS_STATE_LIST.CURRENT_POLYMARKER_COLOUR_INDEX := COLOUR;
  16132.      
  16133.          -- Call to WS_MANAGER with the new marker colour.
  16134.      
  16135.          GKS_INSTR.POLYMARKER_COLOUR_INDEX_SET := COLOUR;
  16136.          WS_MANAGER (GKS_INSTR);
  16137.      
  16138.       end if;
  16139.      
  16140.       exception
  16141.          when STATE_ERROR =>
  16142.             raise;
  16143.          when OTHERS =>
  16144.             ERROR_LOGGING (UNKNOWN,
  16145.                            "SET_POLYMARKER_COLOUR_INDEX"); -- Error 2501
  16146.             raise;
  16147.      
  16148.    end SET_POLYMARKER_COLOUR_INDEX;
  16149.      
  16150.    procedure SET_TEXT_COLOUR_INDEX
  16151.       (COLOUR : in COLOUR_INDEX) is
  16152.      
  16153.    -- This procedure sets the value of the current text colour index
  16154.    -- in the GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  16155.    --
  16156.    -- COLOUR - Indicates the colour of subsequent text primitives.
  16157.      
  16158.    GKS_INSTR : CGI_SET_TEXT_COLOUR_INDEX;
  16159.      
  16160.    begin
  16161.      
  16162.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16163.       -- to see if GKS is in the proper state before proceeding.
  16164.      
  16165.       if CURRENT_OPERATING_STATE = GKCL then
  16166.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  16167.                         "SET_TEXT_COLOUR_INDEX");       -- Error 8
  16168.          raise STATE_ERROR;
  16169.       else
  16170.      
  16171.          GKS_STATE_LIST.CURRENT_TEXT_COLOUR_INDEX := COLOUR;
  16172.      
  16173.          -- Call to WS_MANAGER with the new text colour.
  16174.      
  16175.          GKS_INSTR.TEXT_COLOUR_INDEX_SET := COLOUR;
  16176.          WS_MANAGER (GKS_INSTR);
  16177.      
  16178.       end if;
  16179.      
  16180.       exception
  16181.          when STATE_ERROR =>
  16182.             raise;
  16183.          when OTHERS =>
  16184.             ERROR_LOGGING (UNKNOWN,
  16185.                            "SET_TEXT_COLOUR_INDEX");   -- Error 2501
  16186.             raise;
  16187.      
  16188.    end SET_TEXT_COLOUR_INDEX;
  16189.      
  16190.    procedure SET_FILL_AREA_INTERIOR_STYLE
  16191.       (STYLE : in INTERIOR_STYLE) is
  16192.      
  16193.    -- This procedure sets the value of the current fill area interior
  16194.    -- style in the GKS_STATE_LIST and then sends the value to the
  16195.    -- WS_MANAGER.
  16196.    --
  16197.    -- STYLE - Indicates the interior style to be used for fill area
  16198.    --    primitives.  The values may be HOLLOW, SOLID, PATTERN, or
  16199.    --    HATCH.
  16200.      
  16201.    GKS_INSTR : CGI_SET_FILL_AREA_INTERIOR_STYLE;
  16202.      
  16203.    begin
  16204.      
  16205.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16206.       -- to see if GKS is in the proper state before proceeding.
  16207.      
  16208.       if CURRENT_OPERATING_STATE = GKCL then
  16209.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  16210.                          "SET_FILL_AREA_INTERIOR_STYLE"); -- Error 8
  16211.          raise STATE_ERROR;
  16212.       else
  16213.          GKS_STATE_LIST.CURRENT_FILL_AREA_INTERIOR_STYLE := STYLE;
  16214.      
  16215.          -- Call to WS_MANAGER with the new interior style.
  16216.      
  16217.          GKS_INSTR.FILL_AREA_INTERIOR_STYLE_SET := STYLE;
  16218.          WS_MANAGER (GKS_INSTR);
  16219.      
  16220.       end if;
  16221.      
  16222.       exception
  16223.          when STATE_ERROR =>
  16224.             raise;
  16225.          when OTHERS =>
  16226.             ERROR_LOGGING (UNKNOWN,
  16227.                            "SET_FILL_AREA_INTERIOR_STYLE"); -- Error 2501
  16228.             raise;
  16229.      
  16230.    end SET_FILL_AREA_INTERIOR_STYLE;
  16231.      
  16232.    procedure SET_FILL_AREA_COLOUR_INDEX
  16233.       (COLOUR : in COLOUR_INDEX) is
  16234.      
  16235.    -- This procedure sets the value of the current fill area colour
  16236.    -- index in the GKS_STATE_LIST and then sends the value to the
  16237.    -- WS_MANAGER.
  16238.    --
  16239.    -- COLOUR - Indicates the colour to be used in subsequent
  16240.    --    fill area primitives.
  16241.      
  16242.    GKS_INSTR : CGI_SET_FILL_AREA_COLOUR_INDEX;
  16243.      
  16244.    begin
  16245.      
  16246.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16247.       -- to see if GKS is in the proper state before proceeding.
  16248.      
  16249.       if CURRENT_OPERATING_STATE = GKCL then
  16250.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  16251.                         "SET_FILL_AREA_COLOUR_INDEX");  -- Error 8
  16252.          raise STATE_ERROR;
  16253.      
  16254.       else
  16255.          GKS_STATE_LIST.CURRENT_FILL_AREA_COLOUR_INDEX := COLOUR;
  16256.      
  16257.          -- Call to WS_MANAGER with the new fill area colour.
  16258.      
  16259.          GKS_INSTR.FILL_AREA_COLOUR_INDEX_SET := COLOUR;
  16260.          WS_MANAGER (GKS_INSTR);
  16261.      
  16262.       end if;
  16263.      
  16264.       exception
  16265.          when STATE_ERROR =>
  16266.             raise;
  16267.          when OTHERS =>
  16268.             ERROR_LOGGING (UNKNOWN,
  16269.                            "SET_FILL_AREA_COLOUR_INDEX"); -- Error 2501
  16270.             raise;
  16271.      
  16272.    end SET_FILL_AREA_COLOUR_INDEX;
  16273.      
  16274. end SET_INDIVIDUAL_ATTRIBUTES_MA;
  16275. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16276. --:UDD:GKSADACM:CODE:MA:SET_PRIM_ATTR_MA_B.ADA
  16277. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16278. ------------------------------------------------------------------
  16279. --
  16280. --  NAME: SET_PRIMITIVE_ATTRIBUTES_MA - BODY
  16281. --  IDENTIFIER: GIMXXX.1(2)
  16282. --  DISCREPANCY REPORTS:
  16283. --  DR038  Text height problem with window and viewport.
  16284. ------------------------------------------------------------------
  16285. -- file:  set_prim_attr_ma_b.ada
  16286. -- levels: all levels
  16287.      
  16288. with WSM;
  16289. with CGI;
  16290. with ERROR_ROUTINES;
  16291. with GKS_OPERATING_STATE_LIST;
  16292. with GKS_ERRORS;
  16293. with GKS_STATE_LIST;
  16294. with TRANSFORMATION_MATH;
  16295. with SQUARE_ROOT;
  16296.      
  16297. use WSM;
  16298. use CGI;
  16299. use ERROR_ROUTINES;
  16300. use GKS_OPERATING_STATE_LIST;
  16301. use GKS_ERRORS;
  16302.      
  16303. package body SET_PRIMITIVE_ATTRIBUTES_MA is
  16304.      
  16305. -- This is the package body for the procedures to set the
  16306. -- primitive attribute values for level ma.
  16307. --
  16308. -- Each of the procedures in this package inquires the
  16309. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of
  16310. -- the states GKOP, WSOP, WSAC, or SGOP.  If it is not,
  16311. -- error 8 occurs and the procedure raises the exception
  16312. -- STATE_ERROR.
  16313. --
  16314. -- If an error indicator 8 occurs, these procedures call the
  16315. -- ERROR_LOGGING procedure of the package ERROR_ROUTINES
  16316. -- to log the error indicator and the name of the procedure
  16317. -- in the error file specified when the procedure OPEN_GKS
  16318. -- was called to begin this session of GKS operation.
  16319.      
  16320.    procedure SET_CHAR_HEIGHT
  16321.       (HEIGHT : in WC.MAGNITUDE) is
  16322.      
  16323.    -- This procedure sets the value of the current character height in
  16324.    -- the GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  16325.    --
  16326.    -- HEIGHT - Indicates the nominal height of the capital letter
  16327.    --    character.
  16328.      
  16329.    use WC;
  16330.    -- For visiblity to the types and operations on the types
  16331.    -- in the GKS_COORDINATE_SYSTEM.
  16332.      
  16333.    CHAR_HEIGHT_VECTOR : WC.VECTOR;
  16334.    CHAR_WIDTH_VECTOR  : WC.VECTOR;
  16335.    -- The above two objects are used to hold the vectors that are
  16336.    -- calculated in world coordinates prior to being transformed
  16337.    -- and sent to the WS_MANAGER.
  16338.      
  16339.    GKS_INSTR : CGI_SET_CHAR_VECTORS;
  16340.      
  16341.    begin
  16342.      
  16343.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16344.       -- to see if GKS is in the proper state before proceeding.
  16345.      
  16346.       if CURRENT_OPERATING_STATE = GKCL then
  16347.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  16348.                         "SET_CHAR_HEIGHT");        -- Error 8
  16349.          raise STATE_ERROR;
  16350.       else
  16351.      
  16352.          GKS_STATE_LIST.CURRENT_CHAR_HEIGHT := HEIGHT;
  16353.          GKS_STATE_LIST.CURRENT_CHAR_WIDTH := HEIGHT;
  16354.      
  16355.       -- The following finds the size of the vectors for the
  16356.       -- character height and width.
  16357.      
  16358.       -- The formula for the character height is:
  16359.       -- wc.vector = (current character height) *
  16360.       -- (current character up vector)/
  16361.       -- (the magnitude of the character up vector).
  16362.      
  16363.       CHAR_HEIGHT_VECTOR.X := WC_TYPE (float(HEIGHT) *
  16364.          (float (GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.X)
  16365.          / SQUARE_ROOT.SQRT (float
  16366.          (GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.X ** 2
  16367.          + GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.Y ** 2))));
  16368.      
  16369.      
  16370.       CHAR_HEIGHT_VECTOR.Y := WC_TYPE (float(HEIGHT) *
  16371.          (float(GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.Y)
  16372.          / SQUARE_ROOT.SQRT (float
  16373.          (GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.X ** 2
  16374.          + GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.Y ** 2))));
  16375.      
  16376.       -- The formula for the character width is:
  16377.       -- wc.vector = (current character width) *
  16378.       -- (current character base vector)/
  16379.       -- (the magnitude of the character base vector).
  16380.       -- Remembering that the current character width is equal to
  16381.       -- the parameter HEIGHT that was passed in, the formula
  16382.       -- is used below.
  16383.      
  16384.       CHAR_WIDTH_VECTOR.X := WC_TYPE (float(HEIGHT) *
  16385.          (float(GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X)
  16386.          / SQUARE_ROOT.SQRT (float
  16387.          (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  16388.          + GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2))));
  16389.      
  16390.       CHAR_WIDTH_VECTOR.Y := WC_TYPE (float(HEIGHT) *
  16391.          (float (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y)
  16392.          / SQUARE_ROOT.SQRT (float
  16393.          (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  16394.          + GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2))));
  16395.      
  16396.       -- Transform the WC vectors to NDC
  16397.       GKS_INSTR.CHAR_HEIGHT_VECTOR_SET := TRANSFORMATION_MATH.WC_TO_NDC
  16398.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  16399.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  16400.          NDC_FACTORS, CHAR_HEIGHT_VECTOR);
  16401.      
  16402.       GKS_INSTR.CHAR_WIDTH_VECTOR_SET := TRANSFORMATION_MATH.WC_TO_NDC
  16403.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  16404.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  16405.          NDC_FACTORS, CHAR_WIDTH_VECTOR);
  16406.      
  16407.          -- Call to WS_MANAGER with the new character height vector
  16408.          -- and the new character width vector.
  16409.          WS_MANAGER (GKS_INSTR);
  16410.      
  16411.       end if;
  16412.      
  16413.       exception
  16414.          when STATE_ERROR =>
  16415.             raise;
  16416.          when NUMERIC_ERROR =>
  16417.             ERROR_LOGGING (ARITHMETIC, "SET_CHAR_HEIGHT"); -- Error 308
  16418.             raise SYSTEM_ERROR;
  16419.          when OTHERS =>
  16420.             ERROR_LOGGING (UNKNOWN, "SET_CHAR_HEIGHT");  -- Error 2501
  16421.             raise;
  16422.      
  16423.    end SET_CHAR_HEIGHT;
  16424.      
  16425.    procedure SET_CHAR_UP_VECTOR
  16426.       (CHAR_UP_VECTOR : in WC.VECTOR) is
  16427.      
  16428.      
  16429.    -- This procedure sets the value of the current character up vector
  16430.    -- in the GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  16431.    --
  16432.    -- If the workstation manager returns error 79, this procedure
  16433.    -- raises OUTPUT_ATTRIBUTE_ERROR.
  16434.    --
  16435.    -- CHAR_UP_VECTOR - Indicates the up direction of the character.
  16436.      
  16437.   GKS_INSTR : CGI_SET_CHAR_VECTORS;
  16438.      
  16439.    use WC;
  16440.    -- For visiblity to the types and operations on the types
  16441.    -- in the GKS_COORDINATE_SYSTEM.
  16442.      
  16443.    CHAR_HEIGHT_VECTOR : WC.VECTOR;
  16444.    CHAR_WIDTH_VECTOR  : WC.VECTOR;
  16445.    -- The above two objects are used to hold the vectors that are
  16446.    -- calculated in world coordinates prior to being transformed
  16447.    -- and sent to the WS_MANAGER.
  16448.      
  16449.    begin
  16450.      
  16451.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16452.       -- to see if GKS is in the proper state before proceeding.
  16453.      
  16454.       if CURRENT_OPERATING_STATE = GKCL then
  16455.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  16456.                         "SET_CHAR_UP_VECTOR");        -- Error 8
  16457.          raise STATE_ERROR;
  16458.      
  16459.       elsif (CHAR_UP_VECTOR.X = 0.0) and
  16460.             (CHAR_UP_VECTOR.Y = 0.0) then
  16461.          ERROR_LOGGING (CHAR_UP_VECTOR_IS_ZERO,
  16462.                         "SET_CHAR_UP_VECTOR");        -- Error 79
  16463.          raise OUTPUT_ATTRIBUTE_ERROR;
  16464.      
  16465.       else
  16466.      
  16467.          GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR := CHAR_UP_VECTOR;
  16468.      
  16469.          -- Compute a vector at right angles to the CHAR_UP_VECTOR
  16470.          -- to be used for the CURRENT_CHAR_BASE_VECTOR.
  16471.      
  16472.          GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR :=
  16473.                                   (CHAR_UP_VECTOR.Y,-CHAR_UP_VECTOR.X);
  16474.      
  16475.       -- The following finds the size of the vectors for the
  16476.       -- character height and width using the new character up vector.
  16477.      
  16478.       -- The formula for the character height is:
  16479.       -- wc.vector = (current character height) *
  16480.       -- (current character up vector)/
  16481.       -- (the magnitude of the character up vector).
  16482.      
  16483.      
  16484.       CHAR_HEIGHT_VECTOR.X := WC_TYPE
  16485.            (float(GKS_STATE_LIST.CURRENT_CHAR_HEIGHT)
  16486.          * (float(CHAR_UP_VECTOR.X)
  16487.          / SQUARE_ROOT.SQRT (float
  16488.          (CHAR_UP_VECTOR.X ** 2 + CHAR_UP_VECTOR.Y ** 2))));
  16489.      
  16490.       CHAR_HEIGHT_VECTOR.Y := WC_TYPE
  16491.            (float (GKS_STATE_LIST.CURRENT_CHAR_HEIGHT)
  16492.          * (float (CHAR_UP_VECTOR.Y)
  16493.          / SQUARE_ROOT.SQRT (float
  16494.          (CHAR_UP_VECTOR.X ** 2 + CHAR_UP_VECTOR.Y ** 2))));
  16495.      
  16496.       -- The formula for the character width is:
  16497.       -- wc.vector = (current character width) *
  16498.       -- (current character base vector)/
  16499.       -- (the magnitude of the character base vector).
  16500.      
  16501.       CHAR_WIDTH_VECTOR.X := WC_TYPE
  16502.            (float (GKS_STATE_LIST.CURRENT_CHAR_WIDTH)
  16503.          * (float (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X)
  16504.          /  SQUARE_ROOT.SQRT (float
  16505.            (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  16506.          +  GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2))));
  16507.      
  16508.       CHAR_WIDTH_VECTOR.Y := WC_TYPE
  16509.            (float (GKS_STATE_LIST.CURRENT_CHAR_WIDTH)
  16510.          * (float (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y)
  16511.          /  SQUARE_ROOT.SQRT (float
  16512.            (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  16513.          +  GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2))));
  16514.      
  16515.       -- Transform the WC vectors to NDC
  16516.       GKS_INSTR.CHAR_HEIGHT_VECTOR_SET := TRANSFORMATION_MATH.WC_TO_NDC
  16517.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  16518.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  16519.          NDC_FACTORS, CHAR_HEIGHT_VECTOR);
  16520.      
  16521.       GKS_INSTR.CHAR_WIDTH_VECTOR_SET := TRANSFORMATION_MATH.WC_TO_NDC
  16522.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  16523.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  16524.          NDC_FACTORS, CHAR_WIDTH_VECTOR);
  16525.      
  16526.       WS_MANAGER(GKS_INSTR);
  16527.      
  16528.       end if;
  16529.      
  16530.       exception
  16531.          when STATE_ERROR =>
  16532.             raise;
  16533.          when OUTPUT_ATTRIBUTE_ERROR =>
  16534.             raise;
  16535.          when NUMERIC_ERROR =>
  16536.             ERROR_LOGGING(ARITHMETIC,"SET_CHAR_UP_VECTOR"); -- Error 308
  16537.             raise SYSTEM_ERROR;
  16538.          when OTHERS =>
  16539.             ERROR_LOGGING(UNKNOWN, "SET_CHAR_UP_VECTOR");  -- Error 2501
  16540.             raise;
  16541.      
  16542.    end SET_CHAR_UP_VECTOR;
  16543.      
  16544.    procedure SET_TEXT_ALIGNMENT
  16545.       (ALIGNMENT : in TEXT_ALIGNMENT) is
  16546.      
  16547.    -- This procedure sets the value of the current text alignment in
  16548.    -- the GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  16549.    --
  16550.    -- ALIGNMENT - Indicates the positioning of the text extent
  16551.    --    rectangle in relation to the text position. It is a
  16552.    --    record with a HORIZONTAL component and a VERTICAL
  16553.    --    component.
  16554.      
  16555.    GKS_INSTR : CGI_SET_TEXT_ALIGNMENT;
  16556.      
  16557.    begin
  16558.      
  16559.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16560.       -- to see if GKS is in the proper state before proceeding.
  16561.      
  16562.       if CURRENT_OPERATING_STATE = GKCL then
  16563.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  16564.                         "SET_TEXT_ALIGNMENT");      -- Error 8
  16565.          raise STATE_ERROR;
  16566.       else
  16567.      
  16568.          GKS_STATE_LIST.CURRENT_TEXT_ALIGNMENT := ALIGNMENT;
  16569.      
  16570.          -- Call to WS_MANAGER with the new text alignment.
  16571.      
  16572.          GKS_INSTR.TEXT_ALIGNMENT_SET := ALIGNMENT;
  16573.          WS_MANAGER (GKS_INSTR);
  16574.      
  16575.       end if;
  16576.      
  16577.       exception
  16578.          when STATE_ERROR =>
  16579.             raise;
  16580.          when OTHERS =>
  16581.             ERROR_LOGGING (UNKNOWN, "SET_TEXT_ALIGNMENT"); -- Error 2501
  16582.             raise;
  16583.      
  16584.    end SET_TEXT_ALIGNMENT;
  16585.      
  16586. end SET_PRIMITIVE_ATTRIBUTES_MA ;
  16587. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16588. --:UDD:GKSADACM:CODE:MA:INQ_PRIM_ATTR_B.ADA
  16589. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16590. ------------------------------------------------------------------
  16591. --
  16592. --  NAME: INQ_PRIMITIVE_ATTRIBUTES
  16593. --  IDENTIFIER: GIMXXX.1(1)
  16594. --  DISCREPANCY REPORTS:
  16595. --
  16596. ------------------------------------------------------------------
  16597. -- file:  inq_prim_attr_b.ada
  16598. -- level: all levels
  16599.      
  16600. with GKS_OPERATING_STATE_LIST;
  16601. with GKS_ERRORS;
  16602. with GKS_STATE_LIST;
  16603.      
  16604. use GKS_OPERATING_STATE_LIST;
  16605. use GKS_ERRORS;
  16606.      
  16607. package body INQ_PRIMITIVE_ATTRIBUTES is
  16608.      
  16609. -- This is the package body for inquiring the primitive
  16610. -- attribute values.
  16611. --
  16612. -- Each of the procedures in this package inquires the
  16613. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  16614. -- of the states GKOP, WSOP, WSAC, or SGOP.  If it is not,
  16615. -- error indicator 8 occurs but no exception is raised.
  16616.      
  16617.    procedure INQ_CHAR_HEIGHT
  16618.       (EI    : out ERROR_INDICATOR;
  16619.       HEIGHT : out WC.MAGNITUDE) is
  16620.      
  16621.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  16622.    -- value of the current character height.  If the inquired infor-
  16623.    -- mation is available, the error indicator is returned as 0 and
  16624.    -- the value is returned.
  16625.    --
  16626.    -- EI - This is the error indicator.  Its numeric value represents
  16627.    --    the type of error, if any, that occurred.
  16628.    -- HEIGHT - This is the nominal height of the capital letter
  16629.    --    character.
  16630.      
  16631.    begin
  16632.      
  16633.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16634.       -- to see if GKS is in the proper state before proceeding.
  16635.      
  16636.       if CURRENT_OPERATING_STATE = GKCL then
  16637.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  16638.          HEIGHT := 1.0;
  16639.       else
  16640.          EI := SUCCESSFUL;               -- Error 0
  16641.          HEIGHT := GKS_STATE_LIST.CURRENT_CHAR_HEIGHT;
  16642.       end if;
  16643.      
  16644.    end INQ_CHAR_HEIGHT;
  16645.      
  16646.    procedure INQ_CHAR_UP_VECTOR
  16647.       (EI    : out ERROR_INDICATOR;
  16648.       VECTOR : out WC.VECTOR) is
  16649.      
  16650.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  16651.    -- value of the current character up vector.  If the inquired
  16652.    -- information is available, the error indicator is returned as 0
  16653.    -- and the value is returned.
  16654.    --
  16655.    -- EI - This is the error indicator.  Its numeric value represents
  16656.    --    the type of error, if any, that occurred.
  16657.    -- VECTOR - Indicates the up direction of the character.
  16658.      
  16659.    begin
  16660.      
  16661.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16662.       -- to see if GKS is in the proper state before proceeding.
  16663.      
  16664.       if CURRENT_OPERATING_STATE = GKCL then
  16665.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  16666.          VECTOR := (0.0,0.0);
  16667.       else
  16668.          EI := SUCCESSFUL;              -- Error 0
  16669.          VECTOR := GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR;
  16670.       end if;
  16671.      
  16672.    end INQ_CHAR_UP_VECTOR;
  16673.      
  16674.    procedure INQ_TEXT_PATH
  16675.       (EI  : out ERROR_INDICATOR;
  16676.       PATH : out TEXT_PATH) is
  16677.      
  16678.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  16679.    -- value of the current text path.  If the inquired information
  16680.    -- is available, the error indicator is returned as 0 and the
  16681.    -- value is returned.
  16682.    --
  16683.    -- EI - This is the error indicator.  Its numeric value represents
  16684.    --    the type of error, if any, that occurred.
  16685.    -- PATH - Indicates the direction taken by the text string.  It may
  16686.    --    be RIGHT, LEFT, UP, or DOWN.
  16687.      
  16688.    begin
  16689.      
  16690.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16691.       -- to see if GKS is in the proper state before proceeding.
  16692.      
  16693.       if CURRENT_OPERATING_STATE = GKCL then
  16694.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  16695.          PATH := TEXT_PATH'FIRST;
  16696.       else
  16697.          EI := SUCCESSFUL;              -- Error 0
  16698.          PATH := GKS_STATE_LIST.CURRENT_TEXT_PATH;
  16699.       end if;
  16700.      
  16701.    end INQ_TEXT_PATH;
  16702.      
  16703.    procedure INQ_TEXT_ALIGNMENT
  16704.       (EI       : out ERROR_INDICATOR;
  16705.       ALIGNMENT : out TEXT_ALIGNMENT) is
  16706.      
  16707.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  16708.    -- value of the current text alignment.  If the inquired infor-
  16709.    -- mation is available, the error indicator is returned as 0 and
  16710.    -- the value is returned.
  16711.    --
  16712.    -- EI - This is the error indicator.  Its numeric value represents
  16713.    --    the type of error, if any, that occurred.
  16714.    -- ALIGNMENT - Indicates the positioning of the text extent
  16715.    --    rectangle in relation to the text position. It is a
  16716.    --    record with a HORIZONTAL component and a VERTICAL
  16717.    --    component.
  16718.      
  16719.    begin
  16720.      
  16721.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16722.       -- to see if GKS is in the proper state before proceeding.
  16723.      
  16724.       if CURRENT_OPERATING_STATE = GKCL then
  16725.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  16726.          ALIGNMENT := (NORMAL,NORMAL);
  16727.       else
  16728.          EI := SUCCESSFUL;              -- Error 0
  16729.          ALIGNMENT := GKS_STATE_LIST.CURRENT_TEXT_ALIGNMENT;
  16730.       end if;
  16731.      
  16732.    end INQ_TEXT_ALIGNMENT;
  16733.      
  16734.    procedure INQ_PATTERN_REFERENCE_POINT
  16735.       (EI             : out ERROR_INDICATOR;
  16736.       REFERENCE_POINT : out WC.POINT) is
  16737.      
  16738.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  16739.    -- value of the current pattern reference point.  If the inquired
  16740.    -- information is available, the error indicator is returned as 0
  16741.    -- and the value is returned.
  16742.    --
  16743.    -- EI - This is the error indicator.  Its numeric value represents
  16744.    --    the type of error, if any, that occurred.
  16745.    -- REFERENCE_POINT - This is the world coordinate point giving the
  16746.    --    position for the start of the pattern.  It is a record type
  16747.    --    with X and Y components.
  16748.      
  16749.    begin
  16750.      
  16751.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16752.       -- to see if GKS is in the proper state before proceeding.
  16753.      
  16754.       if CURRENT_OPERATING_STATE = GKCL then
  16755.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  16756.          REFERENCE_POINT := (0.0,0.0);
  16757.       else
  16758.          EI := SUCCESSFUL;              -- Error 0
  16759.          REFERENCE_POINT := GKS_STATE_LIST.
  16760.                             CURRENT_PATTERN_REFERENCE_POINT;
  16761.       end if;
  16762.      
  16763.    end INQ_PATTERN_REFERENCE_POINT;
  16764.      
  16765.    procedure INQ_PATTERN_HEIGHT_VECTOR
  16766.       (EI : out ERROR_INDICATOR;
  16767.       VECTOR : out WC.VECTOR) is
  16768.      
  16769.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  16770.    -- value of the current pattern height vector.  If the inquired
  16771.    -- information is available, the error indicator is returned as 0
  16772.    -- and the value is returned.
  16773.    --
  16774.    -- EI - This is the error indicator.  Its numeric value represents
  16775.    --    the type of error, if any, that occurred.
  16776.    -- VECTOR - Indicates the pattern height vector.
  16777.      
  16778.    begin
  16779.      
  16780.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16781.       -- to see if GKS is in the proper state before proceeding.
  16782.      
  16783.       if CURRENT_OPERATING_STATE = GKCL then
  16784.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  16785.          VECTOR := (0.0,0.0);
  16786.       else
  16787.          EI := SUCCESSFUL;              -- Error 0
  16788.          VECTOR := GKS_STATE_LIST.CURRENT_PATTERN_HEIGHT_VECTOR;
  16789.       end if;
  16790.      
  16791.    end INQ_PATTERN_HEIGHT_VECTOR;
  16792.      
  16793.    procedure INQ_PATTERN_WIDTH_VECTOR
  16794.       (EI   : out ERROR_INDICATOR;
  16795.       WIDTH : out WC.VECTOR) is
  16796.      
  16797.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  16798.    -- value of the current pattern width vector.  If the inquired
  16799.    -- information is available, the error indicator is returned as 0
  16800.    -- and the value is returned.
  16801.    --
  16802.    -- EI - This is the error indicator.  Its numeric value represents
  16803.    --    the type of error, if any, that occurred.
  16804.    -- WIDTH - This is a vector in world coordinates describing the
  16805.    --    pattern width.
  16806.      
  16807.    begin
  16808.      
  16809.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16810.       -- to see if GKS is in the proper state before proceeding.
  16811.      
  16812.       if CURRENT_OPERATING_STATE = GKCL then
  16813.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  16814.          WIDTH := (0.0,0.0);
  16815.       else
  16816.          EI := SUCCESSFUL;              -- Error 0
  16817.          WIDTH := GKS_STATE_LIST.CURRENT_PATTERN_WIDTH_VECTOR;
  16818.       end if;
  16819.      
  16820.    end INQ_PATTERN_WIDTH_VECTOR;
  16821.      
  16822.    procedure INQ_CHAR_WIDTH
  16823.       (EI   : out ERROR_INDICATOR;
  16824.       WIDTH : out WC.MAGNITUDE) is
  16825.      
  16826.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  16827.    -- value of the current character nominal width.  If the inquired
  16828.    -- information is available, the error indicator is returned as 0
  16829.    -- and the value is returned.
  16830.    --
  16831.    -- EI - This is the error indicator.  Its numeric value represents
  16832.    --    the type of error, if any, that occurred.
  16833.    -- WIDTH - Indicates the nominal width of characters.
  16834.      
  16835.    begin
  16836.      
  16837.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16838.       -- to see if GKS is in the proper state before proceeding.
  16839.      
  16840.       if CURRENT_OPERATING_STATE = GKCL then
  16841.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  16842.          WIDTH := 1.0;
  16843.       else
  16844.          EI := SUCCESSFUL;              -- Error 0
  16845.          WIDTH := GKS_STATE_LIST.CURRENT_CHAR_WIDTH;
  16846.       end if;
  16847.      
  16848.    end INQ_CHAR_WIDTH;
  16849.      
  16850.    procedure INQ_CHAR_BASE_VECTOR
  16851.       (EI    : out ERROR_INDICATOR;
  16852.       VECTOR : out WC.VECTOR) is
  16853.      
  16854.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  16855.    -- value of the current character base vector.  If the inquired
  16856.    -- information is available, the error indicator is returned as 0
  16857.    -- and the value is returned.
  16858.    --
  16859.    -- EI - This is the error indicator.  Its numeric value represents
  16860.    --    the type of error, if any, that occurred.
  16861.    -- VECTOR - Indicates the character base vector in world coordinates.
  16862.      
  16863.    begin
  16864.      
  16865.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16866.       -- to see if GKS is in the proper state before proceeding.
  16867.      
  16868.       if CURRENT_OPERATING_STATE = GKCL then
  16869.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  16870.          VECTOR := (0.0,0.0);
  16871.       else
  16872.          EI := SUCCESSFUL;              -- Error 0
  16873.          VECTOR := GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR;
  16874.       end if;
  16875.      
  16876.    end INQ_CHAR_BASE_VECTOR;
  16877.      
  16878.    procedure INQ_CURRENT_PRIMITIVE_ATTRIBUTE_VALUES
  16879.       (EI        : out ERROR_INDICATOR;
  16880.       ATTRIBUTES : out PRIMITIVE_ATTRIBUTE_VALUES) is
  16881.      
  16882.    -- This procedure returns the primitive attributes in a single
  16883.    -- record rather than calling several procedures.
  16884.    -- The values returned by the procedure include:
  16885.    --    the current polyline index
  16886.    --    the current polymarker index
  16887.    --    the current text index
  16888.    --    the current character height
  16889.    --    the current character up vector
  16890.    --    the current character width
  16891.    --    the current character base vector
  16892.    --    the current text path
  16893.    --    the current text alignment
  16894.    --    the current fill area index
  16895.    --    the current pattern width vector
  16896.    --    the current pattern height vector
  16897.    --    the current pattern reference point
  16898.    -- which are contained in the record PRIMITIVE_ATTRIBUTES.
  16899.    -- If the inquired information is available, the error indicator
  16900.    -- is returned as 0 and the value is returned.
  16901.    --
  16902.    -- ATTRIBUTES - This record contains the values for the current
  16903.    --    primitive attributes and the bundle indices as described
  16904.    --    above.
  16905.      
  16906.    begin
  16907.      
  16908.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  16909.       -- to see if GKS is in the proper state before proceeding.
  16910.      
  16911.       if CURRENT_OPERATING_STATE = GKCL then
  16912.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  16913.          ATTRIBUTES.CURRENT_POLYLINE_INDEX    := POLYLINE_INDEX'FIRST;
  16914.          ATTRIBUTES.CURRENT_POLYMARKER_INDEX  := POLYMARKER_INDEX'FIRST;
  16915.          ATTRIBUTES.CURRENT_TEXT_INDEX        := TEXT_INDEX'FIRST;
  16916.          ATTRIBUTES.CURRENT_CHAR_HEIGHT       := 0.0;
  16917.          ATTRIBUTES.CURRENT_CHAR_UP_VECTOR    := (0.0,0.0);
  16918.          ATTRIBUTES.CURRENT_CHAR_WIDTH        := 0.0;
  16919.          ATTRIBUTES.CURRENT_CHAR_BASE_VECTOR  := (0.0,0.0);
  16920.          ATTRIBUTES.CURRENT_TEXT_PATH         := TEXT_PATH'FIRST;
  16921.          ATTRIBUTES.CURRENT_TEXT_ALIGNMENT    := (NORMAL,NORMAL);
  16922.          ATTRIBUTES.CURRENT_FILL_AREA_INDEX   := FILL_AREA_INDEX'FIRST;
  16923.          ATTRIBUTES.CURRENT_PATTERN_WIDTH_VECTOR    := (0.0,0.0);
  16924.          ATTRIBUTES.CURRENT_PATTERN_HEIGHT_VECTOR   := (0.0,0.0);
  16925.          ATTRIBUTES.CURRENT_PATTERN_REFERENCE_POINT := (0.0,0.0);
  16926.       else
  16927.          EI := SUCCESSFUL;               -- Error 0
  16928.          ATTRIBUTES.CURRENT_POLYLINE_INDEX := GKS_STATE_LIST.
  16929.                                           CURRENT_POLYLINE_INDEX;
  16930.          ATTRIBUTES.CURRENT_POLYMARKER_INDEX := GKS_STATE_LIST.
  16931.                                           CURRENT_POLYMARKER_INDEX;
  16932.          ATTRIBUTES.CURRENT_TEXT_INDEX := GKS_STATE_LIST.
  16933.                                           CURRENT_TEXT_INDEX;
  16934.          ATTRIBUTES.CURRENT_CHAR_HEIGHT := GKS_STATE_LIST.
  16935.                                           CURRENT_CHAR_HEIGHT;
  16936.          ATTRIBUTES.CURRENT_CHAR_UP_VECTOR := GKS_STATE_LIST.
  16937.                                           CURRENT_CHAR_UP_VECTOR;
  16938.          ATTRIBUTES.CURRENT_CHAR_WIDTH := GKS_STATE_LIST.
  16939.                                           CURRENT_CHAR_WIDTH;
  16940.          ATTRIBUTES.CURRENT_CHAR_BASE_VECTOR := GKS_STATE_LIST.
  16941.                                           CURRENT_CHAR_BASE_VECTOR;
  16942.          ATTRIBUTES.CURRENT_TEXT_PATH := GKS_STATE_LIST.
  16943.                                           CURRENT_TEXT_PATH;
  16944.          ATTRIBUTES.CURRENT_TEXT_ALIGNMENT := GKS_STATE_LIST.
  16945.                                           CURRENT_TEXT_ALIGNMENT;
  16946.          ATTRIBUTES.CURRENT_FILL_AREA_INDEX := GKS_STATE_LIST.
  16947.                                           CURRENT_FILL_AREA_INDEX;
  16948.          ATTRIBUTES.CURRENT_PATTERN_WIDTH_VECTOR := GKS_STATE_LIST.
  16949.                                           CURRENT_PATTERN_WIDTH_VECTOR;
  16950.          ATTRIBUTES.CURRENT_PATTERN_HEIGHT_VECTOR := GKS_STATE_LIST.
  16951.                                           CURRENT_PATTERN_HEIGHT_VECTOR;
  16952.          ATTRIBUTES.CURRENT_PATTERN_REFERENCE_POINT := GKS_STATE_LIST.
  16953.                                           CURRENT_PATTERN_REFERENCE_POINT;
  16954.      
  16955.       end if;
  16956.      
  16957.    end INQ_CURRENT_PRIMITIVE_ATTRIBUTE_VALUES;
  16958.      
  16959. end INQ_PRIMITIVE_ATTRIBUTES;
  16960. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16961. --:UDD:GKSADACM:CODE:MA:INQ_BUNDLE_IDX_B.ADA
  16962. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16963. ------------------------------------------------------------------
  16964. --
  16965. --  NAME: INQ_BUNDLE_INDICES - BODY
  16966. --  IDENTIFIER: GIMXXX.1(1)
  16967. --  DISCREPANCY REPORTS:
  16968. --
  16969. ------------------------------------------------------------------
  16970. -- file:  inq_bundle_idx_b.ada
  16971. -- level: all levels
  16972.      
  16973. with GKS_OPERATING_STATE_LIST;
  16974. with GKS_ERRORS;
  16975. with GKS_STATE_LIST;
  16976.      
  16977. use GKS_OPERATING_STATE_LIST;
  16978. use GKS_ERRORS;
  16979.      
  16980. package body INQ_BUNDLE_INDICES is
  16981.      
  16982. -- This is the package body for the procedures to inquire the
  16983. -- bundled primitive attributes.
  16984. --
  16985. -- Each of the procedures in this package inquires the
  16986. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  16987. -- of the states GKOP, WSOP, WSAC, or SGOP.  If it is not,
  16988. -- error indicator 8 occurs but no exception is raised.
  16989.      
  16990.    procedure INQ_POLYLINE_INDEX
  16991.       (EI   : out ERROR_INDICATOR;
  16992.       INDEX : out POLYLINE_INDEX) is
  16993.      
  16994.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  16995.    -- value of the current polyline index.  If the inquired infor-
  16996.    -- mation is available, the error indicator is returned as 0 and
  16997.    -- the value is returned.
  16998.    --
  16999.    -- EI - This is the error indicator.  Its numeric value represents
  17000.    --    the type of error, if any, that occurred.
  17001.    -- INDEX - This is an integer index into a polyline bundle table,
  17002.    --    each entry of which contains all the non-geometric aspects
  17003.    --    of the polyline.
  17004.      
  17005.    begin
  17006.      
  17007.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17008.       -- to see if GKS is in the proper state before proceeding.
  17009.      
  17010.       if CURRENT_OPERATING_STATE = GKCL then
  17011.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  17012.          INDEX := POLYLINE_INDEX'FIRST;
  17013.       else
  17014.          EI := SUCCESSFUL;               -- Error 0
  17015.          INDEX := GKS_STATE_LIST.CURRENT_POLYLINE_INDEX;
  17016.       end if;
  17017.      
  17018.    end INQ_POLYLINE_INDEX;
  17019.      
  17020.    procedure INQ_POLYMARKER_INDEX
  17021.       (EI   : out ERROR_INDICATOR;
  17022.       INDEX : out POLYMARKER_INDEX) is
  17023.      
  17024.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17025.    -- value of the current polymarker index.  If the inquired infor-
  17026.    -- mation is available, the error indicator is returned as 0 and
  17027.    -- the value is returned.
  17028.    --
  17029.    -- EI - This is the error indicator.  Its numeric value represents
  17030.    --    the type of error, if any, that occurred.
  17031.    -- INDEX - This is an integer index into a polymarker bundle table,
  17032.    --    each entry of which contains all the non-geometric aspects
  17033.    --    of the polymarker.
  17034.      
  17035.    begin
  17036.      
  17037.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17038.       -- to see if GKS is in the proper state before proceeding.
  17039.      
  17040.       if CURRENT_OPERATING_STATE = GKCL then
  17041.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  17042.          INDEX := POLYMARKER_INDEX'FIRST;
  17043.       else
  17044.          EI := SUCCESSFUL;               -- Error 0
  17045.          INDEX := GKS_STATE_LIST.CURRENT_POLYMARKER_INDEX;
  17046.       end if;
  17047.      
  17048.    end INQ_POLYMARKER_INDEX;
  17049.      
  17050.    procedure INQ_FILL_AREA_INDEX
  17051.       (EI   : out ERROR_INDICATOR;
  17052.       INDEX : out FILL_AREA_INDEX) is
  17053.      
  17054.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17055.    -- value of the current fill area index.  If the inquired infor-
  17056.    -- mation is available, the error indicator is returned as 0 and
  17057.    -- the value is returned.
  17058.    --
  17059.    -- EI - This is the error indicator.  Its numeric value represents
  17060.    --    the type of error, if any, that occurred.
  17061.    -- INDEX - This is an integer index into a fill area bundle table,
  17062.    --    each entry of which contains all the non-geometric aspects
  17063.    --    of the fill area primitive.
  17064.      
  17065.    begin
  17066.      
  17067.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17068.       -- to see if GKS is in the proper state before proceeding.
  17069.      
  17070.       if CURRENT_OPERATING_STATE = GKCL then
  17071.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  17072.          INDEX := FILL_AREA_INDEX'FIRST;
  17073.       else
  17074.          EI := SUCCESSFUL;               -- Error 0
  17075.          INDEX := GKS_STATE_LIST.CURRENT_FILL_AREA_INDEX;
  17076.       end if;
  17077.      
  17078.    end INQ_FILL_AREA_INDEX;
  17079.      
  17080.    procedure INQ_TEXT_INDEX
  17081.       (EI   : out ERROR_INDICATOR;
  17082.       INDEX : out TEXT_INDEX) is
  17083.      
  17084.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17085.    -- value of the current text index.  If the inquired infor-
  17086.    -- mation is available, the error indicator is returned as 0 and
  17087.    -- the value is returned.
  17088.    --
  17089.    -- EI - This is the error indicator.  Its numeric value represents
  17090.    --    the type of error, if any, that occurred.
  17091.    -- INDEX - This is an integer index into a text bundle table,
  17092.    --    each entry of which contains all the non-geometric aspects
  17093.    --    of the text primitive.
  17094.      
  17095.    begin
  17096.      
  17097.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17098.       -- to see if GKS is in the proper state before proceeding.
  17099.      
  17100.       if CURRENT_OPERATING_STATE = GKCL then
  17101.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  17102.          INDEX := TEXT_INDEX'FIRST;
  17103.       else
  17104.          EI := SUCCESSFUL;               -- Error 0
  17105.          INDEX := GKS_STATE_LIST.CURRENT_TEXT_INDEX;
  17106.       end if;
  17107.      
  17108.    end INQ_TEXT_INDEX;
  17109.      
  17110. end INQ_BUNDLE_INDICES;
  17111. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17112. --:UDD:GKSADACM:CODE:MA:INQ_INDV_ATTR_B.ADA
  17113. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17114. ------------------------------------------------------------------
  17115. --
  17116. --  NAME: INQ_INDIVIDUAL_ATTRIBUTES
  17117. --  IDENTIFIER: GIMXXX.1(1)
  17118. --  DISCREPANCY REPORTS:
  17119. --
  17120. ------------------------------------------------------------------
  17121. -- file:  inq_indv_attr_b.ada
  17122. -- level: all levels
  17123.      
  17124. with GKS_OPERATING_STATE_LIST;
  17125. with GKS_ERRORS;
  17126. with GKS_STATE_LIST;
  17127.      
  17128. use GKS_OPERATING_STATE_LIST;
  17129. use GKS_ERRORS;
  17130.      
  17131. package body INQ_INDIVIDUAL_ATTRIBUTES is
  17132.      
  17133. -- This is the package body for inquiring the current
  17134. -- individual attributes.
  17135. --
  17136. -- Each of the procedures in this package inquires the
  17137. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  17138. -- of the states GKOP, WSOP, WSAC, or SGOP.  If it is not,
  17139. -- error indicator 8 occurs but no exception is raised.
  17140.      
  17141.    procedure INQ_LINETYPE
  17142.       (EI  : out ERROR_INDICATOR;
  17143.       LINE : out LINETYPE) is
  17144.      
  17145.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17146.    -- value of the current line type.  If the inquired information
  17147.    -- is available, the error indicator is returned as 0 and the
  17148.    -- value is returned.
  17149.    --
  17150.    -- EI - This is the error indicator.  Its numeric value represents
  17151.    --    the type of error, if any, that occurred.
  17152.    -- LINE - This is an integer value representing the type of line
  17153.    --    style that is currently selected.
  17154.      
  17155.    begin
  17156.      
  17157.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17158.       -- to see if GKS is in the proper state before proceeding.
  17159.      
  17160.       if CURRENT_OPERATING_STATE = GKCL then
  17161.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  17162.          LINE := LINETYPE'FIRST;
  17163.       else
  17164.          EI := SUCCESSFUL;               -- Error 0
  17165.          LINE := GKS_STATE_LIST.CURRENT_LINETYPE;
  17166.       end if;
  17167.      
  17168.    end INQ_LINETYPE;
  17169.      
  17170.    procedure INQ_LINEWIDTH_SCALE_FACTOR
  17171.       (EI   : out ERROR_INDICATOR;
  17172.       WIDTH : out LINE_WIDTH) is
  17173.      
  17174.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17175.    -- value of the current linewidth scale factor.  If the inquired
  17176.    -- information is available, the error indicator is returned as 0
  17177.    -- and the value is returned.
  17178.    --
  17179.    -- EI - This is the error indicator.  Its numeric value represents
  17180.    --    the type of error, if any, that occurred.
  17181.    -- WIDTH - This is an floating point scale factor value that
  17182.    --    represents the width of a line.
  17183.      
  17184.    begin
  17185.      
  17186.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17187.       -- to see if GKS is in the proper state before proceeding.
  17188.      
  17189.       if CURRENT_OPERATING_STATE = GKCL then
  17190.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  17191.          WIDTH := LINE_WIDTH'FIRST;
  17192.       else
  17193.          EI := SUCCESSFUL;              -- Error 0
  17194.          WIDTH := GKS_STATE_LIST.CURRENT_LINEWIDTH_SCALE_FACTOR;
  17195.       end if;
  17196.      
  17197.    end INQ_LINEWIDTH_SCALE_FACTOR;
  17198.      
  17199.    procedure INQ_POLYLINE_COLOUR_INDEX
  17200.       (EI    : out ERROR_INDICATOR;
  17201.       COLOUR : out COLOUR_INDEX) is
  17202.      
  17203.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17204.    -- value of the current polyline colour index.  If the inquired
  17205.    -- information is available, the error indicator is returned as 0
  17206.    -- and the value is returned.
  17207.    --
  17208.    -- EI - This is the error indicator.  Its numeric value represents
  17209.    --    the type of error, if any, that occurred.
  17210.    -- COLOUR - This is an integer value indicating the colour that
  17211.    --    is currently selected for polyline primitives.
  17212.      
  17213.    begin
  17214.      
  17215.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17216.       -- to see if GKS is in the proper state before proceeding.
  17217.      
  17218.       if CURRENT_OPERATING_STATE = GKCL then
  17219.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  17220.          COLOUR := COLOUR_INDEX'FIRST;
  17221.       else
  17222.          EI := SUCCESSFUL;              -- Error 0
  17223.          COLOUR := GKS_STATE_LIST.CURRENT_POLYLINE_COLOUR_INDEX;
  17224.       end if;
  17225.      
  17226.    end INQ_POLYLINE_COLOUR_INDEX;
  17227.      
  17228.    procedure INQ_POLYMARKER_TYPE
  17229.       (EI    : out ERROR_INDICATOR;
  17230.       MARKER : out MARKER_TYPE) is
  17231.      
  17232.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17233.    -- value of the current polymarker type.  If the inquired infor-
  17234.    -- mation is available, the error indicator is returned as 0 and
  17235.    -- the value is returned.
  17236.    --
  17237.    -- EI - This is the error indicator.  Its numeric value represents
  17238.    --    the type of error, if any, that occurred.
  17239.    -- MARKER - This is an integer value representing the type of
  17240.    --    polymarker that is currently selected.
  17241.      
  17242.    begin
  17243.      
  17244.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17245.       -- to see if GKS is in the proper state before proceeding.
  17246.      
  17247.       if CURRENT_OPERATING_STATE = GKCL then
  17248.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  17249.          MARKER := MARKER_TYPE'FIRST;
  17250.       else
  17251.          EI := SUCCESSFUL;                -- Error 0
  17252.          MARKER := GKS_STATE_LIST.CURRENT_MARKER_TYPE;
  17253.       end if;
  17254.      
  17255.    end INQ_POLYMARKER_TYPE;
  17256.      
  17257.    procedure INQ_POLYMARKER_SIZE_SCALE_FACTOR
  17258.       (EI  : out ERROR_INDICATOR;
  17259.       SIZE : out MARKER_SIZE) is
  17260.      
  17261.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17262.    -- value of the current polymarker size scale factor.  If the
  17263.    -- inquired information is available, the error indicator is
  17264.    -- returned as 0 and the value is returned.
  17265.    --
  17266.    -- EI - This is the error indicator.  Its numeric value represents
  17267.    --    the type of error, if any, that occurred.
  17268.    -- SIZE - This is a positive scale factor value indicating the
  17269.    --    relative size of the polymarker.
  17270.      
  17271.    begin
  17272.      
  17273.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17274.       -- to see if GKS is in the proper state before proceeding.
  17275.      
  17276.       if CURRENT_OPERATING_STATE = GKCL then
  17277.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  17278.          SIZE := MARKER_SIZE'FIRST;
  17279.       else
  17280.          EI := SUCCESSFUL;               -- Error 0
  17281.          SIZE := GKS_STATE_LIST.CURRENT_MARKER_SIZE_SCALE_FACTOR;
  17282.       end if;
  17283.      
  17284.    end INQ_POLYMARKER_SIZE_SCALE_FACTOR;
  17285.      
  17286.    procedure INQ_POLYMARKER_COLOUR_INDEX
  17287.       (EI    : out ERROR_INDICATOR;
  17288.       COLOUR : out COLOUR_INDEX) is
  17289.      
  17290.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17291.    -- value of the current polymarker colour index.  If the
  17292.    -- inquired information is available, the error indicator is
  17293.    -- returned as 0 and the value is returned.
  17294.    --
  17295.    -- EI - This is the error indicator.  Its numeric value represents
  17296.    --    the type of error, if any, that occurred.
  17297.    -- COLOUR - This is an integer value indicating the colour that
  17298.    --    is currently selected for polymarker primitives.
  17299.      
  17300.    begin
  17301.      
  17302.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17303.       -- to see if GKS is in the proper state before proceeding.
  17304.      
  17305.       if CURRENT_OPERATING_STATE = GKCL then
  17306.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  17307.          COLOUR := COLOUR_INDEX'FIRST;
  17308.       else
  17309.          EI := SUCCESSFUL;               -- Error 0
  17310.          COLOUR := GKS_STATE_LIST.CURRENT_POLYMARKER_COLOUR_INDEX;
  17311.       end if;
  17312.      
  17313.    end INQ_POLYMARKER_COLOUR_INDEX;
  17314.      
  17315.    procedure INQ_TEXT_FONT_AND_PRECISION
  17316.       (EI            : out ERROR_INDICATOR;
  17317.       FONT_PRECISION : out TEXT_FONT_PRECISION) is
  17318.      
  17319.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17320.    -- value of the current text font and precision.  If the
  17321.    -- inquired information is available, the error indicator is
  17322.    -- returned as 0 and the value is returned.
  17323.    --
  17324.    -- EI - This is the error indicator.  Its numeric value represents
  17325.    --    the type of error, if any, that occurred.
  17326.    -- FONT_PRECISION - This is a record describing the text font
  17327.    --    and precision.  The FONT component is an integer value
  17328.    --    representing the font selected.  The PRECISION component
  17329.    --    may be of the value STRING_PRECISION, CHAR_PRECISION, or
  17330.    --    STROKE_PRECISION.
  17331.      
  17332.    begin
  17333.      
  17334.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17335.       -- to see if GKS is in the proper state before proceeding.
  17336.      
  17337.       if CURRENT_OPERATING_STATE = GKCL then
  17338.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  17339.          FONT_PRECISION := (0,STRING_PRECISION);
  17340.       else
  17341.          EI := SUCCESSFUL;              -- Error 0
  17342.          FONT_PRECISION := GKS_STATE_LIST.
  17343.                            CURRENT_TEXT_FONT_AND_PRECISION;
  17344.       end if;
  17345.      
  17346.    end INQ_TEXT_FONT_AND_PRECISION;
  17347.      
  17348.    procedure INQ_CHAR_EXPANSION_FACTOR
  17349.       (EI       : out ERROR_INDICATOR;
  17350.       EXPANSION : out CHAR_EXPANSION) is
  17351.      
  17352.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17353.    -- value of the current character expansion factor.  If the
  17354.    -- inquired information is available, the error indicator is
  17355.    -- returned as 0 and the value is returned.
  17356.    --
  17357.    -- EI - This is the error indicator.  Its numeric value represents
  17358.    --    the type of error, if any, that occurred.
  17359.    -- EXPANSION - This is a positive scale factor value that indicates
  17360.    --    the character expansion.
  17361.      
  17362.    begin
  17363.      
  17364.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17365.       -- to see if GKS is in the proper state before proceeding.
  17366.      
  17367.       if CURRENT_OPERATING_STATE = GKCL then
  17368.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  17369.          EXPANSION := CHAR_EXPANSION'FIRST;
  17370.       else
  17371.          EI := SUCCESSFUL;              -- Error 0
  17372.          EXPANSION := GKS_STATE_LIST.CURRENT_CHAR_EXPANSION_FACTOR;
  17373.       end if;
  17374.      
  17375.    end INQ_CHAR_EXPANSION_FACTOR;
  17376.      
  17377.    procedure INQ_CHAR_SPACING
  17378.       (EI     : out ERROR_INDICATOR;
  17379.       SPACING : out CHAR_SPACING) is
  17380.      
  17381.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17382.    -- value of the current character spacing.  If the inquired
  17383.    -- information is available, the error indicator is returned
  17384.    -- as 0 and the value is returned.
  17385.    --
  17386.    -- EI - This is the error indicator.  Its numeric value represents
  17387.    --    the type of error, if any, that occurred.
  17388.    -- SPACING - This is a scale factor value representing the
  17389.    --    character spacing.  A positive value indicates the amount
  17390.    --    of space between characters.  A negative value indicates
  17391.    --    the amount of overlap between characters.
  17392.      
  17393.    begin
  17394.      
  17395.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17396.       -- to see if GKS is in the proper state before proceeding.
  17397.      
  17398.       if CURRENT_OPERATING_STATE = GKCL then
  17399.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  17400.          SPACING := 1.0;
  17401.       else
  17402.          EI := SUCCESSFUL;              -- Error 0
  17403.          SPACING := GKS_STATE_LIST.CURRENT_CHAR_SPACING;
  17404.       end if;
  17405.      
  17406.    end INQ_CHAR_SPACING;
  17407.      
  17408.    procedure INQ_TEXT_COLOUR_INDEX
  17409.       (EI    : out ERROR_INDICATOR;
  17410.       COLOUR : out COLOUR_INDEX) is
  17411.      
  17412.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17413.    -- value of the current text colour index.  If the inquired
  17414.    -- information is available, the error indicator is returned
  17415.    -- as 0 and the value is returned.
  17416.    --
  17417.    -- EI - This is the error indicator.  Its numeric value represents
  17418.    --    the type of error, if any, that occurred.
  17419.    -- COLOUR - This is an integer value indicating the colour that
  17420.    --    is currently selected for text primitives.
  17421.      
  17422.    begin
  17423.      
  17424.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17425.       -- to see if GKS is in the proper state before proceeding.
  17426.      
  17427.       if CURRENT_OPERATING_STATE = GKCL then
  17428.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  17429.          COLOUR := COLOUR_INDEX'FIRST;
  17430.       else
  17431.          EI := SUCCESSFUL;              -- Error 0
  17432.          COLOUR := GKS_STATE_LIST.CURRENT_TEXT_COLOUR_INDEX;
  17433.       end if;
  17434.      
  17435.    end INQ_TEXT_COLOUR_INDEX;
  17436.      
  17437.    procedure INQ_FILL_AREA_INTERIOR_STYLE
  17438.       (EI   : out ERROR_INDICATOR;
  17439.       STYLE : out INTERIOR_STYLE) is
  17440.      
  17441.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17442.    -- value of the current fill area interior style.  If the inquired
  17443.    -- information is available, the error indicator is returned
  17444.    -- as 0 and the value is returned.
  17445.    --
  17446.    -- EI - This is the error indicator.  Its numeric value represents
  17447.    --    the type of error, if any, that occurred.
  17448.    -- STYLE - This enumerated type indicates whether the current fill
  17449.    --    area interior style is HOLLOW, SOLID, PATTERN, or HATCH.
  17450.      
  17451.    begin
  17452.      
  17453.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17454.       -- to see if GKS is in the proper state before proceeding.
  17455.      
  17456.       if CURRENT_OPERATING_STATE = GKCL then
  17457.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  17458.          STYLE := INTERIOR_STYLE'FIRST;
  17459.       else
  17460.          EI := SUCCESSFUL;              -- Error 0
  17461.          STYLE := GKS_STATE_LIST.CURRENT_FILL_AREA_INTERIOR_STYLE;
  17462.       end if;
  17463.      
  17464.    end INQ_FILL_AREA_INTERIOR_STYLE;
  17465.      
  17466.    procedure INQ_FILL_AREA_STYLE_INDEX
  17467.       (EI   : out ERROR_INDICATOR;
  17468.       INDEX : out STYLE_INDEX) is
  17469.      
  17470.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17471.    -- value of the current fill area style index.  If the inquired
  17472.    -- information is available, the error indicator is returned
  17473.    -- as 0 and the value is returned.
  17474.    --
  17475.    -- EI - This is the error indicator.  Its numeric value represents
  17476.    --    the type of error, if any, that occurred.
  17477.    -- INDEX - This is a variant record defining the fill area style
  17478.    --    index.  If the discriminant is HOLLOW or SOLID, the record
  17479.    --    has a null component.  If it is PATTERN, the component is
  17480.    --    a PATTERN_INDEX.  If it is HATCH, the record component is
  17481.    --    a HATCH_STYLE_TYPE.
  17482.      
  17483.    begin
  17484.      
  17485.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17486.       -- to see if GKS is in the proper state before proceeding.
  17487.      
  17488.       if CURRENT_OPERATING_STATE = GKCL then
  17489.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  17490.          INDEX := STYLE_INDEX'FIRST;
  17491.       else
  17492.          EI := SUCCESSFUL;               -- Error 0
  17493.          INDEX := GKS_STATE_LIST.CURRENT_FILL_AREA_STYLE_INDEX;
  17494.       end if;
  17495.      
  17496.    end INQ_FILL_AREA_STYLE_INDEX;
  17497.      
  17498.    procedure INQ_FILL_AREA_COLOUR_INDEX
  17499.       (EI    : out ERROR_INDICATOR;
  17500.       COLOUR : out COLOUR_INDEX) is
  17501.      
  17502.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17503.    -- value of the current fill area colour index.  If the inquired
  17504.    -- information is available, the error indicator is returned
  17505.    -- as 0 and the value is returned.
  17506.    --
  17507.    -- EI - This is the error indicator.  Its numeric value represents
  17508.    --    the type of error, if any, that occurred.
  17509.    -- COLOUR - This is an integer value indicating the colour that
  17510.    --    is currently selected for fill area primitives.
  17511.      
  17512.    begin
  17513.      
  17514.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17515.       -- to see if GKS is in the proper state before proceeding.
  17516.      
  17517.       if CURRENT_OPERATING_STATE = GKCL then
  17518.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  17519.          COLOUR := COLOUR_INDEX'FIRST;
  17520.       else
  17521.          EI := SUCCESSFUL;               -- Error 0
  17522.          COLOUR := GKS_STATE_LIST.CURRENT_FILL_AREA_COLOUR_INDEX;
  17523.       end if;
  17524.      
  17525.    end INQ_FILL_AREA_COLOUR_INDEX;
  17526.      
  17527.    procedure INQ_LIST_OF_ASF
  17528.       (EI    : out ERROR_INDICATOR;
  17529.       LIST : out ASF_LIST) is
  17530.      
  17531.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17532.    -- value of the current list of aspect source flags.  If the
  17533.    -- inquired information is available, the error indicator is
  17534.    -- returned as 0 and the values are returned.
  17535.    --
  17536.    -- EI - This is the error indicator.  Its numeric value represents
  17537.    --    the type of error, if any, that occurred.
  17538.    -- LIST - This is a record listing all of the aspect source flags.
  17539.    --    Each component may have a value of INDIVIDUAL or BUNDLED.
  17540.      
  17541.    begin
  17542.      
  17543.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17544.       -- to see if GKS is in the proper state before proceeding.
  17545.      
  17546.       if CURRENT_OPERATING_STATE = GKCL then
  17547.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  17548.          LIST := (OTHERS => INDIVIDUAL);
  17549.       else
  17550.          EI := SUCCESSFUL;               -- Error 0
  17551.          LIST := GKS_STATE_LIST.CURRENT_ASPECT_SOURCE_FLAGS;
  17552.       end if;
  17553.      
  17554.    end INQ_LIST_OF_ASF;
  17555.      
  17556.    procedure INQ_CURRENT_INDIVIDUAL_ATTRIBUTE_VALUES
  17557.       (EI         : out ERROR_INDICATOR;
  17558.       ATTRIBUTES  : out INDIVIDUAL_ATTRIBUTE_VALUES) is
  17559.      
  17560.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  17561.    -- values of:
  17562.    --    the current line type
  17563.    --    the current linewidth scale factor
  17564.    --    the current polyline colour index
  17565.    --    the current polymarker type
  17566.    --    the current polymarker size scale factor
  17567.    --    the current polymarker colour index
  17568.    --    the current text font and precision
  17569.    --    the current character expansion factor
  17570.    --    the current character spacing
  17571.    --    the current text colour index
  17572.    --    the current fill area interior style
  17573.    --    the current fill area style index
  17574.    --    the current fill area colour index
  17575.    --    the current list of aspect source flags
  17576.    -- in a single call.  These values are components of the record
  17577.    -- ATTRIBUTES.  If the inquired information is available, the error
  17578.    -- indicator is returned as 0 and the value is returned.
  17579.    --
  17580.    -- ATTRIBUTES - This is a record type with all of the current
  17581.    --    individual attributes as described above.
  17582.      
  17583.    begin
  17584.      
  17585.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17586.       -- to see if GKS is in the proper state before proceeding.
  17587.      
  17588.       if CURRENT_OPERATING_STATE = GKCL then
  17589.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  17590.          ATTRIBUTES.CURRENT_LINETYPE          := LINETYPE'FIRST;
  17591.          ATTRIBUTES.CURRENT_LINE_WIDTH        := LINE_WIDTH'FIRST;
  17592.          ATTRIBUTES.CURRENT_POLYLINE_COLOUR   := COLOUR_INDEX'FIRST;
  17593.          ATTRIBUTES.CURRENT_MARKER_TYPE       := MARKER_TYPE'FIRST;
  17594.          ATTRIBUTES.CURRENT_POLYMARKER_SIZE   := MARKER_SIZE'FIRST;
  17595.          ATTRIBUTES.CURRENT_POLYMARKER_COLOUR := COLOUR_INDEX'FIRST;
  17596.          ATTRIBUTES.CURRENT_FONT_PRECISION    := (0,STRING_PRECISION);
  17597.          ATTRIBUTES.CURRENT_CHAR_EXPANSION    := CHAR_EXPANSION'FIRST;
  17598.          ATTRIBUTES.CURRENT_CHAR_SPACING      := CHAR_SPACING'FIRST;
  17599.          ATTRIBUTES.CURRENT_TEXT_COLOUR       := COLOUR_INDEX'FIRST;
  17600.          ATTRIBUTES.CURRENT_INTERIOR_STYLE    := INTERIOR_STYLE'FIRST;
  17601.          ATTRIBUTES.CURRENT_STYLE_INDEX       := STYLE_INDEX'FIRST;
  17602.          ATTRIBUTES.CURRENT_FILL_AREA_COLOUR  := COLOUR_INDEX'FIRST;
  17603.          ATTRIBUTES.CURRENT_ASF_LIST          := (OTHERS => INDIVIDUAL);
  17604.       else
  17605.          EI := SUCCESSFUL;     -- Error 0
  17606.          ATTRIBUTES.CURRENT_LINETYPE := GKS_STATE_LIST.CURRENT_LINETYPE;
  17607.          ATTRIBUTES.CURRENT_LINE_WIDTH := GKS_STATE_LIST.
  17608.                                       CURRENT_LINEWIDTH_SCALE_FACTOR;
  17609.          ATTRIBUTES.CURRENT_POLYLINE_COLOUR := GKS_STATE_LIST.
  17610.                                       CURRENT_POLYLINE_COLOUR_INDEX;
  17611.          ATTRIBUTES.CURRENT_MARKER_TYPE := GKS_STATE_LIST.
  17612.                                       CURRENT_MARKER_TYPE;
  17613.          ATTRIBUTES.CURRENT_POLYMARKER_SIZE := GKS_STATE_LIST.
  17614.                                        CURRENT_MARKER_SIZE_SCALE_FACTOR;
  17615.          ATTRIBUTES.CURRENT_POLYMARKER_COLOUR := GKS_STATE_LIST.
  17616.                                        CURRENT_POLYMARKER_COLOUR_INDEX;
  17617.          ATTRIBUTES.CURRENT_FONT_PRECISION := GKS_STATE_LIST.
  17618.                                        CURRENT_TEXT_FONT_AND_PRECISION;
  17619.          ATTRIBUTES.CURRENT_CHAR_EXPANSION := GKS_STATE_LIST.
  17620.                                        CURRENT_CHAR_EXPANSION_FACTOR;
  17621.          ATTRIBUTES.CURRENT_CHAR_SPACING := GKS_STATE_LIST.
  17622.                                        CURRENT_CHAR_SPACING;
  17623.          ATTRIBUTES.CURRENT_TEXT_COLOUR := GKS_STATE_LIST.
  17624.                                        CURRENT_TEXT_COLOUR_INDEX;
  17625.          ATTRIBUTES.CURRENT_INTERIOR_STYLE := GKS_STATE_LIST.
  17626.                                        CURRENT_FILL_AREA_INTERIOR_STYLE;
  17627.          ATTRIBUTES.CURRENT_STYLE_INDEX := GKS_STATE_LIST.
  17628.                                        CURRENT_FILL_AREA_STYLE_INDEX;
  17629.          ATTRIBUTES.CURRENT_FILL_AREA_COLOUR := GKS_STATE_LIST.
  17630.                                        CURRENT_FILL_AREA_COLOUR_INDEX;
  17631.          ATTRIBUTES.CURRENT_ASF_LIST := GKS_STATE_LIST.
  17632.                                         CURRENT_ASPECT_SOURCE_FLAGS;
  17633.      
  17634.       end if;
  17635.      
  17636.    end INQ_CURRENT_INDIVIDUAL_ATTRIBUTE_VALUES;
  17637.      
  17638. end INQ_INDIVIDUAL_ATTRIBUTES;
  17639. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17640. --:UDD:GKSADACM:CODE:MA:GKS_NORM_MA_B.ADA
  17641. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17642. ------------------------------------------------------------------
  17643. --
  17644. --  NAME: GKS_NORMALIZATION - BODY
  17645. --  IDENTIFIER: GIMXXX.1(3)
  17646. --  DISCREPANCY REPORTS:
  17647. --  DR033  Check for = in determining rectangle validity.
  17648. ------------------------------------------------------------------
  17649. -- file:  gks_norm_b.ada
  17650. -- level: ma
  17651.      
  17652. with CGI;
  17653. with WSM;
  17654. with ERROR_ROUTINES;
  17655. with GKS_OPERATING_STATE_LIST;
  17656. with GKS_STATE_LIST;
  17657. with GKS_ERRORS;
  17658. with TRANSLATION_FACTORS;
  17659. with SET_PRIMITIVE_ATTRIBUTES_MA;
  17660.      
  17661. use CGI;
  17662. use WSM;
  17663. use ERROR_ROUTINES;
  17664. use GKS_OPERATING_STATE_LIST;
  17665. use GKS_ERRORS;
  17666.      
  17667. package body GKS_NORMALIZATION is
  17668.      
  17669. -- This is the package body for the normalization transformation
  17670. -- procedures for GKS.
  17671. --
  17672. -- Each of the procedures in this package inquires the
  17673. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  17674. -- of the states GKOP, WSOP, WSAC, or SGOP.  If it is not,
  17675. -- error 8 occurs and the procedure raises the exception
  17676. -- STATE_ERROR.
  17677. --
  17678. -- If an error indicator above 0 occurs, these procedures call
  17679. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  17680. -- to log the error indicator and the name of the procedure
  17681. -- in the error file specified when the procedure OPEN_GKS
  17682. -- was called to begin this session of GKS operation.
  17683.      
  17684.    procedure SET_WINDOW
  17685.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  17686.       WINDOW_LIMITS   : in WC.RECTANGLE_LIMITS) is
  17687.      
  17688.    -- This procedure checks to see if the transformation number is
  17689.    -- greater or equal to 1.  If it is not, error 50 occurs and the
  17690.    -- exception TRANSFORMATION_ERROR is raised.  Then, this
  17691.    -- procedure checks the value of the window limits passed
  17692.    -- in to see if they are valid.  If not, error 51 occurs and the
  17693.    -- exception TRANSFORMATION_ERROR is raised.  Otherwise, the
  17694.    -- procedure sets the value of the window limits entry for the
  17695.    -- specified transformation number in the GKS_STATE_LIST.
  17696.    --
  17697.    -- TRANSFORMATION - This is an integer value representing a
  17698.    --    normalization transformation.
  17699.    -- WINDOW_LIMITS - This record defines the extent of the
  17700.    --    window RECTANGLE_LIMITS in world coordinates. Its X and Y
  17701.    --    components give the limits in relation to the x and y
  17702.    --    axes.
  17703.      
  17704.    begin
  17705.      
  17706.       -- The following if structure inquires the GKS_OPERATING_
  17707.       -- STATE_LIST to see if GKS is in the proper state and if
  17708.       -- the window limits requested are valid before proceeding
  17709.       -- with the set to the GKS_STATE_LIST.
  17710.      
  17711.       if CURRENT_OPERATING_STATE = GKCL then
  17712.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,"SET_WINDOW");-- Error 8
  17713.          raise STATE_ERROR;
  17714.      
  17715.       elsif TRANSFORMATION < 1 then
  17716.          ERROR_LOGGING (INVALID_XFORM_NUMBER,"SET_WINDOW");  -- Error 50
  17717.          raise TRANSFORMATION_ERROR;
  17718.      
  17719.       elsif (WINDOW_LIMITS.XMIN >= WINDOW_LIMITS.XMAX) or
  17720.             (WINDOW_LIMITS.YMIN >= WINDOW_LIMITS.YMAX) then
  17721.          ERROR_LOGGING (INVALID_RECTANGLE, "SET_WINDOW");    -- Error 51
  17722.          raise TRANSFORMATION_ERROR;
  17723.      
  17724.       else
  17725.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  17726.             (TRANSFORMATION).WINDOW := WINDOW_LIMITS;
  17727.      
  17728.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  17729.             (TRANSFORMATION).NDC_FACTORS := TRANSLATION_FACTORS.
  17730.             GET_NORMALIZATION_FACTORS(WINDOW_LIMITS,GKS_STATE_LIST.
  17731.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(TRANSFORMATION).
  17732.             VIEWPORT);
  17733.      
  17734.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  17735.             (TRANSFORMATION).WC_FACTORS := TRANSLATION_FACTORS.
  17736.             GET_NORMALIZATION_FACTORS(GKS_STATE_LIST.
  17737.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(TRANSFORMATION).
  17738.             VIEWPORT,WINDOW_LIMITS);
  17739.       end if;
  17740.      
  17741.    -- The following procedure calls ensure that the primitive
  17742.    -- attributes that are affected by the new window are reset.
  17743.    SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_HEIGHT(GKS_STATE_LIST.
  17744.       CURRENT_CHAR_HEIGHT);
  17745.      
  17746.    SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_UP_VECTOR(GKS_STATE_LIST.
  17747.       CURRENT_CHAR_UP_VECTOR);
  17748.      
  17749.    exception
  17750.       when STATE_ERROR =>
  17751.          raise;
  17752.       when TRANSFORMATION_ERROR =>
  17753.          raise;
  17754.       when OTHERS =>
  17755.          ERROR_LOGGING (UNKNOWN, "SET_WINDOW");             -- Error 2501
  17756.          raise;
  17757.      
  17758.    end SET_WINDOW;
  17759.      
  17760.    procedure SET_VIEWPORT
  17761.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  17762.       VIEWPORT_LIMITS : in NDC.RECTANGLE_LIMITS) is
  17763.      
  17764.    -- If the transformation number is less than 1, error 50
  17765.    -- occurs, and the exception TRANSFORMATION_ERROR is raised.
  17766.    -- Then, this procedure checks if the rectangle definition of
  17767.    -- the viewport limits passed in is valid.  If it is not,
  17768.    -- error 51 occurs and the procedure raises the exception
  17769.    -- TRANSFORMATION_ERROR.  If the rectangle is not with in NDC
  17770.    -- unit square, error 52 occurs and the exception TRANSFORMATION_
  17771.    -- ERROR is raised.
  17772.    --
  17773.    -- The viewport limits entry of the specified normalization
  17774.    -- transformation in the GKS_STATE_LIST is set to the value
  17775.    -- passed in.
  17776.    --
  17777.    -- This procedure also passes the information to the WS_MANAGER
  17778.    -- so that it will have access to the new viewport specification.
  17779.    --
  17780.    -- TRANSFORMATION - This is an integer value representing a
  17781.    --    normalization transformation.
  17782.    -- VEIWPORT_LIMITS - This record defines the extent of the
  17783.    --    viewport rectangle in normalized device coordinates.
  17784.    --    Its X and Y components give the limits in relation to
  17785.    --    the x and y axes.
  17786.      
  17787.    GKS_INSTR : CGI_SET_CLIPPING_RECTANGLE;
  17788.      
  17789.    begin
  17790.      
  17791.       -- The following if structure inquires the GKS_OPERATING_
  17792.       -- STATE_LIST to see if GKS is in the proper state.  It then
  17793.       -- checks the TRANSFORMATION parameter to ensure that it is
  17794.       -- not less than 1.  Then it checks the validity of the VIEW-
  17795.       -- PORT_LIMITS passed in.  This is done by checking the
  17796.       -- rectangle values and by checking to see if the viewport
  17797.       -- is in the NDC unit square.  If all of the checks are
  17798.       -- satisfactory, the viewport is set.
  17799.      
  17800.       if CURRENT_OPERATING_STATE = GKCL then
  17801.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,"SET_VIEWPORT");-- Error 8
  17802.          raise STATE_ERROR;
  17803.      
  17804.       elsif TRANSFORMATION < 1 then
  17805.          ERROR_LOGGING (INVALID_XFORM_NUMBER, "SET_VIEWPORT");-- Error 50
  17806.          raise TRANSFORMATION_ERROR;
  17807.      
  17808.       elsif (VIEWPORT_LIMITS.XMIN >= VIEWPORT_LIMITS.XMAX) or
  17809.             (VIEWPORT_LIMITS.YMIN >= VIEWPORT_LIMITS.YMAX) then
  17810.          ERROR_LOGGING (INVALID_RECTANGLE, "SET_VIEWPORT");   -- Error 51
  17811.          raise TRANSFORMATION_ERROR;
  17812.      
  17813.       elsif (VIEWPORT_LIMITS.XMIN < 0.0) or
  17814.             (VIEWPORT_LIMITS.XMAX > 1.0) or
  17815.             (VIEWPORT_LIMITS.YMIN < 0.0) or
  17816.             (VIEWPORT_LIMITS.YMAX > 1.0) then
  17817.          ERROR_LOGGING (VIEWPORT_NOT_IN_NDC_UNIT_SQR,
  17818.                         "SET_VIEWPORT");                  -- Error 52
  17819.          raise TRANSFORMATION_ERROR;
  17820.      
  17821.       else
  17822.          if (TRANSFORMATION = GKS_STATE_LIST.
  17823.             CURRENT_NORMALIZATION_TRANSFORMATION) and
  17824.             (GKS_STATE_LIST.CLIP_INDICATOR = CLIP) then
  17825.             GKS_INSTR.CLIPPING_RECTANGLE_SET := VIEWPORT_LIMITS;
  17826.             WS_MANAGER (GKS_INSTR);
  17827.          end if;
  17828.      
  17829.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  17830.          (TRANSFORMATION).VIEWPORT := VIEWPORT_LIMITS;
  17831.      
  17832.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  17833.             (TRANSFORMATION).NDC_FACTORS := TRANSLATION_FACTORS.
  17834.             GET_NORMALIZATION_FACTORS(GKS_STATE_LIST.
  17835.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(TRANSFORMATION).
  17836.             WINDOW,VIEWPORT_LIMITS);
  17837.      
  17838.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  17839.             (TRANSFORMATION).WC_FACTORS := TRANSLATION_FACTORS.
  17840.             GET_NORMALIZATION_FACTORS(VIEWPORT_LIMITS,GKS_STATE_LIST.
  17841.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(TRANSFORMATION).
  17842.             WINDOW);
  17843.       end if;
  17844.      
  17845.    -- The following procedure calls ensure that the primitive
  17846.    -- attributes that are affected by the new viewport are reset.
  17847.    SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_HEIGHT(GKS_STATE_LIST.
  17848.       CURRENT_CHAR_HEIGHT);
  17849.      
  17850.    SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_UP_VECTOR(GKS_STATE_LIST.
  17851.       CURRENT_CHAR_UP_VECTOR);
  17852.      
  17853.       exception
  17854.          when STATE_ERROR =>
  17855.             raise;
  17856.          when TRANSFORMATION_ERROR =>
  17857.             raise;
  17858.          when NUMERIC_ERROR =>
  17859.             ERROR_LOGGING (ARITHMETIC, "SET_VIEWPORT"); -- Error 308
  17860.             raise SYSTEM_ERROR;
  17861.          when OTHERS =>
  17862.             ERROR_LOGGING (UNKNOWN, "SET_VIEWPORT");    -- Error 2501
  17863.             raise;
  17864.      
  17865.    end SET_VIEWPORT;
  17866.      
  17867.    procedure SELECT_NORMALIZATION_TRANSFORMATION
  17868.       (TRANSFORMATION : in TRANSFORMATION_NUMBER) is
  17869.      
  17870.    -- The current normalization transformation number entry in the
  17871.    -- GKS_STATE_LIST is set to the value that was passed in.
  17872.    -- Also, if the clipping indicator is on in the GKS_STATE_LIST,
  17873.    -- the procedure passes the clipping rectangle (viewport) of the
  17874.    -- normalization transformation to the WS_MANAGER.
  17875.    --
  17876.    -- TRANSFORMATION - This is an integer value representing a
  17877.    --    normalization transformation.
  17878.      
  17879.    GKS_INSTR : CGI_SET_CLIPPING_RECTANGLE;
  17880.      
  17881.      
  17882.    begin
  17883.      
  17884.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17885.       -- to see if GKS is in the proper state before proceeding
  17886.       -- with the set to the GKS_STATE_LIST.
  17887.      
  17888.       if CURRENT_OPERATING_STATE = GKCL then
  17889.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  17890.                        "SELECT_NORMALIZATION_TRANSFORMATION"); -- Error 8
  17891.          raise STATE_ERROR;
  17892.      
  17893.       elsif  (TRANSFORMATION >
  17894.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS'LAST) then
  17895.          ERROR_LOGGING (INVALID_XFORM_NUMBER,
  17896.                        "SELECT_NORMALIZATION_TRANFORMATION"); -- Error 50
  17897.          raise TRANSFORMATION_ERROR;
  17898.      
  17899.       else
  17900.          if (TRANSFORMATION /= GKS_STATE_LIST.
  17901.             CURRENT_NORMALIZATION_TRANSFORMATION) and
  17902.             (GKS_STATE_LIST.CLIP_INDICATOR = CLIP) then
  17903.             GKS_INSTR.CLIPPING_RECTANGLE_SET := GKS_STATE_LIST.
  17904.               LIST_OF_NORMALIZATION_TRANSFORMATIONS
  17905.               (TRANSFORMATION).VIEWPORT;
  17906.             WS_MANAGER(GKS_INSTR);
  17907.          end if;
  17908.      
  17909.          GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION :=
  17910.             TRANSFORMATION;
  17911.      
  17912.       end if;
  17913.      
  17914.       exception
  17915.          when STATE_ERROR =>
  17916.             raise;
  17917.          when TRANSFORMATION_ERROR =>
  17918.             raise;
  17919.          when NUMERIC_ERROR =>
  17920.             ERROR_LOGGING (ARITHMETIC,
  17921.                            "SELECT_NORMALIZATION_TRANSFORMATION");
  17922.                                                           -- Error 308
  17923.             raise SYSTEM_ERROR;
  17924.          when OTHERS =>
  17925.             ERROR_LOGGING (UNKNOWN,
  17926.                            "SELECT_NORMALIZATION_TRANSFORMATION");
  17927.                                                           -- Error 2501
  17928.             raise;
  17929.      
  17930.    end SELECT_NORMALIZATION_TRANSFORMATION;
  17931.      
  17932.    procedure SET_CLIPPING_INDICATOR
  17933.       (CLIPPING : in CLIPPING_INDICATOR) is
  17934.      
  17935.    -- This procedure sets the clipping indicator in the GKS_STATE_LIST.
  17936.    -- If the indicator is turned OFF, the clipping rectangle of
  17937.    -- (0.0,1.0,0.0,1.0) is passed to the WS_MANAGER.  If it is turned
  17938.    -- ON, the viewport is sent to the WS_MANAGER.
  17939.    --
  17940.    -- CLIPPING - The value of this enumerated parameter may be CLIP
  17941.    --    or NOCLIP.  Its value determines whether or not clipping
  17942.    --    will be performed on successive output.
  17943.      
  17944.    GKS_INSTR : CGI_SET_CLIPPING_RECTANGLE;
  17945.      
  17946.      
  17947.    begin
  17948.      
  17949.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  17950.       -- to see if GKS is in the proper state before proceeding
  17951.       -- with the call to the WS_MANAGER.
  17952.      
  17953.       if CURRENT_OPERATING_STATE = GKCL then
  17954.             ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  17955.                            "SET_CLIPPING_INDICATOR");    -- Error 8
  17956.             raise STATE_ERROR;
  17957.       else
  17958.      
  17959.          if GKS_STATE_LIST.CLIP_INDICATOR /= CLIPPING then
  17960.             GKS_STATE_LIST.CLIP_INDICATOR := CLIPPING;
  17961.          end if;
  17962.      
  17963.       -- Call to the WS_MANAGER.
  17964.      
  17965.          if CLIPPING = CLIP then
  17966.             GKS_INSTR.CLIPPING_RECTANGLE_SET := GKS_STATE_LIST.
  17967.                LIST_OF_NORMALIZATION_TRANSFORMATIONS
  17968.                (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  17969.                VIEWPORT;
  17970.             WS_MANAGER (GKS_INSTR);
  17971.          elsif CLIPPING = NOCLIP then
  17972.             GKS_INSTR.CLIPPING_RECTANGLE_SET := GKS_STATE_LIST.
  17973.                LIST_OF_NORMALIZATION_TRANSFORMATIONS (0).VIEWPORT;
  17974.             WS_MANAGER (GKS_INSTR);
  17975.          end if;
  17976.      
  17977.       end if;
  17978.      
  17979.       exception
  17980.          when STATE_ERROR =>
  17981.             raise;
  17982.          when NUMERIC_ERROR =>
  17983.             ERROR_LOGGING (ARITHMETIC,"SET_CLIPPING_INDICATOR");
  17984.             raise SYSTEM_ERROR;                           -- Error 308
  17985.          when OTHERS =>
  17986.             ERROR_LOGGING (UNKNOWN,"SET_CLIPPING_INDICATOR");-- Error 2501
  17987.             raise;
  17988.      
  17989.    end SET_CLIPPING_INDICATOR;
  17990.      
  17991. end GKS_NORMALIZATION;
  17992. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17993. --:UDD:GKSADACM:CODE:MA:WS_XFORM_B.ADA
  17994. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17995. ------------------------------------------------------------------
  17996. --
  17997. --  NAME: WS_TRANSFORMATION - BODY
  17998. --  IDENTIFIER: GIMXXX.1(2)
  17999. --  DISCREPANCY REPORTS:
  18000. --  DR033  Check for = in determining rectangle validity.
  18001. ------------------------------------------------------------------
  18002. -- file:  ws_xform_b.ada
  18003. -- level: all levels
  18004.      
  18005. with WSM;
  18006. with CGI;
  18007. with ERROR_ROUTINES;
  18008. with GKS_OPERATING_STATE_LIST;
  18009. with GKS_STATE_LIST;
  18010. with GKS_ERRORS;
  18011.      
  18012. use WSM;
  18013. use CGI;
  18014. use ERROR_ROUTINES;
  18015. use GKS_OPERATING_STATE_LIST;
  18016. use GKS_ERRORS;
  18017.      
  18018. package body WS_TRANSFORMATION is
  18019.      
  18020. -- This is the package body for the workstation normalization
  18021. -- transformation procedures.
  18022. --
  18023. -- Each of the procedures in this package inquires the
  18024. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  18025. -- of the states WSOP, WSAC, or SGOP.  If it is not, error
  18026. -- 7 occurs and the procedure raises the exception STATE_ERROR.
  18027. -- In addition, each procedure inquires the GKS_STATE_LIST to see
  18028. -- if the WS is in the set of open workstations before calling the
  18029. -- WS_MANAGER.  If it is not, error 25 occurs and the exception
  18030. -- WS_ERROR is raised.  A check is also made on the rectangle
  18031. -- limits to see if the rectangle is valid.  If not, error 51
  18032. -- occurs and the procedure raises the exception TRANSFORMATION_
  18033. -- ERROR.
  18034. --
  18035. -- If an error indicator above 0 occurs, these procedures call
  18036. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  18037. -- to log the error indicator and the name of the procedure
  18038. -- in the error file specified when the procedure OPEN_GKS
  18039. -- was called to begin this session of GKS operation.
  18040.      
  18041.    procedure SET_WS_WINDOW
  18042.       (WS              : in WS_ID;
  18043.       WS_WINDOW_LIMITS : in NDC.RECTANGLE_LIMITS) is
  18044.      
  18045.    -- This procedure calls the workstation manager to set the
  18046.    -- value of the requested workstation window entry in the
  18047.    -- workstation state list.  If the workstation manager returns
  18048.    -- error 33, or 36, this procedure raises  the exception
  18049.    -- WS_ERROR.
  18050.    --
  18051.    -- WS - This is an integer value representing the workstation
  18052.    --    identification.
  18053.    -- WS_WINDOW_LIMITS - This record defines the extent of the
  18054.    --    workstation window rectangle in normalized device coordinates.
  18055.    --    Its X and Y components give the limits in relation to the
  18056.    --    x and y axes.
  18057.      
  18058.    GKS_INSTR : CGI_SET_WS_WINDOW;
  18059.      
  18060.    begin
  18061.      
  18062.       -- The following if structure inquires the GKS_OPERATING_STATE_
  18063.       -- LIST to see if GKS is in the proper state.  It also inquires
  18064.       -- the GKS_STATE_LIST to see if the requested window limits are
  18065.       -- valid.  Finally, it checks the GKS_STATE_LIST to see if the
  18066.       -- workstation is in the set of open workstations before proceed-
  18067.       -- ing with the call to the WS_MANAGER.
  18068.      
  18069.       if (CURRENT_OPERATING_STATE = GKCL) or
  18070.          (CURRENT_OPERATING_STATE = GKOP) then
  18071.          ERROR_LOGGING (NOT_WSOP_WSAC_SGOP, "SET_WS_WINDOW"); -- Error 7
  18072.          raise STATE_ERROR;
  18073.      
  18074.       elsif (WS_WINDOW_LIMITS.XMIN >= WS_WINDOW_LIMITS.XMAX) or
  18075.             (WS_WINDOW_LIMITS.YMIN >= WS_WINDOW_LIMITS.YMAX) then
  18076.          ERROR_LOGGING (INVALID_RECTANGLE, "SET_WS_WINDOW");  -- Error 51
  18077.          raise TRANSFORMATION_ERROR;
  18078.      
  18079.       elsif (WS_WINDOW_LIMITS.XMIN < 0.0) or
  18080.             (WS_WINDOW_LIMITS.XMAX > 1.0) or
  18081.             (WS_WINDOW_LIMITS.YMIN < 0.0) or
  18082.             (WS_WINDOW_LIMITS.YMAX > 1.0) then
  18083.          ERROR_LOGGING (WS_WINDOW_NOT_IN_NDC_UNIT_SQR,
  18084.                         "SET_WS_WINDOW");                    -- Error 53
  18085.          raise TRANSFORMATION_ERROR;
  18086.      
  18087.       elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  18088.          ERROR_LOGGING (WS_NOT_OPEN, "SET_WS_WINDOW");       -- Error 25
  18089.          raise WS_ERROR;
  18090.      
  18091.       else
  18092.          GKS_INSTR.WS_TO_SET_WINDOW := WS;
  18093.          GKS_INSTR.WS_WINDOW_LIMITS_SET := WS_WINDOW_LIMITS;
  18094.          WS_MANAGER (GKS_INSTR);
  18095.      
  18096.          if GKS_INSTR.EI /= SUCCESSFUL then             -- Error 0
  18097.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or    -- Error 33
  18098.                (GKS_INSTR.EI = WS_IS_WISS) then         -- Error 36
  18099.                ERROR_LOGGING(GKS_INSTR.EI, "SET_WS_WINDOW");
  18100.                raise WS_ERROR;
  18101.             end if;
  18102.      
  18103.          end if;
  18104.      
  18105.       end if;
  18106.      
  18107.       exception
  18108.          when STATE_ERROR =>
  18109.             raise;
  18110.          when TRANSFORMATION_ERROR =>
  18111.             raise;
  18112.          when WS_ERROR =>
  18113.             raise;
  18114.          when NUMERIC_ERROR =>
  18115.             ERROR_LOGGING (ARITHMETIC,"SET_WS_WINDOW");   -- Error 308
  18116.             raise SYSTEM_ERROR;
  18117.          when OTHERS =>
  18118.             ERROR_LOGGING (UNKNOWN, "SET_WS_WINDOW");     -- Error 2501
  18119.             raise;
  18120.      
  18121.    end SET_WS_WINDOW;
  18122.      
  18123.    procedure SET_WS_VIEWPORT
  18124.       (WS                : in WS_ID;
  18125.       WS_VIEWPORT_LIMITS : in DC.RECTANGLE_LIMITS) is
  18126.      
  18127.    -- This procedure calls the workstation manager to set the value
  18128.    -- of the requested workstation viewport in the workstation state
  18129.    -- list.  If the workstation manager returns error 33, or 36,
  18130.    -- this procedure raises the exception WS_ERROR.  If the workstation
  18131.    -- manager returns error 54, this procedure raises the
  18132.    -- exception TRANSFORMATION_ERROR.
  18133.    --
  18134.    -- WS - This is an integer value representing the workstation
  18135.    --    identification.
  18136.    -- VIEWPORT_LIMITS - This record defines the extent of the
  18137.    --    viewport rectangle in device coordinates.  Its X and Y
  18138.    --    components give the limits in relation to the x and y axes.
  18139.      
  18140.    GKS_INSTR : CGI_SET_WS_VIEWPORT;
  18141.      
  18142.    begin
  18143.      
  18144.       -- The following if structure inquires the GKS_OPERATING_STATE_
  18145.       -- LIST to see if GKS is in the proper state.  It also inquires
  18146.       -- the GKS_STATE_LIST to see if the requested window limits are
  18147.       -- valid.  Finally, it checks the GKS_STATE_LIST to see if the
  18148.       -- workstation is in the set of open workstations before proceed-
  18149.       -- ing with the call to the WS_MANAGER.
  18150.      
  18151.       if (CURRENT_OPERATING_STATE = GKCL) or
  18152.          (CURRENT_OPERATING_STATE = GKOP) then
  18153.          ERROR_LOGGING (NOT_WSOP_WSAC_SGOP,
  18154.                         "SET_WS_VIEWPORT");             -- Error 7
  18155.          raise STATE_ERROR;
  18156.      
  18157.       elsif (WS_VIEWPORT_LIMITS.XMIN >= WS_VIEWPORT_LIMITS.XMAX) or
  18158.             (WS_VIEWPORT_LIMITS.YMIN >= WS_VIEWPORT_LIMITS.YMAX) then
  18159.          ERROR_LOGGING (INVALID_RECTANGLE,
  18160.                         "SET_WS_VIEWPORT");                -- Error 51
  18161.          raise TRANSFORMATION_ERROR;
  18162.      
  18163.       elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  18164.          ERROR_LOGGING (WS_NOT_OPEN, "SET_WS_VIEWPORT");    -- Error 25
  18165.          raise WS_ERROR;
  18166.      
  18167.       else
  18168.          GKS_INSTR.WS_TO_SET_VIEWPORT := WS;
  18169.          GKS_INSTR.WS_VIEWPORT_LIMITS_SET := WS_VIEWPORT_LIMITS;
  18170.          WS_MANAGER (GKS_INSTR);
  18171.      
  18172.          if GKS_INSTR.EI /= SUCCESSFUL then                 -- Error 0
  18173.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or        -- Error 33
  18174.                (GKS_INSTR.EI = WS_IS_WISS) or               -- Error 36
  18175.                (GKS_INSTR.EI = WS_VIEWPORT_NOT_IN_DISPLAY_SPACE) then
  18176.                                                             -- Error 54
  18177.                ERROR_LOGGING(GKS_INSTR.EI, "SET_WS_VIEWPORT");
  18178.                raise WS_ERROR;
  18179.             end if;
  18180.      
  18181.          end if;
  18182.      
  18183.       end if;
  18184.      
  18185.       exception
  18186.          when STATE_ERROR =>
  18187.             raise;
  18188.          when WS_ERROR =>
  18189.             raise;
  18190.          when TRANSFORMATION_ERROR =>
  18191.             raise;
  18192.          when NUMERIC_ERROR =>
  18193.             ERROR_LOGGING (ARITHMETIC,"SET_WS_VIEWPORT");  -- Error 308
  18194.             raise SYSTEM_ERROR;
  18195.          when OTHERS =>
  18196.             ERROR_LOGGING (UNKNOWN, "SET_WS_VIEWPORT");  -- Error 2501
  18197.             raise;
  18198.      
  18199.    end SET_WS_VIEWPORT;
  18200.      
  18201. end WS_TRANSFORMATION;
  18202. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18203. --:UDD:GKSADACM:CODE:MA:INQ_GKS_ST_LST_MA_B.ADA
  18204. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18205. ------------------------------------------------------------------
  18206. --
  18207. --  NAME: INQ_GKS_STATE_LIST_MA - BODY
  18208. --  IDENTIFIER: GIMXXX.1(1)
  18209. --  DISCREPANCY REPORTS:
  18210. --
  18211. ------------------------------------------------------------------
  18212. -- file:  inq_gks_st_lst_ma_b.ada
  18213. -- level: all levels
  18214.      
  18215. with GKS_OPERATING_STATE_LIST;
  18216. with GKS_ERRORS;
  18217. with GKS_STATE_LIST;
  18218.      
  18219. use GKS_OPERATING_STATE_LIST;
  18220. use GKS_ERRORS;
  18221.      
  18222. package body INQ_GKS_STATE_LIST_MA is
  18223.      
  18224. -- This is the package body for the procedures to inquire the
  18225. -- GKS state list.
  18226. --
  18227. -- Each of the procedures in this package inquires the
  18228. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  18229. -- of the states GKOP, WSOP, WSAC, or SGOP.  If it
  18230. -- is not, error indicator 8 occurs but no exception is raised.
  18231.      
  18232.    procedure INQ_CURRENT_NORMALIZATION_TRANSFORMATION_NUMBER
  18233.       (EI            : out ERROR_INDICATOR;
  18234.       TRANSFORMATION : out TRANSFORMATION_NUMBER) is
  18235.      
  18236.    -- This procedure inquires the GKS_STATE_LIST for the current
  18237.    -- normalization transformation number.  If the inquired infor-
  18238.    -- mation is available, the error indicator is returned by this
  18239.    -- procedure as 0 and the requested information is returned.
  18240.    --
  18241.    -- EI - This is the error indicator.  Its numeric value represents
  18242.    --    the type of error, if any, that occurred.
  18243.    -- TRANSFORMATION - This is an integer value representing the current
  18244.    --    normalization transformation.
  18245.      
  18246.    begin
  18247.      
  18248.       -- The following case inquires the GKS_OPERATING_STATE_LIST
  18249.       -- to see if GKS is in the proper state before proceeding
  18250.       -- with the inquiry of the GKS_STATE_LIST.
  18251.      
  18252.       if CURRENT_OPERATING_STATE = GKCL then
  18253.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  18254.          TRANSFORMATION := TRANSFORMATION_NUMBER'FIRST;
  18255.       else
  18256.          EI := SUCCESSFUL;               -- Error 0
  18257.          TRANSFORMATION := GKS_STATE_LIST.
  18258.                               CURRENT_NORMALIZATION_TRANSFORMATION;
  18259.       end if;
  18260.      
  18261.    end INQ_CURRENT_NORMALIZATION_TRANSFORMATION_NUMBER;
  18262.      
  18263.    procedure INQ_NORMALIZATION_TRANSFORMATION
  18264.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  18265.       EI              : out ERROR_INDICATOR;
  18266.       WINDOW_LIMITS   : out WC.RECTANGLE_LIMITS;
  18267.       VIEWPORT_LIMITS : out NDC.RECTANGLE_LIMITS) is
  18268.      
  18269.    -- This procedure inquires the GKS_STATE_LIST for the current
  18270.    -- normalization transformation.  If the inquired information
  18271.    -- is available, the error indicator is returned by this procedure
  18272.    -- as 0 and the requested information is returned.
  18273.    --
  18274.    -- TRANSFORMATION - This is an integer value representing a
  18275.    --    normalization transformation.
  18276.    -- EI - This is the error indicator.  Its numeric value represents
  18277.    --    the type of error, if any, that occurred.
  18278.    -- WINDOW_LIMITS - This record defines the extent of the
  18279.    --    window rectangle in world coordinates. Its X and Y
  18280.    --    components give the limits in relation to the x and y
  18281.    --    axes.
  18282.    -- VIEWPORT_LIMITS - This record defines the extent of the
  18283.    --    viewport rectangle in normalized device coordinates.
  18284.    --    Its X and Y components give the limits in relation to
  18285.    --    the x and y axes.
  18286.      
  18287.    begin
  18288.      
  18289.       -- The following if structure inquires the GKS_OPERATING_
  18290.       -- STATE_LIST to see if GKS is in the proper state and the
  18291.       -- transformation number is valid before proceeding with
  18292.       -- the inquiry of the GKS_STATE_LIST.
  18293.      
  18294.       if CURRENT_OPERATING_STATE = GKCL then
  18295.          EI := NOT_GKOP_WSOP_WSAC_SGOP;     -- Error 8
  18296.          WINDOW_LIMITS := (0.0,1.0,0.0,1.0);
  18297.          VIEWPORT_LIMITS := (0.0,1.0,0.0,1.0);
  18298.      
  18299.       elsif TRANSFORMATION < 0 then
  18300.          EI := INVALID_XFORM_NUMBER;        -- Error 50
  18301.          WINDOW_LIMITS := (0.0,1.0,0.0,1.0);
  18302.          VIEWPORT_LIMITS := (0.0,1.0,0.0,1.0);
  18303.      
  18304.       else
  18305.          EI := SUCCESSFUL;                  -- Error 0
  18306.          WINDOW_LIMITS := GKS_STATE_LIST.
  18307.             LIST_OF_NORMALIZATION_TRANSFORMATIONS
  18308.             (TRANSFORMATION).WINDOW;
  18309.          VIEWPORT_LIMITS := GKS_STATE_LIST.
  18310.             LIST_OF_NORMALIZATION_TRANSFORMATIONS
  18311.             (TRANSFORMATION).VIEWPORT;
  18312.       end if;
  18313.      
  18314.    end INQ_NORMALIZATION_TRANSFORMATION;
  18315.      
  18316.    procedure INQ_CLIPPING
  18317.       (EI                : out ERROR_INDICATOR;
  18318.       CLIPPING           : out CLIPPING_INDICATOR;
  18319.       CLIPPING_RECTANGLE : out NDC.RECTANGLE_LIMITS) is
  18320.      
  18321.    -- This procedure inquires the GKS_STATE_LIST to obtain the current
  18322.    -- clipping indicator.  If the inquired information is available,
  18323.    -- the error indicator is returned to this procedure as 0 and the
  18324.    -- requested information is returned.
  18325.    --
  18326.    -- EI - This is the error indicator.  Its numeric value represents
  18327.    --    the type of error, if any, that occurred.
  18328.    -- CLIPPING - The value of this enumerated parameter may be CLIP
  18329.    --    or NOCLIP.  Its value determines whether or not clipping
  18330.    --    is being performed on current output.
  18331.    -- CLIPPING_RECTANGLE - This record defines the extent of the
  18332.    --    clipping area in normalized device coordinates.  The
  18333.    --    X and Y components define the limits of the rectangle
  18334.    --    along the x and y axes.
  18335.      
  18336.    begin
  18337.      
  18338.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  18339.       -- to see if GKS is in the proper state before proceeding.
  18340.      
  18341.       if CURRENT_OPERATING_STATE = GKCL then
  18342.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  18343.          CLIPPING := CLIPPING_INDICATOR'FIRST;
  18344.          CLIPPING_RECTANGLE := (0.0,1.0,0.0,1.0);
  18345.       else
  18346.          EI := SUCCESSFUL;              -- Error 0
  18347.          CLIPPING := GKS_STATE_LIST.CLIP_INDICATOR;
  18348.          CLIPPING_RECTANGLE := GKS_STATE_LIST.
  18349.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(GKS_STATE_LIST.
  18350.             CURRENT_NORMALIZATION_TRANSFORMATION).VIEWPORT;
  18351.       end if;
  18352.      
  18353.    end INQ_CLIPPING;
  18354.      
  18355. end INQ_GKS_STATE_LIST_MA;
  18356. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18357. --:UDD:GKSADACM:CODE:MA:INQ_GKS_DSCR_TBL_MAB.ADA
  18358. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18359. ------------------------------------------------------------------
  18360. --
  18361. --  NAME: INQ_GKS_DESCRIPTION_TABLE_MA
  18362. --  IDENTIFIER: GIMXXX.1(1)
  18363. --  DISCREPANCY REPORTS:
  18364. --
  18365. ------------------------------------------------------------------
  18366. -- file:  inq_gks_dscr_tbl_mab.ada
  18367. -- level: all levels
  18368.      
  18369. with GKS_DESCRIPTION_TABLE;
  18370. with GKS_OPERATING_STATE_LIST;
  18371. with GKS_ERRORS;
  18372.      
  18373. use GKS_OPERATING_STATE_LIST;
  18374. use GKS_ERRORS;
  18375.      
  18376. package body INQ_GKS_DESCRIPTION_TABLE_MA is
  18377.      
  18378. -- This is the package body for the procedures to inquire the
  18379. -- GKS_DESCRIPTION_TABLE.
  18380.      
  18381.    procedure INQ_LEVEL_OF_GKS
  18382.       (EI   : out ERROR_INDICATOR;
  18383.       LEVEL : out GKS_LEVEL) is
  18384.      
  18385.    -- This procedure inquires the GKS_OPERATING_STATE_LIST
  18386.    -- to see if GKS is in one of the states GKOP, WSOP,
  18387.    -- WSAC, or SGOP.  If it is not, error 8 occurs and this
  18388.    -- procedure raises the exception STATE_ERROR.  Otherwise,
  18389.    -- this procedure inquires the GKS description table for the
  18390.    -- level of the current implementation of GKS.  If the inquired
  18391.    -- information is available, the error indicator is returned as
  18392.    -- 0 by this procedure and the value requested is returned.
  18393.    --
  18394.    -- EI - This is the error indicator.  Its numeric value represents
  18395.    --    the type of error, if any, that occurred.
  18396.    -- LEVEL - This enumerated type gives level of GKS.  Its value may
  18397.    --    be Lma, Lmb, Lmc, L0a, L0b, L0c, L1a, L1b, L1c, L2a, L2b, or
  18398.    --    L2c.
  18399.      
  18400.    begin
  18401.      
  18402.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  18403.       -- to see if GKS is in the proper state before proceeding
  18404.       -- with the inquiry of the GKS_DESCRIPTION_TABLE.
  18405.      
  18406.       if CURRENT_OPERATING_STATE = GKCL then
  18407.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  18408.          LEVEL := GKS_LEVEL'FIRST;
  18409.       else
  18410.          EI := SUCCESSFUL;               -- Error 0
  18411.          LEVEL := GKS_DESCRIPTION_TABLE.LEVEL_OF_GKS;
  18412.       end if;
  18413.      
  18414.    end INQ_LEVEL_OF_GKS;
  18415.      
  18416. end INQ_GKS_DESCRIPTION_TABLE_MA;
  18417. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18418. --:UDD:GKSADACM:CODE:MA:INQ_WS_ST_LST_MA_B.ADA
  18419. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18420. ------------------------------------------------------------------
  18421. --
  18422. --  NAME: INQ_WS_STATE_LIST_MA - BODY
  18423. --  IDENTIFIER: GIMXXX.3.1
  18424. --  DISCREPANCY REPORTS:
  18425. --  DR016  Call deallocation procedures in INQ_WS_ST_LST_MA
  18426. ------------------------------------------------------------------
  18427. -- file:  inq_ws_st_lst_ma_b.ada
  18428. -- level: all levels
  18429.      
  18430. with WSM;
  18431. with CGI;
  18432. with GKS_OPERATING_STATE_LIST;
  18433. with GKS_STATE_LIST;
  18434. with GKS_ERRORS;
  18435. with GKS_DESCRIPTION_TABLE;
  18436. with TRANSFORMATION_MATH;
  18437.      
  18438. use WSM;
  18439. use CGI;
  18440. use GKS_OPERATING_STATE_LIST;
  18441. use GKS_ERRORS;
  18442.      
  18443. package body INQ_WS_STATE_LIST_MA is
  18444.      
  18445. -- This is the package body for the procedures to call the
  18446. -- workstation manager to inquire the workstation state list.
  18447. --
  18448. -- Each of the procedures in this package inquires the
  18449. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of the
  18450. -- states WSOP, WSAC, or SGOP.  If it is not, error indicator
  18451. -- 7 occurs but no exception is raised.  In addition, each of
  18452. -- the procedures inquires the GKS_STATE_LIST to see if the
  18453. -- requested WS is open.  If it is not, error indicator 25
  18454. -- occurs but no exception is raised.  If neither condition occurs,
  18455. -- (the EI is 0) then a call is made to the WS_MANAGER to do the
  18456. -- inquiry.
  18457.      
  18458.    procedure INQ_WS_CONNECTION_AND_TYPE
  18459.       (WS        : in WS_ID;
  18460.       EI         : out ERROR_INDICATOR;
  18461.       CONNECTION : out VARIABLE_CONNECTION_ID;
  18462.       TYPE_OF_WS : out WS_TYPE) is
  18463.      
  18464.    -- This procedure calls the workstation manager to obtain the
  18465.    -- connection identifier and the workstation type from the
  18466.    -- workstation state list.  If the inquired information is
  18467.    -- available, the workstation manager returns the error
  18468.    -- indicator as 0 and values requested.
  18469.    --
  18470.    -- WS - This is an integer value indicating the workstation
  18471.    --    identification.
  18472.    -- EI - This is the error indicator.  Its numeric value represents
  18473.    --    the type of error, if any, that occurred.
  18474.    -- CONNECTION - The physical identifier associated with the logical
  18475.    --    WS identifier.
  18476.    -- TYPE_OF_WS - This is an integer value representing the type of
  18477.    --    workstation.
  18478.      
  18479.    GKS_INSTR : CGI_INQ_WS_CONNECTION_AND_TYPE;
  18480.      
  18481.    TEMP_CONNECTION : VARIABLE_CONNECTION_ID;
  18482.      
  18483.    begin
  18484.      
  18485.       -- The following if structure inquires the GKS_OPERATING_
  18486.       -- STATE_LIST to see if GKS is in the proper state.  Then
  18487.       -- if so, it inquires the GKS_STATE_LIST to see if the WS is
  18488.       -- in the set of open workstations before proceeding with the
  18489.       -- inquiry call to the WS_MANAGER.
  18490.      
  18491.       if (CURRENT_OPERATING_STATE = GKCL) or
  18492.          (CURRENT_OPERATING_STATE = GKOP) then
  18493.          EI := NOT_WSOP_WSAC_SGOP;            -- Error 7
  18494.          CONNECTION := TEMP_CONNECTION;
  18495.          TYPE_OF_WS := WS_TYPE'FIRST;
  18496.      
  18497.       elsif not WS_IDS.IS_IN_LIST(WS,
  18498.             GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  18499.          EI := WS_NOT_OPEN;                   -- Error 25
  18500.          CONNECTION := TEMP_CONNECTION;
  18501.          TYPE_OF_WS := WS_TYPE'FIRST;
  18502.      
  18503.       else
  18504.      
  18505.          GKS_INSTR.WS_TO_INQ_CONNECTION_AND_TYPE := WS;
  18506.          WS_MANAGER (GKS_INSTR);
  18507.      
  18508.          if GKS_INSTR.EI /= SUCCESSFUL then   -- Error 0
  18509.             EI := UNKNOWN;                    -- Error 2501
  18510.          else
  18511.             EI := GKS_INSTR.EI;               -- Error 0
  18512.          end if;
  18513.      
  18514.          CONNECTION.CONNECT := GKS_INSTR.CONNECTION_INQ.all; -- DR004
  18515.          TYPE_OF_WS := GKS_INSTR.TYPE_OF_WS_INQ;
  18516.      
  18517.          FREE_CONNECTION_ID (GKS_INSTR.CONNECTION_INQ);
  18518.      
  18519.       end if;
  18520.      
  18521.    end INQ_WS_CONNECTION_AND_TYPE;
  18522.      
  18523.    procedure INQ_TEXT_EXTENT
  18524.       (WS                 : in WS_ID;
  18525.       POSITION            : in WC.POINT;
  18526.       CHAR_STRING         : in STRING;
  18527.       EI                  : out ERROR_INDICATOR;
  18528.       CONCATENATION_POINT : out WC.POINT;
  18529.       TEXT_EXTENT         : out TEXT_EXTENT_PARALLELOGRAM) is
  18530.      
  18531.    -- This procedure calls the workstation manager to obtain the
  18532.    -- value of the text extent rectangle and the concatenation
  18533.    -- point which can be used as the origin of a subsequent text
  18534.    -- output primitive for the concatenation of character strings.
  18535.    -- If the inquired information is available, the error indicator
  18536.    -- is returned by the workstation manager as 0.  If the inquired
  18537.    -- information is not available, the workstation manager returns
  18538.    -- error 39 to indicate the reason for non-availability.
  18539.    --
  18540.    -- WS - This is an integer value indicating the workstation
  18541.    --    identification.
  18542.    -- POSITION - This is a record with X and Y components indicating
  18543.    --    the point in world coordinates where the text starts.
  18544.    -- CHAR_STRING - This string is the text.
  18545.    -- EI - This is the error indicator.  Its numeric value represents
  18546.    --    the type of error, if any, that occurred.
  18547.    -- CONCATENATION_POINT - This is a record with X and Y components
  18548.    --    indicating the point in world coordinates that can be used
  18549.    --    as the origin of a subsequent text output primitive (as in
  18550.    --    the concatenation of strings).
  18551.    -- TEXT_EXTENT - This is a record with four components indicating
  18552.    --    the LOWER_LEFT, LOWER_RIGHT, UPPER_LEFT, and UPPER_RIGHT
  18553.    --    corner points of the text extent rectangle with respect to the
  18554.    --    vertical positioning of the text.  Each component is a
  18555.    --    record with X and Y components to indicate the point in
  18556.    --    world coordinates.
  18557.      
  18558.    GKS_INSTR : CGI_INQ_TEXT_EXTENT;
  18559.      
  18560.    begin
  18561.      
  18562.       -- The following if structure inquires the GKS_OPERATING_
  18563.       -- STATE_LIST to see if GKS is in the proper state.  Then
  18564.       -- if so, it inquires the GKS_STATE_LIST to see if the WS is
  18565.       -- in the set of open workstations before proceeding with the
  18566.       -- inquiry call to the WS_MANAGER.
  18567.      
  18568.       if (CURRENT_OPERATING_STATE = GKCL) or
  18569.          (CURRENT_OPERATING_STATE = GKOP) then
  18570.          EI := NOT_WSOP_WSAC_SGOP;            -- Error 7
  18571.          CONCATENATION_POINT := (0.0,0.0);
  18572.          TEXT_EXTENT := (LOWER_LEFT => (0.0,0.0),
  18573.                          LOWER_RIGHT => (0.0,0.0),
  18574.                          UPPER_LEFT => (0.0,0.0),
  18575.                          UPPER_RIGHT => (0.0,0.0));
  18576.      
  18577.       elsif not WS_IDS.IS_IN_LIST (WS,
  18578.             GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  18579.          EI := WS_NOT_OPEN;                   -- Error 25
  18580.          CONCATENATION_POINT := (0.0,0.0);
  18581.          TEXT_EXTENT := (LOWER_LEFT => (0.0,0.0),
  18582.                          LOWER_RIGHT => (0.0,0.0),
  18583.                          UPPER_LEFT => (0.0,0.0),
  18584.                          UPPER_RIGHT => (0.0,0.0));
  18585.      
  18586.       else
  18587.          GKS_INSTR.WS_TO_INQ_TEXT_EXTENT := WS;
  18588.      
  18589.          -- Transformation logic for WC to NDC
  18590.          GKS_INSTR.POSITION_TEXT := TRANSFORMATION_MATH.WC_TO_NDC
  18591.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  18592.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  18593.             .NDC_FACTORS, POSITION);
  18594.      
  18595.          GKS_INSTR.CHAR_STRING := new STRING'(CHAR_STRING);
  18596.      
  18597.          WS_MANAGER (GKS_INSTR);
  18598.      
  18599.          FREE_STRING (GKS_INSTR.CHAR_STRING);
  18600.      
  18601.          if GKS_INSTR.EI /= SUCCESSFUL then             -- Error 0
  18602.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then  -- Error 39
  18603.                EI := GKS_INSTR.EI;
  18604.             else
  18605.                EI := UNKNOWN;                           -- Error 2501
  18606.             end if;
  18607.          else
  18608.             EI := GKS_INSTR.EI;                         -- Error 0
  18609.          end if;
  18610.      
  18611.          CONCATENATION_POINT := TRANSFORMATION_MATH.NDC_TO_WC
  18612.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  18613.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  18614.             .WC_FACTORS, GKS_INSTR.CONCATENATION_POINT);
  18615.      
  18616.          TEXT_EXTENT.LOWER_LEFT := TRANSFORMATION_MATH.NDC_TO_WC
  18617.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  18618.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  18619.             .WC_FACTORS, GKS_INSTR.TEXT_EXTENT_LOWER_LEFT_INQ);
  18620.      
  18621.          TEXT_EXTENT.LOWER_RIGHT := TRANSFORMATION_MATH.NDC_TO_WC
  18622.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  18623.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  18624.             .WC_FACTORS, GKS_INSTR.TEXT_EXTENT_LOWER_RIGHT_INQ);
  18625.      
  18626.          TEXT_EXTENT.UPPER_LEFT := TRANSFORMATION_MATH.NDC_TO_WC
  18627.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  18628.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  18629.             .WC_FACTORS, GKS_INSTR.TEXT_EXTENT_UPPER_LEFT_INQ);
  18630.      
  18631.          TEXT_EXTENT.UPPER_RIGHT := TRANSFORMATION_MATH.NDC_TO_WC
  18632.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  18633.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  18634.             .WC_FACTORS, GKS_INSTR.TEXT_EXTENT_UPPER_RIGHT_INQ);
  18635.      
  18636.       end if;
  18637.      
  18638.       exception
  18639.          when NUMERIC_ERROR =>
  18640.             EI := ARITHMETIC;                            -- Error 308
  18641.             CONCATENATION_POINT := (0.0,0.0);
  18642.             TEXT_EXTENT := (LOWER_LEFT => (0.0,0.0),
  18643.                            LOWER_RIGHT => (0.0,0.0),
  18644.                            UPPER_LEFT  => (0.0,0.0),
  18645.                            UPPER_RIGHT => (0.0,0.0));
  18646.      
  18647.    end INQ_TEXT_EXTENT;
  18648.      
  18649.    procedure INQ_LIST_OF_COLOUR_INDICES
  18650.       (WS     : in WS_ID;
  18651.       EI      : out ERROR_INDICATOR;
  18652.       INDICES : out COLOUR_INDICES.LIST_OF) is
  18653.      
  18654.    -- This procedure calls the workstation manager to obtain the
  18655.    -- list of defined fill area indices for a particular workstation.
  18656.    -- If the inquired information is available, the error indicator is
  18657.    -- returned by the workstation manager as 0.  If the inquired infor-
  18658.    -- mation is not available, the workstation manager returns the
  18659.    -- error indicator as 33, 35, or 36 to indicate the reason for
  18660.    -- non-availability.
  18661.    --
  18662.    -- WS - This is an integer value indicating the workstation
  18663.    --    identification.
  18664.    -- EI - This is the error indicator.  Its numeric value represents
  18665.    --    the type of error, if any, that occurred.
  18666.    -- INDICES - This is a set type of colour indices.
  18667.      
  18668.    GKS_INSTR : CGI_INQ_LIST_OF_COLOUR_INDICES;
  18669.      
  18670.    begin
  18671.      
  18672.       -- The following if structure inquires the GKS_OPERATING_
  18673.       -- STATE_LIST to see if GKS is in the proper state.  Then
  18674.       -- if so, it inquires the GKS_STATE_LIST to see if the WS is
  18675.       -- in the set of open workstations before proceeding with the
  18676.       -- inquiry call to the WS_MANAGER.
  18677.      
  18678.       if (CURRENT_OPERATING_STATE = GKCL) or
  18679.          (CURRENT_OPERATING_STATE = GKOP) then
  18680.          EI := NOT_WSOP_WSAC_SGOP;                  -- Error 7
  18681.          INDICES := COLOUR_INDICES.NULL_LIST;
  18682.      
  18683.       elsif not WS_IDS.IS_IN_LIST(WS,
  18684.             GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  18685.          EI := WS_NOT_OPEN;                         -- Error 25
  18686.          INDICES := COLOUR_INDICES.NULL_LIST;
  18687.      
  18688.       else
  18689.          GKS_INSTR.WS_TO_INQ_COLOUR_INDICES := WS;
  18690.          WS_MANAGER (GKS_INSTR);
  18691.      
  18692.             if GKS_INSTR.EI /= SUCCESSFUL then
  18693.                if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  18694.                   (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) or   -- Error 35
  18695.                   (GKS_INSTR.EI = WS_IS_WISS) then           -- Error 36
  18696.                   EI := GKS_INSTR.EI;
  18697.                else
  18698.                   EI := UNKNOWN;                             -- Error 2501
  18699.                end if;
  18700.             else
  18701.                EI := GKS_INSTR.EI;                           -- Error 0
  18702.             end if;
  18703.      
  18704.          INDICES := GKS_INSTR.LIST_OF_COLOUR_INDICES_INQ;
  18705.      
  18706.       end if;
  18707.      
  18708.    end INQ_LIST_OF_COLOUR_INDICES;
  18709.      
  18710.    procedure INQ_COLOUR_REPRESENTATION
  18711.       (WS             : in WS_ID;
  18712.       INDEX           : in COLOUR_INDEX;
  18713.       RETURNED_VALUES : in RETURN_VALUE_TYPE;
  18714.       EI              : out ERROR_INDICATOR;
  18715.       COLOUR          : out COLOUR_REPRESENTATION) is
  18716.      
  18717.    -- This procedure calls the workstation manager to obtain the
  18718.    -- value for the colour intensities for a colour index on a
  18719.    -- workstation.  If the inquired information is available, the
  18720.    -- error indicator is returned by the workstation manager as 0.
  18721.    -- If the inquired information is not available, the error
  18722.    -- indicator is returned by the workstation manager as 33, 35,
  18723.    -- 36, 93 or 94 to indicate the reason for non-availability.
  18724.    --
  18725.    -- WS - This is an integer value indicating the workstation
  18726.    --    identification.
  18727.    -- INDEX - This is an integer value indicating the colour index
  18728.    --    into the colour table.
  18729.    -- RETURNED_VALUES - This is an enumerated parameter which may have
  18730.    --    a value of SET or REALIZED to indicate whether the returned
  18731.    --    values should be as they were set by the program or as they
  18732.    --    were actually realized.
  18733.    -- EI - This is the error indicator.  Its numeric value represents
  18734.    --    the type of error, if any, that occurred.
  18735.    -- COLOUR - This is a record with components RED, GREEN, and BLUE
  18736.    --    that represent the colour as a combination of intensities.
  18737.      
  18738.    GKS_INSTR : CGI_INQ_COLOUR_REPRESENTATION;
  18739.      
  18740.    begin
  18741.      
  18742.       -- The following if structure inquires the GKS_OPERATING_
  18743.       -- STATE_LIST to see if GKS is in the proper state.  Then
  18744.       -- if so, it inquires the GKS_STATE_LIST to see if the WS is
  18745.       -- in the set of open workstations before proceeding with the
  18746.       -- inquiry call to the WS_MANAGER.
  18747.      
  18748.       if (CURRENT_OPERATING_STATE = GKCL) or
  18749.          (CURRENT_OPERATING_STATE = GKOP) then
  18750.          EI := NOT_WSOP_WSAC_SGOP;               -- Error 7
  18751.          COLOUR := (RED => INTENSITY'FIRST,
  18752.                     GREEN => INTENSITY'FIRST,
  18753.                     BLUE => INTENSITY'FIRST);
  18754.      
  18755.       elsif not WS_IDS.IS_IN_LIST (WS,
  18756.             GKS_STATE_LIST.LIST_OF_OPEN_WS)  then
  18757.          EI := WS_NOT_OPEN;                      -- Error 25
  18758.          COLOUR := (RED => INTENSITY'FIRST,
  18759.                     GREEN => INTENSITY'FIRST,
  18760.                     BLUE => INTENSITY'FIRST);
  18761.      
  18762.       else
  18763.          GKS_INSTR.WS_TO_INQ_COLOUR_REP := WS;
  18764.          GKS_INSTR.COLOUR_INDEX_TO_INQ_COLOUR_REP := INDEX;
  18765.          GKS_INSTR.RETURN_VALUE_TO_INQ_COLOUR_REP := RETURNED_VALUES;
  18766.          WS_MANAGER (GKS_INSTR);
  18767.      
  18768.          if GKS_INSTR.EI /= SUCCESSFUL then               -- Error 0
  18769.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  18770.                (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) or   -- Error 35
  18771.                (GKS_INSTR.EI = WS_IS_WISS) or             -- Error 36
  18772.                (GKS_INSTR.EI = INVALID_COLOUR_INDEX) or   -- Error 93
  18773.                (GKS_INSTR.EI = NO_COLOUR_REP) then        -- Error 94
  18774.                EI := GKS_INSTR.EI;
  18775.             else
  18776.                EI := UNKNOWN;                             -- Error 2501
  18777.             end if;
  18778.      
  18779.          else
  18780.             EI := GKS_INSTR.EI;                           -- Error 0
  18781.          end if;
  18782.      
  18783.          COLOUR := GKS_INSTR.COLOUR_REP_INQ;
  18784.      
  18785.       end if;
  18786.      
  18787.      
  18788.    end INQ_COLOUR_REPRESENTATION;
  18789.      
  18790.    procedure INQ_WS_TRANSFORMATION
  18791.       (WS                : in WS_ID;
  18792.       EI                 : out ERROR_INDICATOR;
  18793.       UPDATE             : out UPDATE_STATE;
  18794.       REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  18795.       CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  18796.       REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  18797.       CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS) is
  18798.      
  18799.    -- This procedure calls the workstation manager to obtain the
  18800.    -- following workstation transformation information:
  18801.    --  1) the workstation transformation update state
  18802.    --  2) the requested workstation window
  18803.    --  3) the current workstation window
  18804.    --  4) the requested workstation viewport
  18805.    --  5) the current workstation viewport.
  18806.    -- If the inquired information is available, the error indicator
  18807.    -- is returned by the workstation manager as 0.  If the inquired
  18808.    -- information is not available, the error indicator is returned by
  18809.    -- the workstation manager as 33, or 36 to indicate the reason
  18810.    -- for non-availability.
  18811.    --
  18812.    -- WS - This is an integer value indicating the workstation
  18813.    --    identification.
  18814.    -- EI - This is the error indicator.  Its numeric value represents
  18815.    --    the type of error, if any, that occurred.
  18816.    -- UPDATE - This enumerated parameter may have the value NOTPENDING,
  18817.    --    or PENDING to indicate whether or not a workstation transforma-
  18818.    --    tion change has been requested and not yet provided.
  18819.    -- REQUESTED_WINDOW - This record defines the extent of the
  18820.    --    requested window (this is the window "set" by SET_WS_WINDOW)
  18821.    --    in normalized device coordinates.  Its X and Y components give
  18822.    --    the limits in relation to the x and y axes.
  18823.    -- CURRENT_WINDOW  - This record defines the extent of the current
  18824.    --    window in normalized device coordinates.  Its X and Y com-
  18825.    --    ponents give the limits in relation to the x and y axes.
  18826.    -- REQUESTED_VIEWPORT - This record defines the extent of the
  18827.    --    requested viewport (this is the viewport "set" by SET_WS_
  18828.    --    VIEWPORT) in device coordinates.  Its X and Y components
  18829.    --    give the limits in relation to the x and y axes.
  18830.    -- CURRENT_VIEWPORT - This record defines the extent of the current
  18831.    --    viewport in device coordinates.  Its X and Y components give
  18832.    --    limits in relation to the x and y axes.
  18833.      
  18834.    GKS_INSTR : CGI_INQ_WS_TRANSFORMATION;
  18835.      
  18836.    begin
  18837.      
  18838.       -- The following if structure inquires the GKS_OPERATING_
  18839.       -- STATE_LIST to see if GKS is in the proper state.  Then
  18840.       -- if so, it inquires the GKS_STATE_LIST to see if the WS is
  18841.       -- in the set of open workstations before proceeding with the
  18842.       -- inquiry call to the WS_MANAGER.
  18843.      
  18844.       if (CURRENT_OPERATING_STATE = GKCL) or
  18845.          (CURRENT_OPERATING_STATE = GKOP) then
  18846.          EI := NOT_WSOP_WSAC_SGOP;            -- Error 7
  18847.          REQUESTED_WINDOW := (XMIN => 0.0,
  18848.                               XMAX => 0.0,
  18849.                               YMIN => 0.0,
  18850.                               YMAX => 0.0);
  18851.          CURRENT_WINDOW := (XMIN => 0.0,
  18852.                             XMAX => 0.0,
  18853.                             YMIN => 0.0,
  18854.                             YMAX => 0.0);
  18855.          REQUESTED_VIEWPORT := (XMIN => 0.0,
  18856.                                 XMAX => 0.0,
  18857.                                 YMIN => 0.0,
  18858.                                 YMAX => 0.0);
  18859.          CURRENT_VIEWPORT := (XMIN => 0.0,
  18860.                               XMAX => 0.0,
  18861.                               YMIN => 0.0,
  18862.                               YMAX => 0.0);
  18863.      
  18864.       elsif not WS_IDS.IS_IN_LIST (WS,
  18865.             GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  18866.          EI := WS_NOT_OPEN;                   -- Error 25
  18867.          REQUESTED_WINDOW := (XMIN => 0.0,
  18868.                               XMAX => 0.0,
  18869.                               YMIN => 0.0,
  18870.                               YMAX => 0.0);
  18871.          CURRENT_WINDOW := (XMIN => 0.0,
  18872.                             XMAX => 0.0,
  18873.                             YMIN => 0.0,
  18874.                             YMAX => 0.0);
  18875.          REQUESTED_VIEWPORT := (XMIN => 0.0,
  18876.                                 XMAX => 0.0,
  18877.                                 YMIN => 0.0,
  18878.                                 YMAX => 0.0);
  18879.          CURRENT_VIEWPORT := (XMIN => 0.0,
  18880.                               XMAX => 0.0,
  18881.                               YMIN => 0.0,
  18882.                               YMAX => 0.0);
  18883.      
  18884.       else
  18885.          GKS_INSTR.WS_TO_INQ_TRANSFORMATION := WS;
  18886.          WS_MANAGER (GKS_INSTR);
  18887.      
  18888.          if GKS_INSTR.EI /= SUCCESSFUL then            -- Error 0
  18889.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or   -- Error 33
  18890.                (GKS_INSTR.EI = WS_IS_WISS) then        -- Error 36
  18891.                EI := GKS_INSTR.EI;
  18892.             else
  18893.                EI := UNKNOWN;                          -- Error 2501
  18894.             end if;
  18895.      
  18896.          else
  18897.             EI := GKS_INSTR.EI;                         -- Error 0
  18898.          end if;
  18899.      
  18900.          UPDATE             := GKS_INSTR.UPDATE_INQ;
  18901.          REQUESTED_WINDOW   := GKS_INSTR.REQUESTED_WINDOW_INQ;
  18902.          CURRENT_WINDOW     := GKS_INSTR.CURRENT_WINDOW_INQ;
  18903.          REQUESTED_VIEWPORT := GKS_INSTR.REQUESTED_VIEWPORT_INQ;
  18904.          CURRENT_VIEWPORT   := GKS_INSTR.CURRENT_VIEWPORT_INQ;
  18905.      
  18906.       end if;
  18907.      
  18908.      
  18909.    end INQ_WS_TRANSFORMATION;
  18910.      
  18911. end INQ_WS_STATE_LIST_MA;
  18912. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18913. --:UDD:GKSADACM:CODE:MA:INQ_WS_DSCR_TBL_MA_B.ADA
  18914. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18915. ------------------------------------------------------------------
  18916. --
  18917. --  NAME: INQ_WS_DESCRIPTION_TABLE
  18918. --  IDENTIFIER: GIMXXX.1(1)
  18919. --  DISCREPANCY REPORTS:
  18920. --
  18921. ------------------------------------------------------------------
  18922. -- file:  inq_ws_dscr_tbl_ma_b.ada
  18923. -- level: all levels
  18924.      
  18925. with WSM;
  18926. with CGI;
  18927. with GKS_OPERATING_STATE_LIST;
  18928. with GKS_STATE_LIST;
  18929. with GKS_ERRORS;
  18930. with GKS_DESCRIPTION_TABLE;
  18931.      
  18932. use WSM;
  18933. use CGI;
  18934. use GKS_OPERATING_STATE_LIST;
  18935. use GKS_ERRORS;
  18936.      
  18937. package body INQ_WS_DESCRIPTION_TABLE_MA is
  18938.      
  18939. -- This is the package body for the procedures for calling the work-
  18940. -- station manager to inquire the workstation description tables.
  18941. --
  18942. -- Each of the procedures in this package inquires the
  18943. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of the
  18944. -- states GKOP, WSOP, WSAC, or SGOP.  If it is not, error
  18945. -- indicator 8 occurs but no exception is raised.
  18946.      
  18947.    procedure INQ_DISPLAY_SPACE_SIZE
  18948.       (WS                  : in WS_TYPE;
  18949.       EI                   : out ERROR_INDICATOR;
  18950.       UNITS                : out DC_UNITS;
  18951.       MAX_DC_SIZE          : out DC.SIZE;
  18952.       MAX_RASTER_UNIT_SIZE : out RASTER_UNIT_SIZE) is
  18953.      
  18954.    -- This procedure calls the workstation manager to obtain the value
  18955.    -- of the maximum display surface size in device coordinate units
  18956.    -- and what units the device coordinate units are (metres or others),
  18957.    -- and the maximum display surface size in  raster units.  If the
  18958.    -- inquired information is available, the error indicator is returned
  18959.    -- by the workstation manager as 0.  If the inquired information is
  18960.    -- not available, the workstation manager returns the error indicator
  18961.    -- as 31, 33, or 36 to indicate the reason for non-availability.
  18962.    --
  18963.    -- WS - This is an integer value indicating the workstation
  18964.    --    identification.
  18965.    -- EI - This is the error indicator.  Its numeric value represents
  18966.    --    the type of error, if any, that occurred.
  18967.    -- UNITS - This is an enumerated parameter which indicates if the
  18968.    --    device coordinate units for the WS are in METRES or OTHER.
  18969.    -- MAX_DC_SIZE - This record gives the maximum device coordinate
  18970.    --    magnitude as length along the X and Y axes (which are the
  18971.    --    components of the record).
  18972.    -- MAX_RASTER_UNIT_SIZE - This record provides the raster unit
  18973.    --    size in terms of the raster units along the X and Y axes.
  18974.    --    X and Y are the components of the record.
  18975.      
  18976.    GKS_INSTR : CGI_INQ_DISPLAY_SPACE_SIZE;
  18977.      
  18978.    begin
  18979.      
  18980.       -- The following if structure inquires the GKS_OPERATING
  18981.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  18982.       -- it checks to see if the WS exists by checking if it is
  18983.       -- in the list of available WS types in the GKS_DESCRIPTION_
  18984.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  18985.       -- called for the inquiry.
  18986.      
  18987.       if CURRENT_OPERATING_STATE = GKCL then
  18988.          EI := NOT_GKOP_WSOP_WSAC_SGOP;                -- Error 8
  18989.          UNITS := DC_UNITS'FIRST;
  18990.          MAX_DC_SIZE := (XAXIS => 1.0,
  18991.                          YAXIS => 1.0);
  18992.          MAX_RASTER_UNIT_SIZE := (X => RASTER_UNITS'FIRST,
  18993.                                   Y => RASTER_UNITS'FIRST);
  18994.      
  18995.       elsif not WS_TYPES.IS_IN_LIST (WS,GKS_DESCRIPTION_TABLE.
  18996.                                 LIST_OF_AVAILABLE_WS_TYPES) then
  18997.          EI := WS_TYPE_DOES_NOT_EXIST;                 -- Error 23
  18998.          UNITS := DC_UNITS'FIRST;
  18999.          MAX_DC_SIZE := (XAXIS => 1.0,
  19000.                          YAXIS => 1.0);
  19001.          MAX_RASTER_UNIT_SIZE := (X => RASTER_UNITS'FIRST,
  19002.                                   Y => RASTER_UNITS'FIRST);
  19003.      
  19004.       else
  19005.          -- Call to WS_MANAGER with the inquiry parameter.
  19006.          GKS_INSTR.WS_TO_INQ_DISPLAY_SPACE_SIZE := WS;
  19007.          WS_MANAGER (GKS_INSTR);
  19008.      
  19009.          if GKS_INSTR.EI /= SUCCESSFUL then            -- Error 0
  19010.      
  19011.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MO) or   -- Error 31
  19012.                (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or   -- Error 33
  19013.                (GKS_INSTR.EI = WS_IS_WISS) then        -- Error 36
  19014.                EI := GKS_INSTR.EI;
  19015.             else
  19016.                EI := UNKNOWN;                          -- Error 2501
  19017.             end if;
  19018.      
  19019.          else
  19020.             EI := GKS_INSTR.EI;                        -- Error 0
  19021.          end if;
  19022.      
  19023.          UNITS := GKS_INSTR.DISPLAY_SPACE_UNITS_INQ;
  19024.          MAX_DC_SIZE := GKS_INSTR.MAX_DC_SIZE_INQ;
  19025.                MAX_RASTER_UNIT_SIZE := GKS_INSTR.MAX_RASTER_UNIT_SIZE_INQ;
  19026.      
  19027.       end if;
  19028.      
  19029.    end INQ_DISPLAY_SPACE_SIZE;
  19030.      
  19031.    procedure INQ_POLYLINE_FACILITIES
  19032.       (WS               : in WS_TYPE;
  19033.       EI                : out ERROR_INDICATOR;
  19034.       LIST_OF_TYPES     : out LINETYPES.LIST_OF;
  19035.       NUMBER_OF_WIDTHS  : out NATURAL;
  19036.       NOMINAL_WIDTH     : out DC.MAGNITUDE;
  19037.       RANGE_OF_WIDTHS   : out DC.RANGE_OF_MAGNITUDES;
  19038.       NUMBER_OF_INDICES : out NATURAL) is
  19039.      
  19040.    -- This procedure calls the workstation manager to obtain the values
  19041.    -- of the facilities for polyline.  These include:
  19042.    --  1) the number of available linetypes
  19043.    --  2) the list of available linetypes
  19044.    --  3) the number of available linewidths
  19045.    --  4) the nominal linewidth
  19046.    --  5) the range of linewidths (minimum, maximum)
  19047.    --  6) the number of predefined polyline indices.
  19048.    -- If the inquired information is available, the error indicator is
  19049.    -- returned by the workstation manager as 0.  If the inquired infor-
  19050.    -- mation is not available, the workstation manager returns the error
  19051.    -- indicator as 39 to indicate the reason for non-availability.
  19052.    --
  19053.    -- WS - This is an integer value indicating the workstation
  19054.    --    identification.
  19055.    -- EI - This is the error indicator.  Its numeric value represents
  19056.    --    the type of error, if any, that occurred.
  19057.    -- LIST_OF_TYPES - This is a list type of LINETYPES.
  19058.    -- NUMBER_OF_WIDTHS - This is a natural number representing the
  19059.    --    number of line widths.
  19060.    -- NOMINAL_WIDTH - Indicates the nominal magnitude of the line
  19061.    --    in device coordinates.
  19062.    -- RANGE_OF_WIDTHS - This record type gives the MIN and MAX width
  19063.    --    limits for polylines.
  19064.    -- NUMBER_OF_INDICES - This is a natural number representing the
  19065.    --    number of indices.
  19066.      
  19067.    GKS_INSTR : CGI_INQ_POLYLINE_FACILITIES;
  19068.      
  19069.    begin
  19070.      
  19071.       -- The following if structure inquires the GKS_OPERATING
  19072.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  19073.       -- it checks to see if the WS exists by checking if it is
  19074.       -- in the list of available WS types in the GKS_DESCRIPTION_
  19075.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  19076.       -- called for the inquiry.
  19077.      
  19078.       if CURRENT_OPERATING_STATE = GKCL then
  19079.      
  19080.          EI := NOT_GKOP_WSOP_WSAC_SGOP;          -- Error 8
  19081.          LIST_OF_TYPES := LINETYPES.NULL_LIST;
  19082.          NUMBER_OF_WIDTHS := NATURAL'FIRST;
  19083.          NOMINAL_WIDTH := 1.0;
  19084.          RANGE_OF_WIDTHS := (MIN => 1.0,
  19085.                              MAX => 1.0);
  19086.          NUMBER_OF_INDICES := NATURAL'FIRST;
  19087.      
  19088.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  19089.                                LIST_OF_AVAILABLE_WS_TYPES) then
  19090.      
  19091.          EI := WS_TYPE_DOES_NOT_EXIST;           -- Error 23
  19092.          LIST_OF_TYPES := LINETYPES.NULL_LIST;
  19093.          NUMBER_OF_WIDTHS := NATURAL'FIRST;
  19094.          NOMINAL_WIDTH := 1.0;
  19095.          RANGE_OF_WIDTHS := (MIN => 1.0,
  19096.                              MAX => 1.0);
  19097.          NUMBER_OF_INDICES := NATURAL'FIRST;
  19098.      
  19099.       else
  19100.      
  19101.          GKS_INSTR.WS_TO_INQ_POLYLINE_FACILITIES := WS;
  19102.      
  19103.          -- The inquiry call is made to the workstation manager
  19104.          -- for the appropriate workstation.
  19105.      
  19106.          WS_MANAGER (GKS_INSTR);
  19107.      
  19108.          if (GKS_INSTR.EI /= SUCCESSFUL) then              -- Error 0
  19109.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) then   -- Error 39
  19110.                EI := GKS_INSTR.EI;
  19111.             else
  19112.                EI := UNKNOWN;                              -- Error 2501
  19113.             end if;
  19114.      
  19115.          else
  19116.             EI := GKS_INSTR.EI;                            -- Error 0
  19117.          end if;
  19118.      
  19119.          LIST_OF_TYPES     := GKS_INSTR.LIST_OF_POLYLINE_TYPES_INQ;
  19120.          NUMBER_OF_WIDTHS  := GKS_INSTR.NUMBER_OF_WIDTHS_INQ;
  19121.          NOMINAL_WIDTH     := GKS_INSTR.NOMINAL_WIDTH_INQ;
  19122.          RANGE_OF_WIDTHS   := GKS_INSTR.RANGE_OF_WIDTHS_INQ;
  19123.          NUMBER_OF_INDICES := GKS_INSTR.
  19124.                               NUMBER_OF_POLYLINE_INDICES_INQ;
  19125.      
  19126.       end if;
  19127.      
  19128.    end INQ_POLYLINE_FACILITIES;
  19129.      
  19130.    procedure INQ_POLYMARKER_FACILITIES
  19131.       (WS               : in WS_TYPE;
  19132.       EI                : out ERROR_INDICATOR;
  19133.       LIST_OF_TYPES     : out MARKER_TYPES.LIST_OF;
  19134.       NUMBER_OF_SIZES   : out NATURAL;
  19135.       NOMINAL_SIZE      : out DC.MAGNITUDE;
  19136.       RANGE_OF_SIZES    : out DC.RANGE_OF_MAGNITUDES;
  19137.       NUMBER_OF_INDICES : out NATURAL) is
  19138.      
  19139.    -- This procedure calls the workstation manager to obtain the values
  19140.    -- of the facilities for polymarker.  These include:
  19141.    --  1) the number of available marker types
  19142.    --  2) the list of available marker types
  19143.    --  3) the number of available marker sizes
  19144.    --  4) the nominal marker size
  19145.    --  5) the range of marker sizes (minimum, maximum)
  19146.    --  6) the number of predefined polymarker indices.
  19147.    -- If the inquired information is available, the error indicator is
  19148.    -- returned by the workstation manager as 0.  If the inquired infor-
  19149.    -- mation is not available, the workstation manager returns the error
  19150.    -- indicator as 39 to indicate the reason for non-availability.
  19151.    --
  19152.    -- WS - This is an integer value indicating the workstation
  19153.    --    identification.
  19154.    -- EI - This is the error indicator.  Its numeric value represents
  19155.    --    the type of error, if any, that occurred.
  19156.    -- LIST_OF_TYPES - This is a set type of MARKER_TYPES.
  19157.    -- NUMBER_OF_SIZES - This is a natural number representing the
  19158.    --    number of marker sizes.
  19159.    -- NOMINAL_SIZE - Indicates the nominal magnitude of the marker
  19160.    --    in device coordinates.
  19161.    -- RANGE_OF_SIZES - This record type gives the MIN and MAX size
  19162.    --    limits for polymarkers.
  19163.    -- NUMBER_OF_INDICES - This is a natural number representing the
  19164.    --    number of indices.
  19165.      
  19166.    GKS_INSTR : CGI_INQ_POLYMARKER_FACILITIES;
  19167.      
  19168.    begin
  19169.      
  19170.       -- The following if structure inquires the GKS_OPERATING
  19171.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  19172.       -- it checks to see if the WS exists by checking if it is
  19173.       -- in the list of available WS types in the GKS_DESCRIPTION_
  19174.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  19175.       -- called for the inquiry.
  19176.      
  19177.       if CURRENT_OPERATING_STATE = GKCL then
  19178.      
  19179.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  19180.          LIST_OF_TYPES := MARKER_TYPES.NULL_LIST;
  19181.          NUMBER_OF_SIZES := NATURAL'FIRST;
  19182.          NOMINAL_SIZE := 1.0;
  19183.          RANGE_OF_SIZES := (MIN => 1.0,
  19184.                             MAX => 1.0);
  19185.          NUMBER_OF_INDICES := NATURAL'FIRST;
  19186.      
  19187.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  19188.                                LIST_OF_AVAILABLE_WS_TYPES) then
  19189.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  19190.          LIST_OF_TYPES := MARKER_TYPES.NULL_LIST;
  19191.          NUMBER_OF_SIZES := NATURAL'FIRST;
  19192.          NOMINAL_SIZE := 1.0;
  19193.          RANGE_OF_SIZES := (MIN => 1.0,
  19194.                             MAX => 1.0);
  19195.          NUMBER_OF_INDICES := NATURAL'FIRST;
  19196.      
  19197.       else
  19198.      
  19199.          GKS_INSTR.WS_TO_INQ_POLYMARKER_FACILITIES := WS;
  19200.          WS_MANAGER (GKS_INSTR);
  19201.      
  19202.          if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  19203.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then   -- Error 39
  19204.                EI := GKS_INSTR.EI;
  19205.             else
  19206.                EI := UNKNOWN;                            -- Error 2501
  19207.             end if;
  19208.      
  19209.          else
  19210.             EI := GKS_INSTR.EI;                          -- Error 0
  19211.          end if;
  19212.      
  19213.          LIST_OF_TYPES     := GKS_INSTR.LIST_OF_POLYMARKER_TYPES_INQ;
  19214.          NUMBER_OF_SIZES   := GKS_INSTR.NUMBER_OF_SIZES_INQ;
  19215.          NOMINAL_SIZE      := GKS_INSTR.NOMINAL_SIZE_INQ;
  19216.          RANGE_OF_SIZES    := GKS_INSTR.RANGE_OF_SIZES_INQ;
  19217.          NUMBER_OF_INDICES := GKS_INSTR.
  19218.                               NUMBER_OF_POLYMARKER_INDICES_INQ;
  19219.      
  19220.       end if;
  19221.      
  19222.    end INQ_POLYMARKER_FACILITIES;
  19223.      
  19224.    procedure INQ_TEXT_FACILITIES
  19225.       (WS                  : in WS_TYPE;
  19226.       EI                   : out ERROR_INDICATOR;
  19227.       LIST_OF_FONT_PRECISION_PAIRS: out TEXT_FONT_PRECISIONS.LIST_OF;
  19228.       NUMBER_OF_HEIGHTS    : out NATURAL;
  19229.       RANGE_OF_HEIGHTS     : out DC.RANGE_OF_MAGNITUDES;
  19230.       NUMBER_OF_EXPANSIONS : out NATURAL;
  19231.       EXPANSION_RANGE      : out RANGE_OF_EXPANSIONS;
  19232.       NUMBER_OF_INDICES    : out NATURAL) is
  19233.      
  19234.    -- This procedure calls the workstation manager to obtain the values
  19235.    -- of the facilities for text.  These include:
  19236.    --  1) the number of text font and precision pairs
  19237.    --  2) the list of text font and precision pairs
  19238.    --  3) the number of available character heights
  19239.    --  4) the minimum character height
  19240.    --  5) the maximum character height
  19241.    --  6) the number of available character expansion factors
  19242.    --  7) the minimum character expansion factor
  19243.    --  8) the maximum character expansion factor
  19244.    --  9) the number of predefined text indices.
  19245.    -- If the inquired information is available, the error indicator is
  19246.    -- returned by the workstation manager as 0.  If the inquired infor-
  19247.    -- mation is not available, the workstation manager returns the
  19248.    -- error indication as 39 to indicate the reason for non-
  19249.    -- availability.
  19250.    --
  19251.    -- WS - This is an integer value indicating the workstation
  19252.    --    identification.
  19253.    -- EI - This is the error indicator.  Its numeric value represents
  19254.    --    the type of error, if any, that occurred.
  19255.    -- LIST_OF_FONT_PRECISION_PAIRS - This is a record containing a list
  19256.    --    of records which provides the text FONT and PRECISION.
  19257.    -- NUMBER_OF_HEIGHTS - This is a natural number representing the
  19258.    --    number of text character heights.
  19259.    -- RANGE_OF_HEIGHTS - This record type gives the MIN and MAX
  19260.    --    value for the character heights in device coordinates.
  19261.    -- NUMBER_OF_EXPANSIONS - This is a natural number representing the
  19262.    --    number of expansions factors available.
  19263.    -- EXPANSION_RANGE - This record type gives the MIN and MAX
  19264.    --    values for the character expansion factors in device coordi-
  19265.    --    nates.
  19266.    -- NUMBER_OF_INDICES - This is a natural number representing the
  19267.    --    number of indices.
  19268.      
  19269.    GKS_INSTR : CGI_INQ_TEXT_FACILITIES;
  19270.      
  19271.    begin
  19272.      
  19273.       -- The following if structure inquires the GKS_OPERATING
  19274.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  19275.       -- it checks to see if the WS exists by checking if it is
  19276.       -- in the list of available WS types in the GKS_DESCRIPTION_
  19277.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  19278.       -- called for the inquiry.
  19279.      
  19280.       if CURRENT_OPERATING_STATE = GKCL then
  19281.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  19282.          LIST_OF_FONT_PRECISION_PAIRS := TEXT_FONT_PRECISIONS.
  19283.                                          NULL_LIST;
  19284.          NUMBER_OF_HEIGHTS := NATURAL'FIRST;
  19285.          RANGE_OF_HEIGHTS := (MIN => 1.0,
  19286.                               MAX => 1.0);
  19287.          NUMBER_OF_EXPANSIONS := NATURAL'FIRST;
  19288.          EXPANSION_RANGE := (MIN => 1.0,
  19289.                              MAX => 1.0);
  19290.          NUMBER_OF_INDICES := NATURAL'FIRST;
  19291.      
  19292.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  19293.                                LIST_OF_AVAILABLE_WS_TYPES) then
  19294.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  19295.          LIST_OF_FONT_PRECISION_PAIRS := TEXT_FONT_PRECISIONS.
  19296.                                          NULL_LIST;
  19297.          NUMBER_OF_HEIGHTS := NATURAL'FIRST;
  19298.          RANGE_OF_HEIGHTS := (MIN => 1.0,
  19299.                               MAX => 1.0);
  19300.          NUMBER_OF_EXPANSIONS := NATURAL'FIRST;
  19301.          EXPANSION_RANGE := (MIN => 1.0,
  19302.                              MAX => 1.0);
  19303.          NUMBER_OF_INDICES := NATURAL'FIRST;
  19304.      
  19305.       else
  19306.          GKS_INSTR.WS_TO_INQ_TEXT_FACILITIES := WS;
  19307.          WS_MANAGER (GKS_INSTR);
  19308.      
  19309.          if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  19310.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then   -- Error 39
  19311.                EI := GKS_INSTR.EI;
  19312.             else
  19313.                EI := UNKNOWN;                            -- Error 2501
  19314.             end if;
  19315.      
  19316.          else
  19317.             EI := GKS_INSTR.EI;                          -- Error 0
  19318.          end if;
  19319.      
  19320.          LIST_OF_FONT_PRECISION_PAIRS := GKS_INSTR.
  19321.                                          LIST_OF_FONT_PRECISION_PAIRS_INQ;
  19322.          NUMBER_OF_HEIGHTS := GKS_INSTR.NUMBER_OF_HEIGHTS_INQ;
  19323.          RANGE_OF_HEIGHTS := GKS_INSTR.RANGE_OF_HEIGHTS_INQ;
  19324.          NUMBER_OF_EXPANSIONS := GKS_INSTR.NUMBER_OF_EXPANSIONS_INQ;
  19325.          EXPANSION_RANGE := GKS_INSTR.RANGE_OF_EXPANSIONS_INQ;
  19326.          NUMBER_OF_INDICES := GKS_INSTR.NUMBER_OF_TEXT_INDICES_INQ;
  19327.      
  19328.       end if;
  19329.      
  19330.    end INQ_TEXT_FACILITIES;
  19331.      
  19332.    procedure INQ_FILL_AREA_FACILITIES
  19333.       (WS                     : WS_TYPE;
  19334.       EI                      : out ERROR_INDICATOR;
  19335.       LIST_OF_INTERIOR_STYLES : out INTERIOR_STYLES.LIST_OF;
  19336.       LIST_OF_HATCH_STYLES    : out HATCH_STYLES.LIST_OF;
  19337.       NUMBER_OF_INDICES       : out NATURAL) is
  19338.      
  19339.    -- This procedure calls the workstation manager to obtain the values
  19340.    -- of the facilities for the fill area construct.  These include:
  19341.    --  1) the number of available fill area interior styles
  19342.    --  2) the list of available fill area interior styles
  19343.    --  3) the number of available hatch styles
  19344.    --  4) the list of available hatch styles
  19345.    --  5) the number of predefined fill area indices.
  19346.    -- If the inquired information is available, the error indicator is
  19347.    -- returned by the workstation manager as 0.  If the inquired infor-
  19348.    -- mation is not available, the workstation manager returns the
  19349.    -- error indicator as 39 to indicate the reason for non-availability.
  19350.    --
  19351.    -- WS - This is an integer value indicating the workstation
  19352.    --    identification.
  19353.    -- EI - This is the error indicator.  Its numeric value represents
  19354.    --    the type of error, if any, that occurred.
  19355.    -- LIST_OF_INTERIOR_STYLES - This is a set type of the interior
  19356.    --    styles available.  The value of the components are set to 1
  19357.    --    if the corresponding style is available.
  19358.    -- LIST_OF_HATCH_STYLES - This is a set type of the hatch styles
  19359.    --    available.  The value of the components are set to 1 if the
  19360.    --    corresponding hatch style is available.
  19361.    -- NUMBER_OF_INDICES - This is a natural number representing the
  19362.    --    number of indices.
  19363.      
  19364.    GKS_INSTR : CGI_INQ_FILL_AREA_FACILITIES;
  19365.      
  19366.    begin
  19367.      
  19368.       -- The following if structure inquires the GKS_OPERATING
  19369.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  19370.       -- it checks to see if the WS exists by checking if it is
  19371.       -- in the list of available WS types in the GKS_DESCRIPTION_
  19372.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  19373.       -- called for the inquiry.
  19374.      
  19375.       if CURRENT_OPERATING_STATE = GKCL then
  19376.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  19377.          LIST_OF_INTERIOR_STYLES := INTERIOR_STYLES.NULL_LIST;
  19378.          LIST_OF_HATCH_STYLES := HATCH_STYLES.NULL_LIST;
  19379.          NUMBER_OF_INDICES := NATURAL'FIRST;
  19380.      
  19381.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  19382.                                LIST_OF_AVAILABLE_WS_TYPES) then
  19383.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  19384.          LIST_OF_INTERIOR_STYLES := INTERIOR_STYLES.NULL_LIST;
  19385.          LIST_OF_HATCH_STYLES := HATCH_STYLES.NULL_LIST;
  19386.          NUMBER_OF_INDICES := NATURAL'FIRST;
  19387.      
  19388.       else
  19389.          GKS_INSTR.WS_TO_INQ_FILL_AREA_FACILITIES := WS;
  19390.          WS_MANAGER (GKS_INSTR);
  19391.      
  19392.          if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  19393.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then   -- Error 39
  19394.                EI := GKS_INSTR.EI;
  19395.             else
  19396.                EI := UNKNOWN;                            -- Error 2501
  19397.             end if;
  19398.      
  19399.          else
  19400.             EI := GKS_INSTR.EI;
  19401.          end if;
  19402.      
  19403.          LIST_OF_INTERIOR_STYLES := GKS_INSTR.
  19404.                                     LIST_OF_INTERIOR_STYLES_INQ;
  19405.          LIST_OF_HATCH_STYLES    := GKS_INSTR.LIST_OF_HATCH_STYLES_INQ;
  19406.          NUMBER_OF_INDICES       := GKS_INSTR.
  19407.                                     NUMBER_OF_FILL_AREA_INDICES_INQ;
  19408.      
  19409.       end if;
  19410.      
  19411.    end INQ_FILL_AREA_FACILITIES;
  19412.      
  19413.    procedure INQ_COLOUR_FACILITIES
  19414.       (WS                      : in WS_TYPE;
  19415.       EI                       : out ERROR_INDICATOR;
  19416.       NUMBER_OF_COLOURS        : out NATURAL;
  19417.       AVAILABLE_COLOUR         : out COLOUR_AVAILABLE;
  19418.       NUMBER_OF_COLOUR_INDICES : out NATURAL) is
  19419.      
  19420.    -- This procedure calls the workstation manager to obtain the values
  19421.    -- of the facilities for colour.  These include:
  19422.    --  1) the number of available colours or intensities
  19423.    --  2) if colour is available
  19424.    --  3) the number of predefined colour indices.
  19425.    -- If the inquired information is available, the error indicator is
  19426.    -- returned by the workstation manager as 0.  If the inquired infor-
  19427.    -- mation is not available, the workstation manager returns the
  19428.    -- error indicator as 39 to indicate the reason for non-availability.
  19429.    --
  19430.    -- WS - This is an integer value indicating the workstation
  19431.    --    identification.
  19432.    -- EI - This is the error indicator.  Its numeric value represents
  19433.    --    the type of error, if any, that occurred.
  19434.    -- NUMBER_OF_COLOURS - This is a natural number indicating the
  19435.    --    number of colours available.
  19436.    -- AVAILABLE_COLOUR - The value of this enumerated parameter
  19437.    --    can be COLOUR or MONOCHROME to indicate whether colour
  19438.    --    output is available on WS.
  19439.    -- NUMBER_OF_COLOUR_INDICES - This is an natural value representing
  19440.    --    the number of colour indices.
  19441.      
  19442.    GKS_INSTR : CGI_INQ_COLOUR_FACILITIES;
  19443.      
  19444.    begin
  19445.      
  19446.       -- The following if structure inquires the GKS_OPERATING
  19447.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  19448.       -- it checks to see if the WS exists by checking if it is
  19449.       -- in the list of available WS types in the GKS_DESCRIPTION_
  19450.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  19451.       -- called for the inquiry.
  19452.      
  19453.       if CURRENT_OPERATING_STATE = GKCL then
  19454.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  19455.          NUMBER_OF_COLOURS        := NATURAL'FIRST;
  19456.          AVAILABLE_COLOUR         := COLOUR_AVAILABLE'FIRST;
  19457.          NUMBER_OF_COLOUR_INDICES := NATURAL'FIRST;
  19458.      
  19459.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  19460.                                LIST_OF_AVAILABLE_WS_TYPES) then
  19461.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  19462.          NUMBER_OF_COLOURS        := NATURAL'FIRST;
  19463.          AVAILABLE_COLOUR         := COLOUR_AVAILABLE'FIRST;
  19464.          NUMBER_OF_COLOUR_INDICES := NATURAL'FIRST;
  19465.      
  19466.       else
  19467.          GKS_INSTR.WS_TO_INQ_COLOUR_FACILITIES := WS;
  19468.          WS_MANAGER (GKS_INSTR);
  19469.      
  19470.          if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  19471.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then   -- Error 39
  19472.                EI := GKS_INSTR.EI;
  19473.             else
  19474.                EI := UNKNOWN;                            -- Error 2501
  19475.             end if;
  19476.      
  19477.          else
  19478.             EI := GKS_INSTR.EI;                          -- Error 0
  19479.          end if;
  19480.      
  19481.          NUMBER_OF_COLOURS        := GKS_INSTR.NUMBER_OF_COLOURS_INQ;
  19482.          AVAILABLE_COLOUR         := GKS_INSTR.AVAILABLE_COLOUR_INQ;
  19483.          NUMBER_OF_COLOUR_INDICES := GKS_INSTR.
  19484.                                      NUMBER_OF_COLOUR_INDICES_INQ;
  19485.      
  19486.       end if;
  19487.      
  19488.    end INQ_COLOUR_FACILITIES;
  19489.      
  19490.    procedure INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  19491.       (WS                    : in WS_TYPE;
  19492.       EI                     : out ERROR_INDICATOR;
  19493.       MAX_POLYLINE_ENTRIES   : out NATURAL;
  19494.       MAX_POLYMARKER_ENTRIES : out NATURAL;
  19495.       MAX_TEXT_ENTRIES       : out NATURAL;
  19496.       MAX_FILL_AREA_ENTRIES  : out NATURAL;
  19497.       MAX_PATTERN_INDICES    : out NATURAL;
  19498.       MAX_COLOUR_INDICES     : out NATURAL) is
  19499.      
  19500.    -- This procedure calls the workstation manager to obtain the values
  19501.    -- of the maximum number of entries in the following bundle tables:
  19502.    --  1) polyline
  19503.    --  2) polymarker
  19504.    --  3) text
  19505.    --  4) fill area
  19506.    -- It also obtains the maximum number of pattern indices and the
  19507.    -- maximum number of colour indices.
  19508.    -- If the inquired information is available, the error indicator is
  19509.    -- returned by the workstation manager as 0.  If the inquired infor-
  19510.    -- mation is not available, the workstation manager returns the
  19511.    -- error indicator as 39 to indicate the reason for non-availability.
  19512.    --
  19513.    -- WS - This is an integer value indicating the workstation
  19514.    --    identification.
  19515.    -- EI - This is the error indicator.  Its numeric value represents
  19516.    --    the type of error, if any, that occurred.
  19517.    -- MAX_POLYLINE_ENTRIES - This is a natural number representing the
  19518.    --    maximum number of polyline entries in the workstation state
  19519.    --    tables.
  19520.    -- MAX_POLYMARKER_ENTRIES - This is a natural number representing the
  19521.    --    maximum number of polymarker entries in the workstation state
  19522.    --    tables.
  19523.    -- MAX_TEXT_ENTRIES - This is a natural number representing the
  19524.    --    maximum number of text entries in the workstation state
  19525.    --    tables.
  19526.    -- MAX_FILL_AREA_ENTRIES - This is a natural number representing the
  19527.    --    maximum number of fill area entries in the workstation state
  19528.    --    tables.
  19529.    -- MAX_PATTERN_INDICES - This is a natural number representing the
  19530.    --    maximum number of pattern indices in the workstation state
  19531.    --    tables.
  19532.    -- MAX_COLOUR_INDICES - This is a natural number representing the
  19533.    --    maximum number of colour indices in the workstation state
  19534.    --    tables.
  19535.      
  19536.    GKS_INSTR : CGI_INQ_MAX_LENGTH_OF_WS_STATE_TABLES;
  19537.      
  19538.    begin
  19539.      
  19540.       -- The following if structure inquires the GKS_OPERATING
  19541.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  19542.       -- it checks to see if the WS exists by checking if it is
  19543.       -- in the list of available WS types in the GKS_DESCRIPTION_
  19544.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  19545.       -- called for the inquiry.
  19546.      
  19547.       if CURRENT_OPERATING_STATE = GKCL then
  19548.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  19549.          MAX_POLYLINE_ENTRIES := NATURAL'FIRST;
  19550.          MAX_POLYMARKER_ENTRIES := NATURAL'FIRST;
  19551.          MAX_TEXT_ENTRIES := NATURAL'FIRST;
  19552.          MAX_FILL_AREA_ENTRIES := NATURAL'FIRST;
  19553.          MAX_PATTERN_INDICES := NATURAL'FIRST;
  19554.          MAX_COLOUR_INDICES := NATURAL'FIRST;
  19555.      
  19556.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  19557.                                LIST_OF_AVAILABLE_WS_TYPES) then
  19558.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  19559.          MAX_POLYLINE_ENTRIES := NATURAL'FIRST;
  19560.          MAX_POLYMARKER_ENTRIES := NATURAL'FIRST;
  19561.          MAX_TEXT_ENTRIES := NATURAL'FIRST;
  19562.          MAX_FILL_AREA_ENTRIES := NATURAL'FIRST;
  19563.          MAX_PATTERN_INDICES := NATURAL'FIRST;
  19564.          MAX_COLOUR_INDICES := NATURAL'FIRST;
  19565.      
  19566.       else
  19567.          GKS_INSTR.WS_TO_INQ_MAX_LENGTH_OF_WS_STATE_TABLES := WS;
  19568.          WS_MANAGER (GKS_INSTR);
  19569.      
  19570.          if GKS_INSTR.EI /= SUCCESSFUL then             -- Error 0
  19571.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then  -- Error 39
  19572.                EI := GKS_INSTR.EI;
  19573.             else
  19574.                EI := UNKNOWN;                            -- Error 2501
  19575.             end if;
  19576.      
  19577.          else
  19578.             EI := GKS_INSTR.EI;                          -- Error 0
  19579.          end if;
  19580.      
  19581.          MAX_POLYLINE_ENTRIES   := GKS_INSTR.MAX_POLYLINE_ENTRIES_INQ;
  19582.          MAX_POLYMARKER_ENTRIES := GKS_INSTR.MAX_POLYMARKER_ENTRIES_INQ;
  19583.          MAX_TEXT_ENTRIES       := GKS_INSTR.MAX_TEXT_ENTRIES_INQ;
  19584.          MAX_FILL_AREA_ENTRIES  := GKS_INSTR.MAX_FILL_AREA_ENTRIES_INQ;
  19585.          MAX_PATTERN_INDICES    := GKS_INSTR.MAX_PATTERN_INDICES_INQ;
  19586.          MAX_COLOUR_INDICES     := GKS_INSTR.MAX_COLOUR_INDICES_INQ;
  19587.      
  19588.       end if;
  19589.      
  19590.    end INQ_MAX_LENGTH_OF_WS_STATE_TABLES;
  19591.      
  19592. end INQ_WS_DESCRIPTION_TABLE_MA;
  19593. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19594. --:UDD:GKSADACM:CODE:MA:SET_CLR_TBL_B.ADA
  19595. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19596. ------------------------------------------------------------------
  19597. --
  19598. --  NAME: SET_COLOUR_TABLE - BODY
  19599. --  IDENTIFIER: GDMXXX.1(2)
  19600. --  DISCREPANCY REPORTS:
  19601. --  DR005  OUTPUT_ATTRIBUTE_ERROR missing from SET_CLR_TBL_B
  19602. ------------------------------------------------------------------
  19603. -- file:  set_clr_tbl_b.ada
  19604. -- level: all levels
  19605.      
  19606. with WSM;
  19607. with CGI;
  19608. with ERROR_ROUTINES;
  19609. with GKS_OPERATING_STATE_LIST;
  19610. with GKS_STATE_LIST;
  19611. with GKS_ERRORS;
  19612.      
  19613. use WSM;
  19614. use CGI;
  19615. use ERROR_ROUTINES;
  19616. use GKS_OPERATING_STATE_LIST;
  19617. use GKS_ERRORS;
  19618.      
  19619. package body SET_COLOUR_TABLE is
  19620.      
  19621. -- This is the package body for procedures for calling the work-
  19622. -- station manager to set the workstation attributes at level ma.
  19623. --
  19624. -- If an error indicator above 0 occurs, these procedures call
  19625. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  19626. -- to log the error indicator and the name of the procedure
  19627. -- in the error file specified when the procedure OPEN_GKS
  19628. -- was called to begin this session of GKS operation.
  19629.      
  19630.    procedure SET_COLOUR_REPRESENTATION
  19631.       (WS    : in WS_ID;
  19632.       INDEX  : in COLOUR_INDEX;
  19633.       COLOUR : in COLOUR_REPRESENTATION) is
  19634.      
  19635.    -- This procedure inquires the GKS_OPERATING_STATE_LIST to
  19636.    -- check if GKS is in one of the states WSOP, WSAC, or SGOP.
  19637.    -- If it is not, error 7 occurs and the procedure raises the
  19638.    -- exception STATE_ERROR.  It also checks the GKS_STATE_LIST
  19639.    -- to see if the WS is open.  If not, error 25 occurs and the
  19640.    -- procedure raises the exception WS_ERROR.  Otherwise, this
  19641.    -- procedure calls the workstation manager to map a given colour
  19642.    -- index with a specified colour of certain intensities of red,
  19643.    -- green, and blue and to set this value in the workstation state
  19644.    -- list.  If the workstation manager returns error 33, 35, or 36,
  19645.    -- this procedure raises the exception WS_ERROR.
  19646.    --
  19647.    -- WS - Identifies the workstation on which the colour represen-
  19648.    --    tation.
  19649.    -- INDEX - Indicates the entry in the colour table to be set.
  19650.    -- COLOUR - Defines the representation of a colour as a combina-
  19651.    --    tion of RED, GREEN, and BLUE intensities which are the
  19652.    --    components of the record.
  19653.      
  19654.    GKS_INSTR : CGI_SET_COLOUR_REPRESENTATION;
  19655.      
  19656.    begin
  19657.      
  19658.       -- The following if structure inquires the GKS_OPERATING_STATE_
  19659.       -- LIST to see if GKS is in the proper state and the workstation
  19660.       -- specified is open.
  19661.      
  19662.       if (CURRENT_OPERATING_STATE = GKCL) or
  19663.          (CURRENT_OPERATING_STATE = GKOP) then
  19664.          ERROR_LOGGING (NOT_WSOP_WSAC_SGOP, "SET_COLOUR_TABLE");-- Error 7
  19665.          raise STATE_ERROR;
  19666.      
  19667.       elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  19668.          ERROR_LOGGING (WS_NOT_OPEN, "SET_COLOUR_TABLE");    -- Error 25
  19669.          raise WS_ERROR;
  19670.      
  19671.       else
  19672.          GKS_INSTR.WS_TO_SET_COLOUR_REP := WS;
  19673.          GKS_INSTR.COLOUR_INDEX_TO_SET_COLOUR_REP := INDEX;
  19674.          GKS_INSTR.COLOUR_REP_SET := COLOUR;
  19675.          WS_MANAGER (GKS_INSTR);
  19676.      
  19677.          if GKS_INSTR.EI /= SUCCESSFUL then               -- Error 0
  19678.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  19679.                (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) or   -- Error 35
  19680.                (GKS_INSTR.EI = WS_IS_WISS) then           -- Error 36
  19681.                ERROR_LOGGING (GKS_INSTR.EI, "SET_COLOUR_TABLE");
  19682.                raise WS_ERROR;
  19683.             elsif (GKS_INSTR.EI = INVALID_COLOUR_INDEX) then -- Error 93
  19684.                ERROR_LOGGING (GKS_INSTR.EI, "SET_COLOUR_TABLE");
  19685.                raise OUTPUT_ATTRIBUTE_ERROR;
  19686.             end if;
  19687.      
  19688.          end if;
  19689.      
  19690.       end if;
  19691.      
  19692.       exception
  19693.          when STATE_ERROR =>
  19694.             raise;
  19695.          when WS_ERROR =>
  19696.             raise;
  19697.          when OUTPUT_ATTRIBUTE_ERROR =>
  19698.             raise;
  19699.          when OTHERS =>
  19700.             ERROR_LOGGING (UNKNOWN,
  19701.                           "SET_COLOUR_REPRESENTATION"); -- ERROR 2501
  19702.             raise;
  19703.      
  19704.    end SET_COLOUR_REPRESENTATION;
  19705.      
  19706. end SET_COLOUR_TABLE;
  19707. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19708. --:UDD:GKSADACM:CODE:MA:ERROR_ROUTINES_MA_B.ADA
  19709. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19710. ------------------------------------------------------------------
  19711. --
  19712. --  NAME: ERROR_ROUTINES - BODY
  19713. --  IDENTIFIER: GIMXXX.1(1)
  19714. --  DISCREPANCY REPORTS:
  19715. --
  19716. ------------------------------------------------------------------
  19717. -- file:  error_routines_ma_b.ada
  19718. -- level: ma
  19719.      
  19720. with GKS_ERRORS;
  19721.      
  19722. use GKS_ERRORS;
  19723.      
  19724. package body ERROR_ROUTINES is
  19725.      
  19726. -- This is the package body providing the procedures
  19727. -- for GKS error handling.
  19728.      
  19729.    procedure ERROR_LOGGING
  19730.       (EI  : in ERROR_INDICATOR;
  19731.       NAME : in SUBPROGRAM_NAME) is separate;
  19732.      
  19733. end ERROR_ROUTINES;
  19734. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19735. --:UDD:GKSADACM:CODE:MA:WS_CONTROL_B.ADA
  19736. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19737. ------------------------------------------------------------------
  19738. --
  19739. --  NAME: WS_CONTROL - BODY
  19740. --  IDENTIFIER: GIMXXX.1(1)
  19741. --  DISCREPANCY REPORTS:
  19742. --
  19743. ------------------------------------------------------------------
  19744. -- file:  ws_control_b.ada
  19745. -- level: all levels
  19746.      
  19747. with WSM;
  19748. with CGI;
  19749. with ERROR_ROUTINES;
  19750. with GKS_OPERATING_STATE_LIST;
  19751. with GKS_STATE_LIST;
  19752. with GKS_ERRORS;
  19753. with GKS_DESCRIPTION_TABLE;
  19754.      
  19755. use WSM;
  19756. use CGI;
  19757. use ERROR_ROUTINES;
  19758. use GKS_OPERATING_STATE_LIST;
  19759. use GKS_ERRORS;
  19760.      
  19761. package body WS_CONTROL is
  19762.      
  19763. -- This is the package body for the workstation control
  19764. -- functions.  All of these functions call the workstation
  19765. -- manager.
  19766. --
  19767. -- If an error indicator above 0 occurs, these procedures call
  19768. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  19769. -- to log the error indicator and the name of the procedure
  19770. -- in the error file specified when the procedure OPEN_GKS
  19771. -- was called to begin this session of GKS operation.
  19772.      
  19773.    procedure OPEN_WS
  19774.       (WS : in WS_ID;
  19775.       CONNECTION : in CONNECTION_ID;
  19776.       TYPE_OF_WS : in WS_TYPE) is separate;
  19777.      
  19778.    procedure CLOSE_WS
  19779.       (WS : in WS_ID) is separate;
  19780.      
  19781.    procedure ACTIVATE_WS
  19782.       (WS : in WS_ID) is separate;
  19783.      
  19784.    procedure DEACTIVATE_WS
  19785.       (WS : in WS_ID) is separate;
  19786.      
  19787.    procedure CLEAR_WS
  19788.       (WS  : in WS_ID;
  19789.       FLAG : in CONTROL_FLAG) is separate;
  19790.      
  19791.    procedure UPDATE_WS
  19792.       (WS          : in WS_ID;
  19793.       REGENERATION : in UPDATE_REGENERATION_FLAG) is separate;
  19794.      
  19795. end WS_CONTROL;
  19796. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19797. --:UDD:GKSADACM:CODE:MA:GKS_CONTROL_B.ADA
  19798. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19799. ------------------------------------------------------------------
  19800. --
  19801. --  NAME: GKS_CONTROL - BODY
  19802. --  IDENTIFIER: GIMXXX.1(1)
  19803. --  DISCREPANCY REPORTS:
  19804. --
  19805. ------------------------------------------------------------------
  19806. -- file:  gks_control_b.ada
  19807. -- level: all levels
  19808.      
  19809. with GKS_STATE_LIST;
  19810. with GKS_OPERATING_STATE_LIST;
  19811. with GKS_ERROR_STATE_LIST;
  19812. with ERROR_ROUTINES;
  19813. with GKS_CONFIGURATION;
  19814. with GKS_ERRORS;
  19815.      
  19816. use ERROR_ROUTINES;
  19817. use GKS_OPERATING_STATE_LIST;
  19818. use GKS_ERRORS;
  19819.      
  19820. package body GKS_CONTROL is
  19821.      
  19822. -- This is the package body for the GKS control functions.
  19823. --
  19824. -- If an error indicator above 0 occurs, these procedures call
  19825. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  19826. -- to log the error indicator and the name of the procedure
  19827. -- in the error file specified when the procedure OPEN_GKS
  19828. -- was called to begin this session of GKS operation.
  19829.      
  19830.    procedure OPEN_GKS
  19831.       (ERROR_FILE       : in ERROR_FILE_TYPE :=
  19832.                           GKS_CONFIGURATION.DEFAULT_ERROR_FILE;
  19833.       AMOUNT_OF_MEMORY  : in MEMORY_UNITS    :=
  19834.                           GKS_CONFIGURATION.MAX_MEMORY_UNITS) is separate;
  19835.      
  19836.    procedure CLOSE_GKS is separate;
  19837.      
  19838. end GKS_CONTROL;
  19839. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19840. --:UDD:GKSADACM:CODE:MA:OUT_PRIM_B.ADA
  19841. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19842. ------------------------------------------------------------------
  19843. --
  19844. --  NAME: OUTPUT_PRIMITIVES - BODY
  19845. --  IDENTIFIER: GIMXXX.1(1)
  19846. --  DISCREPANCY REPORTS:
  19847. --
  19848. ------------------------------------------------------------------
  19849. -- file:  out_prim_b.ada
  19850. -- level: all levels
  19851.      
  19852. with WSM;
  19853. with CGI;
  19854. with ERROR_ROUTINES;
  19855. with GKS_OPERATING_STATE_LIST;
  19856. with GKS_ERRORS;
  19857. with TRANSFORMATION_MATH;
  19858. with GKS_STATE_LIST;
  19859.      
  19860. use WSM;
  19861. use CGI;
  19862. use ERROR_ROUTINES;
  19863. use GKS_OPERATING_STATE_LIST;
  19864. use GKS_ERRORS;
  19865.      
  19866. package body OUTPUT_PRIMITIVES is
  19867.      
  19868. -- This is the package body for output primitive functions.
  19869. -- All of these procedures call the workstation manager.
  19870. --
  19871. -- All of these procedures inquire the GKS_OPERATING_STATE_LIST
  19872. -- to check if GKS is in one of the states WSAC or SGOP.  If it is
  19873. -- not, error 5 occurs and the procedure raises the exception
  19874. -- STATE_ERROR.
  19875. --
  19876. -- If an error indicator above 0 occurs, these procedures call
  19877. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  19878. -- to log the error indicator and the name of the procedure
  19879. -- in the error file specified when the procedure OPEN_GKS
  19880. -- was called to begin this session of GKS operation.
  19881.      
  19882.    procedure POLYLINE
  19883.       (LINE_POINTS : in WC.POINT_ARRAY) is separate;
  19884.      
  19885.    procedure POLYMARKER
  19886.       (MARKER_POINTS : in WC.POINT_ARRAY) is separate;
  19887.      
  19888.    procedure FILL_AREA
  19889.       (FILL_AREA_POINTS : in WC.POINT_ARRAY) is separate;
  19890.      
  19891.    procedure TEXT
  19892.       (POSITION   : in WC.POINT;
  19893.       TEXT_STRING : in STRING) is separate;
  19894.      
  19895. end OUTPUT_PRIMITIVES;
  19896. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19897. --:UDD:GKSADACM:CODE:MA:ERROR_LOGGING_S.ADA
  19898. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19899. ------------------------------------------------------------------
  19900. --
  19901. --  NAME: ERROR_LOGGING
  19902. --  IDENTIFIER: GIMXXX.1(1)
  19903. --  DISCREPANCY REPORTS:
  19904. --
  19905. ------------------------------------------------------------------
  19906. -- file:  error_logging_s.ada
  19907. -- level: ma
  19908.      
  19909. with TEXT_IO;
  19910. with GKS_ERROR_STATE_LIST;
  19911. with GKS_CONFIGURATION;
  19912.      
  19913. separate (ERROR_ROUTINES)
  19914.      
  19915. procedure ERROR_LOGGING
  19916.    (EI  : in ERROR_INDICATOR;
  19917.    NAME : in SUBPROGRAM_NAME) is
  19918.      
  19919. -- This procedure writes the error number and the GKS function
  19920. -- name detecting the error to the error file (created when the
  19921. -- GKS function OPEN_GKS was called) using the I/O facilities of
  19922. -- TEXT_IO.
  19923. --
  19924. -- EI - This is the error indicator.  Its numeric value represents
  19925. --    the type of error being logged.
  19926. -- NAME - This is a string type.  Its value is the name of the
  19927. --    procedure in which the error being logged occurred.
  19928.      
  19929. begin
  19930.      
  19931.    -- Write the error indicator and the subprogram name to the
  19932.    -- error file.
  19933.      
  19934.    if not TEXT_IO.IS_OPEN(GKS_ERROR_STATE_LIST.ERROR_DATA) then
  19935.       TEXT_IO.CREATE (GKS_ERROR_STATE_LIST.ERROR_DATA,
  19936.                       TEXT_IO.OUT_FILE,
  19937.                       GKS_CONFIGURATION.DEFAULT_ERROR_FILE);
  19938.    end if;
  19939.    TEXT_IO.NEW_LINE(GKS_ERROR_STATE_LIST.ERROR_DATA);
  19940.    TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA,
  19941.       "GKS ERROR NUMBER ");
  19942.    TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA,ERROR_INDICATOR'IMAGE(EI));
  19943.    TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA,
  19944.       " OCCURRED IN ");
  19945.    TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA, NAME);
  19946.    TEXT_IO.NEW_LINE;
  19947.      
  19948. end ERROR_LOGGING;
  19949. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19950. --:UDD:GKSADACM:CODE:MA:ACTIVATE_WS_S.ADA
  19951. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19952. ------------------------------------------------------------------
  19953. --
  19954. --  NAME: ACTIVATE_WS
  19955. --  IDENTIFIER: GIMXXX.1(1)
  19956. --  DISCREPANCY REPORTS:
  19957. --
  19958. ------------------------------------------------------------------
  19959. -- file:  activate_ws_s.ada
  19960. -- level: all levels
  19961.      
  19962. separate (WS_CONTROL)
  19963.      
  19964. procedure ACTIVATE_WS
  19965.    (WS : in WS_ID) is
  19966.      
  19967. -- This procedure first checks the GKS_OPERATING_STATE_LIST
  19968. -- to see if GKS is in state WSOP or WSAC.  If it is not,
  19969. -- error 6 occurs and the exception STATE_ERROR is raised.
  19970. -- Then the procedure inquires the GKS_STATE_LIST to check
  19971. -- if the WS is in the set of open workstations. If it is not,
  19972. -- error 25 occurs and the exception WS_ERROR is raised.
  19973. -- The procedure also checks the GKS_STATE_LIST to see if the
  19974. -- WS is in the set of active workstations.  If it is, error
  19975. -- 29 occurs and the exception WS_ERROR is raised.  Then,
  19976. -- if the addition of another active workstation would
  19977. -- exceed the MAX_ACTIVE_WS number in the GKS_DESCRIPTION_TABLE,
  19978. -- error 43 occurs and the exception WS_ERROR is raised.
  19979. --
  19980. -- Otherwise, this procedure calls the workstation manager
  19981. -- to activate the workstation.  If the workstation manager
  19982. -- returns errors 33, or 35, this procedure raises
  19983. -- the exception WS_ERROR.
  19984. --
  19985. -- WS - This is the identifier of the workstation that is
  19986. --    to be activated.
  19987.      
  19988. GKS_INSTR : CGI_ACTIVATE_WS;
  19989.      
  19990. begin
  19991.      
  19992.    -- The following if structure inquires the GKS_OPERATING_STATE_
  19993.    -- LIST to see if GKS is in the proper state. Then it inquires
  19994.    -- the GKS_STATE_LIST to see if the WS is in the set of open
  19995.    -- workstations and if it is already activated (in the set of
  19996.    -- active workstations).
  19997.      
  19998.    if (CURRENT_OPERATING_STATE /= WSOP) and
  19999.       (CURRENT_OPERATING_STATE /= WSAC) then
  20000.       ERROR_LOGGING (NOT_WSOP_WSAC, "ACTIVATE_WS"); -- Error 6
  20001.       raise STATE_ERROR;
  20002.      
  20003.    elsif not WS_IDS.IS_IN_LIST(WS, GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  20004.       ERROR_LOGGING (WS_NOT_OPEN, "ACTIVATE_WS");   -- Error 25
  20005.       raise WS_ERROR;
  20006.      
  20007.    elsif WS_IDS.IS_IN_LIST(WS, GKS_STATE_LIST.LIST_OF_ACTIVE_WS) then
  20008.       ERROR_LOGGING (WS_IS_ACTIVE, "ACTIVATE_WS");   -- Error 29
  20009.       raise WS_ERROR;
  20010.      
  20011.    elsif WS_IDS.SIZE_OF_LIST(GKS_STATE_LIST.LIST_OF_ACTIVE_WS) =
  20012.       GKS_DESCRIPTION_TABLE.MAX_ACTIVE_WS then
  20013.       ERROR_LOGGING (MAX_NUM_OF_ACTIVE_WS, "ACTIVATE_WS"); -- Error 43
  20014.       raise WS_ERROR;
  20015.      
  20016.    else
  20017.       GKS_INSTR.WS_TO_ACTIVATE := WS;
  20018.       WS_MANAGER (GKS_INSTR);
  20019.      
  20020.       if GKS_INSTR.EI /= SUCCESSFUL then               -- Error 0
  20021.      
  20022.          if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  20023.             (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) then -- Error 35
  20024.             ERROR_LOGGING (GKS_INSTR.EI, "ACTIVATE_WS");
  20025.             raise WS_ERROR;
  20026.          end if;
  20027.      
  20028.       else
  20029.          WS_IDS.ADD_TO_LIST(WS, GKS_STATE_LIST.LIST_OF_ACTIVE_WS);
  20030.      
  20031.          if CURRENT_OPERATING_STATE /= WSAC then
  20032.             CURRENT_OPERATING_STATE := WSAC;
  20033.          end if;
  20034.      
  20035.       end if;
  20036.      
  20037.    end if;
  20038.      
  20039.    exception
  20040.       when STATE_ERROR =>
  20041.          raise;
  20042.       when WS_ERROR =>
  20043.          raise;
  20044.       when OTHERS =>
  20045.          ERROR_LOGGING (UNKNOWN, "ACTIVATE_WS");        -- Error 2501
  20046.          raise;
  20047.      
  20048. end ACTIVATE_WS;
  20049. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20050. --:UDD:GKSADACM:CODE:MA:DEACTIVATE_WS_S.ADA
  20051. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20052. ------------------------------------------------------------------
  20053. --
  20054. --  NAME: DEACTIVATE_WS
  20055. --  IDENTIFIER: GIMXXX.1(1)
  20056. --  DISCREPANCY REPORTS:
  20057. --
  20058. ------------------------------------------------------------------
  20059. -- file:  deactivate_ws_s.ada
  20060. -- level: all levels
  20061.      
  20062. separate (WS_CONTROL)
  20063.      
  20064. procedure DEACTIVATE_WS
  20065.    (WS : in WS_ID) is
  20066.      
  20067. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  20068. -- to see if GKS is in state WSAC.  If it is not, error 3
  20069. -- occurs and this procedure raises the exception STATE_ERROR.
  20070. -- This procedure then inquires the GKS_STATE_LIST to see if
  20071. -- the WS is in the set of active workstations.  If it is not,
  20072. -- error 30 occurs and the exception WS_ERROR is raised.
  20073. -- Otherwise, this procedure calls the workstation manager to
  20074. -- deactivate the workstation.  If the workstation manager returns
  20075. -- errors  33, or 35, this procedure raises the exception
  20076. -- WS_ERROR.
  20077. --
  20078. -- This procedure sets the operating state to WSOP = "At least
  20079. -- one workstation open" in the GKS_OPERATING_STATE_LIST if no
  20080. -- workstations remain active.  This is determined by inquiring
  20081. -- the GKS_STATE_LIST.
  20082. --
  20083. -- WS - This is the identifier of the workstation that is
  20084. --    to be deactivated.
  20085.      
  20086. GKS_INSTR : CGI_DEACTIVATE_WS;
  20087.      
  20088. begin
  20089.      
  20090.    -- The following if structure inquires the GKS_OPERATING_STATE_
  20091.    -- LIST to see if GKS is in the proper state. Then it inquires
  20092.    -- the GKS_STATE_LIST to see if the WS is in the set of active
  20093.    -- workstations before calling the WS_MANAGER.
  20094.      
  20095.    if (CURRENT_OPERATING_STATE /= WSAC) then
  20096.       ERROR_LOGGING (NOT_WSAC, "DEACTIVATE_WS");         -- Error 3
  20097.       raise STATE_ERROR;
  20098.      
  20099.    elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_ACTIVE_WS) then
  20100.       ERROR_LOGGING (WS_IS_NOT_ACTIVE, "DEACTIVATE_WS"); -- Error 30
  20101.       raise WS_ERROR;
  20102.      
  20103.    else
  20104.       GKS_INSTR.WS_TO_DEACTIVATE := WS;
  20105.       WS_MANAGER (GKS_INSTR);
  20106.      
  20107.       if GKS_INSTR.EI /= SUCCESSFUL then                -- Error 0
  20108.          if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or       -- Error 33
  20109.             (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) then  -- Error 35
  20110.             ERROR_LOGGING (GKS_INSTR.EI, "DEACTIVATE_WS");
  20111.             raise WS_ERROR;
  20112.          end if;
  20113.      
  20114.       else
  20115.          WS_IDS.DELETE_FROM_LIST(WS,GKS_STATE_LIST.LIST_OF_ACTIVE_WS);
  20116.      
  20117.          if WS_IDS.SIZE_OF_LIST(GKS_STATE_LIST.LIST_OF_ACTIVE_WS) = 0
  20118.             then
  20119.             CURRENT_OPERATING_STATE := WSOP;
  20120.          end if;
  20121.      
  20122.       end if;
  20123.      
  20124.    end if;
  20125.      
  20126.    exception
  20127.       when STATE_ERROR =>
  20128.          raise;
  20129.       when WS_ERROR =>
  20130.          raise;
  20131.       when OTHERS =>
  20132.          ERROR_LOGGING (UNKNOWN, "DEACTIVATE_WS");       -- Error 2501
  20133.          raise;
  20134.      
  20135. end DEACTIVATE_WS;
  20136. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20137. --:UDD:GKSADACM:CODE:MA:CLEAR_WS_S.ADA
  20138. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20139. ------------------------------------------------------------------
  20140. --
  20141. --  NAME: CLEAR_WS
  20142. --  IDENTIFIER: GDMXXX.1(1)
  20143. --  DISCREPANCY REPORTS:
  20144. --
  20145. ------------------------------------------------------------------
  20146. -- file:  clear_ws_s.ada
  20147. -- level: all levels
  20148.      
  20149. separate (WS_CONTROL)
  20150.      
  20151. procedure CLEAR_WS
  20152.    (WS  : in WS_ID;
  20153.    FLAG : in CONTROL_FLAG) is
  20154.      
  20155. -- This procedure inquires the GKS_OPERATING_STATE_LIST to
  20156. -- see if GKS is in the states WSOP, or WSAC.  If it is not,
  20157. -- error 6 occurs and the exception STATE_ERROR is raised.
  20158. -- Then this procedure inquires the GKS_STATE_LIST to check
  20159. -- if the WS is in the set of open workstations.  If it is not,
  20160. -- error 25 occurs, and the exception WS_ERROR is raised.
  20161. --
  20162. -- Otherwise, this procedure calls the workstation manager to
  20163. -- clear the workstation.  If the workstation manager returns errors
  20164. -- 33, or 35 this procedure raises the exception WS_ERROR.
  20165. --
  20166. -- WS - This is the identifier of the workstation on which the
  20167. --    display surface is to be cleared.
  20168. -- FLAG - Indicates the conditions under which the display
  20169. --    surface is to be cleared.  It may be set to either
  20170. --    CONDITIONALLY or ALWAYS.
  20171.      
  20172. GKS_INSTR : CGI_CLEAR_WS;
  20173.      
  20174. begin
  20175.      
  20176.    -- The following if structure inquires the GKS_OPERATING_STATE_
  20177.    -- LIST to see if GKS is in the proper state. Then it inquires
  20178.    -- the GKS_STATE_LIST to see if the WS is in the set of open
  20179.    -- workstations before calling the WS_MANAGER.
  20180.      
  20181.    if (CURRENT_OPERATING_STATE /= WSOP) and
  20182.       (CURRENT_OPERATING_STATE /= WSAC) then
  20183.       ERROR_LOGGING (NOT_WSOP_WSAC, "CLEAR_WS");  -- Error 6
  20184.       raise STATE_ERROR;
  20185.      
  20186.    elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  20187.       ERROR_LOGGING (WS_NOT_OPEN, "CLEAR_WS");     -- Error 25
  20188.       raise WS_ERROR;
  20189.      
  20190.    else
  20191.       GKS_INSTR.WS_TO_CLEAR := WS;
  20192.       GKS_INSTR.FLAG := FLAG;
  20193.       WS_MANAGER (GKS_INSTR);
  20194.      
  20195.       if GKS_INSTR.EI /= SUCCESSFUL then               -- Error 0
  20196.      
  20197.          if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  20198.             (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) then -- Error 35
  20199.             ERROR_LOGGING (GKS_INSTR.EI, "CLEAR_WS");
  20200.             raise WS_ERROR;
  20201.          end if;
  20202.      
  20203.       end if;
  20204.      
  20205.    end if;
  20206.      
  20207.    exception
  20208.       when STATE_ERROR =>
  20209.          raise;
  20210.       when WS_ERROR =>
  20211.          raise;
  20212.       when OTHERS =>
  20213.          ERROR_LOGGING (UNKNOWN, "CLEAR_WS");             -- Error 2501
  20214.          raise;
  20215.      
  20216. end CLEAR_WS;
  20217. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20218. --:UDD:GKSADACM:CODE:MA:CLOSE_WS_S.ADA
  20219. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20220. ------------------------------------------------------------------
  20221. --
  20222. --  NAME: CLOSE_WS
  20223. --  IDENTIFIER: GIMXXX.1(1)
  20224. --  DISCREPANCY REPORTS:
  20225. --
  20226. ------------------------------------------------------------------
  20227. -- file:  close_ws_s.ada
  20228. -- level: all levels
  20229.      
  20230. separate (WS_CONTROL)
  20231.      
  20232. procedure CLOSE_WS
  20233.    (WS : in WS_ID) is
  20234.      
  20235. -- This procedure inquires the GKS_OPERATING_STATE_LIST
  20236. -- to see if GKS is in state WSOP, WSAC, or SGOP. If it
  20237. -- is not, then error 7 occurs and the exception STATE_
  20238. -- ERROR is raised.  Then it inquires the GKS_STATE_LIST
  20239. -- to see if the WS is in the set of open workstations. If
  20240. -- it is not, error 25 occurs and the exception WS_ERROR is
  20241. -- raised.  The procedure also checks the GKS_STATE_LIST to
  20242. -- see if the WS is in the set of active workstations. If
  20243. -- it is, error 29 occurs and the exception WS_ERROR is
  20244. -- raised.
  20245. --
  20246. -- Otherwise, this procedure calls the workstation manager to
  20247. -- release the connection between the workstation and GKS.
  20248. --
  20249. -- If the workstation manager returns error 147, this procedure
  20250. -- raises the exception INPUT_ERROR.
  20251. --
  20252. -- WS - This is the identifier of the workstation that is
  20253. --    to be closed.
  20254.      
  20255. GKS_INSTR : CGI_CLOSE_WS;
  20256.      
  20257. begin
  20258.      
  20259.    -- The following if structure inquires the GKS_OPERATING_STATE_
  20260.    -- LIST to see if GKS is in the proper state. Then it inquires
  20261.    -- the GKS_STATE_LIST to see if the WS is in the set of open
  20262.    -- workstations and if it is not activated (not in the set of
  20263.    -- active workstations).
  20264.      
  20265.    if (CURRENT_OPERATING_STATE = GKCL) or
  20266.       (CURRENT_OPERATING_STATE = GKOP) then
  20267.       ERROR_LOGGING (NOT_WSOP_WSAC_SGOP, "CLOSE_WS");   -- Error 7
  20268.       raise STATE_ERROR;
  20269.      
  20270.    elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  20271.       ERROR_LOGGING (WS_NOT_OPEN, "CLOSE_WS");          -- Error 25
  20272.       raise WS_ERROR;
  20273.      
  20274.    elsif WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_ACTIVE_WS) then
  20275.       ERROR_LOGGING (WS_IS_ACTIVE, "CLOSE_WS");         -- Error 29
  20276.       raise WS_ERROR;
  20277.      
  20278.    else
  20279.       GKS_INSTR.WS_TO_CLOSE := WS;
  20280.       WS_MANAGER (GKS_INSTR);
  20281.      
  20282.       if GKS_INSTR.EI /= SUCCESSFUL then                   -- Error 0
  20283.          if GKS_INSTR.EI = INPUT_QUEUE_OVERFLOW then       -- Error 147
  20284.             ERROR_LOGGING (INPUT_QUEUE_OVERFLOW, "CLOSE_WS");
  20285.             raise INPUT_ERROR;
  20286.          end if;
  20287.       else
  20288.          WS_IDS.DELETE_FROM_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS);
  20289.      
  20290.          if WS_IDS.SIZE_OF_LIST(GKS_STATE_LIST.LIST_OF_OPEN_WS) = 0 then
  20291.             CURRENT_OPERATING_STATE := GKOP;
  20292.          end if;
  20293.      
  20294.       end if;
  20295.      
  20296.    end if;
  20297.      
  20298.    exception
  20299.       when STATE_ERROR =>
  20300.          raise;
  20301.       when WS_ERROR =>
  20302.          raise;
  20303.       when OTHERS =>
  20304.          ERROR_LOGGING (UNKNOWN, "CLOSE_WS");              -- Error 2501
  20305.          raise;
  20306.      
  20307. end CLOSE_WS;
  20308. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20309. --:UDD:GKSADACM:CODE:MA:CLOSE_GKS_S.ADA
  20310. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20311. ------------------------------------------------------------------
  20312. --
  20313. --  NAME: CLOSE_GKS
  20314. --  IDENTIFIER: GIMXXX.1(1)
  20315. --  DISCREPANCY REPORTS:
  20316. --
  20317. ------------------------------------------------------------------
  20318. -- file:  close_gks_s.ada
  20319. -- level: all levels
  20320.      
  20321. with TEXT_IO;
  20322.      
  20323. separate (GKS_CONTROL)
  20324.      
  20325. procedure CLOSE_GKS is
  20326.      
  20327. --  This function closes GKS.  All of the GKS data
  20328. --  structures are made unavailable.  No further GKS
  20329. --  functions may be invoked.  The operating state is
  20330. --  set to GKCL = "GKS closed."
  20331.      
  20332. --  The procedure inquires the GKS_OPERATING_STATE_LIST
  20333. --  initially.  If the operating state is not GKOP,
  20334. --  error 2 occurs, and the exception STATE_ERROR is
  20335. --  raised.
  20336.      
  20337. EI : ERROR_INDICATOR;
  20338.      
  20339. begin
  20340.      
  20341.    -- The following if inquires the GKS_OPERATING_STATE_LIST
  20342.    -- to see if GKS is in the proper state before proceeding.
  20343.    if CURRENT_OPERATING_STATE /= GKOP then
  20344.       ERROR_LOGGING (NOT_GKOP, "CLOSE_GKS");       -- Error 2
  20345.       raise STATE_ERROR;
  20346.    else
  20347.       TEXT_IO.CLOSE (GKS_ERROR_STATE_LIST.ERROR_DATA);
  20348.       CURRENT_OPERATING_STATE := GKCL;
  20349.    end if;
  20350.      
  20351.    exception
  20352.       when STATE_ERROR =>
  20353.          raise;
  20354.       when OTHERS =>
  20355.          ERROR_LOGGING (UNKNOWN, "CLOSE_GKS");       -- Error 2501
  20356.          raise;
  20357.      
  20358. end CLOSE_GKS;
  20359. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20360. --:UDD:GKSADACM:CODE:MA:FA_S.ADA
  20361. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20362. ------------------------------------------------------------------
  20363. --
  20364. --  NAME: FILL_AREA
  20365. --  IDENTIFIER: GIMXXX.1(1)
  20366. --  DISCREPANCY REPORTS:
  20367. --
  20368. ------------------------------------------------------------------
  20369. -- file:  fa_s.ada
  20370. -- level: all levels
  20371.      
  20372. separate (OUTPUT_PRIMITIVES)
  20373.      
  20374. procedure FILL_AREA
  20375.    (FILL_AREA_POINTS : in WC.POINT_ARRAY) is
  20376.      
  20377. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  20378. -- to check if GKS is in state WSAC or SGOP.  If it is not,
  20379. -- error 5 occurs and the exception STATE_ERROR is raised.  In
  20380. -- addition, it checks if the number of points is invalid.  If
  20381. -- so, error 100 occurs and the exception OUTPUT_PRIMITIVE_ERROR
  20382. -- is raised.  Otherwise, this procedure performs a normalization
  20383. -- transformation on the world coordinate points passed in and
  20384. -- passes the normalized device coordinates that result to the
  20385. -- workstation manager to generate a fill area output.
  20386. --
  20387. -- FILL_AREA_POINTS - Provides the array of world coordinate points.
  20388.      
  20389. GKS_INSTR : CGI_FILL_AREA;
  20390.      
  20391. NDC_POINTS : NDC.POINT_ARRAY(1..FILL_AREA_POINTS'LENGTH);
  20392. -- The above type was created to hold the transformed points.
  20393.      
  20394. begin
  20395.      
  20396.    -- The following if structure inquires the GKS_OPERATING_STATE_
  20397.    -- LIST to see if GKS is in the proper state. Then it checks to
  20398.    -- see that the number of points is valid before calling the
  20399.    -- WS_MANAGER.
  20400.      
  20401.    if (CURRENT_OPERATING_STATE /= WSAC) and
  20402.       (CURRENT_OPERATING_STATE /= SGOP) then
  20403.       ERROR_LOGGING (NOT_WSAC_SGOP, "FILL_AREA");           -- Error 5
  20404.       raise STATE_ERROR;
  20405.      
  20406.    elsif FILL_AREA_POINTS'LENGTH < 3 then
  20407.       ERROR_LOGGING (INVALID_NUMBER_OF_POINTS, "FILL_AREA"); -- Error 100
  20408.       raise OUTPUT_PRIMITIVE_ERROR;
  20409.      
  20410.    else
  20411.       -- The following performs the transformation on the
  20412.       -- points from world coordinates to normalized device coordinates.
  20413.       NDC_POINTS := TRANSFORMATION_MATH.WC_TO_NDC (GKS_STATE_LIST.
  20414.                     LIST_OF_NORMALIZATION_TRANSFORMATIONS
  20415.                    (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  20416.                    .NDC_FACTORS, FILL_AREA_POINTS);
  20417.      
  20418.       GKS_INSTR.FILL_AREA_POINTS := new NDC.POINT_ARRAY'(NDC_POINTS);
  20419.      
  20420.       WS_MANAGER (GKS_INSTR);
  20421.      
  20422.       FREE_POINT_ARRAY(GKS_INSTR.FILL_AREA_POINTS);
  20423.      
  20424.    end if;
  20425.      
  20426.    exception
  20427.       when STATE_ERROR =>
  20428.          raise;
  20429.       when OUTPUT_PRIMITIVE_ERROR =>
  20430.          raise;
  20431.       when NUMERIC_ERROR =>
  20432.          ERROR_LOGGING (ARITHMETIC, "FILL_AREA");          -- Error 308
  20433.          raise SYSTEM_ERROR;
  20434.       when OTHERS =>
  20435.          ERROR_LOGGING (UNKNOWN, "FILL_AREA");             -- Error 2501
  20436.          raise;
  20437.      
  20438. end FILL_AREA;
  20439. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20440. --:UDD:GKSADACM:CODE:MA:OPEN_GKS_S.ADA
  20441. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20442. ------------------------------------------------------------------
  20443. --
  20444. --  NAME: OPEN_GKS
  20445. --  IDENTIFIER: GIMXXX.1(1)
  20446. --  DISCREPANCY REPORTS:
  20447. --
  20448. ------------------------------------------------------------------
  20449. -- file:  open_gks_s.ada
  20450. -- level: all_levels
  20451.      
  20452. with TEXT_IO;
  20453.      
  20454. separate (GKS_CONTROL)
  20455.      
  20456. procedure OPEN_GKS
  20457.    (ERROR_FILE       : in ERROR_FILE_TYPE :=
  20458.                        GKS_CONFIGURATION.DEFAULT_ERROR_FILE;
  20459.     AMOUNT_OF_MEMORY : in MEMORY_UNITS    :=
  20460.                        GKS_CONFIGURATION.MAX_MEMORY_UNITS) is
  20461.      
  20462. -- This function initializes GKS.  It must be invoked
  20463. -- before any other GKS function.  The GKS state list is
  20464. -- allocated and intialised and the GKS description table
  20465. -- and the workstation description tables are made avail-
  20466. -- able.  The operating state is set to GKOP = "GKS open"
  20467. -- in the GKS state list.
  20468. --
  20469. -- The procedure checks if the operating state is set to
  20470. -- GKCL in the GKS_OPERATING_STATE_LIST. If it is not GKCL,
  20471. -- error 1 occurs and the exception STATE_ERROR is raised.
  20472. --
  20473. -- ERROR_FILE - User-defined file for reporting errors detected by GKS.
  20474. -- AMOUNT_OF_MEMORY - Required by GKS but currently ignored.
  20475.      
  20476. begin
  20477.      
  20478.    -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  20479.    -- to see if GKS is in the proper state before proceeding.
  20480.      
  20481.    if CURRENT_OPERATING_STATE /= GKCL then
  20482.       ERROR_LOGGING (NOT_GKCL, "OPEN_GKS"); -- Error 1
  20483.       raise STATE_ERROR;
  20484.      
  20485.    else
  20486.      
  20487.    -- If a TEXT_IO exception occurs after the following statement
  20488.    -- the control jumps to the exception handler.
  20489.      
  20490.       TEXT_IO.CREATE (GKS_ERROR_STATE_LIST.ERROR_DATA,
  20491.                       TEXT_IO.OUT_FILE,
  20492.                       ERROR_FILE);
  20493.      
  20494.       GKS_STATE_LIST.INITIALIZE;
  20495.       CURRENT_OPERATING_STATE := GKOP;
  20496.      
  20497.    end if;
  20498.      
  20499.    exception
  20500.       when STATE_ERROR =>
  20501.          raise;
  20502.      
  20503.       -- The following exceptions occur if the error file name passed
  20504.       -- in is invalid.  The error indicator 200 occurs and the
  20505.       -- exception MISC_ERROR is raised to the user.
  20506.      
  20507.       when TEXT_IO.NAME_ERROR | TEXT_IO.STATUS_ERROR | TEXT_IO.USE_ERROR =>
  20508.      
  20509.          -- Create the error file with the implementation default file.
  20510.          TEXT_IO.CREATE (GKS_ERROR_STATE_LIST.ERROR_DATA,
  20511.                          TEXT_IO.OUT_FILE,
  20512.                          GKS_CONFIGURATION.DEFAULT_ERROR_FILE);
  20513.      
  20514.          GKS_STATE_LIST.INITIALIZE;
  20515.          CURRENT_OPERATING_STATE := GKOP;
  20516.          ERROR_LOGGING (INVALID_ERROR_FILE, "OPEN_GKS"); -- Error 200
  20517.          raise MISC_ERROR;
  20518.      
  20519.       when OTHERS =>
  20520.          ERROR_LOGGING (UNKNOWN, "OPEN_GKS");   -- Error 2501
  20521.          raise;
  20522.      
  20523. end OPEN_GKS;
  20524. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20525. --:UDD:GKSADACM:CODE:MA:OPEN_WS_S.ADA
  20526. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20527. ------------------------------------------------------------------
  20528. --
  20529. --  NAME: OPEN_WS
  20530. --  IDENTIFIER: GIMXXX.1(1)
  20531. --  DISCREPANCY REPORTS:
  20532. --
  20533. ------------------------------------------------------------------
  20534. -- file:  open_ws_s.ada
  20535. -- level: all levels
  20536.      
  20537. with OUTPUT_ATTRIBUTES_TYPE;
  20538. with GET_OUTPUT_ATTRIBUTES;
  20539.      
  20540. separate (WS_CONTROL)
  20541.      
  20542. procedure OPEN_WS
  20543.    (WS        : in WS_ID;
  20544.    CONNECTION : in CONNECTION_ID;
  20545.    TYPE_OF_WS : in WS_TYPE) is
  20546.      
  20547. -- This procedure calls the workstation manager to open
  20548. -- a workstation and thus add it to the set of open
  20549. -- workstations in the GKS_STATE_LIST.  This procedure
  20550. -- inquires the GKS_OPERATING_STATE_LIST for the GKS
  20551. -- operating state.  If GKS is not in the proper state,
  20552. -- error 8 occurs and the procedure raises the exception
  20553. -- STATE_ERROR.  If it is in the proper state, this procedure
  20554. -- inquires the GKS_STATE_LIST to check if the WS is already
  20555. -- open.  If it is, error 24 occurs and the procedure raises
  20556. -- the exception WS_ERROR. Then the call to the WS_MANAGER is
  20557. -- made.  If no errors occur, this procedure sets the operating
  20558. -- state to WSOP = "at least one workstation open." If errors
  20559. -- 21, 22, 26 or 28 are returned by the workstation manager,
  20560. -- this procedure will raise the exception WS_ERROR.
  20561. --
  20562. -- WS - Workstation to be opened.
  20563. -- CONNECTION - The physical identifier associated with the logical
  20564. --    WS identifier.
  20565. -- TYPE_OF_WS - Indicates the type of workstation being opened.
  20566.      
  20567. GKS_INSTR : CGI_OPEN_WS;
  20568.      
  20569. OPEN_WS_ATTRIBUTES : OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  20570.      
  20571. begin
  20572.      
  20573.    -- The following if structure inquires the GKS_OPERATING_STATE_
  20574.    -- LIST to see if GKS is in the proper state. Then it inquires
  20575.    -- the GKS_STATE_LIST to make sure the WS is not in the set of open
  20576.    -- workstations.
  20577.      
  20578.    if (CURRENT_OPERATING_STATE = GKCL) then
  20579.       ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP, "OPEN_WS");  -- Error 8
  20580.       raise STATE_ERROR;
  20581.      
  20582.    elsif WS_IDS.IS_IN_LIST (WS, GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  20583.       ERROR_LOGGING (WS_IS_OPEN, "OPEN_WS");          -- Error 24
  20584.       raise WS_ERROR;
  20585.      
  20586.    elsif WS_IDS.SIZE_OF_LIST (GKS_STATE_LIST.LIST_OF_OPEN_WS) =
  20587.       GKS_DESCRIPTION_TABLE.MAX_OPEN_WS then
  20588.       ERROR_LOGGING (MAX_NUM_OF_OPEN_WS, "OPEN_WS");  -- Error 42
  20589.       raise WS_ERROR;
  20590.      
  20591.    else
  20592.       GKS_INSTR.WS_TO_OPEN := WS;
  20593.       GKS_INSTR.CONNECTION_OPEN := new CONNECTION_ID'(CONNECTION);
  20594.       GKS_INSTR.TYPE_OF_WS_OPEN := TYPE_OF_WS;
  20595.      
  20596.       GET_OUTPUT_ATTRIBUTES.GET_ATTRIBUTES (OPEN_WS_ATTRIBUTES);
  20597.       GKS_INSTR.ATTRIBUTES_AT_OPEN := OPEN_WS_ATTRIBUTES;
  20598.       WS_MANAGER (GKS_INSTR);
  20599.      
  20600.       FREE_CONNECTION_ID (GKS_INSTR.CONNECTION_OPEN);
  20601.      
  20602.       if GKS_INSTR.EI /= SUCCESSFUL then                    -- Error 0
  20603.          if (GKS_INSTR.EI = INVALID_CONN_ID) or             -- Error 21
  20604.             (GKS_INSTR.EI = WS_CANNOT_OPEN) or              -- Error 26
  20605.             (GKS_INSTR.EI = WISS_ALREADY_OPEN) then         -- Error 28
  20606.             ERROR_LOGGING (GKS_INSTR.EI, "OPEN_WS");
  20607.             raise WS_ERROR;
  20608.          end if;
  20609.      
  20610.       else
  20611.          WS_IDS.ADD_TO_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS);
  20612.      
  20613.          if CURRENT_OPERATING_STATE = GKOP then
  20614.             CURRENT_OPERATING_STATE := WSOP;
  20615.          end if;
  20616.      
  20617.       end if;
  20618.      
  20619.    end if;
  20620.      
  20621.    exception
  20622.       when STATE_ERROR =>
  20623.          raise;
  20624.       when WS_ERROR =>
  20625.          raise;
  20626.       when OTHERS =>
  20627.          ERROR_LOGGING (UNKNOWN, "OPEN_WS");          -- Error 2501
  20628.          raise;
  20629.      
  20630. end OPEN_WS;
  20631. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20632. --:UDD:GKSADACM:CODE:MA:PLIN_S.ADA
  20633. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20634. ------------------------------------------------------------------
  20635. --
  20636. --  NAME: POLYLINE
  20637. --  IDENTIFIER: GIMXXX.1(1)
  20638. --  DISCREPANCY REPORTS:
  20639. --
  20640. ------------------------------------------------------------------
  20641. -- file:  plin_s.ada
  20642. -- level: all levels
  20643.      
  20644. separate (OUTPUT_PRIMITIVES)
  20645.      
  20646. procedure POLYLINE
  20647.    (LINE_POINTS : in WC.POINT_ARRAY) is
  20648.      
  20649. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  20650. -- to check if GKS is in state WSAC or SGOP.  If it is not,
  20651. -- error 5 occurs and the exception STATE_ERROR is raised.  In
  20652. -- addition, it checks if the number of points is invalid.  If
  20653. -- so, error 100 occurs and the exception OUTPUT_PRIMITIVE_ERROR
  20654. -- is raised.  Otherwise, this procedure performs a normalization
  20655. -- transformation on the world coordinate points passed in and
  20656. -- passes the normalized device coordinates that result to the
  20657. -- workstation manager to draw a sequence of connected straight
  20658. -- lines.
  20659. --
  20660. -- LINE_POINTS - Provides the array of world coordinate points.
  20661.      
  20662. GKS_INSTR : CGI_POLYLINE;
  20663.      
  20664. NDC_POINTS : NDC.POINT_ARRAY(1..LINE_POINTS'LENGTH);
  20665. -- The above type was created to hold the transformed points.
  20666.      
  20667. begin
  20668.      
  20669.    -- The following if structure inquires the GKS_OPERATING_STATE_
  20670.    -- LIST to see if GKS is in the proper state. Then it checks to
  20671.    -- see that the number of points is valid before calling the
  20672.    -- WS_MANAGER.
  20673.      
  20674.    if (CURRENT_OPERATING_STATE /= WSAC) and
  20675.       (CURRENT_OPERATING_STATE /= SGOP) then
  20676.       ERROR_LOGGING (NOT_WSAC_SGOP, "POLYLINE");            -- Error 5
  20677.       raise STATE_ERROR;
  20678.      
  20679.    elsif LINE_POINTS'LENGTH < 2 then
  20680.       ERROR_LOGGING (INVALID_NUMBER_OF_POINTS, "POLYLINE"); -- Error 100
  20681.       raise OUTPUT_PRIMITIVE_ERROR;
  20682.      
  20683.    else
  20684.      
  20685.       -- The following logic will perform a transformation on the
  20686.       -- points from world coordinates to normalized device coordinates.
  20687.      
  20688.       NDC_POINTS := TRANSFORMATION_MATH.WC_TO_NDC (GKS_STATE_LIST.
  20689.                     LIST_OF_NORMALIZATION_TRANSFORMATIONS
  20690.                    (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  20691.                    .NDC_FACTORS, LINE_POINTS);
  20692.      
  20693.       GKS_INSTR.LINE_POINTS := new NDC.POINT_ARRAY'(NDC_POINTS);
  20694.      
  20695.       WS_MANAGER (GKS_INSTR);
  20696.      
  20697.       FREE_POINT_ARRAY (GKS_INSTR.LINE_POINTS);
  20698.      
  20699.    end if;
  20700.      
  20701.    exception
  20702.       when STATE_ERROR =>
  20703.          raise;
  20704.       when OUTPUT_PRIMITIVE_ERROR =>
  20705.          raise;
  20706.       when NUMERIC_ERROR =>
  20707.          ERROR_LOGGING (ARITHMETIC, "POLYLINE");          -- Error 308
  20708.          raise SYSTEM_ERROR;
  20709.       when OTHERS =>
  20710.          ERROR_LOGGING (UNKNOWN, "POLYLINE");             -- Error 2501
  20711.          raise;
  20712.      
  20713. end POLYLINE;
  20714. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20715. --:UDD:GKSADACM:CODE:MA:PMRK_S.ADA
  20716. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20717. ------------------------------------------------------------------
  20718. --
  20719. --  NAME: POLYMARKER
  20720. --  IDENTIFIER: GIMXXX.1(1)
  20721. --  DISCREPANCY REPORTS:
  20722. --
  20723. ------------------------------------------------------------------
  20724. -- file:  pmrk_s.ada
  20725. -- level: all levels
  20726.      
  20727. separate (OUTPUT_PRIMITIVES)
  20728.      
  20729. procedure POLYMARKER
  20730.    (MARKER_POINTS : in WC.POINT_ARRAY) is
  20731.      
  20732. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  20733. -- to check if GKS is in state WSAC or SGOP.  If it is not,
  20734. -- error 5 occurs and the exception STATE_ERROR is raised.  In
  20735. -- addition, it checks if the number of points is invalid.  If
  20736. -- so, error 100 occurs and the exception OUTPUT_PRIMITIVE_ERROR
  20737. -- is raised.  Otherwise, this procedure performs a normalization
  20738. -- transformation on the world coordinate points passed in and
  20739. -- passes the normalized device coordinates that result to the
  20740. -- workstation manager to draw a sequence of markers.
  20741. --
  20742. -- MARKER_POINTS - Provides the array of world coordinate points.
  20743.      
  20744. GKS_INSTR : CGI_POLYMARKER;
  20745.      
  20746. NDC_POINTS : NDC.POINT_ARRAY(1..MARKER_POINTS'LENGTH);
  20747. -- The above type was created to hold the transformed points.
  20748.      
  20749. begin
  20750.      
  20751.    -- The following if structure inquires the GKS_OPERATING_STATE_
  20752.    -- LIST to see if GKS is in the proper state. Then it checks to
  20753.    -- see that the number of points is valid before calling the
  20754.    -- WS_MANAGER.
  20755.      
  20756.    if (CURRENT_OPERATING_STATE /= WSAC) and
  20757.       (CURRENT_OPERATING_STATE /= SGOP) then
  20758.       ERROR_LOGGING (NOT_WSAC_SGOP, "POLYMARKER");  -- Error 5
  20759.       raise STATE_ERROR;
  20760.      
  20761.    elsif MARKER_POINTS'LENGTH < 1 then
  20762.       ERROR_LOGGING (INVALID_NUMBER_OF_POINTS, "POLYMARKER");-- Error 100
  20763.       raise OUTPUT_PRIMITIVE_ERROR;
  20764.      
  20765.    else
  20766.      
  20767.       -- The following logic will perform a transformation on the
  20768.       -- points from world coordinates to normalized device coordinates.
  20769.       NDC_POINTS := TRANSFORMATION_MATH.WC_TO_NDC (GKS_STATE_LIST.
  20770.                     LIST_OF_NORMALIZATION_TRANSFORMATIONS
  20771.                    (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  20772.                    .NDC_FACTORS, MARKER_POINTS);
  20773.      
  20774.       GKS_INSTR.MARKER_POINTS := new NDC.POINT_ARRAY'(NDC_POINTS);
  20775.      
  20776.       WS_MANAGER (GKS_INSTR);
  20777.      
  20778.       FREE_POINT_ARRAY (GKS_INSTR.MARKER_POINTS);
  20779.      
  20780.    end if;
  20781.      
  20782.    exception
  20783.       when STATE_ERROR =>
  20784.          raise;
  20785.       when OUTPUT_PRIMITIVE_ERROR =>
  20786.          raise;
  20787.       when NUMERIC_ERROR =>
  20788.          ERROR_LOGGING (ARITHMETIC, "POLYMARKER");         -- Error 308
  20789.          raise SYSTEM_ERROR;
  20790.       when OTHERS =>
  20791.          ERROR_LOGGING (UNKNOWN, "POLYMARKER");            -- Error 2501
  20792.          raise;
  20793.      
  20794. end POLYMARKER;
  20795. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20796. --:UDD:GKSADACM:CODE:MA:TXT_S.ADA
  20797. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20798. ------------------------------------------------------------------
  20799. --
  20800. --  NAME: TEXT
  20801. --  IDENTIFIER: GIMXXX.1(1)
  20802. --  DISCREPANCY REPORTS:
  20803. --
  20804. ------------------------------------------------------------------
  20805. -- file:  txt_s.ada
  20806. -- levels: all levels
  20807.      
  20808. separate (OUTPUT_PRIMITIVES)
  20809.      
  20810. procedure TEXT
  20811.    (POSITION   : in WC.POINT;
  20812.    TEXT_STRING : in STRING) is
  20813.      
  20814. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  20815. -- to check if GKS is in one of the states WSAC or SGOP.  If
  20816. -- it is not, error 5 occurs and the exception STATE_ERROR is
  20817. -- raised.  Otherwise, the procedure does a normalization
  20818. -- transformation on the world coordinate point passed in
  20819. -- as the text position.  The resulting normalized device
  20820. -- coordinates and the text string are passed to the work-
  20821. -- station manager to be clipped and generated on the output.
  20822. -- If the WS_MANAGER returns error_indicator 101, this procedure
  20823. -- will raise the exception OUTPUT_PRIMITIVE_ERROR.
  20824. --
  20825. -- POSITION - This is a point in world coordinates at which the
  20826. --    text begins.
  20827. -- TEXT_STRING - This is text to be displayed.
  20828.      
  20829. GKS_INSTR : CGI_TEXT;
  20830.      
  20831. begin
  20832.      
  20833.    -- The following if structure inquires the GKS_OPERATING_STATE_
  20834.    -- LIST to see if GKS is in the proper state.
  20835.      
  20836.    if (CURRENT_OPERATING_STATE /= WSAC) and
  20837.       (CURRENT_OPERATING_STATE /= SGOP) then
  20838.       ERROR_LOGGING (NOT_WSAC_SGOP, "TEXT");    -- Error 5
  20839.       raise STATE_ERROR;
  20840.      
  20841.    else
  20842.       GKS_INSTR.TEXT_STRING := new STRING'(TEXT_STRING);
  20843.      
  20844.       -- The following logic will perform a transformation on the
  20845.       -- point from world coordinates to normalized device coordinates.
  20846.      
  20847.       GKS_INSTR.TEXT_POSITION := TRANSFORMATION_MATH.WC_TO_NDC
  20848.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  20849.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  20850.          .NDC_FACTORS, POSITION);
  20851.      
  20852.       WS_MANAGER (GKS_INSTR);
  20853.      
  20854.       FREE_STRING (GKS_INSTR.TEXT_STRING);
  20855.      
  20856.       if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  20857.          if GKS_INSTR.EI = INVALID_STRING_CODE then   -- Error 101
  20858.             ERROR_LOGGING (GKS_INSTR.EI, "TEXT");
  20859.             raise OUTPUT_PRIMITIVE_ERROR;
  20860.      
  20861.        end if;
  20862.       end if;
  20863.      
  20864.    end if;
  20865.      
  20866.    exception
  20867.       when STATE_ERROR =>
  20868.          raise;
  20869.       when OUTPUT_PRIMITIVE_ERROR =>
  20870.          raise;
  20871.       when NUMERIC_ERROR =>
  20872.          ERROR_LOGGING (ARITHMETIC, "TEXT");          -- Error 308
  20873.          raise SYSTEM_ERROR;
  20874.       when OTHERS =>
  20875.          ERROR_LOGGING (UNKNOWN, "TEXT");             -- Error 2501
  20876.          raise;
  20877.      
  20878. end TEXT;
  20879. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20880. --:UDD:GKSADACM:CODE:MA:UP_WS_S.ADA
  20881. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20882. ------------------------------------------------------------------
  20883. --
  20884. --  NAME: UPDATE_WS
  20885. --  IDENTIFIER: GIMXXX.1(1)
  20886. --  DISCREPANCY REPORTS:
  20887. --
  20888. ------------------------------------------------------------------
  20889. -- file:  up_ws_s.ada
  20890. -- level: all levels
  20891.      
  20892. separate (WS_CONTROL)
  20893.      
  20894. procedure UPDATE_WS
  20895.    (WS          : in WS_ID;
  20896.    REGENERATION : in UPDATE_REGENERATION_FLAG) is
  20897.      
  20898. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  20899. -- to check if GKS is states WSOP, WSAC, or SGOP.  If it is not
  20900. -- then error 7 occurs, and the exception STATE_ERROR is raised.
  20901. -- Then this procedure inquires the GKS_STATE_LIST to see if the
  20902. -- WS is open.  If it is not, error 25 occurs and the exception
  20903. -- WS_ERROR is raised.
  20904. --
  20905. -- Otherwise, this procedure calls the workstation manager to
  20906. -- update the workstation.  If the workstation manager returns
  20907. -- error 33, 35, or 36 this procedure raises the exception WS_ERROR.
  20908. --
  20909. -- WS - This is the identifier of the workstation that is
  20910. --    to be updated.
  20911. -- REGENERATION - This flag may have one of two values, PERFORM
  20912. --    or POSTPONE to indicate the regeneration action on the
  20913. --    display.
  20914.      
  20915. GKS_INSTR : CGI_UPDATE_WS;
  20916.      
  20917. begin
  20918.      
  20919.    -- The following if structure inquires the GKS_OPERATING_STATE_
  20920.    -- LIST to see if GKS is in the proper state. Then it inquires
  20921.    -- the GKS_STATE_LIST to see if the WS is in the set of open
  20922.    -- workstations before calling the WS_MANAGER.
  20923.      
  20924.    if (CURRENT_OPERATING_STATE = GKCL) or
  20925.       (CURRENT_OPERATING_STATE = GKOP) then
  20926.       ERROR_LOGGING (NOT_WSOP_WSAC_SGOP, "UPDATE_WS");  -- Error 7
  20927.       raise STATE_ERROR;
  20928.      
  20929.    elsif not WS_IDS.IS_IN_LIST(WS, GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  20930.       ERROR_LOGGING (WS_NOT_OPEN, "UPDATE_WS");         -- Error 25
  20931.       raise WS_ERROR;
  20932.      
  20933.    else
  20934.       GKS_INSTR.WS_TO_UPDATE := WS;
  20935.       GKS_INSTR.REGENERATION := REGENERATION;
  20936.       WS_MANAGER (GKS_INSTR);
  20937.      
  20938.       if GKS_INSTR.EI /= SUCCESSFUL then               -- Error 0
  20939.          if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  20940.             (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) or   -- Error 35
  20941.             (GKS_INSTR.EI = WS_IS_WISS) then           -- Error 36
  20942.             ERROR_LOGGING (GKS_INSTR.EI, "UPDATE_WS");
  20943.             raise WS_ERROR;
  20944.          end if;
  20945.      
  20946.       end if;
  20947.      
  20948.    end if;
  20949.      
  20950.   exception
  20951.      when STATE_ERROR =>
  20952.         raise;
  20953.      when WS_ERROR =>
  20954.         raise;
  20955.      when SYSTEM_ERROR =>
  20956.         ERROR_LOGGING (ARITHMETIC,"UPDATE_WS");       -- Error 308
  20957.         raise;
  20958.      when OTHERS =>
  20959.         ERROR_LOGGING (UNKNOWN, "UPDATE_WS");         -- Error 2501
  20960.         raise;
  20961.      
  20962. end UPDATE_WS;
  20963. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20964. --:UDD:GKSADACM:CODE:MA:A_CLIP_UTILITIES_B.ADA
  20965. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20966. ------------------------------------------------------------------
  20967. --
  20968. --  NAME: AREA_CLIPPING_UTILITIES - BODY
  20969. --  IDENTIFIER: GDMXXX.1(1)
  20970. --  DISCREPANCY REPORTS:
  20971. --
  20972. ------------------------------------------------------------------
  20973. -- FILE : WSR_UTILITIES_B.ADA
  20974. -- LEVEL : all
  20975.      
  20976. separate (WSR_UTILITIES)
  20977.      
  20978. package body AREA_CLIPPING_UTILITIES is
  20979.      
  20980. -- This package contains all of the types and procedures needed by the
  20981. -- clipping algorithm for the FILL_AREA.
  20982.      
  20983.    type LINE;
  20984.      
  20985.    type LIST_OF_LINES is access LINE;
  20986.      
  20987.    type LINE is
  20988.       record
  20989.          POINTS    : DC.POINT_LIST;
  20990.          NEXT_LINE : LIST_OF_LINES;
  20991.       end record;
  20992.    -- These types define a linked list of lines. They are used to
  20993.    -- return the results of clipping an area because the area may
  20994.    -- be clipped into more than one area.
  20995.      
  20996.    subtype INTERSECTION_LIST is DC.POINT_LIST;
  20997.      
  20998.    procedure BEGIN_NEW_INTERIOR_LINE
  20999.       (FIRST_POINT   : in DC.POINT;
  21000.        INTERIOR_LINE : in out LIST_OF_LINES) is separate;
  21001.      
  21002.    procedure ADD_TO_INTERIOR_LINE
  21003.       (NEXT_POINT    : in DC.POINT;
  21004.        INTERIOR_LINE : in out LIST_OF_LINES) is separate;
  21005.      
  21006.    procedure ADD_TO_EDGE_LIST
  21007.       (INTERSECTION_POINT : in DC.POINT;
  21008.        EDGE_LIST          : in out INTERSECTION_LIST) is separate;
  21009.      
  21010.    procedure SORT_EDGE_LIST_BY_INCREASING_X_VALUE
  21011.       (EDGE_LIST : in out INTERSECTION_LIST) is separate;
  21012.      
  21013.    procedure SORT_EDGE_LIST_BY_INCREASING_Y_VALUE
  21014.       (EDGE_LIST : in out INTERSECTION_LIST) is separate;
  21015.      
  21016.    procedure PAIR_UP_EDGE_POINTS_ADD_LINES_TO_LIST_OF_INTERIOR_LINES
  21017.       (EDGE_LIST           : in INTERSECTION_LIST;
  21018.        CLIPPED_POINTS_LIST : in out LIST_OF_LINES) is separate;
  21019.      
  21020.    procedure JOIN_LINES_TO_FORM_AREAS
  21021.       (LINES : in out LIST_OF_LINES;
  21022.        AREAS : in out LIST_OF_AREAS) is separate;
  21023.      
  21024.    procedure CLIP_ON_RIGHT
  21025.       (INPUT_AREA    : in DC.POINT_ARRAY;
  21026.        RIGHT_BORDER  : in DC_TYPE;
  21027.        CLIPPED_AREAS : in out LIST_OF_AREAS) is separate;
  21028.      
  21029.    procedure CLIP_ON_BOTTOM
  21030.       (INPUT_AREA    : in DC.POINT_ARRAY;
  21031.        BOTTOM_BORDER : in DC_TYPE;
  21032.        CLIPPED_AREAS : in out LIST_OF_AREAS) is separate;
  21033.      
  21034.    procedure CLIP_ON_LEFT
  21035.       (INPUT_AREA    : in DC.POINT_ARRAY;
  21036.        LEFT_BORDER   : in DC_TYPE;
  21037.        CLIPPED_AREAS : in out LIST_OF_AREAS)is separate;
  21038.      
  21039.    procedure CLIP_ON_TOP
  21040.       (INPUT_AREA    : in DC.POINT_ARRAY;
  21041.        TOP_BORDER    : in DC_TYPE;
  21042.        CLIPPED_AREAS : in out LIST_OF_AREAS) is separate;
  21043.      
  21044. end AREA_CLIPPING_UTILITIES;
  21045. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21046. --:UDD:GKSADACM:CODE:MA:A_ADD_EDGES.ADA
  21047. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21048. ------------------------------------------------------------------
  21049. --
  21050. --  NAME: A_ADD_EDGES
  21051. --  IDENTIFIER: GDMXXX.1(1)
  21052. --  DISCREPANCY REPORTS:
  21053. --
  21054. ------------------------------------------------------------------
  21055. -- FILE : A_ADD_EDGES.ADA
  21056. -- LEVEL : all
  21057.      
  21058. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21059.      
  21060. procedure PAIR_UP_EDGE_POINTS_ADD_LINES_TO_LIST_OF_INTERIOR_LINES
  21061.    (EDGE_LIST           : in INTERSECTION_LIST;
  21062.     CLIPPED_POINTS_LIST : in out LIST_OF_LINES) is
  21063.      
  21064. -- This procedure removes the points from the edge list two points at a
  21065. -- time. The two points are made into a line and added to the end of the
  21066. -- list of lines.
  21067. --
  21068. -- EDGE_LIST           - the list of points to be consumed.
  21069. -- CLIPPED_POINTS_LIST - the list of line segments which is being
  21070. --                       augmented.
  21071.      
  21072.    LINE_SEGMENT : DC.POINT_LIST (LENGTH => 2);
  21073.    -- Contains the border line being added to the list.
  21074.      
  21075.    NEW_CLIPPED_POINTS_LIST : LIST_OF_LINES;
  21076.    -- Points to the newly augmented list.
  21077.      
  21078.    POINT_NUMBER : NATURAL := 1;
  21079.    -- A counter through the EDGE_LIST beginning at the first point.
  21080.      
  21081. begin
  21082.      
  21083.    -- Take pairs of points off of the EDGE_LIST until it is all gone.
  21084.    while POINT_NUMBER < EDGE_LIST.LENGTH loop
  21085.      
  21086.       -- Put the next two points in the EDGE_LIST into the LINE_SEGMENT.
  21087.       LINE_SEGMENT.POINTS :=
  21088.          EDGE_LIST.POINTS (POINT_NUMBER .. POINT_NUMBER + 1);
  21089.      
  21090.       -- Get a new record and put the new LINE_SEGMENT in it and put it
  21091.       -- at the beginning of the OUTPUT_LIST.
  21092.       NEW_CLIPPED_POINTS_LIST := new LINE'
  21093.          (POINTS => LINE_SEGMENT,
  21094.           NEXT_LINE => CLIPPED_POINTS_LIST);
  21095.      
  21096.       -- Update the value of CLIPPED_POINTS_LIST.
  21097.       CLIPPED_POINTS_LIST := NEW_CLIPPED_POINTS_LIST;
  21098.      
  21099.       -- Go on to the next pair of points.
  21100.       POINT_NUMBER := POINT_NUMBER + 2;
  21101.      
  21102.    end loop;
  21103.      
  21104. end PAIR_UP_EDGE_POINTS_ADD_LINES_TO_LIST_OF_INTERIOR_LINES;
  21105. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21106. --:UDD:GKSADACM:CODE:MA:A_ADD_INTERIOR.ADA
  21107. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21108. ------------------------------------------------------------------
  21109. --
  21110. --  NAME: ADD_TO_INTERIOR_LINE
  21111. --  IDENTIFIER: GDMXXX.1(1)
  21112. --  DISCREPANCY REPORTS:
  21113. --
  21114. ------------------------------------------------------------------
  21115. -- FILE : A_ADD_INTERIOR.ADA
  21116. -- LEVEL : all
  21117.      
  21118. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21119.      
  21120. procedure ADD_TO_INTERIOR_LINE
  21121.    (NEXT_POINT    : in DC.POINT;
  21122.     INTERIOR_LINE : in out LIST_OF_LINES) is
  21123.      
  21124. -- This procedure adds the NEXT_POINT onto the end of the current
  21125. -- interior line.
  21126. --
  21127. -- NEXT_POINT    - the point to be added onto the list.
  21128. -- INTERIOR_LINE - the line being added to.
  21129.      
  21130.    NEW_POINT_ARRAY :
  21131.       DC.POINT_ARRAY (1 .. INTERIOR_LINE.POINTS.LENGTH + 1);
  21132.    -- The new line, one point longer than the original line.
  21133.      
  21134. begin
  21135.      
  21136.    -- Put the original points at the beginning of the new line.
  21137.    NEW_POINT_ARRAY (1 .. INTERIOR_LINE.POINTS.LENGTH) :=
  21138.       INTERIOR_LINE.POINTS.POINTS;
  21139.      
  21140.    -- Put the new point at the end of the new line.
  21141.    NEW_POINT_ARRAY (INTERIOR_LINE.POINTS.LENGTH + 1) := NEXT_POINT;
  21142.      
  21143.    -- Assign the new list to the out parameter, changing the length at
  21144.    -- the same time as the array is changed.
  21145.    INTERIOR_LINE.POINTS :=
  21146.       (INTERIOR_LINE.POINTS.LENGTH + 1, NEW_POINT_ARRAY);
  21147.      
  21148. end ADD_TO_INTERIOR_LINE;
  21149. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21150. --:UDD:GKSADACM:CODE:MA:A_ADD_TO_EDGE_LIST.ADA
  21151. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21152. ------------------------------------------------------------------
  21153. --
  21154. --  NAME: ADD_TO_EDGE_LIST
  21155. --  IDENTIFIER: GDMXXX.1(1)
  21156. --  DISCREPANCY REPORTS:
  21157. --
  21158. ------------------------------------------------------------------
  21159. -- FILE : A_ADD_TO_EDGE_LIST.ADA
  21160. -- LEVEL : all
  21161.      
  21162. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21163.      
  21164. procedure ADD_TO_EDGE_LIST
  21165.    (INTERSECTION_POINT : in DC.POINT;
  21166.     EDGE_LIST          : in out INTERSECTION_LIST) is
  21167.      
  21168. -- This procedure adds the given point onto the end of the intersection
  21169. -- list.
  21170. --
  21171. -- INTERSECTION_POINT - the new point to be added to the list.
  21172. -- EDGE_LIST          - the list being added to.
  21173.      
  21174.    NEW_EDGE_LIST : DC.POINT_ARRAY (1 .. EDGE_LIST.LENGTH + 1);
  21175.    -- The new list is defined to be one item longer than the input list.
  21176.      
  21177. begin
  21178.      
  21179.    -- Put the old points at the beginning of the new list.
  21180.    NEW_EDGE_LIST (1 .. EDGE_LIST.LENGTH) := EDGE_LIST.POINTS;
  21181.      
  21182.    -- Put the new point at the end of the list.
  21183.    NEW_EDGE_LIST (EDGE_LIST.LENGTH + 1) := INTERSECTION_POINT;
  21184.      
  21185.    -- Assign the new list to the out parameter, changing the length at
  21186.    -- the same time as the array is changed.
  21187.    EDGE_LIST := (EDGE_LIST.LENGTH + 1, NEW_EDGE_LIST);
  21188.      
  21189. end ADD_TO_EDGE_LIST;
  21190. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21191. --:UDD:GKSADACM:CODE:MA:A_BEGIN_INTERIOR.ADA
  21192. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21193. ------------------------------------------------------------------
  21194. --
  21195. --  NAME: BEGIN_NEW_INTERIOR_LINE
  21196. --  IDENTIFIER: GDMXXX.1(1)
  21197. --  DISCREPANCY REPORTS:
  21198. --
  21199. ------------------------------------------------------------------
  21200. -- FILE : A_BEGIN_INTERIOR.ADA
  21201. -- LEVEL : all
  21202.      
  21203. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21204.      
  21205. procedure BEGIN_NEW_INTERIOR_LINE
  21206.    (FIRST_POINT   : in DC.POINT;
  21207.     INTERIOR_LINE : in out LIST_OF_LINES) is
  21208.      
  21209. -- This procedure starts a new interior line which only contains one
  21210. -- point, FIRST_POINT. The procedure puts the new line at the beginning
  21211. -- of the list of interior lines.
  21212. --
  21213. -- FIRST_POINT   - the sole point in the new line.
  21214. -- INTERIOR_LINE - the linked list of interior lines.
  21215.      
  21216.    NEW_LINE : LIST_OF_LINES;
  21217.    -- Points to the new line.
  21218.      
  21219.    NEW_POINT_LIST : DC.POINT_LIST :=
  21220.        (LENGTH => 1, POINTS => (1 => FIRST_POINT));
  21221.    -- Contains the point which makes up the new line.
  21222.      
  21223. begin
  21224.      
  21225.    NEW_LINE := new LINE'
  21226.       (POINTS => NEW_POINT_LIST, NEXT_LINE => INTERIOR_LINE);
  21227.      
  21228.    INTERIOR_LINE := NEW_LINE;
  21229.      
  21230. end BEGIN_NEW_INTERIOR_LINE;
  21231. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21232. --:UDD:GKSADACM:CODE:MA:A_JOIN_LINES.ADA
  21233. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21234. ------------------------------------------------------------------
  21235. --
  21236. --  NAME: JOIN_LINES_TO_FORM_AREAS
  21237. --  IDENTIFIER: GDMXXX.1(1)
  21238. --  DISCREPANCY REPORTS:
  21239. --
  21240. ------------------------------------------------------------------
  21241. -- FILE : A_JOIN_LINES.ADA
  21242. -- LEVEL : all
  21243.      
  21244. with UNCHECKED_DEALLOCATION;
  21245.      
  21246. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21247.      
  21248. procedure JOIN_LINES_TO_FORM_AREAS
  21249.    (LINES : in out LIST_OF_LINES;
  21250.     AREAS : in out LIST_OF_AREAS) is
  21251.      
  21252. -- This procedure takes in a list of line segments. It joins up the
  21253. -- segments into areas by finding endpoints that match.
  21254. --
  21255. -- LINES - the lines to be joined.
  21256. -- AREAS - the result of joining the lines.
  21257.      
  21258.    NEW_AREA : LIST_OF_AREAS;
  21259.    -- Holds the newest area being worked on.
  21260.      
  21261.    procedure DISPOSE is new UNCHECKED_DEALLOCATION
  21262.       (OBJECT => LINE, NAME => LIST_OF_LINES);
  21263.    -- This procedure is used to get rid of the lines once they have been
  21264.    -- processed.
  21265.      
  21266.    USED_LINE : LIST_OF_LINES;
  21267.    -- Contains a line before it is disposed of.
  21268.      
  21269.    NEXT_LINE_SEGMENT : DC.POINT_LIST;
  21270.    -- Contains the next line to be added to the list of ACCUMULATED_
  21271.    -- AREAS.
  21272.      
  21273.    function "=" (LEFT, RIGHT : DC.POINT)
  21274.       return BOOLEAN renames DC."=";
  21275.    -- Make the procedure for equality local for use in infix notation.
  21276.      
  21277.    procedure SEPARATE_OUT_NEXT_LINE_SEGMENT
  21278.       (LIST_OF_SEGMENTS  : in out LIST_OF_LINES;
  21279.        COMMON_POINT      : in DC.POINT;
  21280.        NEXT_LINE_SEGMENT : in out DC.POINT_LIST) is separate;
  21281.      
  21282. begin
  21283.      
  21284.      
  21285.    while LINES /= null loop
  21286.      
  21287.       -- Begin a NEW_AREA with the first set of lines on the list.
  21288.       -- Join the NEW_AREA onto the front of the list of ACCUMULATED_
  21289.       -- AREAS.
  21290.       NEW_AREA := new AREA' (BORDER => LINES.POINTS,
  21291.          NEXT_AREA => AREAS);
  21292.       AREAS := NEW_AREA;
  21293.      
  21294.       -- Remove the used line from the list of lines and dispose of the
  21295.       -- used line.
  21296.       USED_LINE := LINES;
  21297.       LINES := LINES.NEXT_LINE;
  21298.       DISPOSE (USED_LINE);
  21299.      
  21300.       -- Repeat until the area has been closed up.
  21301.       while not (AREAS.BORDER.POINTS(1) =
  21302.          AREAS.BORDER.POINTS (AREAS.BORDER.LENGTH)) loop
  21303.      
  21304.          -- Find a line which has an endpoint that matches the current
  21305.          -- point. Remove that line from the list of lines.
  21306.          SEPARATE_OUT_NEXT_LINE_SEGMENT (LINES,
  21307.             AREAS.BORDER.POINTS (1), NEXT_LINE_SEGMENT);
  21308.      
  21309.          declare
  21310.      
  21311.             TOTAL_LENGTH : constant POSITIVE := AREAS.BORDER.LENGTH +
  21312.                NEXT_LINE_SEGMENT.LENGTH;
  21313.      
  21314.             ARRAY_OF_POINTS : DC.POINT_ARRAY (1 .. TOTAL_LENGTH);
  21315.             -- This variable will hold all of the current area.
  21316.      
  21317.          begin
  21318.      
  21319.             -- Put the new segment at the beginning of the new area.
  21320.             ARRAY_OF_POINTS (1 .. NEXT_LINE_SEGMENT.LENGTH) :=
  21321.                NEXT_LINE_SEGMENT.POINTS;
  21322.      
  21323.             -- Put the old part of the area at the end of the list.
  21324.             ARRAY_OF_POINTS (NEXT_LINE_SEGMENT.LENGTH + 1 ..
  21325.                TOTAL_LENGTH) := AREAS.BORDER.POINTS;
  21326.      
  21327.             -- Update the current area.
  21328.             AREAS.BORDER := (TOTAL_LENGTH, ARRAY_OF_POINTS);
  21329.      
  21330.          end;
  21331.      
  21332.       end loop;
  21333.      
  21334.    end loop;
  21335.      
  21336. end JOIN_LINES_TO_FORM_AREAS;
  21337. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21338. --:UDD:GKSADACM:CODE:MA:A_SEP_NEXT_SEGMENT.ADA
  21339. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21340. ------------------------------------------------------------------
  21341. --
  21342. --  NAME: SEPARATE_OUT_NEXT_LINE_SEGMENT
  21343. --  IDENTIFIER: GDMXXX.1(1)
  21344. --  DISCREPANCY REPORTS:
  21345. --
  21346. ------------------------------------------------------------------
  21347. -- FILE : A_SEP_NEXT_SEGMENT.ADA
  21348. -- LEVEL : all
  21349.      
  21350. with UNCHECKED_DEALLOCATION;
  21351.      
  21352. separate
  21353.    (WSR_UTILITIES.AREA_CLIPPING_UTILITIES.JOIN_LINES_TO_FORM_AREAS)
  21354.      
  21355. procedure SEPARATE_OUT_NEXT_LINE_SEGMENT
  21356.    (LIST_OF_SEGMENTS  : in out LIST_OF_LINES;
  21357.     COMMON_POINT      : in DC.POINT;
  21358.     NEXT_LINE_SEGMENT : in out DC.POINT_LIST) is
  21359.      
  21360. -- This procedure searches through the LIST_OF_SEGMENTS looking for a
  21361. -- segment whose first or last point is the same as the COMMON_POINT.
  21362. -- When it is found the line segment is returned in NEXT_LINE_SEGMENT
  21363. -- with the COMMON_POINT as the last point, and the line segment is
  21364. -- removed from the LIST_OF_SEGMENTS.
  21365. --
  21366. -- LIST_OF_SEGMENTS  - the list of segments being searched through.
  21367. -- COMMON_POINT      - the point being searched for.
  21368. -- NEXT_LINE_SEGMENT - the segment which matches.
  21369.      
  21370.    PREVIOUS_SEGMENT : LIST_OF_LINES := null;
  21371.    -- A pointer to the line segment previous to the one currently under
  21372.    -- consideration.
  21373.      
  21374.    CURRENT_SEGMENT : LIST_OF_LINES := LIST_OF_SEGMENTS;
  21375.    -- A pointer to the line segment currently under consideration.
  21376.      
  21377.    procedure DISPOSE is new UNCHECKED_DEALLOCATION
  21378.       (OBJECT => LINE, NAME => LIST_OF_LINES);
  21379.    -- Used to dispose of a pointer to a line segment after the data has
  21380.    -- been returned in NEXT_LINE_SEGMENT;
  21381.      
  21382.    function "=" (FIRST, LAST : DC.POINT) return BOOLEAN
  21383.       renames DC."=";
  21384.      
  21385.    function INVERT_POINTS (ORIGINAL_POINTS : in DC.POINT_ARRAY)
  21386.       return DC.POINT_ARRAY is
  21387.      
  21388.    -- This function is used for inverting the order of the points in an
  21389.    -- array.
  21390.      
  21391.       TEMPORARY_ARRAY : DC.POINT_ARRAY(ORIGINAL_POINTS'RANGE);
  21392.       -- Holds the inverted value of the ORIGINAL_POINTS while they are
  21393.       -- being swapped.
  21394.      
  21395.    begin
  21396.      
  21397.       for I in ORIGINAL_POINTS'RANGE loop
  21398.          TEMPORARY_ARRAY (ORIGINAL_POINTS'LAST + 1 - I)
  21399.             := ORIGINAL_POINTS (I);
  21400.       end loop;
  21401.      
  21402.       return TEMPORARY_ARRAY;
  21403.      
  21404.    end INVERT_POINTS;
  21405.      
  21406. begin
  21407.      
  21408.    -- Search until a match is found with an endpoint of a segment.
  21409.    while not (COMMON_POINT = CURRENT_SEGMENT.POINTS.POINTS (1)) and
  21410.       not (COMMON_POINT = CURRENT_SEGMENT.POINTS.POINTS
  21411.       (CURRENT_SEGMENT.POINTS.POINTS'LAST)) loop
  21412.      
  21413.       PREVIOUS_SEGMENT := CURRENT_SEGMENT;
  21414.       CURRENT_SEGMENT := CURRENT_SEGMENT.NEXT_LINE;
  21415.      
  21416.    end loop;
  21417.      
  21418.    -- Put the segment into NEXT_LINE_SEGMENT with the matching point
  21419.    -- as the last point of the array.
  21420.    if not (COMMON_POINT = CURRENT_SEGMENT.POINTS.POINTS (1)) then
  21421.      
  21422.       NEXT_LINE_SEGMENT := CURRENT_SEGMENT.POINTS;
  21423.      
  21424.    else
  21425.       NEXT_LINE_SEGMENT := (CURRENT_SEGMENT.POINTS.LENGTH,
  21426.          INVERT_POINTS (CURRENT_SEGMENT.POINTS.POINTS));
  21427.      
  21428.    end if;
  21429.      
  21430.    -- Remove the used line segment from the list of segments.
  21431.    if PREVIOUS_SEGMENT /= null then
  21432.       PREVIOUS_SEGMENT.NEXT_LINE := CURRENT_SEGMENT.NEXT_LINE;
  21433.    else
  21434.       LIST_OF_SEGMENTS := CURRENT_SEGMENT.NEXT_LINE;
  21435.    end if;
  21436.      
  21437.    -- Return its storage space to the heap.
  21438.    DISPOSE (CURRENT_SEGMENT);
  21439.      
  21440.    -- Delete the matching point from the end of the list of points.
  21441.    NEXT_LINE_SEGMENT := (NEXT_LINE_SEGMENT.LENGTH - 1,
  21442.       NEXT_LINE_SEGMENT.POINTS (1 .. NEXT_LINE_SEGMENT.LENGTH - 1));
  21443.      
  21444. end SEPARATE_OUT_NEXT_LINE_SEGMENT;
  21445. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21446. --:UDD:GKSADACM:CODE:MA:A_SORT_BY_X.ADA
  21447. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21448. ------------------------------------------------------------------
  21449. --
  21450. --  NAME: SORT_EDGE_LIST_BY_INCREASING_X_VALUE
  21451. --  IDENTIFIER: GDMXXX.1(1)
  21452. --  DISCREPANCY REPORTS:
  21453. --
  21454. ------------------------------------------------------------------
  21455. -- FILE : A_SORT_BY_X.ADA
  21456. -- LEVEL : all
  21457.      
  21458. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21459.      
  21460. procedure SORT_EDGE_LIST_BY_INCREASING_X_VALUE
  21461.    (EDGE_LIST : in out INTERSECTION_LIST) is
  21462.      
  21463. -- This procedure performs a simple sort on the list of points based
  21464. -- upon the value of their X coordinate. It sorts from smallest to
  21465. -- largest.
  21466. --
  21467. -- EDGE_LIST - the list of points to be sorted.
  21468.      
  21469.    TEMPORARY_POINT : DC.POINT;
  21470.    -- This is a temporary holding place used for swapping points.
  21471.      
  21472. begin
  21473.      
  21474.    -- One pass through this loop will place one point in the correct
  21475.    -- position.
  21476.    for STATIONARY_POINT in 1 .. EDGE_LIST.LENGTH - 1 loop
  21477.      
  21478.       -- Compare each of the remaining points with the STATIONARY_POINT.
  21479.       for LATER_POINT in STATIONARY_POINT + 1 .. EDGE_LIST.LENGTH loop
  21480.      
  21481.          -- Swap the two points if the first one is not the smaller.
  21482.          if EDGE_LIST.POINTS (LATER_POINT).X <
  21483.             EDGE_LIST.POINTS (STATIONARY_POINT).X then
  21484.      
  21485.             TEMPORARY_POINT := EDGE_LIST.POINTS (STATIONARY_POINT);
  21486.             EDGE_LIST.POINTS (STATIONARY_POINT) :=
  21487.                EDGE_LIST.POINTS (LATER_POINT);
  21488.             EDGE_LIST.POINTS (LATER_POINT) := TEMPORARY_POINT;
  21489.          end if;
  21490.      
  21491.       end loop;
  21492.      
  21493.    end loop;
  21494.      
  21495. end SORT_EDGE_LIST_BY_INCREASING_X_VALUE;
  21496. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21497. --:UDD:GKSADACM:CODE:MA:A_SORT_BY_Y.ADA
  21498. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21499. ------------------------------------------------------------------
  21500. --
  21501. --  NAME: SORT_EDGE_LIST_BY_INCREASING_Y_VALUE
  21502. --  IDENTIFIER: GDMXXX.1(1)
  21503. --  DISCREPANCY REPORTS:
  21504. --
  21505. ------------------------------------------------------------------
  21506. -- FILE : A_SORT_BY_Y.ADA
  21507. -- LEVEL : all
  21508.      
  21509. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21510.      
  21511. procedure SORT_EDGE_LIST_BY_INCREASING_Y_VALUE
  21512.    (EDGE_LIST : in out INTERSECTION_LIST) is
  21513.      
  21514. -- This procedure performs a simple sort on the list of points based
  21515. -- upon the value of their Y coordinates. It sorts from smallest to
  21516. -- largest.
  21517. --
  21518. -- EDGE_LIST - the list of points to be sorted.
  21519.      
  21520.    TEMPORARY_POINT : DC.POINT;
  21521.    -- This is a temporary holding place used for swapping points.
  21522.      
  21523. begin
  21524.      
  21525.    -- One pass through this loop will place one point in the correct
  21526.    -- position.
  21527.    for STATIONARY_POINT in 1 .. EDGE_LIST.LENGTH - 1 loop
  21528.      
  21529.       -- Compare each of the remaining points with the STATIONARY_POINT.
  21530.       for LATER_POINT in STATIONARY_POINT + 1 .. EDGE_LIST.LENGTH loop
  21531.      
  21532.          -- Swap the two points if the first one is not the smaller.
  21533.          if EDGE_LIST.POINTS (LATER_POINT).Y <
  21534.             EDGE_LIST.POINTS (STATIONARY_POINT).Y then
  21535.      
  21536.             TEMPORARY_POINT := EDGE_LIST.POINTS (STATIONARY_POINT);
  21537.             EDGE_LIST.POINTS (STATIONARY_POINT) :=
  21538.                EDGE_LIST.POINTS (LATER_POINT);
  21539.             EDGE_LIST.POINTS (LATER_POINT) := TEMPORARY_POINT;
  21540.          end if;
  21541.      
  21542.       end loop;
  21543.      
  21544.    end loop;
  21545.      
  21546. end SORT_EDGE_LIST_BY_INCREASING_Y_VALUE;
  21547. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21548. --:UDD:GKSADACM:CODE:MA:CLIP_ON_BOTTOM.ADA
  21549. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21550. ------------------------------------------------------------------
  21551. --
  21552. --  NAME: CLIP_ON_BOTTOM
  21553. --  IDENTIFIER: GDMXXX.1(1)
  21554. --  DISCREPANCY REPORTS:
  21555. --
  21556. ------------------------------------------------------------------
  21557. -- FILE : CLIP_ON_BOTTOM.ADA
  21558. -- LEVEL : all
  21559.      
  21560. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21561.      
  21562. procedure CLIP_ON_BOTTOM
  21563.    (INPUT_AREA     : in DC.POINT_ARRAY;
  21564.     BOTTOM_BORDER  : in DC_TYPE;
  21565.     CLIPPED_AREAS  : in out LIST_OF_AREAS) is
  21566.      
  21567. -- This procedure clips the points to the bottom border of the clipping
  21568. -- rectangle. The input list is clipped at the line Y = BOTTOM_BORDER
  21569. -- and zero or more areas are returned.
  21570. --
  21571. -- INPUT_AREA    - the list of points to be clipped.
  21572. -- BOTTOM_BORDER - the Y value of the bottom edge of the clipping
  21573. --                 rectangle.
  21574. -- CLIPPED_AREAS - the resulting areas.
  21575.      
  21576.    BOTTOM_EDGE_LIST : INTERSECTION_LIST;
  21577.    -- This holds a list of all the intersections points with the bottom
  21578.    -- edge of the clipping rectangle.
  21579.      
  21580.    INTERIOR_POINT_LISTS : LIST_OF_LINES := null;
  21581.    -- This is a list of the line segments which are interior to the
  21582.    -- clipping rectangle.
  21583.      
  21584.    procedure BOTTOM_SUTHERLAND_AND_HODGMAN
  21585.       (INPUT_AREA      : in DC.POINT_ARRAY;
  21586.        BOTTOM_BORDER   : in DC_TYPE;
  21587.        INTERSECTIONS   : in out INTERSECTION_LIST;
  21588.        INTERIOR_POINTS : in out LIST_OF_LINES) is separate;
  21589.      
  21590. begin
  21591.      
  21592.    -- Perform the first stage of the Sutherland and Hodgman algorithm
  21593.    -- as outlined in Foley and Van Dam except for one addition. Instead
  21594.    -- of joining the intersection points to the interior lines in the
  21595.    -- order that they were generated, keep a separate list of each of
  21596.    -- the interior line segments and the intersection points.
  21597.    BOTTOM_SUTHERLAND_AND_HODGMAN (INPUT_AREA, BOTTOM_BORDER,
  21598.       BOTTOM_EDGE_LIST, INTERIOR_POINT_LISTS);
  21599.      
  21600.    -- Put the list of edges into the order that they are connected to
  21601.    -- each other.
  21602.    SORT_EDGE_LIST_BY_INCREASING_X_VALUE (BOTTOM_EDGE_LIST);
  21603.      
  21604.    -- Make lines out of adjacent intersection points. Put the lines onto
  21605.    -- the list of lines formed in the first step.
  21606.    PAIR_UP_EDGE_POINTS_ADD_LINES_TO_LIST_OF_INTERIOR_LINES
  21607.       (BOTTOM_EDGE_LIST, INTERIOR_POINT_LISTS);
  21608.      
  21609.    -- Find which lines in the list connect with which lines and join
  21610.    -- them together to form areas.
  21611.    JOIN_LINES_TO_FORM_AREAS (INTERIOR_POINT_LISTS, CLIPPED_AREAS);
  21612.      
  21613. end CLIP_ON_BOTTOM;
  21614. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21615. --:UDD:GKSADACM:CODE:MA:BOTTOM_S_AND_H.ADA
  21616. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21617. ------------------------------------------------------------------
  21618. --
  21619. --  NAME: BOTTOM_SUTHERLAND_AND_HODGMAN
  21620. --  IDENTIFIER: GDMXXX.1(1)
  21621. --  DISCREPANCY REPORTS:
  21622. --
  21623. ------------------------------------------------------------------
  21624. -- FILE : BOTTOM_S_AND_H.ADA
  21625. -- LEVEL : all
  21626.      
  21627. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES.CLIP_ON_BOTTOM)
  21628.      
  21629. procedure BOTTOM_SUTHERLAND_AND_HODGMAN
  21630.    (INPUT_AREA      : in DC.POINT_ARRAY;
  21631.     BOTTOM_BORDER   : in DC_TYPE;
  21632.     INTERSECTIONS   : in out INTERSECTION_LIST;
  21633.     INTERIOR_POINTS : in out LIST_OF_LINES) is
  21634.      
  21635. -- This procedure performs the Sutherland and Hodgman algorithm on one
  21636. -- side of the clipping rectangle. It is different from the standard
  21637. -- algorithm in that it does not return a single list of points. A
  21638. -- single list of points is not adaquate because multiple areas cannot
  21639. -- be represented as a single list of points. This procedure gets
  21640. -- around this flaw by returning a list of those line segments which
  21641. -- are interior to the clipping rectangle and a list of the intersection
  21642. -- points.
  21643. --
  21644. -- INPUT_AREA      - the list of points to be clipped.
  21645. -- BOTTOM_BORDER   - the X value of the right edge of the clipping
  21646. --                   rectangle.
  21647. -- INTERSECTIONS   - a list of the points where the input line crosses
  21648. --                   the bottom edge of the clipping rectangle.
  21649. -- INTERIOR_POINTS - a linked list of lines interior to the clipping
  21650. --                   rectangle. It is made up of points from the
  21651. --                   original INPUT_AREA plus the intersection points.
  21652.      
  21653.    FIRST_POINT : POSITIVE := 1;
  21654.    -- This variable is an index into the INPUT_AREA. Processing begins
  21655.    -- with the line segment connecting the first point of INPUT_AREA
  21656.    -- with the second point.
  21657.      
  21658.    INTERSECTION_POINT : DC.POINT;
  21659.    -- A point where the INPUT_AREA crosses over the border of the
  21660.    -- clipping rectangle.
  21661.      
  21662.    function FIND_INTERSECTION
  21663.       (FIRST_POINT  : DC.POINT;
  21664.        SECOND_POINT : DC.POINT;
  21665.        Y_VALUE      : DC_TYPE) return DC_TYPE is
  21666.      
  21667.    -- This function returns the Y value of the point where the line
  21668.    -- segment connecting the FIRST_POINT with the SECOND_POINT crosses
  21669.    -- the line defined by X = X_VALUE.
  21670.      
  21671.    begin
  21672.      
  21673.       return FIRST_POINT.X - ((FIRST_POINT.Y - Y_VALUE) *
  21674.          (FIRST_POINT.X - SECOND_POINT.X)) /
  21675.          (FIRST_POINT.Y - SECOND_POINT.Y);
  21676.      
  21677.    end FIND_INTERSECTION;
  21678.      
  21679. begin
  21680.      
  21681.    -- If the point is inside of the clipping area, put it on the list
  21682.    -- of interior points.
  21683.    if INPUT_AREA (FIRST_POINT).Y >= BOTTOM_BORDER then
  21684.       BEGIN_NEW_INTERIOR_LINE (INPUT_AREA (FIRST_POINT),
  21685.          INTERIOR_POINTS);
  21686.    end if;
  21687.      
  21688.    -- Repeat with each of the line segments in the list beginning with
  21689.    -- the line segment joining the first point to the second point and
  21690.    -- continuing with all the other line segments.
  21691.    for SECOND_POINT in 2 .. INPUT_AREA'LAST loop
  21692.      
  21693.       -- If the second point is inside.
  21694.       if INPUT_AREA (SECOND_POINT).Y >= BOTTOM_BORDER then
  21695.      
  21696.          -- If the line segment is inside to inside, put the second
  21697.          -- point on the list of interior points.
  21698.          if INPUT_AREA (FIRST_POINT).Y >= BOTTOM_BORDER then
  21699.      
  21700.             ADD_TO_INTERIOR_LINE (INPUT_AREA (SECOND_POINT),
  21701.                INTERIOR_POINTS);
  21702.      
  21703.          -- If the line segment is outside to inside, put the point
  21704.          -- where the line intersects the edge onto the list of
  21705.          -- intersections. Also begin a new interior line with the
  21706.          -- intersection point and the interior point.
  21707.          else
  21708.      
  21709.             INTERSECTION_POINT := (X => FIND_INTERSECTION
  21710.                (INPUT_AREA (FIRST_POINT), INPUT_AREA (SECOND_POINT),
  21711.                 BOTTOM_BORDER), Y => BOTTOM_BORDER);
  21712.      
  21713.             ADD_TO_EDGE_LIST (INTERSECTION_POINT, INTERSECTIONS);
  21714.      
  21715.             BEGIN_NEW_INTERIOR_LINE (INTERSECTION_POINT,
  21716.                INTERIOR_POINTS);
  21717.      
  21718.             ADD_TO_INTERIOR_LINE (INPUT_AREA (SECOND_POINT),
  21719.                INTERIOR_POINTS);
  21720.      
  21721.          end if;
  21722.      
  21723.       -- If the line segment is inside to outside, put the point of
  21724.       -- intersection onto the list of intersections. Also put the
  21725.       -- intersection point onto the list of interior points. (It will
  21726.       -- be the last point put on to the current interior line segment.)
  21727.       elsif INPUT_AREA (FIRST_POINT).Y >= BOTTOM_BORDER then
  21728.      
  21729.          INTERSECTION_POINT := (X => FIND_INTERSECTION
  21730.             (INPUT_AREA (FIRST_POINT), INPUT_AREA (SECOND_POINT),
  21731.              BOTTOM_BORDER), Y => BOTTOM_BORDER);
  21732.      
  21733.          ADD_TO_EDGE_LIST (INTERSECTION_POINT, INTERSECTIONS);
  21734.      
  21735.          ADD_TO_INTERIOR_LINE (INTERSECTION_POINT, INTERIOR_POINTS);
  21736.      
  21737.       -- If the line segment is outside to outside, do nothing.
  21738.       end if;
  21739.      
  21740.       FIRST_POINT := SECOND_POINT;
  21741.      
  21742.    end loop;
  21743.      
  21744. end BOTTOM_SUTHERLAND_AND_HODGMAN;
  21745. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21746. --:UDD:GKSADACM:CODE:MA:CLIP_ON_LEFT.ADA
  21747. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21748. ------------------------------------------------------------------
  21749. --
  21750. --  NAME: CLIP_ON_LEFT
  21751. --  IDENTIFIER: GDMXXX.1(1)
  21752. --  DISCREPANCY REPORTS:
  21753. --
  21754. ------------------------------------------------------------------
  21755. -- FILE : CLIP_ON_LEFT.ADA
  21756. -- LEVEL : all
  21757.      
  21758. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21759.      
  21760. procedure CLIP_ON_LEFT
  21761.    (INPUT_AREA    : in DC.POINT_ARRAY;
  21762.     LEFT_BORDER   : in DC_TYPE;
  21763.     CLIPPED_AREAS : in out LIST_OF_AREAS) is
  21764.      
  21765. -- This procedure clips the points to the left border of the clipping
  21766. -- rectangle. The input list is clipped at the line X = LEFT_BORDER
  21767. -- and zero or more areas are returned.
  21768. --
  21769. -- INPUT_AREA    - the list of points to be clipped.
  21770. -- LEFT_BORDER   - the X value of the left edge of the clipping
  21771. --                 rectangle.
  21772. -- CLIPPED_AREAS - the resulting areas.
  21773.      
  21774.    LEFT_EDGE_LIST : INTERSECTION_LIST;
  21775.    -- This holds a list of all the intersections points with the left
  21776.    -- edge of the clipping rectangle.
  21777.      
  21778.    INTERIOR_POINT_LISTS : LIST_OF_LINES := null;
  21779.    -- This is a list of the line segments which are interior to the
  21780.    -- clipping rectangle.
  21781.      
  21782.    procedure LEFT_SUTHERLAND_AND_HODGMAN
  21783.       (INPUT_AREA      : in DC.POINT_ARRAY;
  21784.        LEFT_BORDER     : in DC_TYPE;
  21785.        INTERSECTIONS   : in out INTERSECTION_LIST;
  21786.        INTERIOR_POINTS : in out LIST_OF_LINES) is separate;
  21787.      
  21788. begin
  21789.      
  21790.    -- Perform the first stage of the Sutherland and Hodgman algorithm
  21791.    -- as outlined in Foley and Van Dam except for one addition. Instead
  21792.    -- of joining the intersection points to the interior lines in the
  21793.    -- order that they were generated, keep a separate list of each of
  21794.    -- the interior line segments and the intersection points.
  21795.    LEFT_SUTHERLAND_AND_HODGMAN (INPUT_AREA, LEFT_BORDER,
  21796.       LEFT_EDGE_LIST, INTERIOR_POINT_LISTS);
  21797.      
  21798.    -- Put the list of edges into the order that they are connected to
  21799.    -- each other.
  21800.    SORT_EDGE_LIST_BY_INCREASING_Y_VALUE (LEFT_EDGE_LIST);
  21801.      
  21802.    -- Make lines out of adjacent intersection points. Put the lines onto
  21803.    -- the list of lines formed in the first step.
  21804.    PAIR_UP_EDGE_POINTS_ADD_LINES_TO_LIST_OF_INTERIOR_LINES
  21805.       (LEFT_EDGE_LIST, INTERIOR_POINT_LISTS);
  21806.      
  21807.    -- Find which lines in the list connect with which lines and join
  21808.    -- them together to form areas.
  21809.    JOIN_LINES_TO_FORM_AREAS (INTERIOR_POINT_LISTS, CLIPPED_AREAS);
  21810.      
  21811. end CLIP_ON_LEFT;
  21812. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21813. --:UDD:GKSADACM:CODE:MA:CLIP_ON_RIGHT.ADA
  21814. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21815. ------------------------------------------------------------------
  21816. --
  21817. --  NAME: CLIP_ON_RIGHT
  21818. --  IDENTIFIER: GDMXXX.1(1)
  21819. --  DISCREPANCY REPORTS:
  21820. --
  21821. ------------------------------------------------------------------
  21822. -- FILE : CLIP_ON_RIGHT.ADA
  21823. -- LEVEL : all
  21824.      
  21825. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21826.      
  21827. procedure CLIP_ON_RIGHT
  21828.    (INPUT_AREA    : in DC.POINT_ARRAY;
  21829.     RIGHT_BORDER  : in DC_TYPE;
  21830.     CLIPPED_AREAS : in out LIST_OF_AREAS) is
  21831.      
  21832. -- This procedure clips the points to the right border of the clipping
  21833. -- rectangle. The input list is clipped at the line X = RIGHT_BORDER
  21834. -- and zero or more areas are returned.
  21835. --
  21836. -- INPUT_AREA    - the list of points to be clipped.
  21837. -- RIGHT_BORDER  - the X value of the right edge of the clipping
  21838. --                 rectangle.
  21839. -- CLIPPED_AREAS - the resulting areas.
  21840.      
  21841.    RIGHT_EDGE_LIST : INTERSECTION_LIST;
  21842.    -- This holds a list of all the intersections points with the right
  21843.    -- edge of the clipping rectangle.
  21844.      
  21845.    INTERIOR_POINT_LISTS : LIST_OF_LINES := null;
  21846.    -- This is a list of the line segments which are interior to the
  21847.    -- clipping rectangle.
  21848.      
  21849.    procedure RIGHT_SUTHERLAND_AND_HODGMAN
  21850.       (INPUT_AREA      : in DC.POINT_ARRAY;
  21851.        RIGHT_BORDER    : in DC_TYPE;
  21852.        INTERSECTIONS   : in out INTERSECTION_LIST;
  21853.        INTERIOR_POINTS : in out LIST_OF_LINES) is separate;
  21854.      
  21855. begin
  21856.      
  21857.    -- Perform the first stage of the Sutherland and Hodgman algorithm
  21858.    -- as outlined in Foley and Van Dam except for one addition. Instead
  21859.    -- of joining the intersection points to the interior lines in the
  21860.    -- order that they were generated, keep a separate list of each of
  21861.    -- the interior line segments and the intersection points.
  21862.    RIGHT_SUTHERLAND_AND_HODGMAN (INPUT_AREA, RIGHT_BORDER,
  21863.       RIGHT_EDGE_LIST, INTERIOR_POINT_LISTS);
  21864.      
  21865.    -- Put the list of edges into the order that they are connected to
  21866.    -- each other.
  21867.    SORT_EDGE_LIST_BY_INCREASING_Y_VALUE (RIGHT_EDGE_LIST);
  21868.      
  21869.    -- Make lines out of adjacent intersection points. Put the lines onto
  21870.    -- the list of lines formed in the first step.
  21871.    PAIR_UP_EDGE_POINTS_ADD_LINES_TO_LIST_OF_INTERIOR_LINES
  21872.       (RIGHT_EDGE_LIST, INTERIOR_POINT_LISTS);
  21873.      
  21874.    -- Find which lines in the list connect with which lines and join
  21875.    -- them together to form areas.
  21876.    JOIN_LINES_TO_FORM_AREAS (INTERIOR_POINT_LISTS, CLIPPED_AREAS);
  21877.      
  21878. end CLIP_ON_RIGHT;
  21879. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21880. --:UDD:GKSADACM:CODE:MA:CLIP_ON_TOP.ADA
  21881. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21882. ------------------------------------------------------------------
  21883. --
  21884. --  NAME: CLIP_ON_TOP
  21885. --  IDENTIFIER: GDMXXX.1(1)
  21886. --  DISCREPANCY REPORTS:
  21887. --
  21888. ------------------------------------------------------------------
  21889. -- FILE : CLIP_ON_TOP.ADA
  21890. -- LEVEL : all
  21891.      
  21892. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES)
  21893.      
  21894. procedure CLIP_ON_TOP
  21895.    (INPUT_AREA    : in DC.POINT_ARRAY;
  21896.     TOP_BORDER    : in DC_TYPE;
  21897.     CLIPPED_AREAS : in out LIST_OF_AREAS) is
  21898.      
  21899. -- This procedure clips the points to the top border of the clipping
  21900. -- rectangle. The input list is clipped at the line Y = TOP_BORDER
  21901. -- and zero or more areas are returned.
  21902. --
  21903. -- INPUT_AREA    - the list of points to be clipped.
  21904. -- TOP_BORDER    - the X value of the right edge of the clipping
  21905. --                 rectangle.
  21906. -- CLIPPED_AREAS - the resulting areas.
  21907.      
  21908.    TOP_EDGE_LIST : INTERSECTION_LIST;
  21909.    -- This holds a list of all the intersections points with the top
  21910.    -- edge of the clipping rectangle.
  21911.      
  21912.    INTERIOR_POINT_LISTS : LIST_OF_LINES := null;
  21913.    -- This is a list of the line segments which are interior to the
  21914.    -- clipping rectangle.
  21915.      
  21916.    procedure TOP_SUTHERLAND_AND_HODGMAN
  21917.       (INPUT_AREA      : in DC.POINT_ARRAY;
  21918.        TOP_BORDER      : in DC_TYPE;
  21919.        INTERSECTIONS   : in out INTERSECTION_LIST;
  21920.        INTERIOR_POINTS : in out LIST_OF_LINES) is separate;
  21921.      
  21922. begin
  21923.      
  21924.    -- Perform the first stage of the Sutherland and Hodgman algorithm
  21925.    -- as outlined in Foley and Van Dam except for one addition. Instead
  21926.    -- of joining the intersection points to the interior lines in the
  21927.    -- order that they were generated, keep a separate list of each of
  21928.    -- the interior line segments and the intersection points.
  21929.    TOP_SUTHERLAND_AND_HODGMAN (INPUT_AREA, TOP_BORDER,
  21930.       TOP_EDGE_LIST, INTERIOR_POINT_LISTS);
  21931.      
  21932.    -- Put the list of edges into the order that they are connected to
  21933.    -- each other.
  21934.    SORT_EDGE_LIST_BY_INCREASING_X_VALUE (TOP_EDGE_LIST);
  21935.      
  21936.    -- Make lines out of adjacent intersection points. Put the lines onto
  21937.    -- the list of lines formed in the first step.
  21938.    PAIR_UP_EDGE_POINTS_ADD_LINES_TO_LIST_OF_INTERIOR_LINES
  21939.       (TOP_EDGE_LIST, INTERIOR_POINT_LISTS);
  21940.      
  21941.    -- Find which lines in the list connect with which lines and join
  21942.    -- them together to form areas.
  21943.    JOIN_LINES_TO_FORM_AREAS (INTERIOR_POINT_LISTS, CLIPPED_AREAS);
  21944.      
  21945. end CLIP_ON_TOP;
  21946. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21947. --:UDD:GKSADACM:CODE:MA:LEFT_S_AND_H.ADA
  21948. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21949. ------------------------------------------------------------------
  21950. --
  21951. --  NAME: LEFT_SUTHERLAND_AND_HODGMAN
  21952. --  IDENTIFIER: GDMXXX.1(1)
  21953. --  DISCREPANCY REPORTS:
  21954. --
  21955. ------------------------------------------------------------------
  21956. -- FILE : LEFT_S_AND_H.ADA
  21957. -- LEVEL : all
  21958.      
  21959. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES.CLIP_ON_LEFT)
  21960.      
  21961. procedure LEFT_SUTHERLAND_AND_HODGMAN
  21962.    (INPUT_AREA      : in DC.POINT_ARRAY;
  21963.     LEFT_BORDER     : in DC_TYPE;
  21964.     INTERSECTIONS   : in out INTERSECTION_LIST;
  21965.     INTERIOR_POINTS : in out LIST_OF_LINES) is
  21966.      
  21967. -- This procedure performs the Sutherland and Hodgman algorithm on one
  21968. -- side of the clipping rectangle. It is different from the standard
  21969. -- algorithm in that it does not return a single list of points. A
  21970. -- single list of points is not adaquate because multiple areas cannot
  21971. -- be represented as a single list of points. This procedure gets
  21972. -- around this flaw by returning a list of those line segments which
  21973. -- are interior to the clipping rectangle and a list of the intersection
  21974. -- points.
  21975. --
  21976. -- INPUT_AREA      - the list of points to be clipped.
  21977. -- LEFT_BORDER     - the Y value of the left edge of the clipping
  21978. --                   rectangle.
  21979. -- INTERSECTIONS   - a list of the points where the input line crosses
  21980. --                   the left edge of the clipping rectangle.
  21981. -- INTERIOR_POINTS - a linked list of lines interior to the clipping
  21982. --                   rectangle. It is made up of points from the
  21983. --                   original INPUT_AREA plus the intersection points.
  21984.      
  21985.    FIRST_POINT : POSITIVE := 1;
  21986.    -- This variable is an index into the INPUT_AREA. Processing begins
  21987.    -- with the line segment connecting the first point of INPUT_AREA
  21988.    -- with the last point.
  21989.      
  21990.    INTERSECTION_POINT : DC.POINT;
  21991.    -- A point where the INPUT_AREA crosses over the border of the
  21992.    -- clipping rectangle.
  21993.      
  21994.    function FIND_INTERSECTION
  21995.       (FIRST_POINT  : DC.POINT;
  21996.        SECOND_POINT : DC.POINT;
  21997.        X_VALUE      : DC_TYPE) return DC_TYPE is
  21998.      
  21999.    -- This function returns the Y value of the point where the line
  22000.    -- segment connecting the FIRST_POINT with the SECOND_POINT crosses
  22001.    -- the line defined by X = X_VALUE.
  22002.    --
  22003.    -- FIRST_POINT  - the first point of the line being clipped.
  22004.    -- SECOND_POINT - the last point of the line being clipped.
  22005.    -- X_VALUE      - the X coordinate of the intersection point.
  22006.      
  22007.    begin
  22008.      
  22009.       return FIRST_POINT.Y - ((FIRST_POINT.X - X_VALUE) *
  22010.          (FIRST_POINT.Y - SECOND_POINT.Y)) /
  22011.          (FIRST_POINT.X - SECOND_POINT.X);
  22012.      
  22013.    end FIND_INTERSECTION;
  22014.      
  22015. begin
  22016.      
  22017.    -- If the point is inside of the clipping area, put it on the list
  22018.    -- of interior points.
  22019.    if INPUT_AREA (FIRST_POINT).X >= LEFT_BORDER then
  22020.       BEGIN_NEW_INTERIOR_LINE (INPUT_AREA (FIRST_POINT),
  22021.          INTERIOR_POINTS);
  22022.    end if;
  22023.      
  22024.    -- Repeat with each of the line segments in the list beginning with
  22025.    -- the line segment joining the first point to the second point and
  22026.    -- continuing with each line segment.
  22027.    for SECOND_POINT in 2 .. INPUT_AREA'LAST loop
  22028.      
  22029.       -- If the second point is inside.
  22030.       if INPUT_AREA (SECOND_POINT).X >= LEFT_BORDER then
  22031.      
  22032.          -- If the line segment is inside to inside, put the second
  22033.          -- point on the list of interior points.
  22034.          if INPUT_AREA (FIRST_POINT).X >= LEFT_BORDER then
  22035.      
  22036.             ADD_TO_INTERIOR_LINE (INPUT_AREA (SECOND_POINT),
  22037.                INTERIOR_POINTS);
  22038.      
  22039.          -- If the line segment is outside to inside, put the point
  22040.          -- where the line intersects the edge onto the list of
  22041.          -- intersections. Also begin a new interior line with the
  22042.          -- intersection point and the interior point.
  22043.          else
  22044.      
  22045.             INTERSECTION_POINT := (X => LEFT_BORDER,
  22046.                Y => FIND_INTERSECTION (INPUT_AREA (FIRST_POINT),
  22047.                   INPUT_AREA (SECOND_POINT), LEFT_BORDER));
  22048.      
  22049.             ADD_TO_EDGE_LIST (INTERSECTION_POINT, INTERSECTIONS);
  22050.      
  22051.             BEGIN_NEW_INTERIOR_LINE (INTERSECTION_POINT,
  22052.                INTERIOR_POINTS);
  22053.      
  22054.             ADD_TO_INTERIOR_LINE (INPUT_AREA (SECOND_POINT),
  22055.                INTERIOR_POINTS);
  22056.      
  22057.          end if;
  22058.      
  22059.       -- If the line segment is inside to outside, put the point of
  22060.       -- intersection onto the list of intersections. Also put the
  22061.       -- intersection point onto the list of interior points. (It will
  22062.       -- be the last point put on to the current interior line segment.)
  22063.       elsif INPUT_AREA (FIRST_POINT).X >= LEFT_BORDER then
  22064.      
  22065.          INTERSECTION_POINT := (X => LEFT_BORDER,
  22066.             Y => FIND_INTERSECTION (INPUT_AREA (FIRST_POINT),
  22067.                INPUT_AREA (SECOND_POINT), LEFT_BORDER));
  22068.      
  22069.          ADD_TO_EDGE_LIST (INTERSECTION_POINT, INTERSECTIONS);
  22070.      
  22071.          ADD_TO_INTERIOR_LINE (INTERSECTION_POINT, INTERIOR_POINTS);
  22072.      
  22073.       -- If the line segment is outside to outside, do nothing.
  22074.       -- else
  22075.       --    null;
  22076.       end if;
  22077.      
  22078.       FIRST_POINT := SECOND_POINT;
  22079.      
  22080.    end loop;
  22081.      
  22082. end LEFT_SUTHERLAND_AND_HODGMAN;
  22083. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22084. --:UDD:GKSADACM:CODE:MA:RIGHT_S_AND_H.ADA
  22085. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22086. ------------------------------------------------------------------
  22087. --
  22088. --  NAME: RIGHT_SUTHERLAND_AND_HODGMAN
  22089. --  IDENTIFIER: GDMXXX.1(1)
  22090. --  DISCREPANCY REPORTS:
  22091. --
  22092. ------------------------------------------------------------------
  22093. -- FILE : RIGHT_S_AND_H.ADA
  22094. -- LEVEL : all
  22095.      
  22096. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES.CLIP_ON_RIGHT)
  22097.      
  22098. procedure RIGHT_SUTHERLAND_AND_HODGMAN
  22099.    (INPUT_AREA      : in DC.POINT_ARRAY;
  22100.     RIGHT_BORDER    : in DC_TYPE;
  22101.     INTERSECTIONS   : in out INTERSECTION_LIST;
  22102.     INTERIOR_POINTS : in out LIST_OF_LINES) is
  22103.      
  22104. -- This procedure performs the Sutherland and Hodgman algorithm on one
  22105. -- side of the clipping rectangle. It is different from the standard
  22106. -- algorithm in that it does not return a single list of points. A
  22107. -- single list of points is not adaquate because multiple areas cannot
  22108. -- be represented as a single list of points. This procedure gets
  22109. -- around this flaw by returning a list of those line segments which
  22110. -- are interior to the clipping rectangle and a list of the intersection
  22111. -- points.
  22112. --
  22113. -- INPUT_AREA      - the list of points to be clipped.
  22114. -- RIGHT_BORDER    - the X value of the right edge of the clipping
  22115. --                   rectangle.
  22116. -- INTERSECTIONS   - a list of the points where the input line crosses
  22117. --                   the right edge of the clipping rectangle.
  22118. -- INTERIOR_POINTS - a linked list of lines interior to the clipping
  22119. --                   rectangle. It is made up of points from the
  22120. --                   original INPUT_AREA plus the intersection points.
  22121.      
  22122.    FIRST_POINT : POSITIVE := 1;
  22123.    -- This variable is an index into the INPUT_AREA. Processing begins
  22124.    -- with the line segment connecting the first point of INPUT_AREA
  22125.    -- with the second point.
  22126.      
  22127.    INTERSECTION_POINT : DC.POINT;
  22128.    -- A point where the INPUT_AREA crosses over the border of the
  22129.    -- clipping rectangle.
  22130.      
  22131.    function FIND_INTERSECTION
  22132.       (FIRST_POINT  : DC.POINT;
  22133.        SECOND_POINT : DC.POINT;
  22134.        X_VALUE      : DC_TYPE) return DC_TYPE is
  22135.      
  22136.    -- This function returns the Y value of the point where the line
  22137.    -- segment connecting the FIRST_POINT with the SECOND_POINT crosses
  22138.    -- the line defined by X = X_VALUE.
  22139.    --
  22140.    -- FIRST_POINT  - the first endpoint of the line being clipped.
  22141.    -- SECOND_POINT - the last endpoint of the line being clipped.
  22142.    -- X_VALUE      - the value of the X coordinate of the intersection
  22143.    --                point.
  22144.      
  22145.    begin
  22146.      
  22147.       return FIRST_POINT.Y - ((FIRST_POINT.X - X_VALUE) *
  22148.          (FIRST_POINT.Y - SECOND_POINT.Y)) /
  22149.          (FIRST_POINT.X - SECOND_POINT.X);
  22150.      
  22151.    end FIND_INTERSECTION;
  22152.      
  22153. begin
  22154.      
  22155.      
  22156.    -- If the point is inside of the clipping area, put it on the list
  22157.    -- of interior points.
  22158.    if INPUT_AREA (FIRST_POINT).X <= RIGHT_BORDER then
  22159.       BEGIN_NEW_INTERIOR_LINE (INPUT_AREA (FIRST_POINT),
  22160.          INTERIOR_POINTS);
  22161.    end if;
  22162.      
  22163.    -- Repeat with each of the line segments in the list beginning with
  22164.    -- the line segment joining the first point to the second point and
  22165.    -- continuing with each line segment. (Note: The first point in the
  22166.    -- list will always match the last point in the list.)
  22167.    for SECOND_POINT in 2 ..  INPUT_AREA'LAST loop
  22168.      
  22169.       -- If the second point is inside.
  22170.       if INPUT_AREA (SECOND_POINT).X <= RIGHT_BORDER then
  22171.      
  22172.          -- If the line segment is inside to inside, put the second
  22173.          -- point on the list of interior points.
  22174.          if INPUT_AREA (FIRST_POINT).X <= RIGHT_BORDER then
  22175.      
  22176.             ADD_TO_INTERIOR_LINE (INPUT_AREA (SECOND_POINT),
  22177.                INTERIOR_POINTS);
  22178.      
  22179.          -- If the line segment is outside to inside, put the point
  22180.          -- where the line intersects the edge onto the list of
  22181.          -- intersections. Also begin a new interior line with the
  22182.          -- intersection point and the interior point.
  22183.          else
  22184.      
  22185.             INTERSECTION_POINT := (X => RIGHT_BORDER,
  22186.                Y => FIND_INTERSECTION (INPUT_AREA (FIRST_POINT),
  22187.                   INPUT_AREA (SECOND_POINT), RIGHT_BORDER));
  22188.      
  22189.             ADD_TO_EDGE_LIST (INTERSECTION_POINT, INTERSECTIONS);
  22190.      
  22191.             BEGIN_NEW_INTERIOR_LINE (INTERSECTION_POINT,
  22192.                INTERIOR_POINTS);
  22193.      
  22194.             ADD_TO_INTERIOR_LINE (INPUT_AREA (SECOND_POINT),
  22195.                INTERIOR_POINTS);
  22196.      
  22197.          end if;
  22198.      
  22199.       -- If the line segment is inside to outside, put the point of
  22200.       -- intersection onto the list of intersections. Also put the
  22201.       -- intersection point onto the list of interior points. (It will
  22202.       -- be the last point put on to the current interior line segment.)
  22203.       elsif INPUT_AREA (FIRST_POINT).X <= RIGHT_BORDER then
  22204.      
  22205.          INTERSECTION_POINT := (X => RIGHT_BORDER,
  22206.             Y => FIND_INTERSECTION (INPUT_AREA (FIRST_POINT),
  22207.                INPUT_AREA (SECOND_POINT), RIGHT_BORDER));
  22208.      
  22209.          ADD_TO_EDGE_LIST (INTERSECTION_POINT, INTERSECTIONS);
  22210.      
  22211.          ADD_TO_INTERIOR_LINE (INTERSECTION_POINT, INTERIOR_POINTS);
  22212.      
  22213.       -- If the line segment is outside to outside, do nothing.
  22214.       end if;
  22215.      
  22216.       FIRST_POINT := SECOND_POINT;
  22217.      
  22218.    end loop;
  22219.      
  22220. end RIGHT_SUTHERLAND_AND_HODGMAN;
  22221. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22222. --:UDD:GKSADACM:CODE:MA:TOP_S_AND_H.ADA
  22223. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22224. ------------------------------------------------------------------
  22225. --
  22226. --  NAME: TOP_SUTHERLAND_AND_HODGMAN
  22227. --  IDENTIFIER: GDMXXX.1(1)
  22228. --  DISCREPANCY REPORTS:
  22229. --
  22230. ------------------------------------------------------------------
  22231. -- FILE : TOP_S_AND_H.ADA
  22232. -- LEVEL : all
  22233.      
  22234. separate (WSR_UTILITIES.AREA_CLIPPING_UTILITIES.CLIP_ON_TOP)
  22235.      
  22236. procedure TOP_SUTHERLAND_AND_HODGMAN
  22237.    (INPUT_AREA      : in DC.POINT_ARRAY;
  22238.     TOP_BORDER      : in DC_TYPE;
  22239.     INTERSECTIONS   : in out INTERSECTION_LIST;
  22240.     INTERIOR_POINTS : in out LIST_OF_LINES) is
  22241.      
  22242. -- This procedure performs the Sutherland and Hodgman algorithm on one
  22243. -- side of the clipping rectangle. It is different from the standard
  22244. -- algorithm in that it does not return a single list of points. A
  22245. -- single list of points is not adaquate because multiple areas cannot
  22246. -- be represented as a single list of points. This procedure gets
  22247. -- around this flaw by returning a list of those line segments which
  22248. -- are interior to the clipping rectangle and a list of the intersection
  22249. -- points.
  22250. --
  22251. -- INPUT_AREA      - the list of points to be clipped.
  22252. -- TOP_BORDER      - the Y value of the top edge of the clipping
  22253. --                   rectangle.
  22254. -- INTERSECTIONS   - a list of the points where the input line crosses
  22255. --                   the top edge of the clipping rectangle.
  22256. -- INTERIOR_POINTS - a linked list of lines interior to the clipping
  22257. --                   rectangle. It is made up of points from the
  22258. --                   original INPUT_AREA plus the intersection points.
  22259.      
  22260.    FIRST_POINT : POSITIVE := 1;
  22261.    -- This variable is an index into the INPUT_AREA. Processing begins
  22262.    -- with the line segment connecting the first point of INPUT_AREA
  22263.    -- with the second point.
  22264.      
  22265.    INTERSECTION_POINT : DC.POINT;
  22266.    -- A point where the INPUT_AREA crosses over the border of the
  22267.    -- clipping rectangle.
  22268.      
  22269.    function FIND_INTERSECTION
  22270.       (FIRST_POINT  : DC.POINT;
  22271.        SECOND_POINT : DC.POINT;
  22272.        Y_VALUE      : DC_TYPE) return DC_TYPE is
  22273.      
  22274.    -- This function returns the Y value of the point where the line
  22275.    -- segment connecting the FIRST_POINT with the SECOND_POINT crosses
  22276.    -- the line defined by X = X_VALUE.
  22277.      
  22278.    begin
  22279.      
  22280.       return FIRST_POINT.X - ((FIRST_POINT.Y - Y_VALUE) *
  22281.          (FIRST_POINT.X - SECOND_POINT.X)) /
  22282.          (FIRST_POINT.Y - SECOND_POINT.Y);
  22283.      
  22284.    end FIND_INTERSECTION;
  22285.      
  22286. begin
  22287.      
  22288.    -- If the point is inside of the clipping area, put it on the list
  22289.    -- of interior points.
  22290.    if INPUT_AREA (FIRST_POINT).Y <= TOP_BORDER then
  22291.       BEGIN_NEW_INTERIOR_LINE (INPUT_AREA (FIRST_POINT),
  22292.          INTERIOR_POINTS);
  22293.    end if;
  22294.      
  22295.    -- Repeat with each of the line segments in the list beginning with
  22296.    -- the line segment joining the first point to the second point and
  22297.    -- continuing with each line segment. (Note: The first point in the
  22298.    -- list will always match the last point in the list.)
  22299.    for SECOND_POINT in 2 ..  INPUT_AREA'LAST loop
  22300.      
  22301.       -- If the second point is inside.
  22302.       if INPUT_AREA (SECOND_POINT).Y <= TOP_BORDER then
  22303.      
  22304.          -- If the line segment is inside to inside, put the second
  22305.          -- point on the list of interior points.
  22306.          if INPUT_AREA (FIRST_POINT).Y <= TOP_BORDER then
  22307.      
  22308.             ADD_TO_INTERIOR_LINE (INPUT_AREA (SECOND_POINT),
  22309.                INTERIOR_POINTS);
  22310.      
  22311.          -- If the line segment is outside to inside, put the point
  22312.          -- where the line intersects the edge onto the list of
  22313.          -- intersections. Also begin a new interior line with the
  22314.          -- intersection point and the interior point.
  22315.          else
  22316.      
  22317.             INTERSECTION_POINT := (X => FIND_INTERSECTION
  22318.                (INPUT_AREA (FIRST_POINT), INPUT_AREA (SECOND_POINT),
  22319.                 TOP_BORDER), Y => TOP_BORDER);
  22320.      
  22321.             ADD_TO_EDGE_LIST (INTERSECTION_POINT, INTERSECTIONS);
  22322.      
  22323.             BEGIN_NEW_INTERIOR_LINE (INTERSECTION_POINT,
  22324.                INTERIOR_POINTS);
  22325.      
  22326.             ADD_TO_INTERIOR_LINE (INPUT_AREA (SECOND_POINT),
  22327.                INTERIOR_POINTS);
  22328.      
  22329.          end if;
  22330.      
  22331.       -- If the line segment is inside to outside, put the point of
  22332.       -- intersection onto the list of intersections. Also put the
  22333.       -- intersection point onto the list of interior points. (It will
  22334.       -- be the last point put on to the current interior line segment.)
  22335.       elsif INPUT_AREA (FIRST_POINT).Y <= TOP_BORDER then
  22336.      
  22337.          INTERSECTION_POINT := (X => FIND_INTERSECTION
  22338.             (INPUT_AREA (FIRST_POINT), INPUT_AREA (SECOND_POINT),
  22339.              TOP_BORDER), Y => TOP_BORDER);
  22340.      
  22341.          ADD_TO_EDGE_LIST (INTERSECTION_POINT, INTERSECTIONS);
  22342.      
  22343.          ADD_TO_INTERIOR_LINE (INTERSECTION_POINT, INTERIOR_POINTS);
  22344.      
  22345.       -- If the line segment is outside to outside, do nothing.
  22346.       -- else
  22347.         -- null;
  22348.       end if;
  22349.      
  22350.       FIRST_POINT := SECOND_POINT;
  22351.      
  22352.    end loop;
  22353.      
  22354. end TOP_SUTHERLAND_AND_HODGMAN;
  22355. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22356. --:UDD:GKSADACM:CODE:MA:WSD_FA_MA.ADA
  22357. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22358. ------------------------------------------------------------------
  22359. --
  22360. --  NAME: FILL_AREA
  22361. --  IDENTIFIER: GDMXXX.1(2)
  22362. --  DISCREPANCY REPORTS:
  22363. --  DR009  Fill area debug statements.
  22364. ------------------------------------------------------------------
  22365. -- FILE: WSD_FA_MA.ADA
  22366. -- LEVEL : MA - 0A
  22367.      
  22368. with UNCHECKED_DEALLOCATION;
  22369.      
  22370. separate (LEXI3700_OUTPUT_PRIMITIVES)
  22371.      
  22372. procedure FILL_AREA
  22373.    (WS_SL            : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22374.     FILL_AREA_POINTS : ACCESS_POINT_ARRAY_TYPE) is
  22375.      
  22376. -- This procedure gathers the appropriate attributes from the Work-
  22377. -- station state list and then calls the device driver procedures which
  22378. -- fill in the area defined by the input points.
  22379. --
  22380. -- If the Effective Interior Style is HOLLOW the attributes of polyline
  22381. -- are used to draw the border points. If the Effective Interior Style
  22382. -- is SOLID the border points are drawn by the device driver with a
  22383. -- special flag so that the area can then be filled in. Interior styles
  22384. -- of PATTERN or HATCH are not supported; they will default to HOLLOW.
  22385. --
  22386. -- The FILL_AREA_POINTS will be clipped and transformed from NDC into
  22387. -- IDC coordinate space.
  22388. --
  22389. -- WS_SL             - the pointer to the Workstation State List.
  22390. -- FILL_AREA_POINTS  - a pointer to an array of points in NDC.
  22391.      
  22392.    EFFECTIVE_LINETYPE : LEXI_LINE_TYPE := LEXI_LINE_TYPE'FIRST;
  22393.    -- The value used for drawing the border lines is always solid.
  22394.      
  22395.    EFFECTIVE_LINE_WIDTH : LEXI_LINE_WIDTH_TYPE :=
  22396.       LEXI_LINE_WIDTH_TYPE'FIRST;
  22397.    -- The value used for drawing the border lines is always one.
  22398.      
  22399.    EFFECTIVE_AREA_COLOUR_INDEX : LEXI_COLOUR_INDEX;
  22400.    -- The value derived from the state list fill area colour and used
  22401.    -- for drawing the border lines and the area itself if solid.
  22402.      
  22403.    EFFECTIVE_INTERIOR_STYLE : LEXI_INTERIOR_STYLE;
  22404.    -- The value derived from the state list fill area interior style and
  22405.    -- used to determine if the interior area is solid.
  22406.      
  22407.    DC_AREA : DC.POINT_ARRAY (FILL_AREA_POINTS'RANGE);
  22408.    -- Contains the points in FILL_AREA_POINTS after they have been
  22409.    -- transformed into DC.
  22410.      
  22411.    CLIPPED_DC_AREAS : WSR_UTILITIES.LIST_OF_AREAS;
  22412.    -- Contains the border points of any area(s) which are obtained by
  22413.    -- clipping the DC_POINTS to the area of the Effective Clipping
  22414.    -- Rectangle.
  22415.      
  22416.    function "=" (LEFT, RIGHT : WSR_UTILITIES.LIST_OF_AREAS)
  22417.       return BOOLEAN renames WSR_UTILITIES."=";
  22418.    -- The equals function is made locally visible for use in infix
  22419.    -- notation.
  22420.      
  22421.    TEMP_CLIPPED_DC_AREAS : WSR_UTILITIES.LIST_OF_AREAS;
  22422.    -- A temporary holding place for CLIPPED_DC_AREAS;
  22423.      
  22424.    procedure DISPOSE_AREA is new UNCHECKED_DEALLOCATION
  22425.       (OBJECT => WSR_UTILITIES.AREA,
  22426.        NAME   => WSR_UTILITIES.LIST_OF_AREAS);
  22427.    -- This procedure is used to dispose of CLIPPED_DC_AREAS after they
  22428.    -- have been drawn.
  22429.      
  22430.    type RECTANGLE is
  22431.       record
  22432.          UPPER_LEFT  : DC.POINT;
  22433.          LOWER_RIGHT : DC.POINT;
  22434.       end record;
  22435.    -- This type defines the corner points of a rectangle which is
  22436.    -- parallel to the X and Y axes.
  22437.      
  22438.    SMALLEST_SURROUNDING_RECTANGLE : RECTANGLE;
  22439.    -- This contains two opposite corners of the smallest rectangle which
  22440.    -- is square with the axes and contains all of points in an area.
  22441.      
  22442.    IDC_LOWER_RIGHT_CORNER, IDC_UPPER_LEFT_CORNER : LEXI_POINT;
  22443.    -- Contains the two corner points from the SMALLEST_SURROUNDING_
  22444.    -- RECTANGLE translated into IDC coordinates.
  22445.      
  22446.    SOMETHING_VISIBLE_IN_VIEWPORT : BOOLEAN := FALSE;
  22447.    -- Set to FALSE when all of the FILL_AREA_POINTS are clipped. Set to
  22448.    -- TRUE when some part of the Fill Area is visible.
  22449.      
  22450.    procedure FIND_EXTENTS
  22451.       (INPUT_POINTS                   : in WSR_UTILITIES.LIST_OF_AREAS;
  22452.        SMALLEST_SURROUNDING_RECTANGLE : out RECTANGLE)
  22453.       is separate;
  22454.      
  22455. begin
  22456.      
  22457.    -- Translate the input points from NDC to DC.
  22458.    DC_AREA := CONVERT_NDC_DC.DC_POINT_ARRAY
  22459.       (FILL_AREA_POINTS.all, WS_SL.WS_TRANSFORM);
  22460.      
  22461.    -- Use the EFFECTIVE_CLIPPING_RECTANGLE to clip the input region into
  22462.    -- an arbitrary number of areas interior to the clipping rectangle.
  22463.    -- Obtain the enclosing rectangle's corners from the Workstation
  22464.    -- Resource.
  22465.    WSR_UTILITIES.AREA_CLIP (DC_AREA,
  22466.       WS_SL.EFFECTIVE_CLIPPING_RECTANGLE, CLIPPED_DC_AREAS);
  22467.      
  22468.    -- Determine if anything will be drawn and set the display attributes
  22469.    -- before drawing the areas' borders.
  22470.    if not (CLIPPED_DC_AREAS = null) then
  22471.      
  22472.       -- Assign the current fill area colour index to EFFECTIVE_AREA_
  22473.       -- COLOUR_INDEX. If the colour index is not in the list of indices
  22474.       -- which have been associated with a set of intensity values, the
  22475.       -- value 1 is assigned.
  22476.       if not COLOUR_INDICES.IS_IN_LIST
  22477.          (WS_SL.EFFECTIVE_FILL_AREA_ATTR.COLOUR,
  22478.           WS_SL.SET_OF_COLOUR_IDC) then
  22479.          EFFECTIVE_AREA_COLOUR_INDEX := 1;
  22480.       else EFFECTIVE_AREA_COLOUR_INDEX := LEXI_COLOUR_INDEX
  22481.          (WS_SL.EFFECTIVE_FILL_AREA_ATTR.COLOUR);
  22482.       end if;
  22483.      
  22484.       -- Assign the current fill area interior style to the EFFECTIVE_
  22485.       -- INTERIOR_STYLE. If the current fill area interior style is not
  22486.       -- supported on the Lexidata, the value HOLLOW is assigned.
  22487.       if WS_SL.EFFECTIVE_FILL_AREA_ATTR.INT_STYLE = SOLID then
  22488.          EFFECTIVE_INTERIOR_STYLE := LEXI3700_TYPES.SOLID;
  22489.       else
  22490.          EFFECTIVE_INTERIOR_STYLE := LEXI3700_TYPES.HOLLOW;
  22491.       end if;
  22492.      
  22493.       -- Set the flags which indicate that something is being drawn.
  22494.       SOMETHING_VISIBLE_IN_VIEWPORT := TRUE;
  22495.       WS_SL.WS_DISPLAY_SURFACE := NOTEMPTY;
  22496.      
  22497.    -- Repeat until all of the boundry points are drawn.
  22498.    while not (CLIPPED_DC_AREAS = null) loop
  22499.      
  22500.       declare
  22501.      
  22502.          IDC_AREA : LEXI_POINTS (CLIPPED_DC_AREAS.BORDER.POINTS'RANGE);
  22503.          -- Contains the border points of the next fill area after they
  22504.          -- have been translated into IDC coordinates.
  22505.      
  22506.       begin
  22507.      
  22508.          -- Translate the boundary points of an area into IDC.
  22509.          IDC_AREA := LEXI_UTILITIES.IDC
  22510.             (CLIPPED_DC_AREAS.BORDER.POINTS);
  22511.      
  22512.          -- If the interior style is SOLID, fill in the area.
  22513.          if EFFECTIVE_INTERIOR_STYLE = SOLID then
  22514.      
  22515.             -- Clear the edge flags in the last bit plane that had been
  22516.             -- set during the previous FILL_AREA.
  22517.             LEXI3700_OUTPUT_DRIVER.CLEAR_DISPLAY
  22518.                (LEXI_PLANE_VALUE'(128));
  22519.      
  22520.             -- Set the display parameters for setting the flags.
  22521.             LEXI3700_OUTPUT_DRIVER.SET_DISPLAY_PARAMETERS
  22522.                (EFFECTIVE_LINE_WIDTH, EFFECTIVE_LINETYPE,
  22523.                 LEXI_INTERIOR_STYLE'(SOLID));
  22524.      
  22525.             -- Set the fill flags around the border of the area.
  22526.             LEXI3700_OUTPUT_DRIVER.DISPLAY_CHAINED_VECTORS
  22527.                   (LEXI_COLOUR_INDEX(128), IDC_AREA);
  22528.      
  22529.             -- Determine the smallest area that must be analysed by the
  22530.             -- Device Driver's Fill Area.
  22531.             FIND_EXTENTS
  22532.                (CLIPPED_DC_AREAS, SMALLEST_SURROUNDING_RECTANGLE);
  22533.      
  22534.             -- Translate the smallest enclosing rectangle into IDC.
  22535.             IDC_UPPER_LEFT_CORNER  := LEXI_UTILITIES.IDC
  22536.                (SMALLEST_SURROUNDING_RECTANGLE.UPPER_LEFT);
  22537.      
  22538.             IDC_LOWER_RIGHT_CORNER := LEXI_UTILITIES.IDC
  22539.                (SMALLEST_SURROUNDING_RECTANGLE.LOWER_RIGHT);
  22540.      
  22541.             -- Call the Device Driver to set the scan area for the fill.
  22542.             LEXI3700_OUTPUT_DRIVER.SET_RECTANGULAR_LIMIT
  22543.                (IDC_UPPER_LEFT_CORNER, IDC_LOWER_RIGHT_CORNER);
  22544.      
  22545.             -- Reset the display parameters so that the solid colours
  22546.             -- don't bleed.
  22547.             LEXI3700_OUTPUT_DRIVER.SET_DISPLAY_PARAMETERS
  22548.                (EFFECTIVE_LINE_WIDTH, EFFECTIVE_LINETYPE,
  22549.                 LEXI_INTERIOR_STYLE'(HOLLOW));
  22550.      
  22551.             -- Fill with the proper colour.
  22552.             LEXI3700_OUTPUT_DRIVER.POLYGON_EDGE_FLAG_FILL
  22553.                (EFFECTIVE_AREA_COLOUR_INDEX);
  22554.      
  22555.          -- If the area is hollow, set the proper attributes for the
  22556.          -- border.
  22557.          else
  22558.      
  22559.             -- Set the attributes for drawing the border points. Send
  22560.             -- the Device Driver the linetype and line width as well as
  22561.             -- a flag indicating that the points will not be used later
  22562.             -- on for a polygon fill.
  22563.             LEXI3700_OUTPUT_DRIVER.SET_DISPLAY_PARAMETERS
  22564.                (EFFECTIVE_LINE_WIDTH, EFFECTIVE_LINETYPE,
  22565.                 LEXI_INTERIOR_STYLE'(HOLLOW));
  22566.      
  22567.          end if;
  22568.      
  22569.          -- Draw the border points both for HOLLOW and SOLID.
  22570.          LEXI3700_OUTPUT_DRIVER.DISPLAY_CHAINED_VECTORS
  22571.                (EFFECTIVE_AREA_COLOUR_INDEX, IDC_AREA);
  22572.      
  22573.       -- declare block.
  22574.       end;
  22575.      
  22576.       -- Continue with the next region and destroy the space occupied by
  22577.       -- the current region.
  22578.       TEMP_CLIPPED_DC_AREAS := CLIPPED_DC_AREAS;
  22579.       CLIPPED_DC_AREAS := CLIPPED_DC_AREAS.NEXT_AREA;
  22580.       DISPOSE_AREA (TEMP_CLIPPED_DC_AREAS);
  22581.      
  22582.    end loop;
  22583.      
  22584.    end if;
  22585.      
  22586.    -- Flush the output buffer on the device if the deferral mode is ASAP
  22587.    if WS_SL.WS_DEFERRAL_MODE = ASAP then
  22588.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  22589.    end if;
  22590.      
  22591. end FILL_AREA;
  22592. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22593. --:UDD:GKSADACM:CODE:MA:WSD_FIND_EXTENTS.ADA
  22594. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22595. ------------------------------------------------------------------
  22596. --
  22597. --  NAME: FIND_EXTENTS
  22598. --  IDENTIFIER: GDMXXX.1(2)
  22599. --  DISCREPANCY REPORTS:
  22600. --  DR039  New WSD_FIND_EXTENTS replaces ma & 0a version.
  22601. ------------------------------------------------------------------
  22602. -- FILE : WSD_FIND_EXTENTS.ADA
  22603. -- LEVEL : All levels
  22604.      
  22605. separate (LEXI3700_OUTPUT_PRIMITIVES.FILL_AREA)
  22606.      
  22607. procedure FIND_EXTENTS
  22608.    (INPUT_POINTS                   : in WSR_UTILITIES.LIST_OF_AREAS;
  22609.     SMALLEST_SURROUNDING_RECTANGLE : out RECTANGLE) is
  22610.      
  22611. -- This procedure is used to find the extent or bounding box of the
  22612. -- figure being output. All of the X and Y coordinates are compared
  22613. -- and the largest and smallest are returned as the opposite corners
  22614. -- of the bounding box.
  22615. --
  22616. -- INPUT_POINTS                   - the figure being boxed in.
  22617. -- SMALLEST_SURROUNDING_RECTANGLE - the box which surrounds it.
  22618.      
  22619.    X_MIN : DC_TYPE := INPUT_POINTS.BORDER.POINTS(1).X;
  22620.    X_MAX : DC_TYPE := INPUT_POINTS.BORDER.POINTS(1).X;
  22621.    Y_MIN : DC_TYPE := INPUT_POINTS.BORDER.POINTS(1).Y;
  22622.    Y_MAX : DC_TYPE := INPUT_POINTS.BORDER.POINTS(1).Y;
  22623.    -- The extrema are initialized to the value of the first point in the
  22624.    -- first area.
  22625.      
  22626. begin
  22627.      
  22628.    -- Repeat for each point in the area.
  22629.    for I in 2 .. INPUT_POINTS.BORDER.LENGTH loop
  22630.      
  22631.       -- If the X value of the current point is larger or smaller
  22632.       -- than all previous points, alter the proper extrema.
  22633.       if INPUT_POINTS.BORDER.POINTS (I).X < X_MIN then
  22634.          X_MIN := INPUT_POINTS.BORDER.POINTS (I).X;
  22635.       elsif INPUT_POINTS.BORDER.POINTS (I).X > X_MAX then
  22636.          X_MAX := INPUT_POINTS.BORDER.POINTS (I).X;
  22637.       end if;
  22638.      
  22639.       -- If the Y value of the current point is larger or smaller
  22640.       -- than all previous points, alter the proper extrema.
  22641.       if INPUT_POINTS.BORDER.POINTS (I).Y < Y_MIN then
  22642.          Y_MIN := INPUT_POINTS.BORDER.POINTS (I).Y;
  22643.       elsif INPUT_POINTS.BORDER.POINTS (I).Y > Y_MAX then
  22644.          Y_MAX := INPUT_POINTS.BORDER.POINTS (I).Y;
  22645.       end if;
  22646.      
  22647.     -- Go on to the next point.
  22648.    end loop;
  22649.      
  22650.    -- Return to the calling program with the proper values.
  22651.    SMALLEST_SURROUNDING_RECTANGLE.UPPER_LEFT := (X_MIN, Y_MAX);
  22652.    SMALLEST_SURROUNDING_RECTANGLE.LOWER_RIGHT := (X_MAX, Y_MIN);
  22653.      
  22654. end FIND_EXTENTS;
  22655. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22656. --:UDD:GKSADACM:CODE:MA:WSD_PLINE_MA.ADA
  22657. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22658. ------------------------------------------------------------------
  22659. --
  22660. --  NAME: POLYLINE
  22661. --  IDENTIFIER: GDMXXX.1(2)
  22662. --  DISCREPANCY REPORTS:
  22663. --  DR034  Fix pline clip.
  22664. --
  22665. ------------------------------------------------------------------
  22666. -- FILE: WSD_PLINE_MA.ADA
  22667. -- LEVEL : MA - 0A
  22668.      
  22669. separate (LEXI3700_OUTPUT_PRIMITIVES)
  22670.      
  22671. procedure POLYLINE
  22672.    (WS_SL        : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22673.     LINE_POINTS  : ACCESS_POINT_ARRAY_TYPE) is
  22674.      
  22675. -- This procedure uses the Workstation State List to find the
  22676. -- effective clipping matrix and the attributes used to control
  22677. -- the appearance of the polyline.
  22678. --
  22679. -- WS_SL - is a pointer to the Workstation State List.
  22680. --
  22681. -- LINE_POINTS  - is a pointer to an array containing points to generate
  22682. --                a set of connected lines.
  22683.      
  22684. DEVICE_UNIT_POINTS : DC.POINT_ARRAY(LINE_POINTS'range);
  22685. -- Contain points of type dc.
  22686.      
  22687. FIRST_VALUE : DC.POINT;
  22688. LAST_VALUE  : DC.POINT;
  22689. -- FIRST_VALUE and LAST_VALUE contain the first and last points of the
  22690. -- array.
  22691.      
  22692. FIRST_INDEX : POSITIVE := DEVICE_UNIT_POINTS'FIRST;
  22693. LAST_INDEX  : POSITIVE := DEVICE_UNIT_POINTS'FIRST;
  22694. -- FIRST_INDEX and LAST_INDEX are pointers into the array being clipped.
  22695. -- These pointers point to the first and last index of the array that
  22696. -- are in the effective clipping rectangle.
  22697.      
  22698. LINE_WIDTH : INTEGER;
  22699. -- Contains the line width.
  22700.      
  22701. LEXI_LINE_WIDTH : LEXI_LINE_WIDTH_TYPE;
  22702. -- Contains the line width for the device.
  22703.      
  22704. LINE_COLOUR : LEXI_COLOUR_INDEX;
  22705. -- Contains the Colour index .
  22706.      
  22707. IS_VALID : BOOLEAN;
  22708. -- Contains a flag indicating if the colour index is valid.
  22709.      
  22710. function "&"(A : DC.POINT; B : DC.POINT_ARRAY) return DC.POINT_ARRAY
  22711.             renames DC."&";
  22712. function "&"(A : DC.POINT_ARRAY; B : DC.POINT) return DC.POINT_ARRAY
  22713.             renames DC."&";
  22714.      
  22715. begin
  22716.      
  22717.    IS_VALID := COLOUR_INDICES.IS_IN_LIST
  22718.                  (WS_SL.EFFECTIVE_POLYLINE_ATTR.COLOUR,
  22719.                   WS_SL.SET_OF_COLOUR_IDC);
  22720.    if IS_VALID then
  22721.       LINE_COLOUR := LEXI_COLOUR_INDEX(WS_SL.EFFECTIVE_POLYLINE_ATTR.COLOUR);
  22722.    else
  22723.       LINE_COLOUR := LEXI_COLOUR_INDEX(1);
  22724.    end if;
  22725.    -- Finds colour for polyline.
  22726.      
  22727.    LINE_WIDTH  := INTEGER(WS_SL.EFFECTIVE_POLYLINE_ATTR.L_WIDTH);
  22728.    if LINE_WIDTH <  INTEGER(LEXI_LINE_WIDTH_TYPE'FIRST) then
  22729.       LEXI_LINE_WIDTH := LEXI_LINE_WIDTH_TYPE'FIRST;
  22730.    elsif LINE_WIDTH >  INTEGER(LEXI_LINE_WIDTH_TYPE'LAST) then
  22731.       LEXI_LINE_WIDTH := LEXI_LINE_WIDTH_TYPE'LAST;
  22732.    else
  22733.       LEXI_LINE_WIDTH := LEXI_LINE_WIDTH_TYPE(LINE_WIDTH);
  22734.    end if;
  22735.    -- Finds line width for polyline.
  22736.      
  22737.    DEVICE_UNIT_POINTS := CONVERT_NDC_DC.DC_POINT_ARRAY
  22738.          (LINE_POINTS.all,WS_SL.WS_TRANSFORM);
  22739.    -- Converts points to DC
  22740.      
  22741.    LEXI3700_OUTPUT_DRIVER.SET_DISPLAY_PARAMETERS
  22742.          (LEXI_LINE_WIDTH,
  22743.           LEXI_LINE_TYPE'VAL(WS_SL.EFFECTIVE_POLYLINE_ATTR.L_TYPE - 1),
  22744.           LEXI_INTERIOR_STYLE'(HOLLOW));
  22745.      
  22746.    while FIRST_INDEX /= DEVICE_UNIT_POINTS'LAST loop
  22747.      
  22748.       WSR_UTILITIES.PLINE_CLIP
  22749.          (DEVICE_UNIT_POINTS, FIRST_VALUE, FIRST_INDEX, LAST_INDEX,
  22750.           LAST_VALUE, WS_SL.EFFECTIVE_CLIPPING_RECTANGLE);
  22751.      
  22752.       if FIRST_INDEX > DEVICE_UNIT_POINTS'LAST then
  22753.          exit;
  22754.          -- The points were outside the clipping rectangle.
  22755.       else
  22756.           declare
  22757.             DEVICE_POINTS : LEXI_POINTS(1 .. LAST_INDEX - FIRST_INDEX + 3);
  22758.           begin
  22759.      
  22760.              DEVICE_POINTS := LEXI_UTILITIES.IDC
  22761.                    (FIRST_VALUE &
  22762.                     DEVICE_UNIT_POINTS(FIRST_INDEX .. LAST_INDEX) &
  22763.                     LAST_VALUE);
  22764.      
  22765.              LEXI3700_OUTPUT_DRIVER.DISPLAY_CHAINED_VECTORS
  22766.                    (LINE_COLOUR, DEVICE_POINTS);
  22767.           end;
  22768.           FIRST_INDEX := LAST_INDEX + 1;
  22769.           WS_SL.WS_DISPLAY_SURFACE := NOTEMPTY;
  22770.       end if;
  22771.    end loop;
  22772.      
  22773.    if WS_SL.WS_DEFERRAL_MODE = ASAP then
  22774.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  22775.    end if;
  22776.    -- Flush the output buffer on the device if the deferral mode is ASAP
  22777.      
  22778. end POLYLINE;
  22779. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22780. --:UDD:GKSADACM:CODE:MA:WSD_PMRK_MA.ADA
  22781. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22782. ------------------------------------------------------------------
  22783. --
  22784. --  NAME: POLYMARKER
  22785. --  IDENTIFIER: GDMXXX.1(2)
  22786. --  DISCREPANCY REPORTS:
  22787. --  DR006  Polymarker tests do not execute.
  22788. ------------------------------------------------------------------
  22789. -- FILE: WSD_PMRK_MA.ADA
  22790. -- LEVEL: MA - 0A
  22791.      
  22792. separate (LEXI3700_OUTPUT_PRIMITIVES)
  22793.      
  22794. procedure POLYMARKER
  22795.    (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22796.     MARKER_POINTS : ACCESS_POINT_ARRAY_TYPE) is
  22797.      
  22798. -- This procedure uses the Workstation State List to find the effective
  22799. -- clipping matrix and the attributes used to control the appearance
  22800. -- of the polymarker.
  22801. --
  22802. -- WS_SL         - is a pointer to the Workstation State List.
  22803.      
  22804. -- MARKER_POINTS - is a pointer to an array containing points to give
  22805. --                 position of polymarkers.
  22806.      
  22807. MARKER_SIZE : INTEGER;
  22808. -- Contains the request marker size.
  22809.      
  22810. LEXI_MARKER_SIZE : LEXI_TEXT_SIZE;
  22811. -- Contains the size of the marker.
  22812.      
  22813. IS_VALID : BOOLEAN;
  22814. -- Contains a flag indicating if the colour index is valid.
  22815.      
  22816. MARKER_COLOUR : LEXI_COLOUR_INDEX;
  22817. -- Contains the colour index for the device.
  22818.      
  22819. CLIPPED_MARKER_POINTS : DC.POINT_LIST;
  22820. -- Contains the clipped Polymarkers.
  22821.      
  22822. LEXI_MARKER : LEXI_MARKER_TYPE;
  22823. -- Contains the available marker type.
  22824.      
  22825. MARKER_TYPE : INTEGER;
  22826. -- Contains the Requested Marker type.
  22827.      
  22828. procedure ADJUST_MARKER_POSITION
  22829.    (DEVICE_POINTS : in out LEXI_POINTS;
  22830.     MARKER_SIZE : LEXI_TEXT_SIZE) is
  22831.      
  22832. OFFSET_X : LEXI_COORDINATE :=
  22833.       LEXI_COORDINATE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_WIDTH)
  22834.       * LEXI_COORDINATE(MARKER_SIZE) / LEXI_COORDINATE'(2);
  22835. OFFSET_Y : LEXI_COORDINATE :=
  22836.       LEXI_COORDINATE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  22837.       * LEXI_COORDINATE(MARKER_SIZE) / LEXI_COORDINATE'(2);
  22838.      
  22839. begin
  22840.    for I in DEVICE_POINTS'range loop
  22841.        if INTEGER(DEVICE_POINTS(I).X - OFFSET_X) > 0 then
  22842.           DEVICE_POINTS(I).X := DEVICE_POINTS(I).X - OFFSET_X;
  22843.        else
  22844.           DEVICE_POINTS(I).X := LEXI_COORDINATE'(0);
  22845.        end if;
  22846.        if INTEGER(DEVICE_POINTS(I).Y - OFFSET_Y) > 0 then
  22847.           DEVICE_POINTS(I).Y := DEVICE_POINTS(I).Y - OFFSET_Y;
  22848.        else
  22849.           DEVICE_POINTS(I).Y := LEXI_COORDINATE'(0);
  22850.        end if;
  22851.    end loop;
  22852. end ADJUST_MARKER_POSITION;
  22853.      
  22854. begin
  22855.      
  22856.    IS_VALID := COLOUR_INDICES.IS_IN_LIST
  22857.                  (WS_SL.EFFECTIVE_POLYMARKER_ATTR.COLOUR,
  22858.                   WS_SL.SET_OF_COLOUR_IDC);
  22859.    if IS_VALID then
  22860.       MARKER_COLOUR := LEXI_COLOUR_INDEX(WS_SL.EFFECTIVE_POLYMARKER_ATTR.COLOUR)
  22861. ;
  22862.    else
  22863.       MARKER_COLOUR := LEXI_COLOUR_INDEX'(1);
  22864.    end if;
  22865.    -- Finds the polymarker colour.
  22866.      
  22867.    MARKER_SIZE := INTEGER(WS_SL.EFFECTIVE_POLYMARKER_ATTR.M_SIZE);
  22868.    if MARKER_SIZE < INTEGER(LEXI_TEXT_SIZE'FIRST) then
  22869.       LEXI_MARKER_SIZE := LEXI_TEXT_SIZE'FIRST;
  22870.    elsif MARKER_SIZE > INTEGER(LEXI_TEXT_SIZE'LAST) then
  22871.       LEXI_MARKER_SIZE := LEXI_TEXT_SIZE'LAST;
  22872.    else
  22873.       LEXI_MARKER_SIZE := LEXI_TEXT_SIZE(MARKER_SIZE);
  22874.    end if;
  22875.    -- Finds the polymarker size.
  22876.      
  22877.    LEXI_MARKER := LEXI_MARKER_TYPE'VAL
  22878.       (WS_SL.EFFECTIVE_POLYMARKER_ATTR.M_TYPE - 1);
  22879.      
  22880.    CLIPPED_MARKER_POINTS := WSR_UTILITIES.PMRK_CLIP
  22881.         (CONVERT_NDC_DC.DC_POINT_ARRAY(MARKER_POINTS.all,
  22882.          WS_SL.WS_TRANSFORM),
  22883.          WS_SL.EFFECTIVE_CLIPPING_RECTANGLE);
  22884.      
  22885.    if CLIPPED_MARKER_POINTS.POINTS'LENGTH > 0 then
  22886.       declare
  22887.          DEVICE_POINTS : LEXI_POINTS(1 .. CLIPPED_MARKER_POINTS.LENGTH);
  22888.       begin
  22889.          DEVICE_POINTS := LEXI_UTILITIES.IDC (CLIPPED_MARKER_POINTS.POINTS);
  22890.          ADJUST_MARKER_POSITION(DEVICE_POINTS,LEXI_MARKER_SIZE);
  22891.          for I in DEVICE_POINTS'range loop
  22892.              LEXI3700_OUTPUT_DRIVER.SET_TEXT_PARAMETERS
  22893.                   (DEVICE_POINTS(I), MARKER_COLOUR,
  22894.                    LEXI_CHARACTER_PATH'(LEFT_TO_RIGHT),
  22895.                    LEXI_MARKER_SIZE);
  22896.              LEXI3700_OUTPUT_DRIVER.DISPLAY_TEXT
  22897.                   (LEXI3700_OUTPUT_DRIVER.LEXI_MARKER(LEXI_MARKER));
  22898.          end loop;
  22899.       WS_SL.WS_DISPLAY_SURFACE := NOTEMPTY;
  22900.       end;
  22901.    end if;
  22902.      
  22903.    if WS_SL.WS_DEFERRAL_MODE = ASAP then
  22904.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  22905.    end if;
  22906.    -- Flush the output buffer on the device if the deferral mode is ASAP
  22907.      
  22908. end POLYMARKER;
  22909. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22910. --:UDD:GKSADACM:CODE:MA:WSD_TEXT_MA.ADA
  22911. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22912. ------------------------------------------------------------------
  22913. --
  22914. --  NAME: TEXT
  22915. --  IDENTIFIER: GCMXXX.2(2)
  22916. --  DISCREPANCY REPORTS:
  22917. --  DR029  Completely clipped string of text.
  22918. ------------------------------------------------------------------
  22919. -- FILE: WSD_TEXT_MA.ADA
  22920. -- LEVEL: LEVEL MA
  22921.      
  22922. separate (LEXI3700_OUTPUT_PRIMITIVES)
  22923.      
  22924. procedure TEXT
  22925.    (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22926.     TEXT_POSITION : NDC.POINT;
  22927.     TEXT_STRING   : ACCESS_STRING_TYPE) is
  22928.      
  22929. -- This procedure inquires into the WS State List to find
  22930. -- what the current attribute settings are.
  22931. --
  22932. -- The relevant attributes are as follows:
  22933. -- CHARACTER_SPACING, TEXT_COLOUR_INDEX, CHARACTER_HEIGHT, TEXT_PATH
  22934. -- CHARACTER_UP_VECTOR, TEXT_ALIGNMENT
  22935. --
  22936. -- This procedure calls the IDC procedure in WSD_UTILITIES to
  22937. -- convert the NDC points to IDC (INTEGER DEVICE COORDINATES).
  22938. --
  22939. -- POSITION    - contains the position to display text.
  22940. -- TEXT_STRING - contains a string of text to be displayed.
  22941. -- WS_SL       - is a pointer to the Workstation State List.
  22942.      
  22943. DEVICE_POINT : LEXI_POINT;
  22944. -- contains the starting point for the text string.
  22945.      
  22946. DC_POINT : DC.POINT;
  22947. -- contains the starting point in DC coordinates.
  22948.      
  22949. IS_VALID : BOOLEAN;
  22950. -- Contains a flag indicating if a colour index is valid.
  22951.      
  22952. TEXT_COLOUR : LEXI_COLOUR_INDEX;
  22953. -- Contains the colour index to be used.
  22954.      
  22955. OFFSET : DC.POINT;
  22956. -- Contains an x and y offset to use for each character.
  22957.      
  22958. LEXI_CHAR_SIZE : LEXI_TEXT_SIZE;
  22959. -- Contains the multiplication factor for text size.
  22960.      
  22961. CHAR_HEIGHT : DC_TYPE;
  22962. -- Contains the physical requested height of the character.
  22963.      
  22964. AVAILABLE_HEIGHT : INTEGER;
  22965. -- Contains the available scale factor for text sizes.
  22966.      
  22967. FIRST_VALID, LAST_VALID : POSITIVE;
  22968. -- An index into the string of characters.
  22969.      
  22970. LEXI_CHAR_ROTATION : LEXI_ROTATE_CODE;
  22971. -- Contains the character rotation offered by the device.
  22972.      
  22973. LEXI_PATH : LEXI_CHARACTER_PATH;
  22974. -- Contains the path offered by the device.
  22975.      
  22976. FORTY_FIVE     : constant DC_TYPE := 0.707107;
  22977. NEG_FORTY_FIVE : constant DC_TYPE := -0.707107;
  22978. -- Contains the vector values to determine the character rotation.
  22979.      
  22980. DC_CHAR_HEIGHT_VECTOR : DC.VECTOR;
  22981. -- Contains the height vector converted to DC.
  22982.      
  22983. Y_COMP_VECTOR, X_COMP_VECTOR : DC_TYPE;
  22984. -- Contains the X and Y vectors to determine the character rotation.
  22985.      
  22986. START_POSITION : DC.POINT;
  22987. -- Contains the physical starting point to display the text string.
  22988.      
  22989. TEI_LOWER_LEFT  : DC.POINT;
  22990. -- Contains the parallelogram containing the text string.
  22991.      
  22992. TEI_LOWER_RIGHT : DC.POINT;
  22993. -- Contains the parallelogram containing the text string.
  22994.      
  22995. TEI_UPPER_LEFT  : DC.POINT;
  22996. -- Contains the parallelogram containing the text string.
  22997.      
  22998. TEI_UPPER_RIGHT : DC.POINT;
  22999. -- Contains the parallelogram containing the text string.
  23000.      
  23001. begin
  23002.    IS_VALID := COLOUR_INDICES.IS_IN_LIST
  23003.                  (WS_SL.EFFECTIVE_TEXT_ATTR.COLOUR,
  23004.                   WS_SL.SET_OF_COLOUR_IDC);
  23005.    if IS_VALID then
  23006.       TEXT_COLOUR := LEXI_COLOUR_INDEX(WS_SL.EFFECTIVE_TEXT_ATTR.COLOUR);
  23007.    else
  23008.       TEXT_COLOUR := LEXI_COLOUR_INDEX(1);
  23009.    end if;
  23010.    DC_CHAR_HEIGHT_VECTOR := CONVERT_NDC_DC.DC_VECTOR
  23011.         (WS_SL.OUTPUT_ATTR.CURRENT_CHAR_HEIGHT_VECTOR, WS_SL.WS_TRANSFORM);
  23012.      
  23013.    CHAR_HEIGHT := DC_POINT_OPS.NORM(DC_CHAR_HEIGHT_VECTOR);
  23014.      
  23015.    DC_POINT := CONVERT_NDC_DC.DC_POINT
  23016.                  (TEXT_POSITION, WS_SL.WS_TRANSFORM);
  23017.      
  23018.    WSR_UTILITIES.TEXT_HANDLING
  23019.        (DC_TYPE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP),
  23020.         DC_TYPE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_BASE_BOTTOM),
  23021.         WS_SL.OUTPUT_ATTR.CURRENT_TEXT_PATH,
  23022.         WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT,
  23023.         DC_CHAR_HEIGHT_VECTOR,
  23024.         CONVERT_NDC_DC.DC_VECTOR
  23025.              (WS_SL.OUTPUT_ATTR.CURRENT_CHAR_WIDTH_VECTOR,
  23026.               WS_SL.WS_TRANSFORM),
  23027.         WS_SL.OUTPUT_ATTR.CURRENT_CHAR_EXPANSION_FACTOR,
  23028.         WS_SL.OUTPUT_ATTR.CURRENT_CHAR_SPACING,
  23029.         DC_POINT,
  23030.         TEXT_STRING'LENGTH,
  23031.         DC_TYPE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT),
  23032.         START_POSITION,
  23033.         OFFSET,
  23034.         TEI_LOWER_LEFT,
  23035.         TEI_LOWER_RIGHT,
  23036.         TEI_UPPER_LEFT,
  23037.         TEI_UPPER_RIGHT);
  23038.      
  23039.    X_COMP_VECTOR := DC_CHAR_HEIGHT_VECTOR.X / CHAR_HEIGHT;
  23040.    Y_COMP_VECTOR := DC_CHAR_HEIGHT_VECTOR.Y / CHAR_HEIGHT;
  23041.      
  23042.      
  23043.    AVAILABLE_HEIGHT := abs (INTEGER (CHAR_HEIGHT) /
  23044.       LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT);
  23045.      
  23046.    if AVAILABLE_HEIGHT > INTEGER(LEXI_TEXT_SIZE'LAST) then
  23047.       LEXI_CHAR_SIZE := LEXI_TEXT_SIZE'LAST;
  23048.    elsif AVAILABLE_HEIGHT < INTEGER(LEXI_TEXT_SIZE'FIRST) then
  23049.       LEXI_CHAR_SIZE := LEXI_TEXT_SIZE'FIRST;
  23050.    else
  23051.       LEXI_CHAR_SIZE := LEXI_TEXT_SIZE(AVAILABLE_HEIGHT);
  23052.    end if;
  23053.      
  23054.    if X_COMP_VECTOR > NEG_FORTY_FIVE and X_COMP_VECTOR < FORTY_FIVE then
  23055.       if Y_COMP_VECTOR < 0.0 then
  23056.          LEXI_CHAR_ROTATION := ROTATION_180;
  23057.          START_POSITION.Y := START_POSITION.Y -
  23058.               (DC_TYPE
  23059.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  23060.               + DC_TYPE
  23061.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP))
  23062.               * DC_TYPE(LEXI_CHAR_SIZE);
  23063.       else
  23064.          LEXI_CHAR_ROTATION := NO_ROTATION;
  23065.          START_POSITION.Y := START_POSITION.Y +
  23066.               (DC_TYPE
  23067.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  23068.               + DC_TYPE
  23069.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP))
  23070.               * DC_TYPE(LEXI_CHAR_SIZE);
  23071.      end if;
  23072.    else
  23073.       if X_COMP_VECTOR < 0.0 then
  23074.          LEXI_CHAR_ROTATION := ROTATION_90;
  23075.          START_POSITION.X := START_POSITION.X -
  23076.               (DC_TYPE
  23077.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  23078.               + DC_TYPE
  23079.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP))
  23080.               * DC_TYPE(LEXI_CHAR_SIZE);
  23081.       else
  23082.          LEXI_CHAR_ROTATION := ROTATION_270;
  23083.          START_POSITION.X := START_POSITION.X +
  23084.               (DC_TYPE
  23085.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  23086.               + DC_TYPE
  23087.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP))
  23088.               * DC_TYPE(LEXI_CHAR_SIZE);
  23089.       end if;
  23090.    end if;
  23091.      
  23092.    WSR_UTILITIES.TEXT_CLIP
  23093.        (START_POSITION,
  23094.         TEXT_STRING'LENGTH,
  23095.         WS_SL.EFFECTIVE_CLIPPING_RECTANGLE,
  23096.         OFFSET,
  23097.         FIRST_VALID,
  23098.         LAST_VALID);
  23099.      
  23100.    START_POSITION.X := START_POSITION.X + (OFFSET.X *
  23101.         DC_TYPE(FIRST_VALID - 1));
  23102.    START_POSITION.Y := START_POSITION.Y + (OFFSET.Y *
  23103.         DC_TYPE(FIRST_VALID - 1));
  23104.      
  23105.    LEXI3700_OUTPUT_DRIVER.SET_TEXT_CHARACTER_ROTATION
  23106.        (LEXI_CHAR_ROTATION);
  23107.      
  23108.    case LEXI_CHAR_ROTATION is
  23109.       when NO_ROTATION  => LEXI_PATH := LEFT_TO_RIGHT;
  23110.       when ROTATION_90  => LEXI_PATH := BOTTOM_TO_TOP;
  23111.       when ROTATION_180 => LEXI_PATH := RIGHT_TO_LEFT;
  23112.       when ROTATION_270 => LEXI_PATH := TOP_TO_BOTTOM;
  23113.    end case;
  23114.      
  23115.    if LAST_VALID >= FIRST_VALID then
  23116.       DEVICE_POINT :=  LEXI_UTILITIES.IDC(START_POSITION);
  23117.    end if;
  23118.      
  23119.    for I in FIRST_VALID .. LAST_VALID loop
  23120.       LEXI3700_OUTPUT_DRIVER.SET_TEXT_PARAMETERS
  23121.           (DEVICE_POINT, TEXT_COLOUR,
  23122.            LEXI_CHARACTER_PATH'(LEXI_PATH),
  23123.            LEXI_CHAR_SIZE);
  23124.       LEXI3700_OUTPUT_DRIVER.DISPLAY_TEXT(TEXT_STRING(I .. I));
  23125.      
  23126.       if I /= LAST_VALID then
  23127.          DEVICE_POINT.X := LEXI_COORDINATE(DC_TYPE(DEVICE_POINT.X) +
  23128.                OFFSET.X);
  23129.          DEVICE_POINT.Y := LEXI_COORDINATE(DC_TYPE(DEVICE_POINT.Y) -
  23130.                OFFSET.Y);
  23131.       else
  23132.          WS_SL.WS_DISPLAY_SURFACE := NOTEMPTY;
  23133.          -- If text is being displayed, we set the display surface
  23134.          -- to not empty, is occurs after the text has been drawn.
  23135.       end if;
  23136.    end loop;
  23137.      
  23138.    if WS_SL.WS_DEFERRAL_MODE = ASAP then
  23139.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  23140.    end if;
  23141.    -- Flush the output buffer on the device if the deferral mode is ASAP
  23142.      
  23143. end TEXT;
  23144. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23145. --:UDD:GKSADACM:CODE:MA:GKS_MA.ADA
  23146. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23147. ------------------------------------------------------------------
  23148. --
  23149. --  NAME: GKS_MA
  23150. --  IDENTIFIER: GIMXXX.1(1)
  23151. --  DISCREPANCY REPORTS:
  23152. --
  23153. ------------------------------------------------------------------
  23154. -- file:  gks_ma.ada
  23155. -- level: ma
  23156.      
  23157. -- The following context clauses refer to the logical groups
  23158. -- for level ma.
  23159.      
  23160. with GKS_CONTROL;
  23161. with WS_CONTROL;
  23162. with OUTPUT_PRIMITIVES;
  23163. with SET_INDIVIDUAL_ATTRIBUTES_MA;
  23164. with SET_PRIMITIVE_ATTRIBUTES_MA;
  23165. with SET_COLOUR_TABLE;
  23166. with INQ_PRIMITIVE_ATTRIBUTES;
  23167. with INQ_BU9TNDLE_INDICES;
  23168. with INQ_INDIVIDUAL_ATTRIBUTES;
  23169. with GKS_NORMALIZATION;
  23170. with WS_TRANSFORMATION;
  23171. with INQ_GKS_STATE_LIST_MA;
  23172. with INQ_GKS_DESCRIPTION_TABLE_MA;
  23173. with INQ_WS_STATE_LIST_MA;
  23174. with INQ_WS_DESCRIPTION_TABLE_MA;
  23175. with ERROR_ROUTINES;
  23176.      
  23177. with GKS_TYPES;
  23178. with GKS_CONFIGURATION;
  23179.      
  23180. use GKS_TYPES;
  23181.      
  23182. package GKS_MA is
  23183.      
  23184. -- This package provides the interface to the applications
  23185. -- programmer.  It provides the full functionality for a
  23186. -- level ma implementation of GKS.
  23187.      
  23188.    -- GKS_CONTROL logical functions
  23189.    procedure OPEN_GKS
  23190.       (ERROR_FILE      : in ERROR_FILE_TYPE :=
  23191.                          GKS_CONFIGURATION.DEFAULT_ERROR_FILE;
  23192.       AMOUNT_OF_MEMORY : in MEMORY_UNITS :=
  23193.                          GKS_CONFIGURATION.MAX_MEMORY_UNITS)
  23194.    renames GKS_CONTROL.OPEN_GKS;
  23195.      
  23196.    procedure CLOSE_GKS renames GKS_CONTROL.CLOSE_GKS;
  23197.      
  23198.      
  23199.    -- WS_CONTROL logical functions
  23200.    procedure OPEN_WS
  23201.       (WS        : in WS_ID;
  23202.       CONNECTION : in CONNECTION_ID;
  23203.       TYPE_OF_WS : in WS_TYPE)
  23204.    renames WS_CONTROL.OPEN_WS;
  23205.      
  23206.    procedure CLOSE_WS
  23207.       (WS : in WS_ID)
  23208.    renames WS_CONTROL.CLOSE_WS;
  23209.      
  23210.    procedure ACTIVATE_WS
  23211.       (WS : in WS_ID)
  23212.    renames WS_CONTROL.ACTIVATE_WS;
  23213.      
  23214.    procedure DEACTIVATE_WS
  23215.       (WS : in WS_ID)
  23216.    renames WS_CONTROL.DEACTIVATE_WS;
  23217.      
  23218.    procedure CLEAR_WS
  23219.       (WS  : in WS_ID;
  23220.       FLAG : in CONTROL_FLAG)
  23221.    renames WS_CONTROL.CLEAR_WS;
  23222.      
  23223.    procedure UPDATE_WS
  23224.       (WS          : in WS_ID;
  23225.       REGENERATION : in UPDATE_REGENERATION_FLAG)
  23226.    renames WS_CONTROL.UPDATE_WS;
  23227.      
  23228.      
  23229.    -- OUTPUT_PRIMITIVES logical functions
  23230.    procedure POLYLINE
  23231.       (LINE_POINTS : in WC.POINT_ARRAY)
  23232.    renames OUTPUT_PRIMITIVES.POLYLINE;
  23233.      
  23234.    procedure POLYMARKER
  23235.       (MARKER_POINTS : in WC.POINT_ARRAY)
  23236.    renames OUTPUT_PRIMITIVES.POLYMARKER;
  23237.      
  23238.    procedure FILL_AREA
  23239.       (FILL_AREA_POINTS : in WC.POINT_ARRAY)
  23240.    renames OUTPUT_PRIMITIVES.FILL_AREA;
  23241.      
  23242.    procedure TEXT
  23243.       (POSITION   : in WC.POINT;
  23244.       TEXT_STRING : in STRING)
  23245.    renames OUTPUT_PRIMITIVES.TEXT;
  23246.      
  23247.      
  23248.    -- SET_INDIVIDUAL_ATTRIBUTES_MA logical functions
  23249.    procedure SET_LINETYPE
  23250.       (LINE : in LINETYPE)
  23251.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_LINETYPE;
  23252.      
  23253.    procedure SET_POLYLINE_COLOUR_INDEX
  23254.       (COLOUR : in COLOUR_INDEX)
  23255.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_POLYLINE_COLOUR_INDEX;
  23256.      
  23257.    procedure SET_MARKER_TYPE
  23258.       (MARKER : in MARKER_TYPE)
  23259.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_MARKER_TYPE;
  23260.      
  23261.    procedure SET_POLYMARKER_COLOUR_INDEX
  23262.       (COLOUR : in COLOUR_INDEX)
  23263.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_POLYMARKER_COLOUR_INDEX;
  23264.      
  23265.    procedure SET_TEXT_COLOUR_INDEX
  23266.       (COLOUR : in COLOUR_INDEX)
  23267.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_TEXT_COLOUR_INDEX;
  23268.      
  23269.    procedure SET_FILL_AREA_INTERIOR_STYLE
  23270.       (STYLE : in INTERIOR_STYLE)
  23271.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_FILL_AREA_INTERIOR_STYLE;
  23272.      
  23273.    procedure SET_FILL_AREA_COLOUR_INDEX
  23274.       (COLOUR : in COLOUR_INDEX)
  23275.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_FILL_AREA_COLOUR_INDEX;
  23276.      
  23277.      
  23278.    -- SET_PRIMITIVE_ATTRIBUTES_MA logical functions
  23279.    procedure SET_CHAR_HEIGHT
  23280.       (HEIGHT : in WC.MAGNITUDE)
  23281.    renames SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_HEIGHT;
  23282.      
  23283.    procedure SET_CHAR_UP_VECTOR
  23284.       (CHAR_UP_VECTOR : IN WC.VECTOR)
  23285.    renames SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_UP_VECTOR;
  23286.      
  23287.    procedure SET_TEXT_ALIGNMENT
  23288.       (ALIGNMENT : in TEXT_ALIGNMENT)
  23289.    renames SET_PRIMITIVE_ATTRIBUTES_MA.SET_TEXT_ALIGNMENT;
  23290.      
  23291.      
  23292.    -- SET_COLOUR_TABLE logical functions
  23293.    procedure SET_COLOUR_REPRESENTATION
  23294.       (WS    : in WS_ID;
  23295.       INDEX  : in COLOUR_INDEX;
  23296.       COLOUR : in COLOUR_REPRESENTATION)
  23297.    renames SET_COLOUR_TABLE.SET_COLOUR_REPRESENTATION;
  23298.      
  23299.      
  23300.    -- INQ_PRIMITIVE_ATTRIBUTES logical functions
  23301.    procedure INQ_CHAR_HEIGHT
  23302.       (EI    : out ERROR_INDICATOR;
  23303.       HEIGHT : out WC.MAGNITUDE)
  23304.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_CHAR_HEIGHT;
  23305.      
  23306.    procedure INQ_CHAR_UP_VECTOR
  23307.       (EI    : out ERROR_INDICATOR;
  23308.       VECTOR : out WC.VECTOR)
  23309.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_CHAR_UP_VECTOR;
  23310.      
  23311.    procedure INQ_TEXT_PATH
  23312.       (EI  : out ERROR_INDICATOR;
  23313.       PATH : out TEXT_PATH)
  23314.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_TEXT_PATH;
  23315.      
  23316.    procedure INQ_TEXT_ALIGNMENT
  23317.       (EI       : out ERROR_INDICATOR;
  23318.       ALIGNMENT : out TEXT_ALIGNMENT)
  23319.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_TEXT_ALIGNMENT;
  23320.      
  23321.    procedure INQ_PATTERN_REFERENCE_POINT
  23322.       (EI             : out ERROR_INDICATOR;
  23323.       REFERENCE_POINT : out WC.POINT)
  23324.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_PATTERN_REFERENCE_POINT;
  23325.      
  23326.    procedure INQ_PATTERN_HEIGHT_VECTOR
  23327.       (EI    : out ERROR_INDICATOR;
  23328.       VECTOR : out WC.VECTOR)
  23329.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_PATTERN_HEIGHT_VECTOR;
  23330.      
  23331.    procedure INQ_PATTERN_WIDTH_VECTOR
  23332.       (EI   : out ERROR_INDICATOR;
  23333.       WIDTH : out WC.VECTOR)
  23334.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_PATTERN_WIDTH_VECTOR;
  23335.      
  23336.    procedure INQ_CHAR_WIDTH
  23337.       (EI   : out ERROR_INDICATOR;
  23338.       WIDTH : out WC.MAGNITUDE)
  23339.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_CHAR_WIDTH;
  23340.      
  23341.    procedure INQ_CHAR_BASE_VECTOR
  23342.       (EI    : out ERROR_INDICATOR;
  23343.       VECTOR : out WC.VECTOR)
  23344.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_CHAR_BASE_VECTOR;
  23345.      
  23346.      
  23347.    -- INQ_BUNDLE_INDICES logical functions
  23348.    procedure INQ_POLYLINE_INDEX
  23349.       (EI   : out ERROR_INDICATOR;
  23350.       INDEX : out POLYLINE_INDEX)
  23351.    renames INQ_BUNDLE_INDICES.INQ_POLYLINE_INDEX;
  23352.      
  23353.    procedure INQ_POLYMARKER_INDEX
  23354.       (EI   : out ERROR_INDICATOR;
  23355.       INDEX : out POLYMARKER_INDEX)
  23356.    renames INQ_BUNDLE_INDICES.INQ_POLYMARKER_INDEX;
  23357.      
  23358.    procedure INQ_TEXT_INDEX
  23359.       (EI   : out ERROR_INDICATOR;
  23360.       INDEX : out TEXT_INDEX)
  23361.    renames INQ_BUNDLE_INDICES.INQ_TEXT_INDEX;
  23362.      
  23363.    procedure INQ_FILL_AREA_INDEX
  23364.       (EI   : out ERROR_INDICATOR;
  23365.       INDEX : out FILL_AREA_INDEX)
  23366.    renames INQ_BUNDLE_INDICES.INQ_FILL_AREA_INDEX;
  23367.      
  23368.      
  23369.    -- INQ_INDIVIDUAL_ATTRIBUTES logical functions
  23370.    procedure INQ_LINETYPE
  23371.       (EI  : out ERROR_INDICATOR;
  23372.       LINE : out LINETYPE)
  23373.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_LINETYPE;
  23374.      
  23375.    procedure INQ_LINEWIDTH_SCALE_FACTOR
  23376.       (EI   : out ERROR_INDICATOR;
  23377.       WIDTH : out LINE_WIDTH)
  23378.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_LINEWIDTH_SCALE_FACTOR;
  23379.      
  23380.    procedure INQ_POLYLINE_COLOUR_INDEX
  23381.       (EI    : out ERROR_INDICATOR;
  23382.       COLOUR : out COLOUR_INDEX)
  23383.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_POLYLINE_COLOUR_INDEX;
  23384.      
  23385.    procedure INQ_POLYMARKER_TYPE
  23386.       (EI    : out ERROR_INDICATOR;
  23387.       MARKER : out MARKER_TYPE)
  23388.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_POLYMARKER_TYPE;
  23389.      
  23390.    procedure INQ_POLYMARKER_SIZE_SCALE_FACTOR
  23391.       (EI  : out ERROR_INDICATOR;
  23392.       SIZE : out MARKER_SIZE)
  23393.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_POLYMARKER_SIZE_SCALE_FACTOR;
  23394.      
  23395.    procedure INQ_POLYMARKER_COLOUR_INDEX
  23396.       (EI    : out ERROR_INDICATOR;
  23397.       COLOUR : out COLOUR_INDEX)
  23398.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_POLYMARKER_COLOUR_INDEX;
  23399.      
  23400.    procedure INQ_TEXT_FONT_AND_PRECISION
  23401.       (EI            : out ERROR_INDICATOR;
  23402.       FONT_PRECISION : out TEXT_FONT_PRECISION)
  23403.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_TEXT_FONT_AND_PRECISION;
  23404.      
  23405.    procedure INQ_CHAR_EXPANSION_FACTOR
  23406.       (EI       : out ERROR_INDICATOR;
  23407.       EXPANSION : out CHAR_EXPANSION)
  23408.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_CHAR_EXPANSION_FACTOR;
  23409.      
  23410.    procedure INQ_CHAR_SPACING
  23411.       (EI     : out ERROR_INDICATOR;
  23412.       SPACING : out CHAR_SPACING)
  23413.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_CHAR_SPACING;
  23414.      
  23415.    procedure INQ_TEXT_COLOUR_INDEX
  23416.       (EI    : out ERROR_INDICATOR;
  23417.       COLOUR : out COLOUR_INDEX)
  23418.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_TEXT_COLOUR_INDEX;
  23419.      
  23420.    procedure INQ_FILL_AREA_INTERIOR_STYLE
  23421.       (EI   : out ERROR_INDICATOR;
  23422.       STYLE : out INTERIOR_STYLE)
  23423.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_FILL_AREA_INTERIOR_STYLE;
  23424.      
  23425.    procedure INQ_FILL_AREA_STYLE_INDEX
  23426.       (EI   : out ERROR_INDICATOR;
  23427.       INDEX : out STYLE_INDEX)
  23428.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_FILL_AREA_STYLE_INDEX;
  23429.      
  23430.    procedure INQ_FILL_AREA_COLOUR_INDEX
  23431.       (EI    : out ERROR_INDICATOR;
  23432.       COLOUR : out COLOUR_INDEX)
  23433.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_FILL_AREA_COLOUR_INDEX;
  23434.      
  23435.    procedure INQ_LIST_OF_ASF
  23436.       (EI  : out ERROR_INDICATOR;
  23437.       LIST : out ASF_LIST)
  23438.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_LIST_OF_ASF;
  23439.      
  23440.      
  23441.    -- GKS_NORMALIZATION logical functions
  23442.    procedure SET_WINDOW
  23443.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  23444.       WINDOW_LIMITS   : in WC.RECTANGLE_LIMITS)
  23445.    renames GKS_NORMALIZATION.SET_WINDOW;
  23446.      
  23447.    procedure SET_VIEWPORT
  23448.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  23449.       VIEWPORT_LIMITS : in NDC.RECTANGLE_LIMITS)
  23450.    renames GKS_NORMALIZATION.SET_VIEWPORT;
  23451.      
  23452.    procedure SELECT_NORMALIZATION_TRANSFORMATION
  23453.       (TRANSFORMATION : in TRANSFORMATION_NUMBER)
  23454.    renames GKS_NORMALIZATION.SELECT_NORMALIZATION_TRANSFORMATION;
  23455.      
  23456.    procedure SET_CLIPPING_INDICATOR
  23457.       (CLIPPING : in CLIPPING_INDICATOR)
  23458.    renames GKS_NORMALIZATION.SET_CLIPPING_INDICATOR;
  23459.      
  23460.      
  23461.    -- WS_TRANSFORMATION logical functions
  23462.    procedure SET_WS_WINDOW
  23463.       (WS              : in WS_ID;
  23464.       WS_WINDOW_LIMITS : in NDC.RECTANGLE_LIMITS)
  23465.    renames WS_TRANSFORMATION.SET_WS_WINDOW;
  23466.      
  23467.    procedure SET_WS_VIEWPORT
  23468.       (WS                : in WS_ID;
  23469.       WS_VIEWPORT_LIMITS : in DC.RECTANGLE_LIMITS)
  23470.    renames WS_TRANSFORMATION.SET_WS_VIEWPORT;
  23471.      
  23472.    -- INQ_GKS_STATE_LIST_MA logical functions
  23473.    procedure INQ_CURRENT_NORMALIZATION_TRANSFORMATION_NUMBER
  23474.       (EI            : out ERROR_INDICATOR;
  23475.       TRANSFORMATION : out TRANSFORMATION_NUMBER)
  23476.    renames INQ_GKS_STATE_LIST_MA.
  23477.                        INQ_CURRENT_NORMALIZATION_TRANSFORMATION_NUMBER;
  23478.      
  23479.    procedure INQ_NORMALIZATION_TRANSFORMATION
  23480.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  23481.       EI              : out ERROR_INDICATOR;
  23482.       WINDOW_LIMITS   : out WC.RECTANGLE_LIMITS;
  23483.       VIEWPORT_LIMITS : out NDC.RECTANGLE_LIMITS)
  23484.    renames INQ_GKS_STATE_LIST_MA.INQ_NORMALIZATION_TRANSFORMATION;
  23485.      
  23486.    procedure INQ_CLIPPING
  23487.       (EI                : out ERROR_INDICATOR;
  23488.       CLIPPING           : out CLIPPING_INDICATOR;
  23489.       CLIPPING_RECTANGLE_LIMITS : out NDC.RECTANGLE_LIMITS)
  23490.    renames INQ_GKS_STATE_LIST_MA.INQ_CLIPPING;
  23491.      
  23492.      
  23493.    -- INQ_GKS_DESCRIPTION_TABLE_MA logical functions
  23494.    procedure INQ_LEVEL_OF_GKS
  23495.       (EI   : out ERROR_INDICATOR;
  23496.       LEVEL : out GKS_LEVEL)
  23497.    renames INQ_GKS_DESCRIPTION_TABLE_MA.INQ_LEVEL_OF_GKS;
  23498.      
  23499.      
  23500.    -- INQ_WS_STATE_LIST_MA logical functions
  23501.    procedure INQ_WS_CONNECTION_AND_TYPE
  23502.       (WS        : in WS_ID;
  23503.       EI         : out ERROR_INDICATOR;
  23504.       CONNECTION : out VARIABLE_CONNECTION_ID;
  23505.       TYPE_OF_WS : out WS_TYPE)
  23506.    renames INQ_WS_STATE_LIST_MA.INQ_WS_CONNECTION_AND_TYPE;
  23507.      
  23508.    procedure INQ_TEXT_EXTENT
  23509.       (WS                 : in WS_ID;
  23510.       POSITION            : in WC.POINT;
  23511.       CHAR_STRING         : in STRING;
  23512.       EI                  : out ERROR_INDICATOR;
  23513.       CONCATENATION_POINT : out WC.POINT;
  23514.       TEXT_EXTENT         : out TEXT_EXTENT_PARALLELOGRAM)
  23515.    renames INQ_WS_STATE_LIST_MA.INQ_TEXT_EXTENT;
  23516.      
  23517.    procedure INQ_LIST_OF_COLOUR_INDICES
  23518.       (WS     : in WS_ID;
  23519.       EI      : out ERROR_INDICATOR;
  23520.       INDICES : out COLOUR_INDICES.LIST_OF)
  23521.    renames INQ_WS_STATE_LIST_MA.INQ_LIST_OF_COLOUR_INDICES;
  23522.      
  23523.    procedure INQ_COLOUR_REPRESENTATION
  23524.       (WS             : in WS_ID;
  23525.       INDEX           : in COLOUR_INDEX;
  23526.       RETURNED_VALUES : in RETURN_VALUE_TYPE;
  23527.       EI              : out ERROR_INDICATOR;
  23528.       COLOUR          : out COLOUR_REPRESENTATION)
  23529.    renames INQ_WS_STATE_LIST_MA.INQ_COLOUR_REPRESENTATION;
  23530.      
  23531.    procedure INQ_WS_TRANSFORMATION
  23532.       (WS                : in WS_ID;
  23533.       EI                 : out ERROR_INDICATOR;
  23534.       UPDATE             : out UPDATE_STATE;
  23535.       REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  23536.       CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  23537.       REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  23538.       CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS)
  23539.    renames INQ_WS_STATE_LIST_MA.INQ_WS_TRANSFORMATION;
  23540.      
  23541.      
  23542.    -- INQ_WS_DESCRIPTION_TABLE_MA logical functions
  23543.    procedure INQ_DISPLAY_SPACE_SIZE
  23544.       (WS                  : in WS_TYPE;
  23545.       EI                   : out ERROR_INDICATOR;
  23546.       UNITS                : out DC_UNITS;
  23547.       MAX_DC_SIZE          : out DC.SIZE;
  23548.       MAX_RASTER_UNIT_SIZE : out RASTER_UNIT_SIZE)
  23549.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_DISPLAY_SPACE_SIZE;
  23550.      
  23551.    procedure INQ_POLYLINE_FACILITIES
  23552.       (WS               : in WS_TYPE;
  23553.       EI                : out ERROR_INDICATOR;
  23554.       LIST_OF_TYPES     : out LINETYPES.LIST_OF;
  23555.       NUMBER_OF_WIDTHS  : out NATURAL;
  23556.       NOMINAL_WIDTH     : out DC.MAGNITUDE;
  23557.       RANGE_OF_WIDTHS   : out DC.RANGE_OF_MAGNITUDES;
  23558.       NUMBER_OF_INDICES : out NATURAL)
  23559.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_POLYLINE_FACILITIES;
  23560.      
  23561.    procedure INQ_POLYMARKER_FACILITIES
  23562.       (WS               : in WS_TYPE;
  23563.       EI                : out ERROR_INDICATOR;
  23564.       LIST_OF_TYPES     : out MARKER_TYPES.LIST_OF;
  23565.       NUMBER_OF_SIZES   : out NATURAL;
  23566.       NOMINAL_SIZE      : out DC.MAGNITUDE;
  23567.       RANGE_OF_SIZES    : out DC.RANGE_OF_MAGNITUDES;
  23568.       NUMBER_OF_INDICES : out NATURAL)
  23569.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_POLYMARKER_FACILITIES;
  23570.      
  23571.    procedure INQ_TEXT_FACILITIES
  23572.       (WS                  : in WS_TYPE;
  23573.       EI                   : out ERROR_INDICATOR;
  23574.       LIST_OF_FONT_PRECISION_PAIRS: out TEXT_FONT_PRECISIONS.LIST_OF;
  23575.       NUMBER_OF_HEIGHTS    : out NATURAL;
  23576.       RANGE_OF_HEIGHTS     : out DC.RANGE_OF_MAGNITUDES;
  23577.       NUMBER_OF_EXPANSIONS : out NATURAL;
  23578.       EXPANSION_RANGE      : out RANGE_OF_EXPANSIONS;
  23579.       NUMBER_OF_INDICES    : out NATURAL)
  23580.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_TEXT_FACILITIES;
  23581.      
  23582.    procedure INQ_FILL_AREA_FACILITIES
  23583.       (WS                     : WS_TYPE;
  23584.       EI                      : out ERROR_INDICATOR;
  23585.       LIST_OF_INTERIOR_STYLES : out INTERIOR_STYLES.LIST_OF;
  23586.       LIST_OF_HATCH_STYLES    : out HATCH_STYLES.LIST_OF;
  23587.       NUMBER_OF_INDICES       : out NATURAL)
  23588.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_FILL_AREA_FACILITIES;
  23589.      
  23590.    procedure INQ_COLOUR_FACILITIES
  23591.       (WS                      : in WS_TYPE;
  23592.       EI                       : out ERROR_INDICATOR;
  23593.       NUMBER_OF_COLOURS        : out NATURAL;
  23594.       AVAILABLE_COLOUR         : out COLOUR_AVAILABLE;
  23595.       NUMBER_OF_COLOUR_INDICES : out NATURAL)
  23596.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_COLOUR_FACILITIES;
  23597.      
  23598.    procedure INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  23599.       (WS                    : in WS_TYPE;
  23600.       EI                     : out ERROR_INDICATOR;
  23601.       MAX_POLYLINE_ENTRIES   : out NATURAL;
  23602.       MAX_POLYMARKER_ENTRIES : out NATURAL;
  23603.       MAX_TEXT_ENTRIES       : out NATURAL;
  23604.       MAX_FILL_AREA_ENTRIES  : out NATURAL;
  23605.       MAX_PATTERN_INDICES    : out NATURAL;
  23606.       MAX_COLOUR_INDICES     : out NATURAL)
  23607.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_MAX_LENGTH_OF_WS_STATE_TABLES;
  23608.      
  23609. end GKS_MA;
  23610.      
  23611.      
  23612.      
  23613.      
  23614.      
  23615.      
  23616.      
  23617.      
  23618.  $
  23619.