-- © Copyright 2000 by John Halleck, All Rights Reserved.
-- Display a line of Braille cells as psudo Braille.
with Ada.Text_IO; use Ada.Text_IO;
package body Braille.Display.Print is
procedure Put (Given : Braille_String;
Indent : String := "";
Suppress_Blanks : Boolean := True) is
Final_Line : Display_String (Given'Range);
Last_Character : Integer range 0 .. Given'Length;
begin
New_Line;
for I in 1 .. Given'Length loop
Final_Line (I) := Translate (Given (I), Suppress_Blanks);
end loop;
for Row in 1 .. 3 loop -- For each printable row.
-- Deal with any indention of the text.
if Row = 1 then
Put (Indent);
else
for I in 1 .. Indent'Length loop
Put (' ');
end loop;
end if;
-- Find the end of the line.
Last_Character := 0;
for Index in reverse Given'Range loop
if Final_Line (Index) (Row) /= " " then
Last_Character := Index;
exit;
end if;
end loop;
-- And print to the non-blank end.
for Offset in 1 .. Last_Character loop
if Offset /= 1 then
Put (" ");
end if;
Put (String (Final_Line (Offset) (Row)));
end loop;
New_Line;
end loop;
end Put;
end Braille.Display.Print;
This page is http://www.cc.utah.edu/~nahaj/ada/braille/braille-display-print.adb.html
© Copyright 2000 by John Halleck, All Rights Reserved.
This snapshot was last modified on August 24th, 2000