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,
78 warn ("$e->{FILE}:$e->{LINE}: warning: $s\n");
81 #####################################################################
82 # signal a fatal validation error
86 die("$pos->{FILE}:$pos->{LINE}:$s\n");
89 sub GetElementLevelTable($)
95 my @bracket_array = ();
100 if (has_property($e, "size_is")) {
101 @size_is = split /,/, has_property($e, "size_is");
104 if (has_property($e, "length_is")) {
105 @length_is = split /,/, has_property($e, "length_is");
108 if (defined($e->{ARRAY_LEN})) {
109 @bracket_array = @{$e->{ARRAY_LEN}};
112 if (has_property($e, "out")) {
115 if (has_property($e, "string")) { $needptrs++; }
116 if ($#bracket_array >= 0) { $needptrs = 0; }
118 nonfatal($e, "[out] argument `$e->{NAME}' not a pointer") if ($needptrs > $e->{POINTERS});
121 # Parse the [][][][] style array stuff
122 for my $i (0 .. $#bracket_array) {
123 my $d = $bracket_array[$#bracket_array - $i];
126 my $is_surrounding = 0;
128 my $is_conformant = 0;
133 if ($size = shift @size_is) {
134 } elsif ((scalar(@size_is) == 0) and has_property($e, "string")) {
136 delete($e->{PROPERTIES}->{string});
138 print "$e->{FILE}:$e->{LINE}: Must specify size_is() for conformant array!\n";
142 if (($length = shift @length_is) or $is_string) {
148 if ($e == $e->{PARENT}->{ELEMENTS}[-1]
149 and $e->{PARENT}->{TYPE} ne "FUNCTION") {
157 LENGTH_IS => $length,
158 IS_DEFERRED => "$is_deferred",
159 IS_SURROUNDING => "$is_surrounding",
160 IS_ZERO_TERMINATED => "$is_string",
161 IS_VARYING => "$is_varying",
162 IS_CONFORMANT => "$is_conformant",
163 IS_FIXED => (not $is_conformant and Parse::Pidl::Util::is_constant($size)),
164 IS_INLINE => (not $is_conformant and not Parse::Pidl::Util::is_constant($size))
168 # Next, all the pointers
169 foreach my $i (1..$e->{POINTERS}) {
170 my $pt = pointer_type($e);
172 my $level = "EMBEDDED";
173 # Top level "ref" pointers do not have a referrent identifier
174 $level = "TOP" if ( defined($pt)
176 and $e->{PARENT}->{TYPE} eq "FUNCTION");
180 # for now, there can only be one pointer type per element
181 POINTER_TYPE => pointer_type($e),
182 POINTER_INDEX => $pointer_idx,
183 IS_DEFERRED => "$is_deferred",
189 # everything that follows will be deferred
190 $is_deferred = 1 if ($e->{PARENT}->{TYPE} ne "FUNCTION");
192 my $array_size = shift @size_is;
199 if ($array_length = shift @length_is) {
202 $array_length = $array_size;
207 if (scalar(@size_is) == 0 and has_property($e, "string") and
208 $i == $e->{POINTERS}) {
210 $is_varying = $is_conformant = has_property($e, "noheader")?0:1;
211 delete($e->{PROPERTIES}->{string});
214 if ($array_size or $is_string) {
217 IS_ZERO_TERMINATED => "$is_string",
218 SIZE_IS => $array_size,
219 LENGTH_IS => $array_length,
220 IS_DEFERRED => "$is_deferred",
222 IS_VARYING => "$is_varying",
223 IS_CONFORMANT => "$is_conformant",
232 if (defined(has_property($e, "subcontext"))) {
233 my $hdr_size = has_property($e, "subcontext");
234 my $subsize = has_property($e, "subcontext_size");
235 if (not defined($subsize)) {
240 TYPE => "SUBCONTEXT",
241 HEADER_SIZE => $hdr_size,
242 SUBCONTEXT_SIZE => $subsize,
243 IS_DEFERRED => $is_deferred,
244 COMPRESSION => has_property($e, "compression"),
248 if (my $switch = has_property($e, "switch_is")) {
251 SWITCH_IS => $switch,
252 IS_DEFERRED => $is_deferred
256 if (scalar(@size_is) > 0) {
257 nonfatal($e, "size_is() on non-array element");
260 if (scalar(@length_is) > 0) {
261 nonfatal($e, "length_is() on non-array element");
264 if (has_property($e, "string")) {
265 nonfatal($e, "string() attribute on non-array element");
270 CONVERT_TO => has_property($e, ""),
271 CONVERT_FROM => has_property($e, ""),
272 DATA_TYPE => $e->{TYPE},
273 IS_DEFERRED => $is_deferred,
274 CONTAINS_DEFERRED => can_contain_deferred($e),
275 IS_SURROUNDING => 0 #FIXME
279 foreach (@$order) { $_->{LEVEL_INDEX} = $i; $i+=1; }
284 #####################################################################
285 # see if a type contains any deferred data
286 sub can_contain_deferred
290 return 0 if (Parse::Pidl::Typelist::is_scalar($e->{TYPE}));
291 return 1 unless (hasType($e->{TYPE})); # assume the worst
293 my $type = getType($e->{TYPE});
295 foreach my $x (@{$type->{DATA}->{ELEMENTS}}) {
296 return 1 if ($x->{POINTERS});
297 return 1 if (can_contain_deferred ($x));
307 return undef unless $e->{POINTERS};
309 return "ref" if (has_property($e, "ref"));
310 return "ptr" if (has_property($e, "ptr"));
311 return "sptr" if (has_property($e, "sptr"));
312 return "unique" if (has_property($e, "unique"));
313 return "relative" if (has_property($e, "relative"));
314 return "ignore" if (has_property($e, "ignore"));
319 #####################################################################
320 # work out the correct alignment for a structure or union
321 sub find_largest_alignment($)
326 for my $e (@{$s->{ELEMENTS}}) {
329 if ($e->{POINTERS}) {
331 } elsif (has_property($e, "subcontext")) {
333 } elsif (has_property($e, "transmit_as")) {
334 $a = align_type($e->{PROPERTIES}->{transmit_as});
336 $a = align_type($e->{TYPE});
339 $align = $a if ($align < $a);
345 #####################################################################
352 unless (hasType($e)) {
353 # it must be an external type - all we can do is guess
354 # print "Warning: assuming alignment of unknown type '$e' is 4\n";
358 my $dt = getType($e)->{DATA};
360 if ($dt->{TYPE} eq "ENUM") {
361 return align_type(Parse::Pidl::Typelist::enum_type_fn($dt));
362 } elsif ($dt->{TYPE} eq "BITMAP") {
363 return align_type(Parse::Pidl::Typelist::bitmap_type_fn($dt));
364 } elsif (($dt->{TYPE} eq "STRUCT") or ($dt->{TYPE} eq "UNION")) {
365 return find_largest_alignment($dt);
366 } elsif ($dt->{TYPE} eq "SCALAR") {
367 return $scalar_alignment->{$dt->{NAME}};
370 die("Unknown data type type $dt->{TYPE}");
377 $e->{TYPE} = expandAlias($e->{TYPE});
382 PROPERTIES => $e->{PROPERTIES},
383 LEVELS => GetElementLevelTable($e),
384 REPRESENTATION_TYPE => $e->{PROPERTIES}->{represent_as},
385 ALIGN => align_type($e->{TYPE}),
392 my ($ndr,$struct) = @_;
394 my $surrounding = undef;
396 foreach my $x (@{$struct->{ELEMENTS}})
398 my $e = ParseElement($x);
399 if ($x != $struct->{ELEMENTS}[-1] and
400 $e->{LEVELS}[0]->{IS_SURROUNDING}) {
401 print "$x->{FILE}:$x->{LINE}: error: conformant member not at end of struct\n";
406 my $e = $elements[-1];
407 if (defined($e) and defined($e->{LEVELS}[0]->{IS_SURROUNDING}) and
408 $e->{LEVELS}[0]->{IS_SURROUNDING}) {
412 if (defined $e->{TYPE} && $e->{TYPE} eq "string"
413 && property_matches($e, "flag", ".*LIBNDR_FLAG_STR_CONFORMANT.*")) {
414 $surrounding = $struct->{ELEMENTS}[-1];
419 SURROUNDING_ELEMENT => $surrounding,
420 ELEMENTS => \@elements,
421 PROPERTIES => $struct->{PROPERTIES},
430 my $switch_type = has_property($e, "switch_type");
431 unless (defined($switch_type)) { $switch_type = "uint32"; }
433 if (has_property($e, "nodiscriminant")) { $switch_type = undef; }
436 foreach my $x (@{$e->{ELEMENTS}})
439 if ($x->{TYPE} eq "EMPTY") {
440 $t = { TYPE => "EMPTY" };
442 $t = ParseElement($x);
444 if (has_property($x, "default")) {
445 $t->{CASE} = "default";
447 } elsif (defined($x->{PROPERTIES}->{case})) {
448 $t->{CASE} = "case $x->{PROPERTIES}->{case}";
450 die("Union element $x->{NAME} has neither default nor case property");
457 SWITCH_TYPE => $switch_type,
458 ELEMENTS => \@elements,
459 PROPERTIES => $e->{PROPERTIES},
460 HAS_DEFAULT => $hasdefault,
471 BASE_TYPE => Parse::Pidl::Typelist::enum_type_fn($e),
472 ELEMENTS => $e->{ELEMENTS},
473 PROPERTIES => $e->{PROPERTIES},
484 BASE_TYPE => Parse::Pidl::Typelist::bitmap_type_fn($e),
485 ELEMENTS => $e->{ELEMENTS},
486 PROPERTIES => $e->{PROPERTIES},
495 if ($d->{TYPE} eq "STRUCT" or $d->{TYPE} eq "UNION") {
496 CheckPointerTypes($d, $ndr->{PROPERTIES}->{pointer_default});
500 STRUCT => \&ParseStruct,
501 UNION => \&ParseUnion,
503 BITMAP => \&ParseBitmap,
504 TYPEDEF => \&ParseTypedef,
505 }->{$d->{TYPE}}->($ndr, $d);
514 if (defined($d->{PROPERTIES}) && !defined($d->{DATA}->{PROPERTIES})) {
515 $d->{DATA}->{PROPERTIES} = $d->{PROPERTIES};
518 my $data = ParseType($ndr, $d->{DATA});
519 $data->{ALIGN} = align_type($d->{NAME});
524 PROPERTIES => $d->{PROPERTIES},
537 sub ParseFunction($$$)
539 my ($ndr,$d,$opnum) = @_;
542 my $thisopnum = undef;
544 CheckPointerTypes($d, $ndr->{PROPERTIES}->{pointer_default_top});
546 if (not defined($d->{PROPERTIES}{noopnum})) {
547 $thisopnum = ${$opnum};
551 foreach my $x (@{$d->{ELEMENTS}}) {
552 my $e = ParseElement($x);
553 push (@{$e->{DIRECTION}}, "in") if (has_property($x, "in"));
554 push (@{$e->{DIRECTION}}, "out") if (has_property($x, "out"));
556 push (@elements, $e);
559 if ($d->{RETURN_TYPE} ne "void") {
560 $rettype = expandAlias($d->{RETURN_TYPE});
564 if (has_property($d, "async")) { $async = 1; }
571 RETURN_TYPE => $rettype,
572 PROPERTIES => $d->{PROPERTIES},
573 ELEMENTS => \@elements,
578 sub CheckPointerTypes($$)
580 my ($s,$default) = @_;
582 foreach my $e (@{$s->{ELEMENTS}}) {
583 if ($e->{POINTERS} and not defined(pointer_type($e))) {
584 $e->{PROPERTIES}->{$default} = 1;
589 sub ParseInterface($)
600 if (not has_property($idl, "pointer_default")) {
601 # MIDL defaults to "ptr" in DCE compatible mode (/osf)
602 # and "unique" in Microsoft Extensions mode (default)
603 $idl->{PROPERTIES}->{pointer_default} = "unique";
606 if (not has_property($idl, "pointer_default_top")) {
607 $idl->{PROPERTIES}->{pointer_default_top} = "ref";
610 foreach my $d (@{$idl->{DATA}}) {
611 if ($d->{TYPE} eq "DECLARE") {
612 push (@declares, $d);
613 } elsif ($d->{TYPE} eq "FUNCTION") {
614 push (@functions, ParseFunction($idl, $d, \$opnum));
615 } elsif ($d->{TYPE} eq "CONST") {
616 push (@consts, ParseConst($idl, $d));
618 push (@types, ParseType($idl, $d));
624 if(defined $idl->{PROPERTIES}->{version}) {
625 $version = $idl->{PROPERTIES}->{version};
628 # If no endpoint is set, default to the interface name as a named pipe
629 if (!defined $idl->{PROPERTIES}->{endpoint}) {
630 push @endpoints, "\"ncacn_np:[\\\\pipe\\\\" . $idl->{NAME} . "]\"";
632 @endpoints = split / /, $idl->{PROPERTIES}->{endpoint};
636 NAME => $idl->{NAME},
637 UUID => lc(has_property($idl, "uuid")),
640 PROPERTIES => $idl->{PROPERTIES},
641 FUNCTIONS => \@functions,
644 DECLARES => \@declares,
645 ENDPOINTS => \@endpoints
649 # Convert a IDL tree to a NDR tree
650 # Gives a result tree describing all that's necessary for easily generating
651 # NDR parsers / generators
656 return undef unless (defined($idl));
658 Parse::Pidl::NDR::Validate($idl);
663 ($_->{TYPE} eq "INTERFACE") && push(@ndr, ParseInterface($_));
664 ($_->{TYPE} eq "IMPORT") && push(@ndr, $_);
677 foreach my $l (@{$e->{LEVELS}}) {
678 return $l if ($seen);
679 ($seen = 1) if ($l == $fl);
690 foreach my $l (@{$e->{LEVELS}}) {
691 (return $prev) if ($l == $fl);
698 sub ContainsString($)
702 foreach my $l (@{$e->{LEVELS}}) {
703 return 1 if ($l->{TYPE} eq "ARRAY" and $l->{IS_ZERO_TERMINATED});
709 sub ContainsDeferred($$)
713 return 1 if ($l->{CONTAINS_DEFERRED});
715 while ($l = GetNextLevel($e,$l))
717 return 1 if ($l->{IS_DEFERRED});
718 return 1 if ($l->{CONTAINS_DEFERRED});
728 if ($e->{PARENT} && $e->{PARENT}->{NAME}) {
729 return "$e->{PARENT}->{NAME}.$e->{NAME}";
732 if ($e->{PARENT} && $e->{PARENT}->{PARENT}->{NAME}) {
733 return "$e->{PARENT}->{PARENT}->{NAME}.$e->{NAME}";
737 return "$e->{PARENT}->{NAME}.$e->{NAME}";
743 ###################################
744 # find a sibling var in a structure
748 my($fn) = $e->{PARENT};
750 if ($name =~ /\*(.*)/) {
754 for my $e2 (@{$fn->{ELEMENTS}}) {
755 return $e2 if ($e2->{NAME} eq $name);
761 my %property_list = (
763 "helpstring" => ["INTERFACE", "FUNCTION"],
764 "version" => ["INTERFACE"],
765 "uuid" => ["INTERFACE"],
766 "endpoint" => ["INTERFACE"],
767 "pointer_default" => ["INTERFACE"],
768 "pointer_default_top" => ["INTERFACE"],
769 "depends" => ["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, "depends")) {
1049 nonfatal $interface, "depends() is pidl-specific and deprecated. Use `import' instead";
1052 if (has_property($interface, "helper")) {
1053 nonfatal $interface, "helper() is pidl-specific and deprecated. Use `include' instead";
1056 ValidProperties($interface,"INTERFACE");
1058 if (has_property($interface, "pointer_default") &&
1059 $interface->{PROPERTIES}->{pointer_default} eq "ptr") {
1060 fatal $interface, "Full pointers are not supported yet\n";
1063 if (has_property($interface, "object")) {
1064 if (has_property($interface, "version") &&
1065 $interface->{PROPERTIES}->{version} != 0) {
1066 fatal $interface, "Object interfaces must have version 0.0 ($interface->{NAME})\n";
1069 if (!defined($interface->{BASE}) &&
1070 not ($interface->{NAME} eq "IUnknown")) {
1071 fatal $interface, "Object interfaces must all derive from IUnknown ($interface->{NAME})\n";
1075 foreach my $d (@{$data}) {
1076 ($d->{TYPE} eq "TYPEDEF") &&
1078 ($d->{TYPE} eq "FUNCTION") &&
1084 #####################################################################
1085 # Validate an IDL structure
1090 foreach my $x (@{$idl}) {
1091 ($x->{TYPE} eq "INTERFACE") &&
1093 ($x->{TYPE} eq "IMPORTLIB") &&
1094 nonfatal($x, "importlib() not supported");