X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=Ada95%2Fsrc%2Fterminal_interface-curses-text_io.adb;h=c7238e26e5d9769f9c276650c16171d3917e73fc;hp=01076921c6170f0f110a31418a83de58fc53d18b;hb=a50b059f71e787a32e396c0e5b40cee4230c997e;hpb=46722468f47c2b77b3987729b4bcf2321cccfd01 diff --git a/Ada95/src/terminal_interface-curses-text_io.adb b/Ada95/src/terminal_interface-curses-text_io.adb index 01076921..c7238e26 100644 --- a/Ada95/src/terminal_interface-curses-text_io.adb +++ b/Ada95/src/terminal_interface-curses-text_io.adb @@ -7,7 +7,8 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright 2020 Thomas E. Dickey -- +-- Copyright 1999-2011,2014 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -34,16 +35,16 @@ -- authorization. -- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 --- Contact: http://www.familiepfeifer.de/Contact.aspx?Lang=en -- Version Control: --- $Revision: 1.13 $ +-- $Revision: 1.23 $ +-- $Date: 2020/02/02 23:34:34 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ package body Terminal_Interface.Curses.Text_IO is Default_Window : Window := Null_Window; - procedure Set_Window (Win : in Window) + procedure Set_Window (Win : Window) is begin Default_Window := Win; @@ -60,7 +61,7 @@ package body Terminal_Interface.Curses.Text_IO is end Get_Window; pragma Inline (Get_Window); - procedure Flush (Win : in Window) + procedure Flush (Win : Window) is begin Refresh (Win); @@ -81,15 +82,15 @@ package body Terminal_Interface.Curses.Text_IO is -- A scroll-window is interpreted as an page with unbounded page length, -- i.e. it returns the conventional 0 as page length. - function Line_Length (Win : in Window) return Count + function Line_Length (Win : Window) return Count is N_Lines : Line_Count; N_Cols : Column_Count; begin Get_Size (Win, N_Lines, N_Cols); - if Natural (N_Cols) > Natural (Count'Last) then - raise Layout_Error; - end if; + -- if Natural (N_Cols) > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; return Count (N_Cols); end Line_Length; @@ -99,7 +100,7 @@ package body Terminal_Interface.Curses.Text_IO is return Line_Length (Get_Window); end Line_Length; - function Page_Length (Win : in Window) return Count + function Page_Length (Win : Window) return Count is N_Lines : Line_Count; N_Cols : Column_Count; @@ -108,9 +109,9 @@ package body Terminal_Interface.Curses.Text_IO is return 0; else Get_Size (Win, N_Lines, N_Cols); - if Natural (N_Lines) > Natural (Count'Last) then - raise Layout_Error; - end if; + -- if Natural (N_Lines) > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; return Count (N_Lines); end if; end Page_Length; @@ -124,11 +125,11 @@ package body Terminal_Interface.Curses.Text_IO is ------------------------------------ -- Column, Line, and Page Control -- ------------------------------------ - procedure New_Line (Win : in Window; Spacing : in Positive_Count := 1) + procedure New_Line (Win : Window; Spacing : Positive_Count := 1) is P_Size : constant Count := Page_Length (Win); begin - if Spacing not in Positive_Count then + if not Spacing'Valid then raise Constraint_Error; end if; @@ -141,13 +142,13 @@ package body Terminal_Interface.Curses.Text_IO is end loop; end New_Line; - procedure New_Line (Spacing : in Positive_Count := 1) + procedure New_Line (Spacing : Positive_Count := 1) is begin New_Line (Get_Window, Spacing); end New_Line; - procedure New_Page (Win : in Window) + procedure New_Page (Win : Window) is begin Clear (Win); @@ -159,14 +160,14 @@ package body Terminal_Interface.Curses.Text_IO is New_Page (Get_Window); end New_Page; - procedure Set_Col (Win : in Window; To : in Positive_Count) + procedure Set_Col (Win : Window; To : Positive_Count) is Y : Line_Position; X1 : Column_Position; X2 : Column_Position; N : Natural; begin - if To not in Positive_Count then + if not To'Valid then raise Constraint_Error; end if; @@ -187,24 +188,25 @@ package body Terminal_Interface.Curses.Text_IO is end if; end Set_Col; - procedure Set_Col (To : in Positive_Count) + procedure Set_Col (To : Positive_Count) is begin Set_Col (Get_Window, To); end Set_Col; - procedure Set_Line (Win : in Window; To : in Positive_Count) + procedure Set_Line (Win : Window; To : Positive_Count) is Y1 : Line_Position; Y2 : Line_Position; X : Column_Position; N : Natural; begin - if To not in Positive_Count then + if not To'Valid then raise Constraint_Error; end if; Get_Cursor_Position (Win, Y1, X); + pragma Warnings (Off, X); -- unreferenced N := Natural (To); N := N - 1; Y2 := Line_Position (N); if Y2 < Y1 then @@ -216,13 +218,13 @@ package body Terminal_Interface.Curses.Text_IO is end if; end Set_Line; - procedure Set_Line (To : in Positive_Count) + procedure Set_Line (To : Positive_Count) is begin Set_Line (Get_Window, To); end Set_Line; - function Col (Win : in Window) return Positive_Count + function Col (Win : Window) return Positive_Count is Y : Line_Position; X : Column_Position; @@ -230,9 +232,9 @@ package body Terminal_Interface.Curses.Text_IO is begin Get_Cursor_Position (Win, Y, X); N := Natural (X); N := N + 1; - if N > Natural (Count'Last) then - raise Layout_Error; - end if; + -- if N > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; return Positive_Count (N); end Col; @@ -242,7 +244,7 @@ package body Terminal_Interface.Curses.Text_IO is return Col (Get_Window); end Col; - function Line (Win : in Window) return Positive_Count + function Line (Win : Window) return Positive_Count is Y : Line_Position; X : Column_Position; @@ -250,9 +252,9 @@ package body Terminal_Interface.Curses.Text_IO is begin Get_Cursor_Position (Win, Y, X); N := Natural (Y); N := N + 1; - if N > Natural (Count'Last) then - raise Layout_Error; - end if; + -- if N > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; return Positive_Count (N); end Line; @@ -266,7 +268,7 @@ package body Terminal_Interface.Curses.Text_IO is -- Characters Output -- ----------------------- - procedure Put (Win : in Window; Item : in Character) + procedure Put (Win : Window; Item : Character) is P_Size : constant Count := Page_Length (Win); Y : Line_Position; @@ -284,7 +286,7 @@ package body Terminal_Interface.Curses.Text_IO is Add (Win, Item); end Put; - procedure Put (Item : in Character) + procedure Put (Item : Character) is begin Put (Get_Window, Item); @@ -294,7 +296,7 @@ package body Terminal_Interface.Curses.Text_IO is -- Strings-Output -- -------------------- - procedure Put (Win : in Window; Item : in String) + procedure Put (Win : Window; Item : String) is P_Size : constant Count := Page_Length (Win); Y : Line_Position; @@ -312,15 +314,15 @@ package body Terminal_Interface.Curses.Text_IO is Add (Win, Item); end Put; - procedure Put (Item : in String) + procedure Put (Item : String) is begin Put (Get_Window, Item); end Put; procedure Put_Line - (Win : in Window; - Item : in String) + (Win : Window; + Item : String) is begin Put (Win, Item); @@ -328,7 +330,7 @@ package body Terminal_Interface.Curses.Text_IO is end Put_Line; procedure Put_Line - (Item : in String) + (Item : String) is begin Put_Line (Get_Window, Item);