-- +------------------------------------ -- | Copyright 1992-1997 Future Parallel -- | VLSI Design Lab -- | Library: VFP -- | Designer: Tim Pagden -- | Opened: 11.02.1999 -- +------------------------------------ package body real_class is -- time defined in std.standard -- property functions function string_length ( -- 11.02.1999 a: real ) return integer is use std.textio.all; variable a_real : real; variable real_line : line; variable num_chars : integer := 0; variable result : integer; -- variable num_chars_as_string : string(1 to 2); -- variable real_string : string(1 to 14); variable opline : line; -- file opfile : TEXT is out OUTPUT; begin -- assert false -- report "in string_length" -- severity note; -- copy a so you can use real subtypes (robustly), too a_real := a; -- write a to a line, then L'length should return the number of chars, surely write(real_line, a_real); -- read(real_line, a_real); -- real_string := (real_line.all)'LENGTH; -- for i in 1 to real_max_string -- end loop; -- num_chars := real_string'LENGTH; num_chars := real_line'LENGTH; -- write(opline, num_chars); -- writeline(OUTPUT, opline); deallocate(real_line); result := num_chars; return result; end string_length; -- 04.04.1999 function round ( value : real; technique : rounding_approximation; precision : integer ) return real is variable result : real; begin if technique = fractional_places then -- convert real to f.g format result := round( value, technique, precision); else assert FALSE report "Technique not supported." severity ERROR; end if; return result; end round; end real_class;