[pypy-svn] r22548 - in pypy/dist/pypy/rpython: . module

ericvrp at codespeak.net ericvrp at codespeak.net
Mon Jan 23 19:28:23 CET 2006


Author: ericvrp
Date: Mon Jan 23 19:28:19 2006
New Revision: 22548

Added:
   pypy/dist/pypy/rpython/module/ll_js.py
   pypy/dist/pypy/rpython/rjs.py
Modified:
   pypy/dist/pypy/rpython/extfunctable.py
Log:
Added to be able to call native javascript (external functions).
Currently only eval() is supported and it will probably stay this way,
at least until performance becomes a problem.


Modified: pypy/dist/pypy/rpython/extfunctable.py
==============================================================================
--- pypy/dist/pypy/rpython/extfunctable.py	(original)
+++ pypy/dist/pypy/rpython/extfunctable.py	Mon Jan 23 19:28:19 2006
@@ -231,6 +231,11 @@
                                                   'll_stackless/switch'))
 
 # ___________________________________________________________
+# javascript
+from pypy.rpython import rjs
+declare(rjs.jseval, str, 'll_js/jseval')
+
+# ___________________________________________________________
 # the exceptions that can be implicitely raised by some operations
 standardexceptions = {
     TypeError        : True,

Added: pypy/dist/pypy/rpython/module/ll_js.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rpython/module/ll_js.py	Mon Jan 23 19:28:19 2006
@@ -0,0 +1,5 @@
+from pypy.rpython import rjs
+
+def ll_js_jseval(s):
+    return rjs.jseval(s)
+ll_js_jseval.suggested_primitive = True

Added: pypy/dist/pypy/rpython/rjs.py
==============================================================================
--- (empty file)
+++ pypy/dist/pypy/rpython/rjs.py	Mon Jan 23 19:28:19 2006
@@ -0,0 +1,7 @@
+"""
+This file defines utilities for calling native javascript code in an
+RPython-compliant way, intended for use by genjs.
+"""
+
+def jseval():
+    raise NotImplementedError("only works in translated versions")



More information about the Pypy-commit mailing list