Updated to revision 19604.
Update from samba tree revision 19582 to 19604 ============================ Samba log start ============ ------------------------------------------------------------------------ r19585 | jelmer | 2006-11-06 22:54:19 +0100 (Mon, 06 Nov 2006) | 10 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/idl.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/NDR.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/ODL.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/EJS.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Header.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Wireshark/NDR.pm Add support for some more standard IDL instructions: - `include' (replaces helper()) - `import' (replaces depends()) Add support for parsing importlib() - importlib() is now ignored (with a warning), but no longer causes syntax errors. helper() and depends() are now marked deprecated and will cause warnings. ------------------------------------------------------------------------ r19588 | jelmer | 2006-11-06 23:54:49 +0100 (Mon, 06 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/idl.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba4/Header.pm Use include and import statements rather than depends() and helper(). ------------------------------------------------------------------------ r19599 | jelmer | 2006-11-07 02:00:27 +0100 (Tue, 07 Nov 2006) | 2 lines Changed paths: M /branches/SAMBA_4_0/source/pidl/idl.yp M /branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/IDL.pm Fix --includedir. ------------------------------------------------------------------------ ------------------------------------------------------------------------ ============================ Samba log end ============== svn path=/trunk/; revision=19846
This commit is contained in:
parent
80f82b9203
commit
bfffb8d4b8
|
@ -18,10 +18,40 @@ idl:
|
|||
#empty { {} }
|
||||
| idl interface { push(@{$_[1]}, $_[2]); $_[1] }
|
||||
| idl coclass { push(@{$_[1]}, $_[2]); $_[1] }
|
||||
| idl import { push(@{$_[1]}, $_[2]); $_[1] }
|
||||
| idl include { push(@{$_[1]}, $_[2]); $_[1] }
|
||||
| idl importlib { push(@{$_[1]}, $_[2]); $_[1] }
|
||||
;
|
||||
|
||||
import: 'import' commalist ';' {{
|
||||
"TYPE" => "IMPORT",
|
||||
"PATHS" => $_[2],
|
||||
"FILE" => $_[0]->YYData->{INPUT_FILENAME},
|
||||
"LINE" => $_[0]->YYData->{LINE}
|
||||
}}
|
||||
;
|
||||
include: 'include' commalist ';' {{
|
||||
"TYPE" => "INCLUDE",
|
||||
"PATHS" => $_[2],
|
||||
"FILE" => $_[0]->YYData->{INPUT_FILENAME},
|
||||
"LINE" => $_[0]->YYData->{LINE}
|
||||
}}
|
||||
;
|
||||
importlib: 'importlib' commalist ';' {{
|
||||
"TYPE" => "IMPORTLIB",
|
||||
"PATHS" => $_[2],
|
||||
"FILE" => $_[0]->YYData->{INPUT_FILENAME},
|
||||
"LINE" => $_[0]->YYData->{LINE}
|
||||
}}
|
||||
;
|
||||
|
||||
commalist:
|
||||
text { [ $_[1] ] }
|
||||
| commalist ',' text { push(@{$_[1]}, $_[3]); $_[1] }
|
||||
;
|
||||
|
||||
coclass: property_list 'coclass' identifier '{' interface_names '}' optional_semicolon
|
||||
{$_[3] => {
|
||||
{{
|
||||
"TYPE" => "COCLASS",
|
||||
"PROPERTIES" => $_[1],
|
||||
"NAME" => $_[3],
|
||||
|
@ -37,7 +67,7 @@ interface_names:
|
|||
;
|
||||
|
||||
interface: property_list 'interface' identifier base_interface '{' definitions '}' optional_semicolon
|
||||
{$_[3] => {
|
||||
{{
|
||||
"TYPE" => "INTERFACE",
|
||||
"PROPERTIES" => $_[1],
|
||||
"NAME" => $_[3],
|
||||
|
@ -442,7 +472,8 @@ again:
|
|||
$parser->YYData->{LAST_TOKEN} = $1;
|
||||
if ($1 =~
|
||||
/^(coclass|interface|const|typedef|declare|union
|
||||
|struct|enum|bitmap|void|unsigned|signed)$/x) {
|
||||
|struct|enum|bitmap|void|unsigned|signed|import|include
|
||||
|importlib)$/x) {
|
||||
return $1;
|
||||
}
|
||||
return('IDENTIFIER',$1);
|
||||
|
@ -480,7 +511,7 @@ sub parse_file($$)
|
|||
if (! defined $cpp) {
|
||||
$cpp = "cpp";
|
||||
}
|
||||
my $includes = map { " -I$_" } @$incdirs;
|
||||
my $includes = join('',map { " -I$_" } @$incdirs);
|
||||
my $data = `$cpp -D__PIDL__$includes -xc $filename`;
|
||||
$/ = $saved_delim;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -661,6 +661,7 @@ sub Parse($)
|
|||
|
||||
foreach (@{$idl}) {
|
||||
($_->{TYPE} eq "INTERFACE") && push(@ndr, ParseInterface($_));
|
||||
($_->{TYPE} eq "IMPORT") && push(@ndr, $_);
|
||||
}
|
||||
|
||||
return \@ndr;
|
||||
|
@ -1044,6 +1045,14 @@ sub ValidInterface($)
|
|||
my($interface) = shift;
|
||||
my($data) = $interface->{DATA};
|
||||
|
||||
if (has_property($interface, "depends")) {
|
||||
nonfatal $interface, "depends() is pidl-specific and deprecated. Use `import' instead";
|
||||
}
|
||||
|
||||
if (has_property($interface, "helper")) {
|
||||
nonfatal $interface, "helper() is pidl-specific and deprecated. Use `include' instead";
|
||||
}
|
||||
|
||||
ValidProperties($interface,"INTERFACE");
|
||||
|
||||
if (has_property($interface, "pointer_default") &&
|
||||
|
@ -1081,6 +1090,8 @@ sub Validate($)
|
|||
foreach my $x (@{$idl}) {
|
||||
($x->{TYPE} eq "INTERFACE") &&
|
||||
ValidInterface($x);
|
||||
($x->{TYPE} eq "IMPORTLIB") &&
|
||||
nonfatal($x, "importlib() not supported");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ sub get_interface($$)
|
|||
my($if,$n) = @_;
|
||||
|
||||
foreach(@$if) {
|
||||
next if ($_->{TYPE} ne "INTERFACE");
|
||||
return $_ if($_->{NAME} eq $n);
|
||||
}
|
||||
|
||||
|
@ -62,8 +63,10 @@ sub ReplaceInterfacePointers($)
|
|||
sub ODL2IDL($)
|
||||
{
|
||||
my $odl = shift;
|
||||
|
||||
foreach my $x (@{$odl}) {
|
||||
my $addedorpc = 0;
|
||||
|
||||
foreach my $x (@$odl) {
|
||||
next if ($x->{TYPE} ne "INTERFACE");
|
||||
# Add [in] ORPCTHIS *this, [out] ORPCTHAT *that
|
||||
# and replace interfacepointers with MInterfacePointer
|
||||
# for 'object' interfaces
|
||||
|
@ -72,13 +75,7 @@ sub ODL2IDL($)
|
|||
($e->{TYPE} eq "FUNCTION") && FunctionAddObjArgs($e);
|
||||
ReplaceInterfacePointers($e);
|
||||
}
|
||||
# Object interfaces use ORPC
|
||||
my @depends = ();
|
||||
if(has_property($x, "depends")) {
|
||||
@depends = split /,/, $x->{PROPERTIES}->{depends};
|
||||
}
|
||||
push @depends, "orpc";
|
||||
$x->{PROPERTIES}->{depends} = join(',',@depends);
|
||||
$addedorpc = 1;
|
||||
}
|
||||
|
||||
if ($x->{BASE}) {
|
||||
|
@ -92,6 +89,13 @@ sub ODL2IDL($)
|
|||
}
|
||||
}
|
||||
|
||||
unshift (@$odl, {
|
||||
TYPE => "IMPORT",
|
||||
PATHS => [ "\"orpc.idl\"" ],
|
||||
FILE => undef,
|
||||
LINE => undef
|
||||
}) if ($addedorpc);
|
||||
|
||||
return $odl;
|
||||
}
|
||||
|
||||
|
|
|
@ -730,6 +730,16 @@ sub EjsConst($)
|
|||
$constants{$const->{NAME}} = $const->{VALUE};
|
||||
}
|
||||
|
||||
sub EjsImport
|
||||
{
|
||||
my @imports = @_;
|
||||
foreach (@imports) {
|
||||
s/\.idl\"$//;
|
||||
s/^\"//;
|
||||
pidl_hdr "#include \"librpc/gen_ndr/ndr_$_\_ejs\.h\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# parse the interface definitions
|
||||
sub EjsInterface($$)
|
||||
|
@ -744,9 +754,7 @@ sub EjsInterface($$)
|
|||
pidl_hdr "#define _HEADER_EJS_$interface->{NAME}\n\n";
|
||||
|
||||
if (has_property($interface, "depends")) {
|
||||
foreach (split / /, $interface->{PROPERTIES}->{depends}) {
|
||||
pidl_hdr "#include \"librpc/gen_ndr/ndr_$_\_ejs\.h\"\n";
|
||||
}
|
||||
EjsImport(split / /, $interface->{PROPERTIES}->{depends});
|
||||
}
|
||||
|
||||
pidl_hdr "\n";
|
||||
|
@ -834,8 +842,9 @@ sub Parse($$)
|
|||
($x->{TYPE} eq "INTERFACE") && NeededInterface($x, \%needed);
|
||||
}
|
||||
|
||||
foreach my $x (@{$ndr}) {
|
||||
foreach my $x (@$ndr) {
|
||||
($x->{TYPE} eq "INTERFACE") && EjsInterface($x, \%needed);
|
||||
($x->{TYPE} eq "IMPORT") && EjsImport(@{$x->{PATHS}});
|
||||
}
|
||||
|
||||
return ($res_hdr, $res);
|
||||
|
|
|
@ -307,6 +307,24 @@ sub HeaderFunction($)
|
|||
pidl "};\n\n";
|
||||
}
|
||||
|
||||
sub HeaderImport
|
||||
{
|
||||
my @imports = @_;
|
||||
foreach (@imports) {
|
||||
s/\.idl\"$//;
|
||||
s/^\"//;
|
||||
pidl "#include \"librpc/gen_ndr/$_\.h\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub HeaderInclude
|
||||
{
|
||||
my @includes = @_;
|
||||
foreach (@includes) {
|
||||
pidl "#include $_\n";
|
||||
}
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# parse the interface definitions
|
||||
sub HeaderInterface($)
|
||||
|
@ -317,10 +335,7 @@ sub HeaderInterface($)
|
|||
pidl "#define _HEADER_$interface->{NAME}\n\n";
|
||||
|
||||
if (defined $interface->{PROPERTIES}->{depends}) {
|
||||
my @d = split / /, $interface->{PROPERTIES}->{depends};
|
||||
foreach my $i (@d) {
|
||||
pidl "#include \"librpc/gen_ndr/$i\.h\"\n";
|
||||
}
|
||||
HeaderImport(split / /, $interface->{PROPERTIES}->{depends});
|
||||
}
|
||||
|
||||
foreach my $d (@{$interface->{DATA}}) {
|
||||
|
@ -358,6 +373,8 @@ sub Parse($)
|
|||
|
||||
foreach (@{$idl}) {
|
||||
($_->{TYPE} eq "INTERFACE") && HeaderInterface($_);
|
||||
($_->{TYPE} eq "IMPORT") && HeaderImport(@{$_->{PATHS}});
|
||||
($_->{TYPE} eq "INCLUDE") && HeaderInclude(@{$_->{PATHS}});
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
|
|
@ -2220,6 +2220,28 @@ sub FunctionTable($)
|
|||
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# generate include statements for imported idl files
|
||||
sub HeaderImport
|
||||
{
|
||||
my @imports = @_;
|
||||
foreach (@imports) {
|
||||
s/\.idl\"$//;
|
||||
s/^\"//;
|
||||
pidl choose_header("librpc/gen_ndr/ndr_$_\.h", "gen_ndr/ndr_$_.h");
|
||||
}
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# generate include statements for included header files
|
||||
sub HeaderInclude
|
||||
{
|
||||
my @includes = @_;
|
||||
foreach (@includes) {
|
||||
pidl_hdr "#include $_";
|
||||
}
|
||||
}
|
||||
|
||||
#####################################################################
|
||||
# generate prototypes and defines for the interface definitions
|
||||
# FIXME: these prototypes are for the DCE/RPC client functions, not the
|
||||
|
@ -2237,16 +2259,11 @@ sub HeaderInterface($)
|
|||
}
|
||||
|
||||
if (defined $interface->{PROPERTIES}->{depends}) {
|
||||
my @d = split / /, $interface->{PROPERTIES}->{depends};
|
||||
foreach my $i (@d) {
|
||||
pidl choose_header("librpc/gen_ndr/ndr_$i\.h", "gen_ndr/ndr_$i.h");
|
||||
}
|
||||
HeaderImport(split / /, $interface->{PROPERTIES}->{depends});
|
||||
}
|
||||
|
||||
if (defined $interface->{PROPERTIES}->{helper}) {
|
||||
foreach (split / /, $interface->{PROPERTIES}->{helper}) {
|
||||
pidl_hdr "#include $_";
|
||||
}
|
||||
HeaderInclude(split / /, $interface->{PROPERTIES}->{helper});
|
||||
}
|
||||
|
||||
if (defined $interface->{PROPERTIES}->{uuid}) {
|
||||
|
@ -2390,6 +2407,8 @@ sub Parse($$$)
|
|||
|
||||
foreach (@{$ndr}) {
|
||||
($_->{TYPE} eq "INTERFACE") && ParseInterface($_, \%needed);
|
||||
($_->{TYPE} eq "IMPORT") && HeaderImport(@{$_->{PATHS}});
|
||||
($_->{TYPE} eq "INCLUDE") && HeaderInclude(@{$_->{PATHS}});
|
||||
}
|
||||
|
||||
return ($res_hdr, $res);
|
||||
|
|
|
@ -717,6 +717,25 @@ sub RegisterInterfaceHandoff($)
|
|||
}
|
||||
}
|
||||
|
||||
sub ProcessInclude
|
||||
{
|
||||
my @includes = @_;
|
||||
foreach (@includes) {
|
||||
pidl_hdr "#include \"$_\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub ProcessImport
|
||||
{
|
||||
my @imports = @_;
|
||||
foreach (@imports) {
|
||||
next if($_ eq "security");
|
||||
s/\.idl\"$//;
|
||||
s/^\"//;
|
||||
pidl_hdr "#include \"packet-dcerpc-$_\.h\"\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub ProcessInterface($)
|
||||
{
|
||||
my ($x) = @_;
|
||||
|
@ -728,12 +747,8 @@ sub ProcessInterface($)
|
|||
pidl_hdr "#define $define";
|
||||
pidl_hdr "";
|
||||
|
||||
if (defined $x->{PROPERTIES}->{depends}) {
|
||||
foreach (split / /, $x->{PROPERTIES}->{depends}) {
|
||||
next if($_ eq "security");
|
||||
pidl_hdr "#include \"packet-dcerpc-$_\.h\"\n";
|
||||
}
|
||||
}
|
||||
ProcessImport(split / /, $x->{PROPERTIES}->{depends}) if
|
||||
(defined $x->{PROPERTIES}->{depends});
|
||||
|
||||
pidl_def "static gint proto_dcerpc_$x->{NAME} = -1;";
|
||||
register_ett("ett_dcerpc_$x->{NAME}");
|
||||
|
@ -897,7 +912,11 @@ sub Parse($$$$)
|
|||
|
||||
# Wireshark protocol registration
|
||||
|
||||
ProcessInterface($_) foreach (@$ndr);
|
||||
foreach (@$ndr) {
|
||||
ProcessInterface($_) if ($_->{TYPE} eq "INTERFACE");
|
||||
ProcessImport(@{$_->{PATHS}}) if ($_->{TYPE} eq "IMPORT");
|
||||
ProcessInclude(@{$_->{PATHS}}) if ($_->{TYPE} eq "INCLUDE");
|
||||
}
|
||||
|
||||
$res{ett} = DumpEttDeclaration();
|
||||
$res{hf} = DumpHfDeclaration();
|
||||
|
|
Loading…
Reference in New Issue