Author: jelmer
Date: 2005-09-03 17:16:18 +0000 (Sat, 03 Sep 2005)
New Revision: 10006

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=10006

Log:
Insert correct header file.

Modified:
   branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba/TDR.pm
   branches/SAMBA_4_0/source/pidl/pidl


Changeset:
Modified: branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba/TDR.pm
===================================================================
--- branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba/TDR.pm  2005-09-03 
16:58:44 UTC (rev 10005)
+++ branches/SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba/TDR.pm  2005-09-03 
17:16:18 UTC (rev 10006)
@@ -60,7 +60,7 @@
        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 @@
        }
 
        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 @@
        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 @@
        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 @@
        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"); 

Modified: branches/SAMBA_4_0/source/pidl/pidl
===================================================================
--- branches/SAMBA_4_0/source/pidl/pidl 2005-09-03 16:58:44 UTC (rev 10005)
+++ branches/SAMBA_4_0/source/pidl/pidl 2005-09-03 17:16:18 UTC (rev 10006)
@@ -339,7 +339,7 @@
 
        if (defined($opt_tdr_header)) {
                require Parse::Pidl::Samba::TDR;
-               FileSave($tdr_header, Parse::Pidl::Samba::TDR::Header($pidl, 
$outputdir));
+               FileSave($tdr_header, Parse::Pidl::Samba::TDR::Header($pidl, 
$outputdir,$basename));
        }
 
        if ($opt_template) {

Reply via email to