[pypy-svn] r18485 - pypy/dist/pypy/translator/js

ericvrp at codespeak.net ericvrp at codespeak.net
Wed Oct 12 17:07:03 CEST 2005


Author: ericvrp
Date: Wed Oct 12 17:07:02 2005
New Revision: 18485

Modified:
   pypy/dist/pypy/translator/js/arraynode.py
   pypy/dist/pypy/translator/js/structnode.py
Log:
* remove string null termination

* fix incorrect struct instance syntax



Modified: pypy/dist/pypy/translator/js/arraynode.py
==============================================================================
--- pypy/dist/pypy/translator/js/arraynode.py	(original)
+++ pypy/dist/pypy/translator/js/arraynode.py	Wed Oct 12 17:07:02 2005
@@ -156,9 +156,10 @@
     def get_arrayvalue(self):
         items = self.value.items
         item_length = len(items)
-        if item_length == 0 or items[-1] != chr(0):
-            items = items + [chr(0)]
-            item_length += 1
+        #don't force null termination anymore!
+        #if item_length == 0 or items[-1] != chr(0):
+        #    items = items + [chr(0)]
+        #    item_length += 1
         s = []
         for c in items:
             if ord(c) in StrArrayNode.printables:

Modified: pypy/dist/pypy/translator/js/structnode.py
==============================================================================
--- pypy/dist/pypy/translator/js/structnode.py	(original)
+++ pypy/dist/pypy/translator/js/structnode.py	Wed Oct 12 17:07:02 2005
@@ -83,7 +83,7 @@
         self.db = db
         self.value = value
         self.structtype = self.value._TYPE
-        prefix = 'structinstance.'
+        prefix = 'structinstance_'
         name = str(value).split()[1]
         self.ref = self.make_ref(prefix, name)
         self._get_ref_cache = None
@@ -152,7 +152,7 @@
             name = self._get_types[i][0]
             var  = (name, str(value))
             vars.append(var)
-        return "(%s)" % ", ".join(["{%s:%s}" % var for var in vars])
+        return "({%s})" % ", ".join(["%s:%s" % var for var in vars])
 
         #values = self._getvalues()
         #all_values = ",\n  ".join(values)



More information about the Pypy-commit mailing list