Debian Codegraph @

htmlman/main002.html

raw
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
2 "http://www.w3.org/TR/REC-html40/loose.dtd">
3 <HTML>
4 <HEAD>
5
6 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
7 <META name="GENERATOR" content="hevea 1.06-7 of 2001-11-14">
8 <TITLE>
9 IDL syntax
10 </TITLE>
11 </HEAD>
12 <BODY >
13 <A HREF="main001.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
14 <A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
15 <A HREF="main003.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
16 <HR>
17
18 <H2><A NAME="htoc4">2</A>&nbsp;&nbsp;IDL syntax</H2>
19 This section describes the syntax of IDL files. IDL syntax is very
20 close to that of C declarations, with extra attributes between
21 brackets adding information to the C types. The following example
22 should give the flavor of the syntax:
23 <PRE>
24 int f([in,string] char * msg);
25 </PRE>This reads: ``<TT>f</TT> is a function taking a character string as input and
26 returning an <TT>int</TT>''.<BR>
27 <BR>
28 <A NAME="toc3"></A>
29 <H3><A NAME="htoc5">2.1</A>&nbsp;&nbsp;Lexical conventions</H3>
30
31 <H5>Blanks.</H5> Space, newline, horizontal tabulation, carriage
32 return, line feed and form feed are considered as blanks. Blanks are
33 ignored, but they separate adjacent tokens.<BR>
34 <BR>
35
36 <H5>Comments.</H5> Both C-style comments <TT>/* ... */</TT> and
37 Java-style comments <TT>// ...</TT> are supported. C-style comments are
38 introduced by <TT>/*</TT> and terminated by <TT>*/</TT>. Java-style comments are
39 introduced by <TT>//</TT> and extend to the end of the line. Comments are
40 treated as blank characters. Comments do not occur inside string or
41 character literals. Nested C-style comments are not supported.<BR>
42 <BR>
43
44 <H5>Identifiers.</H5> Identifiers have the same syntax as in C.
45 <DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
46 <TR><TD ALIGN=right NOWRAP>
47 <TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
48 <TD ALIGN=right NOWRAP>::=</TD>
49 <TD ALIGN=left NOWRAP> (<TT><FONT COLOR=blue>A</FONT></TT> ... <TT><FONT COLOR=blue>Z</FONT></TT> | <TT><FONT COLOR=blue>a</FONT></TT> ... <TT><FONT COLOR=blue>z</FONT></TT> | <TT><FONT COLOR=blue>_</FONT></TT>)
50 {<TT><FONT COLOR=blue>A</FONT></TT> ... <TT><FONT COLOR=blue>Z</FONT></TT> | <TT><FONT COLOR=blue>a</FONT></TT> ... <TT><FONT COLOR=blue>z</FONT></TT> | <TT><FONT COLOR=blue>0</FONT></TT> ... <TT><FONT COLOR=blue>9</FONT></TT> | <TT><FONT COLOR=blue>_</FONT></TT>}</TD>
51 </TR></TABLE></DIV><BR>
52
53 <H5>Literals.</H5> Integer literals, character literals and string
54 literals have the same syntax as in C.
55 <DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
56 <TR><TD ALIGN=right NOWRAP>
57 <TT><I><FONT COLOR=maroon>integer</FONT></I></TT></TD>
58 <TD ALIGN=right NOWRAP>::=</TD>
59 <TD ALIGN=left NOWRAP> [<TT><FONT COLOR=blue>-</FONT></TT>] {<TT><FONT COLOR=blue>0</FONT></TT> ... <TT><FONT COLOR=blue>9</FONT></TT>}
60 [<TT><FONT COLOR=blue>-</FONT></TT>] <TT><FONT COLOR=blue>0x</FONT></TT> {<TT><FONT COLOR=blue>0</FONT></TT> ... <TT><FONT COLOR=blue>9</FONT></TT> | <TT><FONT COLOR=blue>a</FONT></TT> ... <TT><FONT COLOR=blue>f</FONT></TT> | <TT><FONT COLOR=blue>A</FONT></TT> ... <TT><FONT COLOR=blue>F</FONT></TT>}
61 [<TT><FONT COLOR=blue>-</FONT></TT>] <TT><FONT COLOR=blue>0</FONT></TT> {<TT><FONT COLOR=blue>0</FONT></TT> ... <TT><FONT COLOR=blue>7</FONT></TT>}</TD>
62 </TR>
63 <TR><TD ALIGN=right NOWRAP>
64 <TT><I><FONT COLOR=maroon>character</FONT></I></TT></TD>
65 <TD ALIGN=right NOWRAP>::=</TD>
66 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>'</FONT></TT> (<TT><I><FONT COLOR=maroon>regular-char</FONT></I></TT> | <TT><I><FONT COLOR=maroon>escape-char</FONT></I></TT>) <TT><FONT COLOR=blue>'</FONT></TT></TD>
67 </TR>
68 <TR><TD ALIGN=right NOWRAP>
69 <TT><I><FONT COLOR=maroon>string</FONT></I></TT></TD>
70 <TD ALIGN=right NOWRAP>::=</TD>
71 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>"</FONT></TT> {<TT><I><FONT COLOR=maroon>regular-char</FONT></I></TT> | <TT><I><FONT COLOR=maroon>escape-char</FONT></I></TT>} <TT><FONT COLOR=blue>"</FONT></TT></TD>
72 </TR>
73 <TR><TD ALIGN=right NOWRAP>
74 <TT><I><FONT COLOR=maroon>escape-char</FONT></I></TT></TD>
75 <TD ALIGN=right NOWRAP>::=</TD>
76 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>\</FONT></TT> (<TT><FONT COLOR=blue>b</FONT></TT>| <TT><FONT COLOR=blue>n</FONT></TT>| <TT><FONT COLOR=blue>r</FONT></TT>| <TT><FONT COLOR=blue>t</FONT></TT>)</TD>
77 </TR>
78 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
79 <TD ALIGN=right NOWRAP>|</TD>
80 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>\</FONT></TT> (<TT><FONT COLOR=blue>0</FONT></TT>...<TT><FONT COLOR=blue>7</FONT></TT>) [<TT><FONT COLOR=blue>0</FONT></TT>...<TT><FONT COLOR=blue>7</FONT></TT>] [<TT><FONT COLOR=blue>0</FONT></TT>...<TT><FONT COLOR=blue>7</FONT></TT>]</TD>
81 </TR></TABLE></DIV><BR>
82
83 <H5>UUID.</H5> Unique identifiers are composed of 16 hexadecimal
84 digits, in groups of 8, 4, 4, 4 and 12, separated by dashes.
85 <DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
86 <TR><TD ALIGN=right NOWRAP>
87 <TT><I><FONT COLOR=maroon>uuid</FONT></I></TT></TD>
88 <TD ALIGN=right NOWRAP>::=</TD>
89 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>hex</FONT></I></TT><SUP><FONT SIZE=2>8</FONT></SUP> <TT><FONT COLOR=blue>-</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>hex</FONT></I></TT><SUP><FONT SIZE=2>4</FONT></SUP> <TT><FONT COLOR=blue>-</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>hex</FONT></I></TT><SUP><FONT SIZE=2>4</FONT></SUP> <TT><FONT COLOR=blue>-</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>hex</FONT></I></TT><SUP><FONT SIZE=2>4</FONT></SUP> <TT><FONT COLOR=blue>-</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>hex</FONT></I></TT><SUP><FONT SIZE=2>4</FONT></SUP> &nbsp;<TT><I><FONT COLOR=maroon>hex</FONT></I></TT><SUP><FONT SIZE=2>4</FONT></SUP> &nbsp;<TT><I><FONT COLOR=maroon>hex</FONT></I></TT><SUP><FONT SIZE=2>4</FONT></SUP></TD>
90 </TR>
91 <TR><TD ALIGN=right NOWRAP>
92 <TT><I><FONT COLOR=maroon>hex</FONT></I></TT></TD>
93 <TD ALIGN=right NOWRAP>::=</TD>
94 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>0</FONT></TT> ... <TT><FONT COLOR=blue>9</FONT></TT> | <TT><FONT COLOR=blue>a</FONT></TT> ... <TT><FONT COLOR=blue>f</FONT></TT> | <TT><FONT COLOR=blue>A</FONT></TT> ... <TT><FONT COLOR=blue>F</FONT></TT></TD>
95 </TR></TABLE></DIV><BR>
96 <A NAME="toc4"></A>
97 <H3><A NAME="htoc6">2.2</A>&nbsp;&nbsp;Limited expressions</H3>
98 Limited expressions are similar to C expressions, with the omission of
99 assignment operators (<TT>=</TT>, <TT>+=</TT>, etc), and the addition of the
100 unsigned (logical) right shift operator <TT>&gt;&gt;&gt;</TT>. Operators have the same
101 precedences and associativities as in C. They are listed below in
102 decreasing priority order.
103 <DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
104 <TR><TD ALIGN=right NOWRAP>
105 <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT></TD>
106 <TD ALIGN=right NOWRAP>::=</TD>
107 <TD ALIGN=left NOWRAP>
108 <TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
109 </TR>
110 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
111 <TD ALIGN=right NOWRAP>|</TD>
112 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>integer</FONT></I></TT></TD>
113 </TR>
114 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
115 <TD ALIGN=right NOWRAP>|</TD>
116 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>character</FONT></I></TT></TD>
117 </TR>
118 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
119 <TD ALIGN=right NOWRAP>|</TD>
120 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>true</FONT></TT></TD>
121 </TR>
122 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
123 <TD ALIGN=right NOWRAP>|</TD>
124 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>false</FONT></TT></TD>
125 </TR>
126 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
127 <TD ALIGN=right NOWRAP>|</TD>
128 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>string</FONT></I></TT></TD>
129 </TR>
130 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
131 <TD ALIGN=right NOWRAP>|</TD>
132 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>sizeof</FONT></I></TT> <TT><FONT COLOR=blue>(</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>type-expr</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT></TD>
133 </TR>
134 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
135 <TD ALIGN=right NOWRAP>|</TD>
136 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>(</FONT></TT> <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT></TD>
137 </TR>
138 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
139 <TD ALIGN=right NOWRAP>|</TD>
140 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT> &nbsp;(<TT><FONT COLOR=blue>.</FONT></TT> | <TT><FONT COLOR=blue>-&gt;</FONT></TT>) <TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
141 </TR>
142 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
143 <TD ALIGN=right NOWRAP>|</TD>
144 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>(</FONT></TT> <TT><I><FONT COLOR=maroon>type-expr</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT></TD>
145 </TR>
146 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
147 <TD ALIGN=right NOWRAP>|</TD>
148 <TD ALIGN=left NOWRAP> (<TT><FONT COLOR=blue>&amp;</FONT></TT>| <TT><FONT COLOR=blue>*</FONT></TT>| <TT><FONT COLOR=blue>!</FONT></TT>| <TT><FONT COLOR=blue>~</FONT></TT>| <TT><FONT COLOR=blue>-</FONT></TT>| <TT><FONT COLOR=blue>+</FONT></TT>) <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT></TD>
149 </TR>
150 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
151 <TD ALIGN=right NOWRAP>|</TD>
152 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT> &nbsp;(<TT><FONT COLOR=blue>*</FONT></TT>| <TT><FONT COLOR=blue>/</FONT></TT>| <TT><FONT COLOR=blue>%</FONT></TT>) <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT></TD>
153 </TR>
154 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
155 <TD ALIGN=right NOWRAP>|</TD>
156 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT> &nbsp;(<TT><FONT COLOR=blue>+</FONT></TT>| <TT><FONT COLOR=blue>-</FONT></TT>) <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT></TD>
157 </TR>
158 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
159 <TD ALIGN=right NOWRAP>|</TD>
160 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT> &nbsp;(<TT><FONT COLOR=blue>&lt;&lt;</FONT></TT>| <TT><FONT COLOR=blue>&gt;&gt;</FONT></TT></TD>
161 </TR>
162 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
163 <TD ALIGN=right NOWRAP>|</TD>
164 <TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>&gt;&gt;&gt;</FONT></TT>) <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT></TD>
165 </TR>
166 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
167 <TD ALIGN=right NOWRAP>|</TD>
168 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT> &nbsp;(<TT><FONT COLOR=blue>==</FONT></TT>| <TT><FONT COLOR=blue>!=</FONT></TT>| <TT><FONT COLOR=blue>&gt;=</FONT></TT>| <TT><FONT COLOR=blue>&lt;=</FONT></TT>| <TT><FONT COLOR=blue>&gt;</FONT></TT>| <TT><FONT COLOR=blue>&lt;</FONT></TT>)</TD>
169 </TR>
170 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
171 <TD ALIGN=right NOWRAP>|</TD>
172 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT> &nbsp;(<TT><FONT COLOR=blue>&amp;</FONT></TT>| <TT><FONT COLOR=blue>^</FONT></TT>| <TT><FONT COLOR=blue>|</FONT></TT>) <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT></TD>
173 </TR>
174 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
175 <TD ALIGN=right NOWRAP>|</TD>
176 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT> &nbsp;(<TT><FONT COLOR=blue>&amp;&amp;</FONT></TT>| <TT><FONT COLOR=blue>||</FONT></TT>) <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT></TD>
177 </TR>
178 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
179 <TD ALIGN=right NOWRAP>|</TD>
180 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT> <TT><FONT COLOR=blue>?</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT> <TT><FONT COLOR=blue>:</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT></TD>
181 </TR></TABLE></DIV>
182 Constant limited expressions, written <TT><I><FONT COLOR=maroon>const-lexpr</FONT></I></TT> below, can only
183 reference identifiers that are bound by the IDL <TT>const</TT> declaration.<BR>
184 <BR>
185 <A NAME="toc5"></A>
186 <H3><A NAME="htoc7">2.3</A>&nbsp;&nbsp;Attributes</H3><BR>
187 <DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
188 <TR><TD ALIGN=right NOWRAP>
189 <TT><I><FONT COLOR=maroon>attributes</FONT></I></TT></TD>
190 <TD ALIGN=right NOWRAP>::=</TD>
191 <TD ALIGN=left NOWRAP>
192 <TT><FONT COLOR=blue>[</FONT></TT> <TT><I><FONT COLOR=maroon>attribute</FONT></I></TT> &nbsp;{ <TT><FONT COLOR=blue>,</FONT></TT> <TT><I><FONT COLOR=maroon>attribute</FONT></I></TT> } <TT><FONT COLOR=blue>]</FONT></TT></TD>
193 </TR>
194 <TR><TD ALIGN=right NOWRAP>
195 <TT><I><FONT COLOR=maroon>attribute</FONT></I></TT></TD>
196 <TD ALIGN=right NOWRAP>::=</TD>
197 <TD ALIGN=left NOWRAP>
198 <TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
199 </TR>
200 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
201 <TD ALIGN=right NOWRAP>|</TD>
202 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>(</FONT></TT> &nbsp;[<TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT>] &nbsp;{ <TT><FONT COLOR=blue>,</FONT></TT> [<TT><I><FONT COLOR=maroon>lexpr</FONT></I></TT>] } <TT><FONT COLOR=blue>)</FONT></TT></TD>
203 </TR>
204 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
205 <TD ALIGN=right NOWRAP>|</TD>
206 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>(</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>uuid</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT></TD>
207 </TR>
208 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
209 <TD ALIGN=right NOWRAP>|</TD>
210 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>attribute</FONT></I></TT> <TT><FONT COLOR=blue>*</FONT></TT></TD>
211 </TR>
212 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
213 <TD ALIGN=right NOWRAP>|</TD>
214 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>*</FONT></TT> <TT><I><FONT COLOR=maroon>attribute</FONT></I></TT></TD>
215 </TR></TABLE></DIV>
216 Attribute lists are written in brackets <TT>[...]</TT>, and are always
217 optional. Each attribute is identified by a name, and may carry
218 optional arguments. Starred attributes apply to the element type of a
219 pointer or array type, rather than to the pointer or array type itself.
220 The following table summarizes the recognized attributes and their
221 arguments.<BR>
222 <DIV ALIGN=center><TABLE BORDER=1 CELLSPACING=0 CELLPADDING=1 WIDTH="80%">
223 <TR><TD ALIGN=center NOWRAP><B>Attribute</B></TD>
224 <TD ALIGN=center NOWRAP><B>Context where it can appear</B></TD>
225 </TR>
226 <TR><TD ALIGN=left NOWRAP>
227 <TT><FONT COLOR=blue>abstract</FONT></TT> </TD>
228 <TD ALIGN=left NOWRAP><TT>typedef</TT></TD>
229 </TR>
230 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>bigarray</FONT></TT> </TD>
231 <TD ALIGN=left NOWRAP>array type</TD>
232 </TR>
233 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>camlint</FONT></TT> </TD>
234 <TD ALIGN=left NOWRAP><TT>int</TT> or <TT>long</TT> integer type</TD>
235 </TR>
236 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>compare</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>fun-name</FONT></I></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
237 <TD ALIGN=left NOWRAP><TT>typedef</TT></TD>
238 </TR>
239 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>c2ml</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>fun-name</FONT></I></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
240 <TD ALIGN=left NOWRAP><TT>typedef</TT></TD>
241 </TR>
242 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>errorcheck</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>fun-name</FONT></I></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
243 <TD ALIGN=left NOWRAP><TT>typedef</TT></TD>
244 </TR>
245 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>errorcode</FONT></TT> </TD>
246 <TD ALIGN=left NOWRAP><TT>typedef</TT></TD>
247 </TR>
248 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>finalize</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>fun-name</FONT></I></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
249 <TD ALIGN=left NOWRAP><TT>typedef</TT></TD>
250 </TR>
251 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>fortran</FONT></TT> </TD>
252 <TD ALIGN=left NOWRAP>array type with <TT>bigarray</TT> attribute</TD>
253 </TR>
254 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>hash</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>fun-name</FONT></I></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
255 <TD ALIGN=left NOWRAP><TT>typedef</TT></TD>
256 </TR>
257 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>ignore</FONT></TT> </TD>
258 <TD ALIGN=left NOWRAP>any pointer type</TD>
259 </TR>
260 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>in</FONT></TT> </TD>
261 <TD ALIGN=left NOWRAP>function parameter</TD>
262 </TR>
263 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>int_default</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT> <TT><FONT COLOR=blue>camlint</FONT></TT>| <TT><FONT COLOR=blue>nativeint</FONT></TT>| <TT><FONT COLOR=blue>int32</FONT></TT>| <TT><FONT COLOR=blue>int64</FONT></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
264 <TD ALIGN=left NOWRAP>interface</TD>
265 </TR>
266 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>int32</FONT></TT> </TD>
267 <TD ALIGN=left NOWRAP><TT>int</TT> or <TT>long</TT> integer type</TD>
268 </TR>
269 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>int64</FONT></TT> </TD>
270 <TD ALIGN=left NOWRAP><TT>int</TT> or <TT>long</TT> integer type</TD>
271 </TR>
272 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>length_is</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>le</FONT></I></TT><SUB><FONT SIZE=2>1</FONT></SUB><TT><FONT COLOR=blue>,</FONT></TT>&nbsp;<TT><I><FONT COLOR=maroon>le</FONT></I></TT><SUB><FONT SIZE=2>2</FONT></SUB><TT><FONT COLOR=blue>,</FONT></TT>...<TT><FONT COLOR=blue>)</FONT></TT> </TD>
273 <TD ALIGN=left NOWRAP>array type</TD>
274 </TR>
275 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>long_default</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT> <TT><FONT COLOR=blue>camlint</FONT></TT>| <TT><FONT COLOR=blue>nativeint</FONT></TT>| <TT><FONT COLOR=blue>int32</FONT></TT>| <TT><FONT COLOR=blue>int64</FONT></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
276 <TD ALIGN=left NOWRAP>interface</TD>
277 </TR>
278 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>managed</FONT></TT> </TD>
279 <TD ALIGN=left NOWRAP>array type with <TT>bigarray</TT> attribute</TD>
280 </TR>
281 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>ml2c</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>fun-name</FONT></I></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
282 <TD ALIGN=left NOWRAP><TT>typedef</TT></TD>
283 </TR>
284 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>mlname(</FONT></TT> <TT><I><FONT COLOR=maroon>label-name</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT> </TD>
285 <TD ALIGN=left NOWRAP><TT>struct</TT> field</TD>
286 </TR>
287 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>mltype("</FONT></TT> <TT><I><FONT COLOR=maroon>caml-type-expr</FONT></I></TT> <TT><FONT COLOR=blue>")</FONT></TT> </TD>
288 <TD ALIGN=left NOWRAP><TT>typedef</TT></TD>
289 </TR>
290 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>nativeint</FONT></TT> </TD>
291 <TD ALIGN=left NOWRAP><TT>int</TT> or <TT>long</TT> integer type</TD>
292 </TR>
293 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>null_terminated</FONT></TT> </TD>
294 <TD ALIGN=left NOWRAP>array of pointers</TD>
295 </TR>
296 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>object</FONT></TT></TD>
297 <TD ALIGN=left NOWRAP>interface</TD>
298 </TR>
299 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>out</FONT></TT> </TD>
300 <TD ALIGN=left NOWRAP>function parameter</TD>
301 </TR>
302 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>pointer_default</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT> <TT><FONT COLOR=blue>ref</FONT></TT>| <TT><FONT COLOR=blue>unique</FONT></TT>| <TT><FONT COLOR=blue>ptr</FONT></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
303 <TD ALIGN=left NOWRAP>interface</TD>
304 </TR>
305 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>propget</FONT></TT></TD>
306 <TD ALIGN=left NOWRAP>function declaration</TD>
307 </TR>
308 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>propput</FONT></TT></TD>
309 <TD ALIGN=left NOWRAP>function declaration</TD>
310 </TR>
311 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>propputref</FONT></TT></TD>
312 <TD ALIGN=left NOWRAP>function declaration</TD>
313 </TR>
314 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>ptr</FONT></TT> </TD>
315 <TD ALIGN=left NOWRAP>any pointer type</TD>
316 </TR>
317 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>ref</FONT></TT> </TD>
318 <TD ALIGN=left NOWRAP>any pointer type</TD>
319 </TR>
320 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>set</FONT></TT> </TD>
321 <TD ALIGN=left NOWRAP>enum type</TD>
322 </TR>
323 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>size_is</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>le</FONT></I></TT><SUB><FONT SIZE=2>1</FONT></SUB><TT><FONT COLOR=blue>,</FONT></TT>&nbsp;<TT><I><FONT COLOR=maroon>le</FONT></I></TT><SUB><FONT SIZE=2>2</FONT></SUB><TT><FONT COLOR=blue>,</FONT></TT>...<TT><FONT COLOR=blue>)</FONT></TT> </TD>
324 <TD ALIGN=left NOWRAP>array type</TD>
325 </TR>
326 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>string</FONT></TT> </TD>
327 <TD ALIGN=left NOWRAP>character array or pointer</TD>
328 </TR>
329 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>switch_is</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>le</FONT></I></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
330 <TD ALIGN=left NOWRAP>union type or pointer to union</TD>
331 </TR>
332 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>switch_type</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>ty</FONT></I></TT><TT><FONT COLOR=blue>)</FONT></TT> </TD>
333 <TD ALIGN=left NOWRAP>union or pointer to union</TD>
334 </TR>
335 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>unique</FONT></TT> </TD>
336 <TD ALIGN=left NOWRAP>any pointer, array, or bigarray type</TD>
337 </TR>
338 <TR><TD ALIGN=left NOWRAP><TT><FONT COLOR=blue>uuid</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT> <TT><I><FONT COLOR=maroon>uuid</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT> </TD>
339 <TD ALIGN=left NOWRAP>interface</TD>
340 </TR></TABLE></DIV><BR>
341 <A NAME="toc6"></A>
342 <H3><A NAME="htoc8">2.4</A>&nbsp;&nbsp;Types and declarators</H3>
343 The declaration of an identifier along with its type is as in C:
344 a type specification comes first, followed by the identifier possibly
345 decorated with <TT>*</TT> and <TT>[...]</TT> to denote pointers and array types.
346 For instance, <TT>int x</TT> declares an identifier <TT>x</TT> of type <TT>int</TT>,
347 while <TT>int (*x)[]</TT> declares an identifier <TT>x</TT> that is a pointer to an
348 array of integers.
349 <DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
350 <TR><TD ALIGN=right NOWRAP>
351 <TT><I><FONT COLOR=maroon>type-spec</FONT></I></TT></TD>
352 <TD ALIGN=right NOWRAP>::=</TD>
353 <TD ALIGN=left NOWRAP>
354 [<TT><FONT COLOR=blue>unsigned</FONT></TT>| <TT><FONT COLOR=blue>signed</FONT></TT>]
355 (<TT><FONT COLOR=blue>int</FONT></TT>| <TT><FONT COLOR=blue>short</FONT></TT>| <TT><FONT COLOR=blue>long</FONT></TT>| <TT><FONT COLOR=blue>char</FONT></TT>| <TT><FONT COLOR=blue>hyper</FONT></TT>| <TT><FONT COLOR=blue>long</FONT></TT> <TT><FONT COLOR=blue>long</FONT></TT>| <TT><FONT COLOR=blue>__int64</FONT></TT>)</TD>
356 </TR>
357 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
358 <TD ALIGN=right NOWRAP>|</TD>
359 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>byte</FONT></TT></TD>
360 </TR>
361 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
362 <TD ALIGN=right NOWRAP>|</TD>
363 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>float</FONT></TT></TD>
364 </TR>
365 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
366 <TD ALIGN=right NOWRAP>|</TD>
367 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>double</FONT></TT></TD>
368 </TR>
369 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
370 <TD ALIGN=right NOWRAP>|</TD>
371 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>boolean</FONT></TT></TD>
372 </TR>
373 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
374 <TD ALIGN=right NOWRAP>|</TD>
375 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>void</FONT></TT></TD>
376 </TR>
377 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
378 <TD ALIGN=right NOWRAP>|</TD>
379 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
380 </TR>
381 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
382 <TD ALIGN=right NOWRAP>|</TD>
383 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>wchar_t</FONT></TT></TD>
384 </TR>
385 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
386 <TD ALIGN=right NOWRAP>|</TD>
387 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>handle_t</FONT></TT></TD>
388 </TR>
389 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
390 <TD ALIGN=right NOWRAP>|</TD>
391 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>struct</FONT></TT> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
392 </TR>
393 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
394 <TD ALIGN=right NOWRAP>|</TD>
395 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>union</FONT></TT> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
396 </TR>
397 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
398 <TD ALIGN=right NOWRAP>|</TD>
399 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>enum</FONT></TT> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
400 </TR>
401 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
402 <TD ALIGN=right NOWRAP>|</TD>
403 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>struct-decl</FONT></I></TT></TD>
404 </TR>
405 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
406 <TD ALIGN=right NOWRAP>|</TD>
407 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>union-decl</FONT></I></TT></TD>
408 </TR>
409 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
410 <TD ALIGN=right NOWRAP>|</TD>
411 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>enum-decl</FONT></I></TT></TD>
412 </TR>
413 <TR><TD ALIGN=right NOWRAP>
414 <TT><I><FONT COLOR=maroon>declarator</FONT></I></TT></TD>
415 <TD ALIGN=right NOWRAP>::=</TD>
416 <TD ALIGN=left NOWRAP>
417 {<TT><FONT COLOR=blue>*</FONT></TT>} <TT><I><FONT COLOR=maroon>direct-declarator</FONT></I></TT></TD>
418 </TR>
419 <TR><TD ALIGN=right NOWRAP>
420 <TT><I><FONT COLOR=maroon>direct-declarator</FONT></I></TT></TD>
421 <TD ALIGN=right NOWRAP>::=</TD>
422 <TD ALIGN=left NOWRAP>
423 <TT><I><FONT COLOR=maroon>ident</FONT></I></TT></TD>
424 </TR>
425 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
426 <TD ALIGN=right NOWRAP>|</TD>
427 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>(</FONT></TT> <TT><I><FONT COLOR=maroon>declarator</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT></TD>
428 </TR>
429 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
430 <TD ALIGN=right NOWRAP>|</TD>
431 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>direct-declarator</FONT></I></TT> <TT><FONT COLOR=blue>[</FONT></TT> &nbsp;[<TT><I><FONT COLOR=maroon>const-lexpr</FONT></I></TT>] <TT><FONT COLOR=blue>]</FONT></TT></TD>
432 </TR></TABLE></DIV><BR>
433 <A NAME="toc7"></A>
434 <H3><A NAME="htoc9">2.5</A>&nbsp;&nbsp;Structures, unions and enumerations</H3><BR>
435 <DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
436 <TR><TD ALIGN=right NOWRAP>
437 <TT><I><FONT COLOR=maroon>struct-decl</FONT></I></TT></TD>
438 <TD ALIGN=right NOWRAP>::=</TD>
439 <TD ALIGN=left NOWRAP>
440 <TT><FONT COLOR=blue>struct</FONT></TT> [<TT><I><FONT COLOR=maroon>ident</FONT></I></TT>] <TT><FONT COLOR=blue>{</FONT></TT> &nbsp;{<TT><I><FONT COLOR=maroon>field-decl</FONT></I></TT>} <TT><FONT COLOR=blue>}</FONT></TT></TD>
441 </TR>
442 <TR><TD ALIGN=right NOWRAP>
443 <TT><I><FONT COLOR=maroon>field-decl</FONT></I></TT></TD>
444 <TD ALIGN=right NOWRAP>::=</TD>
445 <TD ALIGN=left NOWRAP>
446 <TT><I><FONT COLOR=maroon>attributes</FONT></I></TT> &nbsp;<TT><I><FONT COLOR=maroon>type-spec</FONT></I></TT> &nbsp;<TT><I><FONT COLOR=maroon>declarator</FONT></I></TT> &nbsp;{ <TT><FONT COLOR=blue>,</FONT></TT> <TT><I><FONT COLOR=maroon>declarator</FONT></I></TT> } <TT><FONT COLOR=blue>;</FONT></TT></TD>
447 </TR>
448 <TR><TD ALIGN=right NOWRAP>
449 <TT><I><FONT COLOR=maroon>union-decl</FONT></I></TT></TD>
450 <TD ALIGN=right NOWRAP>::=</TD>
451 <TD ALIGN=left NOWRAP>
452 <TT><FONT COLOR=blue>union</FONT></TT> [<TT><I><FONT COLOR=maroon>ident</FONT></I></TT>] <TT><FONT COLOR=blue>{</FONT></TT> &nbsp;{<TT><I><FONT COLOR=maroon>union-case</FONT></I></TT>} <TT><FONT COLOR=blue>}</FONT></TT></TD>
453 </TR>
454 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
455 <TD ALIGN=right NOWRAP>|</TD>
456 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>union</FONT></TT> [<TT><I><FONT COLOR=maroon>ident</FONT></I></TT>] <TT><FONT COLOR=blue>switch</FONT></TT> <TT><FONT COLOR=blue>(</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>type-spec</FONT></I></TT> &nbsp;<TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT> <TT><FONT COLOR=blue>{</FONT></TT> &nbsp;{<TT><I><FONT COLOR=maroon>union-case</FONT></I></TT>} <TT><FONT COLOR=blue>}</FONT></TT></TD>
457 </TR>
458 <TR><TD ALIGN=right NOWRAP>
459 <TT><I><FONT COLOR=maroon>union-case</FONT></I></TT></TD>
460 <TD ALIGN=right NOWRAP>::=</TD>
461 <TD ALIGN=left NOWRAP>
462 {<TT><FONT COLOR=blue>case</FONT></TT> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>:</FONT></TT>}<SUP><FONT SIZE=2>+</FONT></SUP> &nbsp;[<TT><I><FONT COLOR=maroon>field-decl</FONT></I></TT>] <TT><FONT COLOR=blue>;</FONT></TT>
463 <TT><FONT COLOR=blue>default</FONT></TT> <TT><FONT COLOR=blue>:</FONT></TT> &nbsp;[<TT><I><FONT COLOR=maroon>field-decl</FONT></I></TT>] <TT><FONT COLOR=blue>;</FONT></TT></TD>
464 </TR>
465 <TR><TD ALIGN=right NOWRAP>
466 <TT><I><FONT COLOR=maroon>enum-decl</FONT></I></TT></TD>
467 <TD ALIGN=right NOWRAP>::=</TD>
468 <TD ALIGN=left NOWRAP>
469 <TT><FONT COLOR=blue>enum</FONT></TT> [<TT><I><FONT COLOR=maroon>ident</FONT></I></TT>] <TT><FONT COLOR=blue>{</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>enum-case</FONT></I></TT> &nbsp;{<TT><FONT COLOR=blue>,</FONT></TT> <TT><I><FONT COLOR=maroon>enum-case</FONT></I></TT>} &nbsp;[<TT><FONT COLOR=blue>,</FONT></TT>] <TT><FONT COLOR=blue>}</FONT></TT></TD>
470 </TR>
471 <TR><TD ALIGN=right NOWRAP>
472 <TT><I><FONT COLOR=maroon>enum-case</FONT></I></TT></TD>
473 <TD ALIGN=right NOWRAP>::=</TD>
474 <TD ALIGN=left NOWRAP>
475 <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> &nbsp;[<TT><FONT COLOR=blue>=</FONT></TT> <TT><I><FONT COLOR=maroon>const-lexpr</FONT></I></TT>]</TD>
476 </TR></TABLE></DIV><BR>
477 IDL <TT>struct</TT> declarations are like those of C, with the addition of
478 optional attributes on each field. <TT>union</TT> declarations are also as
479 in C, except that each case of an union must be labeled by one or
480 several <TT><FONT COLOR=blue>case</FONT></TT> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>:</FONT></TT>. The first form of union declaration
481 assumes that the discriminant of the union is provided separately
482 via a <TT>switch_is</TT> annotation on the union type, while the second form
483 encapsulates the discriminant along with the union itself
484 (like in Pascal's <TT>record case of</TT> construct).<BR>
485 <BR>
486 <A NAME="toc8"></A>
487 <H3><A NAME="htoc10">2.6</A>&nbsp;&nbsp;Function declarations</H3><BR>
488 <DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
489 <TR><TD ALIGN=right NOWRAP>
490 <TT><I><FONT COLOR=maroon>function-decl</FONT></I></TT></TD>
491 <TD ALIGN=right NOWRAP>::=</TD>
492 <TD ALIGN=left NOWRAP>
493 <TT><I><FONT COLOR=maroon>attributes</FONT></I></TT> &nbsp;<TT><I><FONT COLOR=maroon>type-spec</FONT></I></TT> &nbsp;{<TT><FONT COLOR=blue>*</FONT></TT>} <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>(</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>params</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT> &nbsp;{<TT><FONT COLOR=blue>quote</FONT></TT><TT><FONT COLOR=blue>(</FONT></TT><TT><I><FONT COLOR=maroon>ident</FONT></I></TT><TT><FONT COLOR=blue>,</FONT></TT>&nbsp;<TT><I><FONT COLOR=maroon>string</FONT></I></TT><TT><FONT COLOR=blue>)</FONT></TT>}</TD>
494 </TR>
495 <TR><TD ALIGN=right NOWRAP>
496 <TT><I><FONT COLOR=maroon>params</FONT></I></TT></TD>
497 <TD ALIGN=right NOWRAP>::=</TD>
498 <TD ALIGN=left NOWRAP>
499 <FONT FACE=symbol>e</FONT></TD>
500 </TR>
501 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
502 <TD ALIGN=right NOWRAP>|</TD>
503 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>void</FONT></TT></TD>
504 </TR>
505 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
506 <TD ALIGN=right NOWRAP>|</TD>
507 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>param</FONT></I></TT> &nbsp;{ <TT><FONT COLOR=blue>,</FONT></TT> <TT><I><FONT COLOR=maroon>param</FONT></I></TT> }</TD>
508 </TR>
509 <TR><TD ALIGN=right NOWRAP>
510 <TT><I><FONT COLOR=maroon>param</FONT></I></TT></TD>
511 <TD ALIGN=right NOWRAP>::=</TD>
512 <TD ALIGN=left NOWRAP>
513 <TT><I><FONT COLOR=maroon>attributes</FONT></I></TT> &nbsp;<TT><I><FONT COLOR=maroon>type-spec</FONT></I></TT> &nbsp;<TT><I><FONT COLOR=maroon>declarator</FONT></I></TT></TD>
514 </TR></TABLE></DIV>
515 Function declarations are like in ANSI C, with the addition of
516 attributes on each parameter and on the function itself.
517 Parameters must be named. The optional <TT><I><FONT COLOR=maroon>quote</FONT></I></TT> statements following the
518 declaration are user-provided calling sequences and deallocation
519 sequences that replaces the default sequences in the
520 <TT>camlidl</TT>-generated stub code for the function.<BR>
521 <BR>
522 <A NAME="toc9"></A>
523 <H3><A NAME="htoc11">2.7</A>&nbsp;&nbsp;Constant definitions</H3><BR>
524 <DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
525 <TR><TD ALIGN=right NOWRAP>
526 <TT><I><FONT COLOR=maroon>constant-decl</FONT></I></TT></TD>
527 <TD ALIGN=right NOWRAP>::=</TD>
528 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>const</FONT></TT> <TT><I><FONT COLOR=maroon>attributes</FONT></I></TT> &nbsp;<TT><I><FONT COLOR=maroon>type-spec</FONT></I></TT> &nbsp;{<TT><FONT COLOR=blue>*</FONT></TT>} <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>=</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>const-lexpr</FONT></I></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
529 </TR></TABLE></DIV>
530 A constant declaration associates a name to a limited expression.
531 The limited expression can refer to constant names declared earlier,
532 but cannot refer to other kinds of identifiers. The optional
533 attributes influence the interpretation of the type specification,
534 e.g. <TT>const int x = 3</TT> defines <TT>x</TT> with Caml type <TT>int</TT>, but
535 <TT>const [int64] long x = 5</TT> defines <TT>x</TT> with Caml type <TT>int64</TT>.<BR>
536 <BR>
537 <A NAME="toc10"></A>
538 <H3><A NAME="htoc12">2.8</A>&nbsp;&nbsp;IDL files</H3><BR>
539 <DIV ALIGN=center><TABLE CELLSPACING=2 CELLPADDING=0>
540 <TR><TD ALIGN=right NOWRAP>
541 <TT><I><FONT COLOR=maroon>file</FONT></I></TT></TD>
542 <TD ALIGN=right NOWRAP>::=</TD>
543 <TD ALIGN=left NOWRAP> {<TT><I><FONT COLOR=maroon>decl</FONT></I></TT>}</TD>
544 </TR>
545 <TR><TD ALIGN=right NOWRAP>
546 <TT><I><FONT COLOR=maroon>decl</FONT></I></TT></TD>
547 <TD ALIGN=right NOWRAP>::=</TD>
548 <TD ALIGN=left NOWRAP>
549 <TT><I><FONT COLOR=maroon>function-decl</FONT></I></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
550 </TR>
551 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
552 <TD ALIGN=right NOWRAP>|</TD>
553 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>constant-decl</FONT></I></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
554 </TR>
555 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
556 <TD ALIGN=right NOWRAP>|</TD>
557 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>struct-decl</FONT></I></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
558 </TR>
559 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
560 <TD ALIGN=right NOWRAP>|</TD>
561 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>union-decl</FONT></I></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
562 </TR>
563 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
564 <TD ALIGN=right NOWRAP>|</TD>
565 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>enum-decl</FONT></I></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
566 </TR>
567 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
568 <TD ALIGN=right NOWRAP>|</TD>
569 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>typedef</FONT></TT> <TT><I><FONT COLOR=maroon>attributes</FONT></I></TT> &nbsp;<TT><I><FONT COLOR=maroon>type-spec</FONT></I></TT> &nbsp;<TT><I><FONT COLOR=maroon>declarator</FONT></I></TT> &nbsp;{ <TT><FONT COLOR=blue>,</FONT></TT> <TT><I><FONT COLOR=maroon>declarator</FONT></I></TT> } <TT><FONT COLOR=blue>;</FONT></TT></TD>
570 </TR>
571 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
572 <TD ALIGN=right NOWRAP>|</TD>
573 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>attributes</FONT></I></TT> <TT><FONT COLOR=blue>interface</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>ident</FONT></I></TT> &nbsp;[ <TT><FONT COLOR=blue>:</FONT></TT> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> ] <TT><FONT COLOR=blue>{</FONT></TT> &nbsp;{<TT><I><FONT COLOR=maroon>decl</FONT></I></TT>} <TT><FONT COLOR=blue>}</FONT></TT></TD>
574 </TR>
575 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
576 <TD ALIGN=right NOWRAP>|</TD>
577 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>struct</FONT></TT> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
578 </TR>
579 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
580 <TD ALIGN=right NOWRAP>|</TD>
581 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>union</FONT></TT> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
582 </TR>
583 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
584 <TD ALIGN=right NOWRAP>|</TD>
585 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>union</FONT></TT> <TT><FONT COLOR=blue>switch</FONT></TT> <TT><FONT COLOR=blue>(</FONT></TT> <TT><I><FONT COLOR=maroon>type-spec</FONT></I></TT> &nbsp;<TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
586 </TR>
587 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
588 <TD ALIGN=right NOWRAP>|</TD>
589 <TD ALIGN=left NOWRAP> <TT><I><FONT COLOR=maroon>attributes</FONT></I></TT> <TT><FONT COLOR=blue>interface</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
590 </TR>
591 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
592 <TD ALIGN=right NOWRAP>|</TD>
593 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>import</FONT></TT> <TT><I><FONT COLOR=maroon>string</FONT></I></TT> <TT><FONT COLOR=blue>;</FONT></TT></TD>
594 </TR>
595 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
596 <TD ALIGN=right NOWRAP>|</TD>
597 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>quote</FONT></TT> <TT><FONT COLOR=blue>(</FONT></TT> [<TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>,</FONT></TT>] &nbsp;<TT><I><FONT COLOR=maroon>string</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT></TD>
598 </TR>
599 <TR><TD ALIGN=right NOWRAP>&nbsp;</TD>
600 <TD ALIGN=right NOWRAP>|</TD>
601 <TD ALIGN=left NOWRAP> <TT><FONT COLOR=blue>cpp_quote</FONT></TT> <TT><FONT COLOR=blue>(</FONT></TT> <TT><I><FONT COLOR=maroon>string</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT></TD>
602 </TR></TABLE></DIV>
603 An IDL file is a sequence of IDL declarations. Declarations include
604 function declarations, constant declarations, type declarations
605 (structs, unions, enums, as well as a C-style <TT>typedef</TT> declaration to
606 name a type expression), and interfaces.<BR>
607 <BR>
608 An interface declaration gives a name and attributes to a collection
609 of declarations. For interfaces with the <TT>object</TT> attribute,
610 an optional super-interface can be provided, as in
611 <TT><FONT COLOR=blue>interface</FONT></TT> <TT><I><FONT COLOR=maroon>intf</FONT></I></TT> <TT><FONT COLOR=blue>:</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>super-intf</FONT></I></TT>. The name of the interface can be
612 used as a type name in the remainder of the file.<BR>
613 <BR>
614 Forward declarations of structs, unions and interfaces are supported
615 in the usual C manner, by just giving the name of the struct, union or
616 interface, but not its actual contents.<BR>
617 <BR>
618 The <TT>import</TT> statement reads another IDL file and makes available its
619 type and constant declarations in the remainder of the file.
620 No code is generated for the functions and interfaces declared in the
621 imported file. The same file can be imported several times, but is
622 read in only the first time.<BR>
623 <BR>
624 The <TT><FONT COLOR=blue>quote</FONT></TT> <TT><FONT COLOR=blue>(</FONT></TT> <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> <TT><FONT COLOR=blue>,</FONT></TT> &nbsp;<TT><I><FONT COLOR=maroon>str</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT> diversion copies the string <TT><I><FONT COLOR=maroon>str</FONT></I></TT>
625 verbatim to one of the files generated by the <TT>camlidl</TT> compiler.
626 The <TT><I><FONT COLOR=maroon>ident</FONT></I></TT> determines the file where <TT><I><FONT COLOR=maroon>str</FONT></I></TT> is copied:
627 it can be <TT>ml</TT> for the Caml implementation file (<TT>.ml</TT>),
628 <TT>mli</TT> for the Caml interface file (<TT>.mli</TT>),
629 <TT>mlmli</TT> for both Caml files,
630 <TT>h</TT> for the C header file (<TT>.h</TT>),
631 and <TT>c</TT> for the C source file containing the generated stub code (<TT>.c</TT>
632 file). For backward compatibility, <TT><FONT COLOR=blue>cpp_quote</FONT></TT> <TT><FONT COLOR=blue>(</FONT></TT> <TT><I><FONT COLOR=maroon>str</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT> is
633 recognized as synonymous for <TT><FONT COLOR=blue>quote</FONT></TT> <TT><FONT COLOR=blue>(</FONT></TT> <TT><FONT COLOR=blue>h</FONT></TT> <TT><FONT COLOR=blue>,</FONT></TT> <TT><I><FONT COLOR=maroon>str</FONT></I></TT> <TT><FONT COLOR=blue>)</FONT></TT>.<BR>
634 <BR>
635 <HR>
636 <A HREF="main001.html"><IMG SRC ="previous_motif.gif" ALT="Previous"></A>
637 <A HREF="index.html"><IMG SRC ="contents_motif.gif" ALT="Contents"></A>
638 <A HREF="main003.html"><IMG SRC ="next_motif.gif" ALT="Next"></A>
639 </BODY>
640 </HTML>