Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed print() for newer Python versions, also whitespace issues #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions tools/make-dissector-reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
*/
"""
else:
print "Unknown output type '%s'" % registertype
print( "Unknown output type '%s'" % registertype)
sys.exit(1)


Expand All @@ -77,7 +77,7 @@
filenames.append(os.path.join(srcdir, file))

if len(filenames) < 1:
print "No files found"
print( "No files found")
sys.exit(1)


Expand Down Expand Up @@ -130,7 +130,7 @@
if cache and cache.has_key(filename):
cdict = cache[filename]
if cur_mtime == cdict['mtime']:
# print "Pulling %s from cache" % (filename)
# print( "Pulling %s from cache" % (filename))
regs['proto_reg'].extend(cdict['proto_reg'])
regs['handoff_reg'].extend(cdict['handoff_reg'])
regs['wtap_register'].extend(cdict['wtap_register'])
Expand All @@ -144,7 +144,7 @@
'handoff_reg': [],
'wtap_register': [],
}
# print "Searching %s" % (filename)
# print( "Searching %s" % (filename))
for line in file.readlines():
for action in patterns:
regex = action[1]
Expand All @@ -154,7 +154,7 @@
sym_type = action[0]
regs[sym_type].append(symbol)
if cache is not None:
# print "Caching %s for %s: %s" % (sym_type, filename, symbol)
# print( "Caching %s for %s: %s" % (sym_type, filename, symbol))
cache[filename][sym_type].append(symbol)
file.close()

Expand All @@ -165,7 +165,7 @@

# Make sure we actually processed something
if len(regs['proto_reg']) < 1:
print "No protocol registrations found"
print( "No protocol registrations found")
sys.exit(1)

# Sort the lists to make them pretty
Expand Down Expand Up @@ -246,22 +246,18 @@
register_wtap_module(void)
{
""");

for symbol in regs['wtap_register']:
line = " {extern void %s (void); %s ();}\n" % (symbol, symbol)
reg_code.write(line)

reg_code.write("}\n");
reg_code.write("#endif\n");
reg_code.write("#endif\n");
else:
reg_code.write("""
static gulong proto_reg_count(void)
{
""");

line = " return %d;\n" % len(regs['proto_reg'])
reg_code.write(line)

reg_code.write("""
}
""");
Expand Down