< Ada Programming < Libraries
This language feature is available from Ada 95 on. Interfaces.C is a unit of the Predefined Language Environment since Ada 95.
Specification
-- Standard Ada library specification -- Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com> -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual -- -------------------------------------------------------------------------package
Interfaces.Cis
pragma
Pure(C); -- Declarations based on C's <limits.h> CHAR_BIT :constant
:= implementation_defined; -- typically 8 SCHAR_MIN :constant
:= implementation_defined; -- typically -128 SCHAR_MAX :constant
:= implementation_defined; -- typically 127 UCHAR_MAX :constant
:= implementation_defined; -- typically 255 -- Signed and Unsigned Integerstype
intis
range
implementation_defined .. implementation_defined;type
shortis
range
implementation_defined .. implementation_defined;type
longis
range
implementation_defined .. implementation_defined;type
signed_charis
range
SCHAR_MIN .. SCHAR_MAX;for
signed_char'Sizeuse
CHAR_BIT;type
unsignedis
mod
implementation_defined;type
unsigned_shortis
mod
implementation_defined;type
unsigned_longis
mod
implementation_defined;type
unsigned_charis
mod
(UCHAR_MAX+1);for
unsigned_char'Sizeuse
CHAR_BIT;subtype
plain_charis
unsigned_char; -- implementation_defined;type
ptrdiff_tis
range
implementation_defined .. implementation_defined;type
size_tis
mod
implementation_defined; -- Floating Pointtype
C_floatis
digits
implementation_defined;type
doubleis
digits
implementation_defined;type
long_doubleis
digits
implementation_defined; -- Characters and Stringstype
charis
('x}}'); -- implementation_defined character type; nul :constant
char := implementation_defined;function
To_C (Item :in
Character)return
char;function
To_Ada (Item :in
char)return
Character;type
char_arrayis
array
(size_trange
<>)of
aliased
char;pragma
Pack (char_array);for
char_array'Component_Sizeuse
CHAR_BIT;function
Is_Nul_Terminated (Item :in
char_array)return
Boolean;function
To_C (Item :in
String; Append_Nul :in
Boolean := True)return
char_array;function
To_Ada (Item :in
char_array; Trim_Nul :in
Boolean := True)return
String;procedure
To_C (Item :in
String; Target :out
char_array; Count :out
size_t; Append_Nul :in
Boolean := True);procedure
To_Ada (Item :in
char_array; Target :out
String; Count :out
Natural; Trim_Nul :in
Boolean := True); -- Wide Character and Wide Stringtype
wchar_tis
(' '); -- implementation_defined char type; wide_nul :constant
wchar_t := implementation_defined;function
To_C (Item :in
Wide_Character)return
wchar_t;function
To_Ada (Item :in
wchar_t )return
Wide_Character;type
wchar_arrayis
array
(size_trange
<>)of
aliased
wchar_t;pragma
Pack (wchar_array);function
Is_Nul_Terminated (Item :in
wchar_array)return
Boolean;function
To_C (Item :in
Wide_String; Append_Nul :in
Boolean := True)return
wchar_array;function
To_Ada (Item :in
wchar_array; Trim_Nul :in
Boolean := True)return
Wide_String;procedure
To_C (Item :in
Wide_String; Target :out
wchar_array; Count :out
size_t; Append_Nul :in
Boolean := True);procedure
To_Ada (Item :in
wchar_array; Target :out
Wide_String; Count :out
Natural; Trim_Nul :in
Boolean := True); -- ISO/IEC 10646:2003 compatible types defined by ISO/IEC TR 19769:2004.type
char16_tis
('x}}'); -- implementation_defined character type char16_nul :constant
char16_t := implementation_defined;function
To_C (Item :in
Wide_Character)return
char16_t;function
To_Ada (Item :in
char16_t)return
Wide_Character;type
char16_arrayis
array
(size_trange
<>)of
aliased
char16_t;pragma
Pack (char16_array);function
Is_Nul_Terminated (Item :in
char16_array)return
Boolean;function
To_C (Item :in
Wide_String; Append_Nul :in
Boolean := True)return
char16_array;function
To_Ada (Item :in
char16_array; Trim_Nul :in
Boolean := True)return
Wide_String;procedure
To_C (Item :in
Wide_String; Target :out
char16_array; Count :out
size_t; Append_Nul :in
Boolean := True);procedure
To_Ada (Item :in
char16_array; Target :out
Wide_String; Count :out
Natural; Trim_Nul :in
Boolean := True);type
char32_tis
('x}}'); -- implementation_defined character type char32_nul :constant
char32_t := implementation_defined;function
To_C (Item :in
Wide_Wide_Character)return
char32_t;function
To_Ada (Item :in
char32_t)return
Wide_Wide_Character;type
char32_arrayis
array
(size_trange
<>)of
aliased
char32_t;pragma
Pack (char32_array);function
Is_Nul_Terminated (Item :in
char32_array)return
Boolean;function
To_C (Item :in
Wide_Wide_String; Append_Nul :in
Boolean := True)return
char32_array;function
To_Ada (Item :in
char32_array; Trim_Nul :in
Boolean := True)return
Wide_Wide_String;procedure
To_C (Item :in
Wide_Wide_String; Target :out
char32_array; Count :out
size_t; Append_Nul :in
Boolean := True);procedure
To_Ada (Item :in
char32_array; Target :out
Wide_Wide_String; Count :out
Natural; Trim_Nul :in
Boolean := True); Terminator_Error :exception
;end
Interfaces.C;
See also
Wikibook
External examples
- Search for examples of
Interfaces.C
in: Rosetta Code, GitHub or this Wikibook. - Search for any post related to
Interfaces.C
in: Stack Overflow, comp.lang.ada or any Ada related page.
Ada Reference Manual
Ada 95
Ada 2005
Ada 2012
Open-Source Implementations
FSF GNAT
drake
- Specification: interfaces/i-c.ads
- Body: interfaces/i-c.adb
This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.