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