Two changes

Changes for KK to be merged into mainline pylibopenflow
Changed show to return a string.
diff --git a/tools/pylibopenflow/bin/pyopenflow-pythonize.py b/tools/pylibopenflow/bin/pyopenflow-pythonize.py
index 466c35d..97b7c8f 100755
--- a/tools/pylibopenflow/bin/pyopenflow-pythonize.py
+++ b/tools/pylibopenflow/bin/pyopenflow-pythonize.py
@@ -7,6 +7,7 @@
 Date December 2009
 """
 import sys
+#@todo Fix this include path mechanism
 sys.path.append('./bin')
 sys.path.append('./pylib')
 import getopt
diff --git a/tools/pylibopenflow/pylib/config.py b/tools/pylibopenflow/pylib/config.py
index b90f630..61c903d 100644
--- a/tools/pylibopenflow/pylib/config.py
+++ b/tools/pylibopenflow/pylib/config.py
@@ -2,28 +2,28 @@
 # of_message specific controls
 
 # Do not include any arrays marked [0]
-IGNORE_ZERO_ARRAYS = 1
+IGNORE_ZERO_ARRAYS = True
 
 # Do not include the ofp_header as a member in any structure
 # This allows messages to be consistently generated as:
 #   explicit header declaration
 #   core member declaration
 #   variable length data
-IGNORE_OFP_HEADER = 1
+IGNORE_OFP_HEADER = True
 
 # Generate object equality functions
-GEN_OBJ_EQUALITY = 1
+GEN_OBJ_EQUALITY = True
 
 # Generate object show functions
-GEN_OBJ_SHOW = 1
+GEN_OBJ_SHOW = True
 
 # Generate lists of enum values
-GEN_ENUM_VALUES_LIST = 0
+GEN_ENUM_VALUES_LIST = False
 
 # Generate dictionary of enum strings to values
-GEN_ENUM_DICTIONARY = 1
+GEN_ENUM_DICTIONARY = True
 
 # Auxilary info:  Stuff written to stdout for additional processing
 # Currently generates a (python) map from a class to a list of
 # the data members; used for documentation
-GEN_AUX_INFO = 1
+GEN_AUX_INFO = True
diff --git a/tools/pylibopenflow/pylib/cpythonize.py b/tools/pylibopenflow/pylib/cpythonize.py
index 23f2e2d..498d41e 100644
--- a/tools/pylibopenflow/pylib/cpythonize.py
+++ b/tools/pylibopenflow/pylib/cpythonize.py
@@ -3,6 +3,7 @@
 Date January 2010
 Created by ykk
 """
+import sys
 import cheader
 import c2py
 import datetime
@@ -277,15 +278,17 @@
                             str(self.rules.get_default_value(struct_in.typename, member.name)))
         return code
 
-    def gen_struct_map(self):
-        print
-        print "# Class to array member map"
-        print "class_to_members_map = {"
+    def gen_struct_map(self, file=None):
+        if not file:
+            file = sys.stdout
+        print >> file
+        print >> file, "# Class to array member map"
+        print >> file, "class_to_members_map = {"
         for name, struct in self.cheader.structs.items():
             if not len(struct.members):
                 continue
             s =  "    '" + name + "'"
-            print s + _space_to(36, s) + ": ["
+            print >> file, s + _space_to(36, s) + ": ["
             prev = None
             for member in struct.members:
                 if re.search('pad', member.name):
@@ -293,10 +296,10 @@
                 if prev:
                     print _space_to(39, "") + "'" + prev + "',"
                 prev = member.name
-            print _space_to(39, "") + "'" + prev + "'"
-            print _space_to(38, "") + "],"
-        print "    '_ignore' : []"
-        print "}"
+            print >> file, _space_to(39, "") + "'" + prev + "'"
+            print >> file, _space_to(38, "") + "],"
+        print >> file, "    '_ignore' : []"
+        print >> file, "}"
 
     def __structassert(self, cstruct, cstructname):
         """Return code to check for C array
@@ -458,25 +461,27 @@
         """
         code = []
         code.append(self.tab+"def show(self, prefix=''):")
-        code.append(self.tab*2+"\"\"\"" + "Print basic members of structure")
+        code.append(self.tab*2+"\"\"\"" + "Generate string showing basic members of structure")
         code.append(self.tab*2+"\"\"\"")
+        code.append(self.tab*2+"outstr = ''")
         for member in struct_in.members:
             if re.search('pad', member.name):
                 continue
             elif (isinstance(member, cheader.cstruct)):
-                code.append(self.tab*2 + "print prefix + '" + 
-                            member.name + ": ' ")
+                code.append(self.tab*2 + "outstr += prefix + '" + 
+                            member.name + ": \\n' ")
                 code.append(self.tab*2 + "self." + member.name + 
                             ".show(prefix + '  ')")
             elif (isinstance(member, cheader.carray) and
                   not isinstance(member.object, cheader.cprimitive)):
-                code.append(self.tab*2 + "print prefix + '" + member.name +
-                            ": ' ")
+                code.append(self.tab*2 + "outstr += prefix + '" + member.name +
+                            ": \\n' ")
                 code.append(self.tab*2 + "for obj in self." + member.name + ":")
-                code.append(self.tab*3 + "obj.show(prefix + '  ')")
+                code.append(self.tab*3 + "outstr += obj.show(prefix + '  ')")
             else:
-                code.append(self.tab*2 + "print prefix + '" + member.name +
-                            ": ' + str(self." + member.name + ")")
+                code.append(self.tab*2 + "outstr += prefix + '" + member.name +
+                            ": ' + str(self." + member.name + ") + '\\n'")
+        code.append(self.tab*2+"return outstr")
         return code
 
     def codeunpack(self, struct_in, prefix="!"):