This appendix specifies the bindings of IDL data types to NDR data types and to a set of C-language defined data types. It also specifies the mapping of IDL syntax to the C-language syntax of generated stubs.
The the data type mappings are specified in
IDL Type | NDR Type | Defined C Type | C Type | ||||
---|---|---|---|---|---|---|---|
boolean | boolean | idl_boolean | unsigned char | ||||
char | character | idl_char | unsigned char | ||||
byte | uninterpreted octet | idl_byte | unsigned char | ||||
small | small | idl_small_int | char | ||||
short | short | idl_short_int | short int | ||||
long | long | idl_long_int | long int | ||||
hyper | hyper | idl_hyper_int | 16- or 32- Bit Machines: Big Endian: struct { long high; unsigned long low; } Little Endian: struct { unsigned long low; long high; } 64-Bit Machines: long | ||||
unsigned small | unsigned small | idl_usmall_int | unsigned char | ||||
unsigned short | unsigned short | idl_ushort_int | unsigned short int | ||||
unsigned long | unsigned long | idl_ulong_int | unsigned long int | ||||
unsigned hyper | unsigned hyper | idl_uhyper_int | 16 or 32-Bit Machines: Big Endian: struct { unsigned long high; unsigned long low; } Little Endian: struct { unsigned long low; unsigned long high; } 64-Bit Machines: unsigned long | ||||
float | float | idl_float | float | ||||
double | double | idl_double | double | ||||
handle_t | not transmitted | handle_t | void * | ||||
error_status_t | unsigned long | idl_ulong_int | unsigned long int | ||||
ISO_LATIN_1 | uninterpreted octet | ISO_LATIN_1 | byte | ||||
ISO_MULTI_LINGUAL | (Note 1.) | ISO_MULTI_LINGUAL | struct{ byte row; byte column; } ISO_UCS
| (Note 1.)
| ISO_UCS
| struct{ byte group; byte plane; byte row; byte column; } |
The recommended values for the Boolean constants are specified in
Constant | Value |
---|---|
TRUE | 1 |
FALSE | 0 |
Unless specified otherwise, the code generated for the C language is
syntactically identical to the IDL declarations. The following are the
mappings from IDL to the C language for which the syntax is not
identical to IDL. These mappings use the conventions, notation and
productions defined in
const <const_type_spec> <Identifier> = <const_exp>
maps to the C language as:
#define <Identifier> (<const_exp>L)
union [ <tag> ] { <union_case_label_n_e> <union_arm>
[ <union_case_label_n_e> <union_arm> ] ...
[ default : <union_arm> ]
}
maps to the C language as:
union [ <tag> ] { <union_arm> [ <union_arm> ]... }
If an IDL <union_arm> is empty (that is, an instance resolves to only a ; (semicolon)), then no C mapping is generated for that arm.
union [ <tag> ] switch ( <switch_type_spec> <Identifier> ) [<union_name> ]
{ <union_case_label> [ <union_case_label> ] ... <union_arm>
[ <union_case_label> [ <union_case_label> ] ... <union_arm> ] ...
}
maps to the C language as:
struct [ <tag> ]
{
<switch_type_spec> <Identifier> ;
union { <union_arm> [ <union_arm> ]... } <union_name> ;
}
If an IDL <union_arm> is empty (that is, an instance resolves to
only a ; (semicolon)), then no C mapping is generated for that
arm. If <union_name> is not present in the IDL declaration,
then the union is assigned the name tagged_union.
pipe <type_spec> <pipe_declarators>
maps to the C language as:
typedef
struct <pipe_declarators> {
void (*pull) (
char *state,
<type_spec> *buf,
idl_ulong_int esize,
idl_ulong_int *ecount
);
void (*push) (
char *state,
<type_spec> *buf,
idl_ulong_int *ecount
);
void (*alloc) (
char *state,
idl_ulong_int bsize,
<type_spec> **buf,
idl_ulong_int *bcount
);
char *state;
} <pipe_declarators> ;
<Identifier> <[> <const_bounds> <]> [ <[> <const_bounds> <]> ] ...
<const_bounds> ::= <const_exp> | <lower> .. <upper>
<lower> ::= <Integer_literal> | <Identifier>
<upper> ::= <Integer_literal> | <Identifier>
map to the C language as:
<Identifier> <[> <size> <]> [ <[> <size> <]> ] ...
where <size> is the value obtained by evaluating either <const_exp> or the expression (<upper>-<lower>+1).
<Identifier> <[> [ <star_bounds> ] <]> [ <[> <const_bounds> <]> ] ...
<star_bounds> ::= * | <lower> .. *
<const_bounds> ::= <const_exp> | <lower> .. <upper>
<lower> ::= <Integer_literal> | <Identifier>
<upper> ::= <Integer_literal> | <Identifier>
when used in type definitions map to the C language as:
<Identifier> <[> 1 <]> [ <[> <size> <]> ] ...
and when used in parameter declarations map to the C language as:
<Identifier> <[> <]> [ <[> <size> <]> ] ...
where <size> is value obtained by evaluating either <const_exp> or the expression (<upper>-<lower>+1).
<[> uuid (<interface-uuid>),
version (<major-version>.<minor-version>)
<]>
interface <if-name>
{
<type-decls>
<type-1> <op1> (<params-1>);
[ <type-2> <op2> (<params-2>); ] ...
}
are mapped to the C-language structure:
typedef
structure <if-name> v<major-version> <minor-varsion> epv t {
<type-1> (* <op1>) (<params-1>);
[ <type-2> (* <op2>) (<params-2>); ] ...
}
<if-name> v<major-version> <minor-version> epv t
where the IDL to C-language mappings have also been applied to the <type-1>, ..., and <params-1>, ..., declarations.
Mappings to languages other than C will be specified by The Open Group DCE as they become standardised.
Please note that the html version of this specification may contain formatting aberrations. The definitive version is available as an electronic publication on CD-ROM from The Open Group.
Contents | Next section | Index |