Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r2107 - trunk/Core/Util


Chronological Thread 
  • From: "James Bigler" <bigler@cs.utah.edu>
  • To: manta@sci.utah.edu
  • Subject: [Manta] r2107 - trunk/Core/Util
  • Date: Thu, 21 Feb 2008 22:37:50 -0700 (MST)

Author: bigler
Date: Thu Feb 21 22:37:49 2008
New Revision: 2107

Modified:
   trunk/Core/Util/genCallbacks.py
Log:
Core/Util/genCallbacks.py

  Refactored a little of the code.

  Made a SourceFile class that I can use to inherit from with other classes.


Modified: trunk/Core/Util/genCallbacks.py
==============================================================================
--- trunk/Core/Util/genCallbacks.py     (original)
+++ trunk/Core/Util/genCallbacks.py     Thu Feb 21 22:37:49 2008
@@ -31,9 +31,7 @@
             constant_text = ""
         base = "Callback_%dData_%dArg%s<T" % (self.num_call_time_args, 
self.num_creation_time_args, constant_text)
         type_list = self.typeList()
-        if (len(type_list) > 0):
-            base += ", " + self.format(type_list)
-        base += ">"
+        base += self.format(type_list, begin_seperator=", ") + ">"
         return base
 
     def typeList(self):
@@ -79,12 +77,8 @@
         return result
 
 
-def addFunctions(functions, num_call_time_args, creation_time_arg_sizes):
-    for T in creation_time_arg_sizes:
-        functions.append(Function(num_call_time_args, T))
-
-class CallbackH:
-    def __init__(self, filename = "Callback.h"):
+class SourceFile:
+    def __init__(self, filename):
         self.file = open(filename, "w")
         self.indent_ammount = 0
 
@@ -108,6 +102,10 @@
         else:
             self.file.write(" " * indent_ammount + string + "\n")
 
+class CallbackH (SourceFile):
+    def __init__(self, filename = "test-Callback.h"):
+        SourceFile.__init__(self, filename)
+
     def writeStart(self):
         self.write("/*")
         self.indent()
@@ -197,6 +195,10 @@
                 self.write("#endif // #ifndef SWIG", indent_ammount=0)
             self.write("")
 
+
+def addFunctions(functions, num_call_time_args, creation_time_arg_sizes):
+    for T in creation_time_arg_sizes:
+        functions.append(Function(num_call_time_args, T))
 
 def main():
     static_functions = []




  • [Manta] r2107 - trunk/Core/Util, James Bigler, 02/22/2008

Archive powered by MHonArc 2.6.16.

Top of page