home *** CD-ROM | disk | FTP | other *** search
/ Programmer's ROM - The Computer Language Library / programmersrom.iso / ada / gks / gks0a.src < prev    next >
Encoding:
Text File  |  1988-05-03  |  1.1 MB  |  32,120 lines

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2. --:UDD:GKSADACM:CODE:0A:GKS_CONFIGURATION_0A.ADA
  3. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4. ------------------------------------------------------------------
  5. --
  6. --  NAME: GKS_CONFIGURATION
  7. --  IDENTIFIER: GIMXXX.2(1)
  8. --  DISCREPANCY REPORTS:
  9. --  DR003 Unassigned CGM constants in GKS_CONFIGURATION_0A
  10. ------------------------------------------------------------------
  11. -- file:  gks_configuration_0a.ada
  12. -- level: 0a
  13.      
  14. package GKS_CONFIGURATION is
  15.      
  16. -- This package is external to GKS and contains implementation-defined
  17. -- constants used by a particular level 0a implementation of GKS.  It
  18. -- also contains default declarations used by an application program in
  19. -- its implementation of GKS.
  20.      
  21.    MAX_MEMORY_UNITS              : constant := 0;
  22.      
  23.    MAX_NUMBER_OPEN_WS            : constant := 100;
  24.      
  25.    MAX_NUMBER_ACTIVE_WS          : constant := 100;
  26.      
  27.    MAX_NORMALIZATION_TRANSFORMATION_NUMBER
  28.                                  : constant := 1;
  29.      
  30.    MAX_WS_TYPE                   : constant := 100;
  31.      
  32.    PRECISION                     : constant := 6;
  33.      
  34.    DEFAULT_ERROR_FILE            : constant STRING :=
  35.                                               "gks_error_file";
  36.      
  37.    LEXIDATA_3700_OUTPUT_TYPE     : constant := 1;
  38.      
  39.    GKSM_MO                       : constant := 91;
  40.      
  41.    GKSM_MI                       : constant := 92;
  42.      
  43.    CGM_MO                        : constant := 60;
  44.      
  45.    CGM_MI                        : constant := 70;
  46.      
  47. end GKS_CONFIGURATION;
  48. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  49. --:UDD:GKSADACM:CODE:MA:GKS_COOR_SYS.ADA
  50. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  51. ------------------------------------------------------------------
  52. --
  53. --  NAME: GKS_COORDINATE_SYSTEM
  54. --  IDENTIFIER: GIMXXX.1(1)
  55. --  DISCREPANCY REPORTS:
  56. --
  57. ------------------------------------------------------------------
  58. -- file:  gks_coor_sys.ada
  59. -- level: ma, 0a, 1a, 2a
  60.      
  61. with GKS_CONFIGURATION;
  62.      
  63. generic
  64.      
  65.    type COORDINATE_COMPONENT_TYPE is digits <>;
  66.    -- Coordinate_component_types in the system are floating point
  67.    -- values.  Values on both axes are of the same type.
  68.      
  69. package GKS_COORDINATE_SYSTEM is
  70.      
  71. -- This generic package contains the specification for the coordinate
  72. -- systems template.  It defines a Cartesian coordinate_component_type
  73. -- system for use by GKS.
  74.      
  75.    type POINT is
  76.       record
  77.          X : COORDINATE_COMPONENT_TYPE;
  78.          Y : COORDINATE_COMPONENT_TYPE;
  79.       end record;
  80.    -- Defines a point in the COORDINATE_COMPONENT_TYPE system.
  81.      
  82.    type POINT_ARRAY is array (POSITIVE range <>) of POINT;
  83.    -- Defines an array of points.
  84.      
  85.    subtype SMALL_NATURAL is NATURAL range 0..500;
  86.    -- This is a temporary subtype declaration which allows for
  87.    -- unconstrained POINT_LIST objects without causing the
  88.    -- exception STORAGE_ERROR to be raised.
  89.      
  90.    type POINT_LIST (LENGTH: SMALL_NATURAL := 0) is
  91.       record
  92.          POINTS : POINT_ARRAY (1..LENGTH);
  93.       end record;
  94.    -- This defines the point list.  The record construct with a
  95.    -- discriminant allows a user to index into a list of points
  96.    -- that is user settable.
  97.      
  98.    type VECTOR is new POINT;
  99.    -- Defines a vector in the COORDINATE_COMPONENT_TYPE system.
  100.      
  101.    type RECTANGLE_LIMITS is
  102.       record
  103.          XMIN : COORDINATE_COMPONENT_TYPE;
  104.          XMAX : COORDINATE_COMPONENT_TYPE;
  105.          YMIN : COORDINATE_COMPONENT_TYPE;
  106.          YMAX : COORDINATE_COMPONENT_TYPE;
  107.       end record;
  108.    -- Defines a rectangle in the COORDINATE_COMPONENT_TYPE system.
  109.      
  110.    type MAGNITUDE_BASE_TYPE is digits GKS_CONFIGURATION.PRECISION;
  111.    -- Defines type used to define subtype MAGNITUDE.
  112.      
  113.    subtype MAGNITUDE is MAGNITUDE_BASE_TYPE range
  114.       COORDINATE_COMPONENT_TYPE'SAFE_SMALL..
  115.          COORDINATE_COMPONENT_TYPE'SAFE_LARGE;
  116.    -- Defines the length of an object in the COORDINATE_COMPONENT_TYPE
  117.    -- system.
  118.      
  119.      
  120.    type SIZE is
  121.       record
  122.          XAXIS : MAGNITUDE;
  123.          YAXIS : MAGNITUDE;
  124.       end record;
  125.    -- Defines the size of an object in the COORDINATE_COMPONENT_TYPE
  126.    -- system as length along the X and Y axes.
  127.      
  128.    type RANGE_OF_MAGNITUDES is
  129.       record
  130.          MIN : MAGNITUDE;
  131.          MAX : MAGNITUDE;
  132.       end record;
  133.    -- Defines the extent of a rectangle in the COORDINATE_COMPONENT_TYPE
  134.    -- system parallel to the X and Y axes.
  135.      
  136. end GKS_COORDINATE_SYSTEM;
  137. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  138. --:UDD:GKSADACM:CODE:MA:GKS_MATRIX_UTILITIES.ADA
  139. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  140. ------------------------------------------------------------------
  141. --
  142. --  NAME: GKS_MATRIX_UTILITIES
  143. --  IDENTIFIER: GIMXXX.1(1)
  144. --  DISCREPANCY REPORTS:
  145. --
  146. ------------------------------------------------------------------
  147. -- file:  gks_matrix_utilities.ada
  148. -- level: ma, 0a, 1a, 2a
  149.      
  150. generic
  151.      
  152.    type ELEMENT_TYPE is private;
  153.      
  154. package GKS_MATRIX_UTILITIES is
  155.      
  156. -- The generic package declared in this file is the specification of
  157. -- a MATRIX UTILITY package which defines generic matrix types.  This
  158. -- package is instantiated by GKS_TYPES to provide matrices of colour
  159. -- and pixel colour indices for describing Cell Arrays, Pixel Arrays,
  160. -- etc.
  161.      
  162.    type MATRIX_OF is array (POSITIVE range <>, POSITIVE range <>)
  163.       of ELEMENT_TYPE;
  164.    -- This type specifies an unconstrained array to be used for
  165.    -- the matrix specification in this generic package.
  166.      
  167.    subtype SMALL_NATURAL is NATURAL range 0..500;
  168.    -- This is a temporary subtype declaration which allows for
  169.    -- unconstrained VARIABLE_MATRIX_OF objects without causing
  170.    -- the exception STORAGE_ERROR to be raised.
  171.      
  172.    type VARIABLE_MATRIX_OF (DX : SMALL_NATURAL := 0;
  173.                             DY : SMALL_NATURAL := 0)
  174.       is record
  175.          MATRIX : MATRIX_OF (1..DX, 1..DY);
  176.       end record;
  177.    -- This record type specifies a user defineable matrix by
  178.    -- using a record discriminant which establishes the upper
  179.    -- bounds of the matrix of generic types.
  180.      
  181. end GKS_MATRIX_UTILITIES;
  182. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  183. --:UDD:GKSADACM:CODE:MA:GKS_LIST_UTILITIES.ADA
  184. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  185. ------------------------------------------------------------------
  186. --
  187. --  NAME: GKS_LIST_UTILITIES
  188. --  IDENTIFIER: GIMXXX.1(1)
  189. --  DISCREPANCY REPORTS:
  190. --
  191. ------------------------------------------------------------------
  192. -- file:  gks_list_utilities.ada
  193. -- level: all levels
  194.      
  195. generic
  196.      
  197.    type ELEMENT_TYPE is private;
  198.      
  199. package GKS_LIST_UTILITIES is
  200.      
  201. -- The generic package declared in this file is the specification of
  202. -- a LIST UTILITY package which defines an unordered list type and its
  203. -- operations to support the GKS list type.  The package defines the
  204. -- LIST_OF type as private so that an implementation is free to choose
  205. -- a list type which is optimal for its strategy.
  206.      
  207.    type LIST_OF is private;
  208.      
  209.    NULL_LIST : constant LIST_OF;
  210.      
  211.    procedure ADD_TO_LIST
  212.       (ELEMENT    : in ELEMENT_TYPE;
  213.        LIST       : in out LIST_OF);
  214.      
  215.    procedure DELETE_FROM_LIST
  216.       (ELEMENT      : in ELEMENT_TYPE;
  217.        LIST         : in out LIST_OF);
  218.      
  219.    function SIZE_OF_LIST
  220.       (LIST : in LIST_OF) return NATURAL;
  221.      
  222.    function IS_IN_LIST
  223.       (ELEMENT : ELEMENT_TYPE;
  224.        LIST    : LIST_OF) return BOOLEAN;
  225.      
  226.    function LIST_ELEMENT
  227.       (I    : in POSITIVE;
  228.        LIST : in LIST_OF) return ELEMENT_TYPE;
  229.      
  230.    type LIST_VALUES is array (POSITIVE range <>) of ELEMENT_TYPE;
  231.    -- Definition of an unconstrained array of ELEMENT_TYPE.
  232.    -- Type used by applications to define an array and then
  233.    -- simply calling function LIST to initialize a list.
  234.      
  235.    function LIST
  236.       (VALUES : in LIST_VALUES) return LIST_OF;
  237.      
  238. private
  239.      
  240.    -- Lists are implemented as an access type to an array to hold
  241.    -- the components of the list.  An empty list is a null pointer.
  242.      
  243.    type LIST_OF is access LIST_VALUES;
  244.      
  245.    NULL_LIST : constant LIST_OF := null;
  246.      
  247. end GKS_LIST_UTILITIES;
  248. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  249. --:UDD:GKSADACM:CODE:MA:GKS_LIST_UTILITIES_B.ADA
  250. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  251. ------------------------------------------------------------------
  252. --
  253. --  NAME: GKS_LIST_UTILITIES - BODY
  254. --  IDENTIFIER: GIMXXX.1(1)
  255. --  DISCREPANCY REPORTS:
  256. --
  257. ------------------------------------------------------------------
  258. -- file:  gks_list_utilities_b.ada
  259. -- level: all levels
  260.      
  261. with UNCHECKED_DEALLOCATION;
  262.      
  263. package body GKS_LIST_UTILITIES is
  264.      
  265.    procedure FREE is new UNCHECKED_DEALLOCATION (LIST_VALUES, LIST_OF);
  266.      
  267.    procedure ADD_TO_LIST
  268.       (ELEMENT : in ELEMENT_TYPE;
  269.        LIST    : in out LIST_OF) is
  270.      
  271.    -- This procedure adds ELEMENT to the list pointed to by
  272.    -- LIST_OF.
  273.    --
  274.    -- ELEMENT - Item to be added to LIST.
  275.    -- LIST - A list.
  276.      
  277.       NEW_LIST  : LIST_OF;
  278.       -- Temporary object used to point to a new list.
  279.      
  280.    begin
  281.      
  282.       if LIST /= NULL_LIST then
  283.          if not IS_IN_LIST (ELEMENT, LIST) then
  284.             NEW_LIST := new LIST_VALUES'(LIST.all & ELEMENT);
  285.             FREE (LIST);
  286.             LIST := NEW_LIST;
  287.          end if;
  288.       else
  289.          LIST := new LIST_VALUES'(1 => ELEMENT);
  290.      end if;
  291.      
  292.    end ADD_TO_LIST;
  293.      
  294.    procedure DELETE_FROM_LIST
  295.       (ELEMENT   : in ELEMENT_TYPE;
  296.        LIST      : in out LIST_OF) is
  297.      
  298.    -- This procedure deletes ELEMENT from the list pointed
  299.    -- to by LIST.
  300.    --
  301.    -- ELEMENT - Item to be deleted from LIST.
  302.    -- LIST - A list.
  303.      
  304.       INDEX           : NATURAL;
  305.       -- Object used as an index into LIST.
  306.      
  307.       ITEM_FOUND      : BOOLEAN;
  308.       -- Object used to as a flag and is set to TRUE if
  309.       -- ELEMENT is found in LIST.
  310.      
  311.       NEW_LIST        : LIST_OF;
  312.       -- Temporary object used to point to a new list.
  313.      
  314.    begin
  315.      
  316.       if LIST /= NULL_LIST then
  317.          INDEX := 1;
  318.          ITEM_FOUND := FALSE;
  319.          while INDEX <= LIST'LENGTH loop
  320.             if LIST(INDEX) = ELEMENT then
  321.                ITEM_FOUND := TRUE;
  322.                exit;
  323.             end if;
  324.             INDEX := INDEX + 1;
  325.          end loop;
  326.      
  327.          if ITEM_FOUND then
  328.             if LIST'LENGTH = 1 then
  329.                FREE(LIST);
  330.                LIST := NULL_LIST;
  331.             else
  332.                NEW_LIST := new LIST_VALUES(1..LIST'LENGTH - 1);
  333.                NEW_LIST.all := LIST(1..INDEX - 1) &
  334.                                   LIST(INDEX + 1..LIST'LENGTH);
  335.                FREE (LIST);
  336.                LIST := NEW_LIST;
  337.             end if;
  338.          end if;
  339.       end if;
  340.      
  341.    end DELETE_FROM_LIST;
  342.      
  343.    function SIZE_OF_LIST
  344.       (LIST  : in LIST_OF) return NATURAL is
  345.      
  346.    -- This function returns the number of elements in the
  347.    -- list pointed to by LIST.
  348.    --
  349.    -- LIST - A list.
  350.      
  351.    begin
  352.      
  353.       if LIST = NULL_LIST then
  354.          return 0;
  355.       else
  356.          return LIST'LENGTH;
  357.       end if;
  358.      
  359.    end SIZE_OF_LIST;
  360.      
  361.    function IS_IN_LIST
  362.       (ELEMENT  : ELEMENT_TYPE;
  363.        LIST     : LIST_OF) return BOOLEAN is
  364.      
  365.    -- This function returns TRUE if ELEMENT is found in the list
  366.    -- pointed to by LIST.
  367.    --
  368.    -- ELEMENT - Item to be found in LIST.
  369.    -- LIST - A list.
  370.      
  371.    begin
  372.      
  373.       if LIST /= NULL_LIST then
  374.          for INDEX in 1..LIST'LENGTH loop
  375.             if LIST(INDEX) = ELEMENT then
  376.                return TRUE;
  377.             end if;
  378.          end loop;
  379.       end if;
  380.       return FALSE;
  381.      
  382.    end IS_IN_LIST;
  383.      
  384.    function LIST_ELEMENT
  385.       (I        : in POSITIVE;
  386.        LIST     : in LIST_OF) return ELEMENT_TYPE is
  387.      
  388.    -- This function returns the Ith element in the list pointed
  389.    -- to by LIST.
  390.    --
  391.    -- I - Element's position in LIST that will be returned.
  392.    -- LIST - A list.
  393.      
  394.       DUMMY_ELEMENT: ELEMENT_TYPE;
  395.       -- In the event an invalid position for the list is input,
  396.       -- garbage is returned.
  397.      
  398.    begin
  399.      
  400.       if LIST = NULL_LIST then
  401.          return DUMMY_ELEMENT;
  402.       elsif I <= LIST'LENGTH then
  403.          return LIST(I);
  404.       else
  405.          return DUMMY_ELEMENT;
  406.       end if;
  407.      
  408.    end LIST_ELEMENT;
  409.      
  410.    function LIST
  411.       (VALUES : in LIST_VALUES) return LIST_OF is
  412.      
  413.    -- This function creates a list using the elements from the
  414.    -- array VALUES.  A pointer to the list created is returned.
  415.    --
  416.    -- VALUES - the array to be placed in the specified list.
  417.      
  418.    begin
  419.      
  420.       if VALUES'LENGTH = 0 then
  421.          return NULL_LIST;
  422.       else
  423.          return new LIST_VALUES'(VALUES);
  424.       end if;
  425.      
  426.    end LIST;
  427.      
  428. end GKS_LIST_UTILITIES;
  429. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  430. --:UDD:GKSADACM:CODE:MA:GKS_TYPES_A.ADA
  431. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  432. ------------------------------------------------------------------
  433. --
  434. --  NAME: GKS_TYPES
  435. --  IDENTIFIER: GIMXXX.2(1)
  436. --  DISCREPANCY REPORTS:
  437. --  DR002  5-2-85  "SEGMENT_DETECTABILITY missing from GKS_TYPES"
  438. ------------------------------------------------------------------
  439. -- file:  gks_types_la.ada
  440. -- level: ma, 0a, 1a, 2a
  441.      
  442. with GKS_LIST_UTILITIES;
  443. with GKS_CONFIGURATION;
  444. with GKS_COORDINATE_SYSTEM;
  445. with GKS_MATRIX_UTILITIES;
  446.      
  447. use GKS_CONFIGURATION;
  448.      
  449. package GKS_TYPES is
  450.      
  451. -- This package contains all the data type definitions used to define
  452. -- the Ada binding to GKS.  Some of the declarations employ constant
  453. -- values in the definition.  These constant declarations are
  454. -- collected into a separate package called GKS_CONFIGURATION.
  455.      
  456.      
  457.    package SCALE_FACTOR_TYPE is
  458.      
  459.    -- This package contains the data type definition for SCALE_FACTOR.
  460.      
  461.      
  462.       -- SCALE_FACTOR                            LEVEL ma
  463.      
  464.       type SCALE_FACTOR is digits PRECISION;
  465.      
  466.       -- The type used for unitless scaling factors.
  467.      
  468.      
  469.    end SCALE_FACTOR_TYPE;
  470.      
  471.    use SCALE_FACTOR_TYPE;
  472.      
  473.    subtype SMALL_NATURAL is NATURAL range 0..500;
  474.      
  475.    -- This is a temporary subtype declaration which allows for
  476.    -- unconstrained record objects for various record types defined
  477.    -- below without causing the exception STORAGE_ERROR to
  478.    -- be raised.
  479.      
  480.      
  481.    -- ASF                                        LEVEL 0a
  482.      
  483.    type ASF is (BUNDLED,
  484.                 INDIVIDUAL);
  485.      
  486.    -- This type defines an aspect source flag whose
  487.    -- value indicates whether individual attributes
  488.    -- are to be used, or attributes as specified in
  489.    -- a bundle table.
  490.      
  491.      
  492.    -- ASF_LIST                                   LEVEL 0a
  493.      
  494.    type ASF_LIST is
  495.       record
  496.          LINETYPE                : ASF;
  497.          LINE_WIDTH              : ASF;
  498.          LINE_COLOUR             : ASF;
  499.          MARKER_TYPE             : ASF;
  500.          MARKER_SIZE             : ASF;
  501.          MARKER_COLOUR           : ASF;
  502.          TEXT_FONT_PRECISION     : ASF;
  503.          CHAR_EXPANSION          : ASF;
  504.          CHAR_SPACING            : ASF;
  505.          TEXT_COLOUR             : ASF;
  506.          INTERIOR_STYLE          : ASF;
  507.          STYLE_INDEX             : ASF;
  508.          FILL_AREA_COLOUR        : ASF;
  509.       end record;
  510.      
  511.    -- A list containing all of the aspect source flags,
  512.    -- with components indicating the specific flag.
  513.      
  514.      
  515.    -- ATTRIBUTES_FLAG                            LEVEL 0a
  516.      
  517.    type ATTRIBUTES_FLAG is (CURRENT,
  518.                             SPECIFIED);
  519.      
  520.    -- Indicates whether output attributes used are to
  521.    -- be as currently set, or as explicitly specified.
  522.      
  523.      
  524.    -- ATTRIBUTES_USED_TYPE                       LEVEL 0a
  525.      
  526.    type ATTRIBUTES_USED_TYPE is (POLYLINE_ATTRIBUTES,
  527.                                  POLYMARKER_ATTRIBUTES,
  528.                                  TEXT_ATTRIBUTES,
  529.                                  FILL_AREA_ATTRIBUTES);
  530.      
  531.    -- The types of attributes which may be used in gen-
  532.    -- erating output.
  533.      
  534.      
  535.    -- ATTRIBUTES_USED                            LEVEL 0a
  536.      
  537.    package ATTRIBUTES_USED is new GKS_LIST_UTILITIES
  538.       (ATTRIBUTES_USED_TYPE);
  539.      
  540.    -- Provides for a list of the attributes used.
  541.      
  542.    function "&" (LEFT, RIGHT: ATTRIBUTES_USED.LIST_VALUES) return
  543.       ATTRIBUTES_USED.LIST_VALUES renames ATTRIBUTES_USED."&";
  544.      
  545.      
  546.    -- CHAR_EXPANSION                             LEVEL ma
  547.      
  548.    type CHAR_EXPANSION is new SCALE_FACTOR range
  549.       SCALE_FACTOR'SAFE_SMALL..SCALE_FACTOR'LAST;
  550.      
  551.    -- Defines a character expansion factor.  Factors are unitless
  552.    -- and must be greater than zero.
  553.      
  554.      
  555.    -- CHAR_SPACING                               LEVEL ma
  556.      
  557.    type CHAR_SPACING is new SCALE_FACTOR;
  558.      
  559.    -- Defines a character spacing factor.  The factors are
  560.    -- unitless.  A positive value indicates the amount of
  561.    -- space between characters in a text string, and a
  562.    -- negative value indicates the amound of overlap between
  563.    -- characters in a text string.
  564.      
  565.      
  566.    -- CLIPPING_INDICATOR                         LEVEL ma
  567.      
  568.    type CLIPPING_INDICATOR is (CLIP,
  569.                                NOCLIP);
  570.      
  571.    -- Indicates whether or not clipping is to be performed.
  572.      
  573.      
  574.    -- COLOUR_AVAILABLE                           LEVEL ma
  575.      
  576.    type COLOUR_AVAILABLE is (COLOUR,
  577.                              MONOCHROME);
  578.      
  579.    -- Indicates whether colour output is available on
  580.    -- a workstation.
  581.      
  582.      
  583.    -- PIXEL_COLOUR_INDEX                         LEVEL 0a
  584.      
  585.    type PIXEL_COLOUR_INDEX is new INTEGER range -1..INTEGER'LAST;
  586.      
  587.    --  Represents a pixel colour where the value -1 represents an
  588.    --  invalid colour index.
  589.      
  590.      
  591.    -- COLOUR_INDEX                               LEVEL ma
  592.      
  593.    subtype COLOUR_INDEX is PIXEL_COLOUR_INDEX range
  594.       0..PIXEL_COLOUR_INDEX'LAST;
  595.      
  596.    -- Indices into colour tables are of this type.
  597.      
  598.      
  599.    -- COLOUR_INDICES                             LEVEL ma
  600.      
  601.    package COLOUR_INDICES is new GKS_LIST_UTILITIES (COLOUR_INDEX);
  602.      
  603.    -- Provides for a list of colour indices which are available
  604.    -- on a particular workstation.
  605.      
  606.    function "&" (LEFT, RIGHT: COLOUR_INDICES.LIST_VALUES) return
  607.       COLOUR_INDICES.LIST_VALUES renames COLOUR_INDICES."&";
  608.      
  609.      
  610.    -- COLOUR_MATRICES                            LEVEL ma
  611.      
  612.    package COLOUR_MATRICES is new GKS_MATRIX_UTILITIES (COLOUR_INDEX);
  613.      
  614.    -- Provides for matrices containing colour indices corresponding
  615.    -- to a cell array or a pattern array.
  616.      
  617.      
  618.    -- INTENSITY                                  LEVEL ma
  619.      
  620.    type INTENSITY is digits PRECISION range 0.0..1.0;
  621.      
  622.    -- Defines the range of possible intensities of a colour.
  623.      
  624.      
  625.    -- COLOUR_REPRESENTATION                      LEVEL ma
  626.      
  627.    type COLOUR_REPRESENTATION is
  628.       record
  629.          RED   : INTENSITY;
  630.          GREEN : INTENSITY;
  631.          BLUE  : INTENSITY;
  632.       end record;
  633.      
  634.    -- Defines the representation of a colour as a
  635.    -- combination of intensities in an RGB colour system.
  636.      
  637.      
  638.    -- CONNECTION_ID                              LEVEL ma
  639.      
  640.    subtype CONNECTION_ID is string;
  641.      
  642.    -- Defines the type for a connection identifier.  The
  643.    -- string must correspond to an external device or
  644.    -- file as defined by the GKS implementation.
  645.      
  646.      
  647.    -- CONTROL_FLAG                               LEVEL ma
  648.      
  649.    type CONTROL_FLAG is (CONDITIONALLY,
  650.                          ALWAYS);
  651.      
  652.    -- The control flag is used to indicate the conditions
  653.    -- under which the display surface should be cleared.
  654.      
  655.      
  656.    -- DC_TYPE                                    LEVEL ma
  657.      
  658.    type DC_TYPE is digits PRECISION;
  659.      
  660.    -- The type of a coordinate in the Device Coordinate
  661.    -- System.
  662.      
  663.      
  664.    -- DC                                         LEVEL ma
  665.      
  666.    package DC is new GKS_COORDINATE_SYSTEM (DC_TYPE);
  667.      
  668.    -- Defines the Device Coordinate System.
  669.      
  670.    function "=" (LEFT, RIGHT: DC.POINT) return BOOLEAN
  671.       renames DC."=";
  672.      
  673.    function "&" (LEFT, RIGHT: DC.POINT_ARRAY) return
  674.       DC.POINT_ARRAY renames DC."&";
  675.      
  676.    function "=" (LEFT, RIGHT: DC.VECTOR) return BOOLEAN
  677.       renames DC."=";
  678.      
  679.    function "=" (LEFT, RIGHT: DC.RECTANGLE_LIMITS) return BOOLEAN
  680.       renames DC."=";
  681.      
  682.    function "=" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  683.       renames DC."=";
  684.      
  685.    function "<" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  686.       renames DC."<";
  687.      
  688.    function "<=" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  689.       renames DC."<=";
  690.      
  691.    function ">" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  692.       renames DC.">";
  693.      
  694.    function ">=" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  695.       renames DC.">=";
  696.      
  697.    function "+" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return
  698.       DC.MAGNITUDE_BASE_TYPE renames DC."+";
  699.      
  700.    function "-" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return
  701.       DC.MAGNITUDE_BASE_TYPE renames DC."-";
  702.      
  703.    function "*" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return
  704.       DC.MAGNITUDE_BASE_TYPE renames DC."*";
  705.      
  706.    function "/" (LEFT, RIGHT: DC.MAGNITUDE_BASE_TYPE) return
  707.       DC.MAGNITUDE_BASE_TYPE renames DC."/";
  708.      
  709.    function "=" (LEFT, RIGHT: DC.SIZE) return BOOLEAN
  710.       renames DC."=";
  711.      
  712.    function "=" (LEFT, RIGHT: DC.RANGE_OF_MAGNITUDES) return BOOLEAN
  713.       renames DC."=";
  714.      
  715.      
  716.    -- DC_UNITS                                   LEVEL ma
  717.      
  718.    type DC_UNITS is (METRES,
  719.                      OTHER);
  720.      
  721.    -- Device coordinate units for a particular workstation
  722.    -- may be in meters, or some other unit (such as inches).
  723.      
  724.      
  725.    -- DEFERRAL_MODE                              LEVEL 0a
  726.      
  727.    type DEFERRAL_MODE is (ASAP,
  728.                           BNIG,
  729.                           BNIL,
  730.                           ASTI);
  731.      
  732.    -- Defines the GKS deferral modes.
  733.      
  734.      
  735.    -- DISPLAY_CLASS                              LEVEL 0a
  736.      
  737.    type DISPLAY_CLASS is (VECTOR_DISPLAY,
  738.                           RASTER_DISPLAY,
  739.                           OTHER_DISPLAY);
  740.      
  741.    -- The classification of a workstation of category OUTPUT or OUTIN.
  742.      
  743.      
  744.    -- DISPLAY_SURFACE_EMPTY                      LEVEL 0a
  745.      
  746.    type DISPLAY_SURFACE_EMPTY is (EMPTY,
  747.                                   NOTEMPTY);
  748.      
  749.    -- Indicates whether the display surface is empty.
  750.      
  751.      
  752.    -- DYNAMIC_MODIFICATION                       LEVEL 1a
  753.      
  754.    type DYNAMIC_MODIFICATION is (IRG,
  755.                                  IMM);
  756.      
  757.    -- Indicates whether an update to the state list is per-
  758.    -- formed immediately (IMM) or is implicitly regenerated
  759.    -- (IRG).
  760.      
  761.      
  762.    -- ERROR_FILE_TYPE                            LEVEL ma
  763.      
  764.    subtype ERROR_FILE_TYPE is STRING;
  765.      
  766.    -- Defines the type for error file specification.  The
  767.    -- name used must conform to an external file name as
  768.    -- defined for the host system implementation.
  769.      
  770.      
  771.    -- ERROR_INDICATOR                            LEVEL ma
  772.      
  773.    type ERROR_INDICATOR is new INTEGER;
  774.      
  775.    -- Defines the type for error indicator values.
  776.      
  777.      
  778.    -- FILL_AREA_INDEX                            LEVEL 0a
  779.      
  780.    type FILL_AREA_INDEX is new POSITIVE;
  781.      
  782.    -- Defines the type for fill area bundle table indices.
  783.      
  784.      
  785.    -- FILL_AREA_INDICES                          LEVEL 0a
  786.      
  787.    package FILL_AREA_INDICES is new GKS_LIST_UTILITIES
  788.       (FILL_AREA_INDEX);
  789.      
  790.    -- Provides for list of fill area bundle table indices.
  791.      
  792.    function "&" (LEFT, RIGHT: FILL_AREA_INDICES.LIST_VALUES) return
  793.       FILL_AREA_INDICES.LIST_VALUES renames FILL_AREA_INDICES."&";
  794.      
  795.      
  796.    -- GDP_ID                                     LEVEL 0a
  797.      
  798.    type GDP_ID is new INTEGER;
  799.      
  800.    -- Defines a type for selecting a Generalized Drawing Primitive.
  801.      
  802.      
  803.    -- GDP_IDS                                    LEVEL 0a
  804.      
  805.    package GDP_IDS is new GKS_LIST_UTILITIES (GDP_ID);
  806.      
  807.    -- Provides for lists of Generalized Drawing Primitive ID's.
  808.      
  809.    function "&" (LEFT, RIGHT: GDP_IDS.LIST_VALUES) return
  810.       GDP_IDS.LIST_VALUES renames GDP_IDS."&";
  811.      
  812.      
  813.    -- GKS_LEVEL                                  LEVEL ma
  814.      
  815.    type GKS_LEVEL is (Lma,
  816.                       Lmb,
  817.                       Lmc,
  818.                       L0a,
  819.                       L0b,
  820.                       L0c,
  821.                       L1a,
  822.                       L1b,
  823.                       L1c,
  824.                       L2a,
  825.                       L2b,
  826.                       L2c);
  827.      
  828.    -- The valid Levels of GKS.
  829.      
  830.      
  831.    -- GKSM_ITEM_TYPE                             LEVEL 0a
  832.      
  833.    type GKSM_ITEM_TYPE is new NATURAL;
  834.      
  835.    -- The type of an item contained in a GKSM metafile.
  836.      
  837.      
  838.    -- STYLE_INDEX                                LEVEL 0a
  839.      
  840.    type STYLE_INDEX is new INTEGER;
  841.      
  842.    -- Defines a fill area style index.
  843.      
  844.      
  845.    -- HATCH_STYLE                                LEVEL ma
  846.      
  847.    subtype HATCH_STYLE is STYLE_INDEX;
  848.      
  849.    -- Defines the fill area hatch styles type.
  850.      
  851.      
  852.    -- HATCH_STYLES                               LEVEL ma
  853.      
  854.    package HATCH_STYLES is new GKS_LIST_UTILITIES (HATCH_STYLE);
  855.      
  856.    -- Provides for a list of hatch styles.
  857.      
  858.    function "&" (LEFT, RIGHT: HATCH_STYLES.LIST_VALUES) return
  859.       HATCH_STYLES.LIST_VALUES renames HATCH_STYLES."&";
  860.      
  861.      
  862.    -- HORIZONTAL_ALIGNMENT                       LEVEL ma
  863.      
  864.    type HORIZONTAL_ALIGNMENT is (NORMAL,
  865.                                  LEFT,
  866.                                  CENTRE,
  867.                                  RIGHT);
  868.      
  869.    -- The alignment of the text extent rectangle with
  870.    -- respect to the horizontal positioning of the text.
  871.      
  872.      
  873.    -- INTERIOR_STYLE                             LEVEL ma
  874.      
  875.    type INTERIOR_STYLE is (HOLLOW,
  876.                            SOLID,
  877.                            PATTERN,
  878.                            HATCH);
  879.      
  880.    -- Defines the fill area interior styles.
  881.      
  882.      
  883.    -- INTERIOR_STYLES                            LEVEL ma
  884.      
  885.    package INTERIOR_STYLES is new GKS_LIST_UTILITIES (INTERIOR_STYLE);
  886.      
  887.    -- Provides for lists of interior styles.
  888.      
  889.    function "&" (LEFT, RIGHT: INTERIOR_STYLES.LIST_VALUES) return
  890.       INTERIOR_STYLES.LIST_VALUES renames INTERIOR_STYLES."&";
  891.      
  892.      
  893.    -- INVALID_VALUES_INDICATOR                   LEVEL 0a
  894.      
  895.    type INVALID_VALUES_INDICATOR is (ABSENT,
  896.                                      PRESENT);
  897.      
  898.    -- Indicates whether invalid values are contained
  899.    -- in a pixel array or matrix.
  900.      
  901.      
  902.    -- LINETYPE                                   LEVEL ma
  903.      
  904.    type LINETYPE is new INTEGER;
  905.      
  906.    -- Defines the types of line styles provided by GKS.
  907.      
  908.      
  909.    -- LINE_WIDTH                                 LEVEL ma
  910.      
  911.    type LINE_WIDTH is new SCALE_FACTOR
  912.       range 0.0..SCALE_FACTOR'LAST;
  913.      
  914.    -- The width of a line is indicated by a scale factor.
  915.      
  916.      
  917.    -- LINETYPES                                  LEVEL ma
  918.      
  919.    package LINETYPES is new GKS_LIST_UTILITIES (LINETYPE);
  920.      
  921.    -- Provides for lists of line types.
  922.      
  923.    function "&" (LEFT, RIGHT: LINETYPES.LIST_VALUES) return
  924.       LINETYPES.LIST_VALUES renames LINETYPES."&";
  925.      
  926.      
  927.    -- MARKER_TYPE                                LEVEL ma
  928.      
  929.    type MARKER_TYPE is new INTEGER;
  930.      
  931.    -- Defines the type for markers provided by GKS.
  932.      
  933.      
  934.    -- MARKER_SIZE                                LEVEL ma
  935.      
  936.    type MARKER_SIZE is new SCALE_FACTOR
  937.       range 0.0..SCALE_FACTOR'LAST;
  938.      
  939.    -- The size of a marker is indicated by a scale factor.
  940.      
  941.      
  942.    -- MARKER_TYPES                               LEVEL ma
  943.      
  944.    package MARKER_TYPES is new GKS_LIST_UTILITIES (MARKER_TYPE);
  945.      
  946.    -- Provides for lists of marker types.
  947.      
  948.    function "&" (LEFT, RIGHT: MARKER_TYPES.LIST_VALUES) return
  949.       MARKER_TYPES.LIST_VALUES renames MARKER_TYPES."&";
  950.      
  951.      
  952.    -- MEMORY_UNITS                               LEVEL ma
  953.      
  954.    type MEMORY_UNITS is range 0..MAX_MEMORY_UNITS;
  955.      
  956.    -- Defines the type of the units of memory that may be
  957.    -- allocated for GKS.
  958.      
  959.      
  960.    -- NDC_TYPE                                   LEVEL ma
  961.      
  962.    type NDC_TYPE is digits PRECISION;
  963.      
  964.    -- Defines the type of a coordinate in the Normalized
  965.    -- Device Coordinate System.
  966.      
  967.      
  968.    -- NDC                                        LEVEL ma
  969.      
  970.    package NDC is new GKS_COORDINATE_SYSTEM (NDC_TYPE);
  971.      
  972.    -- Defines the Normalized Device Coordinate System.
  973.      
  974.    function "=" (LEFT, RIGHT: NDC.POINT) return BOOLEAN
  975.       renames NDC."=";
  976.      
  977.    function "&" (LEFT, RIGHT: NDC.POINT_ARRAY) return
  978.       NDC.POINT_ARRAY renames NDC."&";
  979.      
  980.    function "=" (LEFT, RIGHT: NDC.VECTOR) return BOOLEAN
  981.       renames NDC."=";
  982.      
  983.    function "=" (LEFT, RIGHT: NDC.RECTANGLE_LIMITS) return BOOLEAN
  984.       renames NDC."=";
  985.      
  986.    function "=" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  987.       renames NDC."=";
  988.      
  989.    function "<" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  990.       renames NDC."<";
  991.      
  992.    function "<=" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  993.       renames NDC."<=";
  994.      
  995.    function ">" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  996.       renames NDC.">";
  997.      
  998.    function ">=" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  999.       renames NDC.">=";
  1000.      
  1001.    function "+" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return
  1002.       NDC.MAGNITUDE_BASE_TYPE renames NDC."+";
  1003.      
  1004.    function "-" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return
  1005.       NDC.MAGNITUDE_BASE_TYPE renames NDC."-";
  1006.      
  1007.    function "*" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return
  1008.       NDC.MAGNITUDE_BASE_TYPE renames NDC."*";
  1009.      
  1010.    function "/" (LEFT, RIGHT: NDC.MAGNITUDE_BASE_TYPE) return
  1011.       NDC.MAGNITUDE_BASE_TYPE renames NDC."/";
  1012.      
  1013.    function "=" (LEFT, RIGHT: NDC.SIZE) return BOOLEAN
  1014.       renames NDC."=";
  1015.      
  1016.    function "=" (LEFT, RIGHT: NDC.RANGE_OF_MAGNITUDES) return BOOLEAN
  1017.       renames NDC."=";
  1018.      
  1019.      
  1020.    -- NEW_FRAME_NECESSARY                        LEVEL 0a
  1021.      
  1022.    type NEW_FRAME_NECESSARY is (NO,
  1023.                                 YES);
  1024.      
  1025.    -- Indicates whether a new frame action is necessary at
  1026.    -- update.
  1027.      
  1028.      
  1029.    -- OPERATING_STATE                            LEVEL 0a
  1030.      
  1031.    type OPERATING_STATE is (GKCL,
  1032.                             GKOP,
  1033.                             WSOP,
  1034.                             WSAC,
  1035.                             SGOP);
  1036.      
  1037.    -- Defines the five GKS operating states.
  1038.      
  1039.      
  1040.    -- PATTERN_INDEX                              LEVEL 0a
  1041.      
  1042.    subtype PATTERN_INDEX is STYLE_INDEX range 1..STYLE_INDEX'LAST;
  1043.      
  1044.    -- Defines the range of pattern table indices.
  1045.      
  1046.      
  1047.    -- PATTERN_INDICES                            LEVEL 0a
  1048.      
  1049.    package PATTERN_INDICES is new GKS_LIST_UTILITIES (PATTERN_INDEX);
  1050.      
  1051.    -- Provides for lists of pattern table indices.
  1052.      
  1053.    function "&" (LEFT, RIGHT: PATTERN_INDICES.LIST_VALUES) return
  1054.       PATTERN_INDICES.LIST_VALUES renames PATTERN_INDICES."&";
  1055.      
  1056.      
  1057.    -- PIXEL_COLOUR_MATRICES                      LEVEL 0a
  1058.      
  1059.    package PIXEL_COLOUR_MATRICES is new GKS_MATRIX_UTILITIES
  1060.       (PIXEL_COLOUR_INDEX);
  1061.      
  1062.    -- Provides for variable sized matrices of pixel colours.
  1063.      
  1064.      
  1065.    -- POLYLINE_INDEX                             LEVEL 0a
  1066.      
  1067.    type POLYLINE_INDEX is new POSITIVE;
  1068.      
  1069.    -- Defines the range of polyline indices.
  1070.      
  1071.      
  1072.    -- POLYLINE_INDICES                           LEVEL 0a
  1073.      
  1074.    package POLYLINE_INDICES is new GKS_LIST_UTILITIES (POLYLINE_INDEX);
  1075.      
  1076.    -- Provides for lists of polyline indices.
  1077.      
  1078.    function "&" (LEFT, RIGHT: POLYLINE_INDICES.LIST_VALUES) return
  1079.       POLYLINE_INDICES.LIST_VALUES renames POLYLINE_INDICES."&";
  1080.      
  1081.      
  1082.    -- POLYMARKER_INDEX                           LEVEL 0a
  1083.      
  1084.    type POLYMARKER_INDEX is new POSITIVE;
  1085.      
  1086.    -- Defines the range of polymarker bundle table indices.
  1087.      
  1088.      
  1089.    -- POLYMARKER_INDICES                         LEVEL 0a
  1090.      
  1091.    package POLYMARKER_INDICES is new GKS_LIST_UTILITIES
  1092.       (POLYMARKER_INDEX);
  1093.      
  1094.    -- Provides for lists of polymarker indices.
  1095.      
  1096.    function "&" (LEFT, RIGHT: POLYMARKER_INDICES.LIST_VALUES) return
  1097.       POLYMARKER_INDICES.LIST_VALUES renames POLYMARKER_INDICES."&";
  1098.      
  1099.      
  1100.    -- RADIANS                                    LEVEL 1a
  1101.      
  1102.    type RADIANS is digits PRECISION;
  1103.      
  1104.    -- Values used in performing segment transformations
  1105.    -- (rotation angle).  Positive indicates an anticlock-
  1106.    -- wise direction.
  1107.      
  1108.      
  1109.    -- RANGE_OF_EXPANSIONS                        LEVEL 0a
  1110.      
  1111.    type RANGE_OF_EXPANSIONS is
  1112.       record
  1113.          MIN : CHAR_EXPANSION;
  1114.          MAX : CHAR_EXPANSION;
  1115.       end record;
  1116.      
  1117.    -- Provides a ramge of character expansion factors.
  1118.      
  1119.      
  1120.    -- RASTER_UNITS                               LEVEL ma
  1121.      
  1122.    type RASTER_UNITS is new POSITIVE;
  1123.      
  1124.    -- Defines the range of raster units.
  1125.      
  1126.      
  1127.    -- RASTER_UNIT_SIZE                           LEVEL ma
  1128.      
  1129.    type RASTER_UNIT_SIZE is
  1130.       record
  1131.          X : RASTER_UNITS;
  1132.          Y : RASTER_UNITS;
  1133.       end record;
  1134.      
  1135.    -- Defines the size of an object in raster units on a raster device.
  1136.      
  1137.      
  1138.    -- REGENERATION_MODE                          LEVEL 0a
  1139.      
  1140.    type REGENERATION_MODE is (SUPPRESSED,
  1141.                               ALLOWED);
  1142.      
  1143.    -- Indicates whether implicit regeneration of the display is
  1144.    -- suppressed or allowed.
  1145.      
  1146.      
  1147.    -- RELATIVE_PRIORITY                          LEVEL ma
  1148.      
  1149.    type RELATIVE_PRIORITY is (HIGHER,
  1150.                               LOWER);
  1151.      
  1152.    -- Indicates the relative priority between two normalization
  1153.    -- transformations.
  1154.      
  1155.      
  1156.    -- RETURN_VALUE_TYPE                          LEVEL ma
  1157.      
  1158.    type RETURN_VALUE_TYPE is (SET,
  1159.                               REALIZED);
  1160.      
  1161.    -- Indicates whether the returned values should be as
  1162.    -- they were set by the program or as they were actually
  1163.    -- realized on the device.
  1164.      
  1165.      
  1166.    -- SEGMENT_DETECTABILITY                      LEVEL 1a
  1167.      
  1168.    type SEGMENT_DETECTABILITY is (UNDETECTABLE,
  1169.                                   DETECTABLE);
  1170.      
  1171.    -- Indicates whether a segment is detectable or not.
  1172.      
  1173.      
  1174.    -- SEGMENT_HIGHLIGHTING                       LEVEL 1a
  1175.      
  1176.    type SEGMENT_HIGHLIGHTING is (NORMAL,
  1177.                                  HIGHLIGHTED);
  1178.      
  1179.    -- Indicates whether a segment is highlighted or not.
  1180.      
  1181.      
  1182.    -- SEGMENT_NAME                               LEVEL 1a
  1183.      
  1184.    type SEGMENT_NAME is new POSITIVE;
  1185.      
  1186.    --  Defines the range of segment names.
  1187.      
  1188.      
  1189.    -- SEGMENT_NAMES                              LEVEL 1a
  1190.      
  1191.    package SEGMENT_NAMES is new GKS_LIST_UTILITIES (SEGMENT_NAME);
  1192.      
  1193.    -- Provides for lists of segment names.
  1194.      
  1195.    function "&" (LEFT, RIGHT: SEGMENT_NAMES.LIST_VALUES) return
  1196.       SEGMENT_NAMES.LIST_VALUES renames SEGMENT_NAMES."&";
  1197.      
  1198.      
  1199.    -- SEGMENT_PRIORITY                           LEVEL 1a
  1200.      
  1201.    type SEGMENT_PRIORITY is digits PRECISION range 0.0..1.0;
  1202.      
  1203.    --  Defines the priority of a segment.
  1204.      
  1205.      
  1206.    -- SEGMENT_VISIBILITY                         LEVEL 1a
  1207.      
  1208.    type SEGMENT_VISIBILITY is (VISIBLE,
  1209.                                INVISIBLE);
  1210.      
  1211.    -- Indicates whether a segment is visible or not.
  1212.      
  1213.      
  1214.    -- SUBPROGRAM_NAME                            LEVEL ma
  1215.      
  1216.    subtype SUBPROGRAM_NAME is STRING;
  1217.      
  1218.    -- Defines the name of a GKS function detecting an error.
  1219.      
  1220.      
  1221.    -- VERTICAL_ALIGNMENT                         LEVEL ma
  1222.      
  1223.    type VERTICAL_ALIGNMENT is (NORMAL,
  1224.                                TOP,
  1225.                                CAP,
  1226.                                HALF,
  1227.                                BASE,
  1228.                                BOTTOM);
  1229.      
  1230.    -- The alignment of the text extent parallelogram with
  1231.    -- respect to the vertical positioning of the text.
  1232.      
  1233.      
  1234.    -- TEXT_ALIGNMENT                             LEVEL ma
  1235.      
  1236.    type TEXT_ALIGNMENT is
  1237.       record
  1238.          HORIZONTAL : HORIZONTAL_ALIGNMENT;
  1239.          VERTICAL   : VERTICAL_ALIGNMENT;
  1240.       end record;
  1241.      
  1242.    -- The type of the attribute controlling the positioning
  1243.    -- of the text extent parallelogram in relation to the text
  1244.    -- position, having horizontal and vertical components as
  1245.    -- defined above.
  1246.      
  1247.      
  1248.    -- WC_TYPE                                    LEVEL ma
  1249.      
  1250.    type WC_TYPE is digits PRECISION;
  1251.      
  1252.    --  Defines the range of accuracy for World Coordinate types.
  1253.      
  1254.      
  1255.    -- WC                                         LEVEL ma
  1256.      
  1257.    package WC is new GKS_COORDINATE_SYSTEM (WC_TYPE);
  1258.      
  1259.    -- Defines the World Coordinate System.
  1260.      
  1261.    function "=" (LEFT, RIGHT: WC.POINT) return BOOLEAN
  1262.       renames WC."=";
  1263.      
  1264.    function "&" (LEFT, RIGHT: WC.POINT_ARRAY) return
  1265.       WC.POINT_ARRAY renames WC."&";
  1266.      
  1267.    function "=" (LEFT, RIGHT: WC.VECTOR) return BOOLEAN
  1268.       renames WC."=";
  1269.      
  1270.    function "=" (LEFT, RIGHT: WC.RECTANGLE_LIMITS) return BOOLEAN
  1271.       renames WC."=";
  1272.      
  1273.    function "=" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1274.       renames WC."=";
  1275.      
  1276.    function "<" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1277.       renames WC."<";
  1278.      
  1279.    function "<=" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1280.       renames WC."<=";
  1281.      
  1282.    function ">" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1283.       renames WC.">";
  1284.      
  1285.    function ">=" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return BOOLEAN
  1286.       renames WC.">=";
  1287.      
  1288.    function "+" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return
  1289.       WC.MAGNITUDE_BASE_TYPE renames WC."+";
  1290.      
  1291.    function "-" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return
  1292.       WC.MAGNITUDE_BASE_TYPE renames WC."-";
  1293.      
  1294.    function "*" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return
  1295.       WC.MAGNITUDE_BASE_TYPE renames WC."*";
  1296.      
  1297.    function "/" (LEFT, RIGHT: WC.MAGNITUDE_BASE_TYPE) return
  1298.       WC.MAGNITUDE_BASE_TYPE renames WC."/";
  1299.      
  1300.    function "=" (LEFT, RIGHT: WC.SIZE) return BOOLEAN
  1301.       renames WC."=";
  1302.      
  1303.    function "=" (LEFT, RIGHT: WC.RANGE_OF_MAGNITUDES) return BOOLEAN
  1304.       renames WC."=";
  1305.      
  1306.      
  1307.    -- TEXT_EXTENT_PARALLELOGRAM                  LEVEL ma
  1308.      
  1309.    type TEXT_EXTENT_PARALLELOGRAM is
  1310.       record
  1311.          LOWER_LEFT  : WC.POINT;
  1312.          LOWER_RIGHT : WC.POINT;
  1313.          UPPER_LEFT  : WC.POINT;
  1314.          UPPER_RIGHT : WC.POINT;
  1315.       end record;
  1316.      
  1317.    -- Defines the corner points of the text extent parallelogram
  1318.    -- with respect to the vertical positioning of the text.
  1319.      
  1320.      
  1321.    -- TEXT_FONT                                  LEVEL ma
  1322.      
  1323.    type TEXT_FONT is new INTEGER;
  1324.      
  1325.    -- Defines the types of fonts provided by the implementation.
  1326.      
  1327.      
  1328.      
  1329.    -- TEXT_PRECISION                             LEVEL ma
  1330.      
  1331.    type TEXT_PRECISION is (STRING_PRECISION,
  1332.                            CHAR_PRECISION,
  1333.                            STROKE_PRECISION);
  1334.      
  1335.    -- The precision with which text appears.
  1336.      
  1337.    -- TEXT_FONT_PRECISION                        LEVEL ma
  1338.      
  1339.    type TEXT_FONT_PRECISION is
  1340.       record
  1341.          FONT      : TEXT_FONT;
  1342.          PRECISION : TEXT_PRECISION;
  1343.       end record;
  1344.      
  1345.    -- This type defines a record describing the text font and
  1346.    -- precision aspect.
  1347.      
  1348.      
  1349.    -- TEXT_FONT_PRECISIONS                       LEVEL ma
  1350.      
  1351.    package TEXT_FONT_PRECISIONS is new GKS_LIST_UTILITIES
  1352.       (TEXT_FONT_PRECISION);
  1353.      
  1354.    --  Provides for lists of text font and precision pairs.
  1355.      
  1356.    function "&" (LEFT, RIGHT: TEXT_FONT_PRECISIONS.LIST_VALUES) return
  1357.       TEXT_FONT_PRECISIONS.LIST_VALUES renames
  1358.          TEXT_FONT_PRECISIONS."&";
  1359.      
  1360.      
  1361.    -- TEXT_INDEX                                 LEVEL 0a
  1362.      
  1363.    type TEXT_INDEX is new POSITIVE;
  1364.      
  1365.    -- Defines the range of text bundle table indices.
  1366.      
  1367.      
  1368.    -- TEXT_INDICES                               LEVEL 0a
  1369.      
  1370.    package TEXT_INDICES is new GKS_LIST_UTILITIES (TEXT_INDEX);
  1371.      
  1372.    -- Provides for lists of text indices.
  1373.      
  1374.    function "&" (LEFT, RIGHT: TEXT_INDICES.LIST_VALUES) return
  1375.       TEXT_INDICES.LIST_VALUES renames TEXT_INDICES."&";
  1376.      
  1377.      
  1378.    -- TEXT_PATH                                  LEVEL ma
  1379.      
  1380.    type TEXT_PATH is (RIGHT,
  1381.                       LEFT,
  1382.                       UP,
  1383.                       DOWN);
  1384.      
  1385.    --  The direction taken by a text string.
  1386.      
  1387.      
  1388.    -- TRANSFORMATION_FACTOR                      LEVEL 1a
  1389.      
  1390.    type TRANSFORMATION_FACTOR is
  1391.       record
  1392.          X : NDC_TYPE;
  1393.          Y : NDC_TYPE;
  1394.       end record;
  1395.      
  1396.    -- Scale factors used in building transformation
  1397.    -- matrices for performing segment transformations.
  1398.      
  1399.      
  1400.    -- TRANSFORMATION_MATRIX                      LEVEL 1a
  1401.      
  1402.    type TRANSFORMATION_MATRIX is array (1..2, 1..3) of NDC_TYPE;
  1403.      
  1404.    -- For segment transformation mapping within NDC space.
  1405.      
  1406.      
  1407.    -- TRANSFORMATION_NUMBER                      LEVEL ma
  1408.      
  1409.    type TRANSFORMATION_NUMBER is new NATURAL;
  1410.      
  1411.    -- A normalization transformation number.
  1412.      
  1413.      
  1414.    -- TRANSFORMATION_PRIORITY_ARRAY              LEVEL ma
  1415.      
  1416.    type TRANSFORMATION_PRIORITY_ARRAY is array (POSITIVE range <>) of
  1417.       TRANSFORMATION_NUMBER;
  1418.      
  1419.    -- Defines the type to store transformation numbers.
  1420.      
  1421.      
  1422.    -- TRANSFORMATION_PRIORITY_LIST               LEVEL ma
  1423.      
  1424.    type TRANSFORMATION_PRIORITY_LIST (LENGTH : SMALL_NATURAL := 0) is
  1425.       record
  1426.          CONTENTS : TRANSFORMATION_PRIORITY_ARRAY (1..LENGTH);
  1427.       end record;
  1428.      
  1429.    -- Provides for a prioritized list of transformation numbers.
  1430.      
  1431.      
  1432.    -- UPDATE_REGENERATION_FLAG                   LEVEL 0a
  1433.      
  1434.    type UPDATE_REGENERATION_FLAG is (PERFORM,
  1435.                                      POSTPONE);
  1436.      
  1437.    -- Flag indicating regeneration action on display.
  1438.      
  1439.      
  1440.    -- UPDATE_STATE                               LEVEL ma
  1441.      
  1442.    type UPDATE_STATE is (NOTPENDING,
  1443.                          PENDING);
  1444.      
  1445.    -- Indicates whether or not a workstation transformation
  1446.    -- change has been requested and not yet provided.
  1447.      
  1448.      
  1449.    -- VARIABLE_CONNECTION_ID                     LEVEL ma
  1450.      
  1451.    type VARIABLE_CONNECTION_ID (LENGTH : SMALL_NATURAL := 0) is
  1452.       record
  1453.          CONNECT : CONNECTION_ID (1..LENGTH);
  1454.       end record;
  1455.      
  1456.    -- Defines a variable length connection id for INQ_WS_CONNECTION_
  1457.    -- AND_TYPE.
  1458.      
  1459.      
  1460.    -- VARIABLE_SUBPROGRAM_NAME                   LEVEL ma
  1461.      
  1462.    type VARIABLE_SUBPROGRAM_NAME (LENGTH : SMALL_NATURAL := 0) is
  1463.       record
  1464.          CONTENTS : SUBPROGRAM_NAME (1..LENGTH);
  1465.       end record;
  1466.      
  1467.    -- Defines a variable length subprogram name.
  1468.      
  1469.      
  1470.    -- WS_CATEGORY                                LEVEL 0a
  1471.      
  1472.    type WS_CATEGORY is (OUTPUT,
  1473.                         INPUT,
  1474.                         OUTIN,
  1475.                         WISS,
  1476.                         MO,
  1477.                         MI);
  1478.      
  1479.    -- Type for GKS workstation categories.
  1480.      
  1481.      
  1482.    -- WS_ID                                      LEVEL ma
  1483.      
  1484.    type WS_ID is new POSITIVE;
  1485.      
  1486.    -- Defines the range of workstation identifiers.
  1487.      
  1488.      
  1489.    -- WS_IDS                                     LEVEL ma
  1490.      
  1491.    package WS_IDS is new GKS_LIST_UTILITIES (WS_ID);
  1492.      
  1493.    -- Provides for lists of workstation identifiers.
  1494.      
  1495.    function "&" (LEFT, RIGHT: WS_IDS.LIST_VALUES) return
  1496.       WS_IDS.LIST_VALUES renames WS_IDS."&";
  1497.      
  1498.      
  1499.    -- WS_STATE                                   LEVEL 0a
  1500.      
  1501.    type WS_STATE is (INACTIVE,
  1502.                      ACTIVE);
  1503.      
  1504.    -- The state of a workstation.
  1505.      
  1506.      
  1507.    -- WS_TYPE                                    LEVEL ma
  1508.      
  1509.    type WS_TYPE is range 1..MAX_WS_TYPE;
  1510.      
  1511.    -- Range of values corresponding to valid workstation
  1512.    -- types.  Constants specifying names for the various
  1513.    -- types of workstations should be provided by an
  1514.    -- implementation in the GKS_CONFIGURATION package.
  1515.      
  1516.      
  1517.    -- WS_TYPES                                   LEVEL 0a
  1518.      
  1519.    package WS_TYPES is new GKS_LIST_UTILITIES (WS_TYPE);
  1520.      
  1521.    -- Provides for lists of workstation types.
  1522.      
  1523.    function "&" (LEFT, RIGHT: WS_TYPES.LIST_VALUES) return
  1524.       WS_TYPES.LIST_VALUES renames WS_TYPES."&";
  1525.      
  1526.    -- INDIVIDUAL_ATTRIBUTE_VALUES
  1527.      
  1528.    type INDIVIDUAL_ATTRIBUTE_VALUES is
  1529.       record
  1530.          CURRENT_LINETYPE          :  LINETYPE;
  1531.          CURRENT_LINE_WIDTH        :  LINE_WIDTH;
  1532.          CURRENT_POLYLINE_COLOUR   :  COLOUR_INDEX;
  1533.          CURRENT_MARKER_TYPE       :  MARKER_TYPE;
  1534.          CURRENT_POLYMARKER_SIZE   :  MARKER_SIZE;
  1535.          CURRENT_POLYMARKER_COLOUR :  COLOUR_INDEX;
  1536.          CURRENT_FONT_PRECISION    :  TEXT_FONT_PRECISION;
  1537.          CURRENT_CHAR_EXPANSION    :  CHAR_EXPANSION;
  1538.          CURRENT_CHAR_SPACING      :  CHAR_SPACING;
  1539.          CURRENT_TEXT_COLOUR       :  COLOUR_INDEX;
  1540.          CURRENT_INTERIOR_STYLE    :  INTERIOR_STYLE;
  1541.          CURRENT_STYLE_INDEX       :  STYLE_INDEX;
  1542.          CURRENT_FILL_AREA_COLOUR  :  COLOUR_INDEX;
  1543.          CURRENT_ASF_LIST          :  ASF_LIST;
  1544.       end record;
  1545.      
  1546.    -- A record containing all of the current individual
  1547.    -- attributes.
  1548.      
  1549.      
  1550.    -- PRIMITIVE_ATTRIBUTE_VALUES
  1551.      
  1552.    type PRIMITIVE_ATTRIBUTE_VALUES is
  1553.       record
  1554.          CURRENT_POLYLINE_INDEX          :  POLYLINE_INDEX;
  1555.          CURRENT_POLYMARKER_INDEX        :  POLYMARKER_INDEX;
  1556.          CURRENT_TEXT_INDEX              :  TEXT_INDEX;
  1557.          CURRENT_CHAR_HEIGHT             :  WC.MAGNITUDE;
  1558.          CURRENT_CHAR_UP_VECTOR          :  WC.VECTOR;
  1559.          CURRENT_CHAR_WIDTH              :  WC.MAGNITUDE;
  1560.          CURRENT_CHAR_BASE_VECTOR        :  WC.VECTOR;
  1561.          CURRENT_TEXT_PATH               :  TEXT_PATH;
  1562.          CURRENT_TEXT_ALIGNMENT          :  TEXT_ALIGNMENT;
  1563.          CURRENT_FILL_AREA_INDEX         :  FILL_AREA_INDEX;
  1564.          CURRENT_PATTERN_WIDTH_VECTOR    :  WC.VECTOR;
  1565.          CURRENT_PATTERN_HEIGHT_VECTOR   :  WC.VECTOR;
  1566.          CURRENT_PATTERN_REFERENCE_POINT :  WC.POINT;
  1567.       end record;
  1568.      
  1569.    -- A record containing all of the current primitive
  1570.    -- attributes.
  1571.      
  1572.      
  1573.    -- The following exceptions correspond to the classes of
  1574.    -- errors defined by the GKS specification.  Each of these
  1575.    -- exceptions cover one or more error numbers.
  1576.      
  1577.    ESCAPE_ERROR                   : exception;
  1578.      
  1579.    IMPLEMENTATION_DEPENDENT_ERROR : exception;
  1580.      
  1581.    INPUT_ERROR                    : exception;
  1582.      
  1583.    LANGUAGE_BINDING_ERROR         : exception;
  1584.      
  1585.    METAFILE_ERROR                 : exception;
  1586.      
  1587.    MISC_ERROR                     : exception;
  1588.      
  1589.    OUTPUT_ATTRIBUTE_ERROR         : exception;
  1590.      
  1591.    OUTPUT_PRIMITIVE_ERROR         : exception;
  1592.      
  1593.    SEGMENT_ERROR                  : exception;
  1594.      
  1595.    STATE_ERROR                    : exception;
  1596.      
  1597.    SYSTEM_ERROR                   : exception;
  1598.      
  1599.    TRANSFORMATION_ERROR           : exception;
  1600.      
  1601.    WS_ERROR                       : exception;
  1602.      
  1603. end GKS_TYPES;
  1604. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1605. --:UDD:GKSADACM:CODE:MA:SET_INDV_ATTR_MA.ADA
  1606. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1607. ------------------------------------------------------------------
  1608. --
  1609. --  NAME: SET_INDIVIDUAL_ATTRIBUTES_MA
  1610. --  IDENTIFIER: GIMXXX.1(1)
  1611. --  DISCREPANCY REPORTS:
  1612. --
  1613. ------------------------------------------------------------------
  1614. -- file:  set_indv_attr_ma.ada
  1615. -- level: all levels
  1616.      
  1617. with GKS_TYPES;
  1618.      
  1619. use GKS_TYPES;
  1620.      
  1621. package SET_INDIVIDUAL_ATTRIBUTES_MA is
  1622.      
  1623. -- This package provides the functions for setting the individual
  1624. -- attributes for output primitives.
  1625.      
  1626.    procedure SET_LINETYPE
  1627.       (LINE : in LINETYPE);
  1628.      
  1629.    procedure SET_POLYLINE_COLOUR_INDEX
  1630.       (COLOUR : in COLOUR_INDEX);
  1631.      
  1632.    procedure SET_MARKER_TYPE
  1633.       (MARKER : in MARKER_TYPE);
  1634.      
  1635.    procedure SET_POLYMARKER_COLOUR_INDEX
  1636.       (COLOUR : in COLOUR_INDEX);
  1637.      
  1638.    procedure SET_TEXT_COLOUR_INDEX
  1639.       (COLOUR : in COLOUR_INDEX);
  1640.      
  1641.    procedure SET_FILL_AREA_INTERIOR_STYLE
  1642.       (STYLE : in INTERIOR_STYLE);
  1643.      
  1644.    procedure SET_FILL_AREA_COLOUR_INDEX
  1645.       (COLOUR : in COLOUR_INDEX);
  1646.      
  1647. end SET_INDIVIDUAL_ATTRIBUTES_MA;
  1648. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1649. --:UDD:GKSADACM:CODE:MA:SET_PRIM_ATTR_MA.ADA
  1650. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1651. ------------------------------------------------------------------
  1652. --
  1653. --  NAME: SET_PRIMITIVE_ATTRIBUTES_MA
  1654. --  IDENTIFIER: GIMXXX.1(1)
  1655. --  DISCREPANCY REPORTS:
  1656. --
  1657. ------------------------------------------------------------------
  1658. -- file:  set_prim_attr_ma.ada
  1659. -- level: all levels
  1660.      
  1661. with GKS_TYPES;
  1662.      
  1663. use GKS_TYPES;
  1664.      
  1665. package SET_PRIMITIVE_ATTRIBUTES_MA is
  1666.      
  1667. -- This package provides the procedures for setting the
  1668. -- primitive attribute values for level ma.
  1669.      
  1670.    procedure SET_CHAR_HEIGHT
  1671.       (HEIGHT : in WC.MAGNITUDE);
  1672.      
  1673.    procedure SET_CHAR_UP_VECTOR
  1674.       (CHAR_UP_VECTOR : IN WC.VECTOR);
  1675.      
  1676.    procedure SET_TEXT_ALIGNMENT
  1677.       (ALIGNMENT : in TEXT_ALIGNMENT);
  1678.      
  1679. end SET_PRIMITIVE_ATTRIBUTES_MA;
  1680. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1681. --:UDD:GKSADACM:CODE:MA:INQ_PRIM_ATTR.ADA
  1682. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1683. ------------------------------------------------------------------
  1684. --
  1685. --  NAME: INQ_PRIMITIVE_ATTRIBUTES
  1686. --  IDENTIFIER: GIMXXX.1(1)
  1687. --  DISCREPANCY REPORTS:
  1688. --
  1689. ------------------------------------------------------------------
  1690. -- file:  inq_prim_attr.ada
  1691. -- level: all levels
  1692.      
  1693. with GKS_TYPES;
  1694.      
  1695. use GKS_TYPES;
  1696.      
  1697. package INQ_PRIMITIVE_ATTRIBUTES is
  1698.      
  1699. -- This package provides the procedures for inquiring the
  1700. -- primitive attribute values.  These procedures are a result
  1701. -- of the one-to-many mapping of the GKS procedure Inquire
  1702. -- Current Primitive Attribute Values.  In addition, a procedure
  1703. -- INQ_CURRENT_PRIMITIVE_ATTRIBUTE_VALUES is included that is a
  1704. -- one-to-one mapping of the GKS procedure to allow the application
  1705. -- to inquire all of the primitive attributes in one call.
  1706.      
  1707.    procedure INQ_CHAR_HEIGHT
  1708.       (EI    : out ERROR_INDICATOR;
  1709.       HEIGHT : out WC.MAGNITUDE);
  1710.      
  1711.    procedure INQ_CHAR_UP_VECTOR
  1712.       (EI    : out ERROR_INDICATOR;
  1713.       VECTOR : out WC.VECTOR);
  1714.      
  1715.    procedure INQ_TEXT_PATH
  1716.       (EI  : out ERROR_INDICATOR;
  1717.       PATH : out TEXT_PATH);
  1718.      
  1719.    procedure INQ_TEXT_ALIGNMENT
  1720.       (EI       : out ERROR_INDICATOR;
  1721.       ALIGNMENT : out TEXT_ALIGNMENT);
  1722.      
  1723.    procedure INQ_PATTERN_REFERENCE_POINT
  1724.       (EI             : out ERROR_INDICATOR;
  1725.       REFERENCE_POINT : out WC.POINT);
  1726.      
  1727.    procedure INQ_PATTERN_HEIGHT_VECTOR
  1728.       (EI    : out ERROR_INDICATOR;
  1729.       VECTOR : out WC.VECTOR);
  1730.      
  1731.    procedure INQ_PATTERN_WIDTH_VECTOR
  1732.       (EI   : out ERROR_INDICATOR;
  1733.       WIDTH : out WC.VECTOR);
  1734.      
  1735.    procedure INQ_CHAR_WIDTH
  1736.       (EI   : out ERROR_INDICATOR;
  1737.       WIDTH : out WC.MAGNITUDE);
  1738.      
  1739.    procedure INQ_CHAR_BASE_VECTOR
  1740.       (EI    : out ERROR_INDICATOR;
  1741.       VECTOR : out WC.VECTOR);
  1742.      
  1743.    procedure INQ_CURRENT_PRIMITIVE_ATTRIBUTE_VALUES
  1744.       (EI         : out ERROR_INDICATOR;
  1745.        ATTRIBUTES : out PRIMITIVE_ATTRIBUTE_VALUES);
  1746.      
  1747. end INQ_PRIMITIVE_ATTRIBUTES;
  1748. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1749. --:UDD:GKSADACM:CODE:MA:INQ_BUNDLE_IDX.ADA
  1750. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1751. ------------------------------------------------------------------
  1752. --
  1753. --  NAME: INQ_BUNDLE_INDICES
  1754. --  IDENTIFIER: GDMXXX.1(1)
  1755. --  DISCREPANCY REPORTS:
  1756. --
  1757. ------------------------------------------------------------------
  1758. -- file:  inq_bundle_idx.ada
  1759. -- level: all levels
  1760.      
  1761. with GKS_TYPES;
  1762.      
  1763. use GKS_TYPES;
  1764.      
  1765. package INQ_BUNDLE_INDICES is
  1766.      
  1767. -- This package provides the procedures for setting the
  1768. -- bundled primitive attributes.
  1769.      
  1770.    procedure INQ_POLYLINE_INDEX
  1771.       (EI   : out ERROR_INDICATOR;
  1772.       INDEX : out POLYLINE_INDEX);
  1773.      
  1774.    procedure INQ_POLYMARKER_INDEX
  1775.       (EI   : out ERROR_INDICATOR;
  1776.       INDEX : out POLYMARKER_INDEX);
  1777.      
  1778.    procedure INQ_FILL_AREA_INDEX
  1779.       (EI   : out ERROR_INDICATOR;
  1780.       INDEX : out FILL_AREA_INDEX);
  1781.      
  1782.    procedure INQ_TEXT_INDEX
  1783.       (EI   : out ERROR_INDICATOR;
  1784.       INDEX : out TEXT_INDEX);
  1785.      
  1786. end INQ_BUNDLE_INDICES;
  1787. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1788. --:UDD:GKSADACM:CODE:MA:INQ_INDV_ATTR.ADA
  1789. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1790. ------------------------------------------------------------------
  1791. --
  1792. --  NAME: INQ_INDIVIDUAL_ATTRIBUTES
  1793. --  IDENTIFIER: GIMXXX.1(1)
  1794. --  DISCREPANCY REPORTS:
  1795. --
  1796. ------------------------------------------------------------------
  1797. -- file:  inq_indv_attr.ada
  1798. -- level: all levels
  1799.      
  1800. with GKS_TYPES;
  1801.      
  1802. use GKS_TYPES;
  1803.      
  1804. package INQ_INDIVIDUAL_ATTRIBUTES is
  1805.      
  1806. -- This package provides the procedures for inquiring the current
  1807. -- individual attribute values.  These procedures are a result of
  1808. -- the one-to-many mapping of the GKS function Inquire Current
  1809. -- Individual Attribute Values.  In addition, this package includes
  1810. -- a procedure INQ_CURRENT_INDIVIDUAL_ATTRIBUTE_VALUES that is a
  1811. -- one-to-one mapping of the GKS function.  This allows the application
  1812. -- to inquire all of the individual attributes in a single call.
  1813.      
  1814.    procedure INQ_LINETYPE
  1815.       (EI  : out ERROR_INDICATOR;
  1816.       LINE : out LINETYPE);
  1817.      
  1818.    procedure INQ_LINEWIDTH_SCALE_FACTOR
  1819.       (EI   : out ERROR_INDICATOR;
  1820.       WIDTH : out LINE_WIDTH);
  1821.      
  1822.    procedure INQ_POLYLINE_COLOUR_INDEX
  1823.       (EI    : out ERROR_INDICATOR;
  1824.       COLOUR : out COLOUR_INDEX);
  1825.      
  1826.    procedure INQ_POLYMARKER_TYPE
  1827.       (EI    : out ERROR_INDICATOR;
  1828.       MARKER : out MARKER_TYPE);
  1829.      
  1830.    procedure INQ_POLYMARKER_SIZE_SCALE_FACTOR
  1831.       (EI  : out ERROR_INDICATOR;
  1832.       SIZE : out MARKER_SIZE);
  1833.      
  1834.    procedure INQ_POLYMARKER_COLOUR_INDEX
  1835.       (EI    : out ERROR_INDICATOR;
  1836.       COLOUR : out COLOUR_INDEX);
  1837.      
  1838.    procedure INQ_TEXT_FONT_AND_PRECISION
  1839.       (EI            : out ERROR_INDICATOR;
  1840.       FONT_PRECISION : out TEXT_FONT_PRECISION);
  1841.      
  1842.    procedure INQ_CHAR_EXPANSION_FACTOR
  1843.       (EI       : out ERROR_INDICATOR;
  1844.       EXPANSION : out CHAR_EXPANSION);
  1845.      
  1846.    procedure INQ_CHAR_SPACING
  1847.       (EI     : out ERROR_INDICATOR;
  1848.       SPACING : out CHAR_SPACING);
  1849.      
  1850.    procedure INQ_TEXT_COLOUR_INDEX
  1851.       (EI    : out ERROR_INDICATOR;
  1852.       COLOUR : out COLOUR_INDEX);
  1853.      
  1854.    procedure INQ_FILL_AREA_INTERIOR_STYLE
  1855.       (EI   : out ERROR_INDICATOR;
  1856.       STYLE : out INTERIOR_STYLE);
  1857.      
  1858.    procedure INQ_FILL_AREA_STYLE_INDEX
  1859.       (EI   : out ERROR_INDICATOR;
  1860.       INDEX : out STYLE_INDEX);
  1861.      
  1862.    procedure INQ_FILL_AREA_COLOUR_INDEX
  1863.       (EI    : out ERROR_INDICATOR;
  1864.       COLOUR : out COLOUR_INDEX);
  1865.      
  1866.    procedure INQ_LIST_OF_ASF
  1867.       (EI  : out ERROR_INDICATOR;
  1868.       LIST : out ASF_LIST);
  1869.      
  1870.    procedure INQ_CURRENT_INDIVIDUAL_ATTRIBUTE_VALUES
  1871.       (EI         : out ERROR_INDICATOR;
  1872.       ATTRIBUTES  : out INDIVIDUAL_ATTRIBUTE_VALUES);
  1873.      
  1874. end INQ_INDIVIDUAL_ATTRIBUTES;
  1875. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1876. --:UDD:GKSADACM:CODE:0A:GKS_NORM_0A.ADA
  1877. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1878. ------------------------------------------------------------------
  1879. --
  1880. --  NAME: GKS_NORMALIZATION - BODY
  1881. --  IDENTIFIER: GIMXXX.1(2)
  1882. --  DISCREPANCY REPORTS:
  1883. --  DR028  Normalization of primitive attributes.
  1884. ------------------------------------------------------------------
  1885. -- file:  gks_norm.ada
  1886. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  1887.      
  1888. with GKS_TYPES;
  1889.      
  1890. use GKS_TYPES;
  1891.      
  1892. package GKS_NORMALIZATION is
  1893.      
  1894. -- This package provides the normalization transformation
  1895. -- procedures for GKS.
  1896.      
  1897.    procedure SET_WINDOW
  1898.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  1899.       WINDOW_LIMITS   : in WC.RECTANGLE_LIMITS);
  1900.      
  1901.    procedure SET_VIEWPORT
  1902.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  1903.       VIEWPORT_LIMITS : in NDC.RECTANGLE_LIMITS);
  1904.      
  1905.    procedure SELECT_NORMALIZATION_TRANSFORMATION
  1906.       (TRANSFORMATION : in TRANSFORMATION_NUMBER);
  1907.      
  1908.    procedure SET_CLIPPING_INDICATOR
  1909.       (CLIPPING : in CLIPPING_INDICATOR);
  1910.      
  1911. end GKS_NORMALIZATION;
  1912. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1913. --:UDD:GKSADACM:CODE:MA:WS_XFORM.ADA
  1914. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1915. ------------------------------------------------------------------
  1916. --
  1917. --  NAME: WS_TRANSFORMATION
  1918. --  IDENTIFIER: GDMXXX.1(1)
  1919. --  DISCREPANCY REPORTS:
  1920. --
  1921. ------------------------------------------------------------------
  1922. -- file:  ws_xform.ada
  1923. -- level: all levels
  1924.      
  1925. with GKS_TYPES;
  1926.      
  1927. use GKS_TYPES;
  1928.      
  1929. package WS_TRANSFORMATION is
  1930.      
  1931. -- This package provides the procedures for calling the
  1932. -- workstation manager to do the workstation transformations.
  1933.      
  1934.    procedure SET_WS_WINDOW
  1935.       (WS              : in WS_ID;
  1936.       WS_WINDOW_LIMITS : in NDC.RECTANGLE_LIMITS);
  1937.      
  1938.    procedure SET_WS_VIEWPORT
  1939.       (WS                : in WS_ID;
  1940.       WS_VIEWPORT_LIMITS : in DC.RECTANGLE_LIMITS);
  1941.      
  1942. end WS_TRANSFORMATION;
  1943. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1944. --:UDD:GKSADACM:CODE:MA:INQ_GKS_ST_LST_MA.ADA
  1945. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1946. ------------------------------------------------------------------
  1947. --
  1948. --  NAME: INQ_GKS_STATE_LIST_MA
  1949. --  IDENTIFIER: GIMXXX.1(1)
  1950. --  DISCREPANCY REPORTS:
  1951. --
  1952. ------------------------------------------------------------------
  1953. -- file:  inq_gks_st_lst_ma.ada
  1954. -- level: all levels
  1955.      
  1956. with GKS_TYPES;
  1957.      
  1958. use GKS_TYPES;
  1959.      
  1960. package INQ_GKS_STATE_LIST_MA is
  1961.      
  1962. -- This package provides the inquiry procedures for inquiring
  1963. -- values of the GKS_STATE_LIST.
  1964.      
  1965.    procedure INQ_CURRENT_NORMALIZATION_TRANSFORMATION_NUMBER
  1966.       (EI            : out ERROR_INDICATOR;
  1967.       TRANSFORMATION : out TRANSFORMATION_NUMBER);
  1968.      
  1969.    procedure INQ_NORMALIZATION_TRANSFORMATION
  1970.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  1971.       EI              : out ERROR_INDICATOR;
  1972.       WINDOW_LIMITS   : out WC.RECTANGLE_LIMITS;
  1973.       VIEWPORT_LIMITS : out NDC.RECTANGLE_LIMITS);
  1974.      
  1975.    procedure INQ_CLIPPING
  1976.       (EI                : out ERROR_INDICATOR;
  1977.       CLIPPING           : out CLIPPING_INDICATOR;
  1978.       CLIPPING_RECTANGLE : out NDC.RECTANGLE_LIMITS);
  1979.      
  1980. end INQ_GKS_STATE_LIST_MA;
  1981. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1982. --:UDD:GKSADACM:CODE:MA:INQ_GKS_DSCR_TBL_MA.ADA
  1983. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  1984. ------------------------------------------------------------------
  1985. --
  1986. --  NAME: INQ_GKS_DESCRIPTION_TABLE_MA
  1987. --  IDENTIFIER: GIMXXX.1(1)
  1988. --  DISCREPANCY REPORTS:
  1989. --
  1990. ------------------------------------------------------------------
  1991. -- file:  inq_gks_dscr_tbl_ma.ada
  1992. -- level: all levels
  1993.      
  1994. with GKS_TYPES;
  1995.      
  1996. use GKS_TYPES;
  1997.      
  1998. package INQ_GKS_DESCRIPTION_TABLE_MA is
  1999.      
  2000. -- This package provides the inquiry procedures for inquiring
  2001. -- values of the GKS description table.
  2002.      
  2003.    procedure INQ_LEVEL_OF_GKS
  2004.       (EI   : out ERROR_INDICATOR;
  2005.       LEVEL : out GKS_LEVEL);
  2006.      
  2007. end INQ_GKS_DESCRIPTION_TABLE_MA;
  2008. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2009. --:UDD:GKSADACM:CODE:MA:INQ_WS_ST_LST_MA.ADA
  2010. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2011. ------------------------------------------------------------------
  2012. --
  2013. --  NAME: INQ_WS_STATE_LIST_MA
  2014. --  IDENTIFIER: GIMXXX.1(1)
  2015. --  DISCREPANCY REPORTS:
  2016. --
  2017. ------------------------------------------------------------------
  2018. -- file:  inq_ws_st_lst_ma.ada
  2019. -- level: all levels
  2020.      
  2021. with GKS_TYPES;
  2022.      
  2023. use GKS_TYPES;
  2024.      
  2025. package INQ_WS_STATE_LIST_MA is
  2026.      
  2027. -- This package provides the procedures for calling the
  2028. -- workstation manager to inquire the workstation state list.
  2029.      
  2030.    procedure INQ_WS_CONNECTION_AND_TYPE
  2031.       (WS        : in WS_ID;
  2032.       EI         : out ERROR_INDICATOR;
  2033.       CONNECTION : out VARIABLE_CONNECTION_ID;
  2034.       TYPE_OF_WS : out WS_TYPE);
  2035.      
  2036.    procedure INQ_TEXT_EXTENT
  2037.       (WS                 : in WS_ID;
  2038.       POSITION            : in WC.POINT;
  2039.       CHAR_STRING         : in STRING;
  2040.       EI                  : out ERROR_INDICATOR;
  2041.       CONCATENATION_POINT : out WC.POINT;
  2042.       TEXT_EXTENT         : out TEXT_EXTENT_PARALLELOGRAM);
  2043.      
  2044.    procedure INQ_LIST_OF_COLOUR_INDICES
  2045.       (WS     : in WS_ID;
  2046.       EI      : out ERROR_INDICATOR;
  2047.       INDICES : out COLOUR_INDICES.LIST_OF);
  2048.      
  2049.    procedure INQ_COLOUR_REPRESENTATION
  2050.       (WS             : in WS_ID;
  2051.       INDEX           : in COLOUR_INDEX;
  2052.       RETURNED_VALUES : in RETURN_VALUE_TYPE;
  2053.       EI              : out ERROR_INDICATOR;
  2054.       COLOUR          : out COLOUR_REPRESENTATION);
  2055.      
  2056.    procedure INQ_WS_TRANSFORMATION
  2057.       (WS                : in WS_ID;
  2058.       EI                 : out ERROR_INDICATOR;
  2059.       UPDATE             : out UPDATE_STATE;
  2060.       REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  2061.       CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  2062.       REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  2063.       CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS);
  2064.      
  2065. end INQ_WS_STATE_LIST_MA;
  2066. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2067. --:UDD:GKSADACM:CODE:MA:INQ_WS_DSCR_TBL_MA.ADA
  2068. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2069. ------------------------------------------------------------------
  2070. --
  2071. --  NAME: INQ_WS_DESCRIPTION_TABLE_MA
  2072. --  IDENTIFIER: GIMXXX.1(1)
  2073. --  DISCREPANCY REPORTS:
  2074. --
  2075. ------------------------------------------------------------------
  2076. -- file:  inq_ws_dscr_tbl_ma.ada
  2077. -- level: all levels
  2078.      
  2079. with GKS_TYPES;
  2080.      
  2081. use GKS_TYPES;
  2082.      
  2083. package INQ_WS_DESCRIPTION_TABLE_MA is
  2084.      
  2085. -- This package provides the functions for calling the workstation
  2086. -- manager to inquire the workstation description tables for level ma.
  2087.      
  2088.    procedure INQ_DISPLAY_SPACE_SIZE
  2089.       (WS                  : in WS_TYPE;
  2090.       EI                   : out ERROR_INDICATOR;
  2091.       UNITS                : out DC_UNITS;
  2092.       MAX_DC_SIZE          : out DC.SIZE;
  2093.       MAX_RASTER_UNIT_SIZE : out RASTER_UNIT_SIZE);
  2094.      
  2095.    procedure INQ_POLYLINE_FACILITIES
  2096.       (WS               : in WS_TYPE;
  2097.       EI                : out ERROR_INDICATOR;
  2098.       LIST_OF_TYPES     : out LINETYPES.LIST_OF;
  2099.       NUMBER_OF_WIDTHS  : out NATURAL;
  2100.       NOMINAL_WIDTH     : out DC.MAGNITUDE;
  2101.       RANGE_OF_WIDTHS   : out DC.RANGE_OF_MAGNITUDES;
  2102.       NUMBER_OF_INDICES : out NATURAL);
  2103.      
  2104.    procedure INQ_POLYMARKER_FACILITIES
  2105.       (WS               : in WS_TYPE;
  2106.       EI                : out ERROR_INDICATOR;
  2107.       LIST_OF_TYPES     : out MARKER_TYPES.LIST_OF;
  2108.       NUMBER_OF_SIZES   : out NATURAL;
  2109.       NOMINAL_SIZE      : out DC.MAGNITUDE;
  2110.       RANGE_OF_SIZES    : out DC.RANGE_OF_MAGNITUDES;
  2111.       NUMBER_OF_INDICES : out NATURAL);
  2112.      
  2113.    procedure INQ_TEXT_FACILITIES
  2114.       (WS                  : in WS_TYPE;
  2115.       EI                   : out ERROR_INDICATOR;
  2116.       LIST_OF_FONT_PRECISION_PAIRS: out TEXT_FONT_PRECISIONS.LIST_OF;
  2117.       NUMBER_OF_HEIGHTS    : out NATURAL;
  2118.       RANGE_OF_HEIGHTS     : out DC.RANGE_OF_MAGNITUDES;
  2119.       NUMBER_OF_EXPANSIONS : out NATURAL;
  2120.       EXPANSION_RANGE      : out RANGE_OF_EXPANSIONS;
  2121.       NUMBER_OF_INDICES    : out NATURAL);
  2122.      
  2123.    procedure INQ_FILL_AREA_FACILITIES
  2124.       (WS                     : WS_TYPE;
  2125.       EI                      : out ERROR_INDICATOR;
  2126.       LIST_OF_INTERIOR_STYLES : out INTERIOR_STYLES.LIST_OF;
  2127.       LIST_OF_HATCH_STYLES    : out HATCH_STYLES.LIST_OF;
  2128.       NUMBER_OF_INDICES       : out NATURAL);
  2129.      
  2130.    procedure INQ_COLOUR_FACILITIES
  2131.       (WS                      : in WS_TYPE;
  2132.       EI                       : out ERROR_INDICATOR;
  2133.       NUMBER_OF_COLOURS        : out NATURAL;
  2134.       AVAILABLE_COLOUR         : out COLOUR_AVAILABLE;
  2135.       NUMBER_OF_COLOUR_INDICES : out NATURAL);
  2136.      
  2137.    procedure INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  2138.       (WS                    : in WS_TYPE;
  2139.       EI                     : out ERROR_INDICATOR;
  2140.       MAX_POLYLINE_ENTRIES   : out NATURAL;
  2141.       MAX_POLYMARKER_ENTRIES : out NATURAL;
  2142.       MAX_TEXT_ENTRIES       : out NATURAL;
  2143.       MAX_FILL_AREA_ENTRIES  : out NATURAL;
  2144.       MAX_PATTERN_INDICES    : out NATURAL;
  2145.       MAX_COLOUR_INDICES     : out NATURAL);
  2146.      
  2147. end INQ_WS_DESCRIPTION_TABLE_MA;
  2148. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2149. --:UDD:GKSADACM:CODE:MA:SET_CLR_TBL.ADA
  2150. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2151. ------------------------------------------------------------------
  2152. --
  2153. --  NAME: SET_COLOUR_TABLE
  2154. --  IDENTIFIER: GIMXXX.1(1)
  2155. --  DISCREPANCY REPORTS:
  2156. --
  2157. ------------------------------------------------------------------
  2158. -- file:  set_clr_tbl.ada
  2159. -- level: all levels
  2160.      
  2161. with GKS_TYPES;
  2162.      
  2163. use GKS_TYPES;
  2164.      
  2165. package SET_COLOUR_TABLE is
  2166.      
  2167. -- This package provides the procedures for calling the workstation
  2168. -- manager to set the workstation attributes at level ma.
  2169.      
  2170.    procedure SET_COLOUR_REPRESENTATION
  2171.       (WS    : in WS_ID;
  2172.       INDEX  : in COLOUR_INDEX;
  2173.       COLOUR : in COLOUR_REPRESENTATION);
  2174.      
  2175. end SET_COLOUR_TABLE;
  2176. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2177. --:UDD:GKSADACM:CODE:MA:GKS_CONTROL.ADA
  2178. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2179. ------------------------------------------------------------------
  2180. --
  2181. --  NAME: GKS_CONTROL
  2182. --  IDENTIFIER: GIMXXX.1(1)
  2183. --  DISCREPANCY REPORTS:
  2184. --
  2185. ------------------------------------------------------------------
  2186. -- file:  gks_control.ada
  2187. -- level: all levels
  2188.      
  2189. with GKS_TYPES;
  2190. with GKS_CONFIGURATION;
  2191.      
  2192. use GKS_TYPES;
  2193.      
  2194. package GKS_CONTROL is
  2195.      
  2196. -- This package provides the functions for GKS
  2197. -- control.
  2198.      
  2199.    procedure OPEN_GKS
  2200.       (ERROR_FILE       : in ERROR_FILE_TYPE :=
  2201.                           GKS_CONFIGURATION.DEFAULT_ERROR_FILE;
  2202.       AMOUNT_OF_MEMORY  : in MEMORY_UNITS :=
  2203.                           GKS_CONFIGURATION.MAX_MEMORY_UNITS);
  2204.      
  2205.    procedure CLOSE_GKS;
  2206.      
  2207. end GKS_CONTROL;
  2208. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2209. --:UDD:GKSADACM:CODE:MA:WS_CONTROL.ADA
  2210. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2211. ------------------------------------------------------------------
  2212. --
  2213. --  NAME: WS_CONTROL
  2214. --  IDENTIFIER: GIMXXX.1(1)
  2215. --  DISCREPANCY REPORTS:
  2216. --
  2217. ------------------------------------------------------------------
  2218. -- file:  ws_control.ada
  2219. -- level: all levels
  2220.      
  2221. with GKS_TYPES;
  2222.      
  2223. use GKS_TYPES;
  2224.      
  2225. package WS_CONTROL is
  2226.      
  2227. -- This package provides the workstation control functions.
  2228.      
  2229.    procedure OPEN_WS
  2230.       (WS         : in WS_ID;
  2231.        CONNECTION : in CONNECTION_ID;
  2232.        TYPE_OF_WS : in WS_TYPE);
  2233.      
  2234.    procedure CLOSE_WS
  2235.       (WS : in WS_ID);
  2236.      
  2237.    procedure ACTIVATE_WS
  2238.       (WS : in WS_ID);
  2239.      
  2240.    procedure DEACTIVATE_WS
  2241.       (WS : in WS_ID);
  2242.      
  2243.    procedure CLEAR_WS
  2244.       (WS  : in WS_ID;
  2245.       FLAG : in CONTROL_FLAG);
  2246.      
  2247.    procedure UPDATE_WS
  2248.       (WS           : in WS_ID;
  2249.       REGENERATION  : in UPDATE_REGENERATION_FLAG);
  2250.      
  2251. end WS_CONTROL;
  2252. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2253. --:UDD:GKSADACM:CODE:MA:OUT_PRIM.ADA
  2254. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2255. ------------------------------------------------------------------
  2256. --
  2257. --  NAME: OUTPUT_PRIMITIVES
  2258. --  IDENTIFIER: GIMXXX.1(1)
  2259. --  DISCREPANCY REPORTS:
  2260. --
  2261. ------------------------------------------------------------------
  2262. -- file:  out_prim.ada
  2263. -- level: all levels
  2264.      
  2265. with GKS_TYPES;
  2266.      
  2267. use GKS_TYPES;
  2268.      
  2269. package OUTPUT_PRIMITIVES is
  2270.      
  2271. -- This package provides the level ma output primitive functions.
  2272.      
  2273.    procedure POLYLINE
  2274.       (LINE_POINTS : in WC.POINT_ARRAY);
  2275.      
  2276.    procedure POLYMARKER
  2277.       (MARKER_POINTS : in WC.POINT_ARRAY);
  2278.      
  2279.    procedure FILL_AREA
  2280.       (FILL_AREA_POINTS : in WC.POINT_ARRAY);
  2281.      
  2282.    procedure TEXT
  2283.       (POSITION   : in WC.POINT;
  2284.       TEXT_STRING : in STRING);
  2285.      
  2286. end OUTPUT_PRIMITIVES;
  2287. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2288. --:UDD:GKSADACM:CODE:MA:OUT_ATTR_TYP.ADA
  2289. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2290. ------------------------------------------------------------------
  2291. --
  2292. --  NAME: OUTPUT_ATTRIBUTES_TYPE
  2293. --  IDENTIFIER: GDMXXX.1(1)
  2294. --  DISCREPANCY REPORTS:
  2295. --
  2296. ------------------------------------------------------------------
  2297. -- file: OUT_ATTR_TYP.ADA
  2298. -- level: ma, 0a, 1a, 2a
  2299.      
  2300. with GKS_TYPES;
  2301.      
  2302. use GKS_TYPES;
  2303.      
  2304. package OUTPUT_ATTRIBUTES_TYPE is
  2305.      
  2306. -- A grouping of all attributes which affect the display of output
  2307. -- primitives.
  2308.      
  2309.    type OUTPUT_ATTRIBUTES is record
  2310.      
  2311.       ASPECT_SOURCE_FLAGS                  : ASF_LIST;
  2312.      
  2313.       -- polyline attributes
  2314.      
  2315.       CURRENT_POLYLINE_INDEX               : POLYLINE_INDEX;
  2316.       CURRENT_LINETYPE                     : LINETYPE;
  2317.       CURRENT_LINEWIDTH_SCALE_FACTOR       : LINE_WIDTH;
  2318.       CURRENT_POLYLINE_COLOUR_INDEX        : COLOUR_INDEX;
  2319.      
  2320.       -- polymarker attributes
  2321.      
  2322.       CURRENT_POLYMARKER_INDEX             : POLYMARKER_INDEX;
  2323.       CURRENT_MARKER_TYPE                  : MARKER_TYPE;
  2324.       CURRENT_MARKER_SIZE_SCALE_FACTOR     : MARKER_SIZE;
  2325.       CURRENT_POLYMARKER_COLOUR_INDEX      : COLOUR_INDEX;
  2326.      
  2327.       -- text attributes
  2328.      
  2329.       CURRENT_TEXT_INDEX                   : TEXT_INDEX;
  2330.       CURRENT_TEXT_FONT_AND_PRECISION      : TEXT_FONT_PRECISION;
  2331.       CURRENT_CHAR_EXPANSION_FACTOR        : CHAR_EXPANSION;
  2332.       CURRENT_CHAR_SPACING                 : CHAR_SPACING;
  2333.       CURRENT_TEXT_COLOUR_INDEX            : COLOUR_INDEX;
  2334.      
  2335.       -- the following text attributes are not bundlable.
  2336.      
  2337.       CURRENT_CHAR_HEIGHT_VECTOR           : NDC.VECTOR;
  2338.       CURRENT_CHAR_WIDTH_VECTOR            : NDC.VECTOR;
  2339.       CURRENT_TEXT_PATH                    : TEXT_PATH;
  2340.       CURRENT_TEXT_ALIGNMENT               : TEXT_ALIGNMENT;
  2341.      
  2342.       -- fill area attributes.
  2343.      
  2344.       CURRENT_FILL_AREA_INDEX              : FILL_AREA_INDEX;
  2345.       CURRENT_FILL_AREA_INTERIOR_STYLE     : INTERIOR_STYLE;
  2346.       CURRENT_FILL_AREA_STYLE_INDEX        : STYLE_INDEX;
  2347.       CURRENT_FILL_AREA_COLOUR_INDEX       : COLOUR_INDEX;
  2348.      
  2349.       -- pattern attributes for pattern fills.
  2350.      
  2351.       CURRENT_PATTERN_WIDTH_VECTOR         : NDC.VECTOR;
  2352.       CURRENT_PATTERN_HEIGHT_VECTOR        : NDC.VECTOR;
  2353.       CURRENT_PATTERN_REFERENCE_POINT      : NDC.POINT;
  2354.      
  2355.       -- used for clipping to NDC space. The points are the lower left
  2356.       -- corner and the upper right corner.
  2357.      
  2358.       CLIPPING_RECTANGLE                   : NDC.RECTANGLE_LIMITS;
  2359.      
  2360.    end record;
  2361.      
  2362. end OUTPUT_ATTRIBUTES_TYPE;
  2363. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2364. --:UDD:GKSADACM:CODE:0A:CGI_0A.ADA
  2365. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  2366. ------------------------------------------------------------------
  2367. --
  2368. --  NAME: CGI
  2369. --  IDENTIFIER: GDMXXX.1(2)
  2370. --  DISCREPANCY REPORTS:
  2371. --  #019  06/14/85  "Change SET_PATTERN_SIZE to SET_PATTERN_VECTORS"
  2372. ------------------------------------------------------------------
  2373. -- file: cgi_0a.ada
  2374. -- level: 0a
  2375.      
  2376. with GKS_TYPES;
  2377. with OUTPUT_ATTRIBUTES_TYPE;
  2378. with unchecked_deallocation;
  2379.      
  2380. use GKS_TYPES;
  2381.      
  2382. package CGI is
  2383.      
  2384. -- Uses the GKS_TYPES package to define the Computer Graphics
  2385. -- Interface (CGI) to the Workstation Manager.  The interface is
  2386. -- a DATA interface specified by the variant record CGI_INSTR where
  2387. -- the discriminant is the type CGI_OPCODES.
  2388. -- Package GKS_TYPES provides type definitions.
  2389. -- Package OUTPUT_ATTRIBUTES_TYPE provides a grouping of the attributes
  2390. -- which affect the display of output primitives.
  2391. -- Package unchecked_deallocation is a predefined generic library
  2392. -- function for storage deallocation of an object designated by a
  2393. -- value of an access type.
  2394.      
  2395.    type CGI_OPCODES is
  2396.       (NO_OP,
  2397.      
  2398.    -- LEVEL ma
  2399.    -- logical operation "ws_control"
  2400.      
  2401.       OPEN_WS,
  2402.       CLOSE_WS,
  2403.       ACTIVATE_WS,
  2404.       DEACTIVATE_WS,
  2405.       CLEAR_WS,
  2406.       UPDATE_WS,
  2407.      
  2408.    -- logical operation "output_primitives"
  2409.      
  2410.       POLYLINE,
  2411.       POLYMARKER,
  2412.       FILL_AREA,
  2413.       TEXT,
  2414.      
  2415.    -- logical operation "set_primitive_attributes_ma"
  2416.      
  2417.       SET_CHAR_VECTORS,
  2418.       SET_TEXT_ALIGNMENT,
  2419.      
  2420.    -- logical operation "set_individual_attributes_ma"
  2421.      
  2422.       SET_LINETYPE,
  2423.       SET_POLYLINE_COLOUR_INDEX,
  2424.       SET_MARKER_TYPE,
  2425.       SET_POLYMARKER_COLOUR_INDEX,
  2426.       SET_TEXT_COLOUR_INDEX,
  2427.       SET_FILL_AREA_INTERIOR_STYLE,
  2428.       SET_FILL_AREA_COLOUR_INDEX,
  2429.      
  2430.    -- logical operation "set_colour_table"
  2431.      
  2432.       SET_COLOUR_REPRESENTATION,
  2433.      
  2434.    -- logical operation "ws_transformation"
  2435.      
  2436.       SET_WS_WINDOW,
  2437.       SET_WS_VIEWPORT,
  2438.      
  2439.    -- logical operation "inq_ws_description_table_ma"
  2440.      
  2441.       INQ_DISPLAY_SPACE_SIZE,
  2442.       INQ_POLYLINE_FACILITIES,
  2443.       INQ_POLYMARKER_FACILITIES,
  2444.       INQ_TEXT_FACILITIES,
  2445.       INQ_FILL_AREA_FACILITIES,
  2446.       INQ_COLOUR_FACILITIES,
  2447.       INQ_MAX_LENGTH_OF_WS_STATE_TABLES,
  2448.      
  2449.    -- logical operation "inq_ws_state_list_ma"
  2450.      
  2451.       INQ_WS_CONNECTION_AND_TYPE,
  2452.       INQ_TEXT_EXTENT,
  2453.       INQ_LIST_OF_COLOUR_INDICES,
  2454.       INQ_COLOUR_REPRESENTATION,
  2455.       INQ_WS_TRANSFORMATION,
  2456.      
  2457.    -- logical operation "gks_normalization"
  2458.      
  2459.       SET_CLIPPING_RECTANGLE,
  2460.      
  2461.    -- LEVEL 0a
  2462.    -- logical operation "extended_output_primitives"
  2463.      
  2464.       CELL_ARRAY,
  2465.      
  2466.    -- Generalized Drawing Primitives
  2467.      
  2468.       CIRCLE,
  2469.      
  2470.    -- logical operation "set_bundle_indices"
  2471.      
  2472.       SET_POLYLINE_INDEX,
  2473.       SET_POLYMARKER_INDEX,
  2474.       SET_TEXT_INDEX,
  2475.       SET_FILL_AREA_INDEX,
  2476.      
  2477.    -- logical operation "set_primitive_attributes_0a"
  2478.      
  2479.       SET_TEXT_PATH,
  2480.       SET_PATTERN_VECTORS,                                  -- DR019
  2481.       SET_PATTERN_REFERENCE_POINT,
  2482.      
  2483.    -- logical operation "set_individual_attributes_0a"
  2484.      
  2485.       SET_LINE_WIDTH_SCALE_FACTOR,
  2486.       SET_MARKER_SIZE_SCALE_FACTOR,
  2487.       SET_TEXT_FONT_AND_PRECISION,
  2488.       SET_CHAR_EXPANSION_FACTOR,
  2489.       SET_CHAR_SPACING,
  2490.       SET_FILL_AREA_STYLE_INDEX,
  2491.       SET_ASF,
  2492.      
  2493.    -- logical operation "inq_ws_description_table_0a"
  2494.      
  2495.       INQ_WS_CATEGORY,
  2496.       INQ_WS_CLASS,
  2497.       INQ_PREDEFINED_POLYLINE_REPRESENTATION,
  2498.       INQ_PREDEFINED_POLYMARKER_REPRESENTATION,
  2499.       INQ_PREDEFINED_TEXT_REPRESENTATION,
  2500.       INQ_PREDEFINED_FILL_AREA_REPRESENTATION,
  2501.       INQ_PATTERN_FACILITIES,
  2502.       INQ_PREDEFINED_PATTERN_REPRESENTATION,
  2503.       INQ_PREDEFINED_COLOUR_REPRESENTATION,
  2504.       INQ_LIST_OF_AVAILABLE_GDP,
  2505.       INQ_GDP,
  2506.      
  2507.    -- logical operation "inq_ws_state_list_0a"
  2508.      
  2509.       INQ_WS_STATE,
  2510.       INQ_WS_DEFERRAL_AND_UPDATE_STATES,
  2511.      
  2512.    -- logical operation "pixels"
  2513.      
  2514.       INQ_PIXEL_ARRAY_DIMENSIONS,
  2515.       INQ_PIXEL_ARRAY,
  2516.       INQ_PIXEL);
  2517.      
  2518.    type ACCESS_COLOUR_MATRIX_TYPE is ACCESS
  2519.       COLOUR_MATRICES.MATRIX_OF;
  2520.    -- used to pass pointer to a matrix of colour indices
  2521.      
  2522.    type ACCESS_CONNECTION_ID_TYPE is ACCESS CONNECTION_ID;
  2523.    -- used to pass pointer to a connection id string
  2524.      
  2525.    type ACCESS_PIXEL_COLOUR_MATRIX_TYPE is ACCESS
  2526.       PIXEL_COLOUR_MATRICES.MATRIX_OF;
  2527.    -- used to pass pointer to a matrix of pixel colour indices
  2528.      
  2529.    type ACCESS_POINT_ARRAY_TYPE is ACCESS NDC.POINT_ARRAY;
  2530.    -- used to pass pointer to an array of points
  2531.      
  2532.    type ACCESS_STRING_TYPE is ACCESS STRING;
  2533.    -- used to pass pointer to a string
  2534.      
  2535.    -- instantiate unchecked deallocation for access types
  2536.      
  2537.    procedure FREE_COLOUR_MATRIX is new unchecked_deallocation
  2538.          (COLOUR_MATRICES.MATRIX_OF,ACCESS_COLOUR_MATRIX_TYPE);
  2539.      
  2540.    procedure FREE_CONNECTION_ID is new unchecked_deallocation
  2541.          (CONNECTION_ID,ACCESS_CONNECTION_ID_TYPE);
  2542.      
  2543.    procedure FREE_PIXEL_COLOUR_MATRIX is new unchecked_deallocation
  2544.          (PIXEL_COLOUR_MATRICES.MATRIX_OF,
  2545.          ACCESS_PIXEL_COLOUR_MATRIX_TYPE);
  2546.      
  2547.    procedure FREE_POINT_ARRAY is new unchecked_deallocation
  2548.          (NDC.POINT_ARRAY,ACCESS_POINT_ARRAY_TYPE);
  2549.      
  2550.    procedure FREE_STRING is new unchecked_deallocation
  2551.          (STRING,ACCESS_STRING_TYPE);
  2552.      
  2553.    type CGI_INSTR (OP : CGI_OPCODES := NO_OP) is
  2554.       record
  2555.          EI : ERROR_INDICATOR := 0;
  2556.    -- enumerate each opcode giving its appropriate arguments.
  2557.          case OP is
  2558.      
  2559.          when NO_OP =>
  2560.             null;
  2561.      
  2562.    -- logical operation "ws_control"
  2563.      
  2564.          when OPEN_WS =>
  2565.             WS_TO_OPEN       :       WS_ID;
  2566.             CONNECTION_OPEN  :       ACCESS_CONNECTION_ID_TYPE;
  2567.             TYPE_OF_WS_OPEN  :       WS_TYPE;
  2568.             ATTRIBUTES_AT_OPEN :     OUTPUT_ATTRIBUTES_TYPE.
  2569.                                      OUTPUT_ATTRIBUTES;
  2570.          when CLOSE_WS =>
  2571.             WS_TO_CLOSE      :       WS_ID;
  2572.          when ACTIVATE_WS =>
  2573.             WS_TO_ACTIVATE   :       WS_ID;
  2574.          when DEACTIVATE_WS =>
  2575.             WS_TO_DEACTIVATE :       WS_ID;
  2576.          when CLEAR_WS =>
  2577.             WS_TO_CLEAR      :       WS_ID;
  2578.             FLAG             :       CONTROL_FLAG;
  2579.          when UPDATE_WS =>
  2580.             WS_TO_UPDATE     :       WS_ID;
  2581.             REGENERATION     :       UPDATE_REGENERATION_FLAG;
  2582.      
  2583.    -- logical operation "output_primitives"
  2584.      
  2585.          when POLYLINE =>
  2586.             LINE_POINTS      :       ACCESS_POINT_ARRAY_TYPE;
  2587.          when POLYMARKER =>
  2588.             MARKER_POINTS    :       ACCESS_POINT_ARRAY_TYPE;
  2589.          when FILL_AREA =>
  2590.             FILL_AREA_POINTS :       ACCESS_POINT_ARRAY_TYPE;
  2591.          when TEXT =>
  2592.             TEXT_POSITION    :       NDC.POINT;
  2593.             TEXT_STRING      :       ACCESS_STRING_TYPE;
  2594.      
  2595.      
  2596.    -- logical operation "set_primitive_attributes_ma"
  2597.      
  2598.          when SET_CHAR_VECTORS =>
  2599.             CHAR_HEIGHT_VECTOR_SET   :       NDC.VECTOR;
  2600.             CHAR_WIDTH_VECTOR_SET    :       NDC.VECTOR;
  2601.          when SET_TEXT_ALIGNMENT =>
  2602.             TEXT_ALIGNMENT_SET       :       TEXT_ALIGNMENT;
  2603.      
  2604.    -- logical operation "set_individual_attributes_ma"
  2605.      
  2606.          when SET_LINETYPE =>
  2607.             LINETYPE_SET             :       LINETYPE;
  2608.          when SET_POLYLINE_COLOUR_INDEX =>
  2609.             POLYLINE_COLOUR_INDEX_SET :      COLOUR_INDEX;
  2610.          when SET_MARKER_TYPE =>
  2611.             MARKER_TYPE_SET          :       MARKER_TYPE;
  2612.          when SET_POLYMARKER_COLOUR_INDEX =>
  2613.             POLYMARKER_COLOUR_INDEX_SET :    COLOUR_INDEX;
  2614.          when SET_TEXT_COLOUR_INDEX =>
  2615.             TEXT_COLOUR_INDEX_SET    :       COLOUR_INDEX;
  2616.          when SET_FILL_AREA_INTERIOR_STYLE =>
  2617.             FILL_AREA_INTERIOR_STYLE_SET :   INTERIOR_STYLE;
  2618.          when SET_FILL_AREA_COLOUR_INDEX =>
  2619.             FILL_AREA_COLOUR_INDEX_SET :     COLOUR_INDEX;
  2620.      
  2621.    -- logical operation "set_colour_table"
  2622.      
  2623.          when SET_COLOUR_REPRESENTATION =>
  2624.             WS_TO_SET_COLOUR_REP     :       WS_ID;
  2625.             COLOUR_INDEX_TO_SET_COLOUR_REP :   COLOUR_INDEX;
  2626.             COLOUR_REP_SET           :       COLOUR_REPRESENTATION;
  2627.      
  2628.    -- logical operation "ws_transformation"
  2629.      
  2630.          when SET_WS_WINDOW =>
  2631.             WS_TO_SET_WINDOW      :  WS_ID;
  2632.             WS_WINDOW_LIMITS_SET  :  NDC.RECTANGLE_LIMITS;
  2633.          when SET_WS_VIEWPORT =>
  2634.             WS_TO_SET_VIEWPORT     : WS_ID;
  2635.             WS_VIEWPORT_LIMITS_SET : DC.RECTANGLE_LIMITS;
  2636.      
  2637.    -- logical operation "inq_ws_description_table_ma"
  2638.      
  2639.          when INQ_DISPLAY_SPACE_SIZE =>
  2640.             WS_TO_INQ_DISPLAY_SPACE_SIZE :   WS_TYPE;
  2641.             DISPLAY_SPACE_UNITS_INQ  :       DC_UNITS;
  2642.             MAX_DC_SIZE_INQ          :       DC.SIZE;
  2643.             MAX_RASTER_UNIT_SIZE_INQ :       RASTER_UNIT_SIZE;
  2644.          when INQ_POLYLINE_FACILITIES =>
  2645.             WS_TO_INQ_POLYLINE_FACILITIES :  WS_TYPE;
  2646.             LIST_OF_POLYLINE_TYPES_INQ :     LINETYPES.LIST_OF;
  2647.             NUMBER_OF_WIDTHS_INQ     :       NATURAL;
  2648.             NOMINAL_WIDTH_INQ        :       DC.MAGNITUDE;
  2649.             RANGE_OF_WIDTHS_INQ      :       DC.RANGE_OF_MAGNITUDES;
  2650.             NUMBER_OF_POLYLINE_INDICES_INQ : NATURAL;
  2651.          when INQ_POLYMARKER_FACILITIES =>
  2652.             WS_TO_INQ_POLYMARKER_FACILITIES : WS_TYPE;
  2653.             LIST_OF_POLYMARKER_TYPES_INQ:    MARKER_TYPES.LIST_OF;
  2654.             NUMBER_OF_SIZES_INQ      :       NATURAL;
  2655.             NOMINAL_SIZE_INQ         :       DC.MAGNITUDE;
  2656.             RANGE_OF_SIZES_INQ       :       DC.RANGE_OF_MAGNITUDES;
  2657.             NUMBER_OF_POLYMARKER_INDICES_INQ : NATURAL;
  2658.          when INQ_TEXT_FACILITIES =>
  2659.             WS_TO_INQ_TEXT_FACILITIES :      WS_TYPE;
  2660.             LIST_OF_FONT_PRECISION_PAIRS_INQ :
  2661.                                            TEXT_FONT_PRECISIONS.LIST_OF;
  2662.             NUMBER_OF_HEIGHTS_INQ    :       NATURAL;
  2663.             RANGE_OF_HEIGHTS_INQ     :       DC.RANGE_OF_MAGNITUDES;
  2664.             NUMBER_OF_EXPANSIONS_INQ :       NATURAL;
  2665.             RANGE_OF_EXPANSIONS_INQ  :       RANGE_OF_EXPANSIONS;
  2666.             NUMBER_OF_TEXT_INDICES_INQ :     NATURAL;
  2667.          when INQ_FILL_AREA_FACILITIES =>
  2668.             WS_TO_INQ_FILL_AREA_FACILITIES : WS_TYPE;
  2669.             LIST_OF_INTERIOR_STYLES_INQ :    INTERIOR_STYLES.LIST_OF;
  2670.             LIST_OF_HATCH_STYLES_INQ :       HATCH_STYLES.LIST_OF;
  2671.             NUMBER_OF_FILL_AREA_INDICES_INQ : NATURAL;
  2672.          when INQ_COLOUR_FACILITIES =>
  2673.             WS_TO_INQ_COLOUR_FACILITIES :    WS_TYPE;
  2674.             NUMBER_OF_COLOURS_INQ    :       NATURAL;
  2675.             AVAILABLE_COLOUR_INQ     :       COLOUR_AVAILABLE;
  2676.             NUMBER_OF_COLOUR_INDICES_INQ :   NATURAL;
  2677.          when INQ_MAX_LENGTH_OF_WS_STATE_TABLES =>
  2678.             WS_TO_INQ_MAX_LENGTH_OF_WS_STATE_TABLES : WS_TYPE;
  2679.             MAX_POLYLINE_ENTRIES_INQ :       NATURAL;
  2680.             MAX_POLYMARKER_ENTRIES_INQ :     NATURAL;
  2681.             MAX_TEXT_ENTRIES_INQ     :       NATURAL;
  2682.             MAX_FILL_AREA_ENTRIES_INQ :      NATURAL;
  2683.             MAX_PATTERN_INDICES_INQ  :       NATURAL;
  2684.             MAX_COLOUR_INDICES_INQ   :       NATURAL;
  2685.      
  2686.    -- logical operation "inq_ws_state_list_ma"
  2687.      
  2688.          when INQ_WS_CONNECTION_AND_TYPE =>
  2689.             WS_TO_INQ_CONNECTION_AND_TYPE :  WS_ID;
  2690.             CONNECTION_INQ   :       ACCESS_CONNECTION_ID_TYPE;
  2691.             TYPE_OF_WS_INQ   :       WS_TYPE;
  2692.          when INQ_TEXT_EXTENT =>
  2693.             WS_TO_INQ_TEXT_EXTENT :  WS_ID;
  2694.             POSITION_TEXT    :       NDC.POINT;
  2695.             CHAR_STRING      :       ACCESS_STRING_TYPE;
  2696.             CONCATENATION_POINT :    NDC.POINT;
  2697.             TEXT_EXTENT_LOWER_LEFT_INQ   : NDC.POINT;
  2698.             TEXT_EXTENT_LOWER_RIGHT_INQ  : NDC.POINT;
  2699.             TEXT_EXTENT_UPPER_LEFT_INQ   : NDC.POINT;
  2700.             TEXT_EXTENT_UPPER_RIGHT_INQ  : NDC.POINT;
  2701.          when INQ_LIST_OF_COLOUR_INDICES =>
  2702.             WS_TO_INQ_COLOUR_INDICES : WS_ID;
  2703.             LIST_OF_COLOUR_INDICES_INQ : COLOUR_INDICES.LIST_OF;
  2704.          when INQ_COLOUR_REPRESENTATION =>
  2705.             WS_TO_INQ_COLOUR_REP :   WS_ID;
  2706.             COLOUR_INDEX_TO_INQ_COLOUR_REP  : COLOUR_INDEX;
  2707.             RETURN_VALUE_TO_INQ_COLOUR_REP  : RETURN_VALUE_TYPE;
  2708.             COLOUR_REP_INQ                  : COLOUR_REPRESENTATION;
  2709.          when INQ_WS_TRANSFORMATION =>
  2710.             WS_TO_INQ_TRANSFORMATION :       WS_ID;
  2711.             UPDATE_INQ               :       UPDATE_STATE;
  2712.             REQUESTED_WINDOW_INQ     :       NDC.RECTANGLE_LIMITS;
  2713.             CURRENT_WINDOW_INQ       :       NDC.RECTANGLE_LIMITS;
  2714.             REQUESTED_VIEWPORT_INQ   :       DC.RECTANGLE_LIMITS;
  2715.             CURRENT_VIEWPORT_INQ     :       DC.RECTANGLE_LIMITS;
  2716.      
  2717.    -- logical operation "gks_normalization"
  2718.      
  2719.          when SET_CLIPPING_RECTANGLE =>
  2720.             CLIPPING_RECTANGLE_SET : NDC.RECTANGLE_LIMITS;
  2721.      
  2722.    -- LEVEL 0a
  2723.    -- logical operation "extended_output_primitives"
  2724.      
  2725.          when CELL_ARRAY =>
  2726.             CELL_ARRAY_CORNER_1_1    :       NDC.POINT;
  2727.             CELL_ARRAY_CORNER_DX_DY  :       NDC.POINT;
  2728.             CELL_ARRAY_CORNER_DX_1   :       NDC.POINT;
  2729.             CELL_COLOUR_MATRIX       :     ACCESS_COLOUR_MATRIX_TYPE;
  2730.      
  2731.    -- Generalized Drawing Primitives
  2732.          when CIRCLE =>
  2733.             CIRCLE_CENTER            :       NDC.POINT;
  2734.             CIRCLE_PERIPHERAL_POINT   :      NDC.POINT;
  2735.      
  2736.    -- logical operation "set_bundle_indices"
  2737.      
  2738.          when SET_POLYLINE_INDEX =>
  2739.             POLYLINE_INDEX_SET       :       POLYLINE_INDEX;
  2740.          when SET_POLYMARKER_INDEX =>
  2741.             POLYMARKER_INDEX_SET     :       POLYMARKER_INDEX;
  2742.          when SET_TEXT_INDEX =>
  2743.             TEXT_INDEX_SET           :       TEXT_INDEX;
  2744.          when SET_FILL_AREA_INDEX =>
  2745.             FILL_AREA_INDEX_SET      :       FILL_AREA_INDEX;
  2746.      
  2747.    -- logical operation "set_primitive_attributes_0a"
  2748.      
  2749.          when SET_TEXT_PATH =>
  2750.             TEXT_PATH_SET            :       TEXT_PATH;
  2751.          when SET_PATTERN_VECTORS =>                          -- DR019
  2752.             PATTERN_HEIGHT_VECTOR_SET   :    NDC.VECTOR;      -- DR019
  2753.             PATTERN_WIDTH_VECTOR_SET    :    NDC.VECTOR;      -- DR019
  2754.          when SET_PATTERN_REFERENCE_POINT =>
  2755.             PATTERN_REFERENCE_POINT_SET :    NDC.POINT;
  2756.      
  2757.    -- logical operation "set_individual_attributes_0a"
  2758.      
  2759.          when SET_LINE_WIDTH_SCALE_FACTOR =>
  2760.             LINE_WIDTH_SCALE_FACTOR_SET :    LINE_WIDTH;
  2761.          when SET_MARKER_SIZE_SCALE_FACTOR =>
  2762.             MARKER_SIZE_SCALE_FACTOR_SET :   MARKER_SIZE;
  2763.          when SET_TEXT_FONT_AND_PRECISION =>
  2764.             TEXT_FONT_AND_PRECISION_SET :    TEXT_FONT_PRECISION;
  2765.          when SET_CHAR_EXPANSION_FACTOR =>
  2766.             CHAR_EXPANSION_FACTOR_SET :      CHAR_EXPANSION;
  2767.          when SET_CHAR_SPACING =>
  2768.             CHAR_SPACING_SET         :       CHAR_SPACING;
  2769.          when SET_FILL_AREA_STYLE_INDEX =>
  2770.             FILL_AREA_STYLE_INDEX_SET :      STYLE_INDEX;
  2771.          when SET_ASF =>
  2772.             ASF_SET                  :       ASF_LIST;
  2773.      
  2774.    -- logical operation "inq_ws_description_table_0a"
  2775.      
  2776.          when INQ_WS_CATEGORY =>
  2777.             WS_TO_INQ_CATEGORY       :       WS_TYPE;
  2778.             WS_CATEGORY_INQ          :       WS_CATEGORY;
  2779.          when INQ_WS_CLASS =>
  2780.             WS_TO_INQ_CLASS          :       WS_TYPE;
  2781.             WS_CLASS_INQ             :       DISPLAY_CLASS;
  2782.          when INQ_PREDEFINED_POLYLINE_REPRESENTATION =>
  2783.             WS_TO_INQ_PRE_POLYLINE_REP :     WS_TYPE;
  2784.             PRE_POLYLINE_INDEX_TO_INQ_PRE_POLYLINE_REP : POLYLINE_INDEX;
  2785.             PRE_POLYLINE_TYPE_INQ    :       LINETYPE;
  2786.             PRE_POLYLINE_WIDTH_INQ   :       LINE_WIDTH;
  2787.             PRE_POLYLINE_COLOUR_INQ  :       COLOUR_INDEX;
  2788.          when INQ_PREDEFINED_POLYMARKER_REPRESENTATION =>
  2789.             WS_TO_INQ_PRE_POLYMARKER_REP :   WS_TYPE;
  2790.             PRE_POLYMARKER_INDEX_TO_INQ_PRE_POLYMARKER_REP :
  2791.                                                        POLYMARKER_INDEX;
  2792.             PRE_POLYMARKER_TYPE_INQ  :       MARKER_TYPE;
  2793.             PRE_POLYMARKER_SIZE_INQ  :       MARKER_SIZE;
  2794.             PRE_POLYMARKER_COLOUR_INQ :      COLOUR_INDEX;
  2795.          when INQ_PREDEFINED_TEXT_REPRESENTATION =>
  2796.             WS_TO_INQ_PRE_TEXT_REP   :       WS_TYPE;
  2797.             PRE_TEXT_INDEX_TO_INQ_PRE_TEXT_REP : TEXT_INDEX;
  2798.             PRE_TEXT_FONT_PRECISION_INQ :    TEXT_FONT_PRECISION;
  2799.             PRE_TEXT_CHAR_EXPANSION_INQ :    CHAR_EXPANSION;
  2800.             PRE_TEXT_CHAR_SPACING_INQ :      CHAR_SPACING;
  2801.             PRE_TEXT_COLOUR_INQ      :       COLOUR_INDEX;
  2802.          when INQ_PREDEFINED_FILL_AREA_REPRESENTATION =>
  2803.             WS_TO_INQ_PRE_FILL_AREA_REP :    WS_TYPE;
  2804.             PRE_FILL_AREA_INDEX_TO_INQ_PRE_FILL_AREA_REP :
  2805.                                                         FILL_AREA_INDEX;
  2806.             PRE_FILL_AREA_INTERIOR_INQ :     INTERIOR_STYLE;
  2807.             PRE_FILL_AREA_STYLE_INQ  :       STYLE_INDEX;
  2808.             PRE_FILL_AREA_COLOUR_INQ :       COLOUR_INDEX;
  2809.          when INQ_PATTERN_FACILITIES =>
  2810.             WS_TO_INQ_PATTERN_FACILITIES :   WS_TYPE;
  2811.             NUMBER_OF_PATTERN_INDICES :      NATURAL;
  2812.          when INQ_PREDEFINED_PATTERN_REPRESENTATION =>
  2813.             WS_TO_INQ_PRE_PATTERN_REP :      WS_TYPE;
  2814.             PRE_PATTERN_INDEX_TO_INQ_PRE_PATTERN_REP : PATTERN_INDEX;
  2815.             PRE_PATTERN_REP_INQ :            ACCESS_COLOUR_MATRIX_TYPE;
  2816.          when INQ_PREDEFINED_COLOUR_REPRESENTATION =>
  2817.             WS_TO_INQ_PRE_COLOUR_REP :       WS_TYPE;
  2818.             PRE_COLOUR_INDEX_TO_INQ_PRE_COLOUR_REP : COLOUR_INDEX;
  2819.             PRE_COLOUR_REP_INQ       :       COLOUR_REPRESENTATION;
  2820.          when INQ_LIST_OF_AVAILABLE_GDP =>
  2821.             WS_TO_INQ_LIST_OF_AVAILABLE_GDP: WS_TYPE;
  2822.             LIST_OF_GDP_INQ          :       GDP_IDS.LIST_OF;
  2823.          when INQ_GDP =>
  2824.             WS_TO_INQ_GDP            :       WS_TYPE;
  2825.             GDP_TO_INQ_GDP          :        GDP_ID;
  2826.             LIST_OF_ATTRIBUTES_USED_INQ :   ATTRIBUTES_USED.LIST_OF;
  2827.      
  2828.    -- logical operation "inq_ws_state_list_0a"
  2829.      
  2830.          when INQ_WS_STATE =>
  2831.             WS_TO_INQ_STATE  :       WS_ID;
  2832.             WS_STATE_INQ     :       WS_STATE;
  2833.          when INQ_WS_DEFERRAL_AND_UPDATE_STATES =>
  2834.             WS_TO_INQ_DEFERRAL_AND_UPDATE_STATES :   WS_ID;
  2835.             DEFERRAL_INQ :           DEFERRAL_MODE;
  2836.             REGENERATION_INQ :       REGENERATION_MODE;
  2837.             DISPLAY_INQ      :       DISPLAY_SURFACE_EMPTY;
  2838.             FRAME_ACTION_INQ :       NEW_FRAME_NECESSARY;
  2839.      
  2840.    -- logical operation "pixels"
  2841.      
  2842.          when INQ_PIXEL_ARRAY_DIMENSIONS =>
  2843.             WS_TO_INQ_PIXEL_ARRAY_DIMENSIONS :       WS_ID;
  2844.             PIXEL_ARRAY_CORNER_1_1_INQ       :       NDC.POINT;
  2845.             PIXEL_ARRAY_CORNER_DX_DY_INQ     :       NDC.POINT;
  2846.             DIMENSIONS_INQ                   :     RASTER_UNIT_SIZE;
  2847.          when INQ_PIXEL_ARRAY =>
  2848.             WS_TO_INQ_PIXEL_ARRAY :  WS_ID;
  2849.             PIXEL_ARRAY_CORNER_INQ :  NDC.POINT;
  2850.             DX_INQ           :       RASTER_UNITS;
  2851.             DY_INQ           :       RASTER_UNITS;
  2852.             INVALID_VALUES_INQ :     INVALID_VALUES_INDICATOR;
  2853.             PIXEL_ARRAY_INQ  :       ACCESS_PIXEL_COLOUR_MATRIX_TYPE;
  2854.          when INQ_PIXEL =>
  2855.             WS_TO_INQ_PIXEL  :       WS_ID;
  2856.             PIXEL_POINT_INQ  :       NDC.POINT;
  2857.             PIXEL_COLOUR_INQ :       PIXEL_COLOUR_INDEX;
  2858.      
  2859.          end case;
  2860.       end record;
  2861.      
  2862.    -- Subtypes are defined to ensure the correct procedure is called
  2863.    -- from the Device Independent layer to the Workstation Manager(WSM)
  2864.    -- layer by restricting the opcode to one specified value.
  2865.      
  2866.    subtype CGI_NO_OP is
  2867.       CGI_INSTR(OP => NO_OP);
  2868.      
  2869.    -- LEVEL ma
  2870.    -- logical operation "ws_control"
  2871.      
  2872.    subtype CGI_OPEN_WS is
  2873.       CGI_INSTR(OP => OPEN_WS);
  2874.    subtype CGI_CLOSE_WS is
  2875.       CGI_INSTR(OP => CLOSE_WS);
  2876.    subtype CGI_ACTIVATE_WS is
  2877.       CGI_INSTR(OP => ACTIVATE_WS);
  2878.    subtype CGI_DEACTIVATE_WS is
  2879.       CGI_INSTR(OP => DEACTIVATE_WS);
  2880.    subtype CGI_CLEAR_WS is
  2881.       CGI_INSTR(OP => CLEAR_WS);
  2882.    subtype CGI_UPDATE_WS is
  2883.       CGI_INSTR(OP => UPDATE_WS);
  2884.      
  2885.    -- logical operation "output_primitives"
  2886.      
  2887.    subtype CGI_POLYLINE is
  2888.       CGI_INSTR(OP => POLYLINE);
  2889.    subtype CGI_POLYMARKER is
  2890.       CGI_INSTR(OP => POLYMARKER);
  2891.    subtype CGI_FILL_AREA is
  2892.       CGI_INSTR(OP => FILL_AREA);
  2893.    subtype CGI_TEXT is
  2894.       CGI_INSTR(OP => TEXT);
  2895.      
  2896.    -- logical operation "set_primitive_attributes_ma"
  2897.      
  2898.    subtype CGI_SET_CHAR_VECTORS is
  2899.       CGI_INSTR(OP => SET_CHAR_VECTORS);
  2900.    subtype CGI_SET_TEXT_ALIGNMENT is
  2901.       CGI_INSTR(OP => SET_TEXT_ALIGNMENT);
  2902.      
  2903.    -- logical operation "set_individual_attributes_ma"
  2904.      
  2905.    subtype CGI_SET_LINETYPE is
  2906.       CGI_INSTR(OP => SET_LINETYPE);
  2907.    subtype CGI_SET_POLYLINE_COLOUR_INDEX is
  2908.       CGI_INSTR(OP => SET_POLYLINE_COLOUR_INDEX);
  2909.    subtype CGI_SET_MARKER_TYPE is
  2910.       CGI_INSTR(OP => SET_MARKER_TYPE);
  2911.    subtype CGI_SET_POLYMARKER_COLOUR_INDEX is
  2912.       CGI_INSTR(OP => SET_POLYMARKER_COLOUR_INDEX);
  2913.    subtype CGI_SET_TEXT_COLOUR_INDEX is
  2914.       CGI_INSTR(OP => SET_TEXT_COLOUR_INDEX);
  2915.    subtype CGI_SET_FILL_AREA_INTERIOR_STYLE is
  2916.       CGI_INSTR(OP => SET_FILL_AREA_INTERIOR_STYLE);
  2917.    subtype CGI_SET_FILL_AREA_COLOUR_INDEX is
  2918.       CGI_INSTR(OP => SET_FILL_AREA_COLOUR_INDEX);
  2919.      
  2920.    -- logical operation "set_colour_table"
  2921.      
  2922.    subtype CGI_SET_COLOUR_REPRESENTATION is
  2923.       CGI_INSTR(OP => SET_COLOUR_REPRESENTATION);
  2924.      
  2925.    -- logical operation "ws_transformation"
  2926.      
  2927.    subtype CGI_SET_WS_WINDOW is
  2928.       CGI_INSTR(OP => SET_WS_WINDOW);
  2929.    subtype CGI_SET_WS_VIEWPORT is
  2930.       CGI_INSTR(OP => SET_WS_VIEWPORT);
  2931.      
  2932.    -- logical operation "inq_ws_description_table_ma"
  2933.      
  2934.    subtype CGI_INQ_DISPLAY_SPACE_SIZE is
  2935.       CGI_INSTR(OP => INQ_DISPLAY_SPACE_SIZE);
  2936.    subtype CGI_INQ_POLYLINE_FACILITIES is
  2937.       CGI_INSTR(OP => INQ_POLYLINE_FACILITIES);
  2938.    subtype CGI_INQ_POLYMARKER_FACILITIES is
  2939.       CGI_INSTR(OP => INQ_POLYMARKER_FACILITIES);
  2940.    subtype CGI_INQ_TEXT_FACILITIES is
  2941.       CGI_INSTR(OP => INQ_TEXT_FACILITIES);
  2942.    subtype CGI_INQ_FILL_AREA_FACILITIES is
  2943.       CGI_INSTR(OP => INQ_FILL_AREA_FACILITIES);
  2944.    subtype CGI_INQ_COLOUR_FACILITIES is
  2945.       CGI_INSTR(OP => INQ_COLOUR_FACILITIES);
  2946.    subtype CGI_INQ_MAX_LENGTH_OF_WS_STATE_TABLES is
  2947.       CGI_INSTR(OP => INQ_MAX_LENGTH_OF_WS_STATE_TABLES);
  2948.      
  2949.    -- logical operation "inq_ws_state_list_ma"
  2950.      
  2951.    subtype CGI_INQ_WS_CONNECTION_AND_TYPE is
  2952.       CGI_INSTR(OP => INQ_WS_CONNECTION_AND_TYPE);
  2953.    subtype CGI_INQ_TEXT_EXTENT is
  2954.       CGI_INSTR(OP => INQ_TEXT_EXTENT);
  2955.    subtype CGI_INQ_LIST_OF_COLOUR_INDICES is
  2956.       CGI_INSTR(OP => INQ_LIST_OF_COLOUR_INDICES);
  2957.    subtype CGI_INQ_COLOUR_REPRESENTATION is
  2958.       CGI_INSTR(OP => INQ_COLOUR_REPRESENTATION);
  2959.    subtype CGI_INQ_WS_TRANSFORMATION is
  2960.       CGI_INSTR(OP => INQ_WS_TRANSFORMATION);
  2961.      
  2962.    -- logical operation "gks_normalization"
  2963.      
  2964.    subtype CGI_SET_CLIPPING_RECTANGLE is
  2965.       CGI_INSTR(OP => SET_CLIPPING_RECTANGLE);
  2966.      
  2967.    -- LEVEL 0a
  2968.    -- logical operation "extended_output_primitives"
  2969.      
  2970.    subtype CGI_CELL_ARRAY is
  2971.       CGI_INSTR(OP => CELL_ARRAY);
  2972.    -- Generalized Drawing Primitives
  2973.    subtype CGI_CIRCLE is
  2974.       CGI_INSTR(OP => CIRCLE);
  2975.      
  2976.    -- logical operation "set_bundle_indices"
  2977.      
  2978.    subtype CGI_SET_POLYLINE_INDEX is
  2979.       CGI_INSTR(OP => SET_POLYLINE_INDEX);
  2980.    subtype CGI_SET_POLYMARKER_INDEX is
  2981.       CGI_INSTR(OP => SET_POLYMARKER_INDEX);
  2982.    subtype CGI_SET_TEXT_INDEX is
  2983.       CGI_INSTR(OP => SET_TEXT_INDEX);
  2984.    subtype CGI_SET_FILL_AREA_INDEX is
  2985.       CGI_INSTR(OP => SET_FILL_AREA_INDEX);
  2986.      
  2987.    -- logical operation "set_primitive_attributes_0a"
  2988.      
  2989.    subtype CGI_SET_TEXT_PATH is
  2990.       CGI_INSTR(OP => SET_TEXT_PATH);
  2991.    subtype CGI_SET_PATTERN_VECTORS is                        -- DR019
  2992.       CGI_INSTR(OP => SET_PATTERN_VECTORS);                  -- DR019
  2993.    subtype CGI_SET_PATTERN_REFERENCE_POINT is
  2994.       CGI_INSTR(OP => SET_PATTERN_REFERENCE_POINT);
  2995.      
  2996.    -- logical operation "set_individual_attributes_0a"
  2997.      
  2998.    subtype CGI_SET_LINE_WIDTH_SCALE_FACTOR is
  2999.       CGI_INSTR(OP => SET_LINE_WIDTH_SCALE_FACTOR);
  3000.    subtype CGI_SET_MARKER_SIZE_SCALE_FACTOR is
  3001.       CGI_INSTR(OP => SET_MARKER_SIZE_SCALE_FACTOR);
  3002.    subtype CGI_SET_TEXT_FONT_AND_PRECISION is
  3003.       CGI_INSTR(OP => SET_TEXT_FONT_AND_PRECISION);
  3004.    subtype CGI_SET_CHAR_EXPANSION_FACTOR is
  3005.       CGI_INSTR(OP => SET_CHAR_EXPANSION_FACTOR);
  3006.    subtype CGI_SET_CHAR_SPACING is
  3007.       CGI_INSTR(OP => SET_CHAR_SPACING);
  3008.    subtype CGI_SET_FILL_AREA_STYLE_INDEX is
  3009.       CGI_INSTR(OP => SET_FILL_AREA_STYLE_INDEX);
  3010.    subtype CGI_SET_ASF is
  3011.       CGI_INSTR(OP => SET_ASF);
  3012.      
  3013.    -- logical operation "inq_ws_description_table_0a"
  3014.      
  3015.    subtype CGI_INQ_WS_CATEGORY is
  3016.       CGI_INSTR(OP => INQ_WS_CATEGORY);
  3017.    subtype CGI_INQ_WS_CLASS is
  3018.       CGI_INSTR(OP => INQ_WS_CLASS);
  3019.    subtype CGI_INQ_PREDEFINED_POLYLINE_REPRESENTATION is
  3020.       CGI_INSTR(OP => INQ_PREDEFINED_POLYLINE_REPRESENTATION);
  3021.    subtype CGI_INQ_PREDEFINED_POLYMARKER_REPRESENTATION is
  3022.       CGI_INSTR(OP => INQ_PREDEFINED_POLYMARKER_REPRESENTATION);
  3023.    subtype CGI_INQ_PREDEFINED_TEXT_REPRESENTATION is
  3024.       CGI_INSTR(OP => INQ_PREDEFINED_TEXT_REPRESENTATION);
  3025.    subtype CGI_INQ_PREDEFINED_FILL_AREA_REPRESENTATION is
  3026.       CGI_INSTR(OP => INQ_PREDEFINED_FILL_AREA_REPRESENTATION);
  3027.    subtype CGI_INQ_PATTERN_FACILITIES is
  3028.       CGI_INSTR(OP => INQ_PATTERN_FACILITIES);
  3029.    subtype CGI_INQ_PREDEFINED_PATTERN_REPRESENTATION is
  3030.       CGI_INSTR(OP => INQ_PREDEFINED_PATTERN_REPRESENTATION);
  3031.    subtype CGI_INQ_PREDEFINED_COLOUR_REPRESENTATION is
  3032.       CGI_INSTR(OP => INQ_PREDEFINED_COLOUR_REPRESENTATION);
  3033.    subtype CGI_INQ_LIST_OF_AVAILABLE_GDP is
  3034.       CGI_INSTR(OP => INQ_LIST_OF_AVAILABLE_GDP);
  3035.    subtype CGI_INQ_GDP is
  3036.       CGI_INSTR(OP => INQ_GDP);
  3037.      
  3038.    -- logical operation "inq_ws_state_list_0a"
  3039.      
  3040.    subtype CGI_INQ_WS_STATE is
  3041.       CGI_INSTR(OP => INQ_WS_STATE);
  3042.    subtype CGI_INQ_WS_DEFERRAL_AND_UPDATE_STATES is
  3043.       CGI_INSTR(OP => INQ_WS_DEFERRAL_AND_UPDATE_STATES);
  3044.      
  3045.    -- logical operation "pixels"
  3046.      
  3047.    subtype CGI_INQ_PIXEL_ARRAY_DIMENSIONS is
  3048.       CGI_INSTR(OP => INQ_PIXEL_ARRAY_DIMENSIONS);
  3049.    subtype CGI_INQ_PIXEL_ARRAY is
  3050.       CGI_INSTR(OP => INQ_PIXEL_ARRAY);
  3051.    subtype CGI_INQ_PIXEL is
  3052.       CGI_INSTR(OP => INQ_PIXEL);
  3053.      
  3054. end CGI;
  3055. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3056. --:UDD:GKSADACM:CODE:0A:WSM_0A.ADA
  3057. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3058. ------------------------------------------------------------------
  3059. --
  3060. --  NAME: WSM
  3061. --  IDENTIFIER: GDMXXX.1(1)
  3062. --  DISCREPANCY REPORTS:
  3063. --
  3064. ------------------------------------------------------------------
  3065. -- file:  wsm_0a.ada
  3066. -- level: 0a
  3067.      
  3068. with CGI;
  3069.      
  3070. use CGI;
  3071.      
  3072. package WSM is
  3073.      
  3074. -- This is the single entry point for the GKS device independent layer
  3075. -- to interface to all "virtual" devices.  The Work Station manager has
  3076. -- the responsibility of accepting a CGI interface call from GKS,
  3077. -- performing any common operations for workstations and transmitting
  3078. -- the operation to the appropriate workstation drivers via the WS_
  3079. -- COMMUNICATION package.
  3080.      
  3081.    procedure WS_MANAGER
  3082.       (INSTR    : in out CGI_INSTR);
  3083.      
  3084. end WSM;
  3085. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3086. --:UDD:GKSADACM:CODE:0A:ERROR_ROUTINES_0A.ADA
  3087. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3088. ------------------------------------------------------------------
  3089. --
  3090. --  NAME: ERROR_ROUTINES
  3091. --  IDENTIFIER: GIMXXX.1(1)
  3092. --  DISCREPANCY REPORTS:
  3093. --
  3094. ------------------------------------------------------------------
  3095. -- file:  error_routines_0a.ada
  3096. -- level: 0a
  3097.      
  3098. with GKS_TYPES;
  3099.      
  3100. use GKS_TYPES;
  3101.      
  3102. package ERROR_ROUTINES is
  3103.      
  3104. -- This package provides the procedures for gks error handling.
  3105.      
  3106.    procedure EMERGENCY_CLOSE_GKS;
  3107.      
  3108.    procedure ERROR_LOGGING
  3109.       (EI  : in ERROR_INDICATOR;
  3110.       NAME : in SUBPROGRAM_NAME);
  3111.      
  3112.    procedure GET_ERROR
  3113.       (EI  : out ERROR_INDICATOR;
  3114.       NAME : out VARIABLE_SUBPROGRAM_NAME);
  3115.      
  3116. end ERROR_ROUTINES;
  3117. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3118. --:UDD:GKSADACM:CODE:0A:EXT_OUT_PRIM.ADA
  3119. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3120. ------------------------------------------------------------------
  3121. --
  3122. --  NAME: EXTENDED_OUTPUT_PRIMITIVES
  3123. --  IDENTIFIER: GIMXXX.1(1)
  3124. --  DISCREPANCY REPORTS:
  3125. --
  3126. ------------------------------------------------------------------
  3127. -- file:  ext_out_prim.ada
  3128. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  3129.      
  3130. with GKS_TYPES;
  3131.      
  3132. use GKS_TYPES;
  3133.      
  3134. package EXTENDED_OUTPUT_PRIMITIVES is
  3135.      
  3136. -- This package provides the extended output primitives
  3137. -- for level 0a.
  3138.      
  3139.    procedure CELL_ARRAY
  3140.       (CORNER_1_1 : in WC.POINT;
  3141.       CORNER_DX_DY: in WC.POINT;
  3142.       CELL        : in COLOUR_MATRICES.MATRIX_OF);
  3143.      
  3144.    procedure GDP_CIRCLE
  3145.       (CENTER          : in WC.POINT;
  3146.       PERIPHERAL_POINT : in WC.POINT);
  3147.      
  3148. end EXTENDED_OUTPUT_PRIMITIVES;
  3149. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3150. --:UDD:GKSADACM:CODE:MA:GKS_ERRORS.ADA
  3151. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3152. ------------------------------------------------------------------
  3153. --
  3154. --  NAME: GKS_ERRORS
  3155. --  IDENTIFIER: GIMXXX.2(1)
  3156. --  DISCREPANCY REPORTS:
  3157. --  #022  06/13/85  "Add error #85 back into GKS_ERRORS"
  3158. ------------------------------------------------------------------
  3159. -- file : GKS_ERRORS.ADA
  3160. -- levels : all levels
  3161.      
  3162. with GKS_TYPES;
  3163.      
  3164. use GKS_TYPES;
  3165.      
  3166. package GKS_ERRORS is
  3167.      
  3168. -- This package defines error indicator constants to be used
  3169. -- in place of error indicator numbers within code.
  3170.      
  3171. -- IMPLEMENTATION DEPENDENT ERRORS
  3172.      
  3173.    SUCCESSFUL : constant ERROR_INDICATOR := 0;
  3174.      
  3175. -- STATE ERRORS
  3176.      
  3177. -- 1   GKS not in proper state: GKS shall be in state GKCL
  3178.    NOT_GKCL   : constant ERROR_INDICATOR := 1;
  3179.      
  3180. -- 2   GKS not in proper state: GKS shall be in state GKOP
  3181.    NOT_GKOP   : constant ERROR_INDICATOR := 2;
  3182.      
  3183. -- 3   GKS not in proper state: GKS shall be in state WSAC
  3184.    NOT_WSAC   : constant ERROR_INDICATOR := 3;
  3185.      
  3186. -- 4   GKS not in proper state: GKS shall be in state SGOP
  3187.    NOT_SGOP   : constant ERROR_INDICATOR := 4;
  3188.      
  3189. -- 5   GKS not in proper state: GKS shall be in either in
  3190. --     state WSAC or in state SGOP
  3191.    NOT_WSAC_SGOP  : constant ERROR_INDICATOR := 5;
  3192.      
  3193. -- 6   GKS not in proper state: GKS shall be in either state
  3194. --     WSOP or in state WSAC
  3195.    NOT_WSOP_WSAC  : constant ERROR_INDICATOR := 6;
  3196.      
  3197. -- 7   GKS not in proper state: GKS shall be in one of the
  3198. --     states WSOP, WSAC or SGOP
  3199.    NOT_WSOP_WSAC_SGOP  : constant ERROR_INDICATOR := 7;
  3200.      
  3201. -- 8   GKS not in proper state: GKS shall be in one of the
  3202. --     states GKOP, WSOP, WSAC or SGOP
  3203.    NOT_GKOP_WSOP_WSAC_SGOP : constant ERROR_INDICATOR := 8;
  3204.      
  3205.      
  3206. -- WS ERRORS
  3207.      
  3208. -- 21  Specified connection identifier is invalid
  3209.    INVALID_CONN_ID  : constant ERROR_INDICATOR := 21;
  3210.      
  3211. -- 23  Specified workstation type does not exist
  3212.    WS_TYPE_DOES_NOT_EXIST : constant ERROR_INDICATOR := 23;
  3213.      
  3214. -- 24  Specified workstation is open
  3215.    WS_IS_OPEN       : constant ERROR_INDICATOR := 24;
  3216.      
  3217. -- 25  Specified workstation is not open
  3218.    WS_NOT_OPEN      : constant ERROR_INDICATOR := 25;
  3219.      
  3220. -- 26  Specified workstation cannot be opened
  3221.    WS_CANNOT_OPEN   : constant ERROR_INDICATOR := 26;
  3222.      
  3223. -- 27  Workstation Independent Segment Storage is not open
  3224.    WISS_NOT_OPEN    : constant ERROR_INDICATOR := 27;
  3225.      
  3226. -- 28  Workstation Independent Segment Storage is already open
  3227.    WISS_ALREADY_OPEN : constant ERROR_INDICATOR := 28;
  3228.      
  3229. -- 29  Specified workstation is active
  3230.    WS_IS_ACTIVE     : constant ERROR_INDICATOR := 29;
  3231.      
  3232. -- 30  Specified workstation is not active
  3233.    WS_IS_NOT_ACTIVE : constant ERROR_INDICATOR := 30;
  3234.      
  3235. -- 31  Specified workstation is of category MO
  3236.    WS_CATEGORY_IS_MO : constant ERROR_INDICATOR := 31;
  3237.      
  3238. -- 32  Specified workstation is not of category MO
  3239.    WS_CATEGORY_NOT_MO  : constant ERROR_INDICATOR := 32;
  3240.      
  3241. -- 33  Specified workstation is of category MI
  3242.    WS_CATEGORY_IS_MI   : constant ERROR_INDICATOR := 33;
  3243.      
  3244. -- 34  Specified workstation is not of category MI
  3245.    WS_CATEGORY_NOT_MI  : constant ERROR_INDICATOR := 34;
  3246.      
  3247. -- 35  Specified workstation is of category INPUT
  3248.    WS_CATEGORY_IS_INPUT : constant ERROR_INDICATOR := 35;
  3249.      
  3250. -- 36  Specified workstation is Workstation Independent
  3251. --     Segment Storage
  3252.    WS_IS_WISS           : constant ERROR_INDICATOR := 36;
  3253.      
  3254. -- 37  Specified workstation is not of category OUTIN
  3255.    WS_CATEGORY_NOT_OUTIN : constant ERROR_INDICATOR := 37;
  3256.      
  3257. -- 38  Specified workstation is neither of category INPUT nor
  3258. --     of category OUTIN
  3259.    WS_NOT_INPUT_OUTIN    : constant ERROR_INDICATOR := 38;
  3260.      
  3261. -- 39  Specified workstation is neither of category OUTPUT nor
  3262. --     of category OUTIN
  3263.    WS_NOT_OUTPUT_OUTIN   : constant ERROR_INDICATOR := 39;
  3264.      
  3265. -- 40  Specified workstation has no pixel store readback
  3266. --     capability
  3267.    WS_CANNOT_PIXEL_READBACK : constant ERROR_INDICATOR := 40;
  3268.      
  3269. -- 41  Specified workstation type is not able to generate the
  3270. --     specified generalized drawing primitive
  3271.    WS_TYPE_CANNOT_GEN_GDP   : constant ERROR_INDICATOR := 41;
  3272.      
  3273. -- 42  Maximum number of simultaneously open workstations would
  3274. --     be exceeded
  3275.    MAX_NUM_OF_OPEN_WS       : constant ERROR_INDICATOR := 42;
  3276.      
  3277. -- 43  Maximum number of simultaneously active workstations would
  3278. --     be exceeded
  3279.    MAX_NUM_OF_ACTIVE_WS     : constant ERROR_INDICATOR := 43;
  3280.      
  3281.      
  3282. -- TRANSFORMATION ERRORS
  3283.      
  3284. -- 50  Transformation number is invalid
  3285.    INVALID_XFORM_NUMBER           : constant ERROR_INDICATOR :=50;
  3286.      
  3287. -- 51  Rectangle definition is invalid
  3288.    INVALID_RECTANGLE              : constant ERROR_INDICATOR :=51;
  3289.      
  3290. -- 52  Viewport is not within the Normalized Device Coordinate
  3291. --     unit square
  3292.    VIEWPORT_NOT_IN_NDC_UNIT_SQR        : constant ERROR_INDICATOR :=52;
  3293.      
  3294. -- 53  Workstation window is not within the Normalized Device
  3295. --     Coordinate unit square
  3296.    WS_WINDOW_NOT_IN_NDC_UNIT_SQR    : constant ERROR_INDICATOR :=53;
  3297.      
  3298. -- 54  Workstation viewport is not within the display space
  3299.    WS_VIEWPORT_NOT_IN_DISPLAY_SPACE : constant ERROR_INDICATOR :=54;
  3300.      
  3301.      
  3302. -- OUTPUT ATTRIBUTE ERRORS
  3303.      
  3304. -- 60  Polyline index is invalid
  3305. --     This error is precluded by the Ada language.
  3306.    INVALID_POLYLINE_INDEX     : constant ERROR_INDICATOR := 60;
  3307.      
  3308. -- 61  A representation for the specified polyline index has not
  3309. --     been defined on this workstation
  3310.    NO_POLYLINE_REP            : constant ERROR_INDICATOR := 61;
  3311.      
  3312. -- 62  A representation for the specified polyline index has not
  3313. --     been predefined on this workstation
  3314.    NO_PREDEF_POLYLINE_REP     : constant ERROR_INDICATOR := 62;
  3315.      
  3316. -- 63  Linetype is equal to zero
  3317.    LINETYPE_IS_ZERO           : constant ERROR_INDICATOR := 63;
  3318.      
  3319. -- 64  Specified linetype is not supported on this workstation
  3320.    LINETYPE_NOT_ON_WS         : constant ERROR_INDICATOR := 64;
  3321.      
  3322. -- 66  Polymarker index is invalid
  3323. --     This error is precluded by the Ada language.
  3324.    INVALID_POLYMARKER_INDEX   : constant ERROR_INDICATOR := 66;
  3325.      
  3326. -- 67  A representation for the specified polymarker index has
  3327. --     not been defined on this workstation
  3328.    NO_POLYMARKER_REP          : constant ERROR_INDICATOR := 67;
  3329.      
  3330. -- 68  A representation for the specified polymarker index has not
  3331. --     been predefined on this workstation
  3332.    NO_PREDEF_POLYMARKER_REP   : constant ERROR_INDICATOR := 68;
  3333.      
  3334. -- 69  Marker type is equal to zero
  3335.    MARKER_TYPE_IS_ZERO        : constant ERROR_INDICATOR := 69;
  3336.      
  3337. -- 70  Specified marker type is not supported on this workstation
  3338.    MARKER_TYPE_NOT_ON_WS      : constant ERROR_INDICATOR := 70;
  3339.      
  3340. -- 72  Text index is invalid
  3341. --     This error is precluded by the Ada language.
  3342.    INVALID_TEXT_INDEX         : constant ERROR_INDICATOR := 72;
  3343.      
  3344. -- 73  A representation for the specified text index has not been
  3345. --     defined on this workstation
  3346.    NO_TEXT_REP                : constant ERROR_INDICATOR := 73;
  3347.      
  3348. -- 74  A representation for the specified text index has not
  3349. --     been predefined on this workstation
  3350.    NO_PREDEF_TEXT_REP         : constant ERROR_INDICATOR := 74;
  3351.      
  3352. -- 75  Text font is equal to zero
  3353.    TEXT_FONT_IS_ZERO          : constant ERROR_INDICATOR := 75;
  3354.      
  3355. -- 76  Requested text font is not supported for the specified
  3356. --     precision on this workstation
  3357.    TEXT_FONT_NOT_ON_WS        : constant ERROR_INDICATOR := 76;
  3358.      
  3359. -- 79  Length of character up vector is zero
  3360.    CHAR_UP_VECTOR_IS_ZERO     : constant ERROR_INDICATOR := 79;
  3361.      
  3362. -- 80  Fill area index is invalid
  3363. --     This error is precluded by the Ada language.
  3364.    INVALID_FILL_AREA_INDEX    : constant ERROR_INDICATOR := 80;
  3365.      
  3366. -- 81  A representation for the specified fill area index has
  3367. --     not been defined on this workstation
  3368.    NO_FILL_AREA_REP           : constant ERROR_INDICATOR := 81;
  3369.      
  3370. -- 82  A representation for the specified fill area index has
  3371. --     not been predefined on this workstation
  3372.    NO_PREDEF_FILL_AREA_REP    : constant ERROR_INDICATOR := 82;
  3373.      
  3374. -- 83  Specified fill area interior style is not supported on
  3375. --     this workstation
  3376.    FILL_AREA_STYLE_NOT_ON_WS  : constant ERROR_INDICATOR := 83;
  3377.      
  3378. -- 84  Style (pattern or hatch) index is equal to zero
  3379.    STYLE_INDEX_IS_ZERO        : constant ERROR_INDICATOR :=84;
  3380.      
  3381. -- 85  Specified pattern index is invalid                      -- DR022
  3382.    INVALID_PATTERN_INDEX      : constant ERROR_INDICATOR :=85; -- DR022
  3383.                                                                -- DR022
  3384. -- 86  Specified hatch style is not supported on this workstation
  3385.    HATCH_STYLE_NOT_ON_WS      : constant ERROR_INDICATOR :=86;
  3386.      
  3387. -- 88  A representation for the specified pattern index has not
  3388. --     been defined on this workstation
  3389.    NO_PATTERN_REP             : constant ERROR_INDICATOR :=88;
  3390.      
  3391. -- 89  A representation for the specified pattern index has not
  3392. --     been predefined on this workstation
  3393.    NO_PREDEF_PATTERN_REP      : constant ERROR_INDICATOR :=89;
  3394.      
  3395. -- 90  Interior style PATTERN is not supported on this worksta-
  3396. --     tion
  3397.    PATTERN_STYLE_NOT_ON_WS    : constant ERROR_INDICATOR :=90;
  3398.      
  3399. -- 93  Colour index is invalid
  3400. --     This error is precluded by the Ada language.
  3401.    INVALID_COLOUR_INDEX       : constant ERROR_INDICATOR := 93;
  3402.      
  3403. -- 94  A representation for the specified colour index has not
  3404. --     been defined on this workstation
  3405.    NO_COLOUR_REP              : constant ERROR_INDICATOR := 94;
  3406.      
  3407. -- 95  A representation for the specified colour index has not
  3408. --     been predefined on this workstation
  3409.    NO_PREDEF_COLOUR_REP       : constant ERROR_INDICATOR := 95;
  3410.      
  3411.      
  3412. --   OUTPUT PRIMITIVE ERRORS
  3413.      
  3414. -- 100  Number of points is invalid
  3415.    INVALID_NUMBER_OF_POINTS        : constant ERROR_INDICATOR := 100;
  3416.      
  3417. -- 101  Invalid code in string
  3418.    INVALID_STRING_CODE        : constant ERROR_INDICATOR := 101;
  3419.      
  3420. -- 102  Generalized drawing primitive identifier is invalid
  3421.    INVALID_GDP_ID             : constant ERROR_INDICATOR := 102;
  3422.      
  3423. -- 103  Content of generalized drawing primitive data record
  3424. --       is invalid
  3425.    INVALID_GDP_DATA_RECORD    : constant ERROR_INDICATOR := 103;
  3426.      
  3427. -- 104  At least one active workstation is not able to generate
  3428. --      the specified generalized drawing primitive
  3429.    SOME_WS_CANNOT_GEN_GDP : constant ERROR_INDICATOR := 104;
  3430.      
  3431. -- 105  At least one active workstation is not able to generate
  3432. --      the specified generalized drawing primitive under the
  3433. --      current transformations and clipping rectangle
  3434.    SOME_WS_CANNOT_GEN_XFORM_CLIP_GDP : constant ERROR_INDICATOR := 105;
  3435.      
  3436. -- SEGMENT_ERROR
  3437.      
  3438. -- 121 Specified segment name is already in use
  3439.    SEGMENT_IN_USE              : constant ERROR_INDICATOR := 121;
  3440.      
  3441. -- 122 Specified segment does not exist
  3442.    SEGMENT_DOES_NOT_EXIST      : constant ERROR_INDICATOR := 122;
  3443.      
  3444. -- 123 Specified segment does not exist on specified workstation
  3445.    SEGMENT_NOT_ON_WS           : constant ERROR_INDICATOR := 123;
  3446.      
  3447. -- 124 Specified segment does not exist on Workstation
  3448. --     Independent segment storage
  3449.    SEGMENT_NOT_ON_WISS         : constant ERROR_INDICATOR := 124;
  3450.      
  3451. -- 125 Specified segment is open
  3452.    SEGMENT_IS_OPEN             : constant ERROR_INDICATOR := 125;
  3453.      
  3454.      
  3455. --      INPUT ERROR
  3456.      
  3457. -- 140 Specified input device is not present on workstation
  3458.    INPUT_DEVICE_NOT_ON_WS  : constant ERROR_INDICATOR := 140;
  3459.      
  3460. -- 141 Input device is not in REQUEST mode
  3461.    INPUT_DEVICE_NOT_REQUEST : constant ERROR_INDICATOR := 141;
  3462.      
  3463. -- 142 Input device is not in SAMPLE mode
  3464.    INPUT_DEVICE_NOT_SAMPLE : constant ERROR_INDICATOR := 142;
  3465.      
  3466. -- 143 EVENT and SAMPLE input mode are not available at
  3467. --     this level of GKS
  3468.    NO_EVENT_OR_SAMPLE      : constant ERROR_INDICATOR := 143;
  3469.      
  3470. -- 144 Specified prompt and echo type is not supported on
  3471. --     this workstation
  3472.    NO_PROMPT_AND_ECHO_ON_WS : constant ERROR_INDICATOR := 144;
  3473.      
  3474. -- 145 Echo area is outside display space
  3475.    ECHO_AREA_OUT_OF_DISPLAY : constant ERROR_INDICATOR := 145;
  3476.      
  3477. -- 146 Contents of input data record are invalid
  3478.    INVALID_INPUT_DATA_RECORD : constant ERROR_INDICATOR := 146;
  3479.      
  3480. -- 147 Input queue has overflowed
  3481.    INPUT_QUEUE_OVERFLOW     : constant ERROR_INDICATOR := 147;
  3482.      
  3483. -- 148 Input queue has not overflowed since GKS was opened or
  3484. --     the last invocation of INQUIRE INPUT QUEUE OVERFLOW
  3485.    NO_INPUT_QUEUE_OVERFLOW : constant ERROR_INDICATOR := 148;
  3486.      
  3487. -- 149 Input queue has overflowed, but associated workstation
  3488. --     has been closed
  3489.    INPUT_QUEUE_OVERFLOW_NO_WS : constant ERROR_INDICATOR := 149;
  3490.      
  3491. -- 150 No input value of the correct class is in the
  3492. --     current event report
  3493.    NO_INPUT_VALUE_FOR_CLASS : constant ERROR_INDICATOR := 150;
  3494.      
  3495. -- 152 Initial value is invalid
  3496.    INVALID_INITIAL_VALUE         : constant ERROR_INDICATOR := 152;
  3497.      
  3498. -- 153 Number of points in the initial stroke is greater than the
  3499. --     buffer size
  3500.    EXCEEDED_INITIAL_STROKE_POINTS : constant ERROR_INDICATOR := 153;
  3501.      
  3502. -- 154  Length of the initial string is greater than the buffer size
  3503.    EXCEEDED_INITIAL_STRING_LENGTH : constant ERROR_INDICATOR := 154;
  3504.      
  3505.      
  3506. -- METAFILE ERRORS
  3507.      
  3508. -- 160 Item type is not allowed for user items
  3509.    ITEM_TYPE_NOT_ALLOWED      : constant ERROR_INDICATOR := 160;
  3510.      
  3511. -- 161 Item length is invalid
  3512.    INVALID_ITEM_LENGTH        : constant ERROR_INDICATOR := 161;
  3513.      
  3514. -- 162 No item is left in GKS metafile input
  3515.    NO_ITEM_IN_GKSM_INPUT      : constant ERROR_INDICATOR := 162;
  3516.      
  3517. -- 163 Metafile item is invalid
  3518.    INVALID_METAFILE_ITEM      : constant ERROR_INDICATOR := 163;
  3519.      
  3520. -- 164 Item type is not a valid GKS item
  3521.    INVALID_GKS_ITEM_TYPE      : constant ERROR_INDICATOR := 164;
  3522.      
  3523. -- 165 Content of item data record is invalid for the specified
  3524. --     item type
  3525.    INVALID_ITEM_DATA_RECORD   : constant ERROR_INDICATOR := 165;
  3526.      
  3527. -- 167 User item cannot be interpreted
  3528.    CANNOT_INTERPRET_USER_ITEM   : constant ERROR_INDICATOR := 167;
  3529.      
  3530. -- 168 Specified function is not supported at this level of GKS
  3531.    FUNCTION_NOT_SUPPORTED     : constant ERROR_INDICATOR := 168;
  3532.      
  3533.      
  3534.      
  3535. -- ESCAPE ERRORS
  3536.      
  3537. -- 180 Specified escape function is not supported
  3538.    ESCAPE_FUNCTION_NOT_SUPPORTED : constant ERROR_INDICATOR := 180;
  3539.      
  3540. -- 181 Specified escape function identification is invalid
  3541.    INVALID_ESCAPE_ID           : constant ERROR_INDICATOR := 181;
  3542.      
  3543. -- 182 Contents of escape data record are invalid
  3544.    INVALID_ESCAPE_DATA_RECORD       : constant ERROR_INDICATOR := 182;
  3545.      
  3546.      
  3547.      
  3548. -- MISCELLANEOUS ERRORS
  3549.      
  3550. -- 200 Specified error file is invalid
  3551.    INVALID_ERROR_FILE          : constant ERROR_INDICATOR := 200;
  3552.      
  3553.      
  3554.      
  3555. -- SYSTEM ERRORS
  3556.      
  3557. -- 300 Storage overflow has occurred in GKS
  3558.    GKS_STORAGE_OVERFLOW       : constant ERROR_INDICATOR := 300;
  3559.      
  3560. -- 301 Storage overflow has occurred in segment storage
  3561.    SEGMENT_STORAGE_OVERFLOW   : constant ERROR_INDICATOR := 301;
  3562.      
  3563. -- 302 Input/Output error has occurred while reading
  3564.    IO_ERROR_WHILE_READING     : constant ERROR_INDICATOR := 302;
  3565.      
  3566. -- 303 Input/Output error has occurred while writing
  3567.    IO_ERROR_WHILE_WRITING     : constant ERROR_INDICATOR := 303;
  3568.      
  3569. -- 304 Input/Output error has occurred while sending data to a
  3570. --     workstation
  3571.    IO_ERROR_WHILE_SENDING_WS  : constant ERROR_INDICATOR := 304;
  3572.      
  3573. -- 305 Input/Output error has occurred while receiving data
  3574. --     from a workstation
  3575.    IO_ERROR_WHILE_RECEIVE_WS  : constant ERROR_INDICATOR := 305;
  3576.      
  3577. -- 306 Input/Output error has occurred during program library
  3578. --     management
  3579.    IO_ERROR_LIBRARY_MANAGEMENT  : constant ERROR_INDICATOR := 306;
  3580.      
  3581. -- 307 Input/Output error has occurred while reading workstation
  3582. --     description table
  3583.    IO_ERROR_READING_WS_DESCR  : constant ERROR_INDICATOR := 307;
  3584.      
  3585. -- 308 Arithmetic error has occurred
  3586.    ARITHMETIC                 : constant ERROR_INDICATOR := 308;
  3587.      
  3588.      
  3589.      
  3590. -- LANGUAGE BINDING ERRORS
  3591.      
  3592. -- 2500 Invalid use of input data record
  3593.    INVALID_USE_OF_INPUT_DATA  : constant ERROR_INDICATOR := 2500;
  3594.      
  3595.      
  3596. -- OTHERS
  3597.      
  3598. -- 2501 Unknown error occurred during processing.
  3599.    UNKNOWN               : constant ERROR_INDICATOR := 2501;
  3600.      
  3601. end GKS_ERRORS;
  3602. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3603. --:UDD:GKSADACM:CODE:0A:INQ_GKS_DSCR_TBL_0A.ADA
  3604. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3605. ------------------------------------------------------------------
  3606. --
  3607. --  NAME: INQ_GKS_DESCRIPTION_TABLE_0A
  3608. --  IDENTIFIER: GIMXXX.1(1)
  3609. --  DISCREPANCY REPORTS:
  3610. --
  3611. ------------------------------------------------------------------
  3612. -- file:  inq_gks_dscr_tbl_0a.ada
  3613. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  3614.      
  3615. with GKS_TYPES;
  3616.      
  3617. use GKS_TYPES;
  3618.      
  3619. package INQ_GKS_DESCRIPTION_TABLE_0A is
  3620.      
  3621. -- This package provides the procedures for inquiring the
  3622. -- GKS_DESCRIPTION_TABLE for level 0a.
  3623.      
  3624.    procedure INQ_LIST_OF_AVAILABLE_WS_TYPES
  3625.       (EI   : out ERROR_INDICATOR;
  3626.       TYPES : out WS_TYPES.LIST_OF);
  3627.      
  3628.    procedure INQ_MAX_NORMALIZATION_TRANSFORMATION_NUMBER
  3629.       (EI            : out ERROR_INDICATOR;
  3630.       TRANSFORMATION : out TRANSFORMATION_NUMBER);
  3631.      
  3632. end INQ_GKS_DESCRIPTION_TABLE_0A;
  3633. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3634. --:UDD:GKSADACM:CODE:0A:INQ_GKS_ST_LST_0A.ADA
  3635. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3636. ------------------------------------------------------------------
  3637. --
  3638. --  NAME: INQ_GKS_STATE_LIST_0A
  3639. --  IDENTIFIER: GIMXXX.1(1)
  3640. --  DISCREPANCY REPORTS:
  3641. --
  3642. ------------------------------------------------------------------
  3643. -- file:  inq_gks_st_lst_0a.ada
  3644. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  3645.      
  3646. with GKS_TYPES;
  3647.      
  3648. use GKS_TYPES;
  3649.      
  3650. package INQ_GKS_STATE_LIST_0A is
  3651.      
  3652. -- This package provides the procedures to inquire the GKS_
  3653. -- STATE_LIST at levels no lower than 0a.
  3654.      
  3655.    procedure INQ_OPERATING_STATE_VALUE
  3656.       (VALUE : out OPERATING_STATE);
  3657.      
  3658.    procedure INQ_SET_OF_OPEN_WS
  3659.       (EI : out ERROR_INDICATOR;
  3660.       WS  : out WS_IDS.LIST_OF);
  3661.      
  3662.    procedure INQ_LIST_OF_NORMALIZATION_TRANSFORMATION_NUMBERS
  3663.       (EI  : out ERROR_INDICATOR;
  3664.       LIST : out TRANSFORMATION_PRIORITY_LIST);
  3665.      
  3666. end INQ_GKS_STATE_LIST_0A;
  3667. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3668. --:UDD:GKSADACM:CODE:0A:INQ_WS_DSCR_TBL_0A.ADA
  3669. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3670. -- file:  inq_ws_dscr_tbl_0a.ada
  3671. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  3672.      
  3673. with GKS_TYPES;
  3674.      
  3675. use GKS_TYPES;
  3676.      
  3677. package INQ_WS_DESCRIPTION_TABLE_0A is
  3678.      
  3679. -- This package provides the procedures for inquiring the work-
  3680. -- station description table.
  3681.      
  3682.    procedure INQ_WS_CATEGORY
  3683.       (WS      : in WS_TYPE;
  3684.       EI       : out ERROR_INDICATOR;
  3685.       CATEGORY : out WS_CATEGORY);
  3686.      
  3687.    procedure INQ_WS_CLASS
  3688.       (WS   : in WS_TYPE;
  3689.       EI    : out ERROR_INDICATOR;
  3690.       CLASS : out DISPLAY_CLASS);
  3691.      
  3692.    procedure INQ_PREDEFINED_POLYLINE_REPRESENTATION
  3693.       (WS    : in WS_TYPE;
  3694.       INDEX  : in POLYLINE_INDEX;
  3695.       EI     : out ERROR_INDICATOR;
  3696.       LINE   : out LINETYPE;
  3697.       WIDTH  : out LINE_WIDTH;
  3698.       COLOUR : out COLOUR_INDEX);
  3699.      
  3700.    procedure INQ_PREDEFINED_POLYMARKER_REPRESENTATION
  3701.       (WS    : in WS_TYPE;
  3702.       INDEX  : in POLYMARKER_INDEX;
  3703.       EI     : out ERROR_INDICATOR;
  3704.       MARKER : out MARKER_TYPE;
  3705.       SIZE   : out MARKER_SIZE;
  3706.       COLOUR : out COLOUR_INDEX);
  3707.      
  3708.    procedure INQ_PREDEFINED_TEXT_REPRESENTATION
  3709.       (WS            : in WS_TYPE;
  3710.       INDEX          : in TEXT_INDEX;
  3711.       EI             : out ERROR_INDICATOR;
  3712.       FONT_PRECISION : out TEXT_FONT_PRECISION;
  3713.       EXPANSION      : out CHAR_EXPANSION;
  3714.       SPACING        : out CHAR_SPACING;
  3715.       COLOUR         : out COLOUR_INDEX);
  3716.      
  3717.    procedure INQ_PREDEFINED_FILL_AREA_REPRESENTATION
  3718.       (WS      : in WS_TYPE;
  3719.       INDEX    : in FILL_AREA_INDEX;
  3720.       EI       : out ERROR_INDICATOR;
  3721.       INTERIOR : out INTERIOR_STYLE;
  3722.       STYLE    : out STYLE_INDEX;
  3723.       COLOUR   : out COLOUR_INDEX);
  3724.      
  3725.    procedure INQ_PATTERN_FACILITIES
  3726.       (WS               : in WS_TYPE;
  3727.       EI                : out ERROR_INDICATOR;
  3728.       NUMBER_OF_INDICES : out NATURAL);
  3729.      
  3730.    procedure INQ_PREDEFINED_PATTERN_REPRESENTATION
  3731.       (WS     : in WS_TYPE;
  3732.       INDEX   : in PATTERN_INDEX;
  3733.       EI      : out ERROR_INDICATOR;
  3734.       LAST_X  : out NATURAL;
  3735.       LAST_Y  : out NATURAL;
  3736.       PATTERN : out COLOUR_MATRICES.VARIABLE_MATRIX_OF);
  3737.      
  3738.    procedure INQ_PREDEFINED_COLOUR_REPRESENTATION
  3739.       (WS    : in WS_TYPE;
  3740.       INDEX  : in COLOUR_INDEX;
  3741.       EI     : out ERROR_INDICATOR;
  3742.       COLOUR : out COLOUR_REPRESENTATION);
  3743.      
  3744.    procedure INQ_LIST_OF_AVAILABLE_GDP
  3745.       (WS         : in WS_TYPE;
  3746.       EI          : out ERROR_INDICATOR;
  3747.       LIST_OF_GDP : out GDP_IDS.LIST_OF);
  3748.      
  3749.    procedure INQ_GDP
  3750.       (WS    : in WS_TYPE;
  3751.       GDP    : in GDP_ID;
  3752.       EI     : out ERROR_INDICATOR;
  3753.       LIST_OF_ATTRIBUTES_USED : out ATTRIBUTES_USED.LIST_OF);
  3754.      
  3755. end INQ_WS_DESCRIPTION_TABLE_0A;
  3756. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3757. --:UDD:GKSADACM:CODE:0A:INQ_WS_ST_LST_0A.ADA
  3758. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3759. ------------------------------------------------------------------
  3760. --
  3761. --  NAME: INQ_WS_STATE_LIST_0A
  3762. --  IDENTIFIER: GIMXXX.1(1)
  3763. --  DISCREPANCY REPORTS:
  3764. --
  3765. ------------------------------------------------------------------
  3766. -- file:  inq_ws_st_lst_0a.ada
  3767. -- level: 0a, 1a, 2a, 0b, 0c
  3768.      
  3769. with GKS_TYPES;
  3770.      
  3771. use GKS_TYPES;
  3772.      
  3773. package INQ_WS_STATE_LIST_0A is
  3774.      
  3775. -- This package provides the procedures for calling the work-
  3776. -- station manager to inquire the workstation state lists
  3777. -- at levels no lower than 0a.
  3778.      
  3779.    procedure INQ_WS_STATE
  3780.       (WS   : in WS_ID;
  3781.       EI    : out ERROR_INDICATOR;
  3782.       STATE : out WS_STATE);
  3783.      
  3784.    procedure INQ_WS_DEFERRAL_AND_UPDATE_STATES
  3785.       (WS          : in WS_ID;
  3786.       EI           : out ERROR_INDICATOR;
  3787.       DEFERRAL     : out DEFERRAL_MODE;
  3788.       REGENERATION : out REGENERATION_MODE;
  3789.       DISPLAY      : out DISPLAY_SURFACE_EMPTY;
  3790.       FRAME_ACTION : out NEW_FRAME_NECESSARY);
  3791.      
  3792. end INQ_WS_STATE_LIST_0A;
  3793. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3794. --:UDD:GKSADACM:CODE:0A:PIXELS.ADA
  3795. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3796. -- file:  pixels.ada
  3797. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  3798.      
  3799. with GKS_TYPES;
  3800.      
  3801. use GKS_TYPES;
  3802.      
  3803. package PIXELS is
  3804.      
  3805. -- This package provides the procedures for calling the work-
  3806. -- station manager to inquire information about pixels.
  3807.      
  3808.    procedure INQ_PIXEL_ARRAY_DIMENSIONS
  3809.       (WS          : in WS_ID;
  3810.       CORNER_1_1   : in WC.POINT;
  3811.       CORNER_DX_DY : in WC.POINT;
  3812.       EI           : out ERROR_INDICATOR;
  3813.       DIMENSIONS   : out RASTER_UNIT_SIZE);
  3814.      
  3815.    procedure INQ_PIXEL_ARRAY
  3816.       (WS            : in WS_ID;
  3817.       CORNER         : in WC.POINT;
  3818.       DX             : in RASTER_UNITS;
  3819.       DY             : in RASTER_UNITS;
  3820.       EI             : out ERROR_INDICATOR;
  3821.       INVALID_VALUES : out INVALID_VALUES_INDICATOR;
  3822.       LAST_X         : out NATURAL;
  3823.       LAST_Y         : out NATURAL;
  3824.       PIXEL_ARRAY    : out PIXEL_COLOUR_MATRICES.VARIABLE_MATRIX_OF);
  3825.      
  3826.    procedure INQ_PIXEL
  3827.       (WS    : in WS_ID;
  3828.       POINT  : in WC.POINT;
  3829.       EI     : out ERROR_INDICATOR;
  3830.       COLOUR : out PIXEL_COLOUR_INDEX);
  3831.      
  3832. end PIXELS;
  3833. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3834. --:UDD:GKSADACM:CODE:0A:SET_BUNDLE_IDX.ADA
  3835. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3836. ------------------------------------------------------------------
  3837. --
  3838. --  NAME: SET_BUNDLE_INDICES
  3839. --  IDENTIFIER: GIMXXX.1(1)
  3840. --  DISCREPANCY REPORTS:
  3841. --
  3842. ------------------------------------------------------------------
  3843. -- file:  set_bundle_idx.ada
  3844. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  3845.      
  3846. with GKS_TYPES;
  3847.      
  3848. use GKS_TYPES;
  3849.      
  3850. package SET_BUNDLE_INDICES is
  3851.      
  3852. -- This package provides the procedures for setting the values of
  3853. -- the bundle table indices.
  3854.      
  3855.    procedure SET_POLYLINE_INDEX
  3856.       (INDEX : in POLYLINE_INDEX);
  3857.      
  3858.    procedure SET_POLYMARKER_INDEX
  3859.       (INDEX : in POLYMARKER_INDEX);
  3860.      
  3861.    procedure SET_TEXT_INDEX
  3862.       (INDEX : in TEXT_INDEX);
  3863.      
  3864.    procedure SET_FILL_AREA_INDEX
  3865.       (INDEX : in FILL_AREA_INDEX);
  3866.      
  3867. end SET_BUNDLE_INDICES;
  3868. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3869. --:UDD:GKSADACM:CODE:0A:SET_INDV_ATTR_0A.ADA
  3870. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3871. ------------------------------------------------------------------
  3872. --
  3873. --  NAME: SET_INDIVIDUAL_ATTRIBUTES_0A
  3874. --  IDENTIFIER: GIMXXX.1(1)
  3875. --  DISCREPANCY REPORTS:
  3876. --
  3877. ------------------------------------------------------------------
  3878. -- file:  set_indv_attr_0a.ada
  3879. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  3880.      
  3881. with GKS_TYPES;
  3882.      
  3883. use GKS_TYPES;
  3884.      
  3885. package SET_INDIVIDUAL_ATTRIBUTES_0A is
  3886.      
  3887. -- This package provides the procedures for setting the values of
  3888. -- the workstation independent primitive attributes.
  3889.      
  3890.    procedure SET_LINEWIDTH_SCALE_FACTOR
  3891.       (WIDTH : in LINE_WIDTH);
  3892.      
  3893.    procedure SET_MARKER_SIZE_SCALE_FACTOR
  3894.       (SIZE : in MARKER_SIZE);
  3895.      
  3896.    procedure SET_TEXT_FONT_AND_PRECISION
  3897.       (FONT_PRECISION : in TEXT_FONT_PRECISION);
  3898.      
  3899.    procedure SET_CHAR_EXPANSION_FACTOR
  3900.       (EXPANSION : in CHAR_EXPANSION);
  3901.      
  3902.    procedure SET_CHAR_SPACING
  3903.       (SPACING : in CHAR_SPACING);
  3904.      
  3905.    procedure SET_FILL_AREA_STYLE_INDEX
  3906.       (INDEX : in STYLE_INDEX);
  3907.      
  3908.    procedure SET_ASF
  3909.       (ASF : in ASF_LIST);
  3910.      
  3911. end SET_INDIVIDUAL_ATTRIBUTES_0A;
  3912. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3913. --:UDD:GKSADACM:CODE:0A:SET_PRIM_ATTR_0A.ADA
  3914. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3915. ------------------------------------------------------------------
  3916. --
  3917. --  NAME: SET_PRIMITIVE_ATTRIBUTES_0A
  3918. --  IDENTIFIER: GIMXXX.1(1)
  3919. --  DISCREPANCY REPORTS:
  3920. --
  3921. ------------------------------------------------------------------
  3922. -- file:  set_prim_attr_0a.ada
  3923. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  3924.      
  3925. with GKS_TYPES;
  3926.      
  3927. use GKS_TYPES;
  3928.      
  3929. package SET_PRIMITIVE_ATTRIBUTES_0A is
  3930.      
  3931. -- This package provides the procedures for setting the values
  3932. -- of the workstation independent primitive attributes.
  3933.      
  3934.    procedure SET_TEXT_PATH
  3935.       (PATH : in TEXT_PATH);
  3936.      
  3937.    procedure SET_PATTERN_SIZE
  3938.       (SIZE : in WC.SIZE);
  3939.      
  3940.    procedure SET_PATTERN_REFERENCE_POINT
  3941.       (POINT : in WC.POINT);
  3942.      
  3943. end SET_PRIMITIVE_ATTRIBUTES_0A;
  3944. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3945. --:UDD:GKSADACM:CODE:0A:GKS_DSCR_TBL_0A.ADA
  3946. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3947. ------------------------------------------------------------------
  3948. --
  3949. --  NAME: GKS_DESCRIPTION_TABLE
  3950. --  IDENTIFIER: GDMXXX.1(2)
  3951. --  DISCREPANCY REPORTS:
  3952. --  DR026  Initialization of list of available ws types fix.
  3953. ------------------------------------------------------------------
  3954. -- file:  gks_dscr_tbl_0a.ada
  3955.  --level: 0a
  3956.      
  3957. with GKS_CONFIGURATION;
  3958. with GKS_TYPES;
  3959.      
  3960. use GKS_TYPES;
  3961.      
  3962. package GKS_DESCRIPTION_TABLE is
  3963.      
  3964.    LEVEL_OF_GKS               : GKS_LEVEL := L0A;
  3965.      
  3966.    LIST_OF_AVAILABLE_WS_TYPES : WS_TYPES.LIST_OF;
  3967.      
  3968.    MAX_OPEN_WS                : POSITIVE  := GKS_CONFIGURATION
  3969.                                             .MAX_NUMBER_OPEN_WS;
  3970.      
  3971.    MAX_ACTIVE_WS              : POSITIVE  := GKS_CONFIGURATION
  3972.                                             .MAX_NUMBER_ACTIVE_WS;
  3973.      
  3974.    MAX_NORMALIZATION_TRANSFORMATION_NUMBER : TRANSFORMATION_NUMBER
  3975.           := GKS_CONFIGURATION.MAX_NORMALIZATION_TRANSFORMATION_NUMBER;
  3976.      
  3977. end GKS_DESCRIPTION_TABLE;
  3978. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3979. --:UDD:GKSADACM:CODE:MA:GKS_ST_LST.ADA
  3980. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  3981. ------------------------------------------------------------------
  3982. --
  3983. --  NAME: GKS_STATE_LIST
  3984. --  IDENTIFIER: GIMXXX.1(1)
  3985. --  DISCREPANCY REPORTS:
  3986. --
  3987. ------------------------------------------------------------------
  3988. -- file:   gks_st_lst.ada
  3989. -- levels: ma, 0a, 1a, 2a
  3990.      
  3991. with GKS_TYPES;
  3992. with GKS_CONFIGURATION;
  3993.      
  3994. use GKS_TYPES;
  3995.      
  3996. package GKS_STATE_LIST is
  3997.      
  3998.    LIST_OF_OPEN_WS                         : WS_IDS.LIST_OF;
  3999.      
  4000.    LIST_OF_ACTIVE_WS                       : WS_IDS.LIST_OF;
  4001.      
  4002.    CURRENT_ASPECT_SOURCE_FLAGS             : ASF_LIST;
  4003.      
  4004.    -- Polyline attributes
  4005.      
  4006.    CURRENT_POLYLINE_INDEX                  : POLYLINE_INDEX;
  4007.    CURRENT_LINETYPE                        : LINETYPE;
  4008.    CURRENT_LINEWIDTH_SCALE_FACTOR          : LINE_WIDTH;
  4009.    CURRENT_POLYLINE_COLOUR_INDEX           : COLOUR_INDEX;
  4010.      
  4011.    -- Polymarker attributes
  4012.      
  4013.    CURRENT_POLYMARKER_INDEX                : POLYMARKER_INDEX;
  4014.    CURRENT_MARKER_TYPE                     : MARKER_TYPE;
  4015.    CURRENT_MARKER_SIZE_SCALE_FACTOR        : MARKER_SIZE;
  4016.    CURRENT_POLYMARKER_COLOUR_INDEX         : COLOUR_INDEX;
  4017.      
  4018.    -- Text attributes
  4019.      
  4020.    CURRENT_TEXT_INDEX                      : TEXT_INDEX;
  4021.    CURRENT_TEXT_FONT_AND_PRECISION         : TEXT_FONT_PRECISION;
  4022.    CURRENT_CHAR_EXPANSION_FACTOR           : CHAR_EXPANSION;
  4023.    CURRENT_CHAR_SPACING                    : CHAR_SPACING;
  4024.    CURRENT_TEXT_COLOUR_INDEX               : COLOUR_INDEX;
  4025.      
  4026.    -- The following text attributes are not bundleable.
  4027.      
  4028.    CURRENT_CHAR_HEIGHT                     : WC.MAGNITUDE;
  4029.    CURRENT_CHAR_UP_VECTOR                  : WC.VECTOR;
  4030.    CURRENT_TEXT_PATH                       : TEXT_PATH;
  4031.    CURRENT_TEXT_ALIGNMENT                  : TEXT_ALIGNMENT;
  4032.    CURRENT_CHAR_WIDTH                      : WC.MAGNITUDE;
  4033.    CURRENT_CHAR_BASE_VECTOR                : WC.VECTOR;
  4034.      
  4035.    -- Fill area attributes.
  4036.      
  4037.    CURRENT_FILL_AREA_INDEX                 : FILL_AREA_INDEX;
  4038.    CURRENT_FILL_AREA_INTERIOR_STYLE        : INTERIOR_STYLE;
  4039.    CURRENT_FILL_AREA_STYLE_INDEX           : STYLE_INDEX;
  4040.    CURRENT_FILL_AREA_COLOUR_INDEX          : COLOUR_INDEX;
  4041.      
  4042.    -- Pattern attributes for pattern fills.
  4043.      
  4044.    CURRENT_PATTERN_REFERENCE_POINT         : WC.POINT;
  4045.    CURRENT_PATTERN_HEIGHT_VECTOR           : WC.VECTOR;
  4046.    CURRENT_PATTERN_WIDTH_VECTOR            : WC.VECTOR;
  4047.    CURRENT_NORMALIZATION_TRANSFORMATION    : TRANSFORMATION_NUMBER;
  4048.      
  4049.    -- Window and Viewport attributes for transforming between coordinate
  4050.    -- systems.  The factors contain the scale factor and translation
  4051.    -- factor.
  4052.      
  4053.    type NORMALIZATION_TRANSFORMATION is
  4054.       record
  4055.          WINDOW      : WC.RECTANGLE_LIMITS;
  4056.          VIEWPORT    : NDC.RECTANGLE_LIMITS;
  4057.          NDC_FACTORS : TRANSFORMATION_MATRIX; -- Factors for NDC to WC.
  4058.          WC_FACTORS  : TRANSFORMATION_MATRIX; -- Factors for WC to NDC.
  4059.       end record;
  4060.      
  4061.    type NORMALIZATION_TRANSFORMATION_ARRAY is array
  4062.       (TRANSFORMATION_NUMBER range <>) of NORMALIZATION_TRANSFORMATION;
  4063.      
  4064.    LIST_OF_NORMALIZATION_TRANSFORMATIONS :
  4065.       NORMALIZATION_TRANSFORMATION_ARRAY
  4066.          (0..GKS_CONFIGURATION.MAX_NORMALIZATION_TRANSFORMATION_NUMBER);
  4067.      
  4068.    PRIORITY_LIST_OF_TRANSFORMATIONS : TRANSFORMATION_PRIORITY_LIST;
  4069.      
  4070.    -- Clipping attributes
  4071.    CLIP_INDICATOR                        : CLIPPING_INDICATOR;
  4072.      
  4073.    procedure INITIALIZE;
  4074.      
  4075. end GKS_STATE_LIST;
  4076. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4077. --:UDD:GKSADACM:CODE:MA:TRANS_FACT.ADA
  4078. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4079. ------------------------------------------------------------------
  4080. --
  4081. --  NAME: TRANSLATION_FACTORS
  4082. --  IDENTIFIER: GIMXXX.1(1)
  4083. --  DISCREPANCY REPORTS:
  4084. --
  4085. ------------------------------------------------------------------
  4086. -- file:   trans_fact.ada
  4087. -- levels: ma, 0a, 1a, 2a
  4088.      
  4089. with GKS_TYPES;
  4090.      
  4091. use GKS_TYPES;
  4092.      
  4093. package TRANSLATION_FACTORS is
  4094.      
  4095. -- The package TRANSLATION_FACTORS contains functions that compute
  4096. -- the scale factor and translation factor used in translating points
  4097. -- from one coordinate system to another.
  4098.      
  4099.    function GET_NORMALIZATION_FACTORS
  4100.       (WINDOW   : WC.RECTANGLE_LIMITS;
  4101.        VIEWPORT : NDC.RECTANGLE_LIMITS)
  4102.    return TRANSFORMATION_MATRIX;
  4103.      
  4104.    function GET_NORMALIZATION_FACTORS
  4105.       (WINDOW   : NDC.RECTANGLE_LIMITS;
  4106.        VIEWPORT : WC.RECTANGLE_LIMITS)
  4107.    return TRANSFORMATION_MATRIX;
  4108.      
  4109. end TRANSLATION_FACTORS;
  4110.      
  4111. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4112. --:UDD:GKSADACM:CODE:MA:TRANS_FACT_B.ADA
  4113. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4114. ------------------------------------------------------------------
  4115. --
  4116. --  NAME: TRANSLATION_FACTORS - BODY
  4117. --  IDENTIFIER: GIMXXX.1(1)
  4118. --  DISCREPANCY REPORTS:
  4119. --
  4120. ------------------------------------------------------------------
  4121. -- file:  trans_fact_b.ada
  4122. -- level: ma, 0a, 1a, 2a
  4123.      
  4124. package body TRANSLATION_FACTORS is
  4125.      
  4126. -- The package TRANSLATION_FACTORS contains functions that compute
  4127. -- the scale factor and translation factor used in translating points
  4128. -- from one coordinate system to another.
  4129.      
  4130.    function GET_NORMALIZATION_FACTORS
  4131.       (WINDOW   : WC.RECTANGLE_LIMITS;
  4132.        VIEWPORT : NDC.RECTANGLE_LIMITS)
  4133.    return TRANSFORMATION_MATRIX is
  4134.      
  4135.    -- The function GET_NORMALIZATON_FACTORS computes the scale factor
  4136.    -- translation factor for going from world coordinates to normalized
  4137.    -- device coordinates.  The final matrix consists of
  4138.    -- SX - X scale factor.
  4139.    -- SY - Y scale factor.
  4140.    -- TX - X translation factor.
  4141.    -- TY - Y translation factor.
  4142.    -- The matrix to be returned is:
  4143.    --     SX  0.0 TX
  4144.    --     0.0 SY  TY
  4145.    --
  4146.    -- WINDOW - The window coordinates.
  4147.    --
  4148.    -- VIEWPORT - The viewport coordinates.
  4149.      
  4150.    TEMPORARY : TRANSFORMATION_MATRIX;
  4151.    -- The matrix to return.
  4152.      
  4153.    begin
  4154.      
  4155.       -- The X scale factor.
  4156.       TEMPORARY (1,1) :=
  4157.                      (VIEWPORT.XMAX - VIEWPORT.XMIN)/
  4158.            (NDC_TYPE (WINDOW.XMAX - WINDOW.XMIN));
  4159.      
  4160.       -- Not used in translations.
  4161.       TEMPORARY (1,2) := 0.0;
  4162.      
  4163.       -- The X translation factor.
  4164.       TEMPORARY (1,3) :=
  4165.                        (VIEWPORT.XMIN) -
  4166.          (TEMPORARY  (1,1) * (NDC_TYPE(WINDOW.XMIN)) );
  4167.      
  4168.       -- Not used in translations.
  4169.       TEMPORARY (2,1) := 0.0;
  4170.      
  4171.       -- The Y scale factor.
  4172.       TEMPORARY (2,2) :=
  4173.                      (VIEWPORT.YMAX - VIEWPORT.YMIN) /
  4174.            (NDC_TYPE (WINDOW.YMAX - WINDOW.YMIN));
  4175.      
  4176.       -- The Y translation factor.
  4177.       TEMPORARY (2,3) :=
  4178.                          (VIEWPORT.YMIN) -
  4179.                          (TEMPORARY (2,2) * (NDC_TYPE (WINDOW.YMIN)) );
  4180.      
  4181.       return TEMPORARY;
  4182.      
  4183.    end GET_NORMALIZATION_FACTORS;
  4184.      
  4185.    function GET_NORMALIZATION_FACTORS
  4186.       (WINDOW   : NDC.RECTANGLE_LIMITS;
  4187.        VIEWPORT : WC.RECTANGLE_LIMITS)
  4188.    return TRANSFORMATION_MATRIX is
  4189.      
  4190.    -- The function GET_NORMALIZATON_FACTORS computes the scale factor
  4191.    -- translation factor for going from normalized device coordinates
  4192.    -- to world coordinates.  The final matrix consists of
  4193.    -- SX - X scale factor.
  4194.    -- SY - Y scale factor.
  4195.    -- TX - X translation factor.
  4196.    -- TY - Y translation factor.
  4197.    -- The matrix to be returned is:
  4198.    --     SX  0.0 TX
  4199.    --     0.0 SY  TY
  4200.    --
  4201.    -- WINDOW - The window coordinates.
  4202.    --
  4203.    -- VIEWPORT - The viewport coordinates.
  4204.      
  4205.    TEMPORARY : TRANSFORMATION_MATRIX;
  4206.    -- The matrix to be returned.
  4207.      
  4208.    begin
  4209.      
  4210.       -- X scale factor.
  4211.       TEMPORARY (1,1) :=
  4212.                (NDC_TYPE (VIEWPORT.XMAX - VIEWPORT.XMIN) )/
  4213.                          (WINDOW.XMAX - WINDOW.XMIN);
  4214.      
  4215.       -- Not used in translation.
  4216.       TEMPORARY (1,2) := 0.0;
  4217.      
  4218.       -- X translation factor.
  4219.       TEMPORARY (1,3) :=
  4220.              (NDC_TYPE (VIEWPORT.XMIN) ) -
  4221.          (TEMPORARY  (1,1) * (WINDOW.XMIN) );
  4222.      
  4223.       -- Not used in translation.
  4224.       TEMPORARY (2,1) := 0.0;
  4225.      
  4226.       -- Y scale factor.
  4227.       TEMPORARY (2,2) :=
  4228.            (NDC_TYPE (VIEWPORT.YMAX - VIEWPORT.YMIN) ) /
  4229.                      (WINDOW.YMAX - WINDOW.YMIN);
  4230.      
  4231.       -- Y translation factor.
  4232.       TEMPORARY (2,3) :=
  4233.               (NDC_TYPE (VIEWPORT.YMIN)) -
  4234.          (TEMPORARY (2,2) * (WINDOW.YMIN) );
  4235.      
  4236.       return TEMPORARY;
  4237.      
  4238.    end GET_NORMALIZATION_FACTORS;
  4239.      
  4240. end TRANSLATION_FACTORS;
  4241. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4242. --:UDD:GKSADACM:CODE:MA:GKS_ST_LST_B.ADA
  4243. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4244. ------------------------------------------------------------------
  4245. --
  4246. --  NAME: GKS_STATE_LIST - BODY
  4247. --  IDENTIFIER: GIMXXX.1(1)
  4248. --  DISCREPANCY REPORTS:
  4249. --
  4250. ------------------------------------------------------------------
  4251. -- file:   gks_st_lst_b.ada
  4252. -- levels: ma, 0a, 1a, 2a
  4253.      
  4254. with TRANSLATION_FACTORS;
  4255.      
  4256. package body GKS_STATE_LIST is
  4257.      
  4258.    procedure INITIALIZE is
  4259.      
  4260.    -- This procedure initializes the GKS_STATE_LIST to the default
  4261.    -- values given in the GKS specification manual.  It is called
  4262.    -- by the GKS procedure OPEN_GKS.
  4263.      
  4264.       begin
  4265.      
  4266.          LIST_OF_OPEN_WS := WS_IDS.NULL_LIST;
  4267.      
  4268.          LIST_OF_ACTIVE_WS := WS_IDS.NULL_LIST;
  4269.      
  4270.          CURRENT_ASPECT_SOURCE_FLAGS  :=
  4271.             (OTHERS => INDIVIDUAL);
  4272.      
  4273.          -- The following are componants with their type of the record
  4274.          -- type ASF_LIST and their default values:
  4275.          -- LINETYPE                     : ASF := INDIVIDUAL;
  4276.          -- LINE_WIDTH                   : ASF := INDIVIDUAL;
  4277.          -- LINE_COLOUR                  : ASF := INDIVIDUAL;
  4278.          -- MARKER_TYPE                  : ASF := INDIVIDUAL;
  4279.          -- MARKER_SIZE                  : ASF := INDIVIDUAL;
  4280.          -- MARKER_COLOUR                : ASF := INDIVIDUAL;
  4281.          -- TEXT_FONT_PRECISION          : ASF := INDIVIDUAL;
  4282.          -- CHAR_EXPANSION               : ASF := INDIVIDUAL;
  4283.          -- CHAR_SPACING                 : ASF := INDIVIDUAL;
  4284.          -- TEXT_COLOUR                  : ASF := INDIVIDUAL;
  4285.          -- INTERIOR_STYLE               : ASF := INDIVIDUAL;
  4286.          -- STYLE_INDEX                  : ASF := INDIVIDUAL;
  4287.          -- FILL_AREA_COLOUR             : ASF := INDIVIDUAL;
  4288.      
  4289.          -- Polyline attributes
  4290.      
  4291.          CURRENT_POLYLINE_INDEX  := 1;
  4292.          CURRENT_LINETYPE := 1;
  4293.          CURRENT_LINEWIDTH_SCALE_FACTOR := 1.0;
  4294.          CURRENT_POLYLINE_COLOUR_INDEX  := 1;
  4295.      
  4296.          -- Polymarker attributes
  4297.      
  4298.          CURRENT_POLYMARKER_INDEX := 1;
  4299.          CURRENT_MARKER_TYPE := 3;
  4300.          CURRENT_MARKER_SIZE_SCALE_FACTOR := 1.0;
  4301.          CURRENT_POLYMARKER_COLOUR_INDEX  := 1;
  4302.      
  4303.          -- Text attributes
  4304.      
  4305.          CURRENT_TEXT_INDEX := 1;
  4306.          CURRENT_TEXT_FONT_AND_PRECISION :=
  4307.             (1, STRING_PRECISION);
  4308.          CURRENT_CHAR_EXPANSION_FACTOR := 1.0;
  4309.          CURRENT_CHAR_SPACING := 0.0;
  4310.          CURRENT_TEXT_COLOUR_INDEX := 1;
  4311.      
  4312.          -- The following text attributes are not bundleable.
  4313.      
  4314.          CURRENT_CHAR_HEIGHT := 0.01;
  4315.          CURRENT_CHAR_UP_VECTOR  := (0.0, 1.0);
  4316.          CURRENT_TEXT_PATH  := RIGHT;
  4317.          CURRENT_TEXT_ALIGNMENT := (NORMAL, NORMAL);
  4318.          CURRENT_CHAR_WIDTH := 0.01;
  4319.          CURRENT_CHAR_BASE_VECTOR := (1.0, 0.0);
  4320.      
  4321.          -- Fill area attributes.
  4322.      
  4323.          CURRENT_FILL_AREA_INDEX := 1;
  4324.          CURRENT_FILL_AREA_INTERIOR_STYLE := HOLLOW;
  4325.          CURRENT_FILL_AREA_STYLE_INDEX := 1;
  4326.          CURRENT_FILL_AREA_COLOUR_INDEX := 1;
  4327.      
  4328.          -- Pattern attributes for pattern fills.
  4329.      
  4330.          CURRENT_PATTERN_REFERENCE_POINT := (0.0, 0.0);
  4331.          CURRENT_PATTERN_HEIGHT_VECTOR := (0.0,1.0);
  4332.          CURRENT_PATTERN_WIDTH_VECTOR := (1.0,0.0);
  4333.          CURRENT_NORMALIZATION_TRANSFORMATION := 0;
  4334.      
  4335.          PRIORITY_LIST_OF_TRANSFORMATIONS := (LENGTH => SMALL_NATURAL
  4336.             (GKS_CONFIGURATION.MAX_NORMALIZATION_TRANSFORMATION_NUMBER)
  4337.             + SMALL_NATURAL(1),CONTENTS =>(OTHERS => 0));
  4338.      
  4339.          -- Window and Viewport Attributes.
  4340.      
  4341.          for I in TRANSFORMATION_NUMBER(0)..GKS_CONFIGURATION.
  4342.             MAX_NORMALIZATION_TRANSFORMATION_NUMBER loop
  4343.      
  4344.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(I).WINDOW :=
  4345.                (0.0, 1.0, 0.0, 1.0);
  4346.      
  4347.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(I).VIEWPORT :=
  4348.                (0.0, 1.0, 0.0, 1.0);
  4349.      
  4350.             -- Scale factor and translation factor used to translate
  4351.             -- WC to NDC
  4352.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(I).NDC_FACTORS :=
  4353.                TRANSLATION_FACTORS.GET_NORMALIZATION_FACTORS
  4354.                (LIST_OF_NORMALIZATION_TRANSFORMATIONS(0).WINDOW,
  4355.                LIST_OF_NORMALIZATION_TRANSFORMATIONS(0).VIEWPORT);
  4356.      
  4357.             -- Scale factor and translation factor use to translate
  4358.             -- NDC to WC.
  4359.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(I).WC_FACTORS :=
  4360.                TRANSLATION_FACTORS.GET_NORMALIZATION_FACTORS
  4361.                (LIST_OF_NORMALIZATION_TRANSFORMATIONS(0).VIEWPORT,
  4362.                LIST_OF_NORMALIZATION_TRANSFORMATIONS(0).WINDOW);
  4363.      
  4364.             PRIORITY_LIST_OF_TRANSFORMATIONS.CONTENTS(POSITIVE(1+I)) := I;
  4365.      
  4366.          end loop;
  4367.      
  4368.          -- Clipping attributes
  4369.          CLIP_INDICATOR  := CLIP;
  4370.      
  4371.       end INITIALIZE;
  4372.      
  4373. end GKS_STATE_LIST;
  4374. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4375. --:UDD:GKSADACM:CODE:MA:TRANS_MATH.ADA
  4376. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4377. ------------------------------------------------------------------
  4378. --
  4379. --  NAME: TRANSFORMATION_MATH
  4380. --  IDENTIFIER: GIMXXX.1(2)
  4381. --  DISCREPANCY REPORTS:
  4382. --  DR038  Text height problem with window and viewport.
  4383. ------------------------------------------------------------------
  4384. -- file:   trans_math.ada
  4385. -- levels: ma, 0a, 1a, 2a
  4386.      
  4387. with GKS_TYPES;
  4388.      
  4389. use GKS_TYPES;
  4390.      
  4391. package TRANSFORMATION_MATH is
  4392.      
  4393. -- The package TRANSFORMATION_MATH contains functions to compute
  4394. -- transformations.
  4395.      
  4396.    function WC_TO_NDC
  4397.       (MATRIX : TRANSFORMATION_MATRIX;
  4398.        POINT  : WC.POINT)
  4399.    return NDC.POINT;
  4400.      
  4401.    function WC_TO_NDC
  4402.       (MATRIX : TRANSFORMATION_MATRIX;
  4403.        POINTS : WC.POINT_ARRAY)
  4404.    return NDC.POINT_ARRAY;
  4405.      
  4406.    function NDC_TO_WC
  4407.       (MATRIX : TRANSFORMATION_MATRIX;
  4408.        POINT  : NDC.POINT)
  4409.    return WC.POINT;
  4410.      
  4411.    function NDC_TO_WC
  4412.       (MATRIX : TRANSFORMATION_MATRIX;
  4413.        POINTS : NDC.POINT_ARRAY)
  4414.    return WC.POINT_ARRAY;
  4415.      
  4416.    function WC_TO_NDC
  4417.       (MATRIX : TRANSFORMATION_MATRIX;
  4418.        VECTOR : WC.VECTOR)
  4419.    return NDC.VECTOR;
  4420.      
  4421. end TRANSFORMATION_MATH;
  4422. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4423. --:UDD:GKSADACM:CODE:MA:TRANS_MATH_B.ADA
  4424. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4425. ------------------------------------------------------------------
  4426. --
  4427. --  NAME: TRANSFORMATION_MATH - BODY
  4428. --  IDENTIFIER: GIMXXX.1(2)
  4429. --  DISCREPANCY REPORTS:
  4430. --  DR038  Text height problem with window and viewport.
  4431. ------------------------------------------------------------------
  4432. -- file:   trans_math_b.ada
  4433. -- levels: ma, 0a, 1a, 2a
  4434.      
  4435. package body TRANSFORMATION_MATH is
  4436.      
  4437. -- The package TRANSFORMATION_MATH contains functions to compute
  4438. -- transformations.
  4439.      
  4440.    function WC_TO_NDC
  4441.       (MATRIX : TRANSFORMATION_MATRIX;
  4442.        POINT  : WC.POINT)
  4443.    return NDC.POINT is
  4444.      
  4445.    -- The function WC_TO_NDC translates a world coordinate point into
  4446.    -- a normalized device coordinate point.
  4447.    -- The formula (Scale Factor * Point + Translation Factor) is used.
  4448.    --
  4449.    -- MATRIX - The scale factor and translation factor used in
  4450.    --          translation.
  4451.    --
  4452.    -- POINT - The world coordinate point to translate.
  4453.      
  4454.    begin
  4455.      
  4456.       return ( ( (NDC_TYPE (MATRIX (1,1)) * (NDC_TYPE (POINT.X)))
  4457.                 + NDC_TYPE (MATRIX (1,3)) ),
  4458.                ( (NDC_TYPE (MATRIX (2,2)) * (NDC_TYPE (POINT.Y)))
  4459.                 + NDC_TYPE (MATRIX (2,3)) ) );
  4460.      
  4461.    end WC_TO_NDC;
  4462.      
  4463.    function WC_TO_NDC
  4464.       (MATRIX : TRANSFORMATION_MATRIX;
  4465.        POINTS : WC.POINT_ARRAY)
  4466.    return NDC.POINT_ARRAY is
  4467.      
  4468.    -- The function WC_TO_NDC translates an array of world coordinate
  4469.    -- points into an array of normalized device coordinate points.
  4470.    -- The formula ( Scale Factor * Points + Translation Factor) is used.
  4471.    --
  4472.    -- MATRIX - The scale factor and translation factor used in the
  4473.    --          translation of points.
  4474.    --
  4475.    -- POINTS - The array of points to translate.
  4476.      
  4477.    TEMPORARY : NDC.POINT_ARRAY(POINTS'range);
  4478.    -- The array of points to return.
  4479.      
  4480.    begin
  4481.      
  4482.       -- Translate all of the points.
  4483.       for I in POINTS'range loop
  4484.      
  4485.          TEMPORARY(I) :=  ( ( (NDC_TYPE (MATRIX (1,1)) *
  4486.                                NDC_TYPE (POINTS(I).X))
  4487.                              + NDC_TYPE (MATRIX (1,3)) ),
  4488.                             ( (NDC_TYPE (MATRIX (2,2)) *
  4489.                                NDC_TYPE (POINTS(I).Y))
  4490.                              + NDC_TYPE (MATRIX (2,3)) ) );
  4491.      
  4492.       end loop;
  4493.      
  4494.       return TEMPORARY;
  4495.      
  4496.    end WC_TO_NDC;
  4497.      
  4498.    function NDC_TO_WC
  4499.       (MATRIX  : TRANSFORMATION_MATRIX;
  4500.        POINT   : NDC.POINT)
  4501.    return WC.POINT is
  4502.      
  4503.    -- The function NDC_TO_WC translates a normalized device coordinate
  4504.    -- point into a world coordinate point.
  4505.    --
  4506.    -- MATRIX - The scale factor and translation factor used in the
  4507.    --          transformation.
  4508.    -- POINT - The point to transform.
  4509.      
  4510.    begin
  4511.      
  4512.       return ( ( (WC_TYPE (MATRIX (1,1)) * WC_TYPE(POINT.X) )
  4513.                 + WC_TYPE (MATRIX (1,3)) ),
  4514.                ( (WC_TYPE (MATRIX (2,2)) * WC_TYPE(POINT.Y) )
  4515.                 + WC_TYPE (MATRIX (2,3)) ) );
  4516.      
  4517.    end NDC_TO_WC;
  4518.      
  4519.    function NDC_TO_WC
  4520.       (MATRIX  : TRANSFORMATION_MATRIX;
  4521.        POINTS : NDC.POINT_ARRAY)
  4522.    return WC.POINT_ARRAY is
  4523.      
  4524.    -- The function NDC_TO_WC transforms an array of normalized device
  4525.    -- coordinate points into an array of world coordinate points.
  4526.    -- The formula (Scale Factor * Points + Translation Factor) is used.
  4527.    --
  4528.    -- MATRIX - The scale factor and translation factor used in the
  4529.    --          transformation.
  4530.    --
  4531.    -- POINTS - The array of points to transform.
  4532.      
  4533.    TEMPORARY : WC.POINT_ARRAY(POINTS'range);
  4534.    -- The array of points to return.
  4535.      
  4536.    begin
  4537.      
  4538.       -- Translate all of the points.
  4539.       for I in POINTS'range loop
  4540.      
  4541.          TEMPORARY(I) :=  ( ( (WC_TYPE (MATRIX (1,1)) *
  4542.                                WC_TYPE (POINTS(I).X) )
  4543.                              + WC_TYPE (MATRIX (1,3)) ),
  4544.                             ( (WC_TYPE (MATRIX (2,2)) *
  4545.                                WC_TYPE (POINTS(I).Y) )
  4546.                              + WC_TYPE (MATRIX (2,3)) ) );
  4547.      
  4548.       end loop;
  4549.      
  4550.       return TEMPORARY;
  4551.      
  4552.    end NDC_TO_WC;
  4553.      
  4554.    function WC_TO_NDC
  4555.       (MATRIX : TRANSFORMATION_MATRIX;
  4556.        VECTOR : WC.VECTOR)
  4557.    return NDC.VECTOR is
  4558.      
  4559.    -- The function WC_TO_NDC translates a world coordinate vedtor into
  4560.    -- a normalized device coordinate vector.
  4561.    -- The formula (Scale Factor * Vector) is used.
  4562.    --
  4563.    -- MATRIX - The scale factor and translation factor used in
  4564.    --          translation.
  4565.    --
  4566.    -- VECTOR - The world coordinate vector to translate.
  4567.      
  4568.    begin
  4569.      
  4570.       return ( (NDC_TYPE (MATRIX (1,1)) * (NDC_TYPE (VECTOR.X))),
  4571.                (NDC_TYPE (MATRIX (2,2)) * (NDC_TYPE (VECTOR.Y))) );
  4572.      
  4573.    end WC_TO_NDC;
  4574.      
  4575. end TRANSFORMATION_MATH;
  4576. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4577. --:UDD:GKSADACM:CODE:MA:GKS_OPERATING_ST_LST.ADA
  4578. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4579. ------------------------------------------------------------------
  4580. --
  4581. --  NAME: GKS_OPERATING_STATE_LIST
  4582. --  IDENTIFIER: GIMXXX.1(1)
  4583. --  DISCREPANCY REPORTS:
  4584. --
  4585. ------------------------------------------------------------------
  4586. -- file:  gks_operating_st_lst.ada
  4587. -- level: all levels
  4588.      
  4589. with GKS_TYPES;
  4590.      
  4591. use GKS_TYPES;
  4592.      
  4593. package GKS_OPERATING_STATE_LIST is
  4594.      
  4595. -- This package contains the variable for the current operating
  4596. -- state of GKS.
  4597.      
  4598.    CURRENT_OPERATING_STATE : OPERATING_STATE := GKCL;
  4599.      
  4600. end GKS_OPERATING_STATE_LIST;
  4601. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4602. --:UDD:GKSADACM:CODE:MA:GKS_ERROR_ST_LST.ADA
  4603. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4604. ------------------------------------------------------------------
  4605. --
  4606. --  NAME: GKS_ERROR_STATE_LIST
  4607. --  IDENTIFIER: GDMXXX.1(1)
  4608. --  DISCREPANCY REPORTS:
  4609. --
  4610. ------------------------------------------------------------------
  4611. -- file:  gks_error_st_lst.ada
  4612. -- level: all levels
  4613.      
  4614. with GKS_TYPES;
  4615. with TEXT_IO;
  4616. with GKS_ERRORS;
  4617.      
  4618. use GKS_TYPES;
  4619. use GKS_ERRORS;
  4620.      
  4621. package GKS_ERROR_STATE_LIST is
  4622.      
  4623.    -- Declaration of the logical error file name.  This is necessary
  4624.    -- for the physical creating and opening of the error file in
  4625.    -- OPEN_GKS and ERROR_LOGGING.
  4626.      
  4627.    ERROR_DATA : TEXT_IO.FILE_TYPE;
  4628.      
  4629.    LAST_EI : ERROR_INDICATOR := SUCCESSFUL; -- Error 0
  4630.      
  4631.    LAST_SUBPROGRAM : VARIABLE_SUBPROGRAM_NAME;
  4632.      
  4633. end GKS_ERROR_STATE_LIST;
  4634. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4635. --:UDD:GKSADACM:CODE:MA:SQUARE_ROOT.ADA
  4636. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4637. ------------------------------------------------------------------
  4638. --
  4639. --  NAME: SQUARE_ROOT
  4640. --  IDENTIFIER: GIMXXX.1(1)
  4641. --  DISCREPANCY REPORTS:
  4642. --
  4643. ------------------------------------------------------------------
  4644. -- file:  square_root.ada
  4645. -- level: all levels
  4646.      
  4647. package SQUARE_ROOT is
  4648.      
  4649.    function SQRT
  4650.       (VALUE : float)
  4651.    return float;
  4652.      
  4653. end SQUARE_ROOT;
  4654. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4655. --:UDD:GKSADACM:CODE:MA:SQUARE_ROOT_B.ADA
  4656. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4657. ------------------------------------------------------------------
  4658. --
  4659. --  NAME: SQUARE_ROOT - BODY
  4660. --  IDENTIFIER: GIMXXX.1(1)
  4661. --  DISCREPANCY REPORTS:
  4662. --
  4663. ------------------------------------------------------------------
  4664. -- file:  square_root_b.ada
  4665. -- level: all levels
  4666.      
  4667. package body SQUARE_ROOT is
  4668.      
  4669.    function SQRT
  4670.       (VALUE : float)
  4671.    return float is
  4672.      
  4673.    -- The function SQRT uses the Newton-Raphson method of finding
  4674.    -- the square root.
  4675.    --
  4676.    -- VALUE - The value used to find the square root.
  4677.      
  4678.    R1       : float;
  4679.    -- Check for thrashing.
  4680.      
  4681.    R0       : float := 1.0;
  4682.    -- Initial guess.
  4683.      
  4684.    RESULT   : float := ( VALUE + (R0*R0) ) / (2.0 * R0);
  4685.    -- The final square root.
  4686.      
  4687.    PRECISION : float := 1.0 * 10.0 ** (- float'digits); --float'safe_small;
  4688.    -- The most precision expected in the answer.
  4689.      
  4690.    begin
  4691.      
  4692.       if VALUE <= 0.0 then
  4693.          raise numeric_error;
  4694.       end if;
  4695.      
  4696.       loop
  4697.      
  4698.          R1 := R0;
  4699.          R0 := RESULT;
  4700.          RESULT := ( VALUE + (R0*R0) ) / (2.0*R0);
  4701.      
  4702.          if (abs ((RESULT-R0)/R0) <= PRECISION) or
  4703.             (abs (R1 - RESULT) <= PRECISION) then
  4704.             exit;
  4705.          end if;
  4706.      
  4707.       end loop;
  4708.      
  4709.       return RESULT;
  4710.      
  4711.    end SQRT;
  4712.      
  4713. end SQUARE_ROOT;
  4714. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4715. --:UDD:GKSADACM:CODE:MA:GET_OUTPUT_ATTR.ADA
  4716. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4717. ------------------------------------------------------------------
  4718. --
  4719. --  NAME: GET_OUTPUT_ATTRIBUTES
  4720. --  IDENTIFIER: GIMXXX.1(1)
  4721. --  DISCREPANCY REPORTS:
  4722. --
  4723. ------------------------------------------------------------------
  4724. -- file:  get_output_attr.ada
  4725. -- level: ma - 2a
  4726.      
  4727. with GKS_TYPES;
  4728. with SQUARE_ROOT;
  4729. with OUTPUT_ATTRIBUTES_TYPE;
  4730. with TRANSFORMATION_MATH;
  4731.      
  4732. use GKS_TYPES;
  4733.      
  4734. package GET_OUTPUT_ATTRIBUTES IS
  4735.      
  4736.    procedure GET_ATTRIBUTES
  4737.              (LATEST_OUTPUT_ATTRIBUTES : out OUTPUT_ATTRIBUTES_TYPE.
  4738.                                              OUTPUT_ATTRIBUTES);
  4739.      
  4740. end GET_OUTPUT_ATTRIBUTES;
  4741. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4742. --:UDD:GKSADACM:CODE:MA:GET_OUTPUT_ATTR_B.ADA
  4743. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4744. ------------------------------------------------------------------
  4745. --
  4746. --  NAME: GET_OUTPUT_ATTRIBUTES - BODY
  4747. --  IDENTIFIER: GIMXXX.1(1)
  4748. --  DISCREPANCY REPORTS:
  4749. --
  4750. ------------------------------------------------------------------
  4751. -- file:  get_output_attr_b.ada
  4752. -- level: ma - 2a
  4753.      
  4754. with GKS_STATE_LIST;
  4755.      
  4756. package body GET_OUTPUT_ATTRIBUTES is
  4757.      
  4758.      
  4759.    function WC_VECTOR_TO_NDC_VECTOR
  4760.       (WC_VECTOR : in WC.VECTOR)
  4761.    return NDC.VECTOR is
  4762.      
  4763.    -- The function WC_VECTOR_TO_NDC_VECTOR converts a world coordinate
  4764.    -- vector into a normalized device coordinate vector.  It is
  4765.    -- converted by using the scale factor only.
  4766.    --
  4767.    -- WC_VECTOR - The world coordinate vector to be converted.
  4768.      
  4769.       TEMPORARY_POINT : NDC.VECTOR;
  4770.       -- A temporary holder of the vector to return.
  4771.      
  4772.       begin
  4773.      
  4774.          TEMPORARY_POINT.X :=
  4775.            ( (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  4776.                (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  4777.                 NDC_FACTORS(1,1)) * NDC_TYPE(WC_VECTOR.X) );
  4778.      
  4779.          TEMPORARY_POINT.Y :=
  4780.            ( (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  4781.                (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  4782.                 NDC_FACTORS(2,2)) * NDC_TYPE(WC_VECTOR.Y) );
  4783.      
  4784.          return TEMPORARY_POINT;
  4785.      
  4786.       end WC_VECTOR_TO_NDC_VECTOR;
  4787.      
  4788.    procedure GET_ATTRIBUTES
  4789.              (LATEST_OUTPUT_ATTRIBUTES : out OUTPUT_ATTRIBUTES_TYPE.
  4790.                                              OUTPUT_ATTRIBUTES) is
  4791.    -- The procedure GET_ATTRIBUTES outputs the latest attributes.
  4792.    -- Any WC values are converted to NDC.
  4793.    --
  4794.    -- LATEST_OUTPUT_ATTRIBUTES - The latest attributes to be returned.
  4795.      
  4796.       use WC;
  4797.      
  4798.       TEMP_ATTR : OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  4799.      
  4800.       CHAR_HEIGHT_VECTOR : WC.VECTOR;
  4801.      
  4802.       CHAR_WIDTH_VECTOR : WC.VECTOR;
  4803.      
  4804.       begin
  4805.      
  4806.          TEMP_ATTR.ASPECT_SOURCE_FLAGS := GKS_STATE_LIST.
  4807.                                           CURRENT_ASPECT_SOURCE_FLAGS;
  4808.          -- The following are components with their type of the record
  4809.          -- type ASF_LIST and their default values:
  4810.          -- LINETYPE                     : ASF := INDIVIDUAL;
  4811.          -- LINE_WIDTH                   : ASF := INDIVIDUAL;
  4812.          -- LINE_COLOUR                  : ASF := INDIVIDUAL;
  4813.          -- MARKER_TYPE                  : ASF := INDIVIDUAL;
  4814.          -- MARKER_SIZE                  : ASF := INDIVIDUAL;
  4815.          -- MARKER_COLOUR                : ASF := INDIVIDUAL;
  4816.          -- TEXT_FONT_PRECISION          : ASF := INDIVIDUAL;
  4817.          -- CHAR_EXPANSION               : ASF := INDIVIDUAL;
  4818.          -- CHAR_SPACING                 : ASF := INDIVIDUAL;
  4819.          -- TEXT_COLOUR                  : ASF := INDIVIDUAL;
  4820.          -- INTERIOR_STYLE               : ASF := INDIVIDUAL;
  4821.          -- STYLE_INDEX                  : ASF := INDIVIDUAL;
  4822.          -- FILL_AREA_COLOUR             : ASF := INDIVIDUAL;
  4823.      
  4824.          -- polyline attributes
  4825.      
  4826.          TEMP_ATTR.CURRENT_POLYLINE_INDEX
  4827.                    := GKS_STATE_LIST.CURRENT_POLYLINE_INDEX;
  4828.          TEMP_ATTR.CURRENT_LINETYPE
  4829.                    := GKS_STATE_LIST.CURRENT_LINETYPE;
  4830.          TEMP_ATTR.CURRENT_LINEWIDTH_SCALE_FACTOR
  4831.                    := GKS_STATE_LIST.CURRENT_LINEWIDTH_SCALE_FACTOR;
  4832.          TEMP_ATTR.CURRENT_POLYLINE_COLOUR_INDEX
  4833.                    := GKS_STATE_LIST.CURRENT_POLYLINE_COLOUR_INDEX;
  4834.      
  4835.          -- polymarker attributes
  4836.      
  4837.          TEMP_ATTR.CURRENT_POLYMARKER_INDEX
  4838.                    := GKS_STATE_LIST.CURRENT_POLYMARKER_INDEX;
  4839.          TEMP_ATTR.CURRENT_MARKER_TYPE
  4840.                    := GKS_STATE_LIST.CURRENT_MARKER_TYPE;
  4841.          TEMP_ATTR.CURRENT_MARKER_SIZE_SCALE_FACTOR
  4842.                    := GKS_STATE_LIST.CURRENT_MARKER_SIZE_SCALE_FACTOR;
  4843.          TEMP_ATTR.CURRENT_POLYMARKER_COLOUR_INDEX
  4844.                    := GKS_STATE_LIST.CURRENT_POLYMARKER_COLOUR_INDEX;
  4845.      
  4846.          -- text attributes
  4847.      
  4848.          TEMP_ATTR.CURRENT_TEXT_INDEX
  4849.                    := GKS_STATE_LIST.CURRENT_TEXT_INDEX;
  4850.          TEMP_ATTR.CURRENT_TEXT_FONT_AND_PRECISION
  4851.                    := GKS_STATE_LIST.CURRENT_TEXT_FONT_AND_PRECISION;
  4852.          TEMP_ATTR.CURRENT_CHAR_EXPANSION_FACTOR
  4853.                    := GKS_STATE_LIST.CURRENT_CHAR_EXPANSION_FACTOR;
  4854.          TEMP_ATTR.CURRENT_CHAR_SPACING
  4855.                    := GKS_STATE_LIST.CURRENT_CHAR_SPACING;
  4856.          TEMP_ATTR.CURRENT_TEXT_COLOUR_INDEX
  4857.                    := GKS_STATE_LIST.CURRENT_TEXT_COLOUR_INDEX;
  4858.      
  4859.          -- the following text attributes are not bundleable.
  4860.      
  4861.          -- the following calculations compute the character
  4862.          -- height and base vectors, then do the transformations
  4863.          -- from WC to NDC
  4864.      
  4865.          CHAR_HEIGHT_VECTOR.X := WC_TYPE(FLOAT(GKS_STATE_LIST.
  4866.            CURRENT_CHAR_HEIGHT) * FLOAT(GKS_STATE_LIST.
  4867.            CURRENT_CHAR_UP_VECTOR.X) / SQUARE_ROOT.SQRT
  4868.            (FLOAT(GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.X ** 2
  4869.            + GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.Y ** 2)));
  4870.      
  4871.          CHAR_HEIGHT_VECTOR.Y := WC_TYPE(FLOAT(GKS_STATE_LIST.
  4872.              CURRENT_CHAR_HEIGHT) * FLOAT(GKS_STATE_LIST.
  4873.              CURRENT_CHAR_UP_VECTOR.Y) / SQUARE_ROOT.SQRT
  4874.              (FLOAT(GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.X ** 2
  4875.              + GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.Y ** 2)));
  4876.      
  4877.          CHAR_WIDTH_VECTOR.X := WC_TYPE(FLOAT(GKS_STATE_LIST.
  4878.              CURRENT_CHAR_WIDTH) * FLOAT(GKS_STATE_LIST.
  4879.              CURRENT_CHAR_BASE_VECTOR.X) / SQUARE_ROOT.SQRT
  4880.              (FLOAT(GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  4881.              + GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2)));
  4882.      
  4883.          CHAR_WIDTH_VECTOR.Y := WC_TYPE(FLOAT(GKS_STATE_LIST.
  4884.              CURRENT_CHAR_WIDTH) * FLOAT(GKS_STATE_LIST.
  4885.              CURRENT_CHAR_BASE_VECTOR.Y) / SQUARE_ROOT.SQRT
  4886.              (FLOAT(GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  4887.              + GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2)));
  4888.      
  4889.          TEMP_ATTR.CURRENT_CHAR_HEIGHT_VECTOR := NDC.VECTOR
  4890.             (TRANSFORMATION_MATH.WC_TO_NDC(GKS_STATE_LIST.
  4891.             LIST_OF_NORMALIZATION_TRANSFORMATIONS
  4892.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  4893.             NDC_FACTORS, POINT(CHAR_HEIGHT_VECTOR)));
  4894.      
  4895.          TEMP_ATTR.CURRENT_CHAR_WIDTH_VECTOR := NDC.VECTOR
  4896.             (TRANSFORMATION_MATH.WC_TO_NDC(GKS_STATE_LIST.
  4897.             LIST_OF_NORMALIZATION_TRANSFORMATIONS
  4898.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  4899.             NDC_FACTORS, POINT(CHAR_WIDTH_VECTOR)));
  4900.      
  4901.          TEMP_ATTR.CURRENT_TEXT_PATH
  4902.                    := GKS_STATE_LIST.CURRENT_TEXT_PATH;
  4903.          TEMP_ATTR.CURRENT_TEXT_ALIGNMENT
  4904.                    := GKS_STATE_LIST.CURRENT_TEXT_ALIGNMENT;
  4905.      
  4906.          -- fill area attributes.
  4907.      
  4908.          TEMP_ATTR.CURRENT_FILL_AREA_INDEX
  4909.                    := GKS_STATE_LIST.CURRENT_FILL_AREA_INDEX;
  4910.          TEMP_ATTR.CURRENT_FILL_AREA_INTERIOR_STYLE
  4911.                    := GKS_STATE_LIST.CURRENT_FILL_AREA_INTERIOR_STYLE;
  4912.          TEMP_ATTR.CURRENT_FILL_AREA_STYLE_INDEX
  4913.                    := GKS_STATE_LIST.CURRENT_FILL_AREA_STYLE_INDEX;
  4914.          TEMP_ATTR.CURRENT_FILL_AREA_COLOUR_INDEX
  4915.                    := GKS_STATE_LIST.CURRENT_FILL_AREA_COLOUR_INDEX;
  4916.      
  4917.          -- pattern attributes for pattern fills.
  4918.      
  4919.          TEMP_ATTR.CURRENT_PATTERN_REFERENCE_POINT
  4920.                    := TRANSFORMATION_MATH.WC_TO_NDC
  4921.               ( ( GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  4922.                  (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  4923.                   NDC_FACTORS ),
  4924.                 ( GKS_STATE_LIST.CURRENT_PATTERN_REFERENCE_POINT ) );
  4925.          TEMP_ATTR.CURRENT_PATTERN_HEIGHT_VECTOR
  4926.                    := WC_VECTOR_TO_NDC_VECTOR
  4927.                          (GKS_STATE_LIST.CURRENT_PATTERN_HEIGHT_VECTOR);
  4928.          TEMP_ATTR.CURRENT_PATTERN_WIDTH_VECTOR
  4929.                    := WC_VECTOR_TO_NDC_VECTOR
  4930.                          (GKS_STATE_LIST.CURRENT_PATTERN_WIDTH_VECTOR);
  4931.      
  4932.          -- clipping attributes
  4933.      
  4934.          -- used for clipping to NDC space. The points are the lower
  4935.          -- left corner and the upper right corner.
  4936.      
  4937.          TEMP_ATTR.CLIPPING_RECTANGLE
  4938.                    := GKS_STATE_LIST.
  4939.                       LIST_OF_NORMALIZATION_TRANSFORMATIONS
  4940.                       (GKS_STATE_LIST.
  4941.                        CURRENT_NORMALIZATION_TRANSFORMATION).VIEWPORT;
  4942.      
  4943.          -- Initialize the output attribute list.
  4944.          LATEST_OUTPUT_ATTRIBUTES := TEMP_ATTR;
  4945.      
  4946.       end GET_ATTRIBUTES;
  4947.      
  4948.    end GET_OUTPUT_ATTRIBUTES;
  4949. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4950. --:UDD:GKSADACM:CODE:0A:GKS_TRIG_LIB.ADA
  4951. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4952. ------------------------------------------------------------------
  4953. --
  4954. --  NAME: GKS_TRIG_LIB
  4955. --  IDENTIFIER: GDMXXX.1(1)
  4956. --  DISCREPANCY REPORTS:
  4957. --
  4958. ------------------------------------------------------------------
  4959. -- file:  gks_trig_lib.ada
  4960. -- level: 0a, 1a, 2a
  4961.      
  4962. with GKS_TYPES;
  4963.      
  4964. use GKS_TYPES;
  4965.      
  4966. generic
  4967.      
  4968.    type COORDINATE_TYPE is digits <>;
  4969.      
  4970. package GKS_TRIG_LIB is
  4971.      
  4972. -- The package GKS_TRIG_LIB contains trigonometric functions.
  4973.      
  4974.    function SIN
  4975.       (X : RADIANS ) return COORDINATE_TYPE;
  4976.      
  4977.    function COS
  4978.       (X : RADIANS ) return COORDINATE_TYPE;
  4979.      
  4980. end GKS_TRIG_LIB;
  4981. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4982. --:UDD:GKSADACM:CODE:0A:GKS_TRIG_LIB_B.ADA
  4983. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  4984. ------------------------------------------------------------------
  4985. --
  4986. --  NAME: GKS_TRIG_LIB - BODY
  4987. --  IDENTIFIER: GIMXXX.1(1)
  4988. --  DISCREPANCY REPORTS:
  4989. --
  4990. ------------------------------------------------------------------
  4991. -- file  : gks_trig_lib_b.ada
  4992. -- level : 1a
  4993.      
  4994. package body GKS_TRIG_LIB is
  4995. -- The package GKS_TRIG_LIB contains trigonometric functions.
  4996.      
  4997.    ZERO  : constant COORDINATE_TYPE := 0.0;
  4998.    HALF  : constant COORDINATE_TYPE := 0.5;
  4999.    ONE   : constant COORDINATE_TYPE := 1.0;
  5000.    TWO   : constant COORDINATE_TYPE := 2.0;
  5001.      
  5002.    IT    : constant INTEGER := 27;
  5003.    IBETA : constant INTEGER := 2;
  5004.      
  5005.    PI          : constant COORDINATE_TYPE := 3.14159_26535_89793_23846;
  5006.    ONE_OVER_PI : constant COORDINATE_TYPE := 0.31830_98861_83790_67154;
  5007.    PI_OVER_TWO : constant COORDINATE_TYPE := 1.57079_63267_94896_61923;
  5008.      
  5009.      
  5010.    function TRUNCATE
  5011.       (X : COORDINATE_TYPE) return COORDINATE_TYPE is
  5012.      
  5013.    -- The function TRUNCATE extracts the mantissa and returns the
  5014.    -- characteristic.
  5015.    --
  5016.    -- X - Represents the floating point number being truncated.
  5017.      
  5018.    begin
  5019.      
  5020.       if (COORDINATE_TYPE (INTEGER(X)) ) = X then
  5021.          return X;
  5022.       elsif X > ZERO then
  5023.          return COORDINATE_TYPE (INTEGER(X-HALF));
  5024.       elsif X = ZERO then
  5025.          return ZERO;
  5026.       else  -- X < ZERO
  5027.          return COORDINATE_TYPE (INTEGER(X+HALF));
  5028.       end if;
  5029.      
  5030.    end TRUNCATE;
  5031.      
  5032.      
  5033.    function R
  5034.       (G : COORDINATE_TYPE) return COORDINATE_TYPE is
  5035.      
  5036.    -- This function is used to compute the formula given in
  5037.    -- in the return statement.  This value is used in the other
  5038.    -- trigonometric functions.
  5039.    --
  5040.    -- G - Defines a floating point value.
  5041.      
  5042.       R1 : constant COORDINATE_TYPE := -0.16666_66660_883;
  5043.       R2 : constant COORDINATE_TYPE :=  0.83333_30720_556E-2;
  5044.       R3 : constant COORDINATE_TYPE := -0.19840_83282_313E-3;
  5045.       R4 : constant COORDINATE_TYPE :=  0.27523_97106_775E-5;
  5046.       R5 : constant COORDINATE_TYPE := -0.23868_34640_601E-7;
  5047.      
  5048.    begin
  5049.      
  5050.       return ((((R5*G + R4)*G + R3)*G + R2)*G + R1)*G;
  5051.      
  5052.    end R;
  5053.      
  5054.      
  5055.    function SIN (X : RADIANS) return COORDINATE_TYPE is separate;
  5056.      
  5057.      
  5058.    function COS (X : RADIANS) return COORDINATE_TYPE is separate;
  5059.      
  5060.      
  5061. end GKS_TRIG_LIB;
  5062. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5063. --:UDD:GKSADACM:CODE:0A:COS_S.ADA
  5064. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5065. ------------------------------------------------------------------
  5066. --
  5067. --  NAME: COS
  5068. --  IDENTIFIER: GIMXXX.1(1)
  5069. --  DISCREPANCY REPORTS:
  5070. --
  5071. ------------------------------------------------------------------
  5072. -- file : cos_s.ada
  5073. -- level: 1a
  5074.      
  5075. separate (GKS_TRIG_LIB)
  5076.      
  5077. function COS
  5078.    (X : RADIANS) return COORDINATE_TYPE is
  5079.      
  5080. -- The algorithm in use, is taken from Software Manual for the
  5081. -- Elementary Functions by William J. Cody Jr. and William Waite.
  5082. --
  5083. -- Let |X| = N * pi + f  where |f| <= pi/2
  5084. -- then cos (X) = sin (X + pi/2)
  5085. --
  5086. -- It is accomplished by
  5087. -- 1. Reduction of X to a given argument f.
  5088. -- 2. Evaluate SIN (f) over a small interval symmetric about the
  5089. --    origin.
  5090. -- 3. Reconstruction of the desired function value.
  5091. --
  5092. -- X - The coordinate in radians on which the cos function is
  5093. --     performed.
  5094.      
  5095.    SIGN          : COORDINATE_TYPE;
  5096.    INT_X_OVER_PI : INTEGER;
  5097.    X_OVER_PI     : COORDINATE_TYPE;
  5098.    F, G          : COORDINATE_TYPE;
  5099.    X_PREFIX      : COORDINATE_TYPE;
  5100.    X_MANTISSA    : COORDINATE_TYPE;
  5101.    RESULT        : COORDINATE_TYPE;
  5102.    X_INPUT       : COORDINATE_TYPE := COORDINATE_TYPE (X);
  5103.      
  5104.    X_MAX   : COORDINATE_TYPE :=
  5105.              COORDINATE_TYPE ( INTEGER (PI * TWO**(IT/2) ) );
  5106.    BETA    : COORDINATE_TYPE := COORDINATE_TYPE(IBETA);
  5107.    EPSILON : COORDINATE_TYPE := BETA ** (-IT/2);
  5108.      
  5109.    -- pi = C1 + C2
  5110.    C1 : constant COORDINATE_TYPE := 3.140625;
  5111.    C2 : constant COORDINATE_TYPE := 9.6765_35897_93E-4;
  5112.      
  5113.      
  5114. begin
  5115.      
  5116.    -- cos (-X) = cos (X) so the sign is always positive.
  5117.    SIGN    := ONE;
  5118.      
  5119.    -- cos (X) = sin (X + pi/2) so X = X + pi/2
  5120.    X_INPUT := ABS (X_INPUT) + PI_OVER_TWO;
  5121.      
  5122.    -- X too large?
  5123.    if X_INPUT > X_MAX  then
  5124.       raise SYSTEM_ERROR;
  5125.    end if;
  5126.      
  5127.    INT_X_OVER_PI := INTEGER (X_INPUT * ONE_OVER_PI);
  5128.    X_OVER_PI     := COORDINATE_TYPE (INT_X_OVER_PI);
  5129.      
  5130.    -- Determine (-1)**N and multiply by SIGN (X)
  5131.    if (INT_X_OVER_PI) mod 2 /= 0  then
  5132.       SIGN := -SIGN;
  5133.    end if;
  5134.      
  5135.    X_OVER_PI := X_OVER_PI - 0.5;     -- TO FORM COS INSTEAD OF SIN
  5136.      
  5137.    X_PREFIX   := TRUNCATE (COORDINATE_TYPE (ABS (X)) );
  5138.    X_MANTISSA := COORDINATE_TYPE (ABS (X)) - X_PREFIX;
  5139.      
  5140.    -- Reduce X to a given argument f.
  5141.    -- Remember C1 + C2 = pi and X_PREFIX + X_MANTISSA = |X|
  5142.    F  := ((X_PREFIX - X_OVER_PI * C1) + X_MANTISSA) - X_OVER_PI * C2;
  5143.      
  5144.    if ABS(F) < EPSILON  then -- f small enough so SIN (f) = f
  5145.       RESULT := F;
  5146.      
  5147.    else  -- R evaluates sin (f) and the value is reconstructed.
  5148.       G      := F * F;
  5149.       RESULT := F + F*R(G);
  5150.    end if;
  5151.      
  5152.    return (SIGN * RESULT);
  5153.      
  5154. end COS;
  5155. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5156. --:UDD:GKSADACM:CODE:0A:SIN_S.ADA
  5157. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5158. ------------------------------------------------------------------
  5159. --
  5160. --  NAME: SIN
  5161. --  IDENTIFIER: GIMXXX.1(1)
  5162. --  DISCREPANCY REPORTS:
  5163. --
  5164. ------------------------------------------------------------------
  5165. -- file : sin_s.ada
  5166. -- level: 1a
  5167.      
  5168. separate (GKS_TRIG_LIB)
  5169.      
  5170. function SIN
  5171.    (X : RADIANS ) return COORDINATE_TYPE is
  5172.      
  5173. -- The algorithm used is taken from Software Manual for the
  5174. -- Elementary Functions by William J. Cody Jr. and William Waite.
  5175. --
  5176. -- Let |X| = N * pi + f   where  |f| <= pi/2
  5177. -- then sin (X) = sign (X) * sin (f) * (-1) ** N
  5178. --
  5179. -- It is accomplished by
  5180. --  1. Reduction of X to a given argument f.
  5181. --  2. Evaluate SIN (f) over a small interval symmetric about
  5182. --     the origin.
  5183. --  3. Reconstruction of the desired function value.
  5184. --
  5185. -- X - The coordinate in radians on which the sin function is
  5186. --     performed.
  5187.      
  5188.    SIGN          : COORDINATE_TYPE;
  5189.    INT_X_OVER_PI : INTEGER;
  5190.    X_OVER_PI     : COORDINATE_TYPE;
  5191.    F, G          : COORDINATE_TYPE;
  5192.    X_PREFIX      : COORDINATE_TYPE;
  5193.    X_MANTISSA    : COORDINATE_TYPE;
  5194.    RESULT        : COORDINATE_TYPE;
  5195.    X_INPUT       : COORDINATE_TYPE := COORDINATE_TYPE (X);
  5196.      
  5197.    X_MAX    : COORDINATE_TYPE :=
  5198.               COORDINATE_TYPE (INTEGER(PI * TWO**(IT/2)));
  5199.    BETA     : COORDINATE_TYPE := COORDINATE_TYPE(IBETA);
  5200.    EPSILON  : COORDINATE_TYPE := BETA ** (-IT/2);
  5201.      
  5202.    -- pi = C1 + C2
  5203.    C1 : constant COORDINATE_TYPE := 3.140625;
  5204.    C2 : constant COORDINATE_TYPE := 9.6765_35897_93E-4;
  5205.      
  5206.    begin
  5207.      
  5208.       -- Determine SIGN (X) and |X|
  5209.       if X_INPUT < ZERO  then
  5210.         SIGN    := -ONE;
  5211.         X_INPUT := -X_INPUT;
  5212.       else
  5213.         SIGN    := ONE;
  5214.       end if;
  5215.      
  5216.       -- X to large?
  5217.       if X_INPUT > X_MAX  then
  5218.          raise SYSTEM_ERROR;
  5219.       end if;
  5220.      
  5221.       INT_X_OVER_PI := INTEGER (X_INPUT * ONE_OVER_PI);
  5222.       X_OVER_PI     := COORDINATE_TYPE (INT_X_OVER_PI);
  5223.      
  5224.      
  5225.       -- Determine (-1)**N and multiply by SIGN (X)
  5226.       if (INT_X_OVER_PI) mod 2 /= 0  then
  5227.         SIGN := -SIGN;
  5228.       end if;
  5229.      
  5230.       X_PREFIX   := TRUNCATE (X_INPUT);
  5231.       X_MANTISSA := X_INPUT - X_PREFIX;
  5232.      
  5233.       -- Reduce X to a given argument f.
  5234.       -- Remember C1 + C2 = pi and X_PREFIX + X_MANTISSA = |X|
  5235.       F  := ((X_PREFIX - X_OVER_PI * C1) + X_MANTISSA) - X_OVER_PI * C2;
  5236.      
  5237.       if ABS(F) < EPSILON  then -- f small enough so SIN (f) = f
  5238.         RESULT := F;
  5239.      
  5240.       else -- R evaluates sin (f) and the value is reconstructed.
  5241.         G      := F * F;
  5242.         RESULT := F + F*R(G);
  5243.       end if;
  5244.      
  5245.       return (SIGN * RESULT);
  5246.      
  5247.    end SIN;
  5248. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5249. --:UDD:GKSADACM:CODE:MA:SET_INDV_ATTR_MA_B.ADA
  5250. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5251. ------------------------------------------------------------------
  5252. --
  5253. --  NAME: SET_INDIVIDUAL_ATTRIBUTES - BODY
  5254. --  IDENTIFIER: GIMXXX.1(1)
  5255. --  DISCREPANCY REPORTS:
  5256. --
  5257. ------------------------------------------------------------------
  5258. -- file:  set_indv_attr_ma_b.ada
  5259. -- level: all levels
  5260.      
  5261. with WSM;
  5262. with CGI;
  5263. with ERROR_ROUTINES;
  5264. with GKS_OPERATING_STATE_LIST;
  5265. with GKS_ERRORS;
  5266. with GKS_STATE_LIST;
  5267.      
  5268. use WSM;
  5269. use CGI;
  5270. use ERROR_ROUTINES;
  5271. use GKS_OPERATING_STATE_LIST;
  5272. use GKS_ERRORS;
  5273.      
  5274. package body SET_INDIVIDUAL_ATTRIBUTES_MA is
  5275.      
  5276. -- This is the package body for setting individual attributes.
  5277. --
  5278. -- All of the procedures in this package first inquire the
  5279. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of
  5280. -- the states GKOP, WSOP, WSAC, or SGOP.  If it is not, error
  5281. -- 8 occurs and the procedure raises the exception STATE_
  5282. -- ERROR.  No error indicators above 0 are expected from the
  5283. -- workstation manager for these procedures.
  5284. --
  5285. -- If error indicator 8 occurs, these procedures call the
  5286. -- ERROR_LOGGING procedure of the package ERROR_ROUTINES
  5287. -- to log the error indicator and the name of the procedure
  5288. -- in the error file specified when the procedure OPEN_GKS
  5289. -- was called to begin this session of GKS operation.
  5290.      
  5291.    procedure SET_LINETYPE
  5292.       (LINE : in LINETYPE) is
  5293.      
  5294.    -- This procedure sets the value of the current linetype in the
  5295.    -- GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  5296.    --
  5297.    -- LINE - Indicates the line style to be used for subsequent
  5298.    --    polylines.
  5299.      
  5300.    GKS_INSTR : CGI_SET_LINETYPE;
  5301.      
  5302.    begin
  5303.      
  5304.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5305.       -- to see if GKS is in the proper state before proceeding.
  5306.      
  5307.       if CURRENT_OPERATING_STATE = GKCL then
  5308.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  5309.                         "SET_LINETYPE");               -- Error 8
  5310.          raise STATE_ERROR;
  5311.      
  5312.       elsif LINE = 0 then
  5313.          ERROR_LOGGING (LINETYPE_IS_ZERO,
  5314.                         "SET_LINETYPE");               -- Error 63
  5315.          raise OUTPUT_ATTRIBUTE_ERROR;
  5316.      
  5317.       else
  5318.          GKS_STATE_LIST.CURRENT_LINETYPE := LINE;
  5319.      
  5320.          -- Call to WS_MANAGER with the new line type.
  5321.          GKS_INSTR.LINETYPE_SET := LINE;
  5322.          WS_MANAGER (GKS_INSTR);
  5323.      
  5324.       end if;
  5325.      
  5326.       exception
  5327.          when STATE_ERROR =>
  5328.             raise;
  5329.          when OUTPUT_ATTRIBUTE_ERROR =>
  5330.             raise;
  5331.          when OTHERS =>
  5332.             ERROR_LOGGING (UNKNOWN, "SET_LINETYPE");    -- Error 2501
  5333.             raise;
  5334.      
  5335.    end SET_LINETYPE;
  5336.      
  5337.    procedure SET_POLYLINE_COLOUR_INDEX
  5338.       (COLOUR : in COLOUR_INDEX) is
  5339.      
  5340.    -- This procedure sets the value of the current polyline colour
  5341.    -- index GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  5342.    --
  5343.    -- COLOUR - Indicates the colour to be used for subsequent polylines.
  5344.      
  5345.    GKS_INSTR : CGI_SET_POLYLINE_COLOUR_INDEX;
  5346.      
  5347.    begin
  5348.      
  5349.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5350.       -- to see if GKS is in the proper state before proceeding.
  5351.      
  5352.       if CURRENT_OPERATING_STATE = GKCL then
  5353.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  5354.                         "SET_POLYLINE_COLOUR_INDEX");      -- Error 8
  5355.          raise STATE_ERROR;
  5356.       else
  5357.          GKS_STATE_LIST.CURRENT_POLYLINE_COLOUR_INDEX := COLOUR;
  5358.      
  5359.          -- Call to WS_MANAGER with the new line colour.
  5360.      
  5361.          GKS_INSTR.POLYLINE_COLOUR_INDEX_SET := COLOUR;
  5362.          WS_MANAGER (GKS_INSTR);
  5363.      
  5364.       end if;
  5365.      
  5366.       exception
  5367.          when STATE_ERROR =>
  5368.             raise;
  5369.          when OTHERS =>
  5370.             ERROR_LOGGING (UNKNOWN,
  5371.                            "SET_POLYLINE_COLOUR_INDEX"); -- Error 2501
  5372.             raise;
  5373.      
  5374.    end SET_POLYLINE_COLOUR_INDEX;
  5375.      
  5376.    procedure SET_MARKER_TYPE
  5377.       (MARKER : in MARKER_TYPE) is
  5378.      
  5379.    -- This procedure sets the value of the current marker type in
  5380.    -- the GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  5381.    --
  5382.    -- MARKER - Indicates the marker style to be used for subsequent
  5383.    --    polymarkers.
  5384.      
  5385.    GKS_INSTR : CGI_SET_MARKER_TYPE;
  5386.      
  5387.    begin
  5388.      
  5389.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5390.       -- to see if GKS is in the proper state before proceeding.
  5391.      
  5392.       if CURRENT_OPERATING_STATE = GKCL then
  5393.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  5394.                         "SET_MARKER_TYPE");          -- Error 8
  5395.          raise STATE_ERROR;
  5396.      
  5397.       elsif MARKER = 0 then
  5398.          ERROR_LOGGING (MARKER_TYPE_IS_ZERO,
  5399.                         "SET_MARKER_TYPE");          -- Error 69
  5400.          raise OUTPUT_ATTRIBUTE_ERROR;
  5401.      
  5402.       else
  5403.          GKS_STATE_LIST.CURRENT_MARKER_TYPE := MARKER;
  5404.      
  5405.          -- Call to WS_MANAGER with the new marker type.
  5406.      
  5407.          GKS_INSTR.MARKER_TYPE_SET := MARKER;
  5408.          WS_MANAGER (GKS_INSTR);
  5409.       end if;
  5410.      
  5411.       exception
  5412.          when STATE_ERROR =>
  5413.             raise;
  5414.          when OUTPUT_ATTRIBUTE_ERROR =>
  5415.             raise;
  5416.          when OTHERS =>
  5417.             ERROR_LOGGING (UNKNOWN, "SET_MARKER_TYPE");  -- Error 2501
  5418.             raise;
  5419.      
  5420.    end SET_MARKER_TYPE;
  5421.      
  5422.    procedure SET_POLYMARKER_COLOUR_INDEX
  5423.       (COLOUR : in COLOUR_INDEX) is
  5424.      
  5425.    -- This procedure sets the value of the current polymarker
  5426.    -- colour index in the GKS_STATE_LIST and then sends the
  5427.    -- value to the WS_MANAGER.
  5428.    --
  5429.    -- COLOUR - Indicates the colour to be used for subsequent
  5430.    --    polymarkers.
  5431.      
  5432.    GKS_INSTR : CGI_SET_POLYMARKER_COLOUR_INDEX;
  5433.      
  5434.    begin
  5435.      
  5436.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5437.       -- to see if GKS is in the proper state before proceeding.
  5438.      
  5439.       if CURRENT_OPERATING_STATE = GKCL then
  5440.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  5441.                         "SET_POLYMARKER_COLOUR_INDEX");   -- Error 8
  5442.          raise STATE_ERROR;
  5443.      
  5444.       else
  5445.      
  5446.          GKS_STATE_LIST.CURRENT_POLYMARKER_COLOUR_INDEX := COLOUR;
  5447.      
  5448.          -- Call to WS_MANAGER with the new marker colour.
  5449.      
  5450.          GKS_INSTR.POLYMARKER_COLOUR_INDEX_SET := COLOUR;
  5451.          WS_MANAGER (GKS_INSTR);
  5452.      
  5453.       end if;
  5454.      
  5455.       exception
  5456.          when STATE_ERROR =>
  5457.             raise;
  5458.          when OTHERS =>
  5459.             ERROR_LOGGING (UNKNOWN,
  5460.                            "SET_POLYMARKER_COLOUR_INDEX"); -- Error 2501
  5461.             raise;
  5462.      
  5463.    end SET_POLYMARKER_COLOUR_INDEX;
  5464.      
  5465.    procedure SET_TEXT_COLOUR_INDEX
  5466.       (COLOUR : in COLOUR_INDEX) is
  5467.      
  5468.    -- This procedure sets the value of the current text colour index
  5469.    -- in the GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  5470.    --
  5471.    -- COLOUR - Indicates the colour of subsequent text primitives.
  5472.      
  5473.    GKS_INSTR : CGI_SET_TEXT_COLOUR_INDEX;
  5474.      
  5475.    begin
  5476.      
  5477.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5478.       -- to see if GKS is in the proper state before proceeding.
  5479.      
  5480.       if CURRENT_OPERATING_STATE = GKCL then
  5481.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  5482.                         "SET_TEXT_COLOUR_INDEX");       -- Error 8
  5483.          raise STATE_ERROR;
  5484.       else
  5485.      
  5486.          GKS_STATE_LIST.CURRENT_TEXT_COLOUR_INDEX := COLOUR;
  5487.      
  5488.          -- Call to WS_MANAGER with the new text colour.
  5489.      
  5490.          GKS_INSTR.TEXT_COLOUR_INDEX_SET := COLOUR;
  5491.          WS_MANAGER (GKS_INSTR);
  5492.      
  5493.       end if;
  5494.      
  5495.       exception
  5496.          when STATE_ERROR =>
  5497.             raise;
  5498.          when OTHERS =>
  5499.             ERROR_LOGGING (UNKNOWN,
  5500.                            "SET_TEXT_COLOUR_INDEX");   -- Error 2501
  5501.             raise;
  5502.      
  5503.    end SET_TEXT_COLOUR_INDEX;
  5504.      
  5505.    procedure SET_FILL_AREA_INTERIOR_STYLE
  5506.       (STYLE : in INTERIOR_STYLE) is
  5507.      
  5508.    -- This procedure sets the value of the current fill area interior
  5509.    -- style in the GKS_STATE_LIST and then sends the value to the
  5510.    -- WS_MANAGER.
  5511.    --
  5512.    -- STYLE - Indicates the interior style to be used for fill area
  5513.    --    primitives.  The values may be HOLLOW, SOLID, PATTERN, or
  5514.    --    HATCH.
  5515.      
  5516.    GKS_INSTR : CGI_SET_FILL_AREA_INTERIOR_STYLE;
  5517.      
  5518.    begin
  5519.      
  5520.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5521.       -- to see if GKS is in the proper state before proceeding.
  5522.      
  5523.       if CURRENT_OPERATING_STATE = GKCL then
  5524.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  5525.                          "SET_FILL_AREA_INTERIOR_STYLE"); -- Error 8
  5526.          raise STATE_ERROR;
  5527.       else
  5528.          GKS_STATE_LIST.CURRENT_FILL_AREA_INTERIOR_STYLE := STYLE;
  5529.      
  5530.          -- Call to WS_MANAGER with the new interior style.
  5531.      
  5532.          GKS_INSTR.FILL_AREA_INTERIOR_STYLE_SET := STYLE;
  5533.          WS_MANAGER (GKS_INSTR);
  5534.      
  5535.       end if;
  5536.      
  5537.       exception
  5538.          when STATE_ERROR =>
  5539.             raise;
  5540.          when OTHERS =>
  5541.             ERROR_LOGGING (UNKNOWN,
  5542.                            "SET_FILL_AREA_INTERIOR_STYLE"); -- Error 2501
  5543.             raise;
  5544.      
  5545.    end SET_FILL_AREA_INTERIOR_STYLE;
  5546.      
  5547.    procedure SET_FILL_AREA_COLOUR_INDEX
  5548.       (COLOUR : in COLOUR_INDEX) is
  5549.      
  5550.    -- This procedure sets the value of the current fill area colour
  5551.    -- index in the GKS_STATE_LIST and then sends the value to the
  5552.    -- WS_MANAGER.
  5553.    --
  5554.    -- COLOUR - Indicates the colour to be used in subsequent
  5555.    --    fill area primitives.
  5556.      
  5557.    GKS_INSTR : CGI_SET_FILL_AREA_COLOUR_INDEX;
  5558.      
  5559.    begin
  5560.      
  5561.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5562.       -- to see if GKS is in the proper state before proceeding.
  5563.      
  5564.       if CURRENT_OPERATING_STATE = GKCL then
  5565.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  5566.                         "SET_FILL_AREA_COLOUR_INDEX");  -- Error 8
  5567.          raise STATE_ERROR;
  5568.      
  5569.       else
  5570.          GKS_STATE_LIST.CURRENT_FILL_AREA_COLOUR_INDEX := COLOUR;
  5571.      
  5572.          -- Call to WS_MANAGER with the new fill area colour.
  5573.      
  5574.          GKS_INSTR.FILL_AREA_COLOUR_INDEX_SET := COLOUR;
  5575.          WS_MANAGER (GKS_INSTR);
  5576.      
  5577.       end if;
  5578.      
  5579.       exception
  5580.          when STATE_ERROR =>
  5581.             raise;
  5582.          when OTHERS =>
  5583.             ERROR_LOGGING (UNKNOWN,
  5584.                            "SET_FILL_AREA_COLOUR_INDEX"); -- Error 2501
  5585.             raise;
  5586.      
  5587.    end SET_FILL_AREA_COLOUR_INDEX;
  5588.      
  5589. end SET_INDIVIDUAL_ATTRIBUTES_MA;
  5590. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5591. --:UDD:GKSADACM:CODE:MA:SET_PRIM_ATTR_MA_B.ADA
  5592. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5593. ------------------------------------------------------------------
  5594. --
  5595. --  NAME: SET_PRIMITIVE_ATTRIBUTES_MA - BODY
  5596. --  IDENTIFIER: GIMXXX.1(2)
  5597. --  DISCREPANCY REPORTS:
  5598. --  DR038  Text height problem with window and viewport.
  5599. ------------------------------------------------------------------
  5600. -- file:  set_prim_attr_ma_b.ada
  5601. -- levels: all levels
  5602.      
  5603. with WSM;
  5604. with CGI;
  5605. with ERROR_ROUTINES;
  5606. with GKS_OPERATING_STATE_LIST;
  5607. with GKS_ERRORS;
  5608. with GKS_STATE_LIST;
  5609. with TRANSFORMATION_MATH;
  5610. with SQUARE_ROOT;
  5611.      
  5612. use WSM;
  5613. use CGI;
  5614. use ERROR_ROUTINES;
  5615. use GKS_OPERATING_STATE_LIST;
  5616. use GKS_ERRORS;
  5617.      
  5618. package body SET_PRIMITIVE_ATTRIBUTES_MA is
  5619.      
  5620. -- This is the package body for the procedures to set the
  5621. -- primitive attribute values for level ma.
  5622. --
  5623. -- Each of the procedures in this package inquires the
  5624. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of
  5625. -- the states GKOP, WSOP, WSAC, or SGOP.  If it is not,
  5626. -- error 8 occurs and the procedure raises the exception
  5627. -- STATE_ERROR.
  5628. --
  5629. -- If an error indicator 8 occurs, these procedures call the
  5630. -- ERROR_LOGGING procedure of the package ERROR_ROUTINES
  5631. -- to log the error indicator and the name of the procedure
  5632. -- in the error file specified when the procedure OPEN_GKS
  5633. -- was called to begin this session of GKS operation.
  5634.      
  5635.    procedure SET_CHAR_HEIGHT
  5636.       (HEIGHT : in WC.MAGNITUDE) is
  5637.      
  5638.    -- This procedure sets the value of the current character height in
  5639.    -- the GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  5640.    --
  5641.    -- HEIGHT - Indicates the nominal height of the capital letter
  5642.    --    character.
  5643.      
  5644.    use WC;
  5645.    -- For visiblity to the types and operations on the types
  5646.    -- in the GKS_COORDINATE_SYSTEM.
  5647.      
  5648.    CHAR_HEIGHT_VECTOR : WC.VECTOR;
  5649.    CHAR_WIDTH_VECTOR  : WC.VECTOR;
  5650.    -- The above two objects are used to hold the vectors that are
  5651.    -- calculated in world coordinates prior to being transformed
  5652.    -- and sent to the WS_MANAGER.
  5653.      
  5654.    GKS_INSTR : CGI_SET_CHAR_VECTORS;
  5655.      
  5656.    begin
  5657.      
  5658.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5659.       -- to see if GKS is in the proper state before proceeding.
  5660.      
  5661.       if CURRENT_OPERATING_STATE = GKCL then
  5662.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  5663.                         "SET_CHAR_HEIGHT");        -- Error 8
  5664.          raise STATE_ERROR;
  5665.       else
  5666.      
  5667.          GKS_STATE_LIST.CURRENT_CHAR_HEIGHT := HEIGHT;
  5668.          GKS_STATE_LIST.CURRENT_CHAR_WIDTH := HEIGHT;
  5669.      
  5670.       -- The following finds the size of the vectors for the
  5671.       -- character height and width.
  5672.      
  5673.       -- The formula for the character height is:
  5674.       -- wc.vector = (current character height) *
  5675.       -- (current character up vector)/
  5676.       -- (the magnitude of the character up vector).
  5677.      
  5678.       CHAR_HEIGHT_VECTOR.X := WC_TYPE (float(HEIGHT) *
  5679.          (float (GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.X)
  5680.          / SQUARE_ROOT.SQRT (float
  5681.          (GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.X ** 2
  5682.          + GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.Y ** 2))));
  5683.      
  5684.      
  5685.       CHAR_HEIGHT_VECTOR.Y := WC_TYPE (float(HEIGHT) *
  5686.          (float(GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.Y)
  5687.          / SQUARE_ROOT.SQRT (float
  5688.          (GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.X ** 2
  5689.          + GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR.Y ** 2))));
  5690.      
  5691.       -- The formula for the character width is:
  5692.       -- wc.vector = (current character width) *
  5693.       -- (current character base vector)/
  5694.       -- (the magnitude of the character base vector).
  5695.       -- Remembering that the current character width is equal to
  5696.       -- the parameter HEIGHT that was passed in, the formula
  5697.       -- is used below.
  5698.      
  5699.      
  5700.         CHAR_WIDTH_VECTOR.X := WC_TYPE (float(HEIGHT) *
  5701.          (float(GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X)
  5702.          / SQUARE_ROOT.SQRT (float
  5703.          (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  5704.          + GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2))));
  5705.      
  5706.       CHAR_WIDTH_VECTOR.Y := WC_TYPE (float(HEIGHT) *
  5707.          (float (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y)
  5708.          / SQUARE_ROOT.SQRT (float
  5709.          (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  5710.          + GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2))));
  5711.      
  5712.       -- Transform the WC vectors to NDC
  5713.       GKS_INSTR.CHAR_HEIGHT_VECTOR_SET := TRANSFORMATION_MATH.WC_TO_NDC
  5714.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  5715.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  5716.          NDC_FACTORS, CHAR_HEIGHT_VECTOR);
  5717.      
  5718.       GKS_INSTR.CHAR_WIDTH_VECTOR_SET := TRANSFORMATION_MATH.WC_TO_NDC
  5719.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  5720.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  5721.          NDC_FACTORS, CHAR_WIDTH_VECTOR);
  5722.      
  5723.          -- Call to WS_MANAGER with the new character height vector
  5724.          -- and the new character width vector.
  5725.          WS_MANAGER (GKS_INSTR);
  5726.      
  5727.       end if;
  5728.      
  5729.       exception
  5730.          when STATE_ERROR =>
  5731.             raise;
  5732.          when NUMERIC_ERROR =>
  5733.             ERROR_LOGGING (ARITHMETIC, "SET_CHAR_HEIGHT"); -- Error 308
  5734.             raise SYSTEM_ERROR;
  5735.          when OTHERS =>
  5736.             ERROR_LOGGING (UNKNOWN, "SET_CHAR_HEIGHT");  -- Error 2501
  5737.             raise;
  5738.      
  5739.    end SET_CHAR_HEIGHT;
  5740.      
  5741.    procedure SET_CHAR_UP_VECTOR
  5742.       (CHAR_UP_VECTOR : in WC.VECTOR) is
  5743.      
  5744.      
  5745.    -- This procedure sets the value of the current character up vector
  5746.    -- in the GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  5747.    --
  5748.    -- If the workstation manager returns error 79, this procedure
  5749.    -- raises OUTPUT_ATTRIBUTE_ERROR.
  5750.    --
  5751.    -- CHAR_UP_VECTOR - Indicates the up direction of the character.
  5752.      
  5753.    GKS_INSTR : CGI_SET_CHAR_VECTORS;
  5754.      
  5755.    use WC;
  5756.    -- For visiblity to the types and operations on the types
  5757.    -- in the GKS_COORDINATE_SYSTEM.
  5758.      
  5759.    CHAR_HEIGHT_VECTOR : WC.VECTOR;
  5760.    CHAR_WIDTH_VECTOR  : WC.VECTOR;
  5761.    -- The above two objects are used to hold the vectors that are
  5762.    -- calculated in world coordinates prior to being transformed
  5763.    -- and sent to the WS_MANAGER.
  5764.      
  5765.    begin
  5766.      
  5767.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5768.       -- to see if GKS is in the proper state before proceeding.
  5769.      
  5770.       if CURRENT_OPERATING_STATE = GKCL then
  5771.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  5772.                         "SET_CHAR_UP_VECTOR");        -- Error 8
  5773.          raise STATE_ERROR;
  5774.      
  5775.       elsif (CHAR_UP_VECTOR.X = 0.0) and
  5776.             (CHAR_UP_VECTOR.Y = 0.0) then
  5777.          ERROR_LOGGING (CHAR_UP_VECTOR_IS_ZERO,
  5778.                         "SET_CHAR_UP_VECTOR");        -- Error 79
  5779.          raise OUTPUT_ATTRIBUTE_ERROR;
  5780.      
  5781.       else
  5782.      
  5783.          GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR := CHAR_UP_VECTOR;
  5784.      
  5785.          -- Compute a vector at right angles to the CHAR_UP_VECTOR
  5786.          -- to be used for the CURRENT_CHAR_BASE_VECTOR.
  5787.      
  5788.          GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR :=
  5789.                                   (CHAR_UP_VECTOR.Y,-CHAR_UP_VECTOR.X);
  5790.      
  5791.       -- The following finds the size of the vectors for the
  5792.       -- character height and width using the new character up vector.
  5793.      
  5794.       -- The formula for the character height is:
  5795.       -- wc.vector = (current character height) *
  5796.       -- (current character up vector)/
  5797.       -- (the magnitude of the character up vector).
  5798.      
  5799.      
  5800.       CHAR_HEIGHT_VECTOR.X := WC_TYPE
  5801.            (float(GKS_STATE_LIST.CURRENT_CHAR_HEIGHT)
  5802.          * (float(CHAR_UP_VECTOR.X)
  5803.          / SQUARE_ROOT.SQRT (float
  5804.          (CHAR_UP_VECTOR.X ** 2 + CHAR_UP_VECTOR.Y ** 2))));
  5805.      
  5806.       CHAR_HEIGHT_VECTOR.Y := WC_TYPE
  5807.            (float (GKS_STATE_LIST.CURRENT_CHAR_HEIGHT)
  5808.          * (float (CHAR_UP_VECTOR.Y)
  5809.          / SQUARE_ROOT.SQRT (float
  5810.          (CHAR_UP_VECTOR.X ** 2 + CHAR_UP_VECTOR.Y ** 2))));
  5811.      
  5812.       -- The formula for the character width is:
  5813.       -- wc.vector = (current character width) *
  5814.       -- (current character base vector)/
  5815.       -- (the magnitude of the character base vector).
  5816.      
  5817.       CHAR_WIDTH_VECTOR.X := WC_TYPE
  5818.            (float (GKS_STATE_LIST.CURRENT_CHAR_WIDTH)
  5819.          * (float (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X)
  5820.          /  SQUARE_ROOT.SQRT (float
  5821.            (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  5822.          +  GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2))));
  5823.      
  5824.       CHAR_WIDTH_VECTOR.Y := WC_TYPE
  5825.            (float (GKS_STATE_LIST.CURRENT_CHAR_WIDTH)
  5826.          * (float (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y)
  5827.          /  SQUARE_ROOT.SQRT (float
  5828.            (GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.X ** 2
  5829.          +  GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR.Y ** 2))));
  5830.      
  5831.       -- Transform the WC vectors to NDC
  5832.       GKS_INSTR.CHAR_HEIGHT_VECTOR_SET := TRANSFORMATION_MATH.WC_TO_NDC
  5833.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  5834.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  5835.          NDC_FACTORS, CHAR_HEIGHT_VECTOR);
  5836.      
  5837.       GKS_INSTR.CHAR_WIDTH_VECTOR_SET := TRANSFORMATION_MATH.WC_TO_NDC
  5838.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  5839.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  5840.          NDC_FACTORS, CHAR_WIDTH_VECTOR);
  5841.      
  5842.       WS_MANAGER(GKS_INSTR);
  5843.      
  5844.       end if;
  5845.      
  5846.       exception
  5847.          when STATE_ERROR =>
  5848.             raise;
  5849.          when OUTPUT_ATTRIBUTE_ERROR =>
  5850.             raise;
  5851.          when NUMERIC_ERROR =>
  5852.             ERROR_LOGGING(ARITHMETIC,"SET_CHAR_UP_VECTOR"); -- Error 308
  5853.             raise SYSTEM_ERROR;
  5854.          when OTHERS =>
  5855.             ERROR_LOGGING(UNKNOWN, "SET_CHAR_UP_VECTOR");  -- Error 2501
  5856.             raise;
  5857.      
  5858.    end SET_CHAR_UP_VECTOR;
  5859.      
  5860.    procedure SET_TEXT_ALIGNMENT
  5861.       (ALIGNMENT : in TEXT_ALIGNMENT) is
  5862.      
  5863.    -- This procedure sets the value of the current text alignment in
  5864.    -- the GKS_STATE_LIST and then sends the value to the WS_MANAGER.
  5865.    --
  5866.    -- ALIGNMENT - Indicates the positioning of the text extent
  5867.    --    rectangle in relation to the text position. It is a
  5868.    --    record with a HORIZONTAL component and a VERTICAL
  5869.    --    component.
  5870.      
  5871.    GKS_INSTR : CGI_SET_TEXT_ALIGNMENT;
  5872.      
  5873.    begin
  5874.      
  5875.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5876.       -- to see if GKS is in the proper state before proceeding.
  5877.      
  5878.       if CURRENT_OPERATING_STATE = GKCL then
  5879.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  5880.                         "SET_TEXT_ALIGNMENT");      -- Error 8
  5881.          raise STATE_ERROR;
  5882.       else
  5883.      
  5884.          GKS_STATE_LIST.CURRENT_TEXT_ALIGNMENT := ALIGNMENT;
  5885.      
  5886.          -- Call to WS_MANAGER with the new text alignment.
  5887.      
  5888.          GKS_INSTR.TEXT_ALIGNMENT_SET := ALIGNMENT;
  5889.          WS_MANAGER (GKS_INSTR);
  5890.      
  5891.       end if;
  5892.      
  5893.       exception
  5894.          when STATE_ERROR =>
  5895.             raise;
  5896.          when OTHERS =>
  5897.             ERROR_LOGGING (UNKNOWN, "SET_TEXT_ALIGNMENT"); -- Error 2501
  5898.             raise;
  5899.      
  5900.    end SET_TEXT_ALIGNMENT;
  5901.      
  5902. end SET_PRIMITIVE_ATTRIBUTES_MA ;
  5903. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5904. --:UDD:GKSADACM:CODE:MA:INQ_PRIM_ATTR_B.ADA
  5905. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  5906. ------------------------------------------------------------------
  5907. --
  5908. --  NAME: INQ_PRIMITIVE_ATTRIBUTES
  5909. --  IDENTIFIER: GIMXXX.1(1)
  5910. --  DISCREPANCY REPORTS:
  5911. --
  5912. ------------------------------------------------------------------
  5913. -- file:  inq_prim_attr_b.ada
  5914. -- level: all levels
  5915.      
  5916. with GKS_OPERATING_STATE_LIST;
  5917. with GKS_ERRORS;
  5918. with GKS_STATE_LIST;
  5919.      
  5920. use GKS_OPERATING_STATE_LIST;
  5921. use GKS_ERRORS;
  5922.      
  5923. package body INQ_PRIMITIVE_ATTRIBUTES is
  5924.      
  5925. -- This is the package body for inquiring the primitive
  5926. -- attribute values.
  5927. --
  5928. -- Each of the procedures in this package inquires the
  5929. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  5930. -- of the states GKOP, WSOP, WSAC, or SGOP.  If it is not,
  5931. -- error indicator 8 occurs but no exception is raised.
  5932.      
  5933.    procedure INQ_CHAR_HEIGHT
  5934.       (EI    : out ERROR_INDICATOR;
  5935.       HEIGHT : out WC.MAGNITUDE) is
  5936.      
  5937.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  5938.    -- value of the current character height.  If the inquired infor-
  5939.    -- mation is available, the error indicator is returned as 0 and
  5940.    -- the value is returned.
  5941.    --
  5942.    -- EI - This is the error indicator.  Its numeric value represents
  5943.    --    the type of error, if any, that occurred.
  5944.    -- HEIGHT - This is the nominal height of the capital letter
  5945.    --    character.
  5946.      
  5947.    begin
  5948.      
  5949.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5950.       -- to see if GKS is in the proper state before proceeding.
  5951.      
  5952.       if CURRENT_OPERATING_STATE = GKCL then
  5953.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  5954.          HEIGHT := 1.0;
  5955.       else
  5956.          EI := SUCCESSFUL;               -- Error 0
  5957.          HEIGHT := GKS_STATE_LIST.CURRENT_CHAR_HEIGHT;
  5958.       end if;
  5959.      
  5960.    end INQ_CHAR_HEIGHT;
  5961.      
  5962.    procedure INQ_CHAR_UP_VECTOR
  5963.       (EI    : out ERROR_INDICATOR;
  5964.       VECTOR : out WC.VECTOR) is
  5965.      
  5966.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  5967.    -- value of the current character up vector.  If the inquired
  5968.    -- information is available, the error indicator is returned as 0
  5969.    -- and the value is returned.
  5970.    --
  5971.    -- EI - This is the error indicator.  Its numeric value represents
  5972.    --    the type of error, if any, that occurred.
  5973.    -- VECTOR - Indicates the up direction of the character.
  5974.      
  5975.    begin
  5976.      
  5977.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  5978.       -- to see if GKS is in the proper state before proceeding.
  5979.      
  5980.       if CURRENT_OPERATING_STATE = GKCL then
  5981.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  5982.          VECTOR := (0.0,0.0);
  5983.       else
  5984.          EI := SUCCESSFUL;              -- Error 0
  5985.          VECTOR := GKS_STATE_LIST.CURRENT_CHAR_UP_VECTOR;
  5986.       end if;
  5987.      
  5988.    end INQ_CHAR_UP_VECTOR;
  5989.      
  5990.    procedure INQ_TEXT_PATH
  5991.       (EI  : out ERROR_INDICATOR;
  5992.       PATH : out TEXT_PATH) is
  5993.      
  5994.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  5995.    -- value of the current text path.  If the inquired information
  5996.    -- is available, the error indicator is returned as 0 and the
  5997.    -- value is returned.
  5998.    --
  5999.    -- EI - This is the error indicator.  Its numeric value represents
  6000.    --    the type of error, if any, that occurred.
  6001.    -- PATH - Indicates the direction taken by the text string.  It may
  6002.    --    be RIGHT, LEFT, UP, or DOWN.
  6003.      
  6004.    begin
  6005.      
  6006.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6007.       -- to see if GKS is in the proper state before proceeding.
  6008.      
  6009.       if CURRENT_OPERATING_STATE = GKCL then
  6010.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6011.          PATH := TEXT_PATH'FIRST;
  6012.       else
  6013.          EI := SUCCESSFUL;              -- Error 0
  6014.          PATH := GKS_STATE_LIST.CURRENT_TEXT_PATH;
  6015.       end if;
  6016.      
  6017.    end INQ_TEXT_PATH;
  6018.      
  6019.    procedure INQ_TEXT_ALIGNMENT
  6020.       (EI       : out ERROR_INDICATOR;
  6021.       ALIGNMENT : out TEXT_ALIGNMENT) is
  6022.      
  6023.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6024.    -- value of the current text alignment.  If the inquired infor-
  6025.    -- mation is available, the error indicator is returned as 0 and
  6026.    -- the value is returned.
  6027.    --
  6028.    -- EI - This is the error indicator.  Its numeric value represents
  6029.    --    the type of error, if any, that occurred.
  6030.    -- ALIGNMENT - Indicates the positioning of the text extent
  6031.    --    rectangle in relation to the text position. It is a
  6032.    --    record with a HORIZONTAL component and a VERTICAL
  6033.    --    component.
  6034.      
  6035.    begin
  6036.      
  6037.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6038.       -- to see if GKS is in the proper state before proceeding.
  6039.      
  6040.       if CURRENT_OPERATING_STATE = GKCL then
  6041.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6042.          ALIGNMENT := (NORMAL,NORMAL);
  6043.       else
  6044.          EI := SUCCESSFUL;              -- Error 0
  6045.          ALIGNMENT := GKS_STATE_LIST.CURRENT_TEXT_ALIGNMENT;
  6046.       end if;
  6047.      
  6048.    end INQ_TEXT_ALIGNMENT;
  6049.      
  6050.    procedure INQ_PATTERN_REFERENCE_POINT
  6051.       (EI             : out ERROR_INDICATOR;
  6052.       REFERENCE_POINT : out WC.POINT) is
  6053.      
  6054.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6055.    -- value of the current pattern reference point.  If the inquired
  6056.    -- information is available, the error indicator is returned as 0
  6057.    -- and the value is returned.
  6058.    --
  6059.    -- EI - This is the error indicator.  Its numeric value represents
  6060.    --    the type of error, if any, that occurred.
  6061.    -- REFERENCE_POINT - This is the world coordinate point giving the
  6062.    --    position for the start of the pattern.  It is a record type
  6063.    --    with X and Y components.
  6064.      
  6065.    begin
  6066.      
  6067.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6068.       -- to see if GKS is in the proper state before proceeding.
  6069.      
  6070.       if CURRENT_OPERATING_STATE = GKCL then
  6071.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6072.          REFERENCE_POINT := (0.0,0.0);
  6073.       else
  6074.          EI := SUCCESSFUL;              -- Error 0
  6075.          REFERENCE_POINT := GKS_STATE_LIST.
  6076.                             CURRENT_PATTERN_REFERENCE_POINT;
  6077.       end if;
  6078.      
  6079.    end INQ_PATTERN_REFERENCE_POINT;
  6080.      
  6081.    procedure INQ_PATTERN_HEIGHT_VECTOR
  6082.       (EI : out ERROR_INDICATOR;
  6083.       VECTOR : out WC.VECTOR) is
  6084.      
  6085.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6086.    -- value of the current pattern height vector.  If the inquired
  6087.    -- information is available, the error indicator is returned as 0
  6088.    -- and the value is returned.
  6089.    --
  6090.    -- EI - This is the error indicator.  Its numeric value represents
  6091.    --    the type of error, if any, that occurred.
  6092.    -- VECTOR - Indicates the pattern height vector.
  6093.      
  6094.    begin
  6095.      
  6096.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6097.       -- to see if GKS is in the proper state before proceeding.
  6098.      
  6099.       if CURRENT_OPERATING_STATE = GKCL then
  6100.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6101.          VECTOR := (0.0,0.0);
  6102.       else
  6103.          EI := SUCCESSFUL;              -- Error 0
  6104.          VECTOR := GKS_STATE_LIST.CURRENT_PATTERN_HEIGHT_VECTOR;
  6105.       end if;
  6106.      
  6107.    end INQ_PATTERN_HEIGHT_VECTOR;
  6108.      
  6109.    procedure INQ_PATTERN_WIDTH_VECTOR
  6110.       (EI   : out ERROR_INDICATOR;
  6111.       WIDTH : out WC.VECTOR) is
  6112.      
  6113.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6114.    -- value of the current pattern width vector.  If the inquired
  6115.    -- information is available, the error indicator is returned as 0
  6116.    -- and the value is returned.
  6117.    --
  6118.    -- EI - This is the error indicator.  Its numeric value represents
  6119.    --    the type of error, if any, that occurred.
  6120.    -- WIDTH - This is a vector in world coordinates describing the
  6121.    --    pattern width.
  6122.      
  6123.    begin
  6124.      
  6125.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6126.       -- to see if GKS is in the proper state before proceeding.
  6127.      
  6128.       if CURRENT_OPERATING_STATE = GKCL then
  6129.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6130.          WIDTH := (0.0,0.0);
  6131.       else
  6132.          EI := SUCCESSFUL;              -- Error 0
  6133.          WIDTH := GKS_STATE_LIST.CURRENT_PATTERN_WIDTH_VECTOR;
  6134.       end if;
  6135.      
  6136.    end INQ_PATTERN_WIDTH_VECTOR;
  6137.      
  6138.    procedure INQ_CHAR_WIDTH
  6139.       (EI   : out ERROR_INDICATOR;
  6140.       WIDTH : out WC.MAGNITUDE) is
  6141.      
  6142.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6143.    -- value of the current character nominal width.  If the inquired
  6144.    -- information is available, the error indicator is returned as 0
  6145.    -- and the value is returned.
  6146.    --
  6147.    -- EI - This is the error indicator.  Its numeric value represents
  6148.    --    the type of error, if any, that occurred.
  6149.    -- WIDTH - Indicates the nominal width of characters.
  6150.      
  6151.    begin
  6152.      
  6153.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6154.       -- to see if GKS is in the proper state before proceeding.
  6155.      
  6156.       if CURRENT_OPERATING_STATE = GKCL then
  6157.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6158.          WIDTH := 1.0;
  6159.       else
  6160.          EI := SUCCESSFUL;              -- Error 0
  6161.          WIDTH := GKS_STATE_LIST.CURRENT_CHAR_WIDTH;
  6162.       end if;
  6163.      
  6164.    end INQ_CHAR_WIDTH;
  6165.      
  6166.    procedure INQ_CHAR_BASE_VECTOR
  6167.       (EI    : out ERROR_INDICATOR;
  6168.       VECTOR : out WC.VECTOR) is
  6169.      
  6170.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6171.    -- value of the current character base vector.  If the inquired
  6172.    -- information is available, the error indicator is returned as 0
  6173.    -- and the value is returned.
  6174.    --
  6175.    -- EI - This is the error indicator.  Its numeric value represents
  6176.    --    the type of error, if any, that occurred.
  6177.    -- VECTOR - Indicates the character base vector in world coordinates.
  6178.      
  6179.    begin
  6180.      
  6181.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6182.       -- to see if GKS is in the proper state before proceeding.
  6183.      
  6184.       if CURRENT_OPERATING_STATE = GKCL then
  6185.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6186.          VECTOR := (0.0,0.0);
  6187.       else
  6188.          EI := SUCCESSFUL;              -- Error 0
  6189.          VECTOR := GKS_STATE_LIST.CURRENT_CHAR_BASE_VECTOR;
  6190.       end if;
  6191.      
  6192.    end INQ_CHAR_BASE_VECTOR;
  6193.      
  6194.    procedure INQ_CURRENT_PRIMITIVE_ATTRIBUTE_VALUES
  6195.       (EI        : out ERROR_INDICATOR;
  6196.       ATTRIBUTES : out PRIMITIVE_ATTRIBUTE_VALUES) is
  6197.      
  6198.    -- This procedure returns the primitive attributes in a single
  6199.    -- record rather than calling several procedures.
  6200.    -- The values returned by the procedure include:
  6201.    --    the current polyline index
  6202.    --    the current polymarker index
  6203.    --    the current text index
  6204.    --    the current character height
  6205.    --    the current character up vector
  6206.    --    the current character width
  6207.    --    the current character base vector
  6208.    --    the current text path
  6209.    --    the current text alignment
  6210.    --    the current fill area index
  6211.    --    the current pattern width vector
  6212.    --    the current pattern height vector
  6213.    --    the current pattern reference point
  6214.    -- which are contained in the record PRIMITIVE_ATTRIBUTES.
  6215.    -- If the inquired information is available, the error indicator
  6216.    -- is returned as 0 and the value is returned.
  6217.    --
  6218.    -- ATTRIBUTES - This record contains the values for the current
  6219.    --    primitive attributes and the bundle indices as described
  6220.    --    above.
  6221.      
  6222.    begin
  6223.      
  6224.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6225.       -- to see if GKS is in the proper state before proceeding.
  6226.      
  6227.       if CURRENT_OPERATING_STATE = GKCL then
  6228.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6229.          ATTRIBUTES.CURRENT_POLYLINE_INDEX    := POLYLINE_INDEX'FIRST;
  6230.          ATTRIBUTES.CURRENT_POLYMARKER_INDEX  := POLYMARKER_INDEX'FIRST;
  6231.          ATTRIBUTES.CURRENT_TEXT_INDEX        := TEXT_INDEX'FIRST;
  6232.          ATTRIBUTES.CURRENT_CHAR_HEIGHT       := 0.0;
  6233.          ATTRIBUTES.CURRENT_CHAR_UP_VECTOR    := (0.0,0.0);
  6234.          ATTRIBUTES.CURRENT_CHAR_WIDTH        := 0.0;
  6235.          ATTRIBUTES.CURRENT_CHAR_BASE_VECTOR  := (0.0,0.0);
  6236.          ATTRIBUTES.CURRENT_TEXT_PATH         := TEXT_PATH'FIRST;
  6237.          ATTRIBUTES.CURRENT_TEXT_ALIGNMENT    := (NORMAL,NORMAL);
  6238.          ATTRIBUTES.CURRENT_FILL_AREA_INDEX   := FILL_AREA_INDEX'FIRST;
  6239.          ATTRIBUTES.CURRENT_PATTERN_WIDTH_VECTOR    := (0.0,0.0);
  6240.          ATTRIBUTES.CURRENT_PATTERN_HEIGHT_VECTOR   := (0.0,0.0);
  6241.          ATTRIBUTES.CURRENT_PATTERN_REFERENCE_POINT := (0.0,0.0);
  6242.       else
  6243.          EI := SUCCESSFUL;               -- Error 0
  6244.          ATTRIBUTES.CURRENT_POLYLINE_INDEX := GKS_STATE_LIST.
  6245.                                           CURRENT_POLYLINE_INDEX;
  6246.          ATTRIBUTES.CURRENT_POLYMARKER_INDEX := GKS_STATE_LIST.
  6247.                                           CURRENT_POLYMARKER_INDEX;
  6248.          ATTRIBUTES.CURRENT_TEXT_INDEX := GKS_STATE_LIST.
  6249.                                           CURRENT_TEXT_INDEX;
  6250.          ATTRIBUTES.CURRENT_CHAR_HEIGHT := GKS_STATE_LIST.
  6251.                                           CURRENT_CHAR_HEIGHT;
  6252.          ATTRIBUTES.CURRENT_CHAR_UP_VECTOR := GKS_STATE_LIST.
  6253.                                           CURRENT_CHAR_UP_VECTOR;
  6254.          ATTRIBUTES.CURRENT_CHAR_WIDTH := GKS_STATE_LIST.
  6255.                                           CURRENT_CHAR_WIDTH;
  6256.          ATTRIBUTES.CURRENT_CHAR_BASE_VECTOR := GKS_STATE_LIST.
  6257.                                           CURRENT_CHAR_BASE_VECTOR;
  6258.          ATTRIBUTES.CURRENT_TEXT_PATH := GKS_STATE_LIST.
  6259.                                           CURRENT_TEXT_PATH;
  6260.          ATTRIBUTES.CURRENT_TEXT_ALIGNMENT := GKS_STATE_LIST.
  6261.                                           CURRENT_TEXT_ALIGNMENT;
  6262.          ATTRIBUTES.CURRENT_FILL_AREA_INDEX := GKS_STATE_LIST.
  6263.                                           CURRENT_FILL_AREA_INDEX;
  6264.          ATTRIBUTES.CURRENT_PATTERN_WIDTH_VECTOR := GKS_STATE_LIST.
  6265.                                           CURRENT_PATTERN_WIDTH_VECTOR;
  6266.          ATTRIBUTES.CURRENT_PATTERN_HEIGHT_VECTOR := GKS_STATE_LIST.
  6267.                                           CURRENT_PATTERN_HEIGHT_VECTOR;
  6268.          ATTRIBUTES.CURRENT_PATTERN_REFERENCE_POINT := GKS_STATE_LIST.
  6269.                                           CURRENT_PATTERN_REFERENCE_POINT;
  6270.      
  6271.       end if;
  6272.      
  6273.    end INQ_CURRENT_PRIMITIVE_ATTRIBUTE_VALUES;
  6274.      
  6275. end INQ_PRIMITIVE_ATTRIBUTES;
  6276. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6277. --:UDD:GKSADACM:CODE:MA:INQ_BUNDLE_IDX_B.ADA
  6278. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6279. ------------------------------------------------------------------
  6280. --
  6281. --  NAME: INQ_BUNDLE_INDICES - BODY
  6282. --  IDENTIFIER: GIMXXX.1(1)
  6283. --  DISCREPANCY REPORTS:
  6284. --
  6285. ------------------------------------------------------------------
  6286. -- file:  inq_bundle_idx_b.ada
  6287. -- level: all levels
  6288.      
  6289. with GKS_OPERATING_STATE_LIST;
  6290. with GKS_ERRORS;
  6291. with GKS_STATE_LIST;
  6292.      
  6293. use GKS_OPERATING_STATE_LIST;
  6294. use GKS_ERRORS;
  6295.      
  6296. package body INQ_BUNDLE_INDICES is
  6297.      
  6298. -- This is the package body for the procedures to inquire the
  6299. -- bundled primitive attributes.
  6300. --
  6301. -- Each of the procedures in this package inquires the
  6302. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  6303. -- of the states GKOP, WSOP, WSAC, or SGOP.  If it is not,
  6304. -- error indicator 8 occurs but no exception is raised.
  6305.      
  6306.    procedure INQ_POLYLINE_INDEX
  6307.       (EI   : out ERROR_INDICATOR;
  6308.       INDEX : out POLYLINE_INDEX) is
  6309.      
  6310.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6311.    -- value of the current polyline index.  If the inquired infor-
  6312.    -- mation is available, the error indicator is returned as 0 and
  6313.    -- the value is returned.
  6314.    --
  6315.    -- EI - This is the error indicator.  Its numeric value represents
  6316.    --    the type of error, if any, that occurred.
  6317.    -- INDEX - This is an integer index into a polyline bundle table,
  6318.    --    each entry of which contains all the non-geometric aspects
  6319.    --    of the polyline.
  6320.      
  6321.    begin
  6322.      
  6323.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6324.       -- to see if GKS is in the proper state before proceeding.
  6325.      
  6326.       if CURRENT_OPERATING_STATE = GKCL then
  6327.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6328.          INDEX := POLYLINE_INDEX'FIRST;
  6329.       else
  6330.          EI := SUCCESSFUL;               -- Error 0
  6331.          INDEX := GKS_STATE_LIST.CURRENT_POLYLINE_INDEX;
  6332.       end if;
  6333.      
  6334.    end INQ_POLYLINE_INDEX;
  6335.      
  6336.    procedure INQ_POLYMARKER_INDEX
  6337.       (EI   : out ERROR_INDICATOR;
  6338.       INDEX : out POLYMARKER_INDEX) is
  6339.      
  6340.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6341.    -- value of the current polymarker index.  If the inquired infor-
  6342.    -- mation is available, the error indicator is returned as 0 and
  6343.    -- the value is returned.
  6344.    --
  6345.    -- EI - This is the error indicator.  Its numeric value represents
  6346.    --    the type of error, if any, that occurred.
  6347.    -- INDEX - This is an integer index into a polymarker bundle table,
  6348.    --    each entry of which contains all the non-geometric aspects
  6349.    --    of the polymarker.
  6350.      
  6351.    begin
  6352.      
  6353.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6354.       -- to see if GKS is in the proper state before proceeding.
  6355.      
  6356.       if CURRENT_OPERATING_STATE = GKCL then
  6357.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6358.          INDEX := POLYMARKER_INDEX'FIRST;
  6359.       else
  6360.          EI := SUCCESSFUL;               -- Error 0
  6361.          INDEX := GKS_STATE_LIST.CURRENT_POLYMARKER_INDEX;
  6362.       end if;
  6363.      
  6364.    end INQ_POLYMARKER_INDEX;
  6365.      
  6366.    procedure INQ_FILL_AREA_INDEX
  6367.       (EI   : out ERROR_INDICATOR;
  6368.       INDEX : out FILL_AREA_INDEX) is
  6369.      
  6370.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6371.    -- value of the current fill area index.  If the inquired infor-
  6372.    -- mation is available, the error indicator is returned as 0 and
  6373.    -- the value is returned.
  6374.    --
  6375.    -- EI - This is the error indicator.  Its numeric value represents
  6376.    --    the type of error, if any, that occurred.
  6377.    -- INDEX - This is an integer index into a fill area bundle table,
  6378.    --    each entry of which contains all the non-geometric aspects
  6379.    --    of the fill area primitive.
  6380.      
  6381.    begin
  6382.      
  6383.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6384.       -- to see if GKS is in the proper state before proceeding.
  6385.      
  6386.       if CURRENT_OPERATING_STATE = GKCL then
  6387.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6388.          INDEX := FILL_AREA_INDEX'FIRST;
  6389.       else
  6390.          EI := SUCCESSFUL;               -- Error 0
  6391.          INDEX := GKS_STATE_LIST.CURRENT_FILL_AREA_INDEX;
  6392.       end if;
  6393.      
  6394.    end INQ_FILL_AREA_INDEX;
  6395.      
  6396.    procedure INQ_TEXT_INDEX
  6397.       (EI   : out ERROR_INDICATOR;
  6398.       INDEX : out TEXT_INDEX) is
  6399.      
  6400.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6401.    -- value of the current text index.  If the inquired infor-
  6402.    -- mation is available, the error indicator is returned as 0 and
  6403.    -- the value is returned.
  6404.    --
  6405.    -- EI - This is the error indicator.  Its numeric value represents
  6406.    --    the type of error, if any, that occurred.
  6407.    -- INDEX - This is an integer index into a text bundle table,
  6408.    --    each entry of which contains all the non-geometric aspects
  6409.    --    of the text primitive.
  6410.      
  6411.    begin
  6412.      
  6413.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6414.       -- to see if GKS is in the proper state before proceeding.
  6415.      
  6416.       if CURRENT_OPERATING_STATE = GKCL then
  6417.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6418.          INDEX := TEXT_INDEX'FIRST;
  6419.       else
  6420.          EI := SUCCESSFUL;               -- Error 0
  6421.          INDEX := GKS_STATE_LIST.CURRENT_TEXT_INDEX;
  6422.       end if;
  6423.      
  6424.    end INQ_TEXT_INDEX;
  6425.      
  6426. end INQ_BUNDLE_INDICES;
  6427. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6428. --:UDD:GKSADACM:CODE:MA:INQ_INDV_ATTR_B.ADA
  6429. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6430. ------------------------------------------------------------------
  6431. --
  6432. --  NAME: INQ_INDIVIDUAL_ATTRIBUTES
  6433. --  IDENTIFIER: GIMXXX.1(1)
  6434. --  DISCREPANCY REPORTS:
  6435. --
  6436. ------------------------------------------------------------------
  6437. -- file:  inq_indv_attr_b.ada
  6438. -- level: all levels
  6439.      
  6440. with GKS_OPERATING_STATE_LIST;
  6441. with GKS_ERRORS;
  6442. with GKS_STATE_LIST;
  6443.      
  6444. use GKS_OPERATING_STATE_LIST;
  6445. use GKS_ERRORS;
  6446.      
  6447. package body INQ_INDIVIDUAL_ATTRIBUTES is
  6448.      
  6449. -- This is the package body for inquiring the current
  6450. -- individual attributes.
  6451. --
  6452. -- Each of the procedures in this package inquires the
  6453. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  6454. -- of the states GKOP, WSOP, WSAC, or SGOP.  If it is not,
  6455. -- error indicator 8 occurs but no exception is raised.
  6456.      
  6457.    procedure INQ_LINETYPE
  6458.       (EI  : out ERROR_INDICATOR;
  6459.       LINE : out LINETYPE) is
  6460.      
  6461.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6462.    -- value of the current line type.  If the inquired information
  6463.    -- is available, the error indicator is returned as 0 and the
  6464.    -- value is returned.
  6465.    --
  6466.    -- EI - This is the error indicator.  Its numeric value represents
  6467.    --    the type of error, if any, that occurred.
  6468.    -- LINE - This is an integer value representing the type of line
  6469.    --    style that is currently selected.
  6470.      
  6471.    begin
  6472.      
  6473.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6474.       -- to see if GKS is in the proper state before proceeding.
  6475.      
  6476.       if CURRENT_OPERATING_STATE = GKCL then
  6477.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6478.          LINE := LINETYPE'FIRST;
  6479.       else
  6480.          EI := SUCCESSFUL;               -- Error 0
  6481.          LINE := GKS_STATE_LIST.CURRENT_LINETYPE;
  6482.       end if;
  6483.      
  6484.    end INQ_LINETYPE;
  6485.      
  6486.    procedure INQ_LINEWIDTH_SCALE_FACTOR
  6487.       (EI   : out ERROR_INDICATOR;
  6488.       WIDTH : out LINE_WIDTH) is
  6489.      
  6490.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6491.    -- value of the current linewidth scale factor.  If the inquired
  6492.    -- information is available, the error indicator is returned as 0
  6493.    -- and the value is returned.
  6494.    --
  6495.    -- EI - This is the error indicator.  Its numeric value represents
  6496.    --    the type of error, if any, that occurred.
  6497.    -- WIDTH - This is an floating point scale factor value that
  6498.    --    represents the width of a line.
  6499.      
  6500.    begin
  6501.      
  6502.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6503.       -- to see if GKS is in the proper state before proceeding.
  6504.      
  6505.       if CURRENT_OPERATING_STATE = GKCL then
  6506.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6507.          WIDTH := LINE_WIDTH'FIRST;
  6508.       else
  6509.          EI := SUCCESSFUL;              -- Error 0
  6510.          WIDTH := GKS_STATE_LIST.CURRENT_LINEWIDTH_SCALE_FACTOR;
  6511.       end if;
  6512.      
  6513.    end INQ_LINEWIDTH_SCALE_FACTOR;
  6514.      
  6515.    procedure INQ_POLYLINE_COLOUR_INDEX
  6516.       (EI    : out ERROR_INDICATOR;
  6517.       COLOUR : out COLOUR_INDEX) is
  6518.      
  6519.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6520.    -- value of the current polyline colour index.  If the inquired
  6521.    -- information is available, the error indicator is returned as 0
  6522.    -- and the value is returned.
  6523.    --
  6524.    -- EI - This is the error indicator.  Its numeric value represents
  6525.    --    the type of error, if any, that occurred.
  6526.    -- COLOUR - This is an integer value indicating the colour that
  6527.    --    is currently selected for polyline primitives.
  6528.      
  6529.    begin
  6530.      
  6531.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6532.       -- to see if GKS is in the proper state before proceeding.
  6533.      
  6534.       if CURRENT_OPERATING_STATE = GKCL then
  6535.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6536.          COLOUR := COLOUR_INDEX'FIRST;
  6537.       else
  6538.          EI := SUCCESSFUL;              -- Error 0
  6539.          COLOUR := GKS_STATE_LIST.CURRENT_POLYLINE_COLOUR_INDEX;
  6540.       end if;
  6541.      
  6542.    end INQ_POLYLINE_COLOUR_INDEX;
  6543.      
  6544.    procedure INQ_POLYMARKER_TYPE
  6545.       (EI    : out ERROR_INDICATOR;
  6546.       MARKER : out MARKER_TYPE) is
  6547.      
  6548.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6549.    -- value of the current polymarker type.  If the inquired infor-
  6550.    -- mation is available, the error indicator is returned as 0 and
  6551.    -- the value is returned.
  6552.    --
  6553.    -- EI - This is the error indicator.  Its numeric value represents
  6554.    --    the type of error, if any, that occurred.
  6555.    -- MARKER - This is an integer value representing the type of
  6556.    --    polymarker that is currently selected.
  6557.      
  6558.    begin
  6559.      
  6560.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6561.       -- to see if GKS is in the proper state before proceeding.
  6562.      
  6563.       if CURRENT_OPERATING_STATE = GKCL then
  6564.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6565.          MARKER := MARKER_TYPE'FIRST;
  6566.       else
  6567.          EI := SUCCESSFUL;                -- Error 0
  6568.          MARKER := GKS_STATE_LIST.CURRENT_MARKER_TYPE;
  6569.       end if;
  6570.      
  6571.    end INQ_POLYMARKER_TYPE;
  6572.      
  6573.    procedure INQ_POLYMARKER_SIZE_SCALE_FACTOR
  6574.       (EI  : out ERROR_INDICATOR;
  6575.       SIZE : out MARKER_SIZE) is
  6576.      
  6577.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6578.    -- value of the current polymarker size scale factor.  If the
  6579.    -- inquired information is available, the error indicator is
  6580.    -- returned as 0 and the value is returned.
  6581.    --
  6582.    -- EI - This is the error indicator.  Its numeric value represents
  6583.    --    the type of error, if any, that occurred.
  6584.    -- SIZE - This is a positive scale factor value indicating the
  6585.    --    relative size of the polymarker.
  6586.      
  6587.    begin
  6588.      
  6589.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6590.       -- to see if GKS is in the proper state before proceeding.
  6591.      
  6592.       if CURRENT_OPERATING_STATE = GKCL then
  6593.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6594.          SIZE := MARKER_SIZE'FIRST;
  6595.       else
  6596.          EI := SUCCESSFUL;               -- Error 0
  6597.          SIZE := GKS_STATE_LIST.CURRENT_MARKER_SIZE_SCALE_FACTOR;
  6598.       end if;
  6599.      
  6600.    end INQ_POLYMARKER_SIZE_SCALE_FACTOR;
  6601.      
  6602.    procedure INQ_POLYMARKER_COLOUR_INDEX
  6603.       (EI    : out ERROR_INDICATOR;
  6604.       COLOUR : out COLOUR_INDEX) is
  6605.      
  6606.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6607.    -- value of the current polymarker colour index.  If the
  6608.    -- inquired information is available, the error indicator is
  6609.    -- returned as 0 and the value is returned.
  6610.    --
  6611.    -- EI - This is the error indicator.  Its numeric value represents
  6612.    -- the type of error, if any, that occurred.
  6613.    -- COLOUR - This is an integer value indicating the colour that
  6614.    -- is currently selected for polymarker primitives.
  6615.      
  6616.    begin
  6617.      
  6618.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6619.       -- to see if GKS is in the proper state before proceeding.
  6620.      
  6621.       if CURRENT_OPERATING_STATE = GKCL then
  6622.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6623.          COLOUR := COLOUR_INDEX'FIRST;
  6624.       else
  6625.          EI := SUCCESSFUL;               -- Error 0
  6626.          COLOUR := GKS_STATE_LIST.CURRENT_POLYMARKER_COLOUR_INDEX;
  6627.       end if;
  6628.      
  6629.    end INQ_POLYMARKER_COLOUR_INDEX;
  6630.      
  6631.    procedure INQ_TEXT_FONT_AND_PRECISION
  6632.       (EI            : out ERROR_INDICATOR;
  6633.       FONT_PRECISION : out TEXT_FONT_PRECISION) is
  6634.      
  6635.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6636.    -- value of the current text font and precision.  If the
  6637.    -- inquired information is available, the error indicator is
  6638.    -- returned as 0 and the value is returned.
  6639.    --
  6640.    -- EI - This is the error indicator.  Its numeric value represents
  6641.    --    the type of error, if any, that occurred.
  6642.    -- FONT_PRECISION - This is a record describing the text font
  6643.    --    and precision.  The FONT component is an integer value
  6644.    --    representing the font selected.  The PRECISION component
  6645.    --    may be of the value STRING_PRECISION, CHAR_PRECISION, or
  6646.    --    STROKE_PRECISION.
  6647.      
  6648.    begin
  6649.      
  6650.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6651.       -- to see if GKS is in the proper state before proceeding.
  6652.      
  6653.       if CURRENT_OPERATING_STATE = GKCL then
  6654.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6655.          FONT_PRECISION := (0,STRING_PRECISION);
  6656.       else
  6657.          EI := SUCCESSFUL;              -- Error 0
  6658.          FONT_PRECISION := GKS_STATE_LIST.
  6659.                            CURRENT_TEXT_FONT_AND_PRECISION;
  6660.       end if;
  6661.      
  6662.    end INQ_TEXT_FONT_AND_PRECISION;
  6663.      
  6664.    procedure INQ_CHAR_EXPANSION_FACTOR
  6665.       (EI       : out ERROR_INDICATOR;
  6666.       EXPANSION : out CHAR_EXPANSION) is
  6667.      
  6668.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6669.    -- value of the current character expansion factor.  If the
  6670.    -- inquired information is available, the error indicator is
  6671.    -- returned as 0 and the value is returned.
  6672.    --
  6673.    -- EI - This is the error indicator.  Its numeric value represents
  6674.    --    the type of error, if any, that occurred.
  6675.    -- EXPANSION - This is a positive scale factor value that indicates
  6676.    --    the character expansion.
  6677.      
  6678.    begin
  6679.      
  6680.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6681.       -- to see if GKS is in the proper state before proceeding.
  6682.      
  6683.       if CURRENT_OPERATING_STATE = GKCL then
  6684.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6685.          EXPANSION := CHAR_EXPANSION'FIRST;
  6686.       else
  6687.          EI := SUCCESSFUL;              -- Error 0
  6688.          EXPANSION := GKS_STATE_LIST.CURRENT_CHAR_EXPANSION_FACTOR;
  6689.       end if;
  6690.      
  6691.    end INQ_CHAR_EXPANSION_FACTOR;
  6692.      
  6693.    procedure INQ_CHAR_SPACING
  6694.       (EI     : out ERROR_INDICATOR;
  6695.       SPACING : out CHAR_SPACING) is
  6696.      
  6697.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6698.    -- value of the current character spacing.  If the inquired
  6699.    -- information is available, the error indicator is returned
  6700.    -- as 0 and the value is returned.
  6701.    --
  6702.    -- EI - This is the error indicator.  Its numeric value represents
  6703.    --    the type of error, if any, that occurred.
  6704.    -- SPACING - This is a scale factor value representing the
  6705.    --    character spacing.  A positive value indicates the amount
  6706.    --    of space between characters.  A negative value indicates
  6707.    --    the amount of overlap between characters.
  6708.      
  6709.    begin
  6710.      
  6711.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6712.       -- to see if GKS is in the proper state before proceeding.
  6713.      
  6714.       if CURRENT_OPERATING_STATE = GKCL then
  6715.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6716.          SPACING := 1.0;
  6717.       else
  6718.          EI := SUCCESSFUL;              -- Error 0
  6719.          SPACING := GKS_STATE_LIST.CURRENT_CHAR_SPACING;
  6720.       end if;
  6721.      
  6722.    end INQ_CHAR_SPACING;
  6723.      
  6724.    procedure INQ_TEXT_COLOUR_INDEX
  6725.       (EI    : out ERROR_INDICATOR;
  6726.       COLOUR : out COLOUR_INDEX) is
  6727.      
  6728.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6729.    -- value of the current text colour index.  If the inquired
  6730.    -- information is available, the error indicator is returned
  6731.    -- as 0 and the value is returned.
  6732.    --
  6733.    -- EI - This is the error indicator.  Its numeric value represents
  6734.    --    the type of error, if any, that occurred.
  6735.    -- COLOUR - This is an integer value indicating the colour that
  6736.    --    is currently selected for text primitives.
  6737.      
  6738.    begin
  6739.      
  6740.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6741.       -- to see if GKS is in the proper state before proceeding.
  6742.      
  6743.       if CURRENT_OPERATING_STATE = GKCL then
  6744.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6745.          COLOUR := COLOUR_INDEX'FIRST;
  6746.       else
  6747.          EI := SUCCESSFUL;              -- Error 0
  6748.          COLOUR := GKS_STATE_LIST.CURRENT_TEXT_COLOUR_INDEX;
  6749.       end if;
  6750.      
  6751.    end INQ_TEXT_COLOUR_INDEX;
  6752.      
  6753.    procedure INQ_FILL_AREA_INTERIOR_STYLE
  6754.       (EI   : out ERROR_INDICATOR;
  6755.       STYLE : out INTERIOR_STYLE) is
  6756.      
  6757.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6758.    -- value of the current fill area interior style.  If the inquired
  6759.    -- information is available, the error indicator is returned
  6760.    -- as 0 and the value is returned.
  6761.    --
  6762.    -- EI - This is the error indicator.  Its numeric value represents
  6763.    --    the type of error, if any, that occurred.
  6764.    -- STYLE - This enumerated type indicates whether the current fill
  6765.    --    area interior style is HOLLOW, SOLID, PATTERN, or HATCH.
  6766.      
  6767.    begin
  6768.      
  6769.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6770.       -- to see if GKS is in the proper state before proceeding.
  6771.      
  6772.       if CURRENT_OPERATING_STATE = GKCL then
  6773.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6774.          STYLE := INTERIOR_STYLE'FIRST;
  6775.       else
  6776.          EI := SUCCESSFUL;              -- Error 0
  6777.          STYLE := GKS_STATE_LIST.CURRENT_FILL_AREA_INTERIOR_STYLE;
  6778.       end if;
  6779.      
  6780.    end INQ_FILL_AREA_INTERIOR_STYLE;
  6781.      
  6782.    procedure INQ_FILL_AREA_STYLE_INDEX
  6783.       (EI   : out ERROR_INDICATOR;
  6784.       INDEX : out STYLE_INDEX) is
  6785.      
  6786.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6787.    -- value of the current fill area style index.  If the inquired
  6788.    -- information is available, the error indicator is returned
  6789.    -- as 0 and the value is returned.
  6790.    --
  6791.    -- EI - This is the error indicator.  Its numeric value represents
  6792.    --    the type of error, if any, that occurred.
  6793.    -- INDEX - This is a variant record defining the fill area style
  6794.    --    index.  If the discriminant is HOLLOW or SOLID, the record
  6795.    --    has a null component.  If it is PATTERN, the component is
  6796.    --    a PATTERN_INDEX.  If it is HATCH, the record component is
  6797.    --    a HATCH_STYLE_TYPE.
  6798.      
  6799.    begin
  6800.      
  6801.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6802.       -- to see if GKS is in the proper state before proceeding.
  6803.      
  6804.       if CURRENT_OPERATING_STATE = GKCL then
  6805.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6806.          INDEX := STYLE_INDEX'FIRST;
  6807.       else
  6808.          EI := SUCCESSFUL;               -- Error 0
  6809.          INDEX := GKS_STATE_LIST.CURRENT_FILL_AREA_STYLE_INDEX;
  6810.       end if;
  6811.      
  6812.    end INQ_FILL_AREA_STYLE_INDEX;
  6813.      
  6814.    procedure INQ_FILL_AREA_COLOUR_INDEX
  6815.       (EI    : out ERROR_INDICATOR;
  6816.       COLOUR : out COLOUR_INDEX) is
  6817.      
  6818.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6819.    -- value of the current fill area colour index.  If the inquired
  6820.    -- information is available, the error indicator is returned
  6821.    -- as 0 and the value is returned.
  6822.    --
  6823.    -- EI - This is the error indicator.  Its numeric value represents
  6824.    --    the type of error, if any, that occurred.
  6825.    -- COLOUR - This is an integer value indicating the colour that
  6826.    --    is currently selected for fill area primitives.
  6827.      
  6828.    begin
  6829.      
  6830.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6831.       -- to see if GKS is in the proper state before proceeding.
  6832.      
  6833.       if CURRENT_OPERATING_STATE = GKCL then
  6834.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6835.          COLOUR := COLOUR_INDEX'FIRST;
  6836.       else
  6837.          EI := SUCCESSFUL;               -- Error 0
  6838.          COLOUR := GKS_STATE_LIST.CURRENT_FILL_AREA_COLOUR_INDEX;
  6839.       end if;
  6840.      
  6841.    end INQ_FILL_AREA_COLOUR_INDEX;
  6842.      
  6843.    procedure INQ_LIST_OF_ASF
  6844.       (EI    : out ERROR_INDICATOR;
  6845.       LIST : out ASF_LIST) is
  6846.      
  6847.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6848.    -- value of the current list of aspect source flags.  If the
  6849.    -- inquired information is available, the error indicator is
  6850.    -- returned as 0 and the values are returned.
  6851.    --
  6852.    -- EI - This is the error indicator.  Its numeric value represents
  6853.    --    the type of error, if any, that occurred.
  6854.    -- LIST - This is a record listing all of the aspect source flags.
  6855.    --    Each component may have a value of INDIVIDUAL or BUNDLED.
  6856.      
  6857.    begin
  6858.      
  6859.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6860.       -- to see if GKS is in the proper state before proceeding.
  6861.      
  6862.       if CURRENT_OPERATING_STATE = GKCL then
  6863.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  6864.          LIST := (OTHERS => INDIVIDUAL);
  6865.       else
  6866.          EI := SUCCESSFUL;               -- Error 0
  6867.          LIST := GKS_STATE_LIST.CURRENT_ASPECT_SOURCE_FLAGS;
  6868.       end if;
  6869.      
  6870.    end INQ_LIST_OF_ASF;
  6871.      
  6872.    procedure INQ_CURRENT_INDIVIDUAL_ATTRIBUTE_VALUES
  6873.       (EI         : out ERROR_INDICATOR;
  6874.       ATTRIBUTES  : out INDIVIDUAL_ATTRIBUTE_VALUES) is
  6875.      
  6876.    -- This procedure inquires the GKS_STATE_LIST to obtain the
  6877.    -- values of:
  6878.    --    the current line type
  6879.    --    the current linewidth scale factor
  6880.    --    the current polyline colour index
  6881.    --    the current polymarker type
  6882.    --    the current polymarker size scale factor
  6883.    --    the current polymarker colour index
  6884.    --    the current text font and precision
  6885.    --    the current character expansion factor
  6886.    --    the current character spacing
  6887.    --    the current text colour index
  6888.    --    the current fill area interior style
  6889.    --    the current fill area style index
  6890.    --    the current fill area colour index
  6891.    --    the current list of aspect source flags
  6892.    -- in a single call.  These values are components of the record
  6893.    -- ATTRIBUTES.  If the inquired information is available, the error
  6894.    -- indicator is returned as 0 and the value is returned.
  6895.    --
  6896.    -- ATTRIBUTES - This is a record type with all of the current
  6897.    --    individual attributes as described above.
  6898.      
  6899.    begin
  6900.      
  6901.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  6902.       -- to see if GKS is in the proper state before proceeding.
  6903.      
  6904.       if CURRENT_OPERATING_STATE = GKCL then
  6905.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  6906.          ATTRIBUTES.CURRENT_LINETYPE          := LINETYPE'FIRST;
  6907.          ATTRIBUTES.CURRENT_LINE_WIDTH        := LINE_WIDTH'FIRST;
  6908.          ATTRIBUTES.CURRENT_POLYLINE_COLOUR   := COLOUR_INDEX'FIRST;
  6909.          ATTRIBUTES.CURRENT_MARKER_TYPE       := MARKER_TYPE'FIRST;
  6910.          ATTRIBUTES.CURRENT_POLYMARKER_SIZE   := MARKER_SIZE'FIRST;
  6911.          ATTRIBUTES.CURRENT_POLYMARKER_COLOUR := COLOUR_INDEX'FIRST;
  6912.          ATTRIBUTES.CURRENT_FONT_PRECISION    := (0,STRING_PRECISION);
  6913.          ATTRIBUTES.CURRENT_CHAR_EXPANSION    := CHAR_EXPANSION'FIRST;
  6914.          ATTRIBUTES.CURRENT_CHAR_SPACING      := CHAR_SPACING'FIRST;
  6915.          ATTRIBUTES.CURRENT_TEXT_COLOUR       := COLOUR_INDEX'FIRST;
  6916.          ATTRIBUTES.CURRENT_INTERIOR_STYLE    := INTERIOR_STYLE'FIRST;
  6917.          ATTRIBUTES.CURRENT_STYLE_INDEX       := STYLE_INDEX'FIRST;
  6918.          ATTRIBUTES.CURRENT_FILL_AREA_COLOUR  := COLOUR_INDEX'FIRST;
  6919.          ATTRIBUTES.CURRENT_ASF_LIST          := (OTHERS => INDIVIDUAL);
  6920.       else
  6921.          EI := SUCCESSFUL;     -- Error 0
  6922.          ATTRIBUTES.CURRENT_LINETYPE := GKS_STATE_LIST.CURRENT_LINETYPE;
  6923.          ATTRIBUTES.CURRENT_LINE_WIDTH := GKS_STATE_LIST.
  6924.                                       CURRENT_LINEWIDTH_SCALE_FACTOR;
  6925.          ATTRIBUTES.CURRENT_POLYLINE_COLOUR := GKS_STATE_LIST.
  6926.                                       CURRENT_POLYLINE_COLOUR_INDEX;
  6927.          ATTRIBUTES.CURRENT_MARKER_TYPE := GKS_STATE_LIST.
  6928.                                       CURRENT_MARKER_TYPE;
  6929.          ATTRIBUTES.CURRENT_POLYMARKER_SIZE := GKS_STATE_LIST.
  6930.                                        CURRENT_MARKER_SIZE_SCALE_FACTOR;
  6931.          ATTRIBUTES.CURRENT_POLYMARKER_COLOUR := GKS_STATE_LIST.
  6932.                                        CURRENT_POLYMARKER_COLOUR_INDEX;
  6933.          ATTRIBUTES.CURRENT_FONT_PRECISION := GKS_STATE_LIST.
  6934.                                        CURRENT_TEXT_FONT_AND_PRECISION;
  6935.          ATTRIBUTES.CURRENT_CHAR_EXPANSION := GKS_STATE_LIST.
  6936.                                        CURRENT_CHAR_EXPANSION_FACTOR;
  6937.          ATTRIBUTES.CURRENT_CHAR_SPACING := GKS_STATE_LIST.
  6938.                                        CURRENT_CHAR_SPACING;
  6939.          ATTRIBUTES.CURRENT_TEXT_COLOUR := GKS_STATE_LIST.
  6940.                                        CURRENT_TEXT_COLOUR_INDEX;
  6941.          ATTRIBUTES.CURRENT_INTERIOR_STYLE := GKS_STATE_LIST.
  6942.                                        CURRENT_FILL_AREA_INTERIOR_STYLE;
  6943.          ATTRIBUTES.CURRENT_STYLE_INDEX := GKS_STATE_LIST.
  6944.                                        CURRENT_FILL_AREA_STYLE_INDEX;
  6945.          ATTRIBUTES.CURRENT_FILL_AREA_COLOUR := GKS_STATE_LIST.
  6946.                                        CURRENT_FILL_AREA_COLOUR_INDEX;
  6947.          ATTRIBUTES.CURRENT_ASF_LIST := GKS_STATE_LIST.
  6948.                                         CURRENT_ASPECT_SOURCE_FLAGS;
  6949.      
  6950.       end if;
  6951.      
  6952.    end INQ_CURRENT_INDIVIDUAL_ATTRIBUTE_VALUES;
  6953.      
  6954. end INQ_INDIVIDUAL_ATTRIBUTES;
  6955. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6956. --:UDD:GKSADACM:CODE:0A:GKS_NORM_0A_B.ADA
  6957. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  6958. ------------------------------------------------------------------
  6959. --
  6960. --  NAME: GKS_NORMALIZATION - BODY
  6961. --  IDENTIFIER: GIMXXX.1(3)
  6962. --  DISCREPANCY REPORTS:
  6963. --  DR033  Check for = in determining rectangle validity.
  6964. ------------------------------------------------------------------
  6965. -- file:  gks_norm_b.ada
  6966. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  6967.      
  6968. with CGI;
  6969. with WSM;
  6970. with ERROR_ROUTINES;
  6971. with GKS_OPERATING_STATE_LIST;
  6972. with GKS_STATE_LIST;
  6973. with GKS_ERRORS;
  6974. with TRANSLATION_FACTORS;
  6975. with SET_PRIMITIVE_ATTRIBUTES_MA;
  6976. with SET_PRIMITIVE_ATTRIBUTES_0A;
  6977.      
  6978. use CGI;
  6979. use WSM;
  6980. use ERROR_ROUTINES;
  6981. use GKS_OPERATING_STATE_LIST;
  6982. use GKS_ERRORS;
  6983.      
  6984. package body GKS_NORMALIZATION is
  6985.      
  6986. -- This is the package body for the normalization transformation
  6987. -- procedures for GKS.
  6988. --
  6989. -- Each of the procedures in this package inquires the
  6990. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  6991. -- of the states GKOP, WSOP, WSAC, or SGOP.  If it is not,
  6992. -- error 8 occurs and the procedure raises the exception
  6993. -- STATE_ERROR.
  6994. --
  6995. -- If an error indicator above 0 occurs, these procedures call
  6996. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  6997. -- to log the error indicator and the name of the procedure
  6998. -- in the error file specified when the procedure OPEN_GKS
  6999. -- was called to begin this session of GKS operation.
  7000.      
  7001.    procedure SET_WINDOW
  7002.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  7003.       WINDOW_LIMITS   : in WC.RECTANGLE_LIMITS) is
  7004.      
  7005.    -- This procedure checks to see if the transformation number is
  7006.    -- greater or equal to 1.  If it is not, error 50 occurs and the
  7007.    -- exception TRANSFORMATION_ERROR is raised.  Then, this
  7008.    -- procedure checks the value of the window limits passed
  7009.    -- in to see if they are valid.  If not, error 51 occurs and the
  7010.    -- exception TRANSFORMATION_ERROR is raised.  Otherwise, the
  7011.    -- procedure sets the value of the window limits entry for the
  7012.    -- specified transformation number in the GKS_STATE_LIST.
  7013.    --
  7014.    -- TRANSFORMATION - This is an integer value representing a
  7015.    --    normalization transformation.
  7016.    -- WINDOW_LIMITS - This record defines the extent of the
  7017.    --    window RECTANGLE_LIMITS in world coordinates. Its X and Y
  7018.    --    components give the limits in relation to the x and y
  7019.    --    axes.
  7020.      
  7021.    PATTERN_SIZE : WC.SIZE;
  7022.    -- This object is used to store the current pattern size as
  7023.    -- it is converted from height and width vectors in the GKS_STATE_
  7024.    -- LIST.  It is then used as the actual parameter in the
  7025.    -- SET_PATTERN_SIZE call.
  7026.      
  7027.    begin
  7028.      
  7029.       -- The following if structure inquires the GKS_OPERATING_
  7030.       -- STATE_LIST to see if GKS is in the proper state and if
  7031.       -- the window limits requested are valid before proceeding
  7032.       -- with the set to the GKS_STATE_LIST.
  7033.      
  7034.       if CURRENT_OPERATING_STATE = GKCL then
  7035.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,"SET_WINDOW");-- Error 8
  7036.          raise STATE_ERROR;
  7037.      
  7038.       elsif TRANSFORMATION < 1 then
  7039.          ERROR_LOGGING (INVALID_XFORM_NUMBER,"SET_WINDOW");  -- Error 50
  7040.          raise TRANSFORMATION_ERROR;
  7041.      
  7042.       elsif (WINDOW_LIMITS.XMIN >= WINDOW_LIMITS.XMAX) or
  7043.             (WINDOW_LIMITS.YMIN >= WINDOW_LIMITS.YMAX) then
  7044.          ERROR_LOGGING (INVALID_RECTANGLE, "SET_WINDOW");    -- Error 51
  7045.          raise TRANSFORMATION_ERROR;
  7046.      
  7047.       else
  7048.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7049.             (TRANSFORMATION).WINDOW := WINDOW_LIMITS;
  7050.      
  7051.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7052.             (TRANSFORMATION).NDC_FACTORS := TRANSLATION_FACTORS.
  7053.             GET_NORMALIZATION_FACTORS(WINDOW_LIMITS,GKS_STATE_LIST.
  7054.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(TRANSFORMATION).
  7055.             VIEWPORT);
  7056.      
  7057.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7058.             (TRANSFORMATION).WC_FACTORS := TRANSLATION_FACTORS.
  7059.             GET_NORMALIZATION_FACTORS(GKS_STATE_LIST.
  7060.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(TRANSFORMATION).
  7061.             VIEWPORT,WINDOW_LIMITS);
  7062.       end if;
  7063.      
  7064.    -- The following procedure calls ensure that the primitive
  7065.    -- attributes that are affected by the new window are reset.
  7066.    SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_HEIGHT(GKS_STATE_LIST.
  7067.       CURRENT_CHAR_HEIGHT);
  7068.      
  7069.    SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_UP_VECTOR(GKS_STATE_LIST.
  7070.       CURRENT_CHAR_UP_VECTOR);
  7071.      
  7072.    PATTERN_SIZE := (XAXIS => WC.MAGNITUDE(GKS_STATE_LIST.
  7073.       CURRENT_PATTERN_WIDTH_VECTOR.X),
  7074.       YAXIS => WC.MAGNITUDE(GKS_STATE_LIST.
  7075.       CURRENT_PATTERN_HEIGHT_VECTOR.Y));
  7076.      
  7077.    SET_PRIMITIVE_ATTRIBUTES_0A.SET_PATTERN_SIZE(PATTERN_SIZE);
  7078.      
  7079.    SET_PRIMITIVE_ATTRIBUTES_0A.SET_PATTERN_REFERENCE_POINT
  7080.       (GKS_STATE_LIST.CURRENT_PATTERN_REFERENCE_POINT);
  7081.      
  7082.    exception
  7083.       when STATE_ERROR =>
  7084.          raise;
  7085.       when TRANSFORMATION_ERROR =>
  7086.          raise;
  7087.       when OTHERS =>
  7088.          ERROR_LOGGING (UNKNOWN, "SET_WINDOW");             -- Error 2501
  7089.          raise;
  7090.      
  7091.    end SET_WINDOW;
  7092.      
  7093.    procedure SET_VIEWPORT
  7094.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  7095.       VIEWPORT_LIMITS : in NDC.RECTANGLE_LIMITS) is
  7096.      
  7097.    -- If the transformation number is less than 1, error 50
  7098.    -- occurs, and the exception TRANSFORMATION_ERROR is raised.
  7099.    -- Then, this procedure checks if the rectangle definition of
  7100.    -- the viewport limits passed in is valid.  If it is not,
  7101.    -- error 51 occurs and the procedure raises the exception
  7102.    -- TRANSFORMATION_ERROR.  If the rectangle is not with in NDC
  7103.    -- unit square, error 52 occurs and the exception TRANSFORMATION_
  7104.    -- ERROR is raised.
  7105.    --
  7106.    -- The viewport limits entry of the specified normalization
  7107.    -- transformation in the GKS_STATE_LIST is set to the value
  7108.    -- passed in.
  7109.    --
  7110.    -- This procedure also passes the information to the WS_MANAGER
  7111.    -- so that it will have access to the new viewport specification.
  7112.    --
  7113.    -- TRANSFORMATION - This is an integer value representing a
  7114.    --    normalization transformation.
  7115.    -- VEIWPORT_LIMITS - This record defines the extent of the
  7116.    --    viewport rectangle in normalized device coordinates.
  7117.    --    Its X and Y components give the limits in relation to
  7118.    --    the x and y axes.
  7119.      
  7120.    GKS_INSTR : CGI_SET_CLIPPING_RECTANGLE;
  7121.      
  7122.    PATTERN_SIZE : WC.SIZE;
  7123.    -- This object is used to store the current pattern size as
  7124.    -- it is converted from height and width vectors in the GKS_STATE_
  7125.    -- LIST.  It is then used as the actual parameter in the
  7126.    -- SET_PATTERN_SIZE call.
  7127.      
  7128.    begin
  7129.      
  7130.       -- The following if structure inquires the GKS_OPERATING_
  7131.       -- STATE_LIST to see if GKS is in the proper state.  It then
  7132.       -- checks the TRANSFORMATION parameter to ensure that it is
  7133.       -- not less than 1.  Then it checks the validity of the VIEW-
  7134.       -- PORT_LIMITS passed in.  This is done by checking the
  7135.       -- rectangle values and by checking to see if the viewport
  7136.       -- is in the NDC unit square.  If all of the checks are
  7137.       -- satisfactory, the viewport is set.
  7138.      
  7139.       if CURRENT_OPERATING_STATE = GKCL then
  7140.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,"SET_VIEWPORT");-- Error 8
  7141.          raise STATE_ERROR;
  7142.      
  7143.       elsif TRANSFORMATION < 1 then
  7144.          ERROR_LOGGING (INVALID_XFORM_NUMBER, "SET_VIEWPORT");-- Error 50
  7145.          raise TRANSFORMATION_ERROR;
  7146.      
  7147.       elsif (VIEWPORT_LIMITS.XMIN >= VIEWPORT_LIMITS.XMAX) or
  7148.             (VIEWPORT_LIMITS.YMIN >= VIEWPORT_LIMITS.YMAX) then
  7149.          ERROR_LOGGING (INVALID_RECTANGLE, "SET_VIEWPORT");   -- Error 51
  7150.          raise TRANSFORMATION_ERROR;
  7151.      
  7152.       elsif (VIEWPORT_LIMITS.XMIN < 0.0) or
  7153.             (VIEWPORT_LIMITS.XMAX > 1.0) or
  7154.             (VIEWPORT_LIMITS.YMIN < 0.0) or
  7155.             (VIEWPORT_LIMITS.YMAX > 1.0) then
  7156.          ERROR_LOGGING (VIEWPORT_NOT_IN_NDC_UNIT_SQR,
  7157.                         "SET_VIEWPORT");                  -- Error 52
  7158.          raise TRANSFORMATION_ERROR;
  7159.      
  7160.       else
  7161.          if (TRANSFORMATION = GKS_STATE_LIST.
  7162.             CURRENT_NORMALIZATION_TRANSFORMATION) and
  7163.             (GKS_STATE_LIST.CLIP_INDICATOR = CLIP) then
  7164.             GKS_INSTR.CLIPPING_RECTANGLE_SET := VIEWPORT_LIMITS;
  7165.             WS_MANAGER (GKS_INSTR);
  7166.          end if;
  7167.      
  7168.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7169.          (TRANSFORMATION).VIEWPORT := VIEWPORT_LIMITS;
  7170.      
  7171.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7172.             (TRANSFORMATION).NDC_FACTORS := TRANSLATION_FACTORS.
  7173.             GET_NORMALIZATION_FACTORS(GKS_STATE_LIST.
  7174.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(TRANSFORMATION).
  7175.             WINDOW,VIEWPORT_LIMITS);
  7176.      
  7177.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7178.             (TRANSFORMATION).WC_FACTORS := TRANSLATION_FACTORS.
  7179.             GET_NORMALIZATION_FACTORS(VIEWPORT_LIMITS,GKS_STATE_LIST.
  7180.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(TRANSFORMATION).
  7181.             WINDOW);
  7182.       end if;
  7183.      
  7184.    -- The following procedure calls ensure that the primitive
  7185.    -- attributes that are affected by the new viewport are reset.
  7186.    SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_HEIGHT(GKS_STATE_LIST.
  7187.       CURRENT_CHAR_HEIGHT);
  7188.      
  7189.    SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_UP_VECTOR(GKS_STATE_LIST.
  7190.       CURRENT_CHAR_UP_VECTOR);
  7191.      
  7192.    PATTERN_SIZE := (XAXIS => WC.MAGNITUDE(GKS_STATE_LIST.
  7193.       CURRENT_PATTERN_WIDTH_VECTOR.X),
  7194.       YAXIS => WC.MAGNITUDE(GKS_STATE_LIST.
  7195.       CURRENT_PATTERN_HEIGHT_VECTOR.Y));
  7196.      
  7197.    SET_PRIMITIVE_ATTRIBUTES_0A.SET_PATTERN_SIZE(PATTERN_SIZE);
  7198.      
  7199.    SET_PRIMITIVE_ATTRIBUTES_0A.SET_PATTERN_REFERENCE_POINT
  7200.       (GKS_STATE_LIST.CURRENT_PATTERN_REFERENCE_POINT);
  7201.      
  7202.       exception
  7203.          when STATE_ERROR =>
  7204.             raise;
  7205.          when TRANSFORMATION_ERROR =>
  7206.             raise;
  7207.          when NUMERIC_ERROR =>
  7208.             ERROR_LOGGING (ARITHMETIC, "SET_VIEWPORT"); -- Error 308
  7209.             raise SYSTEM_ERROR;
  7210.          when OTHERS =>
  7211.             ERROR_LOGGING (UNKNOWN, "SET_VIEWPORT");    -- Error 2501
  7212.             raise;
  7213.      
  7214.    end SET_VIEWPORT;
  7215.      
  7216.    procedure SELECT_NORMALIZATION_TRANSFORMATION
  7217.       (TRANSFORMATION : in TRANSFORMATION_NUMBER) is
  7218.      
  7219.    -- The current normalization transformation number entry in the
  7220.    -- GKS_STATE_LIST is set to the value that was passed in.
  7221.    -- Also, if the clipping indicator is on in the GKS_STATE_LIST,
  7222.    -- the procedure passes the clipping rectangle (viewport) of the
  7223.    -- normalization transformation to the WS_MANAGER.
  7224.    --
  7225.    -- TRANSFORMATION - This is an integer value representing a
  7226.    --    normalization transformation.
  7227.      
  7228.    GKS_INSTR : CGI_SET_CLIPPING_RECTANGLE;
  7229.      
  7230.      
  7231.    begin
  7232.      
  7233.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  7234.       -- to see if GKS is in the proper state before proceeding
  7235.       -- with the set to the GKS_STATE_LIST.
  7236.      
  7237.       if CURRENT_OPERATING_STATE = GKCL then
  7238.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  7239.                        "SELECT_NORMALIZATION_TRANSFORMATION"); -- Error 8
  7240.          raise STATE_ERROR;
  7241.      
  7242.       elsif  (TRANSFORMATION >
  7243.          GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS'LAST) then
  7244.          ERROR_LOGGING (INVALID_XFORM_NUMBER,
  7245.                        "SELECT_NORMALIZATION_TRANFORMATION"); -- Error 50
  7246.          raise TRANSFORMATION_ERROR;
  7247.      
  7248.       else
  7249.          if (TRANSFORMATION /= GKS_STATE_LIST.
  7250.             CURRENT_NORMALIZATION_TRANSFORMATION) and
  7251.             (GKS_STATE_LIST.CLIP_INDICATOR = CLIP) then
  7252.             GKS_INSTR.CLIPPING_RECTANGLE_SET := GKS_STATE_LIST.
  7253.               LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7254.               (TRANSFORMATION).VIEWPORT;
  7255.             WS_MANAGER(GKS_INSTR);
  7256.          end if;
  7257.      
  7258.          GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION :=
  7259.             TRANSFORMATION;
  7260.      
  7261.       end if;
  7262.      
  7263.       exception
  7264.          when STATE_ERROR =>
  7265.             raise;
  7266.          when TRANSFORMATION_ERROR =>
  7267.             raise;
  7268.          when NUMERIC_ERROR =>
  7269.             ERROR_LOGGING (ARITHMETIC,
  7270.                            "SELECT_NORMALIZATION_TRANSFORMATION");
  7271.                                                           -- Error 308
  7272.             raise SYSTEM_ERROR;
  7273.          when OTHERS =>
  7274.             ERROR_LOGGING (UNKNOWN,
  7275.                            "SELECT_NORMALIZATION_TRANSFORMATION");
  7276.                                                           -- Error 2501
  7277.             raise;
  7278.      
  7279.    end SELECT_NORMALIZATION_TRANSFORMATION;
  7280.      
  7281.    procedure SET_CLIPPING_INDICATOR
  7282.       (CLIPPING : in CLIPPING_INDICATOR) is
  7283.      
  7284.    -- This procedure sets the clipping indicator in the GKS_STATE_LIST.
  7285.    -- If the indicator is turned OFF, the clipping rectangle of
  7286.    -- (0.0,1.0,0.0,1.0) is passed to the WS_MANAGER.  If it is turned
  7287.    -- ON, the viewport is sent to the WS_MANAGER.
  7288.    --
  7289.    -- CLIPPING - The value of this enumerated parameter may be CLIP
  7290.    --    or NOCLIP.  Its value determines whether or not clipping
  7291.    --    will be performed on successive output.
  7292.      
  7293.    GKS_INSTR : CGI_SET_CLIPPING_RECTANGLE;
  7294.      
  7295.      
  7296.    begin
  7297.      
  7298.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  7299.       -- to see if GKS is in the proper state before proceeding
  7300.       -- with the call to the WS_MANAGER.
  7301.      
  7302.       if CURRENT_OPERATING_STATE = GKCL then
  7303.             ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  7304.                            "SET_CLIPPING_INDICATOR");    -- Error 8
  7305.             raise STATE_ERROR;
  7306.       else
  7307.      
  7308.          if GKS_STATE_LIST.CLIP_INDICATOR /= CLIPPING then
  7309.             GKS_STATE_LIST.CLIP_INDICATOR := CLIPPING;
  7310.          end if;
  7311.      
  7312.       -- Call to the WS_MANAGER.
  7313.      
  7314.          if CLIPPING = CLIP then
  7315.             GKS_INSTR.CLIPPING_RECTANGLE_SET := GKS_STATE_LIST.
  7316.                LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7317.                (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  7318.                VIEWPORT;
  7319.             WS_MANAGER (GKS_INSTR);
  7320.          elsif CLIPPING = NOCLIP then
  7321.             GKS_INSTR.CLIPPING_RECTANGLE_SET := GKS_STATE_LIST.
  7322.                LIST_OF_NORMALIZATION_TRANSFORMATIONS (0).VIEWPORT;
  7323.             WS_MANAGER (GKS_INSTR);
  7324.          end if;
  7325.      
  7326.       end if;
  7327.      
  7328.       exception
  7329.          when STATE_ERROR =>
  7330.             raise;
  7331.          when NUMERIC_ERROR =>
  7332.             ERROR_LOGGING (ARITHMETIC,"SET_CLIPPING_INDICATOR");
  7333.             raise SYSTEM_ERROR;                           -- Error 308
  7334.          when OTHERS =>
  7335.             ERROR_LOGGING (UNKNOWN,"SET_CLIPPING_INDICATOR");-- Error 2501
  7336.             raise;
  7337.      
  7338.    end SET_CLIPPING_INDICATOR;
  7339.      
  7340. end GKS_NORMALIZATION;
  7341. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7342. --:UDD:GKSADACM:CODE:MA:WS_XFORM_B.ADA
  7343. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7344. ------------------------------------------------------------------
  7345. --
  7346. --  NAME: WS_TRANSFORMATION - BODY
  7347. --  IDENTIFIER: GIMXXX.1(2)
  7348. --  DISCREPANCY REPORTS:
  7349. --  DR033  Check for = in determining rectangle validity.
  7350. ------------------------------------------------------------------
  7351. -- file:  ws_xform_b.ada
  7352. -- level: all levels
  7353.      
  7354. with WSM;
  7355. with CGI;
  7356. with ERROR_ROUTINES;
  7357. with GKS_OPERATING_STATE_LIST;
  7358. with GKS_STATE_LIST;
  7359. with GKS_ERRORS;
  7360.      
  7361. use WSM;
  7362. use CGI;
  7363. use ERROR_ROUTINES;
  7364. use GKS_OPERATING_STATE_LIST;
  7365. use GKS_ERRORS;
  7366.      
  7367. package body WS_TRANSFORMATION is
  7368.      
  7369. -- This is the package body for the workstation normalization
  7370. -- transformation procedures.
  7371. --
  7372. -- Each of the procedures in this package inquires the
  7373. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  7374. -- of the states WSOP, WSAC, or SGOP.  If it is not, error
  7375. -- 7 occurs and the procedure raises the exception STATE_ERROR.
  7376. -- In addition, each procedure inquires the GKS_STATE_LIST to see
  7377. -- if the WS is in the set of open workstations before calling the
  7378. -- WS_MANAGER.  If it is not, error 25 occurs and the exception
  7379. -- WS_ERROR is raised.  A check is also made on the rectangle
  7380. -- limits to see if the rectangle is valid.  If not, error 51
  7381. -- occurs and the procedure raises the exception TRANSFORMATION_
  7382. -- ERROR.
  7383. --
  7384. -- If an error indicator above 0 occurs, these procedures call
  7385. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  7386. -- to log the error indicator and the name of the procedure
  7387. -- in the error file specified when the procedure OPEN_GKS
  7388. -- was called to begin this session of GKS operation.
  7389.      
  7390.    procedure SET_WS_WINDOW
  7391.       (WS              : in WS_ID;
  7392.       WS_WINDOW_LIMITS : in NDC.RECTANGLE_LIMITS) is
  7393.      
  7394.    -- This procedure calls the workstation manager to set the
  7395.    -- value of the requested workstation window entry in the
  7396.    -- workstation state list.  If the workstation manager returns
  7397.    -- error 33, or 36, this procedure raises  the exception
  7398.    -- WS_ERROR.
  7399.    --
  7400.    -- WS - This is an integer value representing the workstation
  7401.    --    identification.
  7402.    -- WS_WINDOW_LIMITS - This record defines the extent of the
  7403.    --    workstation window rectangle in normalized device coordinates.
  7404.    --    Its X and Y components give the limits in relation to the
  7405.    --    x and y axes.
  7406.      
  7407.    GKS_INSTR : CGI_SET_WS_WINDOW;
  7408.      
  7409.    begin
  7410.      
  7411.       -- The following if structure inquires the GKS_OPERATING_STATE_
  7412.       -- LIST to see if GKS is in the proper state.  It also inquires
  7413.       -- the GKS_STATE_LIST to see if the requested window limits are
  7414.       -- valid.  Finally, it checks the GKS_STATE_LIST to see if the
  7415.       -- workstation is in the set of open workstations before proceed-
  7416.       -- ing with the call to the WS_MANAGER.
  7417.      
  7418.       if (CURRENT_OPERATING_STATE = GKCL) or
  7419.          (CURRENT_OPERATING_STATE = GKOP) then
  7420.          ERROR_LOGGING (NOT_WSOP_WSAC_SGOP, "SET_WS_WINDOW"); -- Error 7
  7421.          raise STATE_ERROR;
  7422.      
  7423.       elsif (WS_WINDOW_LIMITS.XMIN >= WS_WINDOW_LIMITS.XMAX) or
  7424.             (WS_WINDOW_LIMITS.YMIN >= WS_WINDOW_LIMITS.YMAX) then
  7425.          ERROR_LOGGING (INVALID_RECTANGLE, "SET_WS_WINDOW");  -- Error 51
  7426.          raise TRANSFORMATION_ERROR;
  7427.      
  7428.       elsif (WS_WINDOW_LIMITS.XMIN < 0.0) or
  7429.             (WS_WINDOW_LIMITS.XMAX > 1.0) or
  7430.             (WS_WINDOW_LIMITS.YMIN < 0.0) or
  7431.             (WS_WINDOW_LIMITS.YMAX > 1.0) then
  7432.          ERROR_LOGGING (WS_WINDOW_NOT_IN_NDC_UNIT_SQR,
  7433.                         "SET_WS_WINDOW");                    -- Error 53
  7434.          raise TRANSFORMATION_ERROR;
  7435.      
  7436.       elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  7437.          ERROR_LOGGING (WS_NOT_OPEN, "SET_WS_WINDOW");       -- Error 25
  7438.          raise WS_ERROR;
  7439.      
  7440.       else
  7441.          GKS_INSTR.WS_TO_SET_WINDOW := WS;
  7442.          GKS_INSTR.WS_WINDOW_LIMITS_SET := WS_WINDOW_LIMITS;
  7443.          WS_MANAGER (GKS_INSTR);
  7444.      
  7445.          if GKS_INSTR.EI /= SUCCESSFUL then             -- Error 0
  7446.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or    -- Error 33
  7447.                (GKS_INSTR.EI = WS_IS_WISS) then         -- Error 36
  7448.                ERROR_LOGGING(GKS_INSTR.EI, "SET_WS_WINDOW");
  7449.                raise WS_ERROR;
  7450.             end if;
  7451.      
  7452.          end if;
  7453.      
  7454.       end if;
  7455.      
  7456.       exception
  7457.          when STATE_ERROR =>
  7458.             raise;
  7459.          when TRANSFORMATION_ERROR =>
  7460.             raise;
  7461.          when WS_ERROR =>
  7462.             raise;
  7463.          when NUMERIC_ERROR =>
  7464.             ERROR_LOGGING (ARITHMETIC,"SET_WS_WINDOW");   -- Error 308
  7465.             raise SYSTEM_ERROR;
  7466.          when OTHERS =>
  7467.             ERROR_LOGGING (UNKNOWN, "SET_WS_WINDOW");     -- Error 2501
  7468.             raise;
  7469.      
  7470.    end SET_WS_WINDOW;
  7471.      
  7472.    procedure SET_WS_VIEWPORT
  7473.       (WS                : in WS_ID;
  7474.       WS_VIEWPORT_LIMITS : in DC.RECTANGLE_LIMITS) is
  7475.      
  7476.    -- This procedure calls the workstation manager to set the value
  7477.    -- of the requested workstation viewport in the workstation state
  7478.    -- list.  If the workstation manager returns error 33, or 36,
  7479.    -- this procedure raises the exception WS_ERROR.  If the workstation
  7480.    -- manager returns error 54, this procedure raises the
  7481.    -- exception TRANSFORMATION_ERROR.
  7482.    --
  7483.    -- WS - This is an integer value representing the workstation
  7484.    --    identification.
  7485.    -- VIEWPORT_LIMITS - This record defines the extent of the
  7486.    --    viewport rectangle in device coordinates.  Its X and Y
  7487.    --    components give the limits in relation to the x and y axes.
  7488.      
  7489.    GKS_INSTR : CGI_SET_WS_VIEWPORT;
  7490.      
  7491.    begin
  7492.      
  7493.       -- The following if structure inquires the GKS_OPERATING_STATE_
  7494.       -- LIST to see if GKS is in the proper state.  It also inquires
  7495.       -- the GKS_STATE_LIST to see if the requested window limits are
  7496.       -- valid.  Finally, it checks the GKS_STATE_LIST to see if the
  7497.       -- workstation is in the set of open workstations before proceed-
  7498.       -- ing with the call to the WS_MANAGER.
  7499.      
  7500.       if (CURRENT_OPERATING_STATE = GKCL) or
  7501.          (CURRENT_OPERATING_STATE = GKOP) then
  7502.          ERROR_LOGGING (NOT_WSOP_WSAC_SGOP,
  7503.                         "SET_WS_VIEWPORT");             -- Error 7
  7504.          raise STATE_ERROR;
  7505.      
  7506.       elsif (WS_VIEWPORT_LIMITS.XMIN >= WS_VIEWPORT_LIMITS.XMAX) or
  7507.             (WS_VIEWPORT_LIMITS.YMIN >= WS_VIEWPORT_LIMITS.YMAX) then
  7508.          ERROR_LOGGING (INVALID_RECTANGLE,
  7509.                         "SET_WS_VIEWPORT");                -- Error 51
  7510.          raise TRANSFORMATION_ERROR;
  7511.      
  7512.       elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  7513.          ERROR_LOGGING (WS_NOT_OPEN, "SET_WS_VIEWPORT");    -- Error 25
  7514.          raise WS_ERROR;
  7515.      
  7516.       else
  7517.          GKS_INSTR.WS_TO_SET_VIEWPORT := WS;
  7518.          GKS_INSTR.WS_VIEWPORT_LIMITS_SET := WS_VIEWPORT_LIMITS;
  7519.          WS_MANAGER (GKS_INSTR);
  7520.      
  7521.          if GKS_INSTR.EI /= SUCCESSFUL then                 -- Error 0
  7522.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or        -- Error 33
  7523.                (GKS_INSTR.EI = WS_IS_WISS) or               -- Error 36
  7524.                (GKS_INSTR.EI = WS_VIEWPORT_NOT_IN_DISPLAY_SPACE) then
  7525.                                                             -- Error 54
  7526.                ERROR_LOGGING(GKS_INSTR.EI, "SET_WS_VIEWPORT");
  7527.                raise WS_ERROR;
  7528.             end if;
  7529.      
  7530.          end if;
  7531.      
  7532.       end if;
  7533.      
  7534.       exception
  7535.          when STATE_ERROR =>
  7536.             raise;
  7537.          when WS_ERROR =>
  7538.             raise;
  7539.          when TRANSFORMATION_ERROR =>
  7540.             raise;
  7541.          when NUMERIC_ERROR =>
  7542.             ERROR_LOGGING (ARITHMETIC,"SET_WS_VIEWPORT");  -- Error 308
  7543.             raise SYSTEM_ERROR;
  7544.          when OTHERS =>
  7545.             ERROR_LOGGING (UNKNOWN, "SET_WS_VIEWPORT");     -- Error 2501
  7546.             raise;
  7547.      
  7548.    end SET_WS_VIEWPORT;
  7549.      
  7550. end WS_TRANSFORMATION;
  7551. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7552. --:UDD:GKSADACM:CODE:MA:INQ_GKS_ST_LST_MA_B.ADA
  7553. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7554. ------------------------------------------------------------------
  7555. --
  7556. --  NAME: INQ_GKS_STATE_LIST_MA - BODY
  7557. --  IDENTIFIER: GIMXXX.1(1)
  7558. --  DISCREPANCY REPORTS:
  7559. --
  7560. ------------------------------------------------------------------
  7561. -- file:  inq_gks_st_lst_ma_b.ada
  7562. -- level: all levels
  7563.      
  7564. with GKS_OPERATING_STATE_LIST;
  7565. with GKS_ERRORS;
  7566. with GKS_STATE_LIST;
  7567.      
  7568. use GKS_OPERATING_STATE_LIST;
  7569. use GKS_ERRORS;
  7570.      
  7571. package body INQ_GKS_STATE_LIST_MA is
  7572.      
  7573. -- This is the package body for the procedures to inquire the
  7574. -- GKS state list.
  7575. --
  7576. -- Each of the procedures in this package inquires the
  7577. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  7578. -- of the states GKOP, WSOP, WSAC, or SGOP.  If it
  7579. -- is not, error indicator 8 occurs but no exception is raised.
  7580.      
  7581.    procedure INQ_CURRENT_NORMALIZATION_TRANSFORMATION_NUMBER
  7582.       (EI            : out ERROR_INDICATOR;
  7583.       TRANSFORMATION : out TRANSFORMATION_NUMBER) is
  7584.      
  7585.    -- This procedure inquires the GKS_STATE_LIST for the current
  7586.    -- normalization transformation number.  If the inquired infor-
  7587.    -- mation is available, the error indicator is returned by this
  7588.    -- procedure as 0 and the requested information is returned.
  7589.    --
  7590.    -- EI - This is the error indicator.  Its numeric value represents
  7591.    --    the type of error, if any, that occurred.
  7592.    -- TRANSFORMATION - This is an integer value representing the current
  7593.    --    normalization transformation.
  7594.      
  7595.    begin
  7596.      
  7597.       -- The following case inquires the GKS_OPERATING_STATE_LIST
  7598.       -- to see if GKS is in the proper state before proceeding
  7599.       -- with the inquiry of the GKS_STATE_LIST.
  7600.      
  7601.       if CURRENT_OPERATING_STATE = GKCL then
  7602.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  7603.          TRANSFORMATION := TRANSFORMATION_NUMBER'FIRST;
  7604.       else
  7605.          EI := SUCCESSFUL;               -- Error 0
  7606.          TRANSFORMATION := GKS_STATE_LIST.
  7607.                               CURRENT_NORMALIZATION_TRANSFORMATION;
  7608.       end if;
  7609.      
  7610.    end INQ_CURRENT_NORMALIZATION_TRANSFORMATION_NUMBER;
  7611.      
  7612.    procedure INQ_NORMALIZATION_TRANSFORMATION
  7613.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  7614.       EI              : out ERROR_INDICATOR;
  7615.       WINDOW_LIMITS   : out WC.RECTANGLE_LIMITS;
  7616.       VIEWPORT_LIMITS : out NDC.RECTANGLE_LIMITS) is
  7617.      
  7618.    -- This procedure inquires the GKS_STATE_LIST for the current
  7619.    -- normalization transformation.  If the inquired information
  7620.    -- is available, the error indicator is returned by this procedure
  7621.    -- as 0 and the requested information is returned.
  7622.    --
  7623.    -- TRANSFORMATION - This is an integer value representing a
  7624.    --    normalization transformation.
  7625.    -- EI - This is the error indicator.  Its numeric value represents
  7626.    --    the type of error, if any, that occurred.
  7627.    -- WINDOW_LIMITS - This record defines the extent of the
  7628.    --    window rectangle in world coordinates. Its X and Y
  7629.    --    components give the limits in relation to the x and y
  7630.    --    axes.
  7631.    -- VIEWPORT_LIMITS - This record defines the extent of the
  7632.    --    viewport rectangle in normalized device coordinates.
  7633.    --    Its X and Y components give the limits in relation to
  7634.    --    the x and y axes.
  7635.      
  7636.    begin
  7637.      
  7638.       -- The following if structure inquires the GKS_OPERATING_
  7639.       -- STATE_LIST to see if GKS is in the proper state and the
  7640.       -- transformation number is valid before proceeding with
  7641.       -- the inquiry of the GKS_STATE_LIST.
  7642.      
  7643.       if CURRENT_OPERATING_STATE = GKCL then
  7644.          EI := NOT_GKOP_WSOP_WSAC_SGOP;     -- Error 8
  7645.          WINDOW_LIMITS := (0.0,1.0,0.0,1.0);
  7646.          VIEWPORT_LIMITS := (0.0,1.0,0.0,1.0);
  7647.      
  7648.       elsif TRANSFORMATION < 0 then
  7649.          EI := INVALID_XFORM_NUMBER;        -- Error 50
  7650.          WINDOW_LIMITS := (0.0,1.0,0.0,1.0);
  7651.          VIEWPORT_LIMITS := (0.0,1.0,0.0,1.0);
  7652.      
  7653.       else
  7654.          EI := SUCCESSFUL;                  -- Error 0
  7655.          WINDOW_LIMITS := GKS_STATE_LIST.
  7656.             LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7657.             (TRANSFORMATION).WINDOW;
  7658.          VIEWPORT_LIMITS := GKS_STATE_LIST.
  7659.             LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7660.             (TRANSFORMATION).VIEWPORT;
  7661.       end if;
  7662.      
  7663.    end INQ_NORMALIZATION_TRANSFORMATION;
  7664.      
  7665.    procedure INQ_CLIPPING
  7666.       (EI                : out ERROR_INDICATOR;
  7667.       CLIPPING           : out CLIPPING_INDICATOR;
  7668.       CLIPPING_RECTANGLE : out NDC.RECTANGLE_LIMITS) is
  7669.      
  7670.    -- This procedure inquires the GKS_STATE_LIST to obtain the current
  7671.    -- clipping indicator.  If the inquired information is available,
  7672.    -- the error indicator is returned to this procedure as 0 and the
  7673.    -- requested information is returned.
  7674.    --
  7675.    -- EI - This is the error indicator.  Its numeric value represents
  7676.    --    the type of error, if any, that occurred.
  7677.    -- CLIPPING - The value of this enumerated parameter may be CLIP
  7678.    --    or NOCLIP.  Its value determines whether or not clipping
  7679.    --    is being performed on current output.
  7680.    -- CLIPPING_RECTANGLE - This record defines the extent of the
  7681.    --    clipping area in normalized device coordinates.  The
  7682.    --    X and Y components define the limits of the rectangle
  7683.    --    along the x and y axes.
  7684.      
  7685.    begin
  7686.      
  7687.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  7688.       -- to see if GKS is in the proper state before proceeding.
  7689.      
  7690.       if CURRENT_OPERATING_STATE = GKCL then
  7691.          EI := NOT_GKOP_WSOP_WSAC_SGOP; -- Error 8
  7692.          CLIPPING := CLIPPING_INDICATOR'FIRST;
  7693.          CLIPPING_RECTANGLE := (0.0,1.0,0.0,1.0);
  7694.       else
  7695.          EI := SUCCESSFUL;              -- Error 0
  7696.          CLIPPING := GKS_STATE_LIST.CLIP_INDICATOR;
  7697.          CLIPPING_RECTANGLE := GKS_STATE_LIST.
  7698.             LIST_OF_NORMALIZATION_TRANSFORMATIONS(GKS_STATE_LIST.
  7699.             CURRENT_NORMALIZATION_TRANSFORMATION).VIEWPORT;
  7700.       end if;
  7701.      
  7702.    end INQ_CLIPPING;
  7703.      
  7704. end INQ_GKS_STATE_LIST_MA;
  7705. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7706. --:UDD:GKSADACM:CODE:MA:INQ_GKS_DSCR_TBL_MAB.ADA
  7707. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7708. ------------------------------------------------------------------
  7709. --
  7710. --  NAME: INQ_GKS_DESCRIPTION_TABLE_MA
  7711. --  IDENTIFIER: GIMXXX.1(1)
  7712. --  DISCREPANCY REPORTS:
  7713. --
  7714. ------------------------------------------------------------------
  7715. -- file:  inq_gks_dscr_tbl_mab.ada
  7716. -- level: all levels
  7717.      
  7718. with GKS_DESCRIPTION_TABLE;
  7719. with GKS_OPERATING_STATE_LIST;
  7720. with GKS_ERRORS;
  7721.      
  7722. use GKS_OPERATING_STATE_LIST;
  7723. use GKS_ERRORS;
  7724.      
  7725. package body INQ_GKS_DESCRIPTION_TABLE_MA is
  7726.      
  7727. -- This is the package body for the procedures to inquire the
  7728. -- GKS_DESCRIPTION_TABLE.
  7729.      
  7730.    procedure INQ_LEVEL_OF_GKS
  7731.       (EI   : out ERROR_INDICATOR;
  7732.       LEVEL : out GKS_LEVEL) is
  7733.      
  7734.    -- This procedure inquires the GKS_OPERATING_STATE_LIST
  7735.    -- to see if GKS is in one of the states GKOP, WSOP,
  7736.    -- WSAC, or SGOP.  If it is not, error 8 occurs and this
  7737.    -- procedure raises the exception STATE_ERROR.  Otherwise,
  7738.    -- this procedure inquires the GKS description table for the
  7739.    -- level of the current implementation of GKS.  If the inquired
  7740.    -- information is available, the error indicator is returned as
  7741.    -- 0 by this procedure and the value requested is returned.
  7742.    --
  7743.    -- EI - This is the error indicator.  Its numeric value represents
  7744.    --    the type of error, if any, that occurred.
  7745.    -- LEVEL - This enumerated type gives level of GKS.  Its value may
  7746.    --    be Lma, Lmb, Lmc, L0a, L0b, L0c, L1a, L1b, L1c, L2a, L2b, or
  7747.    --    L2c.
  7748.      
  7749.    begin
  7750.      
  7751.       -- The following if inquires the GKS_OPERATING_STATE_LIST
  7752.       -- to see if GKS is in the proper state before proceeding
  7753.       -- with the inquiry of the GKS_DESCRIPTION_TABLE.
  7754.      
  7755.       if CURRENT_OPERATING_STATE = GKCL then
  7756.          EI := NOT_GKOP_WSOP_WSAC_SGOP;  -- Error 8
  7757.          LEVEL := GKS_LEVEL'FIRST;
  7758.       else
  7759.          EI := SUCCESSFUL;               -- Error 0
  7760.          LEVEL := GKS_DESCRIPTION_TABLE.LEVEL_OF_GKS;
  7761.       end if;
  7762.      
  7763.    end INQ_LEVEL_OF_GKS;
  7764.      
  7765. end INQ_GKS_DESCRIPTION_TABLE_MA;
  7766. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7767. --:UDD:GKSADACM:CODE:MA:INQ_WS_ST_LST_MA_B.ADA
  7768. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  7769. ------------------------------------------------------------------
  7770. --
  7771. --  NAME: INQ_WS_STATE_LIST_MA - BODY
  7772. --  IDENTIFIER: GIMXXX.3.1
  7773. --  DISCREPANCY REPORTS:
  7774. --  DR016  Call deallocation procedures in INQ_WS_ST_LST_MA
  7775. ------------------------------------------------------------------
  7776. -- file:  inq_ws_st_lst_ma_b.ada
  7777. -- level: all levels
  7778.      
  7779. with WSM;
  7780. with CGI;
  7781. with GKS_OPERATING_STATE_LIST;
  7782. with GKS_STATE_LIST;
  7783. with GKS_ERRORS;
  7784. with GKS_DESCRIPTION_TABLE;
  7785. with TRANSFORMATION_MATH;
  7786.      
  7787. use WSM;
  7788. use CGI;
  7789. use GKS_OPERATING_STATE_LIST;
  7790. use GKS_ERRORS;
  7791.      
  7792. package body INQ_WS_STATE_LIST_MA is
  7793.      
  7794. -- This is the package body for the procedures to call the
  7795. -- workstation manager to inquire the workstation state list.
  7796. --
  7797. -- Each of the procedures in this package inquires the
  7798. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of the
  7799. -- states WSOP, WSAC, or SGOP.  If it is not, error indicator
  7800. -- 7 occurs but no exception is raised.  In addition, each of
  7801. -- the procedures inquires the GKS_STATE_LIST to see if the
  7802. -- requested WS is open.  If it is not, error indicator 25
  7803. -- occurs but no exception is raised.  If neither condition occurs,
  7804. -- (the EI is 0) then a call is made to the WS_MANAGER to do the
  7805. -- inquiry.
  7806.      
  7807.    procedure INQ_WS_CONNECTION_AND_TYPE
  7808.       (WS        : in WS_ID;
  7809.       EI         : out ERROR_INDICATOR;
  7810.       CONNECTION : out VARIABLE_CONNECTION_ID;
  7811.       TYPE_OF_WS : out WS_TYPE) is
  7812.      
  7813.    -- This procedure calls the workstation manager to obtain the
  7814.    -- connection identifier and the workstation type from the
  7815.    -- workstation state list.  If the inquired information is
  7816.    -- available, the workstation manager returns the error
  7817.    -- indicator as 0 and values requested.
  7818.    --
  7819.    -- WS - This is an integer value indicating the workstation
  7820.    --    identification.
  7821.    -- EI - This is the error indicator.  Its numeric value represents
  7822.    --    the type of error, if any, that occurred.
  7823.    -- CONNECTION - The physical identifier associated with the logical
  7824.    --    WS identifier.
  7825.    -- TYPE_OF_WS - This is an integer value representing the type of
  7826.    --    workstation.
  7827.      
  7828.    GKS_INSTR : CGI_INQ_WS_CONNECTION_AND_TYPE;
  7829.      
  7830.    TEMP_CONNECTION : VARIABLE_CONNECTION_ID;
  7831.      
  7832.    begin
  7833.      
  7834.       -- The following if structure inquires the GKS_OPERATING_
  7835.       -- STATE_LIST to see if GKS is in the proper state.  Then
  7836.       -- if so, it inquires the GKS_STATE_LIST to see if the WS is
  7837.       -- in the set of open workstations before proceeding with the
  7838.       -- inquiry call to the WS_MANAGER.
  7839.      
  7840.       if (CURRENT_OPERATING_STATE = GKCL) or
  7841.          (CURRENT_OPERATING_STATE = GKOP) then
  7842.          EI := NOT_WSOP_WSAC_SGOP;            -- Error 7
  7843.          CONNECTION := TEMP_CONNECTION;
  7844.          TYPE_OF_WS := WS_TYPE'FIRST;
  7845.      
  7846.       elsif not WS_IDS.IS_IN_LIST(WS,
  7847.             GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  7848.          EI := WS_NOT_OPEN;                   -- Error 25
  7849.          CONNECTION := TEMP_CONNECTION;
  7850.          TYPE_OF_WS := WS_TYPE'FIRST;
  7851.      
  7852.       else
  7853.      
  7854.          GKS_INSTR.WS_TO_INQ_CONNECTION_AND_TYPE := WS;
  7855.          WS_MANAGER (GKS_INSTR);
  7856.      
  7857.          if GKS_INSTR.EI /= SUCCESSFUL then   -- Error 0
  7858.             EI := UNKNOWN;                    -- Error 2501
  7859.          else
  7860.             EI := GKS_INSTR.EI;               -- Error 0
  7861.          end if;
  7862.      
  7863.          CONNECTION.CONNECT := GKS_INSTR.CONNECTION_INQ.all; -- DR004
  7864.          TYPE_OF_WS := GKS_INSTR.TYPE_OF_WS_INQ;
  7865.      
  7866.          FREE_CONNECTION_ID (GKS_INSTR.CONNECTION_INQ);
  7867.      
  7868.       end if;
  7869.      
  7870.    end INQ_WS_CONNECTION_AND_TYPE;
  7871.      
  7872.    procedure INQ_TEXT_EXTENT
  7873.       (WS                 : in WS_ID;
  7874.       POSITION            : in WC.POINT;
  7875.       CHAR_STRING         : in STRING;
  7876.       EI                  : out ERROR_INDICATOR;
  7877.       CONCATENATION_POINT : out WC.POINT;
  7878.       TEXT_EXTENT         : out TEXT_EXTENT_PARALLELOGRAM) is
  7879.      
  7880.    -- This procedure calls the workstation manager to obtain the
  7881.    -- value of the text extent rectangle and the concatenation
  7882.    -- point which can be used as the origin of a subsequent text
  7883.    -- output primitive for the concatenation of character strings.
  7884.    -- If the inquired information is available, the error indicator
  7885.    -- is returned by the workstation manager as 0.  If the inquired
  7886.    -- information is not available, the workstation manager returns
  7887.    -- error 39 to indicate the reason for non-availability.
  7888.    --
  7889.    -- WS - This is an integer value indicating the workstation
  7890.    --    identification.
  7891.    -- POSITION - This is a record with X and Y components indicating
  7892.    --    the point in world coordinates where the text starts.
  7893.    -- CHAR_STRING - This string is the text.
  7894.    -- EI - This is the error indicator.  Its numeric value represents
  7895.    --    the type of error, if any, that occured.
  7896.    -- CONCATENATION_POINT - This is a record with X and Y components
  7897.    --    indicating the point in world coordinates that can be used
  7898.    --    as the origin of a subsequent text output primitive (as in
  7899.    --    the concatenation of strings).
  7900.    -- TEXT_EXTENT - This is a record with four components indicating
  7901.    --    the LOWER_LEFT, LOWER_RIGHT, UPPER_LEFT, and UPPER_RIGHT
  7902.    --    corner points of the text extent rectangle with respect to the
  7903.    --    vertical positioning of the text.  Each component is a
  7904.    --    record with X and Y components to indicate the point in
  7905.    --    world coordinates.
  7906.      
  7907.    GKS_INSTR : CGI_INQ_TEXT_EXTENT;
  7908.      
  7909.    begin
  7910.      
  7911.       -- The following if structure inquires the GKS_OPERATING_
  7912.       -- STATE_LIST to see if GKS is in the proper state.  Then
  7913.       -- if so, it inquires the GKS_STATE_LIST to see if the WS is
  7914.       -- in the set of open workstations before proceeding with the
  7915.       -- inquiry call to the WS_MANAGER.
  7916.      
  7917.       if (CURRENT_OPERATING_STATE = GKCL) or
  7918.          (CURRENT_OPERATING_STATE = GKOP) then
  7919.          EI := NOT_WSOP_WSAC_SGOP;            -- Error 7
  7920.          CONCATENATION_POINT := (0.0,0.0);
  7921.          TEXT_EXTENT := (LOWER_LEFT => (0.0,0.0),
  7922.                          LOWER_RIGHT => (0.0,0.0),
  7923.                          UPPER_LEFT => (0.0,0.0),
  7924.                          UPPER_RIGHT => (0.0,0.0));
  7925.      
  7926.       elsif not WS_IDS.IS_IN_LIST (WS,
  7927.             GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  7928.          EI := WS_NOT_OPEN;                   -- Error 25
  7929.          CONCATENATION_POINT := (0.0,0.0);
  7930.          TEXT_EXTENT := (LOWER_LEFT => (0.0,0.0),
  7931.                          LOWER_RIGHT => (0.0,0.0),
  7932.                          UPPER_LEFT => (0.0,0.0),
  7933.                          UPPER_RIGHT => (0.0,0.0));
  7934.      
  7935.       else
  7936.          GKS_INSTR.WS_TO_INQ_TEXT_EXTENT := WS;
  7937.      
  7938.          -- Transformation logic for WC to NDC
  7939.          GKS_INSTR.POSITION_TEXT := TRANSFORMATION_MATH.WC_TO_NDC
  7940.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7941.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  7942.             .NDC_FACTORS, POSITION);
  7943.      
  7944.          GKS_INSTR.CHAR_STRING := new STRING'(CHAR_STRING);
  7945.      
  7946.          WS_MANAGER (GKS_INSTR);
  7947.      
  7948.          FREE_STRING (GKS_INSTR.CHAR_STRING);
  7949.      
  7950.          if GKS_INSTR.EI /= SUCCESSFUL then             -- Error 0
  7951.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then  -- Error 39
  7952.                EI := GKS_INSTR.EI;
  7953.             else
  7954.                EI := UNKNOWN;                           -- Error 2501
  7955.             end if;
  7956.          else
  7957.             EI := GKS_INSTR.EI;                         -- Error 0
  7958.          end if;
  7959.      
  7960.          CONCATENATION_POINT := TRANSFORMATION_MATH.NDC_TO_WC
  7961.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7962.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  7963.             .WC_FACTORS, GKS_INSTR.CONCATENATION_POINT);
  7964.      
  7965.          TEXT_EXTENT.LOWER_LEFT := TRANSFORMATION_MATH.NDC_TO_WC
  7966.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7967.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  7968.             .WC_FACTORS, GKS_INSTR.TEXT_EXTENT_LOWER_LEFT_INQ);
  7969.      
  7970.          TEXT_EXTENT.LOWER_RIGHT := TRANSFORMATION_MATH.NDC_TO_WC
  7971.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7972.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  7973.             .WC_FACTORS, GKS_INSTR.TEXT_EXTENT_LOWER_RIGHT_INQ);
  7974.      
  7975.          TEXT_EXTENT.UPPER_LEFT := TRANSFORMATION_MATH.NDC_TO_WC
  7976.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7977.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  7978.             .WC_FACTORS, GKS_INSTR.TEXT_EXTENT_UPPER_LEFT_INQ);
  7979.      
  7980.          TEXT_EXTENT.UPPER_RIGHT := TRANSFORMATION_MATH.NDC_TO_WC
  7981.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  7982.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  7983.             .WC_FACTORS, GKS_INSTR.TEXT_EXTENT_UPPER_RIGHT_INQ);
  7984.      
  7985.       end if;
  7986.      
  7987.       exception
  7988.          when NUMERIC_ERROR =>
  7989.             EI := ARITHMETIC;                            -- Error 308
  7990.             CONCATENATION_POINT := (0.0,0.0);
  7991.             TEXT_EXTENT := (LOWER_LEFT => (0.0,0.0),
  7992.                            LOWER_RIGHT => (0.0,0.0),
  7993.                            UPPER_LEFT  => (0.0,0.0),
  7994.                            UPPER_RIGHT => (0.0,0.0));
  7995.      
  7996.    end INQ_TEXT_EXTENT;
  7997.      
  7998.    procedure INQ_LIST_OF_COLOUR_INDICES
  7999.       (WS     : in WS_ID;
  8000.       EI      : out ERROR_INDICATOR;
  8001.       INDICES : out COLOUR_INDICES.LIST_OF) is
  8002.      
  8003.    -- This procedure calls the workstation manager to obtain the
  8004.    -- list of defined fill area indices for a particular workstation.
  8005.    -- If the inquired information is available, the error indicator is
  8006.    -- returned by the workstation manager as 0.  If the inquired infor-
  8007.    -- mation is not available, the workstation manager returns the
  8008.    -- error indicator as 33, 35, or 36 to indicate the reason for
  8009.    -- non-availability.
  8010.    --
  8011.    -- WS - This is an integer value indicating the workstation
  8012.    --    identification.
  8013.    -- EI - This is the error indicator.  Its numeric value represents
  8014.    --    the type of error, if any, that occurred.
  8015.    -- INDICES - This is a set type of colour indices.
  8016.      
  8017.    GKS_INSTR : CGI_INQ_LIST_OF_COLOUR_INDICES;
  8018.      
  8019.    begin
  8020.      
  8021.       -- The following if structure inquires the GKS_OPERATING_
  8022.       -- STATE_LIST to see if GKS is in the proper state.  Then
  8023.       -- if so, it inquires the GKS_STATE_LIST to see if the WS is
  8024.       -- in the set of open workstations before proceeding with the
  8025.       -- inquiry call to the WS_MANAGER.
  8026.      
  8027.       if (CURRENT_OPERATING_STATE = GKCL) or
  8028.          (CURRENT_OPERATING_STATE = GKOP) then
  8029.          EI := NOT_WSOP_WSAC_SGOP;                  -- Error 7
  8030.          INDICES := COLOUR_INDICES.NULL_LIST;
  8031.      
  8032.       elsif not WS_IDS.IS_IN_LIST(WS,
  8033.             GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  8034.          EI := WS_NOT_OPEN;                         -- Error 25
  8035.          INDICES := COLOUR_INDICES.NULL_LIST;
  8036.      
  8037.       else
  8038.          GKS_INSTR.WS_TO_INQ_COLOUR_INDICES := WS;
  8039.          WS_MANAGER (GKS_INSTR);
  8040.      
  8041.             if GKS_INSTR.EI /= SUCCESSFUL then
  8042.                if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  8043.                   (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) or   -- Error 35
  8044.                   (GKS_INSTR.EI = WS_IS_WISS) then           -- Error 36
  8045.                   EI := GKS_INSTR.EI;
  8046.                else
  8047.                   EI := UNKNOWN;                             -- Error 2501
  8048.                end if;
  8049.             else
  8050.                EI := GKS_INSTR.EI;                           -- Error 0
  8051.             end if;
  8052.      
  8053.          INDICES := GKS_INSTR.LIST_OF_COLOUR_INDICES_INQ;
  8054.      
  8055.       end if;
  8056.      
  8057.    end INQ_LIST_OF_COLOUR_INDICES;
  8058.      
  8059.    procedure INQ_COLOUR_REPRESENTATION
  8060.       (WS             : in WS_ID;
  8061.       INDEX           : in COLOUR_INDEX;
  8062.       RETURNED_VALUES : in RETURN_VALUE_TYPE;
  8063.       EI              : out ERROR_INDICATOR;
  8064.       COLOUR          : out COLOUR_REPRESENTATION) is
  8065.      
  8066.    -- This procedure calls the workstation manager to obtain the
  8067.    -- value for the colour intensities for a colour index on a
  8068.    -- workstation.  If the inquired information is available, the
  8069.    -- error indicator is returned by the workstation manager as 0.
  8070.    -- If the inquired information is not available, the error
  8071.    -- indicator is returned by the workstation manager as 33, 35,
  8072.    -- 36, 93 or 94 to indicate the reason for non-availability.
  8073.    --
  8074.    -- WS - This is an integer value indicating the workstation
  8075.    --    identification.
  8076.    -- INDEX - This is an integer value indicating the colour index
  8077.    --    into the colour table.
  8078.    -- RETURNED_VALUES - This is an enumerated parameter which may have
  8079.    --    a value of SET or REALIZED to indicate whether the returned
  8080.    --    values should be as they were set by the program or as they
  8081.    --    were actually realized.
  8082.    -- EI - This is the error indicator.  Its numeric value represents
  8083.    --    the type of error, if any, that occurred.
  8084.    -- COLOUR - This is a record with components RED, GREEN, and BLUE
  8085.    --    that represent the colour as a combination of intensities.
  8086.      
  8087.    GKS_INSTR : CGI_INQ_COLOUR_REPRESENTATION;
  8088.      
  8089.    begin
  8090.      
  8091.       -- The following if structure inquires the GKS_OPERATING_
  8092.       -- STATE_LIST to see if GKS is in the proper state.  Then
  8093.       -- if so, it inquires the GKS_STATE_LIST to see if the WS is
  8094.       -- in the set of open workstations before proceeding with the
  8095.       -- inquiry call to the WS_MANAGER.
  8096.      
  8097.       if (CURRENT_OPERATING_STATE = GKCL) or
  8098.          (CURRENT_OPERATING_STATE = GKOP) then
  8099.          EI := NOT_WSOP_WSAC_SGOP;               -- Error 7
  8100.          COLOUR := (RED => INTENSITY'FIRST,
  8101.                     GREEN => INTENSITY'FIRST,
  8102.                     BLUE => INTENSITY'FIRST);
  8103.      
  8104.       elsif not WS_IDS.IS_IN_LIST (WS,
  8105.             GKS_STATE_LIST.LIST_OF_OPEN_WS)  then
  8106.          EI := WS_NOT_OPEN;                      -- Error 25
  8107.          COLOUR := (RED => INTENSITY'FIRST,
  8108.                     GREEN => INTENSITY'FIRST,
  8109.                     BLUE => INTENSITY'FIRST);
  8110.      
  8111.       else
  8112.          GKS_INSTR.WS_TO_INQ_COLOUR_REP := WS;
  8113.          GKS_INSTR.COLOUR_INDEX_TO_INQ_COLOUR_REP := INDEX;
  8114.          GKS_INSTR.RETURN_VALUE_TO_INQ_COLOUR_REP := RETURNED_VALUES;
  8115.          WS_MANAGER (GKS_INSTR);
  8116.      
  8117.          if GKS_INSTR.EI /= SUCCESSFUL then               -- Error 0
  8118.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  8119.                (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) or   -- Error 35
  8120.                (GKS_INSTR.EI = WS_IS_WISS) or             -- Error 36
  8121.                (GKS_INSTR.EI = INVALID_COLOUR_INDEX) or   -- Error 93
  8122.                (GKS_INSTR.EI = NO_COLOUR_REP) then        -- Error 94
  8123.                EI := GKS_INSTR.EI;
  8124.             else
  8125.                EI := UNKNOWN;                             -- Error 2501
  8126.             end if;
  8127.      
  8128.          else
  8129.             EI := GKS_INSTR.EI;                           -- Error 0
  8130.          end if;
  8131.      
  8132.          COLOUR := GKS_INSTR.COLOUR_REP_INQ;
  8133.      
  8134.       end if;
  8135.      
  8136.      
  8137.    end INQ_COLOUR_REPRESENTATION;
  8138.      
  8139.    procedure INQ_WS_TRANSFORMATION
  8140.       (WS                : in WS_ID;
  8141.       EI                 : out ERROR_INDICATOR;
  8142.       UPDATE             : out UPDATE_STATE;
  8143.       REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  8144.       CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  8145.       REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  8146.       CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS) is
  8147.      
  8148.    -- This procedure calls the workstation manager to obtain the
  8149.    -- following workstation transformation information:
  8150.    --  1) the workstation transformation update state
  8151.    --  2) the requested workstation window
  8152.    --  3) the current workstation window
  8153.    --  4) the requested workstation viewport
  8154.    --  5) the current workstation viewport.
  8155.    -- If the inquired information is available, the error indicator
  8156.    -- is returned by the workstation manager as 0.  If the inquired
  8157.    -- information is not available, the error indicator is returned by
  8158.    -- the workstation manager as 33, or 36 to indicate the reason
  8159.    -- for non-availability.
  8160.    --
  8161.    -- WS - This is an integer value indicating the workstation
  8162.    --    identification.
  8163.    -- EI - This is the error indicator.  Its numeric value represents
  8164.    --    the type of error, if any, that occurred.
  8165.    -- UPDATE - This enumerated parameter may have the value NOTPENDING,
  8166.    --    or PENDING to indicate whether or not a workstation transforma-
  8167.    --    tion change has been requested and not yet provided.
  8168.    -- REQUESTED_WINDOW - This record defines the extent of the
  8169.    --    requested window (this is the window "set" by SET_WS_WINDOW)
  8170.    --    in normalized device coordinates.  Its X and Y components give
  8171.    --    the limits in relation to the x and y axes.
  8172.    -- CURRENT_WINDOW  - This record defines the extent of the current
  8173.    --    window in normalized device coordinates.  Its X and Y com-
  8174.    --    ponents give the limits in relation to the x and y axes.
  8175.    -- REQUESTED_VIEWPORT - This record defines the extent of the
  8176.    --    requested viewport (this is the viewport "set" by SET_WS_
  8177.    --    VIEWPORT) in device coordinates.  Its X and Y components
  8178.    --    give the limits in relation to the x and y axes.
  8179.    -- CURRENT_VIEWPORT - This record defines the extent of the current
  8180.    --    viewport in device coordinates.  Its X and Y components give
  8181.    --    limits in relation to the x and y axes.
  8182.      
  8183.    GKS_INSTR : CGI_INQ_WS_TRANSFORMATION;
  8184.      
  8185.    begin
  8186.      
  8187.       -- The following if structure inquires the GKS_OPERATING_
  8188.       -- STATE_LIST to see if GKS is in the proper state.  Then
  8189.       -- if so, it inquires the GKS_STATE_LIST to see if the WS is
  8190.       -- in the set of open workstations before proceeding with the
  8191.       -- inquiry call to the WS_MANAGER.
  8192.      
  8193.       if (CURRENT_OPERATING_STATE = GKCL) or
  8194.          (CURRENT_OPERATING_STATE = GKOP) then
  8195.          EI := NOT_WSOP_WSAC_SGOP;            -- Error 7
  8196.          REQUESTED_WINDOW := (XMIN => 0.0,
  8197.                               XMAX => 0.0,
  8198.                               YMIN => 0.0,
  8199.                               YMAX => 0.0);
  8200.          CURRENT_WINDOW := (XMIN => 0.0,
  8201.                             XMAX => 0.0,
  8202.                             YMIN => 0.0,
  8203.                             YMAX => 0.0);
  8204.          REQUESTED_VIEWPORT := (XMIN => 0.0,
  8205.                                 XMAX => 0.0,
  8206.                                 YMIN => 0.0,
  8207.                                 YMAX => 0.0);
  8208.          CURRENT_VIEWPORT := (XMIN => 0.0,
  8209.                               XMAX => 0.0,
  8210.                               YMIN => 0.0,
  8211.                               YMAX => 0.0);
  8212.      
  8213.       elsif not WS_IDS.IS_IN_LIST (WS,
  8214.             GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  8215.          EI := WS_NOT_OPEN;                   -- Error 25
  8216.          REQUESTED_WINDOW := (XMIN => 0.0,
  8217.                               XMAX => 0.0,
  8218.                               YMIN => 0.0,
  8219.                               YMAX => 0.0);
  8220.          CURRENT_WINDOW := (XMIN => 0.0,
  8221.                             XMAX => 0.0,
  8222.                             YMIN => 0.0,
  8223.                             YMAX => 0.0);
  8224.          REQUESTED_VIEWPORT := (XMIN => 0.0,
  8225.                                 XMAX => 0.0,
  8226.                                 YMIN => 0.0,
  8227.                                 YMAX => 0.0);
  8228.          CURRENT_VIEWPORT := (XMIN => 0.0,
  8229.                               XMAX => 0.0,
  8230.                               YMIN => 0.0,
  8231.                               YMAX => 0.0);
  8232.      
  8233.       else
  8234.          GKS_INSTR.WS_TO_INQ_TRANSFORMATION := WS;
  8235.          WS_MANAGER (GKS_INSTR);
  8236.      
  8237.          if GKS_INSTR.EI /= SUCCESSFUL then            -- Error 0
  8238.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or   -- Error 33
  8239.                (GKS_INSTR.EI = WS_IS_WISS) then        -- Error 36
  8240.                EI := GKS_INSTR.EI;
  8241.             else
  8242.                EI := UNKNOWN;                          -- Error 2501
  8243.             end if;
  8244.      
  8245.          else
  8246.             EI := GKS_INSTR.EI;                         -- Error 0
  8247.          end if;
  8248.      
  8249.          UPDATE             := GKS_INSTR.UPDATE_INQ;
  8250.          REQUESTED_WINDOW   := GKS_INSTR.REQUESTED_WINDOW_INQ;
  8251.          CURRENT_WINDOW     := GKS_INSTR.CURRENT_WINDOW_INQ;
  8252.          REQUESTED_VIEWPORT := GKS_INSTR.REQUESTED_VIEWPORT_INQ;
  8253.          CURRENT_VIEWPORT   := GKS_INSTR.CURRENT_VIEWPORT_INQ;
  8254.      
  8255.       end if;
  8256.      
  8257.      
  8258.    end INQ_WS_TRANSFORMATION;
  8259.      
  8260. end INQ_WS_STATE_LIST_MA;
  8261. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8262. --:UDD:GKSADACM:CODE:MA:INQ_WS_DSCR_TBL_MA_B.ADA
  8263. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8264. ------------------------------------------------------------------
  8265. --
  8266. --  NAME: INQ_WS_DESCRIPTION_TABLE
  8267. --  IDENTIFIER: GIMXXX.1(1)
  8268. --  DISCREPANCY REPORTS:
  8269. --
  8270. ------------------------------------------------------------------
  8271. -- file:  inq_ws_dscr_tbl_ma_b.ada
  8272. -- level: all levels
  8273.      
  8274. with WSM;
  8275. with CGI;
  8276. with GKS_OPERATING_STATE_LIST;
  8277. with GKS_STATE_LIST;
  8278. with GKS_ERRORS;
  8279. with GKS_DESCRIPTION_TABLE;
  8280.      
  8281. use WSM;
  8282. use CGI;
  8283. use GKS_OPERATING_STATE_LIST;
  8284. use GKS_ERRORS;
  8285.      
  8286. package body INQ_WS_DESCRIPTION_TABLE_MA is
  8287.      
  8288. -- This is the package body for the procedures for calling the work-
  8289. -- station manager to inquire the workstation description tables.
  8290. --
  8291. -- Each of the procedures in this package inquires the
  8292. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of the
  8293. -- states GKOP, WSOP, WSAC, or SGOP.  If it is not, error
  8294. -- indicator 8 occurs but no exception is raised.
  8295.      
  8296.    procedure INQ_DISPLAY_SPACE_SIZE
  8297.       (WS                  : in WS_TYPE;
  8298.       EI                   : out ERROR_INDICATOR;
  8299.       UNITS                : out DC_UNITS;
  8300.       MAX_DC_SIZE          : out DC.SIZE;
  8301.       MAX_RASTER_UNIT_SIZE : out RASTER_UNIT_SIZE) is
  8302.      
  8303.    -- This procedure calls the workstation manager to obtain the value
  8304.    -- of the maximum display surface size in device coordinate units
  8305.    -- and what units the device coordinate units are (metres or others),
  8306.    -- and the maximum display surface size in  raster units.  If the
  8307.    -- inquired information is available, the error indicator is returned
  8308.    -- by the workstation manager as 0.  If the inquired information is
  8309.    -- not available, the workstation manager returns the error indicator
  8310.    -- as 31, 33, or 36 to indicate the reason for non-availability.
  8311.    --
  8312.    -- WS - This is an integer value indicating the workstation
  8313.    --    identification.
  8314.    -- EI - This is the error indicator.  Its numeric value represents
  8315.    --    the type of error, if any, that occurred.
  8316.    -- UNITS - This is an enumerated parameter which indicates if the
  8317.    --    device coordinate units for the WS are in METRES or OTHER.
  8318.    -- MAX_DC_SIZE - This record gives the maximum device coordinate
  8319.    --    magnitude as length along the X and Y axes (which are the
  8320.    --    components of the record).
  8321.    -- MAX_RASTER_UNIT_SIZE - This record provides the raster unit
  8322.    --    size in terms of the raster units along the X and Y axes.
  8323.    --    X and Y are the components of the record.
  8324.      
  8325.    GKS_INSTR : CGI_INQ_DISPLAY_SPACE_SIZE;
  8326.      
  8327.    begin
  8328.      
  8329.       -- The following if structure inquires the GKS_OPERATING
  8330.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  8331.       -- it checks to see if the WS exists by checking if it is
  8332.       -- in the list of available WS types in the GKS_DESCRIPTION_
  8333.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  8334.       -- called for the inquiry.
  8335.      
  8336.       if CURRENT_OPERATING_STATE = GKCL then
  8337.          EI := NOT_GKOP_WSOP_WSAC_SGOP;                -- Error 8
  8338.          UNITS := DC_UNITS'FIRST;
  8339.          MAX_DC_SIZE := (XAXIS => 1.0,
  8340.                          YAXIS => 1.0);
  8341.          MAX_RASTER_UNIT_SIZE := (X => RASTER_UNITS'FIRST,
  8342.                                   Y => RASTER_UNITS'FIRST);
  8343.      
  8344.       elsif not WS_TYPES.IS_IN_LIST (WS,GKS_DESCRIPTION_TABLE.
  8345.                                 LIST_OF_AVAILABLE_WS_TYPES) then
  8346.          EI := WS_TYPE_DOES_NOT_EXIST;                 -- Error 23
  8347.          UNITS := DC_UNITS'FIRST;
  8348.          MAX_DC_SIZE := (XAXIS => 1.0,
  8349.                          YAXIS => 1.0);
  8350.          MAX_RASTER_UNIT_SIZE := (X => RASTER_UNITS'FIRST,
  8351.                                   Y => RASTER_UNITS'FIRST);
  8352.      
  8353.       else
  8354.          -- Call to WS_MANAGER with the inquiry parameter.
  8355.          GKS_INSTR.WS_TO_INQ_DISPLAY_SPACE_SIZE := WS;
  8356.          WS_MANAGER (GKS_INSTR);
  8357.      
  8358.          if GKS_INSTR.EI /= SUCCESSFUL then            -- Error 0
  8359.      
  8360.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MO) or   -- Error 31
  8361.                (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or   -- Error 33
  8362.                (GKS_INSTR.EI = WS_IS_WISS) then        -- Error 36
  8363.                EI := GKS_INSTR.EI;
  8364.             else
  8365.                EI := UNKNOWN;                          -- Error 2501
  8366.             end if;
  8367.      
  8368.          else
  8369.             EI := GKS_INSTR.EI;                        -- Error 0
  8370.          end if;
  8371.      
  8372.          UNITS := GKS_INSTR.DISPLAY_SPACE_UNITS_INQ;
  8373.          MAX_DC_SIZE := GKS_INSTR.MAX_DC_SIZE_INQ;
  8374.          MAX_RASTER_UNIT_SIZE := GKS_INSTR.MAX_RASTER_UNIT_SIZE_INQ;
  8375.      
  8376.       end if;
  8377.      
  8378.    end INQ_DISPLAY_SPACE_SIZE;
  8379.      
  8380.    procedure INQ_POLYLINE_FACILITIES
  8381.       (WS               : in WS_TYPE;
  8382.       EI                : out ERROR_INDICATOR;
  8383.       LIST_OF_TYPES     : out LINETYPES.LIST_OF;
  8384.       NUMBER_OF_WIDTHS  : out NATURAL;
  8385.       NOMINAL_WIDTH     : out DC.MAGNITUDE;
  8386.       RANGE_OF_WIDTHS   : out DC.RANGE_OF_MAGNITUDES;
  8387.       NUMBER_OF_INDICES : out NATURAL) is
  8388.      
  8389.    -- This procedure calls the workstation manager to obtain the values
  8390.    -- of the facilities for polyline.  These include:
  8391.    --  1) the number of available linetypes
  8392.    --  2) the list of available linetypes
  8393.    --  3) the number of available linewidths
  8394.    --  4) the nominal linewidth
  8395.    --  5) the range of linewidths (minimum, maximum)
  8396.    --  6) the number of predefined polyline indices.
  8397.    -- If the inquired information is available, the error indicator is
  8398.    -- returned by the workstation manager as 0.  If the inquired infor-
  8399.    -- mation is not available, the workstation manager returns the error
  8400.    -- indicator as 39 to indicate the reason for non-availability.
  8401.    --
  8402.    -- WS - This is an integer value indicating the workstation
  8403.    --    identification.
  8404.    -- EI - This is the error indicator.  Its numeric value represents
  8405.    --    the type of error, if any, that occurred.
  8406.    -- LIST_OF_TYPES - This is a list type of LINETYPES.
  8407.    -- NUMBER_OF_WIDTHS - This is a natural number representing the
  8408.    --    number of line widths.
  8409.    -- NOMINAL_WIDTH - Indicates the nominal magnitude of the line
  8410.    --    in device coordinates.
  8411.    -- RANGE_OF_WIDTHS - This record type gives the MIN and MAX width
  8412.    --    limits for polylines.
  8413.    -- NUMBER_OF_INDICES - This is a natural number representing the
  8414.    --    number of indices.
  8415.      
  8416.    GKS_INSTR : CGI_INQ_POLYLINE_FACILITIES;
  8417.      
  8418.    begin
  8419.      
  8420.       -- The following if structure inquires the GKS_OPERATING
  8421.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  8422.       -- it checks to see if the WS exists by checking if it is
  8423.       -- in the list of available WS types in the GKS_DESCRIPTION_
  8424.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  8425.       -- called for the inquiry.
  8426.      
  8427.       if CURRENT_OPERATING_STATE = GKCL then
  8428.      
  8429.          EI := NOT_GKOP_WSOP_WSAC_SGOP;          -- Error 8
  8430.          LIST_OF_TYPES := LINETYPES.NULL_LIST;
  8431.          NUMBER_OF_WIDTHS := NATURAL'FIRST;
  8432.          NOMINAL_WIDTH := 1.0;
  8433.          RANGE_OF_WIDTHS := (MIN => 1.0,
  8434.                              MAX => 1.0);
  8435.          NUMBER_OF_INDICES := NATURAL'FIRST;
  8436.      
  8437.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  8438.                                LIST_OF_AVAILABLE_WS_TYPES) then
  8439.      
  8440.          EI := WS_TYPE_DOES_NOT_EXIST;           -- Error 23
  8441.          LIST_OF_TYPES := LINETYPES.NULL_LIST;
  8442.          NUMBER_OF_WIDTHS := NATURAL'FIRST;
  8443.          NOMINAL_WIDTH := 1.0;
  8444.          RANGE_OF_WIDTHS := (MIN => 1.0,
  8445.                              MAX => 1.0);
  8446.          NUMBER_OF_INDICES := NATURAL'FIRST;
  8447.      
  8448.       else
  8449.      
  8450.          GKS_INSTR.WS_TO_INQ_POLYLINE_FACILITIES := WS;
  8451.      
  8452.          -- The inquiry call is made to the workstation manager
  8453.          -- for the appropriate workstation.
  8454.      
  8455.          WS_MANAGER (GKS_INSTR);
  8456.      
  8457.          if (GKS_INSTR.EI /= SUCCESSFUL) then              -- Error 0
  8458.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) then   -- Error 39
  8459.                EI := GKS_INSTR.EI;
  8460.             else
  8461.                EI := UNKNOWN;                              -- Error 2501
  8462.             end if;
  8463.      
  8464.          else
  8465.             EI := GKS_INSTR.EI;                            -- Error 0
  8466.          end if;
  8467.      
  8468.          LIST_OF_TYPES     := GKS_INSTR.LIST_OF_POLYLINE_TYPES_INQ;
  8469.          NUMBER_OF_WIDTHS  := GKS_INSTR.NUMBER_OF_WIDTHS_INQ;
  8470.          NOMINAL_WIDTH     := GKS_INSTR.NOMINAL_WIDTH_INQ;
  8471.          RANGE_OF_WIDTHS   := GKS_INSTR.RANGE_OF_WIDTHS_INQ;
  8472.          NUMBER_OF_INDICES := GKS_INSTR.
  8473.                               NUMBER_OF_POLYLINE_INDICES_INQ;
  8474.      
  8475.       end if;
  8476.      
  8477.    end INQ_POLYLINE_FACILITIES;
  8478.      
  8479.    procedure INQ_POLYMARKER_FACILITIES
  8480.       (WS               : in WS_TYPE;
  8481.       EI                : out ERROR_INDICATOR;
  8482.       LIST_OF_TYPES     : out MARKER_TYPES.LIST_OF;
  8483.       NUMBER_OF_SIZES   : out NATURAL;
  8484.       NOMINAL_SIZE      : out DC.MAGNITUDE;
  8485.       RANGE_OF_SIZES    : out DC.RANGE_OF_MAGNITUDES;
  8486.       NUMBER_OF_INDICES : out NATURAL) is
  8487.      
  8488.    -- This procedure calls the workstation manager to obtain the values
  8489.    -- of the facilities for polymarker.  These include:
  8490.    --  1) the number of available marker types
  8491.    --  2) the list of available marker types
  8492.    --  3) the number of available marker sizes
  8493.    --  4) the nominal marker size
  8494.    --  5) the range of marker sizes (minimum, maximum)
  8495.    --  6) the number of predefined polymarker indices.
  8496.    -- If the inquired information is available, the error indicator is
  8497.    -- returned by the workstation manager as 0.  If the inquired infor-
  8498.    -- mation is not available, the workstation manager returns the error
  8499.    -- indicator as 39 to indicate the reason for non-availability.
  8500.    --
  8501.    -- WS - This is an integer value indicating the workstation
  8502.    --    identification.
  8503.    -- EI - This is the error indicator.  Its numeric value represents
  8504.    --    the type of error, if any, that occurred.
  8505.    -- LIST_OF_TYPES - This is a set type of MARKER_TYPES.
  8506.    -- NUMBER_OF_SIZES - This is a natural number representing the
  8507.    --    number of marker sizes.
  8508.    -- NOMINAL_SIZE - Indicates the nominal magnitude of the marker
  8509.    --    in device coordinates.
  8510.    -- RANGE_OF_SIZES - This record type gives the MIN and MAX size
  8511.    --    limits for polymarkers.
  8512.    -- NUMBER_OF_INDICES - This is a natural number representing the
  8513.    --    number of indices.
  8514.      
  8515.    GKS_INSTR : CGI_INQ_POLYMARKER_FACILITIES;
  8516.      
  8517.    begin
  8518.      
  8519.       -- The following if structure inquires the GKS_OPERATING
  8520.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  8521.       -- it checks to see if the WS exists by checking if it is
  8522.       -- in the list of available WS types in the GKS_DESCRIPTION_
  8523.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  8524.       -- called for the inquiry.
  8525.      
  8526.       if CURRENT_OPERATING_STATE = GKCL then
  8527.      
  8528.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  8529.          LIST_OF_TYPES := MARKER_TYPES.NULL_LIST;
  8530.          NUMBER_OF_SIZES := NATURAL'FIRST;
  8531.          NOMINAL_SIZE := 1.0;
  8532.          RANGE_OF_SIZES := (MIN => 1.0,
  8533.                             MAX => 1.0);
  8534.          NUMBER_OF_INDICES := NATURAL'FIRST;
  8535.      
  8536.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  8537.                                LIST_OF_AVAILABLE_WS_TYPES) then
  8538.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  8539.          LIST_OF_TYPES := MARKER_TYPES.NULL_LIST;
  8540.          NUMBER_OF_SIZES := NATURAL'FIRST;
  8541.          NOMINAL_SIZE := 1.0;
  8542.          RANGE_OF_SIZES := (MIN => 1.0,
  8543.                             MAX => 1.0);
  8544.          NUMBER_OF_INDICES := NATURAL'FIRST;
  8545.      
  8546.       else
  8547.      
  8548.          GKS_INSTR.WS_TO_INQ_POLYMARKER_FACILITIES := WS;
  8549.          WS_MANAGER (GKS_INSTR);
  8550.      
  8551.          if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  8552.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then   -- Error 39
  8553.                EI := GKS_INSTR.EI;
  8554.             else
  8555.                EI := UNKNOWN;                            -- Error 2501
  8556.             end if;
  8557.      
  8558.          else
  8559.             EI := GKS_INSTR.EI;                          -- Error 0
  8560.          end if;
  8561.      
  8562.          LIST_OF_TYPES     := GKS_INSTR.LIST_OF_POLYMARKER_TYPES_INQ;
  8563.          NUMBER_OF_SIZES   := GKS_INSTR.NUMBER_OF_SIZES_INQ;
  8564.          NOMINAL_SIZE      := GKS_INSTR.NOMINAL_SIZE_INQ;
  8565.          RANGE_OF_SIZES    := GKS_INSTR.RANGE_OF_SIZES_INQ;
  8566.          NUMBER_OF_INDICES := GKS_INSTR.
  8567.                               NUMBER_OF_POLYMARKER_INDICES_INQ;
  8568.      
  8569.       end if;
  8570.      
  8571.    end INQ_POLYMARKER_FACILITIES;
  8572.      
  8573.    procedure INQ_TEXT_FACILITIES
  8574.       (WS                  : in WS_TYPE;
  8575.       EI                   : out ERROR_INDICATOR;
  8576.       LIST_OF_FONT_PRECISION_PAIRS: out TEXT_FONT_PRECISIONS.LIST_OF;
  8577.       NUMBER_OF_HEIGHTS    : out NATURAL;
  8578.       RANGE_OF_HEIGHTS     : out DC.RANGE_OF_MAGNITUDES;
  8579.       NUMBER_OF_EXPANSIONS : out NATURAL;
  8580.       EXPANSION_RANGE      : out RANGE_OF_EXPANSIONS;
  8581.       NUMBER_OF_INDICES    : out NATURAL) is
  8582.      
  8583.    -- This procedure calls the workstation manager to obtain the values
  8584.    -- of the facilities for text.  These include:
  8585.    --  1) the number of text font and precision pairs
  8586.    --  2) the list of text font and precision pairs
  8587.    --  3) the number of available character heights
  8588.    --  4) the minimum character height
  8589.    --  5) the maximum character height
  8590.    --  6) the number of available character expansion factors
  8591.    --  7) the minimum character expansion factor
  8592.    --  8) the maximum character expansion factor
  8593.    --  9) the number of predefined text indices.
  8594.    -- If the inquired information is available, the error indicator is
  8595.    -- returned by the workstation manager as 0.  If the inquired infor-
  8596.    -- mation is not available, the workstation manager returns the
  8597.    -- error indication as 39 to indicate the reason for non-
  8598.    -- availability.
  8599.    --
  8600.    -- WS - This is an integer value indicating the workstation
  8601.    --    identification.
  8602.    -- EI - This is the error indicator.  Its numeric value represents
  8603.    --    the type of error, if any, that occurred.
  8604.    -- LIST_OF_FONT_PRECISION_PAIRS - This is a record containing a list
  8605.    --    of records which provides the text FONT and PRECISION.
  8606.    -- NUMBER_OF_HEIGHTS - This is a natural number representing the
  8607.    --    number of text character heights.
  8608.    -- RANGE_OF_HEIGHTS - This record type gives the MIN and MAX
  8609.    --    value for the character heights in device coordinates.
  8610.    -- NUMBER_OF_EXPANSIONS - This is a natural number representing the
  8611.    --    number of expansions factors available.
  8612.    -- EXPANSION_RANGE - This record type gives the MIN and MAX
  8613.    --    values for the character expansion factors in device coordi-
  8614.    --    nates.
  8615.    -- NUMBER_OF_INDICES - This is a natural number representing the
  8616.    --    number of indices.
  8617.      
  8618.    GKS_INSTR : CGI_INQ_TEXT_FACILITIES;
  8619.      
  8620.    begin
  8621.      
  8622.       -- The following if structure inquires the GKS_OPERATING
  8623.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  8624.       -- it checks to see if the WS exists by checking if it is
  8625.       -- in the list of available WS types in the GKS_DESCRIPTION_
  8626.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  8627.       -- called for the inquiry.
  8628.      
  8629.       if CURRENT_OPERATING_STATE = GKCL then
  8630.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  8631.          LIST_OF_FONT_PRECISION_PAIRS := TEXT_FONT_PRECISIONS.
  8632.                                          NULL_LIST;
  8633.          NUMBER_OF_HEIGHTS := NATURAL'FIRST;
  8634.          RANGE_OF_HEIGHTS := (MIN => 1.0,
  8635.                               MAX => 1.0);
  8636.          NUMBER_OF_EXPANSIONS := NATURAL'FIRST;
  8637.          EXPANSION_RANGE := (MIN => 1.0,
  8638.                              MAX => 1.0);
  8639.          NUMBER_OF_INDICES := NATURAL'FIRST;
  8640.      
  8641.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  8642.                                LIST_OF_AVAILABLE_WS_TYPES) then
  8643.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  8644.          LIST_OF_FONT_PRECISION_PAIRS := TEXT_FONT_PRECISIONS.
  8645.                                          NULL_LIST;
  8646.          NUMBER_OF_HEIGHTS := NATURAL'FIRST;
  8647.          RANGE_OF_HEIGHTS := (MIN => 1.0,
  8648.                               MAX => 1.0);
  8649.          NUMBER_OF_EXPANSIONS := NATURAL'FIRST;
  8650.          EXPANSION_RANGE := (MIN => 1.0,
  8651.                              MAX => 1.0);
  8652.          NUMBER_OF_INDICES := NATURAL'FIRST;
  8653.      
  8654.       else
  8655.          GKS_INSTR.WS_TO_INQ_TEXT_FACILITIES := WS;
  8656.          WS_MANAGER (GKS_INSTR);
  8657.      
  8658.          if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  8659.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then   -- Error 39
  8660.                EI := GKS_INSTR.EI;
  8661.             else
  8662.                EI := UNKNOWN;                            -- Error 2501
  8663.             end if;
  8664.      
  8665.          else
  8666.             EI := GKS_INSTR.EI;                          -- Error 0
  8667.          end if;
  8668.      
  8669.          LIST_OF_FONT_PRECISION_PAIRS := GKS_INSTR.
  8670.                                          LIST_OF_FONT_PRECISION_PAIRS_INQ;
  8671.          NUMBER_OF_HEIGHTS := GKS_INSTR.NUMBER_OF_HEIGHTS_INQ;
  8672.          RANGE_OF_HEIGHTS := GKS_INSTR.RANGE_OF_HEIGHTS_INQ;
  8673.          NUMBER_OF_EXPANSIONS := GKS_INSTR.NUMBER_OF_EXPANSIONS_INQ;
  8674.          EXPANSION_RANGE := GKS_INSTR.RANGE_OF_EXPANSIONS_INQ;
  8675.          NUMBER_OF_INDICES := GKS_INSTR.NUMBER_OF_TEXT_INDICES_INQ;
  8676.      
  8677.       end if;
  8678.      
  8679.    end INQ_TEXT_FACILITIES;
  8680.      
  8681.    procedure INQ_FILL_AREA_FACILITIES
  8682.       (WS                     : WS_TYPE;
  8683.       EI                      : out ERROR_INDICATOR;
  8684.       LIST_OF_INTERIOR_STYLES : out INTERIOR_STYLES.LIST_OF;
  8685.       LIST_OF_HATCH_STYLES    : out HATCH_STYLES.LIST_OF;
  8686.       NUMBER_OF_INDICES       : out NATURAL) is
  8687.      
  8688.    -- This procedure calls the workstation manager to obtain the values
  8689.    -- of the facilities for the fill area construct.  These include:
  8690.    --  1) the number of available fill area interior styles
  8691.    --  2) the list of available fill area interior sytles
  8692.    --  3) the number of available hatch styles
  8693.    --  4) the list of available hatch styles
  8694.    --  5) the number of predefined fill area indices.
  8695.    -- If the inquired information is available, the error indicator is
  8696.    -- returned by the workstation manager as 0.  If the inquired infor-
  8697.    -- mation is not available, the workstation manager returns the
  8698.    -- error indicator as 39 to indicate the reason for non-availability.
  8699.    --
  8700.    -- WS - This is an integer value indicating the workstation
  8701.    --    identification.
  8702.    -- EI - This is the error indicator.  Its numeric value represents
  8703.    --    the type of error, if any, that occurred.
  8704.    -- LIST_OF_INTERIOR_STYLES - This is a set type of the interior
  8705.    --    styles available.  The value of the components are set to 1
  8706.    --    if the corresponding style is available.
  8707.    -- LIST_OF_HATCH_STYLES - This is a set type of the hatch styles
  8708.    --    available.  The value of the components are set to 1 if the
  8709.    --    corresponding hatch style is available.
  8710.    -- NUMBER_OF_INDICES - This is a natural number representing the
  8711.    --    number of indices.
  8712.      
  8713.    GKS_INSTR : CGI_INQ_FILL_AREA_FACILITIES;
  8714.      
  8715.    begin
  8716.      
  8717.       -- The following if structure inquires the GKS_OPERATING
  8718.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  8719.       -- it checks to see if the WS exists by checking if it is
  8720.       -- in the list of available WS types in the GKS_DESCRIPTION_
  8721.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  8722.       -- called for the inquiry.
  8723.      
  8724.       if CURRENT_OPERATING_STATE = GKCL then
  8725.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  8726.          LIST_OF_INTERIOR_STYLES := INTERIOR_STYLES.NULL_LIST;
  8727.          LIST_OF_HATCH_STYLES := HATCH_STYLES.NULL_LIST;
  8728.          NUMBER_OF_INDICES := NATURAL'FIRST;
  8729.      
  8730.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  8731.                                LIST_OF_AVAILABLE_WS_TYPES) then
  8732.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  8733.          LIST_OF_INTERIOR_STYLES := INTERIOR_STYLES.NULL_LIST;
  8734.          LIST_OF_HATCH_STYLES := HATCH_STYLES.NULL_LIST;
  8735.          NUMBER_OF_INDICES := NATURAL'FIRST;
  8736.      
  8737.       else
  8738.          GKS_INSTR.WS_TO_INQ_FILL_AREA_FACILITIES := WS;
  8739.          WS_MANAGER (GKS_INSTR);
  8740.      
  8741.          if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  8742.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then   -- Error 39
  8743.                EI := GKS_INSTR.EI;
  8744.             else
  8745.                EI := UNKNOWN;                            -- Error 2501
  8746.             end if;
  8747.      
  8748.          else
  8749.             EI := GKS_INSTR.EI;
  8750.          end if;
  8751.      
  8752.          LIST_OF_INTERIOR_STYLES := GKS_INSTR.
  8753.                                     LIST_OF_INTERIOR_STYLES_INQ;
  8754.          LIST_OF_HATCH_STYLES    := GKS_INSTR.LIST_OF_HATCH_STYLES_INQ;
  8755.          NUMBER_OF_INDICES       := GKS_INSTR.
  8756.                                     NUMBER_OF_FILL_AREA_INDICES_INQ;
  8757.      
  8758.       end if;
  8759.      
  8760.    end INQ_FILL_AREA_FACILITIES;
  8761.      
  8762.    procedure INQ_COLOUR_FACILITIES
  8763.       (WS                      : in WS_TYPE;
  8764.       EI                       : out ERROR_INDICATOR;
  8765.       NUMBER_OF_COLOURS        : out NATURAL;
  8766.       AVAILABLE_COLOUR         : out COLOUR_AVAILABLE;
  8767.       NUMBER_OF_COLOUR_INDICES : out NATURAL) is
  8768.      
  8769.    -- This procedure calls the workstation manager to obtain the values
  8770.    -- of the facilities for colour.  These include:
  8771.    --  1) the number of available colours or intensities
  8772.    --  2) if colour is available
  8773.    --  3) the number of predefined colour indices.
  8774.    -- If the inquired information is available, the error indicator is
  8775.    -- returned by the workstation manager as 0.  If the inquired infor-
  8776.    -- mation is not available, the workstation manager returns the
  8777.    -- error indicator as 39 to indicate the reason for non-availability.
  8778.    --
  8779.    -- WS - This is an integer value indicating the workstation
  8780.    --    identification.
  8781.    -- EI - This is the error indicator.  Its numeric value represents
  8782.    --    the type of error, if any, that occurred.
  8783.    -- NUMBER_OF_COLOURS - This is a natural number indicating the
  8784.    --    number of colours available.
  8785.    -- AVAILABLE_COLOUR - The value of this enumerated parameter
  8786.    --    can be COLOUR or MONOCHROME to indicate whether colour
  8787.    --    output is available on WS.
  8788.    -- NUMBER_OF_COLOUR_INDICES - This is an natural value representing
  8789.    --    the number of colour indices.
  8790.      
  8791.    GKS_INSTR : CGI_INQ_COLOUR_FACILITIES;
  8792.      
  8793.    begin
  8794.      
  8795.       -- The following if structure inquires the GKS_OPERATING
  8796.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  8797.       -- it checks to see if the WS exists by checking if it is
  8798.       -- in the list of available WS types in the GKS_DESCRIPTION_
  8799.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  8800.       -- called for the inquiry.
  8801.      
  8802.       if CURRENT_OPERATING_STATE = GKCL then
  8803.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  8804.          NUMBER_OF_COLOURS        := NATURAL'FIRST;
  8805.          AVAILABLE_COLOUR         := COLOUR_AVAILABLE'FIRST;
  8806.          NUMBER_OF_COLOUR_INDICES := NATURAL'FIRST;
  8807.      
  8808.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  8809.                                LIST_OF_AVAILABLE_WS_TYPES) then
  8810.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  8811.          NUMBER_OF_COLOURS        := NATURAL'FIRST;
  8812.          AVAILABLE_COLOUR         := COLOUR_AVAILABLE'FIRST;
  8813.          NUMBER_OF_COLOUR_INDICES := NATURAL'FIRST;
  8814.      
  8815.       else
  8816.          GKS_INSTR.WS_TO_INQ_COLOUR_FACILITIES := WS;
  8817.          WS_MANAGER (GKS_INSTR);
  8818.      
  8819.          if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  8820.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then   -- Error 39
  8821.                EI := GKS_INSTR.EI;
  8822.             else
  8823.                EI := UNKNOWN;                            -- Error 2501
  8824.             end if;
  8825.      
  8826.          else
  8827.             EI := GKS_INSTR.EI;                          -- Error 0
  8828.          end if;
  8829.      
  8830.          NUMBER_OF_COLOURS        := GKS_INSTR.NUMBER_OF_COLOURS_INQ;
  8831.          AVAILABLE_COLOUR         := GKS_INSTR.AVAILABLE_COLOUR_INQ;
  8832.          NUMBER_OF_COLOUR_INDICES := GKS_INSTR.
  8833.                                      NUMBER_OF_COLOUR_INDICES_INQ;
  8834.      
  8835.       end if;
  8836.      
  8837.    end INQ_COLOUR_FACILITIES;
  8838.      
  8839.    procedure INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  8840.       (WS                    : in WS_TYPE;
  8841.       EI                     : out ERROR_INDICATOR;
  8842.       MAX_POLYLINE_ENTRIES   : out NATURAL;
  8843.       MAX_POLYMARKER_ENTRIES : out NATURAL;
  8844.       MAX_TEXT_ENTRIES       : out NATURAL;
  8845.       MAX_FILL_AREA_ENTRIES  : out NATURAL;
  8846.       MAX_PATTERN_INDICES    : out NATURAL;
  8847.       MAX_COLOUR_INDICES     : out NATURAL) is
  8848.      
  8849.    -- This procedure calls the workstation manager to obtain the values
  8850.    -- of the maximum number of entries in the following bundle tables:
  8851.    --  1) polyline
  8852.    --  2) polymarker
  8853.    --  3) text
  8854.    --  4) fill area
  8855.    -- It also obtains the maximum number of pattern indices and the
  8856.    -- maximum number of colour indices.
  8857.    -- If the inquired information is available, the error indicator is
  8858.    -- returned by the workstation manager as 0.  If the inquired infor-
  8859.    -- mation is not available, the workstation manager returns the
  8860.    -- error indicator as 39 to indicate the reason for non-availability.
  8861.    --
  8862.    -- WS - This is an integer value indicating the workstation
  8863.    --    identification.
  8864.    -- EI - This is the error indicator.  Its numeric value represents
  8865.    --    the type of error, if any, that occurred.
  8866.    -- MAX_POLYLINE_ENTRIES - This is a natural number representing the
  8867.    --    maximum number of polyline entries in the workstation state
  8868.    --    tables.
  8869.    -- MAX_POLYMARKER_ENTRIES - This is a natural number representing the
  8870.    --    maximum number of polymarker entries in the workstation state
  8871.    --    tables.
  8872.    -- MAX_TEXT_ENTRIES - This is a natural number representing the
  8873.    --    maximum number of text entries in the workstation state
  8874.    --    tables.
  8875.    -- MAX_FILL_AREA_ENTRIES - This is a natural number representing the
  8876.    --    maximum number of fill area entries in the workstation state
  8877.    --    tables.
  8878.    -- MAX_PATTERN_INDICES - This is a natural number representing the
  8879.    --    maximum number of pattern indices in the workstation state
  8880.    --    tables.
  8881.    -- MAX_COLOUR_INDICES - This is a natural number representing the
  8882.    --    maximum number of colour indices in the workstation state
  8883.    --    tables.
  8884.      
  8885.    GKS_INSTR : CGI_INQ_MAX_LENGTH_OF_WS_STATE_TABLES;
  8886.      
  8887.    begin
  8888.      
  8889.       -- The following if structure inquires the GKS_OPERATING
  8890.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  8891.       -- it checks to see if the WS exists by checking if it is
  8892.       -- in the list of available WS types in the GKS_DESCRIPTION_
  8893.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  8894.       -- called for the inquiry.
  8895.      
  8896.       if CURRENT_OPERATING_STATE = GKCL then
  8897.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  8898.          MAX_POLYLINE_ENTRIES := NATURAL'FIRST;
  8899.          MAX_POLYMARKER_ENTRIES := NATURAL'FIRST;
  8900.          MAX_TEXT_ENTRIES := NATURAL'FIRST;
  8901.          MAX_FILL_AREA_ENTRIES := NATURAL'FIRST;
  8902.          MAX_PATTERN_INDICES := NATURAL'FIRST;
  8903.          MAX_COLOUR_INDICES := NATURAL'FIRST;
  8904.      
  8905.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  8906.                                LIST_OF_AVAILABLE_WS_TYPES) then
  8907.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  8908.          MAX_POLYLINE_ENTRIES := NATURAL'FIRST;
  8909.          MAX_POLYMARKER_ENTRIES := NATURAL'FIRST;
  8910.          MAX_TEXT_ENTRIES := NATURAL'FIRST;
  8911.          MAX_FILL_AREA_ENTRIES := NATURAL'FIRST;
  8912.          MAX_PATTERN_INDICES := NATURAL'FIRST;
  8913.          MAX_COLOUR_INDICES := NATURAL'FIRST;
  8914.      
  8915.       else
  8916.          GKS_INSTR.WS_TO_INQ_MAX_LENGTH_OF_WS_STATE_TABLES := WS;
  8917.          WS_MANAGER (GKS_INSTR);
  8918.      
  8919.          if GKS_INSTR.EI /= SUCCESSFUL then             -- Error 0
  8920.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then  -- Error 39
  8921.                EI := GKS_INSTR.EI;
  8922.             else
  8923.                EI := UNKNOWN;                            -- Error 2501
  8924.             end if;
  8925.      
  8926.          else
  8927.             EI := GKS_INSTR.EI;                          -- Error 0
  8928.          end if;
  8929.      
  8930.          MAX_POLYLINE_ENTRIES   := GKS_INSTR.MAX_POLYLINE_ENTRIES_INQ;
  8931.          MAX_POLYMARKER_ENTRIES := GKS_INSTR.MAX_POLYMARKER_ENTRIES_INQ;
  8932.          MAX_TEXT_ENTRIES       := GKS_INSTR.MAX_TEXT_ENTRIES_INQ;
  8933.          MAX_FILL_AREA_ENTRIES  := GKS_INSTR.MAX_FILL_AREA_ENTRIES_INQ;
  8934.          MAX_PATTERN_INDICES    := GKS_INSTR.MAX_PATTERN_INDICES_INQ;
  8935.          MAX_COLOUR_INDICES     := GKS_INSTR.MAX_COLOUR_INDICES_INQ;
  8936.      
  8937.       end if;
  8938.      
  8939.    end INQ_MAX_LENGTH_OF_WS_STATE_TABLES;
  8940.      
  8941. end INQ_WS_DESCRIPTION_TABLE_MA;
  8942. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8943. --:UDD:GKSADACM:CODE:MA:SET_CLR_TBL_B.ADA
  8944. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  8945. ------------------------------------------------------------------
  8946. --
  8947. --  NAME: SET_COLOUR_TABLE - BODY
  8948. --  IDENTIFIER: GDMXXX.1(2)
  8949. --  DISCREPANCY REPORTS:
  8950. --  DR005  OUTPUT_ATTRIBUTE_ERROR missing from SET_CLR_TBL_B
  8951. ------------------------------------------------------------------
  8952. -- file:  set_clr_tbl_b.ada
  8953. -- level: all levels
  8954.      
  8955. with WSM;
  8956. with CGI;
  8957. with ERROR_ROUTINES;
  8958. with GKS_OPERATING_STATE_LIST;
  8959. with GKS_STATE_LIST;
  8960. with GKS_ERRORS;
  8961.      
  8962. use WSM;
  8963. use CGI;
  8964. use ERROR_ROUTINES;
  8965. use GKS_OPERATING_STATE_LIST;
  8966. use GKS_ERRORS;
  8967.      
  8968. package body SET_COLOUR_TABLE is
  8969.      
  8970. -- This is the package body for procedures for calling the work-
  8971. -- station manager to set the workstation attributes at level ma.
  8972. --
  8973. -- If an error indicator above 0 occurs, these procedures call
  8974. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  8975. -- to log the error indicator and the name of the procedure
  8976. -- in the error file specified when the procedure OPEN_GKS
  8977. -- was called to begin this session of GKS operation.
  8978.      
  8979.    procedure SET_COLOUR_REPRESENTATION
  8980.       (WS    : in WS_ID;
  8981.       INDEX  : in COLOUR_INDEX;
  8982.       COLOUR : in COLOUR_REPRESENTATION) is
  8983.      
  8984.    -- This procedure inquires the GKS_OPERATING_STATE_LIST to
  8985.    -- check if GKS is in one of the states WSOP, WSAC, or SGOP.
  8986.    -- If it is not, error 7 occurs and the procedure raises the
  8987.    -- exception STATE_ERROR.  It also checks the GKS_STATE_LIST
  8988.    -- to see if the WS is open.  If not, error 25 occurs and the
  8989.    -- procedure raises the exception WS_ERROR.  Otherwise, this
  8990.    -- procedure calls the workstation manager to map a given colour
  8991.    -- index with a specified colour of certain intensities of red,
  8992.    -- green, and blue and to set this value in the workstation state
  8993.    -- list.  If the workstation manager returns error 33, 35, or 36,
  8994.    -- this procedure raises the exception WS_ERROR.
  8995.    --
  8996.    -- WS - Identifies the workstation on which the colour represen-
  8997.    --    tation.
  8998.    -- INDEX - Indicates the entry in the colour table to be set.
  8999.    -- COLOUR - Defines the representation of a colour as a combina-
  9000.    --    tion of RED, GREEN, and BLUE intensities which are the
  9001.    --    components of the record.
  9002.      
  9003.    GKS_INSTR : CGI_SET_COLOUR_REPRESENTATION;
  9004.      
  9005.    begin
  9006.      
  9007.       -- The following if structure inquires the GKS_OPERATING_STATE_
  9008.       -- LIST to see if GKS is in the proper state and the workstation
  9009.       -- specified is open.
  9010.      
  9011.       if (CURRENT_OPERATING_STATE = GKCL) or
  9012.          (CURRENT_OPERATING_STATE = GKOP) then
  9013.          ERROR_LOGGING (NOT_WSOP_WSAC_SGOP, "SET_COLOUR_TABLE");-- Error 7
  9014.          raise STATE_ERROR;
  9015.      
  9016.       elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  9017.          ERROR_LOGGING (WS_NOT_OPEN, "SET_COLOUR_TABLE");    -- Error 25
  9018.          raise WS_ERROR;
  9019.      
  9020.       else
  9021.          GKS_INSTR.WS_TO_SET_COLOUR_REP := WS;
  9022.          GKS_INSTR.COLOUR_INDEX_TO_SET_COLOUR_REP := INDEX;
  9023.          GKS_INSTR.COLOUR_REP_SET := COLOUR;
  9024.          WS_MANAGER (GKS_INSTR);
  9025.      
  9026.          if GKS_INSTR.EI /= SUCCESSFUL then               -- Error 0
  9027.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  9028.                (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) or   -- Error 35
  9029.                (GKS_INSTR.EI = WS_IS_WISS) then           -- Error 36
  9030.                ERROR_LOGGING (GKS_INSTR.EI, "SET_COLOUR_TABLE");
  9031.                raise WS_ERROR;
  9032.             elsif (GKS_INSTR.EI = INVALID_COLOUR_INDEX) then -- Error 93
  9033.                ERROR_LOGGING (GKS_INSTR.EI, "SET_COLOUR_TABLE");
  9034.                raise OUTPUT_ATTRIBUTE_ERROR;
  9035.             end if;
  9036.      
  9037.          end if;
  9038.      
  9039.       end if;
  9040.      
  9041.       exception
  9042.          when STATE_ERROR =>
  9043.             raise;
  9044.          when WS_ERROR =>
  9045.             raise;
  9046.          when OUTPUT_ATTRIBUTE_ERROR =>
  9047.             raise;
  9048.          when OTHERS =>
  9049.             ERROR_LOGGING (UNKNOWN,
  9050.                           "SET_COLOUR_REPRESENTATION"); -- ERROR 2501
  9051.             raise;
  9052.      
  9053.    end SET_COLOUR_REPRESENTATION;
  9054.      
  9055. end SET_COLOUR_TABLE;
  9056. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9057. --:UDD:GKSADACM:CODE:MA:WS_CONTROL_B.ADA
  9058. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9059. ------------------------------------------------------------------
  9060. --
  9061. --  NAME: WS_CONTROL - BODY
  9062. --  IDENTIFIER: GIMXXX.1(1)
  9063. --  DISCREPANCY REPORTS:
  9064. --
  9065. ------------------------------------------------------------------
  9066. -- file:  ws_control_b.ada
  9067. -- level: all levels
  9068.      
  9069. with WSM;
  9070. with CGI;
  9071. with ERROR_ROUTINES;
  9072. with GKS_OPERATING_STATE_LIST;
  9073. with GKS_STATE_LIST;
  9074. with GKS_ERRORS;
  9075. with GKS_DESCRIPTION_TABLE;
  9076.      
  9077. use WSM;
  9078. use CGI;
  9079. use ERROR_ROUTINES;
  9080. use GKS_OPERATING_STATE_LIST;
  9081. use GKS_ERRORS;
  9082.      
  9083. package body WS_CONTROL is
  9084.      
  9085. -- This is the package body for the workstation control
  9086. -- functions.  All of these functions call the workstation
  9087. -- manager.
  9088. --
  9089. -- If an error indicator above 0 occurs, these procedures call
  9090. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  9091. -- to log the error indicator and the name of the procedure
  9092. -- in the error file specified when the procedure OPEN_GKS
  9093. -- was called to begin this session of GKS operation.
  9094.      
  9095.    procedure OPEN_WS
  9096.       (WS : in WS_ID;
  9097.       CONNECTION : in CONNECTION_ID;
  9098.       TYPE_OF_WS : in WS_TYPE) is separate;
  9099.      
  9100.    procedure CLOSE_WS
  9101.       (WS : in WS_ID) is separate;
  9102.      
  9103.    procedure ACTIVATE_WS
  9104.       (WS : in WS_ID) is separate;
  9105.      
  9106.    procedure DEACTIVATE_WS
  9107.       (WS : in WS_ID) is separate;
  9108.      
  9109.    procedure CLEAR_WS
  9110.       (WS  : in WS_ID;
  9111.       FLAG : in CONTROL_FLAG) is separate;
  9112.      
  9113.    procedure UPDATE_WS
  9114.       (WS          : in WS_ID;
  9115.       REGENERATION : in UPDATE_REGENERATION_FLAG) is separate;
  9116.      
  9117. end WS_CONTROL;
  9118. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9119. --:UDD:GKSADACM:CODE:MA:ACTIVATE_WS_S.ADA
  9120. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9121. ------------------------------------------------------------------
  9122. --
  9123. --  NAME: ACTIVATE_WS
  9124. --  IDENTIFIER: GIMXXX.1(1)
  9125. --  DISCREPANCY REPORTS:
  9126. --
  9127. ------------------------------------------------------------------
  9128. -- file:  activate_ws_s.ada
  9129. -- level: all levels
  9130.      
  9131. separate (WS_CONTROL)
  9132.      
  9133. procedure ACTIVATE_WS
  9134.    (WS : in WS_ID) is
  9135.      
  9136. -- This procedure first checks the GKS_OPERATING_STATE_LIST
  9137. -- to see if GKS is in state WSOP or WSAC.  If it is not,
  9138. -- error 6 occurs and the exception STATE_ERROR is raised.
  9139. -- Then the procedure inquires the GKS_STATE_LIST to check
  9140. -- if the WS is in the set of open workstations. If it is not,
  9141. -- error 25 occurs and the exception WS_ERROR is raised.
  9142. -- The procedure also checks the GKS_STATE_LIST to see if the
  9143. -- WS is in the set of active workstations.  If it is, error
  9144. -- 29 occurs and the exception WS_ERROR is raised.  Then,
  9145. -- if the addition of another active workstation would
  9146. -- exceed the MAX_ACTIVE_WS number in the GKS_DESCRIPTION_TABLE,
  9147. -- error 43 occurs and the exception WS_ERROR is raised.
  9148. --
  9149. -- Otherwise, this procedure calls the workstation manager
  9150. -- to activate the workstation.  If the workstation manager
  9151. -- returns errors 33, or 35, this procedure raises
  9152. -- the exception WS_ERROR.
  9153. --
  9154. -- WS - This is the identifier of the workstation that is
  9155. --    to be activated.
  9156.      
  9157. GKS_INSTR : CGI_ACTIVATE_WS;
  9158.      
  9159. begin
  9160.      
  9161.    -- The following if structure inquires the GKS_OPERATING_STATE_
  9162.    -- LIST to see if GKS is in the proper state. Then it inquires
  9163.    -- the GKS_STATE_LIST to see if the WS is in the set of open
  9164.    -- workstations and if it is already activated (in the set of
  9165.    -- active workstations).
  9166.      
  9167.    if (CURRENT_OPERATING_STATE /= WSOP) and
  9168.       (CURRENT_OPERATING_STATE /= WSAC) then
  9169.       ERROR_LOGGING (NOT_WSOP_WSAC, "ACTIVATE_WS"); -- Error 6
  9170.       raise STATE_ERROR;
  9171.      
  9172.    elsif not WS_IDS.IS_IN_LIST(WS, GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  9173.       ERROR_LOGGING (WS_NOT_OPEN, "ACTIVATE_WS");   -- Error 25
  9174.       raise WS_ERROR;
  9175.      
  9176.    elsif WS_IDS.IS_IN_LIST(WS, GKS_STATE_LIST.LIST_OF_ACTIVE_WS) then
  9177.       ERROR_LOGGING (WS_IS_ACTIVE, "ACTIVATE_WS");   -- Error 29
  9178.       raise WS_ERROR;
  9179.      
  9180.    elsif WS_IDS.SIZE_OF_LIST(GKS_STATE_LIST.LIST_OF_ACTIVE_WS) =
  9181.       GKS_DESCRIPTION_TABLE.MAX_ACTIVE_WS then
  9182.       ERROR_LOGGING (MAX_NUM_OF_ACTIVE_WS, "ACTIVATE_WS"); -- Error 43
  9183.       raise WS_ERROR;
  9184.      
  9185.    else
  9186.       GKS_INSTR.WS_TO_ACTIVATE := WS;
  9187.       WS_MANAGER (GKS_INSTR);
  9188.      
  9189.       if GKS_INSTR.EI /= SUCCESSFUL then               -- Error 0
  9190.      
  9191.          if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  9192.             (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) then -- Error 35
  9193.             ERROR_LOGGING (GKS_INSTR.EI, "ACTIVATE_WS");
  9194.             raise WS_ERROR;
  9195.          end if;
  9196.      
  9197.       else
  9198.          WS_IDS.ADD_TO_LIST(WS, GKS_STATE_LIST.LIST_OF_ACTIVE_WS);
  9199.      
  9200.          if CURRENT_OPERATING_STATE /= WSAC then
  9201.             CURRENT_OPERATING_STATE := WSAC;
  9202.          end if;
  9203.      
  9204.       end if;
  9205.      
  9206.    end if;
  9207.      
  9208.    exception
  9209.       when STATE_ERROR =>
  9210.          raise;
  9211.       when WS_ERROR =>
  9212.          raise;
  9213.       when OTHERS =>
  9214.          ERROR_LOGGING (UNKNOWN, "ACTIVATE_WS");        -- Error 2501
  9215.          raise;
  9216.      
  9217. end ACTIVATE_WS;
  9218. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9219. --:UDD:GKSADACM:CODE:MA:DEACTIVATE_WS_S.ADA
  9220. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9221. ------------------------------------------------------------------
  9222. --
  9223. --  NAME: DEACTIVATE_WS
  9224. --  IDENTIFIER: GIMXXX.1(1)
  9225. --  DISCREPANCY REPORTS:
  9226. --
  9227. ------------------------------------------------------------------
  9228. -- file:  deactivate_ws_s.ada
  9229. -- level: all levels
  9230.      
  9231. separate (WS_CONTROL)
  9232.      
  9233. procedure DEACTIVATE_WS
  9234.    (WS : in WS_ID) is
  9235.      
  9236. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  9237. -- to see if GKS is in state WSAC.  If it is not, error 3
  9238. -- occurs and this procedure raises the exception STATE_ERROR.
  9239. -- This procedure then inquires the GKS_STATE_LIST to see if
  9240. -- the WS is in the set of active workstations.  If it is not,
  9241. -- error 30 occurs and the exception WS_ERROR is raised.
  9242. -- Otherwise, this procedure calls the workstation manager to
  9243. -- deactivate the workstation.  If the workstation manager returns
  9244. -- errors  33, or 35, this procedure raises the exception
  9245. -- WS_ERROR.
  9246. --
  9247. -- This procedure sets the operating state to WSOP = "At least
  9248. -- one workstation open" in the GKS_OPERATING_STATE_LIST if no
  9249. -- workstations remain active.  This is determined by inquiring
  9250. -- the GKS_STATE_LIST.
  9251. --
  9252. -- WS - This is the identifier of the workstation that is
  9253. --    to be deactivated.
  9254.      
  9255. GKS_INSTR : CGI_DEACTIVATE_WS;
  9256.      
  9257. begin
  9258.      
  9259.    -- The following if structure inquires the GKS_OPERATING_STATE_
  9260.    -- LIST to see if GKS is in the proper state. Then it inquires
  9261.    -- the GKS_STATE_LIST to see if the WS is in the set of active
  9262.    -- workstations before calling the WS_MANAGER.
  9263.      
  9264.    if (CURRENT_OPERATING_STATE /= WSAC) then
  9265.       ERROR_LOGGING (NOT_WSAC, "DEACTIVATE_WS");         -- Error 3
  9266.       raise STATE_ERROR;
  9267.      
  9268.    elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_ACTIVE_WS) then
  9269.       ERROR_LOGGING (WS_IS_NOT_ACTIVE, "DEACTIVATE_WS"); -- Error 30
  9270.       raise WS_ERROR;
  9271.      
  9272.    else
  9273.       GKS_INSTR.WS_TO_DEACTIVATE := WS;
  9274.       WS_MANAGER (GKS_INSTR);
  9275.      
  9276.       if GKS_INSTR.EI /= SUCCESSFUL then                -- Error 0
  9277.          if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or       -- Error 33
  9278.             (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) then  -- Error 35
  9279.             ERROR_LOGGING (GKS_INSTR.EI, "DEACTIVATE_WS");
  9280.             raise WS_ERROR;
  9281.          end if;
  9282.      
  9283.       else
  9284.          WS_IDS.DELETE_FROM_LIST(WS,GKS_STATE_LIST.LIST_OF_ACTIVE_WS);
  9285.      
  9286.          if WS_IDS.SIZE_OF_LIST(GKS_STATE_LIST.LIST_OF_ACTIVE_WS) = 0
  9287.             then
  9288.             CURRENT_OPERATING_STATE := WSOP;
  9289.          end if;
  9290.      
  9291.       end if;
  9292.      
  9293.    end if;
  9294.      
  9295.    exception
  9296.       when STATE_ERROR =>
  9297.          raise;
  9298.       when WS_ERROR =>
  9299.          raise;
  9300.       when OTHERS =>
  9301.          ERROR_LOGGING (UNKNOWN, "DEACTIVATE_WS");       -- Error 2501
  9302.          raise;
  9303.      
  9304. end DEACTIVATE_WS;
  9305. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9306. --:UDD:GKSADACM:CODE:MA:CLEAR_WS_S.ADA
  9307. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9308. ------------------------------------------------------------------
  9309. --
  9310. --  NAME: CLEAR_WS
  9311. --  IDENTIFIER: GDMXXX.1(1)
  9312. --  DISCREPANCY REPORTS:
  9313. --
  9314. ------------------------------------------------------------------
  9315. -- file:  clear_ws_s.ada
  9316. -- level: all levels
  9317.      
  9318. separate (WS_CONTROL)
  9319.      
  9320. procedure CLEAR_WS
  9321.    (WS  : in WS_ID;
  9322.    FLAG : in CONTROL_FLAG) is
  9323.      
  9324. -- This procedure inquires the GKS_OPERATING_STATE_LIST to
  9325. -- see if GKS is in the states WSOP, or WSAC.  If it is not,
  9326. -- error 6 occurs and the exception STATE_ERROR is raised.
  9327. -- Then this procedure inquires the GKS_STATE_LIST to check
  9328. -- if the WS is in the set of open workstations.  If it is not,
  9329. -- error 25 occurs, and the exception WS_ERROR is raised.
  9330. --
  9331. -- Otherwise, this procedure calls the workstation manager to
  9332. -- clear the workstation.  If the workstation manager returns errors
  9333. -- 33, or 35 this procedure raises the exception WS_ERROR.
  9334. --
  9335. -- WS - This is the identifier of the workstation on which the
  9336. --    display surface is to be cleared.
  9337. -- FLAG - Indicates the conditions under which the display
  9338. --    surface is to be cleared.  It may be set to either
  9339. --    CONDITIONALLY or ALWAYS.
  9340.      
  9341. GKS_INSTR : CGI_CLEAR_WS;
  9342.      
  9343. begin
  9344.      
  9345.    -- The following if structure inquires the GKS_OPERATING_STATE_
  9346.    -- LIST to see if GKS is in the proper state. Then it inquires
  9347.    -- the GKS_STATE_LIST to see if the WS is in the set of open
  9348.    -- workstations before calling the WS_MANAGER.
  9349.      
  9350.    if (CURRENT_OPERATING_STATE /= WSOP) and
  9351.       (CURRENT_OPERATING_STATE /= WSAC) then
  9352.       ERROR_LOGGING (NOT_WSOP_WSAC, "CLEAR_WS");  -- Error 6
  9353.       raise STATE_ERROR;
  9354.      
  9355.    elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  9356.       ERROR_LOGGING (WS_NOT_OPEN, "CLEAR_WS");     -- Error 25
  9357.       raise WS_ERROR;
  9358.      
  9359.    else
  9360.       GKS_INSTR.WS_TO_CLEAR := WS;
  9361.       GKS_INSTR.FLAG := FLAG;
  9362.       WS_MANAGER (GKS_INSTR);
  9363.      
  9364.       if GKS_INSTR.EI /= SUCCESSFUL then               -- Error 0
  9365.      
  9366.          if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  9367.             (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) then -- Error 35
  9368.             ERROR_LOGGING (GKS_INSTR.EI, "CLEAR_WS");
  9369.             raise WS_ERROR;
  9370.          end if;
  9371.      
  9372.       end if;
  9373.      
  9374.    end if;
  9375.      
  9376.    exception
  9377.       when STATE_ERROR =>
  9378.          raise;
  9379.       when WS_ERROR =>
  9380.          raise;
  9381.       when OTHERS =>
  9382.          ERROR_LOGGING (UNKNOWN, "CLEAR_WS");             -- Error 2501
  9383.          raise;
  9384.      
  9385. end CLEAR_WS;
  9386. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9387. --:UDD:GKSADACM:CODE:MA:CLOSE_WS_S.ADA
  9388. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9389. ------------------------------------------------------------------
  9390. --
  9391. --  NAME: CLOSE_WS
  9392. --  IDENTIFIER: GIMXXX.1(1)
  9393. --  DISCREPANCY REPORTS:
  9394. --
  9395. ------------------------------------------------------------------
  9396. -- file:  close_ws_s.ada
  9397. -- level: all levels
  9398.      
  9399. separate (WS_CONTROL)
  9400.      
  9401. procedure CLOSE_WS
  9402.    (WS : in WS_ID) is
  9403.      
  9404. -- This procedure inquires the GKS_OPERATING_STATE_LIST
  9405. -- to see if GKS is in state WSOP, WSAC, or SGOP. If it
  9406. -- is not, then error 7 occurs and the exception STATE_
  9407. -- ERROR is raised.  Then it inquires the GKS_STATE_LIST
  9408. -- to see if the WS is in the set of open workstations. If
  9409. -- it is not, error 25 occurs and the exception WS_ERROR is
  9410. -- raised.  The procedure also checks the GKS_STATE_LIST to
  9411. -- see if the WS is in the set of active workstations. If
  9412. -- it is, error 29 occurs and the exception WS_ERROR is
  9413. -- raised.
  9414. --
  9415. -- Otherwise, this procedure calls the workstation manager to
  9416. -- release the connection between the workstation and GKS.
  9417. --
  9418. -- If the workstation manager returns error 147, this procedure
  9419. -- raises the exception INPUT_ERROR.
  9420. --
  9421. -- WS - This is the identifier of the workstation that is
  9422. --    to be closed.
  9423.      
  9424. GKS_INSTR : CGI_CLOSE_WS;
  9425.      
  9426. begin
  9427.      
  9428.    -- The following if structure inquires the GKS_OPERATING_STATE_
  9429.    -- LIST to see if GKS is in the proper state. Then it inquires
  9430.    -- the GKS_STATE_LIST to see if the WS is in the set of open
  9431.    -- workstations and if it is not activated (not in the set of
  9432.    -- active workstations).
  9433.      
  9434.    if (CURRENT_OPERATING_STATE = GKCL) or
  9435.       (CURRENT_OPERATING_STATE = GKOP) then
  9436.       ERROR_LOGGING (NOT_WSOP_WSAC_SGOP, "CLOSE_WS");   -- Error 7
  9437.       raise STATE_ERROR;
  9438.      
  9439.    elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  9440.       ERROR_LOGGING (WS_NOT_OPEN, "CLOSE_WS");          -- Error 25
  9441.       raise WS_ERROR;
  9442.      
  9443.    elsif WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_ACTIVE_WS) then
  9444.       ERROR_LOGGING (WS_IS_ACTIVE, "CLOSE_WS");         -- Error 29
  9445.       raise WS_ERROR;
  9446.      
  9447.    else
  9448.       GKS_INSTR.WS_TO_CLOSE := WS;
  9449.       WS_MANAGER (GKS_INSTR);
  9450.      
  9451.       if GKS_INSTR.EI /= SUCCESSFUL then                   -- Error 0
  9452.          if GKS_INSTR.EI = INPUT_QUEUE_OVERFLOW then       -- Error 147
  9453.             ERROR_LOGGING (INPUT_QUEUE_OVERFLOW, "CLOSE_WS");
  9454.             raise INPUT_ERROR;
  9455.          end if;
  9456.       else
  9457.          WS_IDS.DELETE_FROM_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS);
  9458.      
  9459.          if WS_IDS.SIZE_OF_LIST(GKS_STATE_LIST.LIST_OF_OPEN_WS) = 0 then
  9460.             CURRENT_OPERATING_STATE := GKOP;
  9461.          end if;
  9462.      
  9463.       end if;
  9464.      
  9465.    end if;
  9466.      
  9467.    exception
  9468.       when STATE_ERROR =>
  9469.          raise;
  9470.       when WS_ERROR =>
  9471.          raise;
  9472.       when OTHERS =>
  9473.          ERROR_LOGGING (UNKNOWN, "CLOSE_WS");              -- Error 2501
  9474.          raise;
  9475.      
  9476. end CLOSE_WS;
  9477. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9478. --:UDD:GKSADACM:CODE:MA:GKS_CONTROL_B.ADA
  9479. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9480. ------------------------------------------------------------------
  9481. --
  9482. --  NAME: GKS_CONTROL - BODY
  9483. --  IDENTIFIER: GIMXXX.1(1)
  9484. --  DISCREPANCY REPORTS:
  9485. --
  9486. ------------------------------------------------------------------
  9487. -- file:  gks_control_b.ada
  9488. -- level: all levels
  9489.      
  9490. with GKS_STATE_LIST;
  9491. with GKS_OPERATING_STATE_LIST;
  9492. with GKS_ERROR_STATE_LIST;
  9493. with ERROR_ROUTINES;
  9494. with GKS_CONFIGURATION;
  9495. with GKS_ERRORS;
  9496.      
  9497. use ERROR_ROUTINES;
  9498. use GKS_OPERATING_STATE_LIST;
  9499. use GKS_ERRORS;
  9500.      
  9501. package body GKS_CONTROL is
  9502.      
  9503. -- This is the package body for the GKS control functions.
  9504. --
  9505. -- If an error indicator above 0 occurs, these procedures call
  9506. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  9507. -- to log the error indicator and the name of the procedure
  9508. -- in the error file specified when the procedure OPEN_GKS
  9509. -- was called to begin this session of GKS operation.
  9510.      
  9511.    procedure OPEN_GKS
  9512.       (ERROR_FILE       : in ERROR_FILE_TYPE :=
  9513.                           GKS_CONFIGURATION.DEFAULT_ERROR_FILE;
  9514.       AMOUNT_OF_MEMORY  : in MEMORY_UNITS    :=
  9515.                           GKS_CONFIGURATION.MAX_MEMORY_UNITS) is separate;
  9516.      
  9517.    procedure CLOSE_GKS is separate;
  9518.      
  9519. end GKS_CONTROL;
  9520. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9521. --:UDD:GKSADACM:CODE:MA:CLOSE_GKS_S.ADA
  9522. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9523. ------------------------------------------------------------------
  9524. --
  9525. --  NAME: CLOSE_GKS
  9526. --  IDENTIFIER: GIMXXX.1(1)
  9527. --  DISCREPANCY REPORTS:
  9528. --
  9529. ------------------------------------------------------------------
  9530. -- file:  close_gks_s.ada
  9531. -- level: all levels
  9532.      
  9533. with TEXT_IO;
  9534.      
  9535. separate (GKS_CONTROL)
  9536.      
  9537. procedure CLOSE_GKS is
  9538.      
  9539. --  This function closes GKS.  All of the GKS data
  9540. --  structures are made unavailable.  No further GKS
  9541. --  functions may be invoked.  The operating state is
  9542. --  set to GKCL = "GKS closed."
  9543.      
  9544. --  The procedure inquires the GKS_OPERATING_STATE_LIST
  9545. --  initially.  If the operating state is not GKOP,
  9546. --  error 2 occurs, and the exception STATE_ERROR is
  9547. --  raised.
  9548.      
  9549. EI : ERROR_INDICATOR;
  9550.      
  9551. begin
  9552.      
  9553.    -- The following if inquires the GKS_OPERATING_STATE_LIST
  9554.    -- to see if GKS is in the proper state before proceeding.
  9555.    if CURRENT_OPERATING_STATE /= GKOP then
  9556.       ERROR_LOGGING (NOT_GKOP, "CLOSE_GKS");       -- Error 2
  9557.       raise STATE_ERROR;
  9558.    else
  9559.       TEXT_IO.CLOSE (GKS_ERROR_STATE_LIST.ERROR_DATA);
  9560.       CURRENT_OPERATING_STATE := GKCL;
  9561.    end if;
  9562.      
  9563.    exception
  9564.       when STATE_ERROR =>
  9565.          raise;
  9566.       when OTHERS =>
  9567.          ERROR_LOGGING (UNKNOWN, "CLOSE_GKS");       -- Error 2501
  9568.          raise;
  9569.      
  9570. end CLOSE_GKS;
  9571. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9572. --:UDD:GKSADACM:CODE:MA:OUT_PRIM_B.ADA
  9573. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9574. ------------------------------------------------------------------
  9575. --
  9576. --  NAME: OUTPUT_PRIMITIVES - BODY
  9577. --  IDENTIFIER: GIMXXX.1(1)
  9578. --  DISCREPANCY REPORTS:
  9579. --
  9580. ------------------------------------------------------------------
  9581. -- file:  out_prim_b.ada
  9582. -- level: all levels
  9583.      
  9584. with WSM;
  9585. with CGI;
  9586. with ERROR_ROUTINES;
  9587. with GKS_OPERATING_STATE_LIST;
  9588. with GKS_ERRORS;
  9589. with TRANSFORMATION_MATH;
  9590. with GKS_STATE_LIST;
  9591.      
  9592. use WSM;
  9593. use CGI;
  9594. use ERROR_ROUTINES;
  9595. use GKS_OPERATING_STATE_LIST;
  9596. use GKS_ERRORS;
  9597.      
  9598. package body OUTPUT_PRIMITIVES is
  9599.      
  9600. -- This is the package body for output primitive functions.
  9601. -- All of these procedures call the workstation manager.
  9602. --
  9603. -- All of these procedures inquire the GKS_OPERATING_STATE_LIST
  9604. -- to check if GKS is in one of the states WSAC or SGOP.  If it is
  9605. -- not, error 5 occurs and the procedure raises the exception
  9606. -- STATE_ERROR.
  9607. --
  9608. -- If an error indicator above 0 occurs, these procedures call
  9609. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  9610. -- to log the error indicator and the name of the procedure
  9611. -- in the error file specified when the procedure OPEN_GKS
  9612. -- was called to begin this session of GKS operation.
  9613.      
  9614.    procedure POLYLINE
  9615.       (LINE_POINTS : in WC.POINT_ARRAY) is separate;
  9616.      
  9617.    procedure POLYMARKER
  9618.       (MARKER_POINTS : in WC.POINT_ARRAY) is separate;
  9619.      
  9620.    procedure FILL_AREA
  9621.       (FILL_AREA_POINTS : in WC.POINT_ARRAY) is separate;
  9622.      
  9623.    procedure TEXT
  9624.       (POSITION   : in WC.POINT;
  9625.       TEXT_STRING : in STRING) is separate;
  9626. end OUTPUT_PRIMITIVES;
  9627. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9628. --:UDD:GKSADACM:CODE:MA:FA_S.ADA
  9629. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9630. ------------------------------------------------------------------
  9631. --
  9632. --  NAME: FILL_AREA
  9633. --  IDENTIFIER: GIMXXX.1(1)
  9634. --  DISCREPANCY REPORTS:
  9635. --
  9636. ------------------------------------------------------------------
  9637. -- file:  fa_s.ada
  9638. -- level: all levels
  9639.      
  9640. separate (OUTPUT_PRIMITIVES)
  9641.      
  9642. procedure FILL_AREA
  9643.    (FILL_AREA_POINTS : in WC.POINT_ARRAY) is
  9644.      
  9645. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  9646. -- to check if GKS is in state WSAC or SGOP.  If it is not,
  9647. -- error 5 occurs and the exception STATE_ERROR is raised.  In
  9648. -- addition, it checks if the number of points is invalid.  If
  9649. -- so, error 100 occurs and the exception OUTPUT_PRIMITIVE_ERROR
  9650. -- is raised.  Otherwise, this procedure performs a normalization
  9651. -- transformation on the world coordinate points passed in and
  9652. -- passes the normalized device coordinates that result to the
  9653. -- workstation manager to generate a fill area output.
  9654. --
  9655. -- FILL_AREA_POINTS - Provides the array of world coordinate points.
  9656.      
  9657. GKS_INSTR : CGI_FILL_AREA;
  9658.      
  9659. NDC_POINTS : NDC.POINT_ARRAY(1..FILL_AREA_POINTS'LENGTH);
  9660. -- The above type was created to hold the transformed points.
  9661.      
  9662. begin
  9663.      
  9664.    -- The following if structure inquires the GKS_OPERATING_STATE_
  9665.    -- LIST to see if GKS is in the proper state. Then it checks to
  9666.    -- see that the number of points is valid before calling the
  9667.    -- WS_MANAGER.
  9668.      
  9669.    if (CURRENT_OPERATING_STATE /= WSAC) and
  9670.       (CURRENT_OPERATING_STATE /= SGOP) then
  9671.       ERROR_LOGGING (NOT_WSAC_SGOP, "FILL_AREA");           -- Error 5
  9672.       raise STATE_ERROR;
  9673.      
  9674.    elsif FILL_AREA_POINTS'LENGTH < 3 then
  9675.       ERROR_LOGGING (INVALID_NUMBER_OF_POINTS, "FILL_AREA"); -- Error 100
  9676.       raise OUTPUT_PRIMITIVE_ERROR;
  9677.      
  9678.    else
  9679.       -- The following performs the transformation on the
  9680.       -- points from world coordinates to normalized device coordinates.
  9681.       NDC_POINTS := TRANSFORMATION_MATH.WC_TO_NDC (GKS_STATE_LIST.
  9682.                     LIST_OF_NORMALIZATION_TRANSFORMATIONS
  9683.                    (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  9684.                    .NDC_FACTORS, FILL_AREA_POINTS);
  9685.      
  9686.       GKS_INSTR.FILL_AREA_POINTS := new NDC.POINT_ARRAY'(NDC_POINTS);
  9687.      
  9688.       WS_MANAGER (GKS_INSTR);
  9689.      
  9690.       FREE_POINT_ARRAY(GKS_INSTR.FILL_AREA_POINTS);
  9691.      
  9692.    end if;
  9693.      
  9694.    exception
  9695.       when STATE_ERROR =>
  9696.          raise;
  9697.       when OUTPUT_PRIMITIVE_ERROR =>
  9698.          raise;
  9699.       when NUMERIC_ERROR =>
  9700.          ERROR_LOGGING (ARITHMETIC, "FILL_AREA");          -- Error 308
  9701.          raise SYSTEM_ERROR;
  9702.       when OTHERS =>
  9703.          ERROR_LOGGING (UNKNOWN, "FILL_AREA");             -- Error 2501
  9704.          raise;
  9705.      
  9706. end FILL_AREA;
  9707. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9708. --:UDD:GKSADACM:CODE:MA:OPEN_GKS_S.ADA
  9709. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9710. ------------------------------------------------------------------
  9711. --
  9712. --  NAME: OPEN_GKS
  9713. --  IDENTIFIER: GIMXXX.1(1)
  9714. --  DISCREPANCY REPORTS:
  9715. --
  9716. ------------------------------------------------------------------
  9717. -- file:  open_gks_s.ada
  9718. -- level: all_levels
  9719.      
  9720. with TEXT_IO;
  9721.      
  9722. separate (GKS_CONTROL)
  9723.      
  9724. procedure OPEN_GKS
  9725.    (ERROR_FILE       : in ERROR_FILE_TYPE :=
  9726.                        GKS_CONFIGURATION.DEFAULT_ERROR_FILE;
  9727.     AMOUNT_OF_MEMORY : in MEMORY_UNITS    :=
  9728.                        GKS_CONFIGURATION.MAX_MEMORY_UNITS) is
  9729.      
  9730. -- This function initializes GKS.  It must be invoked
  9731. -- before any other GKS function.  The GKS state list is
  9732. -- allocated and intialised and the GKS description table
  9733. -- and the workstation description tables are made avail-
  9734. -- able.  The operating state is set to GKOP = "GKS open"
  9735. -- in the GKS state list.
  9736. --
  9737. -- The procedure checks if the operating state is set to
  9738. -- GKCL in the GKS_OPERATING_STATE_LIST. If it is not GKCL,
  9739. -- error 1 occurs and the exception STATE_ERROR is raised.
  9740. --
  9741. -- ERROR_FILE - User-defined file for reporting errors detected by GKS.
  9742. -- AMOUNT_OF_MEMORY - Required by GKS but currently ignored.
  9743.      
  9744. begin
  9745.      
  9746.    -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  9747.    -- to see if GKS is in the proper state before proceeding.
  9748.      
  9749.    if CURRENT_OPERATING_STATE /= GKCL then
  9750.       ERROR_LOGGING (NOT_GKCL, "OPEN_GKS"); -- Error 1
  9751.       raise STATE_ERROR;
  9752.      
  9753.    else
  9754.      
  9755.    -- If a TEXT_IO exception occurs after the following statement
  9756.    -- the control jumps to the exception handler.
  9757.      
  9758.       TEXT_IO.CREATE (GKS_ERROR_STATE_LIST.ERROR_DATA,
  9759.                       TEXT_IO.OUT_FILE,
  9760.                       ERROR_FILE);
  9761.      
  9762.       GKS_STATE_LIST.INITIALIZE;
  9763.       CURRENT_OPERATING_STATE := GKOP;
  9764.      
  9765.    end if;
  9766.      
  9767.    exception
  9768.       when STATE_ERROR =>
  9769.          raise;
  9770.      
  9771.       -- The following exceptions occur if the error file name passed
  9772.       -- in is invalid.  The error indicator 200 occurs and the
  9773.       -- exception MISC_ERROR is raised to the user.
  9774.      
  9775.       when TEXT_IO.NAME_ERROR | TEXT_IO.STATUS_ERROR | TEXT_IO.USE_ERROR =>
  9776.      
  9777.          -- Create the error file with the implementation default file.
  9778.          TEXT_IO.CREATE (GKS_ERROR_STATE_LIST.ERROR_DATA,
  9779.                          TEXT_IO.OUT_FILE,
  9780.                          GKS_CONFIGURATION.DEFAULT_ERROR_FILE);
  9781.      
  9782.          GKS_STATE_LIST.INITIALIZE;
  9783.          CURRENT_OPERATING_STATE := GKOP;
  9784.          ERROR_LOGGING (INVALID_ERROR_FILE, "OPEN_GKS"); -- Error 200
  9785.          raise MISC_ERROR;
  9786.      
  9787.       when OTHERS =>
  9788.          ERROR_LOGGING (UNKNOWN, "OPEN_GKS");   -- Error 2501
  9789.          raise;
  9790.      
  9791. end OPEN_GKS;
  9792. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9793. --:UDD:GKSADACM:CODE:MA:OPEN_WS_S.ADA
  9794. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9795. ------------------------------------------------------------------
  9796. --
  9797. --  NAME: OPEN_WS
  9798. --  IDENTIFIER: GIMXXX.1(1)
  9799. --  DISCREPANCY REPORTS:
  9800. --
  9801. ------------------------------------------------------------------
  9802. -- file:  open_ws_s.ada
  9803. -- level: all levels
  9804.      
  9805. with OUTPUT_ATTRIBUTES_TYPE;
  9806. with GET_OUTPUT_ATTRIBUTES;
  9807.      
  9808. separate (WS_CONTROL)
  9809.      
  9810. procedure OPEN_WS
  9811.    (WS        : in WS_ID;
  9812.    CONNECTION : in CONNECTION_ID;
  9813.    TYPE_OF_WS : in WS_TYPE) is
  9814.      
  9815. -- This procedure calls the workstation manager to open
  9816. -- a workstation and thus add it to the set of open
  9817. -- workstations in the GKS_STATE_LIST.  This procedure
  9818. -- inquires the GKS_OPERATING_STATE_LIST for the GKS
  9819. -- operating state.  If GKS is not in the proper state,
  9820. -- error 8 occurs and the procedure raises the exception
  9821. -- STATE_ERROR.  If it is in the proper state, this procedure
  9822. -- inquires the GKS_STATE_LIST to check if the WS is already
  9823. -- open.  If it is, error 24 occurs and the procedure raises
  9824. -- the exception WS_ERROR. Then the call to the WS_MANAGER is
  9825. -- made.  If no errors occur, this procedure sets the operating
  9826. -- state to WSOP = "at least one workstation open." If errors
  9827. -- 21, 22, 26 or 28 are returned by the workstation manager,
  9828. -- this procedure will raise the exception WS_ERROR.
  9829. --
  9830. -- WS - Workstation to be opened.
  9831. -- CONNECTION - The physical identifier associated with the logical
  9832. --    WS identifier.
  9833. -- TYPE_OF_WS - Indicates the type of workstation being opened.
  9834.      
  9835. GKS_INSTR : CGI_OPEN_WS;
  9836.      
  9837. OPEN_WS_ATTRIBUTES : OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  9838.      
  9839. begin
  9840.      
  9841.    -- The following if structure inquires the GKS_OPERATING_STATE_
  9842.    -- LIST to see if GKS is in the proper state. Then it inquires
  9843.    -- the GKS_STATE_LIST to make sure the WS is not in the set of open
  9844.    -- workstations.
  9845.      
  9846.    if (CURRENT_OPERATING_STATE = GKCL) then
  9847.       ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP, "OPEN_WS");  -- Error 8
  9848.       raise STATE_ERROR;
  9849.      
  9850.    elsif WS_IDS.IS_IN_LIST (WS, GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  9851.       ERROR_LOGGING (WS_IS_OPEN, "OPEN_WS");          -- Error 24
  9852.       raise WS_ERROR;
  9853.      
  9854.    elsif WS_IDS.SIZE_OF_LIST (GKS_STATE_LIST.LIST_OF_OPEN_WS) =
  9855.       GKS_DESCRIPTION_TABLE.MAX_OPEN_WS then
  9856.       ERROR_LOGGING (MAX_NUM_OF_OPEN_WS, "OPEN_WS");  -- Error 42
  9857.       raise WS_ERROR;
  9858.      
  9859.    else
  9860.       GKS_INSTR.WS_TO_OPEN := WS;
  9861.       GKS_INSTR.CONNECTION_OPEN := new CONNECTION_ID'(CONNECTION);
  9862.       GKS_INSTR.TYPE_OF_WS_OPEN := TYPE_OF_WS;
  9863.      
  9864.       GET_OUTPUT_ATTRIBUTES.GET_ATTRIBUTES (OPEN_WS_ATTRIBUTES);
  9865.       GKS_INSTR.ATTRIBUTES_AT_OPEN := OPEN_WS_ATTRIBUTES;
  9866.       WS_MANAGER (GKS_INSTR);
  9867.      
  9868.       FREE_CONNECTION_ID (GKS_INSTR.CONNECTION_OPEN);
  9869.      
  9870.       if GKS_INSTR.EI /= SUCCESSFUL then                    -- Error 0
  9871.          if (GKS_INSTR.EI = INVALID_CONN_ID) or             -- Error 21
  9872.             (GKS_INSTR.EI = WS_CANNOT_OPEN) or              -- Error 26
  9873.             (GKS_INSTR.EI = WISS_ALREADY_OPEN) then         -- Error 28
  9874.             ERROR_LOGGING (GKS_INSTR.EI, "OPEN_WS");
  9875.             raise WS_ERROR;
  9876.          end if;
  9877.      
  9878.       else
  9879.          WS_IDS.ADD_TO_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS);
  9880.      
  9881.          if CURRENT_OPERATING_STATE = GKOP then
  9882.             CURRENT_OPERATING_STATE := WSOP;
  9883.          end if;
  9884.      
  9885.       end if;
  9886.      
  9887.    end if;
  9888.      
  9889.    exception
  9890.       when STATE_ERROR =>
  9891.          raise;
  9892.       when WS_ERROR =>
  9893.          raise;
  9894.       when OTHERS =>
  9895.          ERROR_LOGGING (UNKNOWN, "OPEN_WS");          -- Error 2501
  9896.          raise;
  9897.      
  9898. end OPEN_WS;
  9899. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9900. --:UDD:GKSADACM:CODE:MA:PLIN_S.ADA
  9901. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9902. ------------------------------------------------------------------
  9903. --
  9904. --  NAME: POLYLINE
  9905. --  IDENTIFIER: GIMXXX.1(1)
  9906. --  DISCREPANCY REPORTS:
  9907. --
  9908. ------------------------------------------------------------------
  9909. -- file:  plin_s.ada
  9910. -- level: all levels
  9911.      
  9912. separate (OUTPUT_PRIMITIVES)
  9913.      
  9914. procedure POLYLINE
  9915.    (LINE_POINTS : in WC.POINT_ARRAY) is
  9916.      
  9917. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  9918. -- to check if GKS is in state WSAC or SGOP.  If it is not,
  9919. -- error 5 occurs and the exception STATE_ERROR is raised.  In
  9920. -- addition, it checks if the number of points is invalid.  If
  9921. -- so, error 100 occurs and the exception OUTPUT_PRIMITIVE_ERROR
  9922. -- is raised.  Otherwise, this procedure performs a normalization
  9923. -- transformation on the world coordinate points passed in and
  9924. -- passes the normalized device coordinates that result to the
  9925. -- workstation manager to draw a sequence of connected straight
  9926. -- lines.
  9927. --
  9928. -- LINE_POINTS - Provides the array of world coordinate points.
  9929.      
  9930. GKS_INSTR : CGI_POLYLINE;
  9931.      
  9932. NDC_POINTS : NDC.POINT_ARRAY(1..LINE_POINTS'LENGTH);
  9933. -- The above type was created to hold the transformed points.
  9934.      
  9935. begin
  9936.      
  9937.    -- The following if structure inquires the GKS_OPERATING_STATE_
  9938.    -- LIST to see if GKS is in the proper state. Then it checks to
  9939.    -- see that the number of points is valid before calling the
  9940.    -- WS_MANAGER.
  9941.      
  9942.    if (CURRENT_OPERATING_STATE /= WSAC) and
  9943.       (CURRENT_OPERATING_STATE /= SGOP) then
  9944.       ERROR_LOGGING (NOT_WSAC_SGOP, "POLYLINE");            -- Error 5
  9945.       raise STATE_ERROR;
  9946.      
  9947.    elsif LINE_POINTS'LENGTH < 2 then
  9948.       ERROR_LOGGING (INVALID_NUMBER_OF_POINTS, "POLYLINE"); -- Error 100
  9949.       raise OUTPUT_PRIMITIVE_ERROR;
  9950.      
  9951.    else
  9952.      
  9953.       -- The following logic will perform a transformation on the
  9954.       -- points from world coordinates to normalized device coordinates.
  9955.      
  9956.       NDC_POINTS := TRANSFORMATION_MATH.WC_TO_NDC (GKS_STATE_LIST.
  9957.                     LIST_OF_NORMALIZATION_TRANSFORMATIONS
  9958.                    (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  9959.                    .NDC_FACTORS, LINE_POINTS);
  9960.      
  9961.       GKS_INSTR.LINE_POINTS := new NDC.POINT_ARRAY'(NDC_POINTS);
  9962.      
  9963.       WS_MANAGER (GKS_INSTR);
  9964.      
  9965.       FREE_POINT_ARRAY (GKS_INSTR.LINE_POINTS);
  9966.      
  9967.    end if;
  9968.      
  9969.    exception
  9970.       when STATE_ERROR =>
  9971.          raise;
  9972.       when OUTPUT_PRIMITIVE_ERROR =>
  9973.          raise;
  9974.       when NUMERIC_ERROR =>
  9975.          ERROR_LOGGING (ARITHMETIC, "POLYLINE");          -- Error 308
  9976.          raise SYSTEM_ERROR;
  9977.       when OTHERS =>
  9978.          ERROR_LOGGING (UNKNOWN, "POLYLINE");             -- Error 2501
  9979.          raise;
  9980.      
  9981. end POLYLINE;
  9982. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9983. --:UDD:GKSADACM:CODE:MA:PMRK_S.ADA
  9984. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  9985. ------------------------------------------------------------------
  9986. --
  9987. --  NAME: POLYMARKER
  9988. --  IDENTIFIER: GIMXXX.1(1)
  9989. --  DISCREPANCY REPORTS:
  9990. --
  9991. ------------------------------------------------------------------
  9992. -- file:  pmrk_s.ada
  9993. -- level: all levels
  9994.      
  9995. separate (OUTPUT_PRIMITIVES)
  9996.      
  9997. procedure POLYMARKER
  9998.    (MARKER_POINTS : in WC.POINT_ARRAY) is
  9999.      
  10000. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  10001. -- to check if GKS is in state WSAC or SGOP.  If it is not,
  10002. -- error 5 occurs and the exception STATE_ERROR is raised.  In
  10003. -- addition, it checks if the number of points is invalid.  If
  10004. -- so, error 100 occurs and the exception OUTPUT_PRIMITIVE_ERROR
  10005. -- is raised.  Otherwise, this procedure performs a normalization
  10006. -- transformation on the world coordinate points passed in and
  10007. -- passes the normalized device coordinates that result to the
  10008. -- workstation manager to draw a sequence of markers.
  10009. --
  10010. -- MARKER_POINTS - Provides the array of world coordinate points.
  10011.      
  10012. GKS_INSTR : CGI_POLYMARKER;
  10013.      
  10014. NDC_POINTS : NDC.POINT_ARRAY(1..MARKER_POINTS'LENGTH);
  10015. -- The above type was created to hold the transformed points.
  10016.      
  10017. begin
  10018.      
  10019.    -- The following if structure inquires the GKS_OPERATING_STATE_
  10020.    -- LIST to see if GKS is in the proper state. Then it checks to
  10021.    -- see that the number of points is valid before calling the
  10022.    -- WS_MANAGER.
  10023.      
  10024.    if (CURRENT_OPERATING_STATE /= WSAC) and
  10025.       (CURRENT_OPERATING_STATE /= SGOP) then
  10026.       ERROR_LOGGING (NOT_WSAC_SGOP, "POLYMARKER");  -- Error 5
  10027.       raise STATE_ERROR;
  10028.      
  10029.    elsif MARKER_POINTS'LENGTH < 1 then
  10030.       ERROR_LOGGING (INVALID_NUMBER_OF_POINTS, "POLYMARKER");-- Error 100
  10031.       raise OUTPUT_PRIMITIVE_ERROR;
  10032.      
  10033.    else
  10034.      
  10035.       -- The following logic will perform a transformation on the
  10036.       -- points from world coordinates to normalized device coordinates.
  10037.       NDC_POINTS := TRANSFORMATION_MATH.WC_TO_NDC (GKS_STATE_LIST.
  10038.                     LIST_OF_NORMALIZATION_TRANSFORMATIONS
  10039.                    (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  10040.                    .NDC_FACTORS, MARKER_POINTS);
  10041.      
  10042.       GKS_INSTR.MARKER_POINTS := new NDC.POINT_ARRAY'(NDC_POINTS);
  10043.      
  10044.       WS_MANAGER (GKS_INSTR);
  10045.      
  10046.       FREE_POINT_ARRAY (GKS_INSTR.MARKER_POINTS);
  10047.      
  10048.    end if;
  10049.      
  10050.    exception
  10051.       when STATE_ERROR =>
  10052.          raise;
  10053.       when OUTPUT_PRIMITIVE_ERROR =>
  10054.          raise;
  10055.       when NUMERIC_ERROR =>
  10056.          ERROR_LOGGING (ARITHMETIC, "POLYMARKER");         -- Error 308
  10057.          raise SYSTEM_ERROR;
  10058.       when OTHERS =>
  10059.          ERROR_LOGGING (UNKNOWN, "POLYMARKER");            -- Error 2501
  10060.          raise;
  10061.      
  10062. end POLYMARKER;
  10063. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10064. --:UDD:GKSADACM:CODE:MA:TXT_S.ADA
  10065. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10066. ------------------------------------------------------------------
  10067. --
  10068. --  NAME: TEXT
  10069. --  IDENTIFIER: GIMXXX.1(1)
  10070. --  DISCREPANCY REPORTS:
  10071. --
  10072. ------------------------------------------------------------------
  10073. -- file:  txt_s.ada
  10074. -- levels: all levels
  10075.      
  10076. separate (OUTPUT_PRIMITIVES)
  10077.      
  10078. procedure TEXT
  10079.    (POSITION   : in WC.POINT;
  10080.    TEXT_STRING : in STRING) is
  10081.      
  10082. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  10083. -- to check if GKS is in one of the states WSAC or SGOP.  If
  10084. -- it is not, error 5 occurs and the exception STATE_ERROR is
  10085. -- raised.  Otherwise, the procedure does a normalization
  10086. -- transformation on the world coordinate point passed in
  10087. -- as the text position.  The resulting normalized device
  10088. -- coordinates and the text string are passed to the work-
  10089. -- station manager to be clipped and generated on the output.
  10090. -- If the WS_MANAGER returns error_indicator 101, this procedure
  10091. -- will raise the exception OUTPUT_PRIMITIVE_ERROR.
  10092. --
  10093. -- POSITION - This is a point in world coordinates at which the
  10094. --    text begins.
  10095. -- TEXT_STRING - This is text to be displayed.
  10096.      
  10097. GKS_INSTR : CGI_TEXT;
  10098.      
  10099. begin
  10100.      
  10101.    -- The following if structure inquires the GKS_OPERATING_STATE_
  10102.    -- LIST to see if GKS is in the proper state.
  10103.      
  10104.    if (CURRENT_OPERATING_STATE /= WSAC) and
  10105.       (CURRENT_OPERATING_STATE /= SGOP) then
  10106.       ERROR_LOGGING (NOT_WSAC_SGOP, "TEXT");    -- Error 5
  10107.       raise STATE_ERROR;
  10108.      
  10109.    else
  10110.       GKS_INSTR.TEXT_STRING := new STRING'(TEXT_STRING);
  10111.      
  10112.       -- The following logic will perform a transformation on the
  10113.       -- point from world coordinates to normalized device coordinates.
  10114.      
  10115.       GKS_INSTR.TEXT_POSITION := TRANSFORMATION_MATH.WC_TO_NDC
  10116.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  10117.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  10118.          .NDC_FACTORS, POSITION);
  10119.      
  10120.       WS_MANAGER (GKS_INSTR);
  10121.      
  10122.       FREE_STRING (GKS_INSTR.TEXT_STRING);
  10123.      
  10124.       if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  10125.          if GKS_INSTR.EI = INVALID_STRING_CODE then   -- Error 101
  10126.             ERROR_LOGGING (GKS_INSTR.EI, "TEXT");
  10127.             raise OUTPUT_PRIMITIVE_ERROR;
  10128.          end if;
  10129.       end if;
  10130.      
  10131.    end if;
  10132.      
  10133.    exception
  10134.       when STATE_ERROR =>
  10135.          raise;
  10136.       when OUTPUT_PRIMITIVE_ERROR =>
  10137.          raise;
  10138.       when NUMERIC_ERROR =>
  10139.          ERROR_LOGGING (ARITHMETIC, "TEXT");          -- Error 308
  10140.          raise SYSTEM_ERROR;
  10141.       when OTHERS =>
  10142.          ERROR_LOGGING (UNKNOWN, "TEXT");             -- Error 2501
  10143.          raise;
  10144.      
  10145. end TEXT;
  10146. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10147. --:UDD:GKSADACM:CODE:MA:UP_WS_S.ADA
  10148. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10149. ------------------------------------------------------------------
  10150. --
  10151. --  NAME: UPDATE_WS
  10152. --  IDENTIFIER: GIMXXX.1(1)
  10153. --  DISCREPANCY REPORTS:
  10154. --
  10155. ------------------------------------------------------------------
  10156. -- file:  up_ws_s.ada
  10157. -- level: all levels
  10158.      
  10159. separate (WS_CONTROL)
  10160.      
  10161. procedure UPDATE_WS
  10162.    (WS          : in WS_ID;
  10163.    REGENERATION : in UPDATE_REGENERATION_FLAG) is
  10164.      
  10165. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  10166. -- to check if GKS is states WSOP, WSAC, or SGOP.  If it is not
  10167. -- then error 7 occurs, and the exception STATE_ERROR is raised.
  10168. -- Then this procedure inquires the GKS_STATE_LIST to see if the
  10169. -- WS is open.  If it is not, error 25 occurs and the exception
  10170. -- WS_ERROR is raised.
  10171. --
  10172. -- Otherwise, this procedure calls the workstation manager to
  10173. -- update the workstation.  If the workstation manager returns
  10174. -- error 33, 35, or 36 this procedure raises the exception WS_ERROR.
  10175. --
  10176. -- WS - This is the identifier of the workstation that is
  10177. --    to be updated.
  10178. -- REGENERATION - This flag may have one of two values, PERFORM
  10179. --    or POSTPONE to indicate the regeneration action on the
  10180. --    display.
  10181.      
  10182. GKS_INSTR : CGI_UPDATE_WS;
  10183.      
  10184. begin
  10185.      
  10186.    -- The following if structure inquires the GKS_OPERATING_STATE_
  10187.    -- LIST to see if GKS is in the proper state. Then it inquires
  10188.    -- the GKS_STATE_LIST to see if the WS is in the set of open
  10189.    -- workstations before calling the WS_MANAGER.
  10190.      
  10191.    if (CURRENT_OPERATING_STATE = GKCL) or
  10192.       (CURRENT_OPERATING_STATE = GKOP) then
  10193.       ERROR_LOGGING (NOT_WSOP_WSAC_SGOP, "UPDATE_WS");  -- Error 7
  10194.       raise STATE_ERROR;
  10195.      
  10196.    elsif not WS_IDS.IS_IN_LIST(WS, GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  10197.       ERROR_LOGGING (WS_NOT_OPEN, "UPDATE_WS");         -- Error 25
  10198.       raise WS_ERROR;
  10199.      
  10200.    else
  10201.       GKS_INSTR.WS_TO_UPDATE := WS;
  10202.       GKS_INSTR.REGENERATION := REGENERATION;
  10203.       WS_MANAGER (GKS_INSTR);
  10204.      
  10205.       if GKS_INSTR.EI /= SUCCESSFUL then               -- Error 0
  10206.          if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or      -- Error 33
  10207.             (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) or   -- Error 35
  10208.             (GKS_INSTR.EI = WS_IS_WISS) then           -- Error 36
  10209.             ERROR_LOGGING (GKS_INSTR.EI, "UPDATE_WS");
  10210.             raise WS_ERROR;
  10211.          end if;
  10212.      
  10213.       end if;
  10214.      
  10215.    end if;
  10216.      
  10217.   exception
  10218.      when STATE_ERROR =>
  10219.         raise;
  10220.      when WS_ERROR =>
  10221.         raise;
  10222.      when SYSTEM_ERROR =>
  10223.         ERROR_LOGGING (ARITHMETIC,"UPDATE_WS");       -- Error 308
  10224.         raise;
  10225.      when OTHERS =>
  10226.         ERROR_LOGGING (UNKNOWN, "UPDATE_WS");         -- Error 2501
  10227.         raise;
  10228.      
  10229. end UPDATE_WS;
  10230. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10231. --:UDD:GKSADACM:CODE:0A:GKS_DSCR_TBL_0A_B.ADA
  10232. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10233. ------------------------------------------------------------------
  10234. --
  10235. --  NAME: GKS_DESCRIPTION_TABLE - BODY
  10236. --  IDENTIFIER: GIMXXX.1(2)
  10237. --  DISCREPANCY REPORTS:
  10238. --  DR036  Remove WISS_TYPE from level 1a.
  10239. ------------------------------------------------------------------
  10240. -- file:  gks_dscr_tlb_0a_b.ada
  10241. -- level: 0a
  10242.      
  10243. package body GKS_DESCRIPTION_TABLE is
  10244.      
  10245. -- This package body initializes the LIST_OF_AVAILABLE_WS_TYPES
  10246. -- variable listed in the specification part of the package.
  10247.      
  10248. WS_TYPE_ARRAY : WS_TYPES.LIST_VALUES(1..3);
  10249. -- This object is used to store the available workstation types
  10250. -- prior to their input into the LIST_OF_AVAILABLE_WS_TYPES.
  10251.      
  10252. begin
  10253.      
  10254.    WS_TYPE_ARRAY := (WS_TYPE(GKS_CONFIGURATION.
  10255.                     LEXIDATA_3700_OUTPUT_TYPE,
  10256.                     WS_TYPE(GKS_CONFIGURATION.GKSM_MO,
  10257.                     WS_TYPE(GKS_CONFIGURATION.GKSM_MI));
  10258.      
  10259.    LIST_OF_AVAILABLE_WS_TYPES := WS_TYPES.LIST (WS_TYPE_ARRAY);
  10260.      
  10261. end GKS_DESCRIPTION_TABLE;
  10262. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10263. --:UDD:GKSADACM:CODE:0A:PIXELS_B.ADA
  10264. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10265. ------------------------------------------------------------------
  10266. --
  10267. --  NAME: PIXELS - BODY
  10268. --  IDENTIFIER: GIMXXX.1(2)
  10269. --  DISCREPANCY REPORTS:
  10270. --  DR032  INQ_PIXEL_ARRAY constraint error.
  10271. ------------------------------------------------------------------
  10272. -- file:  pixels_b.ada
  10273. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  10274.      
  10275. with WSM;
  10276. with CGI;
  10277. with GKS_OPERATING_STATE_LIST;
  10278. with GKS_ERRORS;
  10279. with GKS_STATE_LIST;
  10280. with TRANSFORMATION_MATH;
  10281.      
  10282. use WSM;
  10283. use CGI;
  10284. use GKS_OPERATING_STATE_LIST;
  10285. use GKS_ERRORS;
  10286.      
  10287. package body PIXELS is
  10288.      
  10289. -- This is the package body providing the procedures to call the
  10290. -- workstation manager to inquire information about pixels.
  10291. --
  10292. -- Each of the procedures in this package inquires the
  10293. -- GKS_OPERATING_STATE_LIST to check if GKS is in one
  10294. -- of the states WSOP, WSAC, or SGOP.  If is not, error
  10295. -- indicator 7 occurs but no exception is raised.  In addition,
  10296. -- each procedure inquires the GKS_STATE_LIST to see if the
  10297. -- workstation is in the set of open workstations.  If it is not,
  10298. -- error indicator 25 occurs but no exception is raised.
  10299.      
  10300.    procedure INQ_PIXEL_ARRAY_DIMENSIONS
  10301.       (WS          : in WS_ID;
  10302.       CORNER_1_1   : in WC.POINT;
  10303.       CORNER_DX_DY : in WC.POINT;
  10304.       EI          : out ERROR_INDICATOR;
  10305.       DIMENSIONS  : out RASTER_UNIT_SIZE) is
  10306.      
  10307.    -- This procedure calls the workstation manager to obtain the
  10308.    -- dimensions of the pixel array.  If the inquired information
  10309.    -- is available, the error indicator is returned by the workstation
  10310.    -- manager as 0.  If the inquired information is not available, the
  10311.    -- workstation manager returns error 39 to indicate the reason
  10312.    -- for non-availability.
  10313.    --
  10314.    -- WS - Determines the specified workstation whose device
  10315.    --    coordinate resolution will be used to calculate the
  10316.    --    dimension of the pixel array.
  10317.    -- CORNER_1_1 - Specifies the lower left point of the inquired
  10318.    --    pixel array area.
  10319.    -- CORNER_DX_DY - Specifies the upper right point of the inquired
  10320.    --    pixel array area.
  10321.    -- EI - Returns an error code, if any.
  10322.    -- DIMENSIONS - Returns the dimensions in raster units of the
  10323.    --    inquired pixel area.
  10324.      
  10325.    GKS_INSTR : CGI_INQ_PIXEL_ARRAY_DIMENSIONS;
  10326.      
  10327.    begin
  10328.      
  10329.       -- The following if structure inquires the GKS_OPERATING_
  10330.       -- STATE_LIST to see if GKS is in the correct state.  Then
  10331.       -- it inquires the GKS_STATE_LIST to see if the WS is in the
  10332.       -- set of open workstations.  If both conditions are true,
  10333.       -- the call to the WS_MANAGER is made.
  10334.      
  10335.       if (CURRENT_OPERATING_STATE = GKCL) or
  10336.          (CURRENT_OPERATING_STATE = GKOP) then
  10337.          EI := NOT_WSOP_WSAC_SGOP;           -- Error 7
  10338.          DIMENSIONS := (X => RASTER_UNITS'FIRST,
  10339.                         Y => RASTER_UNITS'FIRST);
  10340.      
  10341.       elsif not WS_IDS.IS_IN_LIST (WS,GKS_STATE_LIST.LIST_OF_OPEN_WS)
  10342.          then
  10343.          EI := WS_NOT_OPEN;                  -- Error 25
  10344.          DIMENSIONS := (X => RASTER_UNITS'FIRST,
  10345.                         Y => RASTER_UNITS'FIRST);
  10346.      
  10347.       else
  10348.          GKS_INSTR.WS_TO_INQ_PIXEL_ARRAY_DIMENSIONS := WS;
  10349.      
  10350.          -- Transformation logic to transform the 2 points passed in
  10351.          -- from WC to NDC.
  10352.      
  10353.          GKS_INSTR.PIXEL_ARRAY_CORNER_1_1_INQ := TRANSFORMATION_MATH.
  10354.             WC_TO_NDC(GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  10355.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  10356.             .NDC_FACTORS, CORNER_1_1);
  10357.      
  10358.          GKS_INSTR.PIXEL_ARRAY_CORNER_DX_DY_INQ := TRANSFORMATION_MATH.
  10359.             WC_TO_NDC(GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  10360.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  10361.             .NDC_FACTORS, CORNER_DX_DY);
  10362.      
  10363.          WS_MANAGER (GKS_INSTR);
  10364.      
  10365.          if GKS_INSTR.EI /= SUCCESSFUL then             -- Error 0
  10366.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then  -- Error 39
  10367.                EI := GKS_INSTR.EI;
  10368.             else
  10369.                EI := UNKNOWN;                           -- Error 2501
  10370.             end if;
  10371.          else
  10372.             EI := GKS_INSTR.EI;
  10373.          end if;
  10374.      
  10375.          DIMENSIONS := GKS_INSTR.DIMENSIONS_INQ;
  10376.      
  10377.       end if;
  10378.      
  10379.       exception
  10380.          when NUMERIC_ERROR =>
  10381.             EI := ARITHMETIC;                         -- Error 308
  10382.      
  10383.    end INQ_PIXEL_ARRAY_DIMENSIONS;
  10384.      
  10385.    procedure INQ_PIXEL_ARRAY
  10386.       (WS            : in WS_ID;
  10387.       CORNER         : in WC.POINT;
  10388.       DX             : in RASTER_UNITS;
  10389.       DY             : in RASTER_UNITS;
  10390.       EI             : out ERROR_INDICATOR;
  10391.       INVALID_VALUES : out INVALID_VALUES_INDICATOR;
  10392.       LAST_X         : out NATURAL;
  10393.       LAST_Y         : out NATURAL;
  10394.       PIXEL_ARRAY    : out PIXEL_COLOUR_MATRICES.VARIABLE_MATRIX_OF) is
  10395.      
  10396.    -- This procedure calls the workstation manager to obtain the
  10397.    -- presence of invalid values and the colour index array.  If
  10398.    -- the inquired information is available, the error indicator
  10399.    -- is returned by the workstation manager as 0.  If the inquired
  10400.    -- information is not available, the workstation manager returns
  10401.    -- either error 39, or 40 to indicate the reason for non-
  10402.    -- availability.
  10403.    --
  10404.    -- WS - Determines the specified workstation whose pixels
  10405.    --    will be inquired for colour values.
  10406.    -- CORNER - The point in WC that will be transformed to NDC and
  10407.    --    sent to CGI as the initial point where the pixels will
  10408.    --    be inquired for colour values.
  10409.    -- DX, DY - These parameters were originally meant to provide the
  10410.    --    dimensions of the PIXEL_ARRAY.  Since the PIXEL_ARRAY variable
  10411.    --    has the DX and DY as discriminants, these parameters are
  10412.    --    essentially ignored.
  10413.    -- EI - Returns the error code, if any.
  10414.    -- INVALID_VALUES - A flag to indicate the presence of pixels
  10415.    --    which had been transformed outside the workstation's
  10416.    --    viewport.
  10417.    -- LAST_X, LAST_Y - These are the actual dimensions of the pixel
  10418.    --    matrix.  The parameters were added for this implementation to
  10419.    --    notify the application of the extent of the true pixel colour
  10420.    --    indices returned.
  10421.    -- PIXEL_ARRAY - The array of colour values of the pixel area
  10422.    --    inquired on the workstation.
  10423.      
  10424.    GKS_INSTR : CGI_INQ_PIXEL_ARRAY;
  10425.      
  10426.    INVALID_PIXEL_ARRAY : PIXEL_COLOUR_MATRICES.VARIABLE_MATRIX_OF
  10427.                          (PIXEL_ARRAY.DX,PIXEL_ARRAY.DY);
  10428.      
  10429.    begin
  10430.      
  10431.       -- The following if structure inquires the GKS_OPERATING_
  10432.       -- STATE_LIST to see if GKS is in the correct state.  Then
  10433.       -- it inquires the GKS_STATE_LIST to see if the WS is in the
  10434.       -- set of open workstations.  If both conditions are true,
  10435.       -- the call to the WS_MANAGER is made.
  10436.      
  10437.       if (CURRENT_OPERATING_STATE = GKCL) or
  10438.          (CURRENT_OPERATING_STATE = GKOP) then
  10439.          EI := NOT_WSOP_WSAC_SGOP;           -- Error 7
  10440.          INVALID_VALUES := INVALID_VALUES_INDICATOR'FIRST;
  10441.          PIXEL_ARRAY := INVALID_PIXEL_ARRAY;
  10442.      
  10443.       elsif not WS_IDS.IS_IN_LIST (WS,GKS_STATE_LIST.LIST_OF_OPEN_WS)
  10444.          then
  10445.          EI := WS_NOT_OPEN;                  -- Error 25
  10446.          INVALID_VALUES := INVALID_VALUES_INDICATOR'FIRST;
  10447.          PIXEL_ARRAY := INVALID_PIXEL_ARRAY;
  10448.      
  10449.       else
  10450.      
  10451.          GKS_INSTR.WS_TO_INQ_PIXEL_ARRAY := WS;
  10452.      
  10453.          -- Transformation logic to transform the point passed in
  10454.          -- from WC to NDC.
  10455.      
  10456.          GKS_INSTR.PIXEL_ARRAY_CORNER_INQ:=TRANSFORMATION_MATH.WC_TO_NDC
  10457.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  10458.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  10459.             .NDC_FACTORS, CORNER);
  10460.      
  10461.          GKS_INSTR.DX_INQ := RASTER_UNITS(PIXEL_ARRAY.DX);
  10462.          GKS_INSTR.DY_INQ := RASTER_UNITS(PIXEL_ARRAY.DY);
  10463.      
  10464.          WS_MANAGER (GKS_INSTR);
  10465.      
  10466.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  10467.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) or        -- Error 39
  10468.                (GKS_INSTR.EI = WS_CANNOT_PIXEL_READBACK) then -- Error 40
  10469.                EI := GKS_INSTR.EI;
  10470.             else
  10471.                EI := UNKNOWN;                 -- Error 2501
  10472.             end if;
  10473.          else
  10474.             EI := GKS_INSTR.EI;               -- Error 0
  10475.          end if;
  10476.      
  10477.          INVALID_VALUES := GKS_INSTR.INVALID_VALUES_INQ;
  10478.          LAST_X := NATURAL(GKS_INSTR.PIXEL_ARRAY_INQ'LENGTH(1));
  10479.          LAST_Y := NATURAL(GKS_INSTR.PIXEL_ARRAY_INQ'LENGTH(2));
  10480.      
  10481.          if (PIXEL_ARRAY.DX < SMALL_NATURAL(GKS_INSTR.
  10482.             PIXEL_ARRAY_INQ'LENGTH(1))) then
  10483.             for INDEX1 in POSITIVE(1) .. POSITIVE(PIXEL_ARRAY.DX) loop
  10484.                 if PIXEL_ARRAY.DY < SMALL_NATURAL(GKS_INSTR.
  10485.                    PIXEL_ARRAY_INQ'LENGTH(2)) then
  10486.                    for INDEX2 in POSITIVE(1) .. POSITIVE(PIXEL_ARRAY.DY)
  10487.                    loop
  10488.                       PIXEL_ARRAY.MATRIX(INDEX1,INDEX2) :=
  10489.                               GKS_INSTR.PIXEL_ARRAY_INQ(INDEX1,INDEX2);
  10490.                     end loop;
  10491.                  else
  10492.                     for INDEX2 in POSITIVE(1) .. POSITIVE(GKS_INSTR.
  10493.                        PIXEL_ARRAY_INQ'LENGTH(2)) loop
  10494.                        PIXEL_ARRAY.MATRIX(INDEX1,INDEX2) :=
  10495.                            GKS_INSTR.PIXEL_ARRAY_INQ(INDEX1,INDEX2);
  10496.                     end loop;
  10497.                  end if;
  10498.             end loop;
  10499.          else
  10500.              for INDEX1 in POSITIVE(1) .. POSITIVE(GKS_INSTR.
  10501.                 PIXEL_ARRAY_INQ'LENGTH(1)) loop
  10502.                 if PIXEL_ARRAY.DY < SMALL_NATURAL(GKS_INSTR.
  10503.                    PIXEL_ARRAY_INQ'LENGTH(2)) then
  10504.                    for INDEX2 in POSITIVE(1) .. POSITIVE(PIXEL_ARRAY.DY)
  10505.                    loop
  10506.                       PIXEL_ARRAY.MATRIX(INDEX1,INDEX2) :=
  10507.                            GKS_INSTR.PIXEL_ARRAY_INQ(INDEX1,INDEX2);
  10508.                    end loop;
  10509.                  else
  10510.                     for INDEX2 in POSITIVE(1) .. POSITIVE(GKS_INSTR.
  10511.                        PIXEL_ARRAY_INQ'LENGTH(2)) loop
  10512.                        PIXEL_ARRAY.MATRIX(INDEX1,INDEX2) :=
  10513.                            GKS_INSTR.PIXEL_ARRAY_INQ(INDEX1,INDEX2);
  10514.                     end loop;
  10515.                  end if;
  10516.             end loop;
  10517.          end if;
  10518.      
  10519.          FREE_PIXEL_COLOUR_MATRIX (GKS_INSTR.PIXEL_ARRAY_INQ);
  10520.      
  10521.       end if;
  10522.      
  10523.       exception
  10524.          when NUMERIC_ERROR =>
  10525.             EI := ARITHMETIC;              -- Error 308
  10526.             INVALID_VALUES := INVALID_VALUES_INDICATOR'FIRST;
  10527.             PIXEL_ARRAY := INVALID_PIXEL_ARRAY;
  10528.      
  10529.    end INQ_PIXEL_ARRAY;
  10530.      
  10531.    procedure INQ_PIXEL
  10532.       (WS    : in WS_ID;
  10533.       POINT  : in WC.POINT;
  10534.       EI     : out ERROR_INDICATOR;
  10535.       COLOUR : out PIXEL_COLOUR_INDEX) is
  10536.      
  10537.    -- This procedure calls the workstation manager to obtain the
  10538.    -- colour index of the pixel.  If the inquired information is
  10539.    -- available, the error indicator is returned by the workstation
  10540.    -- manager as 0.  If the inquired information is not available,
  10541.    -- the error indicator is set to 39, or 40 to indicate the
  10542.    -- reason for non-availability.
  10543.    --
  10544.    -- WS - The specified workstation.
  10545.    -- POINT - The WC point which when transformed to NDC will be
  10546.    --    passed to WS_MANAGER for inquiring the DC pixel colour.
  10547.    -- EI - returns the error code, if any.
  10548.    -- COLOUR - Returns the colour of the pixel of a valid point
  10549.    --    on the workstation viewport.
  10550.      
  10551.    GKS_INSTR : CGI_INQ_PIXEL;
  10552.      
  10553.    begin
  10554.      
  10555.       -- The following if structure inquires the GKS_OPERATING_
  10556.       -- STATE_LIST to see if GKS is in the correct state.  Then
  10557.       -- it inquires the GKS_STATE_LIST to see if the WS is in the
  10558.       -- set of open workstations.  If both conditions are true,
  10559.       -- the call to the WS_MANAGER is made.
  10560.      
  10561.       if (CURRENT_OPERATING_STATE = GKCL) or
  10562.          (CURRENT_OPERATING_STATE = GKOP) then
  10563.          EI := NOT_WSOP_WSAC_SGOP;           -- Error 7
  10564.          COLOUR := PIXEL_COLOUR_INDEX'FIRST;
  10565.      
  10566.       elsif not WS_IDS.IS_IN_LIST (WS,GKS_STATE_LIST.LIST_OF_OPEN_WS)
  10567.          then
  10568.          EI := WS_NOT_OPEN;                  -- Error 25
  10569.          COLOUR := PIXEL_COLOUR_INDEX'FIRST;
  10570.      
  10571.       else
  10572.          GKS_INSTR.WS_TO_INQ_PIXEL := WS;
  10573.      
  10574.          -- Transformation logic to transform the point passed in
  10575.          -- from WC to NDC.
  10576.      
  10577.          GKS_INSTR.PIXEL_POINT_INQ := TRANSFORMATION_MATH.WC_TO_NDC
  10578.             (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  10579.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  10580.             .NDC_FACTORS, POINT);
  10581.      
  10582.          WS_MANAGER (GKS_INSTR);
  10583.      
  10584.          if GKS_INSTR.EI /= SUCCESSFUL then                    -- Error 0
  10585.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) or         -- Error 39
  10586.                (GKS_INSTR.EI = WS_CANNOT_PIXEL_READBACK) then  -- Error 40
  10587.                EI := GKS_INSTR.EI;
  10588.             else
  10589.                EI := UNKNOWN;                         -- Error 2501
  10590.             end if;
  10591.          else
  10592.             EI := GKS_INSTR.EI;
  10593.          end if;
  10594.      
  10595.          COLOUR := GKS_INSTR.PIXEL_COLOUR_INQ;
  10596.      
  10597.       end if;
  10598.      
  10599.       exception
  10600.          when NUMERIC_ERROR =>
  10601.             EI := ARITHMETIC;
  10602.      
  10603.    end INQ_PIXEL;
  10604.      
  10605. end PIXELS;
  10606. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10607. --:UDD:GKSADACM:CODE:0A:INQ_GKS_DSCR_TBL_0AB.ADA
  10608. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10609. ------------------------------------------------------------------
  10610. --
  10611. --  NAME: INQ_GKS_DESCRIPTION_TABLE_0A
  10612. --  IDENTIFIER: GIMXXX.1(1)
  10613. --  DISCREPANCY REPORTS:
  10614. --
  10615. ------------------------------------------------------------------
  10616. -- file:  inq_gks_dscr_tbl_0ab.ada
  10617. -- level: 0a, 1a, 2a, 0b, 0c
  10618.      
  10619. with GKS_OPERATING_STATE_LIST;
  10620. with GKS_DESCRIPTION_TABLE;
  10621. with GKS_ERRORS;
  10622.      
  10623. use GKS_OPERATING_STATE_LIST;
  10624. use GKS_ERRORS;
  10625.      
  10626. package body INQ_GKS_DESCRIPTION_TABLE_0A is
  10627.      
  10628. -- This is the package body for the procedures to inquire the
  10629. -- GKS_DESCRIPTION_TABLE.
  10630. --
  10631. -- Each of the procedures in this package inquires the
  10632. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of
  10633. -- the states GKCL, GKOP, WSOP, WSAC, SGOP.  If it is not,
  10634. -- error 8 occurs but no exception is raised.
  10635.      
  10636.    procedure INQ_LIST_OF_AVAILABLE_WS_TYPES
  10637.       (EI   : out ERROR_INDICATOR;
  10638.       TYPES : out WS_TYPES.LIST_OF) is
  10639.      
  10640.    -- This procedure inquires the GKS_DESCRIPTION_TABLE to obtain the
  10641.    -- list of available workstation types.  If the inquired information
  10642.    -- is available, the error indicator is set to 0.
  10643.    --
  10644.    -- EI - This is the error indicator.  Its numeric value represents
  10645.    --    the type of error, if any, that occurred.
  10646.    -- TYPES - This is a list type of workstation types.  Its components
  10647.    --    are set for each one of the corresponding available workstation
  10648.    --    type is available.
  10649.      
  10650.    begin
  10651.      
  10652.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  10653.       -- to see if GKS is in the proper state before proceeding
  10654.       -- with the inquiry of the GKS_DESCRIPTION_TABLE.
  10655.      
  10656.       if CURRENT_OPERATING_STATE = GKCL then
  10657.          EI := NOT_GKOP_WSOP_WSAC_SGOP;   -- Error 8
  10658.          TYPES := WS_TYPES.NULL_LIST;
  10659.       else
  10660.          EI := SUCCESSFUL;                -- Error 0
  10661.          TYPES := GKS_DESCRIPTION_TABLE.LIST_OF_AVAILABLE_WS_TYPES;
  10662.       end if;
  10663.      
  10664.      
  10665.    end INQ_LIST_OF_AVAILABLE_WS_TYPES;
  10666.      
  10667.    procedure INQ_MAX_NORMALIZATION_TRANSFORMATION_NUMBER
  10668.       (EI : out ERROR_INDICATOR;
  10669.       TRANSFORMATION : out TRANSFORMATION_NUMBER) is
  10670.      
  10671.    -- This procedure inquires the GKS_DESCRIPTION_TABLE to obtain the
  10672.    -- maximum normalization transformation number.  If the inquired
  10673.    -- information is available, the error indicator is set to 0.
  10674.    --
  10675.    -- EI - This is the error indicator.  Its numeric value represents
  10676.    --    the type of error, if any, that occurred.
  10677.    -- TRANSFORMATION - This is an integer value representing the
  10678.    --    maximum transformation number available.
  10679.      
  10680.    begin
  10681.      
  10682.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  10683.       -- to see if GKS is in the proper state before proceeding
  10684.       -- with the inquiry of the GKS_DESCRIPTION_TABLE.
  10685.      
  10686.       if CURRENT_OPERATING_STATE = GKCL then
  10687.          EI := NOT_GKOP_WSOP_WSAC_SGOP;     -- Error 8
  10688.          TRANSFORMATION := TRANSFORMATION_NUMBER'FIRST;
  10689.       else
  10690.          EI := SUCCESSFUL;                  -- Error 0
  10691.          TRANSFORMATION := GKS_DESCRIPTION_TABLE.
  10692.                            MAX_NORMALIZATION_TRANSFORMATION_NUMBER;
  10693.       end if;
  10694.      
  10695.    end INQ_MAX_NORMALIZATION_TRANSFORMATION_NUMBER;
  10696.      
  10697. end INQ_GKS_DESCRIPTION_TABLE_0A;
  10698. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10699. --:UDD:GKSADACM:CODE:0A:INQ_GKS_ST_LST_0A_B.ADA
  10700. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10701. ------------------------------------------------------------------
  10702. --
  10703. --  NAME: INQ_GKS_STATE_LIST_0A - BODY
  10704. --  IDENTIFIER: GIMXXX.1(1)
  10705. --  DISCREPANCY REPORTS:
  10706. --
  10707. ------------------------------------------------------------------
  10708. -- file:  inq_gks_st_lst_0a_b.ada
  10709. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  10710.      
  10711. with GKS_OPERATING_STATE_LIST;
  10712. with GKS_STATE_LIST;
  10713. with GKS_ERRORS;
  10714.      
  10715. use GKS_ERRORS;
  10716. use GKS_OPERATING_STATE_LIST;
  10717. use GKS_ERRORS;
  10718.      
  10719. package body INQ_GKS_STATE_LIST_0A is
  10720.      
  10721. -- This is the package body for the procedures to inquire
  10722. -- the GKS_STATE_LIST at levels no lower than 0a.
  10723.      
  10724.    procedure INQ_OPERATING_STATE_VALUE
  10725.       (VALUE : out OPERATING_STATE) is
  10726.      
  10727.    -- This procedure inquires the GKS_OPERATING_STATE_LIST for
  10728.    -- the operating state.
  10729.    --
  10730.    -- VALUE - The value of this enumerated parameter may be GKCL,
  10731.    --    GKOP, WSOP, WSAC, or SGOP to indicate the current operating
  10732.    --    state of GKS.
  10733.      
  10734.    begin
  10735.      
  10736.       VALUE := CURRENT_OPERATING_STATE;
  10737.      
  10738.    end INQ_OPERATING_STATE_VALUE;
  10739.      
  10740.    procedure INQ_SET_OF_OPEN_WS
  10741.       (EI : out ERROR_INDICATOR;
  10742.       WS  : out WS_IDS.LIST_OF) is
  10743.      
  10744.    -- This procedure inquires the GKS_OPERATING_STATE_LIST to
  10745.    -- check if GKS is in one of the states GKOP, WSOP, WSAC,
  10746.    -- or SGOP.  If it is not, error 8 occurs and the procedure
  10747.    -- returns the error indicator only.  Otherwise, this procedure
  10748.    -- inquires the GKS_STATE_LIST for the set of open workstations.
  10749.    -- At levels ma and 0a, there need be only one workstation in the
  10750.    -- set.  If the inquired information is available, the error indi-
  10751.    -- cator is set to 0.
  10752.    --
  10753.    -- EI - This is the error indicator.  Its numeric value represents
  10754.    --    the type of error, if any, that occurred.
  10755.    -- WS - This is a set type of WS identifiers.
  10756.      
  10757.    begin
  10758.      
  10759.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  10760.       -- to see if GKS is in the proper state before proceeding
  10761.       -- with the inquiry of the GKS_STATE_LIST.
  10762.      
  10763.       if CURRENT_OPERATING_STATE = GKCL then
  10764.          EI := NOT_GKOP_WSOP_WSAC_SGOP;     -- Error 8
  10765.          WS := WS_IDS.NULL_LIST;
  10766.       else
  10767.          EI := SUCCESSFUL;                  -- Error 0
  10768.          WS := GKS_STATE_LIST.LIST_OF_OPEN_WS;
  10769.       end if;
  10770.      
  10771.    end INQ_SET_OF_OPEN_WS;
  10772.      
  10773.    procedure INQ_LIST_OF_NORMALIZATION_TRANSFORMATION_NUMBERS
  10774.       (EI  : out ERROR_INDICATOR;
  10775.       LIST : out TRANSFORMATION_PRIORITY_LIST) is
  10776.      
  10777.    -- This procedure inquires the GKS_OPERATING_STATE_LIST to
  10778.    -- check if GKS is in one of the states GKOP, WSOP, WSAC,
  10779.    -- or SGOP.  If it is not, error 8 occurs and the procedure
  10780.    -- returns the error indicator only.  Otherwise, this procedure
  10781.    -- inquires the GKS_STATE_LIST for the list of normalization
  10782.    -- transformation numbers.  The list is ordered by viewport input
  10783.    -- priority, starting with the highest priority tranformation
  10784.    -- number.  If the inquired information is available, the error indi-
  10785.    -- cator is set to 0.
  10786.    --
  10787.    -- EI - This is the error indicator.  Its numeric value represents
  10788.    --    the type of error, if any, that occurred.
  10789.    -- LIST - This is a list type of TRANSFORMATION_NUMBERS.
  10790.      
  10791.    INVALID_PRIORITY_LIST : TRANSFORMATION_PRIORITY_LIST;
  10792.      
  10793.    begin
  10794.      
  10795.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  10796.       -- to see if GKS is in the proper state before proceeding
  10797.       -- with the inquiry of the GKS_STATE_LIST.
  10798.      
  10799.       if CURRENT_OPERATING_STATE = GKCL then
  10800.          EI := NOT_GKOP_WSOP_WSAC_SGOP;       -- Error 8
  10801.          LIST := INVALID_PRIORITY_LIST;
  10802.       else
  10803.          EI := SUCCESSFUL;                    -- Error 0
  10804.          LIST := GKS_STATE_LIST.PRIORITY_LIST_OF_TRANSFORMATIONS;
  10805.       end if;
  10806.      
  10807.    end INQ_LIST_OF_NORMALIZATION_TRANSFORMATION_NUMBERS;
  10808.      
  10809. end INQ_GKS_STATE_LIST_0A;
  10810. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10811. --:UDD:GKSADACM:CODE:0A:INQ_WS_DSCR_TBL_0A_B.ADA
  10812. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  10813. ------------------------------------------------------------------
  10814. --
  10815. --  NAME: INQ_WS_DESCRIPTION_TABLE_0A - BODY
  10816. --  IDENTIFIER: GIMXXX.1(2)
  10817. --  DISCREPANCY REPORTS:
  10818. --  DR022  Add error #85 back into GKS_ERRORS.
  10819. ------------------------------------------------------------------
  10820. -- file:  inq_ws_dscr_tbl_0a_b.ada
  10821. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  10822.      
  10823. with WSM;
  10824. with CGI;
  10825. with GKS_OPERATING_STATE_LIST;
  10826. with GKS_DESCRIPTION_TABLE;
  10827. with GKS_ERRORS;
  10828.      
  10829. use WSM;
  10830. use CGI;
  10831. use GKS_OPERATING_STATE_LIST;
  10832. use GKS_ERRORS;
  10833.      
  10834. package body INQ_WS_DESCRIPTION_TABLE_0A is
  10835.      
  10836. -- This is the package body for the procedures to call the workstation
  10837. -- manager to inquire the workstation description tables.
  10838. --
  10839. -- Each of the procedures in this package inquires the
  10840. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of the
  10841. -- states GKOP, WSOP, WSAC, or SGOP.  If it is not, error
  10842. -- 8 occurs but no exception is raised.
  10843.      
  10844.    procedure INQ_WS_CATEGORY
  10845.       (WS      : in WS_TYPE;
  10846.       EI       : out ERROR_INDICATOR;
  10847.       CATEGORY : out WS_CATEGORY) is
  10848.      
  10849.    -- This procedure calls the workstation manager to obtain the
  10850.    -- value of the workstation category from the workstation
  10851.    -- description table.  If the inquired information is available,
  10852.    -- the workstation manager returns the error indicator as 0.
  10853.    --
  10854.    -- WS - This is an integer value representing the type of
  10855.    --    workstation.
  10856.    -- EI - This is the error indicator.  Its numeric value represents
  10857.    --    the type of error, if any, that occurred.
  10858.    -- CATEGORY - The value of this enumerated parameter may be
  10859.    --    OUTPUT, INPUT, OUTIN, WISS, MO, or MI to indicate the
  10860.    --    category of the workstation.
  10861.      
  10862.    GKS_INSTR : CGI_INQ_WS_CATEGORY;
  10863.      
  10864.    begin
  10865.      
  10866.       -- The following if structure inquires the GKS_OPERATING
  10867.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  10868.       -- it checks to see if the WS exists by checking if it is
  10869.       -- in the list of available WS types in the GKS_DESCRIPTION_
  10870.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  10871.       -- called for the inquiry.
  10872.      
  10873.       if CURRENT_OPERATING_STATE = GKCL then
  10874.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  10875.          CATEGORY := WS_CATEGORY'FIRST;
  10876.      
  10877.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  10878.                                LIST_OF_AVAILABLE_WS_TYPES) then
  10879.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  10880.          CATEGORY := WS_CATEGORY'FIRST;
  10881.      
  10882.       else
  10883.          GKS_INSTR.WS_TO_INQ_CATEGORY := WS;
  10884.          WS_MANAGER (GKS_INSTR);
  10885.      
  10886.          if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  10887.             EI := UNKNOWN;                  -- Error 2501
  10888.          else
  10889.             EI := GKS_INSTR.EI;
  10890.          end if;
  10891.      
  10892.          CATEGORY := GKS_INSTR.WS_CATEGORY_INQ;
  10893.      
  10894.       end if;
  10895.      
  10896.    end INQ_WS_CATEGORY;
  10897.      
  10898.    procedure INQ_WS_CLASS
  10899.       (WS   : in WS_TYPE;
  10900.       EI    : out ERROR_INDICATOR;
  10901.       CLASS : out DISPLAY_CLASS) is
  10902.      
  10903.    -- This procedure calls the workstation manager to obtain the
  10904.    -- value of the workstation class from the workstation description
  10905.    -- table.  If the inquired information is available, the work-
  10906.    -- station manager returns the error indicator as 0.
  10907.    --
  10908.    -- WS - This is an integer value representing the type of
  10909.    --    workstation.
  10910.    -- EI - This is the error indicator.  Its numeric value represents
  10911.    --    the type of error, if any, that occurred.
  10912.    -- CLASS - The value of this parameter may be VECTOR_DISPLAY,
  10913.    --    RASTER_DISPLAY, or OTHER_DISPLAY to indicate the
  10914.    --    classification of a workstation of category OUTPUT or
  10915.    --    OUTIN.
  10916.      
  10917.    GKS_INSTR : CGI_INQ_WS_CLASS;
  10918.      
  10919.    begin
  10920.      
  10921.       -- The following if structure inquires the GKS_OPERATING
  10922.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  10923.       -- it checks to see if the WS exists by checking if it is
  10924.       -- in the list of available WS types in the GKS_DESCRIPTION_
  10925.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  10926.       -- called for the inquiry.
  10927.      
  10928.       if CURRENT_OPERATING_STATE = GKCL then
  10929.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  10930.          CLASS := DISPLAY_CLASS'FIRST;
  10931.      
  10932.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  10933.                                LIST_OF_AVAILABLE_WS_TYPES) then
  10934.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  10935.          CLASS := DISPLAY_CLASS'FIRST;
  10936.      
  10937.       else
  10938.          GKS_INSTR.WS_TO_INQ_CLASS := WS;
  10939.          WS_MANAGER (GKS_INSTR);
  10940.      
  10941.          if GKS_INSTR.EI /= SUCCESSFUL then              -- Error 0
  10942.             if GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN then   -- Error 39
  10943.                EI := GKS_INSTR.EI;
  10944.             else
  10945.                EI := UNKNOWN;                  -- Error 2501
  10946.             end if;
  10947.          else
  10948.             EI := GKS_INSTR.EI;
  10949.          end if;
  10950.      
  10951.          CLASS := GKS_INSTR.WS_CLASS_INQ;
  10952.      
  10953.       end if;
  10954.      
  10955.      
  10956.    end INQ_WS_CLASS;
  10957.      
  10958.    procedure INQ_PREDEFINED_POLYLINE_REPRESENTATION
  10959.       (WS    : in WS_TYPE;
  10960.       INDEX  : in POLYLINE_INDEX;
  10961.       EI     : out ERROR_INDICATOR;
  10962.       LINE   : out LINETYPE;
  10963.       WIDTH  : out LINE_WIDTH;
  10964.       COLOUR : out COLOUR_INDEX) is
  10965.      
  10966.    -- This procedure calls the workstation manager to obtain the
  10967.    -- value of the workstation predefined polyline information
  10968.    -- from the workstation description table.  This includes the
  10969.    -- linetype, linewidth scale factor, and the polyline colour
  10970.    -- index.  If the inquired information is available, the
  10971.    -- workstation manager returns the error indicator as 0.  If
  10972.    -- the inquired information is not available, the workstation
  10973.    -- manager returns the error indicator as 39, 60 or 62 to indicate
  10974.    -- the reason for non-availability.
  10975.    --
  10976.    -- WS - This is an integer value representing the type of
  10977.    --    workstation.
  10978.    -- INDEX - This is an integer value representing the index
  10979.    --    into the polyline tables.
  10980.    -- EI - This is the error indicator.  Its numeric value represents
  10981.    --    the type of error, if any, that occurred.
  10982.    -- LINE - This is an integer value representing the line type.
  10983.    -- WIDTH - This is a positive floating point value representing the
  10984.    --    nominal line width.
  10985.    -- COLOUR - This is an integer value representing an index into
  10986.    --    the colour tables.
  10987.      
  10988.    GKS_INSTR : CGI_INQ_PREDEFINED_POLYLINE_REPRESENTATION;
  10989.      
  10990.    begin
  10991.      
  10992.       -- The following if structure inquires the GKS_OPERATING
  10993.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  10994.       -- it checks to see if the WS exists by checking if it is
  10995.       -- in the list of available WS types in the GKS_DESCRIPTION_
  10996.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  10997.       -- called for the inquiry.
  10998.      
  10999.       if CURRENT_OPERATING_STATE = GKCL then
  11000.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  11001.          LINE := LINETYPE'FIRST;
  11002.          WIDTH := 0.0;
  11003.          COLOUR := COLOUR_INDEX'FIRST;
  11004.      
  11005.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  11006.                                LIST_OF_AVAILABLE_WS_TYPES then
  11007.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  11008.          LINE := LINETYPE'FIRST;
  11009.          WIDTH := 0.0;
  11010.          COLOUR := COLOUR_INDEX'FIRST;
  11011.      
  11012.       else
  11013.          GKS_INSTR.WS_TO_INQ_PRE_POLYLINE_REP := WS;
  11014.          GKS_INSTR.PRE_POLYLINE_INDEX_TO_INQ_PRE_POLYLINE_REP := INDEX;
  11015.          WS_MANAGER (GKS_INSTR);
  11016.      
  11017.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  11018.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) or       -- Error 39
  11019.                (GKS_INSTR.EI = INVALID_POLYLINE_INDEX) or    -- Error 60
  11020.                (GKS_INSTR.EI = NO_PREDEF_POLYLINE_REP) then  -- Error 62
  11021.                EI := GKS_INSTR.EI;
  11022.             else
  11023.                EI := UNKNOWN;                      -- Error 2501
  11024.             end if;
  11025.          else
  11026.             EI := GKS_INSTR.EI;
  11027.          end if;
  11028.      
  11029.          LINE := GKS_INSTR.PRE_POLYLINE_TYPE_INQ;
  11030.          WIDTH := GKS_INSTR.PRE_POLYLINE_WIDTH_INQ;
  11031.          COLOUR := GKS_INSTR.PRE_POLYLINE_COLOUR_INQ;
  11032.      
  11033.       end if;
  11034.      
  11035.    end INQ_PREDEFINED_POLYLINE_REPRESENTATION;
  11036.      
  11037.    procedure INQ_PREDEFINED_POLYMARKER_REPRESENTATION
  11038.       (WS    : in WS_TYPE;
  11039.       INDEX  : in POLYMARKER_INDEX;
  11040.       EI     : out ERROR_INDICATOR;
  11041.       MARKER : out MARKER_TYPE;
  11042.       SIZE   : out MARKER_SIZE;
  11043.       COLOUR : out COLOUR_INDEX) is
  11044.      
  11045.    -- This procedure calls the workstation manager to obtain the
  11046.    -- value of the workstation predefined polymarker information
  11047.    -- from the workstation description table.  This includes the
  11048.    -- marker type, marker size scale factor, and the polymarker
  11049.    -- colour index.  If the inquired information is available, the
  11050.    -- workstation manager returns the error indicator as 0.  If
  11051.    -- the inquired information is not available, the workstation
  11052.    -- manager returns the error indicator as 39, 66 or 68 to indicate
  11053.    -- the reason for non-availability.
  11054.    --
  11055.    -- WS - This is an integer value representing the type of
  11056.    --    workstation.
  11057.    -- INDEX - This is an integer value representing the index
  11058.    --    into the polymarker tables.
  11059.    -- EI - This is the error indicator.  Its numeric value represents
  11060.    --    the type of error, if any, that occurred.
  11061.    -- MARKER - This is an integer value representing the marker type.
  11062.    -- SIZE - This is a positive floating point value representing the
  11063.    --    nominal marker size.
  11064.    -- COLOUR - This is an integer value representing an index into
  11065.    --    the colour tables.
  11066.      
  11067.    GKS_INSTR : CGI_INQ_PREDEFINED_POLYMARKER_REPRESENTATION;
  11068.      
  11069.    begin
  11070.      
  11071.       -- The following if structure inquires the GKS_OPERATING
  11072.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  11073.       -- it checks to see if the WS exists by checking if it is
  11074.       -- in the list of available WS types in the GKS_DESCRIPTION_
  11075.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  11076.       -- called for the inquiry.
  11077.      
  11078.       if CURRENT_OPERATING_STATE = GKCL then
  11079.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  11080.          MARKER := MARKER_TYPE'FIRST;
  11081.          SIZE := 0.0;
  11082.          COLOUR := COLOUR_INDEX'FIRST;
  11083.      
  11084.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  11085.                                LIST_OF_AVAILABLE_WS_TYPES) then
  11086.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  11087.          MARKER := MARKER_TYPE'FIRST;
  11088.          SIZE := 0.0;
  11089.          COLOUR := COLOUR_INDEX'FIRST;
  11090.      
  11091.       else
  11092.          GKS_INSTR.WS_TO_INQ_PRE_POLYMARKER_REP := WS;
  11093.          GKS_INSTR.PRE_POLYMARKER_INDEX_TO_INQ_PRE_POLYMARKER_REP :=
  11094.             INDEX;
  11095.          WS_MANAGER (GKS_INSTR);
  11096.      
  11097.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  11098.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) or       -- Error 39
  11099.                (GKS_INSTR.EI = INVALID_POLYMARKER_INDEX) or  -- Error 66
  11100.                (GKS_INSTR.EI = NO_PREDEF_POLYMARKER_REP) then -- Error 68
  11101.                EI := GKS_INSTR.EI;
  11102.             else
  11103.                EI := UNKNOWN;                    -- Error 2501
  11104.             end if;
  11105.          else
  11106.             EI := GKS_INSTR.EI;
  11107.          end if;
  11108.      
  11109.          MARKER := GKS_INSTR.PRE_POLYMARKER_TYPE_INQ;
  11110.          SIZE   := GKS_INSTR.PRE_POLYMARKER_SIZE_INQ;
  11111.          COLOUR := GKS_INSTR.PRE_POLYMARKER_COLOUR_INQ;
  11112.      
  11113.       end if;
  11114.      
  11115.    end INQ_PREDEFINED_POLYMARKER_REPRESENTATION;
  11116.      
  11117.    procedure INQ_PREDEFINED_TEXT_REPRESENTATION
  11118.       (WS            : in WS_TYPE;
  11119.       INDEX          : in TEXT_INDEX;
  11120.       EI             : out ERROR_INDICATOR;
  11121.       FONT_PRECISION : out TEXT_FONT_PRECISION;
  11122.       EXPANSION      : out CHAR_EXPANSION;
  11123.       SPACING        : out CHAR_SPACING;
  11124.       COLOUR         : out COLOUR_INDEX) is
  11125.      
  11126.    -- This procedure calls the workstation manager to obtain the
  11127.    -- value of the workstation predefined text information from
  11128.    -- the workstation description table.  This includes the
  11129.    -- list of text font and precision pairs, the number of
  11130.    -- available character heights, the minimum and maximum char-
  11131.    -- acter heights, the number of available character expansion
  11132.    -- factors, and the number of predefined text indices.  If the
  11133.    -- inquired information is available, the workstation manager
  11134.    -- returns the error indicator as 0.  If the inquired information
  11135.    -- is not available, the workstation manager returns the error
  11136.    -- indicator as 39, 72 or 74 to indicate the reason for non-
  11137.    -- availability.
  11138.    --
  11139.    -- WS - This is an integer value representing the type of
  11140.    --    workstation.
  11141.    -- INDEX - This is an integer value representing the index
  11142.    --    into the text tables.
  11143.    -- EI - This is the error indicator.  Its numeric value represents
  11144.    --    the type of error, if any, that occurred.
  11145.    -- FONT_PRECISION - The two components of this record describe
  11146.    --    the text font and precision aspect.  The component FONT
  11147.    --    is an integer value representing the character font.  The
  11148.    --    component PRECISION may have the value STRING_PRECISION,
  11149.    --    CHAR_PRECISION, or STROKE_PRECISION to indicate the text
  11150.    --    precision.
  11151.    -- EXPANSION - This is a positive floating point value representing
  11152.    --    the nominal character expansion amount.
  11153.    -- SPACING - This is a floating point value representing the
  11154.    --    character spacing factor.  A positive value indicates the
  11155.    --    amount of space between characters in a text string, and a
  11156.    --    a negative value indicates the amount of overlap between
  11157.    --    characters.
  11158.    -- COLOUR - This is an integer value representing an index into
  11159.    --    the colour tables.
  11160.      
  11161.    GKS_INSTR : CGI_INQ_PREDEFINED_TEXT_REPRESENTATION;
  11162.      
  11163.    begin
  11164.      
  11165.       -- The following if structure inquires the GKS_OPERATING
  11166.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  11167.       -- it checks to see if the WS exists by checking if it is
  11168.       -- in the list of available WS types in the GKS_DESCRIPTION_
  11169.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  11170.       -- called for the inquiry.
  11171.      
  11172.       if CURRENT_OPERATING_STATE = GKCL then
  11173.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  11174.          FONT_PRECISION := (FONT => 0,
  11175.                             PRECISION => TEXT_PRECISION'FIRST);
  11176.          EXPANSION := 1.0;
  11177.          SPACING := 0.0;
  11178.          COLOUR := COLOUR_INDEX'FIRST;
  11179.      
  11180.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  11181.                                LIST_OF_AVAILABLE_WS_TYPES) then
  11182.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  11183.          FONT_PRECISION := (FONT => 0,
  11184.                             PRECISION => TEXT_PRECISION'FIRST);
  11185.          EXPANSION := 1.0;
  11186.          SPACING := 0.0;
  11187.          COLOUR := COLOUR_INDEX'FIRST;
  11188.      
  11189.       else
  11190.          GKS_INSTR.WS_TO_INQ_PRE_TEXT_REP := WS;
  11191.          GKS_INSTR.PRE_TEXT_INDEX_TO_INQ_PRE_TEXT_REP := INDEX;
  11192.          WS_MANAGER (GKS_INSTR);
  11193.      
  11194.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  11195.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) or       -- Error 39
  11196.                (GKS_INSTR.EI = INVALID_TEXT_INDEX) or        -- Error 72
  11197.                (GKS_INSTR.EI = NO_PREDEF_TEXT_REP) then      -- Error 74
  11198.                EI := GKS_INSTR.EI;
  11199.             else
  11200.                EI := UNKNOWN;                      -- Error 2501
  11201.             end if;
  11202.          else
  11203.             EI := GKS_INSTR.EI;
  11204.          end if;
  11205.      
  11206.          FONT_PRECISION := GKS_INSTR.PRE_TEXT_FONT_PRECISION_INQ;
  11207.          EXPANSION      := GKS_INSTR.PRE_TEXT_CHAR_EXPANSION_INQ;
  11208.          SPACING        := GKS_INSTR.PRE_TEXT_CHAR_SPACING_INQ;
  11209.          COLOUR         := GKS_INSTR.PRE_TEXT_COLOUR_INQ;
  11210.      
  11211.       end if;
  11212.      
  11213.    end INQ_PREDEFINED_TEXT_REPRESENTATION;
  11214.      
  11215.    procedure INQ_PREDEFINED_FILL_AREA_REPRESENTATION
  11216.       (WS      : in WS_TYPE;
  11217.       INDEX    : in FILL_AREA_INDEX;
  11218.       EI       : out ERROR_INDICATOR;
  11219.       INTERIOR : out INTERIOR_STYLE;
  11220.       STYLE    : out STYLE_INDEX;
  11221.       COLOUR   : out COLOUR_INDEX) is
  11222.      
  11223.    -- This procedure calls the workstation manager to obtain the
  11224.    -- value of the workstation predefined fill area information
  11225.    -- from the workstation description table.  This includes the
  11226.    -- fill area interior style, the fill area style index, and the
  11227.    -- fill area colour index.  If the inquired information is
  11228.    -- available, the workstation manager returns the error indicator
  11229.    -- as 0.  If the inquired information is not available, the
  11230.    -- workstation manager returns the error indicator as 39, 80 or 82
  11231.    -- to indicate the reason for non-availability.
  11232.    --
  11233.    -- WS - This is an integer value representing the type of
  11234.    --    workstation.
  11235.    -- INDEX - This is an integer value representing the index
  11236.    --    into the fill area tables.
  11237.    -- EI - This is the error indicator.  Its numeric value represents
  11238.    --    the type of error, if any, that occurred.
  11239.    -- INTERIOR - This enumerated variable defines the fill area
  11240.    --    interior style.
  11241.    -- STYLE - This is a variant record defining the fill area style.
  11242.    --    When the discriminant is HOLLOW or SOLID, the index is null.
  11243.    --    When the discriminant is PATTERN, the style index is an index
  11244.    --    into the pattern tables.  When the discriminant is HATCH, the
  11245.    --    style index indicates which hatch style is to be used.
  11246.    -- COLOUR - This is an integer value representing an index into
  11247.    --    the colour tables.
  11248.      
  11249.    GKS_INSTR : CGI_INQ_PREDEFINED_FILL_AREA_REPRESENTATION;
  11250.      
  11251.    begin
  11252.      
  11253.       -- The following if structure inquires the GKS_OPERATING
  11254.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  11255.       -- it checks to see if the WS exists by checking if it is
  11256.       -- in the list of available WS types in the GKS_DESCRIPTION_
  11257.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  11258.       -- called for the inquiry.
  11259.      
  11260.       if CURRENT_OPERATING_STATE = GKCL then
  11261.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  11262.          INTERIOR := INTERIOR_STYLE'FIRST;
  11263.          STYLE := STYLE_INDEX'FIRST;
  11264.          COLOUR := COLOUR_INDEX'FIRST;
  11265.      
  11266.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  11267.                                LIST_OF_AVAILABLE_WS_TYPES) then
  11268.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  11269.          INTERIOR := INTERIOR_STYLE'FIRST;
  11270.          STYLE := STYLE_INDEX'FIRST;
  11271.          COLOUR := COLOUR_INDEX'FIRST;
  11272.      
  11273.       else
  11274.          GKS_INSTR.WS_TO_INQ_PRE_FILL_AREA_REP := WS;
  11275.          GKS_INSTR.PRE_FILL_AREA_INDEX_TO_INQ_PRE_FILL_AREA_REP := INDEX;
  11276.          WS_MANAGER (GKS_INSTR);
  11277.      
  11278.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  11279.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) or       -- Error 39
  11280.                (GKS_INSTR.EI = INVALID_FILL_AREA_INDEX) or   -- Error 80
  11281.                (GKS_INSTR.EI = NO_PREDEF_FILL_AREA_REP) then -- Error 82
  11282.                EI := GKS_INSTR.EI;
  11283.             else
  11284.                EI := UNKNOWN;                       -- Error 2501
  11285.             end if;
  11286.          else
  11287.             EI := GKS_INSTR.EI;
  11288.          end if;
  11289.      
  11290.          INTERIOR := GKS_INSTR.PRE_FILL_AREA_INTERIOR_INQ;
  11291.          STYLE    := GKS_INSTR.PRE_FILL_AREA_STYLE_INQ;
  11292.          COLOUR   := GKS_INSTR.PRE_FILL_AREA_COLOUR_INQ;
  11293.      
  11294.       end if;
  11295.      
  11296.    end INQ_PREDEFINED_FILL_AREA_REPRESENTATION;
  11297.      
  11298.    procedure INQ_PATTERN_FACILITIES
  11299.       (WS               : in WS_TYPE;
  11300.       EI                : out ERROR_INDICATOR;
  11301.       NUMBER_OF_INDICES : out NATURAL) is
  11302.      
  11303.    -- This procedure calls the workstation manager to obtain the
  11304.    -- number of predefined pattern indices from the workstation
  11305.    -- description table.  If the inquired information is available,
  11306.    -- the workstation manager returns the error indicator as 0.  If
  11307.    -- the inquired information is not available, the error indicator
  11308.    -- is returned as 39 to indicate the reason for non-availability.
  11309.    --
  11310.    -- WS - This is an integer value representing the type of
  11311.    --    workstation.
  11312.    -- EI - This is the error indicator.  Its numeric value represents
  11313.    --    the type of error, if any, that occurred.
  11314.    -- NUMBER_OF_INDICES - This is a natural number indicating the
  11315.    --    number of pattern indices.
  11316.      
  11317.    GKS_INSTR : CGI_INQ_PATTERN_FACILITIES;
  11318.      
  11319.    begin
  11320.      
  11321.       -- The following if structure inquires the GKS_OPERATING
  11322.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  11323.       -- it checks to see if the WS exists by checking if it is
  11324.       -- in the list of available WS types in the GKS_DESCRIPTION_
  11325.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  11326.       -- called for the inquiry.
  11327.      
  11328.       if CURRENT_OPERATING_STATE = GKCL then
  11329.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  11330.          NUMBER_OF_INDICES := 0;
  11331.      
  11332.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  11333.                                LIST_OF_AVAILABLE_WS_TYPES) then
  11334.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  11335.          NUMBER_OF_INDICES := 0;
  11336.      
  11337.       else
  11338.          GKS_INSTR.WS_TO_INQ_PATTERN_FACILITIES := WS;
  11339.          WS_MANAGER (GKS_INSTR);
  11340.      
  11341.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  11342.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) then     -- Error 39
  11343.                EI := GKS_INSTR.EI;
  11344.             else
  11345.                EI := UNKNOWN;                      -- Error 2501
  11346.             end if;
  11347.          else
  11348.             EI := GKS_INSTR.EI;
  11349.          end if;
  11350.      
  11351.          NUMBER_OF_INDICES := GKS_INSTR.NUMBER_OF_PATTERN_INDICES;
  11352.      
  11353.       end if;
  11354.      
  11355.    end INQ_PATTERN_FACILITIES;
  11356.      
  11357.    procedure INQ_PREDEFINED_PATTERN_REPRESENTATION
  11358.       (WS     : in WS_TYPE;
  11359.       INDEX   : in PATTERN_INDEX;
  11360.       EI      : out ERROR_INDICATOR;
  11361.       LAST_X  : out NATURAL;
  11362.       LAST_Y  : out NATURAL;
  11363.       PATTERN : out COLOUR_MATRICES.VARIABLE_MATRIX_OF) is
  11364.      
  11365.    -- This procedure calls the workstation manager to obtain the
  11366.    -- value of the workstation predefined pattern information
  11367.    -- from the workstation description table.  This includes the
  11368.    -- pattern array dimensions and the pattern array.  If the
  11369.    -- inquired information is available, the workstation manager
  11370.    -- returns the error indicator as 0.  If the inquired information
  11371.    -- is not available, the workstation manager returns the error
  11372.    -- indicator as 39, 89, or 90 to indicate the reason for non-
  11373.    -- availability.
  11374.    --
  11375.    -- WS - This is an integer value representing the type of
  11376.    --    workstation.
  11377.    -- INDEX - This is an integer value representing the index
  11378.    --    into the pattern tables.
  11379.    -- EI - This is the error indicator.  Its numeric value represents
  11380.    --    the type of error, if any, that occurred.
  11381.    -- LAST_X, LAST_Y - These are the actual dimensions of the pattern
  11382.    --    matrix.  The parameters were added for this implementation to
  11383.    --    notify the application of the extent of the true pattern
  11384.    --    indices returned.
  11385.    -- PATTERN - This is a record defining a matrix that contains colour
  11386.    --    indices as elements.  It is assumed to be constrained.
  11387.      
  11388.    GKS_INSTR : CGI_INQ_PREDEFINED_PATTERN_REPRESENTATION;
  11389.    INVALID_PATTERN_MATRIX : COLOUR_MATRICES.VARIABLE_MATRIX_OF
  11390.                             (PATTERN.DX,PATTERN.DY);
  11391.      
  11392.    begin
  11393.      
  11394.       -- The following if structure inquires the GKS_OPERATING
  11395.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  11396.       -- it checks to see if the WS exists by checking if it is
  11397.       -- in the list of available WS types in the GKS_DESCRIPTION_
  11398.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  11399.       -- called for the inquiry.
  11400.      
  11401.       if CURRENT_OPERATING_STATE = GKCL then
  11402.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  11403.          PATTERN := INVALID_PATTERN_MATRIX;
  11404.      
  11405.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  11406.                                LIST_OF_AVAILABLE_WS_TYPES) then
  11407.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  11408.          PATTERN := INVALID_PATTERN_MATRIX;
  11409.      
  11410.       else
  11411.          GKS_INSTR.WS_TO_INQ_PRE_PATTERN_REP := WS;
  11412.          GKS_INSTR.PRE_PATTERN_INDEX_TO_INQ_PRE_PATTERN_REP := INDEX;
  11413.      
  11414.          WS_MANAGER (GKS_INSTR);
  11415.      
  11416.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  11417.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) or       -- Error 39
  11418.                (GKS_INSTR.EI = INVALID_PATTERN_INDEX) or     -- Error 85
  11419.                (GKS_INSTR.EI = NO_PREDEF_PATTERN_REP) or     -- Error 89
  11420.                (GKS_INSTR.EI = PATTERN_STYLE_NOT_ON_WS) then -- Error 90
  11421.                EI := GKS_INSTR.EI;
  11422.             else
  11423.                EI := UNKNOWN;                       -- Error 2501
  11424.             end if;
  11425.          else
  11426.             EI := GKS_INSTR.EI;
  11427.          end if;
  11428.      
  11429.          LAST_X := NATURAL(GKS_INSTR.PRE_PATTERN_REP_INQ'LENGTH(1));
  11430.          LAST_Y := NATURAL(GKS_INSTR.PRE_PATTERN_REP_INQ'LENGTH(2));
  11431.      
  11432.          if (PATTERN.DX < SMALL_NATURAL(GKS_INSTR.
  11433.             PRE_PATTERN_REP_INQ'LENGTH(1))) then
  11434.             for INDEX1 in POSITIVE(1) .. POSITIVE(PATTERN.DX) loop
  11435.                if PATTERN.DY < SMALL_NATURAL(GKS_INSTR.
  11436.                   PRE_PATTERN_REP_INQ'LENGTH(2)) then
  11437.                   for INDEX2 in POSITIVE(1) .. POSITIVE(PATTERN.DY) loop
  11438.                        PATTERN.MATRIX(INDEX1,INDEX2) :=
  11439.                           GKS_INSTR.PRE_PATTERN_REP_INQ(INDEX1,INDEX2);
  11440.                     end loop;
  11441.                  else
  11442.                     for INDEX2 in POSITIVE(1) .. POSITIVE(GKS_INSTR.
  11443.                        PRE_PATTERN_REP_INQ'LENGTH(2)) loop
  11444.                        PATTERN.MATRIX(INDEX1,INDEX2) :=
  11445.                            GKS_INSTR.PRE_PATTERN_REP_INQ(INDEX1,INDEX2);
  11446.                     end loop;
  11447.                  end if;
  11448.             end loop;
  11449.          else
  11450.             for INDEX1 in POSITIVE(1) .. POSITIVE(GKS_INSTR.
  11451.                PRE_PATTERN_REP_INQ'LENGTH(1)) loop
  11452.                if PATTERN.DY < SMALL_NATURAL(GKS_INSTR.
  11453.                   PRE_PATTERN_REP_INQ'LENGTH(2)) then
  11454.                   for INDEX2 in POSITIVE(1) .. POSITIVE(PATTERN.DY) loop
  11455.                      PATTERN.MATRIX(INDEX1,INDEX2) :=
  11456.                         GKS_INSTR.PRE_PATTERN_REP_INQ(INDEX1,INDEX2);
  11457.                   end loop;
  11458.                else
  11459.                   for INDEX2 in POSITIVE(1) .. POSITIVE(GKS_INSTR.
  11460.                      PRE_PATTERN_REP_INQ'LENGTH(2)) loop
  11461.                      PATTERN.MATRIX(INDEX1,INDEX2) :=
  11462.                         GKS_INSTR.PRE_PATTERN_REP_INQ(INDEX1,INDEX2);
  11463.                   end loop;
  11464.                end if;
  11465.             end loop;
  11466.          end if;
  11467.      
  11468.        FREE_COLOUR_MATRIX (GKS_INSTR.PRE_PATTERN_REP_INQ);
  11469.      
  11470.     end if;
  11471.      
  11472.  end INQ_PREDEFINED_PATTERN_REPRESENTATION;
  11473.      
  11474.    procedure INQ_PREDEFINED_COLOUR_REPRESENTATION
  11475.       (WS    : in WS_TYPE;
  11476.       INDEX  : in COLOUR_INDEX;
  11477.       EI     : out ERROR_INDICATOR;
  11478.       COLOUR : out COLOUR_REPRESENTATION) is
  11479.      
  11480.    -- This procedure calls the workstation manager to obtain the
  11481.    -- value of the workstation predefined colour information from
  11482.    -- the workstation description table.  This includes the red
  11483.    -- green, and blue intensities of the colour.  If the inquired
  11484.    -- information is available, the workstation manager returns
  11485.    -- the error indicator as 0. If the inquired information is not
  11486.    -- available, the workstation manager returns the error indicator
  11487.    -- as 39, 93 or 95 to indicate the reason for non-availability.
  11488.    --
  11489.    -- WS - This is an integer value representing the type of
  11490.    --    workstation.
  11491.    -- INDEX - This is an integer value representing the index
  11492.    --    into the pattern tables.
  11493.    -- EI - This is the error indicator.  Its numeric value represents
  11494.    --    the type of error, if any, that occurred.
  11495.    -- COLOUR - This is a record with three components, RED, GREEN,
  11496.    --    and BLUE which define the representation of a colour as a
  11497.    --    combination of intensities.
  11498.      
  11499.    GKS_INSTR : CGI_INQ_PREDEFINED_COLOUR_REPRESENTATION;
  11500.      
  11501.    begin
  11502.      
  11503.       -- The following if structure inquires the GKS_OPERATING
  11504.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  11505.       -- it checks to see if the WS exists by checking if it is
  11506.       -- in the list of available WS types in the GKS_DESCRIPTION_
  11507.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  11508.       -- called for the inquiry.
  11509.      
  11510.       if CURRENT_OPERATING_STATE = GKCL then
  11511.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  11512.          COLOUR := (RED => 0.0, GREEN => 0.0, BLUE => 0.0);
  11513.      
  11514.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  11515.                                LIST_OF_AVAILABLE_WS_TYPES) then
  11516.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  11517.          COLOUR := (RED => 0.0, GREEN => 0.0, BLUE => 0.0);
  11518.      
  11519.       else
  11520.          GKS_INSTR.WS_TO_INQ_PRE_COLOUR_REP := WS;
  11521.          GKS_INSTR.PRE_COLOUR_INDEX_TO_INQ_PRE_COLOUR_REP := INDEX;
  11522.          WS_MANAGER (GKS_INSTR);
  11523.      
  11524.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  11525.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) or       -- Error 39
  11526.                (GKS_INSTR.EI = INVALID_COLOUR_INDEX) or      -- Error 93
  11527.                (GKS_INSTR.EI = NO_PREDEF_COLOUR_REP) then    -- Error 95
  11528.                EI := GKS_INSTR.EI;
  11529.             else
  11530.                EI := UNKNOWN;                      -- Error 2501
  11531.             end if;
  11532.      
  11533.          else
  11534.             EI := GKS_INSTR.EI;
  11535.          end if;
  11536.      
  11537.          COLOUR := GKS_INSTR.PRE_COLOUR_REP_INQ;
  11538.      
  11539.       end if;
  11540.      
  11541.    end INQ_PREDEFINED_COLOUR_REPRESENTATION;
  11542.      
  11543.    procedure INQ_LIST_OF_AVAILABLE_GDP
  11544.       (WS         : in WS_TYPE;
  11545.       EI          : out ERROR_INDICATOR;
  11546.       LIST_OF_GDP : out GDP_IDS.LIST_OF) is
  11547.      
  11548.    -- This procedure calls the workstation manager to obtain the
  11549.    -- list of generalized drawing primitive identifiers.  If
  11550.    -- the inquired information is available,the workstaion manager
  11551.    -- returns the error indicator as 0.  If the inquired information
  11552.    -- is not available, the workstation manager returns the error
  11553.    -- indicator as 39 to indicate the reason for non-availability.
  11554.    --
  11555.    -- WS - This is an integer value representing the type of
  11556.    --    workstation.
  11557.    -- EI - This is the error indicator.  Its numeric value represents
  11558.    --    the type of error, if any, that occurred.
  11559.    -- LIST_OF_GDP - This is a set type of GDP identifiers.
  11560.      
  11561.    GKS_INSTR : CGI_INQ_LIST_OF_AVAILABLE_GDP;
  11562.      
  11563.    begin
  11564.      
  11565.       -- The following if structure inquires the GKS_OPERATING
  11566.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  11567.       -- it checks to see if the WS exists by checking if it is
  11568.       -- in the list of available WS types in the GKS_DESCRIPTION_
  11569.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  11570.       -- called for the inquiry.
  11571.      
  11572.       if CURRENT_OPERATING_STATE = GKCL then
  11573.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  11574.          LIST_OF_GDP := GDP_IDS.NULL_LIST;
  11575.      
  11576.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  11577.                                LIST_OF_AVAILABLE_WS_TYPES) then
  11578.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  11579.          LIST_OF_GDP := GDP_IDS.NULL_LIST;
  11580.      
  11581.       else
  11582.          GKS_INSTR.WS_TO_INQ_LIST_OF_AVAILABLE_GDP := WS;
  11583.          WS_MANAGER (GKS_INSTR);
  11584.      
  11585.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  11586.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) then     -- Error 39
  11587.                EI := GKS_INSTR.EI;
  11588.             else
  11589.                EI := UNKNOWN;                      -- Error 2501
  11590.             end if;
  11591.          else
  11592.             EI := GKS_INSTR.EI;
  11593.          end if;
  11594.      
  11595.          LIST_OF_GDP := GKS_INSTR.LIST_OF_GDP_INQ;
  11596.      
  11597.       end if;
  11598.      
  11599.    end INQ_LIST_OF_AVAILABLE_GDP;
  11600.      
  11601.    procedure INQ_GDP
  11602.       (WS    : in WS_TYPE;
  11603.       GDP    : in GDP_ID;
  11604.       EI     : out ERROR_INDICATOR;
  11605.       LIST_OF_ATTRIBUTES_USED : out ATTRIBUTES_USED.LIST_OF) is
  11606.      
  11607.    -- This procedure calls the workstation manager to obtain the
  11608.    -- list of sets of attributes used for the specified generalized
  11609.    -- drawing primitive.  If the inquired information is available,
  11610.    -- the workstation manager returns the error indicator as 0.  If
  11611.    -- the inquired information is not available, the workstation
  11612.    -- manager returns the error indicator as 39 or 41 to indicate the
  11613.    -- reason for non-availability.
  11614.    --
  11615.    -- WS - This is an integer value representing the type of
  11616.    --    workstation.
  11617.    -- GDP - This is an integer value representing a generalized
  11618.    --    drawing primitive.
  11619.    -- EI - This is the error indicator.  Its numeric value represents
  11620.    --    the type of error, if any, that occurred.
  11621.    -- LIST_OF_ATTRIBUTES_USED - This is a set type of ATTRIBUTES_USED_
  11622.    --    TYPE.  Its components may be set to 1 or 0 to indicate if the
  11623.    --    following attributes are used: POLYLINE_ATTRIBUTES, POLYMARKER_
  11624.    --    ATTRIBUTES, TEXT_ATTRIBUTES, or FILL_AREA_ATTRIBUTES.
  11625.      
  11626.    GKS_INSTR : CGI_INQ_GDP;
  11627.      
  11628.    begin
  11629.      
  11630.       -- The following if structure inquires the GKS_OPERATING
  11631.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  11632.       -- it checks to see if the WS exists by checking if it is
  11633.       -- in the list of available WS types in the GKS_DESCRIPTION_
  11634.       -- TABLE.  If both conditions are true, the WS_MANAGER is
  11635.       -- called for the inquiry.
  11636.      
  11637.       if CURRENT_OPERATING_STATE = GKCL then
  11638.          EI := NOT_GKOP_WSOP_WSAC_SGOP;        -- Error 8
  11639.          LIST_OF_ATTRIBUTES_USED := ATTRIBUTES_USED.NULL_LIST;
  11640.      
  11641.       elsif not WS_TYPES.IS_IN_LIST(WS,GKS_DESCRIPTION_TABLE.
  11642.                                LIST_OF_AVAILABLE_WS_TYPES) then
  11643.          EI := WS_TYPE_DOES_NOT_EXIST;         -- Error 23
  11644.          LIST_OF_ATTRIBUTES_USED := ATTRIBUTES_USED.NULL_LIST;
  11645.      
  11646.       else
  11647.          GKS_INSTR.WS_TO_INQ_GDP := WS;
  11648.          GKS_INSTR.GDP_TO_INQ_GDP := GDP;
  11649.          WS_MANAGER (GKS_INSTR);
  11650.      
  11651.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  11652.             if (GKS_INSTR.EI = WS_NOT_OUTPUT_OUTIN) or       -- Error 39
  11653.                (GKS_INSTR.EI = WS_TYPE_CANNOT_GEN_GDP) then  -- Error 41
  11654.                EI := GKS_INSTR.EI;
  11655.             else
  11656.                EI := UNKNOWN;                      -- Error 2501
  11657.             end if;
  11658.          else
  11659.             EI := GKS_INSTR.EI;
  11660.          end if;
  11661.      
  11662.          LIST_OF_ATTRIBUTES_USED := GKS_INSTR.LIST_OF_ATTRIBUTES_USED_INQ;
  11663.      
  11664.       end if;
  11665.      
  11666.    end INQ_GDP;
  11667.      
  11668. end INQ_WS_DESCRIPTION_TABLE_0A;
  11669. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11670. --:UDD:GKSADACM:CODE:0A:INQ_WS_ST_LST_0A_B.ADA
  11671. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11672. ------------------------------------------------------------------
  11673. --
  11674. --  NAME: INQ_WS_STATE_LIST_0A - BODY
  11675. --  IDENTIFIER: GIMXXX.1(1)
  11676. --  DISCREPANCY REPORTS:
  11677. --
  11678. ------------------------------------------------------------------
  11679. -- file:  inq_ws_st_lst_0a_b.ada
  11680. -- level: 0a, 1a, 2a, 0b, 0c
  11681.      
  11682. with WSM;
  11683. with CGI;
  11684. with GKS_OPERATING_STATE_LIST;
  11685. with GKS_STATE_LIST;
  11686. with GKS_ERRORS;
  11687.      
  11688. use WSM;
  11689. use CGI;
  11690. use GKS_ERRORS;
  11691. use GKS_OPERATING_STATE_LIST;
  11692.      
  11693. package body INQ_WS_STATE_LIST_0A is
  11694.      
  11695. -- This is the package body for the procedures to call the work-
  11696. -- station manager to inquire the workstation state lists at
  11697. -- levels no lower than 0a.
  11698.      
  11699. -- Each of the procedures in this package inquires the
  11700. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of
  11701. -- the states  WSOP, WSAC, SGOP.  If it is not, error 7
  11702. -- occurs but no exception is raised.  Then the procedures
  11703. -- check if the workstation is in the set of open workstations
  11704. -- in the GKS_STATE_LIST.  If it is not, error 25 occurs but
  11705. -- no exception is raised.
  11706.      
  11707.    procedure INQ_WS_STATE
  11708.       (WS   : in WS_ID;
  11709.       EI    : out ERROR_INDICATOR;
  11710.       STATE : out WS_STATE) is
  11711.      
  11712.    -- This procedure calls the workstation manager to obtain the
  11713.    -- value of the workstation state entry in the specified
  11714.    -- workstation's state list.  If the inquired information is
  11715.    -- available, the error indicator is returned as 0 by the work-
  11716.    -- station manager.  If the inquired information is not available,
  11717.    -- the workstation manager returns an error indicator of 33 or 35
  11718.    -- to indicate the reason for unavailabity.
  11719.    --
  11720.    -- WS - Identifies the workstation to be inquired.
  11721.    -- EI - Returns the error code, if any.
  11722.    -- STATE - Returns ACTIVE or INACTIVE.
  11723.      
  11724.    GKS_INSTR : CGI_INQ_WS_STATE;
  11725.      
  11726.    begin
  11727.      
  11728.       -- The following if structure inquires the GKS_OPERATING
  11729.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  11730.       -- it checks to see if the WS is open by checking if it is
  11731.       -- in the list of open WS in the GKS_STATE_LIST.  If both
  11732.       -- conditions are true, the WS_MANAGER is called for the
  11733.       -- inquiry.
  11734.      
  11735.       if (CURRENT_OPERATING_STATE = GKCL) or
  11736.          (CURRENT_OPERATING_STATE = GKOP) then
  11737.          EI := NOT_WSOP_WSAC_SGOP;             -- Error 7
  11738.          STATE := WS_STATE'FIRST;
  11739.      
  11740.       elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  11741.          EI := WS_NOT_OPEN;                    -- Error 25
  11742.          STATE := WS_STATE'FIRST;
  11743.      
  11744.       else
  11745.          GKS_INSTR.WS_TO_INQ_STATE := WS;
  11746.          WS_MANAGER (GKS_INSTR);
  11747.      
  11748.          if GKS_INSTR.EI /= SUCCESSFUL then                  -- Error 0
  11749.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or         -- Error 33
  11750.                (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) then    -- Error 35
  11751.                EI := GKS_INSTR.EI;
  11752.             else
  11753.                EI := UNKNOWN;                             -- Error 2501
  11754.             end if;
  11755.          else
  11756.             EI := GKS_INSTR.EI;
  11757.          end if;
  11758.      
  11759.          STATE := GKS_INSTR.WS_STATE_INQ;
  11760.      
  11761.       end if;
  11762.      
  11763.      
  11764.    end INQ_WS_STATE;
  11765.      
  11766.    procedure INQ_WS_DEFERRAL_AND_UPDATE_STATES
  11767.       (WS          : in WS_ID;
  11768.       EI           : out ERROR_INDICATOR;
  11769.       DEFERRAL     : out DEFERRAL_MODE;
  11770.       REGENERATION : out REGENERATION_MODE;
  11771.       DISPLAY      : out DISPLAY_SURFACE_EMPTY;
  11772.       FRAME_ACTION : out NEW_FRAME_NECESSARY) is
  11773.      
  11774.    -- This procedure calls the workstation manager to obtain the
  11775.    -- workstation deferral mode and the implicit regeneration mode,
  11776.    -- and to determine if the display surface is empty  and if new
  11777.    -- frame action is necessary at update time.  If the inquired
  11778.    -- information is available, the workstation manager returns the
  11779.    -- error indicator as 0.  If the inquired information is not avail-
  11780.    -- able, the workstation manager returns the error indicator as 33,
  11781.    -- 35, or 36 to indicate the reason for non-availability.
  11782.    --
  11783.    -- WS - Identifies the workstation to be inquired.
  11784.    -- EI - Returns the error code, if any.
  11785.    -- DEFERRAL - Returns the deferral mode of the specified workstation.
  11786.    -- REGENERATION - Returns the implicit regeneration mode of the
  11787.    --    specified workstation.
  11788.    -- DISPLAY - Returns whether the display surface is empty.
  11789.    -- FRAME_ACTION - Returns whether a frame action is necessary at
  11790.    --    update time.
  11791.      
  11792.    GKS_INSTR : CGI_INQ_WS_DEFERRAL_AND_UPDATE_STATES;
  11793.      
  11794.    begin
  11795.      
  11796.       -- The following if structure inquires the GKS_OPERATING
  11797.       -- _STATE_LIST to see if GKS is in the proper state.  Then
  11798.       -- it checks to see if the WS is open by checking if it is
  11799.       -- in the list of open WS in the GKS_STATE_LIST.  If both
  11800.       -- conditions are true, the WS_MANAGER is called for the
  11801.       -- inquiry.
  11802.      
  11803.       if (CURRENT_OPERATING_STATE = GKCL) or
  11804.          (CURRENT_OPERATING_STATE = GKOP) then
  11805.          EI := NOT_WSOP_WSAC_SGOP;             -- Error 7
  11806.          DEFERRAL := DEFERRAL_MODE'FIRST;
  11807.          REGENERATION := REGENERATION_MODE'FIRST;
  11808.          DISPLAY := DISPLAY_SURFACE_EMPTY'FIRST;
  11809.          FRAME_ACTION := NEW_FRAME_NECESSARY'FIRST;
  11810.      
  11811.       elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  11812.      
  11813.          EI := WS_NOT_OPEN;                    -- Error 25
  11814.          DEFERRAL := DEFERRAL_MODE'FIRST;
  11815.          REGENERATION := REGENERATION_MODE'FIRST;
  11816.          DISPLAY := DISPLAY_SURFACE_EMPTY'FIRST;
  11817.          FRAME_ACTION := NEW_FRAME_NECESSARY'FIRST;
  11818.      
  11819.       else
  11820.          GKS_INSTR.WS_TO_INQ_DEFERRAL_AND_UPDATE_STATES := WS;
  11821.          WS_MANAGER (GKS_INSTR);
  11822.      
  11823.      
  11824.           if GKS_INSTR.EI = SUCCESSFUL then                  -- Error 0
  11825.             if (GKS_INSTR.EI = WS_CATEGORY_IS_MI) or         -- Error 33
  11826.                (GKS_INSTR.EI = WS_CATEGORY_IS_INPUT) or      -- Error 35
  11827.                (GKS_INSTR.EI = WS_IS_WISS) then              -- Error 36
  11828.                EI := GKS_INSTR.EI;
  11829.             else
  11830.                EI := UNKNOWN;                      -- Error 2501
  11831.             end if;
  11832.          else
  11833.             EI := GKS_INSTR.EI;
  11834.          end if;
  11835.      
  11836.          DEFERRAL     := GKS_INSTR.DEFERRAL_INQ;
  11837.          REGENERATION := GKS_INSTR.REGENERATION_INQ;
  11838.          DISPLAY      := GKS_INSTR.DISPLAY_INQ;
  11839.          FRAME_ACTION := GKS_INSTR.FRAME_ACTION_INQ;
  11840.      
  11841.       end if;
  11842.      
  11843.    end INQ_WS_DEFERRAL_AND_UPDATE_STATES;
  11844.      
  11845. end INQ_WS_STATE_LIST_0A;
  11846. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11847. --:UDD:GKSADACM:CODE:0A:ERROR_ROUTINES_0A_B.ADA
  11848. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11849. ------------------------------------------------------------------
  11850. --
  11851. --  NAME: ERROR_ROUTINES - BODY
  11852. --  IDENTIFIER: GIMXXX.1(1)
  11853. --  DISCREPANCY REPORTS:
  11854. --
  11855. ------------------------------------------------------------------
  11856. -- file:  error_routines_0a_b.ada
  11857. -- level: 0a
  11858.      
  11859. package body ERROR_ROUTINES is
  11860.      
  11861. -- This is the package body providing the procedures
  11862. -- for GKS error handling.
  11863.      
  11864.    procedure EMERGENCY_CLOSE_GKS is separate;
  11865.      
  11866.    procedure ERROR_LOGGING
  11867.       (EI  : in ERROR_INDICATOR;
  11868.       NAME : in SUBPROGRAM_NAME) is separate;
  11869.      
  11870.   procedure GET_ERROR
  11871.       (EI  : out ERROR_INDICATOR;
  11872.       NAME : out VARIABLE_SUBPROGRAM_NAME) is separate;
  11873.      
  11874. end ERROR_ROUTINES;
  11875. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11876. --:UDD:GKSADACM:CODE:0A:GET_ERROR_S.ADA
  11877. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11878. ------------------------------------------------------------------
  11879. --
  11880. --  NAME: GET_ERROR
  11881. --  IDENTIFIER: GIMXXX.1(1)
  11882. --  DISCREPANCY REPORTS:
  11883. --
  11884. ------------------------------------------------------------------
  11885. -- file:  get_error_s.ada
  11886. -- level: all levels
  11887.      
  11888. with GKS_ERROR_STATE_LIST;
  11889.      
  11890. separate (ERROR_ROUTINES)
  11891.      
  11892. procedure GET_ERROR
  11893.    (EI  : out ERROR_INDICATOR;
  11894.    NAME : out VARIABLE_SUBPROGRAM_NAME) is
  11895.      
  11896. -- This function is an additional function added to GKS to
  11897. -- allow the applications program to access the latest error
  11898. -- indicator and subprogram name.
  11899. --
  11900. -- EI - This is the error indicator.  Its numeric value represents
  11901. --    the type of error that last occurred.
  11902. -- NAME - This is a string type.  Its value is the name of the
  11903. --    procedure in which the last error occurred.
  11904.      
  11905. begin
  11906.      
  11907.    EI := GKS_ERROR_STATE_LIST.LAST_EI;
  11908.    NAME := GKS_ERROR_STATE_LIST.LAST_SUBPROGRAM;
  11909.      
  11910. end;
  11911. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11912. --:UDD:GKSADACM:CODE:0A:EMER_CLOSE_GKS_S.ADA
  11913. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11914. ------------------------------------------------------------------
  11915. --
  11916. --  NAME: EMERGENCY_CLOSE_GKS
  11917. --  IDENTIFIER: GIMXXX.1(1)
  11918. --  DISCREPANCY REPORTS:
  11919. --
  11920. ------------------------------------------------------------------
  11921. -- file:  emer_close_gks_s.ada
  11922. -- level: 0a
  11923.      
  11924. with GKS_OPERATING_STATE_LIST;
  11925. with GKS_STATE_LIST;
  11926. with GKS_CONTROL;
  11927. with WS_CONTROL;
  11928.      
  11929. use GKS_OPERATING_STATE_LIST;
  11930.      
  11931. separate (ERROR_ROUTINES)
  11932.      
  11933. procedure EMERGENCY_CLOSE_GKS is
  11934.      
  11935. -- This procedure closes GKS in case of a non-recoverable
  11936. -- error and still saves as much information as possible.
  11937. -- All workstations are updated (by calling GKS procedure
  11938. -- UPDATE_WS).  All active workstations are deactivated
  11939. -- (by calling GKS procedure DEACTIVATE_WS).  All WS are
  11940. -- closed (by calling GKS procedure CLOSE_WS). And GKS is
  11941. -- closed (by calling CLOSE_GKS).
  11942.      
  11943. begin
  11944.      
  11945.    if CURRENT_OPERATING_STATE /= GKCL then
  11946.      
  11947.       for INDEX in 1.. WS_IDS.SIZE_OF_LIST(GKS_STATE_LIST.LIST_OF_OPEN_WS)
  11948.          loop
  11949.      
  11950.          -- Update all open WS.
  11951.      
  11952.          CURRENT_OPERATING_STATE := WSAC;
  11953.          -- Change the current operating state to a valid state
  11954.          -- for the procedures UPDATE_WS and DEACTIVATE_WS.
  11955.      
  11956.          if WS_IDS.IS_IN_LIST(WS_ID(INDEX),
  11957.                              GKS_STATE_LIST.LIST_OF_OPEN_WS)then
  11958.             WS_CONTROL.UPDATE_WS (WS_ID(INDEX),PERFORM);
  11959.          end if;
  11960.      
  11961.          -- Deactivate all active WS.
  11962.          if WS_IDS.IS_IN_LIST(WS_ID(INDEX),
  11963.                              GKS_STATE_LIST.LIST_OF_ACTIVE_WS) then
  11964.             WS_CONTROL.DEACTIVATE_WS (WS_ID(INDEX));
  11965.          end if;
  11966.      
  11967.          -- Close all open WS.
  11968.      
  11969.          CURRENT_OPERATING_STATE := WSOP;
  11970.          -- To ensure that the current operating state is in a valid
  11971.          -- state for the procedure CLOSE_WS.
  11972.      
  11973.          if WS_IDS.IS_IN_LIST(WS_ID(INDEX),
  11974.                              GKS_STATE_LIST.LIST_OF_OPEN_WS) then
  11975.             WS_CONTROL.CLOSE_WS (WS_ID(INDEX));
  11976.          end if;
  11977.      
  11978.       end loop;
  11979.      
  11980.       -- Close GKS.
  11981.      
  11982.       CURRENT_OPERATING_STATE := GKOP;
  11983.       -- To ensure that the current operating state is in a valid
  11984.       -- state for the procedure CLOSE_GKS.
  11985.      
  11986.       GKS_CONTROL.CLOSE_GKS;
  11987.      
  11988.    end if;
  11989.      
  11990. end EMERGENCY_CLOSE_GKS;
  11991. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11992. --:UDD:GKSADACM:CODE:0A:ERROR_LOGGING_S.ADA
  11993. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  11994. ------------------------------------------------------------------
  11995. --
  11996. --  NAME: ERROR_LOGGING
  11997. --  IDENTIFIER: GIMXXX.1(1)
  11998. --  DISCREPANCY REPORTS:
  11999. --
  12000. ------------------------------------------------------------------
  12001. -- file:  error_logging_s.ada
  12002. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  12003.      
  12004. with TEXT_IO;
  12005. with GKS_ERROR_STATE_LIST;
  12006. with GKS_CONFIGURATION;
  12007. with GKS_OPERATING_STATE_LIST;
  12008.      
  12009. separate (ERROR_ROUTINES)
  12010.      
  12011. procedure ERROR_LOGGING
  12012.    (EI  : in ERROR_INDICATOR;
  12013.    NAME : in SUBPROGRAM_NAME) is
  12014.      
  12015. -- This procedure writes the error number and the GKS function
  12016. -- name detecting the error to the error file (created when the
  12017. -- GKS function OPEN_GKS was called) using the I/O facilities of
  12018. -- TEXT_IO.
  12019. --
  12020. -- EI - This is the error indicator.  Its numeric value represents
  12021. --    the type of error being logged.
  12022. -- NAME - This is a string type.  Its value is the name of the
  12023. --    procedure in which the error being logged occurred.
  12024.      
  12025. begin
  12026.      
  12027.    -- Write the error indicator and the subprogram name to the
  12028.    -- error file.
  12029.      
  12030.    if GKS_OPERATING_STATE_LIST.CURRENT_OPERATING_STATE = GKCL then
  12031.       if not TEXT_IO.IS_OPEN(GKS_ERROR_STATE_LIST.ERROR_DATA) then
  12032.          TEXT_IO.CREATE (GKS_ERROR_STATE_LIST.ERROR_DATA,
  12033.                          TEXT_IO.OUT_FILE,
  12034.                          GKS_CONFIGURATION.DEFAULT_ERROR_FILE);
  12035.       end if;
  12036.       TEXT_IO.NEW_LINE(GKS_ERROR_STATE_LIST.ERROR_DATA);
  12037.       TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA,"GKS ERROR NUMBER ");
  12038.       TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA,
  12039.                   ERROR_INDICATOR'IMAGE(EI));
  12040.       TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA," OCCURRED IN ");
  12041.       TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA, NAME);
  12042.       TEXT_IO.NEW_LINE(GKS_ERROR_STATE_LIST.ERROR_DATA);
  12043.       TEXT_IO.CLOSE(GKS_ERROR_STATE_LIST.ERROR_DATA);
  12044.      
  12045.    else
  12046.       TEXT_IO.NEW_LINE(GKS_ERROR_STATE_LIST.ERROR_DATA);
  12047.       TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA,"GKS ERROR NUMBER ");
  12048.       TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA,
  12049.                   ERROR_INDICATOR'IMAGE(EI));
  12050.       TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA," OCCURRED IN ");
  12051.       TEXT_IO.PUT(GKS_ERROR_STATE_LIST.ERROR_DATA, NAME);
  12052.       TEXT_IO.NEW_LINE(GKS_ERROR_STATE_LIST.ERROR_DATA);
  12053.    end if;
  12054.      
  12055.    -- Set the value for the last EI and the last SUBPROGRAM name.
  12056.    GKS_ERROR_STATE_LIST.LAST_EI := EI;
  12057.    GKS_ERROR_STATE_LIST.LAST_SUBPROGRAM := (LENGTH => NAME'LENGTH,
  12058.                                             CONTENTS => NAME);
  12059.      
  12060.      
  12061. end ERROR_LOGGING;
  12062. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12063. --:UDD:GKSADACM:CODE:0A:SET_BUNDLE_IDX_B.ADA
  12064. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12065. ------------------------------------------------------------------
  12066. --
  12067. --  NAME: SET_BUNDLE_INDICES - BODY
  12068. --  IDENTIFIER: GIMXXX.1(1)
  12069. --  DISCREPANCY REPORTS:
  12070. --
  12071. ------------------------------------------------------------------
  12072. -- file:  set_bundle_idx_b.ada
  12073. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  12074.      
  12075. with WSM;
  12076. with CGI;
  12077. with ERROR_ROUTINES;
  12078. with GKS_OPERATING_STATE_LIST;
  12079. with GKS_ERRORS;
  12080. with GKS_DESCRIPTION_TABLE;
  12081. with GKS_STATE_LIST;
  12082.      
  12083. use WSM;
  12084. use CGI;
  12085. use ERROR_ROUTINES;
  12086. use GKS_ERRORS;
  12087. use GKS_OPERATING_STATE_LIST;
  12088.      
  12089. package body SET_BUNDLE_INDICES is
  12090.      
  12091. -- This is the package body for the procedures to call the work-
  12092. -- station manager to set the values of the bundle table indices
  12093. -- in the workstation state lists.
  12094. --
  12095. -- Each procedure in this package inquires the GKS_OPERATING-
  12096. -- STATE_LIST to check if GKS is in one of the states GKOP,
  12097. -- WSOP, WSAC, or SGOP.  If it is not, error 8 occurs and the
  12098. -- procedure raises the exception STATE_ERROR.
  12099. --
  12100. -- If an error indicator above 0 occurs, these procedures call
  12101. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  12102. -- to log the error indicator and the name of the procedure
  12103. -- in the error file specified when the procedure OPEN_GKS
  12104. -- was called to begin this session of GKS operation.
  12105.      
  12106.    procedure SET_POLYLINE_INDEX
  12107.       (INDEX : in POLYLINE_INDEX) is
  12108.      
  12109.    -- This procedure sets the value of the current polyline index
  12110.    -- in the GKS_STATE_LIST and then sends the value to the
  12111.    -- WS_MANAGER.  This value is used when creating subsequent
  12112.    -- polyline output primitives.
  12113.    --
  12114.    -- INDEX - Specifies the polyline index to be set.
  12115.      
  12116.    GKS_INSTR : CGI_SET_POLYLINE_INDEX;
  12117.      
  12118.    begin
  12119.      
  12120.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12121.       -- to see if GKS is in the proper state before proceeding.
  12122.      
  12123.       if CURRENT_OPERATING_STATE = GKCL then
  12124.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12125.                         "SET_POLYLINE_INDEX");    -- Error 8
  12126.          raise STATE_ERROR;
  12127.      
  12128.       else
  12129.      
  12130.          -- Call to WS_MANAGER with the polyline index.
  12131.      
  12132.          GKS_INSTR.POLYLINE_INDEX_SET := INDEX;
  12133.          WS_MANAGER (GKS_INSTR);
  12134.      
  12135.          if GKS_INSTR.EI = INVALID_POLYLINE_INDEX then  -- Error 60
  12136.             ERROR_LOGGING (GKS_INSTR.EI,"SET_POLYLINE_INDEX");
  12137.             raise OUTPUT_ATTRIBUTE_ERROR;
  12138.          end if;
  12139.      
  12140.          GKS_STATE_LIST.CURRENT_POLYLINE_INDEX := INDEX;
  12141.      
  12142.       end if;
  12143.      
  12144.       exception
  12145.          when STATE_ERROR =>
  12146.             raise;
  12147.          when OUTPUT_ATTRIBUTE_ERROR =>
  12148.             raise;
  12149.          when OTHERS =>
  12150.             ERROR_LOGGING (UNKNOWN, "SET_POLYLINE_INDEX"); -- Error 2501
  12151.             raise;
  12152.      
  12153.    end SET_POLYLINE_INDEX;
  12154.      
  12155.    procedure SET_POLYMARKER_INDEX
  12156.       (INDEX : in POLYMARKER_INDEX) is
  12157.      
  12158.    -- This procedure sets the value of the current polymarker index
  12159.    -- in the GKS_STATE_LIST and then sends the value to the
  12160.    -- WS_MANAGER.  This value is used when creating subsequent
  12161.    -- polymarker output primitives.
  12162.    --
  12163.    -- INDEX - Specifies the polymarker index to be set.
  12164.      
  12165.    GKS_INSTR : CGI_SET_POLYMARKER_INDEX;
  12166.      
  12167.    begin
  12168.      
  12169.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12170.       -- to see if GKS is in the proper state before proceeding.
  12171.      
  12172.       if CURRENT_OPERATING_STATE = GKCL then
  12173.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12174.                         "SET_POLYMARKER_INDEX"); -- Error 8
  12175.          raise STATE_ERROR;
  12176.      
  12177.       else
  12178.      
  12179.          -- Call to WS_MANAGER with the new polymarker index.
  12180.      
  12181.          GKS_INSTR.POLYMARKER_INDEX_SET := INDEX;
  12182.          WS_MANAGER (GKS_INSTR);
  12183.      
  12184.          if GKS_INSTR.EI = INVALID_POLYMARKER_INDEX then  -- Error 66
  12185.             ERROR_LOGGING (GKS_INSTR.EI,"SET_POLYMARKER_INDEX");
  12186.             raise OUTPUT_ATTRIBUTE_ERROR;
  12187.          end if;
  12188.      
  12189.          GKS_STATE_LIST.CURRENT_POLYMARKER_INDEX := INDEX;
  12190.      
  12191.       end if;
  12192.      
  12193.       exception
  12194.          when STATE_ERROR =>
  12195.             raise;
  12196.          when OUTPUT_ATTRIBUTE_ERROR =>
  12197.             raise;
  12198.          when OTHERS =>
  12199.             ERROR_LOGGING (UNKNOWN,
  12200.                            "SET_POLYMARKER_INDEX"); -- Error 2501
  12201.             raise;
  12202.      
  12203.    end SET_POLYMARKER_INDEX;
  12204.      
  12205.    procedure SET_TEXT_INDEX
  12206.       (INDEX : in TEXT_INDEX) is
  12207.      
  12208.    -- This procedure sets the value of the current text index
  12209.    -- in the GKS_STATE_LIST and then sends the value to the
  12210.    -- WS_MANAGER.  This value is used when creating subsequent
  12211.    -- text output primitives.
  12212.    --
  12213.    -- INDEX - Specifies the text index to be set.
  12214.      
  12215.    GKS_INSTR : CGI_SET_TEXT_INDEX;
  12216.      
  12217.    begin
  12218.      
  12219.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12220.       -- to see if GKS is in the proper state before proceeding.
  12221.      
  12222.       if CURRENT_OPERATING_STATE = GKCL then
  12223.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12224.                         "SET_TEXT_INDEX");      -- Error 8
  12225.          raise STATE_ERROR;
  12226.      
  12227.       else
  12228.      
  12229.          -- Call to WS_MANAGER with the new text index.
  12230.      
  12231.          GKS_INSTR.TEXT_INDEX_SET := INDEX;
  12232.          WS_MANAGER (GKS_INSTR);
  12233.      
  12234.          if GKS_INSTR.EI = INVALID_TEXT_INDEX then       -- Error 72
  12235.             ERROR_LOGGING (GKS_INSTR.EI, "SET_TEXT_INDEX");
  12236.             raise OUTPUT_ATTRIBUTE_ERROR;
  12237.          end if;
  12238.      
  12239.          GKS_STATE_LIST.CURRENT_TEXT_INDEX := INDEX;
  12240.      
  12241.       end if;
  12242.      
  12243.       exception
  12244.          when STATE_ERROR =>
  12245.             raise;
  12246.          when OUTPUT_ATTRIBUTE_ERROR =>
  12247.             raise;
  12248.          when OTHERS =>
  12249.             ERROR_LOGGING (UNKNOWN, "SET_TEXT_INDEX"); -- Error 2501
  12250.             raise;
  12251.      
  12252.    end SET_TEXT_INDEX;
  12253.      
  12254.    procedure SET_FILL_AREA_INDEX
  12255.       (INDEX : in FILL_AREA_INDEX) is
  12256.      
  12257.    -- This procedure sets the value of the current fill area index
  12258.    -- in the GKS_STATE_LIST and then sends the value to the
  12259.    -- WS_MANAGER.  This value is used when creating subsequent
  12260.    -- fill area output primitives.
  12261.    --
  12262.    -- INDEX - Specifies the fill area index to be set.
  12263.      
  12264.    GKS_INSTR : CGI_SET_FILL_AREA_INDEX;
  12265.      
  12266.    begin
  12267.      
  12268.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12269.       -- to see if GKS is in the proper state before proceeding.
  12270.      
  12271.       if CURRENT_OPERATING_STATE = GKCL then
  12272.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12273.                         "SET_FILL_AREA_INDEX");   -- Error 8
  12274.          raise STATE_ERROR;
  12275.      
  12276.       else
  12277.      
  12278.          -- Call to WS_MANAGER with the new fill area index.
  12279.      
  12280.          GKS_INSTR.FILL_AREA_INDEX_SET := INDEX;
  12281.          WS_MANAGER (GKS_INSTR);
  12282.      
  12283.          if GKS_INSTR.EI = INVALID_FILL_AREA_INDEX then  -- Error 80
  12284.             ERROR_LOGGING (GKS_INSTR.EI,"SET_FILL_AREA_INDEX");
  12285.             raise OUTPUT_ATTRIBUTE_ERROR;
  12286.          end if;
  12287.      
  12288.          GKS_STATE_LIST.CURRENT_FILL_AREA_INDEX := INDEX;
  12289.      
  12290.       end if;
  12291.      
  12292.       exception
  12293.          when STATE_ERROR =>
  12294.             raise;
  12295.          when OUTPUT_ATTRIBUTE_ERROR =>
  12296.             raise;
  12297.          when OTHERS =>
  12298.             ERROR_LOGGING (UNKNOWN, "SET_FILL_AREA_INDEX"); -- Error 2501
  12299.             raise;
  12300.      
  12301.    end SET_FILL_AREA_INDEX;
  12302.      
  12303. end SET_BUNDLE_INDICES;
  12304. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12305. --:UDD:GKSADACM:CODE:0A:SET_PRIM_ATTR_0A_B.ADA
  12306. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12307. ------------------------------------------------------------------
  12308. --
  12309. --  NAME: SET_PRIMITIVE_ATTRIBUTES_0A - BODY
  12310. --  IDENTIFIER: GIMXXX.1(2)
  12311. --  DISCREPANCY REPORTS:
  12312. --  #019  06/14/85  "Change SET_PATTERN_SIZE to SET_PATTERN_VECTORS"
  12313. ------------------------------------------------------------------
  12314. -- file:  set_prim_attr_0a_b.ada
  12315. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  12316.      
  12317. with WSM;
  12318. with CGI;
  12319. with ERROR_ROUTINES;
  12320. with GKS_OPERATING_STATE_LIST;
  12321. with GKS_ERRORS;
  12322. with GKS_STATE_LIST;
  12323. with TRANSFORMATION_MATH;
  12324.      
  12325. use WSM;
  12326. use CGI;
  12327. use ERROR_ROUTINES;
  12328. use GKS_OPERATING_STATE_LIST;
  12329. use GKS_ERRORS;
  12330.      
  12331. package body SET_PRIMITIVE_ATTRIBUTES_0A is
  12332.      
  12333. -- This is the package body for the procedures which set the values
  12334. -- of the workstation independent primitive attributes.
  12335. --
  12336. -- Each of the procedures in this package inquires the
  12337. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of the
  12338. -- states GKOP, WSOP, WSAC, or SGOP.  If it is not, error 8
  12339. -- occurs and the procedure raises the exception STATE_ERROR.
  12340. --
  12341. -- If an error indicator above 0 occurs, these procedures call
  12342. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  12343. -- to log the error indicator and the name of the procedure
  12344. -- in the error file specified when the procedure OPEN_GKS
  12345. -- was called to begin this session of GKS operation.  In
  12346. -- addition, this procedure will raise the appropriate exception.
  12347.      
  12348.    procedure SET_TEXT_PATH
  12349.       (PATH : in TEXT_PATH) is
  12350.      
  12351.    -- This procedure sets the value of the current text path entry
  12352.    -- in the GKS_STATE_LIST to the value specified.  Then it calls
  12353.    -- the WS_MANAGER to pass it the value.  This value is used when
  12354.    -- creating subsequent text output primitives.
  12355.    --
  12356.    -- PATH - Specifies the text path to be set.
  12357.      
  12358.    GKS_INSTR : CGI_SET_TEXT_PATH;
  12359.      
  12360.    begin
  12361.      
  12362.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12363.       -- to see if GKS is in the proper state before proceeding.
  12364.      
  12365.       if CURRENT_OPERATING_STATE = GKCL then
  12366.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12367.                         "SET_TEXT_PATH");           -- Error 8
  12368.          raise STATE_ERROR;
  12369.      
  12370.       else
  12371.      
  12372.          GKS_STATE_LIST.CURRENT_TEXT_PATH := PATH;
  12373.      
  12374.          -- Call to WS_MANAGER with the new text path.
  12375.      
  12376.          GKS_INSTR.TEXT_PATH_SET := PATH;
  12377.          WS_MANAGER (GKS_INSTR);
  12378.      
  12379.       end if;
  12380.      
  12381.       exception
  12382.          when STATE_ERROR =>
  12383.             raise;
  12384.          when OTHERS =>
  12385.             ERROR_LOGGING (UNKNOWN, "SET_TEXT_PATH"); -- Error 2501
  12386.             raise;
  12387.      
  12388.    end SET_TEXT_PATH;
  12389.      
  12390.    procedure SET_PATTERN_SIZE
  12391.       (SIZE : in WC.SIZE) is
  12392.      
  12393.    -- This procedure sets the value of the current pattern size entry
  12394.    -- in the GKS_STATE_LIST to the value specified.  Then it calls
  12395.    -- the WS_MANAGER to pass it the value.
  12396.    --
  12397.    -- SIZE - Specifies the pattern size in WC to be set.
  12398.      
  12399.    GKS_INSTR : CGI_SET_PATTERN_VECTORS;                        -- DR019
  12400.      
  12401.    begin
  12402.      
  12403.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12404.       -- to see if GKS is in the proper state before proceeding.
  12405.      
  12406.       if CURRENT_OPERATING_STATE = GKCL then
  12407.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12408.                         "SET_PATTERN_SIZE");      -- Error 8
  12409.          raise STATE_ERROR;
  12410.      
  12411.       else
  12412.      
  12413.          GKS_STATE_LIST.CURRENT_PATTERN_WIDTH_VECTOR :=
  12414.             (WC_TYPE(SIZE.XAXIS),0.0);
  12415.          GKS_STATE_LIST.CURRENT_PATTERN_HEIGHT_VECTOR :=
  12416.             (0.0,WC_TYPE(SIZE.YAXIS));
  12417.      
  12418.          -- Call to WS_MANAGER with the new pattern size.
  12419.      
  12420.          -- Transformation logic for WC to NDC
  12421.          -- DR019 next 4 lines
  12422.          GKS_INSTR.PATTERN_HEIGHT_VECTOR_SET := (0.0, NDC_TYPE
  12423.             ((GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  12424.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  12425.             NDC_FACTORS(1,1)) * NDC_TYPE(SIZE.XAXIS)));
  12426.      
  12427.          -- DR019 next 4 lines
  12428.          GKS_INSTR.PATTERN_WIDTH_VECTOR_SET := (NDC_TYPE
  12429.             ((GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  12430.             (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION).
  12431.             NDC_FACTORS(2,2)) * NDC_TYPE(SIZE.YAXIS)), 0.0);
  12432.      
  12433.          WS_MANAGER (GKS_INSTR);
  12434.      
  12435.       end if;
  12436.      
  12437.       exception
  12438.          when STATE_ERROR =>
  12439.             raise;
  12440.          when NUMERIC_ERROR =>
  12441.             ERROR_LOGGING (ARITHMETIC, "SET_PATTERN_SIZE"); -- Error 308
  12442.             raise SYSTEM_ERROR;
  12443.          when OTHERS =>
  12444.             ERROR_LOGGING (UNKNOWN, "SET_PATTERN_SIZE"); -- Error 2501
  12445.             raise;
  12446.      
  12447.    end SET_PATTERN_SIZE;
  12448.      
  12449.    procedure SET_PATTERN_REFERENCE_POINT
  12450.       (POINT : in WC.POINT) is
  12451.      
  12452.    -- This procedure sets the value of the current pattern reference
  12453.    -- point in the GKS_STATE_LIST to the value specified.  Then it calls
  12454.    -- the WS_MANAGER to pass it the value.
  12455.    --
  12456.    -- POINT - Specifies the pattern reference point to be set.
  12457.      
  12458.    GKS_INSTR : CGI_SET_PATTERN_REFERENCE_POINT;
  12459.      
  12460.    begin
  12461.      
  12462.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12463.       -- to see if GKS is in the proper state before proceeding.
  12464.      
  12465.       if CURRENT_OPERATING_STATE = GKCL then
  12466.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12467.                         "SET_PATTERN_REFERENCE_POINT"); --Error 8
  12468.          raise STATE_ERROR;
  12469.      
  12470.       else
  12471.      
  12472.          GKS_STATE_LIST.CURRENT_PATTERN_REFERENCE_POINT := POINT;
  12473.      
  12474.          -- Call to WS_MANAGER with the new pattern size.
  12475.      
  12476.          -- Transformation logic for WC to NDC
  12477.          GKS_INSTR.PATTERN_REFERENCE_POINT_SET:= TRANSFORMATION_MATH
  12478.          .WC_TO_NDC(GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  12479.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  12480.          .NDC_FACTORS, POINT);
  12481.      
  12482.          WS_MANAGER (GKS_INSTR);
  12483.      
  12484.       end if;
  12485.      
  12486.       exception
  12487.          when STATE_ERROR =>
  12488.             raise;
  12489.          when NUMERIC_ERROR =>
  12490.             ERROR_LOGGING (ARITHMETIC,
  12491.                            "SET_PATTERN_REFERENCE_POINT"); -- Error 308
  12492.          when OTHERS =>
  12493.             ERROR_LOGGING (UNKNOWN,
  12494.                            "SET_PATTERN_REFERENCE_POINT"); -- Error 2501
  12495.             raise;
  12496.      
  12497.    end SET_PATTERN_REFERENCE_POINT;
  12498.      
  12499. end SET_PRIMITIVE_ATTRIBUTES_0A;
  12500. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12501. --:UDD:GKSADACM:CODE:0A:SET_INDV_ATTR_0A_B.ADA
  12502. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12503. ------------------------------------------------------------------
  12504. --
  12505. --  NAME: SET_INDIVIDUAL_ATTRIBUTES_0A - BODY
  12506. --  IDENTIFIER: GIMXXX.1(1)
  12507. --  DISCREPANCY REPORTS:
  12508. --
  12509. ------------------------------------------------------------------
  12510. -- file:  set_indv_attr_0a_b.ada
  12511. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  12512.      
  12513. with WSM;
  12514. with CGI;
  12515. with ERROR_ROUTINES;
  12516. with GKS_OPERATING_STATE_LIST;
  12517. with GKS_ERRORS;
  12518. with GKS_STATE_LIST;
  12519.      
  12520. use WSM;
  12521. use CGI;
  12522. use ERROR_ROUTINES;
  12523. use GKS_OPERATING_STATE_LIST;
  12524. use GKS_ERRORS;
  12525.      
  12526. package body SET_INDIVIDUAL_ATTRIBUTES_0A is
  12527.      
  12528. -- This is the package body for the procedures to set the indivi-
  12529. -- dual primitive attributes.
  12530. --
  12531. -- Each of the procedures in this package inquires the
  12532. -- GKS_OPERATING_STATE_LIST to check if GKS is in one of
  12533. -- the states GKOP, WSOP, WSAC, SGOP.  If it is not, error
  12534. -- 8 occurs and the procedure raises the exception STATE_ERROR.
  12535. --
  12536. -- If an error indicator above 0 occurs, these procedures call
  12537. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  12538. -- to log the error indicator and the name of the procedure
  12539. -- in the error file specified when the procedure OPEN_GKS
  12540. -- was called to begin this session of GKS operation.
  12541.      
  12542.    procedure SET_LINEWIDTH_SCALE_FACTOR
  12543.       (WIDTH : in LINE_WIDTH) is
  12544.      
  12545.    -- This procedure sets the value of the current line width
  12546.    -- scale factor in the GKS_STATE_LIST and then sends the value
  12547.    -- to the WS_MANAGER. This value is used for the display of
  12548.    -- subsequent polyline output primitives, created when the
  12549.    -- current linewidth scale factor aspect source flag is set
  12550.    -- to individual.
  12551.    --
  12552.    -- WIDTH - Specifies the line width to be set.
  12553.      
  12554.    GKS_INSTR : CGI_SET_LINE_WIDTH_SCALE_FACTOR;
  12555.      
  12556.    begin
  12557.      
  12558.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12559.       -- to see if GKS is in the proper state before proceeding.
  12560.      
  12561.       if CURRENT_OPERATING_STATE = GKCL then
  12562.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12563.                         "SET_LINEWIDTH_SCALE_FACTOR"); -- Error 8
  12564.          raise STATE_ERROR;
  12565.      
  12566.       else
  12567.      
  12568.          GKS_STATE_LIST.CURRENT_LINEWIDTH_SCALE_FACTOR := WIDTH;
  12569.      
  12570.          -- Call to WS_MANAGER with the new line width scale factor.
  12571.      
  12572.          GKS_INSTR.LINE_WIDTH_SCALE_FACTOR_SET := WIDTH;
  12573.          WS_MANAGER (GKS_INSTR);
  12574.      
  12575.       end if;
  12576.      
  12577.       exception
  12578.          when STATE_ERROR =>
  12579.             raise;
  12580.          when OTHERS =>
  12581.             ERROR_LOGGING (UNKNOWN,
  12582.                            "SET_LINEWIDTH_SCALE_FACTOR"); -- Error 2501
  12583.             raise;
  12584.      
  12585.    end SET_LINEWIDTH_SCALE_FACTOR;
  12586.      
  12587.    procedure SET_MARKER_SIZE_SCALE_FACTOR
  12588.       (SIZE : in MARKER_SIZE) is
  12589.      
  12590.    -- This procedure sets the value of the current marker size
  12591.    -- scale factor in the GKS_STATE_LIST and then sends the value
  12592.    -- to the WS_MANAGER. This value is used for the display of
  12593.    -- subsequent polymarker output primitives, created when the
  12594.    -- current marker size scale factor aspect source flag is set
  12595.    -- to individual.
  12596.    --
  12597.    -- SIZE - Specifies the marker size to be set.
  12598.      
  12599.    GKS_INSTR : CGI_SET_MARKER_SIZE_SCALE_FACTOR;
  12600.      
  12601.    begin
  12602.      
  12603.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12604.       -- to see if GKS is in the proper state before proceeding.
  12605.      
  12606.       if CURRENT_OPERATING_STATE = GKCL then
  12607.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12608.                         "SET_MARKER_SIZE_SCALE_FACTOR"); -- Error 8
  12609.          raise STATE_ERROR;
  12610.      
  12611.       else
  12612.      
  12613.          GKS_STATE_LIST.CURRENT_MARKER_SIZE_SCALE_FACTOR := SIZE;
  12614.      
  12615.          -- Call to WS_MANAGER with the new marker size scale factor.
  12616.      
  12617.          GKS_INSTR.MARKER_SIZE_SCALE_FACTOR_SET := SIZE;
  12618.          WS_MANAGER (GKS_INSTR);
  12619.      
  12620.       end if;
  12621.      
  12622.       exception
  12623.          when STATE_ERROR =>
  12624.             raise;
  12625.          when OTHERS =>
  12626.             ERROR_LOGGING (UNKNOWN,
  12627.                            "SET_MARKER_SIZE_SCALE_FACTOR"); -- Error 2501
  12628.             raise;
  12629.      
  12630.    end SET_MARKER_SIZE_SCALE_FACTOR;
  12631.      
  12632.    procedure SET_TEXT_FONT_AND_PRECISION
  12633.       (FONT_PRECISION : in TEXT_FONT_PRECISION) is
  12634.      
  12635.    -- This procedure checks that the value of the text font
  12636.    -- is not equal to zero.  If it is, then error 75 occurs and
  12637.    -- the exception OUTPUT_ATTRIBUTE_ERROR is raised.  Otherwise
  12638.    -- this procedure sets the value of the current text font and
  12639.    -- precision in the GKS_STATE_LIST and then sends the value
  12640.    -- to the WS_MANAGER. This value is used for the display of
  12641.    -- subsequent text output primitives, created when the
  12642.    -- current text font and precision aspect source flag is set
  12643.    -- to individual.
  12644.    --
  12645.    -- FONT_PRECISION - Specifies the text font and precision to be set.
  12646.      
  12647.    GKS_INSTR : CGI_SET_TEXT_FONT_AND_PRECISION;
  12648.      
  12649.    begin
  12650.      
  12651.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12652.       -- to see if GKS is in the proper state before proceeding.
  12653.      
  12654.       if CURRENT_OPERATING_STATE = GKCL then
  12655.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12656.                         "SET_TEXT_FONT_AND_PRECISION"); -- Error 8
  12657.          raise STATE_ERROR;
  12658.      
  12659.       elsif FONT_PRECISION.FONT = 0 then
  12660.          ERROR_LOGGING (TEXT_FONT_IS_ZERO,
  12661.                         "SET_TEXT_FONT_AND_PRECISION"); -- Error 75
  12662.          raise OUTPUT_ATTRIBUTE_ERROR;
  12663.      
  12664.       else
  12665.      
  12666.          GKS_STATE_LIST.CURRENT_TEXT_FONT_AND_PRECISION := FONT_PRECISION;
  12667.      
  12668.          -- Call to WS_MANAGER with the new text font and precision value.
  12669.      
  12670.          GKS_INSTR.TEXT_FONT_AND_PRECISION_SET := FONT_PRECISION;
  12671.          WS_MANAGER (GKS_INSTR);
  12672.      
  12673.       end if;
  12674.      
  12675.       exception
  12676.          when STATE_ERROR =>
  12677.             raise;
  12678.          when OUTPUT_ATTRIBUTE_ERROR =>
  12679.             raise;
  12680.          when OTHERS =>
  12681.             ERROR_LOGGING (UNKNOWN,
  12682.                            "SET_TEXT_FONT_AND_PRECISION"); -- Error 2501
  12683.             raise;
  12684.      
  12685.    end SET_TEXT_FONT_AND_PRECISION;
  12686.      
  12687.    procedure SET_CHAR_EXPANSION_FACTOR
  12688.       (EXPANSION : in CHAR_EXPANSION) is
  12689.      
  12690.    -- This procedure sets the value of the current character expan-
  12691.    -- sion factor in the GKS_STATE_LIST and then sends the value
  12692.    -- to the WS_MANAGER. This value is used for the display of
  12693.    -- subsequent text output primitives, created when the
  12694.    -- current character expansion factor aspect source flag is set
  12695.    -- to individual.
  12696.    --
  12697.    -- EXPANSION - Specifies the character expansion factor to be set.
  12698.      
  12699.    GKS_INSTR : CGI_SET_CHAR_EXPANSION_FACTOR;
  12700.      
  12701.    begin
  12702.      
  12703.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12704.       -- to see if GKS is in the proper state before proceeding.
  12705.      
  12706.       if CURRENT_OPERATING_STATE = GKCL then
  12707.          ERROR_LOGGING(NOT_GKOP_WSOP_WSAC_SGOP,
  12708.                       "SET_CHAR_EXPANSION_FACTOR"); -- Error 8
  12709.          raise STATE_ERROR;
  12710.      
  12711.       else
  12712.      
  12713.          GKS_STATE_LIST.CURRENT_CHAR_EXPANSION_FACTOR := EXPANSION;
  12714.      
  12715.          -- Call to WS_MANAGER with the new character expansion factor.
  12716.      
  12717.          GKS_INSTR.CHAR_EXPANSION_FACTOR_SET := EXPANSION;
  12718.          WS_MANAGER (GKS_INSTR);
  12719.      
  12720.       end if;
  12721.      
  12722.       exception
  12723.          when STATE_ERROR =>
  12724.             raise;
  12725.          when OTHERS =>
  12726.             ERROR_LOGGING (UNKNOWN,
  12727.                            "SET_CHAR_EXPANSION_FACTOR"); -- Error 2501
  12728.             raise;
  12729.      
  12730.    end SET_CHAR_EXPANSION_FACTOR;
  12731.      
  12732.    procedure SET_CHAR_SPACING
  12733.       (SPACING : in CHAR_SPACING) is
  12734.      
  12735.    -- This procedure sets the value of the current character
  12736.    -- spacing in the GKS_STATE_LIST and then sends the value
  12737.    -- to the WS_MANAGER. This value is used for the display of
  12738.    -- subsequent text output primitives, created when the
  12739.    -- current character spacing aspect source flag is set
  12740.    -- to individual.
  12741.    --
  12742.    -- SPACING - Specifies the character spacing to be set.
  12743.      
  12744.    GKS_INSTR : CGI_SET_CHAR_SPACING;
  12745.      
  12746.    begin
  12747.      
  12748.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12749.       -- to see if GKS is in the proper state before proceeding.
  12750.      
  12751.       if CURRENT_OPERATING_STATE = GKCL then
  12752.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12753.                         "SET_CHAR_SPACING");      -- Error 8
  12754.          raise STATE_ERROR;
  12755.      
  12756.       else
  12757.      
  12758.          GKS_STATE_LIST.CURRENT_CHAR_SPACING := SPACING;
  12759.      
  12760.          -- Call to WS_MANAGER with the new character spacing value.
  12761.      
  12762.          GKS_INSTR.CHAR_SPACING_SET := SPACING;
  12763.          WS_MANAGER (GKS_INSTR);
  12764.      
  12765.       end if;
  12766.      
  12767.       exception
  12768.          when STATE_ERROR =>
  12769.             raise;
  12770.          when OTHERS =>
  12771.             ERROR_LOGGING (UNKNOWN, "SET_CHAR_SPACING"); -- Error 2501
  12772.             raise;
  12773.      
  12774.    end SET_CHAR_SPACING;
  12775.      
  12776.    procedure SET_FILL_AREA_STYLE_INDEX
  12777.       (INDEX : in STYLE_INDEX) is
  12778.      
  12779.    -- This procedure sets the value of the current fill area
  12780.    -- style index in the GKS_STATE_LIST and then sends the value
  12781.    -- to the WS_MANAGER. This value is used for the display of
  12782.    -- subsequent fill area output primitives, created when the
  12783.    -- current fill area style index aspect source flag is set
  12784.    -- to individual.
  12785.    --
  12786.    -- INDEX - Specifies the fill area style index to be set.
  12787.      
  12788.    GKS_INSTR : CGI_SET_FILL_AREA_STYLE_INDEX;
  12789.      
  12790.    begin
  12791.      
  12792.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12793.       -- to see if GKS is in the proper state before proceeding.
  12794.      
  12795.       if CURRENT_OPERATING_STATE = GKCL then
  12796.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12797.                         "SET_FILL_AREA_STYLE_INDEX"); -- Error 8
  12798.          raise STATE_ERROR;
  12799.      
  12800.       elsif INDEX = 0 then
  12801.          ERROR_LOGGING (STYLE_INDEX_IS_ZERO,
  12802.                         "SET_FILL_AREA_STYLE_INDEX"); -- Error 84
  12803.          raise OUTPUT_ATTRIBUTE_ERROR;
  12804.      
  12805.       else
  12806.          GKS_STATE_LIST.CURRENT_FILL_AREA_STYLE_INDEX := INDEX;
  12807.      
  12808.          -- Call to WS_MANAGER with the new fill area style index.
  12809.      
  12810.          GKS_INSTR.FILL_AREA_STYLE_INDEX_SET := INDEX;
  12811.          WS_MANAGER (GKS_INSTR);
  12812.       end if;
  12813.      
  12814.       exception
  12815.          when STATE_ERROR =>
  12816.             raise;
  12817.          when OUTPUT_ATTRIBUTE_ERROR =>
  12818.             raise;
  12819.          when OTHERS =>
  12820.             ERROR_LOGGING (UNKNOWN,
  12821.                            "SET_FILL_AREA_STYLE_INDEX"); -- Error 2501
  12822.             raise;
  12823.      
  12824.    end SET_FILL_AREA_STYLE_INDEX;
  12825.      
  12826.    procedure SET_ASF
  12827.       (ASF : in ASF_LIST) is
  12828.      
  12829.    -- This procedure sets the values of the following aspect source
  12830.    -- flags and then calls the WS_MANAGER to pass it the values:
  12831.    --  1) linetype asf
  12832.    --  2) linewidth scale factor asf
  12833.    --  3) polyline colour index asf
  12834.    --  4) marker type asf
  12835.    --  5) marker size scale factor asf
  12836.    --  6) polymarker colour index asf
  12837.    --  7) text font and precision asf
  12838.    --  8) character expansion factor asf
  12839.    --  9) character spacing asf
  12840.    -- 10) text colour index asf
  12841.    -- 11) fill area interior style asf
  12842.    -- 12) fill area style index asf
  12843.    -- 13) fill area colour index asf.
  12844.    --
  12845.    -- ASF - Specifies all the above mentioned aspect source flags
  12846.    --    to be set.
  12847.      
  12848.    GKS_INSTR : CGI_SET_ASF;
  12849.      
  12850.    begin
  12851.      
  12852.       -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  12853.       -- to see if GKS is in the proper state before proceeding.
  12854.      
  12855.       if CURRENT_OPERATING_STATE = GKCL then
  12856.          ERROR_LOGGING (NOT_GKOP_WSOP_WSAC_SGOP,
  12857.                          "SET_ASF");               -- Error 8
  12858.          raise STATE_ERROR;
  12859.      
  12860.       else
  12861.      
  12862.          GKS_STATE_LIST.CURRENT_ASPECT_SOURCE_FLAGS := ASF;
  12863.      
  12864.          -- Call to WS_MANAGER with the new ASF values.
  12865.      
  12866.          GKS_INSTR.ASF_SET := ASF;
  12867.          WS_MANAGER (GKS_INSTR);
  12868.      
  12869.       end if;
  12870.      
  12871.       exception
  12872.          when STATE_ERROR =>
  12873.             raise;
  12874.          when OTHERS =>
  12875.             ERROR_LOGGING (UNKNOWN, "SET_ASF");  -- Error 2501
  12876.             raise;
  12877.      
  12878.    end SET_ASF;
  12879.      
  12880. end SET_INDIVIDUAL_ATTRIBUTES_0A;
  12881. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12882. --:UDD:GKSADACM:CODE:0A:EXT_OUT_PRIM_B.ADA
  12883. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12884. ------------------------------------------------------------------
  12885. --
  12886. --  NAME: EXTENDED_OUTPUT_PRIMITIVES - BODY
  12887. --  IDENTIFIER: GIMXXX.1(1)
  12888. --  DISCREPANCY REPORTS:
  12889. --
  12890. ------------------------------------------------------------------
  12891. -- file:  ext_out_prim_b.ada
  12892. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  12893.      
  12894. with WSM;
  12895. with CGI;
  12896. with ERROR_ROUTINES;
  12897. with GKS_OPERATING_STATE_LIST;
  12898. with GKS_ERRORS;
  12899. with GKS_STATE_LIST;
  12900. with TRANSFORMATION_MATH;
  12901.      
  12902. use WSM;
  12903. use CGI;
  12904. use ERROR_ROUTINES;
  12905. use GKS_OPERATING_STATE_LIST;
  12906. use GKS_ERRORS;
  12907.      
  12908. package body EXTENDED_OUTPUT_PRIMITIVES is
  12909.      
  12910. -- This is the package body for the procedures to extend
  12911. -- the output primitives to level 0a.
  12912. --
  12913. -- If an error indicator above 0 occurs, this procedure calls
  12914. -- the ERROR_LOGGING procedure of the package ERROR_ROUTINES
  12915. -- to log the error indicator and the name of the procedure
  12916. -- in the error file specified when the procedure OPEN_GKS
  12917. -- was called to begin this session of GKS operation.
  12918.      
  12919.    procedure CELL_ARRAY
  12920.       (CORNER_1_1  : in WC.POINT;
  12921.       CORNER_DX_DY : in WC.POINT;
  12922.       CELL         : in COLOUR_MATRICES.MATRIX_OF) is separate;
  12923.      
  12924.    procedure GDP_CIRCLE
  12925.       (CENTER          : in WC.POINT;
  12926.       PERIPHERAL_POINT : in WC.POINT) is separate;
  12927.      
  12928. end EXTENDED_OUTPUT_PRIMITIVES;
  12929. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12930. --:UDD:GKSADACM:CODE:0A:GDP_CIRCLE_S.ADA
  12931. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  12932. ------------------------------------------------------------------
  12933. --
  12934. --  NAME: GDP_CIRCLE
  12935. --  IDENTIFIER: GIMXXX.1(1)
  12936. --  DISCREPANCY REPORTS:
  12937. --
  12938. ------------------------------------------------------------------
  12939. -- file:  gdp_circle_s.ada
  12940. -- level: all levels
  12941.      
  12942. separate (EXTENDED_OUTPUT_PRIMITIVES)
  12943.      
  12944. procedure GDP_CIRCLE
  12945.    (CENTER           : in WC.POINT;
  12946.     PERIPHERAL_POINT : in WC.POINT) is
  12947.      
  12948. -- This procedure first inquires the GKS_OPERATING_STATE_LIST
  12949. -- to check if GKS is in state WSAC or SGOP.  If it is not,
  12950. -- error 5 occurs and the exception STATE_ERROR is raised.
  12951. -- Otherwise, this procedure performs a normalization trans-
  12952. -- formation on the world coordinate points passed in and
  12953. -- passes the normalized device coordinates that result to the
  12954. -- workstation manager to draw a circle.  The workstation manager
  12955. -- checks for errors 104 and 105.  If these errors occur then
  12956. -- the procedure raises the exception OUTPUT_ATTRIBUTE_ERROR.
  12957. --
  12958. -- CENTER - Provides the center point of the circle in world coordi-
  12959. --    nates.
  12960. -- PERIPHERAL_POINT - Provides a peripheral point on the circle in
  12961. --    world coordinates.
  12962.      
  12963. GKS_INSTR : CGI_CIRCLE;
  12964.      
  12965. begin
  12966.      
  12967.    -- The following if structure inquires the GKS_OPERATING_STATE_
  12968.    -- LIST to see if GKS is in the proper state. Then it checks to
  12969.    -- see that the number of points is valid before calling the
  12970.    -- WS_MANAGER.
  12971.      
  12972.    if (CURRENT_OPERATING_STATE /= WSAC) and
  12973.       (CURRENT_OPERATING_STATE /= SGOP) then
  12974.       ERROR_LOGGING (NOT_WSAC_SGOP, "GDP_CIRCLE");            -- Error 5
  12975.       raise STATE_ERROR;
  12976.      
  12977.    else
  12978.      
  12979.       -- The following logics performs a transformation on the
  12980.       -- points from world coordinates to normalized device coordinates.
  12981.      
  12982.       GKS_INSTR.CIRCLE_CENTER := TRANSFORMATION_MATH.WC_TO_NDC
  12983.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  12984.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  12985.          .NDC_FACTORS, CENTER);
  12986.      
  12987.       GKS_INSTR.CIRCLE_PERIPHERAL_POINT := TRANSFORMATION_MATH.WC_TO_NDC
  12988.          (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  12989.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  12990.          .NDC_FACTORS, PERIPHERAL_POINT);
  12991.      
  12992.       WS_MANAGER (GKS_INSTR);
  12993.      
  12994.       if (GKS_INSTR.EI = SOME_WS_CANNOT_GEN_GDP) or    -- Error 104
  12995.          (GKS_INSTR.EI = SOME_WS_CANNOT_GEN_XFORM_CLIP_GDP) then
  12996.                                                        -- Error 105
  12997.          ERROR_LOGGING (GKS_INSTR.EI,"GDP_CIRCLE");
  12998.          raise OUTPUT_PRIMITIVE_ERROR;
  12999.       end if;
  13000.      
  13001.    end if;
  13002.      
  13003.    exception
  13004.       when STATE_ERROR =>
  13005.          raise;
  13006.       when OUTPUT_PRIMITIVE_ERROR =>
  13007.          raise;
  13008.       when NUMERIC_ERROR =>
  13009.          ERROR_LOGGING (ARITHMETIC, "GDP_CIRCLE");          -- Error 308
  13010.          raise SYSTEM_ERROR;
  13011.       when OTHERS =>
  13012.          ERROR_LOGGING (UNKNOWN, "GDP_CIRCLE");             -- Error 2501
  13013.          raise;
  13014.      
  13015. end GDP_CIRCLE;
  13016. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13017. --:UDD:GKSADACM:CODE:0A:CELL_AR_S.ADA
  13018. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13019. ------------------------------------------------------------------
  13020. --
  13021. --  NAME: CELL_ARRAY
  13022. --  IDENTIFIER: GIMXXX.1(1)
  13023. --  DISCREPANCY REPORTS:
  13024. --
  13025. ------------------------------------------------------------------
  13026. -- file:  cell_ar_s.ada
  13027. -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  13028.      
  13029. separate (EXTENDED_OUTPUT_PRIMITIVES)
  13030.      
  13031. procedure CELL_ARRAY
  13032.    (CORNER_1_1 : in WC.POINT;
  13033.    CORNER_DX_DY: in WC.POINT;
  13034.    CELL        : in COLOUR_MATRICES.MATRIX_OF) is
  13035.      
  13036. -- This procedure inquires the GKS_OPERATING_STATE_LIST to
  13037. -- check if GKS is in one of the states WSAC or SGOP.  If it
  13038. -- is not, error 5 occurs and the procedure raises the exception
  13039. -- STATE_ERROR.  Otherwise, this procedure transforms the world
  13040. -- coordinates passed in as the cell rectangle corners into
  13041. -- normalized device coordinates.  Then it passes these
  13042. -- coordinates to the workstation manager and the colour
  13043. -- index array to construct the cell array.
  13044.      
  13045. -- CORNER_1_1  - Specifies the lower left point of the cell array.
  13046. -- CORNER_DX_DY - Specifies the upper right point of the cell array.
  13047. -- CELL - Specifies a matrix of colour indices for the cells
  13048. --    created in the cell array.
  13049.      
  13050. GKS_INSTR : CGI_CELL_ARRAY;
  13051.      
  13052. CORNER_DX_1 : WC.POINT;
  13053. -- The above type was created to hold the third point calculated
  13054. -- from the two passed in.
  13055.      
  13056. begin
  13057.      
  13058.    -- The following if structure inquires the GKS_OPERATING_STATE_LIST
  13059.    -- to check if GKS is in the proper state before proceeding.
  13060.      
  13061.    if (CURRENT_OPERATING_STATE /= WSAC) and
  13062.       (CURRENT_OPERATING_STATE /= SGOP) then
  13063.       ERROR_LOGGING (NOT_WSAC_SGOP, "CELL_ARRAY");  -- Error 5
  13064.       raise STATE_ERROR;
  13065.      
  13066.    else
  13067.      
  13068.       GKS_INSTR.CELL_ARRAY_CORNER_1_1 := TRANSFORMATION_MATH
  13069.          .WC_TO_NDC (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  13070.           (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  13071.           .NDC_FACTORS, CORNER_1_1);
  13072.      
  13073.      
  13074.       GKS_INSTR.CELL_ARRAY_CORNER_DX_DY := TRANSFORMATION_MATH
  13075.          .WC_TO_NDC (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  13076.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  13077.          .NDC_FACTORS, CORNER_DX_DY);
  13078.      
  13079.       CORNER_DX_1 := (CORNER_DX_DY.X,CORNER_1_1.Y);
  13080.      
  13081.       GKS_INSTR.CELL_ARRAY_CORNER_DX_1 := TRANSFORMATION_MATH
  13082.          .WC_TO_NDC(GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS
  13083.          (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION)
  13084.          .NDC_FACTORS, CORNER_DX_1);
  13085.      
  13086.       GKS_INSTR.CELL_COLOUR_MATRIX := new COLOUR_MATRICES.MATRIX_OF'(CELL);
  13087.       WS_MANAGER (GKS_INSTR);
  13088.      
  13089.       FREE_COLOUR_MATRIX (GKS_INSTR.CELL_COLOUR_MATRIX);
  13090.      
  13091.    end if;
  13092.      
  13093.    exception
  13094.       when STATE_ERROR =>
  13095.          raise;
  13096.       when NUMERIC_ERROR =>
  13097.          ERROR_LOGGING (ARITHMETIC, "CELL_ARRAY"); -- Error 308
  13098.          raise SYSTEM_ERROR;
  13099.       when OTHERS =>
  13100.          ERROR_LOGGING (UNKNOWN, "CELL_ARRAY");    -- Error 2501
  13101.          raise;
  13102.      
  13103. end CELL_ARRAY;
  13104. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13105. --:UDD:GKSADACM:CODE:MA:WS_TBL_TYP.ADA
  13106. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13107. -- File: WS_TBL_TYP.ADA
  13108. -- ALL LEVELS
  13109.      
  13110. with GKS_TYPES;
  13111.      
  13112. use GKS_TYPES;
  13113.      
  13114. package WS_TABLE_TYPES is
  13115.      
  13116. -- This package is designed to be `with'ed by the packages
  13117. -- WS_DESCRIPTION_TABLE and WS_STATE_LIST to allow them to use
  13118. -- the types declared here.
  13119.      
  13120.    type POLYLINE_BUNDLE is
  13121.       record
  13122.          L_TYPE  : LINETYPE;
  13123.          L_WIDTH : LINE_WIDTH;
  13124.          COLOUR  : COLOUR_INDEX;
  13125.       end record;
  13126.      
  13127.    type POLYLINE_BUNDLE_LIST is array (POSITIVE range <>)
  13128.                                        of POLYLINE_BUNDLE;
  13129.      
  13130.    type POLYMARKER_BUNDLE is
  13131.       record
  13132.          M_TYPE : MARKER_TYPE;
  13133.          M_SIZE : MARKER_SIZE;
  13134.          COLOUR : COLOUR_INDEX;
  13135.       end record;
  13136.      
  13137.    type POLYMARKER_BUNDLE_LIST is array (POSITIVE range <>)
  13138.                                          of POLYMARKER_BUNDLE;
  13139.      
  13140.    type TEXT_BUNDLE is
  13141.       record
  13142.          TEXT_FONT    : TEXT_FONT_PRECISION;
  13143.          CH_EXPANSION : CHAR_EXPANSION;
  13144.          CH_SPACE     : CHAR_SPACING;
  13145.          COLOUR       : COLOUR_INDEX;
  13146.       end record;
  13147.      
  13148.    type TEXT_BUNDLE_LIST is array (POSITIVE range <>) of TEXT_BUNDLE;
  13149.      
  13150.    type FILL_AREA_BUNDLE is
  13151.       record
  13152.          INT_STYLE : INTERIOR_STYLE;
  13153.          STYLE     : STYLE_INDEX;
  13154.          COLOUR    : COLOUR_INDEX;
  13155.       end record;
  13156.      
  13157.    type FILL_AREA_BUNDLE_LIST is array (POSITIVE range <>)
  13158.                                         of FILL_AREA_BUNDLE;
  13159.      
  13160.    type PATTERN_TABLE_LIST is array (NATURAL range <>)
  13161.                                      of COLOUR_MATRICES
  13162.                                          .VARIABLE_MATRIX_OF;
  13163.      
  13164.    type COLOUR_TABLE_LIST is array (COLOUR_INDEX range <>)
  13165.                                     of COLOUR_REPRESENTATION;
  13166.      
  13167.    type ATTR_USED_LIST is array (GDP_ID range <>)
  13168.                                  of ATTRIBUTES_USED.LIST_OF;
  13169.      
  13170.    subtype MAX_INTENSITIES_TYPE is INTEGER range 2 .. (2 ** 16) - 1;
  13171.      
  13172. end WS_TABLE_TYPES;
  13173. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13174. --:UDD:GKSADACM:CODE:MA:WS_DSCR_TBL_TYP.ADA
  13175. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13176. -- File: ws_dscr_tbl.ada
  13177. -- level ma - 2a
  13178.      
  13179. with GKS_TYPES;
  13180. with WS_TABLE_TYPES;
  13181.      
  13182. use GKS_TYPES;
  13183.      
  13184. package WS_DESCRIPTION_TABLE_TYPES is
  13185.      
  13186. -- All entries are implementation dependent
  13187.      
  13188.    type DYN_MOD_ACCEPTED_FOR_WS_ATTRIBUTES is
  13189.       record
  13190.          POLYLINE_BUNDLE_REP   : DYNAMIC_MODIFICATION;
  13191.          POLYMARKER_BUNDLE_REP : DYNAMIC_MODIFICATION;
  13192.          TEXT_BUNDLE_REP       : DYNAMIC_MODIFICATION;
  13193.          FILL_AREA_BUNDLE_REP  : DYNAMIC_MODIFICATION;
  13194.          PATTERN_REP           : DYNAMIC_MODIFICATION;
  13195.          COLOUR_REP            : DYNAMIC_MODIFICATION;
  13196.          WS_TRANSFORMATION     : DYNAMIC_MODIFICATION;
  13197.       end record;
  13198.      
  13199.    type DYN_MOD_ACCEPTED_FOR_SEGMENT_ATTRIBUTES is
  13200.       record
  13201.          SEGMENT_TRANSFORMATION     : DYNAMIC_MODIFICATION;
  13202.          VISIBILITY_TO_INVISIBLE    : DYNAMIC_MODIFICATION;
  13203.          VISIBILITY_TO_VISIBLE      : DYNAMIC_MODIFICATION;
  13204.          HIGHLIGHTING               : DYNAMIC_MODIFICATION;
  13205.          SEGMENT_PRIORITY           : DYNAMIC_MODIFICATION;
  13206.          ADDING_TO_OBSCURED_SEGMENT : DYNAMIC_MODIFICATION;
  13207.          DELETE_SEGMENT             : DYNAMIC_MODIFICATION;
  13208.       end record;
  13209.      
  13210.    subtype PLIN_INDEX is NATURAL      range 0 .. 5;
  13211.    subtype PMRK_INDEX is NATURAL      range 0 .. 5;
  13212.    subtype TXT_INDEX  is NATURAL      range 0 .. 5;
  13213.    subtype FA_INDEX   is NATURAL      range 0 .. 5;
  13214.    subtype PAT_INDEX  is NATURAL      range 0 .. 0;
  13215.    subtype CLR_INDEX  is COLOUR_INDEX range 0 .. 7;
  13216.    subtype GDP_INDEX  is GDP_ID       range 0 .. 3;
  13217.    -- The subtypes are declared to constrain the size of the
  13218.    -- discriminant components of the record WS_DESCRIPTION_TBL.
  13219.    -- These were put here so as not to raise a STORAGE ERROR at
  13220.    -- the time the object is declared of the type.
  13221.      
  13222.    -- The following record is the WS_DESCRIPTION_TABLE.
  13223.    type WS_DESCRIPTION_TBL
  13224.       (NUM_PREDEFINED_PLIN_BUNDLE   : PLIN_INDEX := 0;
  13225.        NUM_PREDEFINED_PMRK_BUNDLE   : PMRK_INDEX := 0;
  13226.        NUM_PREDEFINED_TEXT_BUNDLE   : TXT_INDEX  := 0;
  13227.        NUM_PREDEFINED_FA_BUNDLE     : FA_INDEX   := 0;
  13228.        NUM_PREDEFINED_PATTERN_TABLE : PAT_INDEX  := 0;
  13229.        LAST_PREDEFINED_COLOUR_REP   : CLR_INDEX  := 0;
  13230.        NUM_OF_GDP_ID                : GDP_INDEX  := 0)
  13231.    is record
  13232.      
  13233.       -- Entries in this group exist for all workstation categories.
  13234.      
  13235.       WORKSTATION_TYPE     : WS_TYPE;
  13236.       WORKSTATION_CATEGORY : WS_CATEGORY;
  13237.      
  13238.       -- Entries in this group exist for OUTPUT, INPUT, OUTIN
  13239.      
  13240.       DEVICE_COOR_UNITS                : DC_UNITS;
  13241.       MAX_DISPLAY_SURFACE_DC_UNITS     : DC.SIZE;
  13242.       MAX_DISPLAY_SURFACE_RASTER_UNITS : RASTER_UNIT_SIZE;
  13243.      
  13244.       -- Entries in this group exist for OUTPUT, OUTIN
  13245.      
  13246.       DISPLAY_TYPE        : DISPLAY_CLASS;
  13247.       WS_DYNAMICS         : DYN_MOD_ACCEPTED_FOR_WS_ATTRIBUTES;
  13248.       DEFER_MODE          : DEFERRAL_MODE;
  13249.       IMPLICIT_REGEN_MODE : REGENERATION_MODE;
  13250.      
  13251.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  13252.       -- linetypes.
  13253.      
  13254.       LIST_AVAILABLE_LTYPE : LINETYPES.LIST_OF;
  13255.       NUM_AVAILABLE_LWIDTH : NATURAL;
  13256.       NOMINAL_LWIDTH       : DC.MAGNITUDE;
  13257.       RANGE_OF_LWIDTH      : DC.RANGE_OF_MAGNITUDES;
  13258.      
  13259.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  13260.       -- polylines.
  13261.      
  13262.       PREDEFINED_PLIN_BUNDLES  : WS_TABLE_TYPES.POLYLINE_BUNDLE_LIST
  13263.             (1..NUM_PREDEFINED_PLIN_BUNDLE);
  13264.      
  13265.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  13266.       -- polymarkers.
  13267.      
  13268.       LIST_AVAILABLE_MARKER_TYPES : MARKER_TYPES.LIST_OF;
  13269.       NUM_AVAILABLE_MARKER_SIZES  : NATURAL;
  13270.       NOMINAL_MARKER_SIZE         : DC.MAGNITUDE;
  13271.       RANGE_OF_MARKER_SIZES       : DC.RANGE_OF_MAGNITUDES;
  13272.      
  13273.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  13274.       -- polymarker bundles.
  13275.       -- It is the list of predefined polymarker bundles.
  13276.      
  13277.       PREDEFINED_PMRK_BUNDLES : WS_TABLE_TYPES.POLYMARKER_BUNDLE_LIST
  13278.             (1..NUM_PREDEFINED_PMRK_BUNDLE);
  13279.      
  13280.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  13281.       -- the list text fonts.
  13282.      
  13283.       LIST_TEXT_FONT_AND_PRECISION :  TEXT_FONT_PRECISIONS.LIST_OF;
  13284.      
  13285.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  13286.       -- characters.
  13287.      
  13288.       NUM_AVAILABLE_CHAR_EXPANSIONS : NATURAL;
  13289.       RANGE_OF_CHAR_EXPANSIONS      : RANGE_OF_EXPANSIONS;
  13290.      
  13291.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  13292.       -- character heights.
  13293.      
  13294.       NUM_AVAILABLE_CHAR_HEIGHTS : NATURAL;
  13295.       RANGE_OF_CHAR_HEIGHTS      : DC.RANGE_OF_MAGNITUDES;
  13296.      
  13297.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  13298.       -- text bundles.
  13299.      
  13300.       PREDEFINED_TEXT_BUNDLES : WS_TABLE_TYPES.TEXT_BUNDLE_LIST
  13301.             (1..NUM_PREDEFINED_TEXT_BUNDLE);
  13302.      
  13303.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  13304.       -- fill areas. It is the list of predefined INTERIOR_STYLES,
  13305.       -- HATCH_STYLES, and FILL_AREA_BUNDLES.
  13306.      
  13307.       LIST_OF_AVAL_INTERIOR_STYLE : INTERIOR_STYLES.LIST_OF;
  13308.       LIST_OF_AVAL_HATCH_STYLE    : HATCH_STYLES.LIST_OF;
  13309.       PREDEFINED_FA_BUNDLES       : WS_TABLE_TYPES.FILL_AREA_BUNDLE_LIST
  13310.             (1..NUM_PREDEFINED_FA_BUNDLE);
  13311.      
  13312.       -- entries in this group exist for OUTPUT,OUTIN and refer to
  13313.       -- pattern tables. It is the list of predefined patterns.
  13314.      
  13315.       PREDEFINED_PATTERN_REP : WS_TABLE_TYPES.PATTERN_TABLE_LIST
  13316.                                   (1..NUM_PREDEFINED_PATTERN_TABLE);
  13317.      
  13318.       -- entries in this group exist for OUTPUT, OUTIN and refer to
  13319.       -- colour tables.
  13320.      
  13321.       MAX_INTENSITIES             : WS_TABLE_TYPES.MAX_INTENSITIES_TYPE;
  13322.       NUM_OF_AVAL_COLOUR_INTENSITY : NATURAL;
  13323.       COLOUR_AVAL                  : COLOUR_AVAILABLE;
  13324.       PREDEFINED_COLOUR_REP        : WS_TABLE_TYPES.COLOUR_TABLE_LIST
  13325.                                         (0..LAST_PREDEFINED_COLOUR_REP);
  13326.      
  13327.       -- entries in this group exist for OUTPUT, OUTIN and refer to
  13328.       -- generalized drawing primitives (GDP)
  13329.      
  13330.       AVAL_GDP  : GDP_IDS.LIST_OF;
  13331.       ATTR_USED : WS_TABLE_TYPES.ATTR_USED_LIST (1 .. NUM_OF_GDP_ID);
  13332.      
  13333.       -- entries in this group exist for OUTPUT, OUTIN and refer to the
  13334.       -- the maximum number of predefined values for this implementation
  13335.      
  13336.       MAX_NUM_PLIN_BUNDLE_TBL_ENTRIES : NATURAL;
  13337.       MAX_NUM_PMRK_BUNDLE_TBL_ENTRIES : NATURAL;
  13338.       MAX_NUM_TEXT_BUNDLE_TBL_ENTRIES : NATURAL;
  13339.       MAX_NUM_FA_BUNDLE_TBL_ENTRIES   : NATURAL;
  13340.       MAX_NUM_PATTERN_INDICES         : NATURAL;
  13341.       MAX_NUM_COLOUR_INDICES          : NATURAL;
  13342.      
  13343.       -- entries in this group exist for OUTPUT, OUTIN and refer to
  13344.       -- segments
  13345.      
  13346.       NUM_OF_SEG_PRIO_SUPPORTED  : NATURAL;
  13347.       SEGMENT_DYNAMICS        : DYN_MOD_ACCEPTED_FOR_SEGMENT_ATTRIBUTES;
  13348.      
  13349.    end record;
  13350.      
  13351. end WS_DESCRIPTION_TABLE_TYPES;
  13352. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13353. --:UDD:GKSADACM:CODE:0A:WSR_INQ_WS_DSCR_0A.ADA
  13354. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13355. ------------------------------------------------------------------
  13356. --
  13357. --  NAME: WSR_INQ_WS_DESCRIPTION_TABLE_0A
  13358. --  IDENTIFIER: GDMXXX.2(1)
  13359. --  DISCREPANCY REPORTS:
  13360. --  DR017  Change pattern to access type.
  13361. ------------------------------------------------------------------
  13362. -- file: WSR_INQ_WS_DSCR_0A.ADA
  13363. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  13364.      
  13365. with GKS_TYPES;
  13366. with CGI;
  13367. with WS_DESCRIPTION_TABLE_TYPES;
  13368.      
  13369. use GKS_TYPES;
  13370. use CGI;
  13371.      
  13372. package WSR_INQ_WS_DESCRIPTION_TABLE_0A is
  13373.      
  13374. -- The parameter types used in this package are declared in GKS_TYPES
  13375. -- and WS_DESCRIPTION_TABLE_TYPES. In each procedure the workstation
  13376. -- description table containing the information to be returned
  13377. -- is passed in from the workstation driver.
  13378.      
  13379.    procedure INQ_WS_CATEGORY
  13380.       (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13381.        CATEGORY    : out WS_CATEGORY);
  13382.      
  13383.    procedure INQ_WS_CLASS
  13384.       (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13385.        CLASS       : out DISPLAY_CLASS);
  13386.      
  13387.    procedure INQ_PREDEFINED_POLYLINE_REPRESENTATION
  13388.       (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13389.        INDEX       : in POLYLINE_INDEX;
  13390.        LINE        : out LINETYPE;
  13391.        WIDTH       : out LINE_WIDTH;
  13392.        COLOUR      : out COLOUR_INDEX;
  13393.        EI          : out ERROR_INDICATOR);
  13394.      
  13395.    procedure INQ_PREDEFINED_POLYMARKER_REPRESENTATION
  13396.       (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13397.        INDEX       : in POLYMARKER_INDEX;
  13398.        MARKER      : out MARKER_TYPE;
  13399.        SIZE        : out MARKER_SIZE;
  13400.        COLOUR      : out COLOUR_INDEX;
  13401.        EI          : out ERROR_INDICATOR);
  13402.      
  13403.    procedure INQ_PREDEFINED_TEXT_REPRESENTATION
  13404.       (WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13405.        INDEX          : in TEXT_INDEX;
  13406.        FONT_PRECISION : out TEXT_FONT_PRECISION;
  13407.        EXPANSION      : out CHAR_EXPANSION;
  13408.        SPACING        : out CHAR_SPACING;
  13409.        COLOUR         : out COLOUR_INDEX;
  13410.        EI             : out ERROR_INDICATOR);
  13411.      
  13412.    procedure INQ_PREDEFINED_FILL_AREA_REPRESENTATION
  13413.       (WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13414.        INDEX         : in FILL_AREA_INDEX;
  13415.        INTERIOR      : out INTERIOR_STYLE;
  13416.        STYLE         : out STYLE_INDEX;
  13417.        COLOUR        : out COLOUR_INDEX;
  13418.        EI            : out ERROR_INDICATOR);
  13419.      
  13420.    procedure INQ_PATTERN_FACILITIES
  13421.       (WS_DSCR_TBL  : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13422.        NUMBER_OF_INDICES : out NATURAL);
  13423.      
  13424.    procedure INQ_PREDEFINED_PATTERN_REPRESENTATION
  13425.       (WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13426.        INDEX         : in PATTERN_INDEX;
  13427.        PATTERN       : out ACCESS_COLOUR_MATRIX_TYPE;
  13428.        EI            : out ERROR_INDICATOR);
  13429.      
  13430.    procedure INQ_PREDEFINED_COLOUR_REPRESENTATION
  13431.       (WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13432.        INDEX         : in COLOUR_INDEX;
  13433.        COLOUR        : out COLOUR_REPRESENTATION;
  13434.        EI            : out ERROR_INDICATOR);
  13435.      
  13436.    procedure INQ_LIST_OF_AVAILABLE_GDP
  13437.       (WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13438.        LIST_OF_GDP   : out GDP_IDS.LIST_OF);
  13439.      
  13440.    procedure INQ_GDP
  13441.       (WS_DSCR_TBL  : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13442.        GDP          : in GDP_ID;
  13443.        LIST_OF_ATTRIBUTES_USED : out ATTRIBUTES_USED.LIST_OF;
  13444.        EI           : out ERROR_INDICATOR);
  13445.      
  13446. end WSR_INQ_WS_DESCRIPTION_TABLE_0A;
  13447. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13448. --:UDD:GKSADACM:CODE:0A:WSR_INQ_WS_DSCR_0A_B.ADA
  13449. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13450. ------------------------------------------------------------------
  13451. --
  13452. --  NAME: WSR_INQ_WS_DESCRIPTION_TABLE_0A - BODY
  13453. --  IDENTIFIER: GDMXXX.2(1)
  13454. --  DISCREPANCY REPORTS:
  13455. --  DR017  Change pattern to access type.
  13456. ------------------------------------------------------------------
  13457. -- file: WSR_INQ_WS_DSCR_0A_B.ADA
  13458. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  13459.      
  13460. with GKS_ERRORS;
  13461.      
  13462. package body WSR_INQ_WS_DESCRIPTION_TABLE_0A is
  13463.      
  13464. -- The following procedures inquire into the specified WS_DSCR_TBL
  13465. -- to return the inquired information.
  13466. -- GKS_ERRORS declares the error constants used to set the error
  13467. -- indicator in some procedures.
  13468.      
  13469.    procedure INQ_WS_CATEGORY
  13470.       (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13471.        CATEGORY    : out WS_CATEGORY) is separate;
  13472.      
  13473.    procedure INQ_WS_CLASS
  13474.       (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13475.        CLASS       : out DISPLAY_CLASS) is separate;
  13476.      
  13477.    procedure INQ_PREDEFINED_POLYLINE_REPRESENTATION
  13478.       (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13479.        INDEX       : in POLYLINE_INDEX;
  13480.        LINE        : out LINETYPE;
  13481.        WIDTH       : out LINE_WIDTH;
  13482.        COLOUR      : out COLOUR_INDEX;
  13483.        EI          : out ERROR_INDICATOR) is separate;
  13484.      
  13485.    procedure INQ_PREDEFINED_POLYMARKER_REPRESENTATION
  13486.       (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13487.        INDEX       : in POLYMARKER_INDEX;
  13488.        MARKER      : out MARKER_TYPE;
  13489.        SIZE        : out MARKER_SIZE;
  13490.        COLOUR      : out COLOUR_INDEX;
  13491.        EI          : out ERROR_INDICATOR) is separate;
  13492.      
  13493.    procedure INQ_PREDEFINED_TEXT_REPRESENTATION
  13494.       (WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13495.        INDEX          : in TEXT_INDEX;
  13496.        FONT_PRECISION : out TEXT_FONT_PRECISION;
  13497.        EXPANSION      : out CHAR_EXPANSION;
  13498.        SPACING        : out CHAR_SPACING;
  13499.        COLOUR         : out COLOUR_INDEX;
  13500.        EI             : out ERROR_INDICATOR) is separate;
  13501.      
  13502.    procedure INQ_PREDEFINED_FILL_AREA_REPRESENTATION
  13503.       (WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13504.        INDEX         : in FILL_AREA_INDEX;
  13505.        INTERIOR      : out INTERIOR_STYLE;
  13506.        STYLE         : out STYLE_INDEX;
  13507.        COLOUR        : out COLOUR_INDEX;
  13508.        EI            : out ERROR_INDICATOR) is separate;
  13509.      
  13510.    procedure INQ_PATTERN_FACILITIES
  13511.       (WS_DSCR_TBL  : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13512.        NUMBER_OF_INDICES : out NATURAL) is separate;
  13513.      
  13514.    procedure INQ_PREDEFINED_PATTERN_REPRESENTATION
  13515.       (WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13516.        INDEX         : in PATTERN_INDEX;
  13517.        PATTERN       : out ACCESS_COLOUR_MATRIX_TYPE;
  13518.        EI            : out ERROR_INDICATOR) is separate;
  13519.      
  13520.    procedure INQ_PREDEFINED_COLOUR_REPRESENTATION
  13521.       (WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13522.        INDEX         : in COLOUR_INDEX;
  13523.        COLOUR        : out COLOUR_REPRESENTATION;
  13524.        EI            : out ERROR_INDICATOR) is separate;
  13525.      
  13526.    procedure INQ_LIST_OF_AVAILABLE_GDP
  13527.       (WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13528.        LIST_OF_GDP   : out GDP_IDS.LIST_OF) is separate;
  13529.      
  13530.    procedure INQ_GDP
  13531.       (WS_DSCR_TBL  : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13532.        GDP          : in GDP_ID;
  13533.        LIST_OF_ATTRIBUTES_USED : out ATTRIBUTES_USED.LIST_OF;
  13534.        EI           : out ERROR_INDICATOR)
  13535.              is separate;
  13536.      
  13537. end WSR_INQ_WS_DESCRIPTION_TABLE_0A;
  13538. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13539. --:UDD:GKSADACM:CODE:0A:WSR_INQ_WS_CATEGORY.ADA
  13540. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13541. ------------------------------------------------------------------
  13542. --
  13543. --  NAME: INQ_WS_CATEGORY
  13544. --  IDENTIFIER: GDMXXX.1(1)
  13545. --  DISCREPANCY REPORTS:
  13546. --
  13547. ------------------------------------------------------------------
  13548. -- file:  WSR_INQ_WS_CATEGORY.ADA
  13549. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  13550.      
  13551. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  13552.      
  13553. procedure INQ_WS_CATEGORY
  13554.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13555.     CATEGORY    : out WS_CATEGORY) is
  13556.      
  13557. -- The requested information is retrieved from WS_DSCR_TBL and
  13558. -- returned in the specified parameter.
  13559. --
  13560. -- The parameters in this procedure are used as follows:
  13561. -- WS_DSCR_TBL  - the workstation description table being inquired.
  13562. -- CATEGORY     - The category of the specified workstation being
  13563. --                inquired.
  13564.      
  13565. begin
  13566.      
  13567.    -- return the inquired category from the workstation
  13568.    -- description table.
  13569.      
  13570.    CATEGORY := WS_DSCR_TBL.WORKSTATION_CATEGORY;
  13571.      
  13572. end INQ_WS_CATEGORY;
  13573. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13574. --:UDD:GKSADACM:CODE:0A:WSR_INQ_WS_CLASS.ADA
  13575. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13576. ------------------------------------------------------------------
  13577. --
  13578. --  NAME: INQ_WS_CLASS
  13579. --  IDENTIFIER: GDMXXX.1(1)
  13580. --  DISCREPANCY REPORTS:
  13581. --
  13582. ------------------------------------------------------------------
  13583. -- file : WSR_INQ_WS_CLASS.ADA
  13584. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  13585.      
  13586. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  13587.      
  13588. procedure INQ_WS_CLASS
  13589.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13590.     CLASS       : out DISPLAY_CLASS) is
  13591.      
  13592. -- The requested information is retrieved from WS_DSCR_TBL and
  13593. -- returned in the specified parameter.
  13594. --
  13595. -- The parameters in this procedure are used as follows:
  13596. -- WS_DSCR_TBL    - the workstation description table being inquired.
  13597. -- CLASS          - the class of workstation being inquired.
  13598.      
  13599. begin
  13600.      
  13601.    -- return the class from the workstation description table.
  13602.      
  13603.    CLASS := WS_DSCR_TBL.DISPLAY_TYPE;
  13604.      
  13605. end INQ_WS_CLASS;
  13606. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13607. --:UDD:GKSADACM:CODE:0A:WSR_INQ_PRE_PLIN_REP.ADA
  13608. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13609. ------------------------------------------------------------------
  13610. --
  13611. --  NAME: INQ_PREDEFINED_POLYLINE_REPRESENTATION
  13612. --  IDENTIFIER: GDMXXX.1(2)
  13613. --  DISCREPANCY REPORTS:
  13614. --  DR010  Bundle indices converted to natural
  13615. ------------------------------------------------------------------
  13616. -- file:  WSR_INQ_PRE_PLIN_REP.ADA
  13617. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  13618.      
  13619. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  13620.      
  13621. procedure INQ_PREDEFINED_POLYLINE_REPRESENTATION
  13622.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13623.     INDEX       : in POLYLINE_INDEX;
  13624.     LINE        : out LINETYPE;
  13625.     WIDTH       : out LINE_WIDTH;
  13626.     COLOUR      : out COLOUR_INDEX;
  13627.     EI          : out ERROR_INDICATOR) is
  13628.      
  13629. -- The requested information is retrieved from WS_DSCR_TBL and
  13630. -- returned in the specified parameters.
  13631. --
  13632. -- This procedure checks the following errors:
  13633. --
  13634. -- EI is set to NO_PREDEF_POLYLINE_REP if a representation for
  13635. -- the specified polyline index is not predefined on the workstation.
  13636. --
  13637. -- The parameters in this procedure are used as follows:
  13638. --
  13639. -- WS_DSCR_TBL   - the workstation description table being inquired.
  13640. -- INDEX         - the index specifying the bundle being inquired.
  13641. -- LINE          - the line style being inquired from the specified
  13642. --                 bundle.
  13643. -- WIDTH         - the line width scale factor being inquired.
  13644. -- COLOUR        - the line colour being inquired.
  13645. -- EI            - An error indicator used for logging errors.
  13646.      
  13647. begin
  13648.      
  13649.    -- set the error indicator to insure that a successful value
  13650.    -- is passed out when no errors occur.
  13651.    EI := GKS_ERRORS.SUCCESSFUL;
  13652.      
  13653.    -- set the out parameters to default values.
  13654.    LINE := LINETYPE'FIRST;
  13655.    WIDTH := LINE_WIDTH'FIRST;
  13656.    COLOUR := COLOUR_INDEX'FIRST;
  13657.      
  13658.    if NATURAL(INDEX) not in
  13659.          WS_DSCR_TBL.PREDEFINED_PLIN_BUNDLES'RANGE then
  13660.      
  13661.       -- the specified polyline representation has not been predefined
  13662.       -- on this workstation.
  13663.      
  13664.       EI := GKS_ERRORS.NO_PREDEF_POLYLINE_REP;
  13665.      
  13666.    else
  13667.      
  13668.       -- Return the line type from the specified bundle in the
  13669.       -- specified workstation description table.
  13670.      
  13671.       LINE := WS_DSCR_TBL.PREDEFINED_PLIN_BUNDLES(NATURAL(INDEX))
  13672.             .L_TYPE;
  13673.      
  13674.       -- Return the line width from the specified bundle in the
  13675.       -- specified workstation description table.
  13676.      
  13677.       WIDTH := WS_DSCR_TBL.PREDEFINED_PLIN_BUNDLES(NATURAL(INDEX))
  13678.             .L_WIDTH;
  13679.      
  13680.       -- Return the colour index from the specified bundle in the
  13681.       -- specified workstation description table.
  13682.      
  13683.       COLOUR := WS_DSCR_TBL.PREDEFINED_PLIN_BUNDLES(NATURAL(INDEX))
  13684.             .COLOUR;
  13685.      
  13686.    end if;
  13687.      
  13688. end INQ_PREDEFINED_POLYLINE_REPRESENTATION;
  13689. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13690. --:UDD:GKSADACM:CODE:0A:WSR_INQ_PRE_PMRK_REP.ADA
  13691. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13692. ------------------------------------------------------------------
  13693. --
  13694. --  NAME: INQ_PREDEFINED_POLYMARKER_REPRESENTATION
  13695. --  IDENTIFIER: GDMXXX.1(2)
  13696. --  DISCREPANCY REPORTS:
  13697. --  DR010 Bundle indices converted to natural
  13698. ------------------------------------------------------------------
  13699. -- file:  WSR_INQ_PRE_PMRK_REP.ADA
  13700. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  13701.      
  13702. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  13703.      
  13704. procedure INQ_PREDEFINED_POLYMARKER_REPRESENTATION
  13705.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13706.     INDEX       : in POLYMARKER_INDEX;
  13707.     MARKER      : out MARKER_TYPE;
  13708.     SIZE        : out MARKER_SIZE;
  13709.     COLOUR      : out COLOUR_INDEX;
  13710.     EI          : out ERROR_INDICATOR) is
  13711.      
  13712. -- The requested information is retrieved from WS_DSCR_TBL and
  13713. -- returned in the specified parameters.
  13714. --
  13715. -- This procedure checks for the following error:
  13716. --
  13717. -- EI is set to NO_PREDEF_POLYMARKER_REP if a representation for
  13718. -- the specified polymarker index has not been predefined on the
  13719. -- workstation.
  13720. --
  13721. -- The parameters in this procedure are used as follows:
  13722. -- WS_DSCR_TBL - the workstation description table to inquire.
  13723. -- INDEX       - the index of the bundle being inquired.
  13724. -- MARKER      - the type of polymarker to inquire.
  13725. -- SIZE        - the scale factor to inquire.
  13726. -- COLOUR      - the colour of polymarker to inquire.
  13727. -- EI          - An error indicator used for logging errors.
  13728.      
  13729. begin
  13730.      
  13731.    -- set the error indicator to insure that a successful value
  13732.    -- is passed out when no errors occur.
  13733.    EI := GKS_ERRORS.SUCCESSFUL;
  13734.      
  13735.    -- set the out parameters to default values.
  13736.    MARKER := MARKER_TYPE'FIRST;
  13737.    SIZE   := MARKER_SIZE'FIRST;
  13738.    COLOUR := COLOUR_INDEX'FIRST;
  13739.      
  13740.    if NATURAL(INDEX) not in
  13741.          WS_DSCR_TBL.PREDEFINED_PMRK_BUNDLES'RANGE then
  13742.      
  13743.       -- the specified polymarker bundle has not been predefined
  13744.       -- on this workstation.
  13745.      
  13746.       EI := GKS_ERRORS.NO_PREDEF_POLYMARKER_REP;
  13747.      
  13748.    else
  13749.      
  13750.       -- Return the marker type from the specified bundle in the
  13751.       -- specified WS_DSCR_TBL.
  13752.      
  13753.       MARKER := WS_DSCR_TBL.PREDEFINED_PMRK_BUNDLES(NATURAL(INDEX))
  13754.             .M_TYPE;
  13755.      
  13756.       -- Return the marker size from the specified bundle in the
  13757.       -- specified WS_DSCR_TBL.
  13758.      
  13759.       SIZE := WS_DSCR_TBL.PREDEFINED_PMRK_BUNDLES(NATURAL(INDEX))
  13760.             .M_SIZE;
  13761.      
  13762.       -- Return the colour index from the specified bundle in the
  13763.       -- specified WS_DSCR_TBL.
  13764.      
  13765.       COLOUR := WS_DSCR_TBL.PREDEFINED_PMRK_BUNDLES(NATURAL(INDEX))
  13766.             .COLOUR;
  13767.      
  13768.    end if;
  13769.      
  13770. end INQ_PREDEFINED_POLYMARKER_REPRESENTATION;
  13771. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13772. --:UDD:GKSADACM:CODE:0A:WSR_INQ_PRE_TEXT_REP.ADA
  13773. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13774. ------------------------------------------------------------------
  13775. --
  13776. --  NAME: INQ_PREDEFINED_TEXT_REPRESENTATION
  13777. --  IDENTIFIER: GDMXXX.1(2)
  13778. --  DISCREPANCY REPORTS:
  13779. --  DR010  Bundle indices converted to natural
  13780. ------------------------------------------------------------------
  13781. -- file:  WSR_INQ_PRE_TEXT_REP.ADA
  13782. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  13783.      
  13784. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  13785.      
  13786. procedure INQ_PREDEFINED_TEXT_REPRESENTATION
  13787.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13788.     INDEX       : in TEXT_INDEX;
  13789.     FONT_PRECISION : out TEXT_FONT_PRECISION;
  13790.     EXPANSION   : out CHAR_EXPANSION;
  13791.     SPACING     : out CHAR_SPACING;
  13792.     COLOUR      : out COLOUR_INDEX;
  13793.     EI          : out ERROR_INDICATOR) is
  13794.      
  13795. -- The requested information is retrieved from WS_DSCR_TBL and
  13796. -- returned in the specified parameters.
  13797. --
  13798. -- This procedure checks for the following error:
  13799. --
  13800. -- EI is set to NO_PREDEF_TEXT_REP if a representation for
  13801. -- the specified text index is not predefined on the workstation.
  13802. --
  13803. -- The following parameters are used:
  13804. -- WS_DSCR_TBL       - the workstation description table to inquire.
  13805. -- INDEX             - the text bundle index.
  13806. -- FONT_PRECISION    - the precision of the text being drawn
  13807. --                     (char, stroke, etc).
  13808. -- EXPANSION         - the scale factor of the width of
  13809. --                     the characters.
  13810. -- SPACING           - the scale factor of the space between
  13811. --                     characters.
  13812. -- COLOUR            - the colour of the text.
  13813. -- EI                - the error indicator used for logging errors
  13814.      
  13815. begin
  13816.      
  13817.    -- set the error indicator to insure that a successful value
  13818.    -- is passed out when no errors occur.
  13819.    EI := GKS_ERRORS.SUCCESSFUL;
  13820.      
  13821.    -- set the out parameters to default values.
  13822.    FONT_PRECISION := (TEXT_FONT'FIRST,TEXT_PRECISION'FIRST);
  13823.    EXPANSION := CHAR_EXPANSION'FIRST;
  13824.    SPACING := CHAR_SPACING'FIRST;
  13825.    COLOUR := COLOUR_INDEX'FIRST;
  13826.      
  13827.    if NATURAL(INDEX) not in
  13828.          WS_DSCR_TBL.PREDEFINED_TEXT_BUNDLES'RANGE then
  13829.      
  13830.       -- the specified text bundle has not been predefined on this
  13831.       -- workstation.
  13832.      
  13833.       EI := GKS_ERRORS.NO_PREDEF_TEXT_REP;
  13834.      
  13835.    else
  13836.      
  13837.       -- Return the text precision from the specified bundle in the
  13838.       -- specified WS_DSCR_TBL.
  13839.      
  13840.       FONT_PRECISION := WS_DSCR_TBL
  13841.             .PREDEFINED_TEXT_BUNDLES(NATURAL(INDEX)).TEXT_FONT;
  13842.      
  13843.       -- Return the character expansion from the specified bundle in
  13844.       -- specified WS_DSCR_TBL.
  13845.      
  13846.       EXPANSION := WS_DSCR_TBL
  13847.             .PREDEFINED_TEXT_BUNDLES(NATURAL(INDEX)).CH_EXPANSION;
  13848.      
  13849.       -- Return the character spacing from the specified bundle in
  13850.       -- specified WS_DSCR_TBL.
  13851.      
  13852.       SPACING := WS_DSCR_TBL
  13853.             .PREDEFINED_TEXT_BUNDLES(NATURAL(INDEX)).CH_SPACE;
  13854.      
  13855.       -- Return the colour index from the specified bundle in the
  13856.       -- specified WS_DSCR_TBL.
  13857.      
  13858.       COLOUR := WS_DSCR_TBL
  13859.             .PREDEFINED_TEXT_BUNDLES(NATURAL(INDEX)).COLOUR;
  13860.      
  13861.    end if;
  13862.      
  13863. end INQ_PREDEFINED_TEXT_REPRESENTATION;
  13864. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13865. --:UDD:GKSADACM:CODE:0A:WSR_INQ_PRE_FA_REP.ADA
  13866. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13867. ------------------------------------------------------------------
  13868. --
  13869. --  NAME: INQ_PREDEFINED_FILL_AREA_REPRESENTATION
  13870. --  IDENTIFIER: GDMXXX.1(2)
  13871. --  DISCREPANCY REPORTS:
  13872. --  DR010  Bundle indices converted to natural
  13873. ------------------------------------------------------------------
  13874. -- file:  WSR_INQ_PRE_FA_REP.ADA
  13875. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  13876.      
  13877. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  13878.      
  13879. procedure INQ_PREDEFINED_FILL_AREA_REPRESENTATION
  13880.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13881.     INDEX       : in FILL_AREA_INDEX;
  13882.     INTERIOR    : out INTERIOR_STYLE;
  13883.     STYLE       : out STYLE_INDEX;
  13884.     COLOUR      : out COLOUR_INDEX;
  13885.     EI          : out ERROR_INDICATOR) is
  13886.      
  13887. -- The requested information is retrieved from WS_DSCR_TBL and
  13888. -- returned in the specified parameters.
  13889. --
  13890. -- This procedure checks for the following error:
  13891. --
  13892. -- EI is set to WS_NO_PREDEF_FILL_AREA_REP if a representation
  13893. -- for the specified fill area index has not been predefined
  13894. -- on the workstation.
  13895. --
  13896. -- The following are parameters used:
  13897. -- WS_DSCR_TBL  - the type of workstation being inquired.
  13898. -- INDEX        - a record type containing the style
  13899. --                fill (hollow, solid, hatch, or pattern).
  13900. -- STYLE        - An index value if the style is HATCH
  13901. --                or PATTERN.
  13902. -- COLOUR       - the colour of the fill.
  13903. -- EI           - an error indicator to log any error detected.
  13904.      
  13905. begin
  13906.      
  13907.    -- set the error indicator to insure that a successful value
  13908.    -- is passed out when no errors occur.
  13909.    EI := GKS_ERRORS.SUCCESSFUL;
  13910.      
  13911.    -- set the out parameters to default values.
  13912.    INTERIOR := INTERIOR_STYLE'FIRST;
  13913.    STYLE := STYLE_INDEX'FIRST;
  13914.    COLOUR := COLOUR_INDEX'FIRST;
  13915.      
  13916.    if NATURAL(INDEX) not in WS_DSCR_TBL.PREDEFINED_FA_BUNDLES'RANGE then
  13917.      
  13918.       -- the specified fill area bundle has not been predefined
  13919.       -- on this workstation.
  13920.      
  13921.       EI := GKS_ERRORS.NO_PREDEF_FILL_AREA_REP;
  13922.      
  13923.    else
  13924.      
  13925.       -- Return the fill area interior style from the specified bundle
  13926.       -- in the specified WS_DSCR_TBL.
  13927.      
  13928.       INTERIOR := WS_DSCR_TBL
  13929.             .PREDEFINED_FA_BUNDLES(NATURAL(INDEX)).INT_STYLE;
  13930.      
  13931.       -- Return the fill area style index from the specified bundle
  13932.       -- in the specified WS_DSCR_TBL.
  13933.      
  13934.       STYLE := WS_DSCR_TBL
  13935.              .PREDEFINED_FA_BUNDLES(NATURAL(INDEX)).STYLE;
  13936.      
  13937.       -- Return the colour index from the specified bundle in the
  13938.       -- in the specified WS_DSCR_TBL.
  13939.      
  13940.       COLOUR := WS_DSCR_TBL
  13941.             .PREDEFINED_FA_BUNDLES(NATURAL(INDEX)).COLOUR;
  13942.      
  13943.    end if;
  13944.      
  13945. end INQ_PREDEFINED_FILL_AREA_REPRESENTATION;
  13946. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13947. --:UDD:GKSADACM:CODE:0A:WSR_INQ_PAT_FAC.ADA
  13948. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13949. ------------------------------------------------------------------
  13950. --
  13951. --  NAME: INQ_PATTERN_FACILITIES
  13952. --  IDENTIFIER: GDMXXX.1(1)
  13953. --  DISCREPANCY REPORTS:
  13954. --
  13955. ------------------------------------------------------------------
  13956. -- file:  WSR_INQ_PAT_FAC.ADA
  13957. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  13958.      
  13959. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  13960.      
  13961. procedure INQ_PATTERN_FACILITIES
  13962.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13963.     NUMBER_OF_INDICES : out NATURAL) is
  13964.      
  13965. -- The requested information is retrieved from WS_DSCR_TBL and
  13966. -- returned in the specified parameter.
  13967. --
  13968. -- The parameters of this procedure are used as follows:
  13969. -- WS_DSCR_TBL - the workstation description table being inquired.
  13970. -- NUMBER_OF_INDICES - the number of predefined pattern indices.
  13971.      
  13972. begin
  13973.      
  13974.    -- Return the number of pattern indices from the specified bundle
  13975.    -- in the specified WS_DSCR_TBL.
  13976.      
  13977.    NUMBER_OF_INDICES := WS_DSCR_TBL.PREDEFINED_PATTERN_REP'LENGTH;
  13978.      
  13979. end INQ_PATTERN_FACILITIES;
  13980. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13981. --:UDD:GKSADACM:CODE:0A:WSR_INQ_PRE_PAT_REP.ADA
  13982. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  13983. ------------------------------------------------------------------
  13984. --
  13985. --  NAME: INQ_PREDEFINED_PATTERN_REPRESENTATION
  13986. --  IDENTIFIER: GDMXXX.2(1)
  13987. --  DISCREPANCY REPORTS:
  13988. --  DR017  Change pattern to access type.
  13989. ------------------------------------------------------------------
  13990. -- file:  WSR_INQ_PRE_PAT_REP.ADA
  13991. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  13992.      
  13993. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  13994.      
  13995. procedure INQ_PREDEFINED_PATTERN_REPRESENTATION
  13996.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  13997.     INDEX       : in PATTERN_INDEX;
  13998.     PATTERN     : out ACCESS_COLOUR_MATRIX_TYPE;
  13999.     EI          : out ERROR_INDICATOR) is
  14000.      
  14001. -- The requested information is retrieved from WS_DSCR_TBL and
  14002. -- returned in the specified parameter.
  14003. --
  14004. -- This procedure checks for the following errors:
  14005. --
  14006. -- EI is set to NO_PREDEF_PATTERN_REP if a representation for
  14007. -- the specified pattern index has not been predefined on the
  14008. -- workstation.
  14009. -- EI is set to PATTERN_STYLE_NOT_ON_WS if the interior style
  14010. -- PATTERN is not supported of that workstation.
  14011. --
  14012. -- The parameters in this procedure are used as follows:
  14013. -- WS_DSCR_TBL      - the workstation description table to be inquired.
  14014. -- INDEX            - the index into a pattern table.
  14015. -- PATTERN          - the two dimensional array of COLOUR_INDICES
  14016. --                    defining the pattern.
  14017. -- EI               - the error indicator used to log errors.
  14018.      
  14019.    function "="(A,B : INTERIOR_STYLES.LIST_OF) return BOOLEAN
  14020.          renames INTERIOR_STYLES."=";
  14021.      
  14022. begin
  14023.      
  14024.    -- set the error indicator to insure that a successful value
  14025.    -- is passed out when no errors occur.
  14026.    EI := GKS_ERRORS.SUCCESSFUL;
  14027.      
  14028.    if WS_DSCR_TBL.LIST_OF_AVAL_INTERIOR_STYLE =
  14029.          INTERIOR_STYLES.NULL_LIST then
  14030.      
  14031.       -- interior style PATTERN is not supported on this workstation.
  14032.       EI := GKS_ERRORS.PATTERN_STYLE_NOT_ON_WS;
  14033.      
  14034.    elsif NATURAL(INDEX) not in
  14035.          WS_DSCR_TBL.PREDEFINED_PATTERN_REP'RANGE then
  14036.      
  14037.       -- the specified pattern representation has not been predefined
  14038.       -- on this workstation.
  14039.      
  14040.       EI := GKS_ERRORS.NO_PREDEF_PATTERN_REP;
  14041.      
  14042.    else
  14043.      
  14044.       -- Return the pattern representation from the specified bundle
  14045.       -- in the specified WS_DSCR_TBL.
  14046.      
  14047.       PATTERN := new COLOUR_MATRICES.MATRIX_OF'(WS_DSCR_TBL
  14048.             .PREDEFINED_PATTERN_REP(NATURAL(INDEX)).MATRIX);
  14049.      
  14050.    end if;
  14051.      
  14052. end INQ_PREDEFINED_PATTERN_REPRESENTATION;
  14053. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14054. --:UDD:GKSADACM:CODE:0A:WSR_INQ_PRE_CLR_REP.ADA
  14055. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14056. ------------------------------------------------------------------
  14057. --
  14058. --  NAME: INQ_PREDEFINED_COLOUR_REPRESENTATION
  14059. --  IDENTIFIER: GDMXXX.1(1)
  14060. --  DISCREPANCY REPORTS:
  14061. --
  14062. ------------------------------------------------------------------
  14063. -- file:  WSR_INQ_PRE_CLR_REP.ADA
  14064. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  14065.      
  14066. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  14067.      
  14068. procedure INQ_PREDEFINED_COLOUR_REPRESENTATION
  14069.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  14070.     INDEX       : in COLOUR_INDEX;
  14071.     COLOUR      : out COLOUR_REPRESENTATION;
  14072.     EI          : out ERROR_INDICATOR) is
  14073.      
  14074. -- The requested information is retrieved from WS_DSCR_TBL and
  14075. -- returned in the specified parameters.
  14076. --
  14077. -- The parameters are used as follows:
  14078. -- WS_DSCR_TBL - the workstation description table to inquire.
  14079. -- INDEX       - the colour index value.
  14080. -- COLOUR      - The colour that the COLOUR_INDEX value
  14081. --               represents in terms of red, green, and blue
  14082. --               intensities.
  14083. -- EI          - the error indicator to log any errors.
  14084.      
  14085. begin
  14086.      
  14087.    -- set the error indicator to insure that a successful value
  14088.    -- is passed out when no errors occur.
  14089.    EI := GKS_ERRORS.SUCCESSFUL;
  14090.      
  14091.    -- set the out parameter to the default value.
  14092.    COLOUR := (0.0,0.0,0.0);
  14093.      
  14094.    if INDEX not in WS_DSCR_TBL.PREDEFINED_COLOUR_REP'RANGE then
  14095.      
  14096.       -- the specified colour table has not been predefined on
  14097.       -- this workstation.
  14098.      
  14099.       EI := GKS_ERRORS.NO_PREDEF_COLOUR_REP;
  14100.    else
  14101.      
  14102.       -- Return the colour representation from the specified bundle in the
  14103.       -- specified WS_DSCR_TBL.
  14104.      
  14105.       COLOUR := WS_DSCR_TBL.PREDEFINED_COLOUR_REP(INDEX);
  14106.      
  14107.    end if;
  14108.      
  14109. end INQ_PREDEFINED_COLOUR_REPRESENTATION;
  14110. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14111. --:UDD:GKSADACM:CODE:0A:WSR_LST_OF_AVAL_GDP.ADA
  14112. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14113. ------------------------------------------------------------------
  14114. --
  14115. --  NAME: INQ_LIST_OF_AVAILABLE_GDP
  14116. --  IDENTIFIER: GDMXXX.1(1)
  14117. --  DISCREPANCY REPORTS:
  14118. --
  14119. ------------------------------------------------------------------
  14120. -- file:  WSR_LST_OF_AVAL_GDP.ADA
  14121. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  14122.      
  14123. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  14124.      
  14125. procedure INQ_LIST_OF_AVAILABLE_GDP
  14126.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  14127.     LIST_OF_GDP : out GDP_IDS.LIST_OF) is
  14128.      
  14129. -- The requested information is retrieved from WS_DSCR_TBL and
  14130. -- returned in the specified parameters.
  14131. --
  14132. -- The following parameters are used:
  14133. -- WS_DSCR_TBL      - the workstation description table to inquire.
  14134. -- LIST_OF_GDP      - gives a list of the GDP's.
  14135.      
  14136. begin
  14137.      
  14138.    -- Return the list of GDP's available on the specified workstation
  14139.    -- type.
  14140.      
  14141.    LIST_OF_GDP  := WS_DSCR_TBL.AVAL_GDP;
  14142.      
  14143. end INQ_LIST_OF_AVAILABLE_GDP;
  14144. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14145. --:UDD:GKSADACM:CODE:0A:WSR_INQ_GDP.ADA
  14146. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14147. ------------------------------------------------------------------
  14148. --
  14149. --  NAME: INQ_GDP
  14150. --  IDENTIFIER: GDMXXX.1(1)
  14151. --  DISCREPANCY REPORTS:
  14152. --
  14153. ------------------------------------------------------------------
  14154. -- file:  WSR_INQ_GDP.ADA
  14155. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  14156.      
  14157. separate (WSR_INQ_WS_DESCRIPTION_TABLE_0A)
  14158.      
  14159. procedure INQ_GDP
  14160.    (WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  14161.     GDP         : in GDP_ID;
  14162.     LIST_OF_ATTRIBUTES_USED : out ATTRIBUTES_USED.LIST_OF;
  14163.     EI          : out ERROR_INDICATOR) is
  14164.      
  14165. -- The requested information is retrieved from WS_DSCR_TBL and
  14166. -- returned in the specified parameters.
  14167. --
  14168. -- The following are parameters used:
  14169. -- WS_DESCRIPTION_TBL      - the description table to inquire.
  14170. -- GDP                     - the GDP being inquired.
  14171. -- LIST_OF_ATTRIBUTES_USED - tells whether POLYLINE attributes
  14172. --                           were used to generate the GDP, or
  14173. --                           POLYMARKER attributes etc.
  14174. -- EI                      - error indicator used to log errors.
  14175. --
  14176. -- The following error is checked:
  14177. --
  14178. -- EI is set to WS_TYPE_CANNOT_GEN_GDP if the specified workstation
  14179. -- type is not able to generate the specified generalized drawing
  14180. -- primitive.
  14181.      
  14182. begin
  14183.      
  14184.    -- set the error indicator to insure that a successful value
  14185.    -- is passed out when no errors occur.
  14186.    EI := GKS_ERRORS.SUCCESSFUL;
  14187.      
  14188.    -- set the default value for the out parameter.
  14189.    LIST_OF_ATTRIBUTES_USED := ATTRIBUTES_USED.NULL_LIST;
  14190.      
  14191.    if GDP_IDS.IS_IN_LIST(GDP,WS_DSCR_TBL.AVAL_GDP) then
  14192.      
  14193.       -- Return the list of attributes used by a specified GDP
  14194.       -- on the specified workstation type.
  14195.      
  14196.       LIST_OF_ATTRIBUTES_USED := WS_DSCR_TBL.ATTR_USED(GDP);
  14197.      
  14198.    else
  14199.      
  14200.       -- this workstation type is not able to generate the GDP.
  14201.       EI := GKS_ERRORS.WS_TYPE_CANNOT_GEN_GDP;
  14202.      
  14203.    end if;
  14204.      
  14205. end INQ_GDP;
  14206. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14207. --:UDD:GKSADACM:CODE:0A:GKS_0A.ADA
  14208. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14209. -- file:  gks_0a.ada
  14210. -- level: 0a
  14211.      
  14212. -- The following context clauses refer to the logical groups
  14213. -- for level 0a.
  14214.      
  14215. with EXTENDED_OUTPUT_PRIMITIVES;
  14216. with SET_INDIVIDUAL_ATTRIBUTES_0A;
  14217. with SET_BUNDLE_INDICES;
  14218. with SET_PRIMITIVE_ATTRIBUTES_0A;
  14219. with INQ_GKS_DESCRIPTION_TABLE_0A;
  14220. with INQ_GKS_STATE_LIST_0A;
  14221. with INQ_WS_DESCRIPTION_TABLE_0A;
  14222. with INQ_WS_STATE_LIST_0A;
  14223. with PIXELS;
  14224. --with GKS_METAFILES;
  14225.      
  14226. -- The following context clauses refer to the logical groups
  14227. -- for level ma.
  14228.      
  14229. with GKS_CONTROL;
  14230. with WS_CONTROL;
  14231. with OUTPUT_PRIMITIVES;
  14232. with SET_INDIVIDUAL_ATTRIBUTES_MA;
  14233. with SET_PRIMITIVE_ATTRIBUTES_MA;
  14234. with SET_COLOUR_TABLE;
  14235. with INQ_PRIMITIVE_ATTRIBUTES;
  14236. with INQ_BUNDLE_INDICES;
  14237. with INQ_INDIVIDUAL_ATTRIBUTES;
  14238. with GKS_NORMALIZATION;
  14239. with WS_TRANSFORMATION;
  14240. with INQ_GKS_STATE_LIST_MA;
  14241. with INQ_GKS_DESCRIPTION_TABLE_MA;
  14242. with INQ_WS_STATE_LIST_MA;
  14243. with INQ_WS_DESCRIPTION_TABLE_MA;
  14244. with ERROR_ROUTINES;
  14245.      
  14246. with GKS_TYPES;
  14247. with GKS_CONFIGURATION;
  14248.      
  14249. use GKS_TYPES;
  14250.      
  14251. package GKS_0A is
  14252.      
  14253. -- This package provides the interface to the applications user.
  14254. -- It provides the appropriate operations of both level ma and 0a
  14255. -- to give the user the full functionality of level 0a.
  14256.      
  14257.    -- Level ma logical groups.
  14258.      
  14259.    -- GKS_CONTROL logical functions
  14260.    procedure OPEN_GKS
  14261.       (ERROR_FILE      : in ERROR_FILE_TYPE :=
  14262.                          GKS_CONFIGURATION.DEFAULT_ERROR_FILE;
  14263.       AMOUNT_OF_MEMORY : in MEMORY_UNITS :=
  14264.                          GKS_CONFIGURATION.MAX_MEMORY_UNITS)
  14265.    renames GKS_CONTROL.OPEN_GKS;
  14266.      
  14267.    procedure CLOSE_GKS renames GKS_CONTROL.CLOSE_GKS;
  14268.      
  14269.      
  14270.    -- WS_CONTROL logical functions
  14271.    procedure OPEN_WS
  14272.       (WS        : in WS_ID;
  14273.       CONNECTION : in CONNECTION_ID;
  14274.       TYPE_OF_WS : in WS_TYPE)
  14275.    renames WS_CONTROL.OPEN_WS;
  14276.      
  14277.    procedure CLOSE_WS
  14278.       (WS : in WS_ID)
  14279.    renames WS_CONTROL.CLOSE_WS;
  14280.      
  14281.    procedure ACTIVATE_WS
  14282.       (WS : in WS_ID)
  14283.    renames WS_CONTROL.ACTIVATE_WS;
  14284.      
  14285.    procedure DEACTIVATE_WS
  14286.       (WS : in WS_ID)
  14287.    renames WS_CONTROL.DEACTIVATE_WS;
  14288.      
  14289.    procedure CLEAR_WS
  14290.       (WS  : in WS_ID;
  14291.       FLAG : in CONTROL_FLAG)
  14292.    renames WS_CONTROL.CLEAR_WS;
  14293.      
  14294.    procedure UPDATE_WS
  14295.       (WS          : in WS_ID;
  14296.       REGENERATION : in UPDATE_REGENERATION_FLAG)
  14297.    renames WS_CONTROL.UPDATE_WS;
  14298.      
  14299.      
  14300.    -- OUTPUT_PRIMITIVES logical functions
  14301.    procedure POLYLINE
  14302.       (LINE_POINTS : in WC.POINT_ARRAY)
  14303.    renames OUTPUT_PRIMITIVES.POLYLINE;
  14304.      
  14305.    procedure POLYMARKER
  14306.       (MARKER_POINTS : in WC.POINT_ARRAY)
  14307.    renames OUTPUT_PRIMITIVES.POLYMARKER;
  14308.      
  14309.      
  14310.    procedure FILL_AREA
  14311.       (FILL_AREA_POINTS : in WC.POINT_ARRAY)
  14312.    renames OUTPUT_PRIMITIVES.FILL_AREA;
  14313.      
  14314.    procedure TEXT
  14315.       (POSITION   : in WC.POINT;
  14316.       TEXT_STRING : in STRING)
  14317.    renames OUTPUT_PRIMITIVES.TEXT;
  14318.      
  14319.      
  14320.    -- SET_INDIVIDUAL_ATTRIBUTES_MA logical functions
  14321.    procedure SET_LINETYPE
  14322.       (LINE : in LINETYPE)
  14323.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_LINETYPE;
  14324.      
  14325.    procedure SET_POLYLINE_COLOUR_INDEX
  14326.       (COLOUR : in COLOUR_INDEX)
  14327.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_POLYLINE_COLOUR_INDEX;
  14328.      
  14329.    procedure SET_MARKER_TYPE
  14330.       (MARKER : in MARKER_TYPE)
  14331.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_MARKER_TYPE;
  14332.      
  14333.    procedure SET_POLYMARKER_COLOUR_INDEX
  14334.       (COLOUR : in COLOUR_INDEX)
  14335.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_POLYMARKER_COLOUR_INDEX;
  14336.      
  14337.    procedure SET_TEXT_COLOUR_INDEX
  14338.       (COLOUR : in COLOUR_INDEX)
  14339.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_TEXT_COLOUR_INDEX;
  14340.      
  14341.    procedure SET_FILL_AREA_INTERIOR_STYLE
  14342.       (STYLE : in INTERIOR_STYLE)
  14343.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_FILL_AREA_INTERIOR_STYLE;
  14344.      
  14345.    procedure SET_FILL_AREA_COLOUR_INDEX
  14346.       (COLOUR : in COLOUR_INDEX)
  14347.    renames SET_INDIVIDUAL_ATTRIBUTES_MA.SET_FILL_AREA_COLOUR_INDEX;
  14348.      
  14349.      
  14350.    -- SET_PRIMITIVE_ATTRIBUTES_MA logical functions
  14351.    procedure SET_CHAR_HEIGHT
  14352.       (HEIGHT : in WC.MAGNITUDE)
  14353.    renames SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_HEIGHT;
  14354.      
  14355.    procedure SET_CHAR_UP_VECTOR
  14356.       (CHAR_UP_VECTOR : IN WC.VECTOR)
  14357.    renames SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_UP_VECTOR;
  14358.      
  14359.    procedure SET_TEXT_ALIGNMENT
  14360.       (ALIGNMENT : in TEXT_ALIGNMENT)
  14361.    renames SET_PRIMITIVE_ATTRIBUTES_MA.SET_TEXT_ALIGNMENT;
  14362.      
  14363.      
  14364.    -- SET_COLOUR_TABLE logical functions
  14365.    procedure SET_COLOUR_REPRESENTATION
  14366.       (WS    : in WS_ID;
  14367.       INDEX  : in COLOUR_INDEX;
  14368.       COLOUR : in COLOUR_REPRESENTATION)
  14369.    renames SET_COLOUR_TABLE.SET_COLOUR_REPRESENTATION;
  14370.      
  14371.      
  14372.    -- INQ_PRIMITIVE_ATTRIBUTES logical functions
  14373.    procedure INQ_CHAR_HEIGHT
  14374.       (EI    : out ERROR_INDICATOR;
  14375.       HEIGHT : out WC.MAGNITUDE)
  14376.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_CHAR_HEIGHT;
  14377.      
  14378.    procedure INQ_CHAR_UP_VECTOR
  14379.       (EI    : out ERROR_INDICATOR;
  14380.       VECTOR : out WC.VECTOR)
  14381.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_CHAR_UP_VECTOR;
  14382.      
  14383.    procedure INQ_TEXT_PATH
  14384.       (EI  : out ERROR_INDICATOR;
  14385.       PATH : out TEXT_PATH)
  14386.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_TEXT_PATH;
  14387.      
  14388.    procedure INQ_TEXT_ALIGNMENT
  14389.       (EI       : out ERROR_INDICATOR;
  14390.       ALIGNMENT : out TEXT_ALIGNMENT)
  14391.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_TEXT_ALIGNMENT;
  14392.      
  14393.    procedure INQ_PATTERN_REFERENCE_POINT
  14394.       (EI             : out ERROR_INDICATOR;
  14395.       REFERENCE_POINT : out WC.POINT)
  14396.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_PATTERN_REFERENCE_POINT;
  14397.      
  14398.    procedure INQ_PATTERN_HEIGHT_VECTOR
  14399.       (EI    : out ERROR_INDICATOR;
  14400.       VECTOR : out WC.VECTOR)
  14401.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_PATTERN_HEIGHT_VECTOR;
  14402.      
  14403.    procedure INQ_PATTERN_WIDTH_VECTOR
  14404.       (EI   : out ERROR_INDICATOR;
  14405.       WIDTH : out WC.VECTOR)
  14406.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_PATTERN_WIDTH_VECTOR;
  14407.      
  14408.    procedure INQ_CHAR_WIDTH
  14409.       (EI   : out ERROR_INDICATOR;
  14410.       WIDTH : out WC.MAGNITUDE)
  14411.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_CHAR_WIDTH;
  14412.      
  14413.    procedure INQ_CHAR_BASE_VECTOR
  14414.       (EI    : out ERROR_INDICATOR;
  14415.       VECTOR : out WC.VECTOR)
  14416.    renames INQ_PRIMITIVE_ATTRIBUTES.INQ_CHAR_BASE_VECTOR;
  14417.      
  14418.      
  14419.    -- INQ_BUNDLE_INDICES logical functions
  14420.    procedure INQ_POLYLINE_INDEX
  14421.       (EI   : out ERROR_INDICATOR;
  14422.       INDEX : out POLYLINE_INDEX)
  14423.    renames INQ_BUNDLE_INDICES.INQ_POLYLINE_INDEX;
  14424.      
  14425.    procedure INQ_POLYMARKER_INDEX
  14426.       (EI   : out ERROR_INDICATOR;
  14427.       INDEX : out POLYMARKER_INDEX)
  14428.    renames INQ_BUNDLE_INDICES.INQ_POLYMARKER_INDEX;
  14429.      
  14430.    procedure INQ_TEXT_INDEX
  14431.       (EI   : out ERROR_INDICATOR;
  14432.       INDEX : out TEXT_INDEX)
  14433.    renames INQ_BUNDLE_INDICES.INQ_TEXT_INDEX;
  14434.      
  14435.    procedure INQ_FILL_AREA_INDEX
  14436.       (EI   : out ERROR_INDICATOR;
  14437.       INDEX : out FILL_AREA_INDEX)
  14438.    renames INQ_BUNDLE_INDICES.INQ_FILL_AREA_INDEX;
  14439.      
  14440.      
  14441.    -- INQ_INDIVIDUAL_ATTRIBUTES logical functions
  14442.    procedure INQ_LINETYPE
  14443.       (EI  : out ERROR_INDICATOR;
  14444.       LINE : out LINETYPE)
  14445.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_LINETYPE;
  14446.      
  14447.    procedure INQ_LINEWIDTH_SCALE_FACTOR
  14448.       (EI   : out ERROR_INDICATOR;
  14449.       WIDTH : out LINE_WIDTH)
  14450.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_LINEWIDTH_SCALE_FACTOR;
  14451.      
  14452.    procedure INQ_POLYLINE_COLOUR_INDEX
  14453.       (EI    : out ERROR_INDICATOR;
  14454.       COLOUR : out COLOUR_INDEX)
  14455.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_POLYLINE_COLOUR_INDEX;
  14456.      
  14457.    procedure INQ_POLYMARKER_TYPE
  14458.       (EI    : out ERROR_INDICATOR;
  14459.       MARKER : out MARKER_TYPE)
  14460.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_POLYMARKER_TYPE;
  14461.      
  14462.    procedure INQ_POLYMARKER_SIZE_SCALE_FACTOR
  14463.       (EI  : out ERROR_INDICATOR;
  14464.       SIZE : out MARKER_SIZE)
  14465.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_POLYMARKER_SIZE_SCALE_FACTOR;
  14466.      
  14467.    procedure INQ_POLYMARKER_COLOUR_INDEX
  14468.       (EI    : out ERROR_INDICATOR;
  14469.       COLOUR : out COLOUR_INDEX)
  14470.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_POLYMARKER_COLOUR_INDEX;
  14471.      
  14472.    procedure INQ_TEXT_FONT_AND_PRECISION
  14473.       (EI            : out ERROR_INDICATOR;
  14474.       FONT_PRECISION : out TEXT_FONT_PRECISION)
  14475.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_TEXT_FONT_AND_PRECISION;
  14476.      
  14477.    procedure INQ_CHAR_EXPANSION_FACTOR
  14478.       (EI       : out ERROR_INDICATOR;
  14479.       EXPANSION : out CHAR_EXPANSION)
  14480.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_CHAR_EXPANSION_FACTOR;
  14481.      
  14482.    procedure INQ_CHAR_SPACING
  14483.       (EI     : out ERROR_INDICATOR;
  14484.       SPACING : out CHAR_SPACING)
  14485.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_CHAR_SPACING;
  14486.      
  14487.    procedure INQ_TEXT_COLOUR_INDEX
  14488.       (EI    : out ERROR_INDICATOR;
  14489.       COLOUR : out COLOUR_INDEX)
  14490.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_TEXT_COLOUR_INDEX;
  14491.      
  14492.    procedure INQ_FILL_AREA_INTERIOR_STYLE
  14493.       (EI   : out ERROR_INDICATOR;
  14494.       STYLE : out INTERIOR_STYLE)
  14495.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_FILL_AREA_INTERIOR_STYLE;
  14496.      
  14497.    procedure INQ_FILL_AREA_STYLE_INDEX
  14498.       (EI   : out ERROR_INDICATOR;
  14499.       INDEX : out STYLE_INDEX)
  14500.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_FILL_AREA_STYLE_INDEX;
  14501.      
  14502.    procedure INQ_FILL_AREA_COLOUR_INDEX
  14503.       (EI    : out ERROR_INDICATOR;
  14504.       COLOUR : out COLOUR_INDEX)
  14505.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_FILL_AREA_COLOUR_INDEX;
  14506.      
  14507.    procedure INQ_LIST_OF_ASF
  14508.       (EI  : out ERROR_INDICATOR;
  14509.       LIST : out ASF_LIST)
  14510.    renames INQ_INDIVIDUAL_ATTRIBUTES.INQ_LIST_OF_ASF;
  14511.      
  14512.      
  14513.    -- GKS_NORMALIZATION logical functions
  14514.    procedure SET_WINDOW
  14515.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  14516.       WINDOW_LIMITS   : in WC.RECTANGLE_LIMITS)
  14517.    renames GKS_NORMALIZATION.SET_WINDOW;
  14518.      
  14519.    procedure SET_VIEWPORT
  14520.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  14521.       VIEWPORT_LIMITS : in NDC.RECTANGLE_LIMITS)
  14522.    renames GKS_NORMALIZATION.SET_VIEWPORT;
  14523.      
  14524.    procedure SELECT_NORMALIZATION_TRANSFORMATION
  14525.       (TRANSFORMATION : in TRANSFORMATION_NUMBER)
  14526.    renames GKS_NORMALIZATION.SELECT_NORMALIZATION_TRANSFORMATION;
  14527.      
  14528.    procedure SET_CLIPPING_INDICATOR
  14529.       (CLIPPING : in CLIPPING_INDICATOR)
  14530.    renames GKS_NORMALIZATION.SET_CLIPPING_INDICATOR;
  14531.      
  14532.      
  14533.    -- WS_TRANSFORMATION logical functions
  14534.    procedure SET_WS_WINDOW
  14535.       (WS              : in WS_ID;
  14536.       WS_WINDOW_LIMITS : in NDC.RECTANGLE_LIMITS)
  14537.    renames WS_TRANSFORMATION.SET_WS_WINDOW;
  14538.      
  14539.    procedure SET_WS_VIEWPORT
  14540.       (WS                : in WS_ID;
  14541.       WS_VIEWPORT_LIMITS : in DC.RECTANGLE_LIMITS)
  14542.    renames WS_TRANSFORMATION.SET_WS_VIEWPORT;
  14543.      
  14544.      
  14545.    -- INQ_GKS_STATE_LIST_MA logical functions
  14546.    procedure INQ_CURRENT_NORMALIZATION_TRANSFORMATION_NUMBER
  14547.       (EI            : out ERROR_INDICATOR;
  14548.       TRANSFORMATION : out TRANSFORMATION_NUMBER)
  14549.    renames INQ_GKS_STATE_LIST_MA.
  14550.            INQ_CURRENT_NORMALIZATION_TRANSFORMATION_NUMBER;
  14551.      
  14552.    procedure INQ_NORMALIZATION_TRANSFORMATION
  14553.       (TRANSFORMATION : in TRANSFORMATION_NUMBER;
  14554.       EI              : out ERROR_INDICATOR;
  14555.       WINDOW_LIMITS   : out WC.RECTANGLE_LIMITS;
  14556.       VIEWPORT_LIMITS : out NDC.RECTANGLE_LIMITS)
  14557.    renames INQ_GKS_STATE_LIST_MA.INQ_NORMALIZATION_TRANSFORMATION;
  14558.      
  14559.    procedure INQ_CLIPPING
  14560.       (EI                : out ERROR_INDICATOR;
  14561.       CLIPPING           : out CLIPPING_INDICATOR;
  14562.       CLIPPING_RECTANGLE_LIMITS : out NDC.RECTANGLE_LIMITS)
  14563.    renames INQ_GKS_STATE_LIST_MA.INQ_CLIPPING;
  14564.      
  14565.      
  14566.    -- INQ_GKS_DESCRIPTION_TABLE_MA logical functions
  14567.    procedure INQ_LEVEL_OF_GKS
  14568.       (EI   : out ERROR_INDICATOR;
  14569.       LEVEL : out GKS_LEVEL)
  14570.    renames INQ_GKS_DESCRIPTION_TABLE_MA.INQ_LEVEL_OF_GKS;
  14571.      
  14572.      
  14573.    -- INQ_WS_STATE_LIST_MA logical functions
  14574.    procedure INQ_WS_CONNECTION_AND_TYPE
  14575.       (WS        : in WS_ID;
  14576.       EI         : out ERROR_INDICATOR;
  14577.       CONNECTION : out VARIABLE_CONNECTION_ID;
  14578.       TYPE_OF_WS : out WS_TYPE)
  14579.    renames INQ_WS_STATE_LIST_MA.INQ_WS_CONNECTION_AND_TYPE;
  14580.      
  14581.    procedure INQ_TEXT_EXTENT
  14582.       (WS                 : in WS_ID;
  14583.       POSITION            : in WC.POINT;
  14584.       CHAR_STRING         : in STRING;
  14585.       EI                  : out ERROR_INDICATOR;
  14586.       CONCATENATION_POINT : out WC.POINT;
  14587.       TEXT_EXTENT         : out TEXT_EXTENT_PARALLELOGRAM)
  14588.    renames INQ_WS_STATE_LIST_MA.INQ_TEXT_EXTENT;
  14589.      
  14590.    procedure INQ_LIST_OF_COLOUR_INDICES
  14591.       (WS     : in WS_ID;
  14592.       EI      : out ERROR_INDICATOR;
  14593.       INDICES : out COLOUR_INDICES.LIST_OF)
  14594.    renames INQ_WS_STATE_LIST_MA.INQ_LIST_OF_COLOUR_INDICES;
  14595.      
  14596.    procedure INQ_COLOUR_REPRESENTATION
  14597.       (WS             : in WS_ID;
  14598.       INDEX           : in COLOUR_INDEX;
  14599.       RETURNED_VALUES : in RETURN_VALUE_TYPE;
  14600.       EI              : out ERROR_INDICATOR;
  14601.       COLOUR          : out COLOUR_REPRESENTATION)
  14602.    renames INQ_WS_STATE_LIST_MA.INQ_COLOUR_REPRESENTATION;
  14603.      
  14604.    procedure INQ_WS_TRANSFORMATION
  14605.       (WS                : in WS_ID;
  14606.       EI                 : out ERROR_INDICATOR;
  14607.       UPDATE             : out UPDATE_STATE;
  14608.       REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  14609.       CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  14610.       REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  14611.       CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS)
  14612.    renames INQ_WS_STATE_LIST_MA.INQ_WS_TRANSFORMATION;
  14613.      
  14614.      
  14615.    -- INQ_WS_DESCRIPTION_TABLE_MA logical functions
  14616.    procedure INQ_DISPLAY_SPACE_SIZE
  14617.       (WS                  : in WS_TYPE;
  14618.       EI                   : out ERROR_INDICATOR;
  14619.       UNITS                : out DC_UNITS;
  14620.       MAX_DC_SIZE          : out DC.SIZE;
  14621.       MAX_RASTER_UNIT_SIZE : out RASTER_UNIT_SIZE)
  14622.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_DISPLAY_SPACE_SIZE;
  14623.      
  14624.    procedure INQ_POLYLINE_FACILITIES
  14625.       (WS               : in WS_TYPE;
  14626.       EI                : out ERROR_INDICATOR;
  14627.       LIST_OF_TYPES     : out LINETYPES.LIST_OF;
  14628.       NUMBER_OF_WIDTHS  : out NATURAL;
  14629.       NOMINAL_WIDTH     : out DC.MAGNITUDE;
  14630.       RANGE_OF_WIDTHS   : out DC.RANGE_OF_MAGNITUDES;
  14631.       NUMBER_OF_INDICES : out NATURAL)
  14632.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_POLYLINE_FACILITIES;
  14633.      
  14634.    procedure INQ_POLYMARKER_FACILITIES
  14635.       (WS               : in WS_TYPE;
  14636.       EI                : out ERROR_INDICATOR;
  14637.       LIST_OF_TYPES     : out MARKER_TYPES.LIST_OF;
  14638.       NUMBER_OF_SIZES   : out NATURAL;
  14639.       NOMINAL_SIZE      : out DC.MAGNITUDE;
  14640.       RANGE_OF_SIZES    : out DC.RANGE_OF_MAGNITUDES;
  14641.       NUMBER_OF_INDICES : out NATURAL)
  14642.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_POLYMARKER_FACILITIES;
  14643.      
  14644.    procedure INQ_TEXT_FACILITIES
  14645.       (WS                  : in WS_TYPE;
  14646.       EI                   : out ERROR_INDICATOR;
  14647.       LIST_OF_FONT_PRECISION_PAIRS: out TEXT_FONT_PRECISIONS.LIST_OF;
  14648.       NUMBER_OF_HEIGHTS    : out NATURAL;
  14649.       RANGE_OF_HEIGHTS     : out DC.RANGE_OF_MAGNITUDES;
  14650.       NUMBER_OF_EXPANSIONS : out NATURAL;
  14651.       EXPANSION_RANGE      : out RANGE_OF_EXPANSIONS;
  14652.       NUMBER_OF_INDICES    : out NATURAL)
  14653.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_TEXT_FACILITIES;
  14654.      
  14655.    procedure INQ_FILL_AREA_FACILITIES
  14656.       (WS                     : WS_TYPE;
  14657.       EI                      : out ERROR_INDICATOR;
  14658.       LIST_OF_INTERIOR_STYLES : out INTERIOR_STYLES.LIST_OF;
  14659.       LIST_OF_HATCH_STYLES    : out HATCH_STYLES.LIST_OF;
  14660.       NUMBER_OF_INDICES       : out NATURAL)
  14661.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_FILL_AREA_FACILITIES;
  14662.      
  14663.    procedure INQ_COLOUR_FACILITIES
  14664.       (WS                      : in WS_TYPE;
  14665.       EI                       : out ERROR_INDICATOR;
  14666.       NUMBER_OF_COLOURS        : out NATURAL;
  14667.       AVAILABLE_COLOUR         : out COLOUR_AVAILABLE;
  14668.       NUMBER_OF_COLOUR_INDICES : out NATURAL)
  14669.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_COLOUR_FACILITIES;
  14670.      
  14671.    procedure INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  14672.       (WS                    : in WS_TYPE;
  14673.       EI                     : out ERROR_INDICATOR;
  14674.       MAX_POLYLINE_ENTRIES   : out NATURAL;
  14675.       MAX_POLYMARKER_ENTRIES : out NATURAL;
  14676.       MAX_TEXT_ENTRIES       : out NATURAL;
  14677.       MAX_FILL_AREA_ENTRIES  : out NATURAL;
  14678.       MAX_PATTERN_INDICES    : out NATURAL;
  14679.       MAX_COLOUR_INDICES     : out NATURAL)
  14680.    renames INQ_WS_DESCRIPTION_TABLE_MA.INQ_MAX_LENGTH_OF_WS_STATE_TABLES;
  14681.      
  14682.      
  14683.    -- Level 0a logical function groups
  14684.      
  14685.    -- EXTENDED_OUTPUT_PRIMITIVES logical functions
  14686.    procedure CELL_ARRAY
  14687.       (LOWER_LEFT : in WC.POINT;
  14688.       UPPER_RIGHT : in WC.POINT;
  14689.       CELL        : in COLOUR_MATRICES.MATRIX_OF)
  14690.    renames EXTENDED_OUTPUT_PRIMITIVES.CELL_ARRAY;
  14691.      
  14692.    procedure GDP_CIRCLE
  14693.       (CENTER    : in WC.POINT;
  14694.       PERIPHERAL : in WC.POINT)
  14695.    renames EXTENDED_OUTPUT_PRIMITIVES.GDP_CIRCLE;
  14696.      
  14697.      
  14698.    -- SET_INDIVIDUAL_ATTRIBUTES_0A logical functions
  14699.    procedure SET_LINEWIDTH_SCALE_FACTOR
  14700.       (WIDTH : in LINE_WIDTH)
  14701.    renames SET_INDIVIDUAL_ATTRIBUTES_0A.SET_LINEWIDTH_SCALE_FACTOR;
  14702.      
  14703.    procedure SET_MARKER_SIZE_SCALE_FACTOR
  14704.       (SIZE : in MARKER_SIZE)
  14705.    renames SET_INDIVIDUAL_ATTRIBUTES_0A.SET_MARKER_SIZE_SCALE_FACTOR;
  14706.      
  14707.    procedure SET_TEXT_FONT_AND_PRECISION
  14708.       (FONT_PRECISION : in TEXT_FONT_PRECISION)
  14709.    renames SET_INDIVIDUAL_ATTRIBUTES_0A.SET_TEXT_FONT_AND_PRECISION;
  14710.      
  14711.    procedure SET_CHAR_EXPANSION_FACTOR
  14712.       (EXPANSION : in CHAR_EXPANSION)
  14713.    renames SET_INDIVIDUAL_ATTRIBUTES_0A.SET_CHAR_EXPANSION_FACTOR;
  14714.      
  14715.    procedure SET_CHAR_SPACING
  14716.       (SPACING : in CHAR_SPACING)
  14717.    renames SET_INDIVIDUAL_ATTRIBUTES_0A.SET_CHAR_SPACING;
  14718.      
  14719.    procedure SET_FILL_AREA_STYLE_INDEX
  14720.       (INDEX : in STYLE_INDEX)
  14721.    renames SET_INDIVIDUAL_ATTRIBUTES_0A.SET_FILL_AREA_STYLE_INDEX;
  14722.      
  14723.    procedure SET_ASF
  14724.       (ASF : in ASF_LIST)
  14725.    renames SET_INDIVIDUAL_ATTRIBUTES_0A.SET_ASF;
  14726.      
  14727.      
  14728.    -- SET_BUNDLE_INDICES logical functions
  14729.    procedure SET_POLYLINE_INDEX
  14730.       (INDEX : in POLYLINE_INDEX)
  14731.    renames SET_BUNDLE_INDICES.SET_POLYLINE_INDEX;
  14732.      
  14733.    procedure SET_POLYMARKER_INDEX
  14734.       (INDEX : in POLYMARKER_INDEX)
  14735.    renames SET_BUNDLE_INDICES.SET_POLYMARKER_INDEX;
  14736.      
  14737.    procedure SET_TEXT_INDEX
  14738.       (INDEX : in TEXT_INDEX)
  14739.    renames SET_BUNDLE_INDICES.SET_TEXT_INDEX;
  14740.      
  14741.    procedure SET_FILL_AREA_INDEX
  14742.       (INDEX : in FILL_AREA_INDEX)
  14743.    renames SET_BUNDLE_INDICES.SET_FILL_AREA_INDEX;
  14744.      
  14745.      
  14746.    -- SET_PRIMITIVE_ATTRIBUTES_0A logical functions
  14747.    procedure SET_TEXT_PATH
  14748.       (PATH : in TEXT_PATH)
  14749.    renames SET_PRIMITIVE_ATTRIBUTES_0A.SET_TEXT_PATH;
  14750.      
  14751.    procedure SET_PATTERN_SIZE
  14752.       (SIZE : in WC.SIZE)
  14753.    renames SET_PRIMITIVE_ATTRIBUTES_0A.SET_PATTERN_SIZE;
  14754.      
  14755.    procedure SET_PATTERN_REFERENCE_POINT
  14756.       (POINT : in WC.POINT)
  14757.    renames SET_PRIMITIVE_ATTRIBUTES_0A.SET_PATTERN_REFERENCE_POINT;
  14758.      
  14759.      
  14760.    -- INQ_GKS_DESCRIPTION_TABLE_0A logical functions
  14761.    procedure INQ_LIST_OF_AVAILABLE_WS_TYPES
  14762.       (EI   : out ERROR_INDICATOR;
  14763.       TYPES : out WS_TYPES.LIST_OF)
  14764.    renames INQ_GKS_DESCRIPTION_TABLE_0A.INQ_LIST_OF_AVAILABLE_WS_TYPES;
  14765.      
  14766.    procedure INQ_MAX_NORMALIZATION_TRANSFORMATION_NUMBER
  14767.       (EI            : out ERROR_INDICATOR;
  14768.       TRANSFORMATION : out TRANSFORMATION_NUMBER)
  14769.    renames INQ_GKS_DESCRIPTION_TABLE_0A.
  14770.            INQ_MAX_NORMALIZATION_TRANSFORMATION_NUMBER;
  14771.      
  14772.      
  14773.    -- INQ_GKS_STATE_LIST_0A logical functions
  14774.    procedure INQ_OPERATING_STATE_VALUE
  14775.       (VALUE : out OPERATING_STATE)
  14776.    renames INQ_GKS_STATE_LIST_0A.INQ_OPERATING_STATE_VALUE;
  14777.      
  14778.    procedure INQ_SET_OF_OPEN_WS
  14779.       (EI : out ERROR_INDICATOR;
  14780.       WS  : out WS_IDS.LIST_OF)
  14781.    renames INQ_GKS_STATE_LIST_0A.INQ_SET_OF_OPEN_WS;
  14782.      
  14783.    procedure INQ_LIST_OF_NORMALIZATION_TRANSFORMATION_NUMBERS
  14784.       (EI  : out ERROR_INDICATOR;
  14785.       LIST : out TRANSFORMATION_PRIORITY_LIST)
  14786.      
  14787.      
  14788. renames INQ_GKS_STATE_LIST_0A.INQ_LIST_OF_NORMALIZATION_TRANSFORMATION_NUMBERS;
  14789.      
  14790.      
  14791.    -- INQ_WS_DESCRIPTION_TABLE_0A logical functions
  14792.    procedure INQ_WS_CATEGORY
  14793.       (WS      : in WS_TYPE;
  14794.       EI       : out ERROR_INDICATOR;
  14795.       CATEGORY : out WS_CATEGORY)
  14796.    renames INQ_WS_DESCRIPTION_TABLE_0A.INQ_WS_CATEGORY;
  14797.      
  14798.    procedure INQ_WS_CLASS
  14799.       (WS   : in WS_TYPE;
  14800.       EI    : out ERROR_INDICATOR;
  14801.       CLASS : out DISPLAY_CLASS)
  14802.    renames INQ_WS_DESCRIPTION_TABLE_0A.INQ_WS_CLASS;
  14803.      
  14804.    procedure INQ_PREDEFINED_POLYLINE_REPRESENTATION
  14805.       (WS    : in WS_TYPE;
  14806.       INDEX  : in POLYLINE_INDEX;
  14807.       EI     : out ERROR_INDICATOR;
  14808.       LINE   : out LINETYPE;
  14809.       WIDTH  : out LINE_WIDTH;
  14810.       COLOUR : out COLOUR_INDEX)
  14811.    renames INQ_WS_DESCRIPTION_TABLE_0A.
  14812.            INQ_PREDEFINED_POLYLINE_REPRESENTATION;
  14813.      
  14814.    procedure INQ_PREDEFINED_POLYMARKER_REPRESENTATION
  14815.       (WS    : in WS_TYPE;
  14816.       INDEX  : in POLYMARKER_INDEX;
  14817.       EI     : out ERROR_INDICATOR;
  14818.       MARKER : out MARKER_TYPE;
  14819.       SIZE   : out MARKER_SIZE;
  14820.       COLOUR : out COLOUR_INDEX)
  14821.    renames INQ_WS_DESCRIPTION_TABLE_0A.
  14822.            INQ_PREDEFINED_POLYMARKER_REPRESENTATION;
  14823.      
  14824.    procedure INQ_PREDEFINED_TEXT_REPRESENTATION
  14825.       (WS            : in WS_TYPE;
  14826.       INDEX          : in TEXT_INDEX;
  14827.       EI             : out ERROR_INDICATOR;
  14828.       FONT_PRECISION : out TEXT_FONT_PRECISION;
  14829.       EXPANSION      : out CHAR_EXPANSION;
  14830.       SPACING        : out CHAR_SPACING;
  14831.       COLOUR         : out COLOUR_INDEX)
  14832.    renames INQ_WS_DESCRIPTION_TABLE_0A.
  14833.            INQ_PREDEFINED_TEXT_REPRESENTATION;
  14834.      
  14835.    procedure INQ_PREDEFINED_FILL_AREA_REPRESENTATION
  14836.       (WS      : in WS_TYPE;
  14837.       INDEX    : in FILL_AREA_INDEX;
  14838.       EI       : out ERROR_INDICATOR;
  14839.       INTERIOR : out INTERIOR_STYLE;
  14840.       STYLE    : out STYLE_INDEX;
  14841.       COLOUR   : out COLOUR_INDEX)
  14842.    renames INQ_WS_DESCRIPTION_TABLE_0A.
  14843.            INQ_PREDEFINED_FILL_AREA_REPRESENTATION;
  14844.      
  14845.    procedure INQ_PATTERN_FACILITIES
  14846.       (WS               : in WS_TYPE;
  14847.       EI                : out ERROR_INDICATOR;
  14848.       NUMBER_OF_INDICES : out NATURAL)
  14849.    renames INQ_WS_DESCRIPTION_TABLE_0A.INQ_PATTERN_FACILITIES;
  14850.      
  14851.    procedure INQ_PREDEFINED_PATTERN_REPRESENTATION
  14852.       (WS     : in WS_TYPE;
  14853.       INDEX   : in PATTERN_INDEX;
  14854.       EI      : out ERROR_INDICATOR;
  14855.       LAST_X  : out NATURAL;
  14856.       LAST_Y  : out NATURAL;
  14857.       PATTERN : out COLOUR_MATRICES.VARIABLE_MATRIX_OF)
  14858.    renames INQ_WS_DESCRIPTION_TABLE_0A.
  14859.            INQ_PREDEFINED_PATTERN_REPRESENTATION;
  14860.      
  14861.    procedure INQ_PREDEFINED_COLOUR_REPRESENTATION
  14862.       (WS    : in WS_TYPE;
  14863.       INDEX  : in COLOUR_INDEX;
  14864.       EI     : out ERROR_INDICATOR;
  14865.       COLOUR : out COLOUR_REPRESENTATION)
  14866.    renames INQ_WS_DESCRIPTION_TABLE_0A.
  14867.            INQ_PREDEFINED_COLOUR_REPRESENTATION;
  14868.      
  14869.    procedure INQ_LIST_OF_AVAILABLE_GDP
  14870.       (WS         : in WS_TYPE;
  14871.       EI          : out ERROR_INDICATOR;
  14872.       LIST_OF_GDP : out GDP_IDS.LIST_OF)
  14873.    renames INQ_WS_DESCRIPTION_TABLE_0A.INQ_LIST_OF_AVAILABLE_GDP;
  14874.      
  14875.    procedure INQ_GDP
  14876.       (WS    : in WS_TYPE;
  14877.       GDP    : in GDP_ID;
  14878.       EI     : out ERROR_INDICATOR;
  14879.       LIST_OF_ATTRIBUTES_USED : out ATTRIBUTES_USED.LIST_OF)
  14880.    renames INQ_WS_DESCRIPTION_TABLE_0A.INQ_GDP;
  14881.      
  14882.      
  14883.    -- INQ_WS_STATE_LIST_0A logical functions
  14884.    procedure INQ_WS_STATE
  14885.       (WS   : in WS_ID;
  14886.       EI    : out ERROR_INDICATOR;
  14887.       STATE : out WS_STATE)
  14888.    renames INQ_WS_STATE_LIST_0A.INQ_WS_STATE;
  14889.      
  14890.    procedure INQ_WS_DEFERRAL_AND_UPDATE_STATES
  14891.       (WS          : in WS_ID;
  14892.       EI           : out ERROR_INDICATOR;
  14893.       DEFERRAL     : out DEFERRAL_MODE;
  14894.       REGENERATION : out REGENERATION_MODE;
  14895.       DISPLAY      : out DISPLAY_SURFACE_EMPTY;
  14896.       FRAME_ACTION : out NEW_FRAME_NECESSARY)
  14897.    renames INQ_WS_STATE_LIST_0A.INQ_WS_DEFERRAL_AND_UPDATE_STATES;
  14898.      
  14899.      
  14900.    -- GKS_METAFILES logical functions
  14901.    --procedure WRITE_ITEM_TO_GKSM
  14902.       --(WS  : in WS_ID;
  14903.       --ITEM : in GKSM_DATA_RECORD)
  14904.    --renames GKS_METAFILES.WRITE_ITEM_TO_GKSM;
  14905.      
  14906.    --procedure GET_ITEM_TYPE_FROM_GKSM
  14907.       --(WS       : in WS_ID;
  14908.       --ITEM_TYPE : out GKSM_ITEM_TYPE)
  14909.    --renames GKS_METAFILES.GET_ITEM_TYPE_FROM_GKSM;
  14910.      
  14911.    --procedure READ_ITEM_FROM_GKSM
  14912.       --(WS  : in WS_ID;
  14913.       --ITEM : out GKSM_DATA_RECORD)
  14914.    --renames GKS_METAFILES.READ_ITEM_FROM_GKSM;
  14915.      
  14916.    --procedure SKIP_ITEM
  14917.       --(WS : in WS_ID)
  14918.    --renames GKS_METAFILES.SKIP_ITEM;
  14919.      
  14920.    --procedure INTERPRET_ITEM
  14921.       --(ITEM : in GKSM_DATA_RECORD)
  14922.    --renames GKS_METAFILES.INTERPRET_ITEM;
  14923.      
  14924.      
  14925.    -- PIXELS logical functions
  14926.    procedure INQ_PIXEL_ARRAY_DIMENSIONS
  14927.       (WS          : in WS_ID;
  14928.       CORNER_1_1   : in WC.POINT;
  14929.       CORNER_DX_DY : in WC.POINT;
  14930.       EI           : out ERROR_INDICATOR;
  14931.       DIMENSIONS   : out RASTER_UNIT_SIZE)
  14932.    renames PIXELS.INQ_PIXEL_ARRAY_DIMENSIONS;
  14933.      
  14934.    procedure INQ_PIXEL_ARRAY
  14935.       (WS            : in WS_ID;
  14936.       CORNER         : in WC.POINT;
  14937.       DX             : in RASTER_UNITS;
  14938.       DY             : in RASTER_UNITS;
  14939.       EI             : out ERROR_INDICATOR;
  14940.       INVALID_VALUES : out INVALID_VALUES_INDICATOR;
  14941.       LAST_X         : out NATURAL;
  14942.       LAST_Y         : out NATURAL;
  14943.       PIXEL_ARRAY    : out PIXEL_COLOUR_MATRICES.VARIABLE_MATRIX_OF)
  14944.    renames PIXELS.INQ_PIXEL_ARRAY;
  14945.      
  14946.    procedure INQ_PIXEL
  14947.       (WS    : in WS_ID;
  14948.       POINT  : in WC.POINT;
  14949.       EI     : out ERROR_INDICATOR;
  14950.       COLOUR : out PIXEL_COLOUR_INDEX)
  14951.    renames PIXELS.INQ_PIXEL;
  14952.      
  14953.      
  14954.    -- ERROR_ROUTINES logical functions
  14955.      
  14956.    procedure ERROR_LOGGING
  14957.       (EI  : in ERROR_INDICATOR;
  14958.       NAME : in SUBPROGRAM_NAME)
  14959.    renames ERROR_ROUTINES.ERROR_LOGGING;
  14960.      
  14961.    procedure EMERGENCY_CLOSE_GKS
  14962.    renames ERROR_ROUTINES.EMERGENCY_CLOSE_GKS;
  14963.      
  14964.    procedure GET_ERROR
  14965.       (EI  : out ERROR_INDICATOR;
  14966.       NAME : out VARIABLE_SUBPROGRAM_NAME)
  14967.    renames ERROR_ROUTINES.GET_ERROR;
  14968.      
  14969. end GKS_0A;
  14970. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14971. --:UDD:GKSADACM:CODE:MA:CONVERT_NDC_DC_MA.ADA
  14972. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  14973. ------------------------------------------------------------------
  14974. --
  14975. --  NAME: CONVERT_NDC_DC
  14976. --  IDENTIFIER: GDMXXX.1(1)
  14977. --  DISCREPANCY REPORTS:
  14978. --
  14979. ------------------------------------------------------------------
  14980. -- File: CONVERT_NDC_DC_MA.ADA
  14981. -- Level: ma, 0a
  14982.      
  14983. with GKS_TYPES;
  14984.      
  14985. use GKS_TYPES;
  14986.      
  14987. package CONVERT_NDC_DC is
  14988.      
  14989. -- This package performs 2-D coordinate transformations between the NDC
  14990. -- and DC coordinate systems.
  14991. --
  14992. -- In support of levels m and 0, workstation transformations and their
  14993. -- inverse transforms are supported for POINT, VECTOR, POINT_ARRAY,
  14994. -- RECTANGLE_LIMITS and SIZE types.
  14995. --
  14996.    type NDC_DC_SCALE_TYPE is private;
  14997.    -- NDC_DC_SCALE_TYPE is an abstraction of the workstation
  14998.    -- transformation and its inverse transformation.
  14999.      
  15000.    subtype WINDOW_TYPE is NDC . RECTANGLE_LIMITS;
  15001.    -- WINDOW_TYPE is used to specify the window of the workstation
  15002.    -- transformation
  15003.      
  15004.    subtype VIEWPORT_TYPE is DC . RECTANGLE_LIMITS;
  15005.    -- VIEWPORT_TYPE is used to specify the viewport of the workstation
  15006.    -- transformation
  15007.      
  15008.    procedure SET_UNIFORM_SCALES
  15009.       (WINDOW   :        WINDOW_TYPE;
  15010.        VIEWPORT :        VIEWPORT_TYPE;
  15011.        SCALE    :    out NDC_DC_SCALE_TYPE);
  15012.      
  15013.    function DC_POINT
  15014.       (POINT : NDC . POINT;
  15015.        SCALE : NDC_DC_SCALE_TYPE) return DC . POINT;
  15016.      
  15017.    function DC_POINT_ARRAY
  15018.       (POINT_ARRAY : NDC . POINT_ARRAY;
  15019.        SCALE       : NDC_DC_SCALE_TYPE) return DC . POINT_ARRAY;
  15020.      
  15021.    function DC_RECTANGLE_LIMITS
  15022.       (RECTANGLE_LIMITS : NDC . RECTANGLE_LIMITS;
  15023.        SCALE            : NDC_DC_SCALE_TYPE)
  15024.        return DC . RECTANGLE_LIMITS;
  15025.      
  15026.    -- The following functions are for relative scaling only,
  15027.    -- not absolute positions
  15028.      
  15029.    function DC_VECTOR
  15030.       (VECTOR : NDC . VECTOR;
  15031.        SCALE  : NDC_DC_SCALE_TYPE) return DC . VECTOR;
  15032.      
  15033.    function DC_SIZE
  15034.       (SIZE  : NDC . SIZE;
  15035.        SCALE : NDC_DC_SCALE_TYPE) return DC . SIZE;
  15036.      
  15037.    -- Conversions from DC to NDC
  15038.      
  15039.    function NDC_POINT
  15040.       (POINT : DC . POINT;
  15041.        SCALE : NDC_DC_SCALE_TYPE) return NDC . POINT;
  15042.      
  15043.    function NDC_POINT_ARRAY
  15044.       (POINT_ARRAY : DC . POINT_ARRAY;
  15045.        SCALE       : NDC_DC_SCALE_TYPE) return NDC . POINT_ARRAY;
  15046.      
  15047.    function NDC_RECTANGLE_LIMITS
  15048.       (RECTANGLE_LIMITS : DC . RECTANGLE_LIMITS;
  15049.        SCALE           : NDC_DC_SCALE_TYPE)
  15050.        return NDC . RECTANGLE_LIMITS;
  15051.      
  15052.    -- The following functions are for relative scaling only,
  15053.    -- not absolute positions
  15054.      
  15055.    function NDC_VECTOR
  15056.       (VECTOR : DC . VECTOR;
  15057.        SCALE  : NDC_DC_SCALE_TYPE) return NDC . VECTOR;
  15058.      
  15059.    function NDC_SIZE
  15060.       (SIZE  : DC . SIZE;
  15061.        SCALE : NDC_DC_SCALE_TYPE) return NDC . SIZE;
  15062.      
  15063. private
  15064.      
  15065.    type NDC_DC_SCALE_TYPE is
  15066.       record
  15067.          V_SCALE : DC . POINT;
  15068.          V_SHIFT : DC . POINT;
  15069.          W_SCALE : NDC . POINT;
  15070.          W_SHIFT : NDC . POINT;
  15071.       end record;
  15072.    -- V_SCALE and V_SHIFT are used to transform to DC types.
  15073.    -- W_SCALE and W_SHIFT are used to transform to NDC types.
  15074.      
  15075. end CONVERT_NDC_DC;
  15076. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15077. --:UDD:GKSADACM:CODE:0A:WS_ST_LST_TYP_0A.ADA
  15078. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15079. ------------------------------------------------------------------
  15080. --
  15081. --  NAME: WS_STATE_LIST_TYPES
  15082. --  IDENTIFIER: GIMXXX.1(1)
  15083. --  DISCREPANCY REPORTS:
  15084. --
  15085. ------------------------------------------------------------------
  15086. -- file:  ws_st_lst_typ_0a.ada
  15087. -- level: 0a,1a,2a
  15088.      
  15089. with GKS_TYPES;
  15090. with WS_TABLE_TYPES;
  15091. with OUTPUT_ATTRIBUTES_TYPE;
  15092. with CONVERT_NDC_DC;
  15093.      
  15094. use GKS_TYPES;
  15095.      
  15096. package WS_STATE_LIST_TYPES is
  15097.      
  15098.    subtype PLIN_INDEX is NATURAL          range 0 .. 5;
  15099.    subtype PMRK_INDEX is NATURAL          range 0 .. 5;
  15100.    subtype TXT_INDEX  is NATURAL          range 0 .. 5;
  15101.    subtype FA_INDEX   is NATURAL          range 0 .. 5;
  15102.    subtype PAT_INDEX  is NATURAL          range 0 .. 0;
  15103.    subtype CLR_INDEX  is COLOUR_INDEX     range 0 .. 127;
  15104.    -- The preceding subtypes were declared so as not to raise a
  15105.    -- STORAGE ERROR at execution time.  The upper bounds were chosen
  15106.    -- for the present implementation.  CLR_INDEX could be changed
  15107.    -- to support a larger colour table for other devices.
  15108.      
  15109.    type WS_STATE_LST
  15110.          (NUM_POLYLINE_BUNDLES      : PLIN_INDEX := 0;
  15111.           NUM_POLYMARKER_BUNDLES    : PMRK_INDEX := 0;
  15112.           NUM_TEXT_BUNDLES          : TXT_INDEX  := 0;
  15113.           NUM_FILL_AREA_BUNDLES     : FA_INDEX   := 0;
  15114.           NUM_PATTERN_TABLES        : PAT_INDEX  := 0;
  15115.           NUM_COLOUR_REPRESENTATION : CLR_INDEX  := 0) is record
  15116.      
  15117.       -- The following is a copy of a subset of the GKS_STATE_LIST.
  15118.       OUTPUT_ATTR                     : OUTPUT_ATTRIBUTES_TYPE.
  15119.                                            OUTPUT_ATTRIBUTES;
  15120.      
  15121.       -- The application programmer's ID for a workstation.
  15122.       WORKSTATION_ID                  : WS_ID;
  15123.      
  15124.       -- The physical connection to the device.
  15125.       -- CONNECTION_ID must have default value to remain unconstrained
  15126.       CONNECT_ID                      : VARIABLE_CONNECTION_ID;
  15127.      
  15128.       -- The workstation category from the WS_DESCRIPTION_TABLE.
  15129.       WORKSTATION_CATEGORY            : WS_CATEGORY;
  15130.      
  15131.       -- The type of workstation.
  15132.       WORKSTATION_TYPE                : WS_TYPE;
  15133.      
  15134.       -- The workstation state.
  15135.       WS_STATE                        : GKS_TYPES.WS_STATE;
  15136.      
  15137.       -- Used for the deferral of output.
  15138.       WS_DEFERRAL_MODE                : DEFERRAL_MODE;
  15139.      
  15140.       -- Used to SUPPRESS or ALLOW implicit regeneration.
  15141.       WS_IMPLICIT_REGEN_MODE          : REGENERATION_MODE;
  15142.      
  15143.       -- Used to tell whether the display surface is EMPTY or not.
  15144.       WS_DISPLAY_SURFACE              : DISPLAY_SURFACE_EMPTY := EMPTY;
  15145.      
  15146.       -- Used to identify if a picture needs an implicit regeneration.
  15147.       WS_NEW_FRAME_ACTION             : NEW_FRAME_NECESSARY := NO;
  15148.      
  15149.       -- polyline bundles
  15150.      
  15151.       SET_OF_PLIN_IDC            : POLYLINE_INDICES.LIST_OF;
  15152.       POLYLINE_BUNDLES           : WS_TABLE_TYPES.POLYLINE_BUNDLE_LIST
  15153.                                         (1 .. NUM_POLYLINE_BUNDLES);
  15154.      
  15155.       -- polymarker bundles
  15156.      
  15157.       SET_OF_PMRK_IDC            : POLYMARKER_INDICES.LIST_OF;
  15158.       POLYMARKER_BUNDLES         : WS_TABLE_TYPES.POLYMARKER_BUNDLE_LIST
  15159.                                         (1 .. NUM_POLYMARKER_BUNDLES);
  15160.      
  15161.       -- text bundles
  15162.      
  15163.       SET_OF_TEXT_IDC            : TEXT_INDICES.LIST_OF;
  15164.       TEXT_BUNDLES               : WS_TABLE_TYPES.TEXT_BUNDLE_LIST
  15165.                                         (1 .. NUM_TEXT_BUNDLES);
  15166.      
  15167.       -- fill area bundles
  15168.      
  15169.       SET_OF_FILL_AREA_IDC       : FILL_AREA_INDICES.LIST_OF;
  15170.       FILL_AREA_BUNDLES          : WS_TABLE_TYPES.FILL_AREA_BUNDLE_LIST
  15171.                                         (1 .. NUM_FILL_AREA_BUNDLES);
  15172.      
  15173.       -- pattern table bundles
  15174.      
  15175.       SET_OF_PATTERN_IDC         : PATTERN_INDICES.LIST_OF;
  15176.       PATTERN_TABLE              : WS_TABLE_TYPES.PATTERN_TABLE_LIST
  15177.                                         (1 .. NUM_PATTERN_TABLES);
  15178.      
  15179.       -- color table
  15180.      
  15181.       SET_OF_COLOUR_IDC          : COLOUR_INDICES.LIST_OF;
  15182.       COLOUR_TABLE               : WS_TABLE_TYPES.COLOUR_TABLE_LIST
  15183.                                        (0 .. NUM_COLOUR_REPRESENTATION);
  15184.      
  15185.       -- transformations
  15186.      
  15187.       -- Tells whether an update of the workstation transformation is
  15188.       -- needed.
  15189.       WS_XFORM_UPDATE_STATE      : UPDATE_STATE := NOTPENDING;
  15190.      
  15191.       -- The value to which the CURRENT_WS_WINDOW is set.
  15192.       REQUESTED_WS_WINDOW        : NDC.RECTANGLE_LIMITS :=
  15193.                                        (0.0, 1.0, 0.0, 1.0);
  15194.      
  15195.       -- The current workstation window.
  15196.       CURRENT_WS_WINDOW          : NDC.RECTANGLE_LIMITS :=
  15197.                                        (0.0, 1.0, 0.0, 1.0);
  15198.      
  15199.       -- The value to which the CURRENT_WS_VIEWPORT is set.
  15200.       REQUESTED_WS_VIEWPORT      : DC.RECTANGLE_LIMITS :=
  15201.                                        (0.0, 1.0, 0.0, 1.0);
  15202.      
  15203.       -- The current workstation viewport.
  15204.       CURRENT_WS_VIEWPORT        : DC.RECTANGLE_LIMITS :=
  15205.                                        (0.0, 1.0, 0.0, 1.0);
  15206.      
  15207.       -- clipping rectangle
  15208.      
  15209.       -- The computed clipping rectangle from the CURRENT_CLIPPING_
  15210.       -- RECTANGLE plus the CURRENT_WS_WINDOW.
  15211.      
  15212.       EFFECTIVE_CLIPPING_RECTANGLE : DC.RECTANGLE_LIMITS :=
  15213.                                         (0.0, 1.0, 0.0, 1.0);
  15214.      
  15215.       -- The following attributes are computed from the attributes
  15216.       -- in the GKS_STATE_LIST and the bundles in the WS_STATE_LIST
  15217.       -- depending on whether an ASF is BUNDLE or INDIVIDUAL.
  15218.      
  15219.       EFFECTIVE_POLYLINE_ATTR   : WS_TABLE_TYPES.POLYLINE_BUNDLE;
  15220.      
  15221.       EFFECTIVE_POLYMARKER_ATTR : WS_TABLE_TYPES.POLYMARKER_BUNDLE;
  15222.      
  15223.       EFFECTIVE_TEXT_ATTR       : WS_TABLE_TYPES.TEXT_BUNDLE;
  15224.      
  15225.       EFFECTIVE_FILL_AREA_ATTR  : WS_TABLE_TYPES.FILL_AREA_BUNDLE;
  15226.      
  15227.       -- The following is computed from the WS window and WS viewport
  15228.       -- and stored for easy access by the WS DRIVER.
  15229.      
  15230.       WS_TRANSFORM              : CONVERT_NDC_DC.NDC_DC_SCALE_TYPE;
  15231.      
  15232.    end record;
  15233.      
  15234.    type WS_STATE_LIST_PTR is access WS_STATE_LST;
  15235.      
  15236. end WS_STATE_LIST_TYPES;
  15237. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15238. --:UDD:GKSADACM:CODE:0A:WSR_SET_BUNDLE_IDC.ADA
  15239. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15240. ------------------------------------------------------------------
  15241. --
  15242. --  NAME: WSR_SET_BUNDLE_INDICES
  15243. --  IDENTIFIER: GDMXXX.1(1)
  15244. --  DISCREPANCY REPORTS:
  15245. --
  15246. ------------------------------------------------------------------
  15247. -- file: WSR_SET_BUNDLE_IDC.ADA
  15248. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15249.      
  15250. with GKS_TYPES;
  15251. with WS_STATE_LIST_TYPES;
  15252.      
  15253. use GKS_TYPES;
  15254.      
  15255. package WSR_SET_BUNDLE_INDICES is
  15256.      
  15257. -- Each procedure is passed a pointer to the workstation state
  15258. -- list which is declared in WS_STATE_LIST_TYPES. GKS_TYPES
  15259. -- contains the type declarations of the other parameters.
  15260. -- The attribute field in the workstation state list is
  15261. -- set in each procedure and effective attributes are updated
  15262. -- if they are bundled and the bundle has previously been set.
  15263.      
  15264.    procedure SET_POLYLINE_INDEX
  15265.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15266.        INDEX         : in POLYLINE_INDEX);
  15267.      
  15268.    procedure SET_POLYMARKER_INDEX
  15269.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15270.        INDEX         : in POLYMARKER_INDEX);
  15271.      
  15272.    procedure SET_TEXT_INDEX
  15273.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15274.        INDEX         : in TEXT_INDEX);
  15275.      
  15276.    procedure SET_FILL_AREA_INDEX
  15277.      
  15278.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15279.        INDEX         : in FILL_AREA_INDEX);
  15280.      
  15281. end WSR_SET_BUNDLE_INDICES;
  15282.      
  15283. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15284. --:UDD:GKSADACM:CODE:0A:WSR_SET_BUNDLE_IDC_B.ADA
  15285. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15286. ------------------------------------------------------------------
  15287. --
  15288. --  NAME: WSR_SET_BUNDLE_INDICES - BODY
  15289. --  IDENTIFIER: GDMXXX.1(1)
  15290. --  DISCREPANCY REPORTS:
  15291. --
  15292. ------------------------------------------------------------------
  15293. -- file: WSR_SET_BUNDLE_IDC_B.ADA
  15294. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15295.      
  15296. package body WSR_SET_BUNDLE_INDICES is
  15297.      
  15298. -- The attribute entry in the workstation state list accessed by
  15299. -- the pointer WS_STATE_LIST is set to the specified value in
  15300. -- each procedure.  If any attribute in the bundle is bundled
  15301. -- then the effective value in the workstation state list is also
  15302. -- set to the specified value only if the bundle has previously
  15303. -- been set.
  15304.      
  15305.    procedure SET_POLYLINE_INDEX
  15306.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15307.        INDEX         : in POLYLINE_INDEX) is separate;
  15308.      
  15309.    procedure SET_POLYMARKER_INDEX
  15310.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15311.        INDEX         : in POLYMARKER_INDEX) is separate;
  15312.      
  15313.    procedure SET_TEXT_INDEX
  15314.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15315.        INDEX         : in TEXT_INDEX) is separate;
  15316.      
  15317.    procedure SET_FILL_AREA_INDEX
  15318.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15319.        INDEX         : in FILL_AREA_INDEX) is separate;
  15320.      
  15321. end WSR_SET_BUNDLE_INDICES;
  15322. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15323. --:UDD:GKSADACM:CODE:0A:WSR_SET_INDV_ATTR_0A.ADA
  15324. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15325. ------------------------------------------------------------------
  15326. --
  15327. --  NAME: WSR_SET_INDIVIDUAL_ATTRIBUTES_0A
  15328. --  IDENTIFIER: GDMXXX.1(1)
  15329. --  DISCREPANCY REPORTS:
  15330. --
  15331. ------------------------------------------------------------------
  15332. -- file: WSR_SET_INDV_ATTR_0A.ADA
  15333. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15334.      
  15335. with GKS_TYPES;
  15336. with WS_DESCRIPTION_TABLE_TYPES;
  15337. with WS_STATE_LIST_TYPES;
  15338.      
  15339. use GKS_TYPES;
  15340.      
  15341. package WSR_SET_INDIVIDUAL_ATTRIBUTES_0A is
  15342.      
  15343. -- Each procedure is passed a pointer to the workstation state
  15344. -- list which is declared in WS_STATE_LIST_TYPES. WS_DESCRIPTION_TBL
  15345. -- is declared in WS_DESCRIPTION_TABLE_TYPES. GKS_TYPES
  15346. -- contains the type declarations of the other parameters.
  15347. -- The attribute field in the workstation state list will be
  15348. -- set in each procedure and effective attributes will be updated
  15349. -- if they are individual.
  15350.      
  15351.    procedure SET_LINE_WIDTH_SCALE_FACTOR
  15352.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15353.        WIDTH         : in LINE_WIDTH);
  15354.      
  15355.    procedure SET_MARKER_SIZE_SCALE_FACTOR
  15356.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15357.        SIZE          : in MARKER_SIZE);
  15358.      
  15359.    procedure SET_TEXT_FONT_AND_PRECISION
  15360.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15361.        WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  15362.        FONT_PRECISION : in TEXT_FONT_PRECISION);
  15363.      
  15364.    procedure SET_CHAR_EXPANSION_FACTOR
  15365.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15366.        EXPANSION     : in CHAR_EXPANSION);
  15367.      
  15368.    procedure SET_CHAR_SPACING
  15369.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15370.        SPACING       : in CHAR_SPACING);
  15371.      
  15372.    procedure SET_FILL_AREA_STYLE_INDEX
  15373.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15374.        INDEX         : in STYLE_INDEX);
  15375.      
  15376.    procedure SET_ASF
  15377.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15378.        ASF           : in ASF_LIST);
  15379.      
  15380. end WSR_SET_INDIVIDUAL_ATTRIBUTES_0A;
  15381. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15382. --:UDD:GKSADACM:CODE:0A:WSR_SET_INDV_0A_B.ADA
  15383. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15384. ------------------------------------------------------------------
  15385. --
  15386. --  NAME: WSR_SET_INDIVIDUAL_ATTRIBUTES_0A - BODY
  15387. --  IDENTIFIER: GDMXXX.1(1)
  15388. --  DISCREPANCY REPORTS:
  15389. --
  15390. ------------------------------------------------------------------
  15391. -- file: WSR_SET_INDV_0A_B.ADA
  15392. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15393.      
  15394. package body WSR_SET_INDIVIDUAL_ATTRIBUTES_0A is
  15395.      
  15396. -- The attribute entry in the workstation state list accessed by
  15397. -- the pointer WS_STATE_LIST is set to the specified value in
  15398. -- each procedure.  If the aspect source flag of the attribute
  15399. -- being set is individual then the effective value in the
  15400. -- workstation state list is also set to the specified value.
  15401.      
  15402.    procedure SET_LINE_WIDTH_SCALE_FACTOR
  15403.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15404.        WIDTH         : in LINE_WIDTH) is separate;
  15405.      
  15406.    procedure SET_MARKER_SIZE_SCALE_FACTOR
  15407.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15408.        SIZE          : in MARKER_SIZE) is separate;
  15409.      
  15410.    procedure SET_TEXT_FONT_AND_PRECISION
  15411.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15412.        WS_DSCR_TBL   : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  15413.        FONT_PRECISION : in TEXT_FONT_PRECISION) is separate;
  15414.      
  15415.    procedure SET_CHAR_EXPANSION_FACTOR
  15416.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15417.        EXPANSION     : in CHAR_EXPANSION) is separate;
  15418.      
  15419.    procedure SET_CHAR_SPACING
  15420.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15421.        SPACING       : in CHAR_SPACING) is separate;
  15422.      
  15423.    procedure SET_FILL_AREA_STYLE_INDEX
  15424.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15425.        INDEX         : in STYLE_INDEX) is separate;
  15426.      
  15427.    procedure SET_ASF
  15428.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15429.        ASF           : in ASF_LIST) is separate;
  15430.      
  15431. end WSR_SET_INDIVIDUAL_ATTRIBUTES_0A;
  15432. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15433. --:UDD:GKSADACM:CODE:0A:WSR_SET_PRIM_ATTR_0A.ADA
  15434. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15435. ------------------------------------------------------------------
  15436. --
  15437. --  NAME: WSR_SET_PRIMITIVE_ATTRIBUTES_0A
  15438. --  IDENTIFIER: GDMXXX.1(2)
  15439. --  DISCREPANCY REPORTS:
  15440. --  #019  06/14/85  "Change SET_PATTERN_SIZE to SET_PATTERN_VECTORS"
  15441. ------------------------------------------------------------------
  15442. -- file: WSR_SET_PRIM_ATTR_0A.ADA
  15443. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15444.      
  15445. with GKS_TYPES;
  15446. with WS_STATE_LIST_TYPES;
  15447.      
  15448. use  GKS_TYPES;
  15449.      
  15450. package WSR_SET_PRIMITIVE_ATTRIBUTES_0A is
  15451.      
  15452. -- Each procedure is passed a pointer to the workstation state
  15453. -- list which is declared in WS_STATE_LIST_TYPES. GKS_TYPES
  15454. -- contains the type declarations of the other parameters.
  15455. -- The attribute field in the workstation state list is
  15456. -- set in each procedure.
  15457.      
  15458.    procedure SET_TEXT_PATH
  15459.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15460.        PATH          : in TEXT_PATH);
  15461.      
  15462.    procedure SET_PATTERN_SIZE
  15463.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15464.        PATTERN_HEIGHT_VECTOR  : in NDC.VECTOR;            -- DR019
  15465.        PATTERN_WIDTH_VECTOR   : in NDC.VECTOR);           -- DR019
  15466.      
  15467.    procedure SET_PATTERN_REFERENCE_POINT
  15468.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15469.        POINT         : in NDC.POINT);
  15470.      
  15471. end WSR_SET_PRIMITIVE_ATTRIBUTES_0A;
  15472. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15473. --:UDD:GKSADACM:CODE:0A:WSR_SET_PRIM_0A_B.ADA
  15474. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15475. ------------------------------------------------------------------
  15476. --
  15477. --  NAME: WSR_SET_PRIMITIVE_ATTRIBUTES_0A - BODY
  15478. --  IDENTIFIER: GDMXXX.1(2)
  15479. --  DISCREPANCY REPORTS:
  15480. --  #019  06/14/85  "Change SET_PATTERN_SIZE to SET_PATTERN_VECTORS"
  15481. ------------------------------------------------------------------
  15482. -- file: WSR_SET_PRIM_0A_B.ADA
  15483. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15484.      
  15485. package body WSR_SET_PRIMITIVE_ATTRIBUTES_0A is
  15486.      
  15487. -- The attribute entry in the workstation state list accessed by
  15488. -- the pointer WS_STATE_LIST is set to the specified value in
  15489. -- each procedure.
  15490.      
  15491.    procedure SET_TEXT_PATH
  15492.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15493.        PATH          : in TEXT_PATH) is separate;
  15494.      
  15495.    procedure SET_PATTERN_SIZE
  15496.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15497.        PATTERN_HEIGHT_VECTOR  : in NDC.VECTOR;            -- DR019
  15498.        PATTERN_WIDTH_VECTOR   : in NDC.VECTOR) is separate; -- DR019
  15499.      
  15500.    procedure SET_PATTERN_REFERENCE_POINT
  15501.       (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15502.        POINT         : in NDC.POINT) is separate;
  15503.      
  15504. end WSR_SET_PRIMITIVE_ATTRIBUTES_0A;
  15505.      
  15506. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15507. --:UDD:GKSADACM:CODE:0A:WSR_SET_ASF.ADA
  15508. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15509. ------------------------------------------------------------------
  15510. --
  15511. --  NAME: SET_ASF
  15512. --  IDENTIFIER: GDMXXX.2(1)
  15513. --  DISCREPANCY REPORTS:
  15514. --  DR010  Bundle indices converted to natural.
  15515. ------------------------------------------------------------------
  15516. -- file: WSR_SET_ASF.ADA
  15517. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15518.      
  15519. with OUTPUT_ATTRIBUTES_TYPE;
  15520. with WS_TABLE_TYPES;
  15521.      
  15522. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_0a)
  15523.      
  15524. procedure SET_ASF
  15525.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15526.     ASF           : in ASF_LIST) is
  15527.      
  15528. -- The workstation state list is accessed by the pointer
  15529. -- WS_STATE_LIST. The aspect source flag record in the workstation
  15530. -- state list containing each of the following aspect source flags
  15531. -- is set to the specified record value (bundled,individual).
  15532. --
  15533. -- linetype ASF
  15534. -- linewidth scale factor ASF
  15535. -- polyline colour index ASF
  15536. -- marker type ASF
  15537. -- marker size scale factor ASF
  15538. -- polymarker colour index ASF
  15539. -- text font and precision ASF
  15540. -- character spacing ASF
  15541. -- character expansion factor ASF
  15542. -- text colour index ASF
  15543. -- fill area interior style ASF
  15544. -- fill area style index ASF
  15545. -- fill area colour index ASF
  15546. --
  15547. -- If the aspect source flag for any attribute is set to
  15548. -- bundled then the effective attribute in the workstation
  15549. -- state list is set to the bundle value corresponding to the
  15550. -- current bundle index.
  15551. --
  15552. -- The parameters to this procedure are used as follows:
  15553. --
  15554. -- WS_STATE_LIST - a pointer to the workstation state list.
  15555. -- ASF           - the list of aspect source flags being set in the
  15556. --                 workstation state list.
  15557.      
  15558.    CURRENT_POLYLINE : WS_TABLE_TYPES.POLYLINE_BUNDLE
  15559.          renames WS_STATE_LIST
  15560.          .POLYLINE_BUNDLES(NATURAL(WS_STATE_LIST.OUTPUT_ATTR
  15561.          .CURRENT_POLYLINE_INDEX));
  15562.      
  15563.    CURRENT_POLYMARKER : WS_TABLE_TYPES.POLYMARKER_BUNDLE
  15564.          renames WS_STATE_LIST
  15565.          .POLYMARKER_BUNDLES(NATURAL(WS_STATE_LIST.OUTPUT_ATTR
  15566.          .CURRENT_POLYMARKER_INDEX));
  15567.      
  15568.    CURRENT_TEXT : WS_TABLE_TYPES.TEXT_BUNDLE
  15569.          renames WS_STATE_LIST
  15570.          .TEXT_BUNDLES(NATURAL(WS_STATE_LIST.OUTPUT_ATTR
  15571.          .CURRENT_TEXT_INDEX));
  15572.      
  15573.    CURRENT_FILL_AREA : WS_TABLE_TYPES.FILL_AREA_BUNDLE
  15574.          renames WS_STATE_LIST
  15575.          .FILL_AREA_BUNDLES(NATURAL(WS_STATE_LIST.OUTPUT_ATTR
  15576.          .CURRENT_FILL_AREA_INDEX));
  15577.      
  15578.    WS : OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES
  15579.          renames WS_STATE_LIST.OUTPUT_ATTR;
  15580.      
  15581. begin
  15582.      
  15583.    -- set the aspect source flags in the workstation state list.
  15584.    WS.ASPECT_SOURCE_FLAGS := ASF;
  15585.      
  15586.    if ASF.LINETYPE = BUNDLED then
  15587.       -- set the effective line type if the line type is bundled
  15588.       -- to the value in the current bundle.
  15589.      
  15590.       WS_STATE_LIST.EFFECTIVE_POLYLINE_ATTR.L_TYPE :=
  15591.             CURRENT_POLYLINE.L_TYPE;
  15592.    else
  15593.       -- set the effective line type if the line type is individual
  15594.       -- to the value in the current individual attribute.
  15595.      
  15596.       WS_STATE_LIST.EFFECTIVE_POLYLINE_ATTR.L_TYPE :=
  15597.             WS.CURRENT_LINETYPE;
  15598.    end if;
  15599.      
  15600.    if ASF.LINE_WIDTH = BUNDLED then
  15601.       -- set the effective linewidth if the linewidth is bundled
  15602.       -- to the value in the current bundle.
  15603.      
  15604.       WS_STATE_LIST.EFFECTIVE_POLYLINE_ATTR.L_WIDTH :=
  15605.             CURRENT_POLYLINE.L_WIDTH;
  15606.    else
  15607.       -- set the effective linewidth if the linewidth is individual
  15608.       -- to the value in the current individual attribute.
  15609.      
  15610.       WS_STATE_LIST.EFFECTIVE_POLYLINE_ATTR.L_WIDTH :=
  15611.             WS.CURRENT_LINEWIDTH_SCALE_FACTOR;
  15612.    end if;
  15613.      
  15614.    if ASF.LINE_COLOUR = BUNDLED then
  15615.       -- set the effective polyline colour index if the colour is
  15616.       -- bundled to the value in the current bundle.
  15617.      
  15618.       WS_STATE_LIST.EFFECTIVE_POLYLINE_ATTR.COLOUR :=
  15619.             CURRENT_POLYLINE.COLOUR;
  15620.    else
  15621.       -- set the effective polyline colour index if the colour is
  15622.       -- individual to the value in the current individual attribute.
  15623.      
  15624.       WS_STATE_LIST.EFFECTIVE_POLYLINE_ATTR.COLOUR :=
  15625.             WS.CURRENT_POLYLINE_COLOUR_INDEX;
  15626.    end if;
  15627.      
  15628.    if ASF.MARKER_TYPE = BUNDLED then
  15629.       -- set the effective marker type if the marker type is bundled
  15630.       -- to the value in the current bundle.
  15631.      
  15632.       WS_STATE_LIST.EFFECTIVE_POLYMARKER_ATTR.M_TYPE :=
  15633.             CURRENT_POLYMARKER.M_TYPE;
  15634.    else
  15635.       -- set the effective marker type if the marker type is individual
  15636.       -- to the value in the current individual attribute.
  15637.      
  15638.       WS_STATE_LIST.EFFECTIVE_POLYMARKER_ATTR.M_TYPE :=
  15639.             WS.CURRENT_MARKER_TYPE;
  15640.    end if;
  15641.      
  15642.    if ASF.MARKER_SIZE = BUNDLED then
  15643.       -- set the effective marker size scale factor if the marker
  15644.       -- size is bundled to the value in the current bundle.
  15645.      
  15646.       WS_STATE_LIST.EFFECTIVE_POLYMARKER_ATTR.M_SIZE :=
  15647.             CURRENT_POLYMARKER.M_SIZE;
  15648.    else
  15649.       -- set the effective marker size scale factor if the marker
  15650.       -- size is individual to the value in the current individual
  15651.       -- attribute.
  15652.      
  15653.       WS_STATE_LIST.EFFECTIVE_POLYMARKER_ATTR.M_SIZE :=
  15654.             WS.CURRENT_MARKER_SIZE_SCALE_FACTOR;
  15655.    end if;
  15656.      
  15657.    if ASF.MARKER_COLOUR = BUNDLED then
  15658.       -- set the effective polymarker colour index if the colour
  15659.       -- index is bundled to the value in the current bundle.
  15660.      
  15661.       WS_STATE_LIST.EFFECTIVE_POLYMARKER_ATTR.COLOUR :=
  15662.             CURRENT_POLYMARKER.COLOUR;
  15663.    else
  15664.       -- set the effective polymarker colour index if the colour
  15665.       -- index is individual to the value in the individual attribute.
  15666.      
  15667.       WS_STATE_LIST.EFFECTIVE_POLYMARKER_ATTR.COLOUR :=
  15668.             WS.CURRENT_POLYMARKER_COLOUR_INDEX;
  15669.    end if;
  15670.      
  15671.    if ASF.TEXT_FONT_PRECISION = BUNDLED then
  15672.       -- set the effective text font and precision if the text font
  15673.       -- and precision is bundled to the value in the current bundle.
  15674.      
  15675.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.TEXT_FONT :=
  15676.             CURRENT_TEXT.TEXT_FONT;
  15677.    else
  15678.       -- set the effective text font and precision if the text font
  15679.       -- and precision is individual to the value in the current
  15680.       -- individual attribute.
  15681.      
  15682.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.TEXT_FONT :=
  15683.             WS.CURRENT_TEXT_FONT_AND_PRECISION;
  15684.    end if;
  15685.      
  15686.    if ASF.CHAR_EXPANSION = BUNDLED then
  15687.       -- set the effective character expansion factor if the character
  15688.       -- expansion factor is bundled to the value in the current bundle.
  15689.      
  15690.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.CH_EXPANSION :=
  15691.             CURRENT_TEXT.CH_EXPANSION;
  15692.    else
  15693.       -- set the effective character expansion factor if the character
  15694.       -- expansion factor is individual to the value in the current
  15695.       -- individual attribute.
  15696.      
  15697.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.CH_EXPANSION :=
  15698.             WS.CURRENT_CHAR_EXPANSION_FACTOR;
  15699.    end if;
  15700.      
  15701.    if ASF.CHAR_SPACING = BUNDLED then
  15702.       -- set the effective character spacing if the character
  15703.       -- spacing is bundled to the value in the current bundle.
  15704.      
  15705.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.CH_SPACE :=
  15706.             CURRENT_TEXT.CH_SPACE;
  15707.    else
  15708.       -- set the effective character spacing if the character
  15709.       -- spacing is individual to the value in the current
  15710.       -- individual attribute.
  15711.      
  15712.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.CH_SPACE :=
  15713.             WS.CURRENT_CHAR_SPACING;
  15714.    end if;
  15715.      
  15716.    if ASF.TEXT_COLOUR = BUNDLED then
  15717.       -- set the effective text colour index if the text colour
  15718.       -- index is bundled to the value in the current bundle.
  15719.      
  15720.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.COLO
  15721.             CURRENT_TEXT.COLOUR;
  15722.    else
  15723.       -- set the effective text colour index if the text colour
  15724.       -- index is individual to the value in the current
  15725.       -- individual attribute.
  15726.      
  15727.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.COLOUR :=
  15728.             WS.CURRENT_TEXT_COLOUR_INDEX;
  15729.    end if;
  15730.      
  15731.    if ASF.INTERIOR_STYLE = BUNDLED then
  15732.       -- set the effective fill area interior style if the fill area
  15733.       -- interior style is bundled to the value in the current bundle.
  15734.      
  15735.       WS_STATE_LIST.EFFECTIVE_FILL_AREA_ATTR.INT_STYLE :=
  15736.             CURRENT_FILL_AREA.INT_STYLE;
  15737.    else
  15738.       -- set the effective fill area interior style if the fill area
  15739.       -- interior style is individual to the value in the current
  15740.       -- individual attribute.
  15741.      
  15742.       WS_STATE_LIST.EFFECTIVE_FILL_AREA_ATTR.INT_STYLE :=
  15743.             WS.CURRENT_FILL_AREA_INTERIOR_STYLE;
  15744.    end if;
  15745.      
  15746.    if ASF.STYLE_INDEX = BUNDLED then
  15747.       -- set the effective fill area style index if the fill area
  15748.       -- style index is bundled to the value in the current bundle.
  15749.      
  15750.       WS_STATE_LIST.EFFECTIVE_FILL_AREA_ATTR.STYLE :=
  15751.             CURRENT_FILL_AREA.STYLE;
  15752.    else
  15753.       -- set the effective fill area style index if the fill area
  15754.       -- style index is individual to the value in the current
  15755.       -- individual attribute.
  15756.      
  15757.       WS_STATE_LIST.EFFECTIVE_FILL_AREA_ATTR.STYLE :=
  15758.             WS.CURRENT_FILL_AREA_STYLE_INDEX;
  15759.    end if;
  15760.      
  15761.    if ASF.FILL_AREA_COLOUR = BUNDLED then
  15762.       -- set the effective fill area colour index if the fill area
  15763.       -- colour index is bundled to the value in the current bundle.
  15764.      
  15765.       WS_STATE_LIST.EFFECTIVE_FILL_AREA_ATTR.COLOUR :=
  15766.             CURRENT_FILL_AREA.COLOUR;
  15767.    else
  15768.       -- set the effective fill area colour index if the fill area
  15769.       -- colour index is individual to the value in the current
  15770.       -- individual attribute.
  15771.      
  15772.       WS_STATE_LIST.EFFECTIVE_FILL_AREA_ATTR.COLOUR :=
  15773.             WS.CURRENT_FILL_AREA_COLOUR_INDEX;
  15774.    end if;
  15775.      
  15776. end SET_ASF;
  15777. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15778. --:UDD:GKSADACM:CODE:0A:WSR_SET_CHAR_EXP_FCT.ADA
  15779. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15780. ------------------------------------------------------------------
  15781. --
  15782. --  NAME: SET_CHAR_EXPANSION_FACTOR
  15783. --  IDENTIFIER: GDMXXX.1(1)
  15784. --  DISCREPANCY REPORTS:
  15785. --
  15786. ------------------------------------------------------------------
  15787. -- file: WSR_SET_CHAR_EXP_FCT.ADA
  15788. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15789.      
  15790. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_0a)
  15791.      
  15792. procedure SET_CHAR_EXPANSION_FACTOR
  15793.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15794.     EXPANSION     : in CHAR_EXPANSION) is
  15795.      
  15796. -- The workstation state list is accessed by the pointer
  15797. -- WS_STATE_LIST. The character expansion factor in the workstation
  15798. -- state list is set to the specified value.
  15799. -- If the aspect source flag for the character expansion factor is
  15800. -- individual then the effective attribute in the workstation
  15801. -- state list is also set to the specified value.
  15802. --
  15803. -- The parameters to this procedure are used as follows:
  15804. --
  15805. -- WS_STATE_LIST - a pointer to the workstation state list.
  15806. -- EXPANSION     - the character expansion factor being set in the
  15807. --                 workstation state list.
  15808.      
  15809. begin
  15810.      
  15811.    -- set the character expansion factor in the workstation state list.
  15812.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_CHAR_EXPANSION_FACTOR :=
  15813.          EXPANSION;
  15814.      
  15815.    -- set the effective character expansion if the character
  15816.    -- expansion is individual.
  15817.      
  15818.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  15819.          .CHAR_EXPANSION = INDIVIDUAL then
  15820.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.CH_EXPANSION := EXPANSION;
  15821.    end if;
  15822.      
  15823. end SET_CHAR_EXPANSION_FACTOR;
  15824. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15825. --:UDD:GKSADACM:CODE:0A:WSR_SET_CHAR_SPG.ADA
  15826. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15827. ------------------------------------------------------------------
  15828. --
  15829. --  NAME: SET_CHAR_SPACING
  15830. --  IDENTIFIER: GDMXXX.1(1)
  15831. --  DISCREPANCY REPORTS:
  15832. --
  15833. ------------------------------------------------------------------
  15834. -- file: WSR_SET_CHAR_SPG.ADA
  15835. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15836.      
  15837. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_0a)
  15838.      
  15839. procedure SET_CHAR_SPACING
  15840.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15841.     SPACING       : in CHAR_SPACING) is
  15842.      
  15843. -- The workstation state list is accessed by the pointer
  15844. -- WS_STATE_LIST. The character spacing in the workstation
  15845. -- state list is set to the specified value.
  15846. -- If the aspect source flag for character spacing is
  15847. -- individual then the effective attribute in the workstation
  15848. -- state list is also set to the specified value.
  15849. --
  15850. -- The parameters to this procedure are used as follows:
  15851. --
  15852. -- WS_STATE_LIST - a pointer to the workstation state list.
  15853. -- SPACING       - the character spacing being set in the
  15854. --                 workstation state list.
  15855.      
  15856. begin
  15857.      
  15858.    -- set the character spacing in the workstation state list.
  15859.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_CHAR_SPACING :=
  15860.          SPACING;
  15861.      
  15862.    -- set the effective character spacing if the character
  15863.    -- spacing is individual.
  15864.      
  15865.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  15866.          .CHAR_SPACING = INDIVIDUAL then
  15867.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.CH_SPACE := SPACING;
  15868.    end if;
  15869.      
  15870. end SET_CHAR_SPACING;
  15871. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15872. --:UDD:GKSADACM:CODE:0A:WSR_SET_FA_IDX.ADA
  15873. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15874. ------------------------------------------------------------------
  15875. --
  15876. --  NAME: SET_FILL_AREA_INDEX
  15877. --  IDENTIFIER: GDMXXX.1(2)
  15878. --  DISCREPANCY REPORTS:
  15879. --  DR010  Bundle indices converted to natural
  15880. ------------------------------------------------------------------
  15881. -- file: WSR_SET_FA_IDX.ADA
  15882. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15883.      
  15884. separate (WSR_SET_BUNDLE_INDICES)
  15885.      
  15886. procedure SET_FILL_AREA_INDEX
  15887.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15888.     INDEX         : in FILL_AREA_INDEX) is
  15889.      
  15890. -- The workstation state list is accessed by the pointer
  15891. -- WS_STATE_LIST. The fill area index in the workstation
  15892. -- state list is set to the specified value.
  15893. -- If the aspect source flag for any fill area attribute is
  15894. -- bundled then the effective attribute in the workstation
  15895. -- state list is also set to the bundle value for that attribute.
  15896. -- If the specified bundle has not been set previously then
  15897. -- the effective attributes are set to the values found in
  15898. -- the default bundle (one).
  15899. --
  15900. -- The parameters to this procedure are used as follows:
  15901. --
  15902. -- WS_STATE_LIST - a pointer to the workstation state list.
  15903. -- INDEX         - the fill area index being set in the workstation
  15904. --                 state list.
  15905.      
  15906.    DEFAULT_INDEX : constant FILL_AREA_INDEX := 1;
  15907.    -- the index value used when the bundle for the specified
  15908.    -- index has not previously been set.
  15909.      
  15910.    IDX : NATURAL;
  15911.    -- a fill area index which holds either the value specified
  15912.    -- or the default value.  The type is natural corresponding
  15913.    -- to the bundle index type in the workstation state list.
  15914.      
  15915. begin
  15916.      
  15917.    -- set the fill area index in the workstation state list.
  15918.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_FILL_AREA_INDEX := INDEX;
  15919.      
  15920.    if FILL_AREA_INDICES
  15921.          .IS_IN_LIST(INDEX,WS_STATE_LIST.SET_OF_FILL_AREA_IDC) then
  15922.       -- The bundle for the specified index has previously been
  15923.       -- set so update the effective attributes with its values
  15924.       -- when the attributes are bundled.
  15925.      
  15926.       IDX := NATURAL(INDEX);
  15927.      
  15928.    else
  15929.       -- The bundle for the specified index has not been previously
  15930.       -- set so update the effective attributes with the values
  15931.       -- from the default bundle (one) when the attributes are bundled.
  15932.      
  15933.       IDX := NATURAL(DEFAULT_INDEX);
  15934.      
  15935.    end if;
  15936.      
  15937.    -- set the effective interior style when the interior
  15938.    -- style is bundled.
  15939.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  15940.          .INTERIOR_STYLE = BUNDLED then
  15941.       WS_STATE_LIST.EFFECTIVE_FILL_AREA_ATTR.INT_STYLE :=
  15942.            WS_STATE_LIST.FILL_AREA_BUNDLES(IDX).INT_STYLE;
  15943.    end if;
  15944.      
  15945.    -- set the effective style index when the style index is bundled.
  15946.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  15947.          .STYLE_INDEX = BUNDLED then
  15948.       WS_STATE_LIST.EFFECTIVE_FILL_AREA_ATTR.STYLE :=
  15949.             WS_STATE_LIST.FILL_AREA_BUNDLES(IDX).STYLE;
  15950.    end if;
  15951.      
  15952.    -- set the effective fill area colour when the colour is bundled.
  15953.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  15954.          .FILL_AREA_COLOUR = BUNDLED then
  15955.       WS_STATE_LIST.EFFECTIVE_FILL_AREA_ATTR.COLOUR :=
  15956.             WS_STATE_LIST.FILL_AREA_BUNDLES(IDX).COLOUR;
  15957.    end if;
  15958.      
  15959. end SET_FILL_AREA_INDEX;
  15960. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15961. --:UDD:GKSADACM:CODE:0A:WSR_SET_FA_STY_IDX.ADA
  15962. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  15963. ------------------------------------------------------------------
  15964. --
  15965. --  NAME: SET_FILL_AREA_STYLE_INDEX
  15966. --  IDENTIFIER: GDMXXX.1(1)
  15967. --  DISCREPANCY REPORTS:
  15968. --
  15969. ------------------------------------------------------------------
  15970. -- file: WSR_SET_FA_STY_IDX.ADA
  15971. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  15972.      
  15973. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_0a)
  15974.      
  15975. procedure SET_FILL_AREA_STYLE_INDEX
  15976.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  15977.     INDEX         : in STYLE_INDEX) is
  15978.      
  15979. -- The workstation state list is accessed by the pointer
  15980. -- WS_STATE_LIST. The fill area style index in the workstation
  15981. -- state list is set to the specified value.
  15982. -- If the aspect source flag for fill area style index is
  15983. -- individual then the effective attribute in the workstation
  15984. -- state list is also set to the specified value.
  15985. --
  15986. -- The parameters to this procedure are used as follows:
  15987. --
  15988. -- WS_STATE_LIST - a pointer to the workstation state list.
  15989. -- INDEX         - the fill area style index being set in the
  15990. --                 workstation state list.
  15991.      
  15992. begin
  15993.      
  15994.    -- set the fill area style index in the workstation state list.
  15995.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_FILL_AREA_STYLE_INDEX :=
  15996.          INDEX;
  15997.      
  15998.    -- set the effective style index if the style index is individual.
  15999.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16000.          .STYLE_INDEX = INDIVIDUAL then
  16001.       WS_STATE_LIST.EFFECTIVE_FILL_AREA_ATTR.STYLE := INDEX;
  16002.    end if;
  16003.      
  16004. end SET_FILL_AREA_STYLE_INDEX;
  16005. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16006. --:UDD:GKSADACM:CODE:0A:WSR_SET_LINW_SF.ADA
  16007. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16008. ------------------------------------------------------------------
  16009. --
  16010. --  NAME: SET_LINE_WIDTH_SCALE_FACTOR
  16011. --  IDENTIFIER: GDMXXX.1(1)
  16012. --  DISCREPANCY REPORTS:
  16013. --
  16014. ------------------------------------------------------------------
  16015. -- file: WSR_SET_LINW_SF.ADA
  16016. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  16017.      
  16018. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_0a)
  16019.      
  16020. procedure SET_LINE_WIDTH_SCALE_FACTOR
  16021.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  16022.     WIDTH         : in LINE_WIDTH) is
  16023.      
  16024. -- The workstation state list is accessed by the pointer
  16025. -- WS_STATE_LIST. The linewidth scale factor in the workstation
  16026. -- state list is set to the specified value.
  16027. -- If the aspect source flag for the linewidth scale factor is
  16028. -- individual then the effective attribute in the workstation
  16029. -- state list is also set to the specified value.
  16030. --
  16031. -- The parameters to this procedure are used as follows:
  16032. --
  16033. -- WS_STATE_LIST - a pointer to the workstation state list.
  16034. -- WIDTH         - the line width scale factor being set in the
  16035. --                 workstation state list.
  16036.      
  16037. begin
  16038.      
  16039.    -- set the linewidth scale factor in the workstation state list.
  16040.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_LINEWIDTH_SCALE_FACTOR :=
  16041.          WIDTH;
  16042.      
  16043.    -- set the effective linewidth if the linewidth is individual.
  16044.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16045.          .LINE_WIDTH = INDIVIDUAL then
  16046.       WS_STATE_LIST.EFFECTIVE_POLYLINE_ATTR.L_WIDTH := WIDTH;
  16047.    end if;
  16048.      
  16049. end SET_LINE_WIDTH_SCALE_FACTOR;
  16050. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16051. --:UDD:GKSADACM:CODE:0A:WSR_SET_MARK_SZE_SF.ADA
  16052. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16053. ------------------------------------------------------------------
  16054. --
  16055. --  NAME: SET_MARKER_SIZE_SCALE_FACTOR
  16056. --  IDENTIFIER: GDMXXX.1(1)
  16057. --  DISCREPANCY REPORTS:
  16058. --
  16059. ------------------------------------------------------------------
  16060. -- file: WSR_SET_MARK_SZE_SF.ADA
  16061. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  16062.      
  16063. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_0a)
  16064.      
  16065. procedure SET_MARKER_SIZE_SCALE_FACTOR
  16066.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  16067.     SIZE          : in MARKER_SIZE) is
  16068.      
  16069. -- The workstation state list is accessed by the pointer
  16070. -- WS_STATE_LIST. The marker size scale factor in the workstation
  16071. -- state list is set to the specified value.
  16072. -- If the aspect source flag for the marker size scale factor is
  16073. -- individual then the effective attribute in the workstation
  16074. -- state list is also set to the specified value.
  16075. --
  16076. -- The parameters to this procedure are used as follows:
  16077. --
  16078. -- WS_STATE_LIST - a pointer to the workstation state list.
  16079. -- SIZE          - the marker size scale factor being set in the
  16080. --                 workstation state list.
  16081.      
  16082. begin
  16083.      
  16084.    -- set the marker size in the workstation state list.
  16085.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_MARKER_SIZE_SCALE_FACTOR :=
  16086.          SIZE;
  16087.      
  16088.    -- set the effective marker size if the marker size is individual.
  16089.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16090.          .MARKER_SIZE = INDIVIDUAL then
  16091.       WS_STATE_LIST.EFFECTIVE_POLYMARKER_ATTR.M_SIZE := SIZE;
  16092.    end if;
  16093.      
  16094. end SET_MARKER_SIZE_SCALE_FACTOR;
  16095. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16096. --:UDD:GKSADACM:CODE:0A:WSR_SET_PAT_REF_PT.ADA
  16097. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16098. ------------------------------------------------------------------
  16099. --
  16100. --  NAME: SET_PATTERN_REFERENCE_POINT
  16101. --  IDENTIFIER: GDMXXX.1(1)
  16102. --  DISCREPANCY REPORTS:
  16103. --
  16104. ------------------------------------------------------------------
  16105. -- file: WSR_SET_PAT_REF_PT.ADA
  16106. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  16107.      
  16108. separate (WSR_SET_PRIMITIVE_ATTRIBUTES_0a)
  16109.      
  16110. procedure SET_PATTERN_REFERENCE_POINT
  16111.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  16112.     POINT         : in NDC.POINT) is
  16113.      
  16114. -- The workstation state list is accessed by the pointer
  16115. -- WS_STATE_LIST. The pattern reference point field of the
  16116. -- workstation state list is set to the specified value in POINT.
  16117. --
  16118. -- The parameters in this procedure are used as follows:
  16119. --
  16120. -- WS_STATE_LIST - a pointer to the workstation state list.
  16121. -- POINT         - the pattern reference point to be set in the
  16122. --                 workstation state list.
  16123.      
  16124. begin
  16125.      
  16126.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_PATTERN_REFERENCE_POINT :=
  16127.          POINT;
  16128.      
  16129. end SET_PATTERN_REFERENCE_POINT;
  16130. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16131. --:UDD:GKSADACM:CODE:0A:WSR_SET_PAT_SZE.ADA
  16132. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16133. ------------------------------------------------------------------
  16134. --
  16135. --  NAME: SET_PATTERN_SIZE
  16136. --  IDENTIFIER: GDMXXX.1(2)
  16137. --  DISCREPANCY REPORTS:
  16138. --  #019  06/14/85  "Change SET_PATTERN_SIZE to SET_PATTERN_VECTORS"
  16139. ------------------------------------------------------------------
  16140. -- file: WSR_SET_PAT_SZE.ADA
  16141. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  16142.      
  16143. separate (WSR_SET_PRIMITIVE_ATTRIBUTES_0a)
  16144.      
  16145. procedure SET_PATTERN_SIZE
  16146.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  16147.     PATTERN_HEIGHT_VECTOR : in NDC.VECTOR;                    -- DR019
  16148.     PATTERN_WIDTH_VECTOR  : in NDC.VECTOR) is                 -- DR019
  16149.      
  16150. -- The workstation state list is accessed by the pointer
  16151. -- WS_STATE_LIST. The pattern width vector and pattern
  16152. -- height vector fields of the workstation state list
  16153. -- are set to the specified values in PATTERN_HEIGHT_VECTOR and -- DR019
  16154. -- PATTERN_WIDTH_VECTOR.                                      -- DR019
  16155. --
  16156. -- The parameters in this procedure are used as follows:
  16157. --
  16158. -- WS_STATE_LIST - a pointer to the workstation state list.
  16159. -- PATTERN_HEIGHT_VECTOR - the pattern height vector to be set -- DR019
  16160. --                         in the workstation state list.      -- DR019
  16161. -- PATTERN_WIDTH_VECTOR - the pattern width vector to be set   -- DR019
  16162. --                        in the workstation state list.       -- DR019
  16163.      
  16164.      
  16165. begin
  16166.      
  16167.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_PATTERN_WIDTH_VECTOR :=   -- DR019
  16168.          PATTERN_WIDTH_VECTOR;                                 -- DR019
  16169.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_PATTERN_HEIGHT_VECTOR :=  -- DR019
  16170.          PATTERN_HEIGHT_VECTOR;                                -- DR019
  16171.      
  16172. end SET_PATTERN_SIZE;
  16173. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16174. --:UDD:GKSADACM:CODE:0A:WSR_SET_PLIN_IDX.ADA
  16175. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16176. ------------------------------------------------------------------
  16177. --
  16178. --  NAME: SET_POLYLINE_INDEX
  16179. --  IDENTIFIER: GDMXXX.1(2)
  16180. --  DISCREPANCY REPORTS:
  16181. --  DR010  Bundle indices converted to natural
  16182. ------------------------------------------------------------------
  16183. -- file: WSR_SET_PLIN_IDX.ADA
  16184. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  16185.      
  16186. separate (WSR_SET_BUNDLE_INDICES)
  16187.      
  16188. procedure SET_POLYLINE_INDEX
  16189.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  16190.     INDEX         : in POLYLINE_INDEX) is
  16191.      
  16192. -- The workstation state list is accessed by the pointer
  16193. -- WS_STATE_LIST. The polyline index in the workstation
  16194. -- state list is set to the specified value.
  16195. -- If the aspect source flag for any polyline attribute is
  16196. -- bundled then the effective attribute in the workstation
  16197. -- state list is also set to the bundle value for that attribute.
  16198. -- If the specified bundle has not been set previously then
  16199. -- the effective attributes are set to the values found in
  16200. -- the default bundle (one).
  16201. --
  16202. -- The parameters to this procedure are used as follows:
  16203. --
  16204. -- WS_STATE_LIST - a pointer to the workstation state list.
  16205. -- INDEX         - the polyline index being set in the workstation
  16206. --                 state list.
  16207.      
  16208.    DEFAULT_INDEX : constant POLYLINE_INDEX := 1;
  16209.    -- the index value used when the bundle for the specified
  16210.    -- index has not previously been set.
  16211.      
  16212.    IDX : NATURAL;
  16213.    -- a polyline index which holds either the value specified
  16214.    -- or the default value.  The type is natural corresponding
  16215.    -- to the bundle index type in the workstation state list.
  16216.      
  16217. begin
  16218.      
  16219.    -- set the polyline index in the workstation state list.
  16220.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_POLYLINE_INDEX := INDEX;
  16221.      
  16222.    if POLYLINE_INDICES
  16223.          .IS_IN_LIST(INDEX,WS_STATE_LIST.SET_OF_PLIN_IDC) then
  16224.       -- The bundle for the specified index has previously been
  16225.       -- set so update the effective attributes with its values
  16226.       -- when the attributes are bundled.
  16227.      
  16228.       IDX := NATURAL(INDEX);
  16229.      
  16230.    else
  16231.       -- The specified bundle has not been previously defined so
  16232.       -- set the effective attributes to values from the default
  16233.       -- index (one) when bundled.
  16234.      
  16235.       IDX := NATURAL(DEFAULT_INDEX);
  16236.      
  16237.    end if;
  16238.      
  16239.    -- set the effective linetype when the linetype is bundled.
  16240.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16241.          .LINETYPE = BUNDLED then
  16242.       WS_STATE_LIST.EFFECTIVE_POLYLINE_ATTR.L_TYPE :=
  16243.             WS_STATE_LIST.POLYLINE_BUNDLES(IDX).L_TYPE;
  16244.    end if;
  16245.      
  16246.    -- set the effective linewidth when the linewidth is bundled.
  16247.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16248.          .LINE_WIDTH = BUNDLED then
  16249.       WS_STATE_LIST.EFFECTIVE_POLYLINE_ATTR.L_WIDTH :=
  16250.             WS_STATE_LIST.POLYLINE_BUNDLES(IDX).L_WIDTH;
  16251.    end if;
  16252.      
  16253.    -- set the effective polyline colour when the colour is bundled.
  16254.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16255.          .LINE_COLOUR = BUNDLED then
  16256.       WS_STATE_LIST.EFFECTIVE_POLYLINE_ATTR.COLOUR :=
  16257.             WS_STATE_LIST.POLYLINE_BUNDLES(IDX).COLOUR;
  16258.    end if;
  16259.      
  16260. end SET_POLYLINE_INDEX;
  16261. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16262. --:UDD:GKSADACM:CODE:0A:WSR_SET_PMRK_IDX.ADA
  16263. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16264. ------------------------------------------------------------------
  16265. --
  16266. --  NAME: SET_POLYMARKER_INDEX
  16267. --  IDENTIFIER: GDMXXX.1(2)
  16268. --  DISCREPANCY REPORTS:
  16269. --  DR010  Bundle indices converted to natural
  16270. ------------------------------------------------------------------
  16271. -- file: WSR_SET_PMRK_IDX.ADA
  16272. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  16273.      
  16274. separate (WSR_SET_BUNDLE_INDICES)
  16275.      
  16276. procedure SET_POLYMARKER_INDEX
  16277.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  16278.     INDEX         : in POLYMARKER_INDEX) is
  16279.      
  16280. -- The workstation state list is accessed by the pointer
  16281. -- WS_STATE_LIST. The polymarker index in the workstation
  16282. -- state list is set to the specified value.
  16283. -- If the aspect source flag for any polymarker attribute is
  16284. -- bundled then the effective attribute in the workstation
  16285. -- state list is also set to the bundle value for that attribute.
  16286. -- If the specified bundle has not been set previously then
  16287. -- the effective attributes are set to the values found in
  16288. -- the default bundle (one).
  16289. --
  16290. -- The parameters to this procedure are used as follows:
  16291. --
  16292. -- WS_STATE_LIST - a pointer to the workstation state list.
  16293. -- INDEX         - the polymarker index being set in the workstation
  16294. --                 state list.
  16295.      
  16296.    DEFAULT_INDEX : constant POLYMARKER_INDEX :=1;
  16297.    -- the index value used when the bundle for the specified
  16298.    -- index has not previously been set.
  16299.      
  16300.    IDX : NATURAL;
  16301.    -- a polymarker index which holds either the value specified
  16302.    -- or the default value.  The type is natural corresponding to
  16303.    -- the bundle index type in the workstation state list.
  16304.      
  16305. begin
  16306.      
  16307.    -- set the polymarker index in the workstation state list.
  16308.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_POLYMARKER_INDEX := INDEX;
  16309.      
  16310.    if POLYMARKER_INDICES
  16311.          .IS_IN_LIST(INDEX,WS_STATE_LIST.SET_OF_PMRK_IDC) then
  16312.       -- The bundle for the specified index has previously been
  16313.       -- set so update the effective attributes with its values
  16314.       -- when the attributes are bundled.
  16315.      
  16316.       IDX := NATURAL(INDEX);
  16317.      
  16318.    else
  16319.       -- The bundle for the specified index has not been previously
  16320.       -- set so update the effective attributes with the values
  16321.       -- from the default index (one) when attributes are bundled.
  16322.       IDX := NATURAL(DEFAULT_INDEX);
  16323.      
  16324.    end if;
  16325.      
  16326.    -- set the effective marker type when the marker type is bundled.
  16327.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16328.          .MARKER_TYPE = BUNDLED then
  16329.       WS_STATE_LIST.EFFECTIVE_POLYMARKER_ATTR.M_TYPE :=
  16330.             WS_STATE_LIST.POLYMARKER_BUNDLES(IDX).M_TYPE;
  16331.    end if;
  16332.      
  16333.    -- set the effective marker size when the marker size is bundled.
  16334.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16335.          .MARKER_SIZE = BUNDLED then
  16336.       WS_STATE_LIST.EFFECTIVE_POLYMARKER_ATTR.M_SIZE :=
  16337.             WS_STATE_LIST.POLYMARKER_BUNDLES(IDX).M_SIZE;
  16338.    end if;
  16339.      
  16340.    -- set the effective polymarker colour when the colour is bundled.
  16341.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16342.          .MARKER_COLOUR = BUNDLED then
  16343.       WS_STATE_LIST.EFFECTIVE_POLYMARKER_ATTR.COLOUR :=
  16344.             WS_STATE_LIST.POLYMARKER_BUNDLES(IDX).COLOUR;
  16345.    end if;
  16346.      
  16347. end SET_POLYMARKER_INDEX;
  16348. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16349. --:UDD:GKSADACM:CODE:0A:WSR_SET_TEXT_IDX.ADA
  16350. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16351. ------------------------------------------------------------------
  16352. --
  16353. --  NAME: SET_TEXT_INDEX
  16354. --  IDENTIFIER: GDMXXX.1(2)
  16355. --  DISCREPANCY REPORTS:
  16356. --  DR010  Bundle indices converted to natural
  16357. ------------------------------------------------------------------
  16358. -- file: WSR_SET_TEXT_IDX.ADA
  16359. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  16360.      
  16361. separate (WSR_SET_BUNDLE_INDICES)
  16362.      
  16363. procedure SET_TEXT_INDEX
  16364.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  16365.     INDEX         : in TEXT_INDEX) is
  16366.      
  16367. -- The workstation state list is accessed by the pointer
  16368. -- WS_STATE_LIST. The text index in the workstation
  16369. -- state list is set to the specified value.
  16370. -- If the aspect source flag for any text attribute is
  16371. -- bundled then the effective attribute in the workstation
  16372. -- state list is also set to the bundle value for that attribute.
  16373. -- If the specified bundle has not been set previously then
  16374. -- the effective attributes are set to the values found in
  16375. -- the default bundle (one).
  16376. --
  16377. -- The parameters to this procedure are used as follows:
  16378. --
  16379. -- WS_STATE_LIST - a pointer to the workstation state list.
  16380. -- INDEX         - the text index being set in the
  16381. --                 workstation state list.
  16382.      
  16383.    DEFAULT_INDEX : constant TEXT_INDEX := 1;
  16384.    -- the index value used when the bundle for the specified
  16385.    -- index has not previously been set.
  16386.      
  16387.    IDX : NATURAL;
  16388.    -- a text index which holds either the value specified
  16389.    -- or the default value.  The type is natural corresponding
  16390.    -- to the bundle index type in the workstation state list.
  16391.      
  16392. begin
  16393.      
  16394.    -- set the text index in the workstation state list.
  16395.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_TEXT_INDEX := INDEX;
  16396.      
  16397.    if TEXT_INDICES
  16398.          .IS_IN_LIST(INDEX,WS_STATE_LIST.SET_OF_TEXT_IDC) then
  16399.       -- The bundle for the specified index has previously been
  16400.       -- set so update the effective attributes with its values
  16401.       -- when the attributes are bundled.
  16402.      
  16403.       IDX := NATURAL(INDEX);
  16404.      
  16405.    else
  16406.       -- The bundle for the specified index has not been previously
  16407.       -- set so update the effective attributes with the values
  16408.       -- from the default bundle (one) when the attributes are bundled.
  16409.      
  16410.       IDX := NATURAL(DEFAULT_INDEX);
  16411.      
  16412.    end if;
  16413.      
  16414.    -- set the effective text font when the text font is bundled.
  16415.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16416.          .TEXT_FONT_PRECISION = BUNDLED then
  16417.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.TEXT_FONT :=
  16418.             WS_STATE_LIST.TEXT_BUNDLES(IDX).TEXT_FONT;
  16419.    end if;
  16420.      
  16421.    -- set the effective character expansion when the character
  16422.    -- expansion is bundled.
  16423.      
  16424.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16425.          .CHAR_EXPANSION = BUNDLED then
  16426.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.CH_EXPANSION :=
  16427.             WS_STATE_LIST.TEXT_BUNDLES(IDX).CH_EXPANSION;
  16428.    end if;
  16429.      
  16430.    -- set the effective character spacing when the character spacing
  16431.    -- is bundled.
  16432.      
  16433.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16434.          .CHAR_SPACING = BUNDLED then
  16435.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.CH_SPACE :=
  16436.             WS_STATE_LIST.TEXT_BUNDLES(IDX).CH_SPACE;
  16437.    end if;
  16438.      
  16439.    -- set the effective text colour when the colour is bundled.
  16440.    if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16441.          .TEXT_COLOUR = BUNDLED then
  16442.       WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.COLOUR :=
  16443.             WS_STATE_LIST.TEXT_BUNDLES(IDX).COLOUR;
  16444.    end if;
  16445.      
  16446. end SET_TEXT_INDEX;
  16447. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16448. --:UDD:GKSADACM:CODE:0A:WSR_SET_TEXT_PATH.ADA
  16449. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16450. ------------------------------------------------------------------
  16451. --
  16452. --  NAME: SET_TEXT_PATH
  16453. --  IDENTIFIER: GDMXXX.1(1)
  16454. --  DISCREPANCY REPORTS:
  16455. --
  16456. ------------------------------------------------------------------
  16457. -- file: WSR_SET_TEXT_PATH.ADA
  16458. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  16459.      
  16460. separate (WSR_SET_PRIMITIVE_ATTRIBUTES_0a)
  16461.      
  16462. procedure SET_TEXT_PATH
  16463.    (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  16464.     PATH          : in TEXT_PATH) is
  16465.      
  16466. -- The workstation state list is accessed by the pointer
  16467. -- WS_STATE_LIST. The attribute field of the workstation
  16468. -- state list is set to the specified value.
  16469. --
  16470. -- The parameters to this procedure are used as follows:
  16471. --
  16472. -- WS_STATE_LIST - a pointer to the workstation state list.
  16473. -- PATH          - the value of the text path being set in the
  16474. --                 workstation state list.
  16475.      
  16476. begin
  16477.      
  16478.    WS_STATE_LIST.OUTPUT_ATTR.CURRENT_TEXT_PATH := PATH;
  16479.      
  16480. end SET_TEXT_PATH;
  16481. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16482. --:UDD:GKSADACM:CODE:0A:WSR_SET_TXTF_AND_PRC.ADA
  16483. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16484. ------------------------------------------------------------------
  16485. --
  16486. --  NAME: SET_TEXT_FONT_AND_PRECISION
  16487. --  IDENTIFIER: GDMXXX.1(1)
  16488. --  DISCREPANCY REPORTS:
  16489. --
  16490. ------------------------------------------------------------------
  16491. -- file: WSR_SET_TXTF_AND_PRC.ADA
  16492. -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c
  16493.      
  16494. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_0a)
  16495.      
  16496. procedure SET_TEXT_FONT_AND_PRECISION
  16497.    (WS_STATE_LIST  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  16498.     WS_DSCR_TBL    : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  16499.     FONT_PRECISION : in TEXT_FONT_PRECISION) is
  16500.      
  16501. -- The workstation state list is accessed by the pointer
  16502. -- WS_STATE_LIST. The text font and precision in the workstation
  16503. -- state list is set to the specified value if the FONT_PRECISION
  16504. -- is defined on this workstation.  Otherwise it is set to the
  16505. -- default value.
  16506. -- If the aspect source flag for text font and precision is
  16507. -- individual then the effective attribute in the workstation
  16508. -- state list is also set to the specified value.
  16509. --
  16510. -- The parameters to this procedure are used as follows:
  16511. --
  16512. -- WS_STATE_LIST  - a pointer to the workstation state list.
  16513. -- WS_DSCR_TBL    - workstation description table containing available
  16514. --                - text font and precision.
  16515. -- FONT_PRECISION - the text font and precision being set in the
  16516. --                  workstation state list.
  16517.      
  16518. begin
  16519.      
  16520.    if TEXT_FONT_PRECISIONS.IS_IN_LIST
  16521.          (FONT_PRECISION,WS_DSCR_TBL.LIST_TEXT_FONT_AND_PRECISION) then
  16522.       -- set the text font in the workstation state list to the
  16523.       -- specified value.
  16524.      
  16525.       WS_STATE_LIST.OUTPUT_ATTR.CURRENT_TEXT_FONT_AND_PRECISION :=
  16526.          FONT_PRECISION;
  16527.      
  16528.       -- set the effective text font if the text font is individual.
  16529.       if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16530.             .TEXT_FONT_PRECISION = INDIVIDUAL then
  16531.          WS_STATE_LIST.EFFECTIVE_TEXT_ATTR.TEXT_FONT := FONT_PRECISION;
  16532.       end if;
  16533.    else
  16534.       -- set the text font in the workstation state list to the
  16535.       -- default value (1;STRING_PRECISION).
  16536.      
  16537.       WS_STATE_LIST.OUTPUT_ATTR.CURRENT_TEXT_FONT_AND_PRECISION :=
  16538.          (1,STRING_PRECISION);
  16539.      
  16540.       -- set the effective text font if the text font is individual.
  16541.       if WS_STATE_LIST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  16542.             .TEXT_FONT_PRECISION = INDIVIDUAL then
  16543.          WS_STATE_LIST.EFFECTIVE_TEXT_ATTR
  16544.                .TEXT_FONT := (1,STRING_PRECISION);
  16545.       end if;
  16546.    end if;
  16547.      
  16548. end SET_TEXT_FONT_AND_PRECISION;
  16549. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16550. --:UDD:GKSADACM:CODE:MA:IMPORT_READ.ADA
  16551. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16552. ------------------------------------------------------------------
  16553. --
  16554. --  NAME: IMPORT_READ
  16555. --  IDENTIFIER: GDMXXX.1(1)
  16556. --  DISCREPANCY REPORTS:
  16557. --
  16558. ------------------------------------------------------------------
  16559. -- FILE : IMPORT_READ
  16560.      
  16561. with SYSTEM;
  16562.      
  16563. package IMPORT_READ  is
  16564.      
  16565. -- This package is designed to import the assembly language
  16566. -- routine that actually does the majority of the communication
  16567. -- from the Lexidata 3700 hardware. The SYSTEM package is used to
  16568. -- allow the use of the address type. This is used in passing the
  16569. -- location of an array.
  16570.      
  16571.    procedure ADA_PHREAD
  16572.       (BUFFER : SYSTEM.ADDRESS;
  16573.        COUNT  : INTEGER;
  16574.        WAIT   : BOOLEAN);
  16575.    pragma interface(masm,ADA_PHREAD);
  16576.    pragma entry_point(ADA_PHREAD, "PHREAD");
  16577.      
  16578. -- The PRAGMA INTERFACE tells the compiler in what language the
  16579. -- procedure is written. MASM is a macro assembler and ADA_PHREAD
  16580. -- is the name of the procedure, so the front end of the procedure is
  16581. -- in Ada and the code is in macro assembly language.
  16582. --
  16583. -- The PRAGMA ENTRY_POINT defines the symbol at which to begin
  16584. -- execution of the foreign program interfaced into the Ada
  16585. -- environment.
  16586. --
  16587. -- The procedure ADA_PHREAD is the interface between Ada and
  16588. -- the assembly language.
  16589. --
  16590. -- BUFFER - This is the starting address in memory to read from.
  16591. -- COUNT  - This variable contains the number of elements to read.
  16592. -- WAIT   - This tells the assembly language to wait until the
  16593. --          read operation is finished. It WAIT is set to false, it
  16594. --          is possible that the main program finishs and the assembly
  16595. --          language has placed data from the LEXIDATA 3700 into the
  16596. --          buffer that the user does not know about.
  16597.      
  16598. end IMPORT_READ;
  16599. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16600. --:UDD:GKSADACM:CODE:MA:IMPORT_WRITE.ADA
  16601. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16602. ------------------------------------------------------------------
  16603. --
  16604. --  NAME: IMPORT_WRITE
  16605. --  IDENTIFIER: GDMXXX.1(1)
  16606. --  DISCREPANCY REPORTS:
  16607. --
  16608. ------------------------------------------------------------------
  16609. -- FILE : IMPORT_WRITE
  16610.      
  16611. with SYSTEM;
  16612.      
  16613. package IMPORT_WRITE is
  16614.      
  16615. -- This package is designed to import the assembly language
  16616. -- routine that actually does the writing of commands to the
  16617. -- Lexidata 3700 hardware. The SYSTEM package is used to allow
  16618. -- the use of the address type. This is used in passing the
  16619. -- location of an array
  16620.      
  16621.    procedure ADA_PHWRIT
  16622.       (BUFFER : SYSTEM.ADDRESS;
  16623.        COUNT  : INTEGER;
  16624.        WAIT   : BOOLEAN);
  16625.    pragma interface(masm,ADA_PHWRIT);
  16626.    pragma entry_point(ADA_PHWRIT, "PHWRIT");
  16627.      
  16628. -- The PRAGMA INTERFACE tells the compiler in what language the
  16629. -- procedure is written. MASM is a macro assembler and ADA_PHWRIT
  16630. -- is the name of the procedure, so the front end of the procedure is
  16631. -- in Ada and the code is in macro assembly language.
  16632. --
  16633. -- The PRAGMA ENTRY_POINT defines the symbol at which to begin
  16634. -- execution of the foreign program interfaced into the Ada
  16635. -- environment.
  16636. --
  16637. -- The procedure ADA_PHWRIT is the interface between Ada and
  16638. -- the assembly language.
  16639. --
  16640. -- BUFFER - This is the starting address in memory to read from.
  16641. -- COUNT  - This variable contains the number of elements to read.
  16642. -- WAIT   - This tells the assembly language to wait until the
  16643. --          write operation is finished. If WAIT is set to false and
  16644. --          the main program finished before the assembly language
  16645. --          has had enough time to send the buffer to the LEXIDATA 3700,
  16646. --          it is possible that there will be unsent data remaining in
  16647. --          the buffer.
  16648.      
  16649. end IMPORT_WRITE;
  16650. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16651. --:UDD:GKSADACM:CODE:MA:IMPORT_VARIABLES.ADA
  16652. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16653. ------------------------------------------------------------------
  16654. --
  16655. --  NAME: IMPORT_VARIABLES
  16656. --  IDENTIFIER: GDMXXX.1(1)
  16657. --  DISCREPANCY REPORTS:
  16658. --
  16659. ------------------------------------------------------------------
  16660. -- FILE : IMPORT_VARIABLES.ADA
  16661.      
  16662. package IMPORT_VARIABLES is
  16663.      
  16664. -- This package specification is designed to allow the assembly
  16665. -- block of VARIABLES of data to be visible. PHBLK.SR is imported
  16666. -- into the Ada environment.
  16667.      
  16668. end IMPORT_VARIABLES;
  16669. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16670. --:UDD:GKSADACM:CODE:MA:IMPORT_WAIT.ADA
  16671. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16672. ------------------------------------------------------------------
  16673. --
  16674. --  NAME: IMPORT_WAIT
  16675. --  IDENTIFIER: GDMXXX.1(1)
  16676. --  DISCREPANCY REPORTS:
  16677. --
  16678. ------------------------------------------------------------------
  16679. -- FILE : IMPORT_WAIT.ADA
  16680.      
  16681. package IMPORT_WAIT is
  16682.      
  16683. -- This package imports the assembly language routine PHOWT.
  16684. -- This is used to pause the software until the hardware has
  16685. -- completed the current task and sends an interrupt to the PHOWT.
  16686.      
  16687.    procedure ADA_PHOWT;
  16688.    pragma interface(masm,ADA_PHOWT);
  16689.    pragma entry_point(ADA_PHOWT,"PHOWT");
  16690.      
  16691. -- The PRAGMA INTERFACE tells the compiler in what language the
  16692. -- procedure is written. MASM is a macro assembler and ADA_PHOWT
  16693. -- is the name of the procedure, so the front end of the procedure is
  16694. -- in Ada and the code is in macro assembly language.
  16695. --
  16696. -- The PRAGMA ENTRY_POINT defines the symbol at which to begin
  16697. -- execution of the foreign program interfaced into the Ada
  16698. -- environment.
  16699.      
  16700. end IMPORT_WAIT;
  16701. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16702. --:UDD:GKSADACM:CODE:MA:IMPORT_OPEN.ADA
  16703. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16704. ------------------------------------------------------------------
  16705. --
  16706. --  NAME: IMPORT_OPEN
  16707. --  IDENTIFIER: GDMXXX.1(1)
  16708. --  DISCREPANCY REPORTS:
  16709. --
  16710. ------------------------------------------------------------------
  16711. -- FILE : IMPORT_OPEN.ADA
  16712.      
  16713. package IMPORT_OPEN is
  16714.      
  16715. -- This package specification is used to import the assembly
  16716. -- language routine PHDOPN.
  16717.      
  16718.   procedure ADA_PHDOPN
  16719.      (INPUT_DEVICE   : INTEGER;
  16720.       OUTPUT_DEVICE  : INTEGER;
  16721.       ERROR          : out INTEGER);
  16722.   pragma interface (masm,ADA_PHDOPN);
  16723.   pragma entry_point (ADA_PHDOPN,"PHDOPN");
  16724.      
  16725. -- The PRAGMA INTERFACE tells the compiler in what language the
  16726. -- procedure is written. MASM is a macro assembler and ADA_PHDOPN
  16727. -- is the name of the procedure, so the front end of the procedure is
  16728. -- in Ada and the code is in macro assembly language.
  16729. --
  16730. -- The PRAGMA ENTRY_POINT defines the symbol at which to begin
  16731. -- execution of the foreign program interfaced into the Ada
  16732. -- environment.
  16733. --
  16734. -- This procedure is designed to open the Lexidata 3700 with an input
  16735. -- device channel and a output device channel. This procedure will
  16736. -- produce an error message. The value of 0 on the DATA GENERAL will
  16737. -- be returned if opened successfully.
  16738. --
  16739. -- INPUT_DEVICE  - contains the physical channel to communicate to
  16740. -- the device.
  16741. -- OUTPUT_DEVICE - contains the physical channel to communicate from
  16742. -- the device.
  16743. -- ERROR         - contains the host system defined error number.
  16744.      
  16745. end IMPORT_OPEN;
  16746. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16747. --:UDD:GKSADACM:CODE:MA:LEXI3700_COMM.ADA
  16748. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16749. ------------------------------------------------------------------
  16750. --
  16751. --  NAME: LEXI3700_COMMUNICATION
  16752. --  IDENTIFIER: GDMXXX.1(1)
  16753. --  DISCREPANCY REPORTS:
  16754. --
  16755. ------------------------------------------------------------------
  16756. -- FILE : LEXI3700_COMM.ADA
  16757. -- LEVEL: ALL
  16758.      
  16759. package LEXI3700_COMMUNICATION is
  16760.      
  16761. -- This package communicates with the Lexidata Graphics Device.
  16762.      
  16763.     type BIT_16 is range 16#0000# .. 16#FFFF#;
  16764.     -- The upper range FFFF will allow a 16 bit value to be stored here.
  16765.     -- If 7FFF is used for the upper range, the Ada compiler allocates
  16766.     -- a 16 bit word instead of the 32 bit word. This will cause the
  16767.     -- assembly language routine to work incorrectly.
  16768.      
  16769.     type LEXIDATA_ARRAY is array (POSITIVE range <>) of BIT_16;
  16770.     -- LEXIDATA_ARRAY is an unconstrained array of a 16 bit value
  16771.     -- that is sent to the Lexidata 3700.
  16772.      
  16773.     procedure CLOSE_LEXIDATA;
  16774.      
  16775.     procedure FLUSH_BUFFER
  16776.        (WAIT_TO_FINISH : BOOLEAN := true);
  16777.      
  16778.     procedure OPEN_LEXIDATA
  16779.        (CHANNEL_IN  : INTEGER;
  16780.         CHANNEL_OUT : INTEGER;
  16781.         ERROR_CODE  : out INTEGER);
  16782.      
  16783.     procedure READ_FROM_BUFFER
  16784.        (READ_BUFFER   : in out LEXIDATA_ARRAY);
  16785.      
  16786.     procedure WRITE_TO_BUFFER
  16787.        (WRITE_BUFFER  : LEXIDATA_ARRAY);
  16788.      
  16789. end LEXI3700_COMMUNICATION;
  16790. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16791. --:UDD:GKSADACM:CODE:MA:LEXI3700_COMM_B.ADA
  16792. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16793. ------------------------------------------------------------------
  16794. --
  16795. --  NAME: LEXI3700_COMMUNICATION - BODY
  16796. --  IDENTIFIER: GDMXXX.1(1)
  16797. --  DISCREPANCY REPORTS:
  16798. --
  16799. ------------------------------------------------------------------
  16800. -- FILE : LEXI3700_COMM_B.ADA
  16801. -- LEVEL: ALL
  16802.      
  16803. with IMPORT_OPEN;
  16804. with IMPORT_VARIABLES;
  16805. with IMPORT_WRITE;
  16806. with IMPORT_WAIT;
  16807. with IMPORT_READ;
  16808. with SYS_CALLS;
  16809.      
  16810. package body LEXI3700_COMMUNICATION is
  16811.      
  16812. -- The body of this package uses the assembly language interface
  16813. -- procedures to communicate with the device.
  16814.      
  16815.    MAX_BUFFER_SIZE : constant := 256;
  16816.    -- The size of one buffer.
  16817.      
  16818.    subtype LEXI_BUFFER is LEXIDATA_ARRAY (1 .. MAX_BUFFER_SIZE * 2);
  16819.    -- LEXI_BUFFER is the double buffer used to buffer commands to
  16820.    -- send to the Lexidata 3700.
  16821.      
  16822.    BUF_START    : INTEGER := 1;
  16823.    -- Dynamically changing pointer to the first position of the current
  16824.    -- buffer.
  16825.      
  16826.    BUF_POINTER  : INTEGER := 1;
  16827.    -- Dynamically changing pointer to the last word written in the
  16828.    -- buffer.
  16829.      
  16830.    OUT_BUFFER   : LEXI_BUFFER;
  16831.    -- Internally maintained buffer of data going to the Lexidata 3700.
  16832.      
  16833.    procedure CLOSE_LEXIDATA is
  16834.      
  16835.    -- CLOSE_LEXIDATA is a system dependant procedure which actually
  16836.    -- makes a Data General system call to close the channel/device.
  16837.      
  16838.         AC0     : INTEGER := 0;
  16839.         -- AC0 - System register required for Data General system calls.
  16840.      
  16841.         AC1     : INTEGER := 0;
  16842.         -- AC1 - System register required for Data General system calls.
  16843.      
  16844.         AC2     : INTEGER := 0;
  16845.         -- AC2 - System register required for Data General system calls.
  16846.      
  16847.         ER      : SYS_CALLS.ERROR_CODE;
  16848.         -- ER - Error return parameter not used in this call.
  16849.      
  16850.     begin
  16851.      
  16852.        IMPORT_WRITE.ADA_PHWRIT (0, 0, true);
  16853.        SYS_CALLS.SYS (SYS_CALLS.DDIS, AC0, AC1, AC2, ER);
  16854.      
  16855.     end CLOSE_LEXIDATA;
  16856.      
  16857.     procedure FLUSH_BUFFER
  16858.        (WAIT_TO_FINISH : BOOLEAN := true) is
  16859.      
  16860.     -- This procedure flushs the current buffer and waits until
  16861.     -- the assembly language routine is finished.
  16862.     --
  16863.     -- WAIT_TO_FINISH - flag set on buffer contents check.
  16864.      
  16865.     begin
  16866.      
  16867.        IMPORT_WAIT.ADA_PHOWT;
  16868.        -- check to make sure buffer has contents.
  16869.        if BUF_POINTER /= BUF_START then
  16870.           IMPORT_WRITE.ADA_PHWRIT(OUT_BUFFER(BUF_START)'ADDRESS,
  16871.                                BUF_POINTER - BUF_START,
  16872.                                WAIT_TO_FINISH);
  16873.           -- switch buffers.
  16874.           if BUF_START = 1 then
  16875.              BUF_START   := MAX_BUFFER_SIZE + 1;
  16876.              BUF_POINTER := MAX_BUFFER_SIZE + 1;
  16877.           else
  16878.              BUF_START   := 1;
  16879.              BUF_POINTER := 1;
  16880.           end if;
  16881.        end if;
  16882.     end FLUSH_BUFFER;
  16883.      
  16884.    procedure OPEN_LEXIDATA
  16885.       (CHANNEL_IN  : INTEGER;
  16886.        CHANNEL_OUT : INTEGER;
  16887.        ERROR_CODE  : out INTEGER) is
  16888.      
  16889.    -- This procedure opens up communication to the device.
  16890.    --
  16891.    -- CHANNEL_IN  - is the I/O channel used for output from the host.
  16892.    -- CHANNEL_OUT - is the I/O channel used for input to the host.
  16893.    -- ERROR_CODE  - is an error that is passed back to the caller. This
  16894.    --               error number is host dependent.
  16895.      
  16896.    begin
  16897.      
  16898.       IMPORT_OPEN.ADA_PHDOPN(CHANNEL_IN, CHANNEL_OUT, ERROR_CODE);
  16899.      
  16900.    end OPEN_LEXIDATA;
  16901.      
  16902.    procedure READ_FROM_BUFFER
  16903.        (READ_BUFFER : in out LEXIDATA_ARRAY) is
  16904.      
  16905.     -- This procedure reads from the device.
  16906.     --
  16907.     -- READ_BUFFER - contains the array of data read from the device.
  16908.      
  16909.     begin
  16910.      
  16911.         -- call the assembly routine
  16912.      
  16913.         IMPORT_READ.ADA_PHREAD(READ_BUFFER(1)'address, READ_BUFFER'length,
  16914.                            true);
  16915.      
  16916.     end READ_FROM_BUFFER;
  16917.      
  16918.     procedure WRITE_TO_BUFFER
  16919.        (WRITE_BUFFER : LEXIDATA_ARRAY) is
  16920.      
  16921.     -- This procedure double buffers data sent to the display processor.
  16922.     --
  16923.     -- This procedure uses two buffers to send data to the display.
  16924.     -- Once one buffer is full, that full buffer is sent to the assembly
  16925.     -- language routine to start transmitting. While one buffer is being
  16926.     -- transmitted to the display processor, the other buffer can be used.
  16927.     -- There is a wait assembly routine that makes sure the transmit
  16928.     -- assembly routine is finished with one buffer before receiving
  16929.     -- another buffer to transmit.
  16930.     --
  16931.     -- WRITE_BUFFER - buffer of data to be sent to the LEXIDATA.
  16932.      
  16933.     CURRENT_POINTER : INTEGER;
  16934.     -- pointer of incoming buffer
  16935.      
  16936.     WORD_COUNT : INTEGER;
  16937.     -- counts the number of items in the incoming buffer
  16938.      
  16939.     REMAINING_SPACE : INTEGER;
  16940.     -- contains the amount of REMAINING_SPACE in the output buffer
  16941.      
  16942.     begin
  16943.      
  16944.      -- Check to see if the incoming buffer fits into the current buffer.
  16945.      -- Initialize loop that runs while the word count is greater than
  16946.      -- or equal to the REMAINING_SPACE available in the current buffer.
  16947.      -- Then copy as many words that will fit in the current buffer and
  16948.      -- call FLUSH. FLUSH passes out the current buffer and switch
  16949.      -- the buffers to continue packing the incoming buffer.
  16950.      
  16951.        WORD_COUNT := WRITE_BUFFER'LENGTH;
  16952.        CURRENT_POINTER := WRITE_BUFFER'FIRST;
  16953.        REMAINING_SPACE  := BUF_START + MAX_BUFFER_SIZE - BUF_POINTER;
  16954.        while (WORD_COUNT >= REMAINING_SPACE) loop
  16955.              OUT_BUFFER(BUF_POINTER .. (BUF_POINTER + REMAINING_SPACE - 1)) :=
  16956.                    WRITE_BUFFER(CURRENT_POINTER .. (CURRENT_POINTER + REMAINING_
  16957. SPACE - 1));
  16958.              CURRENT_POINTER := CURRENT_POINTER + REMAINING_SPACE;
  16959.              BUF_POINTER := BUF_POINTER + REMAINING_SPACE;
  16960.              FLUSH_BUFFER(false);
  16961.              WORD_COUNT := WORD_COUNT - REMAINING_SPACE;
  16962.              REMAINING_SPACE  := BUF_START + MAX_BUFFER_SIZE - BUF_POINTER;
  16963.         end loop;
  16964.      
  16965.         -- The remaining words of the incoming buffer will fit into the
  16966.         -- current buffer. Therefore the loop is exited and the
  16967.         -- rest of the incoming buffer is packed into the current buffer.
  16968.         -- If WORD_COUNT is equal to zero, then it was packed in and flushed.
  16969.      
  16970.         if WORD_COUNT > 0 then
  16971.            OUT_BUFFER(BUF_POINTER .. BUF_POINTER + WORD_COUNT - 1) :=
  16972.                 WRITE_BUFFER(CURRENT_POINTER .. CURRENT_POINTER + WORD_COUNT - 1
  16973. );
  16974.            BUF_POINTER := BUF_POINTER + WORD_COUNT;
  16975.         end if;
  16976.      
  16977.     end WRITE_TO_BUFFER;
  16978.      
  16979. end LEXI3700_COMMUNICATION;
  16980. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16981. --:UDD:GKSADACM:CODE:MA:LEXI3700_CONFIG.ADA
  16982. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  16983. ------------------------------------------------------------------
  16984. --
  16985. --  NAME: LEXI3700_CONFIGURATION
  16986. --  IDENTIFIER: GDMXXX.2(1)
  16987. --  DISCREPANCY REPORTS:
  16988. --  DR012  Text character spacing.
  16989. ------------------------------------------------------------------
  16990. -- FILE : LEXI3700_CONFIG.ADA
  16991. -- LEVEL: ALL
  16992.      
  16993. PACKAGE LEXI3700_CONFIGURATION is
  16994.      
  16995. -- This package contains device specific values that control
  16996. -- the appearance of output on the display.
  16997.      
  16998.    NUM_OF_BITS_USED_FOR_SYSTEM       : constant := 8;
  16999.    -- Number of bits used to describe each pixel in the lookup table.
  17000.    -- This number of bits provide the possible intensity values available.
  17001.      
  17002.    NUM_OF_BITS_USED_FOR_SIZE_OF_CLUT : constant := 8;
  17003.    -- This refers to the amount of memory space available in a lookup table.
  17004.      
  17005.    LEXI_MAXIMUM_PLANE_VALUE : constant :=
  17006.         (2 ** NUM_OF_BITS_USED_FOR_SYSTEM) - 1;
  17007.    -- Is used to mask different planes for different operations.
  17008.      
  17009.    LEXI_MAXIMUM_COLOUR_INDEX : constant :=
  17010.         (2 ** (NUM_OF_BITS_USED_FOR_SIZE_OF_CLUT - 1));
  17011.    -- The number of valid colour indices supported, the last plane is
  17012.    -- used for edge fill for filling polygons.
  17013.      
  17014.    LEXI_MAXIMUM_COLOUR_INTENSITY : constant :=
  17015.         (2 ** NUM_OF_BITS_USED_FOR_SYSTEM) - 1;
  17016.    -- Is the maximum colour intensity allowed to specified each colour
  17017.    -- index.
  17018.      
  17019.    LEXI_NUMBER_OF_LINE_TYPES : constant := 4;
  17020.    -- Tells how many line types the device offers.
  17021.      
  17022.    LEXI_NUMBER_OF_MARKER_TYPES : constant := 5;
  17023.    -- Tells how many marker types the device offers.
  17024.      
  17025.    LEXI_NOMINAL_LINE_WIDTH : constant := 1;
  17026.    LEXI_MINIMUM_LINE_WIDTH : constant := 1;
  17027.    LEXI_MAXIMUM_LINE_WIDTH : constant := 50;
  17028.    -- Tells the range of line widths the device offers.
  17029.      
  17030.    LEXI_NOMINAL_TEXT_SIZE  : constant := 1;
  17031.    LEXI_MINIMUM_TEXT_SIZE  : constant := 1;
  17032.    LEXI_MAXIMUM_TEXT_SIZE  : constant := 50;
  17033.    -- Tells the range of text sizes that the device offers.
  17034.      
  17035.    LEXI_FILL_PLANE_VALUE : constant := 2 ** (NUM_OF_BITS_USED_FOR_SYSTEM - 1);
  17036.    -- Is the plane used for fill area.
  17037.      
  17038.    LEXI_CHARACTER_FONT_HEIGHT : constant := 12;
  17039.    LEXI_CHARACTER_FONT_WIDTH  : constant := 9;
  17040.    -- This includes a pixel space on both sides.
  17041.    LEXI_CHARACTER_FONT        : constant := 9.0 / 12.0;
  17042.    LEXI_CHARACTER_FONT_CAP_TOP : constant := 1.0 / 12.0;
  17043.    LEXI_CHARACTER_FONT_BASE_BOTTOM : constant := 1.0 / 12.0;
  17044.    -- Describes the hardware text font designer.
  17045.      
  17046.    LEXI_X_MAXIMUM : constant := 1279;
  17047.    LEXI_Y_MAXIMUM : constant := 1023;
  17048.    -- Tells the maximum screen size .
  17049.      
  17050. end LEXI3700_CONFIGURATION;
  17051. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17052. --:UDD:GKSADACM:CODE:MA:LEXI3700_TYPES.ADA
  17053. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17054. ------------------------------------------------------------------
  17055. --
  17056. --  NAME: LEXI3700_TYPES
  17057. --  IDENTIFIER: GDMXXX.2(1)
  17058. --  DISCREPANCY REPORTS:
  17059. --  Not listed
  17060. ------------------------------------------------------------------
  17061. -- FILE : LEXI3700_TYPES.ADA
  17062. -- LEVEL: ALL
  17063.      
  17064. with LEXI3700_CONFIGURATION;
  17065.      
  17066. use  LEXI3700_CONFIGURATION;
  17067.      
  17068. package LEXI3700_TYPES is
  17069.      
  17070. -- The package LEXI3700_CONFIGURATION contains the specific values
  17071. -- that control the appearance of output on the display.
  17072.      
  17073.    type LEXI_PATTERN_SIZE is new INTEGER;
  17074.    -- LEXI_PATTERN_SIZE is used to describe the pattern size for vectors
  17075.    -- and arcs. Used with procedure SET_DISPLAY_PARAMETERS.
  17076.      
  17077.    type LEXI_RADIUS_TYPE is range 1 .. LEXI_X_MAXIMUM;
  17078.    -- LEXI_RADIUS_TYPE is used to describe the radius of circles and
  17079.    -- arcs.
  17080.      
  17081.    type LEXI_PLANE_VALUE is range 0 .. LEXI_MAXIMUM_PLANE_VALUE;
  17082.    -- LEXI_PLANE_VALUE describes the display memory planes available.
  17083.      
  17084.    type LEXI_COORDINATE is range 0 .. LEXI_X_MAXIMUM;
  17085.    -- LEXI_COORDINATE describes the range of coordinates for the Lexidata.
  17086.      
  17087.    type LEXI_COUNT_VALUE is new NATURAL;
  17088.    -- LEXI_COUNT_VALUE describes the range of arc size and starting
  17089.    -- position for the DISPLAY_ARC procedure.
  17090.      
  17091.    type LEXI_PLANE_ADDRESS is new INTEGER;
  17092.    -- LEXI_PLANE_ADDRESS describes the range of values for the Red,
  17093.    -- Green, and Blue plane address.
  17094.      
  17095.    type LEXI_POINT is record
  17096.         X : LEXI_COORDINATE;
  17097.         Y : LEXI_COORDINATE;
  17098.    end record;
  17099.    -- LEXI_POINT describes a record for the x and y coordinates of a
  17100.    -- point.
  17101.      
  17102.    type LEXI_POINTS is array (POSITIVE range <>) of LEXI_POINT;
  17103.    -- LEXI_POINTS creates a unconstrained array of x and y coordinates.
  17104.      
  17105.    type LEXI_COLOUR_INDEX is range 0 .. LEXI_MAXIMUM_COLOUR_INDEX;
  17106.    -- LEXI_COLOUR_INDEX is the range of valid colour indices.
  17107.      
  17108.    type LEXI_COLOUR_INTENSITY is range 0 .. LEXI_MAXIMUM_COLOUR_INTENSITY;
  17109.    -- LEXI_COLOUR_INTENSITY is the range of valid intensity values.
  17110.      
  17111.    type LEXI_PIXEL_COLOUR is record
  17112.         RED   : LEXI_COLOUR_INTENSITY;
  17113.         BLUE  : LEXI_COLOUR_INTENSITY;
  17114.         GREEN : LEXI_COLOUR_INTENSITY;
  17115.    end record;
  17116.    -- LEXI_PIXEL_COLOUR is a record made up of Red, Blue, and Green
  17117.    -- intensities.
  17118.      
  17119.    type LEXI_PIXEL_ARRAY_INDEX is array (POSITIVE range <>)
  17120.         of LEXI_COLOUR_INDEX;
  17121.    -- LEXI_PIXEL_ARRAY_INDEX is an unconstrained array of Red, Blue,
  17122.    -- and Green intensity values that make up a colour index.
  17123.      
  17124.    type LEXI_CHARACTER_PATH is (LEFT_TO_RIGHT,
  17125.                                 RIGHT_TO_LEFT,
  17126.                                 BOTTOM_TO_TOP,
  17127.                                 TOP_TO_BOTTOM);
  17128.    -- LEXI_CHARACTER_PATH describes the offered character paths for
  17129.    -- the Lexidata 3700.
  17130.      
  17131.    type LEXI_ROTATE_CODE is    (NO_ROTATION,
  17132.                                 ROTATION_90,
  17133.                                 ROTATION_180,
  17134.                                 ROTATION_270);
  17135.    -- LEXI_ROTATE_CODE describes the offered character rotations
  17136.    -- for the Lexidata 3700.
  17137.      
  17138.    type LEXI_CURSOR_TYPE is (NON_INTERLACED_CROSSHAIR,
  17139.                              NON_INTERLACED_MATRIX,
  17140.                              INTERLACED_CROSSHAIR,
  17141.                              INTERLACED_MATRIX);
  17142.    -- LEXI_CURSOR_TYPE describes the four cursor types offered for the
  17143.    -- Lexidata 3700.
  17144.      
  17145.    type LEXI_MARKER_TYPE is (PERIOD,
  17146.                              PLUS,
  17147.                              ASTERISK,
  17148.                              ZERO,
  17149.                              X_CHAR);
  17150.    -- LEXI_MARKER_TYPE defines the list of valid markers.
  17151.      
  17152.    type LEXI_TEXT_SIZE is range
  17153.         LEXI_MINIMUM_TEXT_SIZE .. LEXI_MAXIMUM_TEXT_SIZE;
  17154.    -- LEXI_TEXT_SIZE defines the range of text sizes.
  17155.      
  17156.    type LEXI_LINE_TYPE is (SOLID_LINE,
  17157.                            DASHED_LINE,
  17158.                            DOTTED_LINE,
  17159.                            DASHED_DOTTED_LINE);
  17160.    -- LEXI_LINE_TYPE is the list of valid line types that the
  17161.    -- Lexidata 3700 offers.
  17162.      
  17163.    type LEXI_LINE_WIDTH_TYPE is range
  17164.         LEXI_MINIMUM_LINE_WIDTH .. LEXI_MAXIMUM_LINE_WIDTH;
  17165.    -- LEXI_LINE_WIDTH_TYPE is the range of line widths.
  17166.      
  17167.    type LEXI_INTERIOR_STYLE is (HOLLOW, SOLID);
  17168.    -- LEXI_INTERIOR_STYLE defines the two interior styles offered.
  17169.      
  17170. end LEXI3700_TYPES;
  17171. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17172. --:UDD:GKSADACM:CODE:MA:LEXI_OUT_DRIVER.ADA
  17173. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17174. ------------------------------------------------------------------
  17175. --
  17176. --  NAME: LEXI3700_OUTPUT_DRIVER
  17177. --  IDENTIFIER: GDMXXX.2(1)
  17178. --  DISCREPANCY REPORTS:
  17179. --  Not listed
  17180. ------------------------------------------------------------------
  17181. -- FILE : LEXI_OUT_DRIVER.ADA
  17182. -- LEVEL: ALL
  17183.      
  17184. with LEXI3700_TYPES;
  17185. with LEXI3700_CONFIGURATION;
  17186.      
  17187. use  LEXI3700_TYPES;
  17188.      
  17189. package LEXI3700_OUTPUT_DRIVER is
  17190.      
  17191. -- This package defines the procedure interface to the Lexidata 3700
  17192. -- graphics display device. This is a subset of the procedures supplied
  17193. -- by the Lexidata to support the GKS.
  17194. -- The naming convention used here to name the procedures in the
  17195. -- LEXI3700_DRIVER is the definition title found in the FUNCTION
  17196. -- DESCRIPTIONS Section 3 of the Lexidata manual. The definition title
  17197. -- is the definition of each function found on the top of each page
  17198. -- that describes a firmware function.
  17199. -- An example of this naming convention is the Lexidata library
  17200. -- call DSCLR with the definition title of CLEAR DISPLAY. So this is
  17201. -- the name that is used for the procedure name.
  17202.      
  17203.    LEXI_MARKER             : constant array (LEXI_MARKER_TYPE)
  17204.                              of STRING(1 .. 1) :=
  17205.                              (PERIOD   => ".",
  17206.                               PLUS     => "+",
  17207.                               ASTERISK => "*",
  17208.                               ZERO     => "o",
  17209.                               X_CHAR   => "x");
  17210.    -- LEXI_MARKER is an array of valid marker types.
  17211.      
  17212.     procedure CLEAR_DISPLAY
  17213.        (PLANE : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last);
  17214.      
  17215.     procedure DEFINE_WRITE_CHANNELS
  17216.        (TEXT_CHANNEL  : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last;
  17217.         GRAPH_CHANNEL : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last;
  17218.         IMAGE_CHANNEL : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last);
  17219.      
  17220.     procedure DISPLAY_ARC
  17221.        (CENTER      : LEXI_POINT;
  17222.         RADIUS      : LEXI_RADIUS_TYPE;
  17223.         COLOUR      : LEXI_COLOUR_INDEX;
  17224.         START       : LEXI_COUNT_VALUE;
  17225.         PIXEL_COUNT : LEXI_COUNT_VALUE);
  17226.      
  17227.     procedure DISPLAY_CHAINED_VECTORS
  17228.        (COLOUR : LEXI_COLOUR_INDEX;
  17229.         POINTS : LEXI_POINTS);
  17230.      
  17231.     procedure DISPLAY_CIRCLE
  17232.        (CENTER : LEXI_POINT;
  17233.         RADIUS : LEXI_RADIUS_TYPE;
  17234.         COLOUR : LEXI_COLOUR_INDEX);
  17235.      
  17236.     procedure DISPLAY_TEXT
  17237.        (TEXT : STRING);
  17238.      
  17239.     procedure FLUSH;
  17240.      
  17241.     procedure OPEN
  17242.        (CHANNEL_IN  : INTEGER;
  17243.         CHANNEL_OUT : INTEGER;
  17244.         ERROR_CODE  : out INTEGER);
  17245.      
  17246.     procedure POLYGON_EDGE_FLAG_FILL
  17247.        (FILL_VALUE      : LEXI_COLOUR_INDEX;
  17248.         LEXI_PLANE_MASK : LEXI_PLANE_VALUE :=
  17249.               LEXI3700_CONFIGURATION.LEXI_FILL_PLANE_VALUE);
  17250.      
  17251.     procedure RANDOM_PIXEL_READ
  17252.        (POINTS      : LEXI_POINTS;
  17253.         PIXEL_ARRAY : out LEXI_PIXEL_ARRAY_INDEX);
  17254.      
  17255.     procedure RANDOM_PIXEL_WRITE
  17256.        (POINTS  : LEXI_POINTS;
  17257.         COLOURS : LEXI_PIXEL_ARRAY_INDEX);
  17258.      
  17259.     procedure READ_FROM_LUT
  17260.        (COLOUR_INDEX : LEXI_COLOUR_INDEX;
  17261.         COLOUR_VALUE : out LEXI_PIXEL_COLOUR);
  17262.      
  17263.     procedure SET_DISPLAY_PARAMETERS
  17264.        (WIDTH : LEXI_LINE_WIDTH_TYPE;
  17265.         LINE  : LEXI_LINE_TYPE;
  17266.         FILL  : LEXI_INTERIOR_STYLE;
  17267.         SIZE  : LEXI_PATTERN_SIZE := 2);
  17268.      
  17269.     procedure SET_HARDWARE_CURSOR
  17270.        (CURSOR : LEXI_CURSOR_TYPE := NON_INTERLACED_MATRIX;
  17271.         XOFF   : LEXI_COORDINATE := 0;
  17272.         YOFF   : LEXI_COORDINATE := 0);
  17273.      
  17274.     procedure SET_RECTANGULAR_LIMIT
  17275.        (UPPER_LEFT  : LEXI_POINT;
  17276.         LOWER_RIGHT : LEXI_POINT);
  17277.      
  17278.     procedure SET_TEXT_CHARACTER_ROTATION
  17279.        (ROTATION : LEXI_ROTATE_CODE);
  17280.      
  17281.     procedure SET_TEXT_PARAMETERS
  17282.        (POSITION : LEXI_POINT;
  17283.         COLOUR   : LEXI_COLOUR_INDEX;
  17284.         PATH     : LEXI_CHARACTER_PATH;
  17285.         SIZE     : LEXI_TEXT_SIZE);
  17286.      
  17287.     procedure SET_TEXT_WINDOW
  17288.        (UPPER_LEFT  : LEXI_POINT;
  17289.         LOWER_RIGHT : LEXI_POINT);
  17290.      
  17291.     procedure SEQUENTIAL_PIXEL_WRITE
  17292.        (PIXEL_ARRAY : LEXI_PIXEL_ARRAY_INDEX);
  17293.      
  17294.     procedure WRITE_TO_LUT
  17295.        (COLOUR_INDEX : LEXI_COLOUR_INDEX;
  17296.         COLOUR_VALUE : LEXI_PIXEL_COLOUR);
  17297.      
  17298. end LEXI3700_OUTPUT_DRIVER;
  17299. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17300. --:UDD:GKSADACM:CODE:MA:LEXI_OUT_DRIVER_B.ADA
  17301. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  17302. ------------------------------------------------------------------
  17303. --
  17304. --  NAME: LEXI3700_OUTPUT_DRIVER - BODY
  17305. --  IDENTIFIER: GDMXXX.2(2)
  17306. --  DISCREPANCY REPORTS:
  17307. --  DR034  Fix pline clip.
  17308. ------------------------------------------------------------------
  17309. -- FILE : LEXI_OUT_DRIVER_B.ADA
  17310. -- LEVEL: ALL
  17311.      
  17312. with LEXI3700_COMMUNICATION;
  17313.      
  17314. use  LEXI3700_COMMUNICATION;
  17315.      
  17316. package body LEXI3700_OUTPUT_DRIVER is
  17317.      
  17318. -- The LEXI3700_COMMUNICATION package communicates with the Lexidata
  17319. -- graphics display.
  17320.      
  17321.    CLEAR_DISPLAY_OP               : constant := 3;
  17322.    -- Clear the display
  17323.      
  17324.    DEFINE_WRITE_CHANNELS_OP       : constant := 2;
  17325.    -- Fill area
  17326.      
  17327.    DISPLAY_ARC_OP                 : constant := 43;
  17328.    -- Arc for clipping circle
  17329.      
  17330.    DISPLAY_CHAINED_VECTORS_OP     : constant := 41;
  17331.    -- Polyline, Fill area
  17332.      
  17333.    DISPLAY_CIRCLE_OP              : constant := 14;
  17334.    -- Circle
  17335.      
  17336.    DISPLAY_TEXT_OP                : constant := 9;
  17337.    -- Polymarker, Text
  17338.      
  17339.    POLYGON_EDGE_FLAG_FILL_OP      : constant := 48;
  17340.    -- Fill area
  17341.      
  17342.    RANDOM_PIXEL_READ_OP           : constant := 16;
  17343.    -- Inq_Pixel_Ar, Inq_Pixel
  17344.      
  17345.    RANDOM_PIXEL_WRITE_OP          : constant := 17;
  17346.    -- Cell_Array
  17347.      
  17348.    READ_FROM_LUT_OP               : constant := 21;
  17349.    -- Inq_Pixel_Ar, Inq_Pixel
  17350.      
  17351.    SET_DISPLAY_PARAMETERS_OP      : constant := 40;
  17352.    -- Polyline,Fill area,Circle
  17353.      
  17354.    SET_HARDWARE_CURSOR_OP         : constant := 26;
  17355.    -- Erases the hardware cursor
  17356.      
  17357.    SET_RECTANGULAR_LIMIT_OP       : constant := 1;
  17358.    -- Fill area
  17359.      
  17360.    SET_TEXT_CHARACTER_ROTATION_OP : constant := 93;
  17361.    -- Character up vector
  17362.      
  17363.    SET_TEXT_PARAMETERS_OP         : constant := 19;
  17364.    -- Polymarker and Text attribute
  17365.      
  17366.    SET_TEXT_WINDOW_OP             : constant := 100;
  17367.    -- String precision
  17368.      
  17369.    SEQUENTIAL_PIXEL_WRITE_OP      : constant := 4;
  17370.    -- cell array
  17371.      
  17372.    WRITE_TO_LUT_OP                : constant := 20;
  17373.    -- Set_Clr_Rep
  17374.      
  17375.    RED_PLANE_ADDRESS   : constant LEXI_PLANE_ADDRESS :=
  17376.          1* LEXI_PLANE_ADDRESS(LEXI_PLANE_VALUE'last + 1);
  17377.    GREEN_PLANE_ADDRESS : constant LEXI_PLANE_ADDRESS :=
  17378.          2* LEXI_PLANE_ADDRESS(LEXI_PLANE_VALUE'last + 1);
  17379.    BLUE_PLANE_ADDRESS  : constant LEXI_PLANE_ADDRESS :=
  17380.          3* LEXI_PLANE_ADDRESS(LEXI_PLANE_VALUE'last + 1);
  17381.    -- These constants address the physical memory locations of
  17382.    -- the colour planes to write an intensity value.
  17383.      
  17384.    LEXI_CHARACTER_ROTATION : constant array (LEXI_ROTATE_CODE)
  17385.                              of INTEGER :=
  17386.                              (NO_ROTATION  => 0,
  17387.                               ROTATION_90  => 1,
  17388.                               ROTATION_180 => 2,
  17389.                               ROTATION_270 => 3);
  17390.    -- LEXI_CHARACTER_ROTATION is an array of valid character rotations.
  17391.      
  17392.    LEXI_LINE               : constant array (LEXI_LINE_TYPE)
  17393.                              of INTEGER :=
  17394.                              (SOLID_LINE         => 8#147777#,
  17395.                               DASHED_LINE        => 8#147007#,
  17396.                               DOTTED_LINE        => 8#146000#,
  17397.                               DASHED_DOTTED_LINE => 8#147431#);
  17398.    -- LEXI_LINE is an array of valid line types.
  17399.      
  17400.    LEXI_PATH               : constant array (LEXI_CHARACTER_PATH)
  17401.                              of INTEGER :=
  17402.                              (LEFT_TO_RIGHT => 8#000#,
  17403.                               RIGHT_TO_LEFT => 8#200#,
  17404.                               BOTTOM_TO_TOP => 8#300#,
  17405.                               TOP_TO_BOTTOM => 8#100#);
  17406.    -- LEXI_PATH is an array of valid character paths.
  17407.      
  17408.    LEXI_FILL_VALUE         : constant array (LEXI_INTERIOR_STYLE)
  17409.                              of INTEGER :=
  17410.                              (HOLLOW => 8#000000#,
  17411.                               SOLID  => 8#130000#);
  17412.    -- LEXI_FILL_VALUE is an array of fill values offered.
  17413.      
  17414.    HARDWARE_CURSOR         : constant array (LEXI_CURSOR_TYPE)
  17415.                              of INTEGER :=
  17416.                              (NON_INTERLACED_CROSSHAIR => 0,
  17417.                               NON_INTERLACED_MATRIX    => 2,
  17418.                               INTERLACED_CROSSHAIR     => 8,
  17419.                               INTERLACED_MATRIX        => 10);
  17420.    -- HARDWARE_CURSOR is an array of hardware cursors the device supports.
  17421.      
  17422.     procedure CLEAR_DISPLAY
  17423.        (PLANE : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last) is
  17424.      
  17425.     -- This procedure clears data from all planes.
  17426.     --
  17427.     -- PLANE - Mask specifying planes to be erased.
  17428.     --
  17429.     -- Procedure name: DSCLR
  17430.      
  17431.     begin
  17432.      
  17433.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17434.             ((BIT_16(CLEAR_DISPLAY_OP),
  17435.               BIT_16(PLANE)));
  17436.      
  17437.     end CLEAR_DISPLAY;
  17438.      
  17439.     procedure DEFINE_WRITE_CHANNELS
  17440.        (TEXT_CHANNEL  : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last;
  17441.         GRAPH_CHANNEL : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last;
  17442.         IMAGE_CHANNEL : LEXI_PLANE_VALUE := LEXI_PLANE_VALUE'last) is
  17443.      
  17444.     -- This procedure defines the display memory planes used by the
  17445.     -- text, graphics, and image functions.
  17446.     --
  17447.     -- TEXT_CHANNEL  - plane enable mask for the text channel.
  17448.     -- GRAPH_CHANNEL - plane enable mask for the graphics channel.
  17449.     -- IMAGE_CHANNEL - plane enable mask for the image channel.
  17450.     --
  17451.     -- Procedure name: DSCHAN
  17452.      
  17453.     begin
  17454.      
  17455.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17456.             ((BIT_16(DEFINE_WRITE_CHANNELS_OP),
  17457.               BIT_16(TEXT_CHANNEL),
  17458.               BIT_16(GRAPH_CHANNEL),
  17459.               BIT_16(IMAGE_CHANNEL)));
  17460.      
  17461.     end DEFINE_WRITE_CHANNELS;
  17462.      
  17463.     procedure DISPLAY_ARC
  17464.        (CENTER          : LEXI_POINT;
  17465.         RADIUS          : LEXI_RADIUS_TYPE;
  17466.         COLOUR          : LEXI_COLOUR_INDEX;
  17467.         START           : LEXI_COUNT_VALUE;
  17468.         PIXEL_COUNT     : LEXI_COUNT_VALUE) is
  17469.      
  17470.     -- This procedure displays the arc of a circle in the write mode
  17471.     -- previously specified by SET_DISPLAY_PARAMETERS.
  17472.     --
  17473.     -- CENTER    - Center point of the arc.
  17474.     -- RADIUS    - The radius of the arc.
  17475.     -- COLOUR    - Color intensity value written to display memory.
  17476.     -- START     - Starting position of arc, counted in pixels
  17477.     --             counterclockwise from 0 degrees.
  17478.     -- PIXEL_COUNT - Size of the arc in pixels, counted counterclockwise
  17479.     --               from start.
  17480.     --
  17481.     -- Procedure name: DSARC
  17482.      
  17483.     begin
  17484.      
  17485.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17486.             ((BIT_16(DISPLAY_ARC_OP),
  17487.               BIT_16(CENTER.X),
  17488.               BIT_16(CENTER.Y),
  17489.               BIT_16(RADIUS),
  17490.               BIT_16(COLOUR),
  17491.               BIT_16(START),
  17492.               BIT_16(PIXEL_COUNT)));
  17493.      
  17494.     end DISPLAY_ARC;
  17495.      
  17496.     procedure DISPLAY_CHAINED_VECTORS
  17497.        (COLOUR : LEXI_COLOUR_INDEX;
  17498.         POINTS : LEXI_POINTS) is
  17499.      
  17500.     -- This procedure displays chained vectors as defined by coordinates
  17501.     -- in array POINTS with a color intensity defined by colour index.
  17502.     --
  17503.     -- COLOUR - Color intensity value to be written to display.
  17504.     -- POINTS - Array defining endpoints of the chained vectors.
  17505.     --
  17506.     -- Procedure name: DSCVEC
  17507.      
  17508.        SEND_BLOCK : LEXIDATA_ARRAY (1 .. (2 * POINTS'LENGTH) + 3);
  17509.        -- array containing information to be sent to the device.
  17510.      
  17511.     begin
  17512.      
  17513.        SEND_BLOCK (1 .. 3) := ((BIT_16(DISPLAY_CHAINED_VECTORS_OP),
  17514.                                BIT_16(COLOUR),
  17515.                                BIT_16(POINTS'LENGTH * 2)));
  17516.        for I in 1 .. POINTS'LENGTH loop
  17517.            SEND_BLOCK(2*I + 2) := BIT_16(POINTS(I).X);
  17518.            SEND_BLOCK(2*I + 3) := BIT_16(POINTS(I).Y);
  17519.        end loop;
  17520.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER(SEND_BLOCK);
  17521.      
  17522.     end DISPLAY_CHAINED_VECTORS;
  17523.      
  17524.     procedure DISPLAY_CIRCLE
  17525.        (CENTER : LEXI_POINT;
  17526.         RADIUS : LEXI_RADIUS_TYPE;
  17527.         COLOUR : LEXI_COLOUR_INDEX) is
  17528.      
  17529.     -- This procedure draws a circle with the specified center
  17530.     -- and radius.
  17531.     --
  17532.     -- CENTER - Center point of the circle.
  17533.     -- RADIUS - The radius of the circle.
  17534.     -- COLOUR - Color intensity index written to pixels comprising
  17535.     --          the circle.
  17536.     --
  17537.     -- Procedure name: DSCIR
  17538.      
  17539.     begin
  17540.      
  17541.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17542.             ((BIT_16(DISPLAY_CIRCLE_OP),
  17543.               BIT_16(CENTER.X),
  17544.               BIT_16(CENTER.Y),
  17545.               BIT_16(RADIUS),
  17546.               BIT_16(COLOUR)));
  17547.      
  17548.     end DISPLAY_CIRCLE;
  17549.      
  17550.     procedure DISPLAY_TEXT
  17551.       (TEXT : STRING) is
  17552.      
  17553.     -- This procedure writes text characters stored in TEXT to the
  17554.     -- planes enabled by the current DEFINE_WRITE_CHANNELS TEXT_CHANNEL
  17555.     -- value.  The procedure breaks down the character string into an
  17556.     -- array of integer, because the device only excepts integer values.
  17557.     --
  17558.     -- TEXT     - The buffer containing the text to be written.
  17559.     --
  17560.     -- Procedure name: DSTXT
  17561.      
  17562.        IS_ODD     : INTEGER := TEXT'LENGTH rem 2;
  17563.        -- IS_ODD     - Used to determine if value is odd or even.
  17564.      
  17565.        HALF_SIZE  : INTEGER := TEXT'LENGTH / 2;
  17566.        -- HALF_SIZE  - Used to determine size of array of integers.
  17567.      
  17568.        SEND_BLOCK : LEXIDATA_ARRAY(1 .. HALF_SIZE + IS_ODD + 2);
  17569.        -- SEND_BLOCK - Contains the checks to send to the LEXIDATA.
  17570.      
  17571.        INDEX      : INTEGER := 2;
  17572.        -- INDEX      - Index for SEND_BLOCK.
  17573.      
  17574.     begin
  17575.      
  17576.         SEND_BLOCK(1 .. 2) := ((BIT_16(DISPLAY_TEXT_OP),
  17577.                              BIT_16(TEXT'length)));
  17578.         for I in TEXT'first .. TEXT'first + HALF_SIZE - 1 loop
  17579.             INDEX := INDEX + 1;
  17580.             SEND_BLOCK(INDEX) := BIT_16(CHARACTER'POS(TEXT(2 * I - 1)) *
  17581.                               256 + CHARACTER'POS (TEXT (2 * I)));
  17582.         end loop;
  17583.         if IS_ODD = 1 then
  17584.            SEND_BLOCK (INDEX + 1) := BIT_16(CHARACTER'POS(TEXT(TEXT'LAST))
  17585.                                   * 256);
  17586.         end if;
  17587.         LEXI3700_COMMUNICATION.WRITE_TO_BUFFER(SEND_BLOCK);
  17588.      
  17589.     end DISPLAY_TEXT;
  17590.      
  17591.     procedure FLUSH is
  17592.      
  17593.     -- This procedure clears out the buffer.
  17594.      
  17595.     begin
  17596.      
  17597.        LEXI3700_COMMUNICATION.FLUSH_BUFFER;
  17598.      
  17599.     end FLUSH;
  17600.      
  17601.     procedure OPEN (CHANNEL_IN  : INTEGER;
  17602.                     CHANNEL_OUT : INTEGER;
  17603.                     ERROR_CODE  : out INTEGER) is
  17604.      
  17605.     -- This procedure establishes the connection of the device .
  17606.     --
  17607.     -- CHANNEL_IN  - The input channel.
  17608.     -- CHANNEL_OUT - The output channel.
  17609.     -- ERROR_CODE  - The error return code from OPEN.
  17610.      
  17611.        OPEN_ERROR : INTEGER;
  17612.        -- OPEN_ERROR contains the error value returned when the device
  17613.        -- cannot be connected.
  17614.      
  17615.     begin
  17616.      
  17617.        LEXI3700_COMMUNICATION.OPEN_LEXIDATA(CHANNEL_IN, CHANNEL_OUT,
  17618.              OPEN_ERROR);
  17619.        ERROR_CODE := OPEN_ERROR;
  17620.      
  17621.     end OPEN;
  17622.      
  17623.     procedure POLYGON_EDGE_FLAG_FILL
  17624.        (FILL_VALUE      : LEXI_COLOUR_INDEX;
  17625.         LEXI_PLANE_MASK : LEXI_PLANE_VALUE :=
  17626.               LEXI3700_CONFIGURATION.LEXI_FILL_PLANE_VALUE) is
  17627.      
  17628.     -- This procedure fills polygons according to the edge flag method
  17629.     -- of polygon filling.
  17630.     --
  17631.     -- FILL_VALUE - Pixel (color intensity) value used to fill polygon.
  17632.     -- LEXI_PLANE_MASK - Mask indicating planes containing edge flags.
  17633.     --
  17634.     -- Procedure name: DSEFIL
  17635.      
  17636.     begin
  17637.      
  17638.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17639.             ((BIT_16(POLYGON_EDGE_FLAG_FILL_OP),
  17640.               BIT_16(LEXI_PLANE_MASK),
  17641.               BIT_16(FILL_VALUE)));
  17642.      
  17643.     end POLYGON_EDGE_FLAG_FILL;
  17644.      
  17645.     procedure RANDOM_PIXEL_READ
  17646.        (POINTS       : LEXI_POINTS;
  17647.         PIXEL_ARRAY  : out LEXI_PIXEL_ARRAY_INDEX) is
  17648.      
  17649.     -- This procedure causes the display processor to send back a number
  17650.     -- of pixel values from locations specified by POINTS, on planes
  17651.     -- enable by the current DEFINE_WRITE_CHANNELS IMAGE_CHANNEL value.
  17652.     --
  17653.     -- POINTS      - Number of pixels to be read.
  17654.     -- PIXEL_ARRAY - Buffer containing pixels to be read.
  17655.     --
  17656.     -- Procedure name: DSRNR
  17657.      
  17658.        PIXEL_POINTER   : LEXIDATA_ARRAY(1 .. 2 * POINTS'length + 2);
  17659.        -- PIXEL_POINTER - Array pointer for pixels.
  17660.      
  17661.        PIXEL_ARRAY_GET : LEXIDATA_ARRAY(1 .. PIXEL_ARRAY'length);
  17662.        -- PIXEL_ARRAY_GET - Array of pixels.
  17663.      
  17664.     begin
  17665.      
  17666.        PIXEL_POINTER(1) := BIT_16(RANDOM_PIXEL_READ_OP);
  17667.        PIXEL_POINTER(2) := BIT_16(POINTS'LENGTH);
  17668.        for I in POINTS'first .. POINTS'last loop
  17669.            PIXEL_POINTER(POSITIVE(I * 2 + 1)) :=
  17670.                 BIT_16(POINTS(I).X);
  17671.            PIXEL_POINTER(POSITIVE(I * 2 + 2)) :=
  17672.                 BIT_16(POINTS(I).Y);
  17673.        end loop;
  17674.      
  17675.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER(PIXEL_POINTER);
  17676.      
  17677.        LEXI3700_COMMUNICATION.FLUSH_BUFFER(FALSE);
  17678.      
  17679.        LEXI3700_COMMUNICATION.READ_FROM_BUFFER
  17680.             (PIXEL_ARRAY_GET);
  17681.      
  17682.        for I in PIXEL_ARRAY_GET'range loop
  17683.            PIXEL_ARRAY(I) := LEXI_COLOUR_INDEX(PIXEL_ARRAY_GET(I));
  17684.        end loop;
  17685.      
  17686.     end RANDOM_PIXEL_READ;
  17687.      
  17688.     procedure RANDOM_PIXEL_WRITE
  17689.        (POINTS  : LEXI_POINTS;
  17690.         COLOURS : LEXI_PIXEL_ARRAY_INDEX) is
  17691.      
  17692.     -- This procedure writes a value into a group for randomly addressed
  17693.     -- pixels to display memory planes enabled by the current DEFINE_
  17694.     -- WRITE_CHANNELS.
  17695.     --
  17696.     -- POINTS  - Number of pixels to be written.
  17697.     -- COLOURS - Buffer containing pixel coordinates and data.
  17698.     --
  17699.     -- Procedure name: DSRNW
  17700.      
  17701.        SEND_BLOCK  : LEXIDATA_ARRAY (1 .. ((3 * COLOURS'LENGTH + 2)));
  17702.        -- array containing information to send to device.
  17703.      
  17704.     begin
  17705.      
  17706.        SEND_BLOCK (1..2) := (RANDOM_PIXEL_WRITE_OP, COLOURS'LENGTH);
  17707.        for I in COLOURS'RANGE loop
  17708.            SEND_BLOCK (((I-1) * 3) + 3) := BIT_16(POINTS(I).X);
  17709.            SEND_BLOCK (((I-1) * 3) + 4) := BIT_16(POINTS(I).Y);
  17710.            SEND_BLOCK (((I-1) * 3) + 5) := BIT_16(COLOURS(I));
  17711.        end loop;
  17712.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER(SEND_BLOCK);
  17713.      
  17714.     end RANDOM_PIXEL_WRITE;
  17715.      
  17716.     procedure READ_FROM_LUT
  17717.        (COLOUR_INDEX : LEXI_COLOUR_INDEX;
  17718.         COLOUR_VALUE : out LEXI_PIXEL_COLOUR) is
  17719.      
  17720.     -- This procedure reads a value from the lookup table
  17721.     -- and returns the corresponding value to the host.
  17722.     --
  17723.     -- COLOUR_INDEX - The index to be read.
  17724.     -- COLOUR_VALUE - A record containing the index colour.
  17725.     --
  17726.     -- Procedure name: DSLRD
  17727.      
  17728.        CURRENT_OFFSET       : LEXIDATA_ARRAY (1..3);
  17729.        --  CURRENT_OFFSET - Contains the physical locations of the red,
  17730.        --                   green, and blue planes.
  17731.      
  17732.        PIXEL             : LEXIDATA_ARRAY (1 .. 1);
  17733.        --  PIXEL       - Contains information about the pixel.
  17734.      
  17735.        PIXEL_VALUE       : LEXIDATA_ARRAY (1..3);
  17736.        --  PIXEL_VALUE - Array that contains the intensity values
  17737.        --                returned from the LEXIDATA.
  17738.      
  17739.     begin
  17740.      
  17741.        CURRENT_OFFSET := (BIT_16(RED_PLANE_ADDRESS),
  17742.                        BIT_16(GREEN_PLANE_ADDRESS),
  17743.                        BIT_16(BLUE_PLANE_ADDRESS));
  17744.        for I in 1..3 loop
  17745.            LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17746.                 ((BIT_16(READ_FROM_LUT_OP),
  17747.                   BIT_16(COLOUR_INDEX) + CURRENT_OFFSET(I),
  17748.                   1));
  17749.             FLUSH;
  17750.             LEXI3700_COMMUNICATION.READ_FROM_BUFFER(PIXEL);
  17751.             PIXEL_VALUE(I) := PIXEL(1);
  17752.        end loop;
  17753.        COLOUR_VALUE.RED   := LEXI_COLOUR_INTENSITY(PIXEL_VALUE(1));
  17754.        COLOUR_VALUE.GREEN := LEXI_COLOUR_INTENSITY(PIXEL_VALUE(2));
  17755.        COLOUR_VALUE.BLUE  := LEXI_COLOUR_INTENSITY(PIXEL_VALUE(3));
  17756.      
  17757.     end READ_FROM_LUT;
  17758.      
  17759.     procedure SET_DISPLAY_PARAMETERS
  17760.        (WIDTH     : LEXI_LINE_WIDTH_TYPE;
  17761.         LINE      : LEXI_LINE_TYPE;
  17762.         FILL      : LEXI_INTERIOR_STYLE;
  17763.         SIZE      : LEXI_PATTERN_SIZE := 2) is
  17764.      
  17765.     -- This procedure specifies the way vectors, circles, arcs, and
  17766.     -- rectangles are drawn.
  17767.     --
  17768.     -- WIDTH - Write mode and line weight.
  17769.     --    BITS  0 - 11 = Line weight (0 or 1 yields a one-pixel width
  17770.     --                      line).
  17771.     --    BITS 12 - 14 = Write mode:
  17772.     --                   000 = Replace Mode.  Replaces any previous
  17773.     --                         value in the selected planes with the
  17774.     --                         specified value.
  17775.     --
  17776.     --                   001 = OR or Set Mode.  ORs the value in the
  17777.     --                         selected planes with the specified value;
  17778.     --                         does not clear any bit.
  17779.     --
  17780.     --                   010 = Clear Mode. ANDs the value in the select-
  17781.     --                         ed planes with the complement of the
  17782.     --                         specified value; does not set any bit.
  17783.     --
  17784.     --                   011 = XOR or Complement Mode.  XORs the value
  17785.     --                         in the selected planes with the specified
  17786.     --                         value; complements the selected bits.
  17787.     --                         This mode is used to draw polygons that
  17788.     --                         are filled with DSEFIL.
  17789.     --
  17790.     --    BIT  15      = Edge flag enable bit
  17791.     --                   0 = Disabled.
  17792.     --                   1 = Enabled.
  17793.     --
  17794.     -- LINE  - Line pattern for vectors and arcs.
  17795.     --    BITS  0 - 11 = Pattern description specifying the on/off
  17796.     --                   pattern applied to all subsequent lines
  17797.     --                   after the call (most significant to least
  17798.     --                   significant).
  17799.     --
  17800.     --    BITS 12 - 15 = Pattern length (number of pattern bits to
  17801.     --                   be used).
  17802.     --                   0 = Solid line.
  17803.     --
  17804.     -- FILL  - The interior style.
  17805.     --
  17806.     -- SIZE  - Pattern size for vectors and arcs, and fill for circles
  17807.     --         and rectangles.
  17808.     --    BITS  0 - 11 = Number of replications of each bit in pattern.
  17809.     --                   (A 0 or 1 in this location specifies a single
  17810.     --                   pixel length.)
  17811.     --
  17812.     --    BIT  12      = Fill enable bit:
  17813.     --                   0 = Fill disabled.
  17814.     --                   1 = Fill enabled.
  17815.     --
  17816.     --    BITS 13 - 15 = Reserved; must be zero.
  17817.     --
  17818.     -- Procedure name: DSDISP
  17819.      
  17820.     begin
  17821.      
  17822.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17823.             ((BIT_16(SET_DISPLAY_PARAMETERS_OP),
  17824.               BIT_16(WIDTH) + BIT_16(LEXI_FILL_VALUE(FILL)),
  17825.               BIT_16(LEXI_LINE(LINE)),
  17826.               BIT_16(SIZE)));
  17827.      
  17828.     end SET_DISPLAY_PARAMETERS;
  17829.      
  17830.     procedure SET_HARDWARE_CURSOR
  17831.        (CURSOR : LEXI_CURSOR_TYPE := NON_INTERLACED_MATRIX;
  17832.         XOFF   : LEXI_COORDINATE := 0;
  17833.         YOFF   : LEXI_COORDINATE := 0) is
  17834.      
  17835.     -- This procedure selects the hardware crosshair cursor or the user-
  17836.     -- defined matrix cursor and provides a variable offset to fine-tune
  17837.     -- the position of the cursor.
  17838.     --
  17839.     -- CURSOR - Cursor type
  17840.     --    0  = Non-interlaced crosshair.
  17841.     --    2  = Non-interlaced matrix.
  17842.     --    8  = Interlaced crosshair.
  17843.     --    10 = Interlaced matrix.
  17844.     --
  17845.     -- XOFF - X displacement from true location.
  17846.     -- YOFF - Y displacement from true location.
  17847.     --
  17848.     -- Procedure name: DSCSL
  17849.      
  17850.     begin
  17851.      
  17852.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17853.             ((BIT_16(SET_HARDWARE_CURSOR_OP),
  17854.               BIT_16(HARDWARE_CURSOR(CURSOR)),
  17855.               BIT_16(XOFF),
  17856.               BIT_16(YOFF)));
  17857.      
  17858.     end SET_HARDWARE_CURSOR;
  17859.      
  17860.     procedure SET_RECTANGULAR_LIMIT
  17861.        (UPPER_LEFT  : LEXI_POINT;
  17862.         LOWER_RIGHT : LEXI_POINT) is
  17863.      
  17864.     -- This procedure defines a rectangular section of memory that
  17865.     -- is used to do edge fill.
  17866.     --
  17867.     -- UPPER_LEFT  - Coordinates of upper left corner.
  17868.     -- LOWER_RIGHT - Coordinates of lower right corner.
  17869.     --
  17870.     -- Procedure name: DSLIM
  17871.      
  17872.     begin
  17873.      
  17874.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17875.             ((BIT_16(SET_RECTANGULAR_LIMIT_OP),
  17876.               BIT_16(UPPER_LEFT.X),
  17877.               BIT_16(UPPER_LEFT.Y),
  17878.               BIT_16(LOWER_RIGHT.X),
  17879.               BIT_16(LOWER_RIGHT.Y)));
  17880.      
  17881.     end SET_RECTANGULAR_LIMIT;
  17882.      
  17883.     procedure SET_TEXT_CHARACTER_ROTATION
  17884.        (ROTATION : LEXI_ROTATE_CODE) is
  17885.      
  17886.     -- This procedure determines the rotation of characters with respect
  17887.     -- to the character path.
  17888.     --
  17889.     -- ROTATION - Rotation of the characters with respect to the
  17890.     --            character path:
  17891.     --                  0 - No rotation (default).
  17892.     --                  1 - 90 degree rotation clockwise.
  17893.     --                  2 - 180 degree rotation clockwise (upside down
  17894.     --                      and backwards).
  17895.     --                  3 - 270 degree rotation clockwise.
  17896.     --
  17897.     -- Procedure name: DSSTR
  17898.      
  17899.     begin
  17900.      
  17901.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17902.             ((BIT_16(SET_TEXT_CHARACTER_ROTATION_OP),
  17903.               BIT_16(LEXI_CHARACTER_ROTATION(ROTATION))));
  17904.      
  17905.     end SET_TEXT_CHARACTER_ROTATION;
  17906.      
  17907.     procedure SET_TEXT_PARAMETERS
  17908.        (POSITION : LEXI_POINT;
  17909.         COLOUR   : LEXI_COLOUR_INDEX;
  17910.         PATH     : LEXI_CHARACTER_PATH;
  17911.         SIZE     : LEXI_TEXT_SIZE) is
  17912.      
  17913.     -- This procedure sets the display parameters for text written with
  17914.     -- DSTXT.
  17915.     --
  17916.     -- POSITION - The X and Y coordinates of text starting position.
  17917.     -- COLOUR   - Value (color intensity index) written to text
  17918.     --            pixels.
  17919.     --
  17920.     -- PATH     - Flag word specifying several parameters.
  17921.     --
  17922.     --    FONT
  17923.     --         bit        description
  17924.     --          0 (LSB)   0 = character font 0
  17925.     --                    1 = font 1
  17926.     --    ADDITIVE
  17927.     --          1         0 = erasive
  17928.     --                    1 = additive write
  17929.     --    REVERSE
  17930.     --          2         0 = normal
  17931.     --                    1 = reverse video
  17932.     --    INCREMENT
  17933.     --         3          0 = enable
  17934.     --                    1 = disable incrementing to next character
  17935.     --    TEXT CURSOR
  17936.     --         4          0 = enable
  17937.     --                    1 = disable test cursor
  17938.     --    CONTROL DISABLE
  17939.     --          5         0 = enable  processing of control characters.
  17940.     --                    1 = disable processing of control characters.
  17941.     --    TEXT PATH
  17942.     --          6 - 7     00 = left to right
  17943.     --                    01 = bottom to top
  17944.     --                    10 = right to left
  17945.     --                    11 = top to bottom
  17946.     --    NOT USED
  17947.     --          8 - 15 (MSB)
  17948.     --
  17949.     -- SIZE - Multiplication factor for the 5 by 7 character font.
  17950.     --        The resulting character is (5 * size) by (7 * size).
  17951.     --
  17952.     -- Procedure name: DSSAO
  17953.      
  17954.     begin
  17955.      
  17956.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17957.             ((BIT_16(SET_TEXT_PARAMETERS_OP),
  17958.               BIT_16(POSITION.X),
  17959.               BIT_16(POSITION.Y),
  17960.               BIT_16(COLOUR),
  17961.               BIT_16(LEXI_PATH(PATH)),
  17962.               BIT_16(SIZE)));
  17963.      
  17964.     end SET_TEXT_PARAMETERS;
  17965.      
  17966.     procedure SET_TEXT_WINDOW
  17967.        (UPPER_LEFT  : LEXI_POINT;
  17968.         LOWER_RIGHT : LEXI_POINT) is
  17969.      
  17970.     -- This procedure defines a text window beyond which no text is
  17971.     -- written.
  17972.     --
  17973.     -- UPPER_LEFT  - Coordinate of upper left portion of the
  17974.     --               text window.
  17975.     -- LOWER_RIGHT - Coordinate of lower right portion of the
  17976.     --               text window.
  17977.     --
  17978.     -- Procedure name: DSSTW
  17979.      
  17980.     begin
  17981.      
  17982.        LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  17983.              ((BIT_16(SET_TEXT_WINDOW_OP),
  17984.                BIT_16(UPPER_LEFT.X),
  17985.                BIT_16(UPPER_LEFT.Y),
  17986.                BIT_16(LOWER_RIGHT.X),
  17987.                BIT_16(LOWER_RIGHT.Y)));
  17988.      
  17989.     end SET_TEXT_WINDOW;
  17990.      
  17991. procedure SEQUENTIAL_PIXEL_WRITE
  17992.    (PIXEL_ARRAY : LEXI_PIXEL_ARRAY_INDEX) is
  17993.      
  17994. -- This procedure writes a number of colour indexs to the display
  17995. -- surface outlined by DSLIM which defines a rectangular limit.
  17996. -- The starting position is the upper left.
  17997.      
  17998. -- procedure DSPUT
  17999.      
  18000. SEND_BLOCK : LEXIDATA_ARRAY (1 .. PIXEL_ARRAY'LENGTH + 2);
  18001.     -- Contains information going to the device.
  18002.      
  18003.  begin
  18004.     SEND_BLOCK(1) := BIT_16(SEQUENTIAL_PIXEL_WRITE_OP);
  18005.     SEND_BLOCK(2) := BIT_16(PIXEL_ARRAY'LENGTH);
  18006.      
  18007.     for I in PIXEL_ARRAY'RANGE loop
  18008.         SEND_BLOCK(I - PIXEL_ARRAY'FIRST + 3) := BIT_16(PIXEL_ARRAY(I));
  18009.     end loop;
  18010.      
  18011.     LEXI3700_COMMUNICATION.WRITE_TO_BUFFER(SEND_BLOCK);
  18012.      
  18013. end SEQUENTIAL_PIXEL_WRITE;
  18014.      
  18015. procedure WRITE_TO_LUT
  18016.        (COLOUR_INDEX : LEXI_COLOUR_INDEX;
  18017.         COLOUR_VALUE : LEXI_PIXEL_COLOUR) is
  18018.      
  18019.     -- This procedure writes a record of colour intensity to the
  18020.     -- table(CLUT).
  18021.     --
  18022.     -- COLOUR_INDEX - The colour index to set the intensity values.
  18023.     -- COLOUR_VALUE - The intensity values to be written.
  18024.     --
  18025.     -- Procedure name: DSLWT
  18026.      
  18027.         CURRENT_OFFSET      : LEXIDATA_ARRAY (1..3);
  18028.         --  CUR_OFFSET  - Contains the physical locations of the red,
  18029.         --                green, and blue planes.
  18030.      
  18031.         PIXEL_VALUE      : LEXIDATA_ARRAY (1..3);
  18032.         --  PIXEL_VALUE - Array containing the intensity values returned
  18033.         --                by the LEXIDATA.
  18034.      
  18035.     begin
  18036.      
  18037.        CURRENT_OFFSET := (BIT_16(RED_PLANE_ADDRESS),
  18038.                        BIT_16(GREEN_PLANE_ADDRESS),
  18039.                        BIT_16(BLUE_PLANE_ADDRESS));
  18040.        PIXEL_VALUE := (BIT_16(COLOUR_VALUE.RED),
  18041.                        BIT_16(COLOUR_VALUE.GREEN),
  18042.                        BIT_16(COLOUR_VALUE.BLUE));
  18043.        for I in 1..3 loop
  18044.            LEXI3700_COMMUNICATION.WRITE_TO_BUFFER
  18045.                 ((BIT_16(WRITE_TO_LUT_OP),
  18046.                   BIT_16(COLOUR_INDEX) + CURRENT_OFFSET(I),
  18047.                   1));
  18048.            LEXI3700_COMMUNICATION.WRITE_TO_BUFFER((PIXEL_VALUE(I .. I)));
  18049.        end loop;
  18050.      
  18051.     end WRITE_TO_LUT;
  18052.      
  18053. end LEXI3700_OUTPUT_DRIVER;
  18054. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18055. --:UDD:GKSADACM:CODE:0A:LEXI3700_TBLS_0A.ADA
  18056. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18057. ------------------------------------------------------------------
  18058. --
  18059. --  NAME: LEXI3700_WS_TABLES
  18060. --  IDENTIFIER: GDMXXX.1(1)
  18061. --  DISCREPANCY REPORTS:
  18062. --
  18063. ------------------------------------------------------------------
  18064. -- file : LEXI3700_TBLS_0A.ADA
  18065. -- level: 0a
  18066.      
  18067. with OUTPUT_ATTRIBUTES_TYPE;
  18068. with WS_STATE_LIST_TYPES;
  18069. with WS_DESCRIPTION_TABLE_TYPES;
  18070. with GKS_TYPES;
  18071.      
  18072. use  GKS_TYPES;
  18073.      
  18074. package LEXI3700_WS_TABLES is
  18075.      
  18076. -- This package contains the specific WS_DESCRIPTION_TABLE for the
  18077. -- LEXIDATA 3700 graphic device, and the list of WS state lists that
  18078. -- could be initialized from this WS description table.  Also a
  18079. -- function for retrieving a pointer to a WS_STATE_LIST from the list
  18080. -- is declared with two procedures, one that initialises a WS state list
  18081. -- and adds it to the list, and a procedure that will take a WS state
  18082. -- list off the the list.
  18083.      
  18084.    LEXI3700_WS_DT : WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL
  18085.       (NUM_PREDEFINED_PLIN_BUNDLE       => 5,
  18086.        NUM_PREDEFINED_PMRK_BUNDLE       => 5,
  18087.        NUM_PREDEFINED_TEXT_BUNDLE       => 5,
  18088.        NUM_PREDEFINED_FA_BUNDLE         => 5,
  18089.        NUM_PREDEFINED_PATTERN_TABLE     => 0,
  18090.        LAST_PREDEFINED_COLOUR_REP       => 7,
  18091.        NUM_OF_GDP_ID                    => 1);
  18092.      
  18093.    function GET_STATE_LIST_PTR
  18094.       (WS_ID : in GKS_TYPES.WS_ID ) return
  18095.        WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  18096.      
  18097.    procedure ADD_STATE_LIST_TO_LIST
  18098.       (WS_ID          : in GKS_TYPES.WS_ID;
  18099.        CONNECT_ID     : in VARIABLE_CONNECTION_ID;
  18100.        WS_TYPE        : in GKS_TYPES.WS_TYPE;
  18101.        ATTRIBUTES     : in OUTPUT_ATTRIBUTES_TYPE
  18102.                            .OUTPUT_ATTRIBUTES;
  18103.        EI             : out ERROR_INDICATOR);
  18104.      
  18105.    procedure DELETE_STATE_LIST_FROM_LIST
  18106.       (WS_ID : in GKS_TYPES.WS_ID);
  18107.      
  18108. end LEXI3700_WS_TABLES;
  18109. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18110. --:UDD:GKSADACM:CODE:0A:LEXI3700_TBLS_0A_B.ADA
  18111. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18112. ------------------------------------------------------------------
  18113. --
  18114. --  NAME: LEXI3700_WS_TABLES - BODY
  18115. --  IDENTIFIER: GDMXXX.1(1)
  18116. --  DISCREPANCY REPORTS:
  18117. --
  18118. ------------------------------------------------------------------
  18119. -- file : lexi3700_tbls_0a_b.ada
  18120. -- level: 0a
  18121.      
  18122. with WS_TABLE_TYPES;
  18123. with LEXI3700_CONFIGURATION;
  18124. with GKS_CONFIGURATION;
  18125.      
  18126. package body LEXI3700_WS_TABLES is
  18127.      
  18128.    subtype PRE_PLINE_BUNDLES is WS_TABLE_TYPES.POLYLINE_BUNDLE;
  18129.    subtype PRE_PMARK_BUNDLES is WS_TABLE_TYPES.POLYMARKER_BUNDLE;
  18130.    subtype PRE_TEXT_BUNDLES is WS_TABLE_TYPES.TEXT_BUNDLE;
  18131.    subtype PRE_FILL_AREA_BUNDLES is WS_TABLE_TYPES.FILL_AREA_BUNDLE;
  18132.    subtype PRE_COLOUR_REP is GKS_TYPES.COLOUR_REPRESENTATION;
  18133.      
  18134.    -- Creates an array of the available line types that are supported.
  18135.    LINE_TYPE_LIST : constant LINETYPES.LIST_VALUES := (1,2,3,4);
  18136.      
  18137.    -- Creates an array of the available marker types that are supported.
  18138.    MARKER_TYPE_LIST : constant MARKER_TYPES.LIST_VALUES := (1,2,3,4,5);
  18139.      
  18140.    -- Creates an array of the available interior styles that the
  18141.    -- Lexidata supports.
  18142.    INTERIOR_STYLE_LIST : constant INTERIOR_STYLES.LIST_VALUES :=
  18143.          (SOLID,HOLLOW);
  18144.      
  18145.    -- Creates an array of text fonts and precisions that is supported.
  18146.    TEXT_FONT_AND_PRECISION_LIST : constant TEXT_FONT_PRECISIONS
  18147.          .LIST_VALUES :=
  18148.          (1 => TEXT_FONT_PRECISION'
  18149.                          (FONT => 1, PRECISION => STRING_PRECISION),
  18150.           2 => TEXT_FONT_PRECISION'
  18151.                           (FONT => 1, PRECISION => CHAR_PRECISION));
  18152.      
  18153.    -- Creates an array of the one GDP that is supported at this time.
  18154.    GDP_ID_LIST : constant GDP_IDS.LIST_VALUES := (1 => 1);
  18155.      
  18156.    -- A list of attributes used to display the GDP.
  18157.    GDP_ATTR_USED_LIST : constant ATTRIBUTES_USED.LIST_VALUES :=
  18158.          (1 => POLYLINE_ATTRIBUTES );
  18159.      
  18160.    -- The list of workstation state lists that could be initialized
  18161.    -- from the LEXI_WS_DT.  Presently the implimentation supports one
  18162.    -- workstation of that type.
  18163.    type LIST_OF_ST_LST;
  18164.      
  18165.    type PTR_TO_LST_OF_WS_ST_LST is access LIST_OF_ST_LST;
  18166.      
  18167.    type LIST_OF_ST_LST is record
  18168.       NEXT_SL     : PTR_TO_LST_OF_WS_ST_LST;
  18169.       WS_ST_LST   : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  18170.    end record;
  18171.      
  18172.    LEXI_ST_LSTS : PTR_TO_LST_OF_WS_ST_LST;
  18173.    -- Contains the last state list that was added to the list.
  18174.      
  18175.    function GET_STATE_LIST_PTR
  18176.       (WS_ID : in GKS_TYPES.WS_ID) return
  18177.        WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR
  18178.    is separate;
  18179.      
  18180.    procedure ADD_STATE_LIST_TO_LIST
  18181.         (WS_ID       : in GKS_TYPES.WS_ID;
  18182.          CONNECT_ID  : in VARIABLE_CONNECTION_ID;
  18183.          WS_TYPE     : in GKS_TYPES.WS_TYPE;
  18184.          ATTRIBUTES  : in OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  18185.          EI          : out ERROR_INDICATOR)
  18186.    is separate;
  18187.      
  18188.    procedure DELETE_STATE_LIST_FROM_LIST
  18189.         (WS_ID : in GKS_TYPES.WS_ID)
  18190.    is separate;
  18191.      
  18192. begin
  18193.      
  18194.    LEXI3700_WS_DT.WORKSTATION_TYPE := GKS_CONFIGURATION
  18195.          .LEXIDATA_3700_OUTPUT_TYPE;
  18196.      
  18197.    -- The workstation category (output, outin, input etc);
  18198.    LEXI3700_WS_DT.WORKSTATION_CATEGORY := OUTPUT;
  18199.      
  18200.    -- The coordinate units are not in meters they are in raster units.
  18201.    LEXI3700_WS_DT.DEVICE_COOR_UNITS := OTHER;
  18202.      
  18203.    -- The size of the display in DC units.
  18204.    LEXI3700_WS_DT.MAX_DISPLAY_SURFACE_DC_UNITS  :=
  18205.          (DC.MAGNITUDE (LEXI3700_CONFIGURATION.LEXI_X_MAXIMUM),
  18206.           DC.MAGNITUDE (LEXI3700_CONFIGURATION.LEXI_Y_MAXIMUM));
  18207.      
  18208.    -- The size of the display surface in raster units.
  18209.    LEXI3700_WS_DT.MAX_DISPLAY_SURFACE_RASTER_UNITS :=
  18210.          (LEXI3700_CONFIGURATION.LEXI_X_MAXIMUM + 1,
  18211.           LEXI3700_CONFIGURATION.LEXI_Y_MAXIMUM + 1);
  18212.      
  18213.    -- The display type (raster, vector etc)
  18214.    LEXI3700_WS_DT.DISPLAY_TYPE := RASTER_DISPLAY;
  18215.      
  18216.    -- The dynamic capabilities of the workstation.
  18217.    LEXI3700_WS_DT.WS_DYNAMICS := WS_DESCRIPTION_TABLE_TYPES
  18218.          .DYN_MOD_ACCEPTED_FOR_WS_ATTRIBUTES'
  18219.            (POLYLINE_BUNDLE_REP   => IRG,
  18220.             POLYMARKER_BUNDLE_REP => IRG,
  18221.             TEXT_BUNDLE_REP       => IRG,
  18222.             FILL_AREA_BUNDLE_REP  => IRG,
  18223.             PATTERN_REP           => IRG,
  18224.             COLOUR_REP            => IMM,
  18225.             WS_TRANSFORMATION     => IRG);
  18226.      
  18227.    -- The workstation deferral mode.  Set to AS SOON AS POSSIBLE.
  18228.    LEXI3700_WS_DT.DEFER_MODE    := ASAP;
  18229.      
  18230.    -- The implicit regeneration mode.  Set to SUPPRESS regeneration.
  18231.    LEXI3700_WS_DT.IMPLICIT_REGEN_MODE := SUPPRESSED;
  18232.      
  18233.    -- Initializes the LIST_OF_AVAILABLE_LTYPE entry.
  18234.    LEXI3700_WS_DT.LIST_AVAILABLE_LTYPE := LINETYPES.LIST
  18235.          ( LINE_TYPE_LIST );
  18236.      
  18237.    -- The maximum number of line widths that the device supports will
  18238.    -- be used at this level 0a.
  18239.    LEXI3700_WS_DT.NUM_AVAILABLE_LWIDTH := LEXI3700_CONFIGURATION
  18240.                                            .LEXI_MAXIMUM_LINE_WIDTH;
  18241.      
  18242.    LEXI3700_WS_DT.NOMINAL_LWIDTH := DC.MAGNITUDE(LEXI3700_CONFIGURATION
  18243.                                     .LEXI_NOMINAL_LINE_WIDTH);
  18244.      
  18245.    -- The maximum range of line widths that the device supports is used.
  18246.    LEXI3700_WS_DT.RANGE_OF_LWIDTH :=
  18247.          (DC.MAGNITUDE(LEXI3700_CONFIGURATION.LEXI_MINIMUM_LINE_WIDTH),
  18248.           DC.MAGNITUDE(LEXI3700_CONFIGURATION.LEXI_MAXIMUM_LINE_WIDTH));
  18249.      
  18250.    -- One predefined bundle.
  18251.    LEXI3700_WS_DT.PREDEFINED_PLIN_BUNDLES := WS_TABLE_TYPES
  18252.          .POLYLINE_BUNDLE_LIST'
  18253.        (1=> PRE_PLINE_BUNDLES'(L_TYPE => 1, L_WIDTH => 1.0, COLOUR=> 1),
  18254.         2=> PRE_PLINE_BUNDLES'(L_TYPE => 2, L_WIDTH => 2.0, COLOUR=> 2),
  18255.         3=> PRE_PLINE_BUNDLES'(L_TYPE => 3, L_WIDTH => 3.0, COLOUR=> 3),
  18256.         4=> PRE_PLINE_BUNDLES'(L_TYPE => 4, L_WIDTH => 4.0, COLOUR=> 4),
  18257.         5=> PRE_PLINE_BUNDLES'(L_TYPE => 1, L_WIDTH =>10.0, COLOUR=> 7));
  18258.      
  18259.    -- Initializes the LIST_OF_AVAILABLE_MARKER_TYPES.
  18260.    LEXI3700_WS_DT.LIST_AVAILABLE_MARKER_TYPES := MARKER_TYPES.LIST
  18261.          ( MARKER_TYPE_LIST );
  18262.      
  18263.    -- The number of available marker sizes.
  18264.    -- On the Lexidata device the polymarkers use text attributes,
  18265.    -- therefore they have the same limitations as text.
  18266.    LEXI3700_WS_DT.NUM_AVAILABLE_MARKER_SIZES :=
  18267.          LEXI3700_CONFIGURATION.LEXI_MAXIMUM_TEXT_SIZE;
  18268.      
  18269.    -- The normal marker size drawn.
  18270.    LEXI3700_WS_DT.NOMINAL_MARKER_SIZE := DC.MAGNITUDE
  18271.          (LEXI3700_CONFIGURATION.LEXI_NOMINAL_TEXT_SIZE);
  18272.      
  18273.    -- The range of available marker sizes.
  18274.    LEXI3700_WS_DT.RANGE_OF_MARKER_SIZES :=
  18275.         (DC.MAGNITUDE (LEXI3700_CONFIGURATION.LEXI_MINIMUM_TEXT_SIZE),
  18276.          DC.MAGNITUDE (LEXI3700_CONFIGURATION.LEXI_MAXIMUM_TEXT_SIZE));
  18277.      
  18278.    -- Five predefined bundles.
  18279.    LEXI3700_WS_DT.PREDEFINED_PMRK_BUNDLES := WS_TABLE_TYPES
  18280.          .POLYMARKER_BUNDLE_LIST'
  18281.         (1=> PRE_PMARK_BUNDLES'(M_TYPE=>1, M_SIZE=>1.0, COLOUR=>1),
  18282.          2=> PRE_PMARK_BUNDLES'(M_TYPE=>2, M_SIZE=>2.0, COLOUR=>2),
  18283.          3=> PRE_PMARK_BUNDLES'(M_TYPE=>3, M_SIZE=>5.0, COLOUR=>3),
  18284.          4=> PRE_PMARK_BUNDLES'(M_TYPE=>4, M_SIZE=>7.0, COLOUR=>5),
  18285.          5=> PRE_PMARK_BUNDLES'(M_TYPE=>5, M_SIZE=>9.0, COLOUR=>7));
  18286.      
  18287.    -- The list of text font and precisions.
  18288.    LEXI3700_WS_DT.LIST_TEXT_FONT_AND_PRECISION :=
  18289.          TEXT_FONT_PRECISIONS.LIST( TEXT_FONT_AND_PRECISION_LIST );
  18290.      
  18291.    -- The number of available character expansions.  However our
  18292.    -- device doesn't support character expansions.
  18293.    LEXI3700_WS_DT.NUM_AVAILABLE_CHAR_EXPANSIONS := 1;
  18294.      
  18295.    -- Only one CHAR_EXPANSIONS supported.
  18296.    LEXI3700_WS_DT.RANGE_OF_CHAR_EXPANSIONS := (1.0,1.0);
  18297.      
  18298.    -- The number of available character heights.
  18299.    LEXI3700_WS_DT.NUM_AVAILABLE_CHAR_HEIGHTS :=
  18300.          (LEXI3700_CONFIGURATION.LEXI_MAXIMUM_TEXT_SIZE);
  18301.      
  18302.    -- The range of character heights available.
  18303.    -- The minimum character height to the maximum character height.
  18304.    LEXI3700_WS_DT.RANGE_OF_CHAR_HEIGHTS :=
  18305.          (DC.MAGNITUDE (LEXI3700_CONFIGURATION.LEXI_MINIMUM_TEXT_SIZE),
  18306.           DC.MAGNITUDE (LEXI3700_CONFIGURATION.LEXI_MAXIMUM_TEXT_SIZE));
  18307.      
  18308.    -- Five predefined text bundle.
  18309.    LEXI3700_WS_DT.PREDEFINED_TEXT_BUNDLES := WS_TABLE_TYPES
  18310.          .TEXT_BUNDLE_LIST'
  18311.         (1=>PRE_TEXT_BUNDLES' (TEXT_FONT=> TEXT_FONT_PRECISION'
  18312.                       (FONT=>1,PRECISION=>STRING_PRECISION),
  18313.                       CH_EXPANSION => 1.0, CH_SPACE => 1.0, COLOUR =>1),
  18314.          2=>PRE_TEXT_BUNDLES' (TEXT_FONT=> TEXT_FONT_PRECISION'
  18315.                       (FONT=>1,PRECISION=>CHAR_PRECISION),
  18316.                       CH_EXPANSION => 1.0, CH_SPACE =>1.0, COLOUR => 2),
  18317.          3=>PRE_TEXT_BUNDLES' (TEXT_FONT=> TEXT_FONT_PRECISION'
  18318.                       (FONT=>1,PRECISION=>STRING_PRECISION),
  18319.                       CH_EXPANSION => 1.0, CH_SPACE => 1.0, COLOUR =>3),
  18320.          4=>PRE_TEXT_BUNDLES' (TEXT_FONT=> TEXT_FONT_PRECISION'
  18321.                       (FONT=>1,PRECISION=>CHAR_PRECISION),
  18322.                       CH_EXPANSION => 1.0, CH_SPACE => 1.0, COLOUR =>4),
  18323.          5=>PRE_TEXT_BUNDLES' (TEXT_FONT=> TEXT_FONT_PRECISION'
  18324.                       (FONT=>1,PRECISION=>STRING_PRECISION),
  18325.                      CH_EXPANSION => 1.0, CH_SPACE => 1.0, COLOUR =>5));
  18326.      
  18327.    -- Initializes the LIST_OF_AVAL_INTERIOR_STYLE entry.
  18328.    LEXI3700_WS_DT.LIST_OF_AVAL_INTERIOR_STYLE :=
  18329.          INTERIOR_STYLES.LIST( INTERIOR_STYLE_LIST );
  18330.      
  18331.    -- Initializes the LIST_OF_AVAL_HATCH_STYLE entry.
  18332.    -- However our implementation does not support HATCH STYLES therefore
  18333.    -- the entry is NULL.
  18334.    LEXI3700_WS_DT.LIST_OF_AVAL_HATCH_STYLE := HATCH_STYLES.NULL_LIST;
  18335.      
  18336.    -- Five predefined fill area bundles.
  18337.    LEXI3700_WS_DT.PREDEFINED_FA_BUNDLES := WS_TABLE_TYPES
  18338.          .FILL_AREA_BUNDLE_LIST'
  18339.       (1=>PRE_FILL_AREA_BUNDLES'(INT_STYLE=>HOLLOW,STYLE=>0,COLOUR=>0),
  18340.        2=>PRE_FILL_AREA_BUNDLES'(INT_STYLE=>SOLID ,STYLE=>0,COLOUR=>1),
  18341.        3=>PRE_FILL_AREA_BUNDLES'(INT_STYLE=>HOLLOW,STYLE=>0,COLOUR=>2),
  18342.        4=>PRE_FILL_AREA_BUNDLES'(INT_STYLE=>SOLID ,STYLE=>0,COLOUR=>4),
  18343.        5=>PRE_FILL_AREA_BUNDLES'(INT_STYLE=>SOLID ,STYLE=>0,COLOUR=>7));
  18344.      
  18345.    -- Defines a empty pattern matrix.  The following code is commented
  18346.    -- out because of the amount of memory needed to to store a pattern
  18347.    -- matrix (even an empty matrix).  Since the present implementation
  18348.    -- doesn't support patterns there is no need to have all that wasted
  18349.    -- space.
  18350. -- LEXI3700_WS_DT.PREDEFINED_PATTERN_REP := WS_TABLE_TYPES
  18351. --       .PATTERN_TABLE_LIST'
  18352. --     (1=>COLOUR_MATRICES.VARIABLE_MATRIX_OF'(MATRIX(0, 0)));
  18353.      
  18354.    -- The number of available colours.  The LEXIDATA supports 255
  18355.    -- intensities for each colour (red, green, blue).  This would
  18356.    -- mean an application programmer can access approximately
  18357.    -- sixteen million colours.  We feel that this constitutes a
  18358.    -- continuous range of colours available, therefore we have put a
  18359.    -- zero for the following entry.
  18360.      
  18361.    LEXI3700_WS_DT.NUM_OF_AVAL_COLOUR_INTENSITY := 0;
  18362.      
  18363.    -- Tells that there is colour available on the device.
  18364.    LEXI3700_WS_DT.COLOUR_AVAL := COLOUR;
  18365.      
  18366.    -- The list of predefined colours for the device.
  18367.    LEXI3700_WS_DT.PREDEFINED_COLOUR_REP :=  WS_TABLE_TYPES
  18368.          .COLOUR_TABLE_LIST'
  18369.          (0=> PRE_COLOUR_REP'( RED=>0.0,GREEN=>0.0,BLUE=>0.0), --black
  18370.           1=> PRE_COLOUR_REP'( RED=>1.0,GREEN=>1.0,BLUE=>1.0), --white
  18371.           2=> PRE_COLOUR_REP'( RED=>1.0,GREEN=>0.0,BLUE=>0.0), --red
  18372.           3=> PRE_COLOUR_REP'( RED=>0.0,GREEN=>1.0,BLUE=>0.0), --green
  18373.           4=> PRE_COLOUR_REP'( RED=>0.0,GREEN=>0.0,BLUE=>1.0), --blue
  18374.           5=> PRE_COLOUR_REP'( RED=>1.0,GREEN=>1.0,BLUE=>0.0), --yellow
  18375.           6=> PRE_COLOUR_REP'( RED=>1.0,GREEN=>0.0,BLUE=>1.0), --magenta
  18376.           7=> PRE_COLOUR_REP'( RED=>0.0,GREEN=>1.0,BLUE=>1.0));--cyan
  18377.      
  18378.    LEXI3700_WS_DT.AVAL_GDP := GDP_IDS.LIST(GDP_ID_LIST);
  18379.      
  18380.    LEXI3700_WS_DT.ATTR_USED(1) :=
  18381.          ATTRIBUTES_USED.LIST(GDP_ATTR_USED_LIST);
  18382.      
  18383.    -- Defines the maximum numbers of bundles available at this level.
  18384.    LEXI3700_WS_DT.MAX_NUM_PLIN_BUNDLE_TBL_ENTRIES := 5;
  18385.    LEXI3700_WS_DT.MAX_NUM_PMRK_BUNDLE_TBL_ENTRIES := 5;
  18386.    LEXI3700_WS_DT.MAX_NUM_TEXT_BUNDLE_TBL_ENTRIES := 5;
  18387.    LEXI3700_WS_DT.MAX_NUM_FA_BUNDLE_TBL_ENTRIES   := 5;
  18388.    LEXI3700_WS_DT.MAX_NUM_PATTERN_INDICES         := 0;
  18389.    LEXI3700_WS_DT.MAX_NUM_COLOUR_INDICES :=
  18390.          NATURAL(LEXI3700_CONFIGURATION.LEXI_MAXIMUM_COLOUR_INDEX);
  18391.      
  18392. end LEXI3700_WS_TABLES;
  18393. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18394. --:UDD:GKSADACM:CODE:MA:WSR_WS_XFORM.ADA
  18395. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18396. ------------------------------------------------------------------
  18397. --
  18398. --  NAME: WSR_WS_TRANSFORMATION
  18399. --  IDENTIFIER: GDMXXX.1(1)
  18400. --  DISCREPANCY REPORTS:
  18401. --
  18402. ------------------------------------------------------------------
  18403. -- File:  WSR_WS_XFORM.ADA
  18404. -- Level: MA
  18405.      
  18406. with GKS_TYPES;
  18407. with WS_STATE_LIST_TYPES;
  18408.      
  18409. use GKS_TYPES;
  18410.      
  18411. package WSR_WS_TRANSFORMATION is
  18412.      
  18413. -- This package, WSR_WS_TRANSFORMATION, provides two procedures to
  18414. -- process requests to specify the Workstation Transformation, and
  18415. -- one procedure to update the workstation transformation.
  18416. --
  18417. -- Packages GKS_TYPES and WS_STATE_LIST_TYPES provide type definitions
  18418. -- for procedure parameters.  Note that packages NDC and DC are from the
  18419. -- GKS_TYPES package and are instantiations of the GKS_COORDINATE_SYSTEM
  18420. -- package.
  18421.      
  18422.    procedure SET_WS_WINDOW
  18423.       (DYNAMIC_MODIFICATION : in     GKS_TYPES . DYNAMIC_MODIFICATION;
  18424.        WS_SL     : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR;
  18425.        WS_WINDOW : in     NDC . RECTANGLE_LIMITS);
  18426.      
  18427.    procedure SET_WS_VIEWPORT
  18428.       (DYNAMIC_MODIFICATION : in     GKS_TYPES . DYNAMIC_MODIFICATION;
  18429.        WS_SL       : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR;
  18430.        WS_VIEWPORT : in     DC . RECTANGLE_LIMITS);
  18431.      
  18432.    procedure UPDATE_WS_TRANSFORMATION
  18433.       (WS_SL     : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR);
  18434.      
  18435. end WSR_WS_TRANSFORMATION;
  18436. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18437. --:UDD:GKSADACM:CODE:0A:GET_ST_LST_PTR_0A.ADA
  18438. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18439. ------------------------------------------------------------------
  18440. --
  18441. --  NAME: GET_STATE_LIST_PTR
  18442. --  IDENTIFIER: GDMXXX.1(2)
  18443. --  DISCREPANCY REPORTS:
  18444. --  DR024  Editorial comments incorrect and/or missing.
  18445. ------------------------------------------------------------------
  18446. -- file: GET_ST_LST_PTR_0A.ADA
  18447. -- level: 0a,1a,2a
  18448.      
  18449. separate (LEXI3700_WS_TABLES)
  18450.      
  18451. function GET_STATE_LIST_PTR
  18452.    (WS_ID : in GKS_TYPES.WS_ID) return
  18453.     WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR is
  18454.      
  18455. -- This procedure returns a pointer to the state list specified by
  18456. -- a workstation id.
  18457. -- The following parameter is used in this function:
  18458. -- WS_ID - The workstation id for the specified workstation state list
  18459. --         to be returned.
  18460.      
  18461. TEMP_SL : PTR_TO_LST_OF_WS_ST_LST;
  18462. -- A temporary state list used for for the loop.
  18463.      
  18464. begin
  18465.      
  18466.    TEMP_SL := LEXI_ST_LSTS;
  18467.      
  18468.    while TEMP_SL /= NULL loop
  18469.      
  18470.       -- If the WS_ID is equal to the requested WS_ID return the
  18471.       -- WS_STATE_LIST.  If not get the next WS_STATE_LIST.
  18472.      
  18473.       if TEMP_SL.WS_ST_LST.WORKSTATION_ID = WS_ID then
  18474.          return TEMP_SL.WS_ST_LST;
  18475.      
  18476.       else
  18477.          TEMP_SL := TEMP_SL.NEXT_SL;
  18478.       end if;
  18479.      
  18480.    end loop;
  18481.      
  18482.    -- If no state list is found with the requested id NULL is returned.
  18483.    return NULL;
  18484.      
  18485. end GET_STATE_LIST_PTR;
  18486. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18487. --:UDD:GKSADACM:CODE:0A:ADD_ST_LST_TO_LST_0A.ADA
  18488. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18489. ------------------------------------------------------------------
  18490. --
  18491. --  NAME: ADD_STATE_LIST_TO_LIST
  18492. --  IDENTIFIER: GDMXXX.1(1)
  18493. --  DISCREPANCY REPORTS:
  18494. --
  18495. ------------------------------------------------------------------
  18496. -- file: ADD_ST_LST_TO_LST_0A.ADA
  18497. -- level: 0a
  18498.      
  18499. with WSR_WS_TRANSFORMATION;
  18500. with WSR_SET_INDIVIDUAL_ATTRIBUTES_0A;
  18501.      
  18502. with GKS_ERRORS;
  18503.      
  18504. separate (LEXI3700_WS_TABLES)
  18505.      
  18506. procedure ADD_STATE_LIST_TO_LIST
  18507.    (WS_ID      : in GKS_TYPES.WS_ID;
  18508.     CONNECT_ID : in VARIABLE_CONNECTION_ID;
  18509.     WS_TYPE    : in GKS_TYPES.WS_TYPE;
  18510.     ATTRIBUTES : in OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  18511.     EI         : out ERROR_INDICATOR) is
  18512.      
  18513.      
  18514. -- The following procedure adds a workstation state list to the list
  18515. -- of workstations of the same type.  All of the workstations in the
  18516. -- list are initialized from the same workstation description table.
  18517. --
  18518. -- The following parameters are used in this procedure:
  18519. -- WS_ID - The workstation id for the workstation.
  18520. -- CONNECT_ID - The connection id for the workstation.
  18521. -- WS_TYPE - The type of workstation.
  18522. -- ATTRIBUTES - A copy of the output attributes as they appeared in the
  18523. --              GKS state list.
  18524. -- EI - An error indicator used to trap errors.
  18525. --
  18526. -- The following set are the five indices for the predefined bundles
  18527. -- used to create the "...IDC_LIST's".
  18528.      
  18529. PLINE_IDC_LIST     : constant POLYLINE_INDICES.LIST_VALUES :=
  18530.                               (1,2,3,4,5);
  18531. PMRK_IDC_LIST      : constant POLYMARKER_INDICES.LIST_VALUES :=
  18532.                               (1,2,3,4,5);
  18533. TEXT_IDC_LIST      : constant TEXT_INDICES.LIST_VALUES :=
  18534.                               (1,2,3,4,5);
  18535. FILL_AREA_IDC_LIST : constant FILL_AREA_INDICES.LIST_VALUES :=
  18536.                               (1,2,3,4,5);
  18537. COLOUR_IDC_LIST    : constant COLOUR_INDICES.LIST_VALUES :=
  18538.                               (0,1,2,3,4,5,6,7);
  18539.      
  18540. begin
  18541.   declare
  18542.     OLD_LEXI_ST_LST : PTR_TO_LST_OF_WS_ST_LST;
  18543.     -- Used as a temporary for linking the lists together.
  18544.      
  18545.     begin
  18546.      
  18547.       -- Get a new WS_STATE_LIST.
  18548.      
  18549.       -- Sets the OLD_LEXI_ST_LST equal to the current state list.
  18550.       -- It gets a new state list and links the new state list to the
  18551.       -- OLD_LEXI_ST_LST.  The first time a state list is allocated
  18552.       -- LEXI_ST_LSTS is NULL, therefore it sets OLD_LEXI_ST_LST to
  18553.       -- NULL.  It gets a new state list, and sets the NEXT_ST_LST equal
  18554.       -- to OLD_LEXI_ST_LST which is NULL;
  18555.      
  18556.       OLD_LEXI_ST_LST := LEXI_ST_LSTS;
  18557.       LEXI_ST_LSTS := new LIST_OF_ST_LST;
  18558.       LEXI_ST_LSTS.NEXT_SL := OLD_LEXI_ST_LST;
  18559.      
  18560.       -- Get a new state list and add it to the list.
  18561.       LEXI_ST_LSTS.WS_ST_LST:= new WS_STATE_LIST_TYPES.WS_STATE_LST
  18562.             (NUM_POLYLINE_BUNDLES      => WS_STATE_LIST_TYPES.PLIN_INDEX
  18563.                    (LEXI3700_WS_DT.MAX_NUM_PLIN_BUNDLE_TBL_ENTRIES),
  18564.              NUM_POLYMARKER_BUNDLES    => WS_STATE_LIST_TYPES.PMRK_INDEX
  18565.                    (LEXI3700_WS_DT.MAX_NUM_PMRK_BUNDLE_TBL_ENTRIES),
  18566.              NUM_TEXT_BUNDLES          => WS_STATE_LIST_TYPES.TXT_INDEX
  18567.                    (LEXI3700_WS_DT.MAX_NUM_TEXT_BUNDLE_TBL_ENTRIES),
  18568.              NUM_FILL_AREA_BUNDLES     => WS_STATE_LIST_TYPES.FA_INDEX
  18569.                    (LEXI3700_WS_DT.MAX_NUM_FA_BUNDLE_TBL_ENTRIES),
  18570.              NUM_PATTERN_TABLES        => WS_STATE_LIST_TYPES.PAT_INDEX
  18571.                    (LEXI3700_WS_DT.MAX_NUM_PATTERN_INDICES),
  18572.              NUM_COLOUR_REPRESENTATION => WS_STATE_LIST_TYPES.CLR_INDEX
  18573.                    (LEXI3700_WS_DT.MAX_NUM_COLOUR_INDICES - 1));
  18574.      
  18575.       -- Initialize the LEXI_ST_LSTS.WS_ST_LST.
  18576.      
  18577.       -- The following are parameters passed in to the procedure.
  18578.      
  18579.       LEXI_ST_LSTS.WS_ST_LST.OUTPUT_ATTR       := ATTRIBUTES;
  18580.       LEXI_ST_LSTS.WS_ST_LST.WORKSTATION_ID    := WS_ID;
  18581.       LEXI_ST_LSTS.WS_ST_LST.CONNECT_ID        := CONNECT_ID;
  18582.       LEXI_ST_LSTS.WS_ST_LST.WORKSTATION_TYPE  := WS_TYPE;
  18583.      
  18584.       -- The following are initialized from the LEXI3700_WS_DT.
  18585.      
  18586.       LEXI_ST_LSTS.WS_ST_LST.WS_DEFERRAL_MODE :=
  18587.             LEXI3700_WS_DT.DEFER_MODE;
  18588.       LEXI_ST_LSTS.WS_ST_LST.WS_IMPLICIT_REGEN_MODE :=
  18589.             LEXI3700_WS_DT.IMPLICIT_REGEN_MODE;
  18590.      
  18591.       -- The list of polyline bundles.
  18592.      
  18593.       LEXI_ST_LSTS.WS_ST_LST.SET_OF_PLIN_IDC :=
  18594.             POLYLINE_INDICES.LIST(PLINE_IDC_LIST);
  18595.       LEXI_ST_LSTS.WS_ST_LST.POLYLINE_BUNDLES :=
  18596.             LEXI3700_WS_DT.PREDEFINED_PLIN_BUNDLES;
  18597.      
  18598.       -- The list of polymarker bundles.
  18599.      
  18600.       LEXI_ST_LSTS.WS_ST_LST.SET_OF_PMRK_IDC :=
  18601.             POLYMARKER_INDICES.LIST(PMRK_IDC_LIST);
  18602.       LEXI_ST_LSTS.WS_ST_LST.POLYMARKER_BUNDLES :=
  18603.             LEXI3700_WS_DT.PREDEFINED_PMRK_BUNDLES;
  18604.      
  18605.       -- The list of text bundles.
  18606.      
  18607.       LEXI_ST_LSTS.WS_ST_LST.SET_OF_TEXT_IDC :=
  18608.             TEXT_INDICES.LIST(TEXT_IDC_LIST);
  18609.       LEXI_ST_LSTS.WS_ST_LST.TEXT_BUNDLES  :=
  18610.             LEXI3700_WS_DT.PREDEFINED_TEXT_BUNDLES;
  18611.      
  18612.       -- The list of fill area bundles.
  18613.      
  18614.       LEXI_ST_LSTS.WS_ST_LST.SET_OF_FILL_AREA_IDC :=
  18615.             FILL_AREA_INDICES.LIST(FILL_AREA_IDC_LIST);
  18616.       LEXI_ST_LSTS.WS_ST_LST.FILL_AREA_BUNDLES :=
  18617.             LEXI3700_WS_DT.PREDEFINED_FA_BUNDLES;
  18618.      
  18619.       -- The colour table.
  18620.      
  18621.       LEXI_ST_LSTS.WS_ST_LST.SET_OF_COLOUR_IDC :=
  18622.             COLOUR_INDICES.LIST(COLOUR_IDC_LIST);
  18623.      
  18624.       LEXI_ST_LSTS.WS_ST_LST.COLOUR_TABLE
  18625.            (LEXI3700_WS_DT.PREDEFINED_COLOUR_REP'first ..
  18626.             LEXI3700_WS_DT.PREDEFINED_COLOUR_REP'last) :=
  18627.             LEXI3700_WS_DT.PREDEFINED_COLOUR_REP;
  18628.      
  18629.       -- The following call sets the effective attributes in the ws
  18630.       -- state list.  Since the ASF could have been changed before
  18631.       -- the workstation was opened the effective attributes are made
  18632.       -- up of individual and bundled attributes.
  18633.      
  18634.       WSR_SET_INDIVIDUAL_ATTRIBUTES_0A.SET_ASF
  18635.             (LEXI_ST_LSTS.WS_ST_LST,
  18636.              LEXI_ST_LSTS.WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS);
  18637.      
  18638.       -- Convert REQUESTED_WS_VIEWPORT in the WS_STATE_LIST_TYPES
  18639.       -- package from the default (0.0,0.0), (1.0,1.0) to the
  18640.       -- maximum square that fits in the display space.
  18641.      
  18642.       LEXI_ST_LSTS.WS_ST_LST.REQUESTED_WS_VIEWPORT :=
  18643.             (0.0,1023.0,0.0,1023.0);
  18644.      
  18645.       -- A call is made here to initialize the WS_TRANSFORMATION
  18646.       -- and set the CURRENT_WS_VIEWPORT.
  18647.       WSR_WS_TRANSFORMATION.SET_WS_VIEWPORT
  18648.             (IMM,
  18649.              LEXI_ST_LSTS.WS_ST_LST,
  18650.              LEXI_ST_LSTS.WS_ST_LST.REQUESTED_WS_VIEWPORT);
  18651.      
  18652.       -- If the procedure gets to this point without raising an
  18653.       -- exception, the workstation was opened successfully.
  18654.       EI := GKS_ERRORS.SUCCESSFUL;
  18655.      
  18656.    end;
  18657.      
  18658.    exception
  18659.       when OTHERS =>
  18660.      
  18661.          EI := GKS_ERRORS.WS_CANNOT_OPEN;
  18662.      
  18663. end ADD_STATE_LIST_TO_LIST;
  18664. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18665. --:UDD:GKSADACM:CODE:0A:DEL_ST_LST_FR_LST_0A.ADA
  18666. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18667. ------------------------------------------------------------------
  18668. --
  18669. --  NAME: DELETE_STATE_LIST_FROM_LIST
  18670. --  IDENTIFIER: GDMXXX.1(2)
  18671. --  DISCREPANCY REPORTS:
  18672. --  DR024  Editorial comments incorrect and/or missing.
  18673. ------------------------------------------------------------------
  18674. -- file: DEL_ST_LST_FR_LST_0A.ADA
  18675. -- level: 0a,1a,2a
  18676.      
  18677. with UNCHECKED_DEALLOCATION;
  18678.      
  18679. separate (LEXI3700_WS_TABLES)
  18680.      
  18681. procedure DELETE_STATE_LIST_FROM_LIST
  18682.    (WS_ID : in GKS_TYPES.WS_ID) is
  18683.      
  18684. -- This procedure deletes the state list specified by the WS_ID from
  18685. -- the list of workstation state lists.
  18686. --
  18687. -- The following parameter is used in this procedure:
  18688. -- WS_ID - The workstation id for the workstation state list to delete.
  18689.      
  18690. -- This procedure deallocates the specified WS state list.
  18691. procedure FREE_WS_ST_LST is new UNCHECKED_DEALLOCATION
  18692.    (WS_STATE_LIST_TYPES.WS_STATE_LST,
  18693.     WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR);
  18694.      
  18695. -- This procedure deallocates a componant of the LIST_OF_ST_LST.
  18696. procedure FREE_LIST_OF_ST_LST is new UNCHECKED_DEALLOCATION
  18697.    (LIST_OF_ST_LST,
  18698.     PTR_TO_LST_OF_WS_ST_LST);
  18699.      
  18700. PREV_TEMP,
  18701. TEMP_SL : PTR_TO_LST_OF_WS_ST_LST := LEXI_ST_LSTS;
  18702. --Temporary variables for deleting the state list.
  18703.      
  18704. begin
  18705.      
  18706.    while TEMP_SL /= NULL loop
  18707.       if TEMP_SL.WS_ST_LST.WORKSTATION_ID = WS_ID then
  18708.      
  18709.          -- If the temporary is equal to the first element in the list
  18710.          -- then the list can just be freed.
  18711.          if TEMP_SL = LEXI_ST_LSTS then
  18712.             LEXI_ST_LSTS := TEMP_SL.NEXT_SL;
  18713.             FREE_WS_ST_LST(TEMP_SL.WS_ST_LST);
  18714.             FREE_LIST_OF_ST_LST(TEMP_SL);
  18715.             EXIT;
  18716.          else
  18717.             -- Set the previous state list's 'next' pointer equal to
  18718.             -- next state list after the temporary. Then free the state
  18719.             -- list.
  18720.      
  18721.             PREV_TEMP.NEXT_SL := TEMP_SL.NEXT_SL;
  18722.             FREE_WS_ST_LST(TEMP_SL.WS_ST_LST);
  18723.             FREE_LIST_OF_ST_LST(TEMP_SL);
  18724.             EXIT;
  18725.          end if;
  18726.      
  18727.       else
  18728.      
  18729.          -- Set the temporary state list equal to the previous state
  18730.          -- list and get the next state list.
  18731.      
  18732.          PREV_TEMP := TEMP_SL;
  18733.          TEMP_SL := TEMP_SL.NEXT_SL;
  18734.       end if;
  18735.    end loop;
  18736.      
  18737. end DELETE_STATE_LIST_FROM_LIST;
  18738. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18739. --:UDD:GKSADACM:CODE:MA:WSR_WS_XFORM_B.ADA
  18740. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18741. ------------------------------------------------------------------
  18742. --
  18743. --  NAME: WSR_WS_TRANSFORMATION - BODY
  18744. --  IDENTIFIER: GDMXXX.1(1)
  18745. --  DISCREPANCY REPORTS:
  18746. --
  18747. ------------------------------------------------------------------
  18748. -- File:  WSR_WS_XFORM_B.ADA
  18749. -- Level: MA, 0A
  18750.      
  18751. package body WSR_WS_TRANSFORMATION is
  18752.      
  18753.    procedure SET_WS_WINDOW
  18754.       (DYNAMIC_MODIFICATION : in     GKS_TYPES . DYNAMIC_MODIFICATION;
  18755.        WS_SL     : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR;
  18756.        WS_WINDOW : in     NDC . RECTANGLE_LIMITS) is
  18757.      
  18758.    --     The overall function of SET_WS_WINDOW is to update the WS_SL
  18759.    -- to reflect the new WS_WINDOW of the Workstation Transformation.
  18760.    -- For efficiency's sake additional transformation matrices have been
  18761.    -- included in the WS_SL for use by the Workstation Driver. These
  18762.    -- must also be updated. In the same vein, an Effective Clipping
  18763.    -- Rectangle is computed. All of these efficiency measures are
  18764.    -- handled by the UPDATE_TRANSFORMATION subprogram.
  18765.    --
  18766.    -- Components of the WS_SL affected are as follows:
  18767.    -- REQUESTED_WS_WINDOW, WS_XFORM_UPDATE_STATE, WS_NEW_FRAME_ACTION,
  18768.    -- If UPDATE_TRANSFORMATION is called, then CURRENT_WS_WINDOW is set
  18769.    -- and additional calculations are done for updating the
  18770.    -- transformations and clipping rectangles.
  18771.    --
  18772.    -- DYNAMIC_MODIFICATION - specifies whether to update the CURRENT
  18773.    --       transformation immediately (IMM), or to cause an implicit
  18774.    --       regeneration (IRG).
  18775.    -- WS_SL - is the Workstation State List of the Workstation Driver.
  18776.    -- WS_WINDOW - specifies the Workstation Transformation window limits
  18777.    --       requested.
  18778.    --
  18779.    -- A note on the DYNAMIC_MODIFICATION parameter:  This should be
  18780.    -- equal to the value of the Workstation Description Table component
  18781.    -- WS_DYNAMICS . WS_TRANSFORMATION, but there are two ways for this
  18782.    -- to occur: 1) the Driver is written with a constant and the
  18783.    -- Workstation Description Table is defined in terms of the driver's
  18784.    -- behavior. 2) the Driver uses whatever value is in the Workstation
  18785.    -- Description Table to determine its actions. Case 1 can be used in
  18786.    -- most simple situations. In case 2, the Workstation Description
  18787.    -- Table component WS_DYNAMICS . WS_TRANSFORMATION should be passed.
  18788.      
  18789.    begin
  18790.      
  18791.       WS_SL . REQUESTED_WS_WINDOW := WS_WINDOW;
  18792.      
  18793.       if DYNAMIC_MODIFICATION = IMM or else
  18794.      
  18795.             WS_SL . WS_DISPLAY_SURFACE = EMPTY then
  18796.      
  18797.          UPDATE_WS_TRANSFORMATION(WS_SL);
  18798.      
  18799.       else
  18800.      
  18801.          WS_SL . WS_XFORM_UPDATE_STATE := PENDING;
  18802.      
  18803.          WS_SL . WS_NEW_FRAME_ACTION := YES;
  18804.      
  18805.       end if;
  18806.      
  18807.    end SET_WS_WINDOW;
  18808.      
  18809.    procedure SET_WS_VIEWPORT
  18810.       (DYNAMIC_MODIFICATION : in     GKS_TYPES . DYNAMIC_MODIFICATION;
  18811.        WS_SL       : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR;
  18812.        WS_VIEWPORT : in     DC . RECTANGLE_LIMITS) is
  18813.      
  18814.    --     The purpose of SET_WS_VIEWPORT to update the WS_SL to
  18815.    -- reflect the new WS_VIEWPORT of the Workstation Transformation. For
  18816.    -- efficiency's sake additional transformations have been included
  18817.    -- in the WS_SL for use by the Workstation Driver. These must
  18818.    -- also be updated. In the same vein, an Effective Clipping Rectangle
  18819.    -- is computed. All of these efficiency measures are handled by the
  18820.    -- UPDATE_TRANSFORMATION subprogram.
  18821.    --
  18822.    -- Components of the WS_SL affected are as follows:
  18823.    -- REQUESTED_WS_VIEWPORT, WS_XFORM_UPDATE_STATE, WS_NEW_FRAME_ACTION,
  18824.    -- If UPDATE_TRANSFORMATION is called, then CURRENT_WS_VIEWPORT is
  18825.    -- set and additional calculations are done for updating the
  18826.    -- transformations and clipping rectangles.
  18827.    --
  18828.    -- DYNAMIC_MODIFICATION - specifies whether to update the CURRENT
  18829.    --       transformation immediately (IMM), or to cause an implicit
  18830.    --       regeneration (IRG).
  18831.    -- WS_SL - is the Workstation State List of the Workstation Driver.
  18832.    -- WS_VIEWPORT - specifies the Workstation Transformation viewport
  18833.    --       limits requested.
  18834.    --
  18835.    -- A note on the DYNAMIC_MODIFICATION parameter:  This should be
  18836.    -- equal to the value of the Workstation Description Table component
  18837.    -- WS_DYNAMICS . WS_TRANSFORMATION, but there are two ways for this
  18838.    -- to occur: 1) the Driver is written with a constant and the
  18839.    -- Workstation Description Table is defined in terms of the driver's
  18840.    -- behavior. 2) the Driver uses whatever value is in the Workstation
  18841.    -- Description Table to determine its actions. Case 1 can be used in
  18842.    -- most simple situations. In case 2, the Workstation Description
  18843.    -- Table component WS_DYNAMICS . WS_TRANSFORMATION should be passed.
  18844.      
  18845.    begin
  18846.      
  18847.       WS_SL . REQUESTED_WS_VIEWPORT := WS_VIEWPORT;
  18848.      
  18849.       if DYNAMIC_MODIFICATION = IMM or else
  18850.      
  18851.             WS_SL . WS_DISPLAY_SURFACE = EMPTY then
  18852.      
  18853.          UPDATE_WS_TRANSFORMATION ( WS_SL );
  18854.      
  18855.       else
  18856.      
  18857.          WS_SL . WS_XFORM_UPDATE_STATE := PENDING;
  18858.      
  18859.          WS_SL . WS_NEW_FRAME_ACTION := YES;
  18860.      
  18861.       end if;
  18862.      
  18863.    end SET_WS_VIEWPORT;
  18864.      
  18865.    procedure UPDATE_WS_TRANSFORMATION
  18866.       (WS_SL     : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR) is
  18867.      
  18868.          separate;
  18869.      
  18870. end WSR_WS_TRANSFORMATION;
  18871. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18872. --:UDD:GKSADACM:CODE:MA:WSR_UTILITIES.ADA
  18873. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18874. ------------------------------------------------------------------
  18875. --
  18876. --  NAME: WSR_UTILITIES
  18877. --  IDENTIFIER: GDMXXX.1(1)
  18878. --  DISCREPANCY REPORTS:
  18879. --
  18880. ------------------------------------------------------------------
  18881. -- FILE : WSR_UTILITIES.ADA
  18882. -- LEVEL : all
  18883.      
  18884. with GKS_TYPES;
  18885. use  GKS_TYPES;
  18886.      
  18887. package WSR_UTILITIES is
  18888.      
  18889. -- The Workstation Resource Utilities contains procedures to handle
  18890. -- clipping of polylines and handling of text.
  18891.      
  18892.    type AREA;
  18893.      
  18894.    type LIST_OF_AREAS is access AREA;
  18895.      
  18896.    type AREA is
  18897.       record
  18898.          BORDER    : DC.POINT_LIST;
  18899.          NEXT_AREA : LIST_OF_AREAS;
  18900.       end record;
  18901.    -- The preceeding 3 declarations allow for the clip routine to return
  18902.    -- a variable number of areas.
  18903.      
  18904.    procedure PLINE_CLIP
  18905.       (POINTER_ARRAY  : DC.POINT_ARRAY;
  18906.        STARTING_PT    : out DC.POINT;
  18907.        STARTING_INDEX : in out POSITIVE;
  18908.        LAST_INDEX     : in out POSITIVE;
  18909.        FINISHING_PT   : out DC.POINT;
  18910.        CLIP_RECTANGLE : DC.RECTANGLE_LIMITS);
  18911.      
  18912.    function PMRK_CLIP
  18913.       (PTR_TO_LIST_OF_POINTS : DC.POINT_ARRAY;
  18914.        CLIP_RECTANGLE        : DC.RECTANGLE_LIMITS)
  18915.       return DC.POINT_LIST;
  18916.      
  18917.    procedure TEXT_CLIP
  18918.       (TEXT_POSITION   : DC.POINT;
  18919.        TEXT_LENGTH     : INTEGER;
  18920.        CLIP_RECTANGLE  : DC.RECTANGLE_LIMITS;
  18921.        OFFSET          : DC.POINT;
  18922.        FIRST_VIS_CHAR  : out POSITIVE;
  18923.        LAST_VIS_CHAR   : out POSITIVE);
  18924.      
  18925.    procedure TEXT_HANDLING
  18926.       (CAP_TOP          : DC_TYPE;
  18927.        BASE_BOTTOM      : DC_TYPE;
  18928.        T_PATH           : TEXT_PATH;
  18929.        T_ALIGNMENT      : TEXT_ALIGNMENT;
  18930.        CHAR_HEIGHT_VECT : DC.VECTOR;
  18931.        CHAR_WIDTH_VECT  : DC.VECTOR;
  18932.        CHAR_EXP_FACTOR  : CHAR_EXPANSION;
  18933.        CHAR_SPACE       : CHAR_SPACING;
  18934.        TEXT_POSITION    : in DC.POINT;
  18935.        TEXT_LENGTH      : INTEGER;
  18936.        CHARACTER_FONT   : DC_TYPE;
  18937.        START_POSITION   : out DC.POINT;
  18938.        OFFSET           : out DC.POINT;
  18939.        TEI_LOWER_LEFT   : out DC.POINT;
  18940.        TEI_LOWER_RIGHT  : out DC.POINT;
  18941.        TEI_UPPER_LEFT   : out DC.POINT;
  18942.        TEI_UPPER_RIGHT  : out DC.POINT);
  18943.      
  18944.    function TRANSFORM
  18945.       (INPUT_VALUE     : float;
  18946.        INPUT_UPPER     : float;
  18947.        INPUT_LOWER     : float;
  18948.        TRANSFORM_UPPER : integer;
  18949.        TRANSFORM_LOWER : integer) return integer;
  18950.      
  18951.    procedure AREA_CLIP
  18952.       (INPUT_AREA         : in DC.POINT_ARRAY;
  18953.        CLIPPING_RECTANGLE : in DC.RECTANGLE_LIMITS;
  18954.        OUTPUT_AREAS       : in out LIST_OF_AREAS);
  18955.    -- This procedure takes an input area and clips it by the CLIPPING_
  18956.    -- RECTANGLE.
  18957.      
  18958. end WSR_UTILITIES;
  18959. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18960. --:UDD:GKSADACM:CODE:MA:WSR_SET_CLR_TABLE.ADA
  18961. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18962. ------------------------------------------------------------------
  18963. --
  18964. --  NAME: WSR_SET_COLOUR_TABLE
  18965. --  IDENTIFIER: GDMXXX.1(1)
  18966. --  DISCREPANCY REPORTS:
  18967. --
  18968. ------------------------------------------------------------------
  18969. -- file : WSR_SET_CLR_TABLE.ADA
  18970. -- level: ma,0a,1a,2a
  18971.      
  18972. with GKS_TYPES;
  18973. with WS_STATE_LIST_TYPES;
  18974.      
  18975. use  GKS_TYPES;
  18976.      
  18977. package WSR_SET_COLOUR_TABLE  is
  18978.      
  18979. -- This package is a resource package.  It can be used by any device
  18980. -- that needs it.  It sets the colour table in the workstation state
  18981. -- list to the value specified by the parameter INDEX to the colour
  18982. -- specified by COLOUR.  It also needs the specified workstation state
  18983. -- list as a parameter to be passed to it.
  18984.      
  18985.    procedure SET_COLOUR_REPRESENTATION
  18986.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  18987.        INDEX     : in COLOUR_INDEX;
  18988.        COLOUR    : in COLOUR_REPRESENTATION;
  18989.        EI        : out ERROR_INDICATOR);
  18990.      
  18991. end WSR_SET_COLOUR_TABLE;
  18992. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18993. --:UDD:GKSADACM:CODE:MA:WSR_SET_CLR_TABLE_B.ADA
  18994. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  18995. ------------------------------------------------------------------
  18996. --
  18997. --  NAME: WSR_SET_COLOUR_TABLE - BODY
  18998. --  IDENTIFIER: GDMXXX.1(1)
  18999. --  DISCREPANCY REPORTS:
  19000. --
  19001. ------------------------------------------------------------------
  19002. -- file:  WSR_SET_CLR_TABLE_B.ADA
  19003. -- level: ma,0a,1a,2a
  19004.      
  19005. with GKS_ERRORS;
  19006.      
  19007. package body WSR_SET_COLOUR_TABLE  is
  19008.      
  19009.    procedure SET_COLOUR_REPRESENTATION
  19010.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19011.        INDEX     : in COLOUR_INDEX;
  19012.        COLOUR    : in COLOUR_REPRESENTATION;
  19013.        EI        : out ERROR_INDICATOR) is
  19014.      
  19015.    -- This procedure changes the colour specified by the index in
  19016.    -- the colour table of the WS_STATE_LIST specified by the parameter.
  19017.    -- It checks to see if the INDEX chosen is valid for the specified
  19018.    -- workstation.
  19019.    --
  19020.    -- The following parameters are used this procedure :
  19021.    -- WS_ST_LST -  the WS_STATE_LIST to which the colour is being
  19022.    --              directed.
  19023.    -- INDEX - the indexed colour being set.
  19024.    -- COLOUR - the intensities of red, green, blue to set the
  19025.    --          colour.
  19026.    -- EI - An error indicator used for logging errors.
  19027.      
  19028.    begin
  19029.      
  19030.       if INDEX not in WS_ST_LST.COLOUR_TABLE'range then
  19031.          EI := GKS_ERRORS.INVALID_COLOUR_INDEX;
  19032.       else
  19033.          EI := GKS_ERRORS.SUCCESSFUL;
  19034.      
  19035.          -- Set the specified WS_STATE_LIST to the
  19036.          -- value specified by the parameter.
  19037.          WS_ST_LST.COLOUR_TABLE (INDEX) := COLOUR;
  19038.      
  19039.          -- The index is added to the SET_OF_COLOUR_IDC in the WS_STATE
  19040.          -- LIST.  The set contains all the set indices on the device.
  19041.          COLOUR_INDICES.ADD_TO_LIST (INDEX,
  19042.                                      WS_ST_LST.SET_OF_COLOUR_IDC);
  19043.       end if;
  19044.      
  19045.    end SET_COLOUR_REPRESENTATION;
  19046.      
  19047. end WSR_SET_COLOUR_TABLE;
  19048. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19049. --:UDD:GKSADACM:CODE:MA:LEXI_CLR_OPS.ADA
  19050. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19051. ------------------------------------------------------------------
  19052. --
  19053. --  NAME: LEXI3700_COLOUR_OPERATIONS
  19054. --  IDENTIFIER: GDMXXX.1(1)
  19055. --  DISCREPANCY REPORTS:
  19056. --
  19057. ------------------------------------------------------------------
  19058. -- FILE: LEXI_CLR_OPS.ADA
  19059. -- LEVEL: MA
  19060.      
  19061. with GKS_TYPES;
  19062. with WS_STATE_LIST_TYPES;
  19063.      
  19064. use  GKS_TYPES;
  19065.      
  19066. package LEXI3700_COLOUR_OPERATIONS is
  19067.      
  19068. -- This package contains a procedure that sets the colour values for the
  19069. -- colour lookup table.
  19070.      
  19071.    procedure SET_COLOUR_REPRESENTATION
  19072.       (WS_SL  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19073.        INDEX  : COLOUR_INDEX;
  19074.        COLOUR : COLOUR_REPRESENTATION;
  19075.        ERROR  : out ERROR_INDICATOR);
  19076.      
  19077. end LEXI3700_COLOUR_OPERATIONS;
  19078. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19079. --:UDD:GKSADACM:CODE:MA:LEXI_CLR_OPS_B.ADA
  19080. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19081. ------------------------------------------------------------------
  19082. --
  19083. --  NAME: LEXI3700_COLOUR_OPERATIONS - BODY
  19084. --  IDENTIFIER: GDMXXX.1(1)
  19085. --  DISCREPANCY REPORTS:
  19086. --
  19087. ------------------------------------------------------------------
  19088. -- FILE: LEXI_CLR_OPS_B.ADA
  19089. -- LEVEL: MA
  19090.      
  19091. with LEXI3700_TYPES;
  19092. with LEXI3700_OUTPUT_DRIVER;
  19093. with GKS_ERRORS;
  19094. with WSR_SET_COLOUR_TABLE;
  19095. with WSR_UTILITIES;
  19096.      
  19097. use  LEXI3700_TYPES;
  19098.      
  19099. package body LEXI3700_COLOUR_OPERATIONS is
  19100.      
  19101. -- The procedure for setting the colour representation on the Lexidata
  19102. -- is found in a separate file.
  19103.      
  19104.    procedure SET_COLOUR_REPRESENTATION
  19105.       (WS_SL  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19106.        INDEX  : COLOUR_INDEX;
  19107.        COLOUR : COLOUR_REPRESENTATION;
  19108.        ERROR  : out ERROR_INDICATOR) is separate;
  19109.      
  19110. end LEXI3700_COLOUR_OPERATIONS;
  19111. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19112. --:UDD:GKSADACM:CODE:MA:WSD_SET_CLR_REP.ADA
  19113. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19114. ------------------------------------------------------------------
  19115. --
  19116. --  NAME: SET_COLOUR_REPRESENTATION
  19117. --  IDENTIFIER: GDMXXX.1(1)
  19118. --  DISCREPANCY REPORTS:
  19119. --
  19120. ------------------------------------------------------------------
  19121. -- FILE: WSD_SET_CLR_REP.ADA
  19122. -- LEVEL : MA
  19123.      
  19124. separate (LEXI3700_COLOUR_OPERATIONS)
  19125.      
  19126. procedure SET_COLOUR_REPRESENTATION
  19127.    (WS_SL  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19128.     INDEX  : COLOUR_INDEX;
  19129.     COLOUR : COLOUR_REPRESENTATION;
  19130.     ERROR  : out ERROR_INDICATOR) is
  19131.      
  19132. -- This procedure sets the requested entry in the color lookup table to
  19133. -- a particular colour value.
  19134. --
  19135. -- This procedure calls a procedure to set the colour in the workstation
  19136. -- state list, converts the colour density values into the device
  19137. -- dependent values, and calls another procedure in the device driver
  19138. -- which sets the colour.
  19139. --
  19140. -- WS_SL  - a pointer to the workstation state list.
  19141. -- INDEX  - contains the index into its colour lookup table.
  19142. -- COLOUR - contains the new intensity values for the three colours -
  19143. --          red, blue, and green.
  19144. -- ERROR  - returns an error_indicator.
  19145.      
  19146. EI : ERROR_INDICATOR;
  19147. -- Used to hold the returned error from WSR_SET_CLR_REP.
  19148.      
  19149. LEXI_COLOUR_VALUE : LEXI_PIXEL_COLOUR;
  19150. -- LEXI_COLOUR_VALUE - this contains COLOUR after its intensity values
  19151. -- are converted into Lexidata compatable intensity values.
  19152.      
  19153.    function CONVERT_TO_DEVICE_RANGE
  19154.      (STANDARD_INTENSITY : INTENSITY)
  19155.       return LEXI_COLOUR_INTENSITY is
  19156.      
  19157.    -- This function accepts intensity values which are in the range of
  19158.    -- the standard GKS intensities [0,1] and converts them into
  19159.    -- intensity values that can be sent to the device.
  19160.    --
  19161.    -- STANDARD_INTENSITY - the intensity value given as a percentage
  19162.    --                      between zero and one.
  19163.      
  19164.    begin
  19165.      
  19166.       -- A procedure is called in the Workstation Resource which will
  19167.       -- convert from a range of floating values into an even distri-
  19168.       -- bution of integer values.
  19169.       return LEXI_COLOUR_INTENSITY
  19170.          (WSR_UTILITIES.TRANSFORM
  19171.           (FLOAT (STANDARD_INTENSITY),
  19172.            FLOAT (INTENSITY'LAST),
  19173.            FLOAT (INTENSITY'FIRST),
  19174.            INTEGER (LEXI_COLOUR_INTENSITY'LAST),
  19175.            INTEGER (LEXI_COLOUR_INTENSITY'FIRST)));
  19176.    end CONVERT_TO_DEVICE_RANGE;
  19177.      
  19178. begin
  19179.      
  19180.    -- A procedure is called in the Workstation Resource which sets
  19181.    -- the Workstation's Colour Lookup Table entry at INDEX to COLOUR.
  19182.    WSR_SET_COLOUR_TABLE.SET_COLOUR_REPRESENTATION
  19183.       (WS_SL, INDEX, COLOUR, EI);
  19184.      
  19185.    -- If error #93 is not detected, further processing is done to set
  19186.    -- the colour on the Lexidata's own colour lookup table.
  19187.    if EI = GKS_ERRORS.SUCCESSFUL then
  19188.      
  19189.       -- The three intensity values are converted into values which are
  19190.       -- meaningful to the Lexidata.
  19191.       LEXI_COLOUR_VALUE.RED   := CONVERT_TO_DEVICE_RANGE (COLOUR.RED);
  19192.       LEXI_COLOUR_VALUE.BLUE  := CONVERT_TO_DEVICE_RANGE (COLOUR.BLUE);
  19193.       LEXI_COLOUR_VALUE.GREEN := CONVERT_TO_DEVICE_RANGE (COLOUR.GREEN);
  19194.      
  19195.       -- The Device Driver is called to set the colour value at INDEX.
  19196.       LEXI3700_OUTPUT_DRIVER.WRITE_TO_LUT
  19197.          (LEXI_COLOUR_INDEX(INDEX), LEXI_COLOUR_VALUE);
  19198.      
  19199.    end if;
  19200.      
  19201.    -- The value of the Error Indicator is returned.
  19202.    ERROR := EI;
  19203.      
  19204. end SET_COLOUR_REPRESENTATION;
  19205. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19206. --:UDD:GKSADACM:CODE:MA:LEXI_WS_CONT_MA.ADA
  19207. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19208. ------------------------------------------------------------------
  19209. --
  19210. --  NAME: LEXI3700_CONTROL_OPERATIONS
  19211. --  IDENTIFIER: GDMXXX.1(1)
  19212. --  DISCREPANCY REPORTS:
  19213. --
  19214. ------------------------------------------------------------------
  19215. -- file: LEXI_WS_CONT_MA.ADA
  19216. -- level: ma,0a
  19217.      
  19218. with GKS_TYPES;
  19219. with OUTPUT_ATTRIBUTES_TYPE;
  19220. with WS_STATE_LIST_TYPES;
  19221. with CGI;
  19222.      
  19223. use GKS_TYPES;
  19224.      
  19225. package LEXI3700_CONTROL_OPERATIONS is
  19226.      
  19227. -- This package is a workstation driver package used to control the
  19228. -- device.  It has direct access to the device driver procedures for
  19229. -- communication to the device.
  19230.      
  19231.    procedure OPEN_WS
  19232.       (WS          : in WS_ID;
  19233.        CONNECTION  : in CGI.ACCESS_CONNECTION_ID_TYPE;
  19234.        TYPE_OF_WS  : in WS_TYPE;
  19235.        ATTRIBUTES  : in out OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  19236.        EI          : out ERROR_INDICATOR);
  19237.      
  19238.    procedure CLOSE_WS
  19239.       (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR);
  19240.      
  19241.    procedure CLEAR_WS
  19242.       (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19243.        FLAG        : in CONTROL_FLAG);
  19244.      
  19245.    procedure UPDATE_WS
  19246.       (WS_ST_LST    : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19247.        REGENERATION : in UPDATE_REGENERATION_FLAG);
  19248.      
  19249. end LEXI3700_CONTROL_OPERATIONS;
  19250. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19251. --:UDD:GKSADACM:CODE:MA:LEXI_WS_CONT_MA_B.ADA
  19252. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19253. ------------------------------------------------------------------
  19254. --
  19255. --  NAME: LEXI3700_CONTROL_OPERATIONS
  19256. --  IDENTIFIER: GDMXXX.1(1)
  19257. --  DISCREPANCY REPORTS:
  19258. --
  19259. ------------------------------------------------------------------
  19260. -- file: LEXI_WS_CONT_MA_B.ADA
  19261. -- level: ma,0a
  19262.      
  19263. with LEXI3700_OUTPUT_DRIVER;
  19264. with LEXI3700_TYPES;
  19265. with GKS_ERRORS;
  19266.      
  19267. use  LEXI3700_TYPES;
  19268.      
  19269. package body LEXI3700_CONTROL_OPERATIONS is
  19270.      
  19271. -- The following packages are used in this package for the given
  19272. -- reasons:
  19273. -- The LEXI3700_OUTPUT_DRIVER package contains all procedures that are
  19274. -- used in the device driver.
  19275. -- The LEXI3700_TYPES package contains all types used by the device
  19276. -- driver.
  19277. -- The GKS_ERRORS package contain all the error constants.
  19278.      
  19279.    procedure OPEN_WS
  19280.       (WS         : in WS_ID;
  19281.        CONNECTION : in CGI.ACCESS_CONNECTION_ID_TYPE;
  19282.        TYPE_OF_WS : in WS_TYPE;
  19283.        ATTRIBUTES : in out OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  19284.        EI         : out ERROR_INDICATOR)
  19285.    is separate;
  19286.      
  19287.    procedure CLOSE_WS
  19288.       (WS_ST_LST  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR)
  19289.    is separate;
  19290.      
  19291.    procedure CLEAR_WS
  19292.       (WS_ST_LST  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19293.        FLAG       : in CONTROL_FLAG)
  19294.    is separate;
  19295.      
  19296.    procedure UPDATE_WS
  19297.       (WS_ST_LST  : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19298.        REGENERATION : in UPDATE_REGENERATION_FLAG)
  19299.    is separate;
  19300.      
  19301. end LEXI3700_CONTROL_OPERATIONS;
  19302. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19303. --:UDD:GKSADACM:CODE:MA:WSD_OPEN_WS.ADA
  19304. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19305. ------------------------------------------------------------------
  19306. --
  19307. --  NAME: OPEN_WS
  19308. --  IDENTIFIER: GDMXXX.1(1)
  19309. --  DISCREPANCY REPORTS:
  19310. --
  19311. ------------------------------------------------------------------
  19312. -- file: WSD_OPEN_WS.ADA
  19313. -- level: ma,0a,1a,2a
  19314.      
  19315. with LEXI3700_COLOUR_OPERATIONS;
  19316. with LEXI3700_WS_TABLES;
  19317.      
  19318. separate (LEXI3700_CONTROL_OPERATIONS)
  19319.      
  19320. procedure OPEN_WS
  19321.    (WS         : in WS_ID;
  19322.     CONNECTION : in CGI.ACCESS_CONNECTION_ID_TYPE;
  19323.     TYPE_OF_WS : in WS_TYPE;
  19324.     ATTRIBUTES : in out OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES;
  19325.     EI         : out ERROR_INDICATOR) is
  19326.      
  19327. -- This procedure calls the device driver procedure to open the device
  19328. -- and establish communication to it.  If there is no error in opening
  19329. -- the device it creates and initializes a WS_STATE_LIST from its
  19330. -- WS_DESCRIPTION_TABLE.  It initializes the OUTPUT_ATTR record in the
  19331. -- WS_STATE_LIST from the parameter ATTRIBUTES.
  19332. --
  19333. -- The parameters used in this procedure are:
  19334. -- WS - The workstation id the application programmer assigned to
  19335. --      associate the workstation with.
  19336. -- CONNECTION - The physical location the device driver needs to
  19337. --              decide which device to open.
  19338. -- TYPE_OF_WS - The type of workstation that is being opened.
  19339. -- ATTRIBUTES - A copy of the output attributes stored in the GKS_STATE_
  19340. --              LIST.
  19341. -- EI - contains any error that may be returned while
  19342. --      attempting to open the device.
  19343.      
  19344. CHANNEL_IN  : constant := 48;
  19345. CHANNEL_OUT : constant := 49;
  19346. -- The preceding define the communication channels to the device.
  19347. -- The present implimentation has them hard coded in for efficiency.
  19348. -- A future implimentation that supports multiple workstations from
  19349. -- the same host will need parameterize needs values to communicate
  19350. -- with the appropriate device.
  19351.      
  19352. CONNECTION_ID : VARIABLE_CONNECTION_ID(CONNECTION'length);
  19353. -- Creates an object the length of the string access type passed in.
  19354.      
  19355. ERROR_CONDITION : INTEGER;
  19356. -- This is the LEXIDATA ERROR CODE that is returned from the device.
  19357.      
  19358. begin
  19359.      
  19360.    -- Call the device driver to open the workstation
  19361.    LEXI3700_OUTPUT_DRIVER.OPEN(CHANNEL_IN,
  19362.                                CHANNEL_OUT,
  19363.                                ERROR_CONDITION);
  19364.      
  19365.    -- Check the error number from the device.  If it is anything but
  19366.    -- zero the device could not be opened successfully.
  19367.      
  19368.    If ERROR_CONDITION /= 0 then
  19369.       EI := GKS_ERRORS.WS_CANNOT_OPEN;
  19370.    else
  19371.       -- The device was opened succesfully.
  19372.       EI := GKS_ERRORS.SUCCESSFUL;
  19373.      
  19374.       -- Clears the display.
  19375.       LEXI3700_OUTPUT_DRIVER.CLEAR_DISPLAY;
  19376.      
  19377.       -- Defines the display memory planes on the device.
  19378.       LEXI3700_OUTPUT_DRIVER.DEFINE_WRITE_CHANNELS;
  19379.      
  19380.       -- Moves the cursor off the screen.
  19381.       LEXI3700_OUTPUT_DRIVER.SET_HARDWARE_CURSOR;
  19382.      
  19383.       -- Call the LEXI3700_WS_TBLS package to initialize the WS_STATE_
  19384.       -- LIST and add its WS_ID to the LIST_OF_WS_STATE_LISTS.
  19385.       CONNECTION_ID.CONNECT := CONNECTION.all;
  19386.      
  19387.       LEXI3700_WS_TABLES.ADD_STATE_LIST_TO_LIST
  19388.             (WS,
  19389.              CONNECTION_ID,
  19390.              TYPE_OF_WS,
  19391.              ATTRIBUTES,
  19392.              EI);
  19393.      
  19394.       declare
  19395.          WS_SL : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19396.          ERROR : ERROR_INDICATOR;
  19397.          -- A dummy error indicator that will always be successful.
  19398.          -- When this error indicator is returned it is expected that
  19399.          -- it will be successful.  The device has already been opened
  19400.          -- and the ws state list allocated, therefore no other error
  19401.          -- can happen.  Since the colours and indices SET_COLOUR_
  19402.          -- REPRESENTATION procedure receives are from its own
  19403.          -- description table it is assumed that they are valid,
  19404.          -- therefore this error indicator does not need to be checked.
  19405.      
  19406.       begin
  19407.          WS_SL := LEXI3700_WS_TABLES.GET_STATE_LIST_PTR(WS);
  19408.          -- Initialize the Look up table on the device.
  19409.          for I in LEXI3700_WS_TABLES.LEXI3700_WS_DT
  19410.                .PREDEFINED_COLOUR_REP'range loop
  19411.             LEXI3700_COLOUR_OPERATIONS.SET_COLOUR_REPRESENTATION
  19412.                   (WS_SL,
  19413.                    COLOUR_INDEX(I),
  19414.                    LEXI3700_WS_TABLES.LEXI3700_WS_DT
  19415.                          .PREDEFINED_COLOUR_REP (I),
  19416.                    ERROR);
  19417.          end loop;
  19418.       end;
  19419.    end if;
  19420.      
  19421. end OPEN_WS;
  19422. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19423. --:UDD:GKSADACM:CODE:MA:WSD_CLOSE_WS_MA.ADA
  19424. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19425. ------------------------------------------------------------------
  19426. --
  19427. --  NAME: CLOSE_WS
  19428. --  IDENTIFIER: GDMXXX.1(1)
  19429. --  DISCREPANCY REPORTS:
  19430. --
  19431. ------------------------------------------------------------------
  19432. -- file: WSD_CLOSE_WS_MA.ADA
  19433. -- level: ma,0a
  19434.      
  19435. with LEXI3700_WS_TABLES;
  19436.      
  19437. separate (LEXI3700_CONTROL_OPERATIONS)
  19438.      
  19439. procedure CLOSE_WS
  19440.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR) is
  19441.      
  19442. -- This procedure calls a procedure in the device driver to
  19443. -- flush the device buffer.  It then calls the DELETE_WS_STATE_LIST_FROM
  19444. -- _LIST procedure in the LEXI3700_WS_TABLES package to deallocate the
  19445. -- WS_STATE_LIST.
  19446. --
  19447. -- note: The interface from the host to the target device that we
  19448. --       presently have does not allow us to close the device and
  19449. --       reopen it from the same process.  This is not acceptable
  19450. --       in GKS so we have decided not to close the device in this
  19451. --       procedure call for the LEXIDATA 3700 workstation.
  19452.      
  19453. begin
  19454.      
  19455.    LEXI3700_OUTPUT_DRIVER.FLUSH;
  19456.      
  19457.    -- Delete the WS_STATE_LIST from the list.
  19458.    LEXI3700_WS_TABLES.DELETE_STATE_LIST_FROM_LIST( WS_ST_LST
  19459.          .WORKSTATION_ID);
  19460.      
  19461. end CLOSE_WS;
  19462. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19463. --:UDD:GKSADACM:CODE:MA:WSD_CLEAR_WS_MA.ADA
  19464. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19465. ------------------------------------------------------------------
  19466. --
  19467. --  NAME: CLEAR_WS
  19468. --  IDENTIFIER: GDMXXX.1(2)
  19469. --  DISCREPANCY REPORTS:
  19470. --  DR021  Need to flush clear WS out of buffer.
  19471. ------------------------------------------------------------------
  19472. -- file: WSD_CLEAR_WS_MA.ADA
  19473. -- level: ma,0a
  19474.      
  19475. with WSR_WS_TRANSFORMATION;
  19476.      
  19477. separate (LEXI3700_CONTROL_OPERATIONS)
  19478.      
  19479. procedure CLEAR_WS
  19480.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19481.     FLAG      : in CONTROL_FLAG) is
  19482.      
  19483. -- This procedure calls the FLUSH procedure that empties the device
  19484. -- buffer.  It then updates the WS_ST_LST and calls the device driver
  19485. -- procedure CLEAR_DISPLAY to clear the display.
  19486. --
  19487. -- The following parameters are used in this procedure:
  19488. -- WS_ST_LST - The workstation state list for the specified device.
  19489. -- FLAG - A flag used to control if the display surface should be
  19490. --        cleared needlessly.
  19491.      
  19492. begin
  19493.      
  19494.    -- Execute all deferred actions.
  19495.    LEXI3700_OUTPUT_DRIVER.FLUSH;
  19496.      
  19497.    -- Check the FLAG if it's ALWAYS or if the WS_DISPLAY_SURFACE is
  19498.    -- NOTEMPTY then clear the device.
  19499.    if FLAG = ALWAYS or else WS_ST_LST.WS_DISPLAY_SURFACE = NOTEMPTY then
  19500.       -- Clear the display.
  19501.       LEXI3700_OUTPUT_DRIVER.CLEAR_DISPLAY;
  19502.       -- Flush the buffer to get the CLEAR_DISPLAY out
  19503.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  19504.    end if;
  19505.      
  19506.    -- If the WS_XFORM_UPDATE_STATE entry in the WS_OUTPUT_STATE_
  19507.    -- LIST is PENDING, the CURRENT_WS_WINDOW and CURRENT_WS_
  19508.    -- VIEWPORT entries in the WS_OUTPUT_STATE LIST are assigned
  19509.    -- the values of the REQUESTED_WS_WINDOW and REQUESTED_WS_
  19510.    -- VIEWPORT entries; the WS_XFORM_UPDATE_STATE entry is set
  19511.    -- to NOTPENDING.  The package WSR_WS_TRANSFORMATION also
  19512.    -- computes the EFFECTIVE_CLIPPING_RECTANGLE.
  19513.      
  19514.    if WS_ST_LST.WS_XFORM_UPDATE_STATE = PENDING then
  19515.       WSR_WS_TRANSFORMATION.UPDATE_WS_TRANSFORMATION( WS_ST_LST );
  19516.    end if;
  19517.      
  19518.    -- The WS_NEW_FRAME_ACTION entry in the WS_OUTPUT_STATE_LIST
  19519.    -- is set to NO.
  19520.    WS_ST_LST.WS_NEW_FRAME_ACTION := NO;
  19521.      
  19522.    -- The WS_DISPLAY_SURFACE entry in the WS_OUTPUT_STATE_LIST
  19523.    -- is set to EMPTY.
  19524.    WS_ST_LST.WS_DISPLAY_SURFACE := EMPTY;
  19525.      
  19526. end CLEAR_WS;
  19527. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19528. --:UDD:GKSADACM:CODE:MA:WSD_UP_WS_MA.ADA
  19529. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19530. ------------------------------------------------------------------
  19531. --
  19532. --  NAME: UPDATE_WS
  19533. --  IDENTIFIER: GDMXXX.1(1)
  19534. --  DISCREPANCY REPORTS:
  19535. --
  19536. ------------------------------------------------------------------
  19537. -- file: WSD_UP_WS_MA.ADA
  19538. -- level: ma,0a
  19539.      
  19540. with WSR_WS_TRANSFORMATION;
  19541.      
  19542. separate (LEXI3700_CONTROL_OPERATIONS)
  19543.      
  19544. procedure UPDATE_WS
  19545.    (WS_ST_LST    : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  19546.     REGENERATION : in UPDATE_REGENERATION_FLAG) is
  19547.      
  19548. -- This procedure updates the workstation.  Since this is a level ma
  19549. -- and 0a procedure there is no implicit regeneration of all visible
  19550. -- segments stored on this workstation done in this procedure.
  19551. --
  19552. -- The following parameters are used in this procedure:
  19553. -- WS_ST_LST - The workstation state list for the specified device.
  19554. -- REGENERATION - A flag used to determine if an implicit regeneration
  19555. --                should be done with this UPDATE_WS call.
  19556.      
  19557. begin
  19558.      
  19559.    -- Call the device driver to flush all deferred actions.
  19560.    LEXI3700_OUTPUT_DRIVER.FLUSH;
  19561.      
  19562.    -- IF the REGENERATION flag is set to PERFORM and the
  19563.    -- WS_NEW_FRAME_ACTION entry in the WS_STATE_LIST is
  19564.    -- YES, then the following actions will be performed:
  19565.      
  19566.    if REGENERATION = PERFORM and WS_ST_LST
  19567.          .WS_NEW_FRAME_ACTION = YES then
  19568.      
  19569.       -- The display surface is cleared only if the WS_DISPLAY_
  19570.       -- SURFACE entry in the WS_STATE_LIST is NOTEMPTY.
  19571.       -- The entry is set to EMPTY.
  19572.      
  19573.       if WS_ST_LST.WS_DISPLAY_SURFACE = NOTEMPTY  then
  19574.      
  19575.          LEXI3700_OUTPUT_DRIVER.CLEAR_DISPLAY;
  19576.          WS_ST_LST.WS_DISPLAY_SURFACE := EMPTY;
  19577.      
  19578.       end if;
  19579.      
  19580.       -- If the WS_XFORM_UPDATE_STATE entry in the WS_STATE_LIST is
  19581.       -- PENDING, the CURRENT_WS_WINDOW and CURRENT_WS_VIEWPORT
  19582.       -- entries in the WS_OUTPUT_STATE LIST are assigned the values
  19583.       -- of the REQUESTED_WS_WINDOW and REQUESTED_WS_VIEWPORT entries;
  19584.       -- the WS_XFORM_UPDATE_STATE entry is set to NOTPENDING.
  19585.      
  19586.       if WS_ST_LST.WS_XFORM_UPDATE_STATE = PENDING then
  19587.          -- The following procedure updates the transformation state
  19588.          -- and compute the new EFFECTIVE_CLIPPING_RECTANGLE in the
  19589.          -- workstation state list.
  19590.          WSR_WS_TRANSFORMATION.UPDATE_WS_TRANSFORMATION( WS_ST_LST );
  19591.       end if;
  19592.      
  19593.       -- The WS_NEW_FRAME_ACTION entry in the WS_STATE_LIST
  19594.       -- is set to NO.
  19595.       WS_ST_LST.WS_NEW_FRAME_ACTION := NO;
  19596.      
  19597.    end if;
  19598.      
  19599. end UPDATE_WS;
  19600. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19601. --:UDD:GKSADACM:CODE:MA:DC_POINT_OPS.ADA
  19602. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19603. ------------------------------------------------------------------
  19604. --
  19605. --  NAME: DC_POINT_OPS
  19606. --  IDENTIFIER: GDMXXX.1(1)
  19607. --  DISCREPANCY REPORTS:
  19608. --
  19609. ------------------------------------------------------------------
  19610. -- File: DC_POINT_OPS.ADA
  19611. -- Level: all
  19612.      
  19613. with GKS_TYPES;
  19614.      
  19615. use GKS_TYPES;
  19616.      
  19617. package DC_POINT_OPS is
  19618.      
  19619. -- Package DC_POINT_OPS provides extended functionality to the POINT
  19620. -- and VECTOR types defined in package DC, an instance of
  19621. -- GKS_COORDINATE_SYSTEM.  The extensions are functions which perform
  19622. -- commonly desired operations on points and vectors.
  19623. --
  19624. -- The functions are grouped by the argument and result types, and
  19625. -- perform well-known mathematical functions:
  19626. --      DOT             vector dot product
  19627. --      NORM            the norm or length of a vector
  19628. --      DIST            Euclidean distance between points
  19629. --      "*"             Multiply VECTOR or POINT by a DC_TYPE or
  19630. --                      DC . MAGNITUDE and vice versa
  19631. --      "/"             Divide VECTOR or POINT by a DC_TYPE or
  19632. --                      DC . MAGNITUDE
  19633. --      "-"             Negative of a VECTOR or a POINT
  19634. --      "+","-"         Sum or difference of a VECTOR or a POINT
  19635. --      "+","-"         Mixed sums of VECTORs and POINTs with POINTs
  19636. --                      regarded as absolute positions and VECTORs as
  19637. --                      relative displacements.
  19638. --
  19639. -- One set of functions is somewhat unconventional:
  19640. --      "*","/"         Coordinate-wise multiply or divide of a VECTOR
  19641. --                      or a POINT
  19642. --
  19643. -- Because POINT and VECTOR are record types, not array types, it is
  19644. -- clumsy to use them as generic parameters, but see packages NDC_OPS and
  19645. -- DC_OPS for an instance of this technique. Instead of a generic
  19646. -- extension to GKS_COORDINATE_SYSTEM, this package directly implements
  19647. -- extensions to package DC.
  19648. --
  19649. -- IMPORTANT, IMPLEMENTATION RESTRICTION:
  19650. -- A sister package, NDC_POINT_OPS was generated from this one by
  19651. -- swapping all occurrences of the strings "NDC" and "DC".  By avoiding
  19652. -- any other use of these strings, an easy pseudo-generic instantiation
  19653. -- is made. Even comments should follow this rule.
  19654.      
  19655.    use DC;
  19656.      
  19657.    subtype COORD is DC_TYPE;
  19658.    subtype MAGNITUDE is DC . MAGNITUDE;
  19659.      
  19660. -- DOT(V, V) => S  DOT PRODUCT
  19661. -- NORM(V)   => S  [S := SQRT( DOT(V,V) );]
  19662.      
  19663.    function DOT
  19664.       (A : in     VECTOR;
  19665.        B : in     VECTOR) return COORD;
  19666.      
  19667.    function NORM
  19668.       (A : in     VECTOR) return COORD;
  19669.      
  19670.    function NORM
  19671.       (A : in     VECTOR) return MAGNITUDE;
  19672.      
  19673.    function DIST
  19674.       (A : in     POINT;
  19675.        B : in     POINT) return COORD;
  19676.      
  19677.    function DIST
  19678.       (A : in     POINT;
  19679.        B : in     POINT) return MAGNITUDE;
  19680.      
  19681. -- Scalar operations
  19682.      
  19683.    function "*"
  19684.       (V : in     VECTOR;
  19685.        S : in     COORD) return VECTOR;
  19686.      
  19687.    function "*"
  19688.       (S : in     COORD;
  19689.        V : in     VECTOR) return VECTOR;
  19690.      
  19691.    function "/"
  19692.       (V : in     VECTOR;
  19693.        S : in     COORD) return VECTOR;
  19694.      
  19695.    function "*"
  19696.       (V : in     VECTOR;
  19697.        S : in     MAGNITUDE) return VECTOR;
  19698.      
  19699.    function "*"
  19700.       (S : in     MAGNITUDE;
  19701.        V : in     VECTOR) return VECTOR;
  19702.      
  19703.    function "/"
  19704.       (V : in     VECTOR;
  19705.        S : in     MAGNITUDE) return VECTOR;
  19706.      
  19707.    function "*"
  19708.       (P : in     POINT;
  19709.        S : in     COORD) return POINT;
  19710.      
  19711.    function "*"
  19712.       (S : in     COORD;
  19713.        P : in     POINT) return POINT;
  19714.      
  19715.    function "/"
  19716.       (P : in     POINT;
  19717.        S : in     COORD) return POINT;
  19718.      
  19719.    function "*"
  19720.       (P : in     POINT;
  19721.        S : in     MAGNITUDE) return POINT;
  19722.      
  19723.    function "*"
  19724.       (S : in     MAGNITUDE;
  19725.        P : in     POINT) return POINT;
  19726.      
  19727.    function "/"
  19728.       (P : in     POINT;
  19729.        S : in     MAGNITUDE) return POINT;
  19730.      
  19731. -- - V   => V [for I in X..Y loop V(I) := - V(I); end loop;]
  19732. -- V + V => V [for I in X..Y loop V(I) := VA(I) + VB(I); end loop;]
  19733. -- V - V => V [for I in X..Y loop V(I) := VA(I) - VB(I); end loop;]
  19734. -- V * V => V [for I in X..Y loop V(I) := VA(I) * VB(I); end loop;]
  19735. -- V / V => V [for I in X..Y loop V(I) := VA(I) / VB(I); end loop;]
  19736.      
  19737.    function "-"
  19738.       (A: in     VECTOR) return VECTOR;
  19739.      
  19740.    function "+"
  19741.       (A : in     VECTOR;
  19742.        B : in     VECTOR) return VECTOR;
  19743.      
  19744.    function "-"
  19745.       (A : in     VECTOR;
  19746.        B : in     VECTOR) return VECTOR;
  19747.      
  19748.    function "*"
  19749.       (A : in     VECTOR;
  19750.        B : in     VECTOR) return VECTOR;
  19751.      
  19752.    function "/"
  19753.       (A : in     VECTOR;
  19754.        B : in     VECTOR) return VECTOR;
  19755.      
  19756.      
  19757. -- - P   => P [for I in X..Y loop P(I) := - P(I); end loop;]
  19758. -- P + P => P [for I in X..Y loop P(I) := PA(I) + PB(I); end loop;]
  19759. -- P - P => P [for I in X..Y loop P(I) := PA(I) - PB(I); end loop;]
  19760. -- P * P => P [for I in X..Y loop P(I) := PA(I) * PB(I); end loop;]
  19761. -- P / P => P [for I in X..Y loop P(I) := PA(I) / PB(I); end loop;]
  19762. --
  19763.    function "-"
  19764.       (A : in     POINT) return POINT;
  19765.      
  19766.    function "+"
  19767.       (A : in     POINT;
  19768.        B : in     POINT) return POINT;
  19769.      
  19770.    function "-"
  19771.       (A : in     POINT;
  19772.        B : in     POINT) return POINT;
  19773.      
  19774.    function "*"
  19775.       (A : in     POINT;
  19776.        B : in     POINT) return POINT;
  19777.      
  19778.    function "/"
  19779.        (A : in     POINT;
  19780.         B : in     POINT) return POINT;
  19781.      
  19782. -- P - P => V [for I in X..Y loop V(I) := PA(I) - PB(I); end loop;]
  19783.      
  19784.    function "-"
  19785.       (HEAD : in     POINT;
  19786.        TAIL : in     POINT) return VECTOR;
  19787.      
  19788. -- P + V => P [for I in X..Y loop P(I) := PA(I) + VB(I); end loop;]
  19789. -- V + P => P [for I in X..Y loop P(I) := VA(I) + PB(I); end loop;]
  19790. -- P - V => P [for I in X..Y loop P(I) := PA(I) - VB(I); end loop;]
  19791. -- V - P => P [for I in X..Y loop P(I) := VA(I) - PB(I); end loop;]
  19792.      
  19793.    function "+"
  19794.       (P : in     POINT;
  19795.        V : in     VECTOR) return POINT;
  19796.      
  19797.    function "+"
  19798.       (V : in     VECTOR;
  19799.        P : in     POINT) return POINT;
  19800.      
  19801.    function "-"
  19802.       (P : in     POINT;
  19803.        V : in     VECTOR) return POINT;
  19804.      
  19805.    function "-"
  19806.       (V : in     VECTOR;
  19807.        P : in     POINT) return POINT;
  19808.      
  19809. end DC_POINT_OPS;
  19810. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19811. --:UDD:GKSADACM:CODE:MA:DC_POINT_OPS_B.ADA
  19812. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  19813. ------------------------------------------------------------------
  19814. --
  19815. --  NAME: DC_POINT_OPS - BODY
  19816. --  IDENTIFIER: GDMXXX.1(1)
  19817. --  DISCREPANCY REPORTS:
  19818. --
  19819. ------------------------------------------------------------------
  19820. -- File: DC_POINT_OPS_B.ADA
  19821. -- Level: all
  19822.      
  19823. package body DC_POINT_OPS is
  19824.      
  19825.    use GKS_TYPES;
  19826.    use DC;
  19827.      
  19828.    function SQRT
  19829.       (X : in    FLOAT) return FLOAT is
  19830.      
  19831.    -- Compute the square root of X.
  19832.    -- Normally, a square root function would test for X < 0.0, but this
  19833.    -- function is never called with a negative number here.
  19834.    --
  19835.    -- X - positive number to take the square root of
  19836.    --
  19837.    -- Implementation note: This function uses FLOAT because the
  19838.    -- difference R - R0 could be zero (truncation effects, or just
  19839.    -- luck).
  19840.    -- This implementation is based on Newton-Raphson iteration for the
  19841.    -- roots of the function F(R) = R**2 - X.
  19842.    -- The Newton-Raphson iteration is:
  19843.    --    R' := R - F(R)/F'(R)
  19844.    -- Substituting F(R) = R**2 - X, and F'(R) = 2*R we get:
  19845.    --    R' := R - (R**2 - X)/(2*R)
  19846.    -- Rearranging:
  19847.    --    R' := R - (R**2 / R - X / R) / 2
  19848.    --    R' := R - (R - X / R) / 2
  19849.    --    R' := (R * 2 - R + X / R) / 2
  19850.    --    R' := (R + X / R) / 2
  19851.    -- Strength reduction, multiply instead of divide, yields:
  19852.    --    R' := (R + X/R) * 0.5
  19853.      
  19854.       R0 : FLOAT := 1.0;
  19855.       -- Previous guess at square root
  19856.      
  19857.       R : FLOAT := X;
  19858.       -- Next quess at square root
  19859.      
  19860.    begin
  19861.      
  19862.       while abs ((R - R0) / R) > 0.000001 loop
  19863.      
  19864.          R0 := R;
  19865.      
  19866.          R := (R + X / R) * 0.5;
  19867.      
  19868.       end loop;
  19869.      
  19870.       return R;
  19871.      
  19872.    end SQRT;
  19873.      
  19874.    function SQRT
  19875.       (X : in    MAGNITUDE) return MAGNITUDE is
  19876.      
  19877.    -- Square root of a MAGNITUDE (which is always positive)
  19878.    --
  19879.    -- X - MAGNITUDE to take the square root of
  19880.      
  19881.    begin
  19882.      
  19883.       return MAGNITUDE ( FLOAT' ( SQRT ( FLOAT(X) ) ));
  19884.      
  19885.    end SQRT;
  19886.      
  19887.    function DOT
  19888.       (A : in     VECTOR;
  19889.        B : in     VECTOR) return COORD is
  19890.      
  19891.    -- DOT product is sum of product of components
  19892.    --
  19893.    -- A - first vector of DOT product
  19894.    -- B - second vector of DOT product
  19895.      
  19896.    begin
  19897.      
  19898.       return (A.X * B.X) + (A.Y * B.Y);
  19899.      
  19900.    end DOT;
  19901.      
  19902.    function NORM
  19903.       (A : VECTOR) return MAGNITUDE is
  19904.      
  19905.    -- Return Euclidean length of a VECTOR as a MAGNITUDE
  19906.    --
  19907.    -- A - VECTOR whose length is sought
  19908.      
  19909.    begin
  19910.      
  19911.       return SQRT ( DC . MAGNITUDE ( DOT (A,A) ) );
  19912.       -- This is a simple algorithm.  Better numerical accuracy and
  19913.       -- greater functional domain can be had, but graphics do not
  19914.       -- require it.
  19915.      
  19916.    end NORM;
  19917.      
  19918.    function NORM
  19919.       (A : VECTOR) return COORD is
  19920.      
  19921.    -- Return Euclidean length of a VECTOR as a COORD
  19922.    --
  19923.    -- A - VECTOR whose length is sought
  19924.      
  19925.    begin
  19926.      
  19927.       return COORD ( MAGNITUDE' ( NORM(A) ) );
  19928.      
  19929.    end NORM;
  19930.      
  19931.    function DIST
  19932.       (A : in     POINT;
  19933.        B : in     POINT) return MAGNITUDE is
  19934.      
  19935.    -- Return Euclidean distance between two point as a MAGNITUDE
  19936.    --
  19937.    -- A - Starting point
  19938.    -- B - Ending point
  19939.      
  19940.    begin
  19941.      
  19942.       return NORM ( VECTOR' (A - B) );
  19943.      
  19944.    end DIST;
  19945.      
  19946.    function DIST
  19947.       (A : in     POINT;
  19948.        B : in     POINT) return COORD is
  19949.      
  19950.    -- Return Euclidean distance between two point as a COORD
  19951.    --
  19952.    -- A - Starting point
  19953.    -- B - Ending point
  19954.      
  19955.    begin
  19956.      
  19957.       return NORM ( VECTOR' (A - B) );
  19958.      
  19959.    end DIST;
  19960.      
  19961. -- Scalar operations: VECTOR and COORD
  19962.      
  19963.    function "*"
  19964.       (V : VECTOR;
  19965.        S : COORD) return VECTOR is
  19966.      
  19967.    -- Multiply a VECTOR by a COORD
  19968.    --
  19969.    -- V - Vector to be multiplied
  19970.    -- S - Scalar to multiply vector by
  19971.      
  19972.    begin
  19973.      
  19974.       return VECTOR '( V.X * S, V.Y * S);
  19975.      
  19976.    end "*";
  19977.      
  19978.    function "*"
  19979.       (S : COORD;
  19980.        V : VECTOR) return VECTOR is
  19981.      
  19982.    -- Multiply a COORD by a VECTOR
  19983.    --
  19984.    -- S - Scalar to multiply vector by
  19985.    -- V - Vector to be multiplied
  19986.      
  19987.    begin
  19988.      
  19989.       return VECTOR '( S * V.X, S * V.Y);
  19990.      
  19991.    end "*";
  19992.      
  19993.    function "/"
  19994.       (V : VECTOR;
  19995.        S : COORD) return VECTOR is
  19996.      
  19997.    -- Divide a VECTOR by a COORD
  19998.    --
  19999.    -- V - Vector to be divided
  20000.    -- S - Scalar to divide vector by
  20001.      
  20002.    begin
  20003.      
  20004.       return VECTOR '( V.X / S, V.Y / S);
  20005.      
  20006.    end "/";
  20007.      
  20008. -- Scalar operations: POINT and COORD
  20009.      
  20010.    function "*"
  20011.       (P : POINT;
  20012.        S : COORD) return POINT is
  20013.      
  20014.    -- Multiply a POINT by a COORD
  20015.    --
  20016.    -- P - POINT to be multiplied
  20017.    -- S - Scalar to multiply POINT by
  20018.      
  20019.    begin
  20020.      
  20021.       return POINT '( P.X * S, P.Y * S);
  20022.      
  20023.    end "*";
  20024.      
  20025.    function "*"
  20026.       (S : COORD;
  20027.        P : POINT) return POINT is
  20028.      
  20029.    -- Multiply a COORD by a POINT
  20030.    --
  20031.    -- S - Scalar to multiply POINT by
  20032.    -- P - POINT to be multiplied
  20033.      
  20034.    begin
  20035.      
  20036.       return POINT '( S * P.X, S * P.Y);
  20037.      
  20038.    end "*";
  20039.      
  20040.    function "/"
  20041.       (P : POINT;
  20042.        S : COORD) return POINT is
  20043.      
  20044.    -- Divide a POINT by a COORD
  20045.    --
  20046.    -- P - POINT to be divided
  20047.    -- S - Scalar to divide POINT by
  20048.      
  20049.    begin
  20050.      
  20051.       return POINT '( P.X / S, P.Y / S);
  20052.      
  20053.    end "/";
  20054.      
  20055. -- Scalar operations: VECTOR and MAGNITUDE
  20056.      
  20057.    function "*"
  20058.       (V : VECTOR;
  20059.        S : MAGNITUDE) return VECTOR is
  20060.      
  20061.    -- Multiply a VECTOR by a MAGNITUDE
  20062.    --
  20063.    -- V - Vector to be multiplied
  20064.    -- S - Scalar to multiply vector by
  20065.      
  20066.       C : COORD := COORD ( S );
  20067.       -- Convert S to a COORD
  20068.      
  20069.    begin
  20070.      
  20071.       return VECTOR '( V.X * C, V.Y * C);
  20072.      
  20073.    end "*";
  20074.      
  20075.    function "*"
  20076.       (S : MAGNITUDE;
  20077.        V : VECTOR) return VECTOR is
  20078.      
  20079.    -- Multiply a MAGNITUDE by a VECTOR
  20080.    --
  20081.    -- S - Scalar to multiply vector by
  20082.    -- V - Vector to be multiplied
  20083.      
  20084.       C : COORD := COORD ( S );
  20085.       -- Convert S to a COORD
  20086.      
  20087.    begin
  20088.      
  20089.       return VECTOR '( C * V.X, C * V.Y);
  20090.      
  20091.    end "*";
  20092.      
  20093.    function "/"
  20094.       (V : VECTOR;
  20095.        S : MAGNITUDE) return VECTOR is
  20096.      
  20097.    -- Divide a VECTOR by a MAGNITUDE
  20098.    --
  20099.    -- V - Vector to be divided
  20100.    -- S - Scalar to divide vector by
  20101.      
  20102.       C : COORD := COORD ( S );
  20103.       -- Convert S to a COORD
  20104.      
  20105.    begin
  20106.      
  20107.       return VECTOR '( V.X / C, V.Y / C);
  20108.      
  20109.    end "/";
  20110.      
  20111. -- Scalar operations: POINT and MAGNITUDE
  20112.      
  20113.    function "*"
  20114.       (P : POINT;
  20115.        S : MAGNITUDE) return POINT is
  20116.      
  20117.    -- Multiply a POINT by a MAGNITUDE
  20118.    --
  20119.    -- P - POINT to be multiplied
  20120.    -- S - Scalar to multiply POINT by
  20121.      
  20122.       C : COORD := COORD ( S );
  20123.       -- Convert S to a COORD
  20124.      
  20125.    begin
  20126.      
  20127.       return POINT '( P.X * C, P.Y * C);
  20128.      
  20129.    end "*";
  20130.      
  20131.    function "*"
  20132.       (S : MAGNITUDE;
  20133.        P : POINT) return POINT is
  20134.      
  20135.    -- Multiply a MAGNITUDE by a POINT
  20136.    --
  20137.    -- S - Scalar to multiply POINT by
  20138.    -- P - POINT to be multiplied
  20139.      
  20140.       C : COORD := COORD ( S );
  20141.       -- Convert S to a COORD
  20142.      
  20143.    begin
  20144.      
  20145.       return POINT '( C * P.X, C * P.Y);
  20146.      
  20147.    end "*";
  20148.      
  20149.    function "/"
  20150.       (P : POINT;
  20151.        S : MAGNITUDE) return POINT is
  20152.      
  20153.    -- Divide a POINT by a MAGNITUDE
  20154.    --
  20155.    -- P - POINT to be divided
  20156.    -- S - Scalar to divide POINT by
  20157.      
  20158.       C : COORD := COORD ( S );
  20159.       -- Convert S to a COORD
  20160.      
  20161.    begin
  20162.      
  20163.       return POINT '( P.X / C, P.Y / C);
  20164.      
  20165.    end "/";
  20166.      
  20167.    --
  20168.    -- VECTOR op VECTOR ==> VECTOR
  20169.    --
  20170.      
  20171.    function "-"
  20172.       ( A : VECTOR) return VECTOR is
  20173.      
  20174.    -- Negate a VECTOR
  20175.    --
  20176.    -- A - a VECTOR
  20177.      
  20178.    begin
  20179.      
  20180.       return VECTOR '( -A.X, -A.Y);
  20181.      
  20182.    end "-";
  20183.      
  20184.    function "-"
  20185.       (A : VECTOR;
  20186.        B : VECTOR) return VECTOR is
  20187.      
  20188.    -- Subtract two VECTORs
  20189.    --
  20190.    -- A - a VECTOR
  20191.    -- B - a VECTOR to subtract from `A'
  20192.      
  20193.    begin
  20194.      
  20195.       return VECTOR '( A.X - B.X, A.Y - B.Y);
  20196.      
  20197.    end "-";
  20198.      
  20199.    function "+"
  20200.       (A : VECTOR;
  20201.        B : VECTOR) return VECTOR is
  20202.      
  20203.    -- Add two VECTORs
  20204.    --
  20205.    -- A - a VECTOR
  20206.    -- B - a VECTOR to add to `A'
  20207.      
  20208.    begin
  20209.      
  20210.       return VECTOR '( A.X + B.X, A.Y + B.Y);
  20211.      
  20212.    end "+";
  20213.      
  20214.    function "*"
  20215.       (A : VECTOR;
  20216.        B : VECTOR) return VECTOR is
  20217.      
  20218.    -- Multiply two VECTORs
  20219.    --
  20220.    -- A - a VECTOR
  20221.    -- B - a VECTOR to multiply `A' by (component-wise)
  20222.      
  20223.    begin
  20224.      
  20225.       return VECTOR '( A.X * B.X, A.Y * B.Y);
  20226.      
  20227.    end "*";
  20228.      
  20229.    function "/"
  20230.       (A : VECTOR;
  20231.        B : VECTOR) return VECTOR is
  20232.      
  20233.    -- Divide two VECTORs
  20234.    --
  20235.    -- A - a VECTOR
  20236.    -- B - a VECTOR to divide `A' by (component-wise)
  20237.      
  20238.    begin
  20239.      
  20240.       return VECTOR '( A.X / B.X, A.Y / B.Y);
  20241.      
  20242.    end "/";
  20243.      
  20244.    --
  20245.    -- POINT op POINT ==> POINT
  20246.    --
  20247.      
  20248.    function "-"
  20249.       ( A : POINT) return POINT is
  20250.      
  20251.    -- Negate a POINT
  20252.    --
  20253.    -- A - a POINT
  20254.      
  20255.    begin
  20256.      
  20257.       return POINT '( -A.X, -A.Y);
  20258.      
  20259.    end "-";
  20260.      
  20261.    function "-"
  20262.       (A : POINT;
  20263.        B : POINT) return POINT is
  20264.      
  20265.    -- Subtract two POINTs
  20266.    --
  20267.    -- A - a POINT
  20268.    -- B - a POINT to subtract from `A'
  20269.      
  20270.    begin
  20271.      
  20272.       return POINT '( A.X - B.X, A.Y - B.Y);
  20273.      
  20274.    end "-";
  20275.      
  20276.    function "+"
  20277.       (A : POINT;
  20278.        B : POINT) return POINT is
  20279.      
  20280.    -- Add two POINTs
  20281.    --
  20282.    -- A - a POINT
  20283.    -- B - a POINT to add to `A'
  20284.      
  20285.    begin
  20286.      
  20287.       return POINT '( A.X + B.X, A.Y + B.Y);
  20288.      
  20289.    end "+";
  20290.      
  20291.    function "*"
  20292.       (A : POINT;
  20293.        B : POINT) return POINT is
  20294.      
  20295.    -- Multiply two POINTs
  20296.    --
  20297.    -- A - a POINT
  20298.    -- B - a POINT to multiply `A' by (component-wise)
  20299.      
  20300.    begin
  20301.      
  20302.       return POINT '( A.X * B.X, A.Y * B.Y);
  20303.      
  20304.    end "*";
  20305.      
  20306.    function "/"
  20307.       (A : POINT;
  20308.        B : POINT) return POINT is
  20309.      
  20310.    -- Divide two POINTs
  20311.    --
  20312.    -- A - a POINT
  20313.    -- B - a POINT to divide `A' by (component-wise)
  20314.      
  20315.    begin
  20316.      
  20317.       return POINT '( A.X / B.X, A.Y / B.Y);
  20318.      
  20319.    end "/";
  20320.      
  20321. -- Functions mixing VECTOR and POINT
  20322.      
  20323.    function "-"
  20324.       (HEAD : POINT;
  20325.        TAIL : POINT) return VECTOR is
  20326.      
  20327.    -- Subtract two POINTs yielding a VECTOR
  20328.    --
  20329.    -- A - a displacement POINT
  20330.    -- B - a reference POINT to subtract from `A'
  20331.      
  20332.    begin
  20333.      
  20334.       return VECTOR '( HEAD.X - TAIL.X, HEAD.Y - TAIL.Y);
  20335.      
  20336.    end "-";
  20337.      
  20338.    function "+"
  20339.       (P : POINT;
  20340.        V : VECTOR) return POINT is
  20341.      
  20342.    -- Add a VECTOR to a POINT yielding a POINT
  20343.    --
  20344.    -- P - a reference POINT
  20345.    -- V - a displacement VECTOR to add to `A'
  20346.      
  20347.    begin
  20348.      
  20349.       return POINT '( P.X + V.X, P.Y + V.Y);
  20350.      
  20351.    end "+";
  20352.      
  20353.    function "+"
  20354.       (V : VECTOR;
  20355.        P : POINT) return POINT is
  20356.      
  20357.    -- Add a VECTOR to a POINT yielding a POINT
  20358.    --
  20359.    -- V - a displacement VECTOR to add to `A'
  20360.    -- P - a reference POINT
  20361.      
  20362.    begin
  20363.      
  20364.       return POINT '( V.X + P.X, V.Y + P.Y);
  20365.      
  20366.    end "+";
  20367.      
  20368.    function "-"
  20369.       (P : POINT;
  20370.        V : VECTOR) return POINT is
  20371.      
  20372.    -- Subtract a VECTOR from a POINT yielding a POINT
  20373.    --
  20374.    -- P - a reference POINT
  20375.    -- V - a displacement VECTOR to subtract from `A'
  20376.      
  20377.    begin
  20378.      
  20379.       return POINT '( P.X - V.X, P.Y - V.Y);
  20380.      
  20381.    end "-";
  20382.      
  20383.    function "-"
  20384.       (V : VECTOR;
  20385.        P : POINT) return POINT is
  20386.      
  20387.    -- Subtract a VECTOR from a POINT yielding a POINT
  20388.    --
  20389.    -- V - a displacement VECTOR
  20390.    -- P - a reference POINT to subtract from `A'
  20391.      
  20392.    begin
  20393.      
  20394.       return POINT '( V.X - P.X, V.Y - P.Y);
  20395.      
  20396.    end "-";
  20397.      
  20398. end DC_POINT_OPS;
  20399. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20400. --:UDD:GKSADACM:CODE:MA:NDC_POINT_OPS.ADA
  20401. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20402. ------------------------------------------------------------------
  20403. --
  20404. --  NAME: NDC_POINT_OPS
  20405. --  IDENTIFIER: GDMXXX.1(1)
  20406. --  DISCREPANCY REPORTS:
  20407. --
  20408. ------------------------------------------------------------------
  20409. -- File: NDC_POINT_OPS.ADA
  20410. -- Level: all
  20411.      
  20412. with GKS_TYPES;
  20413.      
  20414. use GKS_TYPES;
  20415.      
  20416. package NDC_POINT_OPS is
  20417.      
  20418. -- Package NDC_POINT_OPS provides extended functionality to the POINT
  20419. -- and VECTOR types defined in package NDC, an instance of
  20420. -- GKS_COORDINATE_SYSTEM.  The extensions are functions which perform
  20421. -- commonly desired operations on points and vectors.
  20422. --
  20423. -- The functions are grouped by the argument and result types, and
  20424. -- perform well-known mathematical functions:
  20425. --      DOT             vector dot product
  20426. --      NORM            the norm or length of a vector
  20427. --      DIST            Euclidean distance between points
  20428. --      "*"             Multiply VECTOR or POINT by a NDC_TYPE or
  20429. --                      NDC . MAGNITUDE and vice versa
  20430. --      "/"             Divide VECTOR or POINT by a NDC_TYPE or
  20431. --                      NDC . MAGNITUDE
  20432. --      "-"             Negative of a VECTOR or a POINT
  20433. --      "+","-"         Sum or difference of a VECTOR or a POINT
  20434. --      "+","-"         Mixed sums of VECTORs and POINTs with POINTs
  20435. --                      regarded as absolute positions and VECTORs as
  20436. --                      relative displacements.
  20437. --
  20438. -- One set of functions is somewhat unconventional:
  20439. --      "*","/"         Coordinate-wise multiply or divide of a VECTOR
  20440. --                      or a POINT
  20441. --
  20442. -- Because POINT and VECTOR are record types, not array types, it is
  20443. -- clumsy to use them as generic parameters, but see packages DC_OPS and
  20444. -- NDC_OPS for an instance of this technique. Instead of a generic
  20445. -- extension to GKS_COORDINATE_SYSTEM, this package directly implements
  20446. -- extensions to package NDC.
  20447. --
  20448. -- IMPORTANT, IMPLEMENTATION RESTRICTION:
  20449. -- A sister package, DC_POINT_OPS was generated from this one by
  20450. -- swapping all occurrences of the strings "DC" and "NDC".  By avoiding
  20451. -- any other use of these strings, an easy pseudo-generic instantiation
  20452. -- is made. Even comments should follow this rule.
  20453.      
  20454.    use NDC;
  20455.      
  20456.    subtype COORD is NDC_TYPE;
  20457.    subtype MAGNITUDE is NDC . MAGNITUDE;
  20458.      
  20459. -- DOT(V, V) => S  DOT PRODUCT
  20460. -- NORM(V)   => S  [S := SQRT( DOT(V,V) );]
  20461.      
  20462.    function DOT
  20463.       (A : in     VECTOR;
  20464.        B : in     VECTOR) return COORD;
  20465.      
  20466.    function NORM
  20467.       (A : in     VECTOR) return COORD;
  20468.      
  20469.    function NORM
  20470.       (A : in     VECTOR) return MAGNITUDE;
  20471.      
  20472.    function DIST
  20473.       (A : in     POINT;
  20474.        B : in     POINT) return COORD;
  20475.      
  20476.    function DIST
  20477.       (A : in     POINT;
  20478.        B : in     POINT) return MAGNITUDE;
  20479.      
  20480. -- Scalar operations
  20481.      
  20482.    function "*"
  20483.       (V : in     VECTOR;
  20484.        S : in     COORD) return VECTOR;
  20485.      
  20486.    function "*"
  20487.       (S : in     COORD;
  20488.        V : in     VECTOR) return VECTOR;
  20489.      
  20490.    function "/"
  20491.       (V : in     VECTOR;
  20492.        S : in     COORD) return VECTOR;
  20493.      
  20494.    function "*"
  20495.       (V : in     VECTOR;
  20496.        S : in     MAGNITUDE) return VECTOR;
  20497.      
  20498.    function "*"
  20499.       (S : in     MAGNITUDE;
  20500.        V : in     VECTOR) return VECTOR;
  20501.      
  20502.    function "/"
  20503.       (V : in     VECTOR;
  20504.        S : in     MAGNITUDE) return VECTOR;
  20505.      
  20506.    function "*"
  20507.       (P : in     POINT;
  20508.        S : in     COORD) return POINT;
  20509.      
  20510.    function "*"
  20511.       (S : in     COORD;
  20512.        P : in     POINT) return POINT;
  20513.      
  20514.    function "/"
  20515.       (P : in     POINT;
  20516.        S : in     COORD) return POINT;
  20517.      
  20518.    function "*"
  20519.       (P : in     POINT;
  20520.        S : in     MAGNITUDE) return POINT;
  20521.      
  20522.    function "*"
  20523.       (S : in     MAGNITUDE;
  20524.        P : in     POINT) return POINT;
  20525.      
  20526.    function "/"
  20527.       (P : in     POINT;
  20528.        S : in     MAGNITUDE) return POINT;
  20529.      
  20530. -- - V   => V [for I in X..Y loop V(I) := - V(I); end loop;]
  20531. -- V + V => V [for I in X..Y loop V(I) := VA(I) + VB(I); end loop;]
  20532. -- V - V => V [for I in X..Y loop V(I) := VA(I) - VB(I); end loop;]
  20533. -- V * V => V [for I in X..Y loop V(I) := VA(I) * VB(I); end loop;]
  20534. -- V / V => V [for I in X..Y loop V(I) := VA(I) / VB(I); end loop;]
  20535.      
  20536.    function "-"
  20537.       (A: in     VECTOR) return VECTOR;
  20538.      
  20539.    function "+"
  20540.       (A : in     VECTOR;
  20541.        B : in     VECTOR) return VECTOR;
  20542.      
  20543.    function "-"
  20544.       (A : in     VECTOR;
  20545.        B : in     VECTOR) return VECTOR;
  20546.      
  20547.    function "*"
  20548.       (A : in     VECTOR;
  20549.        B : in     VECTOR) return VECTOR;
  20550.      
  20551.    function "/"
  20552.       (A : in     VECTOR;
  20553.        B : in     VECTOR) return VECTOR;
  20554.      
  20555.      
  20556. -- - P   => P [for I in X..Y loop P(I) := - P(I); end loop;]
  20557. -- P + P => P [for I in X..Y loop P(I) := PA(I) + PB(I); end loop;]
  20558. -- P - P => P [for I in X..Y loop P(I) := PA(I) - PB(I); end loop;]
  20559. -- P * P => P [for I in X..Y loop P(I) := PA(I) * PB(I); end loop;]
  20560. -- P / P => P [for I in X..Y loop P(I) := PA(I) / PB(I); end loop;]
  20561. --
  20562.    function "-"
  20563.       (A : in     POINT) return POINT;
  20564.      
  20565.    function "+"
  20566.       (A : in     POINT;
  20567.        B : in     POINT) return POINT;
  20568.      
  20569.    function "-"
  20570.       (A : in     POINT;
  20571.        B : in     POINT) return POINT;
  20572.      
  20573.    function "*"
  20574.       (A : in     POINT;
  20575.        B : in     POINT) return POINT;
  20576.      
  20577.    function "/"
  20578.        (A : in     POINT;
  20579.         B : in     POINT) return POINT;
  20580.      
  20581. -- P - P => V [for I in X..Y loop V(I) := PA(I) - PB(I); end loop;]
  20582.      
  20583.    function "-"
  20584.       (HEAD : in     POINT;
  20585.        TAIL : in     POINT) return VECTOR;
  20586.      
  20587. -- P + V => P [for I in X..Y loop P(I) := PA(I) + VB(I); end loop;]
  20588. -- V + P => P [for I in X..Y loop P(I) := VA(I) + PB(I); end loop;]
  20589. -- P - V => P [for I in X..Y loop P(I) := PA(I) - VB(I); end loop;]
  20590. -- V - P => P [for I in X..Y loop P(I) := VA(I) - PB(I); end loop;]
  20591.      
  20592.    function "+"
  20593.       (P : in     POINT;
  20594.        V : in     VECTOR) return POINT;
  20595.      
  20596.    function "+"
  20597.       (V : in     VECTOR;
  20598.        P : in     POINT) return POINT;
  20599.      
  20600.    function "-"
  20601.       (P : in     POINT;
  20602.        V : in     VECTOR) return POINT;
  20603.      
  20604.    function "-"
  20605.       (V : in     VECTOR;
  20606.        P : in     POINT) return POINT;
  20607.      
  20608. end NDC_POINT_OPS;
  20609. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20610. --:UDD:GKSADACM:CODE:MA:NDC_POINT_OPS_B.ADA
  20611. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  20612. ------------------------------------------------------------------
  20613. --
  20614. --  NAME: NDC_POINT_OPS - BODY
  20615. --  IDENTIFIER: GDMXXX.1(1)
  20616. --  DISCREPANCY REPORTS:
  20617. --
  20618. ------------------------------------------------------------------
  20619. -- File: NDC_POINT_OPS_B.ADA
  20620. -- Level: all
  20621.      
  20622. package body NDC_POINT_OPS is
  20623.      
  20624.    use GKS_TYPES;
  20625.    use NDC;
  20626.      
  20627.    function SQRT
  20628.       (X : in    FLOAT) return FLOAT is
  20629.      
  20630.    -- Compute the square root of X.
  20631.    -- Normally, a square root function would test for X < 0.0, but this
  20632.    -- function is never called with a negative number here.
  20633.    --
  20634.    -- X - positive number to take the square root of
  20635.    --
  20636.    -- Implementation note: This function uses FLOAT because the
  20637.    -- difference R - R0 could be zero (truncation effects, or just
  20638.    -- luck).
  20639.    -- This implementation is based on Newton-Raphson iteration for the
  20640.    -- roots of the function F(R) = R**2 - X.
  20641.    -- The Newton-Raphson iteration is:
  20642.    --    R' := R - F(R)/F'(R)
  20643.    -- Substituting F(R) = R**2 - X, and F'(R) = 2*R we get:
  20644.    --    R' := R - (R**2 - X)/(2*R)
  20645.    -- Rearranging:
  20646.    --    R' := R - (R**2 / R - X / R) / 2
  20647.    --    R' := R - (R - X / R) / 2
  20648.    --    R' := (R * 2 - R + X / R) / 2
  20649.    --    R' := (R + X / R) / 2
  20650.    -- Strength reduction, multiply instead of divide, yields:
  20651.    --    R' := (R + X/R) * 0.5
  20652.      
  20653.       R0 : FLOAT := 1.0;
  20654.       -- Previous guess at square root
  20655.      
  20656.       R : FLOAT := X;
  20657.       -- Next quess at square root
  20658.      
  20659.    begin
  20660.      
  20661.       while abs ((R - R0) / R) > 0.000001 loop
  20662.      
  20663.          R0 := R;
  20664.      
  20665.          R := (R + X / R) * 0.5;
  20666.      
  20667.       end loop;
  20668.      
  20669.       return R;
  20670.      
  20671.    end SQRT;
  20672.      
  20673.    function SQRT
  20674.       (X : in    MAGNITUDE) return MAGNITUDE is
  20675.      
  20676.    -- Square root of a MAGNITUDE (which is always positive)
  20677.    --
  20678.    -- X - MAGNITUDE to take the square root of
  20679.      
  20680.    begin
  20681.      
  20682.       return MAGNITUDE ( FLOAT' ( SQRT ( FLOAT(X) ) ) );
  20683.      
  20684.    end SQRT;
  20685.      
  20686.    function DOT
  20687.       (A : in     VECTOR;
  20688.        B : in     VECTOR) return COORD is
  20689.      
  20690.    -- DOT product is sum of product of components
  20691.    --
  20692.    -- A - first vector of DOT product
  20693.    -- B - second vector of DOT product
  20694.      
  20695.    begin
  20696.      
  20697.       return (A.X * B.X) + (A.Y * B.Y);
  20698.      
  20699.    end DOT;
  20700.      
  20701.    function NORM
  20702.       (A : VECTOR) return MAGNITUDE is
  20703.      
  20704.    -- Return Euclidean length of a VECTOR as a MAGNITUDE
  20705.    --
  20706.    -- A - VECTOR whose length is sought
  20707.      
  20708.    begin
  20709.      
  20710.       return SQRT ( NDC . MAGNITUDE ( DOT (A,A) ) );
  20711.       -- This is a simple algorithm.  Better numerical accuracy and
  20712.       -- greater functional domain can be had, but graphics do not
  20713.       -- require it.
  20714.      
  20715.    end NORM;
  20716.      
  20717.    function NORM
  20718.       (A : VECTOR) return COORD is
  20719.      
  20720.    -- Return Euclidean length of a VECTOR as a COORD
  20721.    --
  20722.    -- A - VECTOR whose length is sought
  20723.      
  20724.    begin
  20725.      
  20726.       return COORD ( MAGNITUDE' ( NORM(A) ) );
  20727.      
  20728.    end NORM;
  20729.      
  20730.    function DIST
  20731.       (A : in     POINT;
  20732.        B : in     POINT) return MAGNITUDE is
  20733.      
  20734.    -- Return Euclidean distance between two point as a MAGNITUDE
  20735.    --
  20736.    -- A - Starting point
  20737.    -- B - Ending point
  20738.      
  20739.    begin
  20740.      
  20741.       return NORM ( VECTOR' (A - B) );
  20742.      
  20743.    end DIST;
  20744.      
  20745.    function DIST
  20746.       (A : in     POINT;
  20747.        B : in     POINT) return COORD is
  20748.      
  20749.    -- Return Euclidean distance between two point as a COORD
  20750.    --
  20751.    -- A - Starting point
  20752.    -- B - Ending point
  20753.      
  20754.    begin
  20755.      
  20756.       return NORM ( VECTOR' (A - B) );
  20757.      
  20758.    end DIST;
  20759.      
  20760. -- Scalar operations: VECTOR and COORD
  20761.      
  20762.    function "*"
  20763.       (V : VECTOR;
  20764.        S : COORD) return VECTOR is
  20765.      
  20766.    -- Multiply a VECTOR by a COORD
  20767.    --
  20768.    -- V - Vector to be multiplied
  20769.    -- S - Scalar to multiply vector by
  20770.      
  20771.    begin
  20772.      
  20773.       return VECTOR '( V.X * S, V.Y * S);
  20774.      
  20775.    end "*";
  20776.      
  20777.    function "*"
  20778.       (S : COORD;
  20779.        V : VECTOR) return VECTOR is
  20780.      
  20781.    -- Multiply a COORD by a VECTOR
  20782.    --
  20783.    -- S - Scalar to multiply vector by
  20784.    -- V - Vector to be multiplied
  20785.      
  20786.    begin
  20787.      
  20788.       return VECTOR '( S * V.X, S * V.Y);
  20789.      
  20790.    end "*";
  20791.      
  20792.    function "/"
  20793.       (V : VECTOR;
  20794.        S : COORD) return VECTOR is
  20795.      
  20796.    -- Divide a VECTOR by a COORD
  20797.    --
  20798.    -- V - Vector to be divided
  20799.    -- S - Scalar to divide vector by
  20800.      
  20801.    begin
  20802.      
  20803.       return VECTOR '( V.X / S, V.Y / S);
  20804.      
  20805.    end "/";
  20806.      
  20807. -- Scalar operations: POINT and COORD
  20808.      
  20809.    function "*"
  20810.       (P : POINT;
  20811.        S : COORD) return POINT is
  20812.      
  20813.    -- Multiply a POINT by a COORD
  20814.    --
  20815.    -- P - POINT to be multiplied
  20816.    -- S - Scalar to multiply POINT by
  20817.      
  20818.    begin
  20819.      
  20820.       return POINT '( P.X * S, P.Y * S);
  20821.      
  20822.    end "*";
  20823.      
  20824.    function "*"
  20825.       (S : COORD;
  20826.        P : POINT) return POINT is
  20827.      
  20828.    -- Multiply a COORD by a POINT
  20829.    --
  20830.    -- S - Scalar to multiply POINT by
  20831.    -- P - POINT to be multiplied
  20832.      
  20833.    begin
  20834.      
  20835.       return POINT '( S * P.X, S * P.Y);
  20836.      
  20837.    end "*";
  20838.      
  20839.    function "/"
  20840.       (P : POINT;
  20841.        S : COORD) return POINT is
  20842.      
  20843.    -- Divide a POINT by a COORD
  20844.    --
  20845.    -- P - POINT to be divided
  20846.    -- S - Scalar to divide POINT by
  20847.      
  20848.    begin
  20849.      
  20850.       return POINT '( P.X / S, P.Y / S);
  20851.      
  20852.    end "/";
  20853.      
  20854. -- Scalar operations: VECTOR and MAGNITUDE
  20855.      
  20856.    function "*"
  20857.       (V : VECTOR;
  20858.        S : MAGNITUDE) return VECTOR is
  20859.      
  20860.    -- Multiply a VECTOR by a MAGNITUDE
  20861.    --
  20862.    -- V - Vector to be multiplied
  20863.    -- S - Scalar to multiply vector by
  20864.      
  20865.       C : COORD := COORD ( S );
  20866.       -- Convert S to a COORD
  20867.      
  20868.    begin
  20869.      
  20870.       return VECTOR '( V.X * C, V.Y * C);
  20871.      
  20872.    end "*";
  20873.      
  20874.    function "*"
  20875.       (S : MAGNITUDE;
  20876.        V : VECTOR) return VECTOR is
  20877.      
  20878.    -- Multiply a MAGNITUDE by a VECTOR
  20879.    --
  20880.    -- S - Scalar to multiply vector by
  20881.    -- V - Vector to be multiplied
  20882.      
  20883.       C : COORD := COORD ( S );
  20884.       -- Convert S to a COORD
  20885.      
  20886.    begin
  20887.      
  20888.       return VECTOR '( C * V.X, C * V.Y);
  20889.      
  20890.    end "*";
  20891.      
  20892.    function "/"
  20893.       (V : VECTOR;
  20894.        S : MAGNITUDE) return VECTOR is
  20895.      
  20896.    -- Divide a VECTOR by a MAGNITUDE
  20897.    --
  20898.    -- V - Vector to be divided
  20899.    -- S - Scalar to divide vector by
  20900.      
  20901.       C : COORD := COORD ( S );
  20902.       -- Convert S to a COORD
  20903.      
  20904.    begin
  20905.      
  20906.       return VECTOR '( V.X / C, V.Y / C);
  20907.      
  20908.    end "/";
  20909.      
  20910. -- Scalar operations: POINT and MAGNITUDE
  20911.      
  20912.    function "*"
  20913.       (P : POINT;
  20914.        S : MAGNITUDE) return POINT is
  20915.      
  20916.    -- Multiply a POINT by a MAGNITUDE
  20917.    --
  20918.    -- P - POINT to be multiplied
  20919.    -- S - Scalar to multiply POINT by
  20920.      
  20921.       C : COORD := COORD ( S );
  20922.       -- Convert S to a COORD
  20923.      
  20924.    begin
  20925.      
  20926.       return POINT '( P.X * C, P.Y * C);
  20927.      
  20928.    end "*";
  20929.      
  20930.    function "*"
  20931.       (S : MAGNITUDE;
  20932.        P : POINT) return POINT is
  20933.      
  20934.    -- Multiply a MAGNITUDE by a POINT
  20935.    --
  20936.    -- S - Scalar to multiply POINT by
  20937.    -- P - POINT to be multiplied
  20938.      
  20939.       C : COORD := COORD ( S );
  20940.       -- Convert S to a COORD
  20941.      
  20942.    begin
  20943.      
  20944.       return POINT '( C * P.X, C * P.Y);
  20945.      
  20946.    end "*";
  20947.      
  20948.    function "/"
  20949.       (P : POINT;
  20950.        S : MAGNITUDE) return POINT is
  20951.      
  20952.    -- Divide a POINT by a MAGNITUDE
  20953.    --
  20954.    -- P - POINT to be divided
  20955.    -- S - Scalar to divide POINT by
  20956.      
  20957.       C : COORD := COORD ( S );
  20958.       -- Convert S to a COORD
  20959.      
  20960.    begin
  20961.      
  20962.       return POINT '( P.X / C, P.Y / C);
  20963.      
  20964.    end "/";
  20965.      
  20966.    --
  20967.    -- VECTOR op VECTOR ==> VECTOR
  20968.    --
  20969.      
  20970.    function "-"
  20971.       ( A : VECTOR) return VECTOR is
  20972.      
  20973.    -- Negate a VECTOR
  20974.    --
  20975.    -- A - a VECTOR
  20976.      
  20977.    begin
  20978.      
  20979.       return VECTOR '( -A.X, -A.Y);
  20980.      
  20981.    end "-";
  20982.      
  20983.    function "-"
  20984.       (A : VECTOR;
  20985.        B : VECTOR) return VECTOR is
  20986.      
  20987.    -- Subtract two VECTORs
  20988.    --
  20989.    -- A - a VECTOR
  20990.    -- B - a VECTOR to subtract from `A'
  20991.      
  20992.    begin
  20993.      
  20994.       return VECTOR '( A.X - B.X, A.Y - B.Y);
  20995.      
  20996.    end "-";
  20997.      
  20998.    function "+"
  20999.       (A : VECTOR;
  21000.        B : VECTOR) return VECTOR is
  21001.      
  21002.    -- Add two VECTORs
  21003.    --
  21004.    -- A - a VECTOR
  21005.    -- B - a VECTOR to add to `A'
  21006.      
  21007.    begin
  21008.      
  21009.       return VECTOR '( A.X + B.X, A.Y + B.Y);
  21010.      
  21011.    end "+";
  21012.      
  21013.    function "*"
  21014.       (A : VECTOR;
  21015.        B : VECTOR) return VECTOR is
  21016.      
  21017.    -- Multiply two VECTORs
  21018.    --
  21019.    -- A - a VECTOR
  21020.    -- B - a VECTOR to multiply `A' by (component-wise)
  21021.      
  21022.    begin
  21023.      
  21024.       return VECTOR '( A.X * B.X, A.Y * B.Y);
  21025.      
  21026.    end "*";
  21027.      
  21028.    function "/"
  21029.       (A : VECTOR;
  21030.        B : VECTOR) return VECTOR is
  21031.      
  21032.    -- Divide two VECTORs
  21033.    --
  21034.    -- A - a VECTOR
  21035.    -- B - a VECTOR to divide `A' by (component-wise)
  21036.      
  21037.    begin
  21038.      
  21039.       return VECTOR '( A.X / B.X, A.Y / B.Y);
  21040.      
  21041.    end "/";
  21042.      
  21043.    --
  21044.    -- POINT op POINT ==> POINT
  21045.    --
  21046.      
  21047.    function "-"
  21048.       ( A : POINT) return POINT is
  21049.      
  21050.    -- Negate a POINT
  21051.    --
  21052.    -- A - a POINT
  21053.      
  21054.    begin
  21055.      
  21056.       return POINT '( -A.X, -A.Y);
  21057.      
  21058.    end "-";
  21059.      
  21060.    function "-"
  21061.       (A : POINT;
  21062.        B : POINT) return POINT is
  21063.      
  21064.    -- Subtract two POINTs
  21065.    --
  21066.    -- A - a POINT
  21067.    -- B - a POINT to subtract from `A'
  21068.      
  21069.    begin
  21070.      
  21071.       return POINT '( A.X - B.X, A.Y - B.Y);
  21072.      
  21073.    end "-";
  21074.      
  21075.    function "+"
  21076.       (A : POINT;
  21077.        B : POINT) return POINT is
  21078.      
  21079.    -- Add two POINTs
  21080.    --
  21081.    -- A - a POINT
  21082.    -- B - a POINT to add to `A'
  21083.      
  21084.    begin
  21085.      
  21086.       return POINT '( A.X + B.X, A.Y + B.Y);
  21087.      
  21088.    end "+";
  21089.      
  21090.    function "*"
  21091.       (A : POINT;
  21092.        B : POINT) return POINT is
  21093.      
  21094.    -- Multiply two POINTs
  21095.    --
  21096.    -- A - a POINT
  21097.    -- B - a POINT to multiply `A' by (component-wise)
  21098.      
  21099.    begin
  21100.      
  21101.       return POINT '( A.X * B.X, A.Y * B.Y);
  21102.      
  21103.    end "*";
  21104.      
  21105.    function "/"
  21106.       (A : POINT;
  21107.        B : POINT) return POINT is
  21108.      
  21109.    -- Divide two POINTs
  21110.    --
  21111.    -- A - a POINT
  21112.    -- B - a POINT to divide `A' by (component-wise)
  21113.      
  21114.    begin
  21115.      
  21116.       return POINT '( A.X / B.X, A.Y / B.Y);
  21117.      
  21118.    end "/";
  21119.      
  21120. -- Functions mixing VECTOR and POINT
  21121.      
  21122.    function "-"
  21123.       (HEAD : POINT;
  21124.        TAIL : POINT) return VECTOR is
  21125.      
  21126.    -- Subtract two POINTs yielding a VECTOR
  21127.    --
  21128.    -- A - a displacement POINT
  21129.    -- B - a reference POINT to subtract from `A'
  21130.      
  21131.    begin
  21132.      
  21133.       return VECTOR '( HEAD.X - TAIL.X, HEAD.Y - TAIL.Y);
  21134.      
  21135.    end "-";
  21136.      
  21137.    function "+"
  21138.       (P : POINT;
  21139.        V : VECTOR) return POINT is
  21140.      
  21141.    -- Add a VECTOR to a POINT yielding a POINT
  21142.    --
  21143.    -- P - a reference POINT
  21144.    -- V - a displacement VECTOR to add to `A'
  21145.      
  21146.    begin
  21147.      
  21148.       return POINT '( P.X + V.X, P.Y + V.Y);
  21149.      
  21150.    end "+";
  21151.      
  21152.    function "+"
  21153.       (V : VECTOR;
  21154.        P : POINT) return POINT is
  21155.      
  21156.    -- Add a VECTOR to a POINT yielding a POINT
  21157.    --
  21158.    -- V - a displacement VECTOR to add to `A'
  21159.    -- P - a reference POINT
  21160.      
  21161.    begin
  21162.      
  21163.       return POINT '( V.X + P.X, V.Y + P.Y);
  21164.      
  21165.    end "+";
  21166.      
  21167.    function "-"
  21168.       (P : POINT;
  21169.        V : VECTOR) return POINT is
  21170.      
  21171.    -- Subtract a VECTOR from a POINT yielding a POINT
  21172.    --
  21173.    -- P - a reference POINT
  21174.    -- V - a displacement VECTOR to subtract from `A'
  21175.      
  21176.    begin
  21177.      
  21178.       return POINT '( P.X - V.X, P.Y - V.Y);
  21179.      
  21180.    end "-";
  21181.      
  21182.    function "-"
  21183.       (V : VECTOR;
  21184.        P : POINT) return POINT is
  21185.      
  21186.    -- Subtract a VECTOR from a POINT yielding a POINT
  21187.    --
  21188.    -- V - a displacement VECTOR
  21189.    -- P - a reference POINT to subtract from `A'
  21190.      
  21191.    begin
  21192.      
  21193.       return POINT '( V.X - P.X, V.Y - P.Y);
  21194.      
  21195.    end "-";
  21196.      
  21197. end NDC_POINT_OPS;
  21198. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21199. --:UDD:GKSADACM:CODE:MA:CONVERT_NDC_DC_MA_B.ADA
  21200. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21201. ------------------------------------------------------------------
  21202. --
  21203. --  NAME: CONVERT_NDC_DC - BODY
  21204. --  IDENTIFIER: GDMXXX.1(1)
  21205. --  DISCREPANCY REPORTS:
  21206. --
  21207. ------------------------------------------------------------------
  21208. -- File: CONVERT_NDC_DC_MA_B.ADA
  21209. -- Level: ma, 0a
  21210.      
  21211. with DC_POINT_OPS;
  21212. with NDC_POINT_OPS;
  21213.      
  21214. use DC_POINT_OPS;
  21215. use NDC_POINT_OPS;
  21216.      
  21217. package body CONVERT_NDC_DC is
  21218.      
  21219. -- This package body implements the SCALING and TRANSFORMATION
  21220. -- functions used to convert between the NDC and DC coordinate systems.
  21221. --
  21222. -- Type NDC_DC_SCALE_TYPE contains the ready-to-use scale and shift
  21223. -- factors needed to perform the workstation transformation and its
  21224. -- inverse.
  21225. --
  21226.      
  21227.    -- Define index for range arrays
  21228.      
  21229.    type LIMIT is (MIN, MAX);
  21230.      
  21231.    -- Define a new kind of rectangle which is easier to manipulate,
  21232.    -- using NDC_POINT_OPS, than the GKS_COORDINATE_SYSTEM records
  21233.      
  21234.    type NDC_RECTANGLE is array (LIMIT) of NDC . POINT;
  21235.      
  21236.    type DC_RECTANGLE is array (LIMIT) of DC . POINT;
  21237.      
  21238.    --
  21239.    -- Define simple conversions
  21240.    --
  21241.      
  21242.    function NDC_POINT
  21243.       (POINT : DC . POINT ) return NDC . POINT;
  21244.      
  21245.    -- Convert each coordinate using basic conversion
  21246.      
  21247.    function NDC_VECTOR
  21248.       (VECTOR : DC . VECTOR ) return NDC . VECTOR;
  21249.      
  21250.    -- Convert each coordinate using basic conversion
  21251.      
  21252.    function DC_POINT
  21253.       (POINT : NDC . POINT ) return DC . POINT;
  21254.      
  21255.    -- Convert each coordinate using basic conversion
  21256.      
  21257.    function DC_VECTOR
  21258.       (VECTOR : NDC . VECTOR ) return DC . VECTOR;
  21259.      
  21260.    -- Convert each coordinate using basic conversion
  21261.      
  21262.    --
  21263.    -- Define scaling conversions
  21264.    --
  21265.      
  21266.    procedure SET_UNIFORM_SCALES
  21267.       (WINDOW   :        WINDOW_TYPE;
  21268.        VIEWPORT :        VIEWPORT_TYPE;
  21269.        SCALE    :    out NDC_DC_SCALE_TYPE) is
  21270.      
  21271.    -- Compute SCALE based on largest image of WINDOW fitting in the
  21272.    -- lower-left of VIEWPORT.  This retains the uniform scale factors.
  21273.    -- The NDC_DC_SCALE_TYPE is not, itself, restricted to uniform
  21274.    -- scaling; it is this procedure which produces restricted values.
  21275.    --
  21276.    -- WINDOW   - NDC units window of uniform transform
  21277.    -- VIEWPORT - DC units viewport of uniform transform
  21278.    -- SCALE    - private type holding returned scale values
  21279.      
  21280.       -- Get rectangles into two-point form, for readable operations
  21281.      
  21282.       W_RECT : NDC_RECTANGLE := NDC_RECTANGLE '(
  21283.             NDC . POINT '( WINDOW . XMIN, WINDOW . YMIN),
  21284.             NDC . POINT '( WINDOW . XMAX, WINDOW . YMAX));
  21285.       -- W_RECT is the window rectangle
  21286.      
  21287.       V_RECT : DC_RECTANGLE := DC_RECTANGLE '(
  21288.             DC . POINT '( VIEWPORT . XMIN, VIEWPORT . YMIN),
  21289.             DC . POINT '( VIEWPORT . XMAX, VIEWPORT . YMAX));
  21290.       -- V_RECT is the viewport rectangle
  21291.      
  21292.       -- Compute deltas
  21293.      
  21294.       W_DELTA : NDC . VECTOR := W_RECT (MAX) - W_RECT (MIN);
  21295.       -- W_DELTA is the size of the window
  21296.      
  21297.       V_DELTA :  DC . VECTOR := V_RECT (MAX) - V_RECT (MIN);
  21298.       -- V_DELTA is the size of the viewport
  21299.      
  21300.       W_SCALE : NDC . POINT;
  21301.       -- W_SCALE is the scale factors to transform to the window-space
  21302.      
  21303.       V_SCALE :  DC . POINT;
  21304.       -- V_SCALE is the scale factors to transform to the viewport-space
  21305.      
  21306.    begin
  21307.      
  21308.       begin
  21309.      
  21310.          W_SCALE . X := W_DELTA . X / NDC_TYPE (V_DELTA . X);
  21311.      
  21312.       exception
  21313.      
  21314.          when others =>
  21315.      
  21316.             -- V_DELTA . X may be zero resulting in overflow
  21317.             W_SCALE . X := 1.0;
  21318.      
  21319.       end;
  21320.      
  21321.       begin
  21322.      
  21323.          W_SCALE . Y := W_DELTA . Y / NDC_TYPE (V_DELTA . Y);
  21324.      
  21325.       exception
  21326.      
  21327.          when others =>
  21328.      
  21329.             -- V_DELTA . Y may be zero resulting in overflow
  21330.             W_SCALE . Y := 1.0;
  21331.      
  21332.       end;
  21333.      
  21334.       begin
  21335.      
  21336.          V_SCALE . X := V_DELTA . X / DC_TYPE (W_DELTA . X);
  21337.      
  21338.       exception
  21339.      
  21340.          when others =>
  21341.      
  21342.             -- W_DELTA . X may be zero resulting in overflow
  21343.             V_SCALE . X := 1.0;
  21344.      
  21345.       end;
  21346.      
  21347.       begin
  21348.      
  21349.          V_SCALE . Y := V_DELTA . Y / DC_TYPE (W_DELTA . Y);
  21350.      
  21351.       exception
  21352.      
  21353.          when others =>
  21354.      
  21355.             -- W_DELTA . Y may be zero resulting in overflow
  21356.             V_SCALE . Y := 1.0;
  21357.      
  21358.       end;
  21359.      
  21360.       -- To achieve a uniform scale, the dimension of V_SCALE with the
  21361.       -- smaller scale is allowed to dominate the other dimension .
  21362.      
  21363.       if V_SCALE . X < V_SCALE . Y then
  21364.      
  21365.          -- X scale dominates Y scale
  21366.          V_SCALE . Y := V_SCALE . X;
  21367.      
  21368.          -- W_SCALE follows V_SCALE proportions
  21369.          W_SCALE . Y := W_SCALE . X;
  21370.      
  21371.       else
  21372.      
  21373.          -- Y scale dominates X scale
  21374.          V_SCALE . X := V_SCALE . Y;
  21375.      
  21376.          -- W_SCALE follows V_SCALE proportions
  21377.          W_SCALE . X := W_SCALE . Y;
  21378.      
  21379.       end if;
  21380.      
  21381.       SCALE := NDC_DC_SCALE_TYPE' (
  21382.          V_SCALE => V_SCALE,
  21383.          V_SHIFT => V_RECT (MIN) - V_SCALE * DC_POINT (W_RECT (MIN)),
  21384.          W_SCALE => W_SCALE,
  21385.          W_SHIFT => W_RECT (MIN) - W_SCALE * NDC_POINT (V_RECT (MIN)));
  21386.      
  21387.    end SET_UNIFORM_SCALES;
  21388.      
  21389.    -- Define Conversion to DC types
  21390.      
  21391.    function DC_POINT
  21392.       (POINT  : NDC . POINT;
  21393.        SCALE  : NDC_DC_SCALE_TYPE) return DC . POINT  is
  21394.      
  21395.    -- Convert POINT to DC units using SCALE factor
  21396.    --
  21397.    -- POINT - input POINT
  21398.    -- SCALE - pre-computed scaling factors
  21399.      
  21400.    begin
  21401.      
  21402.       return DC_POINT (POINT) * SCALE . V_SCALE + SCALE . V_SHIFT;
  21403.      
  21404.    end DC_POINT;
  21405.      
  21406.    function DC_POINT_ARRAY
  21407.       (POINT_ARRAY : NDC . POINT_ARRAY;
  21408.        SCALE       : NDC_DC_SCALE_TYPE) return DC . POINT_ARRAY is
  21409.      
  21410.    -- Convert all POINTs in POINT_ARRAY to DC units using SCALE factor
  21411.    --
  21412.    -- POINT_ARRAY - array of input POINTs
  21413.    -- SCALE - pre-computed scaling factors
  21414.      
  21415.       POINTS : DC . POINT_ARRAY (POINT_ARRAY'RANGE);
  21416.       -- Array to hold converted points
  21417.      
  21418.    begin
  21419.      
  21420.       for I in POINT_ARRAY'RANGE loop
  21421.      
  21422.          POINTS (I) := DC_POINT (POINT_ARRAY (I), SCALE);
  21423.      
  21424.       end loop;
  21425.      
  21426.       return POINTS;
  21427.      
  21428.    end DC_POINT_ARRAY;
  21429.      
  21430.    function DC_RECTANGLE_LIMITS
  21431.       (RECTANGLE_LIMITS : NDC . RECTANGLE_LIMITS;
  21432.        SCALE             : NDC_DC_SCALE_TYPE)
  21433.        return DC . RECTANGLE_LIMITS is
  21434.      
  21435.    -- Convert RECTANGLE_LIMITS to DC units using SCALE factor
  21436.    --
  21437.    -- RECTANGLE_LIMITS - input RECTANGLE_LIMITS
  21438.    -- SCALE - pre-computed scaling factors
  21439.      
  21440.       SX : DC_TYPE renames SCALE . V_SCALE . X;
  21441.       SY : DC_TYPE renames SCALE . V_SCALE . Y;
  21442.       DX : DC_TYPE renames SCALE . V_SHIFT . X;
  21443.       DY : DC_TYPE renames SCALE . V_SHIFT . Y;
  21444.      
  21445.    begin
  21446.      
  21447.       return DC . RECTANGLE_LIMITS' (
  21448.             XMIN => DC_TYPE (RECTANGLE_LIMITS . XMIN) * SX + DX,
  21449.             XMAX => DC_TYPE (RECTANGLE_LIMITS . XMAX) * SX + DX,
  21450.             YMIN => DC_TYPE (RECTANGLE_LIMITS . YMIN) * SY + DY,
  21451.             YMAX => DC_TYPE (RECTANGLE_LIMITS . YMAX) * SY + DY);
  21452.      
  21453.       -- RECTANGLE_LIMITS are not compatible with DC_POINT_OPS, so
  21454.       -- component-by-component expressions are used.
  21455.      
  21456.    end DC_RECTANGLE_LIMITS;
  21457.      
  21458.    -- The following functions are for relative scaling only,
  21459.    -- not absolute positions
  21460.      
  21461.    function DC_VECTOR
  21462.       (VECTOR : NDC . VECTOR;
  21463.        SCALE  : NDC_DC_SCALE_TYPE) return DC . VECTOR is
  21464.      
  21465.    -- Convert VECTOR to DC units using SCALE factor
  21466.    --
  21467.    -- VECTOR - input VECTOR
  21468.    -- SCALE - pre-computed scaling factors
  21469.      
  21470.    begin
  21471.      
  21472.       return DC_VECTOR (VECTOR) * DC . VECTOR (SCALE . V_SCALE);
  21473.      
  21474.    end DC_VECTOR;
  21475.      
  21476.    function DC_SIZE
  21477.       (SIZE  : NDC . SIZE;
  21478.        SCALE : NDC_DC_SCALE_TYPE) return DC . SIZE is
  21479.      
  21480.    -- Convert SIZE to DC units using SCALE factor
  21481.    --
  21482.    -- SIZE - input SIZE
  21483.    -- SCALE - pre-computed scaling factors
  21484.      
  21485.       SX : DC . MAGNITUDE := DC . MAGNITUDE (abs SCALE . V_SCALE . X);
  21486.       -- Scale factor compatible with output type (DC . MAGNITUDE)
  21487.       SY : DC . MAGNITUDE := DC . MAGNITUDE (abs SCALE . V_SCALE . Y);
  21488.       -- Scale factor compatible with output type (DC . MAGNITUDE)
  21489.      
  21490.    begin
  21491.      
  21492.       return DC . SIZE' (
  21493.          XAXIS => DC . MAGNITUDE (SIZE . XAXIS) * SX,
  21494.          YAXIS => DC . MAGNITUDE (SIZE . YAXIS) * SY);
  21495.      
  21496.    end DC_SIZE;
  21497.      
  21498.    --
  21499.    -- Define bodies of simple conversions
  21500.    -- It is possible to use UNCHECKED_CONVERSIONS if the element types
  21501.    -- are the same.  However, explicit handling of each component is
  21502.    -- more general.
  21503.    --
  21504.      
  21505.    function DC_POINT
  21506.       (POINT : NDC . POINT ) return DC . POINT is
  21507.      
  21508.    -- Convert `POINT' to an equal `DC . POINT' (no scaling)
  21509.    --
  21510.    -- POINT - input NDC . POINT
  21511.      
  21512.    begin
  21513.      
  21514.       return DC . POINT'
  21515.          (DC_TYPE (POINT . X), DC_TYPE (POINT . Y));
  21516.      
  21517.    end DC_POINT;
  21518.      
  21519.    function DC_VECTOR
  21520.       (VECTOR : NDC . VECTOR ) return DC . VECTOR is
  21521.      
  21522.    -- Convert `VECTOR' to an equal `DC . VECTOR' (no scaling)
  21523.    --
  21524.    -- VECTOR - input NDC . VECTOR
  21525.      
  21526.    begin
  21527.      
  21528.       return DC . VECTOR'
  21529.             (DC_TYPE (VECTOR . X), DC_TYPE (VECTOR . Y));
  21530.      
  21531.    end DC_VECTOR;
  21532.      
  21533.    -- Define Conversion to NDC types
  21534.      
  21535.    function NDC_POINT
  21536.       (POINT : DC . POINT;
  21537.        SCALE : NDC_DC_SCALE_TYPE) return NDC . POINT is
  21538.      
  21539.    -- Convert POINT to DC units using SCALE factor
  21540.    --
  21541.    -- POINT - input POINT
  21542.    -- SCALE - pre-computed scaling factors
  21543.      
  21544.    begin
  21545.      
  21546.       return NDC_POINT (POINT) * SCALE . W_SCALE + SCALE . W_SHIFT;
  21547.      
  21548.    end NDC_POINT;
  21549.      
  21550.    function NDC_POINT_ARRAY
  21551.       (POINT_ARRAY  : DC . POINT_ARRAY;
  21552.        SCALE       : NDC_DC_SCALE_TYPE) return NDC . POINT_ARRAY is
  21553.      
  21554.    -- Convert all POINTs in POINT_ARRAY to NDC units using SCALE factor
  21555.    --
  21556.    -- POINT_ARRAY - array of input POINTs
  21557.    -- SCALE - pre-computed scaling factors
  21558.      
  21559.       POINTS : NDC . POINT_ARRAY (POINT_ARRAY'RANGE);
  21560.       -- Array to hold converted points
  21561.      
  21562.    begin
  21563.      
  21564.       for I in POINT_ARRAY'RANGE loop
  21565.      
  21566.          POINTS (I) := NDC_POINT (POINT_ARRAY (I),SCALE);
  21567.      
  21568.       end loop;
  21569.       return POINTS;
  21570.      
  21571.    end NDC_POINT_ARRAY;
  21572.      
  21573.    function NDC_RECTANGLE_LIMITS
  21574.       (RECTANGLE_LIMITS : DC . RECTANGLE_LIMITS;
  21575.        SCALE           : NDC_DC_SCALE_TYPE)
  21576.        return NDC . RECTANGLE_LIMITS is
  21577.      
  21578.    -- Convert RECTANGLE_LIMITS to NDC units using SCALE factor
  21579.    --
  21580.    -- RECTANGLE_LIMITS - input RECTANGLE_LIMITS
  21581.    -- SCALE - pre-computed scaling factors
  21582.      
  21583.       SX : NDC_TYPE renames SCALE . W_SCALE . X;
  21584.       SY : NDC_TYPE renames SCALE . W_SCALE . Y;
  21585.       DX : NDC_TYPE renames SCALE . W_SHIFT . X;
  21586.       DY : NDC_TYPE renames SCALE . W_SHIFT . Y;
  21587.      
  21588.    begin
  21589.      
  21590.       return NDC . RECTANGLE_LIMITS' (
  21591.             XMIN => NDC_TYPE (RECTANGLE_LIMITS . XMIN) * SX + DX,
  21592.             XMAX => NDC_TYPE (RECTANGLE_LIMITS . XMAX) * SX + DX,
  21593.             YMIN => NDC_TYPE (RECTANGLE_LIMITS . YMIN) * SY + DY,
  21594.             YMAX => NDC_TYPE (RECTANGLE_LIMITS . YMAX) * SY + DY);
  21595.      
  21596.       -- RECTANGLE_LIMITS are not compatible with DC_POINT_OPS, so
  21597.       -- component-by-component expressions are used.
  21598.      
  21599.    end NDC_RECTANGLE_LIMITS;
  21600.      
  21601.    -- The following functions are for relative scaling only,
  21602.    -- not absolute positions
  21603.      
  21604.    function NDC_VECTOR
  21605.       (VECTOR : DC . VECTOR;
  21606.        SCALE  : NDC_DC_SCALE_TYPE) return NDC . VECTOR is
  21607.      
  21608.    -- Convert VECTOR to NDC units using SCALE factor
  21609.    --
  21610.    -- VECTOR - input VECTOR
  21611.    -- SCALE - pre-computed scaling factors
  21612.      
  21613.    begin
  21614.      
  21615.       return NDC_VECTOR (VECTOR) * NDC . VECTOR (SCALE . W_SCALE);
  21616.      
  21617.    end NDC_VECTOR;
  21618.      
  21619.    function NDC_SIZE
  21620.       (SIZE  : DC . SIZE;
  21621.        SCALE : NDC_DC_SCALE_TYPE) return NDC . SIZE is
  21622.      
  21623.    -- Convert SIZE to NDC units using SCALE factor
  21624.    --
  21625.    -- SIZE - input SIZE
  21626.    -- SCALE - pre-computed scaling factors
  21627.      
  21628.       SX : NDC . MAGNITUDE := NDC . MAGNITUDE (abs SCALE . W_SCALE . X);
  21629.       -- Scale factor compatible with output type (NDC . MAGNITUDE)
  21630.       SY : NDC . MAGNITUDE := NDC . MAGNITUDE (abs SCALE . W_SCALE . Y);
  21631.       -- Scale factor compatible with output type (NDC . MAGNITUDE)
  21632.      
  21633.    begin
  21634.      
  21635.       return NDC . SIZE' (
  21636.             XAXIS => NDC . MAGNITUDE (SIZE . XAXIS) * SX,
  21637.             YAXIS => NDC . MAGNITUDE (SIZE . YAXIS) * SY);
  21638.      
  21639.    end NDC_SIZE;
  21640.      
  21641.    -- Define bodies of simple conversions
  21642.    -- It is possible to use UNCHECKED_CONVERSIONS if the element types
  21643.    -- are the same .   However, explicit handling of each component is
  21644.    -- more general .
  21645.      
  21646.    function NDC_POINT
  21647.       (POINT : DC . POINT ) return NDC . POINT is
  21648.      
  21649.    -- Convert `POINT' to an equal `NDC . POINT' (no scaling)
  21650.    --
  21651.    -- POINT - input DC . POINT
  21652.      
  21653.    begin
  21654.      
  21655.       return NDC . POINT'
  21656.             (NDC_TYPE (POINT . X), NDC_TYPE (POINT . Y));
  21657.      
  21658.    end NDC_POINT;
  21659.      
  21660.    function NDC_VECTOR
  21661.       (VECTOR : DC . VECTOR ) return NDC . VECTOR is
  21662.      
  21663.    -- Convert `VECTOR' to an equal `NDC . VECTOR' (no scaling)
  21664.    --
  21665.    -- VECTOR - input DC . VECTOR
  21666.      
  21667.    begin
  21668.      
  21669.       return NDC . VECTOR'
  21670.             (NDC_TYPE (VECTOR . X), NDC_TYPE (VECTOR . Y));
  21671.      
  21672.    end NDC_VECTOR;
  21673.      
  21674. end CONVERT_NDC_DC;
  21675. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21676. --:UDD:GKSADACM:CODE:0A:LEXI_UTILITIES_0A.ADA
  21677. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21678. ------------------------------------------------------------------
  21679. --
  21680. --  NAME: LEXI_UTILITIES
  21681. --  IDENTIFIER: GDMXXX.1(1)
  21682. --  DISCREPANCY REPORTS:
  21683. --
  21684. ------------------------------------------------------------------
  21685. -- FILE: LEXI_UTILITIES.ADA
  21686. -- LEVEL : 0a - 2a
  21687.      
  21688. with GKS_TYPES;
  21689. with LEXI3700_TYPES;
  21690. with LEXI3700_WS_TABLES;
  21691.      
  21692. use GKS_TYPES;
  21693. use LEXI3700_TYPES;
  21694.      
  21695. package LEXI_UTILITIES is
  21696.      
  21697. -- This package contains utility functions specific to the LEXIDATA 3700
  21698.      
  21699.    LARGEST_CLIPPING_RECTANGLE : constant DC.RECTANGLE_LIMITS :=
  21700.      (XMIN => DC_TYPE (0.0),
  21701.       XMAX => DC_TYPE (LEXI3700_WS_TABLES.LEXI3700_WS_DT.
  21702.          MAX_DISPLAY_SURFACE_RASTER_UNITS.X) - DC_TYPE'(1.0),
  21703.       YMIN => DC_TYPE (0.0),
  21704.       YMAX => DC_TYPE (LEXI3700_WS_TABLES.LEXI3700_WS_DT.
  21705.          MAX_DISPLAY_SURFACE_RASTER_UNITS.Y) - DC_TYPE'(1.0));
  21706.    -- Contains the number of pixels on the display surface in the X and
  21707.    -- Y dimensions.
  21708.      
  21709.    type STATUS_OF_POINTS is (ALL_OUTSIDE, ALL_INSIDE, INTERSECTING);
  21710.    -- This type is used by CLIP_TO_SCREEN to indicate the relationship
  21711.    -- between the points and the clipping rectangle.
  21712.      
  21713.    procedure CLIP_TO_SCREEN
  21714.       (ORIGINAL_POINTS    : in DC.POINT_ARRAY;
  21715.        CLIPPED_POINTS     : out DC.POINT_ARRAY;
  21716.        SUMMARY_OF_RESULTS : out STATUS_OF_POINTS;
  21717.        CLIPPING_RECTANGLE : in DC.RECTANGLE_LIMITS :=
  21718.                             LARGEST_CLIPPING_RECTANGLE);
  21719.      
  21720.    function IDC
  21721.       (SINGLE_POINT : DC.POINT) return LEXI_POINT;
  21722.      
  21723.    function IDC
  21724.       (POINT_LIST  : DC.POINT_ARRAY) return LEXI_POINTS;
  21725.      
  21726. end LEXI_UTILITIES;
  21727. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21728. --:UDD:GKSADACM:CODE:0A:LEXI_UTILITIES_0A_B.ADA
  21729. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21730. ------------------------------------------------------------------
  21731. --
  21732. --  NAME: LEXI_UTILITIES - BODY
  21733. --  IDENTIFIER: GDMXXX.1(1)
  21734. --  DISCREPANCY REPORTS:
  21735. --
  21736. ------------------------------------------------------------------
  21737. -- FILE: LEXI_UTILITIES_B.ADA
  21738. -- LEVEL : 0a - 2a
  21739.      
  21740. package body LEXI_UTILITIES is
  21741.      
  21742.    SCREEN_SIZE : constant RASTER_UNIT_SIZE :=  LEXI3700_WS_TABLES.
  21743.       LEXI3700_WS_DT.MAX_DISPLAY_SURFACE_RASTER_UNITS;
  21744.    -- Contains the number of pixels on the display surface in the X and
  21745.    -- Y dimensions. This variable is used by all of the procedures in
  21746.    -- this package.
  21747.      
  21748.    procedure CLIP_TO_SCREEN
  21749.       (ORIGINAL_POINTS    : in DC.POINT_ARRAY;
  21750.        CLIPPED_POINTS     : out DC.POINT_ARRAY;
  21751.        SUMMARY_OF_RESULTS : out STATUS_OF_POINTS;
  21752.        CLIPPING_RECTANGLE : in DC.RECTANGLE_LIMITS :=
  21753.            LARGEST_CLIPPING_RECTANGLE)
  21754.       is separate;
  21755.      
  21756.    function IDC
  21757.       (POINT_LIST  : DC.POINT_ARRAY) return LEXI_POINTS is
  21758.      
  21759.    -- This function transforms coordinates from DC space to Integer
  21760.    -- Device Coordinates. It changes from a float type to an integer
  21761.    -- type. It also inverts the Y coordinates so that the origin is in
  21762.    -- the upper left corner of IDC instead of the lower left corner of
  21763.    -- DC. The first index of the array returned by this function is
  21764.    -- 1 regardless of the indices of the array it received.
  21765.    --
  21766.    -- POINT_LIST - the list of points in DC to be converted to IDC.
  21767.      
  21768.    IDC_POINTS : LEXI_POINTS(1 .. POINT_LIST'LENGTH);
  21769.    -- Contains the device coordinate points to be returned.
  21770.      
  21771.    IDC_COUNT : POSITIVE := 1;
  21772.    -- This is the index into the IDC_POINTS array. The value returned
  21773.    -- is guarenteed to begin at index #1.
  21774.      
  21775.    begin
  21776.      
  21777.       -- Repeat with each of the points in the input.
  21778.       for DC_COUNT in POINT_LIST'RANGE loop
  21779.      
  21780.          -- Convert the X coordinate of the point to an integer.
  21781.          IDC_POINTS(IDC_COUNT).X :=
  21782.             LEXI_COORDINATE(POINT_LIST(DC_COUNT).X);
  21783.      
  21784.          -- Invert the Y coordinate and convert it to an integer.
  21785.          IDC_POINTS(IDC_COUNT).Y := LEXI_COORDINATE
  21786.             (DC_TYPE(SCREEN_SIZE.Y) - POINT_LIST(DC_COUNT).Y -
  21787.              DC_TYPE'(1.0));
  21788.      
  21789.          IDC_COUNT := IDC_COUNT + 1;
  21790.      
  21791.       end loop;
  21792.      
  21793.       return IDC_POINTS;
  21794.      
  21795.    end IDC;
  21796.      
  21797.    function IDC
  21798.       (SINGLE_POINT : DC.POINT) return LEXI_POINT is
  21799.      
  21800.    -- This function transforms coordinates from DC space to Integer
  21801.    -- Device Coordinates. It changes from a float type to an integer
  21802.    -- type. It also inverts the Y coordinate so that the origin is in
  21803.    -- the upper left corner of IDC instead of the lower left corner of
  21804.    -- DC.
  21805.    --
  21806.    -- SINGLE_POINT is the point in DC to be converted to IDC.
  21807.      
  21808.    IDC_POINT : LEXI_POINT;
  21809.    -- Contains the device coordinate point to be returned.
  21810.      
  21811.    begin
  21812.      
  21813.       -- Convert the X coordinate of the point to an integer.
  21814.       IDC_POINT.X := LEXI_COORDINATE(SINGLE_POINT.X);
  21815.      
  21816.       -- Invert the Y coordinate and convert it to an integer.
  21817.       IDC_POINT.Y := LEXI_COORDINATE
  21818.          (DC_TYPE(SCREEN_SIZE.Y) - SINGLE_POINT.Y - DC_TYPE'(1.0));
  21819.      
  21820.       return IDC_POINT;
  21821.      
  21822.    end IDC;
  21823.      
  21824. end LEXI_UTILITIES;
  21825. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21826. --:UDD:GKSADACM:CODE:0A:WSD_CLIP_TO_SCREEN.ADA
  21827. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21828. ------------------------------------------------------------------
  21829. --
  21830. --  NAME: CLIP_TO_SCREEN
  21831. --  IDENTIFIER: GDMXXX.1(1)
  21832. --  DISCREPANCY REPORTS:
  21833. --
  21834. ------------------------------------------------------------------
  21835. -- FILE : WSD_CLIP_TO_SCREEN.ADA
  21836. -- LEVELS : 0a - 2a
  21837.      
  21838. separate (LEXI_UTILITIES)
  21839.      
  21840. procedure CLIP_TO_SCREEN
  21841.    (ORIGINAL_POINTS    : in DC.POINT_ARRAY;
  21842.     CLIPPED_POINTS     : out DC.POINT_ARRAY;
  21843.     SUMMARY_OF_RESULTS : out STATUS_OF_POINTS;
  21844.     CLIPPING_RECTANGLE : in DC.RECTANGLE_LIMITS :=
  21845.                          LARGEST_CLIPPING_RECTANGLE) is
  21846.      
  21847. -- This procedure will clip an arbitrary number of points to the given
  21848. -- rectangle. If a point has an X or Y coordinate which is outside of
  21849. -- the rectangle, it is clipped to the border. The array of clipped
  21850. -- points is the same length as the array of original points. Each point
  21851. -- is clipped individually as in polymarker's clip. This procedure also
  21852. -- indicates if all the points are outside, inside, or neither.
  21853. --
  21854. -- ORIGINAL_POINTS    - an array of points to be tested.
  21855. -- CLIPPED_POINTS     - the result of clipping the ORIGINAL_POINTS to
  21856. --                      the area of the screen. The index to this
  21857. --                      array is the same as that of CLIPPED_POINTS.
  21858. -- SUMMARY_OF_RESULTS - is ALL_INSIDE if no clipping was done; is
  21859. --                      ALL_OUTSIDE if all of the points are to the
  21860. --                      left of the screen or if all are to the right
  21861. --                      of the screen or all below or above.
  21862. -- CLIPPING_RECTANGLE - the four points which define the borders of the
  21863. --                      clipping area.
  21864.      
  21865.    X_VALUE_OK : BOOLEAN;
  21866.    -- Set to True when the X value of a point is on the screen.
  21867.      
  21868.    Y_VALUE_OK : BOOLEAN;
  21869.    -- Set to True when the Y value of a point is on the screen.
  21870.      
  21871.    NUM_POINTS_OUTSIDE_CLIPPING_RECTANGLE : NATURAL;
  21872.    -- A counter for the number of exterior points.
  21873.      
  21874.    ALL_POINTS_ARE_BELOW : BOOLEAN := TRUE;
  21875.    -- This variable is set to TRUE until a point is found which is
  21876.    -- not below the clipping rectangle.
  21877.      
  21878.    ALL_POINTS_ARE_ABOVE : BOOLEAN := TRUE;
  21879.    -- This variable is set to TRUE until a point is found which is
  21880.    -- not above the clipping rectangle.
  21881.      
  21882.    ALL_POINTS_ARE_TO_THE_RIGHT : BOOLEAN := TRUE;
  21883.    -- This variable is set to TRUE until a point is found which is
  21884.    -- not to the right of the clipping rectangle.
  21885.      
  21886.    ALL_POINTS_ARE_TO_THE_LEFT : BOOLEAN := TRUE;
  21887.    -- This variable is set to TRUE until a point is found which is
  21888.    -- not to the left of the clipping rectangle.
  21889.      
  21890. begin
  21891.      
  21892.    -- Initialize the number of interior points to 0.
  21893.    NUM_POINTS_OUTSIDE_CLIPPING_RECTANGLE := 0;
  21894.      
  21895.    -- Repeat for each of the points in the input array.
  21896.    for I in ORIGINAL_POINTS'RANGE loop
  21897.      
  21898.       -- If the X coordinate is outside the border of the screen, set
  21899.       -- the flag to false and make the clipped point's X coordinate
  21900.       -- equal to the border. Otherwise put the original value into
  21901.       -- the clipped point.
  21902.       if ORIGINAL_POINTS(I).X > CLIPPING_RECTANGLE.XMAX then
  21903.          X_VALUE_OK := FALSE;
  21904.          CLIPPED_POINTS(I).X := CLIPPING_RECTANGLE.XMAX;
  21905.          ALL_POINTS_ARE_TO_THE_LEFT := FALSE;
  21906.       elsif ORIGINAL_POINTS(I).X < CLIPPING_RECTANGLE.XMIN then
  21907.          X_VALUE_OK := FALSE;
  21908.          CLIPPED_POINTS(I).X := CLIPPING_RECTANGLE.XMIN;
  21909.          ALL_POINTS_ARE_TO_THE_RIGHT := FALSE;
  21910.       else
  21911.          X_VALUE_OK := TRUE;
  21912.          CLIPPED_POINTS(I).X := ORIGINAL_POINTS(I).X;
  21913.          ALL_POINTS_ARE_TO_THE_RIGHT := FALSE;
  21914.          ALL_POINTS_ARE_TO_THE_LEFT := FALSE;
  21915.       end if;
  21916.      
  21917.       -- If the Y coordinate is outside the border of the screen, set
  21918.       -- the flag to true and make the clipped point's Y coordinate
  21919.       -- equal to the border. Otherwise put the original value into
  21920.       -- the clipped point.
  21921.       if ORIGINAL_POINTS(I).Y > CLIPPING_RECTANGLE.YMAX then
  21922.          Y_VALUE_OK := FALSE;
  21923.          CLIPPED_POINTS(I).Y := CLIPPING_RECTANGLE.YMAX;
  21924.          ALL_POINTS_ARE_BELOW := FALSE;
  21925.       elsif ORIGINAL_POINTS(I).Y < CLIPPING_RECTANGLE.YMIN then
  21926.          Y_VALUE_OK := FALSE;
  21927.          CLIPPED_POINTS(I).Y := CLIPPING_RECTANGLE.YMIN;
  21928.          ALL_POINTS_ARE_ABOVE := FALSE;
  21929.       else
  21930.          Y_VALUE_OK := TRUE;
  21931.          CLIPPED_POINTS(I).Y := ORIGINAL_POINTS(I).Y;
  21932.          ALL_POINTS_ARE_ABOVE := FALSE;
  21933.          ALL_POINTS_ARE_BELOW := FALSE;
  21934.       end if;
  21935.      
  21936.       -- If the point is one the screen, increment the number of points
  21937.       -- on the screen.
  21938.       if not X_VALUE_OK or not Y_VALUE_OK then
  21939.          NUM_POINTS_OUTSIDE_CLIPPING_RECTANGLE :=
  21940.             NUM_POINTS_OUTSIDE_CLIPPING_RECTANGLE + 1;
  21941.       end if;
  21942.      
  21943.    end loop;
  21944.      
  21945.    -- Calculate the STATUS_OF_THE_POINTS.
  21946.    if ALL_POINTS_ARE_ABOVE or ALL_POINTS_ARE_BELOW or
  21947.       ALL_POINTS_ARE_TO_THE_RIGHT or ALL_POINTS_ARE_TO_THE_LEFT then
  21948.      
  21949.       SUMMARY_OF_RESULTS := ALL_OUTSIDE;
  21950.      
  21951.    elsif NUM_POINTS_OUTSIDE_CLIPPING_RECTANGLE = 0 then
  21952.      
  21953.       SUMMARY_OF_RESULTS := ALL_INSIDE;
  21954.      
  21955.    else
  21956.      
  21957.       SUMMARY_OF_RESULTS := INTERSECTING;
  21958.      
  21959.    end if;
  21960.      
  21961. end CLIP_TO_SCREEN;
  21962. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21963. --:UDD:GKSADACM:CODE:MA:LEXI_OUT_PRIM_MA.ADA
  21964. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  21965. ------------------------------------------------------------------
  21966. --
  21967. --  NAME: LEXI3700_OUTPUT_PRIMITIVES
  21968. --  IDENTIFIER: GDMXXX.2(1)
  21969. --  DISCREPANCY REPORTS:
  21970. --  Not listed
  21971. ------------------------------------------------------------------
  21972. -- FILE  : LEXI3700_OUT_PRIM.ADA
  21973. -- LEVEL : MA - 0A
  21974.      
  21975. with CGI;
  21976. with GKS_TYPES;
  21977. with WS_STATE_LIST_TYPES;
  21978.      
  21979.      
  21980. use  CGI;
  21981. use  GKS_TYPES;
  21982.      
  21983. package LEXI3700_OUTPUT_PRIMITIVES is
  21984.      
  21985. -- This package contains four output primitive procedures
  21986. -- for the Lexidata 3700 output device.
  21987.      
  21988.    procedure POLYLINE
  21989.       (WS_SL       : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  21990.        LINE_POINTS : ACCESS_POINT_ARRAY_TYPE);
  21991.      
  21992.    procedure POLYMARKER
  21993.       (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  21994.        MARKER_POINTS : ACCESS_POINT_ARRAY_TYPE);
  21995.      
  21996.    procedure FILL_AREA
  21997.       (WS_SL            : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  21998.        FILL_AREA_POINTS : ACCESS_POINT_ARRAY_TYPE);
  21999.      
  22000.    procedure TEXT
  22001.       (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22002.        TEXT_POSITION : NDC.POINT;
  22003.        TEXT_STRING   : ACCESS_STRING_TYPE);
  22004.      
  22005. end LEXI3700_OUTPUT_PRIMITIVES;
  22006. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22007. --:UDD:GKSADACM:CODE:MA:LEXI_OUT_PRIM_MA_B.ADA
  22008. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22009. ------------------------------------------------------------------
  22010. --
  22011. --  NAME: LEXI3700_OUTPUT_PRIMITIVES - BODY
  22012. --  IDENTIFIER: GDMXXX.2(1)
  22013. --  DISCREPANCY REPORTS:
  22014. --  Not listed
  22015. ------------------------------------------------------------------
  22016. -- FILE : LEXI3700_OUT_PRIM_B.ADA
  22017. -- LEVEL : MA - 0A
  22018.      
  22019. with LEXI3700_CONFIGURATION;
  22020. with LEXI3700_TYPES;
  22021. with LEXI3700_OUTPUT_DRIVER;
  22022. with CONVERT_NDC_DC;
  22023. with DC_POINT_OPS;
  22024. with WSR_UTILITIES;
  22025. with LEXI_UTILITIES;
  22026.      
  22027. use  LEXI3700_TYPES;
  22028.      
  22029. package body LEXI3700_OUTPUT_PRIMITIVES is
  22030.      
  22031. -- The package LEXI3700_TYPES contains all types used by the device
  22032. -- driver.
  22033. --
  22034. -- The package LEXI3700_DRIVER contains all device specific calls
  22035. -- for the device driver.
  22036. --
  22037. -- The package WSD_UTILITIES contains the functions and procedures needed
  22038. -- by the workstation driver to perform transformations and clipping.
  22039.      
  22040.    procedure POLYLINE
  22041.       (WS_SL       : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22042.        LINE_POINTS : ACCESS_POINT_ARRAY_TYPE) is separate;
  22043.      
  22044.    procedure POLYMARKER
  22045.       (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22046.        MARKER_POINTS : ACCESS_POINT_ARRAY_TYPE) is separate;
  22047.      
  22048.    procedure FILL_AREA
  22049.       (WS_SL            : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22050.        FILL_AREA_POINTS : ACCESS_POINT_ARRAY_TYPE) is separate;
  22051.      
  22052.    procedure TEXT
  22053.       (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22054.        TEXT_POSITION : NDC.POINT;
  22055.        TEXT_STRING   : ACCESS_STRING_TYPE) is separate;
  22056.      
  22057. end LEXI3700_OUTPUT_PRIMITIVES;
  22058. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22059. --:UDD:GKSADACM:CODE:MA:WSD_PLINE_MA.ADA
  22060. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22061. ------------------------------------------------------------------
  22062. --
  22063. --  NAME: POLYLINE
  22064. --  IDENTIFIER: GDMXXX.1(2)
  22065. --  DISCREPANCY REPORTS:
  22066. --  DR034  Fix pline clip.
  22067. ------------------------------------------------------------------
  22068. -- FILE: WSD_PLINE_MA.ADA
  22069. -- LEVEL : MA - 0A
  22070.      
  22071. separate (LEXI3700_OUTPUT_PRIMITIVES)
  22072.      
  22073. procedure POLYLINE
  22074.    (WS_SL        : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22075.     LINE_POINTS  : ACCESS_POINT_ARRAY_TYPE) is
  22076.      
  22077. -- This procedure uses the Workstation State List to find the
  22078. -- effective clipping matrix and the attributes used to control
  22079. -- the appearance of the polyline.
  22080. --
  22081. -- WS_SL - is a pointer to the Workstation State List.
  22082. --
  22083. -- LINE_POINTS  - is a pointer to an array containing points to generate
  22084. --                a set of connected lines.
  22085.      
  22086. DEVICE_UNIT_POINTS : DC.POINT_ARRAY(LINE_POINTS'range);
  22087. -- Contain points of type dc.
  22088.      
  22089. FIRST_VALUE : DC.POINT;
  22090. LAST_VALUE  : DC.POINT;
  22091. -- FIRST_VALUE and LAST_VALUE contain the first and last points of the
  22092. -- array.
  22093.      
  22094. FIRST_INDEX : POSITIVE := DEVICE_UNIT_POINTS'FIRST;
  22095. LAST_INDEX  : POSITIVE := DEVICE_UNIT_POINTS'FIRST;
  22096. -- FIRST_INDEX and LAST_INDEX are pointers into the array being clipped.
  22097. -- These pointers point to the first and last index of the array that
  22098. -- are in the effective clipping rectangle.
  22099.      
  22100. LINE_WIDTH : INTEGER;
  22101. -- Contains the line width.
  22102.      
  22103. LEXI_LINE_WIDTH : LEXI_LINE_WIDTH_TYPE;
  22104. -- Contains the line width for the device.
  22105.      
  22106. LINE_COLOUR : LEXI_COLOUR_INDEX;
  22107. -- Contains the Colour index .
  22108.      
  22109. IS_VALID : BOOLEAN;
  22110. -- Contains a flag indicating if the colour index is valid.
  22111.      
  22112. function "&"(A : DC.POINT; B : DC.POINT_ARRAY) return DC.POINT_ARRAY
  22113.             renames DC."&";
  22114. function "&"(A : DC.POINT_ARRAY; B : DC.POINT) return DC.POINT_ARRAY
  22115.             renames DC."&";
  22116.      
  22117. begin
  22118.      
  22119.    IS_VALID := COLOUR_INDICES.IS_IN_LIST
  22120.                  (WS_SL.EFFECTIVE_POLYLINE_ATTR.COLOUR,
  22121.                   WS_SL.SET_OF_COLOUR_IDC);
  22122.    if IS_VALID then
  22123.       LINE_COLOUR := LEXI_COLOUR_INDEX(WS_SL.EFFECTIVE_POLYLINE_ATTR.COLOUR);
  22124.    else
  22125.       LINE_COLOUR := LEXI_COLOUR_INDEX(1);
  22126.    end if;
  22127.    -- Finds colour for polyline.
  22128.      
  22129.    LINE_WIDTH  := INTEGER(WS_SL.EFFECTIVE_POLYLINE_ATTR.L_WIDTH);
  22130.    if LINE_WIDTH <  INTEGER(LEXI_LINE_WIDTH_TYPE'FIRST) then
  22131.       LEXI_LINE_WIDTH := LEXI_LINE_WIDTH_TYPE'FIRST;
  22132.    elsif LINE_WIDTH >  INTEGER(LEXI_LINE_WIDTH_TYPE'LAST) then
  22133.       LEXI_LINE_WIDTH := LEXI_LINE_WIDTH_TYPE'LAST;
  22134.    else
  22135.       LEXI_LINE_WIDTH := LEXI_LINE_WIDTH_TYPE(LINE_WIDTH);
  22136.    end if;
  22137.    -- Finds line width for polyline.
  22138.      
  22139.    DEVICE_UNIT_POINTS := CONVERT_NDC_DC.DC_POINT_ARRAY
  22140.          (LINE_POINTS.all,WS_SL.WS_TRANSFORM);
  22141.    -- Converts points to DC
  22142.      
  22143.    LEXI3700_OUTPUT_DRIVER.SET_DISPLAY_PARAMETERS
  22144.          (LEXI_LINE_WIDTH,
  22145.           LEXI_LINE_TYPE'VAL(WS_SL.EFFECTIVE_POLYLINE_ATTR.L_TYPE - 1),
  22146.           LEXI_INTERIOR_STYLE'(HOLLOW));
  22147.      
  22148.    while FIRST_INDEX /= DEVICE_UNIT_POINTS'LAST loop
  22149.      
  22150.       WSR_UTILITIES.PLINE_CLIP
  22151.          (DEVICE_UNIT_POINTS, FIRST_VALUE, FIRST_INDEX, LAST_INDEX,
  22152.           LAST_VALUE, WS_SL.EFFECTIVE_CLIPPING_RECTANGLE);
  22153.      
  22154.       if FIRST_INDEX > DEVICE_UNIT_POINTS'LAST then
  22155.          exit;
  22156.          -- The points were outside the clipping rectangle.
  22157.       else
  22158.           declare
  22159.             DEVICE_POINTS : LEXI_POINTS(1 .. LAST_INDEX - FIRST_INDEX + 3);
  22160.           begin
  22161.      
  22162.              DEVICE_POINTS := LEXI_UTILITIES.IDC
  22163.                    (FIRST_VALUE &
  22164.                     DEVICE_UNIT_POINTS(FIRST_INDEX .. LAST_INDEX) &
  22165.                     LAST_VALUE);
  22166.      
  22167.              LEXI3700_OUTPUT_DRIVER.DISPLAY_CHAINED_VECTORS
  22168.                    (LINE_COLOUR, DEVICE_POINTS);
  22169.           end;
  22170.           FIRST_INDEX := LAST_INDEX + 1;
  22171.           WS_SL.WS_DISPLAY_SURFACE := NOTEMPTY;
  22172.       end if;
  22173.    end loop;
  22174.      
  22175.    if WS_SL.WS_DEFERRAL_MODE = ASAP then
  22176.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  22177.    end if;
  22178.    -- Flush the output buffer on the device if the deferral mode is ASAP
  22179.      
  22180. end POLYLINE;
  22181. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22182. --:UDD:GKSADACM:CODE:MA:WSD_PMRK_MA.ADA
  22183. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22184. ------------------------------------------------------------------
  22185. --
  22186. --  NAME: POLYMARKER
  22187. --  IDENTIFIER: GDMXXX.1(2)
  22188. --  DISCREPANCY REPORTS:
  22189. --  DR006  Polymarker tests do not execute.
  22190. ------------------------------------------------------------------
  22191. -- FILE: WSD_PMRK_MA.ADA
  22192. -- LEVEL: MA - 0A
  22193.      
  22194. separate (LEXI3700_OUTPUT_PRIMITIVES)
  22195.      
  22196. procedure POLYMARKER
  22197.    (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22198.     MARKER_POINTS : ACCESS_POINT_ARRAY_TYPE) is
  22199.      
  22200. -- This procedure uses the Workstation State List to find the effective
  22201. -- clipping matrix and the attributes used to control the appearance
  22202. -- of the polymarker.
  22203. --
  22204. -- WS_SL         - is a pointer to the Workstation State List.
  22205.      
  22206. -- MARKER_POINTS - is a pointer to an array containing points to give
  22207. --                 position of polymarkers.
  22208.      
  22209. MARKER_SIZE : INTEGER;
  22210. -- Contains the request marker size.
  22211.      
  22212. LEXI_MARKER_SIZE : LEXI_TEXT_SIZE;
  22213. -- Contains the size of the marker.
  22214.      
  22215. IS_VALID : BOOLEAN;
  22216. -- Contains a flag indicating if the colour index is valid.
  22217.      
  22218. MARKER_COLOUR : LEXI_COLOUR_INDEX;
  22219. -- Contains the colour index for the device.
  22220.      
  22221. CLIPPED_MARKER_POINTS : DC.POINT_LIST;
  22222. -- Contains the clipped Polymarkers.
  22223.      
  22224. LEXI_MARKER : LEXI_MARKER_TYPE;
  22225. -- Contains the available marker type.
  22226.      
  22227. MARKER_TYPE : INTEGER;
  22228. -- Contains the Requested Marker type.
  22229.      
  22230. procedure ADJUST_MARKER_POSITION
  22231.    (DEVICE_POINTS : in out LEXI_POINTS;
  22232.     MARKER_SIZE : LEXI_TEXT_SIZE) is
  22233.      
  22234. OFFSET_X : LEXI_COORDINATE :=
  22235.       LEXI_COORDINATE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_WIDTH)
  22236.       * LEXI_COORDINATE(MARKER_SIZE) / LEXI_COORDINATE'(2);
  22237. OFFSET_Y : LEXI_COORDINATE :=
  22238.       LEXI_COORDINATE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  22239.       * LEXI_COORDINATE(MARKER_SIZE) / LEXI_COORDINATE'(2);
  22240.      
  22241. begin
  22242.    for I in DEVICE_POINTS'range loop
  22243.        if INTEGER(DEVICE_POINTS(I).X - OFFSET_X) > 0 then
  22244.           DEVICE_POINTS(I).X := DEVICE_POINTS(I).X - OFFSET_X;
  22245.        else
  22246.           DEVICE_POINTS(I).X := LEXI_COORDINATE'(0);
  22247.        end if;
  22248.        if INTEGER(DEVICE_POINTS(I).Y - OFFSET_Y) > 0 then
  22249.           DEVICE_POINTS(I).Y := DEVICE_POINTS(I).Y - OFFSET_Y;
  22250.        else
  22251.           DEVICE_POINTS(I).Y := LEXI_COORDINATE'(0);
  22252.        end if;
  22253.    end loop;
  22254. end ADJUST_MARKER_POSITION;
  22255.      
  22256. begin
  22257.      
  22258.    IS_VALID := COLOUR_INDICES.IS_IN_LIST
  22259.                  (WS_SL.EFFECTIVE_POLYMARKER_ATTR.COLOUR,
  22260.                   WS_SL.SET_OF_COLOUR_IDC);
  22261.    if IS_VALID then
  22262.       MARKER_COLOUR := LEXI_COLOUR_INDEX(WS_SL.EFFECTIVE_POLYMARKER_ATTR.COLOUR)
  22263. ;
  22264.    else
  22265.       MARKER_COLOUR := LEXI_COLOUR_INDEX'(1);
  22266.    end if;
  22267.    -- Finds the polymarker colour.
  22268.      
  22269.    MARKER_SIZE := INTEGER(WS_SL.EFFECTIVE_POLYMARKER_ATTR.M_SIZE);
  22270.    if MARKER_SIZE < INTEGER(LEXI_TEXT_SIZE'FIRST) then
  22271.       LEXI_MARKER_SIZE := LEXI_TEXT_SIZE'FIRST;
  22272.    elsif MARKER_SIZE > INTEGER(LEXI_TEXT_SIZE'LAST) then
  22273.       LEXI_MARKER_SIZE := LEXI_TEXT_SIZE'LAST;
  22274.    else
  22275.       LEXI_MARKER_SIZE := LEXI_TEXT_SIZE(MARKER_SIZE);
  22276.    end if;
  22277.    -- Finds the polymarker size.
  22278.      
  22279.    LEXI_MARKER := LEXI_MARKER_TYPE'VAL
  22280.       (WS_SL.EFFECTIVE_POLYMARKER_ATTR.M_TYPE - 1);
  22281.      
  22282.    CLIPPED_MARKER_POINTS := WSR_UTILITIES.PMRK_CLIP
  22283.         (CONVERT_NDC_DC.DC_POINT_ARRAY(MARKER_POINTS.all,
  22284.          WS_SL.WS_TRANSFORM),
  22285.          WS_SL.EFFECTIVE_CLIPPING_RECTANGLE);
  22286.      
  22287.    if CLIPPED_MARKER_POINTS.POINTS'LENGTH > 0 then
  22288.       declare
  22289.          DEVICE_POINTS : LEXI_POINTS(1 .. CLIPPED_MARKER_POINTS.LENGTH);
  22290.       begin
  22291.          DEVICE_POINTS := LEXI_UTILITIES.IDC (CLIPPED_MARKER_POINTS.POINTS);
  22292.          ADJUST_MARKER_POSITION(DEVICE_POINTS,LEXI_MARKER_SIZE);
  22293.          for I in DEVICE_POINTS'range loop
  22294.              LEXI3700_OUTPUT_DRIVER.SET_TEXT_PARAMETERS
  22295.                   (DEVICE_POINTS(I), MARKER_COLOUR,
  22296.                    LEXI_CHARACTER_PATH'(LEFT_TO_RIGHT),
  22297.                    LEXI_MARKER_SIZE);
  22298.              LEXI3700_OUTPUT_DRIVER.DISPLAY_TEXT
  22299.                   (LEXI3700_OUTPUT_DRIVER.LEXI_MARKER(LEXI_MARKER));
  22300.          end loop;
  22301.       WS_SL.WS_DISPLAY_SURFACE := NOTEMPTY;
  22302.       end;
  22303.    end if;
  22304.      
  22305.    if WS_SL.WS_DEFERRAL_MODE = ASAP then
  22306.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  22307.    end if;
  22308.    -- Flush the output buffer on the device if the deferral mode is ASAP
  22309.      
  22310. end POLYMARKER;
  22311. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22312. --:UDD:GKSADACM:CODE:MA:WSD_FA_MA.ADA
  22313. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22314. ------------------------------------------------------------------
  22315. --
  22316. --  NAME: FILL_AREA
  22317. --  IDENTIFIER: GDMXXX.1(2)
  22318. --  DISCREPANCY REPORTS:
  22319. --  DR009  Fill area debug statements.
  22320. ------------------------------------------------------------------
  22321. -- FILE: WSD_FA_MA.ADA
  22322. -- LEVEL : MA - 0A
  22323.      
  22324. with UNCHECKED_DEALLOCATION;
  22325.      
  22326. separate (LEXI3700_OUTPUT_PRIMITIVES)
  22327.      
  22328. procedure FILL_AREA
  22329.    (WS_SL            : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22330.     FILL_AREA_POINTS : ACCESS_POINT_ARRAY_TYPE) is
  22331.      
  22332. -- This procedure gathers the appropriate attributes from the Work-
  22333. -- station state list and then calls the device driver procedures which
  22334. -- fill in the area defined by the input points.
  22335. --
  22336. -- If the Effective Interior Style is HOLLOW the attributes of polyline
  22337. -- are used to draw the border points. If the Effective Interior Style
  22338. -- is SOLID the border points are drawn by the device driver with a
  22339. -- special flag so that the area can then be filled in. Interior styles
  22340. -- of PATTERN or HATCH are not supported; they will default to HOLLOW.
  22341. --
  22342. -- The FILL_AREA_POINTS will be clipped and transformed from NDC into
  22343. -- IDC coordinate space.
  22344. --
  22345. -- WS_SL             - the pointer to the Workstation State List.
  22346. -- FILL_AREA_POINTS  - a pointer to an array of points in NDC.
  22347.      
  22348.    EFFECTIVE_LINETYPE : LEXI_LINE_TYPE := LEXI_LINE_TYPE'FIRST;
  22349.    -- The value used for drawing the border lines is always solid.
  22350.      
  22351.    EFFECTIVE_LINE_WIDTH : LEXI_LINE_WIDTH_TYPE :=
  22352.       LEXI_LINE_WIDTH_TYPE'FIRST;
  22353.    -- The value used for drawing the border lines is always one.
  22354.      
  22355.    EFFECTIVE_AREA_COLOUR_INDEX : LEXI_COLOUR_INDEX;
  22356.    -- The value derived from the state list fill area colour and used
  22357.    -- for drawing the border lines and the area itself if solid.
  22358.      
  22359.    EFFECTIVE_INTERIOR_STYLE : LEXI_INTERIOR_STYLE;
  22360.    -- The value derived from the state list fill area interior style and
  22361.    -- used to determine if the interior area is solid.
  22362.      
  22363.    DC_AREA : DC.POINT_ARRAY (FILL_AREA_POINTS'RANGE);
  22364.    -- Contains the points in FILL_AREA_POINTS after they have been
  22365.    -- transformed into DC.
  22366.      
  22367.    CLIPPED_DC_AREAS : WSR_UTILITIES.LIST_OF_AREAS;
  22368.    -- Contains the border points of any area(s) which are obtained by
  22369.    -- clipping the DC_POINTS to the area of the Effective Clipping
  22370.    -- Rectangle.
  22371.      
  22372.    function "=" (LEFT, RIGHT : WSR_UTILITIES.LIST_OF_AREAS)
  22373.       return BOOLEAN renames WSR_UTILITIES."=";
  22374.    -- The equals function is made locally visible for use in infix
  22375.    -- notation.
  22376.      
  22377.    TEMP_CLIPPED_DC_AREAS : WSR_UTILITIES.LIST_OF_AREAS;
  22378.    -- A temporary holding place for CLIPPED_DC_AREAS;
  22379.      
  22380.    procedure DISPOSE_AREA is new UNCHECKED_DEALLOCATION
  22381.       (OBJECT => WSR_UTILITIES.AREA,
  22382.        NAME   => WSR_UTILITIES.LIST_OF_AREAS);
  22383.    -- This procedure is used to dispose of CLIPPED_DC_AREAS after they
  22384.    -- have been drawn.
  22385.      
  22386.    type RECTANGLE is
  22387.       record
  22388.          UPPER_LEFT  : DC.POINT;
  22389.          LOWER_RIGHT : DC.POINT;
  22390.       end record;
  22391.    -- This type defines the corner points of a rectangle which is
  22392.    -- parallel to the X and Y axes.
  22393.      
  22394.    SMALLEST_SURROUNDING_RECTANGLE : RECTANGLE;
  22395.    -- This contains two opposite corners of the smallest rectangle which
  22396.    -- is square with the axes and contains all of points in an area.
  22397.      
  22398.    IDC_LOWER_RIGHT_CORNER, IDC_UPPER_LEFT_CORNER : LEXI_POINT;
  22399.    -- Contains the two corner points from the SMALLEST_SURROUNDING_
  22400.    -- RECTANGLE translated into IDC coordinates.
  22401.      
  22402.    SOMETHING_VISIBLE_IN_VIEWPORT : BOOLEAN := FALSE;
  22403.    -- Set to FALSE when all of the FILL_AREA_POINTS are clipped. Set to
  22404.    -- TRUE when some part of the Fill Area is visible.
  22405.      
  22406.    procedure FIND_EXTENTS
  22407.       (INPUT_POINTS                   : in WSR_UTILITIES.LIST_OF_AREAS;
  22408.        SMALLEST_SURROUNDING_RECTANGLE : out RECTANGLE)
  22409.       is separate;
  22410.      
  22411. begin
  22412.      
  22413.    -- Translate the input points from NDC to DC.
  22414.    DC_AREA := CONVERT_NDC_DC.DC_POINT_ARRAY
  22415.       (FILL_AREA_POINTS.all, WS_SL.WS_TRANSFORM);
  22416.      
  22417.    -- Use the EFFECTIVE_CLIPPING_RECTANGLE to clip the input region into
  22418.    -- an arbitrary number of areas interior to the clipping rectangle.
  22419.    -- Obtain the enclosing rectangle's corners from the Workstation
  22420.    -- Resource.
  22421.    WSR_UTILITIES.AREA_CLIP (DC_AREA,
  22422.       WS_SL.EFFECTIVE_CLIPPING_RECTANGLE, CLIPPED_DC_AREAS);
  22423.      
  22424.    -- Determine if anything will be drawn and set the display attributes
  22425.    -- before drawing the areas' borders.
  22426.    if not (CLIPPED_DC_AREAS = null) then
  22427.      
  22428.       -- Assign the current fill area colour index to EFFECTIVE_AREA_
  22429.       -- COLOUR_INDEX. If the colour index is not in the list of indices
  22430.       -- which have been associated with a set of intensity values, the
  22431.       -- value 1 is assigned.
  22432.       if not COLOUR_INDICES.IS_IN_LIST
  22433.          (WS_SL.EFFECTIVE_FILL_AREA_ATTR.COLOUR,
  22434.           WS_SL.SET_OF_COLOUR_IDC) then
  22435.          EFFECTIVE_AREA_COLOUR_INDEX := 1;
  22436.       else EFFECTIVE_AREA_COLOUR_INDEX := LEXI_COLOUR_INDEX
  22437.          (WS_SL.EFFECTIVE_FILL_AREA_ATTR.COLOUR);
  22438.       end if;
  22439.      
  22440.       -- Assign the current fill area interior style to the EFFECTIVE_
  22441.       -- INTERIOR_STYLE. If the current fill area interior style is not
  22442.       -- supported on the Lexidata, the value HOLLOW is assigned.
  22443.       if WS_SL.EFFECTIVE_FILL_AREA_ATTR.INT_STYLE = SOLID then
  22444.          EFFECTIVE_INTERIOR_STYLE := LEXI3700_TYPES.SOLID;
  22445.       else
  22446.       EFFECTIVE_INTERIOR_STYLE := LEXI3700_TYPES.HOLLOW;
  22447.       end if;
  22448.      
  22449.       -- Set the flags which indicate that something is being drawn.
  22450.       SOMETHING_VISIBLE_IN_VIEWPORT := TRUE;
  22451.       WS_SL.WS_DISPLAY_SURFACE := NOTEMPTY;
  22452.      
  22453.    -- Repeat until all of the boundry points are drawn.
  22454.    while not (CLIPPED_DC_AREAS = null) loop
  22455.      
  22456.       declare
  22457.      
  22458.          IDC_AREA : LEXI_POINTS (CLIPPED_DC_AREAS.BORDER.POINTS'RANGE);
  22459.          -- Contains the border points of the next fill area after they
  22460.          -- have been translated into IDC coordinates.
  22461.      
  22462.       begin
  22463.      
  22464.          -- Translate the boundary points of an area into IDC.
  22465.          IDC_AREA := LEXI_UTILITIES.IDC
  22466.             (CLIPPED_DC_AREAS.BORDER.POINTS);
  22467.      
  22468.          -- If the interior style is SOLID, fill in the area.
  22469.          if EFFECTIVE_INTERIOR_STYLE = SOLID then
  22470.      
  22471.             -- Clear the edge flags in the last bit plane that had been
  22472.             -- set during the previous FILL_AREA.
  22473.             LEXI3700_OUTPUT_DRIVER.CLEAR_DISPLAY
  22474.                (LEXI_PLANE_VALUE'(128));
  22475.      
  22476.             -- Set the display parameters for setting the flags.
  22477.             LEXI3700_OUTPUT_DRIVER.SET_DISPLAY_PARAMETERS
  22478.                (EFFECTIVE_LINE_WIDTH, EFFECTIVE_LINETYPE,
  22479.                 LEXI_INTERIOR_STYLE'(SOLID));
  22480.      
  22481.             -- Set the fill flags around the border of the area.
  22482.             LEXI3700_OUTPUT_DRIVER.DISPLAY_CHAINED_VECTORS
  22483.                   (LEXI_COLOUR_INDEX(128), IDC_AREA);
  22484.      
  22485.             -- Determine the smallest area that must be analysed by the
  22486.             -- Device Driver's Fill Area.
  22487.             FIND_EXTENTS
  22488.                (CLIPPED_DC_AREAS, SMALLEST_SURROUNDING_RECTANGLE);
  22489.      
  22490.             -- Translate the smallest enclosing rectangle into IDC.
  22491.             IDC_UPPER_LEFT_CORNER  := LEXI_UTILITIES.IDC
  22492.                (SMALLEST_SURROUNDING_RECTANGLE.UPPER_LEFT);
  22493.      
  22494.             IDC_LOWER_RIGHT_CORNER := LEXI_UTILITIES.IDC
  22495.                (SMALLEST_SURROUNDING_RECTANGLE.LOWER_RIGHT);
  22496.      
  22497.             -- Call the Device Driver to set the scan area for the fill.
  22498.             LEXI3700_OUTPUT_DRIVER.SET_RECTANGULAR_LIMIT
  22499.                (IDC_UPPER_LEFT_CORNER, IDC_LOWER_RIGHT_CORNER);
  22500.      
  22501.             -- Reset the display parameters so that the solid colours
  22502.             -- don't bleed.
  22503.             LEXI3700_OUTPUT_DRIVER.SET_DISPLAY_PARAMETERS
  22504.                (EFFECTIVE_LINE_WIDTH, EFFECTIVE_LINETYPE,
  22505.                 LEXI_INTERIOR_STYLE'(HOLLOW));
  22506.      
  22507.             -- Fill with the proper colour.
  22508.             LEXI3700_OUTPUT_DRIVER.POLYGON_EDGE_FLAG_FILL
  22509.                (EFFECTIVE_AREA_COLOUR_INDEX);
  22510.      
  22511.          -- If the area is hollow, set the proper attributes for the
  22512.          -- border.
  22513.          else
  22514.      
  22515.             -- Set the attributes for drawing the border points. Send
  22516.             -- the Device Driver the linetype and line width as well as
  22517.             -- a flag indicating that the points will not be used later
  22518.             -- on for a polygon fill.
  22519.             LEXI3700_OUTPUT_DRIVER.SET_DISPLAY_PARAMETERS
  22520.                (EFFECTIVE_LINE_WIDTH, EFFECTIVE_LINETYPE,
  22521.                 LEXI_INTERIOR_STYLE'(HOLLOW));
  22522.      
  22523.          end if;
  22524.      
  22525.          -- Draw the border points both for HOLLOW and SOLID.
  22526.          LEXI3700_OUTPUT_DRIVER.DISPLAY_CHAINED_VECTORS
  22527.                (EFFECTIVE_AREA_COLOUR_INDEX, IDC_AREA);
  22528.      
  22529.       -- declare block.
  22530.       end;
  22531.      
  22532.       -- Continue with the next region and destroy the space occupied by
  22533.       -- the current region.
  22534.       TEMP_CLIPPED_DC_AREAS := CLIPPED_DC_AREAS;
  22535.       CLIPPED_DC_AREAS := CLIPPED_DC_AREAS.NEXT_AREA;
  22536.       DISPOSE_AREA (TEMP_CLIPPED_DC_AREAS);
  22537.      
  22538.    end loop;
  22539.      
  22540.    end if;
  22541.      
  22542.    -- Flush the output buffer on the device if the deferral mode is ASAP
  22543.    if WS_SL.WS_DEFERRAL_MODE = ASAP then
  22544.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  22545.    end if;
  22546.      
  22547. end FILL_AREA;
  22548. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22549. --:UDD:GKSADACM:CODE:MA:WSD_FIND_EXTENTS.ADA
  22550. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22551. ------------------------------------------------------------------
  22552. --
  22553. --  NAME: FIND_EXTENTS
  22554. --  IDENTIFIER: GDMXXX.1(2)
  22555. --  DISCREPANCY REPORTS:
  22556. --  DR039  New WSD_FIND_EXTENTS replaces ma & 0a version.
  22557. ------------------------------------------------------------------
  22558. -- FILE : WSD_FIND_EXTENTS.ADA
  22559. -- LEVEL : All levels
  22560.      
  22561. separate (LEXI3700_OUTPUT_PRIMITIVES.FILL_AREA)
  22562.      
  22563. procedure FIND_EXTENTS
  22564.    (INPUT_POINTS                   : in WSR_UTILITIES.LIST_OF_AREAS;
  22565.     SMALLEST_SURROUNDING_RECTANGLE : out RECTANGLE) is
  22566.      
  22567. -- This procedure is used to find the extent or bounding box of the
  22568. -- figure being output. All of the X and Y coordinates are compared
  22569. -- and the largest and smallest are returned as the opposite corners
  22570. -- of the bounding box.
  22571. --
  22572. -- INPUT_POINTS                   - the figure being boxed in.
  22573. -- SMALLEST_SURROUNDING_RECTANGLE - the box which surrounds it.
  22574.      
  22575.    X_MIN : DC_TYPE := INPUT_POINTS.BORDER.POINTS(1).X;
  22576.    X_MAX : DC_TYPE := INPUT_POINTS.BORDER.POINTS(1).X;
  22577.    Y_MIN : DC_TYPE := INPUT_POINTS.BORDER.POINTS(1).Y;
  22578.    Y_MAX : DC_TYPE := INPUT_POINTS.BORDER.POINTS(1).Y;
  22579.    -- The extrema are initialized to the value of the first point in the
  22580.    -- first area.
  22581.      
  22582. begin
  22583.      
  22584.    -- Repeat for each point in the area.
  22585.    for I in 2 .. INPUT_POINTS.BORDER.LENGTH loop
  22586.      
  22587.       -- If the X value of the current point is larger or smaller
  22588.       -- than all previous points, alter the proper extrema.
  22589.       if INPUT_POINTS.BORDER.POINTS (I).X < X_MIN then
  22590.          X_MIN := INPUT_POINTS.BORDER.POINTS (I).X;
  22591.       elsif INPUT_POINTS.BORDER.POINTS (I).X > X_MAX then
  22592.          X_MAX := INPUT_POINTS.BORDER.POINTS (I).X;
  22593.       end if;
  22594.      
  22595.       -- If the Y value of the current point is larger or smaller
  22596.       -- than all previous points, alter the proper extrema.
  22597.       if INPUT_POINTS.BORDER.POINTS (I).Y < Y_MIN then
  22598.          Y_MIN := INPUT_POINTS.BORDER.POINTS (I).Y;
  22599.       elsif INPUT_POINTS.BORDER.POINTS (I).Y > Y_MAX then
  22600.          Y_MAX := INPUT_POINTS.BORDER.POINTS (I).Y;
  22601.       end if;
  22602.      
  22603.     -- Go on to the next point.
  22604.    end loop;
  22605.      
  22606.    -- Return to the calling program with the proper values.
  22607.    SMALLEST_SURROUNDING_RECTANGLE.UPPER_LEFT := (X_MIN, Y_MAX);
  22608.    SMALLEST_SURROUNDING_RECTANGLE.LOWER_RIGHT := (X_MAX, Y_MIN);
  22609.      
  22610. end FIND_EXTENTS;
  22611. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22612. --:UDD:GKSADACM:CODE:0A:WSD_TEXT_0A.ADA
  22613. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22614. ------------------------------------------------------------------
  22615. --
  22616. --  NAME: TEXT
  22617. --  IDENTIFIER: GDMXXX.1(1)
  22618. --  DISCREPANCY REPORTS:
  22619. --
  22620. ------------------------------------------------------------------
  22621. -- FILE: WSD_TEXT_0A.ADA
  22622. -- LEVEL: LEVEL 0A
  22623.      
  22624. separate (LEXI3700_OUTPUT_PRIMITIVES)
  22625.      
  22626. procedure TEXT
  22627.    (WS_SL         : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22628.     TEXT_POSITION : NDC.POINT;
  22629.     TEXT_STRING   : ACCESS_STRING_TYPE) is
  22630.      
  22631. -- This procedure inquires into the WS State List to find
  22632. -- what the current attribute settings are.
  22633. --
  22634. -- The relevant attributes are as follows:
  22635. -- CHARACTER_SPACING, TEXT_COLOUR_INDEX, CHARACTER_HEIGHT, TEXT_PATH
  22636. -- CHARACTER_UP_VECTOR, TEXT_ALIGNMENT
  22637. --
  22638. -- This procedure calls the IDC procedure in WSD_UTILITIES to
  22639. -- convert the NDC points to IDC (INTEGER DEVICE COORDINATES).
  22640. --
  22641. -- WS_SL         - is a pointer to the Workstation State List.
  22642. -- TEXT_POSITION - contains the position to display text.
  22643. -- TEXT_STRING   - contains a string of text to be displayed.
  22644.      
  22645. DEVICE_POINT : LEXI_POINT;
  22646. -- contains the starting point for the text string.
  22647.      
  22648. DC_POINT : DC.POINT;
  22649. -- contains the starting point in DC coordinates.
  22650.      
  22651. IS_VALID : BOOLEAN;
  22652. -- Contains a flag indicating if a colour index is valid.
  22653.      
  22654. TEXT_COLOUR : LEXI_COLOUR_INDEX;
  22655. -- Contains the colour index to be used.
  22656.      
  22657. OFFSET : DC.POINT;
  22658. -- Contains an x and y offset to use for each character.
  22659.      
  22660. LEXI_CHAR_SIZE : LEXI_TEXT_SIZE;
  22661. -- Contains the multiplication factor for text size.
  22662.      
  22663. CHAR_HEIGHT : DC_TYPE;
  22664. -- Contains the physical requested height of the character.
  22665.      
  22666. AVAILABLE_HEIGHT : INTEGER;
  22667. -- Contains the available scale factor for text sizes.
  22668.      
  22669. FIRST_VALID, LAST_VALID : POSITIVE;
  22670. -- An index into the string of characters.
  22671.      
  22672. LEXI_CHAR_ROTATION : LEXI_ROTATE_CODE;
  22673. -- Contains the character rotation offered by the device.
  22674.      
  22675. LEXI_PATH : LEXI_CHARACTER_PATH;
  22676. -- Contains the path offered by the device.
  22677.      
  22678. FORTY_FIVE     : constant DC_TYPE := 0.707107;
  22679. NEG_FORTY_FIVE : constant DC_TYPE := -0.707107;
  22680. -- Contains the vector values to determine the character rotation.
  22681.      
  22682. DC_CHAR_HEIGHT_VECTOR : DC.VECTOR;
  22683. -- Contains the height vector converted to DC.
  22684.      
  22685. Y_COMP_VECTOR, X_COMP_VECTOR : DC_TYPE;
  22686. -- Contains the X and Y vectors to determine the character rotation.
  22687.      
  22688. START_POSITION : DC.POINT;
  22689. -- Contains the physical starting point to display the text string.
  22690.      
  22691. TEI_LOWER_LEFT  : DC.POINT;
  22692. -- Contains the parallelogram containing the text string.
  22693.      
  22694. TEI_LOWER_RIGHT : DC.POINT;
  22695. -- Contains the parallelogram containing the text string.
  22696.      
  22697. TEI_UPPER_LEFT  : DC.POINT;
  22698. -- Contains the parallelogram containing the text string.
  22699.      
  22700. TEI_UPPER_RIGHT : DC.POINT;
  22701. -- Contains the parallelogram containing the text string.
  22702.      
  22703. DISPLAY_CHARACTER : BOOLEAN;
  22704. -- Determine if the character is within the viewing window.
  22705.      
  22706.    function "=" (A, B: LEXI_UTILITIES.STATUS_OF_POINTS) return BOOLEAN
  22707.       renames LEXI_UTILITIES."=";
  22708.      
  22709.    function IS_CHARACTER_IN (START_POSITION     : DC.POINT;
  22710.                              PHYS_CHAR_HT       : DC_TYPE;
  22711.                              PHYS_CHAR_WT       : DC_TYPE;
  22712.                              CLIPPING_RECTANGLE : DC.RECTANGLE_LIMITS;
  22713.                              LEXI_CHAR_ROTATION : LEXI_ROTATE_CODE)
  22714.       return BOOLEAN is
  22715.      
  22716.    ORIGINAL_POINT : DC.POINT_ARRAY (1 .. 4);
  22717.    CLIPPED_POINT  : DC.POINT_ARRAY (1 .. 4);
  22718.    CLIP_STATUS    : LEXI_UTILITIES.STATUS_OF_POINTS;
  22719.    IS_OUT         : BOOLEAN := true;
  22720.      
  22721.    begin
  22722.       case LEXI_CHAR_ROTATION is
  22723.          when NO_ROTATION =>
  22724.             ORIGINAL_POINT (1).X := START_POSITION.X;
  22725.             ORIGINAL_POINT (1).Y := START_POSITION.Y;
  22726.             ORIGINAL_POINT (2).X := START_POSITION.X + PHYS_CHAR_WT;
  22727.             ORIGINAL_POINT (2).Y := START_POSITION.Y;
  22728.             ORIGINAL_POINT (3).X := START_POSITION.X;
  22729.             ORIGINAL_POINT (3).Y := START_POSITION.Y - PHYS_CHAR_HT;
  22730.             ORIGINAL_POINT (4).X := START_POSITION.X + PHYS_CHAR_WT;
  22731.             ORIGINAL_POINT (4).Y := START_POSITION.Y - PHYS_CHAR_HT;
  22732.      
  22733.          when ROTATION_90 =>
  22734.             ORIGINAL_POINT (1).X := START_POSITION.X;
  22735.             ORIGINAL_POINT (1).Y := START_POSITION.Y + PHYS_CHAR_WT;
  22736.             ORIGINAL_POINT (2).X := START_POSITION.X + PHYS_CHAR_HT;
  22737.             ORIGINAL_POINT (2).Y := START_POSITION.Y + PHYS_CHAR_WT;
  22738.             ORIGINAL_POINT (3).X := START_POSITION.X;
  22739.             ORIGINAL_POINT (3).Y := START_POSITION.Y;
  22740.             ORIGINAL_POINT (4).X := START_POSITION.X + PHYS_CHAR_HT;
  22741.             ORIGINAL_POINT (4).Y := START_POSITION.Y;
  22742.      
  22743.          when ROTATION_180 =>
  22744.             ORIGINAL_POINT (1).X := START_POSITION.X - PHYS_CHAR_WT;
  22745.             ORIGINAL_POINT (1).Y := START_POSITION.Y + PHYS_CHAR_HT;
  22746.             ORIGINAL_POINT (2).X := START_POSITION.X;
  22747.             ORIGINAL_POINT (2).Y := START_POSITION.Y + PHYS_CHAR_HT;
  22748.             ORIGINAL_POINT (3).X := START_POSITION.X - PHYS_CHAR_WT;
  22749.             ORIGINAL_POINT (3).Y := START_POSITION.Y;
  22750.             ORIGINAL_POINT (4).X := START_POSITION.X;
  22751.             ORIGINAL_POINT (4).Y := START_POSITION.Y;
  22752.      
  22753.          when ROTATION_270 =>
  22754.             ORIGINAL_POINT (1).X := START_POSITION.X - PHYS_CHAR_HT;
  22755.             ORIGINAL_POINT (1).Y := START_POSITION.Y;
  22756.             ORIGINAL_POINT (2).X := START_POSITION.X;
  22757.             ORIGINAL_POINT (2).Y := START_POSITION.Y;
  22758.             ORIGINAL_POINT (3).X := START_POSITION.X - PHYS_CHAR_HT;
  22759.             ORIGINAL_POINT (3).Y := START_POSITION.Y - PHYS_CHAR_WT;
  22760.             ORIGINAL_POINT (4).X := START_POSITION.X;
  22761.             ORIGINAL_POINT (4).Y := START_POSITION.Y - PHYS_CHAR_WT;
  22762.       end case;
  22763.      
  22764.       LEXI_UTILITIES.CLIP_TO_SCREEN (ORIGINAL_POINT,
  22765.                                      CLIPPED_POINT,
  22766.                                      CLIP_STATUS,
  22767.                                      CLIPPING_RECTANGLE);
  22768.      
  22769.       if CLIP_STATUS = LEXI_UTILITIES.ALL_OUTSIDE then
  22770.          IS_OUT := false;
  22771.       end if;
  22772.      
  22773.       return (IS_OUT);
  22774.    end IS_CHARACTER_IN;
  22775.      
  22776. -- Beginning of main procedure TEXT.
  22777.      
  22778. begin
  22779.      
  22780.    IS_VALID := COLOUR_INDICES.IS_IN_LIST
  22781.                  (WS_SL.EFFECTIVE_TEXT_ATTR.COLOUR,
  22782.                   WS_SL.SET_OF_COLOUR_IDC);
  22783.    if IS_VALID then
  22784.       TEXT_COLOUR := LEXI_COLOUR_INDEX(WS_SL.EFFECTIVE_TEXT_ATTR.COLOUR);
  22785.    else
  22786.       TEXT_COLOUR := LEXI_COLOUR_INDEX(1);
  22787.    end if;
  22788.    DC_CHAR_HEIGHT_VECTOR := CONVERT_NDC_DC.DC_VECTOR
  22789.         (WS_SL.OUTPUT_ATTR.CURRENT_CHAR_HEIGHT_VECTOR, WS_SL.WS_TRANSFORM);
  22790.      
  22791.    CHAR_HEIGHT := DC_POINT_OPS.NORM(DC_CHAR_HEIGHT_VECTOR);
  22792.      
  22793.    DC_POINT := CONVERT_NDC_DC.DC_POINT
  22794.                  (TEXT_POSITION, WS_SL.WS_TRANSFORM);
  22795.      
  22796.    WSR_UTILITIES.TEXT_HANDLING
  22797.        (DC_TYPE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP),
  22798.         DC_TYPE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_BASE_BOTTOM),
  22799.         WS_SL.OUTPUT_ATTR.CURRENT_TEXT_PATH,
  22800.         WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT,
  22801.         DC_CHAR_HEIGHT_VECTOR,
  22802.         CONVERT_NDC_DC.DC_VECTOR
  22803.              (WS_SL.OUTPUT_ATTR.CURRENT_CHAR_WIDTH_VECTOR,
  22804.               WS_SL.WS_TRANSFORM),
  22805.         WS_SL.OUTPUT_ATTR.CURRENT_CHAR_EXPANSION_FACTOR,
  22806.         WS_SL.OUTPUT_ATTR.CURRENT_CHAR_SPACING,
  22807.         DC_POINT,
  22808.         TEXT_STRING'LENGTH,
  22809.         DC_TYPE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT),
  22810.         START_POSITION,
  22811.         OFFSET,
  22812.         TEI_LOWER_LEFT,
  22813.         TEI_LOWER_RIGHT,
  22814.         TEI_UPPER_LEFT,
  22815.         TEI_UPPER_RIGHT);
  22816.      
  22817.    X_COMP_VECTOR := DC_CHAR_HEIGHT_VECTOR.X / CHAR_HEIGHT;
  22818.    Y_COMP_VECTOR := DC_CHAR_HEIGHT_VECTOR.Y / CHAR_HEIGHT;
  22819.      
  22820.      
  22821.    AVAILABLE_HEIGHT := abs (INTEGER (CHAR_HEIGHT) /
  22822.       LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT);
  22823.      
  22824.    if AVAILABLE_HEIGHT > INTEGER(LEXI_TEXT_SIZE'LAST) then
  22825.       LEXI_CHAR_SIZE := LEXI_TEXT_SIZE'LAST;
  22826.    elsif AVAILABLE_HEIGHT < INTEGER(LEXI_TEXT_SIZE'FIRST) then
  22827.       LEXI_CHAR_SIZE := LEXI_TEXT_SIZE'FIRST;
  22828.    else
  22829.       LEXI_CHAR_SIZE := LEXI_TEXT_SIZE(AVAILABLE_HEIGHT);
  22830.    end if;
  22831.      
  22832.    if X_COMP_VECTOR > NEG_FORTY_FIVE and X_COMP_VECTOR < FORTY_FIVE then
  22833.       if Y_COMP_VECTOR < 0.0 then
  22834.          LEXI_CHAR_ROTATION := ROTATION_180;
  22835.          START_POSITION.Y := START_POSITION.Y -
  22836.             (DC_TYPE
  22837.             (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  22838.             + DC_TYPE
  22839.             (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP))
  22840.             * DC_TYPE(LEXI_CHAR_SIZE);
  22841.       else
  22842.          LEXI_CHAR_ROTATION := NO_ROTATION;
  22843.          START_POSITION.Y := START_POSITION.Y +
  22844.               (DC_TYPE
  22845.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  22846.               + DC_TYPE
  22847.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP))
  22848.               * DC_TYPE(LEXI_CHAR_SIZE);
  22849.      end if;
  22850.    else
  22851.       if X_COMP_VECTOR < 0.0 then
  22852.          LEXI_CHAR_ROTATION := ROTATION_90;
  22853.          START_POSITION.X := START_POSITION.X -
  22854.               (DC_TYPE
  22855.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  22856.               + DC_TYPE
  22857.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP))
  22858.               * DC_TYPE(LEXI_CHAR_SIZE);
  22859.       else
  22860.          LEXI_CHAR_ROTATION := ROTATION_270;
  22861.          START_POSITION.X := START_POSITION.X +
  22862.               (DC_TYPE
  22863.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  22864.               + DC_TYPE
  22865.               (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP))
  22866.               * DC_TYPE(LEXI_CHAR_SIZE);
  22867.       end if;
  22868.    end if;
  22869.      
  22870.    WSR_UTILITIES.TEXT_CLIP
  22871.        (START_POSITION,
  22872.         TEXT_STRING'LENGTH,
  22873.         WS_SL.EFFECTIVE_CLIPPING_RECTANGLE,
  22874.         OFFSET,
  22875.         FIRST_VALID,
  22876.         LAST_VALID);
  22877.      
  22878.    START_POSITION.X := START_POSITION.X + (OFFSET.X *
  22879.         DC_TYPE(FIRST_VALID - 1));
  22880.    START_POSITION.Y := START_POSITION.Y + (OFFSET.Y *
  22881.         DC_TYPE(FIRST_VALID - 1));
  22882.      
  22883.    LEXI3700_OUTPUT_DRIVER.SET_TEXT_CHARACTER_ROTATION
  22884.        (LEXI_CHAR_ROTATION);
  22885.      
  22886.    case LEXI_CHAR_ROTATION is
  22887.       when NO_ROTATION  => LEXI_PATH := LEFT_TO_RIGHT;
  22888.       when ROTATION_90  => LEXI_PATH := BOTTOM_TO_TOP;
  22889.       when ROTATION_180 => LEXI_PATH := RIGHT_TO_LEFT;
  22890.       when ROTATION_270 => LEXI_PATH := TOP_TO_BOTTOM;
  22891.    end case;
  22892.      
  22893. -- Stroke precision code.
  22894.      
  22895.    if WS_SL.OUTPUT_ATTR.CURRENT_TEXT_FONT_AND_PRECISION.PRECISION =
  22896.       CHAR_PRECISION then
  22897.          DISPLAY_CHARACTER := IS_CHARACTER_IN
  22898.             (START_POSITION,
  22899.              DC_TYPE(
  22900.              DC_TYPE(LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_HEIGHT)
  22901.                + DC_TYPE
  22902.                  (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP)
  22903.                + DC_TYPE
  22904.                  (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_BASE_BOTTOM))
  22905.                * DC_TYPE (LEXI_CHAR_SIZE),
  22906.              DC_TYPE (LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_WIDTH),
  22907.              WS_SL.EFFECTIVE_CLIPPING_RECTANGLE,
  22908.              LEXI_CHAR_ROTATION);
  22909.      
  22910.      
  22911.       if DISPLAY_CHARACTER = false then
  22912.          LAST_VALID := LAST_VALID - 1;
  22913.       end if;
  22914.    end if;
  22915.      
  22916.    if LAST_VALID >= FIRST_VALID then
  22917.       DEVICE_POINT :=  LEXI_UTILITIES.IDC(START_POSITION);
  22918.    end if;
  22919.      
  22920.    for I in FIRST_VALID .. LAST_VALID loop
  22921.        LEXI3700_OUTPUT_DRIVER.SET_TEXT_PARAMETERS
  22922.             (DEVICE_POINT, TEXT_COLOUR,
  22923.              LEXI_CHARACTER_PATH'(LEXI_PATH),
  22924.              LEXI_CHAR_SIZE);
  22925.        LEXI3700_OUTPUT_DRIVER.DISPLAY_TEXT(TEXT_STRING(I .. I));
  22926.      
  22927.        if I /= LAST_VALID then
  22928.           DEVICE_POINT.X := LEXI_COORDINATE(DC_TYPE(DEVICE_POINT.X) +
  22929.                OFFSET.X);
  22930.           DEVICE_POINT.Y := LEXI_COORDINATE(DC_TYPE(DEVICE_POINT.Y) -
  22931.                OFFSET.Y);
  22932.        else
  22933.           -- If text is being displayed, we set the display surface
  22934.           -- to not empty. This occurs after the text has been drawn.
  22935.      
  22936.           WS_SL.WS_DISPLAY_SURFACE := NOTEMPTY;
  22937.        end if;
  22938.    end loop;
  22939.      
  22940.    if WS_SL.WS_DEFERRAL_MODE = ASAP then
  22941.       -- Flush the output buffer on the device if the deferral mode is ASAP
  22942.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  22943.    end if;
  22944.      
  22945. end TEXT;
  22946. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22947. --:UDD:GKSADACM:CODE:MA:WSR_SET_PRIM_MA.ADA
  22948. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22949. ------------------------------------------------------------------
  22950. --
  22951. --  NAME: WSR_SET_PRIMITIVE_ATTRIBUTES_MA
  22952. --  IDENTIFIER: GDMXXX.1(1)
  22953. --  DISCREPANCY REPORTS:
  22954. --
  22955. ------------------------------------------------------------------
  22956. -- file: WSR_SET_PRIM_MA.ADA
  22957. -- level: ma,0a,1a,2a
  22958.      
  22959. with GKS_TYPES;
  22960. with WS_STATE_LIST_TYPES;
  22961. with WS_DESCRIPTION_TABLE_TYPES;
  22962.      
  22963. use  GKS_TYPES;
  22964.      
  22965. package WSR_SET_PRIMITIVE_ATTRIBUTES_MA is
  22966.      
  22967. -- This package is a workstation resource package.  It can be used by
  22968. -- any workstation that needs to have the primitive attributes changed
  22969. -- in its workstation state list.
  22970.      
  22971.    procedure SET_CHAR_VECTORS
  22972.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22973.        CHAR_HEIGHT_VECTOR : in NDC.VECTOR;
  22974.        CHAR_WIDTH_VECTOR  : in NDC.VECTOR);
  22975.      
  22976.    procedure SET_TEXT_ALIGNMENT
  22977.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  22978.        ALIGNMENT : in TEXT_ALIGNMENT);
  22979.      
  22980. end WSR_SET_PRIMITIVE_ATTRIBUTES_MA;
  22981. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22982. --:UDD:GKSADACM:CODE:MA:WSR_SET_PRIM_MA_B.ADA
  22983. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  22984. ------------------------------------------------------------------
  22985. --
  22986. --  NAME: WSR_SET_PRIMITIVE_ATTRIBUTES_MA - BODY
  22987. --  IDENTIFIER: GDMXXX.1(1)
  22988. --  DISCREPANCY REPORTS:
  22989. --
  22990. ------------------------------------------------------------------
  22991. -- file: WSR_SET_PRIM_MA_B.ADA
  22992. -- level: ma,0a,1a,2a
  22993.      
  22994. package body WSR_SET_PRIMITIVE_ATTRIBUTES_MA is
  22995.      
  22996. -- The following procedures set the value specified by the parameter
  22997. -- in the WS_STATE_LIST.
  22998.      
  22999.    procedure SET_CHAR_VECTORS
  23000.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23001.        CHAR_HEIGHT_VECTOR : in NDC.VECTOR;
  23002.        CHAR_WIDTH_VECTOR  : in NDC.VECTOR) is separate;
  23003.      
  23004.    procedure SET_TEXT_ALIGNMENT
  23005.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23006.        ALIGNMENT : in TEXT_ALIGNMENT) is separate;
  23007.      
  23008. end WSR_SET_PRIMITIVE_ATTRIBUTES_MA;
  23009. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23010. --:UDD:GKSADACM:CODE:MA:WSR_SET_CHAR_VECS.ADA
  23011. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23012. ------------------------------------------------------------------
  23013. --
  23014. --  NAME: SET_CHAR_VECTORS
  23015. --  IDENTIFIER: GDMXXX.1(1)
  23016. --  DISCREPANCY REPORTS:
  23017. --
  23018. ------------------------------------------------------------------
  23019. -- file: WSR_SET_CHAR_VECS.ADA
  23020. -- level: ma,0a,1a,2a
  23021.      
  23022. separate (WSR_SET_PRIMITIVE_ATTRIBUTES_MA)
  23023.      
  23024. procedure SET_CHAR_VECTORS
  23025.    (WS_ST_LST      : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23026.     CHAR_HEIGHT_VECTOR : in NDC.VECTOR;
  23027.     CHAR_WIDTH_VECTOR  : in NDC.VECTOR) is
  23028.      
  23029. -- The CURRENT_HEIGHT_VECTOR and CURRENT_WIDTH_VECTOR entries in the
  23030. -- OUTPUT_ATTR record in the WS_STATE_LIST_TYPES package is set to
  23031. -- the values specified by the parameters.
  23032. --
  23033. -- The following parameters are used in this procedure :
  23034. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  23035. -- CHAR_HEIGHT_VECTOR - the upward direction that the character takes,
  23036. --                      as well as the height of the character.
  23037. -- CHAR_WIDTH_VECTOR - the vector in a 90 degree direction with the
  23038. --                     character height.  Also gives the width of the
  23039. --                     character.
  23040.      
  23041. begin
  23042.      
  23043.    WS_ST_LST.OUTPUT_ATTR.CURRENT_CHAR_HEIGHT_VECTOR :=
  23044.          CHAR_HEIGHT_VECTOR;
  23045.      
  23046.    WS_ST_LST.OUTPUT_ATTR.CURRENT_CHAR_WIDTH_VECTOR :=
  23047.          CHAR_WIDTH_VECTOR;
  23048.      
  23049. end SET_CHAR_VECTORS;
  23050. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23051. --:UDD:GKSADACM:CODE:MA:WSR_SET_TEXT_AL.ADA
  23052. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23053. ------------------------------------------------------------------
  23054. --
  23055. --  NAME: SET_TEXT_ALIGNMENT
  23056. --  IDENTIFIER: GDMXXX.1(1)
  23057. --  DISCREPANCY REPORTS:
  23058. --
  23059. ------------------------------------------------------------------
  23060. -- file: WSR_SET_TEXT_AL.ADA
  23061. -- level: ma - 2a
  23062.      
  23063. separate (WSR_SET_PRIMITIVE_ATTRIBUTES_MA)
  23064.      
  23065. procedure SET_TEXT_ALIGNMENT
  23066.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23067.     ALIGNMENT : in TEXT_ALIGNMENT) is
  23068.      
  23069. -- The CURRENT_TEXT_ALIGNMENT entry in the OUTPUT_ATTR record in the
  23070. -- WS_STATE_LIST_TYPES package is set to the value specified by the
  23071. -- parameter.
  23072. --
  23073. -- The following parameters are used in this procedure :
  23074. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  23075. -- TEXT_ALIGNMENT - the position where the text should line up for
  23076. --                  the starting (x, y) value. (i.e. (top,right),
  23077. --                  (normal,normal), or (centre, top) )
  23078.      
  23079. begin
  23080.      
  23081.    WS_ST_LST.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT := ALIGNMENT;
  23082.      
  23083. end SET_TEXT_ALIGNMENT;
  23084. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23085. --:UDD:GKSADACM:CODE:MA:WSR_SET_INDV_MA.ADA
  23086. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23087. ------------------------------------------------------------------
  23088. --
  23089. --  NAME: WSR_SET_INDIVIDUAL_ATTRIBUTES_MA
  23090. --  IDENTIFIER: GDMXXX.1(1)
  23091. --  DISCREPANCY REPORTS:
  23092. --
  23093. ------------------------------------------------------------------
  23094. -- file: WSR_SET_INDV_MA.ADA
  23095. -- level: ma,0a,1a,2a
  23096.      
  23097. with GKS_TYPES;
  23098. with WS_STATE_LIST_TYPES;
  23099. with WS_DESCRIPTION_TABLE_TYPES;
  23100.      
  23101. use GKS_TYPES;
  23102.      
  23103. package WSR_SET_INDIVIDUAL_ATTRIBUTES_MA is
  23104.      
  23105. -- This package is used by any workstation driver that needs to have
  23106. -- the individual attributes changed in its workstation state list.
  23107. -- The procedures first change the entry in the specified workstation
  23108. -- state list then they compute the EFFECTIVE ATTRIBUTES.  The EFFECTIVE
  23109. -- ATTRIBUTES are the attributes the primitives use when being output.
  23110. -- They are the combination of BUNDLED and INDIVIDUAL attributes stored
  23111. -- in a common place.  The EFFECTIVE ATTRIBUTES are an implementation
  23112. -- dependent feature used to optimize the output of primitives.
  23113.      
  23114.    procedure SET_LINETYPE
  23115.       (WS_ST_LST    : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23116.        WS_DSCR_TBL  : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  23117.        LINE         : in out LINETYPE);
  23118.      
  23119.    procedure SET_POLYLINE_COLOUR_INDEX
  23120.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23121.        COLOUR    : in COLOUR_INDEX);
  23122.      
  23123.    procedure SET_MARKER_TYPE
  23124.       (WS_ST_LST    : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23125.        WS_DSCR_TBL  : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  23126.        MARKER       : in out MARKER_TYPE);
  23127.      
  23128.    procedure SET_POLYMARKER_COLOUR_INDEX
  23129.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23130.        COLOUR    : in COLOUR_INDEX);
  23131.      
  23132.    procedure SET_TEXT_COLOUR_INDEX
  23133.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23134.        COLOUR    : in COLOUR_INDEX);
  23135.      
  23136.    procedure SET_FILL_AREA_INTERIOR_STYLE
  23137.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23138.        STYLE     : in INTERIOR_STYLE);
  23139.      
  23140.    procedure SET_FILL_AREA_COLOUR_INDEX
  23141.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23142.        COLOUR    : in COLOUR_INDEX);
  23143.      
  23144. end WSR_SET_INDIVIDUAL_ATTRIBUTES_MA;
  23145. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23146. --:UDD:GKSADACM:CODE:MA:WSR_SET_INDV_MA_B.ADA
  23147. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23148. ------------------------------------------------------------------
  23149. --
  23150. --  NAME: WSR_SET_INDIVIDUAL_ATTRIBUTES_MA - BODY
  23151. --  IDENTIFIER: GDMXXX.1(1)
  23152. --  DISCREPANCY REPORTS:
  23153. --
  23154. ------------------------------------------------------------------
  23155. -- file: WSR_SET_INDV_MA_B.ADA
  23156. -- level: ma,0a,1a,2a
  23157.      
  23158. package body WSR_SET_INDIVIDUAL_ATTRIBUTES_MA is
  23159.      
  23160. -- The following procedures set the value specified by the parameter
  23161. -- in the WS_STATE_LIST.  Some of the attributes chosen may not be
  23162. -- supported on a particular device.  This resource package only
  23163. -- checks the attributes that GKS defines to have a default value if
  23164. -- its not supported and will set it to the default value if not
  23165. -- supported.  The other attributes not having a default value but
  23166. -- defined as being implimentation dependent by GKS are set to the value
  23167. -- chosen by the application programmer.  The converting to a supported
  23168. -- value is left to the implementor of a WS DRIVER.
  23169.      
  23170.    procedure SET_LINETYPE
  23171.       (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23172.        WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  23173.        LINE        : in out LINETYPE) is separate;
  23174.      
  23175.    procedure SET_POLYLINE_COLOUR_INDEX
  23176.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23177.        COLOUR    : in COLOUR_INDEX) is separate;
  23178.      
  23179.    procedure SET_MARKER_TYPE
  23180.       (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23181.        WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  23182.        MARKER      : in out MARKER_TYPE) is separate;
  23183.      
  23184.    procedure SET_POLYMARKER_COLOUR_INDEX
  23185.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23186.        COLOUR    : in COLOUR_INDEX) is separate;
  23187.      
  23188.    procedure SET_TEXT_COLOUR_INDEX
  23189.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23190.        COLOUR    : in COLOUR_INDEX) is separate;
  23191.      
  23192.    procedure SET_FILL_AREA_INTERIOR_STYLE
  23193.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23194.        STYLE     : in INTERIOR_STYLE) is separate;
  23195.      
  23196.    procedure SET_FILL_AREA_COLOUR_INDEX
  23197.       (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23198.        COLOUR    : in COLOUR_INDEX) is separate;
  23199.      
  23200. end WSR_SET_INDIVIDUAL_ATTRIBUTES_MA;
  23201. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23202. --:UDD:GKSADACM:CODE:MA:WSR_SET_LINETYPE.ADA
  23203. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23204. ------------------------------------------------------------------
  23205. --
  23206. --  NAME: SET_LINETYPE
  23207. --  IDENTIFIER: GDMXXX.1(1)
  23208. --  DISCREPANCY REPORTS:
  23209. --
  23210. ------------------------------------------------------------------
  23211. -- file: WSR_SET_LINETYPE.ADA
  23212. -- level: ma,0a,1a,2a
  23213.      
  23214. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  23215.      
  23216. procedure SET_LINETYPE
  23217.    (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23218.     WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  23219.     LINE        : in out LINETYPE) is
  23220.      
  23221. -- The CURRENT_LINETYPE entry in the WS_STATE_LIST in the record
  23222. -- OUTPUT_ATTR is set to the value specified by the parameter. If
  23223. -- the value of the ASF is set to INDIVIDUAL the L_TYPE entry in the
  23224. -- EFFECTIVE_POLYLINE_ATTR is also set to the value specified
  23225. -- by the parameter.
  23226. --
  23227. -- The following parameters are used in this procedure:
  23228. -- WS_ST_LST - The WS_STATE_LIST to set the LINE_TYPE on.
  23229. -- WS_DSCR_TBL - The WS description table describing the specified
  23230. --               device.
  23231. -- LINE - the style line to be used.
  23232.      
  23233. begin
  23234.      
  23235.    if LINETYPES.IS_IN_LIST
  23236.           (LINE, WS_DSCR_TBL.LIST_AVAILABLE_LTYPE) then
  23237.       WS_ST_LST.OUTPUT_ATTR.CURRENT_LINETYPE := LINE;
  23238.    else
  23239.       -- If the line type is not supported on the specified workstation
  23240.       -- the GKS SPECIFICATION requires that the default be linetype 1;
  23241.       LINE := 1;
  23242.       WS_ST_LST.OUTPUT_ATTR.CURRENT_LINETYPE := LINE;
  23243.    end if;
  23244.      
  23245.    -- The following checks the ASF to set if it is set to INDIVIDUAL.
  23246.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS.LINETYPE =
  23247.                                                         INDIVIDUAL then
  23248.       WS_ST_LST.EFFECTIVE_POLYLINE_ATTR.L_TYPE := LINE;
  23249.    end if;
  23250.      
  23251. end SET_LINETYPE;
  23252. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23253. --:UDD:GKSADACM:CODE:MA:WSR_SET_PLIN_CLR_IDX.ADA
  23254. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23255. ------------------------------------------------------------------
  23256. --
  23257. --  NAME: SET_POLYLINE_COLOUR_INDEX
  23258. --  IDENTIFIER: GDMXXX.1(1)
  23259. --  DISCREPANCY REPORTS:
  23260. --
  23261. ------------------------------------------------------------------
  23262. -- file: WSR_SET_PLIN_CLR_IDX.ADA
  23263. -- level: ma - 2a
  23264.      
  23265. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  23266.      
  23267. procedure SET_POLYLINE_COLOUR_INDEX
  23268.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23269.     COLOUR    : in COLOUR_INDEX) is
  23270.      
  23271. -- The CURRENT_POLYLINE_COLOUR_INDEX  entry in the WS_STATE_LIST in the
  23272. -- OUTPUT_ATTR record is  set to the value specified by the parameter.
  23273. -- It only affects the display of subsequent POLYLINES if
  23274. -- its ASF is set to INDIVIDUAL.
  23275. --
  23276. -- The following parameters are used in this procedure:
  23277. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  23278. -- COLOUR - The specified colour to be used.
  23279.      
  23280. begin
  23281.      
  23282.    WS_ST_LST.OUTPUT_ATTR.CURRENT_POLYLINE_COLOUR_INDEX := COLOUR;
  23283.      
  23284.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  23285.    -- If it is, the entry COLOUR in EFFECTIVE_POLYLINE_ATTR will be
  23286.    -- set to the value specified by the parameter.
  23287.      
  23288.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  23289.          .LINE_COLOUR = INDIVIDUAL then
  23290.      
  23291.       WS_ST_LST.EFFECTIVE_POLYLINE_ATTR.COLOUR := COLOUR;
  23292.      
  23293.    end if;
  23294.      
  23295. end SET_POLYLINE_COLOUR_INDEX;
  23296. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23297. --:UDD:GKSADACM:CODE:MA:WSR_SET_PMRK_CLR_IDX.ADA
  23298. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23299. ------------------------------------------------------------------
  23300. --
  23301. --  NAME: SET_POLYMARKER_COLOUR_INDEX
  23302. --  IDENTIFIER: GDMXXX.1(1)
  23303. --  DISCREPANCY REPORTS:
  23304. --
  23305. ------------------------------------------------------------------
  23306. -- file: WSR_SET_PMRK_CLR_IDX.ADA
  23307. -- level: ma - 2a
  23308.      
  23309. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  23310.      
  23311. procedure SET_POLYMARKER_COLOUR_INDEX
  23312.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23313.     COLOUR    : in COLOUR_INDEX) is
  23314.      
  23315. -- The CURRENT_POLYMARKER_COLOUR_INDEX entry in the WS_STATE_LIST in the
  23316. -- OUTPUT_ATTR record is  set to the value specified by the parameter.
  23317. -- It only affects the display of subsequent POLYMARKERS if
  23318. -- its ASF is set to INDIVIDUAL.
  23319. --
  23320. -- The following parameters are used in this procedure:
  23321. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  23322. -- COLOUR - the specified colour to be used.
  23323.      
  23324. begin
  23325.      
  23326.    WS_ST_LST.OUTPUT_ATTR.CURRENT_POLYMARKER_COLOUR_INDEX := COLOUR;
  23327.      
  23328.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  23329.    -- If it is, the entry COLOUR in EFFECTIVE_POLYMARKER_ATTR is
  23330.    -- set to the value specified by the parameter.
  23331.      
  23332.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  23333.          .MARKER_COLOUR = INDIVIDUAL then
  23334.      
  23335.       WS_ST_LST.EFFECTIVE_POLYMARKER_ATTR.COLOUR := COLOUR;
  23336.      
  23337.    end if;
  23338.      
  23339. end SET_POLYMARKER_COLOUR_INDEX;
  23340. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23341. --:UDD:GKSADACM:CODE:MA:WSR_SET_TEXT_CLR_IDX.ADA
  23342. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23343. ------------------------------------------------------------------
  23344. --
  23345. --  NAME: SET_TEXT_COLOUR_INDEX
  23346. --  IDENTIFIER: GDMXXX.1(1)
  23347. --  DISCREPANCY REPORTS:
  23348. --
  23349. ------------------------------------------------------------------
  23350. -- file: WSR_SET_TEXT_CLR_IDX.ADA
  23351. -- level: ma - 2a
  23352.      
  23353. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  23354.      
  23355. procedure SET_TEXT_COLOUR_INDEX
  23356.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23357.     COLOUR    : in COLOUR_INDEX) is
  23358.      
  23359. -- The CURRENT_TEXT_COLOUR_INDEX entry in the WS_STATE_LIST in the
  23360. -- OUTPUT_ATTR record is  set to the value specified by the parameter.
  23361. -- If only affects the display of subsequent TEXT if its ASF is set to
  23362. -- INDIVIDUAL.
  23363. --
  23364. -- The following parameters are used in this procedure:
  23365. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  23366. -- COLOUR  - the specified colour to be used.
  23367.      
  23368. begin
  23369.      
  23370.    WS_ST_LST.OUTPUT_ATTR.CURRENT_TEXT_COLOUR_INDEX := COLOUR;
  23371.      
  23372.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  23373.    -- If it is, the entry COLOUR in EFFECTIVE_TEXT_ATTR is
  23374.    -- set to the value specified by the parameter.
  23375.      
  23376.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  23377.          .TEXT_COLOUR = INDIVIDUAL then
  23378.      
  23379.       WS_ST_LST.EFFECTIVE_TEXT_ATTR.COLOUR := COLOUR;
  23380.      
  23381.    end if;
  23382.      
  23383. end SET_TEXT_COLOUR_INDEX;
  23384. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23385. --:UDD:GKSADACM:CODE:MA:WSR_SET_FA_INT_STY.ADA
  23386. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23387. ------------------------------------------------------------------
  23388. --
  23389. --  NAME: SET_FILL_AREA_INTERIOR_STYLE
  23390. --  IDENTIFIER: GDMXXX.1(1)
  23391. --  DISCREPANCY REPORTS:
  23392. --
  23393. ------------------------------------------------------------------
  23394. -- file: WSR_SET_FA_INT_STY.ADA
  23395. -- level: ma - 2a
  23396.      
  23397. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  23398.      
  23399. procedure SET_FILL_AREA_INTERIOR_STYLE
  23400.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23401.     STYLE     : in INTERIOR_STYLE) is
  23402.      
  23403. -- The CURRENT_FILL_AREA_INTERIOR_STYLE entry in the WS_STATE_LIST in
  23404. -- the OUTPUT_ATTR record is set to the value specified by the
  23405. -- parameter.  It only affects the display of subsequent FILL_AREAs
  23406. -- if its ASF is set to INDIVIDUAL.
  23407. --
  23408. -- The following parameters are used in this procedure:
  23409. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  23410. -- STYLE - the specified intrior style to be used.
  23411.      
  23412. begin
  23413.      
  23414.    WS_ST_LST.OUTPUT_ATTR.CURRENT_FILL_AREA_INTERIOR_STYLE := STYLE;
  23415.      
  23416.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  23417.    -- If it is, the entry INT_STYLE in EFFECTIVE_FILL_AREA_ATTR is
  23418.    -- set to the value specified by the parameter.
  23419.      
  23420.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  23421.          .INTERIOR_STYLE = INDIVIDUAL then
  23422.      
  23423.       WS_ST_LST.EFFECTIVE_FILL_AREA_ATTR.INT_STYLE := STYLE;
  23424.      
  23425.    end if;
  23426.      
  23427. end SET_FILL_AREA_INTERIOR_STYLE;
  23428. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23429. --:UDD:GKSADACM:CODE:MA:WSR_SET_FA_CLR_IDX.ADA
  23430. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23431. ------------------------------------------------------------------
  23432. --
  23433. --  NAME: SET_FILL_AREA_COLOUR_INDEX
  23434. --  IDENTIFIER: GDMXXX.1(1)
  23435. --  DISCREPANCY REPORTS:
  23436. --
  23437. ------------------------------------------------------------------
  23438. -- file: WSR_SET_FA_CLR_IDX.ADA
  23439. -- level: ma - 2a
  23440.      
  23441. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  23442.      
  23443. procedure SET_FILL_AREA_COLOUR_INDEX
  23444.    (WS_ST_LST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23445.     COLOUR    : in COLOUR_INDEX) is
  23446.      
  23447. -- The CURRENT_FILL_AREA_COLOUR_INDEX entry in the WS_STATE_LIST in the
  23448. -- OUTPUT_ATTR record is set to the value specified by the parameter.
  23449. -- It only affects the display of subsequent FILL_AREAS if
  23450. -- its ASF is set to INDIVIDUAL.
  23451. --
  23452. -- The following parameters are used in this procedure:
  23453. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  23454. -- COLOUR - the specified colour to be used.
  23455.      
  23456. begin
  23457.      
  23458.    WS_ST_LST.OUTPUT_ATTR.CURRENT_FILL_AREA_COLOUR_INDEX := COLOUR;
  23459.      
  23460.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  23461.    -- If it is, the entry COLOUR in EFFECTIVE_FILL_AREA_ATTR is
  23462.    -- set to the value specified by the parameter.
  23463.      
  23464.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS
  23465.          .FILL_AREA_COLOUR = INDIVIDUAL then
  23466.      
  23467.       WS_ST_LST.EFFECTIVE_FILL_AREA_ATTR.COLOUR := COLOUR;
  23468.      
  23469.    end if;
  23470.      
  23471. end SET_FILL_AREA_COLOUR_INDEX;
  23472. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23473. --:UDD:GKSADACM:CODE:MA:WSR_SET_MARK_TYPE.ADA
  23474. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23475. ------------------------------------------------------------------
  23476. --
  23477. --  NAME: SET_MARKER_TYPE
  23478. --  IDENTIFIER: GDMXXX.1(1)
  23479. --  DISCREPANCY REPORTS:
  23480. --
  23481. ------------------------------------------------------------------
  23482. -- file: WSR_SET_MARK_TYPE.ADA
  23483. -- level: ma - 2a
  23484.      
  23485. separate (WSR_SET_INDIVIDUAL_ATTRIBUTES_MA)
  23486.      
  23487. procedure SET_MARKER_TYPE
  23488.    (WS_ST_LST   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23489.     WS_DSCR_TBL : in WS_DESCRIPTION_TABLE_TYPES.WS_DESCRIPTION_TBL;
  23490.     MARKER      : in out MARKER_TYPE) is
  23491.      
  23492. -- The CURRENT_MARKER_TYPE  entry in the WS_STATE_LIST in the
  23493. -- OUTPUT_ATTR record is  set to the value specified by the parameter.
  23494. -- It only affects the display of subsequent POLYMARKERS if
  23495. -- its ASF is set to INDIVIDUAL.
  23496. --
  23497. -- The following parameters are used in this procedure:
  23498. -- WS_ST_LST - The specified WS_STATE_LIST to set the value on.
  23499. -- MARKER - the specified polymarker to be used.
  23500.      
  23501. begin
  23502.      
  23503.    if MARKER_TYPES.IS_IN_LIST
  23504.          (MARKER, WS_DSCR_TBL.LIST_AVAILABLE_MARKER_TYPES) then
  23505.      
  23506.       WS_ST_LST.OUTPUT_ATTR.CURRENT_MARKER_TYPE := MARKER;
  23507.      
  23508.    else
  23509.      
  23510.       -- If the specified polymarker is not supported on the specified
  23511.       -- workstation the GKS SPECIFICATION defines marker type 3 must
  23512.       -- be used.
  23513.       MARKER := 3;
  23514.       WS_ST_LST.OUTPUT_ATTR.CURRENT_MARKER_TYPE := MARKER;
  23515.      
  23516.    end if;
  23517.      
  23518.    -- The following checks the ASF to see if it is set to INDIVIDUAL.
  23519.    -- If it is, the entry M_TYPE in EFFECTIVE_POLYMARKER_ATTR will be
  23520.    -- set to the value specified by the parameter.
  23521.      
  23522.    if WS_ST_LST.OUTPUT_ATTR.ASPECT_SOURCE_FLAGS.MARKER_TYPE =
  23523.          INDIVIDUAL then
  23524.      
  23525.       WS_ST_LST.EFFECTIVE_POLYMARKER_ATTR.M_TYPE := MARKER;
  23526.      
  23527.    end if;
  23528.      
  23529. end SET_MARKER_TYPE;
  23530. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23531. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_DSCR_MA.ADA
  23532. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23533. ------------------------------------------------------------------
  23534. --
  23535. --  NAME: WSR_INQ_WS_DESCRIPTION_TABLE_MA
  23536. --  IDENTIFIER: GDMXXX.1(1)
  23537. --  DISCREPANCY REPORTS:
  23538. --
  23539. ------------------------------------------------------------------
  23540. -- File:  WSR_INQ_WS_DSCR_MA.ADA
  23541. -- Level: MA
  23542.      
  23543. with GKS_TYPES;
  23544. with WS_DESCRIPTION_TABLE_TYPES;
  23545.      
  23546. use GKS_TYPES;
  23547.      
  23548. package WSR_INQ_WS_DESCRIPTION_TABLE_MA is
  23549.      
  23550. -- Package GKS_TYPES provides type definitions for the return
  23551. -- parameters.
  23552.      
  23553. -- Package WS_DESCRIPTION_TABLE_TYPES provides type definition for the
  23554. -- Workstation Description Table parameter.
  23555.      
  23556. procedure INQ_DISPLAY_SPACE_SIZE
  23557.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  23558.                                      WS_DESCRIPTION_TBL;
  23559.        DC_UNITS             :    out GKS_TYPES . DC_UNITS;
  23560.        MAX_DC_SIZE          :    out DC . SIZE;
  23561.        MAX_RASTER_UNIT_SIZE :    out RASTER_UNIT_SIZE);
  23562.      
  23563.    procedure INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  23564.       (WS_DT                  : in     WS_DESCRIPTION_TABLE_TYPES .
  23565.                                        WS_DESCRIPTION_TBL;
  23566.        MAX_POLYLINE_ENTRIES   :    out NATURAL;
  23567.        MAX_POLYMARKER_ENTRIES :    out NATURAL;
  23568.        MAX_TEXT_ENTRIES       :    out NATURAL;
  23569.        MAX_FILL_AREA_ENTRIES  :    out NATURAL;
  23570.        MAX_PATTERN_INDICES    :    out NATURAL;
  23571.        MAX_COLOUR_INDICES     :    out NATURAL);
  23572.      
  23573.    procedure INQ_POLYLINE_FACILITIES
  23574.       (WS_DT             : in     WS_DESCRIPTION_TABLE_TYPES .
  23575.                                   WS_DESCRIPTION_TBL;
  23576.        LIST_OF_LINETYPES :    out LINETYPES . LIST_OF;
  23577.        NUMBER_OF_WIDTHS  :    out NATURAL;
  23578.        NOMINAL_WIDTH     :    out DC . MAGNITUDE;
  23579.        RANGE_OF_WIDTHS   :    out DC . RANGE_OF_MAGNITUDES;
  23580.        NUMBER_OF_INDICES :    out NATURAL);
  23581.      
  23582.    procedure INQ_POLYMARKER_FACILITIES
  23583.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  23584.                                      WS_DESCRIPTION_TBL;
  23585.        LIST_OF_MARKER_TYPES :    out MARKER_TYPES . LIST_OF;
  23586.        NUMBER_OF_SIZES      :    out NATURAL;
  23587.        NOMINAL_SIZE         :    out DC . MAGNITUDE;
  23588.        RANGE_OF_SIZES       :    out DC . RANGE_OF_MAGNITUDES;
  23589.        NUMBER_OF_INDICES    :    out NATURAL);
  23590.      
  23591.    procedure INQ_TEXT_FACILITIES
  23592.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  23593.                                      WS_DESCRIPTION_TBL;
  23594.        LIST_OF_FONT_PRECISION_PAIRS :    out TEXT_FONT_PRECISIONS .
  23595.                                                  LIST_OF;
  23596.        NUMBER_OF_HEIGHTS            :    out NATURAL;
  23597.        RANGE_OF_HEIGHTS             :    out DC . RANGE_OF_MAGNITUDES;
  23598.        NUMBER_OF_EXPANSIONS         :    out NATURAL;
  23599.        RANGE_OF_CHAR_EXPANSIONS     :    out RANGE_OF_EXPANSIONS;
  23600.        NUMBER_OF_INDICES            :    out NATURAL);
  23601.      
  23602.    procedure INQ_FILL_AREA_FACILITIES
  23603.       (WS_DT                   : in     WS_DESCRIPTION_TABLE_TYPES .
  23604.                                         WS_DESCRIPTION_TBL;
  23605.        LIST_OF_INTERIOR_STYLES :    out INTERIOR_STYLES . LIST_OF;
  23606.        LIST_OF_HATCH_STYLES    :    out HATCH_STYLES . LIST_OF;
  23607.        NUMBER_OF_INDICES       :    out NATURAL);
  23608.      
  23609.    procedure INQ_COLOUR_FACILITIES
  23610.       (WS_DT             : in     WS_DESCRIPTION_TABLE_TYPES .
  23611.                                   WS_DESCRIPTION_TBL;
  23612.        NUMBER_OF_COLOURS :    out NATURAL;
  23613.        AVAILABLE_COLOUR  :    out COLOUR_AVAILABLE;
  23614.        NUMBER_OF_INDICES :    out NATURAL);
  23615.      
  23616. end WSR_INQ_WS_DESCRIPTION_TABLE_MA;
  23617. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23618. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_DSCR_MA_B.ADA
  23619. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23620. ------------------------------------------------------------------
  23621. --
  23622. --  NAME: WSR_INQ_WS_DESCRIPTION_MA - BODY
  23623. --  IDENTIFIER: GDMXXX.1(1)
  23624. --  DISCREPANCY REPORTS:
  23625. --
  23626. ------------------------------------------------------------------
  23627. -- File:  WSR_INQ_WS_DSCR_MA_B.ADA
  23628. -- Level: MA, 0A, 1A, 2A
  23629.      
  23630. package body WSR_INQ_WS_DESCRIPTION_TABLE_MA is
  23631.      
  23632. -- The procedures in this package provide a convenient mechanism for
  23633. -- returning groups of values from the Workstation Description Table.
  23634.      
  23635.    use GKS_TYPES;
  23636.      
  23637.    procedure INQ_DISPLAY_SPACE_SIZE
  23638.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  23639.                                      WS_DESCRIPTION_TBL;
  23640.        DC_UNITS             :    out GKS_TYPES . DC_UNITS;
  23641.        MAX_DC_SIZE          :    out DC . SIZE;
  23642.        MAX_RASTER_UNIT_SIZE :    out RASTER_UNIT_SIZE) is
  23643.      
  23644.    begin
  23645.      
  23646.       DC_UNITS             := WS_DT . DEVICE_COOR_UNITS;
  23647.       MAX_DC_SIZE          := WS_DT . MAX_DISPLAY_SURFACE_DC_UNITS;
  23648.       MAX_RASTER_UNIT_SIZE := WS_DT . MAX_DISPLAY_SURFACE_RASTER_UNITS;
  23649.      
  23650.    end INQ_DISPLAY_SPACE_SIZE;
  23651.      
  23652.    procedure INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  23653.       (WS_DT                  : in     WS_DESCRIPTION_TABLE_TYPES .
  23654.                                        WS_DESCRIPTION_TBL;
  23655.        MAX_POLYLINE_ENTRIES   :    out NATURAL;
  23656.        MAX_POLYMARKER_ENTRIES :    out NATURAL;
  23657.        MAX_TEXT_ENTRIES       :    out NATURAL;
  23658.        MAX_FILL_AREA_ENTRIES  :    out NATURAL;
  23659.        MAX_PATTERN_INDICES    :    out NATURAL;
  23660.        MAX_COLOUR_INDICES     :    out NATURAL) is
  23661.      
  23662.    begin
  23663.      
  23664.       MAX_POLYLINE_ENTRIES :=
  23665.             WS_DT . MAX_NUM_PLIN_BUNDLE_TBL_ENTRIES;
  23666.      
  23667.       MAX_POLYMARKER_ENTRIES :=
  23668.             WS_DT . MAX_NUM_PMRK_BUNDLE_TBL_ENTRIES;
  23669.      
  23670.       MAX_TEXT_ENTRIES :=
  23671.             WS_DT . MAX_NUM_TEXT_BUNDLE_TBL_ENTRIES;
  23672.      
  23673.       MAX_FILL_AREA_ENTRIES :=
  23674.             WS_DT . MAX_NUM_FA_BUNDLE_TBL_ENTRIES;
  23675.      
  23676.       MAX_PATTERN_INDICES :=
  23677.             WS_DT . MAX_NUM_PATTERN_INDICES;
  23678.      
  23679.       MAX_COLOUR_INDICES :=
  23680.             WS_DT . MAX_NUM_COLOUR_INDICES;
  23681.      
  23682.    end INQ_MAX_LENGTH_OF_WS_STATE_TABLES;
  23683.      
  23684.    procedure INQ_POLYLINE_FACILITIES
  23685.       (WS_DT             : in     WS_DESCRIPTION_TABLE_TYPES .
  23686.                                   WS_DESCRIPTION_TBL;
  23687.        LIST_OF_LINETYPES :    out LINETYPES . LIST_OF;
  23688.        NUMBER_OF_WIDTHS  :    out NATURAL;
  23689.        NOMINAL_WIDTH     :    out DC . MAGNITUDE;
  23690.        RANGE_OF_WIDTHS   :    out DC . RANGE_OF_MAGNITUDES;
  23691.        NUMBER_OF_INDICES :    out NATURAL) is
  23692.      
  23693.    begin
  23694.      
  23695.       LIST_OF_LINETYPES := WS_DT . LIST_AVAILABLE_LTYPE;
  23696.       NUMBER_OF_WIDTHS  := WS_DT . NUM_AVAILABLE_LWIDTH;
  23697.       NOMINAL_WIDTH     := WS_DT . NOMINAL_LWIDTH;
  23698.       RANGE_OF_WIDTHS   := WS_DT . RANGE_OF_LWIDTH;
  23699.       NUMBER_OF_INDICES := WS_DT . NUM_PREDEFINED_PLIN_BUNDLE;
  23700.      
  23701.    end INQ_POLYLINE_FACILITIES;
  23702.      
  23703.      
  23704.    procedure INQ_POLYMARKER_FACILITIES
  23705.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  23706.                                      WS_DESCRIPTION_TBL;
  23707.        LIST_OF_MARKER_TYPES :    out MARKER_TYPES . LIST_OF;
  23708.        NUMBER_OF_SIZES      :    out NATURAL;
  23709.        NOMINAL_SIZE         :    out DC . MAGNITUDE;
  23710.        RANGE_OF_SIZES       :    out DC . RANGE_OF_MAGNITUDES;
  23711.        NUMBER_OF_INDICES    :    out NATURAL) is
  23712.      
  23713.    begin
  23714.      
  23715.       LIST_OF_MARKER_TYPES := WS_DT . LIST_AVAILABLE_MARKER_TYPES;
  23716.       NUMBER_OF_SIZES      := WS_DT . NUM_AVAILABLE_MARKER_SIZES;
  23717.       NOMINAL_SIZE         := WS_DT . NOMINAL_MARKER_SIZE;
  23718.       RANGE_OF_SIZES       := WS_DT . RANGE_OF_MARKER_SIZES;
  23719.       NUMBER_OF_INDICES    := WS_DT . NUM_PREDEFINED_PMRK_BUNDLE;
  23720.      
  23721.    end INQ_POLYMARKER_FACILITIES;
  23722.      
  23723.    procedure INQ_TEXT_FACILITIES
  23724.       (WS_DT                : in     WS_DESCRIPTION_TABLE_TYPES .
  23725.                                      WS_DESCRIPTION_TBL;
  23726.        LIST_OF_FONT_PRECISION_PAIRS :    out TEXT_FONT_PRECISIONS .
  23727.                                                  LIST_OF;
  23728.        NUMBER_OF_HEIGHTS        :    out NATURAL;
  23729.        RANGE_OF_HEIGHTS         :    out DC . RANGE_OF_MAGNITUDES;
  23730.        NUMBER_OF_EXPANSIONS     :    out NATURAL;
  23731.        RANGE_OF_CHAR_EXPANSIONS :    out RANGE_OF_EXPANSIONS;
  23732.        NUMBER_OF_INDICES        :    out NATURAL) is
  23733.      
  23734.    begin
  23735.      
  23736.       LIST_OF_FONT_PRECISION_PAIRS :=
  23737.             WS_DT . LIST_TEXT_FONT_AND_PRECISION;
  23738.      
  23739.       NUMBER_OF_HEIGHTS        := WS_DT . NUM_AVAILABLE_CHAR_HEIGHTS;
  23740.      
  23741.       RANGE_OF_HEIGHTS         := WS_DT . RANGE_OF_CHAR_HEIGHTS;
  23742.      
  23743.       NUMBER_OF_EXPANSIONS     := WS_DT . NUM_AVAILABLE_CHAR_EXPANSIONS;
  23744.      
  23745.       RANGE_OF_CHAR_EXPANSIONS := WS_DT . RANGE_OF_CHAR_EXPANSIONS;
  23746.      
  23747.       NUMBER_OF_INDICES        := WS_DT . NUM_PREDEFINED_TEXT_BUNDLE;
  23748.      
  23749.    end INQ_TEXT_FACILITIES;
  23750.      
  23751.    procedure INQ_FILL_AREA_FACILITIES
  23752.       (WS_DT                   : in     WS_DESCRIPTION_TABLE_TYPES .
  23753.                                         WS_DESCRIPTION_TBL;
  23754.        LIST_OF_INTERIOR_STYLES :    out INTERIOR_STYLES . LIST_OF;
  23755.        LIST_OF_HATCH_STYLES    :    out HATCH_STYLES . LIST_OF;
  23756.        NUMBER_OF_INDICES       :    out NATURAL) is
  23757.      
  23758.    begin
  23759.      
  23760.       LIST_OF_INTERIOR_STYLES := WS_DT . LIST_OF_AVAL_INTERIOR_STYLE;
  23761.       LIST_OF_HATCH_STYLES    := WS_DT . LIST_OF_AVAL_HATCH_STYLE;
  23762.       NUMBER_OF_INDICES       := WS_DT . NUM_PREDEFINED_FA_BUNDLE;
  23763.      
  23764.    end INQ_FILL_AREA_FACILITIES;
  23765.      
  23766.    procedure INQ_COLOUR_FACILITIES
  23767.       (WS_DT             : in     WS_DESCRIPTION_TABLE_TYPES .
  23768.                                   WS_DESCRIPTION_TBL;
  23769.        NUMBER_OF_COLOURS :    out NATURAL;
  23770.        AVAILABLE_COLOUR  :    out COLOUR_AVAILABLE;
  23771.        NUMBER_OF_INDICES :    out NATURAL) is
  23772.      
  23773.    begin
  23774.      
  23775.       NUMBER_OF_COLOURS := WS_DT . NUM_OF_AVAL_COLOUR_INTENSITY;
  23776.       AVAILABLE_COLOUR  := WS_DT . COLOUR_AVAL;
  23777.       NUMBER_OF_INDICES := NATURAL(WS_DT . LAST_PREDEFINED_COLOUR_REP + 1);
  23778.      
  23779.    end INQ_COLOUR_FACILITIES;
  23780.      
  23781. end WSR_INQ_WS_DESCRIPTION_TABLE_MA;
  23782. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23783. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_ST_MA.ADA
  23784. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23785. ------------------------------------------------------------------
  23786. --
  23787. --  NAME: WSR_INQ_WS_STATE_LIST_MA
  23788. --  IDENTIFIER: GDMXXX.2(1)
  23789. --  DISCREPANCY REPORTS:
  23790. --  DR004  Reduce storage size of CGI instruction.
  23791. ------------------------------------------------------------------
  23792. -- file:  WSR_INQ_WS_ST_MA.ADA
  23793. -- level: all levels
  23794.      
  23795. with GKS_TYPES;
  23796. with CGI;
  23797. with WS_STATE_LIST_TYPES;
  23798. with GKS_ERRORS;
  23799.      
  23800. use GKS_TYPES;
  23801. use CGI;
  23802.      
  23803. package WSR_INQ_WS_STATE_LIST_MA is
  23804.      
  23805. -- WS_STATE_LIST_PTR is declared in WS_STATE_LIST_TYPES; the
  23806. -- other parameter types are declared in GKS_TYPES.
  23807. -- Each procedure is called by the workstation driver which
  23808. -- passes a pointer to the workstation state list being inquired.
  23809.      
  23810.    procedure INQ_WS_CONNECTION_AND_TYPE
  23811.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23812.     CONNECTION    : out ACCESS_CONNECTION_ID_TYPE;
  23813.     TYPE_OF_WS    : out WS_TYPE);
  23814.      
  23815.    procedure INQ_LIST_OF_COLOUR_INDICES
  23816.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23817.     INDICES       : out COLOUR_INDICES.LIST_OF);
  23818.      
  23819.    procedure INQ_COLOUR_REPRESENTATION
  23820.    (WS_STATE_LIST   : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23821.     INDEX           : in COLOUR_INDEX;
  23822.     RETURNED_VALUES : in RETURN_VALUE_TYPE;
  23823.     COLOUR          : out COLOUR_REPRESENTATION;
  23824.     EI              : out ERROR_INDICATOR);
  23825.      
  23826.    procedure INQ_WS_TRANSFORMATION
  23827.    (WS_STATE_LIST      : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23828.     UPDATE             : out UPDATE_STATE;
  23829.     REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  23830.     CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  23831.     REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  23832.     CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS);
  23833.      
  23834. end WSR_INQ_WS_STATE_LIST_MA;
  23835. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23836. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_ST_MA_B.ADA
  23837. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23838. ------------------------------------------------------------------
  23839. --
  23840. --  NAME: WSR_INQ_WS_STATE_LIST_MA - BODY
  23841. --  IDENTIFIER: GDMXXX.2(1)
  23842. --  DISCREPANCY REPORTS:
  23843. --  DR004  Reduce storage size of CGI instruction.
  23844. ------------------------------------------------------------------
  23845. -- file:  WSR_INQ_WS_ST_MA_B.ADA
  23846. -- level: all levels
  23847.      
  23848. package body WSR_INQ_WS_STATE_LIST_MA is
  23849.      
  23850. --  The following procedures inquire into the specified workstation
  23851. --  state list accessed by the pointer passed as a parameter,
  23852. --  to retrieve the needed information.
  23853.      
  23854.    procedure INQ_WS_CONNECTION_AND_TYPE
  23855.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23856.     CONNECTION    : out ACCESS_CONNECTION_ID_TYPE;
  23857.     TYPE_OF_WS    : out WS_TYPE) is separate;
  23858.      
  23859.    procedure INQ_LIST_OF_COLOUR_INDICES
  23860.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23861.     INDICES       : out COLOUR_INDICES.LIST_OF) is separate;
  23862.      
  23863.    procedure INQ_COLOUR_REPRESENTATION
  23864.    (WS_STATE_LIST   : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23865.     INDEX           : in COLOUR_INDEX;
  23866.     RETURNED_VALUES : in RETURN_VALUE_TYPE;
  23867.     COLOUR          : out COLOUR_REPRESENTATION;
  23868.     EI              : out ERROR_INDICATOR) is separate;
  23869.      
  23870.    procedure INQ_WS_TRANSFORMATION
  23871.    (WS_STATE_LIST      : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23872.     UPDATE             : out UPDATE_STATE;
  23873.     REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  23874.     CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  23875.     REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  23876.     CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS) is separate;
  23877.      
  23878. end WSR_INQ_WS_STATE_LIST_MA;
  23879. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23880. --:UDD:GKSADACM:CODE:MA:WSR_INQ_CLR_REP.ADA
  23881. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23882. ------------------------------------------------------------------
  23883. --
  23884. --  NAME: INQ_COLOUR_REPRESENTATION
  23885. --  IDENTIFIER: GDMXXX.1(1)
  23886. --  DISCREPANCY REPORTS:
  23887. --
  23888. ------------------------------------------------------------------
  23889. -- file:  WSR_INQ_CLR_REP.ADA
  23890. -- level: all levels
  23891.      
  23892. separate (WSR_INQ_WS_STATE_LIST_MA)
  23893.      
  23894. procedure INQ_COLOUR_REPRESENTATION
  23895.    (WS_STATE_LIST   : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23896.     INDEX           : in COLOUR_INDEX;
  23897.     RETURNED_VALUES : in RETURN_VALUE_TYPE;
  23898.     COLOUR          : out COLOUR_REPRESENTATION;
  23899.     EI              : out ERROR_INDICATOR) is
  23900.      
  23901. -- This procedure returns information about
  23902. -- the colour table from the workstation state list accessed by
  23903. -- the WS_STATE_LIST pointer.
  23904. --
  23905. -- The parameters in this procedure are used as follows:
  23906. --
  23907. -- WS_STATE_LIST     - pointer to the workstation state list
  23908. --                     being inquired.
  23909. -- INDEX             - colour index.
  23910. -- RETURNED_VALUES   - indicates whether the returned values
  23911. --                   - should be as they were set by the program
  23912. --                   - or as they were actually realized by the
  23913. --                   - device.
  23914. -- COLOUR            - colour intensity.
  23915. -- EI                - used to log errors.
  23916. --
  23917. -- EI is set to NO_COLOUR_REP if a representation for the
  23918. -- specified colour index has not been defined on this
  23919. -- workstation.
  23920.      
  23921. begin
  23922.      
  23923.    -- set the error indicator to insure that a successful value
  23924.    -- is passed out when no errors occur.
  23925.    EI := GKS_ERRORS.SUCCESSFUL;
  23926.      
  23927.    -- set the default value of the out parameter.
  23928.    COLOUR := (0.0,0.0,0.0);
  23929.      
  23930.    if RETURNED_VALUES = REALIZED then
  23931.      
  23932.       if not COLOUR_INDICES.IS_IN_LIST
  23933.             (INDEX,WS_STATE_LIST.SET_OF_COLOUR_IDC) then
  23934.      
  23935.          -- the specified colour representation has not been
  23936.          -- defined on this workstation and RETURNED_VALUES
  23937.          -- has value REALIZED.  So return the values using
  23938.          -- the default index.
  23939.      
  23940.          COLOUR := WS_STATE_LIST.COLOUR_TABLE(1);
  23941.      
  23942.       else
  23943.      
  23944.          -- the index specified is within the colour table.
  23945.          -- return the value found in the workstation state list.
  23946.      
  23947.          COLOUR := WS_STATE_LIST.COLOUR_TABLE(INDEX);
  23948.      
  23949.       end if;
  23950.      
  23951.    else
  23952.      
  23953.       if INDEX not in WS_STATE_LIST.COLOUR_TABLE'RANGE then
  23954.      
  23955.          -- the specified colour index is invalid for this workstation.
  23956.          EI := GKS_ERRORS.INVALID_COLOUR_INDEX;
  23957.      
  23958.       elsif not COLOUR_INDICES.IS_IN_LIST(INDEX,WS_STATE_LIST
  23959.             .SET_OF_COLOUR_IDC) then
  23960.          -- the specified colour representation has not been
  23961.          -- defined on this workstation and RETURNED_VALUES
  23962.          -- has value SET.
  23963.      
  23964.          EI := GKS_ERRORS.NO_COLOUR_REP;
  23965.      
  23966.       else
  23967.      
  23968.          -- the index specified is within the colour table.
  23969.          -- return the value found in the workstation state list.
  23970.      
  23971.          COLOUR := WS_STATE_LIST.COLOUR_TABLE(INDEX);
  23972.      
  23973.       end if;
  23974.      
  23975.    end if;
  23976.      
  23977. end INQ_COLOUR_REPRESENTATION;
  23978. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23979. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_CON_TYPE.ADA
  23980. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  23981. ------------------------------------------------------------------
  23982. --
  23983. --  NAME: INQ_WS_CONNECTION_AND_TYPE
  23984. --  IDENTIFIER: GDMXXX.2(1)
  23985. --  DISCREPANCY REPORTS:
  23986. --  DR004  Reduce storage size of CGI instruction.
  23987. ------------------------------------------------------------------
  23988. -- file:  WSR_INQ_WS_CON_TYPE.ADA
  23989. -- level: all levels
  23990.      
  23991. separate (WSR_INQ_WS_STATE_LIST_MA)
  23992.      
  23993. procedure INQ_WS_CONNECTION_AND_TYPE
  23994.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  23995.     CONNECTION    : out ACCESS_CONNECTION_ID_TYPE;
  23996.     TYPE_OF_WS    : out WS_TYPE) is
  23997.      
  23998. -- Return the values of connection identifier and workstation
  23999. -- type from the workstation state list, accessed by WS_STATE_LIST,
  24000. -- in the specified parameters.
  24001. --
  24002. -- The parameters in this procedure are used as follows:
  24003. --
  24004. -- WS_STATE_LIST  - pointer to the workstation state list.
  24005. -- CONNECTION     - pointer to the workstation identifier to return.
  24006. -- TYPE_OF_WS     - workstation type to return.
  24007. --
  24008. -- No errors are checked in this procedure.
  24009.      
  24010. begin
  24011.      
  24012.    -- Inquire connection identifier
  24013.    CONNECTION := new CONNECTION_ID'(WS_STATE_LIST.CONNECT_ID.CONNECT);
  24014.      
  24015.    -- Inquire workstation type
  24016.    TYPE_OF_WS := WS_STATE_LIST.WORKSTATION_TYPE;
  24017.      
  24018. end INQ_WS_CONNECTION_AND_TYPE;
  24019. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24020. --:UDD:GKSADACM:CODE:MA:WSR_INQ_LST_CLR_IDC.ADA
  24021. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24022. ------------------------------------------------------------------
  24023. --
  24024. --  NAME: INQ_LIST_OF_COLOUR_INDICES
  24025. --  IDENTIFIER: GIMXXX.1(1)
  24026. --  DISCREPANCY REPORTS:
  24027. --
  24028. ------------------------------------------------------------------
  24029. -- file:  WSR_INQ_LST_CLR_IDC.ADA
  24030. -- level: all levels
  24031.      
  24032. separate (WSR_INQ_WS_STATE_LIST_MA)
  24033.      
  24034. procedure INQ_LIST_OF_COLOUR_INDICES
  24035.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  24036.     INDICES       : out COLOUR_INDICES.LIST_OF) is
  24037.      
  24038. -- Return the list of colour indices from the workstation state list,
  24039. -- accessed by the pointer WS_STATE_LIST, in the specified parameter.
  24040. --
  24041. -- The parameters in this procedure are used as follows:
  24042. --
  24043. -- WS_STATE_LIST     - pointer to the workstation state list.
  24044. -- INDICES           - list of colour indices to return.
  24045.      
  24046. begin
  24047.      
  24048.    -- Inquire the list of colour indices.
  24049.      
  24050.    INDICES := WS_STATE_LIST.SET_OF_COLOUR_IDC;
  24051.      
  24052. end INQ_LIST_OF_COLOUR_INDICES;
  24053. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24054. --:UDD:GKSADACM:CODE:MA:WSR_INQ_WS_XFORM.ADA
  24055. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24056. ------------------------------------------------------------------
  24057. --
  24058. --  NAME: INQ_WS_TRANSFORMATION
  24059. --  IDENTIFIER: GDMXXX.1(1)
  24060. --  DISCREPANCY REPORTS:
  24061. --
  24062. ------------------------------------------------------------------
  24063. -- file:  WSR_INQ_WS_XFORM.ADA
  24064. -- level: all levels
  24065.      
  24066. separate (WSR_INQ_WS_STATE_LIST_MA)
  24067.      
  24068. procedure INQ_WS_TRANSFORMATION
  24069.    (WS_STATE_LIST : in WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  24070.     UPDATE        : out UPDATE_STATE;
  24071.     REQUESTED_WINDOW   : out NDC.RECTANGLE_LIMITS;
  24072.     CURRENT_WINDOW     : out NDC.RECTANGLE_LIMITS;
  24073.     REQUESTED_VIEWPORT : out DC.RECTANGLE_LIMITS;
  24074.     CURRENT_VIEWPORT   : out DC.RECTANGLE_LIMITS) is
  24075.      
  24076. -- Find the workstation transformation update state, the requested
  24077. -- workstation window, the current workstation window, the requested
  24078. -- workstation viewport and the current workstation viewport from
  24079. -- the workstation state list accessed by the pointer WS_STATE_LIST.
  24080. -- The workstation transformation state is PENDING if a workstation
  24081. -- transformation change has been requested but not yet provided.
  24082. --
  24083. -- The parameters in this procedure are used as follows:
  24084. --
  24085. -- WS_STATE_LIST                - pointer to the workstation state list.
  24086. -- UPDATE                       - update information
  24087. --                                (pending,not pending).
  24088. -- REQUESTED_WINDOW             - requested workstation window in
  24089. --                                NDC coordinates.
  24090. -- CURRENT_WINDOW               - current workstation window in
  24091. --                                NDC coordinates.
  24092. -- REQUESTED_VIEWPORT           - requested viewport in DC coordinates.
  24093. -- CURRENT_VIEWPORT             - current viewport in DC coordinates.
  24094.      
  24095. begin
  24096.      
  24097.    -- Inquire workstation transformation update state
  24098.    UPDATE := WS_STATE_LIST.WS_XFORM_UPDATE_STATE;
  24099.      
  24100.    -- Inquire requested workstation window
  24101.    REQUESTED_WINDOW := WS_STATE_LIST.REQUESTED_WS_WINDOW;
  24102.      
  24103.    -- Inquire current workstation window
  24104.    CURRENT_WINDOW := WS_STATE_LIST.CURRENT_WS_WINDOW;
  24105.      
  24106.    -- Inquire requested workstation viewport
  24107.    REQUESTED_VIEWPORT := WS_STATE_LIST.REQUESTED_WS_VIEWPORT;
  24108.      
  24109.    -- Inquire current workstation viewport
  24110.    CURRENT_VIEWPORT := WS_STATE_LIST.CURRENT_WS_VIEWPORT;
  24111.      
  24112. end INQ_WS_TRANSFORMATION;
  24113. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24114. --:UDD:GKSADACM:CODE:MA:RECTANGLE_OPS.ADA
  24115. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24116. ------------------------------------------------------------------
  24117. --
  24118. --  NAME: RECTANGLE_LIMITS_OPS
  24119. --  IDENTIFIER: GDMXXX.1(1)
  24120. --  DISCREPANCY REPORTS:
  24121. --
  24122. ------------------------------------------------------------------
  24123. -- File: RECTANGLE_OPS.ADA
  24124. -- Level: all
  24125.      
  24126. generic
  24127.    type COORDINATE is digits <>;
  24128.      
  24129.    type RECTANGLE_LIMITS is private;
  24130.      
  24131.    with function XMIN(R : in RECTANGLE_LIMITS) return COORDINATE is <>;
  24132.    with function XMAX(R : in RECTANGLE_LIMITS) return COORDINATE is <>;
  24133.    with function YMIN(R : in RECTANGLE_LIMITS) return COORDINATE is <>;
  24134.    with function YMAX(R : in RECTANGLE_LIMITS) return COORDINATE is <>;
  24135.    with function RECTANGLE_LIMITS_MAKE
  24136.       (XMIN : in     COORDINATE;
  24137.        XMAX : in     COORDINATE;
  24138.        YMIN : in     COORDINATE;
  24139.        YMAX : in     COORDINATE) return  RECTANGLE_LIMITS is <>;
  24140.      
  24141. package RECTANGLE_LIMITS_OPS is
  24142.      
  24143.    UNIT_SQR : constant RECTANGLE_LIMITS :=
  24144.       RECTANGLE_LIMITS_MAKE
  24145.          (XMIN => 0.0, XMAX => 1.0,
  24146.           YMIN => 0.0, YMAX => 1.0);
  24147.      
  24148.    function IS_VALID
  24149.       (A : in     RECTANGLE_LIMITS) return BOOLEAN;
  24150.      
  24151.    function "<"
  24152.       (A : in     RECTANGLE_LIMITS;
  24153.        B : in     RECTANGLE_LIMITS) return BOOLEAN;
  24154.      
  24155.    function "<="
  24156.       (A : in     RECTANGLE_LIMITS;
  24157.        B : in     RECTANGLE_LIMITS) return BOOLEAN;
  24158.      
  24159.    function ">="
  24160.       (A : in     RECTANGLE_LIMITS;
  24161.        B : in     RECTANGLE_LIMITS) return BOOLEAN;
  24162.      
  24163.    function ">"
  24164.       (A : in     RECTANGLE_LIMITS;
  24165.        B : in     RECTANGLE_LIMITS) return BOOLEAN;
  24166.      
  24167.    function "or"
  24168.       (A : in     RECTANGLE_LIMITS;
  24169.        B : in     RECTANGLE_LIMITS) return RECTANGLE_LIMITS;
  24170.      
  24171.    function "and"
  24172.       (A : in     RECTANGLE_LIMITS;
  24173.        B : in     RECTANGLE_LIMITS) return RECTANGLE_LIMITS;
  24174.      
  24175. end RECTANGLE_LIMITS_OPS;
  24176. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24177. --:UDD:GKSADACM:CODE:MA:RECTANGLE_OPS_B.ADA
  24178. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24179. ------------------------------------------------------------------
  24180. --
  24181. --  NAME: RECTANGLE_LIMITS_OPS - BODY
  24182. --  IDENTIFIER: GDMXXX.1(1)
  24183. --  DISCREPANCY REPORTS:
  24184. --
  24185. ------------------------------------------------------------------
  24186. -- File: RECTANGLE_OPS_B.ADA
  24187. -- Level: all
  24188.      
  24189. package body RECTANGLE_LIMITS_OPS is
  24190.      
  24191. -- Package RECTANGLE_LIMITS_OPS provides functions useful in
  24192. -- comparing rectangles instantiated from the GKS_COORDINATE_SYSTEM
  24193. -- package.  To allow this package to be generic, it is necessary to
  24194. -- augment the record type RECTANGLE_LIMITS with access and aggregate
  24195. -- functions since the components are not visible here.
  24196.      
  24197.    -- Auxiliary function specificiations
  24198.      
  24199.    function MIN
  24200.       (A : in     COORDINATE;
  24201.        B : in     COORDINATE) return COORDINATE;
  24202.      
  24203.    function MAX
  24204.       (A : in     COORDINATE;
  24205.        B : in     COORDINATE) return COORDINATE;
  24206.      
  24207.    -- Implementations of subprograms in the package specification
  24208.      
  24209.    function IS_VALID
  24210.       (A : in     RECTANGLE_LIMITS) return BOOLEAN is
  24211.    -- Predicate returning `TRUE' when `A' is a positive rectangle.
  24212.      
  24213.    begin
  24214.      
  24215.       return XMIN(A) < XMAX(A) and then YMIN(A) < YMAX(A);
  24216.      
  24217.    end IS_VALID;
  24218.      
  24219.    function "<"
  24220.       (A : in     RECTANGLE_LIMITS;
  24221.        B : in     RECTANGLE_LIMITS) return BOOLEAN is
  24222.    -- Predicate returning `TRUE' when `A' is a proper subset of `B'.
  24223.      
  24224.    begin
  24225.      
  24226.       return   XMIN(B) < XMIN(A) and then XMAX(A) < XMAX(B)
  24227.       and then YMIN(B) < YMIN(A) and then YMAX(A) < YMAX(B);
  24228.      
  24229.    end "<";
  24230.      
  24231.    function "<="
  24232.       (A : in     RECTANGLE_LIMITS;
  24233.        B : in     RECTANGLE_LIMITS) return BOOLEAN is
  24234.    -- Predicate returning `TRUE' when `A' completely contained in `B'.
  24235.      
  24236.    begin
  24237.      
  24238.       return   XMIN(B) <= XMIN(A) and then XMAX(A) <= XMAX(B)
  24239.       and then YMIN(B) <= YMIN(A) and then YMAX(A) <= YMAX(B);
  24240.      
  24241.    end "<=";
  24242.      
  24243.    function ">="
  24244.       (A : in     RECTANGLE_LIMITS;
  24245.        B : in     RECTANGLE_LIMITS) return BOOLEAN is
  24246.    -- Predicate returning `TRUE' when `B' completely contained in `A'.
  24247.      
  24248.    begin
  24249.      
  24250.       return   XMIN(B) >= XMIN(A) and then XMAX(A) >= XMAX(B)
  24251.       and then YMIN(B) >= YMIN(A) and then YMAX(A) >= YMAX(B);
  24252.      
  24253.    end ">=";
  24254.      
  24255.    function ">"
  24256.       (A : in     RECTANGLE_LIMITS;
  24257.        B : in     RECTANGLE_LIMITS) return BOOLEAN is
  24258.    -- Predicate returning `TRUE' when `B' is a proper subset of `A'.
  24259.      
  24260.    begin
  24261.      
  24262.       return   XMIN(B) > XMIN(A) and then XMAX(A) > XMAX(B)
  24263.       and then YMIN(B) > YMIN(A) and then YMAX(A) > YMAX(B);
  24264.      
  24265.    end ">";
  24266.      
  24267.    function "or"
  24268.       (A : in     RECTANGLE_LIMITS;
  24269.        B : in     RECTANGLE_LIMITS) return RECTANGLE_LIMITS is
  24270.    -- Returns a RECTANGLE_LIMITS "enclosing" both `A' and `B'.
  24271.    -- Let `R' be the returned RECTANGLE_LIMITS.  Then the following
  24272.    -- predicate holds:  A <= R and B <= R.
  24273.      
  24274.    begin
  24275.      
  24276.       return RECTANGLE_LIMITS_MAKE (
  24277.             XMIN => MIN( XMIN(A) , XMIN(B) ),
  24278.             XMAX => MAX( XMAX(A) , XMAX(B) ),
  24279.    YMIN => MIN( YMIN(A) , YMIN(B) ),
  24280.             YMAX => MAX( YMAX(A) , YMAX(B) ));
  24281.      
  24282.    end "or";
  24283.      
  24284.    function "and"
  24285.       (A : in     RECTANGLE_LIMITS;
  24286.        B : in     RECTANGLE_LIMITS) return RECTANGLE_LIMITS is
  24287.    -- Returns a RECTANGLE_LIMITS "enclosed" by both `A' and `B'.
  24288.    -- Let `R' be the returned RECTANGLE_LIMITS.  Then the following
  24289.    -- predicate holds:  R <= A and R <= B.
  24290.      
  24291.    begin
  24292.      
  24293.       return RECTANGLE_LIMITS_MAKE (
  24294.             XMIN => MAX( XMIN(A) , XMIN(B) ),
  24295.             XMAX => MIN( XMAX(A) , XMAX(B) ),
  24296.             YMIN => MAX( YMIN(A) , YMIN(B) ),
  24297.             YMAX => MIN( YMAX(A) , YMAX(B) ));
  24298.      
  24299.    end "and";
  24300.      
  24301.    function MIN
  24302.       (A : in     COORDINATE;
  24303.        B : in     COORDINATE) return COORDINATE is
  24304.    -- Returns the minimum of `A' and `B'.
  24305.    -- Let `C' be the returned COORDINATE.  Then the following
  24306.    -- predicate holds:  C <= A and C <= B.
  24307.      
  24308.    begin
  24309.      
  24310.       if A < B then
  24311.          return A;
  24312.       else
  24313.          return B;
  24314.       end if;
  24315.      
  24316.    end MIN;
  24317.      
  24318.    function MAX
  24319.       (A : in     COORDINATE;
  24320.        B : in     COORDINATE) return COORDINATE is
  24321.    -- Returns the maximum of `A' and `B'.
  24322.    -- Let `C' be the returned COORDINATE.  Then the following
  24323.    -- predicate holds:  A <= C and B <= C.
  24324.      
  24325.    begin
  24326.      
  24327.       if B < A then
  24328.          return A;
  24329.       else
  24330.          return B;
  24331.       end if;
  24332.      
  24333.    end MAX;
  24334.      
  24335. end RECTANGLE_LIMITS_OPS;
  24336. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24337. --:UDD:GKSADACM:CODE:MA:DC_OPS_DEFS.ADA
  24338. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24339. ------------------------------------------------------------------
  24340. --
  24341. --  NAME: DC_OPS_DEFS
  24342. --  IDENTIFIER: GDMXXX.1(1)
  24343. --  DISCREPANCY REPORTS:
  24344. --
  24345. ------------------------------------------------------------------
  24346. -- File: DC_OPS_DEFS.ADA
  24347. -- Level: all
  24348.      
  24349. with GKS_TYPES;
  24350.      
  24351. use GKS_TYPES;
  24352.      
  24353. package DC_OPS_DEFS is
  24354.      
  24355.    -- Access
  24356.      
  24357.    function XMIN
  24358.       (RECT : in     DC . RECTANGLE_LIMITS) return DC_TYPE;
  24359.      
  24360.    function XMAX
  24361.       (RECT : in     DC . RECTANGLE_LIMITS) return DC_TYPE;
  24362.      
  24363.    function YMIN
  24364.       (RECT : in     DC . RECTANGLE_LIMITS) return DC_TYPE;
  24365.      
  24366.    function YMAX
  24367.       (RECT : in     DC . RECTANGLE_LIMITS) return DC_TYPE;
  24368.      
  24369.    -- Assignment
  24370.      
  24371.    procedure SET_XMIN
  24372.       (RECT  : in out DC . RECTANGLE_LIMITS;
  24373.        COORD : in     DC_TYPE);
  24374.      
  24375.    procedure SET_XMAX
  24376.       (RECT  : in out DC . RECTANGLE_LIMITS;
  24377.        COORD : in     DC_TYPE);
  24378.      
  24379.    procedure SET_YMIN
  24380.       (RECT  : in out DC . RECTANGLE_LIMITS;
  24381.        COORD : in     DC_TYPE);
  24382.      
  24383.    procedure SET_YMAX
  24384.       (RECT  : in out DC . RECTANGLE_LIMITS;
  24385.        COORD : in     DC_TYPE);
  24386.      
  24387.    -- Aggregate
  24388.      
  24389.    function RECTANGLE_LIMITS_MAKE
  24390.       (XMIN : in     DC_TYPE;
  24391.        XMAX : in     DC_TYPE;
  24392.        YMIN : in     DC_TYPE;
  24393.        YMAX : in     DC_TYPE)
  24394.        return  DC . RECTANGLE_LIMITS;
  24395.      
  24396. end DC_OPS_DEFS;
  24397. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24398. --:UDD:GKSADACM:CODE:MA:DC_OPS_DEFS_B.ADA
  24399. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24400. ------------------------------------------------------------------
  24401. --
  24402. --  NAME: DC_OPS_DEFS - BODY
  24403. --  IDENTIFIER: GDMXXX.1(1)
  24404. --  DISCREPANCY REPORTS:
  24405. --
  24406. ------------------------------------------------------------------
  24407. -- File: DC_OPS_DEFS_B.ADA
  24408. -- Level: all
  24409.      
  24410. package body DC_OPS_DEFS is
  24411.      
  24412.    -- Access functions provide functions to be used in a generic
  24413.    -- instantiation to access the values of components of the record.
  24414.    -- The name of each function is the name of its component.
  24415.      
  24416.    function XMIN
  24417.       (RECT : in     DC . RECTANGLE_LIMITS)
  24418.       return DC_TYPE is
  24419.    -- Return the XMIN component of RECT.
  24420.      
  24421.    begin
  24422.      
  24423.       return RECT . XMIN;
  24424.      
  24425.    end XMIN;
  24426.      
  24427.    function XMAX
  24428.       (RECT : in     DC . RECTANGLE_LIMITS)
  24429.       return DC_TYPE is
  24430.    -- Return the XMAX component of RECT.
  24431.      
  24432.    begin
  24433.      
  24434.       return RECT . XMAX;
  24435.      
  24436.    end XMAX;
  24437.      
  24438.    function YMIN
  24439.       (RECT : in     DC . RECTANGLE_LIMITS)
  24440.       return DC_TYPE is
  24441.    -- Return the YMIN component of RECT.
  24442.      
  24443.    begin
  24444.      
  24445.       return RECT . YMIN;
  24446.      
  24447.    end YMIN;
  24448.      
  24449.    function YMAX
  24450.       (RECT : in     DC . RECTANGLE_LIMITS)
  24451.       return DC_TYPE is
  24452.    -- Return the YMAX component of RECT.
  24453.      
  24454.    begin
  24455.      
  24456.       return RECT . YMAX;
  24457.      
  24458.    end YMAX;
  24459.      
  24460.    -- Assignment functions provide functions to be used in a generic
  24461.    -- instantiation to assign new values to components of the record.
  24462.    -- The name of each function is `SET_' & the name of its component.
  24463.      
  24464.    procedure SET_XMIN
  24465.       (RECT  : in out DC . RECTANGLE_LIMITS;
  24466.        COORD : in     DC_TYPE) is
  24467.    -- Assign COORD to the XMIN component of RECT.
  24468.      
  24469.    begin
  24470.      
  24471.       RECT . XMIN := COORD;
  24472.      
  24473.    end SET_XMIN;
  24474.      
  24475.    procedure SET_XMAX
  24476.       (RECT  : in out DC . RECTANGLE_LIMITS;
  24477.        COORD : in     DC_TYPE) is
  24478.    -- Assign COORD to the XMAX component of RECT.
  24479.      
  24480.    begin
  24481.      
  24482.       RECT . XMAX := COORD;
  24483.      
  24484.    end SET_XMAX;
  24485.      
  24486.    procedure SET_YMIN
  24487.       (RECT  : in out DC . RECTANGLE_LIMITS;
  24488.        COORD : in     DC_TYPE) is
  24489.    -- Assign COORD to the YMIN component of RECT.
  24490.      
  24491.    begin
  24492.      
  24493.       RECT . YMIN := COORD;
  24494.      
  24495.    end SET_YMIN;
  24496.      
  24497.    procedure SET_YMAX
  24498.       (RECT  : in out DC . RECTANGLE_LIMITS;
  24499.        COORD : in     DC_TYPE) is
  24500.    -- Assign COORD to the YMAX component of RECT.
  24501.      
  24502.    begin
  24503.      
  24504.       RECT . YMAX := COORD;
  24505.      
  24506.    end SET_YMAX;
  24507.      
  24508.    -- Aggregate
  24509.      
  24510.    function RECTANGLE_LIMITS_MAKE
  24511.       (XMIN : in     DC_TYPE;
  24512.        XMAX : in     DC_TYPE;
  24513.        YMIN : in     DC_TYPE;
  24514.        YMAX : in     DC_TYPE)
  24515.        return  DC . RECTANGLE_LIMITS is
  24516.    -- Return a rectangle formed from the corresponding input parameters.
  24517.      
  24518.    begin
  24519.      
  24520.       return DC . RECTANGLE_LIMITS'
  24521.          (XMIN => XMIN,
  24522.           XMAX => XMAX,
  24523.           YMIN => YMIN,
  24524.           YMAX => YMAX);
  24525.      
  24526.    end RECTANGLE_LIMITS_MAKE;
  24527.      
  24528. end DC_OPS_DEFS;
  24529. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24530. --:UDD:GKSADACM:CODE:MA:DC_OPS.ADA
  24531. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24532. ------------------------------------------------------------------
  24533. --
  24534. --  NAME: DC_OPS
  24535. --  IDENTIFIER: GDMXXX.1(1)
  24536. --  DISCREPANCY REPORTS:
  24537. --
  24538. ------------------------------------------------------------------
  24539. -- File: DC_OPS.ADA
  24540. -- Level: all
  24541.      
  24542. with RECTANGLE_LIMITS_OPS;
  24543. with GKS_TYPES;
  24544. with DC_OPS_DEFS;
  24545.      
  24546. use GKS_TYPES;
  24547.      
  24548. package DC_OPS is new RECTANGLE_LIMITS_OPS
  24549.    (COORDINATE            => DC_TYPE,
  24550.     RECTANGLE_LIMITS      => DC . RECTANGLE_LIMITS,
  24551.     XMIN                  => DC_OPS_DEFS . XMIN,
  24552.     XMAX                  => DC_OPS_DEFS . XMAX,
  24553.     YMIN                  => DC_OPS_DEFS . YMIN,
  24554.     YMAX                  => DC_OPS_DEFS . YMAX,
  24555.     RECTANGLE_LIMITS_MAKE => DC_OPS_DEFS . RECTANGLE_LIMITS_MAKE);
  24556.      
  24557. -- Package GKS_TYPES defines the DC_TYPE and the DC package.
  24558. -- Package DC_OPS_DEFS defines the access and aggregate subprograms
  24559. -- needed to instantiate RECTANGLE_LIMITS_OPS.
  24560. -- Package RECTANGLE_LIMITS_OPS is a generic package which defines
  24561. -- relational operations on rectangles.
  24562. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24563. --:UDD:GKSADACM:CODE:MA:NDC_OPS_DEFS.ADA
  24564. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24565. ------------------------------------------------------------------
  24566. --
  24567. --  NAME: NDC_OPS_DEFS
  24568. --  IDENTIFIER: GDMXXX.1(1)
  24569. --  DISCREPANCY REPORTS:
  24570. --
  24571. ------------------------------------------------------------------
  24572. -- File: NDC_OPS_DEFS.ADA
  24573. -- Level: all
  24574.      
  24575. with GKS_TYPES;
  24576.      
  24577. use GKS_TYPES;
  24578.      
  24579. package NDC_OPS_DEFS is
  24580.      
  24581.    -- Access
  24582.      
  24583.    function XMIN
  24584.       (RECT : in     NDC . RECTANGLE_LIMITS) return NDC_TYPE;
  24585.      
  24586.    function XMAX
  24587.       (RECT : in     NDC . RECTANGLE_LIMITS) return NDC_TYPE;
  24588.      
  24589.    function YMIN
  24590.       (RECT : in     NDC . RECTANGLE_LIMITS) return NDC_TYPE;
  24591.      
  24592.    function YMAX
  24593.       (RECT : in     NDC . RECTANGLE_LIMITS) return NDC_TYPE;
  24594.      
  24595.    -- Assignment
  24596.      
  24597.    procedure SET_XMIN
  24598.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  24599.        COORD : in     NDC_TYPE);
  24600.      
  24601.    procedure SET_XMAX
  24602.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  24603.        COORD : in     NDC_TYPE);
  24604.      
  24605.    procedure SET_YMIN
  24606.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  24607.        COORD : in     NDC_TYPE);
  24608.      
  24609.    procedure SET_YMAX
  24610.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  24611.        COORD : in     NDC_TYPE);
  24612.      
  24613.    -- Aggregate
  24614.      
  24615.    function RECTANGLE_LIMITS_MAKE
  24616.       (XMIN : in     NDC_TYPE;
  24617.        XMAX : in     NDC_TYPE;
  24618.        YMIN : in     NDC_TYPE;
  24619.        YMAX : in     NDC_TYPE)
  24620.        return  NDC . RECTANGLE_LIMITS;
  24621.      
  24622. end NDC_OPS_DEFS;
  24623. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24624. --:UDD:GKSADACM:CODE:MA:NDC_OPS_DEFS_B.ADA
  24625. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24626. ------------------------------------------------------------------
  24627. --
  24628. --  NAME: NDC_OPS_DEFS - BODY
  24629. --  IDENTIFIER: GDMXXX.1(1)
  24630. --  DISCREPANCY REPORTS:
  24631. --
  24632. ------------------------------------------------------------------
  24633. -- File: NDC_OPS_DEFS_B.ADA
  24634. -- Level: all
  24635.      
  24636. package body NDC_OPS_DEFS is
  24637.      
  24638.    -- Access functions provide functions to be used in a generic
  24639.    -- instantiation to access the values of components of the record.
  24640.    -- The name of each function is the name of its component.
  24641.      
  24642.    function XMIN
  24643.       (RECT : in     NDC . RECTANGLE_LIMITS)
  24644.       return NDC_TYPE is
  24645.    -- Return the XMIN component of RECT.
  24646.      
  24647.    begin
  24648.      
  24649.       return RECT . XMIN;
  24650.      
  24651.    end XMIN;
  24652.      
  24653.    function XMAX
  24654.       (RECT : in     NDC . RECTANGLE_LIMITS)
  24655.       return NDC_TYPE is
  24656.    -- Return the XMAX component of RECT.
  24657.      
  24658.    begin
  24659.      
  24660.       return RECT . XMAX;
  24661.      
  24662.    end XMAX;
  24663.      
  24664.    function YMIN
  24665.       (RECT : in     NDC . RECTANGLE_LIMITS)
  24666.       return NDC_TYPE is
  24667.    -- Return the YMIN component of RECT.
  24668.      
  24669.    begin
  24670.      
  24671.       return RECT . YMIN;
  24672.      
  24673.    end YMIN;
  24674.      
  24675.    function YMAX
  24676.       (RECT : in     NDC . RECTANGLE_LIMITS)
  24677.       return NDC_TYPE is
  24678.    -- Return the YMAX component of RECT.
  24679.      
  24680.    begin
  24681.      
  24682.       return RECT . YMAX;
  24683.      
  24684.    end YMAX;
  24685.      
  24686.    -- Assignment functions provide functions to be used in a generic
  24687.    -- instantiation to assign new values to components of the record.
  24688.    -- The name of each function is `SET_' & the name of its component.
  24689.      
  24690.    procedure SET_XMIN
  24691.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  24692.        COORD : in     NDC_TYPE) is
  24693.    -- Assign COORD to the XMIN component of RECT.
  24694.      
  24695.    begin
  24696.      
  24697.       RECT . XMIN := COORD;
  24698.      
  24699.    end SET_XMIN;
  24700.      
  24701.    procedure SET_XMAX
  24702.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  24703.        COORD : in     NDC_TYPE) is
  24704.    -- Assign COORD to the XMAX component of RECT.
  24705.      
  24706.    begin
  24707.      
  24708.       RECT . XMAX := COORD;
  24709.      
  24710.    end SET_XMAX;
  24711.      
  24712.    procedure SET_YMIN
  24713.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  24714.        COORD : in     NDC_TYPE) is
  24715.    -- Assign COORD to the YMIN component of RECT.
  24716.      
  24717.    begin
  24718.      
  24719.       RECT . YMIN := COORD;
  24720.      
  24721.    end SET_YMIN;
  24722.      
  24723.    procedure SET_YMAX
  24724.       (RECT  : in out NDC . RECTANGLE_LIMITS;
  24725.        COORD : in     NDC_TYPE) is
  24726.    -- Assign COORD to the YMAX component of RECT.
  24727.      
  24728.    begin
  24729.      
  24730.       RECT . YMAX := COORD;
  24731.      
  24732.    end SET_YMAX;
  24733.      
  24734.    -- Aggregate
  24735.      
  24736.    function RECTANGLE_LIMITS_MAKE
  24737.       (XMIN : in     NDC_TYPE;
  24738.        XMAX : in     NDC_TYPE;
  24739.        YMIN : in     NDC_TYPE;
  24740.        YMAX : in     NDC_TYPE)
  24741.        return  NDC . RECTANGLE_LIMITS is
  24742.    -- Return a rectangle formed from the corresponding input parameters.
  24743.      
  24744.    begin
  24745.      
  24746.       return NDC . RECTANGLE_LIMITS'
  24747.          (XMIN => XMIN,
  24748.           XMAX => XMAX,
  24749.           YMIN => YMIN,
  24750.           YMAX => YMAX);
  24751.      
  24752.    end RECTANGLE_LIMITS_MAKE;
  24753.      
  24754. end NDC_OPS_DEFS;
  24755. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24756. --:UDD:GKSADACM:CODE:MA:NDC_OPS.ADA
  24757. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24758. ------------------------------------------------------------------
  24759. --
  24760. --  NAME: NDC_OPS
  24761. --  IDENTIFIER: GDMXXX.1(1)
  24762. --  DISCREPANCY REPORTS:
  24763. --
  24764. ------------------------------------------------------------------
  24765. -- File: NDC_OPS.ADA
  24766. -- Level: all
  24767.      
  24768. with RECTANGLE_LIMITS_OPS;
  24769. with GKS_TYPES;
  24770. with NDC_OPS_DEFS;
  24771.      
  24772. use GKS_TYPES;
  24773.      
  24774. package NDC_OPS is new RECTANGLE_LIMITS_OPS
  24775.    (COORDINATE            => NDC_TYPE,
  24776.     RECTANGLE_LIMITS      => NDC . RECTANGLE_LIMITS,
  24777.     XMIN                  => NDC_OPS_DEFS . XMIN,
  24778.     XMAX                  => NDC_OPS_DEFS . XMAX,
  24779.     YMIN                  => NDC_OPS_DEFS . YMIN,
  24780.     YMAX                  => NDC_OPS_DEFS . YMAX,
  24781.     RECTANGLE_LIMITS_MAKE => NDC_OPS_DEFS . RECTANGLE_LIMITS_MAKE);
  24782.      
  24783. -- Package GKS_TYPES defines the NDC_TYPE and the NDC package.
  24784. -- Package NDC_OPS_DEFS defines the access and aggregate subprograms
  24785. -- needed to instantiate RECTANGLE_LIMITS_OPS.
  24786. -- Package RECTANGLE_LIMITS_OPS is a generic package which defines
  24787. -- relational operations on rectangles.
  24788. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24789. --:UDD:GKSADACM:CODE:MA:WSR_UPDATE_WS_XFORM.ADA
  24790. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24791. ------------------------------------------------------------------
  24792. --
  24793. --  NAME: UPDATE_WS_TRANSFORMATION
  24794. --  IDENTIFIER: GDMXXX.1(1)
  24795. --  DISCREPANCY REPORTS:
  24796. --
  24797. ------------------------------------------------------------------
  24798. -- File: WSR_UPDATE_WS_XFORM.ADA
  24799. -- Level: MA, 0A
  24800.      
  24801. with CONVERT_NDC_DC;
  24802. with NDC_OPS;
  24803.      
  24804. separate (WSR_WS_TRANSFORMATION)
  24805.      
  24806. procedure UPDATE_WS_TRANSFORMATION
  24807.    (WS_SL     : in     WS_STATE_LIST_TYPES . WS_STATE_LIST_PTR) is
  24808.      
  24809. -- Procedure UPDATE_WS_TRANSFORMATION updates the Workstation State List
  24810. -- `WS_SL' to reflect the current values of REQUESTED_WS_WINDOW and
  24811. -- REQUESTED_WS_VIEWPORT.  The CURRENT_WS_WINDOW and the
  24812. -- CURRENT_WS_VIEWPORT are updated. If there is any change in these
  24813. -- values, the WS_TRANSFORM and EFFECTIVE_CLIPPING_RECTANGLE are also
  24814. -- updated.
  24815.      
  24816. -- WS_SL is the Workstation State List (access value) to be updated.
  24817.      
  24818.    NDC_EFFECTIVE_CLIPPING_RECTANGLE : NDC . RECTANGLE_LIMITS;
  24819.    -- Intersection of `WS_SL . OUTPUT_ATTR . CLIPPING_RECTANGLE',
  24820.    -- with the `WS_SL . CURRENT_WS_WINDOW'.
  24821.      
  24822. begin
  24823.      
  24824.    -- Test if current WINDOW//VIEWPORT is up to date (equal requested)
  24825.    if WS_SL . CURRENT_WS_WINDOW /= WS_SL . REQUESTED_WS_WINDOW or else
  24826.       WS_SL . CURRENT_WS_VIEWPORT /= WS_SL . REQUESTED_WS_VIEWPORT then
  24827.      
  24828.       WS_SL . CURRENT_WS_WINDOW := WS_SL . REQUESTED_WS_WINDOW;
  24829.      
  24830.       WS_SL . CURRENT_WS_VIEWPORT := WS_SL . REQUESTED_WS_VIEWPORT;
  24831.      
  24832.       -- Compute and change the pre-computed transformation value
  24833.       --
  24834.       -- Note that the Workstation transformation is an EQUAL scaling
  24835.       -- in both X and Y --- no distortion is introduced into the NDC
  24836.       -- picture.  As far as scaling is concerned, the Workstation
  24837.       -- Viewport is reduced to the same X-Y proportion as the
  24838.       -- Workstation Window. Clipping is performed at the actual
  24839.       -- window.
  24840.      
  24841.       CONVERT_NDC_DC . SET_UNIFORM_SCALES
  24842.             (WS_SL . CURRENT_WS_WINDOW,
  24843.              WS_SL . CURRENT_WS_VIEWPORT,
  24844.              WS_SL . WS_TRANSFORM);
  24845.      
  24846.       -- Change `WS_SL . EFFECTIVE_CLIPPING_RECTANGLE'.
  24847.       -- The effective clipping rectangle is stored in Device
  24848.       -- Coordinates; hence it must be recomputed with each change
  24849.       -- to the Workstation Transformation.  This includes changes in
  24850.       -- the Workstation Viewport, not just when the Workstation Window
  24851.       -- changes.
  24852.       --   The current clipping rectangle, stored in NDC, is "and"ed
  24853.       -- with the workstation window and then converted to DC units.
  24854.      
  24855.       NDC_EFFECTIVE_CLIPPING_RECTANGLE := NDC_OPS . "and"
  24856.             (WS_SL . OUTPUT_ATTR . CLIPPING_RECTANGLE,
  24857.              WS_SL . CURRENT_WS_WINDOW);
  24858.      
  24859.       WS_SL . EFFECTIVE_CLIPPING_RECTANGLE :=
  24860.             CONVERT_NDC_DC . DC_RECTANGLE_LIMITS
  24861.             (NDC_EFFECTIVE_CLIPPING_RECTANGLE,
  24862.             WS_SL . WS_TRANSFORM);
  24863.      
  24864.    end if;
  24865.      
  24866.    WS_SL . WS_XFORM_UPDATE_STATE := NOTPENDING;
  24867.      
  24868. end UPDATE_WS_TRANSFORMATION;
  24869. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24870. --:UDD:GKSADACM:CODE:MA:WSR_GKS_NORM.ADA
  24871. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24872. ------------------------------------------------------------------
  24873. --
  24874. --  NAME: WSR_GKS_NORMALIZATION
  24875. --  IDENTIFIER: GDMXXX.1(1)
  24876. --  DISCREPANCY REPORTS:
  24877. --
  24878. ------------------------------------------------------------------
  24879. -- file : WSR_GKS_NORM.ADA
  24880. -- level: ma,0a,1a,2a
  24881.      
  24882. with GKS_TYPES;
  24883. with WS_STATE_LIST_TYPES;
  24884.      
  24885. use  GKS_TYPES;
  24886.      
  24887. package WSR_GKS_NORMALIZATION is
  24888.      
  24889. -- This package is a workstation resource package that can be used by
  24890. -- any workstation driver that needs to have the CLIPPING_RECTANGLE
  24891. -- set in the specified workstation state list.  It sets the value
  24892. -- in the WS_ST_LST to the specified value then it finds the inter-
  24893. -- section between the CLIP_RECTANGLE and the CURRENT_WS_WINDOW that
  24894. -- is in the workstation state list and sets the EFFECTIVE_CLIPPING_
  24895. -- RECTANGLE in the WS_ST_LST.
  24896.      
  24897.    procedure SET_CLIPPING_RECTANGLE
  24898.       (WS_ST_LST      : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  24899.        CLIP_RECTANGLE : in NDC.RECTANGLE_LIMITS);
  24900.      
  24901.  end WSR_GKS_NORMALIZATION;
  24902. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24903. --:UDD:GKSADACM:CODE:MA:WSR_GKS_NORM_B.ADA
  24904. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24905. ------------------------------------------------------------------
  24906. --
  24907. --  NAME: WSR_GKS_NORMALIZATION - BODY
  24908. --  IDENTIFIER: GDMXXX.1(1)
  24909. --  DISCREPANCY REPORTS:
  24910. --
  24911. ------------------------------------------------------------------
  24912. -- file : WSR_GKS_NORM_B.ADA
  24913. -- level: ma - 2a
  24914.      
  24915. with NDC_OPS;
  24916. with CONVERT_NDC_DC;
  24917.      
  24918. package body WSR_GKS_NORMALIZATION is
  24919.      
  24920.    procedure SET_CLIPPING_RECTANGLE
  24921.       (WS_ST_LST      : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  24922.        CLIP_RECTANGLE : in NDC.RECTANGLE_LIMITS) is
  24923.      
  24924.    -- This procedure sets the value for the CLIPPING_RECTANGLE in the
  24925.    -- WS_STATE_LIST to the value specified by the parameter.
  24926.    --
  24927.    -- The following parameters are used in this procedure:
  24928.    -- WS_ST_LST - The specified WS_STATE_LIST to set the clipping
  24929.    --             rectangle on.
  24930.    -- CLIP_RECTANGLE - The value to which the CLIPPING_RECTANGLE is set.
  24931.      
  24932.       NDC_CLIPPING_RECTANGLE : NDC.RECTANGLE_LIMITS;
  24933.       -- A temporary location for storage of the EFFECTIVE_CLIPPING
  24934.       -- RECTANGLE before it is transformed to DC points and stored in
  24935.       -- the WS_ST_LST.
  24936.      
  24937.    begin
  24938.      
  24939.       WS_ST_LST.OUTPUT_ATTR.CLIPPING_RECTANGLE := CLIP_RECTANGLE;
  24940.      
  24941.       -- Compute the EFFECTIVE_CLIPPING_RECTANGLE.
  24942.       NDC_CLIPPING_RECTANGLE :=
  24943.             NDC_OPS."and"(CLIP_RECTANGLE,WS_ST_LST.CURRENT_WS_WINDOW);
  24944.      
  24945.       -- Transform the clipping rectangle from NDC to DC.
  24946.       WS_ST_LST.EFFECTIVE_CLIPPING_RECTANGLE :=
  24947.             CONVERT_NDC_DC.DC_RECTANGLE_LIMITS
  24948.                (NDC_CLIPPING_RECTANGLE,WS_ST_LST.WS_TRANSFORM);
  24949.      
  24950.    end SET_CLIPPING_RECTANGLE;
  24951.      
  24952. end WSR_GKS_NORMALIZATION;
  24953. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24954. --:UDD:GKSADACM:CODE:MA:DICTIONARY.ADA
  24955. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  24956. ------------------------------------------------------------------
  24957. --
  24958. --  NAME: DICTIONARY
  24959. --  IDENTIFIER: GDMXXX.1(1)
  24960. --  DISCREPANCY REPORTS:
  24961. --
  24962. ------------------------------------------------------------------
  24963. -- File: DICTIONARY.ADA
  24964. -- Level: all
  24965.      
  24966. generic
  24967.      
  24968.    type KEY_TYPE is private;
  24969.      
  24970.    with function "<" (LEFT, RIGHT : in     KEY_TYPE) return BOOLEAN;
  24971.      
  24972.    type VALUE_TYPE is private;
  24973.      
  24974.    type KEY_LIST_TYPE is array (POSITIVE range <>) of KEY_TYPE;
  24975.      
  24976.    type VALUE_LIST_TYPE is array (POSITIVE range <>) of VALUE_TYPE;
  24977.      
  24978. package DICTIONARY is
  24979.      
  24980. -- Package DICTIONARY defines an ASSOCIATION_TYPE and a DICTIONARY_TYPE.
  24981. --
  24982. -- An association between a KEY_TYPE value and a VALUE_TYPE value is
  24983. -- represented by an ASSOCIATION_TYPE value, which is a record with
  24984. -- components KEY, containing the KEY_TYPE value, and VALUE, containing
  24985. -- the VALUE_TYPE value associated with KEY.
  24986. --
  24987. -- A set of associations is called a dictionary, by analogy of the set
  24988. -- of associations between words and their definitions. Dictionaries may
  24989. -- be represented with objects of the type DICTIONARY_TYPE.
  24990. --
  24991. -- A dictionary serves as an associative memory, associating VALUE's to
  24992. -- KEY's.  For any KEY, the associated VALUE can be found.
  24993. --
  24994. -- A pure associative memory, like a set, imposes no order on the
  24995. -- entries.  This dictionary, like Webster's dictionary, is sorted.
  24996. -- The sorted order is used internally to speed-up searching for a KEY.
  24997. -- In order to impose a sorting order the "<" function is imported.  The
  24998. -- lists which can be derived from the dictionary, ASSOCIATION_LIST,
  24999. -- KEY_LIST, and VALUE_LIST, are returned in this sorted order.
  25000. --
  25001. -- DICTIONARY_TYPE is actually an access type.  Simple assignment of one
  25002. -- DICTIONARY_TYPE object to another only results in having two ways to
  25003. -- reference the same dictionary.  A COPY procedure is provided to
  25004. -- generate a new copy.
  25005.      
  25006.    type ASSOCIATION_TYPE is
  25007.       record
  25008.          KEY   : KEY_TYPE;
  25009.          VALUE : VALUE_TYPE;
  25010.       end record;
  25011.      
  25012.    type ASSOCIATION_LIST_TYPE is array (POSITIVE range <>)
  25013.          of ASSOCIATION_TYPE;
  25014.      
  25015.    type DICTIONARY_TYPE is private;
  25016.      
  25017.    KEY_IN_USE : exception;
  25018.      
  25019.    KEY_NOT_FOUND : exception;
  25020.      
  25021.    procedure CREATE
  25022.       (DICTIONARY : in out DICTIONARY_TYPE;
  25023.        ASSOCIATION : in     ASSOCIATION_TYPE);
  25024.      
  25025.    procedure CREATE
  25026.       (DICTIONARY : in out DICTIONARY_TYPE;
  25027.        KEY        : in     KEY_TYPE;
  25028.        VALUE      : in     VALUE_TYPE);
  25029.      
  25030.    procedure ALTER
  25031.       (DICTIONARY : in     DICTIONARY_TYPE;
  25032.        ASSOCIATION : in     ASSOCIATION_TYPE);
  25033.      
  25034.    procedure ALTER
  25035.       (DICTIONARY : in     DICTIONARY_TYPE;
  25036.        KEY        : in     KEY_TYPE;
  25037.        VALUE      : in     VALUE_TYPE);
  25038.      
  25039.    procedure ENTER
  25040.       (DICTIONARY : in out DICTIONARY_TYPE;
  25041.        ASSOCIATION : in     ASSOCIATION_TYPE);
  25042.      
  25043.    procedure ENTER
  25044.       (DICTIONARY : in out DICTIONARY_TYPE;
  25045.        KEY        : in     KEY_TYPE;
  25046.        VALUE      : in     VALUE_TYPE);
  25047.      
  25048.    procedure REMOVE
  25049.       (DICTIONARY : in out DICTIONARY_TYPE;
  25050.        KEY        : in     KEY_TYPE);
  25051.      
  25052.    procedure PURGE
  25053.       (DICTIONARY : in out DICTIONARY_TYPE;
  25054.        KEY        : in     KEY_TYPE);
  25055.      
  25056.    function IS_IN
  25057.       (DICTIONARY : in     DICTIONARY_TYPE;
  25058.        KEY        : in     KEY_TYPE) return BOOLEAN;
  25059.      
  25060.    function ASSOCIATION
  25061.       (DICTIONARY : in     DICTIONARY_TYPE;
  25062.        KEY        : in     KEY_TYPE) return ASSOCIATION_TYPE;
  25063.      
  25064.    function VALUE
  25065.       (DICTIONARY : in     DICTIONARY_TYPE;
  25066.        KEY        : in     KEY_TYPE) return VALUE_TYPE;
  25067.      
  25068.    function SIZE
  25069.       (DICTIONARY : in     DICTIONARY_TYPE) return NATURAL;
  25070.      
  25071.    function ASSOCIATION_LIST
  25072.       (DICTIONARY : in     DICTIONARY_TYPE) return ASSOCIATION_LIST_TYPE;
  25073.      
  25074.    function KEY_LIST
  25075.       (DICTIONARY : in     DICTIONARY_TYPE) return KEY_LIST_TYPE;
  25076.      
  25077.    function VALUE_LIST
  25078.       (DICTIONARY : in     DICTIONARY_TYPE) return VALUE_LIST_TYPE;
  25079.      
  25080.    function COPY
  25081.       (ORIGINAL : in     DICTIONARY_TYPE) return DICTIONARY_TYPE;
  25082.      
  25083. private
  25084.      
  25085.    type DICTIONARY_NODE_TYPE;
  25086.      
  25087.    type DICTIONARY_TYPE is access DICTIONARY_NODE_TYPE;
  25088.      
  25089. end DICTIONARY;
  25090. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  25091. --:UDD:GKSADACM:CODE:MA:DICTIONARY_B.ADA
  25092. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  25093. ------------------------------------------------------------------
  25094. --
  25095. --  NAME: DICTIONARY - BODY
  25096. --  IDENTIFIER: GDMXXX.1(1)
  25097. --  DISCREPANCY REPORTS:
  25098. --
  25099. ------------------------------------------------------------------
  25100. -- File: DICTIONARY_B.ADA
  25101. -- Level: all
  25102.      
  25103. with UNCHECKED_DEALLOCATION;
  25104.      
  25105. package body DICTIONARY is
  25106.      
  25107. -- UNCHECKED_DEALLOCATION is a generic procedure in the predefined
  25108. -- language environment. Here, FREE_TREE_NODE is instantiated to
  25109. -- provide a procedure to deallocate TREE_NODE_TYPE objects.
  25110.      
  25111.    -- First some auxiliary types and subprograms must be defined
  25112.      
  25113.    type TREE_NODE_TYPE;
  25114.      
  25115.    type TREE_TYPE is access TREE_NODE_TYPE;
  25116.      
  25117.    type TREE_NODE_TYPE is
  25118.       record
  25119.          ASSOCIATION : ASSOCIATION_TYPE;
  25120.          -- ASSOCIATION holds the KEY and VALUE.
  25121.          L_SON : TREE_TYPE;
  25122.          -- L_SON designates the left-hand son of this node
  25123.          R_SON : TREE_TYPE;
  25124.          -- R_SON designates the right-hand son of this node
  25125.       end record;
  25126.      
  25127.    -- The TREE_NODE_TYPE contains the ASSOCIATION and access
  25128.    -- to the left subtree (L_SON) and the right subtree (R_SON).
  25129.    -- Dynamically allocated TREE_NODE_TYPE objects may be linked
  25130.    -- by the L_SON and R_SON fields.
  25131.      
  25132.    -- In this case, TREE_NODE_TYPE is used to build a sorted binary
  25133.    -- tree of linked nodes.  On insertion into the tree, if `KEY < ROOT
  25134.    -- . ASSOCIATION . KEY' returns `TRUE', the ASSOCIATION is inserted
  25135.    -- into the left subtree, `ROOT . L_SON'.
  25136.    -- (It is assumed that "<" is antisymmetric. That is, `A = B or
  25137.    -- (A < B xor B < A)'.)
  25138.      
  25139.    procedure FREE_TREE_NODE is new UNCHECKED_DEALLOCATION
  25140.       (OBJECT => TREE_NODE_TYPE,
  25141.        NAME   => TREE_TYPE);
  25142.      
  25143.    -- Procedure FREE_TREE_NODE (X : in out TREE_TYPE) deallocates
  25144.    -- the memory used for the tree nodes.  Ada semantic rules do not
  25145.    -- require an Ada implementation to perform automatic "garbage
  25146.    -- collection" of inaccessible nodes.  It is therefore expedient
  25147.    -- to perform UNCHECKED_DEALLOCATION of unused designated objects.
  25148.    --
  25149.    -- X                 - the access value of a TREE_TYPE designated
  25150.    --                     object which is no longer needed.
  25151.      
  25152.    function COPY
  25153.       (TREE : in     TREE_TYPE) return TREE_TYPE;
  25154.      
  25155.    -- Function COPY creates an identical copy of the original tree;
  25156.    -- Contrast this with simple assignment (":=") which only copies the
  25157.    -- access value, resulting in two ways to access the same designated
  25158.    -- object.
  25159.    --
  25160.    -- Note that the ASSOCIATIONs in the tree are only assigned, not
  25161.    -- themselves COPY'ed.  This is a warning against the use of access
  25162.    -- types for VALUE_TYPE.
  25163.    --
  25164.    -- TREE              - an access value of the tree to be copied
  25165.      
  25166.    function COPY_NOT_NULL
  25167.       (TREE : in     TREE_TYPE) return TREE_TYPE;
  25168.      
  25169.    -- COPT_NOT_NULL is a helper function for COPY. It creates an
  25170.    -- identical copy of the original tree, which is assumed to be
  25171.    -- non-null.  This function is more efficient than a single
  25172.    -- COPY function, since it does not have to test for a null TREE.
  25173.    --
  25174.    -- TREE - non-null access value to a tree
  25175.      
  25176.    function SEARCH
  25177.       (IN_TREE : in     TREE_TYPE;
  25178.        KEY  : in     KEY_TYPE) return TREE_TYPE;
  25179.      
  25180.    -- Function SEARCH searches the binary tree, returning the access
  25181.    -- to the node equal to KEY.  On average, search time is O(log2
  25182.    -- SIZE(IN_TREE)). If no node is found, a null access is returned.
  25183.    --
  25184.    -- IN_TREE           - an access value of the tree to be searched
  25185.    -- KEY               - KEY value used to compare tree nodes
  25186.      
  25187.    procedure TAKE_OUT
  25188.       (TREE : in out TREE_TYPE);
  25189.      
  25190.    -- Procedure TAKE_OUT replaces the TREE with the merger of its
  25191.    -- left and right subtrees. The subtrees themselves are altered to
  25192.    -- merge them together.
  25193.    --
  25194.    -- TREE              - an access value which is replaced with an
  25195.    --                   access to the root of the merged subtrees.
  25196.      
  25197.    generic
  25198.      
  25199.       with procedure PROCESS
  25200.          (ASSOCIATION : in     ASSOCIATION_TYPE);
  25201.      
  25202.    procedure PROCESS_TREE
  25203.       (TREE : in     TREE_TYPE);
  25204.      
  25205.    -- Procedure PROCESS_TREE calls its generic parameter PROCESS once
  25206.    -- for each ASSOCIATION in TREE.  Inorder traversal of TREE is used.
  25207.    --
  25208.    -- TREE              - an access value of the tree to be processed
  25209.      
  25210.    --
  25211.    -- Define implementations for entities declared in package
  25212.    -- specification
  25213.    --
  25214.      
  25215.    type DICTIONARY_NODE_TYPE is
  25216.       record
  25217.          SIZE : NATURAL := 0;
  25218.          ROOT : TREE_TYPE;
  25219.       end record;
  25220.      
  25221.    -- The SIZE of the dictionary is explicitly stored along with an
  25222.    -- access value to the ROOT of a simple binary tree.  No attempt is
  25223.    -- made to keep the tree balanced. This yields good average behavior
  25224.    -- over randomly distributed keys, but the worst case is poor for
  25225.    -- "linearized trees".  Choose the AVL tree for those cases.
  25226.      
  25227.    --
  25228.    -- Define bodies of auxiliary subprograms
  25229.    --
  25230.      
  25231.    function SEARCH
  25232.       (IN_TREE : in     TREE_TYPE;
  25233.        KEY     : in     KEY_TYPE) return TREE_TYPE is
  25234.      
  25235.    -- Function SEARCH returns an access value to the node of `IN_TREE'
  25236.    -- which has an `ASSOCIATION . KEY' field equal to `KEY'. If `KEY'
  25237.    -- is not found, the returned value is `null'.
  25238.      
  25239.       TREE : TREE_TYPE := IN_TREE;
  25240.      
  25241.    begin
  25242.      
  25243.       while TREE /= null loop
  25244.      
  25245.          if KEY = TREE . ASSOCIATION . KEY then
  25246.      
  25247.             exit;
  25248.      
  25249.          elsif KEY < TREE . ASSOCIATION . KEY then
  25250.      
  25251.             TREE := TREE . L_SON;
  25252.      
  25253.          else
  25254.      
  25255.             TREE := TREE . R_SON;
  25256.      
  25257.          end if;
  25258.      
  25259.       end loop;
  25260.      
  25261.       return TREE;
  25262.      
  25263.    end SEARCH;
  25264.      
  25265.    procedure PROCESS_TREE
  25266.       (TREE : in     TREE_TYPE) is
  25267.      
  25268.    -- Procedure PROCESS_TREE calls its generic parameter PROCESS once
  25269.    -- for each ASSOCIATION in TREE.  Inorder traversal of TREE is used.
  25270.    --
  25271.    -- TREE              - an access value of the tree to be processed
  25272.      
  25273.    begin
  25274.      
  25275.       if TREE /= null then
  25276.      
  25277.          PROCESS_TREE (TREE . L_SON);
  25278.      
  25279.          PROCESS (TREE . ASSOCIATION);
  25280.      
  25281.          PROCESS_TREE (TREE . R_SON);
  25282.      
  25283.       end if;
  25284.      
  25285.    end PROCESS_TREE;
  25286.      
  25287.    function COPY
  25288.       (TREE : in     TREE_TYPE) return TREE_TYPE is
  25289.      
  25290.    -- Create an identical copy of the original tree.  Contrast this
  25291.    -- with simple assignment (":=").
  25292.    -- Note that the ASSOCIATIONs in the tree are only assigned, not
  25293.    -- COPY'ed, themselves.
  25294.    --
  25295.    -- TREE - Access to root of binary tree
  25296.      
  25297.    begin
  25298.      
  25299.       if TREE /= null then
  25300.      
  25301.          return  COPY_NOT_NULL (TREE);
  25302.      
  25303.       else
  25304.      
  25305.          return null;
  25306.      
  25307.       end if;
  25308.      
  25309.    end COPY;
  25310.      
  25311.    function COPY_NOT_NULL
  25312.       (TREE : in     TREE_TYPE) return TREE_TYPE is
  25313.      
  25314.    -- Create an identical copy of the original tree, assumed to be
  25315.    -- non-null.  This function is more efficient than a single
  25316.    -- COPY function, since it does not have to test for a null TREE.
  25317.    -- It does test for null sons of TREE, but these tests are paid
  25318.    -- back by avoiding over half of the procedure calls which would
  25319.    -- otherwise be wasted to produce a null value.  (For `N' interior
  25320.    -- nodes, there are `N+1' null values.)
  25321.    --
  25322.    -- TREE - non-null Access to root of binary tree
  25323.      
  25324.       TREE_L : TREE_TYPE;
  25325.       -- Access Object to designate new left subtree
  25326.      
  25327.       TREE_R : TREE_TYPE;
  25328.       -- Access Object to designate new right subtree
  25329.      
  25330.    begin
  25331.       -- We assume that TREE is non-null. We avoid any calls
  25332.       -- which would violate this assumption.
  25333.      
  25334.       -- Test TREE . L_SON to avoid recursion for null tree
  25335.      
  25336.       if TREE . L_SON /= null then
  25337.      
  25338.          TREE_L := COPY_NOT_NULL (TREE . L_SON);
  25339.      
  25340.       end if;
  25341.      
  25342.       -- Test TREE . R_SON to avoid recursion for null tree
  25343.      
  25344.       if TREE . R_SON /= null then
  25345.      
  25346.          TREE_R := COPY_NOT_NULL (TREE . R_SON);
  25347.      
  25348.       end if;
  25349.      
  25350.       return new TREE_NODE_TYPE' (
  25351.             L_SON       => TREE_L,
  25352.             R_SON       => TREE_R,
  25353.             ASSOCIATION => TREE . ASSOCIATION);
  25354.      
  25355.    end COPY_NOT_NULL;
  25356.      
  25357.    procedure TAKE_OUT
  25358.       (TREE : in out TREE_TYPE) is
  25359.      
  25360.    -- Procedure TAKE_OUT removes the node accessed by `TREE' and
  25361.    -- replaces it with another node.  The tree descending from `TREE'
  25362.    -- is reformed in a simple way to avoid increasing the depth of
  25363.    -- the tree.  After the two trivial cases, where one subtree is null,
  25364.    -- two other cases arise. In the first, the left subtree can simply
  25365.    -- be attached as `L_SON' of `TREE . R_SON', the successor of TREE.
  25366.    -- In the final case, the successor of `TREE' is moved from the end
  25367.    -- of the L_SON chain of `TREE . R_SON' to be the new root of the
  25368.    -- tree.
  25369.    --
  25370.    -- TREE - access to the node to be deleted.  Return value is
  25371.    --        root of the re-formed tree.  The initial value of TREE
  25372.    --        should not be null, or a CONSTRAINT_ERROR arises.
  25373.      
  25374.       TREE_L : TREE_TYPE := TREE . L_SON;
  25375.       -- TREE_L - Left son of the original root
  25376.      
  25377.       TREE_R : TREE_TYPE := TREE . R_SON;
  25378.       -- TREE_R - Right son of the original root
  25379.      
  25380.    begin
  25381.      
  25382.       -- Reclaim storage for deleted node (at TREE)
  25383.       -- We still have access to subtrees through TREE_L and TREE_R.
  25384.      
  25385.       FREE_TREE_NODE (TREE);
  25386.      
  25387.       -- The first two cases can be in arbitrary order
  25388.      
  25389.       if TREE_L = null then
  25390.      
  25391.          TREE := TREE_R;
  25392.      
  25393.       elsif TREE_R = null then
  25394.      
  25395.          TREE := TREE_L;
  25396.      
  25397.       else
  25398.          -- At this point, (TREE_L /= null) and (TREE_R /= null)
  25399.      
  25400.          -- TREE_L and TREE_R are two non-null subtrees to be merged.
  25401.          -- To preserve the sequence of in-order traversal, either the
  25402.          -- predecessor or the successor of the original TREE node can
  25403.          -- be installed as the new root node. We arbitrarily choose the
  25404.          -- successor, in the right subtree, as the new root.
  25405.      
  25406.          TREE := TREE_R;
  25407.      
  25408.          if TREE . L_SON = null then
  25409.      
  25410.          -- We only have to attach the left subtree
  25411.      
  25412.             TREE . L_SON := TREE_L;
  25413.      
  25414.          else
  25415.      
  25416.             -- Successor is at the end of the "L_SON" chain
  25417.      
  25418.             declare
  25419.      
  25420.                PREV : TREE_TYPE;
  25421.                -- Node from which TREE (the successor) is to be detached
  25422.      
  25423.             begin
  25424.      
  25425.                loop
  25426.      
  25427.                   PREV := TREE;
  25428.      
  25429.                   TREE := TREE . L_SON;
  25430.      
  25431.                   exit when TREE . L_SON = null;
  25432.      
  25433.                end loop;
  25434.      
  25435.                -- Replace PREV . L_SON with TREE . R_SON
  25436.                -- Note that, currently, TREE = PREV . L_SON;
  25437.      
  25438.                PREV . L_SON := TREE . R_SON;
  25439.      
  25440.                -- Attach left and right subtrees to TREE
  25441.      
  25442.                TREE . L_SON := TREE_L;
  25443.                TREE . R_SON := TREE_R;
  25444.      
  25445.             end;
  25446.      
  25447.          end if;
  25448.      
  25449.       end if;
  25450.      
  25451.    end TAKE_OUT;
  25452.      
  25453.    --
  25454.    -- Define implementations for subprograms declared in package
  25455.    -- specification
  25456.    --
  25457.      
  25458.    procedure CREATE
  25459.       (DICTIONARY : in out DICTIONARY_TYPE;
  25460.        ASSOCIATION : in     ASSOCIATION_TYPE) is
  25461.      
  25462.    -- CREATE adds a new association to the dictionary.  If ASSOCIATION .
  25463.    -- KEY already is used in an association, then KEY_IN_USE is raised.
  25464.    -- Exceptions:  KEY_IN_USE
  25465.    --
  25466.    -- DICTIONARY        - an access value of the dictionary in which
  25467.    --                   ASSOCIATION is to be inserted.  This parameter
  25468.    --                   must be `in out' mode because a newly allocated
  25469.    --                   access value is returned in place of a null
  25470.    --                   `in' value for DICTIONARY.
  25471.    -- ASSOCIATION       - a record representing the association of its
  25472.    --                   KEY component with its VALUE component.
  25473.      
  25474.       KEY : KEY_TYPE renames ASSOCIATION . KEY;
  25475.      
  25476.       procedure FIND
  25477.          (TREE : in out TREE_TYPE) is
  25478.      
  25479.       -- Procedure FIND moves down the TREE recursively searching
  25480.       -- for the point to insert the new ASSOCIATION.  Searching
  25481.       -- continues until either a node is found with an equal KEY, or
  25482.       -- an empty branch is taken.  KEY_IN_USE is raised if the key is
  25483.       -- found in the tree.  The null branch is replaced with a new
  25484.       -- node.
  25485.       --
  25486.       -- Procedure FIND originally had more work to do, updating
  25487.       -- the SIZE fields of each node along the access path. Now,
  25488.       -- the only SIZE field is in the DICTIONARY, not the TREE.
  25489.       -- An iterative version of CREATE could be made without using
  25490.       -- a recursive procedure.  However, the formal parameter TREE
  25491.       -- stands in for both the `TREE . L_SON' and `TREE . R_SON' calls
  25492.       -- in this version, resulting in a more compact and readable
  25493.       -- algorithm.
  25494.      
  25495.       -- WARNING: FIND uses `KEY' and `DICTIONARY . SIZE' from
  25496.       -- the enclosing scope.
  25497.      
  25498.       begin
  25499.      
  25500.          if TREE = null then
  25501.      
  25502.             TREE := new TREE_NODE_TYPE'
  25503.                  (L_SON        => null,
  25504.                   R_SON        => null,
  25505.                   ASSOCIATION => ASSOCIATION);
  25506.      
  25507.          elsif KEY = TREE . ASSOCIATION . KEY then
  25508.      
  25509.             raise KEY_IN_USE;
  25510.      
  25511.          elsif KEY < TREE . ASSOCIATION . KEY then
  25512.      
  25513.             FIND (TREE . L_SON);
  25514.      
  25515.          else
  25516.      
  25517.             FIND (TREE . R_SON);
  25518.      
  25519.          end if;
  25520.      
  25521.       end FIND;
  25522.      
  25523.    begin
  25524.      
  25525.       if DICTIONARY = null then
  25526.      
  25527.          DICTIONARY := new DICTIONARY_NODE_TYPE'
  25528.             (SIZE => 0, ROOT => null);
  25529.      
  25530.       end if;
  25531.      
  25532.       FIND (DICTIONARY . ROOT);
  25533.      
  25534.       -- if KEY_IN_USE is raised, the following is not executed
  25535.       DICTIONARY . SIZE := DICTIONARY . SIZE + 1;
  25536.      
  25537.    end CREATE;
  25538.      
  25539.    procedure CREATE
  25540.       (DICTIONARY : in out DICTIONARY_TYPE;
  25541.        KEY        : in     KEY_TYPE;
  25542.        VALUE      : in     VALUE_TYPE) is
  25543.      
  25544.    -- CREATE adds a new association to the dictionary linking KEY to its
  25545.    -- associated value. If KEY already has an association KEY_IN_USE is
  25546.    -- raised.
  25547.    -- Exceptions:  KEY_IN_USE
  25548.    --
  25549.    -- DICTIONARY        - an access value of the dictionary in which
  25550.    --                   ASSOCIATION is to be inserted.  This parameter
  25551.    --                   must be `in out' mode because a newly allocated
  25552.    --                   access value is returned in place of a null
  25553.    --                   `in' value for DICTIONARY.
  25554.    -- KEY               - the "handle" by which VALUE can be referenced
  25555.    --                   in the DICTIONARY. (Corresponds to the "word"
  25556.    --                   which is used to order and index the
  25557.    --                   dictionary.)
  25558.    -- VALUE             - the information which is to be associated with
  25559.    --                   KEY.  (Corresponds to the "definition" of KEY in
  25560.    --                   a dictionary.)
  25561.      
  25562.    begin
  25563.      
  25564.       CREATE (DICTIONARY, ASSOCIATION_TYPE' (KEY, VALUE));
  25565.      
  25566.    end CREATE;
  25567.      
  25568.    procedure ALTER
  25569.       (DICTIONARY  : in     DICTIONARY_TYPE;
  25570.        ASSOCIATION : in     ASSOCIATION_TYPE) is
  25571.      
  25572.    -- ALTER replaces a pre-existing association in the dictionary.
  25573.    -- If ASSOCIATION . KEY is not in DICTIONARY then KEY_NOT_FOUND is
  25574.    -- raised.
  25575.    -- Exceptions:  KEY_NOT_FOUND
  25576.    --
  25577.    -- DICTIONARY        - an access value of the dictionary in which
  25578.    --                   ASSOCIATION is to be altered.
  25579.    -- ASSOCIATION       - a record representing the association of its
  25580.    --                   KEY component with its VALUE component.
  25581.      
  25582.       KEY : KEY_TYPE renames ASSOCIATION . KEY;
  25583.      
  25584.       TREE : TREE_TYPE;
  25585.      
  25586.    begin
  25587.      
  25588.       if DICTIONARY = null then
  25589.      
  25590.          raise KEY_NOT_FOUND;
  25591.      
  25592.       end if;
  25593.      
  25594.       TREE := DICTIONARY . ROOT;
  25595.      
  25596.       while TREE /= null
  25597.       loop
  25598.      
  25599.          if KEY = TREE . ASSOCIATION . KEY then
  25600.      
  25601.             TREE . ASSOCIATION := ASSOCIATION;
  25602.             return;
  25603.      
  25604.          elsif KEY < TREE . ASSOCIATION . KEY then
  25605.      
  25606.             TREE := TREE . L_SON;
  25607.      
  25608.          else
  25609.      
  25610.             TREE := TREE . R_SON;
  25611.      
  25612.          end if;
  25613.      
  25614.       end loop;
  25615.      
  25616.       raise KEY_NOT_FOUND;
  25617.      
  25618.    end ALTER;
  25619.      
  25620.    procedure ALTER
  25621.       (DICTIONARY : in     DICTIONARY_TYPE;
  25622.        KEY        : in     KEY_TYPE;
  25623.        VALUE      : in     VALUE_TYPE) is
  25624.      
  25625.    -- ALTER sets the VALUE corresponding to KEY. KEY must already
  25626.    -- be in DICTIONARY or else KEY_NOT_FOUND is raised.
  25627.    -- Exceptions:  KEY_NOT_FOUND
  25628.    --
  25629.    -- DICTIONARY        - an access value of the dictionary in which
  25630.    --                   ASSOCIATION is to be inserted.
  25631.    -- KEY               - the "handle" by which VALUE can be referenced
  25632.    --                   in the DICTIONARY. (Corresponds to the "word"
  25633.    --                   which is used to order and index the
  25634.    --                   dictionary.)
  25635.    -- VALUE             - the information which is to be associated with
  25636.    --                   KEY.  (Corresponds to the "definition" of KEY in
  25637.    --                   a dictionary.)
  25638.      
  25639.       TREE : TREE_TYPE;
  25640.      
  25641.    begin
  25642.      
  25643.       if DICTIONARY = null then
  25644.      
  25645.          raise KEY_NOT_FOUND;
  25646.      
  25647.       end if;
  25648.      
  25649.       TREE := DICTIONARY . ROOT;
  25650.      
  25651.       while TREE /= null
  25652.       loop
  25653.      
  25654.          if KEY = TREE . ASSOCIATION . KEY then
  25655.      
  25656.             TREE . ASSOCIATION . VALUE := VALUE;
  25657.             return;
  25658.      
  25659.          elsif KEY < TREE . ASSOCIATION . KEY then
  25660.      
  25661.             TREE := TREE . L_SON;
  25662.      
  25663.          else
  25664.      
  25665.             TREE := TREE . R_SON;
  25666.      
  25667.          end if;
  25668.      
  25669.       end loop;
  25670.      
  25671.       raise KEY_NOT_FOUND;
  25672.      
  25673.    end ALTER;
  25674.      
  25675.    procedure ENTER
  25676.       (DICTIONARY  : in out DICTIONARY_TYPE;
  25677.        ASSOCIATION : in     ASSOCIATION_TYPE) is
  25678.      
  25679.    -- ENTER puts an ASSOCIATION in DICTIONARY.  ASSOCIATION . KEY may
  25680.    -- or may not already be in the dictionary.
  25681.    --
  25682.    -- DICTIONARY        - an access value of the dictionary in which
  25683.    --                   ASSOCIATION is to be inserted.  This parameter
  25684.    --                   must be `in out' mode because a newly allocated
  25685.    --                   access value is returned in place of a null
  25686.    --                   `in' value for DICTIONARY.
  25687.    -- ASSOCIATION       - a record representing the association of its
  25688.    --                   KEY component with its VALUE component.
  25689.      
  25690.       KEY : KEY_TYPE renames ASSOCIATION . KEY;
  25691.      
  25692.       procedure FIND
  25693.          (TREE : in out TREE_TYPE) is
  25694.      
  25695.       -- Procedure FIND moves down the TREE recursively searching
  25696.       -- for the point to insert the new ASSOCIATION.  Searching
  25697.       -- continues until either a node is found with an equal KEY, or
  25698.       -- an empty branch is taken.  If the key is found in the tree,
  25699.       -- the association of that node is replaced. A null branch is
  25700.       -- replaced with a new node.
  25701.       --
  25702.       -- Procedure FIND originally had more work to do, updating
  25703.       -- the SIZE fields of each node along the access path. Now,
  25704.       -- the only SIZE field is in the DICTIONARY, not the TREE.
  25705.       -- An iterative version of ENTER could be made without using
  25706.       -- a recursive procedure.  However, the formal parameter TREE
  25707.       -- stands in for both the `TREE . L_SON' and `TREE . R_SON' calls
  25708.       -- in this version, resulting in a more compact and readable
  25709.       -- algorithm.
  25710.      
  25711.       -- WARNING: FIND uses `KEY' and `DICTIONARY . SIZE' from
  25712.       -- the enclosing scope.
  25713.      
  25714.       begin
  25715.      
  25716.          if TREE = null then
  25717.      
  25718.             TREE := new TREE_NODE_TYPE' (
  25719.                   L_SON        => null,
  25720.                   R_SON        => null,
  25721.                   ASSOCIATION => ASSOCIATION);
  25722.      
  25723.             DICTIONARY . SIZE := DICTIONARY . SIZE + 1;
  25724.      
  25725.             return;
  25726.      
  25727.          elsif KEY = TREE . ASSOCIATION . KEY then
  25728.      
  25729.             TREE . ASSOCIATION := ASSOCIATION;
  25730.      
  25731.             return;
  25732.      
  25733.          elsif KEY < TREE . ASSOCIATION . KEY then
  25734.      
  25735.             FIND (TREE . L_SON);
  25736.      
  25737.          else
  25738.      
  25739.             FIND (TREE . R_SON);
  25740.      
  25741.          end if;
  25742.      
  25743.       end FIND;
  25744.      
  25745.    begin
  25746.      
  25747.       if DICTIONARY = null then
  25748.      
  25749.          DICTIONARY := new DICTIONARY_NODE_TYPE'
  25750.             (SIZE => 0, ROOT => null);
  25751.      
  25752.       end if;
  25753.      
  25754.       FIND (DICTIONARY . ROOT);
  25755.      
  25756.    end ENTER;
  25757.      
  25758.    procedure ENTER
  25759.       (DICTIONARY : in out DICTIONARY_TYPE;
  25760.        KEY        : in     KEY_TYPE;
  25761.        VALUE      : in     VALUE_TYPE) is
  25762.      
  25763.    -- ENTER associates VALUE with KEY in DICTIONARY.  KEY may
  25764.    -- or may not already be in the dictionary.
  25765.    --
  25766.    -- DICTIONARY        - an access value of the dictionary in which
  25767.    --                   ASSOCIATION is to be inserted.  This parameter
  25768.    --                   must be `in out' mode because a newly allocated
  25769.    --                   access value is returned in place of a null
  25770.    --                   `in' value for DICTIONARY.
  25771.    -- KEY               - the "handle" by which VALUE can be referenced
  25772.    --                   in the DICTIONARY. (Corresponds to the "word"
  25773.    --                   which is used to order and index the
  25774.    --                   dictionary.)
  25775.    -- VALUE             - the information which is to be associated with
  25776.    --                   KEY.  (Corresponds to the "definition" of KEY in
  25777.    --                   a dictionary.)
  25778.      
  25779.       procedure FIND
  25780.          (TREE : in out TREE_TYPE) is
  25781.      
  25782.       -- Procedure FIND moves down the TREE recursively searching
  25783.       -- for the point to insert the new ASSOCIATION.  Searching
  25784.       -- continues until either a node is found with an equal KEY, or
  25785.       -- an empty branch is taken.  If the key is found in the tree,
  25786.       -- the association of that node is replaced. A null branch is
  25787.       -- replaced with a new node.
  25788.       --
  25789.       -- TREE - The access value to the tree being searched
  25790.       --
  25791.       -- Procedure FIND originally had more work to do, updating
  25792.       -- the SIZE fields of each node along the access path. Now,
  25793.       -- the only SIZE field is in the DICTIONARY, not the TREE.
  25794.       -- An iterative version of ENTER could be made without using
  25795.       -- a recursive procedure.  However, the formal parameter TREE
  25796.       -- stands in for both the `TREE . L_SON' and `TREE . R_SON' calls
  25797.       -- in this version, resulting in a more compact and readable
  25798.       -- algorithm.
  25799.      
  25800.       -- WARNING: FIND uses `KEY' and `DICTIONARY . SIZE' from
  25801.       -- the enclosing scope.
  25802.      
  25803.       begin
  25804.      
  25805.          if TREE = null then
  25806.      
  25807.             TREE := new TREE_NODE_TYPE' (
  25808.                   L_SON        => null,
  25809.                   R_SON        => null,
  25810.                   ASSOCIATION => ASSOCIATION_TYPE' (KEY, VALUE));
  25811.      
  25812.             DICTIONARY . SIZE := DICTIONARY . SIZE + 1;
  25813.      
  25814.             return;
  25815.      
  25816.          elsif KEY = TREE . ASSOCIATION . KEY then
  25817.      
  25818.             TREE . ASSOCIATION . VALUE := VALUE;
  25819.      
  25820.             return;
  25821.      
  25822.          elsif KEY < TREE . ASSOCIATION . KEY then
  25823.      
  25824.             FIND (TREE . L_SON);
  25825.      
  25826.          else
  25827.      
  25828.             FIND (TREE . R_SON);
  25829.      
  25830.          end if;
  25831.      
  25832.       end FIND;
  25833.      
  25834.    begin
  25835.      
  25836.       if DICTIONARY = null then
  25837.      
  25838.          DICTIONARY := new DICTIONARY_NODE_TYPE'
  25839.             (SIZE => 0, ROOT => null);
  25840.      
  25841.       end if;
  25842.      
  25843.       FIND (DICTIONARY . ROOT);
  25844.      
  25845.       -- The following Code could replace this subprogram body and
  25846.       -- its "FIND" routine.  However, code space has been sacrificed
  25847.       -- to attempt to provide better run-time speed.
  25848.       -- ENTER (DICTIONARY, ASSOCIATION_TYPE' (KEY, VALUE));
  25849.       --
  25850.    end ENTER;
  25851.      
  25852.    procedure REMOVE
  25853.       (DICTIONARY : in out DICTIONARY_TYPE;
  25854.        KEY        : in     KEY_TYPE) is
  25855.      
  25856.    -- Remove the association of KEY to its VALUE in DICTIONARY.  If no
  25857.    -- association exists for KEY, raise KEY_NOT_FOUND.
  25858.    -- Exceptions:  KEY_NOT_FOUND
  25859.    --
  25860.    -- DICTIONARY        - an access value of the dictionary from which
  25861.    --                   KEY is to be removed.
  25862.    -- KEY               - value of the KEY field of the ASSOCIATION to
  25863.    --                   be removed from DICTIONARY.
  25864.      
  25865.       procedure FIND
  25866.          (TREE : in out TREE_TYPE) is
  25867.      
  25868.       -- Procedure FIND moves down the TREE recursively searching
  25869.       -- for the ASSOCIATION with the given KEY.  Searching
  25870.       -- continues until either a node is found with an equal KEY, or
  25871.       -- an empty branch is taken.  If the key is found in the tree,
  25872.       -- the association of that node is removed. If not found, the
  25873.       -- exception KEY_NOT_FOUND is raised.
  25874.       --
  25875.       -- TREE - Access to root of Tree in being searched
  25876.       --
  25877.       -- Procedure FIND originally had more work to do, updating
  25878.       -- the SIZE fields of each node along the access path. Now,
  25879.       -- the only SIZE field is in the DICTIONARY, not the TREE.
  25880.       -- An iterative version of ENTER could be made without using
  25881.       -- a recursive procedure.  However, the formal parameter TREE
  25882.       -- stands in for both the `TREE . L_SON' and `TREE . R_SON' calls
  25883.       -- in this version, resulting in a more compact and readable
  25884.       -- algorithm.
  25885.      
  25886.       -- WARNING: FIND uses `KEY' and `DICTIONARY . SIZE' from
  25887.       -- the enclosing scope.
  25888.      
  25889.       begin
  25890.      
  25891.          if TREE = null then
  25892.      
  25893.             raise KEY_NOT_FOUND;
  25894.      
  25895.          elsif KEY = TREE . ASSOCIATION . KEY then
  25896.      
  25897.             TAKE_OUT (TREE);
  25898.      
  25899.             DICTIONARY . SIZE := DICTIONARY . SIZE - 1;
  25900.      
  25901.             return;
  25902.      
  25903.          elsif KEY < TREE . ASSOCIATION . KEY then
  25904.      
  25905.             FIND (TREE . L_SON);
  25906.      
  25907.          else
  25908.      
  25909.             FIND (TREE . R_SON);
  25910.      
  25911.          end if;
  25912.      
  25913.       end FIND;
  25914.      
  25915.    begin
  25916.      
  25917.       if DICTIONARY = null then
  25918.      
  25919.          raise KEY_NOT_FOUND;
  25920.      
  25921.       end if;
  25922.      
  25923.       FIND (DICTIONARY . ROOT);
  25924.      
  25925.    end REMOVE;
  25926.      
  25927.    procedure PURGE
  25928.       (DICTIONARY : in out DICTIONARY_TYPE;
  25929.        KEY        : in     KEY_TYPE) is
  25930.      
  25931.    -- Remove any association of KEY to its (unknown) VALUE from
  25932.    -- DICTIONARY. If no association exists, just return.
  25933.    --
  25934.    -- DICTIONARY        - an access value of the dictionary from which
  25935.    --                   KEY is to be purged.
  25936.    -- KEY               - value of the KEY field of the ASSOCIATION to
  25937.    --                   be purged from DICTIONARY.
  25938.      
  25939.       procedure FIND
  25940.          (TREE : in out TREE_TYPE) is
  25941.      
  25942.       -- Procedure FIND moves down the TREE recursively searching
  25943.       -- for the ASSOCIATION with the given KEY.  Searching
  25944.       -- continues until either a node is found with an equal KEY, or
  25945.       -- an empty branch is taken.  If the key is found in the tree,
  25946.       -- the association of that node is removed. If not found, no
  25947.       -- action is taken.
  25948.       --
  25949.       -- TREE - Access to root of tree being searched
  25950.       --
  25951.       -- Procedure FIND originally had more work to do, updating
  25952.       -- the SIZE fields of each node along the access path. Now,
  25953.       -- the only SIZE field is in the DICTIONARY, not the TREE.
  25954.       -- An iterative version of ENTER could be made without using
  25955.       -- a recursive procedure.  However, the formal parameter TREE
  25956.       -- stands in for both the `TREE . L_SON' and `TREE . R_SON' calls
  25957.       -- in this version, resulting in a more compact and readable
  25958.       -- algorithm.
  25959.      
  25960.       -- WARNING: FIND uses `KEY' and `DICTIONARY . SIZE' from
  25961.       -- the enclosing scope.
  25962.      
  25963.       begin
  25964.      
  25965.          if TREE = null then
  25966.      
  25967.             return;
  25968.      
  25969.          elsif KEY = TREE . ASSOCIATION . KEY then
  25970.      
  25971.             TAKE_OUT (TREE);
  25972.      
  25973.             DICTIONARY . SIZE := DICTIONARY . SIZE - 1;
  25974.      
  25975.             return;
  25976.      
  25977.          elsif KEY < TREE . ASSOCIATION . KEY then
  25978.      
  25979.             FIND (TREE . L_SON);
  25980.      
  25981.          else
  25982.      
  25983.             FIND (TREE . R_SON);
  25984.      
  25985.          end if;
  25986.      
  25987.       end FIND;
  25988.      
  25989.    begin
  25990.      
  25991.       if DICTIONARY = null then
  25992.      
  25993.          return;
  25994.      
  25995.       end if;
  25996.      
  25997.       FIND (DICTIONARY . ROOT);
  25998.      
  25999.    end PURGE;
  26000.      
  26001.    function IS_IN
  26002.       (DICTIONARY : in     DICTIONARY_TYPE;
  26003.        KEY        : in     KEY_TYPE) return BOOLEAN is
  26004.      
  26005.    -- Function IS_IN returns TRUE if KEY has an ASSOCIATION in the
  26006.    -- DICTIONARY.
  26007.    --
  26008.    -- DICTIONARY        - an access value of the dictionary that is
  26009.    --                   searched for KEY.
  26010.    -- KEY               - value of the KEY field of the ASSOCIATION to
  26011.    --                   be matched in DICTIONARY.
  26012.      
  26013.    begin
  26014.      
  26015.       return DICTIONARY /= null and then
  26016.             SEARCH (DICTIONARY . ROOT, KEY) /= null;
  26017.      
  26018.    end IS_IN;
  26019.      
  26020.    function ASSOCIATION
  26021.       (DICTIONARY : in     DICTIONARY_TYPE;
  26022.        KEY        : in     KEY_TYPE) return ASSOCIATION_TYPE is
  26023.      
  26024.    -- Function ASSOCIATION returns the ASSOCIATION associated
  26025.    -- with KEY in the DICTIONARY.
  26026.    -- Exceptions:  KEY_NOT_FOUND
  26027.    -- DICTIONARY        - an access value of the dictionary that is
  26028.    --                   searched for KEY.
  26029.    -- KEY               - value of the KEY field of the ASSOCIATION to
  26030.    --                   be matched in DICTIONARY.
  26031.      
  26032.    begin
  26033.      
  26034.       if DICTIONARY = null then
  26035.      
  26036.          raise KEY_NOT_FOUND;
  26037.      
  26038.       end if;
  26039.      
  26040.       declare
  26041.      
  26042.          TREE : TREE_TYPE := SEARCH (DICTIONARY . ROOT, KEY);
  26043.      
  26044.       begin
  26045.      
  26046.          if TREE = null then
  26047.      
  26048.             raise KEY_NOT_FOUND;
  26049.      
  26050.          end if;
  26051.      
  26052.          return TREE . ASSOCIATION;
  26053.      
  26054.       end;
  26055.      
  26056.    end ASSOCIATION;
  26057.      
  26058.    function VALUE
  26059.       (DICTIONARY : in     DICTIONARY_TYPE;
  26060.        KEY        : in     KEY_TYPE) return VALUE_TYPE is
  26061.      
  26062.    -- Function VALUE returns the VALUE associated with KEY in the
  26063.    -- specified DICTIONARY.
  26064.    -- Exceptions:  KEY_NOT_FOUND
  26065.    -- DICTIONARY        - an access value of the dictionary that is
  26066.    --                   searched for KEY.
  26067.    -- KEY               - value of the KEY field of the ASSOCIATION to
  26068.    --                   be matched in DICTIONARY.
  26069.      
  26070.    begin
  26071.      
  26072.       return ASSOCIATION (DICTIONARY, KEY) . VALUE;
  26073.      
  26074.    end VALUE;
  26075.      
  26076.    function SIZE
  26077.       (DICTIONARY : in     DICTIONARY_TYPE) return NATURAL is
  26078.      
  26079.    -- Return the number of ASSOCIATIONS in DICTIONARY.
  26080.    -- DICTIONARY        - an access value of the dictionary
  26081.      
  26082.    begin
  26083.      
  26084.       if DICTIONARY = null then
  26085.      
  26086.          return 0;
  26087.      
  26088.       else
  26089.      
  26090.          return DICTIONARY . SIZE;
  26091.      
  26092.       end if;
  26093.      
  26094.    end SIZE;
  26095.      
  26096.    function ASSOCIATION_LIST
  26097.       (DICTIONARY : in    DICTIONARY_TYPE)
  26098.        return ASSOCIATION_LIST_TYPE is
  26099.      
  26100.    -- Return the list of ASSOCIATIONs currently in DICTIONARY.
  26101.    --
  26102.    -- Note on usage:
  26103.    -- Normally one does not return a unconstrained type, since
  26104.    -- the calling program must be able to handle the returned value
  26105.    -- without raising a CONSTRAINT_ERROR. This is perfectly feasible
  26106.    -- here because the calling program can use SIZE(DICTIONARY) to
  26107.    -- predict and conform to the constraint.
  26108.    --
  26109.    -- The order of the keys is ascending, as defined by generic
  26110.    -- parameter "<".
  26111.    --
  26112.    -- DICTIONARY - access to the dictionary
  26113.      
  26114.       LIST : ASSOCIATION_LIST_TYPE (1.. SIZE(DICTIONARY));
  26115.       -- Array to return list of associations.
  26116.      
  26117.       LIST_INDEX : NATURAL := 0;
  26118.       -- Current number of associations in LIST
  26119.      
  26120.       procedure APPEND_ASSOCIATION_TO_LIST
  26121.          (ASSOCIATION : in     ASSOCIATION_TYPE) is
  26122.      
  26123.       -- Helper procedure used to define instantiation of generic
  26124.       -- PROCESS_TREE.  APPEND_ASSOCIATION_TO_LIST adds the association
  26125.       -- to the end of the LIST of associations collected so far.
  26126.       --
  26127.       -- ASSOCIATION - next association to be added to LIST
  26128.       --
  26129.       -- LIST_INDEX and LIST come from the enclosing scope
  26130.      
  26131.       begin
  26132.      
  26133.          LIST_INDEX := LIST_INDEX + 1;
  26134.          LIST (LIST_INDEX) := ASSOCIATION;
  26135.      
  26136.       end APPEND_ASSOCIATION_TO_LIST;
  26137.      
  26138.       procedure BUILD_ASSOCIATION_LIST is new PROCESS_TREE
  26139.          (PROCESS => APPEND_ASSOCIATION_TO_LIST);
  26140.      
  26141.    begin
  26142.      
  26143.       if DICTIONARY /= null then
  26144.      
  26145.          BUILD_ASSOCIATION_LIST(DICTIONARY . ROOT);
  26146.      
  26147.       end if;
  26148.      
  26149.       return LIST;
  26150.      
  26151.    end ASSOCIATION_LIST;
  26152.      
  26153.    function KEY_LIST
  26154.       (DICTIONARY : in    DICTIONARY_TYPE)
  26155.          return KEY_LIST_TYPE is
  26156.      
  26157.    -- Return the list of KEYS currently used in DICTIONARY.
  26158.    --
  26159.    -- Note on usage:
  26160.    -- Normally one does not return a unconstrained type, since
  26161.    -- the calling program must be able to handle the returned value
  26162.    -- without raising a CONSTRAINT_ERROR. This is perfectly feasible
  26163.    -- here because the calling program can use SIZE(DICTIONARY) to
  26164.    -- predict and conform to the constraint.
  26165.    --
  26166.    -- The order of the keys is ascending, as defined by generic
  26167.    -- parameter "<".
  26168.    --
  26169.    -- DICTIONARY - access to the dictionary
  26170.      
  26171.       LIST : KEY_LIST_TYPE(1.. SIZE (DICTIONARY));
  26172.       -- Array to return list of keys.
  26173.      
  26174.       LIST_INDEX : NATURAL := 0;
  26175.       -- Current number of items in LIST
  26176.      
  26177.       procedure APPEND_KEY_TO_LIST
  26178.          (ASSOCIATION : in     ASSOCIATION_TYPE) is
  26179.      
  26180.       -- Helper procedure used to define instantiation of generic
  26181.       -- PROCESS_TREE.  APPEND_KEY_TO_LIST adds the key
  26182.       -- to the end of the LIST of keys collected so far.
  26183.       --
  26184.       -- ASSOCIATION - ASSOCIATION . KEY is next KEY to be added to LIST
  26185.       --
  26186.       -- LIST_INDEX and LIST come from the enclosing scope
  26187.      
  26188.       begin
  26189.      
  26190.          LIST_INDEX := LIST_INDEX + 1;
  26191.          LIST (LIST_INDEX) := ASSOCIATION . KEY;
  26192.      
  26193.       end APPEND_KEY_TO_LIST;
  26194.      
  26195.       procedure BUILD_KEY_LIST is new PROCESS_TREE
  26196.          (PROCESS => APPEND_KEY_TO_LIST);
  26197.      
  26198.    begin
  26199.      
  26200.       if DICTIONARY /= null then
  26201.      
  26202.          BUILD_KEY_LIST(DICTIONARY . ROOT);
  26203.      
  26204.       end if;
  26205.      
  26206.       return LIST;
  26207.      
  26208.    end KEY_LIST;
  26209.      
  26210.    function VALUE_LIST
  26211.       (DICTIONARY : in    DICTIONARY_TYPE) return VALUE_LIST_TYPE is
  26212.      
  26213.    -- Return the list of VALUES currently used in DICTIONARY.
  26214.    -- The order of the VALUES is identical to KEY_LIST.
  26215.    --
  26216.    -- Note on usage:
  26217.    -- Normally one does not return a unconstrained type, since
  26218.    -- the calling program must be able to handle the returned value
  26219.    -- without raising a CONSTRAINT_ERROR. This is perfectly feasible
  26220.    -- here because the calling program can use SIZE(DICTIONARY) to
  26221.    -- predict and conform to the constraint.
  26222.    --
  26223.      
  26224.       LIST : VALUE_LIST_TYPE(1.. SIZE (DICTIONARY));
  26225.       -- Array to return list of VALUEs
  26226.      
  26227.       LIST_INDEX : NATURAL := 0;
  26228.       -- Current number of items in LIST
  26229.      
  26230.       procedure APPEND_VALUE_TO_LIST
  26231.          (ASSOCIATION : in     ASSOCIATION_TYPE) is
  26232.      
  26233.       -- Helper procedure used to define instantiation of generic
  26234.       -- PROCESS_TREE.  APPEND_VALUE_TO_LIST adds the value
  26235.       -- to the end of the LIST of values collected so far.
  26236.       --
  26237.       -- ASSOCIATION - ASSOCIATION . VALUE is next VALUE to be added
  26238.       --
  26239.       -- LIST_INDEX and LIST come from the enclosing scope
  26240.      
  26241.       begin
  26242.      
  26243.          LIST_INDEX := LIST_INDEX + 1;
  26244.          LIST (LIST_INDEX) := ASSOCIATION . VALUE;
  26245.      
  26246.       end APPEND_VALUE_TO_LIST;
  26247.      
  26248.       procedure BUILD_VALUE_LIST is new PROCESS_TREE
  26249.          (PROCESS => APPEND_VALUE_TO_LIST);
  26250.      
  26251.    begin
  26252.      
  26253.       if DICTIONARY /= null then
  26254.      
  26255.          BUILD_VALUE_LIST(DICTIONARY . ROOT);
  26256.      
  26257.       end if;
  26258.      
  26259.       return LIST;
  26260.      
  26261.    end VALUE_LIST;
  26262.      
  26263.    function COPY
  26264.       (ORIGINAL : in     DICTIONARY_TYPE)
  26265.          return DICTIONARY_TYPE is
  26266.      
  26267.    -- Create an identical copy of the ORIGINAL dictionary.
  26268.    -- Contrast this with ":=".
  26269.    -- Note that the ASSOCIATIONs in the dictionary are
  26270.    -- only assigned, not COPY'ed.
  26271.    --
  26272.    -- ORIGINAL - Access to original DICTIONARY
  26273.      
  26274.    begin
  26275.      
  26276.       if ORIGINAL /= null then
  26277.      
  26278.          return new DICTIONARY_NODE_TYPE'
  26279.             (SIZE => ORIGINAL . SIZE,
  26280.              ROOT => COPY (ORIGINAL . ROOT));
  26281.      
  26282.       else
  26283.      
  26284.          return null;
  26285.      
  26286.       end if;
  26287.      
  26288.    end COPY;
  26289.      
  26290. end DICTIONARY;
  26291. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26292. --:UDD:GKSADACM:CODE:MA:CGI_OPEN_WS_OPS.ADA
  26293. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26294. ------------------------------------------------------------------
  26295. --
  26296. --  NAME: CGI_OPEN_WS_OPERATIONS
  26297. --  IDENTIFIER: GDMXXX.1(1)
  26298. --  DISCREPANCY REPORTS:
  26299. --
  26300. ------------------------------------------------------------------
  26301. -- file: CGI_OPEN_WS_OPS.ADA
  26302. -- level: ma, 0a, 1a, 2a
  26303.      
  26304. with GKS_TYPES;
  26305. with DICTIONARY;
  26306.      
  26307. use GKS_TYPES;
  26308.      
  26309. package CGI_OPEN_WS_OPERATIONS is
  26310.      
  26311. -- This package contains OPEN_WS package which is an instantiation
  26312. -- of a DICTIONARY package.  It provides the workstation manager level
  26313. -- the means to maintain a set of open ws ids and their associated
  26314. -- workstation types.
  26315. -- Package GKS_TYPES provides type definitions.
  26316.      
  26317.    type WS_ID_LIST is array (POSITIVE range <>) of
  26318.          WS_ID;
  26319.    -- Array of workstation ids returned by some subprograms from
  26320.    -- DICTIONARY package
  26321.      
  26322.    type WS_TYPE_LIST is array (POSITIVE range   <>)
  26323.          of WS_TYPE;
  26324.    -- Array of workstation types returned by some subprograms from
  26325.    -- DICTIONARY package
  26326.      
  26327.    package OPEN_WS is new DICTIONARY
  26328.       (KEY_TYPE  => WS_ID,
  26329.        "<" => "<",
  26330.        VALUE_TYPE =>  WS_TYPE,
  26331.        KEY_LIST_TYPE => WS_ID_LIST,
  26332.        VALUE_LIST_TYPE => WS_TYPE_LIST);
  26333.    -- Provides a dictionary and the appropriate operations for the
  26334.    -- association between a workstation id and a
  26335.    -- workstation type for each open workstation
  26336.      
  26337.    OPEN_DICTIONARY : OPEN_WS.DICTIONARY_TYPE;
  26338.    -- Association of the workstation id and workstation type for each
  26339.    -- open workstation
  26340.      
  26341. end CGI_OPEN_WS_OPERATIONS;
  26342. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26343. --:UDD:GKSADACM:CODE:MA:LEXI_INQ_TEXT.ADA
  26344. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26345. ------------------------------------------------------------------
  26346. --
  26347. --  NAME: LEXI3700_INQ_TEXT
  26348. --  IDENTIFIER: GDMXXX.2(1)
  26349. --  DISCREPANCY REPORTS:
  26350. --  Not listed
  26351. ------------------------------------------------------------------
  26352. -- FILE: LEXI_INQ_TEXT.ADA
  26353. -- LEVEL: MA
  26354.      
  26355. with GKS_TYPES;
  26356. with CGI;
  26357. with WS_STATE_LIST_TYPES;
  26358.      
  26359. use  CGI;
  26360. use  GKS_TYPES;
  26361.      
  26362. package LEXI3700_INQ_TEXT is
  26363.      
  26364. -- This package contains a procedure that inquires the Text Extent of
  26365. -- a text string.
  26366.      
  26367.    procedure INQ_TEXT_EXTENT
  26368.       (WS_SL                   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  26369.        POSITION_TEXT           : NDC.POINT;
  26370.        CHAR_STRING             : ACCESS_STRING_TYPE;
  26371.        CONCATENATION_POINT     : out NDC.POINT;
  26372.        TEXT_EXTENT_LOWER_LEFT  : out NDC.POINT;
  26373.        TEXT_EXTENT_LOWER_RIGHT : out NDC.POINT;
  26374.        TEXT_EXTENT_UPPER_LEFT  : out NDC.POINT;
  26375.        TEXT_EXTENT_UPPER_RIGHT : out NDC.POINT);
  26376.      
  26377. end LEXI3700_INQ_TEXT;
  26378. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26379. --:UDD:GKSADACM:CODE:MA:LEXI_INQ_TEXT_B.ADA
  26380. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26381. ------------------------------------------------------------------
  26382. --
  26383. --  NAME: LEXI3700_INQ_TEXT - BODY
  26384. --  IDENTIFIER: GDMXXX.2(1)
  26385. --  DISCREPANCY REPORTS:
  26386. --  Not listed
  26387. ------------------------------------------------------------------
  26388. -- FILE: LEXI_INQ_TEXT_B.ADA
  26389. -- LEVEL: MA
  26390.      
  26391. with LEXI3700_CONFIGURATION;
  26392. with WSR_UTILITIES;
  26393. with CONVERT_NDC_DC;
  26394.      
  26395. package body LEXI3700_INQ_TEXT is
  26396.      
  26397.    procedure INQ_TEXT_EXTENT
  26398.       (WS_SL                   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  26399.        POSITION_TEXT           : NDC.POINT;
  26400.        CHAR_STRING             : ACCESS_STRING_TYPE;
  26401.        CONCATENATION_POINT     : out NDC.POINT;
  26402.        TEXT_EXTENT_LOWER_LEFT  : out NDC.POINT;
  26403.        TEXT_EXTENT_LOWER_RIGHT : out NDC.POINT;
  26404.        TEXT_EXTENT_UPPER_LEFT  : out NDC.POINT;
  26405.        TEXT_EXTENT_UPPER_RIGHT : out NDC.POINT) is separate;
  26406.      
  26407. end LEXI3700_INQ_TEXT;
  26408. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26409. --:UDD:GKSADACM:CODE:MA:WSD_INQ_TEXT_EXT.ADA
  26410. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26411. ------------------------------------------------------------------
  26412. --
  26413. --  NAME: INQ_TEXT_EXTENT
  26414. --  IDENTIFIER: GDMXXX.3(3)
  26415. --  DISCREPANCY REPORTS:
  26416. --  DR041  Miscellaneous updates.
  26417. ------------------------------------------------------------------
  26418. -- FILE  : WSD_INQ_TEXT_EXT.ADA
  26419. -- LEVEL : MA
  26420.      
  26421. with DC_POINT_OPS;
  26422. separate (LEXI3700_INQ_TEXT)
  26423.      
  26424.    procedure INQ_TEXT_EXTENT
  26425.       (WS_SL                   : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  26426.        POSITION_TEXT           : NDC.POINT;
  26427.        CHAR_STRING             : ACCESS_STRING_TYPE;
  26428.        CONCATENATION_POINT     : out NDC.POINT;
  26429.        TEXT_EXTENT_LOWER_LEFT  : out NDC.POINT;
  26430.        TEXT_EXTENT_LOWER_RIGHT : out NDC.POINT;
  26431.        TEXT_EXTENT_UPPER_LEFT  : out NDC.POINT;
  26432.        TEXT_EXTENT_UPPER_RIGHT : out NDC.POINT) is
  26433.      
  26434. -- This procedure defines the Text Extent Rectangle for the input Text
  26435. -- string.  This procedure also returns the Concatenation Point, which
  26436. -- is used to position addition text as required.
  26437.      
  26438. -- Parameter definition section.
  26439.      
  26440. --  WS_SL            - A pointer to the work station state list.
  26441. --  POSITION_TEXT    - The requested starting position of the text.
  26442. --  CHAR_STRING      - The character string used in the calculations.
  26443. --  CONCATENATION_PT - The point used to append additional text.
  26444. --  TEXT_EXTENT_INQ  - The Text Extent Rectangle.
  26445.      
  26446. -- Variable section.
  26447.      
  26448. CAP_TOP              : DC_TYPE :=
  26449.       LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_CAP_TOP;
  26450. -- CAP_TOP           - The fraction of character height to Topline.
  26451.      
  26452. BASE_BOTTOM          : DC_TYPE :=
  26453.       LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT_BASE_BOTTOM;
  26454. -- BASE_BOTTOM       - The fraction of character width to Bottomline.
  26455.      
  26456. CHARACTER_FONT       : DC_TYPE :=
  26457.       LEXI3700_CONFIGURATION.LEXI_CHARACTER_FONT;
  26458. -- CHARACTER_FONT    - Describes the Width/Height ratio of the font.
  26459.      
  26460. CAT_POINT            : DC.POINT;
  26461. -- CAT_POINT         - The DC.POINT version of the Concatenation Point.
  26462.      
  26463. OFFSET               : DC.POINT;
  26464. -- OFFSET            - The X-Y displacements for text positioning.
  26465.      
  26466. START_POSITION       : DC.POINT;
  26467. -- START_POSITION    - The returned actual starting text position.
  26468.      
  26469. DC_POINT             : DC.POINT;
  26470. -- DC_POINT          - The input text position point.
  26471.      
  26472. TEI_LOWER_LEFT       : DC.POINT;
  26473. -- Contains the parallelogram containing the text string.
  26474.      
  26475. TEI_LOWER_RIGHT      : DC.POINT;
  26476. -- Contains the parallelogram containing the text string.
  26477.      
  26478. TEI_UPPER_LEFT       : DC.POINT;
  26479. -- Contains the parallelogram containing the text string.
  26480.      
  26481. TEI_UPPER_RIGHT      : DC.POINT;
  26482. -- Contains the parallelogram containing the text string.
  26483.      
  26484. HCOS                 : DC_TYPE;
  26485. -- The Cosine of the Height Vector.
  26486.      
  26487. HSIN                 : DC_TYPE;
  26488. -- The Sine of the Height Vector.
  26489.      
  26490. DC_CHAR_HEIGHT_VECTOR : DC.VECTOR;
  26491. -- Contains the vector in dc.
  26492.      
  26493. CHAR_HEIGHT : DC_TYPE;
  26494. -- Contains the sqrt of the height vector;
  26495.      
  26496. begin
  26497.    DC_POINT := CONVERT_NDC_DC.DC_POINT
  26498.       (POSITION_TEXT, WS_SL.WS_TRANSFORM);
  26499.      
  26500. -- Call the procedure TEXT_HANDLING to calculate the Offsets and Start
  26501. -- Position needed to calculate the Concatenation Point.  TEXT_HANDLING
  26502. -- calculates the Text Extent Rectangle, which is also returned.
  26503.      
  26504.    WSR_UTILITIES.TEXT_HANDLING
  26505.        (CAP_TOP,
  26506.         BASE_BOTTOM,
  26507.         WS_SL.OUTPUT_ATTR.CURRENT_TEXT_PATH,
  26508.         WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT,
  26509.         CONVERT_NDC_DC.DC_VECTOR
  26510.              (WS_SL.OUTPUT_ATTR.CURRENT_CHAR_HEIGHT_VECTOR,
  26511.               WS_SL.WS_TRANSFORM),
  26512.         CONVERT_NDC_DC.DC_VECTOR
  26513.              (WS_SL.OUTPUT_ATTR.CURRENT_CHAR_WIDTH_VECTOR,
  26514.               WS_SL.WS_TRANSFORM),
  26515.         WS_SL.OUTPUT_ATTR.CURRENT_CHAR_EXPANSION_FACTOR,
  26516.         WS_SL.OUTPUT_ATTR.CURRENT_CHAR_SPACING,
  26517.         DC_POINT,
  26518.         CHAR_STRING'LENGTH,
  26519.         CHARACTER_FONT,
  26520.         START_POSITION,
  26521.         OFFSET,
  26522.         TEI_LOWER_LEFT,
  26523.         TEI_LOWER_RIGHT,
  26524.         TEI_UPPER_LEFT,
  26525.         TEI_UPPER_RIGHT);
  26526.      
  26527. -- Determine the Concatenation Point.
  26528.      
  26529.    DC_CHAR_HEIGHT_VECTOR := CONVERT_NDC_DC.DC_VECTOR
  26530.       (WS_SL.OUTPUT_ATTR.CURRENT_CHAR_HEIGHT_VECTOR,
  26531.        WS_SL.WS_TRANSFORM);
  26532.      
  26533.    CHAR_HEIGHT := DC_POINT_OPS.NORM(DC_CHAR_HEIGHT_VECTOR);
  26534.      
  26535.    HCOS := DC_CHAR_HEIGHT_VECTOR.X / CHAR_HEIGHT;
  26536.    HSIN := DC_CHAR_HEIGHT_VECTOR.Y / CHAR_HEIGHT;
  26537.      
  26538.    case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_PATH is
  26539.       when UP =>
  26540.          case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  26541.             when TOP =>
  26542.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  26543.                   when CENTRE | NORMAL =>
  26544.                                  CAT_POINT.X := (TEI_LOWER_LEFT.X +
  26545.                                     TEI_LOWER_RIGHT.X) / 2.0;
  26546.                                  CAT_POINT.Y := (TEI_LOWER_LEFT.Y +
  26547.                                     TEI_LOWER_RIGHT.Y) / 2.0;
  26548.      
  26549.                   when LEFT =>   CAT_POINT.X := TEI_LOWER_LEFT.X;
  26550.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y;
  26551.      
  26552.                   when RIGHT =>  CAT_POINT.X := TEI_LOWER_RIGHT.X;
  26553.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y;
  26554.                end case;
  26555.      
  26556.             when CAP =>
  26557.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  26558.                   when CENTRE | NORMAL =>
  26559.                                  CAT_POINT.X := ((TEI_LOWER_LEFT.X +
  26560.                                     TEI_LOWER_RIGHT.X) / 2.0) +
  26561.                                     (BASE_BOTTOM * HCOS);
  26562.                                  CAT_POINT.Y := ((TEI_LOWER_LEFT.Y +
  26563.                                     TEI_LOWER_RIGHT.Y) / 2.0) +
  26564.                                     (BASE_BOTTOM * HSIN);
  26565.      
  26566.                   when LEFT =>   CAT_POINT.X := TEI_LOWER_LEFT.X +
  26567.                                     (BASE_BOTTOM * HCOS);
  26568.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y +
  26569.                                     (BASE_BOTTOM * HSIN);
  26570.      
  26571.                   when RIGHT =>  CAT_POINT.X := TEI_LOWER_RIGHT.X +
  26572.                                     (BASE_BOTTOM * HCOS);
  26573.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y +
  26574.                                     (BASE_BOTTOM * HSIN);
  26575.                end case;
  26576.      
  26577.             when HALF =>          CAT_POINT.X := START_POSITION.X;
  26578.                                   CAT_POINT.Y := START_POSITION.Y;
  26579.      
  26580.             when BASE | NORMAL =>
  26581.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  26582.                   when CENTRE | NORMAL =>
  26583.                                  CAT_POINT.X := ((TEI_UPPER_LEFT.X +
  26584.                                     TEI_UPPER_RIGHT.X) / 2.0) -
  26585.                                     (CAP_TOP * HCOS);
  26586.                                  CAT_POINT.Y := ((TEI_UPPER_LEFT.Y +
  26587.                                     TEI_UPPER_RIGHT.Y) / 2.0) -
  26588.                                     (CAP_TOP * HSIN);
  26589.      
  26590.                   when LEFT =>   CAT_POINT.X := TEI_UPPER_LEFT.X -
  26591.                                     (CAP_TOP * HCOS);
  26592.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y -
  26593.                                     (CAP_TOP * HSIN);
  26594.      
  26595.                   when RIGHT =>  CAT_POINT.X := TEI_UPPER_RIGHT.X -
  26596.                                     (CAP_TOP * HCOS);
  26597.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y -
  26598.                                     (CAP_TOP * HSIN);
  26599.                end case;
  26600.      
  26601.             when BOTTOM =>
  26602.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  26603.                   when CENTRE | NORMAL =>
  26604.                                  CAT_POINT.X := (TEI_UPPER_LEFT.X +
  26605.                                     TEI_UPPER_RIGHT.X) / 2.0;
  26606.                                  CAT_POINT.Y := (TEI_UPPER_LEFT.Y +
  26607.                                     TEI_UPPER_RIGHT.Y) / 2.0;
  26608.      
  26609.                   when LEFT =>   CAT_POINT.X := TEI_UPPER_LEFT.X;
  26610.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y;
  26611.      
  26612.                   when RIGHT =>  CAT_POINT.X := TEI_UPPER_RIGHT.X;
  26613.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y;
  26614.                end case;
  26615.          end case;
  26616.      
  26617.      
  26618.       when DOWN =>
  26619.          case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  26620.             when TOP | NORMAL =>
  26621.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  26622.                   when CENTRE | NORMAL =>
  26623.                                  CAT_POINT.X := (TEI_LOWER_LEFT.X +
  26624.                                     TEI_LOWER_RIGHT.X) / 2.0;
  26625.                                  CAT_POINT.Y := (TEI_LOWER_LEFT.Y +
  26626.                                     TEI_LOWER_RIGHT.Y) / 2.0;
  26627.      
  26628.                   when LEFT =>   CAT_POINT.X := TEI_LOWER_LEFT.X;
  26629.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y;
  26630.      
  26631.                   when RIGHT =>  CAT_POINT.X := TEI_LOWER_RIGHT.X;
  26632.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y;
  26633.                end case;
  26634.      
  26635.             when CAP =>
  26636.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  26637.                   when CENTRE | NORMAL =>
  26638.                                  CAT_POINT.X := ((TEI_LOWER_LEFT.X +
  26639.                                     TEI_LOWER_RIGHT.X) / 2.0) +
  26640.                                     (BASE_BOTTOM * HCOS);
  26641.                                  CAT_POINT.Y := ((TEI_LOWER_LEFT.Y +
  26642.                                     TEI_LOWER_RIGHT.Y) / 2.0) +
  26643.                                     (BASE_BOTTOM * HSIN);
  26644.      
  26645.                   when LEFT =>   CAT_POINT.X := TEI_LOWER_LEFT.X +
  26646.                                     (BASE_BOTTOM * HCOS);
  26647.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y +
  26648.                                     (BASE_BOTTOM * HSIN);
  26649.      
  26650.                   when RIGHT =>  CAT_POINT.X := TEI_LOWER_RIGHT.X +
  26651.                                     (BASE_BOTTOM * HCOS);
  26652.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y +
  26653.                                     (BASE_BOTTOM * HSIN);
  26654.                end case;
  26655.      
  26656.             when HALF =>          CAT_POINT.X := START_POSITION.X;
  26657.                                   CAT_POINT.Y := START_POSITION.Y;
  26658.      
  26659.             when BASE =>
  26660.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  26661.                   when CENTRE | NORMAL =>
  26662.                                  CAT_POINT.X := ((TEI_UPPER_LEFT.X +
  26663.                                     TEI_UPPER_RIGHT.X) / 2.0) -
  26664.                                     (CAP_TOP * HCOS);
  26665.                                  CAT_POINT.Y := ((TEI_UPPER_LEFT.Y +
  26666.                                     TEI_UPPER_RIGHT.Y) / 2.0) -
  26667.                                     (CAP_TOP * HSIN);
  26668.      
  26669.                   when LEFT =>   CAT_POINT.X := TEI_UPPER_LEFT.X -
  26670.                                     (CAP_TOP * HCOS);
  26671.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y -
  26672.                                     (CAP_TOP * HSIN);
  26673.      
  26674.                   when RIGHT =>  CAT_POINT.X := TEI_UPPER_RIGHT.X -
  26675.                                     (CAP_TOP * HCOS);
  26676.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y -
  26677.                                     (CAP_TOP * HSIN);
  26678.                end case;
  26679.      
  26680.             when BOTTOM =>
  26681.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  26682.                   when CENTRE | NORMAL =>
  26683.                                  CAT_POINT.X := (TEI_UPPER_LEFT.X +
  26684.                                     TEI_UPPER_RIGHT.X) / 2.0;
  26685.                                  CAT_POINT.Y := (TEI_UPPER_LEFT.Y +
  26686.                                     TEI_UPPER_RIGHT.Y) / 2.0;
  26687.      
  26688.                   when LEFT =>   CAT_POINT.X := TEI_UPPER_LEFT.X;
  26689.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y;
  26690.      
  26691.                   when RIGHT =>  CAT_POINT.X := TEI_UPPER_RIGHT.X;
  26692.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y;
  26693.                end case;
  26694.      
  26695.          end case;
  26696.      
  26697.      
  26698.       when LEFT =>
  26699.          case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  26700.             when LEFT =>
  26701.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  26702.                   when TOP =>  CAT_POINT.X := TEI_UPPER_RIGHT.X;
  26703.                                CAT_POINT.Y := TEI_UPPER_RIGHT.Y;
  26704.      
  26705.                   when CAP =>  CAT_POINT.X := TEI_UPPER_RIGHT.X -
  26706.                                   (CAP_TOP * HCOS);
  26707.                                CAT_POINT.Y := TEI_UPPER_RIGHT.Y -
  26708.                                   (CAP_TOP * HSIN);
  26709.      
  26710.                   when HALF => CAT_POINT.X := (TEI_LOWER_RIGHT.X +
  26711.                                   TEI_UPPER_RIGHT.X) / 2.0;
  26712.                                CAT_POINT.Y := (TEI_LOWER_RIGHT.Y +
  26713.                                   TEI_UPPER_RIGHT.Y) / 2.0;
  26714.      
  26715.                   when BASE | NORMAL =>
  26716.                                   CAT_POINT.X := TEI_LOWER_RIGHT.X +
  26717.                                      (BASE_BOTTOM * HCOS);
  26718.                                   CAT_POINT.Y := TEI_LOWER_RIGHT.Y +
  26719.                                      (BASE_BOTTOM * HSIN);
  26720.      
  26721.                   when BOTTOM =>  CAT_POINT.X := TEI_LOWER_RIGHT.X;
  26722.                                   CAT_POINT.Y := TEI_LOWER_RIGHT.Y;
  26723.                end case;
  26724.      
  26725.             when CENTRE =>        CAT_POINT.X := START_POSITION.X;
  26726.                                   CAT_POINT.Y := START_POSITION.Y;
  26727.      
  26728.             when RIGHT | NORMAL =>
  26729.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  26730.                   when TOP =>    CAT_POINT.X := TEI_UPPER_LEFT.X;
  26731.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y;
  26732.      
  26733.                   when CAP =>    CAT_POINT.X := TEI_UPPER_LEFT.X -
  26734.                                     (CAP_TOP * HCOS);
  26735.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y -
  26736.                                     (CAP_TOP * HSIN);
  26737.      
  26738.                   when HALF =>   CAT_POINT.X := (TEI_LOWER_LEFT.X +
  26739.                                     TEI_UPPER_LEFT.X) / 2.0;
  26740.                                  CAT_POINT.Y := (TEI_LOWER_LEFT.Y +
  26741.                                     TEI_UPPER_LEFT.Y) / 2.0;
  26742.      
  26743.                   when BASE | NORMAL =>
  26744.                                  CAT_POINT.X := TEI_LOWER_LEFT.X +
  26745.                                     (BASE_BOTTOM * HCOS);
  26746.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y +
  26747.                                     (BASE_BOTTOM * HSIN);
  26748.      
  26749.                   when BOTTOM => CAT_POINT.X := TEI_LOWER_LEFT.X;
  26750.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y;
  26751.                end case;
  26752.          end case;
  26753.      
  26754.      
  26755.       when RIGHT =>
  26756.          case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.HORIZONTAL is
  26757.             when LEFT | NORMAL =>
  26758.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  26759.                   when TOP =>    CAT_POINT.X := TEI_UPPER_RIGHT.X;
  26760.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y;
  26761.      
  26762.                   when CAP =>    CAT_POINT.X := TEI_UPPER_RIGHT.X -
  26763.                                     (CAP_TOP * HCOS);
  26764.                                  CAT_POINT.Y := TEI_UPPER_RIGHT.Y -
  26765.                                     (CAP_TOP * HSIN);
  26766.      
  26767.                   when HALF =>   CAT_POINT.X := (TEI_LOWER_RIGHT.X +
  26768.                                     TEI_UPPER_RIGHT.X) / 2.0;
  26769.                                  CAT_POINT.Y := (TEI_LOWER_RIGHT.Y +
  26770.                                     TEI_UPPER_RIGHT.Y) / 2.0;
  26771.      
  26772.                   when BASE | NORMAL =>
  26773.                                  CAT_POINT.X := TEI_LOWER_RIGHT.X +
  26774.                                     (BASE_BOTTOM * HCOS);
  26775.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y +
  26776.                                     (BASE_BOTTOM * HSIN);
  26777.      
  26778.                   when BOTTOM => CAT_POINT.X := TEI_LOWER_RIGHT.X;
  26779.                                  CAT_POINT.Y := TEI_LOWER_RIGHT.Y;
  26780.                end case;
  26781.      
  26782.             when CENTRE =>        CAT_POINT.X := START_POSITION.X;
  26783.                                   CAT_POINT.Y := START_POSITION.Y;
  26784.      
  26785.             when RIGHT =>
  26786.                case WS_SL.OUTPUT_ATTR.CURRENT_TEXT_ALIGNMENT.VERTICAL is
  26787.                   when TOP =>    CAT_POINT.X := TEI_UPPER_LEFT.X;
  26788.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y;
  26789.      
  26790.                   when CAP =>    CAT_POINT.X := TEI_UPPER_LEFT.X -
  26791.                                     (CAP_TOP * HCOS);
  26792.                                  CAT_POINT.Y := TEI_UPPER_LEFT.Y -
  26793.                                     (CAP_TOP * HSIN);
  26794.      
  26795.                   when HALF =>   CAT_POINT.X := (TEI_LOWER_LEFT.X +
  26796.                                     TEI_UPPER_LEFT.X) / 2.0;
  26797.                                  CAT_POINT.Y := (TEI_LOWER_LEFT.Y +
  26798.                                     TEI_UPPER_LEFT.Y) / 2.0;
  26799.      
  26800.                   when BASE | NORMAL =>
  26801.                                  CAT_POINT.X := TEI_LOWER_LEFT.X +
  26802.                                     (BASE_BOTTOM * HCOS);
  26803.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y +
  26804.                                     (BASE_BOTTOM * HSIN);
  26805.      
  26806.                   when BOTTOM => CAT_POINT.X := TEI_LOWER_LEFT.X;
  26807.                                  CAT_POINT.Y := TEI_LOWER_LEFT.Y;
  26808.                end case;
  26809.          end case;
  26810.    end case;
  26811.      
  26812.    CONCATENATION_POINT := CONVERT_NDC_DC.NDC_POINT
  26813.       (CAT_POINT, WS_SL.WS_TRANSFORM);
  26814.      
  26815.    TEXT_EXTENT_LOWER_LEFT  := CONVERT_NDC_DC.NDC_POINT
  26816.       (TEI_LOWER_LEFT, WS_SL.WS_TRANSFORM);
  26817.    TEXT_EXTENT_LOWER_RIGHT := CONVERT_NDC_DC.NDC_POINT
  26818.       (TEI_LOWER_RIGHT, WS_SL.WS_TRANSFORM);
  26819.    TEXT_EXTENT_UPPER_LEFT  := CONVERT_NDC_DC.NDC_POINT
  26820.       (TEI_UPPER_LEFT, WS_SL.WS_TRANSFORM);
  26821.    TEXT_EXTENT_UPPER_RIGHT := CONVERT_NDC_DC.NDC_POINT
  26822.       (TEI_UPPER_RIGHT, WS_SL.WS_TRANSFORM);
  26823.      
  26824. end INQ_TEXT_EXTENT;
  26825. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26826. --:UDD:GKSADACM:CODE:0A:LEXI_EXT_PRIM_0A.ADA
  26827. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26828. ------------------------------------------------------------------
  26829. --
  26830. --  NAME: LEXI3700_EXTENDED_OUTPUT_PRIMITIVES
  26831. --  IDENTIFIER: GDMXXX.1(1)
  26832. --  DISCREPANCY REPORTS:
  26833. --
  26834. ------------------------------------------------------------------
  26835. -- FILE: LEXI_EXT_PRIM_0A.ADA
  26836. -- LEVEL: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  26837.      
  26838. with GKS_TYPES;
  26839. with WS_STATE_LIST_TYPES;
  26840. with CGI;
  26841.      
  26842. use  GKS_TYPES;
  26843. use  CGI;
  26844.      
  26845. package LEXI3700_EXTENDED_OUTPUT_PRIMITIVES is
  26846.      
  26847. -- This package contains all extended primitives procedures for the
  26848. -- Lexidata 3700 output device.
  26849. -- If more GDP's are added to the workstation driver, the
  26850. -- procedures are placed here.
  26851.      
  26852.    procedure CELL_ARRAY
  26853.       (WS_SL                    : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  26854.        CELL_ARRAY_CORNER_1_1    : NDC.POINT;
  26855.        CELL_ARRAY_CORNER_DX_DY  : NDC.POINT;
  26856.        CELL_ARRAY_CORNER_DX_1   : NDC.POINT;
  26857.        CELL_COLOUR_MATRIX       : ACCESS_COLOUR_MATRIX_TYPE);
  26858.      
  26859.    procedure CIRCLE
  26860.       (WS_SL                   : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  26861.        CIRCLE_CENTER           : NDC.POINT;
  26862.        CIRCLE_PERIPHERAL_POINT : NDC.POINT);
  26863.      
  26864. end LEXI3700_EXTENDED_OUTPUT_PRIMITIVES;
  26865. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26866. --:UDD:GKSADACM:CODE:0A:LEXI_EXT_PRIM_0A_B.ADA
  26867. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26868. ------------------------------------------------------------------
  26869. --
  26870. --  NAME: LEXI3700_EXTENDED_OUTPUT_PRIMITIVES - BODY
  26871. --  IDENTIFIER: GDMXXX.1(1)
  26872. --  DISCREPANCY REPORTS:
  26873. --
  26874. ------------------------------------------------------------------
  26875. -- FILE: LEXI_EXT_PRIM_0A_B.ADA
  26876. -- LEVEL: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  26877.      
  26878. with CONVERT_NDC_DC;
  26879. with LEXI3700_TYPES;
  26880. with LEXI3700_OUTPUT_DRIVER;
  26881. with WSR_UTILITIES;
  26882. with LEXI_UTILITIES;
  26883.      
  26884. use  LEXI3700_TYPES;
  26885.      
  26886. package body LEXI3700_EXTENDED_OUTPUT_PRIMITIVES is
  26887.      
  26888. -- This package contains all extended primitives procedures for the
  26889. -- Lexidata 3700 output device.
  26890. -- If more GDP's are added to the workstation driver, the
  26891. -- procedures are placed here.
  26892.      
  26893.    procedure CELL_ARRAY
  26894.       (WS_SL                    : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  26895.        CELL_ARRAY_CORNER_1_1    : NDC.POINT;
  26896.        CELL_ARRAY_CORNER_DX_DY  : NDC.POINT;
  26897.        CELL_ARRAY_CORNER_DX_1   : NDC.POINT;
  26898.        CELL_COLOUR_MATRIX       : ACCESS_COLOUR_MATRIX_TYPE)
  26899.       is separate;
  26900.      
  26901.    procedure CIRCLE
  26902.       (WS_SL                   : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  26903.        CIRCLE_CENTER           : NDC.POINT;
  26904.        CIRCLE_PERIPHERAL_POINT : NDC.POINT)
  26905.       is separate;
  26906.      
  26907. end LEXI3700_EXTENDED_OUTPUT_PRIMITIVES;
  26908. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26909. --:UDD:GKSADACM:CODE:0A:WSD_CIRCLE_0A.ADA
  26910. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  26911. ------------------------------------------------------------------
  26912. --
  26913. --  NAME: CIRCLE
  26914. --  IDENTIFIER: GDMXXX.1(1)
  26915. --  DISCREPANCY REPORTS:
  26916. --
  26917. ------------------------------------------------------------------
  26918. -- FILE: WSD_CIRCLE_OA.ADA
  26919. -- LEVEL: OA
  26920.      
  26921. with SQUARE_ROOT;
  26922.      
  26923. separate (LEXI3700_EXTENDED_OUTPUT_PRIMITIVES)
  26924.      
  26925. procedure CIRCLE
  26926.    (WS_SL                   : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  26927.     CIRCLE_CENTER           : NDC.POINT;
  26928.     CIRCLE_PERIPHERAL_POINT : NDC.POINT) is
  26929.      
  26930. -- The CIRCLE procedure is a GDP and all GDP's have no explicit
  26931. -- geometric attributes. Such information may be specified in the
  26932. -- GDP data record.
  26933. --
  26934. -- This procedure calls the IDC procedure in WSD_UTILITIES to
  26935. -- convert the NDC points to IDC (INTEGER DEVICE COORDINATES).
  26936. --
  26937. -- This procedure uses the clipping rectangle to make sure
  26938. -- that the circle is within the window/viewport. Arcs are used
  26939. -- to perform any required clipping on circles.
  26940. --
  26941. -- CIRCLE_CENTER        - contains a point defining the center of a
  26942. --                        circle.
  26943. -- CIRCLE_PERIPHERAL_PT - contains a peripheral point on the circle.
  26944. -- WS_SL                - is a pointer to the Workstation State List.
  26945.      
  26946. RADIUS : DC_TYPE;
  26947. -- RADIUS contains the radius of the circle.
  26948.      
  26949. CENTER : LEXI_POINT;
  26950. -- CENTER contains the center of the circle.
  26951.      
  26952. PERIPHERAL_POINT : LEXI_POINT;
  26953. -- contains the perpheral point.
  26954.      
  26955. CLIP_FLAG : boolean;
  26956. -- CLIP_FLAG tells if clipping is needed on circle.
  26957.      
  26958. LINE_WIDTH : INTEGER := INTEGER(WS_SL.EFFECTIVE_POLYLINE_ATTR.L_WIDTH);
  26959. -- Contains the line width.
  26960.      
  26961. LEXI_LINE_WIDTH : LEXI_LINE_WIDTH_TYPE;
  26962. -- Contains the line width for the device.
  26963.      
  26964. LINE_COLOUR : LEXI_COLOUR_INDEX;
  26965. -- Contains the Colour index .
  26966.      
  26967. IS_VALID : BOOLEAN;
  26968. -- Contains a flag indicating if the colour index is valid.
  26969.      
  26970. DC_CENTER : DC.POINT;
  26971. -- Contains the center of the circle in dc.
  26972.      
  26973. DC_PERIPHERAL : DC.POINT;
  26974. -- Contains the peripheral point of the circle in dc.
  26975.      
  26976. XMIN : DC_TYPE :=  WS_SL.EFFECTIVE_CLIPPING_RECTANGLE.XMIN;
  26977. -- The minimum X point of the clipping rectangle.
  26978.      
  26979. XMAX : DC_TYPE := WS_SL.EFFECTIVE_CLIPPING_RECTANGLE.XMAX;
  26980. -- The maximum X point of the clipping rectangle.
  26981.      
  26982. YMIN : DC_TYPE := WS_SL.EFFECTIVE_CLIPPING_RECTANGLE.YMIN;
  26983. -- The minimum Y point of the clipping rectangle.
  26984.      
  26985. YMAX : DC_TYPE := WS_SL.EFFECTIVE_CLIPPING_RECTANGLE.YMAX;
  26986. -- The maximum Y point of the clipping rectangle.
  26987.      
  26988. MIN_DIS_TO_CLIPPING : DC_TYPE;
  26989. -- The distance from the center point to the minimum rectangle point.
  26990.      
  26991. MAX_DIS_TO_CLIPPING : DC_TYPE;
  26992. -- The distance from the center point to the maximum rectangle point.
  26993.      
  26994. procedure CLIP_CIRCLE (CENTER             : LEXI_POINT;
  26995.                        LINE_COLOUR        : LEXI_COLOUR_INDEX;
  26996.                        CLIPPING_RECTANGLE : DC.RECTANGLE_LIMITS;
  26997.                        RADIUS             : DC_TYPE) is separate;
  26998.      
  26999. begin
  27000.      
  27001.    -- Gets the colour for the circle from polyline attributes
  27002.    -- (implementation dependent).  If the effective polyline colour is
  27003.    -- not in the list of colours set, colour 1 is used.
  27004.      
  27005.    if COLOUR_INDICES.IS_IN_LIST (WS_SL.EFFECTIVE_POLYLINE_ATTR.COLOUR,
  27006.          WS_SL.SET_OF_COLOUR_IDC) then
  27007.      
  27008.       LINE_COLOUR :=
  27009.             LEXI_COLOUR_INDEX(WS_SL.EFFECTIVE_POLYLINE_ATTR.COLOUR);
  27010.    else
  27011.       LINE_COLOUR := LEXI_COLOUR_INDEX(1);
  27012.    end if;
  27013.      
  27014.    -- The line width is taken from the polyline attributes
  27015.    -- (implementation dependent).  If the line width is greater than
  27016.    -- the largest line width supported on the workstation, the largest
  27017.    -- line width supported is used.  If the line width is less than the
  27018.    -- smallest line width supported, the smallest line width supported
  27019.    -- is used.
  27020.      
  27021.    if LINE_WIDTH < INTEGER(LEXI_LINE_WIDTH_TYPE'first) then
  27022.       LEXI_LINE_WIDTH := LEXI_LINE_WIDTH_TYPE'FIRST;
  27023.    elsif LINE_WIDTH > INTEGER(LEXI_LINE_WIDTH_TYPE'last) then
  27024.       LEXI_LINE_WIDTH := LEXI_LINE_WIDTH_TYPE'last;
  27025.    else
  27026.       LEXI_LINE_WIDTH := LEXI_LINE_WIDTH_TYPE(LINE_WIDTH);
  27027.    end if;
  27028.      
  27029.    LEXI3700_OUTPUT_DRIVER.SET_DISPLAY_PARAMETERS
  27030.          (LEXI_LINE_WIDTH,
  27031.           LEXI_LINE_TYPE'val(WS_SL.EFFECTIVE_POLYLINE_ATTR.L_TYPE - 1),
  27032.           LEXI_INTERIOR_STYLE'(HOLLOW));
  27033.      
  27034.    -- Converts the center point to dc coordinates.
  27035.    DC_CENTER := CONVERT_NDC_DC.DC_POINT
  27036.         (CIRCLE_CENTER, WS_SL.WS_TRANSFORM);
  27037.      
  27038.    -- Converts the peripheral point to dc coordinates.
  27039.    DC_PERIPHERAL := CONVERT_NDC_DC.DC_POINT
  27040.         (CIRCLE_PERIPHERAL_POINT, WS_SL.WS_TRANSFORM);
  27041.      
  27042.    -- Converts the center and peripheral points to IDC coordinates
  27043.    -- specific for the device.
  27044.    CENTER           := LEXI_UTILITIES.IDC (DC_CENTER);
  27045.    PERIPHERAL_POINT := LEXI_UTILITIES.IDC (DC_PERIPHERAL);
  27046.      
  27047.    -- Calculate the Radius length.
  27048.      
  27049.    RADIUS := DC_TYPE (SQUARE_ROOT.SQRT (FLOAT (((DC_PERIPHERAL.X - DC_CENTER.X)
  27050. *
  27051.       (DC_PERIPHERAL.X - DC_CENTER.X)) +
  27052.       ((DC_PERIPHERAL.Y - DC_CENTER.Y) *
  27053.       (DC_PERIPHERAL.Y - DC_CENTER.Y)))));
  27054.      
  27055.    -- Calculate the Distance to Clipping values.
  27056.      
  27057.    MIN_DIS_TO_CLIPPING := DC_TYPE (SQUARE_ROOT.SQRT (FLOAT (((XMIN - DC_CENTER.X
  27058. ) *
  27059.       (XMIN - DC_CENTER.X)) + ((YMIN - DC_CENTER.Y) *
  27060.       (YMIN - DC_CENTER.Y)))));
  27061.      
  27062.    MAX_DIS_TO_CLIPPING := DC_TYPE (SQUARE_ROOT.SQRT (FLOAT (((XMAX - DC_CENTER.X
  27063. ) *
  27064.       (XMAX - DC_CENTER.X)) + ((YMAX - DC_CENTER.Y) *
  27065.       (YMAX - DC_CENTER.Y)))));
  27066.      
  27067.    -- Determine if the circle is completely within the window.
  27068.      
  27069.    if DC_CENTER.X + RADIUS <= XMAX and then
  27070.       DC_CENTER.X - RADIUS >= XMIN and then
  27071.       DC_CENTER.Y - RADIUS >= YMIN and then
  27072.       DC_CENTER.Y + RADIUS <= YMAX then
  27073.      
  27074.       LEXI3700_OUTPUT_DRIVER.DISPLAY_CIRCLE (CENTER,
  27075.                                              LEXI_RADIUS_TYPE(RADIUS),
  27076.                                              LINE_COLOUR);
  27077.      
  27078.    elsif RADIUS > MIN_DIS_TO_CLIPPING and then
  27079.          RADIUS > MAX_DIS_TO_CLIPPING then
  27080.             null; -- Done because none of the circle is in the window.
  27081.      
  27082.    elsif (DC_CENTER.X + RADIUS > XMAX and DC_CENTER.X - RADIUS > XMAX)
  27083.       or else
  27084.          (DC_CENTER.X + RADIUS < XMIN and DC_CENTER.X - RADIUS < XMIN)
  27085.       or else
  27086.          (DC_CENTER.Y + RADIUS > YMAX and DC_CENTER.Y - RADIUS > YMAX)
  27087.       or else
  27088.          (DC_CENTER.Y + RADIUS < YMIN and DC_CENTER.Y - RADIUS < YMIN)
  27089.       then
  27090.          null; -- Done because none of the circle is in the window.
  27091.      
  27092.    else
  27093.       CLIP_CIRCLE (CENTER,
  27094.                    LINE_COLOUR,
  27095.                    WS_SL.EFFECTIVE_CLIPPING_RECTANGLE,
  27096.                    RADIUS);
  27097.    end if;
  27098.      
  27099.    WS_SL.WS_DISPLAY_SURFACE := NOTEMPTY;
  27100.      
  27101.    if WS_SL.WS_DEFERRAL_MODE = ASAP then
  27102.       LEXI3700_OUTPUT_DRIVER.FLUSH;
  27103.    end if;
  27104.    -- Flush the output buffer on the device if the deferral mode is ASAP
  27105.      
  27106. end CIRCLE;
  27107. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27108. --:UDD:GKSADACM:CODE:0A:CLIP_CIRCLE.ADA
  27109. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27110. ------------------------------------------------------------------
  27111. --
  27112. --  NAME: CLIP_CIRCLE
  27113. --  IDENTIFIER: GDMXXX.1(1)
  27114. --  DISCREPANCY REPORTS:
  27115. --
  27116. ------------------------------------------------------------------
  27117. -- FILE  : CLIP_CIRCLE.ADA
  27118. -- LEVEL : 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c
  27119.      
  27120. with GKS_TRIG_LIB;
  27121.      
  27122. separate (LEXI3700_EXTENDED_OUTPUT_PRIMITIVES.CIRCLE)
  27123.      
  27124. procedure CLIP_CIRCLE (CENTER             : LEXI_POINT;
  27125.                        LINE_COLOUR        : LEXI_COLOUR_INDEX;
  27126.                        CLIPPING_RECTANGLE : DC.RECTANGLE_LIMITS;
  27127.                        RADIUS             : DC_TYPE) is
  27128.      
  27129. -- This procedure performs the required clipping for all circles.
  27130. --
  27131. -- CENTER            - The center point of the circle.
  27132. -- LINE_COLOUR       - The color that the circle is to be drawn in.
  27133. -- CLIPPING_RECTANGE - The area in which the circle can be seen in,
  27134. --                     outside of which requires clipping to be done.
  27135. -- RADIUS            - The radius of the circle.
  27136.      
  27137. THEATA1        : DC_TYPE := 0.0;
  27138. -- One of the two angles used to determine clipping window intersection.
  27139.      
  27140. THEATA2        : DC_TYPE;
  27141. -- One of the two angles used to determine clipping window intersection.
  27142.      
  27143. START_POINT    : LEXI_COUNT_VALUE;
  27144. -- The point at which the clipped circle begins
  27145.      
  27146. END_POINT      : LEXI_COUNT_VALUE;
  27147. -- The point at which the clipped circle stops
  27148.      
  27149. PIXELS         : LEXI_COUNT_VALUE;
  27150. -- The number of pixels to be used to create the circle segment.
  27151.      
  27152. CNT            : DC_TYPE := 0.0;
  27153. -- A counter used for calculations.
  27154.      
  27155. XVAL1          : DC_TYPE;
  27156. -- Radial length value.
  27157.      
  27158. XVAL2          : DC_TYPE;
  27159. -- Radial length value.
  27160.      
  27161. YVAL1          : DC_TYPE;
  27162. -- Radial length value.
  27163.      
  27164. YVAL2          : DC_TYPE;
  27165. -- Radial length value.
  27166.      
  27167. DRAW_ARC       : BOOLEAN := false;
  27168. -- Flag which indicates that the circle segment (arc) can be drawn.
  27169.      
  27170. VALID_POINT    : BOOLEAN := false;
  27171. -- Flag which indicates that a point, inside the window, has been found.
  27172.      
  27173. I              : DC_TYPE := 0.0;
  27174. -- Counter value.
  27175.      
  27176. PI             : constant DC_TYPE := 3.141592654;
  27177. -- The constant PI, for circle calculations.
  27178.      
  27179. PI_180         : constant DC_TYPE := PI / 180.0;
  27180. -- The constant PI divided by 180.0, for degree to radian conversions.
  27181.      
  27182. PIXEL_RATIO    : constant DC_TYPE := 1.41421; -- 5.66
  27183. -- The length to width pixel ratio.
  27184.      
  27185. NP180          : constant DC_TYPE := 0.5 * PI;
  27186. -- The constant 90.0 * PI / 180.0, used for circle calculations.
  27187.      
  27188. INCREM         : DC_TYPE := 0.2;
  27189. -- The increment for Theata1 and Theata2.
  27190.      
  27191. QUADS          : DC_TYPE;
  27192. -- The number of quadrants the circle traverses.
  27193.      
  27194. LOWER_LEFT     : LEXI_POINT := LEXI_UTILITIES.IDC
  27195.                ((CLIPPING_RECTANGLE.XMIN, CLIPPING_RECTANGLE.YMIN));
  27196. -- The lower left corner of the clipping window.
  27197.      
  27198. UPPER_RIGHT    : LEXI_POINT := LEXI_UTILITIES.IDC
  27199.                ((CLIPPING_RECTANGLE.XMAX, CLIPPING_RECTANGLE.YMAX));
  27200. -- The upper right corner of the clipping window.
  27201.      
  27202. package CIRCLE_TRIG_LIB is new GKS_TRIG_LIB(DC_TYPE);
  27203. use CIRCLE_TRIG_LIB;
  27204.      
  27205. begin
  27206.      
  27207. -- Remain in loop until the entire circumference is traversed, and all
  27208. -- calculations are made.
  27209.      
  27210.       while I <= 361.0 loop
  27211.      
  27212.       THEATA1 := I * PI_180;
  27213.       THEATA2 := (I + INCREM) * PI_180;
  27214.      
  27215.       -- Calculate the radial length for Theata1 and Theata2.
  27216.      
  27217.       XVAL1 := DC_TYPE(CENTER.X) + RADIUS *
  27218.          COS(RADIANS(THEATA1));
  27219.       YVAL1 := DC_TYPE(CENTER.Y) - RADIUS *
  27220.          SIN(RADIANS(THEATA1));
  27221.       XVAL2 := DC_TYPE(CENTER.X) + RADIUS *
  27222.          COS(RADIANS(THEATA2));
  27223.       YVAL2 := DC_TYPE(CENTER.Y) - RADIUS *
  27224.          SIN(RADIANS(THEATA2));
  27225.      
  27226.       -- Determine if specified radial point is a valid one.
  27227.      
  27228.       if (XVAL1 >= DC_TYPE(LOWER_LEFT.X) and
  27229.                    XVAL1 <= DC_TYPE(UPPER_RIGHT.X)) and then
  27230.          (YVAL1 <= DC_TYPE(LOWER_LEFT.Y) and
  27231.                    YVAL1 >= DC_TYPE(UPPER_RIGHT.Y)) and then
  27232.          (XVAL2 >= DC_TYPE(LOWER_LEFT.X) and
  27233.                    XVAL2 <= DC_TYPE(UPPER_RIGHT.X)) and then
  27234.          (YVAL2 <= DC_TYPE(LOWER_LEFT.Y) and
  27235.                    YVAL2 >= DC_TYPE(UPPER_RIGHT.Y)) then
  27236.      
  27237.          CNT := CNT + INCREM;
  27238.          VALID_POINT := true;
  27239.      else
  27240.          DRAW_ARC := true;
  27241.      end if;
  27242.      
  27243.      -- If circumference is completed and valid points were found,
  27244.      -- draw them.
  27245.      
  27246.      if (DRAW_ARC or I >= 360.0) and VALID_POINT then
  27247.      
  27248.          QUADS := DC_TYPE (INTEGER(((I + INCREM + 45.0) / 90.0) - 0.5));
  27249.      
  27250.          END_POINT := LEXI_COUNT_VALUE ((((QUADS * PIXEL_RATIO) +
  27251.             SIN(RADIANS(((I + INCREM) * PI_180) -
  27252.             (QUADS * NP180)))) * RADIUS) + 1.0);
  27253.      
  27254.          QUADS := DC_TYPE
  27255.             (INTEGER (((I + INCREM - CNT + 45.0) / 90.0) - 0.5));
  27256.      
  27257.          START_POINT := LEXI_COUNT_VALUE ((((QUADS * PIXEL_RATIO) +
  27258.             SIN(RADIANS(((I + INCREM - CNT) * PI_180) -
  27259.             (QUADS * NP180)))) * RADIUS) + 1.0);
  27260.      
  27261.          PIXELS := END_POINT - START_POINT;
  27262.      
  27263.          -- Call DISPLAY_ARC to draw circle segments in the window.
  27264.      
  27265.          LEXI3700_OUTPUT_DRIVER.DISPLAY_ARC
  27266.               (CENTER,
  27267.                LEXI_RADIUS_TYPE (RADIUS),
  27268.                LINE_COLOUR,
  27269.                START_POINT,
  27270.                PIXELS);
  27271.      
  27272.          LEXI3700_OUTPUT_DRIVER.FLUSH;
  27273.          CNT := 0.0;
  27274.          VALID_POINT := false;
  27275.          DRAW_ARC    := false;
  27276.       end if;
  27277.      
  27278.    I := I + INCREM;
  27279.      
  27280.    end loop; -- WHILE LOOP
  27281.      
  27282. end CLIP_CIRCLE;
  27283. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27284. --:UDD:GKSADACM:CODE:0A:WSD_CELL_AR_0A.ADA
  27285. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27286. ------------------------------------------------------------------
  27287. --
  27288. --  NAME: CELL_ARRAY
  27289. --  IDENTIFIER: GDMXXX.1(2)
  27290. --  DISCREPANCY REPORTS:
  27291. --  DR042  Cell arrays over-write each other.
  27292. ------------------------------------------------------------------
  27293. -- file: WSD_CELL_AR_0A.ADA
  27294. -- level: 0a
  27295.      
  27296. with CONVERT_NDC_DC;
  27297.      
  27298. separate (LEXI3700_EXTENDED_OUTPUT_PRIMITIVES)
  27299.      
  27300. procedure CELL_ARRAY
  27301.    (WS_SL                     : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  27302.     CELL_ARRAY_CORNER_1_1     : NDC.POINT;
  27303.     CELL_ARRAY_CORNER_DX_DY   : NDC.POINT;
  27304.     CELL_ARRAY_CORNER_DX_1    : NDC.POINT;
  27305.     CELL_COLOUR_MATRIX        : ACCESS_COLOUR_MATRIX_TYPE) is
  27306.      
  27307. -- This procedure makes one or more calls to LEXI3700_DRIVER procedures
  27308. -- in order to produce the desired results.
  27309. --
  27310. -- This procedure receives three points in NDC.  It first converts them
  27311. -- to DC.  It then computes the fourth point before converting them
  27312. -- to IDC coordinates specific to the LEXIDATA.
  27313. --
  27314. -- The procedure clips to the clipping rectangle in DC coordinates.
  27315. -- If the whole CELL_ARRAY is clipped the computation of the cells
  27316. -- and scan regions is bypassed and the procedure ends.  If at least
  27317. -- some portion of the cell array is within the clipping rectangle
  27318. -- it will be displayed.
  27319. --
  27320. -- If some part of the cell array is to be displayed first it computes
  27321. -- the size of the cell array in pixels, then the size of each cell in
  27322. -- pixels.  A comparison is made from the original cell array's and the
  27323. -- clipped cell array's top left corner.  If the clipped cell array's
  27324. -- corner is different and the x or y componant is greater than the
  27325. -- original cell array corner the corner has been clipped and at least
  27326. -- a part of the first cell will not be displayed.  Because of this,
  27327. -- an offset needs to be computed to determine which cell is now the
  27328. -- top left corner and what colour it is to be.
  27329. --               ________________
  27330. --           4__|________ 3     |
  27331. --            |_||___|__|       |
  27332. --            |_||___|__|       |
  27333. --            |_||___|__|       | <-- clipping rectangle
  27334. --            |_||___|__|       |
  27335. --           1  |  ^     2      |
  27336. --              |__|____________|
  27337. --                 |
  27338. --                 |
  27339. --              cell array
  27340. --
  27341. -- Once the offset is determined as to where to index into the CELL_
  27342. -- COLOUR_MATRIX, an array is filled with colour indices and dumped to
  27343. -- the device to be displayed.
  27344. --
  27345. -- WS_SL - is a pointer to the Workstation State List.
  27346. -- CELL_ARRAY_CORNER_1_1 - The corner point (referred to as P) which
  27347. --                         corresponds with cell 1,1 of the cell colour
  27348. --                         matrix.
  27349. -- CELL_ARRAY_CORNER_DX_DY - The corner point (referred to as Q) which
  27350. --                           corresponds with the dx, dy element of the
  27351. --                           cell colour matrix.
  27352. -- CELL_ARRAY_CORNER_DX_1 - The corner point which corresponds with
  27353. --                          the cell dx,1 of the cell colour matrix.
  27354. -- CELL_COLOUR_MATRIX - is an array of pixel colours that are mapped
  27355. --                      onto the device display area.
  27356.      
  27357. TEMP_CELL_COLOUR_MATRIX : COLOUR_MATRICES.MATRIX_OF
  27358.       (1 .. CELL_COLOUR_MATRIX'length(1),
  27359.        1 .. CELL_COLOUR_MATRIX'length(2));
  27360. -- Stores the colour indices in the proper locations for displaying to
  27361. -- the screen.
  27362.      
  27363. DC_CELL_ARRAY,
  27364. -- Contains the points of the cell array dimensions in DC.
  27365.      
  27366. DC_CLIPPED_CELL_ARRAY : DC.POINT_ARRAY(1..4);
  27367. -- Contains the points of the clipped cell array in DC. Note the first
  27368. -- position in the array is the bottom left corner, the second is the
  27369. -- bottom right, third is the top right, and fourth is the top left.
  27370.      
  27371. PIXEL_ARRAY_HEIGHT,
  27372. PIXEL_ARRAY_WIDTH : INTEGER;
  27373. -- The computed height and width of the cell array.
  27374.      
  27375. CELL_PIXEL_HEIGHT,
  27376. CELL_PIXEL_WIDTH : LEXI_COORDINATE;
  27377. -- The computed height and width of a single cell in pixels.
  27378.      
  27379. IDC_UPPER_LEFT,
  27380. IDC_LOWER_RIGHT : LEXI_POINT;
  27381. -- The upper left and lower right corners of the CELL_ARRAY in INTEGER
  27382. -- DEVICE COORDINATES specific for the LEXIDATA.
  27383.      
  27384. DISPLAY_CELL_ARRAY : LEXI_UTILITIES.STATUS_OF_POINTS;
  27385. -- Used to determined if the array was completly clipped.
  27386.      
  27387. LINE_WIDTH : LEXI_LINE_WIDTH_TYPE := LEXI_LINE_WIDTH_TYPE'first;
  27388. -- An implementation dependent line width used to initialize the device.
  27389.      
  27390. LINE_TYPE  : LEXI_LINE_TYPE  := LEXI_LINE_TYPE'first;
  27391. -- An implementation dependent linetype used to initialize the device.
  27392.      
  27393. INTERIOR_STYLE : LEXI_INTERIOR_STYLE := HOLLOW;
  27394. -- An implementation dependent interior style used to initialize
  27395. -- the device.
  27396.      
  27397. begin
  27398. -- The addition to the current logic to support the fact that
  27399. -- points P and Q can be any opposite corners.
  27400.      
  27401. -- If the x and y of point P is less than the x and y of point Q then
  27402. -- point P is in the bottom left corner, and the CELL_COLOUR_MATRIX
  27403. -- needs to be adjusted.
  27404.      
  27405. if CELL_ARRAY_CORNER_1_1.X < CELL_ARRAY_CORNER_DX_DY.X then
  27406.    if CELL_ARRAY_CORNER_1_1.Y < CELL_ARRAY_CORNER_DX_DY.Y then
  27407.       DC_CELL_ARRAY(1) := CONVERT_NDC_DC.DC_POINT
  27408.             (CELL_ARRAY_CORNER_1_1, WS_SL.WS_TRANSFORM);
  27409.       DC_CELL_ARRAY(2) := CONVERT_NDC_DC.DC_POINT
  27410.             (CELL_ARRAY_CORNER_DX_1, WS_SL.WS_TRANSFORM);
  27411.       DC_CELL_ARRAY(3) := CONVERT_NDC_DC.DC_POINT
  27412.             (CELL_ARRAY_CORNER_DX_DY, WS_SL.WS_TRANSFORM);
  27413.      
  27414.       -- Compute the fourth point.
  27415.       DC_CELL_ARRAY(4) := DC.POINT'(DC_CELL_ARRAY(1).X,
  27416.                                     DC_CELL_ARRAY(3).Y);
  27417.      
  27418.       -- Fill the TEMP_CELL_COLOUR_MATRIX with the colour indices in
  27419.       -- the proper locations depending where point P is.
  27420.      
  27421.       for I in CELL_COLOUR_MATRIX'range(1) loop
  27422.          for J in CELL_COLOUR_MATRIX'range(2) loop
  27423.             TEMP_CELL_COLOUR_MATRIX(I,J) := CELL_COLOUR_MATRIX
  27424.                   (I, CELL_COLOUR_MATRIX'last(2) - J + 1);
  27425.          end loop;
  27426.       end loop;
  27427.      
  27428.    else
  27429.      -- Point P is in the upper left corner and the CELL_COLOUR_MATRIX
  27430.      -- does not need to be adjusted.
  27431.      
  27432.       DC_CELL_ARRAY(2) := CONVERT_NDC_DC.DC_POINT
  27433.             (CELL_ARRAY_CORNER_DX_DY, WS_SL.WS_TRANSFORM);
  27434.       DC_CELL_ARRAY(3) := CONVERT_NDC_DC.DC_POINT
  27435.             (CELL_ARRAY_CORNER_DX_1, WS_SL.WS_TRANSFORM);
  27436.       DC_CELL_ARRAY(4) := CONVERT_NDC_DC.DC_POINT
  27437.             (CELL_ARRAY_CORNER_1_1, WS_SL.WS_TRANSFORM);
  27438.      
  27439.       -- Compute the fourth point.
  27440.       DC_CELL_ARRAY(1) := DC.POINT'(DC_CELL_ARRAY(4).X,
  27441.                                     DC_CELL_ARRAY(2).Y);
  27442.      
  27443.       for I in CELL_COLOUR_MATRIX'range(1) loop
  27444.          for J in CELL_COLOUR_MATRIX'range(2) loop
  27445.             TEMP_CELL_COLOUR_MATRIX(I,J) := CELL_COLOUR_MATRIX(I, J);
  27446.          end loop;
  27447.       end loop;
  27448.      
  27449.    end if;
  27450.      
  27451. elsif CELL_ARRAY_CORNER_1_1.Y > CELL_ARRAY_CORNER_DX_DY.Y then
  27452.      
  27453.    -- Point P is in the upper right corner.
  27454.      
  27455.    DC_CELL_ARRAY(1) := CONVERT_NDC_DC.DC_POINT
  27456.          (CELL_ARRAY_CORNER_DX_DY, WS_SL.WS_TRANSFORM);
  27457.    DC_CELL_ARRAY(3) := CONVERT_NDC_DC.DC_POINT
  27458.          (CELL_ARRAY_CORNER_1_1, WS_SL.WS_TRANSFORM);
  27459.    DC_CELL_ARRAY(4) := CONVERT_NDC_DC.DC_POINT
  27460.          (CELL_ARRAY_CORNER_DX_1, WS_SL.WS_TRANSFORM);
  27461.      
  27462.    -- Compute the fourth point.
  27463.    DC_CELL_ARRAY(2) := DC.POINT'(DC_CELL_ARRAY(3).X,
  27464.                                  DC_CELL_ARRAY(1).Y);
  27465.      
  27466.    for I in CELL_COLOUR_MATRIX'range(1) loop
  27467.       for J in CELL_COLOUR_MATRIX'range(2) loop
  27468.          TEMP_CELL_COLOUR_MATRIX(I,J) := CELL_COLOUR_MATRIX
  27469.                (CELL_COLOUR_MATRIX'last(1) - I + 1, J);
  27470.       end loop;
  27471.    end loop;
  27472.      
  27473. else
  27474.      
  27475.    -- Point P is in the lower right corner.
  27476.      
  27477.    DC_CELL_ARRAY(1) := CONVERT_NDC_DC.DC_POINT
  27478.          (CELL_ARRAY_CORNER_DX_1, WS_SL.WS_TRANSFORM);
  27479.    DC_CELL_ARRAY(2) := CONVERT_NDC_DC.DC_POINT
  27480.          (CELL_ARRAY_CORNER_1_1, WS_SL.WS_TRANSFORM);
  27481.    DC_CELL_ARRAY(4) := CONVERT_NDC_DC.DC_POINT
  27482.          (CELL_ARRAY_CORNER_DX_DY, WS_SL.WS_TRANSFORM);
  27483.      
  27484.    -- Compute the fourth point.
  27485.    DC_CELL_ARRAY(3) := DC.POINT'(DC_CELL_ARRAY(2).X,
  27486.                                  DC_CELL_ARRAY(4).Y);
  27487.      
  27488.    for I in CELL_COLOUR_MATRIX'range(1) loop
  27489.       for J in CELL_COLOUR_MATRIX'range(2) loop
  27490.          TEMP_CELL_COLOUR_MATRIX(I,J) := CELL_COLOUR_MATRIX
  27491.                (CELL_COLOUR_MATRIX'last(1) - I + 1,
  27492.                 CELL_COLOUR_MATRIX'last(2) - J + 1);
  27493.       end loop;
  27494.    end loop;
  27495. end if;
  27496.      
  27497.    -- Clip the cell array to the EFFECTIVE_CLIPPING_RECTANGLE in DC.
  27498.    LEXI_UTILITIES.CLIP_TO_SCREEN
  27499.          (DC_CELL_ARRAY,DC_CLIPPED_CELL_ARRAY,DISPLAY_CELL_ARRAY,
  27500.           WS_SL.EFFECTIVE_CLIPPING_RECTANGLE);
  27501.      
  27502.    if DISPLAY_CELL_ARRAY /= LEXI_UTILITIES.ALL_OUTSIDE then
  27503.    -- The CELL_ARRAY was not totally outside the clipping rectangle.
  27504.    -- At least part of the CELL_ARRAY will be displayed.
  27505.      
  27506.       -- Compute the size of the cell array.
  27507.       PIXEL_ARRAY_WIDTH := INTEGER(DC_CELL_ARRAY(3).X) -
  27508.                            INTEGER(DC_CELL_ARRAY(4).X) + 1;
  27509.       PIXEL_ARRAY_HEIGHT := INTEGER(DC_CELL_ARRAY(4).Y) -
  27510.                             INTEGER(DC_CELL_ARRAY(1).Y) + 1;
  27511.      
  27512.       -- Compute the size of a cell.
  27513.       CELL_PIXEL_WIDTH := CELL_COLOUR_MATRIX'length(1);
  27514.       CELL_PIXEL_HEIGHT := CELL_COLOUR_MATRIX'length(2);
  27515.      
  27516.       -- Set the device for displaying cells
  27517.       LEXI3700_OUTPUT_DRIVER.SET_DISPLAY_PARAMETERS
  27518.            (LINE_WIDTH,LINE_TYPE,INTERIOR_STYLE);
  27519.      
  27520.       declare
  27521.          CLIPPED_IDC_CELL_ARRAY : LEXI_POINTS(1..4) :=
  27522.                LEXI_UTILITIES.IDC (DC_CLIPPED_CELL_ARRAY);
  27523.          CLIP_LEFT,
  27524.          CLIP_TOP : INTEGER;
  27525.      
  27526.       begin
  27527.      
  27528.          -- Set the rectangle limits for the device to draw to.
  27529.          LEXI3700_OUTPUT_DRIVER.SET_RECTANGULAR_LIMIT
  27530.                (CLIPPED_IDC_CELL_ARRAY(4),CLIPPED_IDC_CELL_ARRAY(2));
  27531.      
  27532.          CLIP_LEFT := abs (INTEGER(DC_CLIPPED_CELL_ARRAY(4).X) -
  27533.                       INTEGER(DC_CELL_ARRAY(4).X));
  27534.          CLIP_TOP := abs (INTEGER(DC_CLIPPED_CELL_ARRAY(4).Y) -
  27535.                      INTEGER(DC_CELL_ARRAY(4).Y));
  27536.      
  27537.          declare
  27538.      
  27539.             COLOUR_INDICES_ARRAY : LEXI_PIXEL_ARRAY_INDEX
  27540.                   (1 .. POSITIVE(CLIPPED_IDC_CELL_ARRAY(3).X -
  27541.                    CLIPPED_IDC_CELL_ARRAY(4).X + 1));
  27542.             Y_POSITION : NATURAL;
  27543.             X_POSITION : NATURAL;
  27544.             -- Indices into the TEMP_CELL_COLOUR_MATRIX for displaying.
  27545.      
  27546.             function "+" (A,B : LEXI_COORDINATE) return LEXI_COORDINATE
  27547.                   renames LEXI3700_TYPES."+";
  27548.      
  27549.             function "*" (A,B : LEXI_COORDINATE) return LEXI_COORDINATE
  27550.                   renames LEXI3700_TYPES."*";
  27551.      
  27552.          begin
  27553.      
  27554.             -- The number of time the following loops is equal to the
  27555.             -- rows and columns of pixels of the clipped cell array.
  27556.             -- The DX and DY are used to compute an offset to index into
  27557.             -- the CELL_COLOUR_MATRIX if the cell array was clipped.  If
  27558.             -- the cell array wasn't clipped the offset will be zero and
  27559.             -- the array will be indexed from its starting position.
  27560.      
  27561.             for DY IN 0 .. CLIPPED_IDC_CELL_ARRAY(1).Y -
  27562.                   CLIPPED_IDC_CELL_ARRAY(4).Y  loop
  27563.      
  27564.                -- The computed offset of the Y componant of the CELL_
  27565.                -- COLOUR_MATRIX.  The x is computed each time through
  27566.                -- the loop.
  27567.      
  27568.                Y_POSITION := TEMP_CELL_COLOUR_MATRIX'first(2) +
  27569.                         NATURAL ((CELL_PIXEL_HEIGHT *
  27570.                         (DY +  LEXI_COORDINATE(CLIP_TOP))) /
  27571.                         LEXI_COORDINATE(PIXEL_ARRAY_HEIGHT));
  27572.      
  27573.                for DX in 0 .. CLIPPED_IDC_CELL_ARRAY(3).X -
  27574.                         CLIPPED_IDC_CELL_ARRAY(4).X loop
  27575.      
  27576.                   X_POSITION := TEMP_CELL_COLOUR_MATRIX'first(1) +
  27577.                         NATURAL ((CELL_PIXEL_WIDTH *
  27578.                         (DX + LEXI_COORDINATE(CLIP_LEFT))) /
  27579.                         LEXI_COORDINATE(PIXEL_ARRAY_WIDTH));
  27580.      
  27581.                   COLOUR_INDICES_ARRAY(POSITIVE(DX + 1)) :=
  27582.                         LEXI_COLOUR_INDEX
  27583.                         (TEMP_CELL_COLOUR_MATRIX
  27584.                         (X_POSITION, Y_POSITION));
  27585.      
  27586.                   -- Check to see if the colour index requested is set
  27587.                   -- on the device, if not an implementation defined
  27588.                   -- colour index of 1 is used.
  27589.      
  27590.                   if not COLOUR_INDICES.IS_IN_LIST (COLOUR_INDEX
  27591.                         (COLOUR_INDICES_ARRAY(POSITIVE(DX + 1))),
  27592.                          WS_SL.SET_OF_COLOUR_IDC) then
  27593.                      COLOUR_INDICES_ARRAY(POSITIVE(DX + 1)) := 1;
  27594.                   end if;
  27595.      
  27596.                end loop;
  27597.      
  27598.                -- Call the OUTPUT DRIVER to display a row of pixels.
  27599.                LEXI3700_OUTPUT_DRIVER.SEQUENTIAL_PIXEL_WRITE
  27600.                      (COLOUR_INDICES_ARRAY);
  27601.      
  27602.             end loop;
  27603.          end;
  27604.       end;
  27605.    end if;
  27606.      
  27607. end CELL_ARRAY;
  27608. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27609. --:UDD:GKSADACM:CODE:0A:LEXI_PIXEL_OPS.ADA
  27610. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27611. ------------------------------------------------------------------
  27612. --
  27613. --  NAME: LEXI3700_PIXEL_OPERATIONS
  27614. --  IDENTIFIER: GDMXXX.1(1)
  27615. --  DISCREPANCY REPORTS:
  27616. --
  27617. ------------------------------------------------------------------
  27618. -- FILE: LEXI_PIXEL_OPS.ADA
  27619. -- LEVEL: 0A
  27620.      
  27621. with GKS_TYPES;
  27622. with WS_STATE_LIST_TYPES;
  27623. with CGI;
  27624.      
  27625. use  CGI;
  27626. use  GKS_TYPES;
  27627.      
  27628. package LEXI3700_PIXEL_OPERATIONS is
  27629.      
  27630. -- This package specifies all procedures that inquire into pixel
  27631. -- points on the device.
  27632.      
  27633.    procedure INQ_PIXEL_ARRAY_DIMENSIONS
  27634.       (WS_SL              : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  27635.        PIXEL_CORNER_1_1   : NDC.POINT;
  27636.        PIXEL_CORNER_DX_DY : NDC.POINT;
  27637.        DIMENSIONS         : out RASTER_UNIT_SIZE);
  27638.      
  27639.    procedure INQ_PIXEL_ARRAY
  27640.       (WS_SL              : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  27641.        PIXEL_ARRAY_CORNER : NDC.POINT;
  27642.        DX                 : RASTER_UNITS;
  27643.        DY                 : RASTER_UNITS;
  27644.        INVALID_VALUES     : out INVALID_VALUES_INDICATOR;
  27645.        PIXEL_ARRAY        : out ACCESS_PIXEL_COLOUR_MATRIX_TYPE);
  27646.      
  27647.    procedure INQ_PIXEL
  27648.       (WS_SL        : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  27649.        PIXEL_POINT  : NDC.POINT;
  27650.        PIXEL_COLOUR : out PIXEL_COLOUR_INDEX);
  27651.      
  27652. end LEXI3700_PIXEL_OPERATIONS;
  27653. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27654. --:UDD:GKSADACM:CODE:0A:LEXI_PIXEL_OPS_B.ADA
  27655. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27656. ------------------------------------------------------------------
  27657. --
  27658. --  NAME: LEXI3700_PIXEL_OPERATIONS - BODY
  27659. --  IDENTIFIER: GDMXXX.1(1)
  27660. --  DISCREPANCY REPORTS:
  27661. --
  27662. ------------------------------------------------------------------
  27663. -- FILE: LEXI_PIXEL_OPS_B.ADA
  27664. -- LEVEL : 0A
  27665.      
  27666. with LEXI3700_OUTPUT_DRIVER;
  27667. with LEXI3700_TYPES;
  27668. with CONVERT_NDC_DC;
  27669. with LEXI_UTILITIES;
  27670.      
  27671. use  LEXI3700_TYPES;
  27672.      
  27673. package body LEXI3700_PIXEL_OPERATIONS is
  27674.      
  27675.    procedure INQ_PIXEL_ARRAY_DIMENSIONS
  27676.       (WS_SL              : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  27677.        PIXEL_CORNER_1_1   : NDC.POINT;
  27678.        PIXEL_CORNER_DX_DY : NDC.POINT;
  27679.        DIMENSIONS         : out RASTER_UNIT_SIZE)
  27680.       is separate;
  27681.      
  27682.    procedure INQ_PIXEL_ARRAY
  27683.       (WS_SL              : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  27684.        PIXEL_ARRAY_CORNER : NDC.POINT;
  27685.        DX                 : RASTER_UNITS;
  27686.        DY                 : RASTER_UNITS;
  27687.        INVALID_VALUES     : out INVALID_VALUES_INDICATOR;
  27688.        PIXEL_ARRAY        : out ACCESS_PIXEL_COLOUR_MATRIX_TYPE)
  27689.       is separate;
  27690.      
  27691.    procedure INQ_PIXEL
  27692.       (WS_SL        : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  27693.        PIXEL_POINT  : NDC.POINT;
  27694.        PIXEL_COLOUR : out PIXEL_COLOUR_INDEX) is separate;
  27695.      
  27696. end LEXI3700_PIXEL_OPERATIONS;
  27697. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27698. --:UDD:GKSADACM:CODE:0A:WSD_INQ_PIXEL_0A.ADA
  27699. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27700. ------------------------------------------------------------------
  27701. --
  27702. --  NAME: INQ_PIXEL
  27703. --  IDENTIFIER: GDMXXX.1(2)
  27704. --  DISCREPANCY REPORTS:
  27705. --  DR035  Changes to INQ_PIXEL
  27706. ------------------------------------------------------------------
  27707. -- FILE: WSD_INQ_PIXEL_0A.ADA
  27708. -- LEVEL: 0A
  27709.      
  27710. separate (LEXI3700_PIXEL_OPERATIONS)
  27711.      
  27712. procedure INQ_PIXEL
  27713.    (WS_SL        : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  27714.     PIXEL_POINT  : NDC.POINT;
  27715.     PIXEL_COLOUR : out PIXEL_COLOUR_INDEX) is
  27716.      
  27717. -- This procedure accepts one point and returns the colour index of the
  27718. -- point. If the pixel is not on the display surface, the value -1 is
  27719. -- returned.
  27720. --
  27721. -- WS_SL        - the pointer to the Workstation State List.
  27722. -- PIXEL_POINT  - the given point in NDC coordinates.
  27723. -- PIXEL_COLOUR - the given pixel's colour index.
  27724.      
  27725.    DC_DEVICE_POINT  : DC.POINT_ARRAY (1 .. 1);
  27726.    -- The PIXEL_POINT after it is translated into DC coordinates.
  27727.      
  27728.    IDC_DEVICE_POINT : LEXI_POINTS(1 .. 1);
  27729.    -- The DC_DEVICE_POINT after it is translated into IDC coordinates.
  27730.      
  27731.    PIXEL_COLOUR_ARRAY : LEXI_PIXEL_ARRAY_INDEX (1 .. 1);
  27732.    -- Holds the colour returned from the device driver.
  27733.      
  27734.    IS_ON_DISPLAY_SURFACE : LEXI_UTILITIES.STATUS_OF_POINTS;
  27735.    -- This variable is used to test if the point is on the display
  27736.    -- surface. It is set to either ALL_OUTSIDE or ALL_INSIDE.
  27737.      
  27738.    function "=" (LEFT, RIGHT : in LEXI_UTILITIES.STATUS_OF_POINTS)
  27739.       return BOOLEAN
  27740.       renames LEXI_UTILITIES."=";
  27741.      
  27742. begin
  27743.      
  27744.    -- Translate from NDC to DC.
  27745.    DC_DEVICE_POINT(1) := CONVERT_NDC_DC.DC_POINT
  27746.       (PIXEL_POINT, WS_SL.WS_TRANSFORM);
  27747.      
  27748.    -- Test if the point is on the screen before translating into IDC.
  27749.    LEXI_UTILITIES.CLIP_TO_SCREEN (DC_DEVICE_POINT, DC_DEVICE_POINT,
  27750.       IS_ON_DISPLAY_SURFACE);
  27751.      
  27752.    -- One point within the display surface means that it is valid to
  27753.    -- inquire the colour.
  27754.    if IS_ON_DISPLAY_SURFACE = LEXI_UTILITIES.ALL_INSIDE then
  27755.      
  27756.       -- Translate from DC to IDC.
  27757.       IDC_DEVICE_POINT :=
  27758.          LEXI_UTILITIES.IDC (DC_DEVICE_POINT);
  27759.      
  27760.       -- Call the device driver to obtain the colour of the point.
  27761.       LEXI3700_OUTPUT_DRIVER.RANDOM_PIXEL_READ
  27762.          (IDC_DEVICE_POINT, PIXEL_COLOUR_ARRAY);
  27763.      
  27764.       -- Put the colour into the output parameter.
  27765.       PIXEL_COLOUR := PIXEL_COLOUR_INDEX (PIXEL_COLOUR_ARRAY(1));
  27766.      
  27767.    else
  27768.      
  27769.       -- If the point is not on the screen, put a -1 into the output
  27770.       -- parameter.
  27771.       PIXEL_COLOUR := -1;
  27772.      
  27773.    end if;
  27774.      
  27775. end INQ_PIXEL;
  27776. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27777. --:UDD:GKSADACM:CODE:0A:WSD_INQ_PIXEL_AR_0A.ADA
  27778. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  27779. ------------------------------------------------------------------
  27780. --
  27781. --  NAME: INQ_PIXEL_ARRAY
  27782. --  IDENTIFIER: GDMXXX.1(2)
  27783. --  DISCREPANCY REPORTS:
  27784. --  DR035  Changes to INQ_PIXEL
  27785. ------------------------------------------------------------------
  27786. -- FILE: WSD_INQ_PIXEL_AR_0A.ADA
  27787. -- LEVEL: 0A
  27788.      
  27789. separate (LEXI3700_PIXEL_OPERATIONS)
  27790.      
  27791. procedure INQ_PIXEL_ARRAY
  27792.    (WS_SL              : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  27793.     PIXEL_ARRAY_CORNER : NDC.POINT;
  27794.     DX                 : RASTER_UNITS;
  27795.     DY                 : RASTER_UNITS;
  27796.     INVALID_VALUES     : out INVALID_VALUES_INDICATOR;
  27797.     PIXEL_ARRAY        : out ACCESS_PIXEL_COLOUR_MATRIX_TYPE) is
  27798.      
  27799. -- This procedure receives a point which maps onto a pixel of the
  27800. -- display surface. A rectangle is defined which has the given point
  27801. -- as its upper left corner. DX is the width of the rectangle in pixels.
  27802. -- DY is the height of the rectangle in pixels.
  27803. --
  27804. -- The PIXEL_ARRAY returns the colour index associated with each pixel
  27805. -- in the rectangle. If a pixel is not on the device surface, the value
  27806. -- -1 is assigned to its position in the array and the flag INVALID_
  27807. -- VALUES is set to PRESENT.
  27808. --
  27809. -- This procedure processes through the PIXEL_ARRAY one scan line at a
  27810. -- time. If the scan line is above or below the display surface, it is
  27811. -- filled with -1's. Otherwise, the scan line is divided into three
  27812. -- areas (any of which could be null): the area to the left of the
  27813. -- display surface, the area on the display surface, and the area on the
  27814. -- right of the display surface. The right and left areas are filled
  27815. -- with -1's and the middle portion used when calling the device driver
  27816. -- to return the colour indices.
  27817. --
  27818. -- The case where all of the points are on the display surface is
  27819. -- treated as a special case because we believe it is the most
  27820. -- common case and because we wanted to eliminate the overhead of
  27821. -- handling the portions outside the display surface when they are all
  27822. -- null.
  27823. --
  27824. -- WS_SL              - a pointer to the Workstation State List.
  27825. --                      Used for converting from NDC to DC.
  27826. -- PIXEL_ARRAY_CORNER - the point at the upper left corner of the
  27827. --                      specified rectangle.
  27828. -- DX                 - the x dimension of the pixel array.
  27829. -- DY                 - the y dimension of the pixel array.
  27830. -- INVALID_VALUES     - a flag which indicates with 'PRESENT' or
  27831. --                      'ABSENT' if there are any negative ones in the
  27832. --                      PIXEL_ARRAY.
  27833. -- PIXEL_ARRAY        - returns the indices into the colour lookup
  27834. --                      table associated with each of the pixels in the
  27835. --                      rectangle.
  27836.      
  27837.    DC_CORNER_POINTS : DC.POINT_ARRAY (1 .. 4);
  27838.    -- The first value is PIXEL_ARRAY_CORNER and second value is the
  27839.    -- corner opposite PIXEL_ARRAY_CORNER. The other two corners of the
  27840.    -- rectangle are in the last two positions.
  27841.      
  27842.    CLIPPED_DC_CORNER_POINTS : DC.POINT_ARRAY (1 .. 4);
  27843.    -- Contains the value of DC_CORNER_POINTS after they have been
  27844.    -- clipped to the display surface.
  27845.      
  27846.    POINT_STATUS_FLAG : LEXI_UTILITIES.STATUS_OF_POINTS;
  27847.    -- Indicates how many corners of the rectangle are within the display
  27848.    -- surface.
  27849.      
  27850.    IDC_CORNER_POINTS : LEXI_POINTS (1 .. 2);
  27851.    -- Contains the value of the first two CLIPPED_DC_CORNER_POINTS after
  27852.    -- they have been transformed into the IDC coordinate system.
  27853.      
  27854.    TEMP_PIXEL_ARRAY : PIXEL_COLOUR_MATRICES.MATRIX_OF
  27855.       (1 .. POSITIVE(DX), 1 .. POSITIVE(DY));
  27856.    -- An array which holds the values which are returned in PIXEL_ARRAY.
  27857.      
  27858.    function "=" (FIRST, LAST : in LEXI_UTILITIES.STATUS_OF_POINTS)
  27859.       return BOOLEAN
  27860.       renames LEXI_UTILITIES."=";
  27861.      
  27862. begin
  27863.      
  27864.    -- Transform PIXEL_ARRAY_CORNER into DC_CORNER_POINTS(1).
  27865.    DC_CORNER_POINTS (1) := CONVERT_NDC_DC.DC_POINT
  27866.       (PIXEL_ARRAY_CORNER, WS_SL.WS_TRANSFORM);
  27867.      
  27868.    -- Put the opposite corner into DC_CORNER_POINTS(2).
  27869.    -- The X coordinate increases by DX - 1 because the rectangle goes
  27870.    -- to the right.
  27871.    DC_CORNER_POINTS(2).X :=
  27872.       DC_CORNER_POINTS(1).X + DC_TYPE(DX) - DC_TYPE(1);
  27873.    -- The Y coodinate decreases by DY - 1 because the rectangle goes
  27874.    -- down.
  27875.    DC_CORNER_POINTS(2).Y :=
  27876.       DC_CORNER_POINTS(1).Y - DC_TYPE(DY) + DC_TYPE(1);
  27877.      
  27878.    -- Put the other two corners of the rectangle into the third and
  27879.    -- fourth elements of DC_CORNER_POINTS.
  27880.    DC_CORNER_POINTS(3).X := DC_CORNER_POINTS(1).X;
  27881.    DC_CORNER_POINTS(3).Y := DC_CORNER_POINTS(2).Y;
  27882.    DC_CORNER_POINTS(4).X := DC_CORNER_POINTS(2).X;
  27883.    DC_CORNER_POINTS(4).Y := DC_CORNER_POINTS(1).Y;
  27884.      
  27885.    -- Clip the DC_CORNER_POINTS to the area of the display surface.
  27886.    LEXI_UTILITIES.CLIP_TO_SCREEN (DC_CORNER_POINTS,
  27887.       CLIPPED_DC_CORNER_POINTS, POINT_STATUS_FLAG);
  27888.      
  27889.    -- Transform the first two of the clipped points into IDC coordinate
  27890.    -- space.
  27891.    IDC_CORNER_POINTS :=
  27892.       LEXI_UTILITIES.IDC (CLIPPED_DC_CORNER_POINTS (1 .. 2));
  27893.      
  27894.    -- The case where all of the points are valid is treated as a special
  27895.    -- case. It is assumed that this case occurs more often and thus
  27896.    -- the code is optimized for it.
  27897.    if POINT_STATUS_FLAG = LEXI_UTILITIES.ALL_INSIDE then
  27898.      
  27899.       -- Set the flag to indicate that no points are off of the display
  27900.       -- surface.
  27901.       INVALID_VALUES := ABSENT;
  27902.      
  27903.       declare
  27904.      
  27905.          SCAN_LINE_POINT_VALUES : LEXI_POINTS (1 .. POSITIVE(DX));
  27906.          -- This variable holds the X and Y coordinates of the points
  27907.          -- in one scan line.
  27908.      
  27909.          SCAN_LINE_COLOUR_INDEX_VALUES :
  27910.             LEXI_PIXEL_ARRAY_INDEX (1 .. POSITIVE(DX));
  27911.          -- This variable holds the colour indices which are associated
  27912.          -- with each of those points.
  27913.      
  27914.          subtype X_RANGE is INTEGER range 0 .. INTEGER(DX);
  27915.          X_COUNTER : X_RANGE;
  27916.          -- X_COUNTER is used to index through the SCAN_LINE_POINT_
  27917.          -- VALUES. It corresponds to an index through the range of X
  27918.          -- indices in PIXEL_ARRAY.
  27919.      
  27920.          subtype Y_RANGE is INTEGER range 0 .. INTEGER(DY);
  27921.          Y_COUNTER : Y_RANGE;
  27922.          -- Y_COUNTER is used to index through the TEMP_PIXEL_ARRAY.
  27923.      
  27924.       begin
  27925.      
  27926.          -- Since the X values are the same for each scan line, they
  27927.          -- loaded into the scan line array first.
  27928.          X_COUNTER := 0;
  27929.          for X_VALUE in IDC_CORNER_POINTS(1).X .. IDC_CORNER_POINTS(2).X
  27930.             loop
  27931.                X_COUNTER := X_COUNTER + 1;
  27932.                SCAN_LINE_POINT_VALUES (X_COUNTER).X := X_VALUE;
  27933.          end loop;
  27934.      
  27935.          -- The index into the TEMP_PIXEL_ARRAY is initialized.
  27936.          Y_COUNTER := 0;
  27937.      
  27938.          -- This for loop processes on scan line at a time.
  27939.          for Y_VALUE in IDC_CORNER_POINTS(1).Y .. IDC_CORNER_POINTS(2).Y
  27940.             loop
  27941.      
  27942.                -- The Y index is incremented for the next scan line.
  27943.                Y_COUNTER := Y_COUNTER + 1;
  27944.      
  27945.                -- The Y_VALUE for the current scan line is loaded into
  27946.                -- the scan line array.
  27947.                for X_COUNTER in 1 .. POSITIVE(DX) loop
  27948.                   SCAN_LINE_POINT_VALUES(X_COUNTER).Y := Y_VALUE;
  27949.                end loop;
  27950.      
  27951.                -- The Lexi Driver is called to obtain the colour index
  27952.                -- values for the scan line.
  27953.                LEXI3700_OUTPUT_DRIVER.RANDOM_PIXEL_READ
  27954.                   (SCAN_LINE_POINT_VALUES,
  27955.                    SCAN_LINE_COLOUR_INDEX_VALUES);
  27956.      
  27957.                -- The colour index values are loaded into the temporary
  27958.                -- array.
  27959.                for X_COUNTER in 1 .. POSITIVE(DX) loop
  27960.                   TEMP_PIXEL_ARRAY (X_COUNTER, Y_COUNTER) :=
  27961.                      PIXEL_COLOUR_INDEX
  27962.                      (SCAN_LINE_COLOUR_INDEX_VALUES (X_COUNTER));
  27963.                end loop;
  27964.          end loop; -- Current scan line finished.
  27965.       end; -- Define block;
  27966.      
  27967.    --  The entire rectangle is off of the screen.
  27968.    elsif POINT_STATUS_FLAG = LEXI_UTILITIES.ALL_OUTSIDE then
  27969.      
  27970.       -- Set the flag to indicate that there are points off of the
  27971.       -- display surface.
  27972.       INVALID_VALUES := PRESENT;
  27973.      
  27974.       -- Fill the rectangle with all ones.
  27975.       for I in 1 .. POSITIVE(DX) loop
  27976.          for J in 1 .. POSITIVE(DY) loop
  27977.             TEMP_PIXEL_ARRAY (I,J) := -1;
  27978.          end loop;
  27979.       end loop;
  27980.      
  27981.    -- The rectangle is partially on the screen.
  27982.    else
  27983.       declare
  27984.          subtype Y_RANGE is INTEGER range 0 .. INTEGER(DY);
  27985.          subtype X_RANGE is INTEGER range 0 .. INTEGER(DX);
  27986.          FRONT_X : X_RANGE;
  27987.          -- FRONT_X is the number of pixels in the rectangle which are
  27988.          -- off the left edge of the screen.
  27989.      
  27990.          END_X : X_RANGE;
  27991.          -- END_X is the number of pixels from the left edge of the
  27992.          -- rectangle up to and including the rightmost pixel which is
  27993.          -- in the rectangle and on the screen.
  27994.      
  27995.          FRONT_Y : Y_RANGE;
  27996.          -- FRONT_Y is the number of pixels in the rectangle which are
  27997.          -- off the top edge of the screen.
  27998.      
  27999.          END_Y : Y_RANGE;
  28000.          -- END_Y is the number of pixels from the top of the rectangle
  28001.          -- up to and including the bottommost pixel which is in the
  28002.          -- rectangle and on the screen.
  28003.      
  28004.       begin
  28005.      
  28006.          -- Set the flag to indicate that there are points off of the
  28007.          -- display surface.
  28008.          INVALID_VALUES := PRESENT;
  28009.      
  28010.          -- When the first corner point is on the screen, FRONT_Y is
  28011.          -- zero. When the first corner has been clipped, FRONT_Y is
  28012.          -- the number of rows clipped off.
  28013.          FRONT_Y := Y_RANGE
  28014.             (DC_CORNER_POINTS(1).Y - CLIPPED_DC_CORNER_POINTS(1).Y);
  28015.      
  28016.          -- END_Y is the number of pixels from the first corner point to
  28017.          -- the clipped second point.
  28018.          END_Y := Y_RANGE
  28019.             (DC_CORNER_POINTS(1).Y - CLIPPED_DC_CORNER_POINTS(2).Y) + 1;
  28020.      
  28021.          -- When the first corner point is on the screen, FRONT_X is
  28022.          -- zero. When the first corner has been clipped, FRONT_X is
  28023.          -- the number of columns clipped off.
  28024.          FRONT_X := X_RANGE
  28025.             (CLIPPED_DC_CORNER_POINTS(1).X - DC_CORNER_POINTS(1).X);
  28026.      
  28027.          -- END_X is the number of pixels from the first corner point to
  28028.          -- the clipped second point.
  28029.          END_X := X_RANGE
  28030.             (CLIPPED_DC_CORNER_POINTS(2).X - DC_CORNER_POINTS(1).X) + 1;
  28031.      
  28032.          declare
  28033.      
  28034.             SCAN_LINE_POINT_VALUES : LEXI_POINTS
  28035.                (1 .. END_X - FRONT_X);
  28036.             -- Contains the X and Y coordinates in IDC of one row from
  28037.             -- the intersection of the rectangle and the screen.
  28038.      
  28039.             SCAN_LINE_COLOUR_INDEX_VALUES : LEXI_PIXEL_ARRAY_INDEX
  28040.                (1 .. END_X - FRONT_X);
  28041.             -- Contains the colour indices which correspond to the
  28042.             -- preceeding point values.
  28043.      
  28044.             X_COUNTER : LEXI_COORDINATE;
  28045.             -- Indexes across a scan line in IDC.
  28046.      
  28047.             Y_COUNTER : LEXI_COORDINATE;
  28048.             -- Indicates a scan line's position in IDC.
  28049.      
  28050.             SCAN_LINE_COUNTER : POSITIVE;
  28051.             -- Indexes into the SCAN_LINE_COLOUR_INDEX_VALUES beginning
  28052.             -- at position 1.
  28053.      
  28054.          begin
  28055.      
  28056.             -- Fill the rows above the screen with -1's.
  28057.             for J in 1 .. FRONT_Y loop
  28058.                for I in 1 .. POSITIVE(DX) loop
  28059.                   TEMP_PIXEL_ARRAY (I,J) := -1;
  28060.                end loop;
  28061.             end loop;
  28062.      
  28063.             -- Put the X value of the first point in the scan line into
  28064.             -- X_COUNTER.
  28065.             X_COUNTER := IDC_CORNER_POINTS(1).X;
  28066.      
  28067.             -- Fill in the X values of the points in the scan line. They
  28068.             -- are the same for each of the rows.
  28069.      
  28070.             for I in 1 .. END_X - FRONT_X loop
  28071.                SCAN_LINE_POINT_VALUES(I).X := X_COUNTER;
  28072.                exit when X_COUNTER = LEXI_COORDINATE'LAST;
  28073.                X_COUNTER := X_COUNTER + 1;
  28074.             end loop;
  28075.      
  28076.             -- Put the Y value of the first scan line into Y_COUNTER.
  28077.             Y_COUNTER := IDC_CORNER_POINTS(1).Y;
  28078.             -- Repeat for each of the scan lines on the screen.
  28079.             for J in FRONT_Y + 1 .. END_Y loop
  28080.                -- Put -1's in the portion of the row which is to the
  28081.                -- left of the screen.
  28082.                for I in 1 .. FRONT_X loop
  28083.                   TEMP_PIXEL_ARRAY (I,J) := -1;
  28084.                end loop;
  28085.      
  28086.                -- Fill the Y coordinates of the scan line with the Y
  28087.                -- value for this row.
  28088.                for I in 1 .. END_X - FRONT_X loop
  28089.                   SCAN_LINE_POINT_VALUES(I).Y := Y_COUNTER;
  28090.                end loop;
  28091.      
  28092.                -- Increment the Y value for the next row.
  28093.                Y_COUNTER := Y_COUNTER + 1;
  28094.      
  28095.                -- Call the Device Driver procedure for reading the
  28096.                -- colour of the given points.
  28097.      
  28098.                LEXI3700_OUTPUT_DRIVER.RANDOM_PIXEL_READ
  28099.                   (SCAN_LINE_POINT_VALUES,
  28100.                    SCAN_LINE_COLOUR_INDEX_VALUES);
  28101.      
  28102.                -- Move the colour values from the Device Driver's output
  28103.                -- (indices beginning at one) into the PIXEL_ARRAY
  28104.                -- (X indices beginning at FRONT_X + 1).
  28105.                SCAN_LINE_COUNTER := 1;
  28106.                for I in FRONT_X + 1 .. END_X loop
  28107.                   TEMP_PIXEL_ARRAY (I,J) := PIXEL_COLOUR_INDEX
  28108.                      (SCAN_LINE_COLOUR_INDEX_VALUES
  28109.                       (SCAN_LINE_COUNTER));
  28110.                   SCAN_LINE_COUNTER := SCAN_LINE_COUNTER + 1;
  28111.                end loop;
  28112.      
  28113.                -- Put -1's in the positions to the right of the display
  28114.                -- surface.
  28115.                for I in END_X + 1 .. POSITIVE(DX) loop
  28116.                   TEMP_PIXEL_ARRAY (I,J) := -1;
  28117.                end loop;
  28118.      
  28119.             end loop; -- for each scan line.
  28120.      
  28121.          end; -- declare block;
  28122.      
  28123.          -- Put -1's in the rows below the screen.
  28124.          for J in END_Y + 1 .. POSITIVE(DY) loop
  28125.             for I in 1 .. POSITIVE(DX) loop
  28126.                TEMP_PIXEL_ARRAY (I,J) := -1;
  28127.             end loop;
  28128.          end loop;
  28129.      
  28130.       end; -- declare block;
  28131.    end if;
  28132.      
  28133.    -- Load the temporary array into the output record along with its
  28134.    -- dimensions.
  28135.      
  28136.    PIXEL_ARRAY := new PIXEL_COLOUR_MATRICES.MATRIX_OF'(TEMP_PIXEL_ARRAY);
  28137.      
  28138. end INQ_PIXEL_ARRAY;
  28139. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28140. --:UDD:GKSADACM:CODE:0A:WSD_INQ_PIXEL_DIM_0A.ADA
  28141. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28142. ------------------------------------------------------------------
  28143. --
  28144. --  NAME: INQ_PIXEL_ARRAY_DIMENSIONS
  28145. --  IDENTIFIER: GDMXXX.1(1)
  28146. --  DISCREPANCY REPORTS:
  28147. --
  28148. ------------------------------------------------------------------
  28149. -- FILE: WSD_INQ_PIXEL_DIM_0A.ADA
  28150. -- LEVEL: 0A
  28151.      
  28152. separate (LEXI3700_PIXEL_OPERATIONS)
  28153.      
  28154. procedure INQ_PIXEL_ARRAY_DIMENSIONS
  28155.    (WS_SL              : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  28156.     PIXEL_CORNER_1_1   : NDC.POINT;
  28157.     PIXEL_CORNER_DX_DY : NDC.POINT;
  28158.     DIMENSIONS         : out RASTER_UNIT_SIZE) is
  28159.      
  28160. -- This procedure receives two points which define the corners of a
  28161. -- rectangle that is parallel to the coordinate axes. It returns the
  28162. -- number of pixels in the rectangle's height and the number of pixels
  28163. -- in the rectangle's width.
  28164. --
  28165. -- The rectangle is mapped from NDC to DC, and the difference between
  28166. -- the corner points is taken as the result. Since the range of DC is
  28167. -- unconstrained, no clipping is done.
  28168. --
  28169. -- WS_SL              - a pointer to the Workstation State List.
  28170. --                      Used to convert from NDC to DC.
  28171. -- PIXEL_CORNER_1_1   - contains an x and y position for one corner of
  28172. --                      the rectangle.
  28173. -- PIXEL_CORNER_DX_DY - contains the x and y position for the opposite
  28174. --                      corner of the rectangle.
  28175. -- DIMENSIONS         - returns the height and width of the rectangle
  28176. --                      measured in pixels.
  28177.      
  28178.    DC_DEVICE_POINTS : DC.POINT_ARRAY (1 .. 2);
  28179.    -- contains PIXEL_CORNER_1_1 and PIXEL_CORNER_DX_DY after they are
  28180.    -- transformed into DC coordinate space.
  28181.      
  28182. begin
  28183.      
  28184.   -- Translate both points from NDC to DC.
  28185.   DC_DEVICE_POINTS := CONVERT_NDC_DC.DC_POINT_ARRAY
  28186.      ((PIXEL_CORNER_1_1, PIXEL_CORNER_DX_DY),
  28187.       WS_SL.WS_TRANSFORM);
  28188.      
  28189.   -- Return the absolute value of the difference between the points.
  28190.   -- The value one is added because the edges of the rectangle are
  28191.   -- included in computing their dimensions.
  28192.   DIMENSIONS.X := RASTER_UNITS
  28193.      (abs (DC_DEVICE_POINTS(1).X - DC_DEVICE_POINTS(2).X) +
  28194.       DC_TYPE(1.0));
  28195.   DIMENSIONS.Y := RASTER_UNITS
  28196.      (abs (DC_DEVICE_POINTS(1).Y - DC_DEVICE_POINTS(2).Y) +
  28197.       DC_TYPE(1.0));
  28198.      
  28199. end INQ_PIXEL_ARRAY_DIMENSIONS;
  28200. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28201. --:UDD:GKSADACM:CODE:0A:WSR_INQ_WS_ST_0A.ADA
  28202. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28203. ------------------------------------------------------------------
  28204. --
  28205. --  NAME: WSR_INQ_WS_STATE_LIST_0A
  28206. --  IDENTIFIER: GDMXXX.1(1)
  28207. --  DISCREPANCY REPORTS:
  28208. --
  28209. ------------------------------------------------------------------
  28210. -- File:  WSR_INQ_WS_ST_0A.ADA
  28211. -- Level: 0A, 1A, 2A
  28212.      
  28213. with GKS_TYPES;
  28214. with WS_STATE_LIST_TYPES;
  28215.      
  28216. package WSR_INQ_WS_STATE_LIST_0A is
  28217.      
  28218. -- Packages GKS_TYPES and WS_STATE_LIST_TYPES provide types and subtypes
  28219. -- for subprogram parameters.
  28220. -- This package allows inquiries into the workstation's states.
  28221.      
  28222.    procedure INQ_WS_DEFERRAL_AND_UPDATE_STATES
  28223.       (WS_STATE_LIST         : in out WS_STATE_LIST_TYPES .
  28224.                                      WS_STATE_LIST_PTR;
  28225.        DEFERRAL              :    out GKS_TYPES . DEFERRAL_MODE;
  28226.        REGENERATION_MODE     :    out GKS_TYPES . REGENERATION_MODE;
  28227.        DISPLAY_SURFACE_EMPTY :    out GKS_TYPES .
  28228.                                       DISPLAY_SURFACE_EMPTY;
  28229.        NEW_FRAME_NECESSARY   :    out GKS_TYPES . NEW_FRAME_NECESSARY);
  28230.      
  28231.    procedure INQ_WS_STATE
  28232.       (WS_STATE_LIST         : in out WS_STATE_LIST_TYPES .
  28233.                                      WS_STATE_LIST_PTR;
  28234.        STATE                 :    out GKS_TYPES . WS_STATE);
  28235.      
  28236. end WSR_INQ_WS_STATE_LIST_0A;
  28237. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28238. --:UDD:GKSADACM:CODE:0A:WSR_INQ_WS_ST_0A_B.ADA
  28239. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28240. ------------------------------------------------------------------
  28241. --
  28242. --  NAME: WSR_INQ_WS_STATE_LIST_0A - BODY
  28243. --  IDENTIFIER: GDMXXX.1(1)
  28244. --  DISCREPANCY REPORTS:
  28245. --
  28246. ------------------------------------------------------------------
  28247. -- File: WSR_INQ_WS_ST_0A_B.ADA
  28248. -- Level: 0A, 1A, 2A
  28249.      
  28250. package body WSR_INQ_WS_STATE_LIST_0A is
  28251.      
  28252.    procedure INQ_WS_DEFERRAL_AND_UPDATE_STATES
  28253.       (WS_STATE_LIST         : in out WS_STATE_LIST_TYPES .
  28254.                                       WS_STATE_LIST_PTR;
  28255.        DEFERRAL              :    out GKS_TYPES . DEFERRAL_MODE;
  28256.        REGENERATION_MODE     :    out GKS_TYPES . REGENERATION_MODE;
  28257.        DISPLAY_SURFACE_EMPTY :    out GKS_TYPES .
  28258.                                       DISPLAY_SURFACE_EMPTY;
  28259.        NEW_FRAME_NECESSARY   :    out GKS_TYPES .
  28260.                                       NEW_FRAME_NECESSARY) is
  28261.    -- This procedure merely returns a group of components from the
  28262.    -- Workstation State List passed to it.  Since WS_STATE_LIST_TYPES .
  28263.    -- WS_STATE_LIST_PTR is an open data type, this procedure provides
  28264.    -- convenience, but no other functionality.
  28265.    --
  28266.    -- WS_STATE_LIST - A pointer to the workstation state list.
  28267.    -- DEFERRAL - Returns one of the four GKS deferral modes, which
  28268.    --            controls the possible delay of output functions.
  28269.    -- REGENERATION_MODE - Returns one of the two GKS regeneration
  28270.    --                     modes, which controls the suppression of
  28271.    --                     of implicit regeneration of the whole picture.
  28272.    -- DISPLAY_SURFACE_EMPTY - Indicates whether the display surface is
  28273.    --                         empty.
  28274.    -- NEW_FRAME_NECESSARY - Indicates whether a new frame action is
  28275.    --                       necessary at update.
  28276.      
  28277.      
  28278.    begin
  28279.      
  28280.       DEFERRAL              := WS_STATE_LIST . WS_DEFERRAL_MODE;
  28281.       REGENERATION_MODE     := WS_STATE_LIST . WS_IMPLICIT_REGEN_MODE;
  28282.       DISPLAY_SURFACE_EMPTY := WS_STATE_LIST . WS_DISPLAY_SURFACE;
  28283.       NEW_FRAME_NECESSARY   := WS_STATE_LIST . WS_NEW_FRAME_ACTION;
  28284.      
  28285.    end INQ_WS_DEFERRAL_AND_UPDATE_STATES;
  28286.      
  28287.      
  28288.    procedure INQ_WS_STATE
  28289.       (WS_STATE_LIST         : in out WS_STATE_LIST_TYPES .
  28290.                                      WS_STATE_LIST_PTR;
  28291.        STATE                 :    out GKS_TYPES . WS_STATE) is
  28292.    -- This procedure returns the state of the workstation, which
  28293.    -- is ACTIVE or INACTIVE.
  28294.    --
  28295.    -- WS_STATE_LIST - A pointer to the workstation state list.
  28296.    -- STATE - Indicates the state of the workstation.
  28297.      
  28298.    begin
  28299.      
  28300.       STATE := WS_STATE_LIST . WS_STATE;
  28301.      
  28302.    end INQ_WS_STATE;
  28303.      
  28304. end WSR_INQ_WS_STATE_LIST_0A;
  28305. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28306. --:UDD:GKSADACM:CODE:0A:LEXI3700_WSD_0A.ADA
  28307. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28308. ------------------------------------------------------------------
  28309. --
  28310. --  NAME: LEXI3700_WSD
  28311. --  IDENTIFIER: GDMXXX.1(1)
  28312. --  DISCREPANCY REPORTS:
  28313. --
  28314. ------------------------------------------------------------------
  28315. -- file: LEXI3700_WSD_0A.ADA
  28316. -- level: 0a
  28317.      
  28318. with CGI;
  28319. with GKS_TYPES;
  28320.      
  28321. use  CGI;
  28322. use  GKS_TYPES;
  28323.      
  28324. package LEXI3700_WSD is
  28325.      
  28326. -- This package LEXI3700_WSD is the LEXIDATA workstation driver. As
  28327. -- a workstation driver, it controls the flow of operations to the
  28328. -- device driver.
  28329. --
  28330. -- Package GKS_TYPES provides type definitions.
  28331. -- Package CGI provides the data interface from the workstation
  28332. -- manager. The data interface is a discriminant record made up of
  28333. -- an OPERATION and the corresponding parameters for the operation.
  28334. --
  28335. -- This package LEXI3700_WSD provides a single procedure LEXI3700_WSD
  28336. -- to perform the workstation operation which is encoded in the CGI
  28337. -- instruction.
  28338.      
  28339.    procedure LEXI3700_WSD
  28340.       (INSTR : in out CGI_INSTR;
  28341.        AFFECTED_WS_ID : in WS_ID);
  28342.      
  28343. end LEXI3700_WSD;
  28344. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28345. --:UDD:GKSADACM:CODE:0A:LEXI3700_WSD_0A_B.ADA
  28346. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28347. ------------------------------------------------------------------
  28348. --
  28349. --  NAME: LEXI3700_WSD - BODY
  28350. --  IDENTIFIER: GDMXXX.1(2)
  28351. --  DISCREPANCY REPORTS:
  28352. --  #019  06/14/85  "Change SET_PATTERN_SIZE to SET_PATTERN_VECTORS"
  28353. ------------------------------------------------------------------
  28354. -- file: LEXI3700_WSD_0A_B.ADA
  28355. -- level: 0a
  28356.      
  28357. with WS_STATE_LIST_TYPES;
  28358. with LEXI3700_WS_TABLES;
  28359.      
  28360. -- Workstation Driver operations for level ma
  28361. with LEXI3700_CONTROL_OPERATIONS;
  28362. with LEXI3700_OUTPUT_PRIMITIVES;
  28363. with LEXI3700_COLOUR_OPERATIONS;
  28364. with LEXI3700_INQ_TEXT;
  28365.      
  28366. -- Resource operations for level ma
  28367. with WSR_SET_PRIMITIVE_ATTRIBUTES_MA;
  28368. with WSR_SET_INDIVIDUAL_ATTRIBUTES_MA;
  28369. with WSR_WS_TRANSFORMATION;
  28370. with WSR_INQ_WS_DESCRIPTION_TABLE_MA;
  28371. with WSR_INQ_WS_STATE_LIST_MA;
  28372. with WSR_GKS_NORMALIZATION;
  28373.      
  28374. -- Workstation Driver operations for level 0a
  28375. with LEXI3700_EXTENDED_OUTPUT_PRIMITIVES;
  28376. with LEXI3700_PIXEL_OPERATIONS;
  28377.      
  28378. -- Resource operations for level 0a
  28379. with WSR_SET_BUNDLE_INDICES;
  28380. with WSR_SET_PRIMITIVE_ATTRIBUTES_0A;
  28381. with WSR_SET_INDIVIDUAL_ATTRIBUTES_0A;
  28382. with WSR_INQ_WS_DESCRIPTION_TABLE_0A;
  28383. with WSR_INQ_WS_STATE_LIST_0A;
  28384.      
  28385. package body LEXI3700_WSD is
  28386.      
  28387. -- This package is the LEXIDATA workstation driver and
  28388. -- controls the flow of commands to the device driver.
  28389. --
  28390. -- Package WS_STATE_LIST_TYPES provides a type for access to a
  28391. -- workstation state list.
  28392. -- Package LEXI3700_WS_TABLES provides a procedure GET_STATE_LIST_PTR
  28393. -- to get the pointer of a workstation state list currently allocated
  28394. -- for the Lexidata device corresponding to the given workstation id.
  28395. -- If no state list has been allocated for the current id, a null
  28396. -- pointer is returned.
  28397.      
  28398.    procedure LEXI3700_WSD
  28399.       (INSTR : in out CGI_INSTR;
  28400.        AFFECTED_WS_ID : WS_ID) is
  28401.      
  28402.    -- The workstation id is used to find the appropriate workstation
  28403.    -- state list.  A pointer to the workstation state list is passed to
  28404.    -- all workstation resource (wsr) routines.
  28405.    --
  28406.    -- This procedure decodes the op_code that is passed from the
  28407.    -- workstation manager. Once the op_code has been decoded, this
  28408.    -- procedure calls a procedure in either a resource package for
  28409.    -- common functions among workstations or a LEXI3700 package for
  28410.    -- operations specific to the Lexidata.  The LEXI3700 packages
  28411.    -- produce a call to the device driver for actual output.
  28412.    --
  28413.    --
  28414.    -- INSTR - contains the operation and the related parameters.
  28415.    -- AFFECTED_WS_ID - the workstation id  of the workstation that is
  28416.    --                  affected by the current operation
  28417.      
  28418.    -- A pointer to the workstation state list corresponding to WS_ID
  28419.    WS_SL : WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR;
  28420.      
  28421.    -- The workstation description table used by this driver
  28422.    --        LEXI3700_WS_TABLES.LEXI3700_WS_DT
  28423.      
  28424.    begin
  28425.      
  28426.       WS_SL := LEXI3700_WS_TABLES.
  28427.             GET_STATE_LIST_PTR(AFFECTED_WS_ID);
  28428.      
  28429.       case INSTR.OP is
  28430.      
  28431.          when NO_OP =>
  28432.             null;
  28433.      
  28434.          -- logical operation "ws_control"
  28435.      
  28436.          when OPEN_WS =>
  28437.             LEXI3700_CONTROL_OPERATIONS.OPEN_WS
  28438.                (INSTR.WS_TO_OPEN,
  28439.                 INSTR.CONNECTION_OPEN,
  28440.                 INSTR.TYPE_OF_WS_OPEN,
  28441.                 INSTR.ATTRIBUTES_AT_OPEN,
  28442.                 INSTR.EI);
  28443.          when CLOSE_WS =>
  28444.             LEXI3700_CONTROL_OPERATIONS.CLOSE_WS(WS_SL);
  28445.          when ACTIVATE_WS =>
  28446.             WS_SL.WS_STATE := ACTIVE;
  28447.          when DEACTIVATE_WS =>
  28448.             WS_SL.WS_STATE := INACTIVE;
  28449.          when CLEAR_WS =>
  28450.             LEXI3700_CONTROL_OPERATIONS.CLEAR_WS
  28451.                (WS_SL,
  28452.                 INSTR.FLAG);
  28453.          when UPDATE_WS =>
  28454.             LEXI3700_CONTROL_OPERATIONS.UPDATE_WS
  28455.                (WS_SL,
  28456.                 INSTR.REGENERATION);
  28457.      
  28458.          -- logical operation "output_primitives"
  28459.      
  28460.          when POLYLINE =>
  28461.             LEXI3700_OUTPUT_PRIMITIVES.POLYLINE
  28462.                (WS_SL,
  28463.                 INSTR.LINE_POINTS);
  28464.          when POLYMARKER =>
  28465.             LEXI3700_OUTPUT_PRIMITIVES.POLYMARKER
  28466.                (WS_SL,
  28467.                 INSTR.MARKER_POINTS);
  28468.          when FILL_AREA =>
  28469.             LEXI3700_OUTPUT_PRIMITIVES.FILL_AREA
  28470.                (WS_SL,
  28471.                 INSTR.FILL_AREA_POINTS);
  28472.          when TEXT =>
  28473.             LEXI3700_OUTPUT_PRIMITIVES.TEXT
  28474.                (WS_SL,
  28475.                 INSTR.TEXT_POSITION,
  28476.                 INSTR.TEXT_STRING);
  28477.      
  28478.          -- logical operation "set_primitive_attributes_ma"
  28479.      
  28480.          when SET_CHAR_VECTORS =>
  28481.             WSR_SET_PRIMITIVE_ATTRIBUTES_MA.SET_CHAR_VECTORS
  28482.                   (WS_SL,
  28483.                    INSTR.CHAR_HEIGHT_VECTOR_SET,
  28484.                    INSTR.CHAR_WIDTH_VECTOR_SET);
  28485.          when SET_TEXT_ALIGNMENT =>
  28486.             WSR_SET_PRIMITIVE_ATTRIBUTES_MA.SET_TEXT_ALIGNMENT
  28487.                   (WS_SL,
  28488.                    INSTR.TEXT_ALIGNMENT_SET);
  28489.      
  28490.          -- logical operation "set_individual_attributes_ma"
  28491.      
  28492.          when SET_LINETYPE =>
  28493.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA.SET_LINETYPE
  28494.                   (WS_SL,
  28495.                    LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28496.                    INSTR.LINETYPE_SET);
  28497.          when SET_POLYLINE_COLOUR_INDEX =>
  28498.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA.SET_POLYLINE_COLOUR_INDEX
  28499.                   (WS_SL,
  28500.                    INSTR.POLYLINE_COLOUR_INDEX_SET);
  28501.          when SET_MARKER_TYPE =>
  28502.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA.SET_MARKER_TYPE
  28503.                   (WS_SL,
  28504.                    LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28505.                    INSTR.MARKER_TYPE_SET);
  28506.          when SET_POLYMARKER_COLOUR_INDEX =>
  28507.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA
  28508.                   .SET_POLYMARKER_COLOUR_INDEX
  28509.                   (WS_SL,
  28510.                    INSTR.POLYMARKER_COLOUR_INDEX_SET);
  28511.          when SET_TEXT_COLOUR_INDEX =>
  28512.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA.SET_TEXT_COLOUR_INDEX
  28513.                   (WS_SL,
  28514.                    INSTR.TEXT_COLOUR_INDEX_SET);
  28515.          when SET_FILL_AREA_INTERIOR_STYLE =>
  28516.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA
  28517.                   .SET_FILL_AREA_INTERIOR_STYLE
  28518.                   (WS_SL,
  28519.                    INSTR.FILL_AREA_INTERIOR_STYLE_SET);
  28520.          when SET_FILL_AREA_COLOUR_INDEX =>
  28521.             WSR_SET_INDIVIDUAL_ATTRIBUTES_MA.SET_FILL_AREA_COLOUR_INDEX
  28522.                   (WS_SL,
  28523.                    INSTR.FILL_AREA_COLOUR_INDEX_SET);
  28524.      
  28525.          -- logical operation "set_colour_table"
  28526.      
  28527.          when SET_COLOUR_REPRESENTATION =>
  28528.             LEXI3700_COLOUR_OPERATIONS.SET_COLOUR_REPRESENTATION
  28529.                   (WS_SL,
  28530.                    INSTR.COLOUR_INDEX_TO_SET_COLOUR_REP,
  28531.                    INSTR.COLOUR_REP_SET,
  28532.                    INSTR.EI);
  28533.      
  28534.          -- logical operation "ws_transformation"
  28535.      
  28536.          when SET_WS_WINDOW =>
  28537.             WSR_WS_TRANSFORMATION.SET_WS_WINDOW
  28538.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT.WS_DYNAMICS.
  28539.                          WS_TRANSFORMATION,
  28540.                    WS_SL,
  28541.                    INSTR.WS_WINDOW_LIMITS_SET);
  28542.          when SET_WS_VIEWPORT =>
  28543.             WSR_WS_TRANSFORMATION.SET_WS_VIEWPORT
  28544.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT.WS_DYNAMICS.
  28545.                          WS_TRANSFORMATION,
  28546.                    WS_SL,
  28547.                    INSTR.WS_VIEWPORT_LIMITS_SET);
  28548.      
  28549.          -- logical operation "inq_ws_description_table_ma"
  28550.      
  28551.          when INQ_DISPLAY_SPACE_SIZE =>
  28552.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_DISPLAY_SPACE_SIZE
  28553.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28554.                    INSTR.DISPLAY_SPACE_UNITS_INQ,
  28555.                    INSTR.MAX_DC_SIZE_INQ,
  28556.                    INSTR.MAX_RASTER_UNIT_SIZE_INQ);
  28557.          when INQ_POLYLINE_FACILITIES =>
  28558.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_POLYLINE_FACILITIES
  28559.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28560.                    INSTR.LIST_OF_POLYLINE_TYPES_INQ,
  28561.                    INSTR.NUMBER_OF_WIDTHS_INQ,
  28562.                    INSTR.NOMINAL_WIDTH_INQ,
  28563.                    INSTR.RANGE_OF_WIDTHS_INQ,
  28564.                    INSTR.NUMBER_OF_POLYLINE_INDICES_INQ);
  28565.          when INQ_POLYMARKER_FACILITIES =>
  28566.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_POLYMARKER_FACILITIES
  28567.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28568.                    INSTR.LIST_OF_POLYMARKER_TYPES_INQ,
  28569.                    INSTR.NUMBER_OF_SIZES_INQ,
  28570.                    INSTR.NOMINAL_SIZE_INQ,
  28571.                    INSTR.RANGE_OF_SIZES_INQ,
  28572.                    INSTR.NUMBER_OF_POLYMARKER_INDICES_INQ);
  28573.          when INQ_TEXT_FACILITIES =>
  28574.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_TEXT_FACILITIES
  28575.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28576.                    INSTR.LIST_OF_FONT_PRECISION_PAIRS_INQ,
  28577.                    INSTR.NUMBER_OF_HEIGHTS_INQ,
  28578.                    INSTR.RANGE_OF_HEIGHTS_INQ,
  28579.                    INSTR.NUMBER_OF_EXPANSIONS_INQ,
  28580.                    INSTR.RANGE_OF_EXPANSIONS_INQ,
  28581.                    INSTR.NUMBER_OF_TEXT_INDICES_INQ);
  28582.          when INQ_FILL_AREA_FACILITIES =>
  28583.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_FILL_AREA_FACILITIES
  28584.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28585.                    INSTR.LIST_OF_INTERIOR_STYLES_INQ,
  28586.                    INSTR.LIST_OF_HATCH_STYLES_INQ,
  28587.                    INSTR.NUMBER_OF_FILL_AREA_INDICES_INQ);
  28588.          when INQ_COLOUR_FACILITIES =>
  28589.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.INQ_COLOUR_FACILITIES
  28590.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28591.                    INSTR.NUMBER_OF_COLOURS_INQ,
  28592.                    INSTR.AVAILABLE_COLOUR_INQ,
  28593.                    INSTR.NUMBER_OF_COLOUR_INDICES_INQ);
  28594.          when INQ_MAX_LENGTH_OF_WS_STATE_TABLES =>
  28595.             WSR_INQ_WS_DESCRIPTION_TABLE_MA.
  28596.                   INQ_MAX_LENGTH_OF_WS_STATE_TABLES
  28597.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28598.                    INSTR.MAX_POLYLINE_ENTRIES_INQ,
  28599.                    INSTR.MAX_POLYMARKER_ENTRIES_INQ,
  28600.                    INSTR.MAX_TEXT_ENTRIES_INQ,
  28601.                    INSTR.MAX_FILL_AREA_ENTRIES_INQ,
  28602.                    INSTR.MAX_PATTERN_INDICES_INQ,
  28603.                    INSTR.MAX_COLOUR_INDICES_INQ);
  28604.      
  28605.          -- logical operation "inq_ws_state_list_ma"
  28606.      
  28607.          when INQ_WS_CONNECTION_AND_TYPE =>
  28608.             WSR_INQ_WS_STATE_LIST_MA.INQ_WS_CONNECTION_AND_TYPE
  28609.                   (WS_SL,
  28610.                    INSTR.CONNECTION_INQ,
  28611.                    INSTR.TYPE_OF_WS_INQ);
  28612.          when INQ_TEXT_EXTENT =>
  28613.             LEXI3700_INQ_TEXT.INQ_TEXT_EXTENT
  28614.                   (WS_SL,
  28615.                    INSTR.POSITION_TEXT,
  28616.                    INSTR.CHAR_STRING,
  28617.                    INSTR.CONCATENATION_POINT,
  28618.                    INSTR.TEXT_EXTENT_LOWER_LEFT_INQ,
  28619.                    INSTR.TEXT_EXTENT_LOWER_RIGHT_INQ,
  28620.                    INSTR.TEXT_EXTENT_UPPER_LEFT_INQ,
  28621.                    INSTR.TEXT_EXTENT_UPPER_RIGHT_INQ);
  28622.          when INQ_LIST_OF_COLOUR_INDICES =>
  28623.             WSR_INQ_WS_STATE_LIST_MA.INQ_LIST_OF_COLOUR_INDICES
  28624.                   (WS_SL,
  28625.                    INSTR.LIST_OF_COLOUR_INDICES_INQ);
  28626.          when INQ_COLOUR_REPRESENTATION =>
  28627.             WSR_INQ_WS_STATE_LIST_MA.INQ_COLOUR_REPRESENTATION
  28628.                   (WS_SL,
  28629.                    INSTR.COLOUR_INDEX_TO_INQ_COLOUR_REP,
  28630.                    INSTR.RETURN_VALUE_TO_INQ_COLOUR_REP,
  28631.                    INSTR.COLOUR_REP_INQ,
  28632.                    INSTR.EI);
  28633.          when INQ_WS_TRANSFORMATION =>
  28634.             WSR_INQ_WS_STATE_LIST_MA.INQ_WS_TRANSFORMATION
  28635.                   (WS_SL,
  28636.                    INSTR.UPDATE_INQ,
  28637.                    INSTR.REQUESTED_WINDOW_INQ,
  28638.                    INSTR.CURRENT_WINDOW_INQ,
  28639.                    INSTR.REQUESTED_VIEWPORT_INQ,
  28640.                    INSTR.CURRENT_VIEWPORT_INQ);
  28641.      
  28642.          -- logical operation "gks_normalization"
  28643.      
  28644.          when SET_CLIPPING_RECTANGLE =>
  28645.             WSR_GKS_NORMALIZATION.SET_CLIPPING_RECTANGLE
  28646.                   (WS_SL,
  28647.                    INSTR.CLIPPING_RECTANGLE_SET);
  28648.      
  28649.          -- LEVEL 0a
  28650.          -- logical operation "extended_output_primitives"
  28651.      
  28652.          when CELL_ARRAY =>
  28653.             LEXI3700_EXTENDED_OUTPUT_PRIMITIVES.CELL_ARRAY
  28654.                   (WS_SL,
  28655.                    INSTR.CELL_ARRAY_CORNER_1_1,
  28656.                    INSTR.CELL_ARRAY_CORNER_DX_DY,
  28657.                    INSTR.CELL_ARRAY_CORNER_DX_1,
  28658.                    INSTR.CELL_COLOUR_MATRIX);
  28659.      
  28660.          -- Generalized Drawing Primitives
  28661.          when CIRCLE =>
  28662.             LEXI3700_EXTENDED_OUTPUT_PRIMITIVES.CIRCLE
  28663.                   (WS_SL,
  28664.                    INSTR.CIRCLE_CENTER,
  28665.                    INSTR.CIRCLE_PERIPHERAL_POINT);
  28666.      
  28667.          -- logical operation "set_bundle_indices"
  28668.      
  28669.          when SET_POLYLINE_INDEX =>
  28670.             WSR_SET_BUNDLE_INDICES.SET_POLYLINE_INDEX
  28671.                   (WS_SL,
  28672.                    INSTR.POLYLINE_INDEX_SET);
  28673.          when SET_POLYMARKER_INDEX =>
  28674.             WSR_SET_BUNDLE_INDICES.SET_POLYMARKER_INDEX
  28675.                   (WS_SL,
  28676.                    INSTR.POLYMARKER_INDEX_SET);
  28677.          when SET_TEXT_INDEX =>
  28678.             WSR_SET_BUNDLE_INDICES.SET_TEXT_INDEX
  28679.                   (WS_SL,
  28680.                    INSTR.TEXT_INDEX_SET);
  28681.          when SET_FILL_AREA_INDEX =>
  28682.             WSR_SET_BUNDLE_INDICES.SET_FILL_AREA_INDEX
  28683.                   (WS_SL,
  28684.                    INSTR.FILL_AREA_INDEX_SET);
  28685.      
  28686.          -- logical operation "set_primitive_attributes_0a"
  28687.      
  28688.          when SET_TEXT_PATH =>
  28689.             WSR_SET_PRIMITIVE_ATTRIBUTES_0A.SET_TEXT_PATH
  28690.                   (WS_SL,
  28691.                    INSTR.TEXT_PATH_SET);
  28692.          when SET_PATTERN_VECTORS =>                           -- DR019
  28693.             WSR_SET_PRIMITIVE_ATTRIBUTES_0A.SET_PATTERN_SIZE
  28694.                   (WS_SL,
  28695.                    INSTR.PATTERN_HEIGHT_VECTOR_SET,            -- DR019
  28696.                    INSTR.PATTERN_WIDTH_VECTOR_SET);            -- DR019
  28697.          when SET_PATTERN_REFERENCE_POINT =>
  28698.             WSR_SET_PRIMITIVE_ATTRIBUTES_0A.SET_PATTERN_REFERENCE_POINT
  28699.                   (WS_SL,
  28700.                    INSTR.PATTERN_REFERENCE_POINT_SET);
  28701.      
  28702.          -- logical operation "set_individual_attributes_0a"
  28703.      
  28704.          when SET_LINE_WIDTH_SCALE_FACTOR =>
  28705.             WSR_SET_INDIVIDUAL_ATTRIBUTES_0A.SET_LINE_WIDTH_SCALE_FACTOR
  28706.                   (WS_SL,
  28707.                    INSTR.LINE_WIDTH_SCALE_FACTOR_SET);
  28708.          when SET_MARKER_SIZE_SCALE_FACTOR =>
  28709.             WSR_SET_INDIVIDUAL_ATTRIBUTES_0A
  28710.                   .SET_MARKER_SIZE_SCALE_FACTOR
  28711.                   (WS_SL,
  28712.                    INSTR.MARKER_SIZE_SCALE_FACTOR_SET);
  28713.          when SET_TEXT_FONT_AND_PRECISION =>
  28714.             WSR_SET_INDIVIDUAL_ATTRIBUTES_0A.SET_TEXT_FONT_AND_PRECISION
  28715.                   (WS_SL,
  28716.                    LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28717.                    INSTR.TEXT_FONT_AND_PRECISION_SET);
  28718.          when SET_CHAR_EXPANSION_FACTOR =>
  28719.             WSR_SET_INDIVIDUAL_ATTRIBUTES_0A.SET_CHAR_EXPANSION_FACTOR
  28720.                   (WS_SL,
  28721.                    INSTR.CHAR_EXPANSION_FACTOR_SET);
  28722.          when SET_CHAR_SPACING =>
  28723.             WSR_SET_INDIVIDUAL_ATTRIBUTES_0A.SET_CHAR_SPACING
  28724.                   (WS_SL,
  28725.                    INSTR.CHAR_SPACING_SET);
  28726.          when SET_FILL_AREA_STYLE_INDEX =>
  28727.             WSR_SET_INDIVIDUAL_ATTRIBUTES_0A.SET_FILL_AREA_STYLE_INDEX
  28728.                   (WS_SL,
  28729.                    INSTR.FILL_AREA_STYLE_INDEX_SET);
  28730.          when SET_ASF =>
  28731.             WSR_SET_INDIVIDUAL_ATTRIBUTES_0A.SET_ASF
  28732.                   (WS_SL,
  28733.                    INSTR.ASF_SET);
  28734.      
  28735.          -- logical operation "inq_ws_description_table_0a"
  28736.      
  28737.          when INQ_WS_CATEGORY =>
  28738.             WSR_INQ_WS_DESCRIPTION_TABLE_0A.INQ_WS_CATEGORY
  28739.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28740.                    INSTR.WS_CATEGORY_INQ);
  28741.          when INQ_WS_CLASS =>
  28742.             WSR_INQ_WS_DESCRIPTION_TABLE_0A.INQ_WS_CLASS
  28743.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28744.                    INSTR.WS_CLASS_INQ);
  28745.          when INQ_PREDEFINED_POLYLINE_REPRESENTATION =>
  28746.             WSR_INQ_WS_DESCRIPTION_TABLE_0A
  28747.                   .INQ_PREDEFINED_POLYLINE_REPRESENTATION
  28748.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28749.                    INSTR.PRE_POLYLINE_INDEX_TO_INQ_PRE_POLYLINE_REP,
  28750.                    INSTR.PRE_POLYLINE_TYPE_INQ,
  28751.                    INSTR.PRE_POLYLINE_WIDTH_INQ,
  28752.                    INSTR.PRE_POLYLINE_COLOUR_INQ,
  28753.                    INSTR.EI);
  28754.          when INQ_PREDEFINED_POLYMARKER_REPRESENTATION =>
  28755.             WSR_INQ_WS_DESCRIPTION_TABLE_0A
  28756.                   .INQ_PREDEFINED_POLYMARKER_REPRESENTATION
  28757.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28758.                    INSTR.PRE_POLYMARKER_INDEX_TO_INQ_PRE_POLYMARKER_REP,
  28759.                    INSTR.PRE_POLYMARKER_TYPE_INQ,
  28760.                    INSTR.PRE_POLYMARKER_SIZE_INQ,
  28761.                    INSTR.PRE_POLYMARKER_COLOUR_INQ,
  28762.                    INSTR.EI);
  28763.          when INQ_PREDEFINED_TEXT_REPRESENTATION =>
  28764.             WSR_INQ_WS_DESCRIPTION_TABLE_0A
  28765.                   .INQ_PREDEFINED_TEXT_REPRESENTATION
  28766.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28767.                    INSTR.PRE_TEXT_INDEX_TO_INQ_PRE_TEXT_REP,
  28768.                    INSTR.PRE_TEXT_FONT_PRECISION_INQ,
  28769.                    INSTR.PRE_TEXT_CHAR_EXPANSION_INQ,
  28770.                    INSTR.PRE_TEXT_CHAR_SPACING_INQ,
  28771.                    INSTR.PRE_TEXT_COLOUR_INQ,
  28772.                    INSTR.EI);
  28773.          when INQ_PREDEFINED_FILL_AREA_REPRESENTATION =>
  28774.             WSR_INQ_WS_DESCRIPTION_TABLE_0A
  28775.                   .INQ_PREDEFINED_FILL_AREA_REPRESENTATION
  28776.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28777.                    INSTR.PRE_FILL_AREA_INDEX_TO_INQ_PRE_FILL_AREA_REP,
  28778.                    INSTR.PRE_FILL_AREA_INTERIOR_INQ,
  28779.                    INSTR.PRE_FILL_AREA_STYLE_INQ,
  28780.                    INSTR.PRE_FILL_AREA_COLOUR_INQ,
  28781.                    INSTR.EI);
  28782.          when INQ_PATTERN_FACILITIES =>
  28783.             WSR_INQ_WS_DESCRIPTION_TABLE_0A.INQ_PATTERN_FACILITIES
  28784.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28785.                    INSTR.NUMBER_OF_PATTERN_INDICES);
  28786.          when INQ_PREDEFINED_PATTERN_REPRESENTATION =>
  28787.             WSR_INQ_WS_DESCRIPTION_TABLE_0A
  28788.                   .INQ_PREDEFINED_PATTERN_REPRESENTATION
  28789.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28790.                    INSTR.PRE_PATTERN_INDEX_TO_INQ_PRE_PATTERN_REP,
  28791.                    INSTR.PRE_PATTERN_REP_INQ,
  28792.                    INSTR.EI);
  28793.          when INQ_PREDEFINED_COLOUR_REPRESENTATION =>
  28794.             WSR_INQ_WS_DESCRIPTION_TABLE_0A
  28795.                   .INQ_PREDEFINED_COLOUR_REPRESENTATION
  28796.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28797.                    INSTR.PRE_COLOUR_INDEX_TO_INQ_PRE_COLOUR_REP,
  28798.                    INSTR.PRE_COLOUR_REP_INQ,
  28799.                    INSTR.EI);
  28800.          when INQ_LIST_OF_AVAILABLE_GDP =>
  28801.             WSR_INQ_WS_DESCRIPTION_TABLE_0A.INQ_LIST_OF_AVAILABLE_GDP
  28802.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28803.                    INSTR.LIST_OF_GDP_INQ);
  28804.          when INQ_GDP =>
  28805.             WSR_INQ_WS_DESCRIPTION_TABLE_0A.INQ_GDP
  28806.                   (LEXI3700_WS_TABLES.LEXI3700_WS_DT,
  28807.                    INSTR.GDP_TO_INQ_GDP,
  28808.                    INSTR.LIST_OF_ATTRIBUTES_USED_INQ,
  28809.                    INSTR.EI);
  28810.      
  28811.          -- logical operation "inq_ws_state_list_0a"
  28812.      
  28813.          when INQ_WS_STATE =>
  28814.             WSR_INQ_WS_STATE_LIST_0A.INQ_WS_STATE
  28815.                   (WS_SL,
  28816.                    INSTR.WS_STATE_INQ);
  28817.          when INQ_WS_DEFERRAL_AND_UPDATE_STATES =>
  28818.             WSR_INQ_WS_STATE_LIST_0A.INQ_WS_DEFERRAL_AND_UPDATE_STATES
  28819.                   (WS_SL,
  28820.                    INSTR.DEFERRAL_INQ,
  28821.                    INSTR.REGENERATION_INQ,
  28822.                    INSTR.DISPLAY_INQ,
  28823.                    INSTR.FRAME_ACTION_INQ);
  28824.      
  28825.          -- logical operation "pixels"
  28826.      
  28827.          when INQ_PIXEL_ARRAY_DIMENSIONS =>
  28828.             LEXI3700_PIXEL_OPERATIONS.INQ_PIXEL_ARRAY_DIMENSIONS
  28829.                   (WS_SL,
  28830.                    INSTR.PIXEL_ARRAY_CORNER_1_1_INQ,
  28831.                    INSTR.PIXEL_ARRAY_CORNER_DX_DY_INQ,
  28832.                    INSTR.DIMENSIONS_INQ);
  28833.          when INQ_PIXEL_ARRAY =>
  28834.             LEXI3700_PIXEL_OPERATIONS.INQ_PIXEL_ARRAY
  28835.                   (WS_SL,
  28836.                    INSTR.PIXEL_ARRAY_CORNER_INQ,
  28837.                    INSTR.DX_INQ,
  28838.                    INSTR.DY_INQ,
  28839.                    INSTR.INVALID_VALUES_INQ,
  28840.                    INSTR.PIXEL_ARRAY_INQ);
  28841.          when INQ_PIXEL =>
  28842.             LEXI3700_PIXEL_OPERATIONS.INQ_PIXEL
  28843.                   (WS_SL,
  28844.                    INSTR.PIXEL_POINT_INQ,
  28845.                    INSTR.PIXEL_COLOUR_INQ);
  28846.      
  28847.       end case;
  28848.      
  28849.    end LEXI3700_WSD;
  28850.      
  28851. end LEXI3700_WSD;
  28852. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28853. --:UDD:GKSADACM:CODE:MA:WS_COMM.ADA
  28854. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28855. ------------------------------------------------------------------
  28856. --
  28857. --  NAME: WS_COMMUNICATION
  28858. --  IDENTIFIER: GDMXXX.1(1)
  28859. --  DISCREPANCY REPORTS:
  28860. --
  28861. ------------------------------------------------------------------
  28862. -- file: WS_COMM.ADA
  28863. -- level: all levels
  28864.      
  28865. with CGI;
  28866. with GKS_TYPES;
  28867.      
  28868. use CGI;
  28869. use GKS_TYPES;
  28870.      
  28871. package WS_COMMUNICATION is
  28872.      
  28873. -- CGI_INSTR is declared in the CGI package.
  28874. -- WS_TYPE and WS_ID are declared in GKS_TYPES.
  28875. -- XMIT_ALL is passed a list of workstations for which
  28876. -- to transmit the instruction.
  28877.      
  28878.    procedure XMIT
  28879.       (INSTR      : in out CGI_INSTR;
  28880.        XMIT_WS_ID : in WS_ID);
  28881.      
  28882.    procedure XMIT_TYPE
  28883.       (INSTR      : in out CGI_INSTR;
  28884.        XMIT_TYPE  : in WS_TYPE);
  28885.      
  28886.    procedure XMIT_ALL
  28887.       (INSTR   : in out CGI_INSTR;
  28888.        WS_XMIT_LIST : in WS_IDS.LIST_OF);
  28889.      
  28890. end WS_COMMUNICATION;
  28891.      
  28892. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28893. --:UDD:GKSADACM:CODE:MA:WS_COMM_B.ADA
  28894. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28895. ------------------------------------------------------------------
  28896. --
  28897. --  NAME: WS_COMMUNICATION
  28898. --  IDENTIFIER: GDMXXX.1(1)
  28899. --  DISCREPANCY REPORTS:
  28900. --
  28901. ------------------------------------------------------------------
  28902. -- file: WS_COMM_B.ADA
  28903. -- level: all levels
  28904.      
  28905. package body WS_COMMUNICATION is
  28906.      
  28907. -- This package provides the data interface between
  28908. -- the WS_MANAGER and output device drivers.
  28909.      
  28910.    procedure XMIT
  28911.       (INSTR      : in out CGI_INSTR;
  28912.        XMIT_WS_ID : in WS_ID) is separate;
  28913.      
  28914.    procedure XMIT_TYPE
  28915.       (INSTR      : in out CGI_INSTR;
  28916.        XMIT_TYPE  : in WS_TYPE) is separate;
  28917.      
  28918.    procedure XMIT_ALL
  28919.       (INSTR        : in out CGI_INSTR;
  28920.        WS_XMIT_LIST : in WS_IDS.LIST_OF) is separate;
  28921.      
  28922. end WS_COMMUNICATION;
  28923. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28924. --:UDD:GKSADACM:CODE:MA:XMIT.ADA
  28925. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28926. ------------------------------------------------------------------
  28927. --
  28928. --  NAME: XMIT
  28929. --  IDENTIFIER: GDMXXX.1(1)
  28930. --  DISCREPANCY REPORTS:
  28931. --
  28932. ------------------------------------------------------------------
  28933. -- file: XMIT.ADA
  28934. -- level: ma
  28935.      
  28936. with GKS_CONFIGURATION;
  28937. with LEXI3700_WSD;
  28938. with CGI_OPEN_WS_OPERATIONS;
  28939.      
  28940. separate (WS_COMMUNICATION)
  28941.      
  28942. procedure XMIT
  28943.    (INSTR      : in out CGI_INSTR;
  28944.     XMIT_WS_ID : in WS_ID) is
  28945.      
  28946. -- This procedure may be rewritten at each level and
  28947. -- for each implementation of GKS due to changes in system
  28948. -- configuration of devices. Capabilities of GKS increase at
  28949. -- each level. Level a has output capabilities and level b
  28950. -- has some input capabilities. The case statement
  28951. -- in this procedure changes to reflect these capability
  28952. -- changes to include output devices at level a or to include
  28953. -- input or output devices at levels b and c.
  28954. -- Also, various implementations of GKS will have varied
  28955. -- devices and the case statement changes to reflect alternative
  28956. -- device selections.
  28957.      
  28958. XMIT_WS_TYPE : WS_TYPE;
  28959.      
  28960. begin
  28961.      
  28962.    -- Send the INSTR and the WS_ID to the workstation driver
  28963.    -- for the workstation type corresponding to the WS_ID.
  28964.    -- CGI_OPEN_WS_OPERATIONS contains the function which
  28965.    -- returns the workstation type, on which to case, for the
  28966.    -- given XMIT_WS_ID and dictionary in which it resides.
  28967.      
  28968.    XMIT_WS_TYPE := CGI_OPEN_WS_OPERATIONS.OPEN_WS.VALUE
  28969.          (CGI_OPEN_WS_OPERATIONS.OPEN_DICTIONARY,XMIT_WS_ID);
  28970.      
  28971.    case XMIT_WS_TYPE is
  28972.      
  28973.       when GKS_CONFIGURATION.LEXIDATA_3700_OUTPUT_TYPE  =>
  28974.             LEXI3700_WSD.LEXI3700_WSD(INSTR,XMIT_WS_ID);
  28975.       when others =>
  28976.             null;
  28977.    end case;
  28978.      
  28979. end XMIT;
  28980. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28981. --:UDD:GKSADACM:CODE:MA:XMIT_TYPE.ADA
  28982. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  28983. ------------------------------------------------------------------
  28984. --
  28985. --  NAME: XMIT_TYPE
  28986. --  IDENTIFIER: GDMXXX.1(1)
  28987. --  DISCREPANCY REPORTS:
  28988. --
  28989. ------------------------------------------------------------------
  28990. -- file: XMIT_TYPE.ADA
  28991. -- level: ma
  28992.      
  28993. with GKS_CONFIGURATION;
  28994. with LEXI3700_WSD;
  28995.      
  28996. separate (WS_COMMUNICATION)
  28997.      
  28998. procedure XMIT_TYPE
  28999.    (INSTR      : in out CGI_INSTR;
  29000.     XMIT_TYPE  : in WS_TYPE) is
  29001.      
  29002. -- This procedure may be rewritten at each level and
  29003. -- for each implementation of GKS due to changes in system
  29004. -- configuration of devices. Capabilities of GKS increase at
  29005. -- each level. Level a has output capabilities and level b
  29006. -- has some input capabilities. The case statement
  29007. -- in this procedure changes to reflect these capability
  29008. -- changes to include output devices at level a or to include
  29009. -- input or output devices at levels b and c.
  29010. -- Also, various implementations of GKS will have varied
  29011. -- devices and the case statement changes to reflect alternative
  29012. -- device selections.
  29013.      
  29014. begin
  29015.      
  29016.    -- Send a workstation id as a dummy parameter with the INSTR
  29017.    -- to the workstation driver for the XMIT_TYPE specified
  29018.    -- by the parameter.
  29019.      
  29020.    case XMIT_TYPE is
  29021.       when GKS_CONFIGURATION.LEXIDATA_3700_OUTPUT_TYPE  =>
  29022.             LEXI3700_WSD.LEXI3700_WSD(INSTR,WS_ID'LAST);
  29023.       when others => null;
  29024.    end case;
  29025.      
  29026. end XMIT_TYPE;
  29027. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  29028. --:UDD:GKSADACM:CODE:MA:XMIT_ALL.ADA
  29029. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  29030. ------------------------------------------------------------------
  29031. --
  29032. --  NAME: XMIT_ALL
  29033. --  IDENTIFIER: GDMXXX.1(1)
  29034. --  DISCREPANCY REPORTS:
  29035. --
  29036. ------------------------------------------------------------------
  29037. -- file: XMIT_ALL.ADA
  29038. -- level: all levels
  29039.      
  29040. separate (WS_COMMUNICATION)
  29041.      
  29042. procedure XMIT_ALL
  29043.    (INSTR : in out CGI_INSTR;
  29044.     WS_XMIT_LIST : in WS_IDS.LIST_OF) is
  29045.      
  29046. begin
  29047.      
  29048.    -- The XMIT procedure is called for every workstation
  29049.    -- in the WS_XMIT_LIST.
  29050.      
  29051.    for I in 1..WS_IDS.SIZE_OF_LIST(WS_XMIT_LIST) loop
  29052.       XMIT(INSTR,WS_IDS.LIST_ELEMENT(I,WS_XMIT_LIST));
  29053.    end loop;
  29054.      
  29055. end XMIT_ALL;
  29056. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  29057. --:UDD:GKSADACM:CODE:0A:WSM_0A_B.ADA
  29058. --::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  29059. ------------------------------------------------------------------
  29060. --
  29061. --  NAME: WSM - BODY
  29062. --  IDENTIFIER: GDMXXX.1(2)
  29063. --  DISCREPANCY REPORTS:
  29064. --  #019  06/14/85  "Change SET_PATTERN_SIZE to SET_PATTERN_VECTORS"
  29065. ------------------------------------------------------------------
  29066. -- file:  wsm_0a_b.ada
  29067. -- level: 0a
  29068.      
  29069. with GKS_TYPES;
  29070. with WS_COMMUNICATION;
  29071. with CGI_OPEN_WS_OPERATIONS;
  29072. with GKS_ERRORS;
  29073.      
  29074. use  GKS_TYPES;
  29075.      
  29076. package body WSM is
  29077.      
  29078. -- This is the single entry point for the GKS device independent layer
  29079. -- to interface to all "virtual" devices.  The Work Station manager has
  29080. -- the responsibility of accepting a CGI interface call from GKS,
  29081. -- performing any common operations for workstations and transmitting
  29082. -- the operation to the appropriate workstation drivers via the WS_
  29083. -- COMMUNICATION package.
  29084. -- Package GKS_TYPES provides type definitions.
  29085. -- Package WS_COMMUNICATIONS provides communication of instructions to
  29086. -- different workstation drivers.
  29087. -- Package CGI_OPEN_WS_OPERATIONS provides a dictionary of associations
  29088. -- between workstation ids and workstation types for each currently
  29089. -- open workstation.
  29090. -- Package GKS_ERRORS provides named constants for possible error
  29091. -- indicator values.
  29092.      
  29093.    LIST_OF_OPEN_WS : WS_IDS.LIST_OF;
  29094.    -- WS manager copy of list of currently open workstations
  29095.      
  29096.    LIST_OF_ACTIVE_WS : WS_IDS.LIST_OF;
  29097.    -- WS manager copy of list of currently active workstations
  29098.      
  29099.    procedure WS_MANAGER
  29100.       (INSTR  : in out CGI_INSTR) is
  29101.      
  29102.    -- Decodes all CGI interface instructions and invokes the
  29103.    -- appropriate procedure of WS_COMMUNICATION to transmit to a
  29104.    -- Workstation Driver.
  29105.      
  29106.    begin
  29107.      
  29108.       -- Call the appropriate WS_COMMUNICATION routine based on
  29109.       -- the CGI instruction opcode
  29110.      
  29111.       case INSTR.OP is
  29112.      
  29113.          when NO_OP =>
  29114.             null;
  29115.      
  29116.          -- logical operation "ws_control"
  29117.      
  29118.          when OPEN_WS =>
  29119.             -- Add association of ws id and ws type to dictionary
  29120.             CGI_OPEN_WS_OPERATIONS.OPEN_WS.ENTER
  29121.                   (CGI_OPEN_WS_OPERATIONS.OPEN_DICTIONARY,
  29122.                    INSTR.WS_TO_OPEN,
  29123.                    INSTR.TYPE_OF_WS_OPEN);
  29124.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_OPEN);
  29125.             if  INSTR.EI = GKS_ERRORS.SUCCESSFUL then
  29126.                -- Add workstation id to list of open workstations
  29127.                WS_IDS.ADD_TO_LIST(INSTR.WS_TO_OPEN,
  29128.                      LIST_OF_OPEN_WS);
  29129.             else
  29130.                -- remove ws id entry from open dictionary
  29131.                CGI_OPEN_WS_OPERATIONS.OPEN_WS.PURGE
  29132.                      (CGI_OPEN_WS_OPERATIONS.OPEN_DICTIONARY,
  29133.                       INSTR.WS_TO_OPEN);
  29134.             end if;
  29135.          when CLOSE_WS =>
  29136.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_CLOSE);
  29137.             -- remove ws id entry from open dictionary
  29138.             CGI_OPEN_WS_OPERATIONS.OPEN_WS.PURGE
  29139.                   (CGI_OPEN_WS_OPERATIONS.OPEN_DICTIONARY,
  29140.                    INSTR.WS_TO_CLOSE);
  29141.             -- Delete workstation id from list of open workstations
  29142.             WS_IDS.DELETE_FROM_LIST(INSTR.WS_TO_CLOSE,
  29143.                   LIST_OF_OPEN_WS);
  29144.          when ACTIVATE_WS =>
  29145.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_ACTIVATE);
  29146.             if  INSTR.EI = GKS_ERRORS.SUCCESSFUL then
  29147.                -- Add workstation id to list of active workstations
  29148.                WS_IDS.ADD_TO_LIST(INSTR.WS_TO_ACTIVATE,
  29149.                      LIST_OF_ACTIVE_WS);
  29150.             end if;
  29151.          when DEACTIVATE_WS =>
  29152.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_DEACTIVATE);
  29153.             -- Delete workstation id from list of active workstations
  29154.             WS_IDS.DELETE_FROM_LIST(INSTR.WS_TO_DEACTIVATE,
  29155.                   LIST_OF_ACTIVE_WS);
  29156.          when CLEAR_WS =>
  29157.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_CLEAR);
  29158.          when UPDATE_WS =>
  29159.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_UPDATE);
  29160.      
  29161.          -- logical operation "set_colour_table"
  29162.      
  29163.          when SET_COLOUR_REPRESENTATION =>
  29164.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_SET_COLOUR_REP);
  29165.      
  29166.          -- logical operation "ws_transformation"
  29167.      
  29168.          when SET_WS_WINDOW =>
  29169.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_SET_WINDOW);
  29170.          when SET_WS_VIEWPORT =>
  29171.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_SET_VIEWPORT);
  29172.      
  29173.          -- logical operation "inq_ws_description_table_ma"
  29174.      
  29175.          when INQ_DISPLAY_SPACE_SIZE =>
  29176.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29177.                   INSTR.WS_TO_INQ_DISPLAY_SPACE_SIZE);
  29178.          when INQ_POLYLINE_FACILITIES =>
  29179.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29180.                   INSTR.WS_TO_INQ_POLYLINE_FACILITIES);
  29181.          when INQ_POLYMARKER_FACILITIES =>
  29182.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29183.                   INSTR.WS_TO_INQ_POLYMARKER_FACILITIES);
  29184.          when INQ_TEXT_FACILITIES =>
  29185.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29186.                   INSTR.WS_TO_INQ_TEXT_FACILITIES);
  29187.          when INQ_FILL_AREA_FACILITIES =>
  29188.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29189.                   INSTR.WS_TO_INQ_FILL_AREA_FACILITIES);
  29190.          when INQ_COLOUR_FACILITIES =>
  29191.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29192.                   INSTR.WS_TO_INQ_COLOUR_FACILITIES);
  29193.          when INQ_MAX_LENGTH_OF_WS_STATE_TABLES =>
  29194.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29195.                   INSTR.WS_TO_INQ_MAX_LENGTH_OF_WS_STATE_TABLES);
  29196.      
  29197.          -- logical operation "inq_ws_state_list_ma"
  29198.      
  29199.          when INQ_WS_CONNECTION_AND_TYPE =>
  29200.             WS_COMMUNICATION.XMIT(INSTR,
  29201.                   INSTR.WS_TO_INQ_CONNECTION_AND_TYPE);
  29202.          when INQ_TEXT_EXTENT =>
  29203.             WS_COMMUNICATION.XMIT(INSTR,INSTR.WS_TO_INQ_TEXT_EXTENT);
  29204.          when INQ_LIST_OF_COLOUR_INDICES =>
  29205.             WS_COMMUNICATION.XMIT(INSTR,
  29206.                   INSTR.WS_TO_INQ_COLOUR_INDICES);
  29207.          when INQ_COLOUR_REPRESENTATION =>
  29208.             WS_COMMUNICATION.XMIT(INSTR,
  29209.                   INSTR.WS_TO_INQ_COLOUR_REP);
  29210.          when INQ_WS_TRANSFORMATION =>
  29211.             WS_COMMUNICATION.XMIT(INSTR,
  29212.                   INSTR.WS_TO_INQ_TRANSFORMATION);
  29213.      
  29214.          -- LEVEL 0a
  29215.      
  29216.          -- logical operation "inq_ws_description_table_0a"
  29217.      
  29218.          when INQ_WS_CATEGORY =>
  29219.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29220.                   INSTR.WS_TO_INQ_CATEGORY);
  29221.          when INQ_WS_CLASS =>
  29222.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29223.                   INSTR.WS_TO_INQ_CLASS);
  29224.          when INQ_PREDEFINED_POLYLINE_REPRESENTATION =>
  29225.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29226.                   INSTR.WS_TO_INQ_PRE_POLYLINE_REP);
  29227.          when INQ_PREDEFINED_POLYMARKER_REPRESENTATION =>
  29228.             WS_COMMUNICATION.XMIT_TYPE(INSTR,
  29229.                   INSTR.WS_TO_INQ_PRE_POLYMARKER_REP);
  29230.          when INQ_PR