idl2wrs: add debug command line parameter
convert the "DEBUG" constant to a command line parameter Change-Id: I7f873d85fa053cb9298bd03444125d0160ef4640 Reviewed-on: https://code.wireshark.org/review/33456 Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
parent
54cccedfbe
commit
54db60f4e5
|
@ -57,9 +57,8 @@ from wireshark_gen import wireshark_gen_C
|
|||
|
||||
class WiresharkVisitor:
|
||||
|
||||
DEBUG = 0 # debug flag
|
||||
|
||||
def __init__(self, st):
|
||||
def __init__(self, st, debug=False):
|
||||
self.DEBUG = debug
|
||||
self.st = st
|
||||
self.oplist = [] # list of operation nodes
|
||||
self.enlist = [] # list of enum nodes
|
||||
|
@ -258,8 +257,10 @@ class WiresharkVisitor:
|
|||
|
||||
def run(tree, args):
|
||||
|
||||
DEBUG = "debug" in args
|
||||
|
||||
st = output.Stream(sys.stdout, 4) # set indent for stream
|
||||
ev = WiresharkVisitor(st) # create visitor object
|
||||
ev = WiresharkVisitor(st, DEBUG) # create visitor object
|
||||
|
||||
ev.visitAST(tree) # go find some operations
|
||||
|
||||
|
@ -273,7 +274,7 @@ def run(tree, args):
|
|||
nl = string.split(fname,".")[0] # split name of main IDL file using "." as separator
|
||||
# and grab first field (eg: CosNaming)
|
||||
|
||||
if ev.DEBUG:
|
||||
if DEBUG:
|
||||
for i in ev.oplist:
|
||||
print "XXX - Operation node ", i, " repoId() = ", i.repoId()
|
||||
for i in ev.atlist:
|
||||
|
@ -290,7 +291,7 @@ def run(tree, args):
|
|||
# and generate some C code
|
||||
|
||||
|
||||
eg = wireshark_gen_C(ev.st, string.upper(nl), string.lower(nl), string.capitalize(nl) + " Dissector Using GIOP API")
|
||||
eg = wireshark_gen_C(ev.st, string.upper(nl), string.lower(nl), string.capitalize(nl) + " Dissector Using GIOP API", debug=DEBUG)
|
||||
eg.genCode(ev.oplist, ev.atlist, ev.enlist, ev.stlist, ev.unlist) # pass them onto the C generator
|
||||
|
||||
#
|
||||
|
|
|
@ -115,13 +115,6 @@ import tempfile
|
|||
|
||||
class wireshark_gen_C:
|
||||
|
||||
|
||||
#
|
||||
# Turn DEBUG stuff on/off
|
||||
#
|
||||
|
||||
DEBUG = 0
|
||||
|
||||
#
|
||||
# Some string constants for our templates
|
||||
#
|
||||
|
@ -147,7 +140,9 @@ class wireshark_gen_C:
|
|||
# Constructor
|
||||
#
|
||||
|
||||
def __init__(self, st, protocol_name, dissector_name ,description):
|
||||
def __init__(self, st, protocol_name, dissector_name ,description, debug=False):
|
||||
self.DEBUG = debug
|
||||
|
||||
self.st = output.Stream(tempfile.TemporaryFile(),4) # for first pass only
|
||||
|
||||
self.st_save = st # where 2nd pass should go
|
||||
|
|
Loading…
Reference in New Issue