Reimport pidl support for COM.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 7 May 2008 15:18:18 +0000 (17:18 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 15 Sep 2008 15:36:58 +0000 (17:36 +0200)
source4/librpc/idl/dcom.idl
source4/librpc/idl/wmi.idl
source4/pidl/idl.yp
source4/pidl/lib/Parse/Pidl/IDL.pm
source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm [new file with mode: 0644]
source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm [new file with mode: 0644]
source4/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm [new file with mode: 0644]
source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
source4/pidl/lib/Parse/Pidl/Typelist.pm

index 2a2b9ad8b1324875f45dcb6a429342826a71de78..64e1c1850b3b7aa67ec14e1210ecb63efff17d16 100644 (file)
@@ -18,8 +18,7 @@
        object,
        uuid("00000000-0000-0000-C000-000000000046"),
        pointer_default(unique),
-       helpstring("Base interface for all COM interfaces"),
-       keepref
+       helpstring("Base interface for all COM interfaces")
 ]
 interface IUnknown
 {
@@ -43,8 +42,7 @@ interface IUnknown
 [
        object,
        uuid("00000001-0000-0000-C000-000000000046"),
-       pointer_default(unique),
-       keepref
+       pointer_default(unique)
 ] interface IClassFactory : IUnknown
 {
        [local] WERROR CreateInstance([in,unique] MInterfacePointer *pUnknown, 
@@ -71,8 +69,7 @@ interface IUnknown
        uuid("00000131-0000-0000-C000-000000000046"),
        object,
        pointer_default(unique),
-       helpstring("Remote version of IUnknown"),
-       keepref
+       helpstring("Remote version of IUnknown")
 ]
 interface IRemUnknown : IUnknown
 {
@@ -172,8 +169,7 @@ interface IRemUnknown : IUnknown
 [
        object,
        pointer_default(unique),
-       uuid("00000143-0000-0000-C000-000000000046"),
-       keepref
+       uuid("00000143-0000-0000-C000-000000000046")
 ]
 
 interface IRemUnknown2 : IRemUnknown
@@ -190,8 +186,7 @@ interface IRemUnknown2 : IRemUnknown
 [
        object,
        pointer_default(unique),
-       uuid("00020400-0000-0000-C000-000000000046"),
-       keepref
+       uuid("00020400-0000-0000-C000-000000000046")
 ] interface IDispatch : IUnknown
 {
        /*****************/
@@ -259,8 +254,7 @@ interface IRemUnknown2 : IRemUnknown
        uuid(DA23F6DB-6F45-466C-9EED-0B65286F2D78),
        helpstring("ICoffeeMachine Interface"),
        pointer_default(unique),
-       object,
-       keepref
+       object
 ] interface ICoffeeMachine : IUnknown
 {
        WERROR MakeCoffee([in,string,charset(UTF16)] uint16 *flavor);
@@ -278,8 +272,7 @@ interface IRemUnknown2 : IRemUnknown
        object,
        pointer_default(unique),
        uuid("0000000C-0000-0000-C000-000000000046"),
-       helpstring("Stream"),
-       keepref
+       helpstring("Stream")
 ]
 interface IStream : IUnknown
 {
index 8f736c49718d92374c6c0cb4e5d5b1403e0814e5..6726ffa050c53f78062d9e41986ebac9bda9985e 100644 (file)
@@ -207,8 +207,6 @@ interface IWbemClassObject : IUnknown
         WBEM_INFINITE = 0xFFFFFFFF
     } WBEM_TIMEOUT_TYPE;
 
-    typedef [public,nopull,nopush,noprint,string,charset(UTF16)] uint16 *CIMSTRING;
-
     typedef [public,v1_enum] enum
     {
         CIM_EMPTY = 0,
@@ -295,7 +293,7 @@ interface IWbemClassObject : IUnknown
 
     typedef [public] struct {
        uint32 count;
-       [relative] CIMSTRING item[count];
+       [relative,charset(UTF16)] uint16 *item[count];
     } arr_CIMSTRING;
 
     typedef [public] struct {
@@ -317,9 +315,9 @@ interface IWbemClassObject : IUnknown
        [case(CIM_REAL32)] uint32 v_real32;
        [case(CIM_REAL64)] udlong v_real64;
        [case(CIM_BOOLEAN)] uint16 v_boolean;
-       [case(CIM_STRING),relative] CIMSTRING v_string;
-       [case(CIM_DATETIME),relative] CIMSTRING v_datetime;
-       [case(CIM_REFERENCE),relative] CIMSTRING v_reference;
+       [case(CIM_STRING),relative,charset(UTF16)] uint16 *v_string;
+       [case(CIM_DATETIME),relative,charset(UTF16)] uint16 *v_datetime;
+       [case(CIM_REFERENCE),relative,charset(UTF16)] uint16 *v_reference;
        [case(CIM_OBJECT),subcontext(4),relative] WbemClassObject *v_object;
 
        [case(CIM_ARR_SINT8),relative] arr_int8 *a_sint8;
@@ -368,7 +366,7 @@ interface IWbemClassObject : IUnknown
 
     typedef [public,nopush,nopull] struct
     {
-       [relative] CIMSTRING name;
+       [relative,charset(UTF16)] uint16 *name;
        WBEM_FLAVOR_TYPE flavors;
        CIMTYPE_ENUMERATION cimtype;
        [switch_is(cimtype)] CIMVAR value;
@@ -391,14 +389,14 @@ interface IWbemClassObject : IUnknown
 
     typedef [public] struct
     {
-       [relative] CIMSTRING name;
+       [relative,charset(UTF16)] uint16 *name;
        [relative] WbemPropertyDesc *desc;
     } WbemProperty;
 
     typedef [public,nopull,nopush] struct
     {
        uint32 count;
-       [ref] CIMSTRING item[count];
+       [ref,charset(UTF16)] uint16 *item[count];
     } CIMSTRINGS;
 
     typedef [public,bitmap8bit] bitmap {
@@ -409,7 +407,7 @@ interface IWbemClassObject : IUnknown
     typedef [public,nopush,nopull,noprint,flag(NDR_NOALIGN)] struct
     {
        uint8 u_0;
-       [relative, null_is_ffffffff] CIMSTRING __CLASS;
+       [relative, null_is_ffffffff,charset(UTF16)] uint16 *__CLASS;
        uint32 data_size;
        CIMSTRINGS __DERIVATION;
        WbemQualifiers qualifiers;
@@ -421,7 +419,7 @@ interface IWbemClassObject : IUnknown
 
     typedef [public] struct
     {
-       [relative,null_is_ffffffff] CIMSTRING name;
+       [relative,null_is_ffffffff,charset(UTF16)] uint16 *name;
        uint32 u0;
        uint32 u1;
        [relative] WbemQualifiers *qualifiers;
@@ -439,7 +437,7 @@ interface IWbemClassObject : IUnknown
     typedef [public,flag(NDR_NOALIGN),nopush,nopull,noprint] struct
     {
        uint8 u1_0;
-       [relative] CIMSTRING __CLASS;
+       [relative,charset(UTF16)] uint16 *__CLASS;
        uint8 *default_flags;
        CIMVAR *data;
        uint32 u2_4;
@@ -449,8 +447,8 @@ interface IWbemClassObject : IUnknown
     typedef [public,nopush,nopull,noprint,flag(NDR_NOALIGN)] struct
     {
        WCO_FLAGS flags;
-       [ref] CIMSTRING __SERVER;
-       [ref] CIMSTRING __NAMESPACE;
+       [ref,charset(UTF16)] uint16 *__SERVER;
+       [ref,charset(UTF16)] uint16 *__NAMESPACE;
        WbemClass *sup_class;
        WbemMethods *sup_methods;
        WbemClass *obj_class;
@@ -465,7 +463,7 @@ interface IWbemClassObject : IUnknown
 //     [value(clSize)] uint32 _wsize;
 //     [flag(NDR_NOALIGN)] uint16 asData[clSize];
 //    } BSTR1;
-    typedef [public,nopush,nopull,noprint,string,charset(UTF16)] uint16 *BSTR;
+    //typedef [public,nopush,nopull,noprint,string,charset(UTF16)] uint16 *BSTR;
 
     WERROR OpenNamespace(
 //        [in] BSTR *strNamespace,
index a0323af8ee6532af10522ef466d35f3df75111be..8589982a2c913830aa9a761a6fad4ee024bc19b9 100644 (file)
@@ -67,17 +67,24 @@ interface_names:
        | interface_names 'interface' identifier ';' { push(@{$_[1]}, $_[2]); $_[1] }
 ;
 
-interface: property_list 'interface' identifier '{' definitions '}' optional_semicolon
+interface: property_list 'interface' identifier base_interface '{' definitions '}' optional_semicolon
           {{
                "TYPE" => "INTERFACE", 
               "PROPERTIES" => $_[1],
               "NAME" => $_[3],
-              "DATA" => $_[5],
+                  "BASE" => $_[4],
+              "DATA" => $_[6],
                   "FILE" => $_[0]->YYData->{FILE},
                   "LINE" => $_[0]->YYData->{LINE},
           }}
 ;
 
+base_interface:
+    #empty
+    | ':' identifier { $_[2] }
+;
+
+
 cpp_quote: 'cpp_quote' '(' text ')'
        {{
                 "TYPE" => "CPP_QUOTE",
index 4adb4dcea8c16eee29ec60b720cbe2c6f5dc02cb..06d54fb4b5f524905f79523af4a359b619112025 100644 (file)
@@ -38,7 +38,7 @@ sub new {
                        "import" => 7,
                        "include" => 13
                },
-               DEFAULT => -83,
+               DEFAULT => -85,
                GOTOS => {
                        'cpp_quote' => 11,
                        'importlib' => 10,
@@ -124,7 +124,7 @@ sub new {
                }
        },
        {#State 16
-               DEFAULT => -114
+               DEFAULT => -116
        },
        {#State 17
                DEFAULT => -11
@@ -184,7 +184,7 @@ sub new {
                }
        },
        {#State 26
-               DEFAULT => -110
+               DEFAULT => -112
        },
        {#State 27
                ACTIONS => {
@@ -193,23 +193,27 @@ sub new {
        },
        {#State 28
                ACTIONS => {
-                       "{" => 37
+                       ":" => 37
+               },
+               DEFAULT => -17,
+               GOTOS => {
+                       'base_interface' => 38
                }
        },
        {#State 29
                ACTIONS => {
-                       "," => 38,
-                       "]" => 39
+                       "," => 39,
+                       "]" => 40
                }
        },
        {#State 30
                ACTIONS => {
-                       "(" => 40
+                       "(" => 41
                },
-               DEFAULT => -87
+               DEFAULT => -89
        },
        {#State 31
-               DEFAULT => -85
+               DEFAULT => -87
        },
        {#State 32
                DEFAULT => -8
@@ -218,7 +222,7 @@ sub new {
                DEFAULT => -9
        },
        {#State 34
-               DEFAULT => -17
+               DEFAULT => -19
        },
        {#State 35
                DEFAULT => -12
@@ -226,1457 +230,1473 @@ sub new {
        {#State 36
                DEFAULT => -14,
                GOTOS => {
-                       'interface_names' => 41
+                       'interface_names' => 42
                }
        },
        {#State 37
                ACTIONS => {
-                       "const" => 51
+                       'IDENTIFIER' => 26
                },
-               DEFAULT => -83,
                GOTOS => {
-                       'typedecl' => 42,
-                       'function' => 43,
-                       'definitions' => 45,
-                       'bitmap' => 44,
-                       'definition' => 48,
-                       'property_list' => 47,
-                       'usertype' => 46,
-                       'const' => 50,
-                       'struct' => 49,
-                       'typedef' => 53,
-                       'enum' => 52,
-                       'union' => 54
+                       'identifier' => 43
                }
        },
        {#State 38
+               ACTIONS => {
+                       "{" => 44
+               }
+       },
+       {#State 39
                ACTIONS => {
                        'IDENTIFIER' => 26
                },
                GOTOS => {
                        'identifier' => 30,
-                       'property' => 55
+                       'property' => 45
                }
        },
-       {#State 39
-               DEFAULT => -84
-       },
        {#State 40
+               DEFAULT => -86
+       },
+       {#State 41
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
-                       'text' => 61,
-                       'anytext' => 56,
-                       'constant' => 57,
-                       'commalisttext' => 59
+                       'identifier' => 50,
+                       'text' => 51,
+                       'anytext' => 46,
+                       'constant' => 47,
+                       'commalisttext' => 49
                }
        },
-       {#State 41
+       {#State 42
                ACTIONS => {
-                       "}" => 62,
-                       "interface" => 63
+                       "}" => 52,
+                       "interface" => 53
                }
        },
-       {#State 42
-               DEFAULT => -23
-       },
        {#State 43
-               DEFAULT => -20
+               DEFAULT => -18
        },
        {#State 44
-               DEFAULT => -31
-       },
-       {#State 45
                ACTIONS => {
-                       "}" => 64,
-                       "const" => 51
+                       "const" => 63
                },
-               DEFAULT => -83,
+               DEFAULT => -85,
                GOTOS => {
-                       'typedecl' => 42,
-                       'function' => 43,
-                       'bitmap' => 44,
-                       'definition' => 65,
-                       'property_list' => 47,
-                       'usertype' => 46,
-                       'struct' => 49,
-                       'const' => 50,
-                       'typedef' => 53,
-                       'enum' => 52,
-                       'union' => 54
+                       'typedecl' => 54,
+                       'function' => 55,
+                       'definitions' => 57,
+                       'bitmap' => 56,
+                       'definition' => 60,
+                       'property_list' => 59,
+                       'usertype' => 58,
+                       'const' => 62,
+                       'struct' => 61,
+                       'typedef' => 65,
+                       'enum' => 64,
+                       'union' => 66
                }
        },
+       {#State 45
+               DEFAULT => -88
+       },
        {#State 46
                ACTIONS => {
-                       ";" => 66
-               }
+                       "-" => 68,
+                       ":" => 67,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "*" => 79,
+                       "?" => 69,
+                       "{" => 73,
+                       "&" => 74,
+                       "/" => 75,
+                       "=" => 76,
+                       "(" => 77,
+                       "|" => 78,
+                       "." => 80,
+                       ">" => 81
+               },
+               DEFAULT => -91
        },
        {#State 47
-               ACTIONS => {
-                       "typedef" => 67,
-                       'IDENTIFIER' => 26,
-                       "signed" => 75,
-                       "union" => 68,
-                       "enum" => 77,
-                       "bitmap" => 78,
-                       'void' => 69,
-                       "unsigned" => 79,
-                       "[" => 20,
-                       "struct" => 74
-               },
-               GOTOS => {
-                       'existingtype' => 76,
-                       'bitmap' => 44,
-                       'usertype' => 71,
-                       'property_list' => 70,
-                       'identifier' => 72,
-                       'struct' => 49,
-                       'enum' => 52,
-                       'type' => 80,
-                       'union' => 54,
-                       'sign' => 73
-               }
+               DEFAULT => -95
        },
        {#State 48
-               DEFAULT => -18
+               DEFAULT => -115
        },
        {#State 49
-               DEFAULT => -28
+               ACTIONS => {
+                       "," => 82,
+                       ")" => 83
+               }
        },
        {#State 50
-               DEFAULT => -21
+               DEFAULT => -94
        },
        {#State 51
+               DEFAULT => -96
+       },
+       {#State 52
                ACTIONS => {
-                       'IDENTIFIER' => 26
+                       ";" => 85
                },
+               DEFAULT => -117,
                GOTOS => {
-                       'identifier' => 81
+                       'optional_semicolon' => 84
                }
        },
-       {#State 52
-               DEFAULT => -30
-       },
        {#State 53
-               DEFAULT => -22
+               ACTIONS => {
+                       'IDENTIFIER' => 26
+               },
+               GOTOS => {
+                       'identifier' => 86
+               }
        },
        {#State 54
-               DEFAULT => -29
+               DEFAULT => -25
        },
        {#State 55
-               DEFAULT => -86
+               DEFAULT => -22
        },
        {#State 56
-               ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "*" => 87,
-                       "?" => 88,
-                       "{" => 89,
-                       "&" => 90,
-                       "/" => 91,
-                       "=" => 92,
-                       "(" => 93,
-                       "|" => 94,
-                       "." => 95,
-                       ">" => 96
-               },
-               DEFAULT => -89
+               DEFAULT => -33
        },
        {#State 57
-               DEFAULT => -93
+               ACTIONS => {
+                       "}" => 87,
+                       "const" => 63
+               },
+               DEFAULT => -85,
+               GOTOS => {
+                       'typedecl' => 54,
+                       'function' => 55,
+                       'bitmap' => 56,
+                       'definition' => 88,
+                       'property_list' => 59,
+                       'usertype' => 58,
+                       'struct' => 61,
+                       'const' => 62,
+                       'typedef' => 65,
+                       'enum' => 64,
+                       'union' => 66
+               }
        },
        {#State 58
-               DEFAULT => -113
+               ACTIONS => {
+                       ";" => 89
+               }
        },
        {#State 59
                ACTIONS => {
-                       "," => 97,
-                       ")" => 98
+                       "typedef" => 90,
+                       'IDENTIFIER' => 26,
+                       "signed" => 98,
+                       "union" => 91,
+                       "enum" => 100,
+                       "bitmap" => 101,
+                       'void' => 92,
+                       "unsigned" => 102,
+                       "[" => 20,
+                       "struct" => 97
+               },
+               GOTOS => {
+                       'existingtype' => 99,
+                       'bitmap' => 56,
+                       'usertype' => 94,
+                       'property_list' => 93,
+                       'identifier' => 95,
+                       'struct' => 61,
+                       'enum' => 64,
+                       'type' => 103,
+                       'union' => 66,
+                       'sign' => 96
                }
        },
        {#State 60
-               DEFAULT => -92
+               DEFAULT => -20
        },
        {#State 61
-               DEFAULT => -94
+               DEFAULT => -30
        },
        {#State 62
-               ACTIONS => {
-                       ";" => 99
-               },
-               DEFAULT => -115,
-               GOTOS => {
-                       'optional_semicolon' => 100
-               }
+               DEFAULT => -23
        },
        {#State 63
                ACTIONS => {
                        'IDENTIFIER' => 26
                },
                GOTOS => {
-                       'identifier' => 101
+                       'identifier' => 104
                }
        },
        {#State 64
-               ACTIONS => {
-                       ";" => 99
-               },
-               DEFAULT => -115,
-               GOTOS => {
-                       'optional_semicolon' => 102
-               }
+               DEFAULT => -32
        },
        {#State 65
-               DEFAULT => -19
+               DEFAULT => -24
        },
        {#State 66
-               DEFAULT => -32
+               DEFAULT => -31
        },
        {#State 67
                ACTIONS => {
-                       'IDENTIFIER' => 26,
-                       "signed" => 75,
-                       'void' => 69,
-                       "unsigned" => 79
-               },
-               DEFAULT => -83,
-               GOTOS => {
-                       'existingtype' => 76,
-                       'bitmap' => 44,
-                       'usertype' => 71,
-                       'property_list' => 70,
-                       'identifier' => 72,
-                       'struct' => 49,
-                       'enum' => 52,
-                       'type' => 103,
-                       'union' => 54,
-                       'sign' => 73
+                       'CONSTANT' => 48,
+                       'TEXT' => 16,
+                       'IDENTIFIER' => 26
+               },
+               DEFAULT => -93,
+               GOTOS => {
+                       'identifier' => 50,
+                       'anytext' => 105,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
        {#State 68
                ACTIONS => {
-                       'IDENTIFIER' => 104
+                       'CONSTANT' => 48,
+                       'TEXT' => 16,
+                       'IDENTIFIER' => 26
                },
-               DEFAULT => -112,
+               DEFAULT => -93,
                GOTOS => {
-                       'optional_identifier' => 105
+                       'identifier' => 50,
+                       'anytext' => 106,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
        {#State 69
-               DEFAULT => -39
-       },
-       {#State 70
-               ACTIONS => {
-                       "union" => 68,
-                       "enum" => 77,
-                       "bitmap" => 78,
-                       "[" => 20,
-                       "struct" => 74
-               }
-       },
-       {#State 71
-               DEFAULT => -37
-       },
-       {#State 72
-               DEFAULT => -36
-       },
-       {#State 73
                ACTIONS => {
+                       'CONSTANT' => 48,
+                       'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 106
+                       'identifier' => 50,
+                       'anytext' => 107,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 74
+       {#State 70
                ACTIONS => {
-                       'IDENTIFIER' => 104
+                       'CONSTANT' => 48,
+                       'TEXT' => 16,
+                       'IDENTIFIER' => 26
                },
-               DEFAULT => -112,
+               DEFAULT => -93,
                GOTOS => {
-                       'optional_identifier' => 107
+                       'identifier' => 50,
+                       'anytext' => 108,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 75
-               DEFAULT => -33
-       },
-       {#State 76
-               DEFAULT => -38
-       },
-       {#State 77
+       {#State 71
                ACTIONS => {
-                       'IDENTIFIER' => 104
+                       'CONSTANT' => 48,
+                       'TEXT' => 16,
+                       'IDENTIFIER' => 26
                },
-               DEFAULT => -112,
+               DEFAULT => -93,
                GOTOS => {
-                       'optional_identifier' => 108
+                       'identifier' => 50,
+                       'anytext' => 109,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 78
+       {#State 72
                ACTIONS => {
-                       'IDENTIFIER' => 104
+                       'CONSTANT' => 48,
+                       'TEXT' => 16,
+                       'IDENTIFIER' => 26
                },
-               DEFAULT => -112,
+               DEFAULT => -93,
                GOTOS => {
-                       'optional_identifier' => 109
+                       'identifier' => 50,
+                       'anytext' => 110,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 79
-               DEFAULT => -34
-       },
-       {#State 80
+       {#State 73
                ACTIONS => {
+                       'CONSTANT' => 48,
+                       'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 110
+                       'identifier' => 50,
+                       'anytext' => 46,
+                       'text' => 51,
+                       'constant' => 47,
+                       'commalisttext' => 111
                }
        },
-       {#State 81
-               DEFAULT => -72,
-               GOTOS => {
-                       'pointers' => 111
-               }
-       },
-       {#State 82
+       {#State 74
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
+                       'identifier' => 50,
                        'anytext' => 112,
-                       'text' => 61,
-                       'constant' => 57
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 83
+       {#State 75
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
+                       'identifier' => 50,
                        'anytext' => 113,
-                       'text' => 61,
-                       'constant' => 57
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 84
+       {#State 76
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
+                       'identifier' => 50,
                        'anytext' => 114,
-                       'text' => 61,
-                       'constant' => 57
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 85
+       {#State 77
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 115,
-                       'text' => 61,
-                       'constant' => 57
+                       'identifier' => 50,
+                       'anytext' => 46,
+                       'text' => 51,
+                       'constant' => 47,
+                       'commalisttext' => 115
                }
        },
-       {#State 86
+       {#State 78
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
+                       'identifier' => 50,
                        'anytext' => 116,
-                       'text' => 61,
-                       'constant' => 57
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 87
+       {#State 79
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
+                       'identifier' => 50,
                        'anytext' => 117,
-                       'text' => 61,
-                       'constant' => 57
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 88
+       {#State 80
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
+                       'identifier' => 50,
                        'anytext' => 118,
-                       'text' => 61,
-                       'constant' => 57
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 89
+       {#State 81
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 56,
-                       'text' => 61,
-                       'constant' => 57,
-                       'commalisttext' => 119
+                       'identifier' => 50,
+                       'anytext' => 119,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 90
+       {#State 82
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
+                       'identifier' => 50,
                        'anytext' => 120,
-                       'text' => 61,
-                       'constant' => 57
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 91
+       {#State 83
+               DEFAULT => -90
+       },
+       {#State 84
+               DEFAULT => -13
+       },
+       {#State 85
+               DEFAULT => -118
+       },
+       {#State 86
                ACTIONS => {
-                       'CONSTANT' => 58,
-                       'TEXT' => 16,
-                       'IDENTIFIER' => 26
-               },
-               DEFAULT => -91,
-               GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 121,
-                       'text' => 61,
-                       'constant' => 57
+                       ";" => 121
                }
        },
-       {#State 92
+       {#State 87
                ACTIONS => {
-                       'CONSTANT' => 58,
-                       'TEXT' => 16,
-                       'IDENTIFIER' => 26
+                       ";" => 85
                },
-               DEFAULT => -91,
+               DEFAULT => -117,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 122,
-                       'text' => 61,
-                       'constant' => 57
+                       'optional_semicolon' => 122
                }
        },
-       {#State 93
+       {#State 88
+               DEFAULT => -21
+       },
+       {#State 89
+               DEFAULT => -34
+       },
+       {#State 90
                ACTIONS => {
-                       'CONSTANT' => 58,
-                       'TEXT' => 16,
-                       'IDENTIFIER' => 26
+                       'IDENTIFIER' => 26,
+                       "signed" => 98,
+                       'void' => 92,
+                       "unsigned" => 102
                },
-               DEFAULT => -91,
+               DEFAULT => -85,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 56,
-                       'text' => 61,
-                       'constant' => 57,
-                       'commalisttext' => 123
+                       'existingtype' => 99,
+                       'bitmap' => 56,
+                       'usertype' => 94,
+                       'property_list' => 93,
+                       'identifier' => 95,
+                       'struct' => 61,
+                       'enum' => 64,
+                       'type' => 123,
+                       'union' => 66,
+                       'sign' => 96
                }
        },
-       {#State 94
+       {#State 91
                ACTIONS => {
-                       'CONSTANT' => 58,
-                       'TEXT' => 16,
-                       'IDENTIFIER' => 26
+                       'IDENTIFIER' => 124
                },
-               DEFAULT => -91,
+               DEFAULT => -114,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 124,
-                       'text' => 61,
-                       'constant' => 57
+                       'optional_identifier' => 125
                }
        },
-       {#State 95
+       {#State 92
+               DEFAULT => -41
+       },
+       {#State 93
                ACTIONS => {
-                       'CONSTANT' => 58,
-                       'TEXT' => 16,
-                       'IDENTIFIER' => 26
-               },
-               DEFAULT => -91,
-               GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 125,
-                       'text' => 61,
-                       'constant' => 57
+                       "union" => 91,
+                       "enum" => 100,
+                       "bitmap" => 101,
+                       "[" => 20,
+                       "struct" => 97
                }
        },
+       {#State 94
+               DEFAULT => -39
+       },
+       {#State 95
+               DEFAULT => -38
+       },
        {#State 96
                ACTIONS => {
-                       'CONSTANT' => 58,
-                       'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 126,
-                       'text' => 61,
-                       'constant' => 57
+                       'identifier' => 126
                }
        },
        {#State 97
                ACTIONS => {
-                       'CONSTANT' => 58,
-                       'TEXT' => 16,
-                       'IDENTIFIER' => 26
+                       'IDENTIFIER' => 124
                },
-               DEFAULT => -91,
+               DEFAULT => -114,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 127,
-                       'text' => 61,
-                       'constant' => 57
+                       'optional_identifier' => 127
                }
        },
        {#State 98
-               DEFAULT => -88
+               DEFAULT => -35
        },
        {#State 99
-               DEFAULT => -116
+               DEFAULT => -40
        },
        {#State 100
-               DEFAULT => -13
+               ACTIONS => {
+                       'IDENTIFIER' => 124
+               },
+               DEFAULT => -114,
+               GOTOS => {
+                       'optional_identifier' => 128
+               }
        },
        {#State 101
                ACTIONS => {
-                       ";" => 128
+                       'IDENTIFIER' => 124
+               },
+               DEFAULT => -114,
+               GOTOS => {
+                       'optional_identifier' => 129
                }
        },
        {#State 102
-               DEFAULT => -16
+               DEFAULT => -36
        },
        {#State 103
                ACTIONS => {
                        'IDENTIFIER' => 26
                },
                GOTOS => {
-                       'identifier' => 129
+                       'identifier' => 130
                }
        },
        {#State 104
-               DEFAULT => -111
+               DEFAULT => -74,
+               GOTOS => {
+                       'pointers' => 131
+               }
        },
        {#State 105
                ACTIONS => {
-                       "{" => 131
+                       "-" => 68,
+                       ":" => 67,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "*" => 79,
+                       "?" => 69,
+                       "{" => 73,
+                       "&" => 74,
+                       "/" => 75,
+                       "=" => 76,
+                       "(" => 77,
+                       "|" => 78,
+                       "." => 80,
+                       ">" => 81
                },
-               DEFAULT => -68,
-               GOTOS => {
-                       'union_body' => 132,
-                       'opt_union_body' => 130
-               }
+               DEFAULT => -106
        },
        {#State 106
-               DEFAULT => -35
+               ACTIONS => {
+                       ":" => 67,
+                       "<" => 70,
+                       "~" => 71,
+                       "?" => 69,
+                       "{" => 73,
+                       "=" => 76
+               },
+               DEFAULT => -97
        },
        {#State 107
                ACTIONS => {
-                       "{" => 134
+                       "-" => 68,
+                       ":" => 67,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "*" => 79,
+                       "?" => 69,
+                       "{" => 73,
+                       "&" => 74,
+                       "/" => 75,
+                       "=" => 76,
+                       "(" => 77,
+                       "|" => 78,
+                       "." => 80,
+                       ">" => 81
                },
-               DEFAULT => -58,
-               GOTOS => {
-                       'struct_body' => 133,
-                       'opt_struct_body' => 135
-               }
+               DEFAULT => -105
        },
        {#State 108
                ACTIONS => {
-                       "{" => 136
+                       "-" => 68,
+                       ":" => 67,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "*" => 79,
+                       "?" => 69,
+                       "{" => 73,
+                       "&" => 74,
+                       "/" => 75,
+                       "=" => 76,
+                       "(" => 77,
+                       "|" => 78,
+                       "." => 80,
+                       ">" => 81
                },
-               DEFAULT => -41,
-               GOTOS => {
-                       'opt_enum_body' => 138,
-                       'enum_body' => 137
-               }
+               DEFAULT => -101
        },
        {#State 109
                ACTIONS => {
-                       "{" => 140
+                       "-" => 68,
+                       ":" => 67,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "*" => 79,
+                       "?" => 69,
+                       "{" => 73,
+                       "&" => 74,
+                       "/" => 75,
+                       "=" => 76,
+                       "(" => 77,
+                       "|" => 78,
+                       "." => 80,
+                       ">" => 81
                },
-               DEFAULT => -49,
-               GOTOS => {
-                       'bitmap_body' => 141,
-                       'opt_bitmap_body' => 139
-               }
+               DEFAULT => -109
        },
        {#State 110
                ACTIONS => {
-                       "(" => 142
-               }
+                       ":" => 67,
+                       "<" => 70,
+                       "~" => 71,
+                       "?" => 69,
+                       "{" => 73,
+                       "=" => 76
+               },
+               DEFAULT => -108
        },
        {#State 111
                ACTIONS => {
-                       'IDENTIFIER' => 26,
-                       "*" => 144
-               },
-               GOTOS => {
-                       'identifier' => 143
+                       "}" => 132,
+                       "," => 82
                }
        },
        {#State 112
                ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "*" => 87,
-                       "?" => 88,
-                       "{" => 89,
-                       "&" => 90,
-                       "/" => 91,
-                       "=" => 92,
-                       "(" => 93,
-                       "|" => 94,
-                       "." => 95,
-                       ">" => 96
+                       ":" => 67,
+                       "<" => 70,
+                       "~" => 71,
+                       "?" => 69,
+                       "{" => 73,
+                       "=" => 76
                },
-               DEFAULT => -104
+               DEFAULT => -103
        },
        {#State 113
                ACTIONS => {
-                       ":" => 82,
-                       "<" => 84,
-                       "~" => 85,
-                       "?" => 88,
-                       "{" => 89,
-                       "=" => 92
+                       ":" => 67,
+                       "<" => 70,
+                       "~" => 71,
+                       "?" => 69,
+                       "{" => 73,
+                       "=" => 76
                },
-               DEFAULT => -95
+               DEFAULT => -104
        },
        {#State 114
                ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "*" => 87,
-                       "?" => 88,
-                       "{" => 89,
-                       "&" => 90,
-                       "/" => 91,
-                       "=" => 92,
-                       "(" => 93,
-                       "|" => 94,
-                       "." => 95,
-                       ">" => 96
+                       "-" => 68,
+                       ":" => 67,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "*" => 79,
+                       "?" => 69,
+                       "{" => 73,
+                       "&" => 74,
+                       "/" => 75,
+                       "=" => 76,
+                       "(" => 77,
+                       "|" => 78,
+                       "." => 80,
+                       ">" => 81
                },
-               DEFAULT => -99
+               DEFAULT => -107
        },
        {#State 115
                ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "*" => 87,
-                       "?" => 88,
-                       "{" => 89,
-                       "&" => 90,
-                       "/" => 91,
-                       "=" => 92,
-                       "(" => 93,
-                       "|" => 94,
-                       "." => 95,
-                       ">" => 96
-               },
-               DEFAULT => -107
+                       "," => 82,
+                       ")" => 133
+               }
        },
        {#State 116
                ACTIONS => {
-                       ":" => 82,
-                       "<" => 84,
-                       "~" => 85,
-                       "?" => 88,
-                       "{" => 89,
-                       "=" => 92
+                       ":" => 67,
+                       "<" => 70,
+                       "~" => 71,
+                       "?" => 69,
+                       "{" => 73,
+                       "=" => 76
                },
-               DEFAULT => -106
+               DEFAULT => -102
        },
        {#State 117
                ACTIONS => {
-                       ":" => 82,
-                       "<" => 84,
-                       "~" => 85,
-                       "?" => 88,
-                       "{" => 89,
-                       "=" => 92
+                       ":" => 67,
+                       "<" => 70,
+                       "~" => 71,
+                       "?" => 69,
+                       "{" => 73,
+                       "=" => 76
                },
-               DEFAULT => -97
+               DEFAULT => -99
        },
        {#State 118
                ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "*" => 87,
-                       "?" => 88,
-                       "{" => 89,
-                       "&" => 90,
-                       "/" => 91,
-                       "=" => 92,
-                       "(" => 93,
-                       "|" => 94,
-                       "." => 95,
-                       ">" => 96
+                       ":" => 67,
+                       "<" => 70,
+                       "~" => 71,
+                       "?" => 69,
+                       "{" => 73,
+                       "=" => 76
                },
-               DEFAULT => -103
+               DEFAULT => -98
        },
        {#State 119
                ACTIONS => {
-                       "}" => 145,
-                       "," => 97
-               }
+                       ":" => 67,
+                       "<" => 70,
+                       "~" => 71,
+                       "?" => 69,
+                       "{" => 73,
+                       "=" => 76
+               },
+               DEFAULT => -100
        },
        {#State 120
                ACTIONS => {
-                       ":" => 82,
-                       "<" => 84,
-                       "~" => 85,
-                       "?" => 88,
-                       "{" => 89,
-                       "=" => 92
+                       "-" => 68,
+                       ":" => 67,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "*" => 79,
+                       "?" => 69,
+                       "{" => 73,
+                       "&" => 74,
+                       "/" => 75,
+                       "=" => 76,
+                       "(" => 77,
+                       "|" => 78,
+                       "." => 80,
+                       ">" => 81
                },
-               DEFAULT => -101
+               DEFAULT => -92
        },
        {#State 121
-               ACTIONS => {
-                       ":" => 82,
-                       "<" => 84,
-                       "~" => 85,
-                       "?" => 88,
-                       "{" => 89,
-                       "=" => 92
-               },
-               DEFAULT => -102
+               DEFAULT => -15
        },
        {#State 122
-               ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "*" => 87,
-                       "?" => 88,
-                       "{" => 89,
-                       "&" => 90,
-                       "/" => 91,
-                       "=" => 92,
-                       "(" => 93,
-                       "|" => 94,
-                       "." => 95,
-                       ">" => 96
-               },
-               DEFAULT => -105
+               DEFAULT => -16
        },
        {#State 123
                ACTIONS => {
-                       "," => 97,
-                       ")" => 146
+                       'IDENTIFIER' => 26
+               },
+               GOTOS => {
+                       'identifier' => 134
                }
        },
        {#State 124
-               ACTIONS => {
-                       ":" => 82,
-                       "<" => 84,
-                       "~" => 85,
-                       "?" => 88,
-                       "{" => 89,
-                       "=" => 92
-               },
-               DEFAULT => -100
+               DEFAULT => -113
        },
        {#State 125
                ACTIONS => {
-                       ":" => 82,
-                       "<" => 84,
-                       "~" => 85,
-                       "?" => 88,
-                       "{" => 89,
-                       "=" => 92
+                       "{" => 136
                },
-               DEFAULT => -96
+               DEFAULT => -70,
+               GOTOS => {
+                       'union_body' => 137,
+                       'opt_union_body' => 135
+               }
        },
        {#State 126
-               ACTIONS => {
-                       ":" => 82,
-                       "<" => 84,
-                       "~" => 85,
-                       "?" => 88,
-                       "{" => 89,
-                       "=" => 92
-               },
-               DEFAULT => -98
+               DEFAULT => -37
        },
        {#State 127
                ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "*" => 87,
-                       "?" => 88,
-                       "{" => 89,
-                       "&" => 90,
-                       "/" => 91,
-                       "=" => 92,
-                       "(" => 93,
-                       "|" => 94,
-                       "." => 95,
-                       ">" => 96
+                       "{" => 139
                },
-               DEFAULT => -90
+               DEFAULT => -60,
+               GOTOS => {
+                       'struct_body' => 138,
+                       'opt_struct_body' => 140
+               }
        },
        {#State 128
-               DEFAULT => -15
+               ACTIONS => {
+                       "{" => 141
+               },
+               DEFAULT => -43,
+               GOTOS => {
+                       'opt_enum_body' => 143,
+                       'enum_body' => 142
+               }
        },
        {#State 129
                ACTIONS => {
-                       "[" => 147
+                       "{" => 145
                },
-               DEFAULT => -80,
+               DEFAULT => -51,
                GOTOS => {
-                       'array_len' => 148
+                       'bitmap_body' => 146,
+                       'opt_bitmap_body' => 144
                }
        },
        {#State 130
-               DEFAULT => -70
+               ACTIONS => {
+                       "(" => 147
+               }
        },
        {#State 131
-               DEFAULT => -65,
+               ACTIONS => {
+                       'IDENTIFIER' => 26,
+                       "*" => 149
+               },
                GOTOS => {
-                       'union_elements' => 149
+                       'identifier' => 148
                }
        },
        {#State 132
-               DEFAULT => -69
+               ACTIONS => {
+                       'CONSTANT' => 48,
+                       'TEXT' => 16,
+                       'IDENTIFIER' => 26
+               },
+               DEFAULT => -93,
+               GOTOS => {
+                       'identifier' => 50,
+                       'anytext' => 150,
+                       'text' => 51,
+                       'constant' => 47
+               }
        },
        {#State 133
-               DEFAULT => -59
+               ACTIONS => {
+                       'CONSTANT' => 48,
+                       'TEXT' => 16,
+                       'IDENTIFIER' => 26
+               },
+               DEFAULT => -93,
+               GOTOS => {
+                       'identifier' => 50,
+                       'anytext' => 151,
+                       'text' => 51,
+                       'constant' => 47
+               }
        },
        {#State 134
-               DEFAULT => -74,
+               ACTIONS => {
+                       "[" => 152
+               },
+               DEFAULT => -82,
                GOTOS => {
-                       'element_list1' => 150
+                       'array_len' => 153
                }
        },
        {#State 135
-               DEFAULT => -60
+               DEFAULT => -72
        },
        {#State 136
-               ACTIONS => {
-                       'IDENTIFIER' => 26
-               },
+               DEFAULT => -67,
                GOTOS => {
-                       'identifier' => 151,
-                       'enum_element' => 152,
-                       'enum_elements' => 153
+                       'union_elements' => 154
                }
        },
        {#State 137
-               DEFAULT => -42
+               DEFAULT => -71
        },
        {#State 138
-               DEFAULT => -43
+               DEFAULT => -61
        },
        {#State 139
-               DEFAULT => -51
+               DEFAULT => -76,
+               GOTOS => {
+                       'element_list1' => 155
+               }
        },
        {#State 140
+               DEFAULT => -62
+       },
+       {#State 141
                ACTIONS => {
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -54,
                GOTOS => {
                        'identifier' => 156,
-                       'bitmap_element' => 155,
-                       'bitmap_elements' => 154,
-                       'opt_bitmap_elements' => 157
+                       'enum_element' => 157,
+                       'enum_elements' => 158
                }
        },
-       {#State 141
-               DEFAULT => -50
-       },
        {#State 142
-               ACTIONS => {
-                       "," => -76,
-                       "void" => 161,
-                       ")" => -76
-               },
-               DEFAULT => -83,
-               GOTOS => {
-                       'base_element' => 158,
-                       'element_list2' => 160,
-                       'property_list' => 159
-               }
+               DEFAULT => -44
        },
        {#State 143
-               ACTIONS => {
-                       "[" => 147,
-                       "=" => 163
-               },
-               GOTOS => {
-                       'array_len' => 162
-               }
+               DEFAULT => -45
        },
        {#State 144
-               DEFAULT => -73
+               DEFAULT => -53
        },
        {#State 145
                ACTIONS => {
-                       'CONSTANT' => 58,
-                       'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -56,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 164,
-                       'text' => 61,
-                       'constant' => 57
+                       'identifier' => 161,
+                       'bitmap_element' => 160,
+                       'bitmap_elements' => 159,
+                       'opt_bitmap_elements' => 162
                }
        },
        {#State 146
+               DEFAULT => -52
+       },
+       {#State 147
                ACTIONS => {
-                       'CONSTANT' => 58,
-                       'TEXT' => 16,
-                       'IDENTIFIER' => 26
+                       "," => -78,
+                       "void" => 166,
+                       ")" => -78
                },
-               DEFAULT => -91,
+               DEFAULT => -85,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 165,
-                       'text' => 61,
-                       'constant' => 57
+                       'base_element' => 163,
+                       'element_list2' => 165,
+                       'property_list' => 164
                }
        },
-       {#State 147
+       {#State 148
+               ACTIONS => {
+                       "[" => 152,
+                       "=" => 168
+               },
+               GOTOS => {
+                       'array_len' => 167
+               }
+       },
+       {#State 149
+               DEFAULT => -75
+       },
+       {#State 150
+               ACTIONS => {
+                       "-" => 68,
+                       ":" => 67,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "*" => 79,
+                       "?" => 69,
+                       "{" => 73,
+                       "&" => 74,
+                       "/" => 75,
+                       "=" => 76,
+                       "(" => 77,
+                       "|" => 78,
+                       "." => 80,
+                       ">" => 81
+               },
+               DEFAULT => -111
+       },
+       {#State 151
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       ":" => 67,
+                       "<" => 70,
+                       "~" => 71,
+                       "?" => 69,
+                       "{" => 73,
+                       "=" => 76
+               },
+               DEFAULT => -110
+       },
+       {#State 152
+               ACTIONS => {
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
-                       "]" => 166,
+                       "]" => 169,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 167,
-                       'text' => 61,
-                       'constant' => 57
+                       'identifier' => 50,
+                       'anytext' => 170,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 148
+       {#State 153
                ACTIONS => {
-                       ";" => 168
+                       ";" => 171
                }
        },
-       {#State 149
+       {#State 154
                ACTIONS => {
-                       "}" => 169
+                       "}" => 172
                },
-               DEFAULT => -83,
+               DEFAULT => -85,
                GOTOS => {
-                       'optional_base_element' => 171,
-                       'property_list' => 170
+                       'optional_base_element' => 174,
+                       'property_list' => 173
                }
        },
-       {#State 150
+       {#State 155
                ACTIONS => {
-                       "}" => 172
+                       "}" => 175
                },
-               DEFAULT => -83,
+               DEFAULT => -85,
                GOTOS => {
-                       'base_element' => 173,
-                       'property_list' => 159
+                       'base_element' => 176,
+                       'property_list' => 164
                }
        },
-       {#State 151
+       {#State 156
                ACTIONS => {
-                       "=" => 174
+                       "=" => 177
                },
-               DEFAULT => -46
+               DEFAULT => -48
        },
-       {#State 152
-               DEFAULT => -44
+       {#State 157
+               DEFAULT => -46
        },
-       {#State 153
+       {#State 158
                ACTIONS => {
-                       "}" => 175,
-                       "," => 176
+                       "}" => 178,
+                       "," => 179
                }
        },
-       {#State 154
+       {#State 159
                ACTIONS => {
-                       "," => 177
+                       "," => 180
                },
-               DEFAULT => -55
+               DEFAULT => -57
        },
-       {#State 155
-               DEFAULT => -52
+       {#State 160
+               DEFAULT => -54
        },
-       {#State 156
+       {#State 161
                ACTIONS => {
-                       "=" => 178
+                       "=" => 181
                }
        },
-       {#State 157
+       {#State 162
                ACTIONS => {
-                       "}" => 179
+                       "}" => 182
                }
        },
-       {#State 158
-               DEFAULT => -78
+       {#State 163
+               DEFAULT => -80
        },
-       {#State 159
+       {#State 164
                ACTIONS => {
                        'IDENTIFIER' => 26,
-                       "signed" => 75,
-                       'void' => 69,
-                       "unsigned" => 79,
+                       "signed" => 98,
+                       'void' => 92,
+                       "unsigned" => 102,
                        "[" => 20
                },
-               DEFAULT => -83,
+               DEFAULT => -85,
                GOTOS => {
-                       'existingtype' => 76,
-                       'bitmap' => 44,
-                       'usertype' => 71,
-                       'property_list' => 70,
-                       'identifier' => 72,
-                       'struct' => 49,
-                       'enum' => 52,
-                       'type' => 180,
-                       'union' => 54,
-                       'sign' => 73
+                       'existingtype' => 99,
+                       'bitmap' => 56,
+                       'usertype' => 94,
+                       'property_list' => 93,
+                       'identifier' => 95,
+                       'struct' => 61,
+                       'enum' => 64,
+                       'type' => 183,
+                       'union' => 66,
+                       'sign' => 96
                }
        },
-       {#State 160
+       {#State 165
                ACTIONS => {
-                       "," => 181,
-                       ")" => 182
+                       "," => 184,
+                       ")" => 185
                }
        },
-       {#State 161
-               DEFAULT => -77
+       {#State 166
+               DEFAULT => -79
        },
-       {#State 162
+       {#State 167
                ACTIONS => {
-                       "=" => 183
+                       "=" => 186
                }
        },
-       {#State 163
+       {#State 168
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 184,
-                       'text' => 61,
-                       'constant' => 57
+                       'identifier' => 50,
+                       'anytext' => 187,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 164
-               ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "*" => 87,
-                       "?" => 88,
-                       "{" => 89,
-                       "&" => 90,
-                       "/" => 91,
-                       "=" => 92,
-                       "(" => 93,
-                       "|" => 94,
-                       "." => 95,
-                       ">" => 96
-               },
-               DEFAULT => -109
-       },
-       {#State 165
-               ACTIONS => {
-                       ":" => 82,
-                       "<" => 84,
-                       "~" => 85,
-                       "?" => 88,
-                       "{" => 89,
-                       "=" => 92
-               },
-               DEFAULT => -108
-       },
-       {#State 166
+       {#State 169
                ACTIONS => {
-                       "[" => 147
+                       "[" => 152
                },
-               DEFAULT => -80,
+               DEFAULT => -82,
                GOTOS => {
-                       'array_len' => 185
+                       'array_len' => 188
                }
        },
-       {#State 167
+       {#State 170
                ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "?" => 88,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "&" => 90,
-                       "{" => 89,
-                       "/" => 91,
-                       "=" => 92,
-                       "|" => 94,
-                       "(" => 93,
-                       "*" => 87,
-                       "." => 95,
-                       "]" => 186,
-                       ">" => 96
+                       "-" => 68,
+                       ":" => 67,
+                       "?" => 69,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "&" => 74,
+                       "{" => 73,
+                       "/" => 75,
+                       "=" => 76,
+                       "|" => 78,
+                       "(" => 77,
+                       "*" => 79,
+                       "." => 80,
+                       "]" => 189,
+                       ">" => 81
                }
        },
-       {#State 168
-               DEFAULT => -27
+       {#State 171
+               DEFAULT => -29
        },
-       {#State 169
-               DEFAULT => -67
+       {#State 172
+               DEFAULT => -69
        },
-       {#State 170
+       {#State 173
                ACTIONS => {
                        "[" => 20
                },
-               DEFAULT => -83,
+               DEFAULT => -85,
                GOTOS => {
-                       'base_or_empty' => 187,
-                       'base_element' => 188,
-                       'empty_element' => 189,
-                       'property_list' => 190
+                       'base_or_empty' => 190,
+                       'base_element' => 191,
+                       'empty_element' => 192,
+                       'property_list' => 193
                }
        },
-       {#State 171
-               DEFAULT => -66
+       {#State 174
+               DEFAULT => -68
        },
-       {#State 172
-               DEFAULT => -57
+       {#State 175
+               DEFAULT => -59
        },
-       {#State 173
+       {#State 176
                ACTIONS => {
-                       ";" => 191
+                       ";" => 194
                }
        },
-       {#State 174
+       {#State 177
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 192,
-                       'text' => 61,
-                       'constant' => 57
+                       'identifier' => 50,
+                       'anytext' => 195,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 175
-               DEFAULT => -40
+       {#State 178
+               DEFAULT => -42
        },
-       {#State 176
+       {#State 179
                ACTIONS => {
                        'IDENTIFIER' => 26
                },
                GOTOS => {
-                       'identifier' => 151,
-                       'enum_element' => 193
+                       'identifier' => 156,
+                       'enum_element' => 196
                }
        },
-       {#State 177
+       {#State 180
                ACTIONS => {
                        'IDENTIFIER' => 26
                },
                GOTOS => {
-                       'identifier' => 156,
-                       'bitmap_element' => 194
+                       'identifier' => 161,
+                       'bitmap_element' => 197
                }
        },
-       {#State 178
+       {#State 181
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 195,
-                       'text' => 61,
-                       'constant' => 57
+                       'identifier' => 50,
+                       'anytext' => 198,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 179
-               DEFAULT => -48
+       {#State 182
+               DEFAULT => -50
        },
-       {#State 180
-               DEFAULT => -72,
+       {#State 183
+               DEFAULT => -74,
                GOTOS => {
-                       'pointers' => 196
+                       'pointers' => 199
                }
        },
-       {#State 181
-               DEFAULT => -83,
+       {#State 184
+               DEFAULT => -85,
                GOTOS => {
-                       'base_element' => 197,
-                       'property_list' => 159
+                       'base_element' => 200,
+                       'property_list' => 164
                }
        },
-       {#State 182
+       {#State 185
                ACTIONS => {
-                       ";" => 198
+                       ";" => 201
                }
        },
-       {#State 183
+       {#State 186
                ACTIONS => {
-                       'CONSTANT' => 58,
+                       'CONSTANT' => 48,
                        'TEXT' => 16,
                        'IDENTIFIER' => 26
                },
-               DEFAULT => -91,
+               DEFAULT => -93,
                GOTOS => {
-                       'identifier' => 60,
-                       'anytext' => 199,
-                       'text' => 61,
-                       'constant' => 57
+                       'identifier' => 50,
+                       'anytext' => 202,
+                       'text' => 51,
+                       'constant' => 47
                }
        },
-       {#State 184
+       {#State 187
                ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "?" => 88,
-                       "<" => 84,
-                       ";" => 200,
-                       "+" => 86,
-                       "~" => 85,
-                       "&" => 90,
-                       "{" => 89,
-                       "/" => 91,
-                       "=" => 92,
-                       "|" => 94,
-                       "(" => 93,
-                       "*" => 87,
-                       "." => 95,
-                       ">" => 96
+                       "-" => 68,
+                       ":" => 67,
+                       "?" => 69,
+                       "<" => 70,
+                       ";" => 203,
+                       "+" => 72,
+                       "~" => 71,
+                       "&" => 74,
+                       "{" => 73,
+                       "/" => 75,
+                       "=" => 76,
+                       "|" => 78,
+                       "(" => 77,
+                       "*" => 79,
+                       "." => 80,
+                       ">" => 81
                }
        },
-       {#State 185
-               DEFAULT => -81
+       {#State 188
+               DEFAULT => -83
        },
-       {#State 186
+       {#State 189
                ACTIONS => {
-                       "[" => 147
+                       "[" => 152
                },
-               DEFAULT => -80,
+               DEFAULT => -82,
                GOTOS => {
-                       'array_len' => 201
+                       'array_len' => 204
                }
        },
-       {#State 187
-               DEFAULT => -64
+       {#State 190
+               DEFAULT => -66
        },
-       {#State 188
+       {#State 191
                ACTIONS => {
-                       ";" => 202
+                       ";" => 205
                }
        },
-       {#State 189
-               DEFAULT => -63
+       {#State 192
+               DEFAULT => -65
        },
-       {#State 190
+       {#State 193
                ACTIONS => {
                        'IDENTIFIER' => 26,
-                       "signed" => 75,
-                       ";" => 203,
-                       'void' => 69,
-                       "unsigned" => 79,
+                       "signed" => 98,
+                       ";" => 206,
+                       'void' => 92,
+                       "unsigned" => 102,
                        "[" => 20
                },
-               DEFAULT => -83,
+               DEFAULT => -85,
                GOTOS => {
-                       'existingtype' => 76,
-                       'bitmap' => 44,
-                       'usertype' => 71,
-                       'property_list' => 70,
-                       'identifier' => 72,
-                       'struct' => 49,
-                       'enum' => 52,
-                       'type' => 180,
-                       'union' => 54,
-                       'sign' => 73
+                       'existingtype' => 99,
+                       'bitmap' => 56,
+                       'usertype' => 94,
+                       'property_list' => 93,
+                       'identifier' => 95,
+                       'struct' => 61,
+                       'enum' => 64,
+                       'type' => 183,
+                       'union' => 66,
+                       'sign' => 96
                }
        },
-       {#State 191
-               DEFAULT => -75
-       },
-       {#State 192
-               ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "*" => 87,
-                       "?" => 88,
-                       "{" => 89,
-                       "&" => 90,
-                       "/" => 91,
-                       "=" => 92,
-                       "(" => 93,
-                       "|" => 94,
-                       "." => 95,
-                       ">" => 96
-               },
-               DEFAULT => -47
-       },
-       {#State 193
-               DEFAULT => -45
-       },
        {#State 194
-               DEFAULT => -53
+               DEFAULT => -77
        },
        {#State 195
                ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "<" => 84,
-                       "+" => 86,
-                       "~" => 85,
-                       "*" => 87,
-                       "?" => 88,
-                       "{" => 89,
-                       "&" => 90,
-                       "/" => 91,
-                       "=" => 92,
-                       "(" => 93,
-                       "|" => 94,
-                       "." => 95,
-                       ">" => 96
-               },
-               DEFAULT => -56
+                       "-" => 68,
+                       ":" => 67,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "*" => 79,
+                       "?" => 69,
+                       "{" => 73,
+                       "&" => 74,
+                       "/" => 75,
+                       "=" => 76,
+                       "(" => 77,
+                       "|" => 78,
+                       "." => 80,
+                       ">" => 81
+               },
+               DEFAULT => -49
        },
        {#State 196
-               ACTIONS => {
-                       'IDENTIFIER' => 26,
-                       "*" => 144
-               },
-               GOTOS => {
-                       'identifier' => 204
-               }
+               DEFAULT => -47
        },
        {#State 197
-               DEFAULT => -79
+               DEFAULT => -55
        },
        {#State 198
-               DEFAULT => -26
+               ACTIONS => {
+                       "-" => 68,
+                       ":" => 67,
+                       "<" => 70,
+                       "+" => 72,
+                       "~" => 71,
+                       "*" => 79,
+                       "?" => 69,
+                       "{" => 73,
+                       "&" => 74,
+                       "/" => 75,
+                       "=" => 76,
+                       "(" => 77,
+                       "|" => 78,
+                       "." => 80,
+                       ">" => 81
+               },
+               DEFAULT => -58
        },
        {#State 199
                ACTIONS => {
-                       "-" => 83,
-                       ":" => 82,
-                       "?" => 88,
-                       "<" => 84,
-                       ";" => 205,
-                       "+" => 86,
-                       "~" => 85,
-                       "&" => 90,
-                       "{" => 89,
-                       "/" => 91,
-                       "=" => 92,
-                       "|" => 94,
-                       "(" => 93,
-                       "*" => 87,
-                       "." => 95,
-                       ">" => 96
+                       'IDENTIFIER' => 26,
+                       "*" => 149
+               },
+               GOTOS => {
+                       'identifier' => 207
                }
        },
        {#State 200
-               DEFAULT => -24
+               DEFAULT => -81
        },
        {#State 201
-               DEFAULT => -82
+               DEFAULT => -28
        },
        {#State 202
-               DEFAULT => -62
+               ACTIONS => {
+                       "-" => 68,
+                       ":" => 67,
+                       "?" => 69,
+                       "<" => 70,
+                       ";" => 208,
+                       "+" => 72,
+                       "~" => 71,
+                       "&" => 74,
+                       "{" => 73,
+                       "/" => 75,
+                       "=" => 76,
+                       "|" => 78,
+                       "(" => 77,
+                       "*" => 79,
+                       "." => 80,
+                       ">" => 81
+               }
        },
        {#State 203
-               DEFAULT => -61
+               DEFAULT => -26
        },
        {#State 204
+               DEFAULT => -84
+       },
+       {#State 205
+               DEFAULT => -64
+       },
+       {#State 206
+               DEFAULT => -63
+       },
+       {#State 207
                ACTIONS => {
-                       "[" => 147
+                       "[" => 152
                },
-               DEFAULT => -80,
+               DEFAULT => -82,
                GOTOS => {
-                       'array_len' => 206
+                       'array_len' => 209
                }
        },
-       {#State 205
-               DEFAULT => -25
+       {#State 208
+               DEFAULT => -27
        },
-       {#State 206
-               DEFAULT => -71
+       {#State 209
+               DEFAULT => -73
        }
 ],
                                   yyrules  =>
@@ -1791,22 +1811,32 @@ sub
 { push(@{$_[1]}, $_[2]); $_[1] }
        ],
        [#Rule 16
-                'interface', 7,
+                'interface', 8,
 sub
 #line 71 "pidl/idl.yp"
 {{
                "TYPE" => "INTERFACE", 
               "PROPERTIES" => $_[1],
               "NAME" => $_[3],
-              "DATA" => $_[5],
+                  "BASE" => $_[4],
+              "DATA" => $_[6],
                   "FILE" => $_[0]->YYData->{FILE},
                   "LINE" => $_[0]->YYData->{LINE},
           }}
        ],
        [#Rule 17
+                'base_interface', 0, undef
+       ],
+       [#Rule 18
+                'base_interface', 2,
+sub
+#line 84 "pidl/idl.yp"
+{ $_[2] }
+       ],
+       [#Rule 19
                 'cpp_quote', 4,
 sub
-#line 82 "pidl/idl.yp"
+#line 89 "pidl/idl.yp"
 {{
                 "TYPE" => "CPP_QUOTE",
                 "FILE" => $_[0]->YYData->{FILE},
@@ -1814,34 +1844,34 @@ sub
                 "DATA" => $_[3]
        }}
        ],
-       [#Rule 18
+       [#Rule 20
                 'definitions', 1,
 sub
-#line 91 "pidl/idl.yp"
+#line 98 "pidl/idl.yp"
 { [ $_[1] ] }
        ],
-       [#Rule 19
+       [#Rule 21
                 'definitions', 2,
 sub
-#line 92 "pidl/idl.yp"
+#line 99 "pidl/idl.yp"
 { push(@{$_[1]}, $_[2]); $_[1] }
        ],
-       [#Rule 20
+       [#Rule 22
                 'definition', 1, undef
        ],
-       [#Rule 21
+       [#Rule 23
                 'definition', 1, undef
        ],
-       [#Rule 22
+       [#Rule 24
                 'definition', 1, undef
        ],
-       [#Rule 23
+       [#Rule 25
                 'definition', 1, undef
        ],
-       [#Rule 24
+       [#Rule 26
                 'const', 7,
 sub
-#line 100 "pidl/idl.yp"
+#line 107 "pidl/idl.yp"
 {{
                      "TYPE"  => "CONST", 
                     "DTYPE"  => $_[2],
@@ -1852,10 +1882,10 @@ sub
                     "LINE" => $_[0]->YYData->{LINE},
         }}
        ],
-       [#Rule 25
+       [#Rule 27
                 'const', 8,
 sub
-#line 110 "pidl/idl.yp"
+#line 117 "pidl/idl.yp"
 {{
                      "TYPE"  => "CONST", 
                     "DTYPE"  => $_[2],
@@ -1867,10 +1897,10 @@ sub
                     "LINE" => $_[0]->YYData->{LINE},
         }}
        ],
-       [#Rule 26
+       [#Rule 28
                 'function', 7,
 sub
-#line 124 "pidl/idl.yp"
+#line 131 "pidl/idl.yp"
 {{
                "TYPE" => "FUNCTION",
                "NAME" => $_[3],
@@ -1881,10 +1911,10 @@ sub
                "LINE" => $_[0]->YYData->{LINE},
          }}
        ],
-       [#Rule 27
+       [#Rule 29
                 'typedef', 6,
 sub
-#line 136 "pidl/idl.yp"
+#line 143 "pidl/idl.yp"
 {{
                     "TYPE" => "TYPEDEF", 
                      "PROPERTIES" => $_[1],
@@ -1895,67 +1925,67 @@ sub
                     "LINE" => $_[0]->YYData->{LINE},
         }}
        ],
-       [#Rule 28
+       [#Rule 30
                 'usertype', 1, undef
        ],
-       [#Rule 29
+       [#Rule 31
                 'usertype', 1, undef
        ],
-       [#Rule 30
+       [#Rule 32
                 'usertype', 1, undef
        ],
-       [#Rule 31
+       [#Rule 33
                 'usertype', 1, undef
        ],
-       [#Rule 32
+       [#Rule 34
                 'typedecl', 2,
 sub
-#line 149 "pidl/idl.yp"
+#line 156 "pidl/idl.yp"
 { $_[1] }
        ],
-       [#Rule 33
+       [#Rule 35
                 'sign', 1, undef
        ],
-       [#Rule 34
+       [#Rule 36
                 'sign', 1, undef
        ],
-       [#Rule 35
+       [#Rule 37
                 'existingtype', 2,
 sub
-#line 154 "pidl/idl.yp"
+#line 161 "pidl/idl.yp"
 { ($_[1]?$_[1]:"signed") ." $_[2]" }
        ],
-       [#Rule 36
+       [#Rule 38
                 'existingtype', 1, undef
        ],
-       [#Rule 37
+       [#Rule 39
                 'type', 1, undef
        ],
-       [#Rule 38
+       [#Rule 40
                 'type', 1, undef
        ],
-       [#Rule 39
+       [#Rule 41
                 'type', 1,
 sub
-#line 158 "pidl/idl.yp"
+#line 165 "pidl/idl.yp"
 { "void" }
        ],
-       [#Rule 40
+       [#Rule 42
                 'enum_body', 3,
 sub
-#line 160 "pidl/idl.yp"
+#line 167 "pidl/idl.yp"
 { $_[2] }
        ],
-       [#Rule 41
+       [#Rule 43
                 'opt_enum_body', 0, undef
        ],
-       [#Rule 42
+       [#Rule 44
                 'opt_enum_body', 1, undef
        ],
-       [#Rule 43
+       [#Rule 45
                 'enum', 4,
 sub
-#line 163 "pidl/idl.yp"
+#line 170 "pidl/idl.yp"
 {{
              "TYPE" => "ENUM", 
                         "PROPERTIES" => $_[1],
@@ -1963,43 +1993,43 @@ sub
                     "ELEMENTS" => $_[4]
         }}
        ],
-       [#Rule 44
+       [#Rule 46
                 'enum_elements', 1,
 sub
-#line 172 "pidl/idl.yp"
+#line 179 "pidl/idl.yp"
 { [ $_[1] ] }
        ],
-       [#Rule 45
+       [#Rule 47
                 'enum_elements', 3,
 sub
-#line 173 "pidl/idl.yp"
+#line 180 "pidl/idl.yp"
 { push(@{$_[1]}, $_[3]); $_[1] }
        ],
-       [#Rule 46
+       [#Rule 48
                 'enum_element', 1, undef
        ],
-       [#Rule 47
+       [#Rule 49
                 'enum_element', 3,
 sub
-#line 177 "pidl/idl.yp"
+#line 184 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
-       [#Rule 48
+       [#Rule 50
                 'bitmap_body', 3,
 sub
-#line 180 "pidl/idl.yp"
+#line 187 "pidl/idl.yp"
 { $_[2] }
        ],
-       [#Rule 49
+       [#Rule 51
                 'opt_bitmap_body', 0, undef
        ],
-       [#Rule 50
+       [#Rule 52
                 'opt_bitmap_body', 1, undef
        ],
-       [#Rule 51
+       [#Rule 53
                 'bitmap', 4,
 sub
-#line 183 "pidl/idl.yp"
+#line 190 "pidl/idl.yp"
 {{
              "TYPE" => "BITMAP", 
                     "PROPERTIES" => $_[1],
@@ -2007,46 +2037,46 @@ sub
                     "ELEMENTS" => $_[4]
         }}
        ],
-       [#Rule 52
+       [#Rule 54
                 'bitmap_elements', 1,
 sub
-#line 192 "pidl/idl.yp"
+#line 199 "pidl/idl.yp"
 { [ $_[1] ] }
        ],
-       [#Rule 53
+       [#Rule 55
                 'bitmap_elements', 3,
 sub
-#line 193 "pidl/idl.yp"
+#line 200 "pidl/idl.yp"
 { push(@{$_[1]}, $_[3]); $_[1] }
        ],
-       [#Rule 54
+       [#Rule 56
                 'opt_bitmap_elements', 0, undef
        ],
-       [#Rule 55
+       [#Rule 57
                 'opt_bitmap_elements', 1, undef
        ],
-       [#Rule 56
+       [#Rule 58
                 'bitmap_element', 3,
 sub
-#line 198 "pidl/idl.yp"
+#line 205 "pidl/idl.yp"
 { "$_[1] ( $_[3] )" }
        ],
-       [#Rule 57
+       [#Rule 59
                 'struct_body', 3,
 sub
-#line 201 "pidl/idl.yp"
+#line 208 "pidl/idl.yp"
 { $_[2] }
        ],
-       [#Rule 58
+       [#Rule 60
                 'opt_struct_body', 0, undef
        ],
-       [#Rule 59
+       [#Rule 61
                 'opt_struct_body', 1, undef
        ],
-       [#Rule 60
+       [#Rule 62
                 'struct', 4,
 sub
-#line 205 "pidl/idl.yp"
+#line 212 "pidl/idl.yp"
 {{
              "TYPE" => "STRUCT", 
                         "PROPERTIES" => $_[1],
@@ -2054,10 +2084,10 @@ sub
                     "ELEMENTS" => $_[4]
         }}
        ],
-       [#Rule 61
+       [#Rule 63
                 'empty_element', 2,
 sub
-#line 214 "pidl/idl.yp"
+#line 221 "pidl/idl.yp"
 {{
                 "NAME" => "",
                 "TYPE" => "EMPTY",
@@ -2068,43 +2098,43 @@ sub
                 "LINE" => $_[0]->YYData->{LINE},
         }}
        ],
-       [#Rule 62
+       [#Rule 64
                 'base_or_empty', 2, undef
        ],
-       [#Rule 63
+       [#Rule 65
                 'base_or_empty', 1, undef
        ],
-       [#Rule 64
+       [#Rule 66
                 'optional_base_element', 2,
 sub
-#line 228 "pidl/idl.yp"
+#line 235 "pidl/idl.yp"
 { $_[2]->{PROPERTIES} = FlattenHash([$_[1],$_[2]->{PROPERTIES}]); $_[2] }
        ],
-       [#Rule 65
+       [#Rule 67
                 'union_elements', 0, undef
        ],
-       [#Rule 66
+       [#Rule 68
                 'union_elements', 2,
 sub
-#line 233 "pidl/idl.yp"
+#line 240 "pidl/idl.yp"
 { push(@{$_[1]}, $_[2]); $_[1] }
        ],
-       [#Rule 67
+       [#Rule 69
                 'union_body', 3,
 sub
-#line 236 "pidl/idl.yp"
+#line 243 "pidl/idl.yp"
 { $_[2] }
        ],
-       [#Rule 68
+       [#Rule 70
                 'opt_union_body', 0, undef
        ],
-       [#Rule 69
+       [#Rule 71
                 'opt_union_body', 1, undef
        ],
-       [#Rule 70
+       [#Rule 72
                 'union', 4,
 sub
-#line 240 "pidl/idl.yp"
+#line 247 "pidl/idl.yp"
 {{
              "TYPE" => "UNION", 
                         "PROPERTIES" => $_[1],
@@ -2112,10 +2142,10 @@ sub
                     "ELEMENTS" => $_[4]
         }}
        ],
-       [#Rule 71
+       [#Rule 73
                 'base_element', 5,
 sub
-#line 249 "pidl/idl.yp"
+#line 256 "pidl/idl.yp"
 {{
                           "NAME" => $_[4],
                           "TYPE" => $_[2],
@@ -2126,232 +2156,232 @@ sub
                       "LINE" => $_[0]->YYData->{LINE},
               }}
        ],
-       [#Rule 72
+       [#Rule 74
                 'pointers', 0,
 sub
-#line 263 "pidl/idl.yp"
+#line 270 "pidl/idl.yp"
 { 0 }
        ],
-       [#Rule 73
+       [#Rule 75
                 'pointers', 2,
 sub
-#line 264 "pidl/idl.yp"
+#line 271 "pidl/idl.yp"
 { $_[1]+1 }
        ],
-       [#Rule 74
+       [#Rule 76
                 'element_list1', 0,
 sub
-#line 268 "pidl/idl.yp"
+#line 275 "pidl/idl.yp"
 { [] }
        ],
-       [#Rule 75
+       [#Rule 77
                 'element_list1', 3,
 sub
-#line 269 "pidl/idl.yp"
+#line 276 "pidl/idl.yp"
 { push(@{$_[1]}, $_[2]); $_[1] }
        ],
-       [#Rule 76
+       [#Rule 78
                 'element_list2', 0, undef
        ],
-       [#Rule 77
+       [#Rule 79
                 'element_list2', 1, undef
        ],
-       [#Rule 78
+       [#Rule 80
                 'element_list2', 1,
 sub
-#line 275 "pidl/idl.yp"
+#line 282 "pidl/idl.yp"
 { [ $_[1] ] }
        ],
-       [#Rule 79
+       [#Rule 81
                 'element_list2', 3,
 sub
-#line 276 "pidl/idl.yp"
+#line 283 "pidl/idl.yp"
 { push(@{$_[1]}, $_[3]); $_[1] }
        ],
-       [#Rule 80
+       [#Rule 82
                 'array_len', 0, undef
        ],
-       [#Rule 81
+       [#Rule 83
                 'array_len', 3,
 sub
-#line 281 "pidl/idl.yp"
+#line 288 "pidl/idl.yp"
 { push(@{$_[3]}, "*"); $_[3] }
        ],
-       [#Rule 82
+       [#Rule 84
                 'array_len', 4,
 sub
-#line 282 "pidl/idl.yp"
+#line 289 "pidl/idl.yp"
 { push(@{$_[4]}, "$_[2]"); $_[4] }
        ],
-       [#Rule 83
+       [#Rule 85
                 'property_list', 0, undef
        ],
-       [#Rule 84
+       [#Rule 86
                 'property_list', 4,
 sub
-#line 288 "pidl/idl.yp"
+#line 295 "pidl/idl.yp"
 { FlattenHash([$_[1],$_[3]]); }
        ],
-       [#Rule 85
+       [#Rule 87
                 'properties', 1,
 sub
-#line 291 "pidl/idl.yp"
+#line 298 "pidl/idl.yp"
 { $_[1] }
        ],
-       [#Rule 86
+       [#Rule 88
                 'properties', 3,
 sub
-#line 292 "pidl/idl.yp"
+#line 299 "pidl/idl.yp"
 { FlattenHash([$_[1], $_[3]]); }
        ],
-       [#Rule 87
+       [#Rule 89
                 'property', 1,
 sub
-#line 295 "pidl/idl.yp"
+#line 302 "pidl/idl.yp"
 {{ "$_[1]" => "1"     }}
        ],
-       [#Rule 88
+       [#Rule 90
                 'property', 4,
 sub
-#line 296 "pidl/idl.yp"
+#line 303 "pidl/idl.yp"
 {{ "$_[1]" => "$_[3]" }}
        ],
-       [#Rule 89
+       [#Rule 91
                 'commalisttext', 1, undef
        ],
-       [#Rule 90
+       [#Rule 92
                 'commalisttext', 3,
 sub
-#line 301 "pidl/idl.yp"
+#line 308 "pidl/idl.yp"
 { "$_[1],$_[3]" }
        ],
-       [#Rule 91
+       [#Rule 93
                 'anytext', 0,
 sub
-#line 305 "pidl/idl.yp"
+#line 312 "pidl/idl.yp"
 { "" }
        ],
-       [#Rule 92
-                'anytext', 1, undef
-       ],
-       [#Rule 93
-                'anytext', 1, undef
-       ],
        [#Rule 94
                 'anytext', 1, undef
        ],
        [#Rule 95
-                'anytext', 3,
-sub
-#line 307 "pidl/idl.yp"
-{ "$_[1]$_[2]$_[3]" }
+                'anytext', 1, undef
        ],
        [#Rule 96
-                'anytext', 3,
-sub
-#line 308 "pidl/idl.yp"
-{ "$_[1]$_[2]$_[3]" }
+                'anytext', 1, undef
        ],
        [#Rule 97
                 'anytext', 3,
 sub
-#line 309 "pidl/idl.yp"
+#line 314 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 98
                 'anytext', 3,
 sub
-#line 310 "pidl/idl.yp"
+#line 315 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 99
                 'anytext', 3,
 sub
-#line 311 "pidl/idl.yp"
+#line 316 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 100
                 'anytext', 3,
 sub
-#line 312 "pidl/idl.yp"
+#line 317 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 101
                 'anytext', 3,
 sub
-#line 313 "pidl/idl.yp"
+#line 318 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 102
                 'anytext', 3,
 sub
-#line 314 "pidl/idl.yp"
+#line 319 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 103
                 'anytext', 3,
 sub
-#line 315 "pidl/idl.yp"
+#line 320 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 104
                 'anytext', 3,
 sub
-#line 316 "pidl/idl.yp"
+#line 321 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 105
                 'anytext', 3,
 sub
-#line 317 "pidl/idl.yp"
+#line 322 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 106
                 'anytext', 3,
 sub
-#line 318 "pidl/idl.yp"
+#line 323 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 107
                 'anytext', 3,
 sub
-#line 319 "pidl/idl.yp"
+#line 324 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]" }
        ],
        [#Rule 108
+                'anytext', 3,
+sub
+#line 325 "pidl/idl.yp"
+{ "$_[1]$_[2]$_[3]" }
+       ],
+       [#Rule 109
+                'anytext', 3,
+sub
+#line 326 "pidl/idl.yp"
+{ "$_[1]$_[2]$_[3]" }
+       ],
+       [#Rule 110
                 'anytext', 5,
 sub
-#line 320 "pidl/idl.yp"
+#line 327 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]$_[4]$_[5]" }
        ],
-       [#Rule 109
+       [#Rule 111
                 'anytext', 5,
 sub
-#line 321 "pidl/idl.yp"
+#line 328 "pidl/idl.yp"
 { "$_[1]$_[2]$_[3]$_[4]$_[5]" }
        ],
-       [#Rule 110
+       [#Rule 112
                 'identifier', 1, undef
        ],
-       [#Rule 111
+       [#Rule 113
                 'optional_identifier', 1, undef
        ],
-       [#Rule 112
+       [#Rule 114
                 'optional_identifier', 0, undef
        ],
-       [#Rule 113
+       [#Rule 115
                 'constant', 1, undef
        ],
-       [#Rule 114
+       [#Rule 116
                 'text', 1,
 sub
-#line 335 "pidl/idl.yp"
+#line 342 "pidl/idl.yp"
 { "\"$_[1]\"" }
        ],
-       [#Rule 115
+       [#Rule 117
                 'optional_semicolon', 0, undef
        ],
-       [#Rule 116
+       [#Rule 118
                 'optional_semicolon', 1, undef
        ]
 ],
@@ -2359,7 +2389,7 @@ sub
     bless($self,$class);
 }
 
-#line 346 "pidl/idl.yp"
+#line 353 "pidl/idl.yp"
 
 
 use Parse::Pidl qw(error);
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/COM/Header.pm
new file mode 100644 (file)
index 0000000..85dab37
--- /dev/null
@@ -0,0 +1,142 @@
+# COM Header generation
+# (C) 2005 Jelmer Vernooij <jelmer@samba.org>
+
+package Parse::Pidl::Samba4::COM::Header;
+
+use Parse::Pidl::Typelist qw(mapType);
+use Parse::Pidl::Util qw(has_property is_constant);
+
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+use strict;
+
+sub GetArgumentProtoList($)
+{
+       my $f = shift;
+       my $res = "";
+
+       foreach my $a (@{$f->{ELEMENTS}}) {
+
+               $res .= ", " . mapType($a->{TYPE}) . " ";
+
+               my $l = $a->{POINTERS};
+               $l-- if (Parse::Pidl::Typelist::scalar_is_reference($a->{TYPE}));
+               foreach my $i (1..$l) {
+                       $res .= "*";
+               }
+
+               if (defined $a->{ARRAY_LEN}[0] && !is_constant($a->{ARRAY_LEN}[0]) &&
+               !$a->{POINTERS}) {
+                       $res .= "*";
+               }
+               $res .= $a->{NAME};
+               if (defined $a->{ARRAY_LEN}[0] && is_constant($a->{ARRAY_LEN}[0])) {
+                       $res .= "[$a->{ARRAY_LEN}[0]]";
+               }
+       }
+
+       return $res;
+}
+
+sub GetArgumentList($)
+{
+       my $f = shift;
+       my $res = "";
+
+       foreach (@{$f->{ELEMENTS}}) { $res .= ", $_->{NAME}"; }
+
+       return $res;
+}
+
+#####################################################################
+# generate vtable structure for COM interface
+sub HeaderVTable($)
+{
+       my $interface = shift;
+       my $res;
+       $res .= "#define " . uc($interface->{NAME}) . "_METHODS \\\n";
+       if (defined($interface->{BASE})) {
+               $res .= "\t" . uc($interface->{BASE} . "_METHODS") . "\\\n";
+       }
+
+       my $data = $interface->{DATA};
+       foreach my $d (@{$data}) {
+               $res .= "\t" . mapType($d->{RETURN_TYPE}) . " (*$d->{NAME}) (struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . GetArgumentProtoList($d) . ");\\\n" if ($d->{TYPE} eq "FUNCTION");
+       }
+       $res .= "\n";
+       $res .= "struct $interface->{NAME}_vtable {\n";
+       $res .= "\tstruct GUID iid;\n";
+       $res .= "\t" . uc($interface->{NAME}) . "_METHODS\n";
+       $res .= "};\n\n";
+
+       return $res;
+}
+
+sub ParseInterface($)
+{
+       my $if = shift;
+       my $res;
+
+       $res .="\n\n/* $if->{NAME} */\n";
+
+       $res .="#define COM_" . uc($if->{NAME}) . "_UUID $if->{PROPERTIES}->{uuid}\n\n";
+
+       $res .="struct $if->{NAME}_vtable;\n\n";
+
+       $res .="struct $if->{NAME} {
+       struct com_context *ctx;
+       struct $if->{NAME}_vtable *vtable;
+       void *object_data;
+};\n\n";
+
+       $res.=HeaderVTable($if);
+
+       foreach my $d (@{$if->{DATA}}) {
+               next if ($d->{TYPE} ne "FUNCTION");
+
+               $res .= "#define $if->{NAME}_$d->{NAME}(interface, mem_ctx" . GetArgumentList($d) . ") ";
+
+               $res .= "((interface)->vtable->$d->{NAME}(interface, mem_ctx" . GetArgumentList($d) . "))";
+
+               $res .="\n";
+       }
+
+       return $res;
+}
+
+sub ParseCoClass($)
+{
+       my $c = shift;
+       my $res = "";
+       $res .= "#define CLSID_" . uc($c->{NAME}) . " $c->{PROPERTIES}->{uuid}\n";
+       if (has_property($c, "progid")) {
+               $res .= "#define PROGID_" . uc($c->{NAME}) . " $c->{PROPERTIES}->{progid}\n";
+       }
+       $res .= "\n";
+       return $res;
+}
+
+sub Parse($$)
+{
+       my ($idl,$ndr_header) = @_;
+       my $res = "";
+
+       $res .= "#include \"librpc/gen_ndr/orpc.h\"\n" . 
+                       "#include \"$ndr_header\"\n\n";
+
+       foreach (@{$idl})
+       {
+               if ($_->{TYPE} eq "INTERFACE" && has_property($_, "object")) {
+                       $res.=ParseInterface($_);
+               } 
+
+               if ($_->{TYPE} eq "COCLASS") {
+                       $res.=ParseCoClass($_);
+               }
+       }
+
+       return $res;
+}
+
+1;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm b/source4/pidl/lib/Parse/Pidl/Samba4/COM/Proxy.pm
new file mode 100644 (file)
index 0000000..e6366f0
--- /dev/null
@@ -0,0 +1,219 @@
+###################################################
+# DCOM parser for Samba
+# Basically the glue between COM and DCE/RPC with NDR
+# Copyright jelmer@samba.org 2003-2005
+# released under the GNU GPL
+
+package Parse::Pidl::Samba4::COM::Proxy;
+
+use Parse::Pidl::Samba4::COM::Header;
+use Parse::Pidl::Util qw(has_property);
+
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+use strict;
+
+my($res);
+
+sub ParseVTable($$)
+{
+       my $interface = shift;
+       my $name = shift;
+
+       # Generate the vtable
+       $res .="\tstruct $interface->{NAME}_vtable $name = {";
+
+       if (defined($interface->{BASE})) {
+               $res .= "\n\t\t{},";
+       }
+
+       my $data = $interface->{DATA};
+
+       foreach my $d (@{$data}) {
+               if ($d->{TYPE} eq "FUNCTION") {
+                   $res .= "\n\t\tdcom_proxy_$interface->{NAME}_$d->{NAME}";
+                       $res .= ",";
+               }
+       }
+
+       $res .= "\n\t};\n\n";
+}
+
+sub ParseRegFunc($)
+{
+       my $interface = shift;
+
+       $res .= "static NTSTATUS dcom_proxy_$interface->{NAME}_init(void)
+{
+       struct GUID base_iid;
+       struct $interface->{NAME}_vtable *proxy_vtable = talloc(talloc_autofree_context(), struct $interface->{NAME}_vtable);
+";
+
+       if (defined($interface->{BASE})) {
+               $res.= "
+       const void *base_vtable;
+
+       base_iid = dcerpc_table_$interface->{BASE}.uuid;
+
+       base_vtable = dcom_proxy_vtable_by_iid(&base_iid);
+       if (base_vtable == NULL) {
+               DEBUG(0, (\"No proxy registered for base interface '$interface->{BASE}'\\n\"));
+               return NT_STATUS_FOOBAR;
+       }
+       
+       memcpy(&proxy_vtable, base_vtable, sizeof(struct $interface->{BASE}_vtable));
+
+";
+       }
+       foreach my $x (@{$interface->{DATA}}) {
+               next unless ($x->{TYPE} eq "FUNCTION");
+
+               $res .= "\tproxy_vtable.$x->{NAME} = dcom_proxy_$interface->{NAME}_$x->{NAME};\n";
+       }
+
+       $res.= "
+       proxy_vtable.iid = dcerpc_table_$interface->{NAME}.uuid;
+
+       return dcom_register_proxy(&proxy_vtable);
+}\n\n";
+}
+
+#####################################################################
+# parse a function
+sub ParseFunction($$)
+{
+       my $interface = shift;
+       my $fn = shift;
+       my $name = $fn->{NAME};
+       my $uname = uc $name;
+
+       $res.="
+static $fn->{RETURN_TYPE} dcom_proxy_$interface->{NAME}_$name(struct $interface->{NAME} *d, TALLOC_CTX *mem_ctx" . Parse::Pidl::Samba4::COM::Header::GetArgumentProtoList($fn) . ")
+{
+       struct dcerpc_pipe *p;
+       NTSTATUS status = dcom_get_pipe(d, &p);
+       struct $name r;
+       struct rpc_request *req;
+
+       if (NT_STATUS_IS_ERR(status)) {
+               return status;
+       }
+
+       ZERO_STRUCT(r.in.ORPCthis);
+       r.in.ORPCthis.version.MajorVersion = COM_MAJOR_VERSION;
+       r.in.ORPCthis.version.MinorVersion = COM_MINOR_VERSION;
+";
+       
+       # Put arguments into r
+       foreach my $a (@{$fn->{ELEMENTS}}) {
+               next unless (has_property($a, "in"));
+               if (Parse::Pidl::Typelist::typeIs($a->{TYPE}, "INTERFACE")) {
+                       $res .="\tNDR_CHECK(dcom_OBJREF_from_IUnknown(&r.in.$a->{NAME}.obj, $a->{NAME}));\n";
+               } else {
+                       $res .= "\tr.in.$a->{NAME} = $a->{NAME};\n";
+               }
+       }
+
+       $res .="
+       if (p->conn->flags & DCERPC_DEBUG_PRINT_IN) {
+               NDR_PRINT_IN_DEBUG($name, &r);          
+       }
+
+       status = dcerpc_ndr_request(p, &d->ipid, &dcerpc_table_$interface->{NAME}, DCERPC_$uname, mem_ctx, &r);
+
+       if (NT_STATUS_IS_OK(status) && (p->conn->flags & DCERPC_DEBUG_PRINT_OUT)) {
+               NDR_PRINT_OUT_DEBUG($name, r);          
+       }
+
+";
+
+       # Put r info back into arguments
+       foreach my $a (@{$fn->{ELEMENTS}}) {
+               next unless (has_property($a, "out"));
+
+               if (Parse::Pidl::Typelist::typeIs($a->{TYPE}, "INTERFACE")) {
+                       $res .="\tNDR_CHECK(dcom_IUnknown_from_OBJREF(d->ctx, &$a->{NAME}, r.out.$a->{NAME}.obj));\n";
+               } else {
+                       $res .= "\t*$a->{NAME} = r.out.$a->{NAME};\n";
+               }
+
+       }
+       
+       if ($fn->{RETURN_TYPE} eq "NTSTATUS") {
+               $res .= "\tif (NT_STATUS_IS_OK(status)) status = r.out.result;\n";
+       }
+
+       $res .= 
+       "
+       return r.out.result;
+}\n\n";
+}
+
+#####################################################################
+# parse the interface definitions
+sub ParseInterface($)
+{
+       my($interface) = shift;
+       my($data) = $interface->{DATA};
+       $res = "/* DCOM proxy for $interface->{NAME} generated by pidl */\n\n";
+       foreach my $d (@{$data}) {
+               ($d->{TYPE} eq "FUNCTION") && 
+               ParseFunction($interface, $d);
+       }
+
+       ParseRegFunc($interface);
+}
+
+sub RegistrationFunction($$)
+{
+       my $idl = shift;
+       my $basename = shift;
+
+       my $res = "\n\nNTSTATUS dcom_$basename\_init(void)\n";
+       $res .= "{\n";
+       $res .="\tNTSTATUS status = NT_STATUS_OK;\n";
+       foreach my $interface (@{$idl}) {
+               next if $interface->{TYPE} ne "INTERFACE";
+               next if not has_property($interface, "object");
+
+               my $data = $interface->{DATA};
+               my $count = 0;
+               foreach my $d (@{$data}) {
+                       if ($d->{TYPE} eq "FUNCTION") { $count++; }
+               }
+
+               next if ($count == 0);
+
+               $res .= "\tstatus = dcom_$interface->{NAME}_init();\n";
+               $res .= "\tif (NT_STATUS_IS_ERR(status)) {\n";
+               $res .= "\t\treturn status;\n";
+               $res .= "\t}\n\n";
+       }
+       $res .= "\treturn status;\n";
+       $res .= "}\n\n";
+
+       return $res;
+}
+
+sub Parse($$)
+{
+       my ($pidl,$comh_filename) = @_;
+       my $res = "";
+
+       $res .= "#include \"includes.h\"\n" .
+                       "#include \"lib/com/dcom/dcom.h\"\n" .
+                       "#include \"$comh_filename\"\n";
+
+       foreach (@{$pidl}) {
+               next if ($_->{TYPE} ne "INTERFACE");
+               next if has_property($_, "local");
+               next unless has_property($_, "object");
+
+               $res .= ParseInterface($_);
+       }
+
+       return $res;
+}
+
+1;
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm b/source4/pidl/lib/Parse/Pidl/Samba4/COM/Stub.pm
new file mode 100644 (file)
index 0000000..150acbf
--- /dev/null
@@ -0,0 +1,327 @@
+###################################################
+# DCOM stub boilerplate generator
+# Copyright jelmer@samba.org 2004-2005
+# Copyright tridge@samba.org 2003
+# Copyright metze@samba.org 2004
+# released under the GNU GPL
+
+package Parse::Pidl::Samba4::COM::Stub;
+
+use Parse::Pidl::Util qw(has_property);
+use strict;
+
+use vars qw($VERSION);
+$VERSION = '0.01';
+
+my($res);
+
+sub pidl($)
+{
+       $res .= shift;
+}
+
+#####################################################
+# generate the switch statement for function dispatch
+sub gen_dispatch_switch($)
+{
+       my $data = shift;
+
+       my $count = 0;
+       foreach my $d (@{$data}) {
+               next if ($d->{TYPE} ne "FUNCTION");
+
+               pidl "\tcase $count: {\n";
+               if ($d->{RETURN_TYPE} && $d->{RETURN_TYPE} ne "void") {
+                       pidl "\t\tNTSTATUS result;\n";
+               }
+               pidl "\t\tstruct $d->{NAME} *r2 = r;\n";
+               pidl "\t\tif (DEBUGLEVEL > 10) {\n";
+               pidl "\t\t\tNDR_PRINT_FUNCTION_DEBUG($d->{NAME}, NDR_IN, r2);\n";
+               pidl "\t\t}\n";
+               if ($d->{RETURN_TYPE} && $d->{RETURN_TYPE} ne "void") {
+                       pidl "\t\tresult = vtable->$d->{NAME}(iface, mem_ctx, r2);\n";
+               } else {
+                       pidl "\t\tvtable->$d->{NAME}(iface, mem_ctx, r2);\n";
+               }
+               pidl "\t\tif (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {\n";
+               pidl "\t\t\tDEBUG(5,(\"function $d->{NAME} will reply async\\n\"));\n";
+               pidl "\t\t}\n";
+               pidl "\t\tbreak;\n\t}\n";
+               $count++; 
+       }
+}
+
+#####################################################
+# generate the switch statement for function reply
+sub gen_reply_switch($)
+{
+       my $data = shift;
+
+       my $count = 0;
+       foreach my $d (@{$data}) {
+               next if ($d->{TYPE} ne "FUNCTION");
+
+               pidl "\tcase $count: {\n";
+               pidl "\t\tstruct $d->{NAME} *r2 = r;\n";
+               pidl "\t\tif (dce_call->state_flags & DCESRV_CALL_STATE_FLAG_ASYNC) {\n";
+               pidl "\t\t\tDEBUG(5,(\"function $d->{NAME} replied async\\n\"));\n";
+               pidl "\t\t}\n";
+               pidl "\t\tif (DEBUGLEVEL > 10 && dce_call->fault_code == 0) {\n";
+               pidl "\t\t\tNDR_PRINT_FUNCTION_DEBUG($d->{NAME}, NDR_OUT | NDR_SET_VALUES, r2);\n";
+               pidl "\t\t}\n";
+               pidl "\t\tif (dce_call->fault_code != 0) {\n";
+               pidl "\t\t\tDEBUG(2,(\"dcerpc_fault %s in $d->{NAME}\\n\", dcerpc_errstr(mem_ctx, dce_call->fault_code)));\n";
+               pidl "\t\t}\n";
+               pidl "\t\tbreak;\n\t}\n";
+               $count++; 
+       }
+}
+
+#####################################################################
+# produce boilerplate code for a interface
+sub Boilerplate_Iface($)
+{
+       my($interface) = shift;
+       my($data) = $interface->{DATA};
+       my $name = $interface->{NAME};
+       my $uname = uc $name;
+       my $uuid = Parse::Pidl::Util::make_str($interface->{PROPERTIES}->{uuid});
+       my $if_version = $interface->{PROPERTIES}->{version};
+
+       pidl "
+static NTSTATUS $name\__op_bind(struct dcesrv_call_state *dce_call, const struct dcesrv_interface *iface)
+{
+#ifdef DCESRV_INTERFACE_$uname\_BIND
+       return DCESRV_INTERFACE_$uname\_BIND(dce_call,iface);
+#else
+       return NT_STATUS_OK;
+#endif
+}
+
+static void $name\__op_unbind(struct dcesrv_connection_context *context, const struct dcesrv_interface *iface)
+{
+#ifdef DCESRV_INTERFACE_$uname\_UNBIND
+       DCESRV_INTERFACE_$uname\_UNBIND(context, iface);
+#else
+       return;
+#endif
+}
+
+static NTSTATUS $name\__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_pull *pull, void **r)
+{
+       NTSTATUS status;
+       uint16_t opnum = dce_call->pkt.u.request.opnum;
+
+       dce_call->fault_code = 0;
+
+       if (opnum >= dcerpc_table_$name.num_calls) {
+               dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
+               return NT_STATUS_NET_WRITE_FAULT;
+       }
+
+       *r = talloc_size(mem_ctx, dcerpc_table_$name.calls[opnum].struct_size);
+       NT_STATUS_HAVE_NO_MEMORY(*r);
+
+        /* unravel the NDR for the packet */
+       status = dcerpc_table_$name.calls[opnum].ndr_pull(pull, NDR_IN, *r);
+       if (!NT_STATUS_IS_OK(status)) {
+               dcerpc_log_packet(&dcerpc_table_$name, opnum, NDR_IN,
+                                 &dce_call->pkt.u.request.stub_and_verifier);
+               dce_call->fault_code = DCERPC_FAULT_NDR;
+               return NT_STATUS_NET_WRITE_FAULT;
+       }
+
+       return NT_STATUS_OK;
+}
+
+static NTSTATUS $name\__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
+{
+       uint16_t opnum = dce_call->pkt.u.request.opnum;
+       struct GUID ipid = dce_call->pkt.u.request.object.object;
+       struct dcom_interface_p *iface = dcom_get_local_iface_p(&ipid);
+       const struct dcom_$name\_vtable *vtable = iface->vtable;
+
+       switch (opnum) {
+";
+       gen_dispatch_switch($data);
+
+pidl "
+       default:
+               dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
+               break;
+       }
+
+       if (dce_call->fault_code != 0) {
+               dcerpc_log_packet(&dcerpc_table_$name, opnum, NDR_IN,
+                                 &dce_call->pkt.u.request.stub_and_verifier);
+               return NT_STATUS_NET_WRITE_FAULT;
+       }
+
+       return NT_STATUS_OK;
+}
+
+static NTSTATUS $name\__op_reply(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r)
+{
+       uint16_t opnum = dce_call->pkt.u.request.opnum;
+
+       switch (opnum) {
+";
+       gen_reply_switch($data);
+
+pidl "
+       default:
+               dce_call->fault_code = DCERPC_FAULT_OP_RNG_ERROR;
+               break;
+       }
+
+       if (dce_call->fault_code != 0) {
+               dcerpc_log_packet(&dcerpc_table_$name, opnum, NDR_IN,
+                                 &dce_call->pkt.u.request.stub_and_verifier);
+               return NT_STATUS_NET_WRITE_FAULT;
+       }
+
+       return NT_STATUS_OK;
+}
+
+static NTSTATUS $name\__op_ndr_push(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct ndr_push *push, const void *r)
+{
+       NTSTATUS status;
+       uint16_t opnum = dce_call->pkt.u.request.opnum;
+
+       status = dcerpc_table_$name.calls[opnum].ndr_push(push, NDR_OUT, r);
+       if (!NT_STATUS_IS_OK(status)) {
+               dce_call->fault_code = DCERPC_FAULT_NDR;
+               return NT_STATUS_NET_WRITE_FAULT;
+       }
+
+       return NT_STATUS_OK;
+}
+
+static const struct dcesrv_interface $name\_interface = {
+       .name           = \"$name\",
+       .uuid           = $uuid,
+       .if_version     = $if_version,
+       .bind           = $name\__op_bind,
+       .unbind         = $name\__op_unbind,
+       .ndr_pull       = $name\__op_ndr_pull,
+       .dispatch       = $name\__op_dispatch,
+       .reply          = $name\__op_reply,
+       .ndr_push       = $name\__op_ndr_push
+};
+
+";
+}
+
+#####################################################################
+# produce boilerplate code for an endpoint server
+sub Boilerplate_Ep_Server($)
+{
+       my($interface) = shift;
+       my $name = $interface->{NAME};
+       my $uname = uc $name;
+
+       pidl "
+static NTSTATUS $name\__op_init_server(struct dcesrv_context *dce_ctx, const struct dcesrv_endpoint_server *ep_server)
+{
+       int i;
+
+       for (i=0;i<dcerpc_table_$name.endpoints->count;i++) {
+               NTSTATUS ret;
+               const char *name = dcerpc_table_$name.endpoints->names[i];
+
+               ret = dcesrv_interface_register(dce_ctx, name, &$name\_interface, NULL);
+               if (!NT_STATUS_IS_OK(ret)) {
+                       DEBUG(1,(\"$name\_op_init_server: failed to register endpoint \'%s\'\\n\",name));
+                       return ret;
+               }
+       }
+
+       return NT_STATUS_OK;
+}
+
+static BOOL $name\__op_interface_by_uuid(struct dcesrv_interface *iface, const char *uuid, uint32_t if_version)
+{
+       if (dcerpc_table_$name.if_version == if_version &&
+               strcmp(dcerpc_table_$name.uuid, uuid)==0) {
+               memcpy(iface,&dcerpc_table_$name, sizeof(*iface));
+               return True;
+       }
+
+       return False;
+}
+
+static BOOL $name\__op_interface_by_name(struct dcesrv_interface *iface, const char *name)
+{
+       if (strcmp(dcerpc_table_$name.name, name)==0) {
+               memcpy(iface,&dcerpc_table_$name, sizeof(*iface));
+               return True;
+       }
+
+       return False;   
+}
+       
+NTSTATUS dcerpc_server_$name\_init(void)
+{
+       NTSTATUS ret;
+       struct dcesrv_endpoint_server ep_server;
+
+       /* fill in our name */
+       ep_server.name = \"$name\";
+
+       /* fill in all the operations */
+       ep_server.init_server = $name\__op_init_server;
+
+       ep_server.interface_by_uuid = $name\__op_interface_by_uuid;
+       ep_server.interface_by_name = $name\__op_interface_by_name;
+
+       /* register ourselves with the DCERPC subsystem. */
+       ret = dcerpc_register_ep_server(&ep_server);
+
+       if (!NT_STATUS_IS_OK(ret)) {
+               DEBUG(0,(\"Failed to register \'$name\' endpoint server!\\n\"));
+               return ret;
+       }
+
+       return ret;
+}
+
+";
+}
+
+#####################################################################
+# dcom interface stub from a parsed IDL structure 
+sub ParseInterface($)
+{
+       my($interface) = shift;
+       
+       return "" if has_property($interface, "local");
+       
+       my($data) = $interface->{DATA};
+       my $count = 0;
+
+       $res = "";
+
+       if (!defined $interface->{PROPERTIES}->{uuid}) {
+               return $res;
+       }
+
+       if (!defined $interface->{PROPERTIES}->{version}) {
+               $interface->{PROPERTIES}->{version} = "0.0";
+       }
+
+       foreach my $d (@{$data}) {
+               if ($d->{TYPE} eq "FUNCTION") { $count++; }
+       }
+
+       if ($count == 0) {
+               return $res;
+       }
+
+       $res = "/* dcom interface stub generated by pidl */\n\n";
+       Boilerplate_Iface($interface);
+       Boilerplate_Ep_Server($interface);
+
+       return $res;
+}
+
+1;
index 60d0dafc8aba21a29b10380db99ffc7b99050cb1..ab672367175f92a6fd29f48394fcb96c2c788a22 100644 (file)
@@ -1025,7 +1025,7 @@ sub ConvertObjectToPythonData($$$$$)
                return $self->ConvertScalarToPython(Parse::Pidl::Typelist::bitmap_type_fn($actual_ctype), $cvar);
        } elsif ($actual_ctype->{TYPE} eq "SCALAR") {
                return $self->ConvertScalarToPython($actual_ctype->{NAME}, $cvar);
-       } elsif ($actual_ctype->{TYPE} eq "STRUCT") {
+       } elsif ($actual_ctype->{TYPE} eq "STRUCT" or $actual_ctype->{TYPE} eq "INTERFACE") {
                return "py_talloc_import_ex(&$ctype->{NAME}_Type, $mem_ctx, $cvar)";
        }
 
index 8ba1ae47afbb3ed6feddc0b7ba2c571bf266cf4e..c5c458ac6b9cc1b8f99a6ed14cbf788539513c76 100644 (file)
@@ -245,7 +245,7 @@ sub mapType($$)
        return mapType($t->{DATA}, $n) if ($t->{TYPE} eq "TYPEDEF");
        return mapScalarType($n) if ($t->{TYPE} eq "SCALAR");
        return "enum $n" if ($t->{TYPE} eq "ENUM");
-       return "struct $n" if ($t->{TYPE} eq "STRUCT");
+       return "struct $n" if ($t->{TYPE} eq "STRUCT" or $t->{TYPE} eq "INTERFACE");
        return "union $n" if ($t->{TYPE} eq "UNION");
        return mapScalarType(bitmap_type_fn($t)) if ($t->{TYPE} eq "BITMAP");
        die("Unknown type $t->{TYPE}");
@@ -273,6 +273,13 @@ sub LoadIdl($)
        foreach my $x (@{$idl}) {
                next if $x->{TYPE} ne "INTERFACE";
 
+               # DCOM interfaces can be types as well
+               addType({
+                       NAME => $x->{NAME},
+                       TYPE => "TYPEDEF",
+                       DATA => $x
+                       }) if (has_property($x, "object"));
+
                foreach my $y (@{$x->{DATA}}) {
                        addType($y) if (
                                $y->{TYPE} eq "TYPEDEF"