with text_io, starlet, system, condition_handling, calendar; use text_io, starlet, calendar; with DYNAMIC_STRING; use DYNAMIC_STRING; with SYSTEM_LIBRARY; use SYSTEM_LIBRARY; -- package body MISC_ROUTINES is --+---------------------------------------------------------------------- -- -- Unit Type : Package Body type -- Unit Name : MISC_ROUTINES.ADA -- Version : V01.0F -- -- Author : Stephen R. Rainier -- Date : 10/25/85 -- -- -- Purpose : Package of independent, misc. routines. -- -- -- Parameters : Nothing special. -- -- -- Modifications : -- -- Name Date Description of Change -- ---- ---- --------------------- -- -- -- Packages "WITH"ed : system, starlet, condition_handling, calendar, -- text_io, DYNAMIC_STRING, SYSTEM_LIBRARY -- -- -- Procedure/Function "CALL"s : ASCII_TIME, DO_CMD, STRIP_SEARCH -- -- -- Exceptions : -- -- Name Handled/Raised Description -- ---- -------------- ----------- -- -- -- -- Side Effects : -- -- -- Comments : -- --%---------------------------------------------------------------------- -- -- Global Declarations -- procedure ASCII_TIME(YRS : out string; MONS : in out string; DAYS : out string; HRS : out string; MINS : out string) is TD : integer := 4; CURRENT_TIME : time; SECS : day_duration; begin CURRENT_TIME := clock; SECS := seconds(CURRENT_TIME); if integer'image(year(CURRENT_TIME) - 1900)'length = 2 then YRS(1) := '0'; YRS(2) := integer'image(year(CURRENT_TIME) - 1900)(2); else YRS := integer'image(year(CURRENT_TIME) - 1900)(2..3); end if; if integer'image(month(CURRENT_TIME))'length = 2 then MONS(1) := '0'; MONS(2) := integer'image(month(CURRENT_TIME))(2); else MONS := integer'image(month(CURRENT_TIME))(2..3); end if; if MONS > "10" or MONS < "05" then TD := 5; end if; if integer'image(day(CURRENT_TIME))'length = 2 then DAYS(1) := '0'; DAYS(2) := integer'image(day(CURRENT_TIME))(2); else DAYS := integer'image(day(CURRENT_TIME))(2..3); end if; if integer'image(integer(SECS)/3600 - TD)'length = 2 then HRS(1) := '0'; HRS(2) := integer'image(integer(SECS)/3600 - TD)(2); else HRS := integer'image(integer(SECS)/3600 - TD)(2..3); end if; if integer'image((integer(SECS) - ((integer(SECS)/3600)*3600))/60)'length = 2 then MINS(1) := '0'; MINS(2):=integer'image((integer(SECS)-((integer(SECS)/3600)*3600))/60)(2); else MINS:=integer'image((integer(SECS)-((integer(SECS)/3600)*3600))/60)(2..3); end if; exception when others => raise; end ASCII_TIME; procedure STRIP_SEARCH(FILE_NAME : in out DYN_STRING; EXTENSION : out DYN_STRING) is POS : integer; begin POS := INDEX(FILE_NAME, D_STRING("."), 1); if POS = 0 then EXTENSION := D_STRING(""); else EXTENSION := SUBSTRING(FILE_NAME, POS, LENGTH(FILE_NAME) - POS + 1); FILE_NAME := SUBSTRING(FILE_NAME, 1, POS - 1); end if; exception when constraint_error => FILE_NAME := D_STRING(""); EXTENSION := D_STRING(""); end STRIP_SEARCH; procedure DO_CMD(LINE : in DYN_STRING; IN_FILE : in string := ""; OUT_FILE : in string := ""; ECHO_FLAG : boolean := false) is PROCESS_ID : system.unsigned_longword := 0; COMPLETION_STATUS, PRI, PRI2 : system.unsigned_longword := 0; STATUS : condition_handling.cond_value_type := 0; begin if ECHO_FLAG then -- if echo, then printout the command -- put(">");put(STR(LINE));put(ascii.cr);new_line; end if; SETPRI(STATUS => COMPLETION_STATUS, PRI => 5, PRVPRI => PRI); SPAWN_DCL(STATUS, STR(LINE), IN_FILE, OUT_FILE, 0, "", PROCESS_ID, COMPLETION_STATUS); SETPRI(STATUS => COMPLETION_STATUS, PRI => PRI, PRVPRI => PRI2); end DO_CMD; begin null; end MISC_ROUTINES;