Revert previous checkin.
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 2 Feb 2009 22:16:46 +0000 (22:16 +0000)
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 2 Feb 2009 22:16:46 +0000 (22:16 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@27356 f5534014-38df-0310-8fa8-9805f1628bb7

Makefile.nmake
tools/make-dissector-reg.py

index 2bc77e6cd1325315682520d0107282e94eff9295..979a21963d7bde7a9a88db4eec1088882dfe131c 100644 (file)
@@ -393,24 +393,13 @@ AUTHORS-SHORT-FORMAT: AUTHORS-SHORT make-authors-format.pl
 # routines must start in column zero, or must be preceded only by
 # "void " starting in column zero, and must not be inside #if.
 #
-# The shell script runs slowly, as multiple greps and seds are run
-# for each input file; this is especially slow on Windows.  Therefore,
-# if Python is present (as indicated by PYTHON being defined), we run
-# a faster Python script to do that work instead.
-#
 # The first argument is the name of the file to write.
 # The second argument is the directory in which the source files live.
 # All subsequent arguments are the files to scan.
 #
-!IFDEF PYTHON
-tshark-tap-register.c: $(TSHARK_TAP_SRC) tools/make-dissector-reg.py
-       @echo Making tshark-tap-register.c (using python)
-       @$(PYTHON) "tools/make-dissector-reg.py" . taps $(TSHARK_TAP_SRC)       
-!ELSE
 tshark-tap-register.c: $(TSHARK_TAP_SRC) make-tapreg-dotc
        @echo Making tshark-tap-register.c
        @$(SH) make-tapreg-dotc tshark-tap-register.c . $(TSHARK_TAP_SRC)
-!ENDIF
 
 text2pcap-scanner.c : text2pcap-scanner.l
        $(LEX) -otext2pcap-scanner.c text2pcap-scanner.l
index 1c520c0576aabdd767e53e9e195b74b3026770b3..f9745bb38441e9f76ccaeebe3ab0cebc9da2bc7f 100755 (executable)
@@ -36,10 +36,6 @@ elif registertype == "dissectors":
        tmp_filename = "register.c-tmp"
        final_filename = "register.c"
        cache_filename = "register-cache.pkl"
-elif registertype == "taps":
-       tmp_filename = "tshark-tap-register.c-tmp"
-       final_filename = "tshark-tap-register.c"
-       cache_filename = "tap-cache.pkl"
 else:
        print "Unknown output type '%s'" % registertype
        sys.exit(1)
@@ -69,7 +65,6 @@ if len(filenames) < 1:
 regs = {
        'proto_reg': [],
        'handoff_reg': [],
-       'tap_reg': [],
        }
 
 # For those that don't know Python, r"" indicates a raw string,
@@ -80,17 +75,12 @@ proto_regex1 = r"void\s+(?P<symbol>proto_register_[_A-Za-z0-9]+)\s*\([^;]+$"
 handoff_regex0 = r"^(?P<symbol>proto_reg_handoff_[_A-Za-z0-9]+)\s*\([^;]+$"
 handoff_regex1 = r"void\s+(?P<symbol>proto_reg_handoff_[_A-Za-z0-9]+)\s*\([^;]+$"
 
-tap_regex0 = r"^(?P<symbol>register_tap_listener_[_A-Za-z0-9]+)\s*\([^;]+$"
-tap_regex1 = r"void\s+(?P<symbol>register_tap_listener_[_A-Za-z0-9]+)\s*\([^;]+$"
-
 # This table drives the pattern-matching and symbol-harvesting
 patterns = [
        ( 'proto_reg', re.compile(proto_regex0) ),
        ( 'proto_reg', re.compile(proto_regex1) ),
        ( 'handoff_reg', re.compile(handoff_regex0) ),
        ( 'handoff_reg', re.compile(handoff_regex1) ),
-       ( 'tap_reg', re.compile(tap_regex0) ),
-       ( 'tap_reg', re.compile(tap_regex1) ),
        ]
 
 # Open our registration symbol cache
@@ -113,7 +103,6 @@ for filename in filenames:
 #                      print "Pulling %s from cache" % (filename)
                        regs['proto_reg'].extend(cdict['proto_reg'])
                        regs['handoff_reg'].extend(cdict['handoff_reg'])
-                       regs['tap_reg'].extend(cdict['tap_reg'])
                        file.close()
                        continue
        # We don't have a cache entry
@@ -122,7 +111,6 @@ for filename in filenames:
                        'mtime': cur_mtime,
                        'proto_reg': [],
                        'handoff_reg': [],
-                       'tap_reg': [],
                        }
 #      print "Searching %s" % (filename)
        for line in file.readlines():
