with INTEGER_TEXT_IO; use INTEGER_TEXT_IO; package body STRING_HANDLER is procedure APPEND_INTEGER(THE_STRING : in out string; THE_INT : integer; LAST_POSITION : in out integer) is TEMP_STRING : string(1..20); begin INTEGER_TEXT_IO.PUT (ITEM => THE_INT, TO => TEMP_STRING); for I in TEMP_STRING'range loop if TEMP_STRING(I) /= ' ' then LAST_POSITION := LAST_POSITION + 1; THE_STRING(LAST_POSITION) := TEMP_STRING(I); end if; end loop; end APPEND_INTEGER; procedure APPEND_HEX_WORD(THE_STRING : in out string; THE_INT : integer; LAST_POSITION : in out integer) is REMAINDER : integer; function NIBBLE_TO_HEX(NIBBLE : integer) return character is TEMP : integer; begin -- NIBBLE_TO_HEX if NIBBLE > 9 then TEMP := NIBBLE + 55; else TEMP := NIBBLE + 48; end if; return character'val(TEMP); end NIBBLE_TO_HEX; begin REMAINDER := THE_INT; THE_STRING(LAST_POSITION + 1) := NIBBLE_TO_HEX(REMAINDER/4096); REMAINDER := REMAINDER - (REMAINDER/4096)*4096; THE_STRING(LAST_POSITION + 2) := NIBBLE_TO_HEX(REMAINDER/256); REMAINDER := REMAINDER - (REMAINDER/256)*256; THE_STRING(LAST_POSITION + 3) := NIBBLE_TO_HEX(REMAINDER/16); REMAINDER := REMAINDER - (REMAINDER/16)*16; THE_STRING(LAST_POSITION + 4) := NIBBLE_TO_HEX(REMAINDER); LAST_POSITION := LAST_POSITION + 4; end APPEND_HEX_WORD; procedure APPEND_STRING(THE_STRING : in out string; SMALLER_STRING : in string; LAST_POSITION : in out integer) is FIRST_POSITION : integer := LAST_POSITION + 1; begin LAST_POSITION := LAST_POSITION + SMALLER_STRING'length; THE_STRING(FIRST_POSITION .. LAST_POSITION) := SMALLER_STRING; end APPEND_STRING; end STRING_HANDLER;