lib/ldb-samba: Add comment dicouraging use of schemaUpgradeInProgress
[obnox/samba/samba-obnox.git] / pidl / idl.yp
index 399ff74f41f40328242c6d9f4d398c3ef879372e..c8a65f6f629328e752c26eecfe5a6cd42d05b446 100644 (file)
@@ -169,13 +169,14 @@ function:
 ;
 
 typedef:
-       property_list 'typedef' type identifier array_len ';'
+       property_list 'typedef' type pointers identifier array_len ';'
        {{
                "TYPE" => "TYPEDEF",
                "PROPERTIES" => $_[1],
-               "NAME" => $_[4],
+               "NAME" => $_[5],
                "DATA" => $_[3],
-               "ARRAY_LEN" => $_[5],
+               "POINTERS" => $_[4],
+               "ARRAY_LEN" => $_[6],
                "FILE" => $_[0]->YYData->{FILE},
                "LINE" => $_[0]->YYData->{LINE},
         }}
@@ -189,6 +190,8 @@ usertype:
        enum
        |
        bitmap
+       |
+       pipe
 ;
 
 typedecl:
@@ -379,6 +382,41 @@ pointers:
        pointers '*'  { $_[1]+1 }
 ;
 
+pipe:
+       property_list 'pipe' type
+       {{
+               "TYPE" => "PIPE",
+               "PROPERTIES" => $_[1],
+               "NAME" => undef,
+               "DATA" => {
+                       "TYPE" => "STRUCT",
+                       "PROPERTIES" => $_[1],
+                       "NAME" => undef,
+                       "ELEMENTS" => [{
+                               "NAME" => "count",
+                               "PROPERTIES" => $_[1],
+                               "POINTERS" => 0,
+                               "ARRAY_LEN" => [],
+                               "TYPE" => "uint3264",
+                               "FILE" => $_[0]->YYData->{FILE},
+                               "LINE" => $_[0]->YYData->{LINE},
+                       },{
+                               "NAME" => "array",
+                               "PROPERTIES" => $_[1],
+                               "POINTERS" => 0,
+                               "ARRAY_LEN" => [ "count" ],
+                               "TYPE" => $_[3],
+                               "FILE" => $_[0]->YYData->{FILE},
+                               "LINE" => $_[0]->YYData->{LINE},
+                       }],
+                       "FILE" => $_[0]->YYData->{FILE},
+                       "LINE" => $_[0]->YYData->{LINE},
+               },
+               "FILE" => $_[0]->YYData->{FILE},
+               "LINE" => $_[0]->YYData->{LINE},
+       }}
+;
+
 element_list1:
        #empty
        { [] }
@@ -572,7 +610,9 @@ again:
 
        for ($parser->YYData->{INPUT}) {
                if (/^\#/) {
-                       if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
+                       # Linemarker format is described at
+                       # http://gcc.gnu.org/onlinedocs/cpp/Preprocessor-Output.html
+                       if (s/^\# (\d+) \"(.*?)\"(( \d+){1,4}|)//) {
                                $parser->YYData->{LINE} = $1-1;
                                $parser->YYData->{FILE} = $2;
                                goto again;
@@ -603,7 +643,7 @@ again:
                        if ($1 =~
                            /^(coclass|interface|import|importlib
                              |include|cpp_quote|typedef
-                             |union|struct|enum|bitmap
+                             |union|struct|enum|bitmap|pipe
                              |void|const|unsigned|signed)$/x) {
                                return $1;
                        }
@@ -639,11 +679,17 @@ sub parse_file($$)
        my $saved_delim = $/;
        undef $/;
        my $cpp = $ENV{CPP};
+       my $options = "";
        if (! defined $cpp) {
-               $cpp = "cpp";
+               if (defined $ENV{CC}) {
+                       $cpp = "$ENV{CC}";
+                       $options = "-E";
+               } else {
+                       $cpp = "cpp";
+               }
        }
        my $includes = join('',map { " -I$_" } @$incdirs);
-       my $data = `$cpp -D__PIDL__$includes -xc $filename`;
+       my $data = `$cpp $options -D__PIDL__$includes -xc "$filename"`;
        $/ = $saved_delim;
 
        return parse_string($data, $filename);