1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

r4551: add support for a pidl extensions

'declare bitmap foo1;'
'declare enum foo2;'

and also allow

typedef [public] bitmap ...
typedef [public] enum ...

you need to a forward declaration of bitmaps and enums

when you want to use them in another idl file,
and you need to make the real declaration to be public

see the next commit to samr.idl and netlogon.idl

metze
(This used to be commit a8d61aa473)
This commit is contained in:
Stefan Metzmacher 2005-01-06 06:32:07 +00:00 committed by Gerald (Jerry) Carter
parent e159e42d84
commit e3fd874341
4 changed files with 857 additions and 709 deletions

View File

@ -199,6 +199,19 @@ sub HeaderType($$$)
}
}
#####################################################################
# parse a declare
sub HeaderDeclare($)
{
my($declare) = shift;
if ($declare->{DATA}->{TYPE} eq "ENUM") {
util::enum_bitmap($declare, $declare->{NAME});
} elsif ($declare->{DATA}->{TYPE} eq "BITMAP") {
util::register_bitmap($declare, $declare->{NAME});
}
}
#####################################################################
# parse a typedef
sub HeaderTypedef($)
@ -237,6 +250,23 @@ sub HeaderTypedefProto($)
$res .= "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, int level, union $d->{NAME} *r);\n";
}
}
if ($d->{DATA}{TYPE} eq "ENUM") {
$res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, enum $d->{NAME} r);\n";
$res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, enum $d->{NAME} *r);\n";
if (!util::has_property($d, "noprint")) {
$res .= "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, enum $d->{NAME} r);\n";
}
}
if ($d->{DATA}{TYPE} eq "BITMAP") {
my $type_decl = util::bitmap_type_decl($d->{DATA});
$res .= "NTSTATUS ndr_push_$d->{NAME}(struct ndr_push *ndr, $type_decl r);\n";
$res .= "NTSTATUS ndr_pull_$d->{NAME}(struct ndr_pull *ndr, $type_decl *r);\n";
if (!util::has_property($d, "noprint")) {
$res .= "void ndr_print_$d->{NAME}(struct ndr_print *ndr, const char *name, $type_decl r);\n";
}
}
}
#####################################################################
@ -431,6 +461,8 @@ sub HeaderInterface($)
foreach my $d (@{$data}) {
($d->{TYPE} eq "CONST") &&
HeaderConst($d);
($d->{TYPE} eq "DECLARE") &&
HeaderDeclare($d);
($d->{TYPE} eq "TYPEDEF") &&
HeaderTypedef($d);
($d->{TYPE} eq "TYPEDEF") &&
@ -438,7 +470,7 @@ sub HeaderInterface($)
($d->{TYPE} eq "FUNCTION") &&
HeaderFunction($d);
($d->{TYPE} eq "FUNCTION") &&
HeaderFnProto($interface, $d);
HeaderFnProto($interface, $d);
}
(util::has_property($interface, "object")) &&

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,7 @@ definitions:
;
definition: function | const | typedef
definition: function | const | typedef | declare
;
const: 'const' identifier identifier '=' anytext ';'
@ -86,6 +86,30 @@ function: property_list type identifier '(' element_list2 ')' ';'
}}
;
declare: 'declare' property_list decl_type identifier';'
{{
"TYPE" => "DECLARE",
"PROPERTIES" => $_[2],
"NAME" => $_[4],
"DATA" => $_[3],
}}
;
decl_type: decl_enum | decl_bitmap
;
decl_enum: 'enum'
{{
"TYPE" => "ENUM"
}}
;
decl_bitmap: 'bitmap'
{{
"TYPE" => "BITMAP"
}}
;
typedef: 'typedef' property_list type identifier array_len ';'
{{
"TYPE" => "TYPEDEF",
@ -327,7 +351,7 @@ again:
if (s/^([\w_]+)//) {
$parser->YYData->{LAST_TOKEN} = $1;
if ($1 =~
/^(coclass|interface|const|typedef|union
/^(coclass|interface|const|typedef|declare|union
|struct|enum|bitmap|void|case|default)$/x) {
return $1;
}

View File

@ -1716,9 +1716,12 @@ sub ParseInterface($)
my($data) = $interface->{DATA};
foreach my $d (@{$data}) {
if ($d->{TYPE} eq "DECLARE") {
$structs{$d->{NAME}} = $d;
}
if ($d->{TYPE} eq "TYPEDEF") {
$structs{$d->{NAME}} = $d;
}
}
}
foreach my $d (@{$data}) {