From c420c5a4c4bc2185f123058027f8328ade0d0a4e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 13 Jun 2005 22:22:51 +0000 Subject: r7552: Use ParseExpr() for [value] attributes; allows us somewhat cleaner IDL. (This used to be commit b7b01bccd101654d1f5ec83cba9dea7e9431d6ce) --- source4/build/pidl/TODO | 8 ++++---- source4/build/pidl/ndr_parser.pm | 4 ++-- source4/build/pidl/validator.pm | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) (limited to 'source4/build') diff --git a/source4/build/pidl/TODO b/source4/build/pidl/TODO index 2f45c2d11a..d63fb4af7e 100644 --- a/source4/build/pidl/TODO +++ b/source4/build/pidl/TODO @@ -3,10 +3,10 @@ [string] attribute. Pidl itself would support a couple of extra attributes for it's own use while being compatible with other IDL compilers. - Proposed extensions for pidl: + Proposed extensions for pidl (to arrays): [convert(t)] attribute for forcing conversions from CH_UCS2, etc to UTF8 - [noterm] attribute - [nullterm] attribute + [noterm] attribute -> Indicating there is no terminating character + [nullterm] attribute -> Indicating the string is null terminated The various flags for strings would change as follows: @@ -16,7 +16,7 @@ LIBNDR_FLAG_STR_SIZE4 -> [size_is()] or if needed [conformant] LIBNDR_FLAG_STR_NOTERM -> [noterm] LIBNDR_FLAG_STR_NULLTERM -> [nullterm] LIBNDR_FLAG_STR_SIZE2 -> uint16 length; [string] char data[length] -LIBNDR_FLAG_STR_BYTESIZE -> ??? +LIBNDR_FLAG_STR_BYTESIZE -> uint16 length; [string] char data[length] LIBNDR_FLAG_STR_FIXLEN32 -> [32] LIBNDR_FLAG_STR_CONFORMANT -> no longer needed LIBNDR_FLAG_STR_CHARLEN -> ??? diff --git a/source4/build/pidl/ndr_parser.pm b/source4/build/pidl/ndr_parser.pm index 0dd1289d80..7beefbf95d 100644 --- a/source4/build/pidl/ndr_parser.pm +++ b/source4/build/pidl/ndr_parser.pm @@ -704,7 +704,7 @@ sub ParseElementPush($$$$$$) start_flags($e); if (my $value = util::has_property($e, "value")) { - pidl "$var_name = $value;"; + pidl "$var_name = " . ParseExpr($value, $env) . ";"; } ParseElementPushLevel($e, $e->{LEVELS}[0], $ndr, $var_name, $env, $primitives, $deferred); @@ -748,7 +748,7 @@ sub ParseElementPrint($$$) if (my $value = util::has_property($e, "value")) { pidl "if (ndr->flags & LIBNDR_PRINT_SET_VALUES) {"; - pidl "\t$var_name = $value;"; + pidl "\t$var_name = " . ParseExpr($value,$env) . ";"; pidl "}"; } diff --git a/source4/build/pidl/validator.pm b/source4/build/pidl/validator.pm index 6bd31db621..ebe8115985 100644 --- a/source4/build/pidl/validator.pm +++ b/source4/build/pidl/validator.pm @@ -130,6 +130,7 @@ my %property_list = ( # array "range" => ["ELEMENT"], "size_is" => ["ELEMENT"], + "string" => ["ELEMENT"], "length_is" => ["ELEMENT"], ); -- cgit