MyGit

0.2

xdress/xdress

版本发布时间: 2013-07-03 22:29:30

xdress/xdress最新发布版本:0.4(2014-02-27 08:11:31)

XDress 0.2 Release Notes

XDress is an automatic wrapper generator for C/C++ written in pure Python. Currently, xdress may generate Python bindings (via Cython) for C++ classes, functions, and certain variable types. It also contains idiomatic wrappers for C++ standard library containers (sets, vectors, maps). In the future, other tools and bindings will be supported.

The main enabling feature of xdress is a dynamic type system that was designed with the purpose of API generation in mind.

Release highlights:

Please visit the website for more information: http://xdress.org/

Ask questions on the mailing list: xdress@googlegroups.com

Download the code from GitHub: http://github.com/xdress/xdress

XDress is free & open source (BSD 2-clause license) and requires Python 2.7, NumPy 1.5+, Cython 0.19+, and optionally GCC-XML, pycparser, and lxml.

New Features

First Class C Support

Wrapping C code is now fully handled through with the optional pycparser. This means that you don't have to worry about whether or not the GCC-XML parser will work on your particular bit of code. Furthermore, C structs and their members are now handled idiomatically. (C++ structs are actually treated as C++ classes, which means that their are allowed to have constructors and other C++ concepts not present in C.)

Python 3 Support

The entire code base is built and tested under Python 3.3. This uses the single code base model, as most development takes pace in Python 2.7. The Cython code that is generated may be used by both Python 2 & 3.

Type System

The type system has been expanded and hardened to handle additional use cases, largely motivated by the desire for realistic C support.

A new function pointer (fucntion_pointer) refinement type has been added. When converting from C to Python, a new function object is created that wraps the underlying call. For converting from Python to C, a virtual table of callback functions is constructed that have the same signature of the pointer but hold a reference to a Python function. The size of the table and thus how many callbacks you can have before overwriting previous ones, is set by the max_callbacks key in the extra dictionary in class descriptions. This defaults to 8.

A new enum refinement type now also comes stock. These may be exposed to Python in the rc.variables list.

The type system now also comes with basic type matching tools. There is a new TypeMatcher class, a matches() function, and a singleton MatchAny that may be used for determining whether a type adheres to a pattern. The TypeMatcher class itself is immutable and hashable and therefore may be used anywhere other type elements (tuples, str, int) may be used including as dict keys! This is helpful for specifying conversions for large groups of types.

Finally, the type system conversion dictionaries now accept callable objects as values. This was put in to handle templated types where the number of argument is not in general know beforehand, e.g. enums and function pointers. The values must be callable with only a single argument -- the type itself. For example, lambda t: rtnvalue is valid.

Plugins!

XDress is a suite of tools written on top of a type system. Thus the entire core has been refactored to implement a very nimble and easy plugin system. The plugin mechanism enables external projects with their own code generators to easily hook into the xdress tools. Additionally, this allows users to decide at run time which plugins they want to use.

Mini-FAQ

Authors

An * indicates a first time contributor.

Links

  1. Homepage - http://xdress.org/
  2. Mailing List - xdress@googlegroups.com
  3. GitHub Organization - https://github.com/xdress
  4. Pycparser - https://pypi.python.org/pypi/pycparser

相关地址:原始地址 下载(tar) 下载(zip)

查看:2013-07-03发行的版本