diff options
author | Tim Potter <tpot@samba.org> | 2005-01-07 22:27:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:08:32 -0500 |
commit | 0ee9f4d6e16d2760f31cc8c0a2f120131da24fd3 (patch) | |
tree | 2a42cfe92dccc08be5e4eecf51d569d8b7a33f53 /source4/build/pidl | |
parent | e357b5b64a897e3b3570714da0584f966e6a0d42 (diff) | |
download | samba-0ee9f4d6e16d2760f31cc8c0a2f120131da24fd3.tar.gz samba-0ee9f4d6e16d2760f31cc8c0a2f120131da24fd3.tar.bz2 samba-0ee9f4d6e16d2760f31cc8c0a2f120131da24fd3.zip |
r4599: Remove some duplicated code in pidl.pl.
Start working on adding support for bitmaps and enums.
In progress tweaks for arrays of structures.
(This used to be commit d39cb7ecb4c193cbba628ee6d6f9b5c5bbf89d33)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r-- | source4/build/pidl/eparser.pm | 36 | ||||
-rwxr-xr-x | source4/build/pidl/pidl.pl | 28 |
2 files changed, 41 insertions, 23 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm index 0549bdfdef..73f2275b98 100644 --- a/source4/build/pidl/eparser.pm +++ b/source4/build/pidl/eparser.pm @@ -228,6 +228,17 @@ sub NeededTypedef($) $needed{"ett_$t->{NAME}"} = 1; } + + if ($t->{DATA}->{TYPE} eq "ENUM") { + use Data::Dumper; + print Dumper($t); + + $needed{"hf_$t->{NAME}"} = { + 'name' => $t->{NAME}, + 'ft' => 'FT_UINT32', + 'base' => 'BASE_HEX' + }; + } } ##################################################################### @@ -342,6 +353,10 @@ sub RewriteHeader($$$) s/(struct pidl_pull \*ndr, int ndr_flags)/$1, pidl_tree *tree/smg; + # Bitmaps + + s/(uint32_t \*r\);)/pidl_tree *tree, int hf, $1/smg; + pidl $_; } @@ -405,10 +420,11 @@ sub RewriteC($$$) s/NDR_CHECK\((.*)\)/$1/g; - # We're not interested in ndr_print or ndr_push functions. + # We're not interested in ndr_print, ndr_push or ndr_size functions. s/^(static )?NTSTATUS (ndr_push[^\(]+).*?^\}\n\n//smg; s/^void (ndr_print[^\(]+).*?^\}\n\n//smg; + s/^size_t (ndr_size[^\(]+).*?^\}\n\n//smg; # Get rid of dcerpc interface structures and functions @@ -435,7 +451,9 @@ sub RewriteC($$$) # Add tree argument to ndr_pull_array() - s/(ndr_pull_array\(ndr, ([^,]*?), ([^\)].*?)\);)/ndr_pull_array( ndr, $2, tree, $3);/smg; +#get_subtree(tree, \"$2\", ndr, ett_$2) +#ndr_pull_array( ndr, NDR_SCALARS, tree, (void **)r->aces, sizeof(r->aces[0]), r->num_aces, (ndr_pull_flags_fn_t)ndr_pull_security_ace); + s/(ndr_pull_array\(ndr, ([^,]*?), ([^,]*?), ([^\)].*?)\);)/ndr_pull_array( ndr, $2, tree, $3, $4);/smg; s/(ndr_pull_array_([^\(]*?)\(ndr, ([^,]*?), (r->((in|out).)?([^,]*?)), (.*?)\);)/ndr_pull_array_$2( ndr, $3, tree, hf_$7_$2_array, $4, $8);/smg; @@ -491,7 +509,19 @@ sub RewriteC($$$) s/uint(16|32) _level/uint$1_t _level/smg; s/ndr_pull_([^\(]*)\(ndr, tree, hf_level, &_level\);/ndr_pull_$1(ndr, tree, hf_level_$1, &_level);/smg; - + + # Enums + + s/(^static NTSTATUS ndr_pull_(.+?), (enum .+?)\))/static NTSTATUS ndr_pull_$2, pidl_tree *tree, int hf, $3)/smg; + s/uint(8|16|32) v;/uint$1_t v;/smg; + s/(ndr_pull_([^\)]*?)\(ndr, &v\);)/ndr_pull_$2(ndr, tree, hf, &v);/smg; + + s/(ndr_pull_([^\(]+?)\(ndr, &_level\);)/ndr_pull_$2(ndr, tree, hf_$2, &_level);/smg; + + # Bitmaps + + s/(^NTSTATUS ndr_pull_(.+?), uint32 \*r\))/NTSTATUS ndr_pull_$2, pidl_tree *tree, int hf, uint32_t *r)/smg; + pidl $_; } diff --git a/source4/build/pidl/pidl.pl b/source4/build/pidl/pidl.pl index 6d0ff69081..5c09ca1842 100755 --- a/source4/build/pidl/pidl.pl +++ b/source4/build/pidl/pidl.pl @@ -141,6 +141,10 @@ sub process_file($) if ($opt_header) { my($header) = util::ChangeExtension($output, ".h"); util::FileSave($header, IdlHeader::Parse($pidl)); + if ($opt_eparser) { + my($eparserhdr) = dirname($output) . "/packet-dcerpc-$basename.h"; + IdlEParser::RewriteHeader($pidl, $header, $eparserhdr); + } } if ($opt_client) { @@ -202,26 +206,10 @@ $dcom if ($opt_parser) { my($parser) = util::ChangeExtension($output, ".c"); IdlParser::Parse($pidl, $parser); - } - - if ($opt_eparser) { - - # Generate regular .c and .h files for marshaling and - # unmarshaling. - - my($parser) = util::ChangeExtension($output, ".c"); - IdlParser::Parse($pidl, $parser); - - my($header) = util::ChangeExtension($output, ".h"); - util::FileSave($header, IdlHeader::Parse($pidl)); - - # Postprocess to produce ethereal parsers. - - my($eparser) = dirname($output) . "/packet-dcerpc-$basename.c"; - IdlEParser::RewriteC($pidl, $parser, $eparser); - - my($eparserhdr) = dirname($output) . "/packet-dcerpc-$basename.h"; - IdlEParser::RewriteHeader($pidl, $header, $eparserhdr); + if($opt_eparser) { + my($eparser) = dirname($output) . "/packet-dcerpc-$basename.c"; + IdlEParser::RewriteC($pidl, $parser, $eparser); + } } if ($opt_swig) { |