summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-17 06:25:51 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-17 06:25:51 +0000
commitfa83432e1085d32f1a3f4208b81b6e936ba63b38 (patch)
treeddea06f174b4227fa6ed63b304094362a7c55106 /source4/build
parentd1feb4c6d56b37d045a329fab98857fb36bd42c1 (diff)
downloadsamba-fa83432e1085d32f1a3f4208b81b6e936ba63b38.tar.gz
samba-fa83432e1085d32f1a3f4208b81b6e936ba63b38.tar.bz2
samba-fa83432e1085d32f1a3f4208b81b6e936ba63b38.zip
* support inline arrays
* add enough to allow security descriptors to be IDL described * added "noprint" property to allow fancy printing for specific functions (This used to be commit 08df20c8bed57bbb9a9a907c807ad850382fd4e8)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/idl.gram1
-rw-r--r--source4/build/pidl/parser.pm40
-rwxr-xr-xsource4/build/pidl/pidl.pl2
-rw-r--r--source4/build/pidl/util.pm6
4 files changed, 27 insertions, 22 deletions
diff --git a/source4/build/pidl/idl.gram b/source4/build/pidl/idl.gram
index a4435819d5..461b4c8e2d 100644
--- a/source4/build/pidl/idl.gram
+++ b/source4/build/pidl/idl.gram
@@ -107,6 +107,7 @@ property: 'unique'
| 'context_handle'
| 'string'
| 'public'
+ | 'noprint'
| 'relative'
| 'nodiscriminant'
| 'subcontext'
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm
index 67118488d4..97300eda91 100644
--- a/source4/build/pidl/parser.pm
+++ b/source4/build/pidl/parser.pm
@@ -98,7 +98,7 @@ sub ParseArrayPush($$$)
if (defined $e->{CONFORMANT_SIZE}) {
# the conformant size has already been pushed
- } elsif (!util::is_fixed_array($e)) {
+ } elsif (!util::is_inline_array($e)) {
# we need to emit the array size
$res .= "\t\tNDR_CHECK(ndr_push_uint32(ndr, $size));\n";
}
@@ -111,9 +111,9 @@ sub ParseArrayPush($$$)
}
if (util::is_scalar_type($e->{TYPE})) {
- $res .= "\t\tNDR_CHECK(ndr_push_array_$e->{TYPE}(ndr, $var_prefix$e->{NAME}, $size));\n";
+ $res .= "\t\tNDR_CHECK(ndr_push_array_$e->{TYPE}(ndr, $ndr_flags, $var_prefix$e->{NAME}, $size));\n";
} else {
- $res .= "\t\tNDR_CHECK(ndr_push_array(ndr, ndr_flags, $var_prefix$e->{NAME}, sizeof($var_prefix$e->{NAME}\[0]), $size, (ndr_push_flags_fn_t)ndr_push_$e->{TYPE}));\n";
+ $res .= "\t\tNDR_CHECK(ndr_push_array(ndr, $ndr_flags, $var_prefix$e->{NAME}, sizeof($var_prefix$e->{NAME}\[0]), $size, (ndr_push_flags_fn_t)ndr_push_$e->{TYPE}));\n";
}
}
@@ -156,7 +156,7 @@ sub ParseArrayPull($$$)
$res .= "\tif ($size > $alloc_size) {\n";
$res .= "\t\treturn ndr_pull_error(ndr, NDR_ERR_CONFORMANT_SIZE, \"Bad conformant size %u should be %u\", $alloc_size, $size);\n";
$res .= "\t}\n";
- } elsif (!util::is_fixed_array($e)) {
+ } elsif (!util::is_inline_array($e)) {
# non fixed arrays encode the size just before the array
$res .= "\t{\n";
$res .= "\t\tuint32 _array_size;\n";
@@ -168,7 +168,9 @@ sub ParseArrayPull($$$)
}
if (util::need_alloc($e) && !util::is_fixed_array($e)) {
- $res .= "\t\tNDR_ALLOC_N_SIZE(ndr, $var_prefix$e->{NAME}, $alloc_size, sizeof($var_prefix$e->{NAME}\[0]));\n";
+ if (!util::is_inline_array($e) || $ndr_flags eq "NDR_SCALARS") {
+ $res .= "\t\tNDR_ALLOC_N_SIZE(ndr, $var_prefix$e->{NAME}, $alloc_size, sizeof($var_prefix$e->{NAME}\[0]));\n";
+ }
}
if (my $length = util::has_property($e, "length_is")) {
@@ -182,7 +184,7 @@ sub ParseArrayPull($$$)
}
if (util::is_scalar_type($e->{TYPE})) {
- $res .= "\t\tNDR_CHECK(ndr_pull_array_$e->{TYPE}(ndr, $var_prefix$e->{NAME}, $size));\n";
+ $res .= "\t\tNDR_CHECK(ndr_pull_array_$e->{TYPE}(ndr, $ndr_flags, $var_prefix$e->{NAME}, $size));\n";
} else {
$res .= "\t\tNDR_CHECK(ndr_pull_array(ndr, $ndr_flags, (void **)$var_prefix$e->{NAME}, sizeof($var_prefix$e->{NAME}\[0]), $size, (ndr_pull_flags_fn_t)ndr_pull_$e->{TYPE}));\n";
}
@@ -200,6 +202,8 @@ sub ParseElementPushScalar($$$)
if (util::has_property($e, "relative")) {
$res .= "\tNDR_CHECK(ndr_push_relative(ndr, NDR_SCALARS, $var_prefix$e->{NAME}, (ndr_push_const_fn_t) ndr_push_$e->{TYPE}));\n";
+ } elsif (util::is_inline_array($e)) {
+ ParseArrayPush($e, "r->", "NDR_SCALARS");
} elsif (my $value = util::has_property($e, "value")) {
$res .= "\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $value));\n";
} elsif (defined $e->{VALUE}) {
@@ -307,6 +311,8 @@ sub ParseElementPullScalar($$$)
$res .= "\tNDR_CHECK(ndr_pull_relative(ndr, (const void **)&$var_prefix$e->{NAME}, sizeof(*$var_prefix$e->{NAME}), (ndr_pull_flags_fn_t)ndr_pull_$e->{TYPE}));\n";
} elsif (defined $e->{VALUE}) {
$res .= "\tNDR_CHECK(ndr_pull_$e->{TYPE}(ndr, $e->{VALUE}));\n";
+ } elsif (util::is_inline_array($e)) {
+ ParseArrayPull($e, "r->", "NDR_SCALARS");
} elsif (util::need_wire_pointer($e)) {
$res .= "\tNDR_CHECK(ndr_pull_uint32(ndr, &_ptr_$e->{NAME}));\n";
$res .= "\tif (_ptr_$e->{NAME}) {\n";
@@ -350,6 +356,8 @@ sub ParseElementPushBuffer($$$)
if (util::has_property($e, "relative")) {
$res .= "\tNDR_CHECK(ndr_push_relative(ndr, NDR_BUFFERS, $cprefix$var_prefix$e->{NAME}, (ndr_push_const_fn_t) ndr_push_$e->{TYPE}));\n";
+ } elsif (util::is_inline_array($e)) {
+ ParseArrayPush($e, "r->", "NDR_BUFFERS");
} elsif (util::array_size($e)) {
ParseArrayPush($e, "r->", "NDR_SCALARS|NDR_BUFFERS");
} elsif (my $switch = util::has_property($e, "switch_is")) {
@@ -422,7 +430,9 @@ sub ParseElementPullBuffer($$$)
$res .= "\tif ($var_prefix$e->{NAME}) {\n";
}
- if (util::array_size($e)) {
+ if (util::is_inline_array($e)) {
+ ParseArrayPull($e, "r->", "NDR_BUFFERS");
+ } elsif (util::array_size($e)) {
ParseArrayPull($e, "r->", "NDR_SCALARS|NDR_BUFFERS");
} elsif (my $switch = util::has_property($e, "switch_is")) {
if ($e->{POINTERS}) {
@@ -807,10 +817,7 @@ sub ParseFunctionPush($)
$res .= "\tNDR_CHECK(ndr_push_ptr(ndr, r->in.$e->{NAME}));\n";
}
$res .= "\tif (r->in.$e->{NAME}) {\n";
- if (!util::is_scalar_type($e->{TYPE})) {
- $res .= "\t\tint ndr_flags = NDR_SCALARS|NDR_BUFFERS;\n";
- }
- ParseArrayPush($e, "r->in.", "ndr_flags");
+ ParseArrayPush($e, "r->in.", "NDR_SCALARS|NDR_BUFFERS");
$res .= "\t}\n";
} else {
ParseElementPushScalar($e, "r->in.", "NDR_SCALARS|NDR_BUFFERS");
@@ -852,10 +859,7 @@ sub ParseFunctionPull($)
} else {
$res .= "\tif (r->out.$e->{NAME}) {\n";
}
- if (!util::is_scalar_type($e->{TYPE})) {
- $res .= "\t\tint ndr_flags = NDR_SCALARS|NDR_BUFFERS;\n";
- }
- ParseArrayPull($e, "r->out.", "ndr_flags");
+ ParseArrayPull($e, "r->out.", "NDR_SCALARS|NDR_BUFFERS");
$res .= "\t}\n";
} else {
ParseElementPullScalar($e, "r->out.", "NDR_SCALARS|NDR_BUFFERS");
@@ -893,8 +897,10 @@ sub ParseInterface($)
ParseFunctionPull($d);
}
foreach my $d (@{$data}) {
- ($d->{TYPE} eq "TYPEDEF") &&
- ParseTypedefPrint($d);
+ if ($d->{TYPE} eq "TYPEDEF" &&
+ !util::has_property($d->{DATA}, "noprint")) {
+ ParseTypedefPrint($d);
+ }
}
}
diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl
index 2b856b2e47..06bdb92b12 100755
--- a/source4/build/pidl/pidl.pl
+++ b/source4/build/pidl/pidl.pl
@@ -48,7 +48,7 @@ sub IdlParse($)
my($saved_sep) = $/;
undef $/;
- my($idl) = $parser->idl(`cpp $filename`);
+ my($idl) = $parser->idl(`cpp $filename | grep -v '^#'`);
$/ = $saved_sep;
util::CleanData($idl);
return $idl;
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm
index 949946d328..fcc6c54216 100644
--- a/source4/build/pidl/util.pm
+++ b/source4/build/pidl/util.pm
@@ -221,9 +221,6 @@ sub is_builtin_type($)
return 1, if (is_scalar_type($type));
return 1, if ($type =~ "unistr.*");
- return 1, if ($type eq "security_descriptor");
- return 1, if ($type eq "dom_sid");
- return 1, if ($type eq "dom_sid2");
return 1, if ($type eq "policy_handle");
return 0;
@@ -374,7 +371,8 @@ sub is_inline_array($)
{
my $e = shift;
my $len = $e->{"ARRAY_LEN"};
- if (defined $len && $len ne "*") {
+ if (is_fixed_array($e) ||
+ defined $len && $len ne "*") {
return 1;
}
return 0;