diff options
Diffstat (limited to 'source4/pidl/lib/Parse')
-rw-r--r-- | source4/pidl/lib/Parse/Pidl/Samba/TDR.pm | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/source4/pidl/lib/Parse/Pidl/Samba/TDR.pm b/source4/pidl/lib/Parse/Pidl/Samba/TDR.pm index b9bfd83e41..aa41e9419c 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba/TDR.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba/TDR.pm @@ -60,7 +60,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 = @{$e->{ARRAY_LEN}}[0]; + my $len = ParseExpr(@{$e->{ARRAY_LEN}}[0], $env); if ($len eq "*") { $len = "-1"; } pidl "TDR_CHECK(tdr_$t\_charset(tdr$name, &v->$e->{NAME}, $len, sizeof($e->{TYPE}_t), CH_$e->{PROPERTIES}->{charset}));"; return; @@ -112,6 +112,7 @@ sub ParserStruct($$$$) } my %env = map { $_->{NAME} => "v->$_->{NAME}" } @{$e->{ELEMENTS}}; + $env{"this"} = "v"; ParserElement($_, $t, \%env) foreach (@{$e->{ELEMENTS}}); if ($t eq "print") { @@ -215,6 +216,7 @@ sub Parser($$) pidl "/* autogenerated by pidl */"; pidl "#include \"includes.h\""; pidl "#include \"$hdrname\""; + pidl ""; foreach (@$idl) { ParserInterface($_) if ($_->{TYPE} eq "INTERFACE"); } return $ret; } @@ -226,8 +228,6 @@ sub HeaderInterface($$) pidl "#ifndef __TDR_$x->{NAME}_HEADER__"; pidl "#define __TDR_$x->{NAME}_HEADER__"; - pidl "#include \"$outputdir/$x->{NAME}.h\""; - foreach my $e (@{$x->{DATA}}) { next unless ($e->{TYPE} eq "TYPEDEF"); next unless has_property($e, "public"); @@ -251,11 +251,14 @@ sub HeaderInterface($$) pidl "#endif /* __TDR_$x->{NAME}_HEADER__ */"; } -sub Header($$) +sub Header($$$) { - my ($idl,$outputdir) = @_; + my ($idl,$outputdir,$basename) = @_; $ret = ""; pidl "/* Generated by pidl */"; + + pidl "#include \"$outputdir/$basename.h\""; + pidl ""; foreach (@$idl) { HeaderInterface($_, $outputdir) if ($_->{TYPE} eq "INTERFACE"); |