From 7cb8c5f7096be04cd65ec41a5b8f98d0ae3e890a Mon Sep 17 00:00:00 2001 From: NĂ©lio Laranjeiro Date: Sun, 23 Nov 2008 19:35:46 +0100 Subject: tools/trace: First version of the trace creator parser source file. --- tools/trace/lib/traceclass.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tools/trace/lib/traceclass.py (limited to 'tools/trace/lib/traceclass.py') diff --git a/tools/trace/lib/traceclass.py b/tools/trace/lib/traceclass.py new file mode 100644 index 00000000..3dd07142 --- /dev/null +++ b/tools/trace/lib/traceclass.py @@ -0,0 +1,43 @@ +# Define the trace Param. +class TraceParam: + def __init__ (self, name, length): + self.__name = name + + if (length == 0) or (length == 3) or (length > 4): + self.__length = 0 + raise Exception ("Length not permitted") + else: + self.__length = length + + def name (self): + return self.__name + + def length (self): + return self.__length + +# Defines the Events of the trace module. +class TraceEvent: + def __init__(self, name = ''): + self.__name = name + self.__param_list = list() + self.__string = "" + + def name (self): + return self.__name + + def param_add (self, name, length): + param = TraceParam (name, length) + self.__param_list.append(param) + + def param_get (self, pos): + if pos <= len (self.__param_list): + return self.__param_list[pos] + + def param_nb (self): + return len(self.__param_list) + + def string_set (self, string = ""): + self.__string = string + + def string_get (self): + return self.__string -- cgit v1.2.3