1 ------------------------------------------------------------------------------
3 -- GNAT COMPILER COMPONENTS --
5 -- I N T E R F A C E S . C . S T R I N G S --
9 -- Copyright (C) 1993-2010, Free Software Foundation, Inc. --
11 -- This specification is derived from the Ada Reference Manual for use with --
12 -- GNAT. The copyright notice above, and the license provisions that follow --
13 -- apply solely to the contents of the part following the private keyword. --
15 -- GNAT is free software; you can redistribute it and/or modify it under --
16 -- terms of the GNU General Public License as published by the Free Soft- --
17 -- ware Foundation; either version 3, or (at your option) any later ver- --
18 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
19 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
20 -- or FITNESS FOR A PARTICULAR PURPOSE. --
22 -- As a special exception under Section 7 of GPL version 3, you are granted --
23 -- additional permissions described in the GCC Runtime Library Exception, --
24 -- version 3.1, as published by the Free Software Foundation. --
26 -- You should have received a copy of the GNU General Public License and --
27 -- a copy of the GCC Runtime Library Exception along with this program; --
28 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
29 -- <http://www.gnu.org/licenses/>. --
31 -- GNAT was originally developed by the GNAT team at New York University. --
32 -- Extensive contributions were provided by Ada Core Technologies Inc. --
34 ------------------------------------------------------------------------------
36 package Interfaces
.C
.Strings
is
39 type char_array_access
is access all char_array
;
40 for char_array_access
'Size use System
.Parameters
.ptr_bits
;
42 pragma No_Strict_Aliasing
(char_array_access
);
43 -- Since this type is used for external interfacing, with the pointer
44 -- coming from who knows where, it seems a good idea to turn off any
45 -- strict aliasing assumptions for this type.
47 type chars_ptr
is private;
48 pragma Preelaborable_Initialization
(chars_ptr
);
50 type chars_ptr_array
is array (size_t
range <>) of aliased chars_ptr
;
52 Null_Ptr
: constant chars_ptr
;
55 (Item
: char_array_access
;
56 Nul_Check
: Boolean := False) return chars_ptr
;
58 function New_Char_Array
(Chars
: char_array
) return chars_ptr
;
60 function New_String
(Str
: String) return chars_ptr
;
62 procedure Free
(Item
: in out chars_ptr
);
64 Dereference_Error
: exception;
66 function Value
(Item
: chars_ptr
) return char_array
;
70 Length
: size_t
) return char_array
;
72 function Value
(Item
: chars_ptr
) return String;
76 Length
: size_t
) return String;
78 function Strlen
(Item
: chars_ptr
) return size_t
;
84 Check
: Boolean := True);
90 Check
: Boolean := True);
92 Update_Error
: exception;
95 type chars_ptr
is access all Character;
96 for chars_ptr
'Size use System
.Parameters
.ptr_bits
;
98 pragma No_Strict_Aliasing
(chars_ptr
);
99 -- Since this type is used for external interfacing, with the pointer
100 -- coming from who knows where, it seems a good idea to turn off any
101 -- strict aliasing assumptions for this type.
103 Null_Ptr
: constant chars_ptr
:= null;
104 end Interfaces
.C
.Strings
;