[pypy-svn] r13631 - in pypy/dist/pypy: rpython translator/c

ac at codespeak.net ac at codespeak.net
Mon Jun 20 18:31:54 CEST 2005


Author: ac
Date: Mon Jun 20 18:31:54 2005
New Revision: 13631

Added:
   pypy/dist/pypy/translator/c/char_include.h   (contents, props changed)
Modified:
   pypy/dist/pypy/rpython/llinterp.py
   pypy/dist/pypy/rpython/rint.py
   pypy/dist/pypy/translator/c/g_include.h
   pypy/dist/pypy/translator/c/primitive.py
Log:
Make rpystone work.

Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py	(original)
+++ pypy/dist/pypy/rpython/llinterp.py	Mon Jun 20 18:31:54 2005
@@ -235,7 +235,7 @@
         assert type(b) is bool
         return int(b)
 
-    def op_cast_int_to_chr(self, b):
+    def op_cast_int_to_char(self, b):
         assert type(b) is int
         return chr(b)
 

Modified: pypy/dist/pypy/rpython/rint.py
==============================================================================
--- pypy/dist/pypy/rpython/rint.py	(original)
+++ pypy/dist/pypy/rpython/rint.py	Mon Jun 20 18:31:54 2005
@@ -290,5 +290,5 @@
 class __extend__(pairtype(IntegerRepr, CharRepr)):
         def convert_from_to((r_from, r_to), v, llops):
             if r_from.lowleveltype == Signed:
-                return llops.genop('cast_int_to_chr', [v], resulttype=Char)
+                return llops.genop('cast_int_to_char', [v], resulttype=Char)
             return NotImplemented

Added: pypy/dist/pypy/translator/c/char_include.h
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/translator/c/char_include.h	Mon Jun 20 18:31:54 2005
@@ -0,0 +1,15 @@
+/************************************************************/
+/***  C header subsection: operations between chars       ***/
+
+/*** unary operations ***/
+
+/***  binary operations ***/
+
+
+#define OP_CHAR_EQ(x,y,r,err)	  r = ((x) == (y));
+#define OP_CHAR_NE(x,y,r,err)	  r = ((x) != (y));
+#define OP_CHAR_LE(x,y,r,err)	  r = ((x) <= (y));
+#define OP_CHAR_GT(x,y,r,err)	  r = ((x) >  (y));
+#define OP_CHAR_LT(x,y,r,err)	  r = ((x) <  (y));
+#define OP_CHAR_GE(x,y,r,err)	  r = ((x) >= (y));
+

Modified: pypy/dist/pypy/translator/c/g_include.h
==============================================================================
--- pypy/dist/pypy/translator/c/g_include.h	(original)
+++ pypy/dist/pypy/translator/c/g_include.h	Mon Jun 20 18:31:54 2005
@@ -16,6 +16,7 @@
 #include "g_module.h"
 
 #include "int_include.h"
+#include "char_include.h"
 #include "float_include.h"
 #include "ll_include.h"
 #include "pyobj_include.h"

Modified: pypy/dist/pypy/translator/c/primitive.py
==============================================================================
--- pypy/dist/pypy/translator/c/primitive.py	(original)
+++ pypy/dist/pypy/translator/c/primitive.py	Mon Jun 20 18:31:54 2005
@@ -21,7 +21,7 @@
 def name_char(value):
     assert type(value) is str and len(value) == 1
     if ' ' <= value < '\x7f':
-        return "'%s'" % (value.replace("'", r"\'").replace("\\", r"\\"),)
+        return "'%s'" % (value.replace("\\", r"\\").replace("'", r"\'"),)
     else:
         return '%d' % ord(value)
 



More information about the Pypy-commit mailing list