-------------------------------------------------------------------- -- -- NAME: BUILD_NEW_GKSM_DATA_RECORD - BODY -- DISCREPANCY REPORTS: -- -------------------------------------------------------------------- -- file: BUILD_NEW_GKSM_DATA_RECORD.ADA -- level: 0a , 0b , 0c , 1a, 1b , 1c , 2a , 2b , 2c separate (GKS) procedure BUILD_NEW_GKSM_DATA_RECORD ( TYPE_OF_ITEM : in GKSM_ITEM_TYPE; ITEM_DATA : in STRING; ITEM : out GKSM_DATA_RECORD ) is -- The application programmer must be able to write non- -- graphical data into the metafile. This can be provided -- by allowing character strings to be output. Numeric data -- must be converted to a string by the application programmer -- prior to calling BUILD_NEW_GKSM_DATA_RECORD. A function, -- ITEM_DATA_RECORD_STRING, is provided as a means to convert -- item data records into strings. -- This procedure constructs and returns a GKSM_DATA_RECORD for -- GKSM_ITEM_TYPE GKSM_USER_ITEM. -- TYPE_OF_ITEM - is the natural number that indicates which -- GKSM_ITEM_TYPE the GKSM_DATA_RECORD must be built with. -- This routine builds GKSM_DATA_RECORD's only for a value of -- TYPE_OF_ITEM equal to GKSM_USER_ITEM (GKSM_USER_ITEM -- has a value of 101). -- ITEM_DATA - is the string that must be put into the -- GKSM_DATA_RECORD, this cannot be done directly because -- GKSM_DATA_RECORD is a private type. -- ITEM - is the GKSM_DATA_RECORD returned by the routine -- containing the ITEM_DATA. 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; if TYPE_OF_ITEM /= GKS.GKSM_USER_ITEM then GKS_ERROR_STATE_LIST.ERROR_STATE := ON; ERROR_HANDLING (GKS_ERRORS.ITEM_TYPE_NOT_ALLOWED, --Error 160 "BUILD_NEW_GKSM_DATA_RECORD"); GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; end if; ITEM := GKSM_DATA_RECORD' ( TYPE_OF_ITEM => GKSM_USER_ITEM, USER_ITEM => new STRING'(ITEM_DATA), LENGTH => 0 ); 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, "BUILD_NEW_GKSM_DATA_RECORD"); -- Error 2501 GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; exception when OTHERS => GKS_ERROR_STATE_LIST.ERROR_STATE := OFF; raise; end; end BUILD_NEW_GKSM_DATA_RECORD;