Revision: 1371
http://pygccxml.svn.sourceforge.net/pygccxml/?rev=1371&view=rev
Author: roman_yakovenko
Date: 2008-07-14 11:14:53 -0700 (Mon, 14 Jul 2008)
Log Message:
-----------
adding initial support for ctypes module
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_repository/__init__.py
Added Paths:
-----------
pyplusplus_dev/pyplusplus/code_repository/ctypes_integration.py
Modified: pyplusplus_dev/pyplusplus/code_repository/__init__.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_repository/__init__.py 2008-07-14 04:24:28 UTC (rev 1370)
+++ pyplusplus_dev/pyplusplus/code_repository/__init__.py 2008-07-14 18:14:53 UTC (rev 1371)
@@ -19,15 +19,15 @@
import convenience
import return_range
import call_policies
-#import ctypes_integration
+import ctypes_integration
all = [ array_1
, gil_guard
, convenience
, call_policies
, named_tuple
- , return_range ]
- #, ctypes_integration ]
+ , return_range
+ , ctypes_integration ]
headers = map( lambda f: f.file_name, all )
Added: pyplusplus_dev/pyplusplus/code_repository/ctypes_integration.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_repository/ctypes_integration.py (rev 0)
+++ pyplusplus_dev/pyplusplus/code_repository/ctypes_integration.py 2008-07-14 18:14:53 UTC (rev 1371)
@@ -0,0 +1,57 @@
+# Copyright 2004 Roman Yakovenko.
+# Distributed under the Boost Software License, Version 1.0. (See
+# accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
+
+"""
+This file contains C++ code needed to export one dimensional static arrays.
+"""
+
+
+namespace = "pyplusplus::convenience"
+
+file_name = "__ctypes_integration.pypp.hpp"
+
+code = \
+"""// Copyright 2004 Roman Yakovenko.
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef __ctypes_integration_pyplusplus_hpp__
+#define __ctypes_integration_pyplusplus_hpp__
+
+#include "boost/python.hpp"
+#include "boost/utility/addressof.hpp"
+#include "boost/mpl/vector.hpp"
+#include "boost/function.hpp"
+#include "boost/cstdint.hpp"
+#include "boost/bind.hpp"
+
+
+namespace pyplusplus{ namespace convenience{
+
+template< typename TType, typename TMemVarType >
+boost::uintmax_t
+addressof( const TType &inst, const TMemVarType TType::* offset){
+ return boost::uintmax_t( boost::addressof( inst.*offset ) );
+}
+
+template< typename TType, typename TMemVarType >
+boost::python::object
+make_addressof_getter( const TMemVarType TType::* offset ){
+ namespace bpl = boost::python;
+ namespace pyppc = pyplusplus::convenience;
+ return bpl::make_function( boost::bind( &pyppc::addressof< TType, TMemVarType >, _1, offset )
+ , bpl::default_call_policies()
+ , boost::mpl::vector< boost::uintmax_t, const TType& >() );
+}
+
+} /*pyplusplus*/ } /*convenience*/
+
+namespace pyplus_conv = pyplusplus::convenience;
+
+#endif//__ctypes_integration_pyplusplus_hpp__
+
+"""
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|