aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYannik Enss <Yannik.Enss@rohde-schwarz.com>2019-05-29 14:19:41 +0200
committerGerald Combs <gerald@wireshark.org>2019-06-05 16:51:50 +0000
commit3f3337b2ca8ce07fd4418fa40b6e0dbdf7dd8ab3 (patch)
tree6042fb2d0f4351800076bb1022fc02fe91a4e294
parent1c09af410db664a46fcd1158cb4f669df302ce6b (diff)
idl2wrs: add aggressive mode
add a mode to ignore a few optimisations in favor of working output Change-Id: I875cec5a80e9449e9fd954d4ff6a21e5b128db5e Reviewed-on: https://code.wireshark.org/review/33459 Reviewed-by: Gerald Combs <gerald@wireshark.org>
-rwxr-xr-xtools/wireshark_be.py3
-rwxr-xr-xtools/wireshark_gen.py11
2 files changed, 9 insertions, 5 deletions
diff --git a/tools/wireshark_be.py b/tools/wireshark_be.py
index cae15d3aa9..2125e04038 100755
--- a/tools/wireshark_be.py
+++ b/tools/wireshark_be.py
@@ -258,6 +258,7 @@ class WiresharkVisitor:
def run(tree, args):
DEBUG = "debug" in args
+ AGGRESSIVE = "aggressive" in args
st = output.Stream(sys.stdout, 4) # set indent for stream
ev = WiresharkVisitor(st, DEBUG) # create visitor object
@@ -291,7 +292,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", debug=DEBUG)
+ eg = wireshark_gen_C(ev.st, string.upper(nl), string.lower(nl), string.capitalize(nl) + " Dissector Using GIOP API", debug=DEBUG, aggressive=AGGRESSIVE)
eg.genCode(ev.oplist, ev.atlist, ev.enlist, ev.stlist, ev.unlist) # pass them onto the C generator
#
diff --git a/tools/wireshark_gen.py b/tools/wireshark_gen.py
index cc970b3631..c8a2905d89 100755
--- a/tools/wireshark_gen.py
+++ b/tools/wireshark_gen.py
@@ -140,8 +140,9 @@ class wireshark_gen_C:
# Constructor
#
- def __init__(self, st, protocol_name, dissector_name ,description, debug=False):
+ def __init__(self, st, protocol_name, dissector_name ,description, debug=False, aggressive=False):
self.DEBUG = debug
+ self.AGGRESSIVE = aggressive
self.st = output.Stream(tempfile.TemporaryFile(),4) # for first pass only
@@ -308,7 +309,7 @@ class wireshark_gen_C:
#self.get_CDR_alias(rt, rt.name() )
if (rt.unalias().kind() == idltype.tk_sequence):
self.st.out(self.template_hf, name=sname + "_return_loop")
- if (self.isSeqNativeType(rt.unalias().seqType())):
+ if (self.isSeqNativeType(rt.unalias().seqType())) or self.AGGRESSIVE:
self.st.out(self.template_hf, name=sname + "_return")
elif ((rt.unalias().kind() != idltype.tk_struct) and \
(rt.unalias().kind() != idltype.tk_objref) and \
@@ -324,7 +325,7 @@ class wireshark_gen_C:
for p in op.parameters():
if (p.paramType().unalias().kind() == idltype.tk_sequence):
self.st.out(self.template_hf, name=sname + "_" + p.identifier() + "_loop")
- if (self.isSeqNativeType(p.paramType().unalias().seqType())):
+ if (self.isSeqNativeType(p.paramType().unalias().seqType())) or self.AGGRESSIVE:
self.st.out(self.template_hf, name=sname + "_" + p.identifier())
elif ((p.paramType().unalias().kind() != idltype.tk_any) and \
(p.paramType().unalias().kind() != idltype.tk_struct) and \
@@ -373,7 +374,7 @@ class wireshark_gen_C:
for decl in m.declarators():
if (m.memberType().unalias().kind() == idltype.tk_sequence):
self.st.out(self.template_hf, name=sname + "_" + decl.identifier() + "_loop")
- if (self.isSeqNativeType(m.memberType().unalias().seqType())):
+ if (self.isSeqNativeType(m.memberType().unalias().seqType())) or self.AGGRESSIVE:
self.st.out(self.template_hf, name=sname + "_" + decl.identifier())
else:
if (m.memberType().unalias().kind() == idltype.tk_wchar):
@@ -1541,6 +1542,8 @@ class wireshark_gen_C:
un_need_item = 1
else:
un_need_item = 1
+ if self.AGGRESSIVE:
+ un_need_item = 1
sname = self.namespace(un, "_")
self.curr_sname = sname # update current opnode/exnode/stnode/unnode scoped name