summaryrefslogtreecommitdiff
path: root/tools/trace/tcreator/tcreator.py
diff options
context:
space:
mode:
authorNélio Laranjeiro2008-11-23 19:35:46 +0100
committerNélio Laranjeiro2008-11-23 19:35:46 +0100
commit7cb8c5f7096be04cd65ec41a5b8f98d0ae3e890a (patch)
tree55fdb7a143ec50712bc9cfd2c9baed9cc57f6e40 /tools/trace/tcreator/tcreator.py
parentf5f92965f6e0df104686875b82d329a65efedd2a (diff)
tools/trace: First version of the trace creator parser source file.
Diffstat (limited to 'tools/trace/tcreator/tcreator.py')
-rw-r--r--tools/trace/tcreator/tcreator.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/trace/tcreator/tcreator.py b/tools/trace/tcreator/tcreator.py
new file mode 100644
index 00000000..e0624259
--- /dev/null
+++ b/tools/trace/tcreator/tcreator.py
@@ -0,0 +1,27 @@
+import sys
+from writer import *
+
+try:
+ from lib.parser import *
+except:
+ print "--> You should run yapps on lib/parser.g"
+
+class TCreator:
+
+ def __init__(self, infile, outfile, enum_name = "trace_id_t"):
+ self.__infile = infile
+ self.__outfile = outfile
+ self.__enum_name = enum_name
+
+ def create (self):
+ infile = open (self.__infile, 'r')
+ data = parse ('parser', infile.read())
+ infile.close()
+
+ w = Writer (self.__outfile, self.__enum_name)
+ outstring = w.parse_list (data)
+
+ if self.__outfile != "":
+ w.write_file (outstring)
+ else:
+ w.print_file (outstring)