1 ###################################################
2 # Samba4 NDR info tree generator
3 # Copyright tridge@samba.org 2000-2003
4 # Copyright tpot@samba.org 2001
5 # Copyright jelmer@samba.org 2004-2006
6 # released under the GNU GPL
12 Parse::Pidl::NDR - NDR parsing information generator
16 Return a table describing the order in which the parts of an element
27 Jelmer Vernooij <jelmer@samba.org>
31 package Parse::Pidl::NDR;
34 use vars qw($VERSION);
37 @EXPORT = qw(GetPrevLevel GetNextLevel ContainsDeferred ContainsString);
38 @EXPORT_OK = qw(GetElementLevelTable ParseElement ValidElement);
41 use Parse::Pidl qw(warning fatal);
42 use Parse::Pidl::Typelist qw(hasType getType expandAlias);
43 use Parse::Pidl::Util qw(has_property property_matches);
45 # Alignment of the built-in scalar types
46 my $scalar_alignment = {
62 'string_array' => 4, #???
71 'wrepl_nbt_name' => 4,
75 sub GetElementLevelTable($)
81 my @bracket_array = ();
86 if (has_property($e, "size_is")) {
87 @size_is = split /,/, has_property($e, "size_is");
90 if (has_property($e, "length_is")) {
91 @length_is = split /,/, has_property($e, "length_is");
94 if (defined($e->{ARRAY_LEN})) {
95 @bracket_array = @{$e->{ARRAY_LEN}};
98 if (has_property($e, "out")) {
101 if (has_property($e, "string")) { $needptrs++; }
102 if ($#bracket_array >= 0) { $needptrs = 0; }
104 warning($e, "[out] argument `$e->{NAME}' not a pointer") if ($needptrs > $e->{POINTERS});
107 # Parse the [][][][] style array stuff
108 for my $i (0 .. $#bracket_array) {
109 my $d = $bracket_array[$#bracket_array - $i];
112 my $is_surrounding = 0;
114 my $is_conformant = 0;
119 if ($size = shift @size_is) {
120 } elsif ((scalar(@size_is) == 0) and has_property($e, "string")) {
122 delete($e->{PROPERTIES}->{string});
124 fatal($e, "Must specify size_is() for conformant array!")
127 if (($length = shift @length_is) or $is_string) {
133 if ($e == $e->{PARENT}->{ELEMENTS}[-1]
134 and $e->{PARENT}->{TYPE} ne "FUNCTION") {
142 LENGTH_IS => $length,
143 IS_DEFERRED => "$is_deferred",
144 IS_SURROUNDING => "$is_surrounding",
145 IS_ZERO_TERMINATED => "$is_string",
146 IS_VARYING => "$is_varying",
147 IS_CONFORMANT => "$is_conformant",
148 IS_FIXED => (not $is_conformant and Parse::Pidl::Util::is_constant($size)),
149 IS_INLINE => (not $is_conformant and not Parse::Pidl::Util::is_constant($size))
153 # Next, all the pointers
154 foreach my $i (1..$e->{POINTERS}) {
155 my $pt = pointer_type($e);
157 my $level = "EMBEDDED";
158 # Top level "ref" pointers do not have a referrent identifier
159 $level = "TOP" if ( defined($pt)
161 and $e->{PARENT}->{TYPE} eq "FUNCTION");
165 # for now, there can only be one pointer type per element
166 POINTER_TYPE => pointer_type($e),
167 POINTER_INDEX => $pointer_idx,
168 IS_DEFERRED => "$is_deferred",
172 warning($e, "top-level \[out\] pointer `$e->{NAME}' is not a \[ref\] pointer")
173 if ($i == 1 and pointer_type($e) ne "ref" and
174 $e->{PARENT}->{TYPE} eq "FUNCTION" and
175 not has_property($e, "in"));
179 # everything that follows will be deferred
180 $is_deferred = 1 if ($e->{PARENT}->{TYPE} ne "FUNCTION");
182 my $array_size = shift @size_is;
189 if ($array_length = shift @length_is) {
192 $array_length = $array_size;
197 if (scalar(@size_is) == 0 and has_property($e, "string") and
198 $i == $e->{POINTERS}) {
200 $is_varying = $is_conformant = has_property($e, "noheader")?0:1;
201 delete($e->{PROPERTIES}->{string});
204 if ($array_size or $is_string) {
207 IS_ZERO_TERMINATED => "$is_string",
208 SIZE_IS => $array_size,
209 LENGTH_IS => $array_length,
210 IS_DEFERRED => "$is_deferred",
212 IS_VARYING => "$is_varying",
213 IS_CONFORMANT => "$is_conformant",
222 if (defined(has_property($e, "subcontext"))) {
223 my $hdr_size = has_property($e, "subcontext");
224 my $subsize = has_property($e, "subcontext_size");
225 if (not defined($subsize)) {
230 TYPE => "SUBCONTEXT",
231 HEADER_SIZE => $hdr_size,
232 SUBCONTEXT_SIZE => $subsize,
233 IS_DEFERRED => $is_deferred,
234 COMPRESSION => has_property($e, "compression"),
238 if (my $switch = has_property($e, "switch_is")) {
241 SWITCH_IS => $switch,
242 IS_DEFERRED => $is_deferred
246 if (scalar(@size_is) > 0) {
247 warning($e, "size_is() on non-array element");
250 if (scalar(@length_is) > 0) {
251 warning($e, "length_is() on non-array element");
254 if (has_property($e, "string")) {
255 warning($e, "string() attribute on non-array element");
260 CONVERT_TO => has_property($e, ""),
261 CONVERT_FROM => has_property($e, ""),
262 DATA_TYPE => $e->{TYPE},
263 IS_DEFERRED => $is_deferred,
264 CONTAINS_DEFERRED => can_contain_deferred($e),
265 IS_SURROUNDING => 0 #FIXME
269 foreach (@$order) { $_->{LEVEL_INDEX} = $i; $i+=1; }
274 #####################################################################
275 # see if a type contains any deferred data
276 sub can_contain_deferred
280 return 0 if (Parse::Pidl::Typelist::is_scalar($e->{TYPE}));
281 return 1 unless (hasType($e->{TYPE})); # assume the worst
283 my $type = getType($e->{TYPE});
285 foreach my $x (@{$type->{DATA}->{ELEMENTS}}) {
286 return 1 if ($x->{POINTERS});
287 return 1 if (can_contain_deferred ($x));
297 return undef unless $e->{POINTERS};
299 return "ref" if (has_property($e, "ref"));
300 return "full" if (has_property($e, "ptr"));
301 return "sptr" if (has_property($e, "sptr"));
302 return "unique" if (has_property($e, "unique"));
303 return "relative" if (has_property($e, "relative"));
304 return "ignore" if (has_property($e, "ignore"));
309 #####################################################################
310 # work out the correct alignment for a structure or union
311 sub find_largest_alignment($)
316 for my $e (@{$s->{ELEMENTS}}) {
319 if ($e->{POINTERS}) {
321 } elsif (has_property($e, "subcontext")) {
323 } elsif (has_property($e, "transmit_as")) {
324 $a = align_type($e->{PROPERTIES}->{transmit_as});
326 $a = align_type($e->{TYPE});
329 $align = $a if ($align < $a);
335 #####################################################################
342 unless (hasType($e)) {
343 # it must be an external type - all we can do is guess
344 # print "Warning: assuming alignment of unknown type '$e' is 4\n";
348 my $dt = getType($e)->{DATA};
350 if ($dt->{TYPE} eq "ENUM") {
351 return align_type(Parse::Pidl::Typelist::enum_type_fn($dt));
352 } elsif ($dt->{TYPE} eq "BITMAP") {
353 return align_type(Parse::Pidl::Typelist::bitmap_type_fn($dt));
354 } elsif (($dt->{TYPE} eq "STRUCT") or ($dt->{TYPE} eq "UNION")) {
355 return find_largest_alignment($dt);
356 } elsif ($dt->{TYPE} eq "SCALAR") {
357 return $scalar_alignment->{$dt->{NAME}};
360 die("Unknown data type type $dt->{TYPE}");
367 $e->{TYPE} = expandAlias($e->{TYPE});
372 PROPERTIES => $e->{PROPERTIES},
373 LEVELS => GetElementLevelTable($e),
374 REPRESENTATION_TYPE => $e->{PROPERTIES}->{represent_as},
375 ALIGN => align_type($e->{TYPE}),
382 my ($ndr,$struct) = @_;
384 my $surrounding = undef;
386 foreach my $x (@{$struct->{ELEMENTS}})
388 my $e = ParseElement($x);
389 if ($x != $struct->{ELEMENTS}[-1] and
390 $e->{LEVELS}[0]->{IS_SURROUNDING}) {
391 print "$x->{FILE}:$x->{LINE}: error: conformant member not at end of struct\n";
396 my $e = $elements[-1];
397 if (defined($e) and defined($e->{LEVELS}[0]->{IS_SURROUNDING}) and
398 $e->{LEVELS}[0]->{IS_SURROUNDING}) {
402 if (defined $e->{TYPE} && $e->{TYPE} eq "string"
403 && property_matches($e, "flag", ".*LIBNDR_FLAG_STR_CONFORMANT.*")) {
404 $surrounding = $struct->{ELEMENTS}[-1];
409 SURROUNDING_ELEMENT => $surrounding,
410 ELEMENTS => \@elements,
411 PROPERTIES => $struct->{PROPERTIES},
420 my $switch_type = has_property($e, "switch_type");
421 unless (defined($switch_type)) { $switch_type = "uint32"; }
423 if (has_property($e, "nodiscriminant")) { $switch_type = undef; }
426 foreach my $x (@{$e->{ELEMENTS}})
429 if ($x->{TYPE} eq "EMPTY") {
430 $t = { TYPE => "EMPTY" };
432 $t = ParseElement($x);
434 if (has_property($x, "default")) {
435 $t->{CASE} = "default";
437 } elsif (defined($x->{PROPERTIES}->{case})) {
438 $t->{CASE} = "case $x->{PROPERTIES}->{case}";
440 die("Union element $x->{NAME} has neither default nor case property");
447 SWITCH_TYPE => $switch_type,
448 ELEMENTS => \@elements,
449 PROPERTIES => $e->{PROPERTIES},
450 HAS_DEFAULT => $hasdefault,
461 BASE_TYPE => Parse::Pidl::Typelist::enum_type_fn($e),
462 ELEMENTS => $e->{ELEMENTS},
463 PROPERTIES => $e->{PROPERTIES},
474 BASE_TYPE => Parse::Pidl::Typelist::bitmap_type_fn($e),
475 ELEMENTS => $e->{ELEMENTS},
476 PROPERTIES => $e->{PROPERTIES},
485 if ($d->{TYPE} eq "STRUCT" or $d->{TYPE} eq "UNION") {
486 CheckPointerTypes($d, $ndr->{PROPERTIES}->{pointer_default});
490 STRUCT => \&ParseStruct,
491 UNION => \&ParseUnion,
493 BITMAP => \&ParseBitmap,
494 TYPEDEF => \&ParseTypedef,
495 }->{$d->{TYPE}}->($ndr, $d);
504 if (defined($d->{PROPERTIES}) && !defined($d->{DATA}->{PROPERTIES})) {
505 $d->{DATA}->{PROPERTIES} = $d->{PROPERTIES};
508 my $data = ParseType($ndr, $d->{DATA});
509 $data->{ALIGN} = align_type($d->{NAME});
514 PROPERTIES => $d->{PROPERTIES},
527 sub ParseFunction($$$)
529 my ($ndr,$d,$opnum) = @_;
532 my $thisopnum = undef;
534 CheckPointerTypes($d, $ndr->{PROPERTIES}->{pointer_default_top});
536 if (not defined($d->{PROPERTIES}{noopnum})) {
537 $thisopnum = ${$opnum};
541 foreach my $x (@{$d->{ELEMENTS}}) {
542 my $e = ParseElement($x);
543 push (@{$e->{DIRECTION}}, "in") if (has_property($x, "in"));
544 push (@{$e->{DIRECTION}}, "out") if (has_property($x, "out"));
546 push (@elements, $e);
549 if ($d->{RETURN_TYPE} ne "void") {
550 $rettype = expandAlias($d->{RETURN_TYPE});
554 if (has_property($d, "async")) { $async = 1; }
561 RETURN_TYPE => $rettype,
562 PROPERTIES => $d->{PROPERTIES},
563 ELEMENTS => \@elements,
568 sub CheckPointerTypes($$)
570 my ($s,$default) = @_;
572 foreach my $e (@{$s->{ELEMENTS}}) {
573 if ($e->{POINTERS} and not defined(pointer_type($e))) {
574 $e->{PROPERTIES}->{$default} = 1;
579 sub ParseInterface($)
590 if (not has_property($idl, "pointer_default")) {
591 # MIDL defaults to "ptr" in DCE compatible mode (/osf)
592 # and "unique" in Microsoft Extensions mode (default)
593 $idl->{PROPERTIES}->{pointer_default} = "unique";
596 if (not has_property($idl, "pointer_default_top")) {
597 $idl->{PROPERTIES}->{pointer_default_top} = "ref";
599 warning($idl, "pointer_default_top() is a pidl extension and should not be used");
602 foreach my $d (@{$idl->{DATA}}) {
603 if ($d->{TYPE} eq "DECLARE") {
604 push (@declares, $d);
605 } elsif ($d->{TYPE} eq "FUNCTION") {
606 push (@functions, ParseFunction($idl, $d, \$opnum));
607 } elsif ($d->{TYPE} eq "CONST") {
608 push (@consts, ParseConst($idl, $d));
610 push (@types, ParseType($idl, $d));
616 if(defined $idl->{PROPERTIES}->{version}) {
617 $version = $idl->{PROPERTIES}->{version};
620 # If no endpoint is set, default to the interface name as a named pipe
621 if (!defined $idl->{PROPERTIES}->{endpoint}) {
622 push @endpoints, "\"ncacn_np:[\\\\pipe\\\\" . $idl->{NAME} . "]\"";
624 @endpoints = split / /, $idl->{PROPERTIES}->{endpoint};
628 NAME => $idl->{NAME},
629 UUID => lc(has_property($idl, "uuid")),
632 PROPERTIES => $idl->{PROPERTIES},
633 FUNCTIONS => \@functions,
636 DECLARES => \@declares,
637 ENDPOINTS => \@endpoints
641 # Convert a IDL tree to a NDR tree
642 # Gives a result tree describing all that's necessary for easily generating
643 # NDR parsers / generators
648 return undef unless (defined($idl));
650 Parse::Pidl::NDR::Validate($idl);
655 ($_->{TYPE} eq "INTERFACE") && push(@ndr, ParseInterface($_));
656 ($_->{TYPE} eq "IMPORT") && push(@ndr, $_);
669 foreach my $l (@{$e->{LEVELS}}) {
670 return $l if ($seen);
671 ($seen = 1) if ($l == $fl);
682 foreach my $l (@{$e->{LEVELS}}) {
683 (return $prev) if ($l == $fl);
690 sub ContainsString($)
694 foreach my $l (@{$e->{LEVELS}}) {
695 return 1 if ($l->{TYPE} eq "ARRAY" and $l->{IS_ZERO_TERMINATED});
701 sub ContainsDeferred($$)
705 return 1 if ($l->{CONTAINS_DEFERRED});
707 while ($l = GetNextLevel($e,$l))
709 return 1 if ($l->{IS_DEFERRED});
710 return 1 if ($l->{CONTAINS_DEFERRED});
720 if ($e->{PARENT} && $e->{PARENT}->{NAME}) {
721 return "$e->{PARENT}->{NAME}.$e->{NAME}";
724 if ($e->{PARENT} && $e->{PARENT}->{PARENT}->{NAME}) {
725 return "$e->{PARENT}->{PARENT}->{NAME}.$e->{NAME}";
729 return "$e->{PARENT}->{NAME}.$e->{NAME}";
735 ###################################
736 # find a sibling var in a structure
740 my($fn) = $e->{PARENT};
742 if ($name =~ /\*(.*)/) {
746 for my $e2 (@{$fn->{ELEMENTS}}) {
747 return $e2 if ($e2->{NAME} eq $name);
753 my %property_list = (
755 "helpstring" => ["INTERFACE", "FUNCTION"],
756 "version" => ["INTERFACE"],
757 "uuid" => ["INTERFACE"],
758 "endpoint" => ["INTERFACE"],
759 "pointer_default" => ["INTERFACE"],
760 "pointer_default_top" => ["INTERFACE"],
761 "helper" => ["INTERFACE"],
762 "authservice" => ["INTERFACE"],
765 "object" => ["INTERFACE"],
766 "local" => ["INTERFACE", "FUNCTION"],
767 "iid_is" => ["ELEMENT"],
768 "call_as" => ["FUNCTION"],
769 "idempotent" => ["FUNCTION"],
772 "noopnum" => ["FUNCTION"],
774 "out" => ["ELEMENT"],
775 "async" => ["FUNCTION"],
778 "ref" => ["ELEMENT"],
779 "ptr" => ["ELEMENT"],
780 "unique" => ["ELEMENT"],
781 "ignore" => ["ELEMENT"],
782 "relative" => ["ELEMENT"],
783 "relative_base" => ["TYPEDEF"],
785 "gensize" => ["TYPEDEF"],
786 "value" => ["ELEMENT"],
787 "flag" => ["ELEMENT", "TYPEDEF"],
790 "public" => ["FUNCTION", "TYPEDEF"],
791 "nopush" => ["FUNCTION", "TYPEDEF"],
792 "nopull" => ["FUNCTION", "TYPEDEF"],
793 "nosize" => ["FUNCTION", "TYPEDEF"],
794 "noprint" => ["FUNCTION", "TYPEDEF"],
795 "noejs" => ["FUNCTION", "TYPEDEF"],
798 "switch_is" => ["ELEMENT"],
799 "switch_type" => ["ELEMENT", "TYPEDEF"],
800 "nodiscriminant" => ["TYPEDEF"],
801 "case" => ["ELEMENT"],
802 "default" => ["ELEMENT"],
804 "represent_as" => ["ELEMENT"],
805 "transmit_as" => ["ELEMENT"],
808 "subcontext" => ["ELEMENT"],
809 "subcontext_size" => ["ELEMENT"],
810 "compression" => ["ELEMENT"],
813 "enum8bit" => ["TYPEDEF"],
814 "enum16bit" => ["TYPEDEF"],
815 "v1_enum" => ["TYPEDEF"],
818 "bitmap8bit" => ["TYPEDEF"],
819 "bitmap16bit" => ["TYPEDEF"],
820 "bitmap32bit" => ["TYPEDEF"],
821 "bitmap64bit" => ["TYPEDEF"],
824 "range" => ["ELEMENT"],
825 "size_is" => ["ELEMENT"],
826 "string" => ["ELEMENT"],
827 "noheader" => ["ELEMENT"],
828 "charset" => ["ELEMENT"],
829 "length_is" => ["ELEMENT"],
832 #####################################################################
833 # check for unknown properties
834 sub ValidProperties($$)
838 return unless defined $e->{PROPERTIES};
840 foreach my $key (keys %{$e->{PROPERTIES}}) {
841 warning($e, el_name($e) . ": unknown property '$key'")
842 unless defined($property_list{$key});
844 fatal($e, el_name($e) . ": property '$key' not allowed on '$t'")
845 unless grep($t, @{$property_list{$key}});
852 my $ti = getType($t);
854 if (not defined ($ti)) {
856 } elsif ($ti->{DATA}->{TYPE} eq "ENUM") {
857 return Parse::Pidl::Typelist::enum_type_fn($ti->{DATA});
858 } elsif ($ti->{DATA}->{TYPE} eq "BITMAP") {
859 return Parse::Pidl::Typelist::enum_type_fn($ti->{DATA});
860 } elsif ($ti->{DATA}->{TYPE} eq "SCALAR") {
867 #####################################################################
873 ValidProperties($e,"ELEMENT");
875 # Check whether switches are used correctly.
876 if (my $switch = has_property($e, "switch_is")) {
877 my $e2 = find_sibling($e, $switch);
878 my $type = getType($e->{TYPE});
880 if (defined($type) and $type->{DATA}->{TYPE} ne "UNION") {
881 fatal($e, el_name($e) . ": switch_is() used on non-union type $e->{TYPE} which is a $type->{DATA}->{TYPE}");
884 if (!has_property($type, "nodiscriminant") and defined($e2)) {
885 my $discriminator_type = has_property($type, "switch_type");
886 $discriminator_type = "uint32" unless defined ($discriminator_type);
888 my $t1 = mapToScalar($discriminator_type);
890 if (not defined($t1)) {
891 fatal($e, el_name($e) . ": unable to map discriminator type '$discriminator_type' to scalar");
894 my $t2 = mapToScalar($e2->{TYPE});
895 if (not defined($t2)) {
896 fatal($e, el_name($e) . ": unable to map variable used for switch_is() to scalar");
900 warning($e, el_name($e) . ": switch_is() is of type $e2->{TYPE} ($t2), while discriminator type for union $type->{NAME} is $discriminator_type ($t1)");
905 if (has_property($e, "subcontext") and has_property($e, "represent_as")) {
906 fatal($e, el_name($e) . " : subcontext() and represent_as() can not be used on the same element");
909 if (has_property($e, "subcontext") and has_property($e, "transmit_as")) {
910 fatal($e, el_name($e) . " : subcontext() and transmit_as() can not be used on the same element");
913 if (has_property($e, "represent_as") and has_property($e, "transmit_as")) {
914 fatal($e, el_name($e) . " : represent_as() and transmit_as() can not be used on the same element");
917 if (has_property($e, "represent_as") and has_property($e, "value")) {
918 fatal($e, el_name($e) . " : represent_as() and value() can not be used on the same element");
921 if (has_property($e, "subcontext")) {
922 warning($e, "subcontext() is deprecated. Use represent_as() or transmit_as() instead");
925 if (defined (has_property($e, "subcontext_size")) and not defined(has_property($e, "subcontext"))) {
926 fatal($e, el_name($e) . " : subcontext_size() on non-subcontext element");
929 if (defined (has_property($e, "compression")) and not defined(has_property($e, "subcontext"))) {
930 fatal($e, el_name($e) . " : compression() on non-subcontext element");
933 if (!$e->{POINTERS} && (
934 has_property($e, "ptr") or
935 has_property($e, "unique") or
936 has_property($e, "relative") or
937 has_property($e, "ref"))) {
938 fatal($e, el_name($e) . " : pointer properties on non-pointer element\n");
942 #####################################################################
948 ValidProperties($struct,"STRUCT");
950 foreach my $e (@{$struct->{ELEMENTS}}) {
951 $e->{PARENT} = $struct;
956 #####################################################################
962 ValidProperties($union,"UNION");
964 if (has_property($union->{PARENT}, "nodiscriminant") and has_property($union->{PARENT}, "switch_type")) {
965 fatal($union->{PARENT}, $union->{PARENT}->{NAME} . ": switch_type() on union without discriminant");
968 foreach my $e (@{$union->{ELEMENTS}}) {
969 $e->{PARENT} = $union;
971 if (defined($e->{PROPERTIES}->{default}) and
972 defined($e->{PROPERTIES}->{case})) {
973 fatal($e, "Union member $e->{NAME} can not have both default and case properties!");
976 unless (defined ($e->{PROPERTIES}->{default}) or
977 defined ($e->{PROPERTIES}->{case})) {
978 fatal($e, "Union member $e->{NAME} must have default or case property");
981 if (has_property($e, "ref")) {
982 fatal($e, el_name($e) . " : embedded ref pointers are not supported yet\n");
990 #####################################################################
994 my($typedef) = shift;
995 my $data = $typedef->{DATA};
997 ValidProperties($typedef,"TYPEDEF");
999 $data->{PARENT} = $typedef;
1001 if (ref($data) eq "HASH") {
1002 if ($data->{TYPE} eq "STRUCT") {
1006 if ($data->{TYPE} eq "UNION") {
1012 #####################################################################
1014 sub ValidFunction($)
1018 ValidProperties($fn,"FUNCTION");
1020 foreach my $e (@{$fn->{ELEMENTS}}) {
1022 if (has_property($e, "ref") && !$e->{POINTERS}) {
1023 fatal($e, "[ref] variables must be pointers ($fn->{NAME}/$e->{NAME})");
1029 #####################################################################
1030 # parse the interface definitions
1031 sub ValidInterface($)
1033 my($interface) = shift;
1034 my($data) = $interface->{DATA};
1036 if (has_property($interface, "helper")) {
1037 warning($interface, "helper() is pidl-specific and deprecated. Use `include' instead");
1040 ValidProperties($interface,"INTERFACE");
1042 if (has_property($interface, "pointer_default")) {
1043 if (not grep (/$interface->{PROPERTIES}->{pointer_default}/,
1044 ("ref", "unique", "ptr"))) {
1045 fatal($interface, "Unknown default pointer type `$interface->{PROPERTIES}->{pointer_default}'");
1049 if (has_property($interface, "object")) {
1050 if (has_property($interface, "version") &&
1051 $interface->{PROPERTIES}->{version} != 0) {
1052 fatal($interface, "Object interfaces must have version 0.0 ($interface->{NAME})");
1055 if (!defined($interface->{BASE}) &&
1056 not ($interface->{NAME} eq "IUnknown")) {
1057 fatal($interface, "Object interfaces must all derive from IUnknown ($interface->{NAME})");
1061 foreach my $d (@{$data}) {
1062 ($d->{TYPE} eq "TYPEDEF") &&
1064 ($d->{TYPE} eq "FUNCTION") &&
1070 #####################################################################
1071 # Validate an IDL structure
1076 foreach my $x (@{$idl}) {
1077 ($x->{TYPE} eq "INTERFACE") &&
1079 ($x->{TYPE} eq "IMPORTLIB") &&
1080 warning($x, "importlib() not supported");