aboutsummaryrefslogblamecommitdiffstats
path: root/lib/ic/doc/src/ch_basic_idl.xml
blob: d993fa3594f2a38148a8112559cc54a6a471644a (plain) (tree)


































































































































































                                                                                                                                          
<?xml version="1.0" encoding="latin1" ?>
<!DOCTYPE chapter SYSTEM "chapter.dtd">

<chapter>
  <header>
    <copyright>
      <year>2002</year><year>2009</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>