~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/orber/doc/src/ch_idl_to_erlang_mapping.xml

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
<chapter>
5
5
  <header>
6
6
    <copyright>
7
 
      <year>1997</year><year>2009</year>
 
7
      <year>1997</year><year>2010</year>
8
8
      <holder>Ericsson AB. All Rights Reserved.</holder>
9
9
    </copyright>
10
10
    <legalnotice>
286
286
typedef wstring<10> myWString10;
287
287
      ]]></code>
288
288
      <p>If we want to define a char/string or wchar/wstring constant, we can
289
 
        use octal (\\OOO - one, two or three octal digits), 
290
 
        hexadecimal (\\xHH - one or two hexadecimal digits) and unicode (\\uHHHH -
 
289
        use octal (\OOO - one, two or three octal digits), 
 
290
        hexadecimal (\xHH - one or two hexadecimal digits) and unicode (\uHHHH -
291
291
        one, two, three or four hexadecimal digits.) representation as well.
292
292
        For example:</p>
293
293
      <code type="none">
294
 
const string  SwedensBestSoccerTeam = "\\101" "\\x49" "\\u004B";
295
 
const wstring SwedensBestHockeyTeam = L"\\101\\x49\\u004B";
296
 
const char  aChar  = '\\u004B';  
297
 
const wchar aWchar = L'\\u004C';
 
294
const string  SwedensBestSoccerTeam = "\101" "\x49" "\u004B";
 
295
const wstring SwedensBestHockeyTeam = L"\101\x49\u004B";
 
296
const char  aChar  = '\u004B';  
 
297
const wchar aWchar = L'\u004C';
298
298
      </code>
299
299
      <p>Naturally, we can use <c>"Erlang"</c>, <c>L"Rocks"</c>, <c>'A'</c>
300
300
        and <c>L'A'</c> as well.</p>
445
445
    <section>
446
446
      <title>Struct Data Type</title>
447
447
      <p>A <c>struct</c> may have Basic, Template, Scoped Names and Constructed 
448
 
        types as members.</p>
 
448
        types as members. By using forward declaration we can define a recursive struct:</p>
 
449
      <code type="none"><![CDATA[
 
450
struct myStruct; // Forward declaration
 
451
typedef sequence<myStruct> myStructSeq;
 
452
struct myStruct {
 
453
    myStructSeq chain;
 
454
};
 
455
 
 
456
// Deprecated definition (anonymous) not supported by IC
 
457
struct myStruct {
 
458
    sequence<myStruct> chain;
 
459
};
 
460
      ]]></code>
449
461
    </section>
450
462
 
451
463
    <section>
510
522
  default: boolean DefaultValue; 
511
523
};
512
524
      </code>
 
525
      <p>In the same way as structs, unions can be recursive if forward
 
526
         declaration is used (anonymous types is deprecated and not supported):</p>
 
527
      <code type="none"><![CDATA[
 
528
// Forward declaration
 
529
union myUnion;
 
530
typedef sequence<myUnion>myUnionSeq;
 
531
union myUnion switch (long) {
 
532
    case 1 : myUnionSeq chain;
 
533
    default: boolean DefaultValue;
 
534
};
 
535
      ]]></code>
 
536
 
 
537
    <note>
 
538
      <p>Recursive types (union and struct) require Light IFR. I.e. the
 
539
         IC option {light_ifr, true} is used and that Orber is configured in such a way that
 
540
         Light IFR is activated. Recursive TypeCode is currently not supported, which is
 
541
         why these cannot be encapsulated in an any data type.</p>
 
542
    </note>
 
543
 
513
544
    </section>
514
545
    <warning>
515
546
      <p>Every field in, for example, a struct must be initiated. Otherwise
697
728
module x {
698
729
 
699
730
    struct y_z {
700
 
\011...
 
731
    ...
701
732
    };
702
733
 
703
734
    interface y {
704
735
 
705
 
\011struct z {
706
 
\011    ...
707
 
\011};
 
736
    struct z {
 
737
        ...
 
738
    };
708
739
    };
709
740
};
710
741
      </code>
815
846
    const float pi = 3.14;
816
847
 
817
848
    interface i {
818
 
\011const float pi = 3.1415;
 
849
    const float pi = 3.1415;
819
850
    };
820
851
};
821
852
    </code>
890
921
      object internal state with its object reference. The object internal state is
891
922
      an Erlang term which has a format defined by the user.</p>
892
923
    <note>
