[pypy-svn] r23863 - pypy/dist/pypy/doc
arigo at codespeak.net
arigo at codespeak.net
Wed Mar 1 22:18:05 CET 2006
Author: arigo
Date: Wed Mar 1 22:17:51 2006
New Revision: 23863
Modified:
pypy/dist/pypy/doc/ctypes-integration.txt
Log:
CTypes: actually, all objects sometimes need an owning or non-owning version.
Modified: pypy/dist/pypy/doc/ctypes-integration.txt
==============================================================================
--- pypy/dist/pypy/doc/ctypes-integration.txt (original)
+++ pypy/dist/pypy/doc/ctypes-integration.txt Wed Mar 1 22:17:51 2006
@@ -120,8 +120,7 @@
Primitive Types
~~~~~~~~~~~~~~~
Ctypes' primitive types are mapped directly to the correspondending PyPy
-LLType: Signed, Float, etc. Primitive values can always be copied around,
-so there is no needed for the "c_data_ref" case here. We get::
+LLType: Signed, Float, etc. For the owned-memory case, we get::
Ptr( GcStruct( "CtypesBox_<TypeName>
( "c_data"
@@ -132,16 +131,30 @@
in LLType we can't take pointers to Signed or Float, only to Struct or
Array.
+The non-owned-memory case is::
+
+ Ptr( GcStruct( "CtypesBox_<TypeName>
+ ( "c_data_ref"
+ (Ptr(Struct "C_Data_<TypeName>
+ ( "value", Signed/Float/etc. ) ) ) ) ) )
+
Pointers
~~~~~~~~
-A C pointer behaves like a primitive value, in that it can be copied
-around. We get::
+
+::
Ptr( GcStruct( "CtypesBox_<TypeName>
( "c_data"
(Struct "C_Data_<TypeName>
( "value", Ptr(...) ) ) ) ) )
+or::
+
+ Ptr( GcStruct( "CtypesBox_<TypeName>
+ ( "c_data_ref"
+ (Ptr(Struct "C_Data_<TypeName>
+ ( "value", Ptr(...) ) ) ) ) ) )
+
However, there is a special case here: the pointer might point to data
owned by another CtypesBox -- i.e. it can point to the "c_data" field of
some other CtypesBox. In this case we must make sure that the other
More information about the Pypy-commit
mailing list