
// %CopyrightBegin%
// 
// Copyright Ericsson AB 2004-2016. All Rights Reserved.
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// 
// %CopyrightEnd%

#include "erlang.idl"


const short TestConst = 1;

module m {

  const short TestConst = 2;

  struct b {
    long l;
    char c;
  }; 

  struct simple {
    long l;
    b    b_t;
  };

  enum fruit {orange, banana, apple, peach, pear};

  typedef sequence<long> lseq;

  typedef sequence<b> bseq;

  struct a {
    long l;
    bseq y;
    double d;
  };

  typedef sequence<a> aseq;

  typedef sequence<string> sseq;
  typedef string str;
  typedef long myLong;

  typedef long arr1[500], dd[2][3];

  typedef erlang::term apa;
  typedef erlang::port banan;

  typedef sequence<erlang::term> etseq;

  struct s {
    long l;
    sequence<long> sl;
  };

  struct es {
    fruit f;
    myLong l;
  };

  struct et {
    erlang::term e;
    long l;
  };


  typedef sequence<char> str1;
  typedef string<12> str2;
  typedef char str3[3];  	

  typedef sequence<string> sstr3;  // sequence of string
  typedef sequence<sstr3> ssstr3;  // sequence of sequences of strings

  typedef long  arr3[3];           // array of long
  typedef sequence<arr3> sarr3;    // sequence of array
  typedef sequence<sarr3> ssarr3;  // sequence of sequnces of arrays of strings
    
 struct strRec{
    boolean bb;
    string str4;
    long str7[3][2];
    sequence<char> str5; 
    string<12> str6;
    str3 str8;
    str2 str9;
    str1 str10; 	
  };


  struct dyn {
    long l;
    sequence<long> sl;
  };
  typedef dyn arr2[1][2];


  interface i {

    const short TestConst = 3;	

    //arr2 suck(in arr2 x, out arr2 y );

    ///////////////////////////////// attribute long l;

    // simple types
    void void_test();
    long long_test(in long a, out long a1);
    long long longlong_test(in long long a, out long long a1);	
    unsigned short ushort_test(in unsigned short a, out unsigned short a1);
    unsigned long ulong_test(in unsigned long a, out unsigned long a1);
    unsigned long long ulonglong_test(in unsigned long long a, out unsigned long long a1);
    double double_test(in double a, out double a1);
    char char_test(in char a, out char a1);
    wchar wchar_test(in wchar a, out wchar a1);
    octet octet_test(in octet a, out octet a1);
    boolean bool_test(in boolean a, out boolean a1);

    // Seq. and struct tests
    b struct_test(in b a, out b a1);
    es struct2_test(in es a, out es a1);
    //simple struct3_test(in simple x, out simple y);	
    bseq seq1_test(in bseq a, out bseq a1);
    aseq seq2_test(in aseq a, out aseq a1);
    lseq seq3_test(in lseq a, out lseq a1);
    ssstr3 seq4_test(in ssstr3 a, out ssstr3 a1);
    ssarr3 seq5_test(in ssarr3 a, out ssarr3 a1);

    // Array tests
    arr1 array1_test(in arr1 a, out arr1 a1);
    dd array2_test(in dd a, out dd a1);

    // enum test
    fruit enum_test(in fruit a, out fruit a1);

    // string tests
    string string1_test(in string a, out string a1);
    wstring wstring1_test(in wstring a, out wstring a1);
    sseq string2_test(in sseq a, out sseq a1);
    str string3_test(in str a, out str a1);
    strRec string4_test(in strRec a, out strRec a1);

    // Special erlang types
    erlang::pid pid_test(in erlang::pid a, out erlang::pid a1);
    erlang::port port_test(in erlang::port a, out erlang::port a1);
    erlang::ref ref_test(in erlang::ref a, out erlang::ref a1);
    erlang::term term_test(in erlang::term a, out erlang::term a1);
    
    // typedef test
    long typedef_test(in apa a, in banan b, out apa a1, out banan b1);

    // inlined seq. test
    s inline_sequence_test(in s a, out s a1);

    // term seq. test
    etseq term_sequence_test(in etseq a, out etseq a1);
    // term struct test
    et term_struct_test(in et a, out et a1);
   
  };

};