893
 
      <p>It is is not always the case that the internal state will be the first parameter, as stubs can use their own object reference as the first parameter (see the IC documentation).</p>
 
924
      <p>It is not always the case that the internal state will be the first parameter, as stubs can use their own object reference as the first parameter (see the IC documentation).</p>
894
925
    </note>
895
926
    <p>A function call will invoke an operation. The first
896
927
      parameter of the function should be the object reference and then
1036
1067
%% Description: 
1037
1068
%%----------------------------------------------------------------------
1038
1069
logon(State, ID, PW) ->
1039
 
\011%% Check if the ID/PW is valid and what 
1040
 
\011%% type of user it is (Common or Administrator).
1041
 
\011OE_Reply
 
1070
    %% Check if the ID/PW is valid and what 
 
1071
    %% type of user it is (Common or Administrator).
 
1072
    OE_Reply
1042
1073
            = case check_user(ID, PW) of
1043
 
\011         {ok, administrator} ->
1044
 
\011            'DB_Administrator':oe_create();
1045
 
\011         {ok, common} ->
1046
 
\011            'DB_CommonUser':oe_create();
1047
 
\011         error ->
1048
 
\011            %% Here we should throw an exception              
1049
 
 \011           corba:raise(....)
 
1074
             {ok, administrator} ->
 
1075
                'DB_Administrator':oe_create();
 
1076
             {ok, common} ->
 
1077
                'DB_CommonUser':oe_create();
 
1078
             error ->
 
1079
                %% Here we should throw an exception              
 
1080
                corba:raise(....)
1050
1081
        end,
1051
 
\011{reply, OE_Reply, State}.
 
1082
    {reply, OE_Reply, State}.
1052
1083
 
1053
1084
%%======================================================================
1054
1085
%% Internal Functions
1064
1095
%% Description: Initiates the server
1065
1096
%%----------------------------------------------------------------------
1066
1097
init(_Env) ->
1067
 
\011{ok, #state{}}.
 
1098
    {ok, #state{}}.
1068
1099
 
1069
1100
 
1070
1101
%%----------------------------------------------------------------------
1076
1107
%% Description: Invoked when the object is terminating.
1077
1108
%%----------------------------------------------------------------------
1078
1109
terminate(_Reason, _State) ->
1079
 
\011ok.
 
1110
    ok.
1080
1111
 
1081
1112
 
1082
1113
%%----------------------------------------------------------------------
1090
1121
%%              due to code replacement.
1091
1122
%%----------------------------------------------------------------------
1092
1123
code_change(_OldVsn, State, _Extra) ->
1093
 
\011{ok, State}.
 
1124
    {ok, State}.
1094
1125
 
1095
1126
 
1096
1127
%%----------------------------------------------------------------------
1104
1135
%% Description: Invoked when, for example, the server traps exits.
1105
1136
%%----------------------------------------------------------------------
1106
1137
handle_info(_Info, State) ->
1107
 
\011{noreply, State}.
 
1138
    {noreply, State}.
1108
1139
    ]]></code>
1109
1140
    <p>Since <c>DB_Administrator</c> inherits from <c>DB_CommonUser</c>,
1110
1141
      we must implement <c>delete</c> in the <c>DB_Administrator_impl.erl</c>
1421
1452
      </row>
1422
1453
      <row>
1423
1454
        <cell align="left" valign="middle">{tk_objref, IFRId, Name}</cell>
1424
 
        <cell align="left" valign="middle">{tk_objref, "IDL:M1\\I1:1.0", "I1"}</cell>
 
1455
        <cell align="left" valign="middle">{tk_objref, "IDL:M1\I1:1.0", "I1"}</cell>
1425
1456
      </row>
1426
1457
      <row>
1427
1458
        <cell align="left" valign="middle">{tk_struct, IFRId, Name, [{ElemName, ElemTC}]}</cell>
1428
 
        <cell align="left" valign="middle">{tk_struct, "IDL:M1\\S1:1.0", "S1", [{"a", tk_long}, {"b", tk_char}]}</cell>
 
1459
        <cell align="left" valign="middle">{tk_struct, "IDL:M1\S1:1.0", "S1", [{"a", tk_long}, {"b", tk_char}]}</cell>
1429
1460
      </row>
1430
1461
      <row>
1431
1462
        <cell align="left" valign="middle">{tk_union, IFRId, Name, DiscrTC, DefaultNr, [{Label, ElemName, ElemTC}]}         <br></br>