------------------------------------------------------------------ -- -- NAME: SET_COLOUR_TABLE - BODY -- DISCREPANCY REPORTS: -- ------------------------------------------------------------------ -- file: set_clr_tbl_b.ada -- level: all levels with WSM; with CGI_SUBTYPES_A; with ERROR_HANDLING; with GKS_OPERATING_STATE_LIST; with GKS_STATE_LIST; with GKS_ERRORS; with GKS_ERROR_STATE_LIST; use GKS_ERROR_STATE_LIST; use WSM; use CGI_SUBTYPES_A; use GKS_OPERATING_STATE_LIST; use GKS_ERRORS; package body SET_COLOUR_TABLE is -- This is the package body for procedures for calling the work- -- station manager to set the workstation attributes at level ma. -- -- If an error indicator above 0 occurs, these procedures call -- the ERROR_HANDLING procedure with the error indicator and -- the name of the procedure. procedure SET_COLOUR_REPRESENTATION (WS : in WS_ID; INDEX : in COLOUR_INDEX; RGB_COLOUR : in COLOUR_REPRESENTATION) is -- This procedure inquires the GKS_OPERATING_STATE_LIST to -- check if GKS is in one of the states WSOP, WSAC, or SGOP. -- If it is not, error 7 occurs and the procedure calls the -- ERROR_HANDLING procedure. It also checks the GKS_STATE_LIST -- to see if the WS is open. If not, error 25 occurs and the -- procedure calls the ERROR_HANDLING procedure. Otherwise, this -- procedure calls the workstation manager to map a given colour -- index with a specified colour of certain intensities of red, -- green, and blue and to set this value in the workstation state -- list. If the workstation manager returns error 33, 35, or 36, -- this procedure calls the ERROR_HANDLING procedure. -- -- WS - Identifies the workstation on which the colour represen- -- tation. -- INDEX - Indicates the entry in the colour table to be set. -- RGB_COLOUR - Defines the representation of a colour as a combina- -- tion of RED, GREEN, and BLUE intensities which are the -- components of the record. GKS_INSTR : CGI_SET_COLOUR_REPRESENTATION; 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 see if GKS is in the proper state and the workstation -- specified is open. if (CURRENT_OPERATING_STATE = GKCL) or (CURRENT_OPERATING_STATE = GKOP) then GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (NOT_WSOP_WSAC_SGOP,"SET_COLOUR_REPRESENTATION"); -- Error 7 GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (WS_NOT_OPEN, "SET_COLOUR_REPRESENTATION"); -- Error 25 GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; else GKS_INSTR.WS_TO_SET_COLOUR_REP := WS; GKS_INSTR.COLOUR_INDEX_TO_SET_COLOUR_REP := INDEX; GKS_INSTR.COLOUR_REP_SET := RGB_COLOUR; WS_MANAGER (GKS_INSTR); if GKS_INSTR.ERROR_INDICATOR /= SUCCESSFUL then -- Error 0 if (GKS_INSTR.ERROR_INDICATOR = WS_CATEGORY_IS_MI) or -- Error 33 (GKS_INSTR.ERROR_INDICATOR = WS_CATEGORY_IS_INPUT) or -- Error 35 (GKS_INSTR.ERROR_INDICATOR = WS_IS_WISS) then -- Error 36 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (GKS_INSTR.ERROR_INDICATOR, "SET_COLOUR_REPRESENTATION"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; elsif (GKS_INSTR.ERROR_INDICATOR = INVALID_COLOUR_INDEX) then -- Error 93 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (GKS_INSTR.ERROR_INDICATOR, "SET_COLOUR_REPRESENTATION"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; end if; end if; end if; exception when GKS_ERROR => GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; raise; when OTHERS => begin GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (UNKNOWN, "SET_COLOUR_REPRESENTATION"); -- ERROR 2501 GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; exception when OTHERS => GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; raise; end; end SET_COLOUR_REPRESENTATION; end SET_COLOUR_TABLE;