text
stringlengths
0
234
procedure Read (This : in out TP_Device; Str : out String) is
Status : UART_Status;
Data : UART_Data_8b (Str'Range);
begin
This.Port.Receive (Data, Status);
if Status /= Ok then
-- No error handling...
raise Program_Error;
end if;
for Index in Str'Range loop
Str (Index) := To_Char (Data (Index));
end loop;
end Read;
----------------------
-- Set_Line_Spacing --
----------------------
procedure Set_Line_Spacing (This : in out TP_Device; Spacing : UInt8) is
begin
Write (This, ASCII.ESC & '3' & To_Char (Spacing));
end Set_Line_Spacing;
---------------
-- Set_Align --
---------------
procedure Set_Align (This : in out TP_Device; Align : Text_Align) is
Mode : Character;
begin
case Align is
when Left => Mode := '0';
when Center => Mode := '1';
when Right => Mode := '2';
end case;
Write (This, ASCII.ESC & 'a' & Mode);
end Set_Align;
----------------------
-- Set_Font_Enlarge --
----------------------
procedure Set_Font_Enlarge (This : in out TP_Device; Height, Width : Boolean) is
Data : UInt8 := 0;
begin
if Height then
Data := Data or 16#01#;
end if;
if Width then
Data := Data or 16#10#;
end if;
Write (This, ASCII.GS & '!' & To_Char (Data));
end Set_Font_Enlarge;
--------------
-- Set_Bold --
--------------
procedure Set_Bold (This : in out TP_Device; Bold : Boolean) is
begin
Write (This, ASCII.ESC & 'E' & To_Char (if Bold then 1 else 0));
end Set_Bold;
----------------------
-- Set_Double_Width --
----------------------
procedure Set_Double_Width (This : in out TP_Device; Double : Boolean) is
begin
if Double then
Write (This, ASCII.ESC & ASCII.SO);
else
Write (This, ASCII.ESC & ASCII.DC4);
end if;
end Set_Double_Width;
----------------
-- Set_UpDown --
----------------
procedure Set_UpDown (This : in out TP_Device; UpDown : Boolean) is
begin
Write (This, ASCII.ESC & '{' & To_Char (if UpDown then 1 else 0));
end Set_UpDown;
------------------
-- Set_Reversed --
------------------
procedure Set_Reversed (This : in out TP_Device; Reversed : Boolean) is
begin
Write (This, ASCII.GS & 'B' & To_Char (if Reversed then 1 else 0));
end Set_Reversed;
--------------------------
-- Set_Underline_Height --
--------------------------