terminal_interface-curses-aux.ads.m4 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. -- -*- ada -*-
  2. define(`HTMLNAME',`terminal_interface-curses-aux__ads.htm')dnl
  3. include(M4MACRO)dnl
  4. ------------------------------------------------------------------------------
  5. -- --
  6. -- GNAT ncurses Binding --
  7. -- --
  8. -- Terminal_Interface.Curses.Aux --
  9. -- --
  10. -- S P E C --
  11. -- --
  12. ------------------------------------------------------------------------------
  13. -- Copyright (c) 1998 Free Software Foundation, Inc. --
  14. -- --
  15. -- Permission is hereby granted, free of charge, to any person obtaining a --
  16. -- copy of this software and associated documentation files (the --
  17. -- "Software"), to deal in the Software without restriction, including --
  18. -- without limitation the rights to use, copy, modify, merge, publish, --
  19. -- distribute, distribute with modifications, sublicense, and/or sell --
  20. -- copies of the Software, and to permit persons to whom the Software is --
  21. -- furnished to do so, subject to the following conditions: --
  22. -- --
  23. -- The above copyright notice and this permission notice shall be included --
  24. -- in all copies or substantial portions of the Software. --
  25. -- --
  26. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS --
  27. -- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF --
  28. -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. --
  29. -- IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, --
  30. -- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR --
  31. -- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR --
  32. -- THE USE OR OTHER DEALINGS IN THE SOFTWARE. --
  33. -- --
  34. -- Except as contained in this notice, the name(s) of the above copyright --
  35. -- holders shall not be used in advertising or otherwise to promote the --
  36. -- sale, use or other dealings in this Software without prior written --
  37. -- authorization. --
  38. ------------------------------------------------------------------------------
  39. -- Author: Juergen Pfeifer, 1996
  40. -- Version Control:
  41. -- $Revision: 1.16 $
  42. -- Binding Version 01.00
  43. ------------------------------------------------------------------------------
  44. include(`Base_Defs')
  45. with System;
  46. with Interfaces.C;
  47. with Interfaces.C.Strings; use Interfaces.C.Strings;
  48. with Unchecked_Conversion;
  49. package Terminal_Interface.Curses.Aux is
  50. pragma Preelaborate (Terminal_Interface.Curses.Aux);
  51. use type Interfaces.C.int;
  52. subtype C_Int is Interfaces.C.int;
  53. subtype C_Short is Interfaces.C.short;
  54. subtype C_Long_Int is Interfaces.C.long;
  55. subtype C_Size_T is Interfaces.C.size_t;
  56. subtype C_UInt is Interfaces.C.unsigned;
  57. subtype C_ULong is Interfaces.C.unsigned_long;
  58. subtype C_Char_Ptr is Interfaces.C.Strings.chars_ptr;
  59. type C_Void_Ptr is new System.Address;
  60. include(`Chtype_Def')
  61. -- This is how those constants are defined in ncurses. I see them also
  62. -- exactly like this in all ETI implementations I ever tested. So it
  63. -- could be that this is quite general, but please check with your curses.
  64. -- This is critical, because curses sometime mixes boolean returns with
  65. -- returning an error status.
  66. Curses_Ok : constant C_Int := CF_CURSES_OK;
  67. Curses_Err : constant C_Int := CF_CURSES_ERR;
  68. Curses_True : constant C_Int := CF_CURSES_TRUE;
  69. Curses_False : constant C_Int := CF_CURSES_FALSE;
  70. -- Eti_Error: type for error codes returned by the menu and form subsystem
  71. include(`Eti_Defs')
  72. procedure Eti_Exception (Code : Eti_Error);
  73. -- Dispatch the error code and raise the appropriate exception
  74. --
  75. --
  76. -- Some helpers
  77. function Chtype_To_AttrChar is new
  78. Unchecked_Conversion (Source => C_Chtype,
  79. Target => Attributed_Character);
  80. function AttrChar_To_Chtype is new
  81. Unchecked_Conversion (Source => Attributed_Character,
  82. Target => C_Chtype);
  83. function AttrChar_To_AttrType is new
  84. Unchecked_Conversion (Source => Attributed_Character,
  85. Target => C_AttrType);
  86. function AttrType_To_AttrChar is new
  87. Unchecked_Conversion (Source => C_AttrType,
  88. Target => Attributed_Character);
  89. procedure Fill_String (Cp : in chars_ptr;
  90. Str : out String);
  91. -- Fill the Str parameter with the string denoted by the chars_ptr
  92. -- C-Style string.
  93. function Fill_String (Cp : chars_ptr) return String;
  94. -- Same but as function.
  95. end Terminal_Interface.Curses.Aux;