summaryrefslogtreecommitdiff
path: root/source4/build/pidl
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2005-01-16 01:48:08 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:08:52 -0500
commit0d9fa3f46cc04450e5a9433519f2f77476791798 (patch)
tree104ee5545ecb47112fc3acf0c103753b09800d54 /source4/build/pidl
parent1e776edfc546f01341f153daa80e4155e5ff9855 (diff)
downloadsamba-0d9fa3f46cc04450e5a9433519f2f77476791798.tar.gz
samba-0d9fa3f46cc04450e5a9433519f2f77476791798.tar.bz2
samba-0d9fa3f46cc04450e5a9433519f2f77476791798.zip
r4770: Change from processing ndr_*.[ch] files all at once to line-by-line.
I'm hoping this will allow better mapping hf fields to the structures they are present in which isn't possible at the moment. (Line mode allows us to use /foo/ .. /bar/ regexps and to store state during the processing. (This used to be commit 75b6df15f2edfac99fbcd7cefb7b404591a1ecb6)
Diffstat (limited to 'source4/build/pidl')
-rw-r--r--source4/build/pidl/eparser.pm36
1 files changed, 16 insertions, 20 deletions
diff --git a/source4/build/pidl/eparser.pm b/source4/build/pidl/eparser.pm
index d288a3b045..92467a6211 100644
--- a/source4/build/pidl/eparser.pm
+++ b/source4/build/pidl/eparser.pm
@@ -324,9 +324,7 @@ sub RewriteHeader($$$)
open(IN, "<$input") || die "can't open $input for reading";
open(OUT, ">$output") || die "can't open $output for writing";
- # Read in entire file
-
- undef $/;
+ # Read through file
while(<IN>) {
@@ -338,8 +336,8 @@ sub RewriteHeader($$$)
# Get rid of async send and receive function.
- s/^NTSTATUS dcerpc_.*?;\n//smg;
- s/^struct rpc_request.*?;\n\n//smg;
+ s/^NTSTATUS dcerpc_.*?;//smg;
+ s/^struct rpc_request.*?;//smg;
# Rewrite librpc includes
@@ -414,9 +412,7 @@ sub RewriteC($$$)
pidl "\n";
- # Read in entire file for post-processing
-
- undef $/;
+ # Read through file
while(<IN>) {
@@ -433,19 +429,19 @@ sub RewriteC($$$)
# We're not interested in ndr_{print,push,size} functions so
# just delete them.
- s/^(static )?NTSTATUS (ndr_push[^\(]+).*?^\}\n\n//smg;
- s/^void (ndr_print[^\(]+).*?^\}\n\n//smg;
- s/^size_t (ndr_size[^\(]+).*?^\}\n\n//smg;
+ next, if /^(static )?NTSTATUS ndr_push/ .. /^}/;
+ next, if /^void ndr_print/ .. /^}/;
+ next, if /^size_t ndr_size/ .. /^}/;
# Get rid of dcerpc interface structures and functions since
# they are also not very interesting.
- s/^static const struct dcerpc_interface_call .*?^\};\n\n//smg;
- s/^static const char \* const ([a-z]+)_endpoint_strings.*?^\};\n\n//smgx;
- s/^static const struct dcerpc_endpoint_list .*?^\};\n\n\n//smg;
- s/^const struct dcerpc_interface_table .*?^\};\n\n//smg;
- s/^static NTSTATUS dcerpc_ndr_([a-z]+)_init.*?^\}\n\n//smg;
- s/^NTSTATUS dcerpc_([a-z]+)_init.*?^\}\n\n//smg;
+next, if /^static const struct dcerpc_interface_call/ .. /^};/;
+next, if /^static const char \* const [a-z]+_endpoint_strings/ ../^};/;
+next, if /^static const struct dcerpc_endpoint_list/ .. /^};/;
+next, if /^const struct dcerpc_interface_table/ .. /^};/;
+next, if /^static NTSTATUS dcerpc_ndr_[a-z]+_init/ .. /^}/;
+next, if /^NTSTATUS dcerpc_[a-z]+_init/ .. /^}/;
# Rewrite includes to packet-dcerpc-foo.h instead of ndr_foo.h
@@ -563,7 +559,7 @@ sub RewriteC($$$)
# Enums
- s/(^static\ NTSTATUS\ ndr_pull_(.+?),\ (enum .+?)\))
+ s/(^static\ NTSTATUS\ ndr_pull_(.+?),\ (enum\ .+?)\))
/static NTSTATUS ndr_pull_$2, pidl_tree *tree, int hf, $3)/smgx;
s/uint(8|16|32) v;/uint$1_t v;/smg;
s/(ndr_pull_([^\)]*?)\(ndr,\ &v\);)
@@ -574,8 +570,8 @@ sub RewriteC($$$)
# Bitmaps
- s/(^NTSTATUS\ ndr_pull_(.+?),\ uint32\ \*r\))
- /NTSTATUS ndr_pull_$2, pidl_tree *tree, int hf, uint32_t *r)/smgx;
+s/(^(static\ )?NTSTATUS\ ndr_pull_(.+?),\ uint32\ \*r\))
+ /NTSTATUS ndr_pull_$3, pidl_tree *tree, int hf, uint32_t *r)/smgx;
pidl $_;
}