From 449c6acd70221ca257eeb4b82de428760e089d59 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 20 Aug 2005 21:54:45 +0000 Subject: r9433: - Update TODO & README - Extend compatibility module (work towards being able to generate Midl-compatible IDL files, pretty much just removing attributes midl doesn't know such as value() and charset()) - Support charset() on fixed-size arrays of characters (This used to be commit 43817eb0bd46aab10d1595ce008d8380565246f0) --- source4/build/pidl/Parse/Pidl/Compat.pm | 170 ++++++++++++++++++++++++-- source4/build/pidl/Parse/Pidl/Samba/Header.pm | 6 +- source4/build/pidl/README | 51 ++++---- source4/build/pidl/TODO | 4 +- 4 files changed, 191 insertions(+), 40 deletions(-) (limited to 'source4') diff --git a/source4/build/pidl/Parse/Pidl/Compat.pm b/source4/build/pidl/Parse/Pidl/Compat.pm index f81d73f36a..39cb67fd71 100644 --- a/source4/build/pidl/Parse/Pidl/Compat.pm +++ b/source4/build/pidl/Parse/Pidl/Compat.pm @@ -5,8 +5,73 @@ package Parse::Pidl::Compat; +use Parse::Pidl::Util qw(has_property); use strict; +my %supported_properties = ( + # interface + "helpstring" => ["INTERFACE", "FUNCTION"], + "version" => ["INTERFACE"], + "uuid" => ["INTERFACE"], + "endpoint" => ["INTERFACE"], + "pointer_default" => ["INTERFACE"], + + # dcom + "object" => ["INTERFACE"], + "local" => ["INTERFACE", "FUNCTION"], + "iid_is" => ["ELEMENT"], + "call_as" => ["FUNCTION"], + "idempotent" => ["FUNCTION"], + + # function + "in" => ["ELEMENT"], + "out" => ["ELEMENT"], + + # pointer + "ref" => ["ELEMENT"], + "ptr" => ["ELEMENT"], + "unique" => ["ELEMENT"], + "ignore" => ["ELEMENT"], + + "value" => ["ELEMENT"], + + # generic + "public" => ["FUNCTION", "TYPEDEF"], + "nopush" => ["FUNCTION", "TYPEDEF"], + "nopull" => ["FUNCTION", "TYPEDEF"], + "noprint" => ["FUNCTION", "TYPEDEF"], + "noejs" => ["FUNCTION", "TYPEDEF"], + + # union + "switch_is" => ["ELEMENT"], + "switch_type" => ["ELEMENT", "TYPEDEF"], + "case" => ["ELEMENT"], + "default" => ["ELEMENT"], + + # subcontext + "subcontext" => ["ELEMENT"], + "subcontext_size" => ["ELEMENT"], + + # enum + "enum16bit" => ["TYPEDEF"], + "v1_enum" => ["TYPEDEF"], + + # bitmap + "bitmap8bit" => ["TYPEDEF"], + "bitmap16bit" => ["TYPEDEF"], + "bitmap32bit" => ["TYPEDEF"], + "bitmap64bit" => ["TYPEDEF"], + + # array + "range" => ["ELEMENT"], + "size_is" => ["ELEMENT"], + "string" => ["ELEMENT"], + "noheader" => ["ELEMENT"], + "charset" => ["ELEMENT"], + "length_is" => ["ELEMENT"], +); + + my($res); sub warning($$) @@ -14,39 +79,122 @@ sub warning($$) my $l = shift; my $m = shift; + print "$l->{FILE}:$l->{LINE}:Warning:$m\n"; +} + +sub error($$) +{ + my ($l,$m) = @_; print "$l->{FILE}:$l->{LINE}:$m\n"; } +sub CheckTypedef($) +{ + my $td = shift; + + if (has_property($td, "nodiscriminant")) { + error($td, "nodiscriminant property not supported"); + } + + if ($td->{TYPE} eq "BITMAP") { + warning($td, "converting bitmap to scalar"); + #FIXME + } + + if (has_property($td, "gensize")) { + warning($td, "ignoring gensize() property. "); + } + + if (has_property($td, "enum8bit") and has_property($td, "enum16bit")) { + warning($td, "8 and 16 bit enums not supported, converting to scalar"); + #FIXME + } + + StripProperties($td); +} + +sub CheckElement($) +{ + my $e = shift; + + if (has_property($e, "noheader")) { + error($e, "noheader property not supported"); + return; + } + + if (has_property($e, "subcontext")) { + warning($e, "converting subcontext to byte array"); + #FIXME + } + + if (has_property($e, "compression")) { + error($e, "compression() property not supported"); + } + + if (has_property($e, "obfuscation")) { + error($e, "obfuscation() property not supported"); + } + + if (has_property($e, "sptr")) { + error($e, "sptr() pointer property not supported"); + } + + if (has_property($e, "relative")) { + error($e, "relative() pointer property not supported"); + } + + if (has_property($td, "flag")) { + warning($e, "ignoring flag() property"); + } + + if (has_property($td, "value")) { + warning($e, "ignoring value() property"); + } + + StripProperties($e); +} + +sub CheckFunction($) +{ + my $fn = shift; + + if (has_property($fn, "noopnum")) { + error($fn, "noopnum not converted. Opcodes will be out of sync."); + } + + StripProperties($fn); + + +} + sub CheckInterface($) { my $if = shift; - if (util::has_property($if, "pointer_default_top")) { - warning($if, "pointer_default_top() is pidl-specific"); + + if (has_property($if, "pointer_default_top") and + $if->{PROPERTIES}->{pointer_default_top} ne "ref") { + error($if, "pointer_default_top() is pidl-specific"); } + StripProperties($if); + foreach my $x (@{$if->{DATA}}) { if ($x->{TYPE} eq "DECLARE") { warning($if, "the declare keyword is pidl-specific"); next; } - - if ($x->{TYPE} eq "TYPEDEF") { - if ($x->{DATA}->{TYPE} eq "UNION") { - if (util::has_property($x, "nodiscriminant")) { - warning($x, "nodiscriminant property is pidl-specific"); - } - } - } } } sub Check($) { my $pidl = shift; + my $nidl = []; my $res = ""; foreach my $x (@{$pidl}) { - CheckInterface($x) if ($x->{TYPE} eq "INTERFACE"); + push (@$nidl, CheckInterface($x)) + if ($x->{TYPE} eq "INTERFACE"); } return $res; diff --git a/source4/build/pidl/Parse/Pidl/Samba/Header.pm b/source4/build/pidl/Parse/Pidl/Samba/Header.pm index 928b35d4ca..ca67b7c09f 100644 --- a/source4/build/pidl/Parse/Pidl/Samba/Header.pm +++ b/source4/build/pidl/Parse/Pidl/Samba/Header.pm @@ -199,7 +199,11 @@ sub HeaderType($$$) } if (has_property($e, "charset")) { - pidl "const char"; + if ($e->{POINTERS} > 0) { + pidl "const char"; + } else { + pidl "char"; + } } else { pidl mapType($e->{TYPE}); } diff --git a/source4/build/pidl/README b/source4/build/pidl/README index 62498a40c7..e6768b6940 100644 --- a/source4/build/pidl/README +++ b/source4/build/pidl/README @@ -14,34 +14,33 @@ After a parse tree is present, pidl will call one of it's backends a list of current backends: -- Generic -- -dump.pm - Converts the parse tree back to an IDL file -validator.pm - Validates the parse tree - --- DCE/RPC+NDR -- -ndr.pm - Generates intermediate datastructures for use by NDR parses/generators -ndr_client.pm - Generates client call functions in C using the NDR parser -eth_parser.pm - Generates a parser for the ethereal network sniffer -eth_header.pm - Generates a header for ethereal -swig.pm - Generates SWIG interface files (.i) -ndr_header.pm - Generates a header file with structures -ndr_parser.pm - Generates pull/push functions for parsing NDR -server.pm - Generates server side implementation in C -template.pm - Generates stubs in C for server implementation -ejs.pm - Generates bindings for Embedded JavaScript (EJS) -ejs_header.pm - Generates headers for the EJS bindings - --- COM / DCOM -- -odl.pm - Generates IDL structures from ODL structures for use in - the NDR parser generator -dcom_proxy.pm - Generates proxy object for DCOM (client-side) -dcom_stub.pm - Generates stub call handler for DCOM (server-side) -com_header.pm - Generates header file for COM interface(s) +Parse::Pidl::Dump - Converts the parse tree back to an IDL file +Parse::Pidl::Samba::Header - Generates header file with data structures defined in IDL file +Parse::Pidl::NDR - Generates intermediate datastructures for use by NDR parses/generators +Parse::Pidl::ODL - Generates IDL structures from ODL structures for use in the NDR parser generator + +-- Samba NDR -- +Parse::Pidl::Samba::NDR::Client - Generates client call functions in C using the NDR parser +Parse::Pidl::Samba::SWIG - Generates SWIG interface files (.i) +Parse::Pidl::Samba::NDR::Header - Generates a header file with NDR-parser specific data +Parse::Pidl::Samba::NDR::Parser - Generates pull/push functions for parsing NDR +Parse::Pidl::Samba::NDR::Server - Generates server side implementation in C +Parse::Pidl::Samba::Template - Generates stubs in C for server implementation +Parse::Pidl::Samba::EJS - Generates bindings for Embedded JavaScript (EJS) +Parse::Pidl::Samba::EJSHeader - Generates headers for the EJS bindings + +-- Samba COM / DCOM -- +Parse::Pidl::Samba::COM::Proxy - Generates proxy object for DCOM (client-side) +Parse::Pidl::Samba::COM::Stub - Generates stub call handler for DCOM (server-side) +Parse::Pidl::Samba::COM::Header - Generates header file for COM interface(s) + +-- Ethereal -- +Parse::Pidl::Ethereal::NDR - Generates a parser for the ethereal network sniffer +Parse::Pidl::Ethereal::Conformance - Reads conformance files containing additional data for generating Ethereal parsers -- Utility modules -- -tables.pl - Generates a table of available interfaces from a list of IDL files -util.pm - Misc utility functions used by *.pm and pidl.pl -typelist.pm - Utility functions for keeping track of known types and their - representation in C +Parse::Pidl::Util - Misc utility functions used by *.pm and pidl.pl +Parse::Pidl::Typelist - Utility functions for keeping track of known types and their representation in C Tips for hacking on pidl: - Look at the pidl's parse tree by using the --keep option and looking diff --git a/source4/build/pidl/TODO b/source4/build/pidl/TODO index efb103ff0d..f341dba846 100644 --- a/source4/build/pidl/TODO +++ b/source4/build/pidl/TODO @@ -1,5 +1,4 @@ -- True multiple dimension array / strings in arrays support (closely related to - things specified above) +- True multiple dimension array / strings in arrays support - compatibility mode for generating MIDL-readable data: - strip out pidl-specific properties @@ -9,3 +8,4 @@ a (regular) remote error occurs - support nested elements +- fix stand-alone installation -- cgit