1 ###################################################
2 # IDL Compatibility checker
3 # Copyright jelmer@samba.org 2005
4 # released under the GNU GPL
6 package Parse::Pidl::Compat;
8 use Parse::Pidl qw(warning);
9 use Parse::Pidl::Util qw(has_property);
12 use vars qw($VERSION);
15 my %supported_properties = (
17 "helpstring" => ["INTERFACE", "FUNCTION"],
18 "version" => ["INTERFACE"],
19 "uuid" => ["INTERFACE"],
20 "endpoint" => ["INTERFACE"],
21 "pointer_default" => ["INTERFACE"],
24 "object" => ["INTERFACE"],
25 "local" => ["INTERFACE", "FUNCTION"],
26 "iid_is" => ["ELEMENT"],
27 "call_as" => ["FUNCTION"],
28 "idempotent" => ["FUNCTION"],
37 "unique" => ["ELEMENT"],
38 "ignore" => ["ELEMENT"],
40 "value" => ["ELEMENT"],
43 "public" => ["FUNCTION", "TYPEDEF"],
44 "nopush" => ["FUNCTION", "TYPEDEF"],
45 "nopull" => ["FUNCTION", "TYPEDEF"],
46 "noprint" => ["FUNCTION", "TYPEDEF"],
47 "nopython" => ["FUNCTION", "TYPEDEF"],
50 "switch_is" => ["ELEMENT"],
51 "switch_type" => ["ELEMENT", "TYPEDEF"],
52 "case" => ["ELEMENT"],
53 "default" => ["ELEMENT"],
56 "subcontext" => ["ELEMENT"],
57 "subcontext_size" => ["ELEMENT"],
60 "enum16bit" => ["TYPEDEF"],
61 "v1_enum" => ["TYPEDEF"],
64 "bitmap8bit" => ["TYPEDEF"],
65 "bitmap16bit" => ["TYPEDEF"],
66 "bitmap32bit" => ["TYPEDEF"],
67 "bitmap64bit" => ["TYPEDEF"],
70 "range" => ["ELEMENT"],
71 "size_is" => ["ELEMENT"],
72 "string" => ["ELEMENT"],
73 "noheader" => ["ELEMENT"],
74 "charset" => ["ELEMENT"],
75 "length_is" => ["ELEMENT"],
82 if (has_property($td, "nodiscriminant")) {
83 warning($td, "nodiscriminant property not supported");
86 if ($td->{TYPE} eq "BITMAP") {
87 warning($td, "converting bitmap to scalar");
91 if (has_property($td, "gensize")) {
92 warning($td, "ignoring gensize() property. ");
95 if (has_property($td, "enum8bit") and has_property($td, "enum16bit")) {
96 warning($td, "8 and 16 bit enums not supported, converting to scalar");
100 StripProperties($td);
107 if (has_property($e, "noheader")) {
108 warning($e, "noheader property not supported");
112 if (has_property($e, "subcontext")) {
113 warning($e, "converting subcontext to byte array");
117 if (has_property($e, "compression")) {
118 warning($e, "compression() property not supported");
121 if (has_property($e, "sptr")) {
122 warning($e, "sptr() pointer property not supported");
125 if (has_property($e, "relative")) {
126 warning($e, "relative() pointer property not supported");
129 if (has_property($e, "relative_short")) {
130 warning($e, "relative_short() pointer property not supported");
133 if (has_property($e, "flag")) {
134 warning($e, "ignoring flag() property");
137 if (has_property($e, "value")) {
138 warning($e, "ignoring value() property");
146 if (has_property($fn, "noopnum")) {
147 warning($fn, "noopnum not converted. Opcodes will be out of sync.");
151 sub CheckInterface($)
163 push (@$nidl, CheckInterface($_)) if ($_->{TYPE} eq "INTERFACE");