------------------------------------------------------------------ -- -- NAME: GKSM_INT_WSD_OPERATIONS - BODY -- DISCREPANCY REPORTS: ------------------------------------------------------------------ -- file: GKSM_INT_WSD_OPS_B.ADA -- level: 0a,1a,2a,0b,1b,2b,0c,1c,2c with GKS_ERRORS; with GKSM_INT_WS_TABLES; with GKSM_TYPES; with METAFILE_WS_TABLES; package body GKSM_INT_WSD_OPERATIONS is -- This package contains procedures named for the workstation -- control functions within GKS. Each of these perform necessary -- workstation housekeeping activities, such as adding or deleting -- the workstation state list to the list of active state lists. -- These procedures also handle the opening and closing of the -- actual physical metafile. procedure OPEN_WS (WS : in WS_ID; CONNECTION : in ACCESS_CONNECTION_ID_TYPE; TYPE_OF_WS : in WS_TYPE; ERROR_INDICATOR : in out ERROR_NUMBER) is -- This procedure is called by the GKSM workstation driver whenever -- a GKSM interpreter workstation is requested to be opened. -- This procedure performs the necessary activities to open and -- initialize the workstation. A GKSM Interpreter procedure is -- called to open a physical metafile. -- -- The parameters used in this procedure are: -- WS - The workstation id the application programmer assigned to -- associate the workstation with. -- CONNECTION - The ASCII name of the metafile to be interpreted. -- TYPE_OF_WS - The type of workstation that is being opened. -- ERROR_INDICATOR - contains any error that may be returned while -- attempting -- to open the workstation . CONNECTION_ID : VARIABLE_CONNECTION_ID(CONNECTION'length); -- Creates an object the length of the string access type passed in. METAFILE_SL : INTERPRETER_TABLES.METAFILE_STATE_LIST_PTR; -- Creates a pointer object to a metafile state list. ITEM_TYPE : GKSM_TYPES.GKSM_ITEMS; -- An object to contain a GKSM item number. begin -- Create, initialize, and add a new workstation state list -- (for this workstation) to the current list of workstation -- state lists. CONNECTION_ID.CONNECT := CONNECTION.all; GKSM_INT_WS_TABLES.ADD_STATE_LIST_TO_LIST (WS, CONNECTION_ID, TYPE_OF_WS, ERROR_INDICATOR); If ERROR_INDICATOR = GKS_ERRORS.SUCCESSFUL then -- Create, initialize, and add a new metafile state list -- (for this workstation) to the current list of metafile -- state lists. INTERPRETER_TABLES.ADD_METAFILE_STATE_LIST (WS, ERROR_INDICATOR); If ERROR_INDICATOR = GKS_ERRORS.SUCCESSFUL then -- Get the pointer to the metafile state list. METAFILE_SL := INTERPRETER_TABLES. GET_METAFILE_STATE_LIST_PTR(WS); -- The GKSM Interpreter procedure OPEN_METAFILE is -- called with the metafile file object (as contained in the -- metafile state list) and connection_id parameters. -- -- The metafile file object is used for all operations on -- the physical metafile, such as, create, open, read, -- write, and close. -- -- The connection_id is used as the file name for the -- physical metafile. -- -- If the opening of the metafile is unsuccessful then the -- workstation and metafile state list are deleted from the -- list of state lists and an error indication is returned -- to the calling procedure. GKSM_INTERPRETER.OPEN_METAFILE (METAFILE_SL.METAFILE_ID, CONNECTION.all); -- The GKSM Interpreter procedure READ_OPCODE is called -- in order for the metafile pointer to be positioned -- at the first item of the metafile. GKSM_INTERPRETER.READ_OPCODE (METAFILE_SL.METAFILE_ID, ITEM_TYPE); end if; end if; exception when OTHERS => ERROR_INDICATOR := GKS_ERRORS.WS_CANNOT_OPEN; end OPEN_WS; procedure CLOSE_WS (WS_STATE_LIST : in out WS_STATE_LIST_TYPES.WS_STATE_LIST_PTR; METAFILE_SL : in out INTERPRETER_TABLES. METAFILE_STATE_LIST_PTR) is -- This procedure is called whenever a GKSM interpreter workstation -- is requested to be closed. This procedure closes the currently -- opened physical metafile and performs the necessary activities -- to close the workstation, such as, deleting the workstation and -- metafile state lists from the list of state lists. -- -- The parameters used in this procedure are: -- WS_STATE_LIST - a pointer to a workstation state list. -- METAFILE_SL - a pointer to a metafile state list. begin -- Call the GKSM Interpreter procedure CLOSE_METAFILE procedure to -- close the currently opened physical metafile. GKSM_INTERPRETER.CLOSE_METAFILE (METAFILE_SL.METAFILE_ID); -- Close the workstation by deleting the WS_STATE_LIST from -- the current list of active workstation state lists. GKSM_INT_WS_TABLES.DELETE_STATE_LIST_FROM_LIST (WS_STATE_LIST. WORKSTATION_ID); -- Delete the METAFILE_STATE_LIST from the current list of -- active metafile state lists. INTERPRETER_TABLES.DELETE_METAFILE_STATE_LIST (METAFILE_SL. WORKSTATION_ID); end CLOSE_WS; end GKSM_INT_WSD_OPERATIONS;