@@ -144,19 +132,13 @@ if cache is not None and cache_filename is not None:
        cache_file.close()
 
 # Make sure we actually processed something
-if registertype == "taps":
-       if len(regs['tap_reg']) < 1:
-               print "No tap registrations found"
-               sys.exit(1)
-else:
-       if len(regs['proto_reg']) < 1:
-               print "No protocol registrations found"
-               sys.exit(1)
+if len(regs['proto_reg']) < 1:
+       print "No protocol registrations found"
+       sys.exit(1)
 
 # Sort the lists to make them pretty
 regs['proto_reg'].sort()
 regs['handoff_reg'].sort()
-regs['tap_reg'].sort()
 
 reg_code = open(tmp_filename, "w")
 
@@ -183,22 +165,22 @@ G_MODULE_EXPORT void
 plugin_register (void)
 {
 """);
-       for symbol in regs['proto_reg']:
-               line = "  {extern void %s (void); %s ();}\n" % (symbol, symbol)
-               reg_code.write(line)
-               
-       reg_code.write("}\n")
-if registertype == "dissectors":
+else:
        reg_code.write("""
 #include "register.h"
 void
 register_all_protocols(register_cb cb, gpointer client_data)
 {
 """);
-       for symbol in regs['proto_reg']:
+
+for symbol in regs['proto_reg']:
+       if registertype == "plugin":
+               line = "  {extern void %s (void); %s ();}\n" % (symbol, symbol)
+       else:
                line = "  {extern void %s (void); if(cb) (*cb)(RA_REGISTER, \"%s\", client_data); %s ();}\n" % (symbol, symbol, symbol)
-               reg_code.write(line)
-       reg_code.write("}\n")
+       reg_code.write(line)
+
+reg_code.write("}\n")
 
 
 # Make the routine to register all protocol handoffs
@@ -208,22 +190,25 @@ G_MODULE_EXPORT void
 plugin_reg_handoff(void)
 {
 """);
-       for symbol in regs['handoff_reg']:
-               line = "  {extern void %s (void); %s ();}\n" % (symbol, symbol)
-               reg_code.write(line)
-       reg_code.write("}\n")
-       reg_code.write("#endif\n");     
-if registertype == "dissectors":
+else:
        reg_code.write("""
 void
 register_all_protocol_handoffs(register_cb cb, gpointer client_data)
 {
 """);
 
-       for symbol in regs['tap_reg']:
+for symbol in regs['handoff_reg']:
+       if registertype == "plugin":
+               line = "  {extern void %s (void); %s ();}\n" % (symbol, symbol)
+       else:
                line = "  {extern void %s (void); if(cb) (*cb)(RA_HANDOFF, \"%s\", client_data); %s ();}\n" % (symbol, symbol, symbol)
-               reg_code.write(line)
-       reg_code.write("}\n")
+       reg_code.write(line)
+
+reg_code.write("}\n")
+
+if registertype == "plugin":
+       reg_code.write("#endif\n");
+else:
        reg_code.write("""
 gulong register_count(void)
 {
@@ -236,15 +221,6 @@ gulong register_count(void)
 }
 """);
 
-if registertype == "taps":
-       reg_code.write("""
-#include "register.h"
-void register_all_tap_listeners(void) {
-""");
-       for symbol in regs['tap_reg']:
-               line = "  {extern void %s (void); %s ();}\n" % (symbol, symbol)
-               reg_code.write(line)
-       reg_code.write("}\n")
 
 # Close the file
 reg_code.close()