svn commit: samba r4770 - in branches/SAMBA_4_0/source/build/pidl: .

tpot at samba.org tpot at samba.org
Sun Jan 16 01:48:08 GMT 2005


Author: tpot
Date: 2005-01-16 01:48:08 +0000 (Sun, 16 Jan 2005)
New Revision: 4770

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=4770

Log:
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.

Modified:
   branches/SAMBA_4_0/source/build/pidl/eparser.pm


Changeset:
Modified: branches/SAMBA_4_0/source/build/pidl/eparser.pm
===================================================================
--- branches/SAMBA_4_0/source/build/pidl/eparser.pm	2005-01-16 01:28:11 UTC (rev 4769)
+++ branches/SAMBA_4_0/source/build/pidl/eparser.pm	2005-01-16 01:48:08 UTC (rev 4770)
@@ -324,10 +324,8 @@
     open(IN, "<$input") || die "can't open $input for reading";
     open(OUT, ">$output") || die "can't open $output for writing";    
    
-    # Read in entire file
+    # Read through file
 
-    undef $/;
-
     while(<IN>) {
 
 	# Not interested in ndr_push or ndr_print routines as they
@@ -338,8 +336,8 @@
 
 	# 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,10 +412,8 @@
 
     pidl "\n";
 
-    # Read in entire file for post-processing
+    # Read through file
 
-    undef $/;
-
     while(<IN>) {
 
 	#
@@ -433,19 +429,19 @@
 	# 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 @@
 				
 	# 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 @@
 
 	# 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 $_;
     }



More information about the samba-cvs mailing list