terminal_interface-curses-text_io__ads.htm 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  2. <HTML><HEAD><TITLE>terminal_interface-curses-text_io.ads</TITLE></HEAD>
  3. <BODY>
  4. <HR><DIV ALIGN="center"><H1> File : terminal_interface-curses-text_io.ads </H1></DIV><HR>
  5. <PRE>
  6. <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
  7. <FONT COLOR=green><EM>-- --</EM></FONT>
  8. <FONT COLOR=green><EM>-- <A HREF="http://www.gnat.com">GNAT</A> ncurses Binding --</EM></FONT>
  9. <FONT COLOR=green><EM>-- --</EM></FONT>
  10. <FONT COLOR=green><EM>-- Terminal_Interface.Curses.Text_IO --</EM></FONT>
  11. <FONT COLOR=green><EM>-- --</EM></FONT>
  12. <FONT COLOR=green><EM>-- S P E C --</EM></FONT>
  13. <FONT COLOR=green><EM>-- --</EM></FONT>
  14. <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
  15. <FONT COLOR=green><EM>-- Copyright (c) 1998 Free Software Foundation, Inc. --</EM></FONT>
  16. <FONT COLOR=green><EM>-- --</EM></FONT>
  17. <FONT COLOR=green><EM>-- Permission is hereby granted, free of charge, to any person obtaining a --</EM></FONT>
  18. <FONT COLOR=green><EM>-- copy of this software and associated documentation files (the --</EM></FONT>
  19. <FONT COLOR=green><EM>-- "Software"), to deal in the Software without restriction, including --</EM></FONT>
  20. <FONT COLOR=green><EM>-- without limitation the rights to use, copy, modify, merge, publish, --</EM></FONT>
  21. <FONT COLOR=green><EM>-- distribute, distribute with modifications, sublicense, and/or sell --</EM></FONT>
  22. <FONT COLOR=green><EM>-- copies of the Software, and to permit persons to whom the Software is --</EM></FONT>
  23. <FONT COLOR=green><EM>-- furnished to do so, subject to the following conditions: --</EM></FONT>
  24. <FONT COLOR=green><EM>-- --</EM></FONT>
  25. <FONT COLOR=green><EM>-- The above copyright notice and this permission notice shall be included --</EM></FONT>
  26. <FONT COLOR=green><EM>-- in all copies or substantial portions of the Software. --</EM></FONT>
  27. <FONT COLOR=green><EM>-- --</EM></FONT>
  28. <FONT COLOR=green><EM>-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --</EM></FONT>
  29. <FONT COLOR=green><EM>-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --</EM></FONT>
  30. <FONT COLOR=green><EM>-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --</EM></FONT>
  31. <FONT COLOR=green><EM>-- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --</EM></FONT>
  32. <FONT COLOR=green><EM>-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --</EM></FONT>
  33. <FONT COLOR=green><EM>-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --</EM></FONT>
  34. <FONT COLOR=green><EM>-- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --</EM></FONT>
  35. <FONT COLOR=green><EM>-- --</EM></FONT>
  36. <FONT COLOR=green><EM>-- Except as contained in this notice, the name(s) of the above copyright --</EM></FONT>
  37. <FONT COLOR=green><EM>-- holders shall not be used in advertising or otherwise to promote the --</EM></FONT>
  38. <FONT COLOR=green><EM>-- sale, use or other dealings in this Software without prior written --</EM></FONT>
  39. <FONT COLOR=green><EM>-- authorization. --</EM></FONT>
  40. <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
  41. <FONT COLOR=green><EM>-- Author: Juergen Pfeifer, 1996</EM></FONT>
  42. <FONT COLOR=green><EM>-- Version Control:</EM></FONT>
  43. <FONT COLOR=green><EM>-- @Revision: 1.13 @</EM></FONT>
  44. <FONT COLOR=green><EM>-- Binding Version 01.00</EM></FONT>
  45. <FONT COLOR=green><EM>------------------------------------------------------------------------------</EM></FONT>
  46. <b>with</b> Ada.Text_IO;
  47. <b>with</b> Ada.IO_Exceptions;
  48. <b>package</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<FONT COLOR=red><A NAME="ref_44_35" HREF="terminal_interface-curses-text_io__adb.htm#ref_42_40">Text_IO</A></FONT> <b>is</b>
  49. <b>use</b> <b>type</b> Ada.Text_IO.Count;
  50. <b>subtype</b> <FONT COLOR=red><A NAME="ref_47_12">Count</A></FONT> <b>is</b> Ada.Text_IO.Count;
  51. <b>subtype</b> <FONT COLOR=red><A NAME="ref_48_12">Positive_Count</A></FONT> <b>is</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A> <b>range</b> 1 .. <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>'Last;
  52. <b>subtype</b> <FONT COLOR=red><A NAME="ref_50_12">Field</A></FONT> <b>is</b> Ada.Text_IO.Field;
  53. <b>subtype</b> <FONT COLOR=red><A NAME="ref_51_12">Number_Base</A></FONT> <b>is</b> Integer <b>range</b> 2 .. 16;
  54. <b>type</b> <FONT COLOR=red><A NAME="ref_53_9">Type_Set</A></FONT> <b>is</b> (<FONT COLOR=red><A NAME="ref_53_22">Lower_Case</A></FONT>, <FONT COLOR=red><A NAME="ref_53_34">Upper_Case</A></FONT>, <FONT COLOR=red><A NAME="ref_53_46">Mixed_Case</A></FONT>);
  55. <FONT COLOR=green><EM>-- For most of the routines you will see a version without a Window</EM></FONT>
  56. <FONT COLOR=green><EM>-- type parameter. They will operate on a default window, which can</EM></FONT>
  57. <FONT COLOR=green><EM>-- be set by the user. It is initially equal to Standard_Window.</EM></FONT>
  58. <b>procedure</b> <FONT COLOR=red><A NAME="ref_59_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_46_14">Set_Window</A></FONT> (<FONT COLOR=red><A NAME="ref_59_26" HREF="terminal_interface-curses-text_io__adb.htm#ref_46_26">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>);
  59. <FONT COLOR=green><EM>-- Set Win as the default window</EM></FONT>
  60. <b>function</b> <FONT COLOR=red><A NAME="ref_62_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_52_13">Get_Window</A></FONT> <b>return</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>;
  61. <FONT COLOR=green><EM>-- Get the current default window</EM></FONT>
  62. <b>procedure</b> <FONT COLOR=red><A NAME="ref_65_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_63_14">Flush</A></FONT> (<FONT COLOR=red><A NAME="ref_65_21" HREF="terminal_interface-curses-text_io__adb.htm#ref_63_21">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>);
  63. <b>procedure</b> <FONT COLOR=red><A NAME="ref_66_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_69_14">Flush</A></FONT>;
  64. <FONT COLOR=green><EM>--------------------------------------------</EM></FONT>
  65. <FONT COLOR=green><EM>-- Specification of line and page lengths --</EM></FONT>
  66. <FONT COLOR=green><EM>--------------------------------------------</EM></FONT>
  67. <FONT COLOR=green><EM>-- There are no set routines in this package. I assume, that you allocate</EM></FONT>
  68. <FONT COLOR=green><EM>-- the window with an appropriate size.</EM></FONT>
  69. <FONT COLOR=green><EM>-- A scroll-window is interpreted as an page with unbounded page length,</EM></FONT>
  70. <FONT COLOR=green><EM>-- i.e. it returns the conventional 0 as page length.</EM></FONT>
  71. <b>function</b> <FONT COLOR=red><A NAME="ref_77_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_84_13">Line_Length</A></FONT> (<FONT COLOR=red><A NAME="ref_77_26" HREF="terminal_interface-curses-text_io__adb.htm#ref_84_26">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>;
  72. <b>function</b> <FONT COLOR=red><A NAME="ref_78_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_96_13">Line_Length</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>;
  73. <b>function</b> <FONT COLOR=red><A NAME="ref_80_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_102_13">Page_Length</A></FONT> (<FONT COLOR=red><A NAME="ref_80_26" HREF="terminal_interface-curses-text_io__adb.htm#ref_102_26">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>;
  74. <b>function</b> <FONT COLOR=red><A NAME="ref_81_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_118_13">Page_Length</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_47_12">Count</A>;
  75. <FONT COLOR=green><EM>------------------------------------</EM></FONT>
  76. <FONT COLOR=green><EM>-- Column, Line, and Page Control --</EM></FONT>
  77. <FONT COLOR=green><EM>------------------------------------</EM></FONT>
  78. <b>procedure</b> <FONT COLOR=red><A NAME="ref_86_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_127_14">New_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_86_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_127_24">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_86_41" HREF="terminal_interface-curses-text_io__adb.htm#ref_127_41">Spacing</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1);
  79. <b>procedure</b> <FONT COLOR=red><A NAME="ref_87_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_144_14">New_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_87_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_144_24">Spacing</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A> := 1);
  80. <b>procedure</b> <FONT COLOR=red><A NAME="ref_89_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_150_14">New_Page</A></FONT> (<FONT COLOR=red><A NAME="ref_89_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_150_24">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>);
  81. <b>procedure</b> <FONT COLOR=red><A NAME="ref_90_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_156_14">New_Page</A></FONT>;
  82. <b>procedure</b> <FONT COLOR=red><A NAME="ref_92_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_162_14">Set_Col</A></FONT> (<FONT COLOR=red><A NAME="ref_92_23" HREF="terminal_interface-curses-text_io__adb.htm#ref_162_23">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_92_41" HREF="terminal_interface-curses-text_io__adb.htm#ref_162_41">To</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>);
  83. <b>procedure</b> <FONT COLOR=red><A NAME="ref_93_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_190_14">Set_Col</A></FONT> (<FONT COLOR=red><A NAME="ref_93_23" HREF="terminal_interface-curses-text_io__adb.htm#ref_190_23">To</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>);
  84. <b>procedure</b> <FONT COLOR=red><A NAME="ref_95_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_196_14">Set_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_95_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_196_24">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_95_41" HREF="terminal_interface-curses-text_io__adb.htm#ref_196_41">To</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>);
  85. <b>procedure</b> <FONT COLOR=red><A NAME="ref_96_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_219_14">Set_Line</A></FONT> (<FONT COLOR=red><A NAME="ref_96_24" HREF="terminal_interface-curses-text_io__adb.htm#ref_219_24">To</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>);
  86. <b>function</b> <FONT COLOR=red><A NAME="ref_98_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_225_13">Col</A></FONT> (<FONT COLOR=red><A NAME="ref_98_18" HREF="terminal_interface-curses-text_io__adb.htm#ref_225_18">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>;
  87. <b>function</b> <FONT COLOR=red><A NAME="ref_99_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_239_13">Col</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>;
  88. <b>function</b> <FONT COLOR=red><A NAME="ref_101_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_245_13">Line</A></FONT> (<FONT COLOR=red><A NAME="ref_101_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_245_19">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>) <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>;
  89. <b>function</b> <FONT COLOR=red><A NAME="ref_102_13" HREF="terminal_interface-curses-text_io__adb.htm#ref_259_13">Line</A></FONT> <b>return</b> <A HREF="terminal_interface-curses-text_io__ads.htm#ref_48_12">Positive_Count</A>;
  90. <FONT COLOR=green><EM>-----------------------</EM></FONT>
  91. <FONT COLOR=green><EM>-- Characters-Output --</EM></FONT>
  92. <FONT COLOR=green><EM>-----------------------</EM></FONT>
  93. <b>procedure</b> <FONT COLOR=red><A NAME="ref_108_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_269_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_108_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_269_19">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_108_37" HREF="terminal_interface-curses-text_io__adb.htm#ref_269_37">Item</A></FONT> : <b>in</b> Character);
  94. <b>procedure</b> <FONT COLOR=red><A NAME="ref_109_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_287_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_109_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_287_19">Item</A></FONT> : <b>in</b> Character);
  95. <FONT COLOR=green><EM>--------------------</EM></FONT>
  96. <FONT COLOR=green><EM>-- Strings-Output --</EM></FONT>
  97. <FONT COLOR=green><EM>--------------------</EM></FONT>
  98. <b>procedure</b> <FONT COLOR=red><A NAME="ref_115_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_297_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_115_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_297_19">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>; <FONT COLOR=red><A NAME="ref_115_37" HREF="terminal_interface-curses-text_io__adb.htm#ref_297_37">Item</A></FONT> : <b>in</b> String);
  99. <b>procedure</b> <FONT COLOR=red><A NAME="ref_116_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_315_14">Put</A></FONT> (<FONT COLOR=red><A NAME="ref_116_19" HREF="terminal_interface-curses-text_io__adb.htm#ref_315_19">Item</A></FONT> : <b>in</b> String);
  100. <b>procedure</b> <FONT COLOR=red><A NAME="ref_118_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_321_14">Put_Line</A></FONT>
  101. (<FONT COLOR=red><A NAME="ref_119_7" HREF="terminal_interface-curses-text_io__adb.htm#ref_322_7">Win</A></FONT> : <b>in</b> <A HREF="terminal_interface-curses__ads.htm#ref_57_9">Window</A>;
  102. <FONT COLOR=red><A NAME="ref_120_7" HREF="terminal_interface-curses-text_io__adb.htm#ref_323_7">Item</A></FONT> : <b>in</b> String);
  103. <b>procedure</b> <FONT COLOR=red><A NAME="ref_122_14" HREF="terminal_interface-curses-text_io__adb.htm#ref_330_14">Put_Line</A></FONT>
  104. (<FONT COLOR=red><A NAME="ref_123_7" HREF="terminal_interface-curses-text_io__adb.htm#ref_331_7">Item</A></FONT> : <b>in</b> String);
  105. <FONT COLOR=green><EM>-- Exceptions</EM></FONT>
  106. <FONT COLOR=red><A NAME="ref_127_4">Status_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Status_Error;
  107. <FONT COLOR=red><A NAME="ref_128_4">Mode_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Mode_Error;
  108. <FONT COLOR=red><A NAME="ref_129_4">Name_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Name_Error;
  109. <FONT COLOR=red><A NAME="ref_130_4">Use_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Use_Error;
  110. <FONT COLOR=red><A NAME="ref_131_4">Device_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Device_Error;
  111. <FONT COLOR=red><A NAME="ref_132_4">End_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.End_Error;
  112. <FONT COLOR=red><A NAME="ref_133_4">Data_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Data_Error;
  113. <FONT COLOR=red><A NAME="ref_134_4">Layout_Error</A></FONT> : <b>exception</b> <b>renames</b> Ada.IO_Exceptions.Layout_Error;
  114. <b>end</b> <A HREF="terminal_interface__ads.htm#ref_42_9">Terminal_Interface</A>.<A HREF="terminal_interface-curses__ads.htm#ref_49_28">Curses</A>.<A HREF="terminal_interface-curses-text_io__ads.htm#ref_44_35">Text_IO</A>;
  115. </PRE></BODY></HTML>