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);
40 use Parse::Pidl::Typelist qw(hasType getType expandAlias);
41 use Parse::Pidl::Util qw(has_property property_matches);
43 # Alignment of the built-in scalar types
44 my $scalar_alignment = {
60 'string_array' => 4, #???
69 'wrepl_nbt_name' => 4,
76 warn ("$e->{FILE}:$e->{LINE}: warning: $s\n");
79 #####################################################################
80 # signal a fatal validation error
84 die("$pos->{FILE}:$pos->{LINE}:$s\n");
87 sub GetElementLevelTable($)
93 my @bracket_array = ();
98 if (has_property($e, "size_is")) {
99 @size_is = split /,/, has_property($e, "size_is");
102 if (has_property($e, "length_is")) {
103 @length_is = split /,/, has_property($e, "length_is");
106 if (defined($e->{ARRAY_LEN})) {
107 @bracket_array = @{$e->{ARRAY_LEN}};
110 if (has_property($e, "out")) {
113 if (has_property($e, "string")) { $needptrs++; }
114 if ($#bracket_array >= 0) { $needptrs = 0; }
116 nonfatal($e, "[out] argument `$e->{NAME}' not a pointer") if ($needptrs > $e->{POINTERS});
119 # Parse the [][][][] style array stuff
120 for my $i (0 .. $#bracket_array) {
121 my $d = $bracket_array[$#bracket_array - $i];
124 my $is_surrounding = 0;
126 my $is_conformant = 0;
131 if ($size = shift @size_is) {
132 } elsif ((scalar(@size_is) == 0) and has_property($e, "string")) {
134 delete($e->{PROPERTIES}->{string});
136 fatal($e, "Must specify size_is() for conformant array!")
139 if (($length = shift @length_is) or $is_string) {
145 if ($e == $e->{PARENT}->{ELEMENTS}[-1]
146 and $e->{PARENT}->{TYPE} ne "FUNCTION") {
154 LENGTH_IS => $length,
155 IS_DEFERRED => "$is_deferred",
156 IS_SURROUNDING => "$is_surrounding",
157 IS_ZERO_TERMINATED => "$is_string",
158 IS_VARYING => "$is_varying",
159 IS_CONFORMANT => "$is_conformant",
160 IS_FIXED => (not $is_conformant and Parse::Pidl::Util::is_constant($size)),
161 IS_INLINE => (not $is_conformant and not Parse::Pidl::Util::is_constant($size))
165 # Next, all the pointers
166 foreach my $i (1..$e->{POINTERS}) {
167 my $pt = pointer_type($e);
169 my $level = "EMBEDDED";
170 # Top level "ref" pointers do not have a referrent identifier
171 $level = "TOP" if ( defined($pt)
173 and $e->{PARENT}->{TYPE} eq "FUNCTION");
177 # for now, there can only be one pointer type per element
178 POINTER_TYPE => pointer_type($e),
179 POINTER_INDEX => $pointer_idx,
180 IS_DEFERRED => "$is_deferred",
184 nonfatal($e, "top-level pointer `$e->{NAME}' is not a \[ref\] pointer")
185 if ($i == 1 and pointer_type($e) ne "ref" and
186 $e->{PARENT}->{TYPE} eq "FUNCTION");
190 # everything that follows will be deferred
191 $is_deferred = 1 if ($e->{PARENT}->{TYPE} ne "FUNCTION");
193 my $array_size = shift @size_is;
200 if ($array_length = shift @length_is) {
203 $array_length = $array_size;
208 if (scalar(@size_is) == 0 and has_property($e, "string") and
209 $i == $e->{POINTERS}) {
211 $is_varying = $is_conformant = has_property($e, "noheader")?0:1;
212 delete($e->{PROPERTIES}->{string});
215 if ($array_size or $is_string) {
218 IS_ZERO_TERMINATED => "$is_string",
219 SIZE_IS => $array_size,
220 LENGTH_IS => $array_length,
221 IS_DEFERRED => "$is_deferred",
223 IS_VARYING => "$is_varying",
224 IS_CONFORMANT => "$is_conformant",
233 if (defined(has_property($e, "subcontext"))) {
234 my $hdr_size = has_property($e, "subcontext");
235 my $subsize = has_property($e, "subcontext_size");
236 if (not defined($subsize)) {
241 TYPE => "SUBCONTEXT",
242 HEADER_SIZE => $hdr_size,
243 SUBCONTEXT_SIZE => $subsize,
244 IS_DEFERRED => $is_deferred,
245 COMPRESSION => has_property($e, "compression"),
249 if (my $switch = has_property($e, "switch_is")) {
252 SWITCH_IS => $switch,
253 IS_DEFERRED => $is_deferred
257 if (scalar(@size_is) > 0) {
258 nonfatal($e, "size_is() on non-array element");
261 if (scalar(@length_is) > 0) {
262 nonfatal($e, "length_is() on non-array element");
265 if (has_property($e, "string")) {
266 nonfatal($e, "string() attribute on non-array element");
271 CONVERT_TO => has_property($e, ""),
272 CONVERT_FROM => has_property($e, ""),
273 DATA_TYPE => $e->{TYPE},
274 IS_DEFERRED => $is_deferred,
275 CONTAINS_DEFERRED => can_contain_deferred($e),
276 IS_SURROUNDING => 0 #FIXME
280 foreach (@$order) { $_->{LEVEL_INDEX} = $i; $i+=1; }
285 #####################################################################
286 # see if a type contains any deferred data
287 sub can_contain_deferred
291 return 0 if (Parse::Pidl::Typelist::is_scalar($e->{TYPE}));
292 return 1 unless (hasType($e->{TYPE})); # assume the worst
294 my $type = getType($e->{TYPE});
296 foreach my $x (@{$type->{DATA}->{ELEMENTS}}) {
297 return 1 if ($x->{POINTERS});
298 return 1 if (can_contain_deferred ($x));
308 return undef unless $e->{POINTERS};
310 return "ref" if (has_property($e, "ref"));
311 return "ptr" if (has_property($e, "ptr"));
312 return "sptr" if (has_property($e, "sptr"));
313 return "unique" if (has_property($e, "unique"));
314 return "relative" if (has_property($e, "relative"));
315 return "ignore" if (has_property($e, "ignore"));
320 #####################################################################
321 # work out the correct alignment for a structure or union
322 sub find_largest_alignment($)
327 for my $e (@{$s->{ELEMENTS}}) {
330 if ($e->{POINTERS}) {
332 } elsif (has_property($e, "subcontext")) {
334 } elsif (has_property($e, "transmit_as")) {
335 $a = align_type($e->{PROPERTIES}->{transmit_as});
337 $a = align_type($e->{TYPE});
340 $align = $a if ($align < $a);
346 #####################################################################
353 unless (hasType($e)) {
354 # it must be an external type - all we can do is guess
355 # print "Warning: assuming alignment of unknown type '$e' is 4\n";
359 my $dt = getType($e)->{DATA};
361 if ($dt->{TYPE} eq "ENUM") {
362 return align_type(Parse::Pidl::Typelist::enum_type_fn($dt));
363 } elsif ($dt->{TYPE} eq "BITMAP") {
364 return align_type(Parse::Pidl::Typelist::bitmap_type_fn($dt));
365 } elsif (($dt->{TYPE} eq "STRUCT") or ($dt->{TYPE} eq "UNION")) {
366 return find_largest_alignment($dt);
367 } elsif ($dt->{TYPE} eq "SCALAR") {
368 return $scalar_alignment->{$dt->{NAME}};
371 die("Unknown data type type $dt->{TYPE}");
378 $e->{TYPE} = expandAlias($e->{TYPE});
383 PROPERTIES => $e->{PROPERTIES},
384 LEVELS => GetElementLevelTable($e),
385 REPRESENTATION_TYPE => $e->{PROPERTIES}->{represent_as},
386 ALIGN => align_type($e->{TYPE}),
393 my ($ndr,$struct) = @_;
395 my $surrounding = undef;
397 foreach my $x (@{$struct->{ELEMENTS}})
399 my $e = ParseElement($x);
400 if ($x != $struct->{ELEMENTS}[-1] and
401 $e->{LEVELS}[0]->{IS_SURROUNDING}) {
402 print "$x->{FILE}:$x->{LINE}: error: conformant member not at end of struct\n";
407 my $e = $elements[-1];
408 if (defined($e) and defined($e->{LEVELS}[0]->{IS_SURROUNDING}) and
409 $e->{LEVELS}[0]->{IS_SURROUNDING}) {
413 if (defined $e->{TYPE} && $e->{TYPE} eq "string"
414 && property_matches($e, "flag", ".*LIBNDR_FLAG_STR_CONFORMANT.*")) {
415 $surrounding = $struct->{ELEMENTS}[-1];
420 SURROUNDING_ELEMENT => $surrounding,
421 ELEMENTS => \@elements,
422 PROPERTIES => $struct->{PROPERTIES},
431 my $switch_type = has_property($e, "switch_type");
432 unless (defined($switch_type)) { $switch_type = "uint32"; }
434 if (has_property($e, "nodiscriminant")) { $switch_type = undef; }
437 foreach my $x (@{$e->{ELEMENTS}})
440 if ($x->{TYPE} eq "EMPTY") {
441 $t = { TYPE => "EMPTY" };
443 $t = ParseElement($x);
445 if (has_property($x, "default")) {
446 $t->{CASE} = "default";
448 } elsif (defined($x->{PROPERTIES}->{case})) {
449 $t->{CASE} = "case $x->{PROPERTIES}->{case}";
451 die("Union element $x->{NAME} has neither default nor case property");
458 SWITCH_TYPE => $switch_type,
459 ELEMENTS => \@elements,
460 PROPERTIES => $e->{PROPERTIES},
461 HAS_DEFAULT => $hasdefault,
472 BASE_TYPE => Parse::Pidl::Typelist::enum_type_fn($e),
473 ELEMENTS => $e->{ELEMENTS},
474 PROPERTIES => $e->{PROPERTIES},
485 BASE_TYPE => Parse::Pidl::Typelist::bitmap_type_fn($e),
486 ELEMENTS => $e->{ELEMENTS},
487 PROPERTIES => $e->{PROPERTIES},
496 if ($d->{TYPE} eq "STRUCT" or $d->{TYPE} eq "UNION") {
497 CheckPointerTypes($d, $ndr->{PROPERTIES}->{pointer_default});
501 STRUCT => \&ParseStruct,
502 UNION => \&ParseUnion,
504 BITMAP => \&ParseBitmap,
505 TYPEDEF => \&ParseTypedef,
506 }->{$d->{TYPE}}->($ndr, $d);
515 if (defined($d->{PROPERTIES}) && !defined($d->{DATA}->{PROPERTIES})) {
516 $d->{DATA}->{PROPERTIES} = $d->{PROPERTIES};
519 my $data = ParseType($ndr, $d->{DATA});
520 $data->{ALIGN} = align_type($d->{NAME});
525 PROPERTIES => $d->{PROPERTIES},
538 sub ParseFunction($$$)
540 my ($ndr,$d,$opnum) = @_;
543 my $thisopnum = undef;
545 CheckPointerTypes($d, $ndr->{PROPERTIES}->{pointer_default_top});
547 if (not defined($d->{PROPERTIES}{noopnum})) {
548 $thisopnum = ${$opnum};
552 foreach my $x (@{$d->{ELEMENTS}}) {
553 my $e = ParseElement($x);
554 push (@{$e->{DIRECTION}}, "in") if (has_property($x, "in"));
555 push (@{$e->{DIRECTION}}, "out") if (has_property($x, "out"));
557 push (@elements, $e);
560 if ($d->{RETURN_TYPE} ne "void") {
561 $rettype = expandAlias($d->{RETURN_TYPE});
565 if (has_property($d, "async")) { $async = 1; }
572 RETURN_TYPE => $rettype,
573 PROPERTIES => $d->{PROPERTIES},
574 ELEMENTS => \@elements,
579 sub CheckPointerTypes($$)
581 my ($s,$default) = @_;
583 foreach my $e (@{$s->{ELEMENTS}}) {
584 if ($e->{POINTERS} and not defined(pointer_type($e))) {
585 $e->{PROPERTIES}->{$default} = 1;
590 sub ParseInterface($)
601 if (not has_property($idl, "pointer_default")) {
602 # MIDL defaults to "ptr" in DCE compatible mode (/osf)
603 # and "unique" in Microsoft Extensions mode (default)
604 $idl->{PROPERTIES}->{pointer_default} = "unique";
607 if (not has_property($idl, "pointer_default_top")) {
608 $idl->{PROPERTIES}->{pointer_default_top} = "ref";
611 foreach my $d (@{$idl->{DATA}}) {
612 if ($d->{TYPE} eq "DECLARE") {
613 push (@declares, $d);
614 } elsif ($d->{TYPE} eq "FUNCTION") {
615 push (@functions, ParseFunction($idl, $d, \$opnum));
616 } elsif ($d->{TYPE} eq "CONST") {
617 push (@consts, ParseConst($idl, $d));
619 push (@types, ParseType($idl, $d));
625 if(defined $idl->{PROPERTIES}->{version}) {
626 $version = $idl->{PROPERTIES}->{version};
629 # If no endpoint is set, default to the interface name as a named pipe
630 if (!defined $idl->{PROPERTIES}->{endpoint}) {
631 push @endpoints, "\"ncacn_np:[\\\\pipe\\\\" . $idl->{NAME} . "]\"";
633 @endpoints = split / /, $idl->{PROPERTIES}->{endpoint};
637 NAME => $idl->{NAME},
638 UUID => lc(has_property($idl, "uuid")),
641 PROPERTIES => $idl->{PROPERTIES},
642 FUNCTIONS => \@functions,
645 DECLARES => \@declares,
646 ENDPOINTS => \@endpoints
650 # Convert a IDL tree to a NDR tree
651 # Gives a result tree describing all that's necessary for easily generating
652 # NDR parsers / generators
657 return undef unless (defined($idl));
659 Parse::Pidl::NDR::Validate($idl);
664 ($_->{TYPE} eq "INTERFACE") && push(@ndr, ParseInterface($_));
665 ($_->{TYPE} eq "IMPORT") && push(@ndr, $_);
678 foreach my $l (@{$e->{LEVELS}}) {
679 return $l if ($seen);
680 ($seen = 1) if ($l == $fl);
691 foreach my $l (@{$e->{LEVELS}}) {
692 (return $prev) if ($l == $fl);
699 sub ContainsString($)
703 foreach my $l (@{$e->{LEVELS}}) {
704 return 1 if ($l->{TYPE} eq "ARRAY" and $l->{IS_ZERO_TERMINATED});
710 sub ContainsDeferred($$)
714 return 1 if ($l->{CONTAINS_DEFERRED});
716 while ($l = GetNextLevel($e,$l))
718 return 1 if ($l->{IS_DEFERRED});
719 return 1 if ($l->{CONTAINS_DEFERRED});
729 if ($e->{PARENT} && $e->{PARENT}->{NAME}) {
730 return "$e->{PARENT}->{NAME}.$e->{NAME}";
733 if ($e->{PARENT} && $e->{PARENT}->{PARENT}->{NAME}) {
734 return "$e->{PARENT}->{PARENT}->{NAME}.$e->{NAME}";
738 return "$e->{PARENT}->{NAME}.$e->{NAME}";
744 ###################################
745 # find a sibling var in a structure
749 my($fn) = $e->{PARENT};
751 if ($name =~ /\*(.*)/) {
755 for my $e2 (@{$fn->{ELEMENTS}}) {
756 return $e2 if ($e2->{NAME} eq $name);
762 my %property_list = (
764 "helpstring" => ["INTERFACE", "FUNCTION"],
765 "version" => ["INTERFACE"],
766 "uuid" => ["INTERFACE"],
767 "endpoint" => ["INTERFACE"],
768 "pointer_default" => ["INTERFACE"],
769 "pointer_default_top" => ["INTERFACE"],
770 "helper" => ["INTERFACE"],
771 "authservice" => ["INTERFACE"],
774 "object" => ["INTERFACE"],
775 "local" => ["INTERFACE", "FUNCTION"],
776 "iid_is" => ["ELEMENT"],
777 "call_as" => ["FUNCTION"],
778 "idempotent" => ["FUNCTION"],
781 "noopnum" => ["FUNCTION"],
783 "out" => ["ELEMENT"],
784 "async" => ["FUNCTION"],
787 "ref" => ["ELEMENT"],
788 "ptr" => ["ELEMENT"],
789 "sptr" => ["ELEMENT"],
790 "unique" => ["ELEMENT"],
791 "ignore" => ["ELEMENT"],
792 "relative" => ["ELEMENT"],
793 "relative_base" => ["TYPEDEF"],
795 "gensize" => ["TYPEDEF"],
796 "value" => ["ELEMENT"],
797 "flag" => ["ELEMENT", "TYPEDEF"],
800 "public" => ["FUNCTION", "TYPEDEF"],
801 "nopush" => ["FUNCTION", "TYPEDEF"],
802 "nopull" => ["FUNCTION", "TYPEDEF"],
803 "nosize" => ["FUNCTION", "TYPEDEF"],
804 "noprint" => ["FUNCTION", "TYPEDEF"],
805 "noejs" => ["FUNCTION", "TYPEDEF"],
808 "switch_is" => ["ELEMENT"],
809 "switch_type" => ["ELEMENT", "TYPEDEF"],
810 "nodiscriminant" => ["TYPEDEF"],
811 "case" => ["ELEMENT"],
812 "default" => ["ELEMENT"],
814 "represent_as" => ["ELEMENT"],
815 "transmit_as" => ["ELEMENT"],
818 "subcontext" => ["ELEMENT"],
819 "subcontext_size" => ["ELEMENT"],
820 "compression" => ["ELEMENT"],
823 "enum8bit" => ["TYPEDEF"],
824 "enum16bit" => ["TYPEDEF"],
825 "v1_enum" => ["TYPEDEF"],
828 "bitmap8bit" => ["TYPEDEF"],
829 "bitmap16bit" => ["TYPEDEF"],
830 "bitmap32bit" => ["TYPEDEF"],
831 "bitmap64bit" => ["TYPEDEF"],
834 "range" => ["ELEMENT"],
835 "size_is" => ["ELEMENT"],
836 "string" => ["ELEMENT"],
837 "noheader" => ["ELEMENT"],
838 "charset" => ["ELEMENT"],
839 "length_is" => ["ELEMENT"],
842 #####################################################################
843 # check for unknown properties
844 sub ValidProperties($$)
848 return unless defined $e->{PROPERTIES};
850 foreach my $key (keys %{$e->{PROPERTIES}}) {
851 fatal($e, el_name($e) . ": unknown property '$key'\n")
852 unless defined($property_list{$key});
854 fatal($e, el_name($e) . ": property '$key' not allowed on '$t'\n")
855 unless grep($t, @{$property_list{$key}});
862 my $ti = getType($t);
864 if (not defined ($ti)) {
866 } elsif ($ti->{DATA}->{TYPE} eq "ENUM") {
867 return Parse::Pidl::Typelist::enum_type_fn($ti->{DATA});
868 } elsif ($ti->{DATA}->{TYPE} eq "BITMAP") {
869 return Parse::Pidl::Typelist::enum_type_fn($ti->{DATA});
870 } elsif ($ti->{DATA}->{TYPE} eq "SCALAR") {
877 #####################################################################
883 ValidProperties($e,"ELEMENT");
885 if (has_property($e, "ptr")) {
886 fatal($e, el_name($e) . " : pidl does not support full NDR pointers yet\n");
889 # Check whether switches are used correctly.
890 if (my $switch = has_property($e, "switch_is")) {
891 my $e2 = find_sibling($e, $switch);
892 my $type = getType($e->{TYPE});
894 if (defined($type) and $type->{DATA}->{TYPE} ne "UNION") {
895 fatal($e, el_name($e) . ": switch_is() used on non-union type $e->{TYPE} which is a $type->{DATA}->{TYPE}");
898 if (!has_property($type, "nodiscriminant") and defined($e2)) {
899 my $discriminator_type = has_property($type, "switch_type");
900 $discriminator_type = "uint32" unless defined ($discriminator_type);
902 my $t1 = mapToScalar($discriminator_type);
904 if (not defined($t1)) {
905 fatal($e, el_name($e) . ": unable to map discriminator type '$discriminator_type' to scalar");
908 my $t2 = mapToScalar($e2->{TYPE});
909 if (not defined($t2)) {
910 fatal($e, el_name($e) . ": unable to map variable used for switch_is() to scalar");
914 nonfatal($e, el_name($e) . ": switch_is() is of type $e2->{TYPE} ($t2), while discriminator type for union $type->{NAME} is $discriminator_type ($t1)");
920 if (has_property($e, "subcontext") and has_property($e, "represent_as")) {
921 fatal($e, el_name($e) . " : subcontext() and represent_as() can not be used on the same element");
924 if (has_property($e, "subcontext") and has_property($e, "transmit_as")) {
925 fatal($e, el_name($e) . " : subcontext() and transmit_as() can not be used on the same element");
928 if (has_property($e, "represent_as") and has_property($e, "transmit_as")) {
929 fatal($e, el_name($e) . " : represent_as() and transmit_as() can not be used on the same element");
932 if (has_property($e, "represent_as") and has_property($e, "value")) {
933 fatal($e, el_name($e) . " : represent_as() and value() can not be used on the same element");
936 if (defined (has_property($e, "subcontext_size")) and not defined(has_property($e, "subcontext"))) {
937 fatal($e, el_name($e) . " : subcontext_size() on non-subcontext element");
940 if (defined (has_property($e, "compression")) and not defined(has_property($e, "subcontext"))) {
941 fatal($e, el_name($e) . " : compression() on non-subcontext element");
944 if (!$e->{POINTERS} && (
945 has_property($e, "ptr") or
946 has_property($e, "sptr") or
947 has_property($e, "unique") or
948 has_property($e, "relative") or
949 has_property($e, "ref"))) {
950 fatal($e, el_name($e) . " : pointer properties on non-pointer element\n");
954 #####################################################################
960 ValidProperties($struct,"STRUCT");
962 foreach my $e (@{$struct->{ELEMENTS}}) {
963 $e->{PARENT} = $struct;
968 #####################################################################
974 ValidProperties($union,"UNION");
976 if (has_property($union->{PARENT}, "nodiscriminant") and has_property($union->{PARENT}, "switch_type")) {
977 fatal($union->{PARENT}, $union->{PARENT}->{NAME} . ": switch_type() on union without discriminant");
980 foreach my $e (@{$union->{ELEMENTS}}) {
981 $e->{PARENT} = $union;
983 if (defined($e->{PROPERTIES}->{default}) and
984 defined($e->{PROPERTIES}->{case})) {
985 fatal $e, "Union member $e->{NAME} can not have both default and case properties!\n";
988 unless (defined ($e->{PROPERTIES}->{default}) or
989 defined ($e->{PROPERTIES}->{case})) {
990 fatal $e, "Union member $e->{NAME} must have default or case property\n";
993 if (has_property($e, "ref")) {
994 fatal($e, el_name($e) . " : embedded ref pointers are not supported yet\n");
1002 #####################################################################
1006 my($typedef) = shift;
1007 my $data = $typedef->{DATA};
1009 ValidProperties($typedef,"TYPEDEF");
1011 $data->{PARENT} = $typedef;
1013 if (ref($data) eq "HASH") {
1014 if ($data->{TYPE} eq "STRUCT") {
1018 if ($data->{TYPE} eq "UNION") {
1024 #####################################################################
1026 sub ValidFunction($)
1030 ValidProperties($fn,"FUNCTION");
1032 foreach my $e (@{$fn->{ELEMENTS}}) {
1034 if (has_property($e, "ref") && !$e->{POINTERS}) {
1035 fatal $e, "[ref] variables must be pointers ($fn->{NAME}/$e->{NAME})\n";
1041 #####################################################################
1042 # parse the interface definitions
1043 sub ValidInterface($)
1045 my($interface) = shift;
1046 my($data) = $interface->{DATA};
1048 if (has_property($interface, "helper")) {
1049 nonfatal $interface, "helper() is pidl-specific and deprecated. Use `include' instead";
1052 ValidProperties($interface,"INTERFACE");
1054 if (has_property($interface, "pointer_default") &&
1055 $interface->{PROPERTIES}->{pointer_default} eq "ptr") {
1056 fatal $interface, "Full pointers are not supported yet\n";
1059 if (has_property($interface, "object")) {
1060 if (has_property($interface, "version") &&
1061 $interface->{PROPERTIES}->{version} != 0) {
1062 fatal $interface, "Object interfaces must have version 0.0 ($interface->{NAME})\n";
1065 if (!defined($interface->{BASE}) &&
1066 not ($interface->{NAME} eq "IUnknown")) {
1067 fatal $interface, "Object interfaces must all derive from IUnknown ($interface->{NAME})\n";
1071 foreach my $d (@{$data}) {
1072 ($d->{TYPE} eq "TYPEDEF") &&
1074 ($d->{TYPE} eq "FUNCTION") &&
1080 #####################################################################
1081 # Validate an IDL structure
1086 foreach my $x (@{$idl}) {
1087 ($x->{TYPE} eq "INTERFACE") &&
1089 ($x->{TYPE} eq "IMPORTLIB") &&
1090 nonfatal($x, "importlib() not supported");