Import types from other Python mechanisms using the Python import mechanism, to ensur...
[tprouty/samba.git] / pidl / lib / Parse / Pidl / Typelist.pm
index c5c458ac6b9cc1b8f99a6ed14cbf788539513c76..0e3fd8de444c3988c04e365f6bc2d1f4e49439a2 100644 (file)
@@ -177,6 +177,7 @@ sub RegisterScalars()
                addType({
                        NAME => $_,
                        TYPE => "TYPEDEF",
+                       BASEFILE => "<builtin>",
                        DATA => {
                                TYPE => "SCALAR",
                                NAME => $_
@@ -266,9 +267,10 @@ sub mapTypeName($)
        return mapType($dt, $dt->{NAME});
 }
 
-sub LoadIdl($)
+sub LoadIdl($;$)
 {
-       my ($idl) = @_;
+       my $idl = shift;
+       my $basename = shift;
 
        foreach my $x (@{$idl}) {
                next if $x->{TYPE} ne "INTERFACE";
@@ -277,16 +279,19 @@ sub LoadIdl($)
                addType({
                        NAME => $x->{NAME},
                        TYPE => "TYPEDEF",
-                       DATA => $x
+                       DATA => $x,
+                       BASEFILE => $basename,
                        }) if (has_property($x, "object"));
 
                foreach my $y (@{$x->{DATA}}) {
-                       addType($y) if (
-                               $y->{TYPE} eq "TYPEDEF" 
-                                or $y->{TYPE} eq "UNION"
-                                or $y->{TYPE} eq "STRUCT"
-                        or $y->{TYPE} eq "ENUM"
-                        or $y->{TYPE} eq "BITMAP");
+                       if ($y->{TYPE} eq "TYPEDEF" 
+                               or $y->{TYPE} eq "UNION"
+                               or $y->{TYPE} eq "STRUCT"
+                       or $y->{TYPE} eq "ENUM"
+                       or $y->{TYPE} eq "BITMAP") {
+                               $y->{BASEFILE} = $basename;
+                               addType($y);
+                       }
                }
        }
 }