[pypy-commit] extradoc extradoc: example code

fijal noreply at buildbot.pypy.org
Sat Jun 30 22:03:57 CEST 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: extradoc
Changeset: r4237:549b9fe51082
Date: 2012-06-30 22:03 +0200
http://bitbucket.org/pypy/extradoc/changeset/549b9fe51082/

Log:	example code

diff --git a/talk/ep2012/stm/talk.rst b/talk/ep2012/stm/talk.rst
--- a/talk/ep2012/stm/talk.rst
+++ b/talk/ep2012/stm/talk.rst
@@ -176,8 +176,17 @@
 CFFI slide
 ----------
 
-* XXX a bit of example code
+some example code::
 
+  >>> from cffi import FFI
+  >>> ffi = FFI()
+  >>> ffi.cdef("""
+  ...     int printf(const char *format, ...);
+  ... """)
+  >>> C = ffi.dlopen(None)
+  >>> arg = ffi.new("char[]", "world")
+  >>> C.printf("hi there, %s!\n", arg)
+  hi there, world!
 
 STM
 ---


More information about the pypy-commit mailing list