aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ic/doc/src/ch_basic_idl.xml
blob: 986052bf16c749401c9e995a0e06f90cc2d07465 (plain) (blame)
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
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>
  <header>
    <copyright>
      <year>2002</year><year>2013</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      The contents of this file are subject to the Erlang Public License,
      Version 1.1, (the "License"); you may not use this file except in
      compliance with the License. You should have received a copy of the
      Erlang Public License along with this software. If not, it can be
      retrieved online at http://www.erlang.org/.
    
      Software distributed under the License is distributed on an "AS IS"
      basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
      the License for the specific language governing rights and limitations
      under the License.
    
    </legalnotice>

    <title>OMG IDL</title>
    <prepared></prepared>
    <docno></docno>
    <date>2002-07-15</date>
    <rev></rev>
    <file>ch_basic_idl.xml</file>
  </header>

  <section>
    <title>OMG IDL - Overview</title>
    <p>The purpose of OMG IDL, <em>Interface Definition Language</em>, mapping
      is to act as translator between platforms and languages. An IDL 
      specification is supposed to describe data types, object types etc.</p>
    <p>Since the <c>C</c> and <c>Java</c> IC backends only supports a subset of the
      IDL types supported by the other backends, the mapping is divided into
      different parts. For more information about IDL to Erlang mapping,
      i.e., <c>CORBA</c>, plain Erlang and generic Erlang Server, see the Orber
      User's Guide. How to use the plain Erlang and generic Erlang Server is
      found in this User's Guide.</p>

    <section>
      <title>Reserved Compiler Names and Keywords</title>
      <p>The use of some names is  strongly discouraged due to 
        ambiguities. However, the use of some names is prohibited 
        when using the Erlang mapping , as they are strictly reserved for IC.</p>
      <p>IC reserves all identifiers starting with <c>OE_</c> and <c>oe_</c> 
        for internal use.</p>
      <p>Note also, that an identifier in IDL can  contain alphabetic,
        digits and underscore characters, but the first character 
        <em>must</em> be alphabetic.
        </p>
      <p>Using underscores in IDL names can lead to ambiguities
        due to the name mapping described above. It is advisable to 
        avoid the use of underscores in identifiers.</p>
      <p>The OMG defines a set of reserved words, shown below, for use as keywords. 
        These may <em>not</em> be used as, for example, identifiers.</p>
      <table>
        <row>
          <cell align="left" valign="middle">abstract</cell>
          <cell align="left" valign="middle">double</cell>
          <cell align="left" valign="middle">local</cell>
          <cell align="left" valign="middle">raises</cell>
          <cell align="left" valign="middle">typedef</cell>
        </row>
        <row>
          <cell align="left" valign="middle">any</cell>
          <cell align="left" valign="middle">exception</cell>
          <cell align="left" valign="middle">long</cell>
          <cell align="left" valign="middle">readonly</cell>
          <cell align="left" valign="middle">unsigned</cell>
        </row>
        <row>
          <cell align="left" valign="middle">attribute</cell>
          <cell align="left" valign="middle">enum</cell>
          <cell align="left" valign="middle">module</cell>
          <cell align="left" valign="middle">sequence</cell>
          <cell align="left" valign="middle">union</cell>
        </row>
        <row>
          <cell align="left" valign="middle">boolean</cell>
          <cell align="left" valign="middle">factory</cell>
          <cell align="left" valign="middle">native</cell>
          <cell align="left" valign="middle">short</cell>
          <cell align="left" valign="middle">ValueBase</cell>
        </row>
        <row>
          <cell align="left" valign="middle">case</cell>
          <cell align="left" valign="middle">FALSE</cell>
          <cell align="left" valign="middle">Object</cell>
          <cell align="left" valign="middle">string</cell>
          <cell align="left" valign="middle">valuetype</cell>
        </row>
        <row>
          <cell align="left" valign="middle">char</cell>
          <cell align="left" valign="middle">fixed</cell>
          <cell align="left" valign="middle">octet</cell>
          <cell align="left" valign="middle">struct</cell>
          <cell align="left" valign="middle">void</cell>
        </row>
        <row>
          <cell align="left" valign="middle">const</cell>
          <cell align="left" valign="middle">float</cell>
          <cell align="left" valign="middle">oneway</cell>
          <cell align="left" valign="middle">supports</cell>
          <cell align="left" valign="middle">wchar</cell>
        </row>
        <row>
          <cell align="left" valign="middle">context</cell>
          <cell align="left" valign="middle">in</cell>
          <cell align="left" valign="middle">out</cell>
          <cell align="left" valign="middle">switch</cell>
          <cell align="left" valign="middle">wstring</cell>
        </row>
        <row>
          <cell align="left" valign="middle">custom</cell>
          <cell align="left" valign="middle">inout</cell>
          <cell align="left" valign="middle">private</cell>
          <cell align="left" valign="middle">TRUE</cell>
          <cell align="left" valign="middle"></cell>
        </row>
        <row>
          <cell align="left" valign="middle">default</cell>
          <cell align="left" valign="middle">interface</cell>
          <cell align="left" valign="middle">public</cell>
          <cell align="left" valign="middle">truncatable</cell>
          <cell align="left" valign="middle"></cell>
        </row>
        <tcaption>OMG IDL keywords</tcaption>
      </table>
      <p>The keywords listed above must be written exactly as shown. Any usage
        of identifiers that collide with a keyword is illegal. For example,
        <em>long</em> is a valid keyword; <em>Long</em> and <em>LONG</em> are
        illegal as keywords and identifiers. But, since the OMG must be able
        to expand the IDL grammar, it is possible to use <em>Escaped  Identifiers</em>. For example, it is not unlikely that <c>native</c>
        have been used in IDL-specifications as identifiers. One option is to
        change all occurrences to <c>myNative</c>. Usually, it is necessary
        to change programming language code that depends upon that IDL as well.
        Since Escaped Identifiers just disable type checking (i.e. if it is a reserved
        word or not) and leaves everything else unchanged, it is only necessary to
        update the IDL-specification. To escape an identifier, simply prefix it
        with <c>_</c>. The following IDL-code is illegal:</p>
      <code type="none">
typedef string native;
interface i {
   void foo(in native Arg);
   };
};
      </code>
      <p>With Escaped Identifiers the code will look like:</p>
      <code type="none">
typedef string _native;
interface i {
   void foo(in _native Arg);
   };
};
      </code>
    </section>
  </section>
</chapter>