Ada Programming/Libraries/Interfaces.COBOL
Appearance
This language feature is available from Ada 95 on.
Interfaces.COBOL is a unit of the Predefined Language Environment since Ada 95.
Specification
[edit | edit source]package
Interfaces.COBOLis
pragma
Preelaborate(COBOL); -- Types and operations for internal data representationstype
Floatingis
digits
implementation-defined;type
Long_Floatingis
digits
implementation-defined;type
Binaryis
range
implementation-defined;type
Long_Binaryis
range
implementation-defined; Max_Digits_Binary :constant
:= implementation-defined; Max_Digits_Long_Binary :constant
:= implementation-defined;type
Decimal_Elementis
mod
implementation-defined;type
Packed_Decimalis
array
(Positiverange
<>)of
Decimal_Elementwith
Pack;type
COBOL_Characteris
implementation-defined charactertype
; Ada_To_COBOL :array
(Character)of
COBOL_Character := implementation-defined; COBOL_To_Ada :array
(COBOL_Character)of
Character := implementation-defined;type
Alphanumericis
array
(Positiverange
<>)of
COBOL_Characterwith
Pack;function
To_COBOL (Item :in
String)return
Alphanumeric;function
To_Ada (Item :in
Alphanumeric)return
String;procedure
To_COBOL (Item :in
String; Target :out
Alphanumeric; Last :out
Natural);procedure
To_Ada (Item :in
Alphanumeric; Target :out
String; Last :out
Natural);type
Numericis
array
(Positiverange
<>)of
COBOL_Characterwith
Pack; -- Formats for COBOL data representationstype
Display_Formatis
private
; Unsigned :constant
Display_Format; Leading_Separate :constant
Display_Format; Trailing_Separate :constant
Display_Format; Leading_Nonseparate :constant
Display_Format; Trailing_Nonseparate :constant
Display_Format;type
Binary_Formatis
private
; High_Order_First :constant
Binary_Format; Low_Order_First :constant
Binary_Format; Native_Binary :constant
Binary_Format;type
Packed_Formatis
private
; Packed_Unsigned :constant
Packed_Format; Packed_Signed :constant
Packed_Format; -- Types for external representation of COBOL binary datatype
Byteis
mod
2**COBOL_Character'Size;type
Byte_Arrayis
array
(Positiverange
<>)of
Bytewith
Pack; Conversion_Error :exception
;generic
type
Numis
delta
<>digits
<>;package
Decimal_Conversionsis
-- Display Formats: data values are represented as Numericfunction
Valid (Item :in
Numeric; Format :in
Display_Format)return
Boolean;function
Length (Format :in
Display_Format)return
Natural;function
To_Decimal (Item :in
Numeric; Format :in
Display_Format)return
Num;function
To_Display (Item :in
Num; Format :in
Display_Format)return
Numeric; -- Packed Formats: data values are represented as Packed_Decimalfunction
Valid (Item :in
Packed_Decimal; Format :in
Packed_Format)return
Boolean;function
Length (Format :in
Packed_Format)return
Natural;function
To_Decimal (Item :in
Packed_Decimal; Format :in
Packed_Format)return
Num;function
To_Packed (Item :in
Num; Format :in
Packed_Format)return
Packed_Decimal; -- Binary Formats: external data values are represented as Byte_Arrayfunction
Valid (Item :in
Byte_Array; Format :in
Binary_Format)return
Boolean;function
Length (Format :in
Binary_Format)return
Natural;function
To_Decimal (Item :in
Byte_Array; Format :in
Binary_Format)return
Num;function
To_Binary (Item :in
Num; Format :in
Binary_Format)return
Byte_Array; -- Internal Binary formats: data values are of type Binary or Long_Binaryfunction
To_Decimal (Item :in
Binary)return
Num;function
To_Decimal (Item :in
Long_Binary)return
Num;function
To_Binary (Item :in
Num)return
Binary;function
To_Long_Binary (Item :in
Num)return
Long_Binary;end
Decimal_Conversions;private
... -- not specified by the languageend
Interfaces.COBOL;
See also
[edit | edit source]Wikibook
[edit | edit source]External examples
[edit source]- Search for examples of
Interfaces.COBOL
in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook. - Search for posts related to
Interfaces.COBOL
in: Stack Overflow, comp.lang.ada or any Ada related page.
Ada Reference Manual
[edit | edit source]Ada 95
[edit | edit source]Ada 2005
[edit | edit source]Ada 2012
[edit | edit source]Open-Source Implementations
[edit | edit source]FSF GNAT
- Specification: i-cobol.ads
- Body: i-cobol.adb
drake
- Specification: interfaces/i-cobol.ads
- Body: interfaces/i-cobol.adb