summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2019-03-28 16:45:35 +0100
committerDaniel Friesel <derf@finalrewind.org>2019-03-28 16:45:35 +0100
commit6ac24fe2e631a4c2f5cf61233cb2168351f89e36 (patch)
treed333a04506b66d98375f2f9211b52fc540715746 /lib
parent8c8d157ac537a9c542fe666b5f75c44fad7aac58 (diff)
fix callcycles argument handling
Diffstat (limited to 'lib')
-rwxr-xr-xlib/protocol_benchmarks.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/protocol_benchmarks.py b/lib/protocol_benchmarks.py
index 7bec6a8..6220b94 100755
--- a/lib/protocol_benchmarks.py
+++ b/lib/protocol_benchmarks.py
@@ -81,7 +81,7 @@ class DummyProtocol:
return False
def add_transition(self, code_snippet: str, args: list):
- self.transition_map[code_snippet] = args
+ self.transition_map[code_snippet.rstrip()] = args
return code_snippet
class ArduinoJSON(DummyProtocol):
@@ -501,7 +501,7 @@ class ManualJSON(DummyProtocol):
def add_to_dict(self, key, value, is_last):
if type(value) == str:
if len(value) and value[0] == '$':
- self.buf += 'bout << "\\"{}\\":" << dec << {}'.format(key, value[1:])
+ self.buf += self.add_transition('bout << "\\"{}\\":" << dec << {}'.format(key, value[1:]), [len(key)])
else:
self.buf += self.add_transition('bout << "\\"{}\\":\\"{}\\""'.format(key, value), [len(key), len(value)])
@@ -1355,13 +1355,19 @@ def shorten_call(snippet, lib = ''):
elif 'mpack_start_' in snippet:
snippet = snippet.split(',')[0]
elif 'bout <<' in snippet:
- snippet = 'bout'
+ if '\\":\\"' in snippet:
+ snippet = 'bout << key:str'
+ elif 'bout << "\\"' in snippet:
+ snippet = 'bout << key'
+ else:
+ snippet = 'bout << other'
elif 'msg.' in snippet:
snippet = re.sub('msg.(?:[^[]+)(?:\[.*?\])? = .*', 'msg.? = ?', snippet)
elif lib == 'arduinojson:':
snippet = re.sub('ArduinoJson::JsonObject& [^ ]+ = [^.]+.createNestedObject\([^)]*\);', 'ArduinoJson::JsonObject& ? = ?.createNestedObject(?);', snippet)
snippet = re.sub('ArduinoJson::JsonArray& [^ ]+ = [^.]+.createNestedArray\([^)]*\);', 'ArduinoJson::JsonArray& ? = ?.createNestedArray(?);', snippet)
- snippet = re.sub('root[^[]*\["[^"]*"\] = [^;]+', 'root?["?"] = ?', snippet)
+ snippet = re.sub('root[^[]*\["[^"]*"\] = [^";]+', 'root?["?"] = ?', snippet)
+ snippet = re.sub('root[^[]*\["[^"]*"\] = "[^"]+"', 'root?["?"] = "?"', snippet)
snippet = re.sub('rootl.add\([^)]*\)', 'rootl.add(?)', snippet)
snippet = re.sub('^dec_[^ ]*', 'dec_?', snippet)