r8264: - Use standard perl package structure for pidl.
[sfrench/samba-autobuild/.git] / source4 / build / pidl / Parse / Pidl / Compat.pm
1 ###################################################
2 # IDL Compatibility checker
3 # Copyright jelmer@samba.org 2005
4 # released under the GNU GPL
5
6 package Parse::Pidl::Compat;
7
8 use strict;
9
10 my($res);
11
12 sub warning($$)
13 {
14         my $l = shift;
15         my $m = shift;
16
17         print "$l->{FILE}:$l->{LINE}:$m\n";
18 }
19
20 sub CheckInterface($)
21 {
22         my $if = shift;
23         if (util::has_property($if, "pointer_default_top")) {
24                 warning($if, "pointer_default_top() is pidl-specific");
25         }
26
27         foreach my $x (@{$if->{DATA}}) {
28                 if ($x->{TYPE} eq "DECLARE") {
29                         warning($if, "the declare keyword is pidl-specific");
30                         next;
31                 }
32
33                 if ($x->{TYPE} eq "TYPEDEF") {
34                         if ($x->{DATA}->{TYPE} eq "UNION") {
35                                 if (util::has_property($x, "nodiscriminant")) {
36                                         warning($x, "nodiscriminant property is pidl-specific");
37                                 }
38                         }
39                 }
40         }
41 }
42
43 sub Check($)
44 {
45         my $pidl = shift;
46         my $res = "";
47
48         foreach my $x (@{$pidl}) {
49                 CheckInterface($x) if ($x->{TYPE} eq "INTERFACE");
50         }
51
52         return $res;
53 }
54
55 1;