Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

4-strprim/makestr.scm works for python

  • Loading branch information...
commit 7ff58d91ea2b9e7e4d13aa92461a0d728295be84 1 parent 443f324
@Gabriano Gabriano authored
Showing with 37 additions and 3 deletions.
  1. +35 −1 gsc/_t-univ.scm
  2. +2 −2 include/stamp.h
View
36 gsc/_t-univ.scm
@@ -853,6 +853,7 @@ EOF
#<<EOF
#! /usr/bin/python
+from array import array
import ctypes
glo = {}
@@ -863,6 +864,32 @@ nargs = 0
temp1 = False
temp2 = False
+#
+# String
+#
+class String:
+ def __init__ ( self, *args ):
+ self.chars = array('u', list(args))
+
+ def stringset ( self, n, c ):
+ self.chars[n] = c
+
+ def stringref ( self, n ):
+ return self.chars[n]
+
+ def __len__ ( self ):
+ return len(self.chars)
+
+ def __str__ ( self ):
+ return "".join(self.chars)
+
+def makestring ( n, c ):
+ args = [unicode(c)]*n
+ return String(*args)
+
+def stringp ( s ):
+ return isinstance(s, String)
+
def lbl1_println(): # println
global glo, reg, stack, sp, nargs, temp1, temp2
@@ -1586,7 +1613,14 @@ EOF
(translate-gvm-opnd ctx (list-ref opnds 1))
")"))
- ((python ruby php) ;TODO: complete
+ ((python)
+ (gen "makestring("
+ (translate-gvm-opnd ctx (list-ref opnds 0))
+ ", unicode(chr("
+ (translate-gvm-opnd ctx (list-ref opnds 1))
+ ")))"))
+
+ ((ruby php) ;TODO: complete
(gen ""))
(else
View
4 include/stamp.h
@@ -2,5 +2,5 @@
* Time stamp of last source code repository commit.
*/
-#define ___STAMP_YMD 20120606
-#define ___STAMP_HMS 221116
+#define ___STAMP_YMD 20120607
+#define ___STAMP_HMS 3514
Please sign in to comment.
Something went wrong with that request. Please try again.