summaryrefslogtreecommitdiff
path: root/source4/pidl/lib/Parse/Pidl/Samba4
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-01-05 20:52:12 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:37:01 -0500
commita7bc3801f94891880a90b2974dfbadc9e9f8c2ee (patch)
tree2cc690d4b35022398e8062847f70982fd34585e0 /source4/pidl/lib/Parse/Pidl/Samba4
parent38ba8bf8ba75c19ab8d34eb4862b05befc8e1497 (diff)
downloadsamba-a7bc3801f94891880a90b2974dfbadc9e9f8c2ee.tar.gz
samba-a7bc3801f94891880a90b2974dfbadc9e9f8c2ee.tar.bz2
samba-a7bc3801f94891880a90b2974dfbadc9e9f8c2ee.zip
r20567: Print proper errors with filename and line numbers in ParseExpr()
(This used to be commit f5dc1b47ecf18068a47f8f68016463ef4a55dc03)
Diffstat (limited to 'source4/pidl/lib/Parse/Pidl/Samba4')
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm14
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm46
-rw-r--r--source4/pidl/lib/Parse/Pidl/Samba4/TDR.pm8
3 files changed, 34 insertions, 34 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
index f820dbbc5a..c851fafd4b 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/EJS.pm
@@ -198,8 +198,8 @@ sub EjsPullArray($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
my $nl = Parse::Pidl::NDR::GetNextLevel($e, $l);
- my $length = Parse::Pidl::Util::ParseExpr($l->{LENGTH_IS}, $env);
- my $size = Parse::Pidl::Util::ParseExpr($l->{SIZE_IS}, $env);
+ my $length = Parse::Pidl::Util::ParseExpr($l->{LENGTH_IS}, $env, $e);
+ my $size = Parse::Pidl::Util::ParseExpr($l->{SIZE_IS}, $env, $e);
my $pl = Parse::Pidl::NDR::GetPrevLevel($e, $l);
if ($pl && $pl->{TYPE} eq "POINTER") {
$var = get_pointer_to($var);
@@ -238,7 +238,7 @@ sub EjsPullArray($$$$$)
sub EjsPullSwitch($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
- my $switch_var = Parse::Pidl::Util::ParseExpr($l->{SWITCH_IS}, $env);
+ my $switch_var = Parse::Pidl::Util::ParseExpr($l->{SWITCH_IS}, $env, $e);
pidl "ejs_set_switch(ejs, $switch_var);";
EjsPullElement($e, Parse::Pidl::NDR::GetNextLevel($e, $l), $var, $name, $env);
}
@@ -270,7 +270,7 @@ sub EjsPullElementTop($$)
my $e = shift;
my $env = shift;
my $l = $e->{LEVELS}[0];
- my $var = Parse::Pidl::Util::ParseExpr($e->{NAME}, $env);
+ my $var = Parse::Pidl::Util::ParseExpr($e->{NAME}, $env, $e);
my $name = "\"$e->{NAME}\"";
EjsPullElement($e, $l, $var, $name, $env);
}
@@ -488,7 +488,7 @@ sub EjsPushPointer($$$$$)
sub EjsPushSwitch($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
- my $switch_var = Parse::Pidl::Util::ParseExpr($l->{SWITCH_IS}, $env);
+ my $switch_var = Parse::Pidl::Util::ParseExpr($l->{SWITCH_IS}, $env, $e);
pidl "ejs_set_switch(ejs, $switch_var);";
EjsPushElement($e, Parse::Pidl::NDR::GetNextLevel($e, $l), $var, $name, $env);
}
@@ -500,7 +500,7 @@ sub EjsPushArray($$$$$)
{
my ($e, $l, $var, $name, $env) = @_;
my $nl = Parse::Pidl::NDR::GetNextLevel($e, $l);
- my $length = Parse::Pidl::Util::ParseExpr($l->{LENGTH_IS}, $env);
+ my $length = Parse::Pidl::Util::ParseExpr($l->{LENGTH_IS}, $env, $e);
my $pl = Parse::Pidl::NDR::GetPrevLevel($e, $l);
if ($pl && $pl->{TYPE} eq "POINTER") {
$var = get_pointer_to($var);
@@ -553,7 +553,7 @@ sub EjsPushElementTop($$)
my $e = shift;
my $env = shift;
my $l = $e->{LEVELS}[0];
- my $var = Parse::Pidl::Util::ParseExpr($e->{NAME}, $env);
+ my $var = Parse::Pidl::Util::ParseExpr($e->{NAME}, $env, $e);
my $name = "\"$e->{NAME}\"";
EjsPushElement($e, $l, $var, $name, $env);
}
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
index f104ffbad8..debdc8e308 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm
@@ -257,7 +257,7 @@ sub EnvSubstituteValue($$)
foreach my $e (@{$s->{ELEMENTS}}) {
next unless (my $v = has_property($e, "value"));
- $env->{$e->{NAME}} = ParseExpr($v, $env);
+ $env->{$e->{NAME}} = ParseExpr($v, $env, $e);
}
return $env;
@@ -309,8 +309,8 @@ sub ParseArrayPushHeader($$$$$)
$size = $length = "ndr_string_length($var_name, sizeof(*$var_name))";
}
} else {
- $size = ParseExpr($l->{SIZE_IS}, $env);
- $length = ParseExpr($l->{LENGTH_IS}, $env);
+ $size = ParseExpr($l->{SIZE_IS}, $env, $e);
+ $length = ParseExpr($l->{LENGTH_IS}, $env, $e);
}
if ((!$l->{IS_SURROUNDING}) and $l->{IS_CONFORMANT}) {
@@ -339,7 +339,7 @@ sub ParseArrayPullHeader($$$$$)
} elsif ($l->{IS_ZERO_TERMINATED}) { # Noheader arrays
$length = $size = "ndr_get_string_size($ndr, sizeof(*$var_name))";
} else {
- $length = $size = ParseExpr($l->{SIZE_IS}, $env);
+ $length = $size = ParseExpr($l->{SIZE_IS}, $env, $e);
}
if ((!$l->{IS_SURROUNDING}) and $l->{IS_CONFORMANT}) {
@@ -363,7 +363,7 @@ sub ParseArrayPullHeader($$$$$)
}
if ($l->{IS_CONFORMANT} and not $l->{IS_ZERO_TERMINATED}) {
- my $size = ParseExpr($l->{SIZE_IS}, $env);
+ my $size = ParseExpr($l->{SIZE_IS}, $env, $e);
defer "if ($var_name) {";
defer_indent;
check_null_pointer_deferred($size);
@@ -373,7 +373,7 @@ sub ParseArrayPullHeader($$$$$)
}
if ($l->{IS_VARYING} and not $l->{IS_ZERO_TERMINATED}) {
- my $length = ParseExpr($l->{LENGTH_IS}, $env);
+ my $length = ParseExpr($l->{LENGTH_IS}, $env, $e);
defer "if ($var_name) {";
defer_indent;
check_null_pointer_deferred($length);
@@ -404,7 +404,7 @@ sub compression_clen($$$)
my $compression = $l->{COMPRESSION};
my ($alg, $clen, $dlen) = split(/ /, $compression);
- return ParseExpr($clen, $env);
+ return ParseExpr($clen, $env, $e);
}
sub compression_dlen($$$)
@@ -413,7 +413,7 @@ sub compression_dlen($$$)
my $compression = $l->{COMPRESSION};
my ($alg, $clen, $dlen) = split(/ /, $compression);
- return ParseExpr($dlen, $env);
+ return ParseExpr($dlen, $env, $e);
}
sub ParseCompressionPushStart($$$$)
@@ -474,7 +474,7 @@ sub ParseSubcontextPushStart($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env, $e);
pidl "{";
indent;
@@ -492,7 +492,7 @@ sub ParseSubcontextPushEnd($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env, $e);
if (defined $l->{COMPRESSION}) {
ParseCompressionPushEnd($e, $l, $subndr, $env);
@@ -507,7 +507,7 @@ sub ParseSubcontextPullStart($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env, $e);
pidl "{";
indent;
@@ -525,7 +525,7 @@ sub ParseSubcontextPullEnd($$$$)
{
my ($e,$l,$ndr,$env) = @_;
my $subndr = "_ndr_$e->{NAME}";
- my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env);
+ my $subcontext_size = ParseExpr($l->{SUBCONTEXT_SIZE},$env, $e);
if (defined $l->{COMPRESSION}) {
ParseCompressionPullEnd($e, $l, $subndr, $env);
@@ -590,7 +590,7 @@ sub ParseElementPushLevel
}
} elsif ($l->{TYPE} eq "ARRAY" and not has_fast_array($e,$l) and
not is_charset_array($e, $l)) {
- my $length = ParseExpr($l->{LENGTH_IS}, $env);
+ my $length = ParseExpr($l->{LENGTH_IS}, $env, $e);
my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
$var_name = $var_name . "[$counter]";
@@ -641,7 +641,7 @@ sub ParseElementPush($$$$$$)
start_flags($e);
if (my $value = has_property($e, "value")) {
- $var_name = ParseExpr($value, $env);
+ $var_name = ParseExpr($value, $env, $e);
}
ParseElementPushLevel($e, $e->{LEVELS}[0], $ndr, $var_name, $env, $primitives, $deferred);
@@ -692,7 +692,7 @@ sub ParseElementPrint($$$)
$var_name = append_prefix($e, $var_name);
if (my $value = has_property($e, "value")) {
- $var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . ParseExpr($value,$env) . ":$var_name";
+ $var_name = "(ndr->flags & LIBNDR_PRINT_SET_VALUES)?" . ParseExpr($value,$env, $e) . ":$var_name";
}
foreach my $l (@{$e->{LEVELS}}) {
@@ -714,7 +714,7 @@ sub ParseElementPrint($$$)
if ($l->{IS_ZERO_TERMINATED}) {
$length = "ndr_string_length($var_name, sizeof(*$var_name))";
} else {
- $length = ParseExpr($l->{LENGTH_IS}, $env);
+ $length = ParseExpr($l->{LENGTH_IS}, $env, $e);
}
if (is_charset_array($e,$l)) {
@@ -744,7 +744,7 @@ sub ParseElementPrint($$$)
}
pidl "ndr_print_$l->{DATA_TYPE}(ndr, \"$e->{NAME}\", $var_name);";
} elsif ($l->{TYPE} eq "SWITCH") {
- my $switch_var = ParseExpr($l->{SWITCH_IS}, $env);
+ my $switch_var = ParseExpr($l->{SWITCH_IS}, $env, $e);
pidl "ndr_print_set_switch_value(ndr, " . get_pointer_to($var_name) . ", $switch_var);";
}
}
@@ -774,7 +774,7 @@ sub ParseElementPrint($$$)
sub ParseSwitchPull($$$$$$)
{
my($e,$l,$ndr,$var_name,$ndr_flags,$env) = @_;
- my $switch_var = ParseExpr($l->{SWITCH_IS}, $env);
+ my $switch_var = ParseExpr($l->{SWITCH_IS}, $env, $e);
check_null_pointer($switch_var);
@@ -787,7 +787,7 @@ sub ParseSwitchPull($$$$$$)
sub ParseSwitchPush($$$$$$)
{
my($e,$l,$ndr,$var_name,$ndr_flags,$env) = @_;
- my $switch_var = ParseExpr($l->{SWITCH_IS}, $env);
+ my $switch_var = ParseExpr($l->{SWITCH_IS}, $env, $e);
check_null_pointer($switch_var);
$var_name = get_pointer_to($var_name);
@@ -986,7 +986,7 @@ sub ParseElementPullLevel
}
} elsif ($l->{TYPE} eq "ARRAY" and
not has_fast_array($e,$l) and not is_charset_array($e, $l)) {
- my $length = ParseExpr($l->{LENGTH_IS}, $env);
+ my $length = ParseExpr($l->{LENGTH_IS}, $env, $e);
my $counter = "cntr_$e->{NAME}_$l->{LEVEL_INDEX}";
my $array_name = $var_name;
@@ -1155,7 +1155,7 @@ sub ParseStructPush($$)
$size = "ndr_string_length(r->$e->{NAME}, sizeof(*r->$e->{NAME}))";
}
} else {
- $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env);
+ $size = ParseExpr($e->{LEVELS}[0]->{SIZE_IS}, $env, $e);
}
pidl "NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, $size));";
@@ -2012,7 +2012,7 @@ sub AllocateArrayLevel($$$$$)
{
my ($e,$l,$ndr,$env,$size) = @_;
- my $var = ParseExpr($e->{NAME}, $env);
+ my $var = ParseExpr($e->{NAME}, $env, $e);
check_null_pointer($size);
my $pl = GetPrevLevel($e, $l);
@@ -2093,7 +2093,7 @@ sub ParseFunctionPull($)
and $e->{LEVELS}[1]->{IS_ZERO_TERMINATED});
if ($e->{LEVELS}[1]->{TYPE} eq "ARRAY") {
- my $size = ParseExpr($e->{LEVELS}[1]->{SIZE_IS}, $env);
+ my $size = ParseExpr($e->{LEVELS}[1]->{SIZE_IS}, $env, $e);
check_null_pointer($size);
pidl "NDR_PULL_ALLOC_N(ndr, r->out.$e->{NAME}, $size);";
diff --git a/source4/pidl/lib/Parse/Pidl/Samba4/TDR.pm b/source4/pidl/lib/Parse/Pidl/Samba4/TDR.pm
index bc8d27a283..a3e8d3470b 100644
--- a/source4/pidl/lib/Parse/Pidl/Samba4/TDR.pm
+++ b/source4/pidl/lib/Parse/Pidl/Samba4/TDR.pm
@@ -72,7 +72,7 @@ sub ParserElement($$$)
if (has_property($e, "charset")) {
fatal($e,"charset() on non-array element") unless (defined($e->{ARRAY_LEN}) and scalar(@{$e->{ARRAY_LEN}}) > 0);
- my $len = ParseExpr(@{$e->{ARRAY_LEN}}[0], $env);
+ my $len = ParseExpr(@{$e->{ARRAY_LEN}}[0], $env, $e);
if ($len eq "*") { $len = "-1"; }
$name = ", mem_ctx" if ($t eq "pull");
pidl "TDR_CHECK(tdr_$t\_charset(tdr$name, &v->$e->{NAME}, $len, sizeof($e->{TYPE}_t), CH_$e->{PROPERTIES}->{charset}));";
@@ -80,11 +80,11 @@ sub ParserElement($$$)
}
if (has_property($e, "switch_is")) {
- $switch = ", " . ParseExpr($e->{PROPERTIES}->{switch_is}, $env);
+ $switch = ", " . ParseExpr($e->{PROPERTIES}->{switch_is}, $env, $e);
}
if (defined($e->{ARRAY_LEN}) and scalar(@{$e->{ARRAY_LEN}}) > 0) {
- my $len = ParseExpr($e->{ARRAY_LEN}[0], $env);
+ my $len = ParseExpr($e->{ARRAY_LEN}[0], $env, $e);
if ($t eq "pull" and not is_constant($len)) {
pidl "TDR_ALLOC(mem_ctx, v->$e->{NAME}, $len);";
@@ -101,7 +101,7 @@ sub ParserElement($$$)
}
if (has_property($e, "value") && $t eq "push") {
- pidl "v->$e->{NAME} = ".ParseExpr($e->{PROPERTIES}->{value}, $env).";";
+ pidl "v->$e->{NAME} = ".ParseExpr($e->{PROPERTIES}->{value}, $env, $e).";";
}
pidl "TDR_CHECK(tdr_$t\_$e->{TYPE}(tdr$name$switch, &v->$e->{NAME}$array));";