From 812d2fd8fd4dfab158bbc8e278a723363cf29e6e Mon Sep 17 00:00:00 2001 From: Niels Provos Date: Thu, 3 Apr 2008 14:27:01 +0000 Subject: [PATCH] proxy one more generator svn:r701 --- event_rpcgen.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/event_rpcgen.py b/event_rpcgen.py index 8f29edbd..82982467 100755 --- a/event_rpcgen.py +++ b/event_rpcgen.py @@ -52,17 +52,17 @@ class Struct: name = "%s_%s" % (self._name, entry.Name()) return name.upper() + def PrintIndented(self, file, ident, code): + """Takes an array, add indentation to each entry and prints it.""" + for entry in code: + print >>file, '%s%s' % (ident, entry) + class StructCCode(Struct): """ Knows how to generate C code for a struct """ def __init__(self, name): Struct.__init__(self, name) - def PrintIndented(self, file, ident, code): - """Takes an array, add indentation to each entry and prints it.""" - for entry in code: - print >>file, '%s%s' % (ident, entry) - def PrintTags(self, file): """Prints the tag definitions for a structure.""" print >>file, '/* Tag definition for %s */' % self._name @@ -1366,7 +1366,7 @@ def ProcessOneEntry(factory, newstruct, entry): newname = newentry.Name()+ '_array' # Now borgify the new entry. - newentry = EntryArray(newentry) + newentry = factory.EntryArray(newentry) newentry.SetStruct(newstruct) newentry.SetLineCount(line_count) newentry.MakeArray() @@ -1599,6 +1599,9 @@ class CCodeGenerator: def EntryStruct(self, entry_type, name, tag, struct_name): return EntryStruct(entry_type, name, tag, struct_name) + def EntryArray(self, entry): + return EntryArray(entry) + def Generate(factory, filename): ext = filename.split('.')[-1] if ext != 'rpc': -- 2.40.0