[pypy-svn] r38384 - pypy/dist/pypy/doc
antocuni at codespeak.net
antocuni at codespeak.net
Sat Feb 10 15:05:05 CET 2007
Author: antocuni
Date: Sat Feb 10 15:05:05 2007
New Revision: 38384
Modified:
pypy/dist/pypy/doc/getting-started.txt
pypy/dist/pypy/doc/translation.txt
Log:
Some more info about pypy.net
Modified: pypy/dist/pypy/doc/getting-started.txt
==============================================================================
--- pypy/dist/pypy/doc/getting-started.txt (original)
+++ pypy/dist/pypy/doc/getting-started.txt Sat Feb 10 15:05:05 2007
@@ -488,9 +488,9 @@
Translating the flow graph to CLI code
++++++++++++++++++++++++++++++++++++++
-Use the CLI backend to translate the flowgraphs into .NET executables:
+Use the `CLI backend`_ to translate the flowgraphs into .NET executables:
``gencli`` is quite mature now and can also compile the whole
-interpreter. You can try out the CLI backend from the interactive
+interpreter. You can try out the `CLI backend`_ from the interactive
translator shell::
>>> def myfunc(a, b): return a+b
@@ -743,7 +743,7 @@
Translating using the CLI backend
+++++++++++++++++++++++++++++++++
-To create a standalone .NET executable using the CLI backend::
+To create a standalone .NET executable using the `CLI backend`_::
./translate.py --text --batch --backend=cli targetpypystandalone.py
@@ -775,6 +775,36 @@
fine. Once assembled, you can run the produced executable with the
Microsoft Runtime.
+You can also try the still very experimental ``clr`` module that
+enables integration with the surrounding .NET environment. First, you
+have to tell translate.py to include the ``clr`` module::
+
+ ./translate.py --text --batch --backend=cli targetpypystandalone.py --withmod-clr
+
+Then, you can dynamically load .NET classes using the
+``clr.load_cli_classe`` method. After a class has been loaded, you can
+instantiate and use it as it were a normal Python class. Special
+methods such as indexers and properties are supported using the usual
+Python syntax:
+
+ >>>> import clr
+ >>>> ArrayList = clr.load_cli_class('System.Collections', 'ArrayList')
+ >>>> obj.Add(1)
+ 0
+ >>>> obj.Add(2)
+ 1
+ >>>> obj.Add("foo")
+ 2
+ >>>> print obj[0], obj[1], obj[2]
+ 1 2 foo
+ >>>> print obj.Count
+ 3
+
+At the moment the only way to load a .NET class is to explicitly use
+``clr.load_cli_class``; in the future they will be automatically
+loaded when accessing .NET namespaces as they were Python modules, as
+IronPython does.
+
.. _`start reading sources`:
Where to start reading the sources
@@ -900,6 +930,7 @@
.. _`.NET Frameword SDK 2.0`: http://msdn.microsoft.com/netframework/downloads/updates/default.aspx
.. _Mono: http://www.mono-project.com/Main_Page
+.. _`CLI backend`: cli-backend.html
.. _Dot Graphviz: http://www.graphviz.org/
.. _Pygame: http://www.pygame.org/
Modified: pypy/dist/pypy/doc/translation.txt
==============================================================================
--- pypy/dist/pypy/doc/translation.txt (original)
+++ pypy/dist/pypy/doc/translation.txt Sat Feb 10 15:05:05 2007
@@ -775,13 +775,13 @@
GenCLI
++++++
-GenCLI targets the `Common Language Infrastructure`_, the most famous
+GenCLI_ targets the `Common Language Infrastructure`_, the most famous
implementations of which are Microsoft's `.NET`_ and Mono_.
-It is probably the most advanced of the object oriented backends -- it can
-compile our two standard benchmarks, RPyStone (CPython's PyStone benchmark
-modified slightly to be RPython) and a RPython version of the common Richards
-benchmark.
+It is the most advanced of the object oriented backends -- it can
+compile the PyPy interpreter as well as our two standard benchmarks,
+RPyStone (CPython's PyStone benchmark modified slightly to be RPython)
+and a RPython version of the common Richards benchmark.
It is almost entirely the work of Antonio Cuni, who started this
backend as part of his `Master's thesis`_, the Google's Summer of Code
@@ -791,6 +791,7 @@
.. _`.NET`: http://www.microsoft.com/net/
.. _Mono: http://www.mono-project.com/
.. _`Master's thesis`: http://codespeak.net/~antocuni/Implementing%20Python%20in%20.NET.pdf
+.. _GenCLI: cli-backend.html
GenJVM
++++++
More information about the pypy-svn
mailing list