------------------------------------------------------------------ -- -- NAME: EXTENDED_SEGMENTS - BODY -- DISCREPANCY REPORTS: ------------------------------------------------------------------ -- file: EXT_SEGS_B.ADA -- level: 2a with CGI_SUBTYPES_A; with WSM; with GKS_STATE_LIST; with GKS_OPERATING_STATE_LIST; with ERROR_HANDLING; with OUTPUT_ATTRIBUTES_TYPE; with GET_OUTPUT_ATTRIBUTES; with GKS_ERRORS; with GKS_ERROR_STATE_LIST; use CGI_SUBTYPES_A; use WSM; use GKS_OPERATING_STATE_LIST; use GKS_ERROR_STATE_LIST; use GKS_ERRORS; package body EXTENDED_SEGMENTS is -- The package EXTENDED_SEGMENTS contains procedures that extend -- the ability to manipulate segments. procedure ASSOCIATE_SEGMENT_WITH_WS (WS : in WS_ID; SEGMENT : in SEGMENT_NAME) is -- This procedure begins by checking the operating state. If it is -- not WSOP or WSAC error #6 occurs and the procedure ERROR_HANDLING -- is called. The specific workstation is checked for being opened -- and if not error #25 is raised. Otherwise, WS_MANAGER occurs. -- It can return errors #27, #33, #35, and #124. If it does, the -- procedure ERROR_HANDLING is called. -- -- WS - The identifier of the workstation on which the -- the segment is to be associated. -- -- SEGMENT - This the identifier of the segment that is to -- be associated with the workstation. GKS_INSTR : CGI_ASSOCIATE_SEGMENT_WITH_WS; CURRENT_ATTRIBUTES : OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES; ERROR_INDICATOR : ERROR_NUMBER; 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 case inquires the GKS_OPERATING_STATE_LIST to see -- if GKS is in the proper state before proceeding. if (CURRENT_OPERATING_STATE /= WSOP) and (CURRENT_OPERATING_STATE /= WSAC) then -- The state must be either workstation is active or -- workstation is open. -- Otherwise, an error exists and must be logged. ERROR_INDICATOR := NOT_WSOP_WSAC; -- error 6 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (ERROR_INDICATOR,"ASSOCIATE_SEGMENT_WITH_WS"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; -- Check if the specified workstation is open. elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then -- The workstation must be open. -- Otherwise, an error exists. ERROR_INDICATOR := WS_NOT_OPEN; -- error 25 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (ERROR_INDICATOR,"ASSOCIATE_SEGMENT_WITH_WS"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; else -- Get the current attributes from the GKS_STATE_LIST. GET_OUTPUT_ATTRIBUTES.GET_ATTRIBUTES(CURRENT_ATTRIBUTES); -- Call workstation manager with parameters. GKS_INSTR.WS_TO_ASSOCIATE_SEGMENT_WITH := WS; GKS_INSTR.SEGMENT_TO_ASSOCIATE_WITH_WS := SEGMENT; GKS_INSTR.ATTRIBUTES_AT_ASSOCIATE := CURRENT_ATTRIBUTES; WS_MANAGER(GKS_INSTR); ERROR_INDICATOR := GKS_INSTR.ERROR_INDICATOR; -- Check for a successful call. If not, only expected -- errors should be returned. Anything else is UNKNOWN. if ERROR_INDICATOR /= SUCCESSFUL then if (ERROR_INDICATOR = WISS_NOT_OPEN) or -- error 27 (ERROR_INDICATOR = WS_CATEGORY_NOT_MO) or -- error 33 (ERROR_INDICATOR = WS_CATEGORY_IS_INPUT) then -- error 35 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING(ERROR_INDICATOR,"ASSOCIATE_SEGMENT_WITH_WS"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; elsif (ERROR_INDICATOR = SEGMENT_NOT_ON_WISS) then -- error 124 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (ERROR_INDICATOR,"ASSOCIATE_SEGMENT_WITH_WS"); 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,"ASSOCIATE_SEGMENT_WITH_WS"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; exception when OTHERS => GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; raise; end; end ASSOCIATE_SEGMENT_WITH_WS; procedure COPY_SEGMENT_TO_WS (WS : in WS_ID; SEGMENT : in SEGMENT_NAME) is -- This procedure begins by checking the operating state. If it is -- not WSOP or WSAC error #6 occurs. Next the specific -- workstation is checked for being open and if not, error #25 -- and the procedure ERROR_HANDLING is called. Otherwise WS_MANAGER -- is called. It can return errors #27, #33, #35, #36, and #124. If -- it does, the procedure ERROR_HANDLING is called. -- -- WS - The identifier of the workstation on which the -- the segment is to be associated. -- -- SEGMENT - This the identifier of the segment that is to -- be associated with the workstation. GKS_INSTR : CGI_COPY_SEGMENT_TO_WS; CURRENT_ATTRIBUTES : OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES; ERROR_INDICATOR : ERROR_NUMBER; 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 inquires the GKS_OPERATING_STATE_LIST to see -- if GKS is in the proper state before proceeding. if (CURRENT_OPERATING_STATE /= WSOP) and (CURRENT_OPERATING_STATE /= WSAC) then -- The state must be either workstation is active or -- workstation is open. -- Otherwise, an error exists. ERROR_INDICATOR := NOT_WSOP_WSAC; -- error 6 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (ERROR_INDICATOR,"COPY_SEGMENT_TO_WS"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; -- Check if the specified segment is open. elsif not WS_IDS.IS_IN_LIST(WS,GKS_STATE_LIST.LIST_OF_OPEN_WS) then -- The workstation must be open. -- Otherwise, an error exists. ERROR_INDICATOR := WS_NOT_OPEN; -- error 25 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (ERROR_INDICATOR,"COPY_SEGMENT_TO_WS"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; else -- Get the current attributes from the GKS_STATE_LIST. GET_OUTPUT_ATTRIBUTES.GET_ATTRIBUTES(CURRENT_ATTRIBUTES); -- Call workstation manager with parameters. GKS_INSTR.WS_TO_COPY_SEGMENT_TO := WS; GKS_INSTR.SEGMENT_TO_COPY_TO_WS := SEGMENT; GKS_INSTR.ATTRIBUTES_AT_COPY := CURRENT_ATTRIBUTES; WS_MANAGER(GKS_INSTR); ERROR_INDICATOR := GKS_INSTR.ERROR_INDICATOR; -- Check for a successful call. If not, only expected -- errors should be returned. Anything else is UNKNOWN. if ERROR_INDICATOR /= SUCCESSFUL then if (ERROR_INDICATOR = WISS_NOT_OPEN) or -- error 27 (ERROR_INDICATOR = WS_CATEGORY_NOT_MO) or -- error 33 (ERROR_INDICATOR = WS_CATEGORY_IS_INPUT) or -- error 35 (ERROR_INDICATOR = WS_IS_WISS) then -- error 36 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING(ERROR_INDICATOR,"COPY_SEGMENT_TO_WS"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; elsif (ERROR_INDICATOR = SEGMENT_NOT_ON_WISS) then -- error 124 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (ERROR_INDICATOR,"COPY_SEGMENT_TO_WS"); 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,"COPY_SEGMENT_TO_WS"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; exception when OTHERS => GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; raise; end; end COPY_SEGMENT_TO_WS; procedure INSERT_SEGMENT (SEGMENT : in SEGMENT_NAME; TRANSFORMATION : in TRANSFORMATION_MATRIX) is -- This procedure begins by checking the operating state. If it is -- not WSAC or SGOP exception #5 occurs. Otherwise the Workstation -- Manager is called. It can return errors #27, #124, or #125. If -- it does, the error is logged and the appropriate exception is -- raised. -- -- SEGMENT - This the identifier of the segment that is to -- be associated with the workstation. -- -- TRANSFORMATION - This is the transformation matrix. GKS_INSTR : CGI_INSERT_SEGMENT; CURRENT_ATTRIBUTES : OUTPUT_ATTRIBUTES_TYPE.OUTPUT_ATTRIBUTES; ERROR_INDICATOR : ERROR_NUMBER; 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 inquires the GKS_OPERATING_STATE_LIST to see -- if GKS is in the proper state before proceeding. if (CURRENT_OPERATING_STATE /= WSAC) and (CURRENT_OPERATING_STATE /= SGOP) then -- The state must be either workstation is active or -- segment is open. -- Otherwise, an error exists. ERROR_INDICATOR := NOT_WSAC_SGOP; -- error 5 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (ERROR_INDICATOR,"INSERT_SEGMENT"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; else -- Get the current attributes from the GKS_STATE_LIST. GET_OUTPUT_ATTRIBUTES.GET_ATTRIBUTES (CURRENT_ATTRIBUTES); -- Call workstation manager with parameters. GKS_INSTR.SEGMENT_TO_INSERT := SEGMENT; GKS_INSTR.INSERT_SEGMENT_TRANSFORMATION := TRANSFORMATION; GKS_INSTR.ATTRIBUTES_AT_INSERT := CURRENT_ATTRIBUTES; WS_MANAGER(GKS_INSTR); ERROR_INDICATOR := GKS_INSTR.ERROR_INDICATOR; -- Check for a successful call. If not, only expected -- errors should be returned. Anything else is UNKNOWN. if ERROR_INDICATOR /= SUCCESSFUL then if (ERROR_INDICATOR = WISS_NOT_OPEN) then -- error 27 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING(ERROR_INDICATOR,"INSERT_SEGMENT"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; elsif (ERROR_INDICATOR = SEGMENT_NOT_ON_WISS) or -- error 124 (ERROR_INDICATOR = SEGMENT_IS_OPEN) then -- error 125 GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (ERROR_INDICATOR,"INSERT_SEGMENT"); 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,"INSERT_SEGMENT"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; exception when OTHERS => GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; raise; end; end INSERT_SEGMENT; end EXTENDED_SEGMENTS;