diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/build/pidl/eparser.pm | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm index 7d2ac1df1a..faaf34fe27 100644 --- a/source4/build/pidl/eparser.pm +++ b/source4/build/pidl/eparser.pm @@ -292,9 +292,9 @@ sub ParseArrayPull($$$) } if (util::is_scalar_type($e->{TYPE})) { - pidl "\t\tndr_pull_array_$e->{TYPE}(ndr, $ndr_flags, tree, \"$e->{NAME}\", hf_$e->{NAME}_$e->{TYPE}, $var_prefix$e->{NAME}, $size);\n"; + pidl "\t\tndr_pull_array_$e->{TYPE}(ndr, $ndr_flags, tree, \"" . field2name($e->{NAME}) . "\", hf_$e->{NAME}_$e->{TYPE}, $var_prefix$e->{NAME}, $size);\n"; } else { - pidl "\t\tndr_pull_array(ndr, $ndr_flags, tree, \"$e->{NAME}\", (void **)$var_prefix$e->{NAME}, sizeof($var_prefix$e->{NAME}\[0]), $size, (ndr_pull_flags_fn_t)ndr_pull_$e->{TYPE});\n"; + pidl "\t\tndr_pull_array(ndr, $ndr_flags, tree, \"" . field2name($e->{NAME}) . "\", (void **)$var_prefix$e->{NAME}, sizeof($var_prefix$e->{NAME}\[0]), $size, (ndr_pull_flags_fn_t)ndr_pull_$e->{TYPE});\n"; } pidl "\t}\n"; @@ -379,7 +379,7 @@ sub ParseElementPullScalar($$$) } elsif (util::is_builtin_type($e->{TYPE})) { pidl "\tndr_pull_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, $cprefix$var_prefix$e->{NAME});\n"; } else { - pidl "\tndr_pull_$e->{TYPE}(ndr, $ndr_flags, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; + pidl "\tndr_pull_$e->{TYPE}(ndr, $ndr_flags, get_subtree(tree, \"" . field2name($e->{NAME}) . "\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; } end_flags($e); @@ -430,9 +430,9 @@ sub ParseElementPullBuffer($$$) } elsif (util::is_builtin_type($e->{TYPE})) { pidl "\t\tndr_pull_$e->{TYPE}(ndr, tree, hf_$e->{NAME}_$e->{TYPE}, $cprefix$var_prefix$e->{NAME});\n"; } elsif ($e->{POINTERS}) { - pidl "\t\tndr_pull_$e->{TYPE}(ndr, NDR_SCALARS|NDR_BUFFERS, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; + pidl "\t\tndr_pull_$e->{TYPE}(ndr, NDR_SCALARS|NDR_BUFFERS, get_subtree(tree, \"" . field2name($e->{NAME}) . "\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; } else { - pidl "\t\tndr_pull_$e->{TYPE}(ndr, $ndr_flags, get_subtree(tree, \"$e->{NAME}\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; + pidl "\t\tndr_pull_$e->{TYPE}(ndr, $ndr_flags, get_subtree(tree, \"" . field2name($e->{NAME}) . "\", ndr, ett_$e->{TYPE}), $cprefix$var_prefix$e->{NAME});\n"; } if (util::need_wire_pointer($e)) { @@ -831,6 +831,19 @@ sub type2base($) return "BASE_NONE"; } +# Convert a IDL structure field name (e.g access_mask) to a prettier +# string like 'Access Mask'. + +sub field2name($) +{ + my($field) = shift; + + $field =~ s/_/ /g; # Replace underscores with spaces + $field =~ s/(\w+)/\u\L$1/g; # Capitalise each word + + return $field; +} + sub NeededFunction($) { my $fn = shift; @@ -841,7 +854,7 @@ sub NeededFunction($) if (util::is_scalar_type($e->{TYPE})) { $needed{"hf_$e->{NAME}_$e->{TYPE}"} = { - 'name' => $e->{NAME}, + 'name' => field2name($e->{NAME}), 'type' => $e->{TYPE}, 'ft' => type2ft($e->{TYPE}), 'base' => type2base($e->{TYPE}) @@ -871,7 +884,7 @@ sub NeededTypedef($) if (util::is_scalar_type($e->{TYPE})) { $needed{"hf_$e->{NAME}_$e->{TYPE}"} = { - 'name' => $e->{NAME}, + 'name' => field2name($e->{NAME}), 'type' => $e->{TYPE}, 'ft' => type2ft($e->{TYPE}), 'base' => type2base($e->{TYPE}) @@ -944,8 +957,6 @@ sub ParseHeader($$) pidl "/* parser auto-generated by pidl */\n\n"; - pidl "#include \"ndr_$module.h\"\n\n"; - foreach my $x (@{$idl}) { if ($x->{TYPE} eq "INTERFACE") { foreach my $d (@{$x->{DATA}}) { |