=====================================================================
SIP - A Tool for Generating Python Bindings for C and C++ Libraries
=====================================================================
-----------------
Reference Guide
-----------------
:Contact: [email protected]
:Version: 4.4.5
:Copyright: Copyright (c) 2006 Riverbank Computing Limited
.. contents::
.. section-numbering::
Introduction
============
This is the reference guide for SIP 4.4.5. SIP is a tool for
automatically generating `Python <http://www.python.org>`__ bindings for C and
C++ libraries. SIP was originally developed in 1998 for
`PyQt <http://www.riverbankcomputing.co.uk/pyqt/>`__ - the Python bindings for
the Qt GUI toolkit - but is suitable for generating bindings for any C or C++
library.
This version of SIP generates bindings for Python v2.3 or later. If you want
to generate bindings for earlier versions of Python (going back as far as
Python v1.5) then you need to use `SIP v3.x`_.
There are many other similar tools available. One of the original such tools
is `SWIG <http://www.swig.org>`__ and, in fact, SIP is so called because it
started out as a small SWIG. Unlike SWIG, SIP is specifically designed for
bringing together Python and C/C++ and goes to great lengths to make the
integration as tight as possible.
The homepage for SIP is http://www.riverbankcomputing.co.uk/sip/. Here you
will always find the latest stable version, current development snapshots, and
the latest version of this documentation.
License
-------
SIP is licensed under the same terms as Python itself. SIP places no
restrictions on the license you may apply to the bindings you create.
Features
--------
SIP, and the bindings it produces, have the following features.
- bindings are fast to load and minimise memory consumption especially when
only a small sub-set of a large library is being used
- automatic conversion between standard Python and C/C++ data types
- overloading of functions and methods with different argument signatures
- access to a C++ class's protected methods
- the ability to define a Python class that is a sub-class of a C++ class,
including abstract C++ classes
- support for ordinary C++ functions, class methods, static class methods,
virtual class methods and abstract class methods
- the ability to re-implement C++ virtual and abstract methods in Python
- support for global and class variables
- support for global and class operators
- support for C++ namespaces
- support for C++ templates
- support for C++ exceptions and wrapping them as Python exceptions
- the ability to define mappings between C++ classes and similar Python
data types that are automatically invoked
- the ability to automatically exploit any available run time type
information to ensure that the class of a Python instance object matches
the class of the corresponding C++ instance
- full support of the Python global interpreter lock, including the ability
to specify that a C++ function of method may block, therefore allowing
the lock to be released and other Python threads to run
- support for the concept of ownership of a C++ instance (i.e. what part of
the code is responsible for calling the instance's destructor) and how
the ownership may change during the execution of an application
- the ability to generate bindings for a C++ class library that itself is
built on another C++ class library which also has had bindings generated
so that the different bindings integrate and share code properly
- a sophisticated versioning system that allows the full lifetime of a C++
class library, including any platform specific or optional features, to
be described in a single set of specification files
- the ability to include documentation in the specification files which can
be extracted and subsequently processed by external tools
- the ability to include copyright notices and licensing information in the
specification files that is automatically included in all generated
source code
- a build system, written in Python, that you can extend to configure,
compile and install your own bindings without worrying about platform
specific issues
- support for building your extensions using distutils
- SIP, and the bindings it produces, runs under UNIX, Linux, Windows and
MacOS/X
SIP v3.x
--------
SIP v3.x differs from current versions in the following respects.
- It uses Python's classic classes to wrap C++ classes (and so generated
bindings can be built against any version of Python).
- It does not support the creation of bindings for C libraries.
- It does not generate bindings that will work on MacOS/X.
- It is not formally documented. However, most of this document does
apply to SIP v3.x - just don't be surprised if you come across something
that doesn't.
New releases of SIP v3.x may be made in the future, but no significant
development will be done.
SIP Components
--------------
SIP comprises a number of different components.
- The SIP code generator (``sip`` or ``sip.exe``). This processes ``.sip``
specification files and generates C or C++ bindings. It is covered in
detail in `Using SIP`_.
- The SIP header file (``sip.h``). This contains definitions and data
structures needed by the generated C and C++ code.
- The SIP module (``sip.so`` or ``sip.pyd``). This is a Python extension
module that is imported automatically by SIP generated bindings and
provides them with some common utility functions. See also `Using the
SIP Module in Applications`_.
- The SIP build system (``sipconfig.py``). This is a pure Python module
that is created when SIP is configured and encapsulates all the necessary
information about your system including relevant directory names,
compiler and linker flags, and version numbers. It also includes several
Python classes and functions which help you write configuration scripts
for your own bindings. It is covered in detail in `The SIP Build
System`_.
- The SIP distutils extension (``sipdistutils.py``). This is a distutils
extension that can be used to build your extension modules using
distutils and is an alternative to writing configuration scripts with the
SIP build system. This can be as simple as adding your .sip files to the
list of files needed to build the extension module. It is covered in
detail in `Building Your Extension with distutils`_.
Qt Support
----------
SIP has specific support for the creation of bindings based on Trolltech's Qt
toolkit.
The SIP code generator understands the signal/slot type safe callback mechanism
that Qt uses to connect objects together. This allows applications to define
new Python signals, and allows any Python callable object to be used as a slot.
SIP itself does not require Qt to be installed.
Potential Incompatibilities with Earlier Versions
=================================================
SIP v4.4
--------
- The ``SIP_BUILD`` C preprocessor symbol has been removed.
- `sipConvertToCpp()`_, `sipIsSubClassInstance()`_ and the old `Generated
Type Convertors`_ have been deprecated. The functions
`sipCanConvertToInstance()`_, `sipConvertToInstance()`_,
`sipForceConvertToInstance()`_, `sipConvertFromInstance()`_,
`sipConvertFromNewInstance()`_, `sipCanConvertToMappedType()`_,
`sipConvertToMappedType()`_, `sipForceConvertToMappedType()`_ and
`sipConvertFromMappedType()`_ should be used instead. Handwritten
`%ConvertFromTypeCode`_ and `%ConvertToTypeCode`_ now has the
responsibility for using these to implement the ``Transfer`` and
``Tr
没有合适的资源?快使用搜索试试~ 我知道了~
用C-C 实现的成熟的sip协议栈.rar_C++ sip_C++实现SIP协议栈_SIP C++_boatla4_协议实现
共99个文件
c:12个
py:4个
h:4个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 171 浏览量
2022-07-15
20:36:06
上传
评论
收藏 267KB RAR 举报
温馨提示
C++实现SPI协议栈,大家可以看看。。。。
资源推荐
资源详情
资源评论
收起资源包目录
用C-C 实现的成熟的sip协议栈.rar (99个子文件)
249877
www.pudn.com.txt 218B
sip-4.4.5
configure.py 12KB
THANKS 394B
siputils.py 69KB
sipgen
main.c 9KB
heap.c 2KB
gencode.c 194KB
lexer.c 92KB
parser.h 6KB
transform.c 58KB
sipgen.sbf 534B
parser.y 102KB
lexer.l 11KB
sip.h 33KB
parser.c 194KB
custom
customw.c 2KB
custom.c 2KB
mkcustom.py 3KB
specs
bsdi-g++ 2KB
freebsd-g++34 2KB
freebsd-g++ 2KB
irix-cc-o32 2KB
linux-pgcc 2KB
cygwin-g++ 2KB
linux-g++ 2KB
win32-msvc 3KB
hpux-cc 3KB
linux-cxx 2KB
win32-msvc2005 3KB
linux-ecc-64 2KB
hpux-acc-64 4KB
linux-g++-32 2KB
linux-g++-64 2KB
openbsd-g++ 2KB
macx-xlc 3KB
hpuxi-acc-64 4KB
hpux-acc-o64 4KB
solaris-cc-64 3KB
linux-kylix 2KB
aix-xlc 2KB
solaris-g++-64 3KB
macx-g++ 3KB
tru64-cxx 2KB
hpux-acc 3KB
sco-cc 2KB
win32-borland 2KB
irix-cc 4KB
hpux-g++-64 2KB
solaris-cc 2KB
tru64-g++ 2KB
win32-icc 3KB
darwin-g++ 2KB
unixware-g++ 2KB
unixware-cc 2KB
linux-icc 3KB
win32-watcom 2KB
reliant-cds 2KB
qnx-g++ 2KB
freebsd-g++40 2KB
solaris-g++ 2KB
lynxos-g++ 2KB
sco-g++ 2KB
win32-g++ 3KB
linux-kcc 2KB
hpux-g++ 2KB
netbsd-g++ 2KB
aix-g++-64 2KB
irix-cc-64 4KB
aix-g++ 2KB
irix-g++ 2KB
irix-g++-64 2KB
macx-pbuilder 2KB
freebsd-icc 3KB
reliant-cds-64 2KB
win32-msvc.net 3KB
hurd-g++ 2KB
aix-xlc-64 2KB
hpuxi-acc 4KB
dgux-g++ 2KB
macx-xcode 2KB
macx-mwerks 753B
sipdistutils.py 3KB
TODO 3KB
LICENSE 2KB
README 158B
README.HP-UX 998B
doc
sipref.txt 182KB
default.css 4KB
sipref.html 308KB
siplib
threads.c 4KB
objmap.c 6KB
siplib.sbf 527B
bool.cpp 616B
siplib.c 145KB
qtlib.c 27KB
sipint.h 3KB
sip.h 29KB
NEWS 8KB
ChangeLog 89KB
共 99 条
- 1
资源评论
- wangwenpei20122024-03-14资源内容总结的很到位,内容详实,很受用,学到了~
钱亚锋
- 粉丝: 88
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功