summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/Parse/Pidl/NDR.pm59
-rw-r--r--source4/build/pidl/Parse/Pidl/ODL.pm5
-rw-r--r--source4/build/pidl/Parse/Pidl/Samba/COM/Header.pm5
-rw-r--r--source4/build/pidl/Parse/Pidl/Samba/COM/Proxy.pm11
-rw-r--r--source4/build/pidl/Parse/Pidl/Samba/COM/Stub.pm3
-rw-r--r--source4/build/pidl/Parse/Pidl/Samba/EJS.pm13
-rw-r--r--source4/build/pidl/Parse/Pidl/Samba/EJSHeader.pm3
-rw-r--r--source4/build/pidl/Parse/Pidl/Samba/NDR/Header.pm19
-rw-r--r--source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm47
-rw-r--r--source4/build/pidl/Parse/Pidl/Typelist.pm14
-rw-r--r--source4/build/pidl/Parse/Pidl/Util.pm3
-rw-r--r--source4/build/pidl/Parse/Pidl/Validator.pm38
12 files changed, 117 insertions, 103 deletions
diff --git a/source4/build/pidl/Parse/Pidl/NDR.pm b/source4/build/pidl/Parse/Pidl/NDR.pm
index f07b5e60ea..e330bcec3b 100644
--- a/source4/build/pidl/Parse/Pidl/NDR.pm
+++ b/source4/build/pidl/Parse/Pidl/NDR.pm
@@ -9,6 +9,7 @@ package Parse::Pidl::NDR;
use strict;
use Parse::Pidl::Typelist;
+use Parse::Pidl::Util qw(has_property property_matches);
sub nonfatal($$)
{
@@ -35,12 +36,12 @@ sub GetElementLevelTable($)
my @length_is = ();
my @size_is = ();
- if (Parse::Pidl::Util::has_property($e, "size_is")) {
- @size_is = split /,/, Parse::Pidl::Util::has_property($e, "size_is");
+ if (has_property($e, "size_is")) {
+ @size_is = split /,/, has_property($e, "size_is");
}
- if (Parse::Pidl::Util::has_property($e, "length_is")) {
- @length_is = split /,/, Parse::Pidl::Util::has_property($e, "length_is");
+ if (has_property($e, "length_is")) {
+ @length_is = split /,/, has_property($e, "length_is");
}
if (defined($e->{ARRAY_LEN})) {
@@ -59,7 +60,7 @@ sub GetElementLevelTable($)
if ($d eq "*") {
$is_conformant = 1;
if ($size = shift @size_is) {
- } elsif ((scalar(@size_is) == 0) and Parse::Pidl::Util::has_property($e, "string")) {
+ } elsif ((scalar(@size_is) == 0) and has_property($e, "string")) {
$is_string = 1;
delete($e->{PROPERTIES}->{string});
} else {
@@ -129,9 +130,9 @@ sub GetElementLevelTable($)
}
}
- if (scalar(@size_is) == 0 and Parse::Pidl::Util::has_property($e, "string")) {
+ if (scalar(@size_is) == 0 and has_property($e, "string")) {
$is_string = 1;
- $is_varying = $is_conformant = Parse::Pidl::Util::has_property($e, "noheader")?0:1;
+ $is_varying = $is_conformant = has_property($e, "noheader")?0:1;
delete($e->{PROPERTIES}->{string});
}
@@ -153,9 +154,9 @@ sub GetElementLevelTable($)
}
}
- if (defined(Parse::Pidl::Util::has_property($e, "subcontext"))) {
- my $hdr_size = Parse::Pidl::Util::has_property($e, "subcontext");
- my $subsize = Parse::Pidl::Util::has_property($e, "subcontext_size");
+ if (defined(has_property($e, "subcontext"))) {
+ my $hdr_size = has_property($e, "subcontext");
+ my $subsize = has_property($e, "subcontext_size");
if (not defined($subsize)) {
$subsize = -1;
}
@@ -165,12 +166,12 @@ sub GetElementLevelTable($)
HEADER_SIZE => $hdr_size,
SUBCONTEXT_SIZE => $subsize,
IS_DEFERRED => $is_deferred,
- COMPRESSION => Parse::Pidl::Util::has_property($e, "compression"),
- OBFUSCATION => Parse::Pidl::Util::has_property($e, "obfuscation")
+ COMPRESSION => has_property($e, "compression"),
+ OBFUSCATION => has_property($e, "obfuscation")
});
}
- if (my $switch = Parse::Pidl::Util::has_property($e, "switch_is")) {
+ if (my $switch = has_property($e, "switch_is")) {
push (@$order, {
TYPE => "SWITCH",
SWITCH_IS => $switch,
@@ -186,7 +187,7 @@ sub GetElementLevelTable($)
nonfatal($e, "length_is() on non-array element");
}
- if (Parse::Pidl::Util::has_property($e, "string")) {
+ if (has_property($e, "string")) {
nonfatal($e, "string() attribute on non-array element");
}
@@ -230,12 +231,12 @@ sub pointer_type($)
return undef unless $e->{POINTERS};
- return "ref" if (Parse::Pidl::Util::has_property($e, "ref"));
- return "ptr" if (Parse::Pidl::Util::has_property($e, "ptr"));
- return "sptr" if (Parse::Pidl::Util::has_property($e, "sptr"));
- return "unique" if (Parse::Pidl::Util::has_property($e, "unique"));
- return "relative" if (Parse::Pidl::Util::has_property($e, "relative"));
- return "ignore" if (Parse::Pidl::Util::has_property($e, "ignore"));
+ return "ref" if (has_property($e, "ref"));
+ return "ptr" if (has_property($e, "ptr"));
+ return "sptr" if (has_property($e, "sptr"));
+ return "unique" if (has_property($e, "unique"));
+ return "relative" if (has_property($e, "relative"));
+ return "ignore" if (has_property($e, "ignore"));
return undef;
}
@@ -320,7 +321,7 @@ sub ParseStruct($)
}
if (defined $e->{TYPE} && $e->{TYPE} eq "string"
- && Parse::Pidl::Util::property_matches($e, "flag", ".*LIBNDR_FLAG_STR_CONFORMANT.*")) {
+ && property_matches($e, "flag", ".*LIBNDR_FLAG_STR_CONFORMANT.*")) {
$surrounding = $struct->{ELEMENTS}[-1];
}
@@ -336,10 +337,10 @@ sub ParseUnion($)
{
my $e = shift;
my @elements = ();
- my $switch_type = Parse::Pidl::Util::has_property($e, "switch_type");
+ my $switch_type = has_property($e, "switch_type");
unless (defined($switch_type)) { $switch_type = "uint32"; }
- if (Parse::Pidl::Util::has_property($e, "nodiscriminant")) { $switch_type = undef; }
+ if (has_property($e, "nodiscriminant")) { $switch_type = undef; }
foreach my $x (@{$e->{ELEMENTS}})
{
@@ -349,7 +350,7 @@ sub ParseUnion($)
} else {
$t = ParseElement($x);
}
- if (Parse::Pidl::Util::has_property($x, "default")) {
+ if (has_property($x, "default")) {
$t->{CASE} = "default";
} elsif (defined($x->{PROPERTIES}->{case})) {
$t->{CASE} = "case $x->{PROPERTIES}->{case}";
@@ -444,8 +445,8 @@ sub ParseFunction($$$)
foreach my $x (@{$d->{ELEMENTS}}) {
my $e = ParseElement($x);
- push (@{$e->{DIRECTION}}, "in") if (Parse::Pidl::Util::has_property($x, "in"));
- push (@{$e->{DIRECTION}}, "out") if (Parse::Pidl::Util::has_property($x, "out"));
+ push (@{$e->{DIRECTION}}, "in") if (has_property($x, "in"));
+ push (@{$e->{DIRECTION}}, "out") if (has_property($x, "out"));
push (@elements, $e);
}
@@ -486,13 +487,13 @@ sub ParseInterface($)
my $opnum = 0;
my $version;
- if (not Parse::Pidl::Util::has_property($idl, "pointer_default")) {
+ if (not has_property($idl, "pointer_default")) {
# MIDL defaults to "ptr" in DCE compatible mode (/osf)
# and "unique" in Microsoft Extensions mode (default)
$idl->{PROPERTIES}->{pointer_default} = "unique";
}
- if (not Parse::Pidl::Util::has_property($idl, "pointer_default_top")) {
+ if (not has_property($idl, "pointer_default_top")) {
$idl->{PROPERTIES}->{pointer_default_top} = "ref";
}
@@ -529,7 +530,7 @@ sub ParseInterface($)
return {
NAME => $idl->{NAME},
- UUID => Parse::Pidl::Util::has_property($idl, "uuid"),
+ UUID => has_property($idl, "uuid"),
VERSION => $version,
TYPE => "INTERFACE",
PROPERTIES => $idl->{PROPERTIES},
diff --git a/source4/build/pidl/Parse/Pidl/ODL.pm b/source4/build/pidl/Parse/Pidl/ODL.pm
index eddf7e417c..fadb77f15d 100644
--- a/source4/build/pidl/Parse/Pidl/ODL.pm
+++ b/source4/build/pidl/Parse/Pidl/ODL.pm
@@ -4,6 +4,7 @@
package Parse::Pidl::ODL;
+use Parse::Pidl::Util qw(has_property);
use strict;
#####################################################################
@@ -59,14 +60,14 @@ sub ODL2IDL($)
# Add [in] ORPCTHIS *this, [out] ORPCTHAT *that
# and replace interfacepointers with MInterfacePointer
# for 'object' interfaces
- if (Parse::Pidl::Util::has_property($x, "object")) {
+ if (has_property($x, "object")) {
foreach my $e (@{$x->{DATA}}) {
($e->{TYPE} eq "FUNCTION") && FunctionAddObjArgs($e);
ReplaceInterfacePointers($e);
}
# Object interfaces use ORPC
my @depends = ();
- if(Parse::Pidl::Util::has_property($x, "depends")) {
+ if(has_property($x, "depends")) {
@depends = split /,/, $x->{PROPERTIES}->{depends};
}
push @depends, "orpc";
diff --git a/source4/build/pidl/Parse/Pidl/Samba/COM/Header.pm b/source4/build/pidl/Parse/Pidl/Samba/COM/Header.pm
index 4f5e0d68ad..7b6c4db212 100644
--- a/source4/build/pidl/Parse/Pidl/Samba/COM/Header.pm
+++ b/source4/build/pidl/Parse/Pidl/Samba/COM/Header.pm
@@ -4,6 +4,7 @@
package Parse::Pidl::Samba::COM::Header;
use Parse::Pidl::Typelist;
+use Parse::Pidl::Util qw(has_property);
use strict;
@@ -109,7 +110,7 @@ sub ParseCoClass($)
my $c = shift;
my $res = "";
$res .= "#define CLSID_" . uc($c->{NAME}) . " $c->{PROPERTIES}->{uuid}\n";
- if (Parse::Pidl::Util::has_property($c, "progid")) {
+ if (has_property($c, "progid")) {
$res .= "#define PROGID_" . uc($c->{NAME}) . " $c->{PROPERTIES}->{progid}\n";
}
$res .= "\n";
@@ -123,7 +124,7 @@ sub Parse($)
foreach my $x (@{$idl})
{
- if ($x->{TYPE} eq "INTERFACE" && Parse::Pidl::Util::has_property($x, "object")) {
+ if ($x->{TYPE} eq "INTERFACE" && has_property($x, "object")) {
$res.=ParseInterface($x);
}
diff --git a/source4/build/pidl/Parse/Pidl/Samba/COM/Proxy.pm b/source4/build/pidl/Parse/Pidl/Samba/COM/Proxy.pm
index f4c23e1d9b..c94ef59ae9 100644
--- a/source4/build/pidl/Parse/Pidl/Samba/COM/Proxy.pm
+++ b/source4/build/pidl/Parse/Pidl/Samba/COM/Proxy.pm
@@ -7,6 +7,7 @@
package Parse::Pidl::Samba::COM::Proxy;
use Parse::Pidl::Samba::COM::Header;
+use Parse::Pidl::Util qw(has_property);
use strict;
@@ -103,7 +104,7 @@ static $fn->{RETURN_TYPE} dcom_proxy_$interface->{NAME}_$name(struct $interface-
# Put arguments into r
foreach my $a (@{$fn->{ELEMENTS}}) {
- next unless (Parse::Pidl::Util::has_property($a, "in"));
+ 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 {
@@ -126,7 +127,7 @@ static $fn->{RETURN_TYPE} dcom_proxy_$interface->{NAME}_$name(struct $interface-
# Put r info back into arguments
foreach my $a (@{$fn->{ELEMENTS}}) {
- next unless (Parse::Pidl::Util::has_property($a, "out"));
+ 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";
@@ -171,7 +172,7 @@ sub RegistrationFunction($$)
$res .="\tNTSTATUS status = NT_STATUS_OK;\n";
foreach my $interface (@{$idl}) {
next if $interface->{TYPE} ne "INTERFACE";
- next if not Parse::Pidl::Util::has_property($interface, "object");
+ next if not has_property($interface, "object");
my $data = $interface->{DATA};
my $count = 0;
@@ -199,8 +200,8 @@ sub Parse($)
foreach my $x (@{$pidl}) {
next if ($x->{TYPE} ne "INTERFACE");
- next if Parse::Pidl::Util::has_property($x, "local");
- next unless Parse::Pidl::Util::has_property($x, "object");
+ next if has_property($x, "local");
+ next unless has_property($x, "object");
$res .= ParseInterface($x);
}
diff --git a/source4/build/pidl/Parse/Pidl/Samba/COM/Stub.pm b/source4/build/pidl/Parse/Pidl/Samba/COM/Stub.pm
index a06671e76d..785c34fc77 100644
--- a/source4/build/pidl/Parse/Pidl/Samba/COM/Stub.pm
+++ b/source4/build/pidl/Parse/Pidl/Samba/COM/Stub.pm
@@ -7,6 +7,7 @@
package Parse::Pidl::Samba::COM::Stub;
+use Parse::Pidl::Util qw(has_property);
use strict;
my($res);
@@ -290,7 +291,7 @@ sub ParseInterface($)
{
my($interface) = shift;
- return "" if Parse::Pidl::Util::has_property($interface, "local");
+ return "" if has_property($interface, "local");
my($data) = $interface->{DATA};
my $count = 0;
diff --git a/source4/build/pidl/Parse/Pidl/Samba/EJS.pm b/source4/build/pidl/Parse/Pidl/Samba/EJS.pm
index ed35d2d237..26556b2820 100644
--- a/source4/build/pidl/Parse/Pidl/Samba/EJS.pm
+++ b/source4/build/pidl/Parse/Pidl/Samba/EJS.pm
@@ -8,6 +8,7 @@ package Parse::Pidl::Samba::EJS;
use strict;
use Parse::Pidl::Typelist;
+use Parse::Pidl::Util qw(has_property);
my($res);
my %constants;
@@ -110,7 +111,7 @@ sub fn_prefix($)
{
my $fn = shift;
- return "" if (Parse::Pidl::Util::has_property($fn, "public"));
+ return "" if (has_property($fn, "public"));
return "static ";
}
@@ -120,7 +121,7 @@ sub EjsPullScalar($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
- return if (Parse::Pidl::Util::has_property($e, "value"));
+ return if (has_property($e, "value"));
my $pl = Parse::Pidl::NDR::GetPrevLevel($e, $l);
$var = get_pointer_to($var);
@@ -203,7 +204,7 @@ sub EjsPullSwitch($$$$$)
sub EjsPullElement($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
- if (Parse::Pidl::Util::has_property($e, "charset")) {
+ if (has_property($e, "charset")) {
EjsPullString($e, $l, $var, $name, $env);
} elsif ($l->{TYPE} eq "ARRAY") {
EjsPullArray($e, $l, $var, $name, $env);
@@ -327,7 +328,7 @@ sub EjsBitmapPull($$)
sub EjsTypedefPull($)
{
my $d = shift;
- return if (Parse::Pidl::Util::has_property($d, "noejs"));
+ return if (has_property($d, "noejs"));
if ($d->{DATA}->{TYPE} eq 'STRUCT') {
EjsStructPull($d->{NAME}, $d->{DATA});
} elsif ($d->{DATA}->{TYPE} eq 'UNION') {
@@ -444,7 +445,7 @@ sub EjsPushArray($$$$$)
sub EjsPushElement($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
- if (Parse::Pidl::Util::has_property($e, "charset")) {
+ if (has_property($e, "charset")) {
EjsPushString($e, $l, $var, $name, $env);
} elsif ($l->{TYPE} eq "ARRAY") {
EjsPushArray($e, $l, $var, $name, $env);
@@ -587,7 +588,7 @@ sub EjsBitmapPush($$)
sub EjsTypedefPush($)
{
my $d = shift;
- return if (Parse::Pidl::Util::has_property($d, "noejs"));
+ return if (has_property($d, "noejs"));
if ($d->{DATA}->{TYPE} eq 'STRUCT') {
EjsStructPush($d->{NAME}, $d->{DATA});
} elsif ($d->{DATA}->{TYPE} eq 'UNION') {
diff --git a/source4/build/pidl/Parse/Pidl/Samba/EJSHeader.pm b/source4/build/pidl/Parse/Pidl/Samba/EJSHeader.pm
index e2472545ef..81c75705de 100644
--- a/source4/build/pidl/Parse/Pidl/Samba/EJSHeader.pm
+++ b/source4/build/pidl/Parse/Pidl/Samba/EJSHeader.pm
@@ -7,6 +7,7 @@ package Parse::Pidl::Samba::EJSHeader;
use strict;
use Parse::Pidl::Typelist;
+use Parse::Pidl::Util qw(has_property);
my($res);
@@ -22,7 +23,7 @@ sub HeaderTypedefProto($)
my $d = shift;
my $name = $d->{NAME};
- return unless Parse::Pidl::Util::has_property($d, "public");
+ return unless has_property($d, "public");
my $type_decl = Parse::Pidl::Typelist::mapType($name);
diff --git a/source4/build/pidl/Parse/Pidl/Samba/NDR/Header.pm b/source4/build/pidl/Parse/Pidl/Samba/NDR/Header.pm
index d15e9bfbcb..09e4bb5050 100644
--- a/source4/build/pidl/Parse/Pidl/Samba/NDR/Header.pm
+++ b/source4/build/pidl/Parse/Pidl/Samba/NDR/Header.pm
@@ -8,6 +8,7 @@ package Parse::Pidl::Samba::NDR::Header;
use strict;
use Parse::Pidl::Typelist;
+use Parse::Pidl::Util qw(has_property);
use Parse::Pidl::Samba::NDR::Parser;
my($res);
@@ -214,7 +215,7 @@ sub HeaderType($$$)
return;
}
- if (Parse::Pidl::Util::has_property($e, "charset")) {
+ if (has_property($e, "charset")) {
pidl "const char";
} else {
pidl Parse::Pidl::Typelist::mapType($e->{TYPE});
@@ -238,23 +239,23 @@ sub HeaderTypedefProto($)
my $tf = Parse::Pidl::Samba::NDR::Parser::get_typefamily($d->{DATA}{TYPE});
- if (Parse::Pidl::Util::has_property($d, "gensize")) {
+ if (has_property($d, "gensize")) {
my $size_args = $tf->{SIZE_FN_ARGS}->($d);
pidl "size_t ndr_size_$d->{NAME}($size_args);\n";
}
- return unless Parse::Pidl::Util::has_property($d, "public");
+ return unless has_property($d, "public");
my $pull_args = $tf->{PULL_FN_ARGS}->($d);
my $push_args = $tf->{PUSH_FN_ARGS}->($d);
my $print_args = $tf->{PRINT_FN_ARGS}->($d);
- unless (Parse::Pidl::Util::has_property($d, "nopush")) {
+ unless (has_property($d, "nopush")) {
pidl "NTSTATUS ndr_push_$d->{NAME}($push_args);\n";
}
- unless (Parse::Pidl::Util::has_property($d, "nopull")) {
+ unless (has_property($d, "nopull")) {
pidl "NTSTATUS ndr_pull_$d->{NAME}($pull_args);\n";
}
- unless (Parse::Pidl::Util::has_property($d, "noprint")) {
+ unless (has_property($d, "noprint")) {
pidl "void ndr_print_$d->{NAME}($print_args);\n";
}
}
@@ -278,7 +279,7 @@ sub HeaderFunctionInOut($$)
my($fn,$prop) = @_;
foreach my $e (@{$fn->{ELEMENTS}}) {
- if (Parse::Pidl::Util::has_property($e, $prop)) {
+ if (has_property($e, $prop)) {
HeaderElement($e);
}
}
@@ -295,7 +296,7 @@ sub HeaderFunctionInOut_needed($$)
}
foreach my $e (@{$fn->{ELEMENTS}}) {
- if (Parse::Pidl::Util::has_property($e, $prop)) {
+ if (has_property($e, $prop)) {
return 1;
}
}
@@ -369,7 +370,7 @@ sub HeaderFnProto($$)
pidl "struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r);\n";
}
- return unless Parse::Pidl::Util::has_property($fn, "public");
+ return unless has_property($fn, "public");
pidl "NTSTATUS ndr_push_$name(struct ndr_push *ndr, int flags, const struct $name *r);\n";
pidl "NTSTATUS ndr_pull_$name(struct ndr_pull *ndr, int flags, struct $name *r);\n";
diff --git a/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm b/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm
index 21e1449067..421f854e3e 100644
--- a/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm
+++ b/source4/build/pidl/Parse/Pidl/Samba/NDR/Parser.pm
@@ -9,6 +9,7 @@ package Parse::Pidl::Samba::NDR::Parser;
use strict;
use Parse::Pidl::Typelist;
+use Parse::Pidl::Util qw(has_property);
use Parse::Pidl::NDR;
# list of known types
@@ -130,7 +131,7 @@ sub fn_prefix($)
{
my $fn = shift;
- return "" if (Parse::Pidl::Util::has_property($fn, "public"));
+ return "" if (has_property($fn, "public"));
return "static ";
}
@@ -139,7 +140,7 @@ sub fn_prefix($)
sub start_flags($)
{
my $e = shift;
- my $flags = Parse::Pidl::Util::has_property($e, "flag");
+ my $flags = has_property($e, "flag");
if (defined $flags) {
pidl "{";
indent;
@@ -153,7 +154,7 @@ sub start_flags($)
sub end_flags($)
{
my $e = shift;
- my $flags = Parse::Pidl::Util::has_property($e, "flag");
+ my $flags = has_property($e, "flag");
if (defined $flags) {
pidl "ndr->flags = _flags_save_$e->{TYPE};";
deindent;
@@ -389,7 +390,7 @@ sub ParseObfuscationPushStart($$)
sub ParseObfuscationPushEnd($$)
{
my ($e,$ndr) = @_;
- my $obfuscation = Parse::Pidl::Util::has_property($e, "obfuscation");
+ my $obfuscation = has_property($e, "obfuscation");
pidl "NDR_CHECK(ndr_push_obfuscation($ndr, $obfuscation));";
}
@@ -397,7 +398,7 @@ sub ParseObfuscationPushEnd($$)
sub ParseObfuscationPullStart($$)
{
my ($e,$ndr) = @_;
- my $obfuscation = Parse::Pidl::Util::has_property($e, "obfuscation");
+ my $obfuscation = has_property($e, "obfuscation");
pidl "NDR_CHECK(ndr_pull_obfuscation($ndr, $obfuscation));";
@@ -528,7 +529,7 @@ sub ParseElementPushLevel
my $nl = Parse::Pidl::NDR::GetNextLevel($e, $l);
- if (Parse::Pidl::Util::has_property($e, "charset")) {
+ if (has_property($e, "charset")) {
pidl "NDR_CHECK(ndr_push_charset($ndr, $ndr_flags, $var_name, $length, sizeof(" . Parse::Pidl::Typelist::mapType($nl->{DATA_TYPE}) . "), CH_$e->{PROPERTIES}->{charset}));";
} else {
pidl "NDR_CHECK(ndr_push_array_$nl->{DATA_TYPE}($ndr, $ndr_flags, $var_name, $length));";
@@ -602,7 +603,7 @@ sub ParseElementPush($$$$$$)
start_flags($e);
- if (my $value = Parse::Pidl::Util::has_property($e, "value")) {
+ if (my $value = has_property($e, "value")) {
$var_name = Parse::Pidl::Util::ParseExpr($value, $env);
}
@@ -641,9 +642,9 @@ sub ParseElementPrint($$$)
my($e,$var_name,$env) = @_;
$var_name = append_prefix($e, $var_name);
- return if (Parse::Pidl::Util::has_property($e, "noprint"));
+ return if (has_property($e, "noprint"));
- if (my $value = Parse::Pidl::Util::has_property($e, "value")) {
+ if (my $value = has_property($e, "value")) {
$var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . Parse::Pidl::Util::ParseExpr($value,$env) . ":$var_name";
}
@@ -670,7 +671,7 @@ sub ParseElementPrint($$$)
}
if (is_scalar_array($e, $l)) {
- if (Parse::Pidl::Util::has_property($e, "charset")) {
+ if (has_property($e, "charset")) {
pidl "ndr_print_string(ndr, \"$e->{NAME}\", $var_name);";
} else {
my $nl = Parse::Pidl::NDR::GetNextLevel($e, $l);
@@ -761,7 +762,7 @@ sub ParseDataPull($$$$$)
pidl "NDR_CHECK(ndr_pull_$l->{DATA_TYPE}($ndr, $ndr_flags, $var_name));";
- if (my $range = Parse::Pidl::Util::has_property($e, "range")) {
+ if (my $range = has_property($e, "range")) {
$var_name = get_value_of($var_name);
my ($low, $high) = split(/ /, $range, 2);
pidl "if ($var_name < $low || $var_name > $high) {";
@@ -830,7 +831,7 @@ sub ParseElementPullLevel
}
my $nl = Parse::Pidl::NDR::GetNextLevel($e, $l);
- if (Parse::Pidl::Util::has_property($e, "charset")) {
+ if (has_property($e, "charset")) {
pidl "NDR_CHECK(ndr_pull_charset($ndr, $ndr_flags, ".get_pointer_to($var_name).", $length, sizeof(" . Parse::Pidl::Typelist::mapType($nl->{DATA_TYPE}) . "), CH_$e->{PROPERTIES}->{charset}));";
} else {
pidl "NDR_CHECK(ndr_pull_array_$nl->{DATA_TYPE}($ndr, $ndr_flags, $var_name, $length));";
@@ -1356,7 +1357,7 @@ sub ParseStructNdrSize($)
my $t = shift;
my $sizevar;
- if (my $flags = Parse::Pidl::Util::has_property($t, "flag")) {
+ if (my $flags = has_property($t, "flag")) {
pidl "flags |= $flags;";
}
pidl "return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_$t->{NAME});";
@@ -1404,7 +1405,7 @@ sub ParseUnionNdrSize($)
my $t = shift;
my $sizevar;
- if (my $flags = Parse::Pidl::Util::has_property($t, "flag")) {
+ if (my $flags = has_property($t, "flag")) {
pidl "flags |= $flags;";
}
@@ -1748,7 +1749,7 @@ sub ParseFunctionPrint($)
{
my($fn) = shift;
- return if Parse::Pidl::Util::has_property($fn, "noprint");
+ return if has_property($fn, "noprint");
pidl "void ndr_print_$fn->{NAME}(struct ndr_print *ndr, const char *name, int flags, const struct $fn->{NAME} *r)";
pidl "{";
@@ -1811,7 +1812,7 @@ sub ParseFunctionPush($)
{
my($fn) = shift;
- return if Parse::Pidl::Util::has_property($fn, "nopush");
+ return if has_property($fn, "nopush");
pidl fn_prefix($fn) . "NTSTATUS ndr_push_$fn->{NAME}(struct ndr_push *ndr, int flags, const struct $fn->{NAME} *r)";
pidl "{";
@@ -1861,7 +1862,7 @@ sub AllocateArrayLevel($$$$$)
{
my ($e,$l,$ndr,$env,$size) = @_;
- return if (Parse::Pidl::Util::has_property($e, "charset"));
+ return if (has_property($e, "charset"));
my $var = Parse::Pidl::Util::ParseExpr($e->{NAME}, $env);
@@ -1890,7 +1891,7 @@ sub ParseFunctionPull($)
{
my($fn) = shift;
- return if Parse::Pidl::Util::has_property($fn, "nopull");
+ return if has_property($fn, "nopull");
# pull function args
pidl fn_prefix($fn) . "NTSTATUS ndr_pull_$fn->{NAME}(struct ndr_pull *ndr, int flags, struct $fn->{NAME} *r)";
@@ -2185,14 +2186,14 @@ sub NeededFunction($$)
sub NeededTypedef($$)
{
my ($t,$needed) = @_;
- if (Parse::Pidl::Util::has_property($t, "public")) {
- $needed->{"pull_$t->{NAME}"} = not Parse::Pidl::Util::has_property($t, "nopull");
- $needed->{"push_$t->{NAME}"} = not Parse::Pidl::Util::has_property($t, "nopush");
- $needed->{"print_$t->{NAME}"} = not Parse::Pidl::Util::has_property($t, "noprint");
+ if (has_property($t, "public")) {
+ $needed->{"pull_$t->{NAME}"} = not has_property($t, "nopull");
+ $needed->{"push_$t->{NAME}"} = not has_property($t, "nopush");
+ $needed->{"print_$t->{NAME}"} = not has_property($t, "noprint");
}
if ($t->{DATA}->{TYPE} eq "STRUCT" or $t->{DATA}->{TYPE} eq "UNION") {
- if (Parse::Pidl::Util::has_property($t, "gensize")) {
+ if (has_property($t, "gensize")) {
$needed->{"ndr_size_$t->{NAME}"} = 1;
}
diff --git a/source4/build/pidl/Parse/Pidl/Typelist.pm b/source4/build/pidl/Parse/Pidl/Typelist.pm
index d134cc6992..d8934bfbce 100644
--- a/source4/build/pidl/Parse/Pidl/Typelist.pm
+++ b/source4/build/pidl/Parse/Pidl/Typelist.pm
@@ -5,7 +5,7 @@
package Parse::Pidl::Typelist;
-use Parse::Pidl::Util;
+use Parse::Pidl::Util qw(has_property);
use strict;
my %typedefs = ();
@@ -253,9 +253,9 @@ sub RegisterAliases()
sub enum_type_fn($)
{
my $enum = shift;
- if (Parse::Pidl::Util::has_property($enum->{PARENT}, "enum8bit")) {
+ if (has_property($enum->{PARENT}, "enum8bit")) {
return "uint8";
- } elsif (Parse::Pidl::Util::has_property($enum->{PARENT}, "v1_enum")) {
+ } elsif (has_property($enum->{PARENT}, "v1_enum")) {
return "uint32";
}
return "uint16";
@@ -265,11 +265,11 @@ sub bitmap_type_fn($)
{
my $bitmap = shift;
- if (Parse::Pidl::Util::has_property($bitmap, "bitmap8bit")) {
+ if (has_property($bitmap, "bitmap8bit")) {
return "uint8";
- } elsif (Parse::Pidl::Util::has_property($bitmap, "bitmap16bit")) {
+ } elsif (has_property($bitmap, "bitmap16bit")) {
return "uint16";
- } elsif (Parse::Pidl::Util::has_property($bitmap, "bitmap64bit")) {
+ } elsif (has_property($bitmap, "bitmap64bit")) {
return "hyper";
}
return "uint32";
@@ -310,7 +310,7 @@ sub LoadIdl($)
NAME => $x->{NAME},
TYPE => "TYPEDEF",
DATA => $x
- }) if (Parse::Pidl::Util::has_property($x, "object"));
+ }) if (has_property($x, "object"));
foreach my $y (@{$x->{DATA}}) {
addType($y) if (
diff --git a/source4/build/pidl/Parse/Pidl/Util.pm b/source4/build/pidl/Parse/Pidl/Util.pm
index 41fde63c25..fec18e6aeb 100644
--- a/source4/build/pidl/Parse/Pidl/Util.pm
+++ b/source4/build/pidl/Parse/Pidl/Util.pm
@@ -4,6 +4,9 @@
# released under the GNU GPL
package Parse::Pidl::Util;
+use Exporter 'import';
+@EXPORT_OK = qw(has_property property_matches);
+
use strict;
#####################################################################
diff --git a/source4/build/pidl/Parse/Pidl/Validator.pm b/source4/build/pidl/Parse/Pidl/Validator.pm
index 53015bc575..606d14e08b 100644
--- a/source4/build/pidl/Parse/Pidl/Validator.pm
+++ b/source4/build/pidl/Parse/Pidl/Validator.pm
@@ -5,6 +5,8 @@
package Parse::Pidl::Validator;
+use Parse::Pidl::Util qw(has_property);
+
use strict;
#####################################################################
@@ -176,12 +178,12 @@ sub ValidElement($)
ValidProperties($e,"ELEMENT");
- if (Parse::Pidl::Util::has_property($e, "ptr")) {
+ if (has_property($e, "ptr")) {
fatal($e, el_name($e) . " : pidl does not support full NDR pointers yet\n");
}
# Check whether switches are used correctly.
- if (my $switch = Parse::Pidl::Util::has_property($e, "switch_is")) {
+ if (my $switch = has_property($e, "switch_is")) {
my $e2 = find_sibling($e, $switch);
my $type = Parse::Pidl::Typelist::getType($e->{TYPE});
@@ -189,8 +191,8 @@ sub ValidElement($)
fatal($e, el_name($e) . ": switch_is() used on non-union type $e->{TYPE} which is a $type->{DATA}->{TYPE}");
}
- if (!Parse::Pidl::Util::has_property($type, "nodiscriminant") and defined($e2)) {
- my $discriminator_type = Parse::Pidl::Util::has_property($type, "switch_type");
+ if (!has_property($type, "nodiscriminant") and defined($e2)) {
+ my $discriminator_type = has_property($type, "switch_type");
$discriminator_type = "uint32" unless defined ($discriminator_type);
my $t1 = mapToScalar($discriminator_type);
@@ -210,24 +212,24 @@ sub ValidElement($)
}
}
- if (defined (Parse::Pidl::Util::has_property($e, "subcontext_size")) and not defined(Parse::Pidl::Util::has_property($e, "subcontext"))) {
+ if (defined (has_property($e, "subcontext_size")) and not defined(has_property($e, "subcontext"))) {
fatal($e, el_name($e) . " : subcontext_size() on non-subcontext element");
}
- if (defined (Parse::Pidl::Util::has_property($e, "compression")) and not defined(Parse::Pidl::Util::has_property($e, "subcontext"))) {
+ if (defined (has_property($e, "compression")) and not defined(has_property($e, "subcontext"))) {
fatal($e, el_name($e) . " : compression() on non-subcontext element");
}
- if (defined (Parse::Pidl::Util::has_property($e, "obfuscation")) and not defined(Parse::Pidl::Util::has_property($e, "subcontext"))) {
+ if (defined (has_property($e, "obfuscation")) and not defined(has_property($e, "subcontext"))) {
fatal($e, el_name($e) . " : obfuscation() on non-subcontext element");
}
if (!$e->{POINTERS} && (
- Parse::Pidl::Util::has_property($e, "ptr") or
- Parse::Pidl::Util::has_property($e, "sptr") or
- Parse::Pidl::Util::has_property($e, "unique") or
- Parse::Pidl::Util::has_property($e, "relative") or
- Parse::Pidl::Util::has_property($e, "ref"))) {
+ has_property($e, "ptr") or
+ has_property($e, "sptr") or
+ has_property($e, "unique") or
+ has_property($e, "relative") or
+ has_property($e, "ref"))) {
fatal($e, el_name($e) . " : pointer properties on non-pointer element\n");
}
}
@@ -254,7 +256,7 @@ sub ValidUnion($)
ValidProperties($union,"UNION");
- if (Parse::Pidl::Util::has_property($union->{PARENT}, "nodiscriminant") and Parse::Pidl::Util::has_property($union->{PARENT}, "switch_type")) {
+ if (has_property($union->{PARENT}, "nodiscriminant") and has_property($union->{PARENT}, "switch_type")) {
fatal($union->{PARENT}, $union->{PARENT}->{NAME} . ": switch_type() on union without discriminant");
}
@@ -271,7 +273,7 @@ sub ValidUnion($)
fatal $e, "Union member $e->{NAME} must have default or case property\n";
}
- if (Parse::Pidl::Util::has_property($e, "ref")) {
+ if (has_property($e, "ref")) {
fatal($e, el_name($e) . " : embedded ref pointers are not supported yet\n");
}
@@ -312,7 +314,7 @@ sub ValidFunction($)
foreach my $e (@{$fn->{ELEMENTS}}) {
$e->{PARENT} = $fn;
- if (Parse::Pidl::Util::has_property($e, "ref") && !$e->{POINTERS}) {
+ if (has_property($e, "ref") && !$e->{POINTERS}) {
fatal $e, "[ref] variables must be pointers ($fn->{NAME}/$e->{NAME})\n";
}
ValidElement($e);
@@ -328,13 +330,13 @@ sub ValidInterface($)
ValidProperties($interface,"INTERFACE");
- if (Parse::Pidl::Util::has_property($interface, "pointer_default") &&
+ if (has_property($interface, "pointer_default") &&
$interface->{PROPERTIES}->{pointer_default} eq "ptr") {
fatal $interface, "Full pointers are not supported yet\n";
}
- if (Parse::Pidl::Util::has_property($interface, "object")) {
- if (Parse::Pidl::Util::has_property($interface, "version") &&
+ if (has_property($interface, "object")) {
+ if (has_property($interface, "version") &&
$interface->{PROPERTIES}->{version} != 0) {
fatal $interface, "Object interfaces must have version 0.0 ($interface->{NAME})\n";
}