------------------------------------------------------------------ -- -- NAME: EXTENDED_OUTPUT_PRIMITIVES - BODY -- DISCREPANCY REPORTS: ------------------------------------------------------------------ -- file: ext_out_prim_b.ada -- level: 0a, 1a, 2a, 0b, 1b, 2b, 0c, 1c, 2c with WSM; with CGI_SUBTYPES_A; with GKS_ERROR_STATE_LIST; with GKS_OPERATING_STATE_LIST; with GKS_ERRORS; with GKS_STATE_LIST; with TRANSFORMATION_MATH; with ERROR_HANDLING; use WSM; use CGI_SUBTYPES_A; use GKS_ERROR_STATE_LIST; use GKS_OPERATING_STATE_LIST; use GKS_ERRORS; package body EXTENDED_OUTPUT_PRIMITIVES is -- This is the package body for the procedures to extend -- the output primitives to level 0a. -- -- If an error indicator above 0 occurs, this procedure calls -- the ERROR_HANDLING procedure. procedure CELL_ARRAY (CORNER_1_1 : in WC.POINT; CORNER_DX_DY: in WC.POINT; CELLS : in COLOUR_MATRIX) is -- This procedure inquires the GKS_OPERATING_STATE_LIST to -- check if GKS is in one of the states WSAC or SGOP. If it -- is not, error 5 occurs and the procedure calls the procedure -- ERROR_HANDLING. Otherwise, this procedure transforms the world -- coordinates passed in as the cell rectangle corners into -- normalized device coordinates. Then it passes these -- coordinates to the workstation manager and the colour -- index array to construct the cell array. -- CORNER_1_1 - Specifies the lower left point of the cell array. -- CORNER_DX_DY - Specifies the upper right point of the cell array. -- CELLS - Specifies a matrix of colour indices for the cells -- created in the cell array. GKS_INSTR : CGI_CELL_ARRAY; CORNER_DX_1 : WC.POINT; -- The above type was created to hold the third point calculated -- from the two passed in. begin -- Check the GKS_ERROR_STATE_LIST to see that the ERROR_STATE -- is not ON before continuing. if GKS_ERROR_STATE_LIST.ERROR_STATE = ON then return; end if; -- The following if structure inquires the GKS_OPERATING_STATE_LIST -- to check if GKS is in the proper state before proceeding. if (CURRENT_OPERATING_STATE /= WSAC) and (CURRENT_OPERATING_STATE /= SGOP) then GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (NOT_WSAC_SGOP, "CELL_ARRAY"); -- Error 5 GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; else GKS_INSTR.CELL_ARRAY_CORNER_1_1 := TRANSFORMATION_MATH .WC_TO_NDC (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION) .NDC_FACTORS, CORNER_1_1); GKS_INSTR.CELL_ARRAY_CORNER_DX_DY := TRANSFORMATION_MATH .WC_TO_NDC (GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION) .NDC_FACTORS, CORNER_DX_DY); CORNER_DX_1 := (CORNER_DX_DY.X,CORNER_1_1.Y); GKS_INSTR.CELL_ARRAY_CORNER_DX_1 := TRANSFORMATION_MATH .WC_TO_NDC(GKS_STATE_LIST.LIST_OF_NORMALIZATION_TRANSFORMATIONS (GKS_STATE_LIST.CURRENT_NORMALIZATION_TRANSFORMATION) .NDC_FACTORS, CORNER_DX_1); GKS_INSTR.CELL_COLOUR_MATRIX := new COLOUR_MATRIX'(CELLS); WS_MANAGER (GKS_INSTR); FREE_COLOUR_MATRIX (GKS_INSTR.CELL_COLOUR_MATRIX); end if; exception when GKS_ERROR => GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; raise; when NUMERIC_ERROR | CONSTRAINT_ERROR => begin GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (ARITHMETIC, "CELL_ARRAY"); -- Error 308 GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; exception when OTHERS => GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; raise; end; when OTHERS => begin GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (UNKNOWN, "CELL_ARRAY"); -- Error 2501 GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; exception when OTHERS => GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; raise; end; end CELL_ARRAY; end EXTENDED_OUTPUT_PRIMITIVES;