diff options
-rw-r--r-- | source4/build/pidl/header.pm | 10 | ||||
-rw-r--r-- | source4/build/pidl/idl.gram | 9 | ||||
-rw-r--r-- | source4/build/pidl/parser.pm | 16 | ||||
-rw-r--r-- | source4/build/pidl/util.pm | 13 |
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; |