Ada 编程/库/接口.COBOL
外观
此语言特性从 Ada 95 开始可用。
接口.COBOL 是 预定义语言环境 自 Ada 95 以来的一部分。
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;
外部示例
[编辑源代码]- 在以下网站中搜索 示例
Interfaces.COBOL
:Rosetta Code,GitHub (gists),任何 Alire 包 或 本维基教科书。 - 在以下网站中搜索与
Interfaces.COBOL
相关的 帖子:Stack Overflow,comp.lang.ada 或 任何与 Ada 相关的页面。
FSF GNAT
- 规范:i-cobol.ads
- 主体:i-cobol.adb
drake