summaryrefslogtreecommitdiff
path: root/source4/build
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-11-16 13:48:05 +0000
committerAndrew Tridgell <tridge@samba.org>2003-11-16 13:48:05 +0000
commitc4b7585288095cb9459feb237a9581ba30b850d0 (patch)
treeb6deb6afcad3981759012e2301633446e081724f /source4/build
parentea266c0625e04a2dc10d25c2fee7b685965fcd3e (diff)
downloadsamba-c4b7585288095cb9459feb237a9581ba30b850d0.tar.gz
samba-c4b7585288095cb9459feb237a9581ba30b850d0.tar.bz2
samba-c4b7585288095cb9459feb237a9581ba30b850d0.zip
* the beginnings of non-constant fixed arrays
* added relative pointers support (This used to be commit 4a34a4f29cf8ab79582ce7b503da907df7b4d209)
Diffstat (limited to 'source4/build')
-rw-r--r--source4/build/pidl/header.pm10
-rw-r--r--source4/build/pidl/idl.gram9
-rw-r--r--source4/build/pidl/parser.pm16
-rw-r--r--source4/build/pidl/util.pm13
4 files changed, 38 insertions, 10 deletions
diff --git a/source4/build/pidl/header.pm b/source4/build/pidl/header.pm
index e5acad2a63..7f7f2db977 100644
--- a/source4/build/pidl/header.pm
+++ b/source4/build/pidl/header.pm
@@ -59,13 +59,14 @@ sub HeaderElement($)
$res .= "*";
}
}
- if (defined $element->{ARRAY_LEN} && $element->{ARRAY_LEN} eq "*") {
+ if (defined $element->{ARRAY_LEN} &&
+ !util::is_constant($element->{ARRAY_LEN})) {
# conformant arrays are ugly! I choose to implement them with
# pointers instead of the [1] method
$res .= "*";
}
$res .= "$element->{NAME}";
- if (defined $element->{ARRAY_LEN} && $element->{ARRAY_LEN} ne "*") {
+ if (defined $element->{ARRAY_LEN} && util::is_constant($element->{ARRAY_LEN})) {
$res .= "[$element->{ARRAY_LEN}]";
}
$res .= ";\n";
@@ -128,7 +129,7 @@ sub HeaderType($$$)
}
if ($data =~ "unistr") {
$res .= "const char";
- } elsif ($data =~ "relstr") {
+ } elsif ($data =~ "nstring") {
$res .= "const char *";
} elsif (util::is_scalar_type($data)) {
$res .= "$data";
@@ -198,6 +199,9 @@ sub HeaderInterface($)
my($interface) = shift;
my($data) = $interface->{DATA};
foreach my $d (@{$data}) {
+ if (!defined $d->{TYPE}) {
+ print Dumper $d;
+ }
($d->{TYPE} eq "TYPEDEF") &&
HeaderTypedef($d);
($d->{TYPE} eq "FUNCTION") &&
diff --git a/source4/build/pidl/idl.gram b/source4/build/pidl/idl.gram
index 1e96431e47..f340b9787e 100644
--- a/source4/build/pidl/idl.gram
+++ b/source4/build/pidl/idl.gram
@@ -78,10 +78,12 @@ base_element: property_list(s?) type pointer(s?) identifier array_len(?)
| <error>
array_len:
- '[]'
+ '[' ']'
{ "*" }
- | '[' <commit> constant ']'
- { $item{constant} }
+ | '[' '*' ']'
+ { "*" }
+ | '[' <commit> text ']'
+ { "$item{text}" }
| <error?>
element_list1: base_element(s? /;/) ';'
@@ -105,6 +107,7 @@ property: 'unique'
| 'context_handle'
| 'string'
| 'public'
+ | 'relative'
| 'subcontext'
| 'byte_count_pointer' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
| 'size_is' '(' expression ')' {{ "$item[1]" => "$item{expression}" }}
diff --git a/source4/build/pidl/parser.pm b/source4/build/pidl/parser.pm
index e341d9f216..6037fb3d89 100644
--- a/source4/build/pidl/parser.pm
+++ b/source4/build/pidl/parser.pm
@@ -198,7 +198,9 @@ sub ParseElementPushScalar($$$)
my($ndr_flags) = shift;
my $cprefix = util::c_push_prefix($e);
- if (my $value = util::has_property($e, "value")) {
+ 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 (my $value = util::has_property($e, "value")) {
$res .= "\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $value));\n";
} elsif (defined $e->{VALUE}) {
$res .= "\tNDR_CHECK(ndr_push_$e->{TYPE}(ndr, $e->{VALUE}));\n";
@@ -301,7 +303,9 @@ sub ParseElementPullScalar($$$)
my($ndr_flags) = shift;
my $cprefix = util::c_pull_prefix($e);
- if (defined $e->{VALUE}) {
+ if (util::has_property($e, "relative")) {
+ $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::need_wire_pointer($e)) {
$res .= "\tNDR_CHECK(ndr_pull_uint32(ndr, &_ptr_$e->{NAME}));\n";
@@ -344,7 +348,9 @@ sub ParseElementPushBuffer($$$)
$res .= "\tif ($var_prefix$e->{NAME}) {\n";
}
- if (util::array_size($e)) {
+ 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::array_size($e)) {
ParseArrayPush($e, "r->", "NDR_SCALARS|NDR_BUFFERS");
} elsif (my $switch = util::has_property($e, "switch_is")) {
if ($e->{POINTERS}) {
@@ -408,6 +414,10 @@ sub ParseElementPullBuffer($$$)
return;
}
+ if (util::has_property($e, "relative")) {
+ return;
+ }
+
if (util::need_wire_pointer($e)) {
$res .= "\tif ($var_prefix$e->{NAME}) {\n";
}
diff --git a/source4/build/pidl/util.pm b/source4/build/pidl/util.pm
index 916ae79d5f..16cb012d0c 100644
--- a/source4/build/pidl/util.pm
+++ b/source4/build/pidl/util.pm
@@ -329,7 +329,7 @@ sub c_pull_prefix($)
if ($e->{TYPE} =~ "unistr.*") {
return "&";
}
- if ($e->{TYPE} =~ "relstr.*") {
+ if ($e->{TYPE} =~ "nstring.*") {
return "&";
}
@@ -367,6 +367,17 @@ sub is_fixed_array($)
return 0;
}
+# return 1 if this is a inline array
+sub is_inline_array($)
+{
+ my $e = shift;
+ my $len = $e->{"ARRAY_LEN"};
+ if (defined $len && $len ne "*") {
+ return 1;
+ }
+ return 0;
+}
+
sub dump($)
{
print Dumper shift;