summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2006-11-06 21:54:19 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:24:57 -0500
commitd8ecabe452f36302105c6412ae5ab93cabfe5cf2 (patch)
treed5f8e1c8d246e6a95a5aa91e1776047104f046f0 /source4/pidl/lib/Parse/Pidl/Samba4
parent6317ba1cf71faa7b77072649d92205a38f800fd1 (diff)
downloadsamba-d8ecabe452f36302105c6412ae5ab93cabfe5cf2.tar.gz
samba-d8ecabe452f36302105c6412ae5ab93cabfe5cf2.tar.bz2
samba-d8ecabe452f36302105c6412ae5ab93cabfe5cf2.zip
r19585: 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. (This used to be commit 1ccab71cb8a9e3db9448b6679d01ad00e1c1e9a3)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba4')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm17
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/Header.pm25
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm33
3 files changed, 60 insertions, 15 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index 218b882323..bb3b36dca4 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -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);
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
index 6fb3ee2eec..94346efe4b 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/Header.pm
@@ -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;
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index 1bb277fd0e..80d02cb533 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -2221,6 +2221,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
# NDR parser and so do not belong here, technically speaking
@@ -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);