1 |
281 |
jeremybenn |
------------------------------------------------------------------------------
|
2 |
|
|
-- --
|
3 |
|
|
-- GNAT COMPILER COMPONENTS --
|
4 |
|
|
-- --
|
5 |
|
|
-- I N T E R F A C E S . C . S T R I N G S --
|
6 |
|
|
-- --
|
7 |
|
|
-- S p e c --
|
8 |
|
|
-- --
|
9 |
|
|
-- Copyright (C) 1993-2009, Free Software Foundation, Inc. --
|
10 |
|
|
-- --
|
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. --
|
14 |
|
|
-- --
|
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. --
|
21 |
|
|
-- --
|
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. --
|
25 |
|
|
-- --
|
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/>. --
|
30 |
|
|
-- --
|
31 |
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
32 |
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
33 |
|
|
-- --
|
34 |
|
|
------------------------------------------------------------------------------
|
35 |
|
|
|
36 |
|
|
package Interfaces.C.Strings is
|
37 |
|
|
pragma Preelaborate;
|
38 |
|
|
|
39 |
|
|
type char_array_access is access all char_array;
|
40 |
|
|
|
41 |
|
|
pragma No_Strict_Aliasing (char_array_access);
|
42 |
|
|
-- Since this type is used for external interfacing, with the pointer
|
43 |
|
|
-- coming from who knows where, it seems a good idea to turn off any
|
44 |
|
|
-- strict aliasing assumptions for this type.
|
45 |
|
|
|
46 |
|
|
type chars_ptr is private;
|
47 |
|
|
|
48 |
|
|
type chars_ptr_array is array (size_t range <>) of chars_ptr;
|
49 |
|
|
|
50 |
|
|
Null_Ptr : constant chars_ptr;
|
51 |
|
|
|
52 |
|
|
function To_Chars_Ptr
|
53 |
|
|
(Item : char_array_access;
|
54 |
|
|
Nul_Check : Boolean := False) return chars_ptr;
|
55 |
|
|
|
56 |
|
|
function New_Char_Array (Chars : char_array) return chars_ptr;
|
57 |
|
|
|
58 |
|
|
function New_String (Str : String) return chars_ptr;
|
59 |
|
|
|
60 |
|
|
procedure Free (Item : in out chars_ptr);
|
61 |
|
|
|
62 |
|
|
Dereference_Error : exception;
|
63 |
|
|
|
64 |
|
|
function Value (Item : chars_ptr) return char_array;
|
65 |
|
|
|
66 |
|
|
function Value
|
67 |
|
|
(Item : chars_ptr;
|
68 |
|
|
Length : size_t) return char_array;
|
69 |
|
|
|
70 |
|
|
function Value (Item : chars_ptr) return String;
|
71 |
|
|
|
72 |
|
|
function Value
|
73 |
|
|
(Item : chars_ptr;
|
74 |
|
|
Length : size_t) return String;
|
75 |
|
|
|
76 |
|
|
function Strlen (Item : chars_ptr) return size_t;
|
77 |
|
|
|
78 |
|
|
procedure Update
|
79 |
|
|
(Item : chars_ptr;
|
80 |
|
|
Offset : size_t;
|
81 |
|
|
Chars : char_array;
|
82 |
|
|
Check : Boolean := True);
|
83 |
|
|
|
84 |
|
|
procedure Update
|
85 |
|
|
(Item : chars_ptr;
|
86 |
|
|
Offset : size_t;
|
87 |
|
|
Str : String;
|
88 |
|
|
Check : Boolean := True);
|
89 |
|
|
|
90 |
|
|
Update_Error : exception;
|
91 |
|
|
|
92 |
|
|
private
|
93 |
|
|
type chars_ptr is access all Character;
|
94 |
|
|
pragma Convention (C, chars_ptr);
|
95 |
|
|
|
96 |
|
|
pragma No_Strict_Aliasing (chars_ptr);
|
97 |
|
|
-- Since this type is used for external interfacing, with the pointer
|
98 |
|
|
-- coming from who knows where, it seems a good idea to turn off any
|
99 |
|
|
-- strict aliasing assumptions for this type.
|
100 |
|
|
|
101 |
|
|
Null_Ptr : constant chars_ptr := null;
|
102 |
|
|
end Interfaces.C.Strings;
|