]> granicus.if.org Git - libevent/commitdiff
proxy one more generator
authorNiels Provos <provos@gmail.com>
Thu, 3 Apr 2008 14:27:01 +0000 (14:27 +0000)
committerNiels Provos <provos@gmail.com>
Thu, 3 Apr 2008 14:27:01 +0000 (14:27 +0000)
svn:r701

event_rpcgen.py

index 8f29edbd07b8345cbf5a661b51ef14aae9907e5e..82982467f860e1f1b2817313fca8c8292f1f4a56 100755 (executable)
@@ -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':