From 976b20e0430a450c33a53970a089b5c001a1b42e Mon Sep 17 00:00:00 2001 From: gregory guy Date: Sat, 6 Nov 2021 17:01:39 +0100 Subject: Rename sip into sip-tqt in order to be conflict free with upstream. This relates to bug 2699. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: gregory guy Signed-off-by: Slávek Banko --- configure.py | 66 +-- custom/custom.c | 6 +- custom/customw.c | 6 +- custom/mkcustom.py | 12 +- sip_tqt_distutils.py | 148 +++++ sipdistutils.py | 148 ----- sipgen/gencode.c | 72 +-- sipgen/heap.c | 8 +- sipgen/lexer.l | 10 +- sipgen/main.c | 14 +- sipgen/parser.y | 4 +- sipgen/sip.h | 22 +- sipgen/sipgen.sbf | 10 +- sipgen/transform.c | 10 +- siplib/apiversions.c | 10 +- siplib/bool.cpp | 8 +- siplib/descriptors.c | 14 +- siplib/objmap.c | 10 +- siplib/sip-tqt.h | 1587 ++++++++++++++++++++++++++++++++++++++++++++++++++ siplib/sip.h | 1587 -------------------------------------------------- siplib/sipint.h | 14 +- siplib/siplib.c | 110 ++-- siplib/siplib.sbf | 12 +- siplib/threads.c | 12 +- siplib/tqtlib.c | 14 +- siplib/voidptr.c | 28 +- siputils.py | 36 +- specs/freebsd-clang | 81 +++ 28 files changed, 2069 insertions(+), 1990 deletions(-) create mode 100644 sip_tqt_distutils.py delete mode 100644 sipdistutils.py create mode 100644 siplib/sip-tqt.h delete mode 100644 siplib/sip.h create mode 100644 specs/freebsd-clang diff --git a/configure.py b/configure.py index bfdbe2b..c172cc9 100644 --- a/configure.py +++ b/configure.py @@ -1,17 +1,17 @@ -# This script handles the SIP configuration and generates the Makefiles. +# This script handles the SIP-TQt configuration and generates the Makefiles. # # Copyright (c) 2010 Riverbank Computing Limited # -# This file is part of SIP. +# This file is part of SIP-TQt. # -# This copy of SIP is licensed for use under the terms of the SIP License +# This copy of SIP-TQt is licensed for use under the terms of the SIP License # Agreement. See the file LICENSE for more details. # -# This copy of SIP may also used under the terms of the GNU General Public +# This copy of SIP-TQt may also used under the terms of the GNU General Public # License v2 or v3 as published by the Free Software Foundation which can be # found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. # -# SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of +# SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -129,7 +129,7 @@ def set_defaults(): "cygwin": "cygwin-g++", "darwin": "macx-g++", "dgux": "dgux-g++", - "freebsd": "freebsd-g++", + "freebsd": "freebsd-clang", "gnu": "hurd-g++", "hp-ux": "hpux-acc", "irix": "irix-cc", @@ -165,7 +165,7 @@ def set_defaults(): break default_sipbindir = plat_bin_dir - default_sipmoddir = os.path.join(plat_py_site_dir, 'sip4_tqt') + default_sipmoddir = plat_py_site_dir default_sipincdir = plat_py_inc_dir default_sipsipdir = plat_sip_dir @@ -173,9 +173,9 @@ def set_defaults(): def inform_user(): """Tell the user the option values that are going to be used. """ - siputils.inform("The SIP code generator will be installed in %s." % opts.sipbindir) - siputils.inform("The SIP module will be installed in %s." % opts.sipmoddir) - siputils.inform("The SIP header file will be installed in %s." % opts.sipincdir) + siputils.inform("The SIP-TQt code generator will be installed in %s." % opts.sipbindir) + siputils.inform("The SIP-TQt module will be installed in %s." % opts.sipmoddir) + siputils.inform("The SIP-TQt header file will be installed in %s." % opts.sipincdir) siputils.inform("The default directory to install .sip files in is %s." % opts.sipsipdir) siputils.inform("The platform/compiler configuration is %s." % opts.platform) @@ -201,17 +201,17 @@ def set_platform_directories(): if sys.platform == "win32": plat_py_lib_dir = sys.prefix + "\\libs" plat_bin_dir = sys.exec_prefix - plat_sip_dir = sys.prefix + "\\sip" + plat_sip_dir = sys.prefix + "\\sip-tqt" else: lib_dir = sysconfig.get_python_lib(plat_specific=1, standard_lib=1) plat_py_lib_dir = lib_dir + "/config" plat_bin_dir = sys.exec_prefix + "/bin" - plat_sip_dir = sys.prefix + "/share/sip" + plat_sip_dir = sys.prefix + "/share/sip-tqt" def create_config(module, template, macros): - """Create the SIP configuration module so that it can be imported by build + """Create the SIP-TQt configuration module so that it can be imported by build scripts. module is the module file name. @@ -225,7 +225,7 @@ def create_config(module, template, macros): "sip_version": sip_version, "sip_version_str": sip_version_str, "platform": opts.platform, - "sip_bin": os.path.join(opts.sipbindir, "sip"), + "sip_bin": os.path.join(opts.sipbindir, "sip-tqt"), "sip_inc_dir": opts.sipincdir, "sip_mod_dir": opts.sipmoddir, "default_bin_dir": plat_bin_dir, @@ -249,26 +249,24 @@ def create_makefiles(macros, extra_lib_dir=None, extra_libs=None): """ # Bootstrap. Make sure we get the right one. sys.path.insert(0, os.path.curdir) - import sipconfig + import sip_tqt_config - cfg = sipconfig.Configuration() + cfg = sip_tqt_config.Configuration() cfg.set_build_macros(macros) - sipconfig.inform("Creating top level Makefile...") + sip_tqt_config.inform("Creating top level Makefile...") - open('__init__.py', 'a').close() - - sipconfig.ParentMakefile( + sip_tqt_config.ParentMakefile( configuration=cfg, subdirs=["sipgen", "siplib"], - installs=(["__init__.py", "sipconfig.py", os.path.join(src_dir, "sipdistutils.py")], + installs=(["sip_tqt_config.py", os.path.join(src_dir, "sip_tqt_distutils.py")], cfg.sip_mod_dir) ).generate() - sipconfig.inform("Creating sip code generator Makefile...") + sip_tqt_config.inform("Creating sip-tqt code generator Makefile...") - sipconfig.ProgramMakefile( + sip_tqt_config.ProgramMakefile( configuration=cfg, build_file=os.path.join(src_dir, "sipgen", "sipgen.sbf"), dir="sipgen", @@ -279,14 +277,14 @@ def create_makefiles(macros, extra_lib_dir=None, extra_libs=None): arch=opts.arch ).generate() - sipconfig.inform("Creating sip module Makefile...") + sip_tqt_config.inform("Creating sip-tqt module Makefile...") - makefile = sipconfig.ModuleMakefile( + makefile = sip_tqt_config.ModuleMakefile( configuration=cfg, build_file=os.path.join(src_dir, "siplib", "siplib.sbf"), dir="siplib", install_dir=cfg.sip_mod_dir, - installs=([os.path.join(src_dir, "siplib", "sip.h")], cfg.sip_inc_dir), + installs=([os.path.join(src_dir, "siplib", "sip-tqt.h")], cfg.sip_inc_dir), console=1, warnings=0, static=opts.static, @@ -315,7 +313,7 @@ def create_optparser(): # Note: we don't use %default to be compatible with Python 2.3. p.add_option("-k", "--static", action="store_true", default=False, - dest="static", help="build the SIP module as a static library") + dest="static", help="build the SIP-TQt module as a static library") p.add_option("-p", "--platform", action="store", default=default_platform, type="string", metavar="PLATFORM", dest="platform", help="the platform/compiler configuration " @@ -342,7 +340,7 @@ def create_optparser(): help="build for architecture ARCH") g.add_option("-n", "--universal", action="store_true", default=False, dest="universal", - help="build the SIP code generator and module as universal " + help="build the SIP-TQt code generator and module as universal " "binaries") g.add_option("-s", "--sdk", action="store", default=default_sdk, type="string", metavar="SDK", dest="sdk", @@ -364,16 +362,16 @@ def create_optparser(): g = optparse.OptionGroup(p, title="Installation") g.add_option("-b", "--bindir", action="callback", default=default_sipbindir, type="string", metavar="DIR", - dest="sipbindir", callback=store_abspath, help="where the SIP " + dest="sipbindir", callback=store_abspath, help="where the SIP-TQt " "code generator will be installed [default: %s]" % default_sipbindir) g.add_option("-d", "--destdir", action="callback", default=default_sipmoddir, type="string", metavar="DIR", - dest="sipmoddir", callback=store_abspath, help="where the SIP " + dest="sipmoddir", callback=store_abspath, help="where the SIP-TQt " "module will be installed [default: %s]" % default_sipmoddir) g.add_option("-e", "--incdir", action="callback", default=default_sipincdir, type="string", metavar="DIR", - dest="sipincdir", callback=store_abspath, help="where the SIP " + dest="sipincdir", callback=store_abspath, help="where the SIP-TQt " "header file will be installed [default: %s]" % default_sipincdir) g.add_option("-v", "--sipdir", action="callback", default=default_sipsipdir, type="string", metavar="DIR", @@ -389,10 +387,10 @@ def main(argv): argv is the list of command line arguments. """ - siputils.inform("This is SIP %s for Python %s on %s." % (sip_version_str, sys.version.split()[0], sys.platform)) + siputils.inform("This is SIP-TQt %s for Python %s on %s platform." % (sip_version_str, sys.version.split()[0], sys.platform)) if py_version < 0x020300: - siputils.error("This version of SIP requires Python v2.3 or later.") + siputils.error("This version of SIP-TQt requires Python v2.3 or later.") global extra_lib_dir @@ -467,7 +465,7 @@ def main(argv): inform_user() # Install the configuration module. - create_config("sipconfig.py", os.path.join(src_dir, "siputils.py"), + create_config("sip_tqt_config.py", os.path.join(src_dir, "siputils.py"), macros) # Create the Makefiles. diff --git a/custom/custom.c b/custom/custom.c index f7888af..013f988 100644 --- a/custom/custom.c +++ b/custom/custom.c @@ -14,11 +14,11 @@ int main(int argc, char **argv) * to be a builtin in the custom interpreter. The name of the function * will be the name of the module with "init" prepended. The modules * must be built as static libraries (using the -k flag to configure.py - * for SIP and PyTQt). + * for SIP-TQt and PyTQt). */ /* The sip module will be builtin. */ - extern void initsip(void); + extern void initsip_tqt(void); /* * Uncomment these (and in the structure below) to include the PyTQt @@ -40,7 +40,7 @@ int main(int argc, char **argv) * the builtin modules. */ struct _inittab builtin_modules[] = { - {"sip", initsip}, + {"sip_tqt", initsip_tqt}, /* {"qt", initqt},*/ /* {"qtaxcontainer", initqtaxcontainer},*/ /* {"qtcanvas", initqtcanvas},*/ diff --git a/custom/customw.c b/custom/customw.c index 087a4b9..e554f2b 100644 --- a/custom/customw.c +++ b/custom/customw.c @@ -18,11 +18,11 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, * to be a builtin in the custom interpreter. The name of the function * will be the name of the module with "init" prepended. The modules * must be built as static libraries (using the -k flag to configure.py - * for SIP and PyTQt). + * for SIP-TQt and PyTQt). */ /* The sip module will be builtin. */ - extern void initsip(void); + extern void initsip_tqt(void); /* * Uncomment these (and in the structure below) to include the PyTQt @@ -44,7 +44,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, * the builtin modules. */ struct _inittab builtin_modules[] = { - {"sip", initsip}, + {"sip_tqt", initsip_tqt}, /* {"qt", initqt},*/ /* {"qtaxcontainer", initqtaxcontainer},*/ /* {"qtcanvas", initqtcanvas},*/ diff --git a/custom/mkcustom.py b/custom/mkcustom.py index 0e8deab..94f7021 100644 --- a/custom/mkcustom.py +++ b/custom/mkcustom.py @@ -1,4 +1,4 @@ -"""This Python script uses the SIP build system to create a Makefile for +"""This Python script uses the SIP-TQt build system to create a Makefile for building a custom Python interpreter. The script doesn't take any command line flags - just edit it to suit your needs. You will also need to edit custom.c or customw.c. @@ -6,11 +6,11 @@ or customw.c. import sys -import sipconfig +import sip_tqt_config -# Get the SIP configuration. -cfg = sipconfig.Configuration() +# Get the SIP-TQt configuration. +cfg = sip_tqt_config.Configuration() # This is the name of the interpreter executable (excluding any platform @@ -50,7 +50,7 @@ if sys.platform == "linux2": # Create a dictionary describing the target and source files to be passed to -# the SIP build system. +# the SIP-TQt build system. build = {} if sys.platform == "win32" and WindowsInterpreter: @@ -66,7 +66,7 @@ else: qt = (cfg.qt_version > 0) # Create the Makefile instance. -mf = sipconfig.ProgramMakefile(cfg, build, python=True, console=console, qt=qt) +mf = sip_tqt_config.ProgramMakefile(cfg, build, python=True, console=console, qt=qt) # Modify the Makefile according to the values set above. mf.extra_lib_dirs.extend(ExtraLibraryDirectories) diff --git a/sip_tqt_distutils.py b/sip_tqt_distutils.py new file mode 100644 index 0000000..6c6b9d9 --- /dev/null +++ b/sip_tqt_distutils.py @@ -0,0 +1,148 @@ +# Subclasses disutils.command.build_ext, +# replacing it with a SIP-TQt version that compiles .sip -> .cpp +# before calling the original build_ext command. +# Written by Giovanni Bajo +# Based on Pyrex.Distutils, written by Graham Fawcett and Darrel Gallion. + +import distutils.command.build_ext +from distutils.dep_util import newer, newer_group +import os +import sys +from hashlib import sha1 + +build_ext_base = distutils.command.build_ext.build_ext + +def replace_suffix(path, new_suffix): + return os.path.splitext(path)[0] + new_suffix + +class build_ext (build_ext_base): + + description = "Compiler SIP-TQt descriptions, then build C/C++ extensions (compile/link to build directory)" + + user_options = build_ext_base.user_options[:] + user_options = [opt for opt in user_options if not opt[0].startswith("swig")] + user_options += [ + ('sip-opts=', None, + "list of sip command line options"), + ] + + def initialize_options (self): + build_ext_base.initialize_options(self) + self.sip_opts = None + + def finalize_options (self): + build_ext_base.finalize_options(self) + if self.sip_opts is None: + self.sip_opts = [] + else: + self.sip_opts = self.sip_opts.split(' ') + + def _get_sip_output_list(self, sbf): + """ + Parse the sbf file specified to extract the name of the generated source + files. Make them absolute assuming they reside in the temp directory. + """ + for L in file(sbf): + key, value = L.split("=", 1) + if key.strip() == "sources": + out = [] + for o in value.split(): + out.append(os.path.join(self.build_temp, o)) + return out + + raise RuntimeError("cannot parse SIP-generated '%s'" % sbf) + + def _find_sip(self): + import sip_tqt_config + cfg = sip_tqt_config.Configuration() + if os.name == "nt": + if not os.path.splitext(os.path.basename(cfg.sip_bin))[1]: + return cfg.sip_bin + ".exe" + return cfg.sip_bin + + def _sip_inc_dir(self): + import sip_tqt_config + cfg = sip_tqt_config.Configuration() + return cfg.sip_inc_dir + + def _sip_sipfiles_dir(self): + import sip_tqt_config + cfg = sip_tqt_config.Configuration() + return cfg.default_sip_dir + + def _sip_calc_signature(self): + sip_bin = self._find_sip() + return sha1(open(sip_bin, "rb").read()).hexdigest() + + def _sip_signature_file(self): + return os.path.join(self.build_temp, "sip.signature") + + def build_extension (self, ext): + oldforce = self.force + + if not self.force: + sip_sources = [source for source in ext.sources if source.endswith('.sip')] + if sip_sources: + sigfile = self._sip_signature_file() + if not os.path.isfile(sigfile): + self.force = True + else: + old_sig = open(sigfile).read() + new_sig = self._sip_calc_signature() + if old_sig != new_sig: + self.force = True + + build_ext_base.build_extension(self, ext) + + self.force = oldforce + + def swig_sources (self, sources, extension=None): + if not self.extensions: + return + + # Add the SIP-TQt include directory to the include path + if extension is not None: + extension.include_dirs.append(self._sip_inc_dir()) + depends = extension.depends + else: + # pre-2.4 compatibility + self.include_dirs.append(self._sip_inc_dir()) + depends = [] # ? + + # Filter dependencies list: we are interested only in .sip files, + # since the main .sip files can only depend on additional .sip + # files. For instance, if a .h changes, there is no need to + # run sip again. + depends = [f for f in depends if os.path.splitext(f)[1] == ".sip"] + + # Create the temporary directory if it does not exist already + if not os.path.isdir(self.build_temp): + os.makedirs(self.build_temp) + + # Collect the names of the source (.sip) files + sip_sources = [] + sip_sources = [source for source in sources if source.endswith('.sip')] + other_sources = [source for source in sources if not source.endswith('.sip')] + generated_sources = [] + + sip_bin = self._find_sip() + + for sip in sip_sources: + # Use the sbf file as dependency check + sipbasename = os.path.basename(sip) + sbf = os.path.join(self.build_temp, replace_suffix(sipbasename, ".sbf")) + if newer_group([sip]+depends, sbf) or self.force: + self._sip_compile(sip_bin, sip, sbf) + open(self._sip_signature_file(), "w").write(self._sip_calc_signature()) + out = self._get_sip_output_list(sbf) + generated_sources.extend(out) + + return generated_sources + other_sources + + def _sip_compile(self, sip_bin, source, sbf): + self.spawn([sip_bin] + self.sip_opts + + ["-c", self.build_temp, + "-b", sbf, + "-I", self._sip_sipfiles_dir(), + source]) + diff --git a/sipdistutils.py b/sipdistutils.py deleted file mode 100644 index 6994989..0000000 --- a/sipdistutils.py +++ /dev/null @@ -1,148 +0,0 @@ -# Subclasses disutils.command.build_ext, -# replacing it with a SIP version that compiles .sip -> .cpp -# before calling the original build_ext command. -# Written by Giovanni Bajo -# Based on Pyrex.Distutils, written by Graham Fawcett and Darrel Gallion. - -import distutils.command.build_ext -from distutils.dep_util import newer, newer_group -import os -import sys -from hashlib import sha1 - -build_ext_base = distutils.command.build_ext.build_ext - -def replace_suffix(path, new_suffix): - return os.path.splitext(path)[0] + new_suffix - -class build_ext (build_ext_base): - - description = "Compiler SIP descriptions, then build C/C++ extensions (compile/link to build directory)" - - user_options = build_ext_base.user_options[:] - user_options = [opt for opt in user_options if not opt[0].startswith("swig")] - user_options += [ - ('sip-opts=', None, - "list of sip command line options"), - ] - - def initialize_options (self): - build_ext_base.initialize_options(self) - self.sip_opts = None - - def finalize_options (self): - build_ext_base.finalize_options(self) - if self.sip_opts is None: - self.sip_opts = [] - else: - self.sip_opts = self.sip_opts.split(' ') - - def _get_sip_output_list(self, sbf): - """ - Parse the sbf file specified to extract the name of the generated source - files. Make them absolute assuming they reside in the temp directory. - """ - for L in file(sbf): - key, value = L.split("=", 1) - if key.strip() == "sources": - out = [] - for o in value.split(): - out.append(os.path.join(self.build_temp, o)) - return out - - raise RuntimeError("cannot parse SIP-generated '%s'" % sbf) - - def _find_sip(self): - import sipconfig - cfg = sipconfig.Configuration() - if os.name == "nt": - if not os.path.splitext(os.path.basename(cfg.sip_bin))[1]: - return cfg.sip_bin + ".exe" - return cfg.sip_bin - - def _sip_inc_dir(self): - import sipconfig - cfg = sipconfig.Configuration() - return cfg.sip_inc_dir - - def _sip_sipfiles_dir(self): - import sipconfig - cfg = sipconfig.Configuration() - return cfg.default_sip_dir - - def _sip_calc_signature(self): - sip_bin = self._find_sip() - return sha1(open(sip_bin, "rb").read()).hexdigest() - - def _sip_signature_file(self): - return os.path.join(self.build_temp, "sip.signature") - - def build_extension (self, ext): - oldforce = self.force - - if not self.force: - sip_sources = [source for source in ext.sources if source.endswith('.sip')] - if sip_sources: - sigfile = self._sip_signature_file() - if not os.path.isfile(sigfile): - self.force = True - else: - old_sig = open(sigfile).read() - new_sig = self._sip_calc_signature() - if old_sig != new_sig: - self.force = True - - build_ext_base.build_extension(self, ext) - - self.force = oldforce - - def swig_sources (self, sources, extension=None): - if not self.extensions: - return - - # Add the SIP include directory to the include path - if extension is not None: - extension.include_dirs.append(self._sip_inc_dir()) - depends = extension.depends - else: - # pre-2.4 compatibility - self.include_dirs.append(self._sip_inc_dir()) - depends = [] # ? - - # Filter dependencies list: we are interested only in .sip files, - # since the main .sip files can only depend on additional .sip - # files. For instance, if a .h changes, there is no need to - # run sip again. - depends = [f for f in depends if os.path.splitext(f)[1] == ".sip"] - - # Create the temporary directory if it does not exist already - if not os.path.isdir(self.build_temp): - os.makedirs(self.build_temp) - - # Collect the names of the source (.sip) files - sip_sources = [] - sip_sources = [source for source in sources if source.endswith('.sip')] - other_sources = [source for source in sources if not source.endswith('.sip')] - generated_sources = [] - - sip_bin = self._find_sip() - - for sip in sip_sources: - # Use the sbf file as dependency check - sipbasename = os.path.basename(sip) - sbf = os.path.join(self.build_temp, replace_suffix(sipbasename, ".sbf")) - if newer_group([sip]+depends, sbf) or self.force: - self._sip_compile(sip_bin, sip, sbf) - open(self._sip_signature_file(), "w").write(self._sip_calc_signature()) - out = self._get_sip_output_list(sbf) - generated_sources.extend(out) - - return generated_sources + other_sources - - def _sip_compile(self, sip_bin, source, sbf): - self.spawn([sip_bin] + self.sip_opts + - ["-c", self.build_temp, - "-b", sbf, - "-I", self._sip_sipfiles_dir(), - source]) - diff --git a/sipgen/gencode.c b/sipgen/gencode.c index f7d239e..9438d9b 100644 --- a/sipgen/gencode.c +++ b/sipgen/gencode.c @@ -1,18 +1,18 @@ /* - * The code generator module for SIP. + * The code generator module for SIP-TQt. * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ @@ -496,11 +496,11 @@ static void generateInternalAPIHeader(sipSpec *pt, moduleDef *mod, "#define _%sAPI_H\n" "\n" "\n" -"#include \n" +"#include \n" , mname , mname); - if (pluginPyTQt4(pt)) + if (pluginPyQt4(pt)) prcode(fp, "\n" "#include \n" @@ -787,7 +787,7 @@ static void generateInternalAPIHeader(sipSpec *pt, moduleDef *mod, prcode(fp, "\n" -"/* The SIP API, this module's API and the APIs of any imported modules. */\n" +"/* The SIP-TQt API, this module's API and the APIs of any imported modules. */\n" "extern const sipAPIDef *sipAPI_%s;\n" "extern sipExportedModuleDef sipModuleAPI_%s;\n" , mname @@ -802,7 +802,7 @@ static void generateInternalAPIHeader(sipSpec *pt, moduleDef *mod, , mname, mld->module->name); } - if (pluginPyTQt4(pt)) + if (pluginPyQt4(pt)) prcode(fp, "\n" "typedef const TQMetaObject *(*sip_qt_metaobject_func)(sipSimpleWrapper *,sipTypeDef *);\n" @@ -1817,7 +1817,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir, "/* This defines this module. */\n" "sipExportedModuleDef sipModuleAPI_%s = {\n" " 0,\n" -" SIP_API_MINOR_NR,\n" +" SIP_TQT_API_MINOR_NR,\n" " %n,\n" " 0,\n" " %d,\n" @@ -1880,7 +1880,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir, prcode(fp, "\n" "\n" -"/* The SIP API and the APIs of any imported modules. */\n" +"/* The SIP-TQt API and the APIs of any imported modules. */\n" "const sipAPIDef *sipAPI_%s;\n" , mname); @@ -1889,7 +1889,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir, "const sipExportedModuleDef *sipModuleAPI_%s_%s;\n" , mname, mld->module->name); - if (pluginPyTQt4(pt)) + if (pluginPyQt4(pt)) prcode(fp, "\n" "sip_qt_metaobject_func sip_%s_qt_metaobject;\n" @@ -2006,7 +2006,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir, prcode(fp, " /* Export the module and publish it's API. */\n" -" if (sipExportModule(&sipModuleAPI_%s,SIP_API_MAJOR_NR,SIP_API_MINOR_NR,0) < 0)\n" +" if (sipExportModule(&sipModuleAPI_%s,SIP_TQT_API_MAJOR_NR,SIP_TQT_API_MINOR_NR,0) < 0)\n" " {\n" "#if !defined(SIP_USE_PYCAPSULE)\n" " Py_DECREF(sip_sipmod);\n" @@ -2016,7 +2016,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir, " }\n" , mname); - if (pluginPyTQt4(pt)) + if (pluginPyQt4(pt)) { /* Import the helpers. */ prcode(fp, @@ -2161,7 +2161,7 @@ static void generateTypesTable(sipSpec *pt, moduleDef *mod, FILE *fp) argDef *ad; const char *type_suffix; - type_suffix = (pluginPyTQt4(pt) || pluginPyTQt3(pt)) ? ".super" : ""; + type_suffix = (pluginPyQt4(pt) || pluginPyTQt3(pt)) ? ".super" : ""; prcode(fp, "\n" @@ -2214,18 +2214,18 @@ static void generateTypesTable(sipSpec *pt, moduleDef *mod, FILE *fp) static void generateSipImport(moduleDef *mod, FILE *fp) { prcode(fp, -" /* Get the SIP module's API. */\n" +" /* Get the SIP-TQt module's API. */\n" "#if defined(SIP_USE_PYCAPSULE)\n" "\n" ); if (generating_c) prcode(fp, -" sipAPI_%s = (const sipAPIDef *)PyCapsule_Import(\"sip._C_API\", 0);\n" +" sipAPI_%s = (const sipAPIDef *)PyCapsule_Import(\"sip_tqt._C_API\", 0);\n" , mod->name); else prcode(fp, -" sipAPI_%s = reinterpret_cast(PyCapsule_Import(\"sip._C_API\", 0));\n" +" sipAPI_%s = reinterpret_cast(PyCapsule_Import(\"sip_tqt._C_API\", 0));\n" , mod->name); prcode(fp, @@ -2239,17 +2239,17 @@ static void generateSipImport(moduleDef *mod, FILE *fp) "#else\n" "\n" "#if PY_VERSION_HEX >= 0x02050000\n" -" sip_sipmod = PyImport_ImportModule(\"sip\");\n" +" sip_sipmod = PyImport_ImportModule(\"sip_tqt\");\n" "#else\n" , mod->name); if (generating_c) prcode(fp, -" sip_sipmod = PyImport_ImportModule((char *)\"sip\");\n" +" sip_sipmod = PyImport_ImportModule((char *)\"sip_tqt\");\n" ); else prcode(fp, -" sip_sipmod = PyImport_ImportModule(const_cast(\"sip\"));\n" +" sip_sipmod = PyImport_ImportModule(const_cast(\"sip_tqt\"));\n" ); prcode(fp, @@ -2911,7 +2911,7 @@ static int generateClasses(sipSpec *pt, moduleDef *mod, classDef *cd, FILE *fp) * code rather than through a static table. This is because C++ does * not guarantee the order in which the table and the instance will be * created. So far this has only been seen to be a problem when - * statically linking SIP generated modules on Windows. + * statically linking SIP-TQt generated modules on Windows. */ if (!generating_c && vd->accessfunc == NULL && vd->type.nrderefs == 0) continue; @@ -3816,7 +3816,7 @@ static void generateTypeDefLink(sipSpec *pt, ifaceFileDef *iff, FILE *fp) if (iff->next_alt->type == mappedtype_iface) prcode(fp, ".mtd_base"); - else if (pluginPyTQt3(pt) || pluginPyTQt4(pt)) + else if (pluginPyTQt3(pt) || pluginPyQt4(pt)) prcode(fp, ".super.ctd_base"); else prcode(fp, ".ctd_base"); @@ -6066,9 +6066,9 @@ static void generateShadowCode(sipSpec *pt, moduleDef *mod, classDef *cd, } /* The meta methods if required. */ - if (pluginPyTQt4(pt) && isTQObjectSubClass(cd)) + if (pluginPyQt4(pt) && isTQObjectSubClass(cd)) { - if (!noPyTQt4TQMetaObject(cd)) + if (!noPyQt4TQMetaObject(cd)) prcode(fp, "\n" "const TQMetaObject *sip%C::metaObject() const\n" @@ -8022,7 +8022,7 @@ static void generateClassAPI(classDef *cd, sipSpec *pt, FILE *fp) { const char *type_prefix; - if (pluginPyTQt4(pt)) + if (pluginPyQt4(pt)) type_prefix = "pyqt4"; else if (pluginPyTQt3(pt)) type_prefix = "pyqt3"; @@ -8179,7 +8179,7 @@ static void generateShadowClassDeclaration(sipSpec *pt,classDef *cd,FILE *fp) ,(cd->vmembers != NULL ? "virtual " : ""),classFTQCName(cd),cd->dtorexceptions); /* The metacall methods if required. */ - if (pluginPyTQt4(pt) && isTQObjectSubClass(cd)) + if (pluginPyQt4(pt) && isTQObjectSubClass(cd)) { prcode(fp, "\n" @@ -8187,7 +8187,7 @@ static void generateShadowClassDeclaration(sipSpec *pt,classDef *cd,FILE *fp) " void *qt_metacast(const char *);\n" ); - if (!noPyTQt4TQMetaObject(cd)) + if (!noPyQt4TQMetaObject(cd)) prcode(fp, " const TQMetaObject *metaObject() const;\n" ); @@ -8986,10 +8986,10 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp) nr_methods = generateClassMethodTable(pt, cd, fp); nr_enums = generateEnumMemberTable(pt, mod, cd, NULL, fp); - /* Generate the PyTQt4 signals table. */ + /* Generate the PyQt4 signals table. */ is_signals = FALSE; - if (pluginPyTQt4(pt) && isTQObjectSubClass(cd)) + if (pluginPyQt4(pt) && isTQObjectSubClass(cd)) { /* The signals must be grouped by name. */ for (md = cd->members; md != NULL; md = md->next) @@ -9025,7 +9025,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp) prcode(fp, "\n" "\n" -"/* Define this type's PyTQt4 signals. */\n" +"/* Define this type's PyQt4 signals. */\n" "static const pyqt4QtSignal pyqt4_signals_%C[] = {\n" , classFTQCName(cd)); } @@ -9135,7 +9135,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp) has_docstring = TRUE; } - if (pluginPyTQt4(pt)) + if (pluginPyQt4(pt)) { type_prefix = "pyqt4"; embedded = TRUE; @@ -9540,9 +9540,9 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp) ); } - if (pluginPyTQt4(pt)) + if (pluginPyQt4(pt)) { - if (isTQObjectSubClass(cd) && !noPyTQt4TQMetaObject(cd)) + if (isTQObjectSubClass(cd) && !noPyQt4TQMetaObject(cd)) prcode(fp, " &%U::staticMetaObject,\n" , cd); @@ -9572,7 +9572,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp) /* - * Generate an entry in the PyTQt4 signal table. + * Generate an entry in the PyQt4 signal table. */ static void generateSignalTableEntry(sipSpec *pt, classDef *cd, overDef *sig, memberDef *md, int membernr, FILE *fp) @@ -12697,7 +12697,7 @@ static FILE *createFile(moduleDef *mod, const char *fname, "/*\n" " * %s\n" " *\n" -" * Generated by SIP %s on %s" +" * Generated by SIP-TQt %s on %s" ,description ,sipVersion,ctime(&now)); diff --git a/sipgen/heap.c b/sipgen/heap.c index a4b42ba..12f559c 100644 --- a/sipgen/heap.c +++ b/sipgen/heap.c @@ -3,16 +3,16 @@ * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ diff --git a/sipgen/lexer.l b/sipgen/lexer.l index 53fd905..3e61972 100644 --- a/sipgen/lexer.l +++ b/sipgen/lexer.l @@ -1,18 +1,18 @@ /* - * The SIP lexer. + * The SIP-TQt lexer. * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ diff --git a/sipgen/main.c b/sipgen/main.c index 199fab1..15085c8 100644 --- a/sipgen/main.c +++ b/sipgen/main.c @@ -1,18 +1,18 @@ /* - * The main module for SIP. + * The main module for SIP-TQt. * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ @@ -27,7 +27,7 @@ #ifndef PACKAGE -#define PACKAGE "sip" +#define PACKAGE "sip-tqt" #endif #define VERSION "4.10.5" @@ -460,7 +460,7 @@ void fatal(char *fmt,...) /* - * Display the SIP version number on stdout and exit with zero exit status. + * Display the SIP-TQt version number on stdout and exit with zero exit status. */ static void version(void) { diff --git a/sipgen/parser.y b/sipgen/parser.y index 0c4d803..33e42c4 100644 --- a/sipgen/parser.y +++ b/sipgen/parser.y @@ -3266,7 +3266,7 @@ static void finishClass(sipSpec *pt, moduleDef *mod, classDef *cd, cd->pyqt4_flags = flg->fvalue.ival; if (findOptFlag(of, "PyQt4NoQMetaObject", bool_flag) != NULL) - setPyTQt4NoTQMetaObject(cd); + setPyQt4NoTQMetaObject(cd); if (isOpaque(cd)) { @@ -6071,7 +6071,7 @@ int pluginPyTQt3(sipSpec *pt) /* * Return TRUE if the PyQt4 plugin was specified. */ -int pluginPyTQt4(sipSpec *pt) +int pluginPyQt4(sipSpec *pt) { return stringFind(pt->plugins, "PyQt4"); } diff --git a/sipgen/sip.h b/sipgen/sip.h index 4a4910b..af3f8fa 100644 --- a/sipgen/sip.h +++ b/sipgen/sip.h @@ -1,18 +1,18 @@ /* - * The main header file for SIP. + * The main header file for SIP-TQt. * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ @@ -137,8 +137,8 @@ #define setIsHoldGILDtor(cd) ((cd)->classflags |= CLASS_DTOR_HOLD_GIL) #define assignmentHelper(cd) ((cd)->classflags & CLASS_ASSIGN_HELPER) #define setAssignmentHelper(cd) ((cd)->classflags |= CLASS_ASSIGN_HELPER) -#define noPyTQt4TQMetaObject(cd) ((cd)->classflags & CLASS_NO_TQMETAOBJECT) -#define setPyTQt4NoTQMetaObject(cd) ((cd)->classflags |= CLASS_NO_TQMETAOBJECT) +#define noPyQt4TQMetaObject(cd) ((cd)->classflags & CLASS_NO_TQMETAOBJECT) +#define setPyQt4NoTQMetaObject(cd) ((cd)->classflags |= CLASS_NO_TQMETAOBJECT) #define isTemplateClass(cd) ((cd)->classflags & CLASS_IS_TEMPLATE) #define setIsTemplateClass(cd) ((cd)->classflags |= CLASS_IS_TEMPLATE) #define resetIsTemplateClass(cd) ((cd)->classflags &= ~CLASS_IS_TEMPLATE) @@ -989,7 +989,7 @@ typedef struct _mroDef { typedef struct _classDef { int classflags; /* The class flags. */ - int pyqt4_flags; /* The PyTQt4 specific flags. */ + int pyqt4_flags; /* The PyQt4 specific flags. */ nameDef *pyname; /* The Python name. */ ifaceFileDef *iff; /* The interface file. */ struct _classDef *ecd; /* The enclosing scope. */ @@ -1085,8 +1085,8 @@ typedef struct _parserContext { } parserContext; -extern char *sipVersion; /* The version of SIP. */ -extern stringList *includeDirList; /* The include directory list for SIP files. */ +extern char *sipVersion; /* The version of SIP-TQt. */ +extern stringList *includeDirList; /* The include directory list for SIP-TQt files. */ void parse(sipSpec *, FILE *, char *, stringList *, stringList *, int, int); @@ -1140,7 +1140,7 @@ ifaceFileDef *findIfaceFile(sipSpec *pt, moduleDef *mod, scopedNameDef *fqname, ifaceFileType iftype, apiVersionRangeDef *api_range, argDef *ad); int pluginPyTQt3(sipSpec *pt); -int pluginPyTQt4(sipSpec *pt); +int pluginPyQt4(sipSpec *pt); void yywarning(char *); nameDef *cacheName(sipSpec *pt, const char *name); scopedNameDef *encodedTemplateName(templateDef *td); diff --git a/sipgen/sipgen.sbf b/sipgen/sipgen.sbf index 3542663..25ddf09 100644 --- a/sipgen/sipgen.sbf +++ b/sipgen/sipgen.sbf @@ -2,18 +2,18 @@ # # Copyright (c) 2010 Riverbank Computing Limited # -# This file is part of SIP. +# This file is part of SIP-TQt. # -# This copy of SIP is licensed for use under the terms of the SIP License +# This copy of SIP-TQt is licensed for use under the terms of the SIP License # Agreement. See the file LICENSE for more details. # -# This copy of SIP may also used under the terms of the GNU General Public +# This copy of SIP-TQt may also used under the terms of the GNU General Public # License v2 or v3 as published by the Free Software Foundation which can be # found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. # -# SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of +# SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -target = sip +target = sip-tqt sources = main.c transform.c gencode.c export.c heap.c parser.c lexer.c headers = sip.h parser.h diff --git a/sipgen/transform.c b/sipgen/transform.c index 8e61351..c6d204d 100644 --- a/sipgen/transform.c +++ b/sipgen/transform.c @@ -1,18 +1,18 @@ /* - * The parse tree transformation module for SIP. + * The parse tree transformation module for SIP-TQt. * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ diff --git a/siplib/apiversions.c b/siplib/apiversions.c index 7d86c76..f278c6b 100644 --- a/siplib/apiversions.c +++ b/siplib/apiversions.c @@ -3,16 +3,16 @@ * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ @@ -21,7 +21,7 @@ #include -#include "sip.h" +#include "sip-tqt.h" #include "sipint.h" diff --git a/siplib/bool.cpp b/siplib/bool.cpp index 8936287..42238de 100644 --- a/siplib/bool.cpp +++ b/siplib/bool.cpp @@ -2,16 +2,16 @@ // // Copyright (c) 2010 Riverbank Computing Limited // -// This file is part of SIP. +// This file is part of SIP-TQt. // -// This copy of SIP is licensed for use under the terms of the SIP License +// This copy of SIP-TQt is licensed for use under the terms of the SIP License // Agreement. See the file LICENSE for more details. // -// This copy of SIP may also used under the terms of the GNU General Public +// This copy of SIP-TQt may also used under the terms of the GNU General Public // License v2 or v3 as published by the Free Software Foundation which can be // found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. // -// SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of +// SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. diff --git a/siplib/descriptors.c b/siplib/descriptors.c index 29277c5..009a03e 100644 --- a/siplib/descriptors.c +++ b/siplib/descriptors.c @@ -3,23 +3,23 @@ * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #include -#include "sip.h" +#include "sip-tqt.h" #include "sipint.h" @@ -51,7 +51,7 @@ typedef struct _sipMethodDescr { */ PyTypeObject sipMethodDescr_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "sip.methoddescriptor", /* tp_name */ + "sip_tqt.methoddescriptor", /* tp_name */ sizeof (sipMethodDescr), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -168,7 +168,7 @@ typedef struct _sipVariableDescr { */ PyTypeObject sipVariableDescr_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "sip.variabledescriptor", /* tp_name */ + "sip_tqt.variabledescriptor", /* tp_name */ sizeof (sipVariableDescr), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ diff --git a/siplib/objmap.c b/siplib/objmap.c index f9c196d..3376a99 100644 --- a/siplib/objmap.c +++ b/siplib/objmap.c @@ -4,23 +4,23 @@ * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ #include -#include "sip.h" +#include "sip-tqt.h" #include "sipint.h" diff --git a/siplib/sip-tqt.h b/siplib/sip-tqt.h new file mode 100644 index 0000000..845ed6d --- /dev/null +++ b/siplib/sip-tqt.h @@ -0,0 +1,1587 @@ +/* + * The SIP-TQt module interface. + * + * Copyright (c) 2010 Riverbank Computing Limited + * + * This file is part of SIP-TQt. + * + * This copy of SIP-TQt is licensed for use under the terms of the SIP License + * Agreement. See the file LICENSE for more details. + * + * This copy of SIP-TQt may also used under the terms of the GNU General Public + * License v2 or v3 as published by the Free Software Foundation which can be + * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. + * + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + */ + + +#ifndef _SIP_TQT_H +#define _SIP_TQT_H + + +/* + * This gets round a problem with TQt's moc and Python v2.3. Strictly speaking + * it's a TQt problem but later versions of Python include a fix for it so we + * might as well too. + */ +#undef slots + + +#include + +/* + * There is a mis-feature somewhere with the Borland compiler. This works + * around it. + */ +#if defined(__BORLANDC__) +#include +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Sanity check on the Python version. */ +#if PY_VERSION_HEX < 0x02030000 +#error "This version of SIP-TQt requires Python v2.3 or later" +#endif + + +/* + * Define the SIP-TQt version number. + */ +#define SIP_TQT_VERSION 0x040a05 +#define SIP_TQT_VERSION_STR "4.10.5" + + +/* + * Define the current API version number. SIP-TQt must handle modules with the + * same major number and with the same or earlier minor number. Whenever data + * structure elements are added they must be appended and the minor number + * incremented. Whenever data structure elements are removed or the order + * changed then the major number must be incremented and the minor number set + * to 0. + * + * History: + * + * 7.1 Added the 'H' format character to sip_api_parse_result(). + * Deprecated the 'D' format character of sip_api_parse_result(). + * + * 7.0 Added sip_api_parse_kwd_args(). + * Added sipErrorState, sip_api_add_exception(). + * The type initialisation function is now passed a dictionary of keyword + * arguments. + * All argument parsers now update a set of error messages rather than an + * argument count. + * The signatures of sip_api_no_function() and sip_api_no_method() have + * changed. + * Added ctd_docstring to sipClassTypeDef. + * Added vf_docstring to sipVersionedFunctionDef. + * + * 6.0 Added the sipContainerDef structure to define the contents of a class + * or mapped type. Restructured sipClassDef and sipMappedTypeDef + * accordingly. + * Added the 'r' format character to sip_api_parse_args(). + * Added the 'r' format character to sip_api_call_method() and + * sip_api_build_result(). + * Added the assignment, array and copy allocation helpers. + * + * 5.0 Added sip_api_is_api_enabled(). + * Renamed the td_version_nr member of sipTypeDef to be int and where -1 + * indicates it is not versioned. + * Added the em_versions member to sipExportedModuleDef. + * Added the em_versioned_functions member to sipExportedModuleDef. + * + * 4.0 Much refactoring. + * + * 3.8 Added sip_api_register_qt_metatype() and sip_api_deprecated(). + * Added qt_register_meta_type() to the TQt support API. + * The C/C++ names of enums and types are now always defined in the + * relevant structures and don't default to the Python name. + * Added the 'XE' format characters to sip_api_parse_args(). + * + * 3.7 Added sip_api_convert_from_const_void_ptr(), + * sip_api_convert_from_void_ptr_and_size() and + * sip_api_convert_from_const_void_ptr_and_size(). + * Added the 'g' and 'G' format characters (to replace the now deprecated + * 'a' and 'A' format characters) to sip_api_build_result(), + * sip_api_call_method() and sip_api_parse_result(). + * Added the 'k' and 'K' format characters (to replace the now deprecated + * 'a' and 'A' format characters) to sip_api_parse_args(). + * Added sip_api_invoke_slot(). + * Added sip_api_parse_type(). + * Added sip_api_is_exact_wrapped_type(). + * Added sip_api_assign_instance(). + * Added sip_api_assign_mapped_type(). + * Added the td_assign and td_qt fields to the sipTypeDef structure. + * Added the mt_assign field to the sipMappedType structure. + * + * 3.6 Added the 'g' format character to sip_api_parse_args(). + * + * 3.5 Added the td_pickle field to the sipTypeDef structure. + * Added sip_api_transfer_break(). + * + * 3.4 Added qt_find_connection() to the TQt support API. + * Added sip_api_string_as_char(), sip_api_unicode_as_wchar(), + * sip_api_unicode_as_wstring(), sip_api_find_class(), + * sip_api_find_named_enum() and sip_api_parse_signature(). + * Added the 'A', 'w' and 'x' format characters to sip_api_parse_args(), + * sip_api_parse_result(), sip_api_build_result() and + * sip_api_call_method(). + * + * 3.3 Added sip_api_register_int_types(). + * + * 3.2 Added sip_api_export_symbol() and sip_api_import_symbol(). + * + * 3.1 Added sip_api_add_mapped_type_instance(). + * + * 3.0 Moved the TQt support out of the sip module and into PyTQt. This is + * such a dramatic change that there is no point in attempting to maintain + * backwards compatibility. + * + * 2.0 Added the td_flags field to the sipTypeDef structure. + * Added the first_child, sibling_next, sibling_prev and parent fields to + * the sipWrapper structure. + * Added the td_traverse and td_clear fields to the sipTypeDef structure. + * Added the em_api_minor field to the sipExportedModuleDef structure. + * Added sip_api_bad_operator_arg(). + * Added sip_api_wrapper_check(). + * + * 1.1 Added support for __pos__ and __abs__. + * + * 1.0 Removed all deprecated parts of the API. + * Removed the td_proxy field from the sipTypeDef structure. + * Removed the create proxy function from the 'q' and 'y' format + * characters to sip_api_parse_args(). + * Removed sip_api_emit_to_slot(). + * Reworked the enum related structures. + * + * 0.2 Added the 'H' format character to sip_api_parse_args(). + * + * 0.1 Added sip_api_add_class_instance(). + * Added the 't' format character to sip_api_parse_args(). + * Deprecated the 'J' and 'K' format characters to sip_api_parse_result(). + * + * 0.0 Original version. + */ +#define SIP_TQT_API_MAJOR_NR 7 +#define SIP_TQT_API_MINOR_NR 1 + + +/* Some compatibility stuff to help with handwritten code for SIP-TQt v3. */ +#if !defined(ANY) +#define ANY void +#endif + + +/* Some Python compatibility stuff. */ +#if PY_VERSION_HEX >= 0x02050000 + +#define SIP_SSIZE_T Py_ssize_t + +#define SIP_MLNAME_CAST(s) (s) +#define SIP_MLDOC_CAST(s) (s) +#define SIP_TPNAME_CAST(s) (s) + +#else + +#define SIP_SSIZE_T int + +#define SIP_MLNAME_CAST(s) ((char *)(s)) +#define SIP_MLDOC_CAST(s) ((char *)(s)) +#define SIP_TPNAME_CAST(s) ((char *)(s)) + +#endif + +#if PY_MAJOR_VERSION >= 3 + +#define SIPLong_FromLong PyLong_FromLong +#define SIPLong_AsLong PyLong_AsLong + +#define SIPBytes_Check PyBytes_Check +#define SIPBytes_FromString PyBytes_FromString +#define SIPBytes_FromStringAndSize PyBytes_FromStringAndSize +#define SIPBytes_AS_STRING PyBytes_AS_STRING +#define SIPBytes_GET_SIZE PyBytes_GET_SIZE + +#if PY_MINOR_VERSION >= 1 +#define SIP_USE_PYCAPSULE +#endif + +#else + +#define SIPLong_FromLong PyInt_FromLong +#define SIPLong_AsLong PyInt_AsLong + +#define SIPBytes_Check PyString_Check +#define SIPBytes_FromString PyString_FromString +#define SIPBytes_FromStringAndSize PyString_FromStringAndSize +#define SIPBytes_AS_STRING PyString_AS_STRING +#define SIPBytes_GET_SIZE PyString_GET_SIZE + +#if PY_MINOR_VERSION >= 7 +#define SIP_USE_PYCAPSULE +#endif + +#endif + +#if !defined(Py_REFCNT) +#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) +#endif + +#if !defined(Py_TYPE) +#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) +#endif + +#if !defined(PyVarObject_HEAD_INIT) +#define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, +#endif + + +/* + * The mask that can be passed to sipTrace(). + */ +#define SIP_TRACE_CATCHERS 0x0001 +#define SIP_TRACE_CTORS 0x0002 +#define SIP_TRACE_DTORS 0x0004 +#define SIP_TRACE_INITS 0x0008 +#define SIP_TRACE_DEALLOCS 0x0010 +#define SIP_TRACE_METHODS 0x0020 + + +/* + * Hide some thread dependent stuff. + */ +#ifdef WITH_THREAD +typedef PyGILState_STATE sip_gilstate_t; +#define SIP_RELEASE_GIL(gs) PyGILState_Release(gs); +#define SIP_BLOCK_THREADS {PyGILState_STATE sipGIL = PyGILState_Ensure(); +#define SIP_UNBLOCK_THREADS PyGILState_Release(sipGIL);} +#else +typedef int sip_gilstate_t; +#define SIP_RELEASE_GIL(gs) +#define SIP_BLOCK_THREADS +#define SIP_UNBLOCK_THREADS +#endif + + +/* + * The meta-type of a wrapper type. + */ +typedef struct _sipWrapperType { + /* + * The super-metatype. This must be first in the structure so that it can + * be cast to a PyTypeObject *. + */ + PyHeapTypeObject super; + + /* The generated type structure. */ + struct _sipTypeDef *type; + + /* The list of init extenders. */ + struct _sipInitExtenderDef *iextend; + + /* Set if the type's dictionary contains all lazy attributes. */ + int dict_complete; +} sipWrapperType; + + +/* + * The type of a simple C/C++ wrapper object. + */ +typedef struct _sipSimpleWrapper { + PyObject_HEAD + + union { + /* C/C++ object pointer. */ + void *cppPtr; + + /* Access function. */ + void *(*afPtr)(); + } u; + + /* Object flags. */ + int flags; + + /* The optional dictionary of extra references keyed by argument number. */ + PyObject *extra_refs; + + /* For the user to use. */ + PyObject *user; + + /* The instance dictionary. */ + PyObject *dict; + + /* Next object at this address. */ + struct _sipSimpleWrapper *next; +} sipSimpleWrapper; + + +/* + * The type of a C/C++ wrapper object that supports parent/child relationships. + */ +typedef struct _sipWrapper { + /* The super-type. */ + sipSimpleWrapper super; + + /* First child object. */ + struct _sipWrapper *first_child; + + /* Next sibling. */ + struct _sipWrapper *sibling_next; + + /* Previous sibling. */ + struct _sipWrapper *sibling_prev; + + /* Owning object. */ + struct _sipWrapper *parent; +} sipWrapper; + + +/* + * The meta-type of an enum type. (This is exposed only to support the + * deprecated sipConvertFromNamedEnum() macro.) + */ +typedef struct _sipEnumTypeObject { + /* + * The super-metatype. This must be first in the structure so that it can + * be cast to a PyTypeObject *. + */ + PyHeapTypeObject super; + + /* The generated type structure. */ + struct _sipTypeDef *type; +} sipEnumTypeObject; + + +/* + * Some convenient function pointers. + */ +typedef void *(*sipInitFunc)(sipSimpleWrapper *, PyObject *, PyObject *, + PyObject **, PyObject **, PyObject **); +typedef int (*sipTraverseFunc)(void *, visitproc, void *); +typedef int (*sipClearFunc)(void *); +#if PY_MAJOR_VERSION >= 3 +typedef int (*sipGetBufferFunc)(PyObject *, void *, Py_buffer *, int); +typedef void (*sipReleaseBufferFunc)(PyObject *, void *, Py_buffer *); +#else +typedef SIP_SSIZE_T (*sipBufferFunc)(PyObject *, void *, SIP_SSIZE_T, void **); +typedef SIP_SSIZE_T (*sipSegCountFunc)(PyObject *, void *, SIP_SSIZE_T *); +#endif +typedef void (*sipDeallocFunc)(sipSimpleWrapper *); +typedef void *(*sipCastFunc)(void *, const struct _sipTypeDef *); +typedef const struct _sipTypeDef *(*sipSubClassConvertFunc)(void **); +typedef int (*sipConvertToFunc)(PyObject *, void **, int *, PyObject *); +typedef PyObject *(*sipConvertFromFunc)(void *, PyObject *); +typedef int (*sipVirtHandlerFunc)(void *, PyObject *, ...); +typedef void (*sipAssignFunc)(void *, SIP_SSIZE_T, const void *); +typedef void *(*sipArrayFunc)(SIP_SSIZE_T); +typedef void *(*sipCopyFunc)(const void *, SIP_SSIZE_T); +typedef void (*sipReleaseFunc)(void *, int); +typedef PyObject *(*sipPickleFunc)(void *); +typedef int (*sipAttrGetterFunc)(const struct _sipTypeDef *, PyObject *); +typedef PyObject *(*sipVariableGetterFunc)(void *, PyObject *); +typedef int (*sipVariableSetterFunc)(void *, PyObject *, PyObject *); + + +/* + * The information describing an encoded type ID. + */ +typedef struct _sipEncodedTypeDef { + /* The type number. */ + unsigned sc_type:16; + + /* The module number (255 for this one). */ + unsigned sc_module:8; + + /* A context specific flag. */ + unsigned sc_flag:1; +} sipEncodedTypeDef; + + +/* + * The information describing an enum member. + */ +typedef struct _sipEnumMemberDef { + /* The member name. */ + const char *em_name; + + /* The member value. */ + int em_val; + + /* The member enum, -ve if anonymous. */ + int em_enum; +} sipEnumMemberDef; + + +/* + * The information describing static instances. + */ +typedef struct _sipInstancesDef { + /* The types. */ + struct _sipTypeInstanceDef *id_type; + + /* The void *. */ + struct _sipVoidPtrInstanceDef *id_voidp; + + /* The chars. */ + struct _sipCharInstanceDef *id_char; + + /* The strings. */ + struct _sipStringInstanceDef *id_string; + + /* The ints. */ + struct _sipIntInstanceDef *id_int; + + /* The longs. */ + struct _sipLongInstanceDef *id_long; + + /* The unsigned longs. */ + struct _sipUnsignedLongInstanceDef *id_ulong; + + /* The long longs. */ + struct _sipLongLongInstanceDef *id_llong; + + /* The unsigned long longs. */ + struct _sipUnsignedLongLongInstanceDef *id_ullong; + + /* The doubles. */ + struct _sipDoubleInstanceDef *id_double; +} sipInstancesDef; + + +/* + * The information describing a type initialiser extender. + */ +typedef struct _sipInitExtenderDef { + /* The API version range index. */ + int ie_api_range; + + /* The extender function. */ + sipInitFunc ie_extender; + + /* The class being extended. */ + sipEncodedTypeDef ie_class; + + /* The next extender for this class. */ + struct _sipInitExtenderDef *ie_next; +} sipInitExtenderDef; + + +/* + * The information describing a sub-class convertor. + */ +typedef struct _sipSubClassConvertorDef { + /* The convertor. */ + sipSubClassConvertFunc scc_convertor; + + /* The encoded base type. */ + sipEncodedTypeDef scc_base; + + /* The base type. */ + struct _sipTypeDef *scc_basetype; +} sipSubClassConvertorDef; + + +/* + * The different error states of handwritten code. + */ +typedef enum { + sipErrorNone, /* There is no error. */ + sipErrorFail, /* The error is a failure. */ + sipErrorContinue /* It may not apply if a later operation succeeds. */ +} sipErrorState; + + +/* + * The different Python slot types. + */ +typedef enum { + str_slot, /* __str__ */ + int_slot, /* __int__ */ +#if PY_MAJOR_VERSION < 3 + long_slot, /* __long__ */ +#endif + float_slot, /* __float__ */ + len_slot, /* __len__ */ + contains_slot, /* __contains__ */ + add_slot, /* __add__ for number */ + concat_slot, /* __add__ for sequence types */ + sub_slot, /* __sub__ */ + mul_slot, /* __mul__ for number types */ + repeat_slot, /* __mul__ for sequence types */ + div_slot, /* __div__ */ + mod_slot, /* __mod__ */ + floordiv_slot, /* __floordiv__ */ + truediv_slot, /* __truediv__ */ + and_slot, /* __and__ */ + or_slot, /* __or__ */ + xor_slot, /* __xor__ */ + lshift_slot, /* __lshift__ */ + rshift_slot, /* __rshift__ */ + iadd_slot, /* __iadd__ for number types */ + iconcat_slot, /* __iadd__ for sequence types */ + isub_slot, /* __isub__ */ + imul_slot, /* __imul__ for number types */ + irepeat_slot, /* __imul__ for sequence types */ + idiv_slot, /* __idiv__ */ + imod_slot, /* __imod__ */ + ifloordiv_slot, /* __ifloordiv__ */ + itruediv_slot, /* __itruediv__ */ + iand_slot, /* __iand__ */ + ior_slot, /* __ior__ */ + ixor_slot, /* __ixor__ */ + ilshift_slot, /* __ilshift__ */ + irshift_slot, /* __irshift__ */ + invert_slot, /* __invert__ */ + call_slot, /* __call__ */ + getitem_slot, /* __getitem__ */ + setitem_slot, /* __setitem__ */ + delitem_slot, /* __delitem__ */ + lt_slot, /* __lt__ */ + le_slot, /* __le__ */ + eq_slot, /* __eq__ */ + ne_slot, /* __ne__ */ + gt_slot, /* __gt__ */ + ge_slot, /* __ge__ */ +#if PY_MAJOR_VERSION < 3 + cmp_slot, /* __cmp__ */ +#endif + bool_slot, /* __bool__, __nonzero__ */ + neg_slot, /* __neg__ */ + repr_slot, /* __repr__ */ + hash_slot, /* __hash__ */ + pos_slot, /* __pos__ */ + abs_slot, /* __abs__ */ +#if PY_VERSION_HEX >= 0x02050000 + index_slot, /* __index__ */ +#endif + iter_slot, /* __iter__ */ + next_slot, /* __next__ */ +} sipPySlotType; + + +/* + * The information describing a Python slot function. + */ +typedef struct _sipPySlotDef { + /* The function. */ + void *psd_func; + + /* The type. */ + sipPySlotType psd_type; +} sipPySlotDef; + + +/* + * The information describing a Python slot extender. + */ +typedef struct _sipPySlotExtenderDef { + /* The function. */ + void *pse_func; + + /* The type. */ + sipPySlotType pse_type; + + /* The encoded class. */ + sipEncodedTypeDef pse_class; +} sipPySlotExtenderDef; + + +/* + * The information describing a typedef. + */ +typedef struct _sipTypedefDef { + /* The typedef name. */ + const char *tdd_name; + + /* The typedef value. */ + const char *tdd_type_name; +} sipTypedefDef; + + +/* + * The information describing a variable. + */ +typedef struct _sipVariableDef { + /* The variable name. */ + const char *vd_name; + + /* The variable getter. */ + sipVariableGetterFunc vd_getter; + + /* The variable setter. It is NULL if the variable is const. */ + sipVariableSetterFunc vd_setter; + + /* This is set if the variable is static. */ + int vd_is_static; +} sipVariableDef; + + +/* + * The information describing a type, either a C++ class (or C struct), a C++ + * namespace, a mapped type or a named enum. + */ +typedef struct _sipTypeDef { + /* The version range index, -1 if the type isn't versioned. */ + int td_version; + + /* The next version of this type. */ + struct _sipTypeDef *td_next_version; + + /* The module, 0 if the type hasn't been initialised. */ + struct _sipExportedModuleDef *td_module; + + /* Type flags, see the sipType*() macros. */ + int td_flags; + + /* The C/C++ name of the type. */ + int td_cname; + + /* + * The Python type object. This needs to be a union until we remove the + * deprecated sipClass_* macros. + */ + union { + PyTypeObject *td_py_type; + sipWrapperType *td_wrapper_type; + } u; +} sipTypeDef; + + +/* + * The information describing a container (ie. a class, namespace or a mapped + * type). + */ +typedef struct _sipContainerDef { + /* + * The Python name of the type, -1 if this is a namespace extender (in the + * context of a class) or doesn't require a namespace (in the context of a + * mapped type). */ + int cod_name; + + /* + * The scoping type or the namespace this is extending if it is a namespace + * extender. + */ + sipEncodedTypeDef cod_scope; + + /* The number of lazy methods. */ + int cod_nrmethods; + + /* The table of lazy methods. */ + PyMethodDef *cod_methods; + + /* The number of lazy enum members. */ + int cod_nrenummembers; + + /* The table of lazy enum members. */ + sipEnumMemberDef *cod_enummembers; + + /* The number of variables. */ + int cod_nrvariables; + + /* The table of variables. */ + sipVariableDef *cod_variables; + + /* The static instances. */ + sipInstancesDef cod_instances; +} sipContainerDef; + + +/* + * The information describing a C++ class (or C struct) or a C++ namespace. + */ +typedef struct _sipClassTypeDef { + /* The base type information. */ + sipTypeDef ctd_base; + + /* The container information. */ + sipContainerDef ctd_container; + + /* The docstring. */ + const char *ctd_docstring; + + /* + * The meta-type name, -1 to use the meta-type of the first super-type + * (normally sipWrapperType). + */ + int ctd_metatype; + + /* The super-type name, -1 to use sipWrapper. */ + int ctd_supertype; + + /* The super-types. */ + sipEncodedTypeDef *ctd_supers; + + /* The table of Python slots. */ + sipPySlotDef *ctd_pyslots; + + /* The initialisation function. */ + sipInitFunc ctd_init; + + /* The traverse function. */ + sipTraverseFunc ctd_traverse; + + /* The clear function. */ + sipClearFunc ctd_clear; + +#if PY_MAJOR_VERSION >= 3 + /* The get buffer function. */ + sipGetBufferFunc ctd_getbuffer; + + /* The release buffer function. */ + sipReleaseBufferFunc ctd_releasebuffer; +#else + /* The read buffer function. */ + sipBufferFunc ctd_readbuffer; + + /* The write buffer function. */ + sipBufferFunc ctd_writebuffer; + + /* The segment count function. */ + sipSegCountFunc ctd_segcount; + + /* The char buffer function. */ + sipBufferFunc ctd_charbuffer; +#endif + + /* The deallocation function. */ + sipDeallocFunc ctd_dealloc; + + /* The optional assignment function. */ + sipAssignFunc ctd_assign; + + /* The optional array allocation function. */ + sipArrayFunc ctd_array; + + /* The optional copy function. */ + sipCopyFunc ctd_copy; + + /* The release function, 0 if a C strict. */ + sipReleaseFunc ctd_release; + + /* The cast function, 0 if a C struct. */ + sipCastFunc ctd_cast; + + /* The optional convert to function. */ + sipConvertToFunc ctd_cto; + + /* The next namespace extender. */ + struct _sipClassTypeDef *ctd_nsextender; + + /* The pickle function. */ + sipPickleFunc ctd_pickle; +} sipClassTypeDef; + + +/* + * The information describing a mapped type. + */ +typedef struct _sipMappedTypeDef { + /* The base type information. */ + sipTypeDef mtd_base; + + /* The container information. */ + sipContainerDef mtd_container; + + /* The optional assignment function. */ + sipAssignFunc mtd_assign; + + /* The optional array allocation function. */ + sipArrayFunc mtd_array; + + /* The optional copy function. */ + sipCopyFunc mtd_copy; + + /* The optional release function. */ + sipReleaseFunc mtd_release; + + /* The convert to function. */ + sipConvertToFunc mtd_cto; + + /* The convert from function. */ + sipConvertFromFunc mtd_cfrom; +} sipMappedTypeDef; + + +/* + * The information describing a named enum. + */ +typedef struct _sipEnumTypeDef { + /* The base type information. */ + sipTypeDef etd_base; + + /* The Python name of the enum. */ + int etd_name; + + /* The scoping type, -1 if it is defined at the module level. */ + int etd_scope; + + /* The Python slots. */ + struct _sipPySlotDef *etd_pyslots; +} sipEnumTypeDef; + + +/* + * The information describing an external type. + */ +typedef struct _sipExternalTypeDef { + /* The index into the type table. */ + int et_nr; + + /* The name of the type. */ + const char *et_name; +} sipExternalTypeDef; + + +/* + * The information describing a mapped class. This (and anything that uses it) + * is deprecated. + */ +typedef sipTypeDef sipMappedType; + + +/* + * Defines an entry in the module specific list of delayed dtor calls. + */ +typedef struct _sipDelayedDtor { + /* The C/C++ instance. */ + void *dd_ptr; + + /* The class name. */ + const char *dd_name; + + /* Non-zero if dd_ptr is a derived class instance. */ + int dd_isderived; + + /* Next in the list. */ + struct _sipDelayedDtor *dd_next; +} sipDelayedDtor; + + +/* + * Defines an entry in the table of global functions all of whose overloads + * are versioned (so their names can't be automatically added to the module + * dictionary). + */ +typedef struct _sipVersionedFunctionDef { + /* The name, -1 marks the end of the table. */ + int vf_name; + + /* The function itself. */ + PyCFunction vf_function; + + /* The METH_* flags. */ + int vf_flags; + + /* The docstring. */ + const char *vf_docstring; + + /* The API version range index. */ + int vf_api_range; +} sipVersionedFunctionDef; + + +/* + * The information describing an imported module. + */ +typedef struct _sipImportedModuleDef { + /* The module name. */ + const char *im_name; + + /* The required version. */ + int im_version; + + /* The imported module. */ + struct _sipExportedModuleDef *im_module; +} sipImportedModuleDef; + + +/* + * The main client module structure. + */ +typedef struct _sipExportedModuleDef { + /* The next in the list. */ + struct _sipExportedModuleDef *em_next; + + /* The SIP-TQt API minor version number. */ + unsigned em_api_minor; + + /* The module name. */ + int em_name; + + /* The module name as an object. */ + PyObject *em_nameobj; + + /* The module version. */ + int em_version; + + /* The string pool. */ + const char *em_strings; + + /* The imported modules. */ + sipImportedModuleDef *em_imports; + + /* The optional TQt support API. */ + struct _sipTQtAPI *em_qt_api; + + /* The number of types. */ + int em_nrtypes; + + /* The table of types. */ + sipTypeDef **em_types; + + /* The table of external types. */ + sipExternalTypeDef *em_external; + + /* The number of members in global enums. */ + int em_nrenummembers; + + /* The table of members in global enums. */ + sipEnumMemberDef *em_enummembers; + + /* The number of typedefs. */ + int em_nrtypedefs; + + /* The table of typedefs. */ + sipTypedefDef *em_typedefs; + + /* The table of virtual handlers. */ + sipVirtHandlerFunc *em_virthandlers; + + /* The sub-class convertors. */ + sipSubClassConvertorDef *em_convertors; + + /* The static instances. */ + sipInstancesDef em_instances; + + /* The license. */ + struct _sipLicenseDef *em_license; + + /* The table of exception types. */ + PyObject **em_exceptions; + + /* The table of Python slot extenders. */ + sipPySlotExtenderDef *em_slotextend; + + /* The table of initialiser extenders. */ + sipInitExtenderDef *em_initextend; + + /* The delayed dtor handler. */ + void (*em_delayeddtors)(const sipDelayedDtor *); + + /* The list of delayed dtors. */ + sipDelayedDtor *em_ddlist; + + /* + * The array of API version definitions. Each definition takes up 3 + * elements. If the third element of a 3-tuple is negative then the first + * two elements define an API and its default version. All such + * definitions will appear at the end of the array. If the first element + * of a 3-tuple is negative then that is the last element of the array. + */ + int *em_versions; + + /* The optional table of versioned functions. */ + sipVersionedFunctionDef *em_versioned_functions; +} sipExportedModuleDef; + + +/* + * The information describing a license to be added to a dictionary. + */ +typedef struct _sipLicenseDef { + /* The type of license. */ + const char *lc_type; + + /* The licensee. */ + const char *lc_licensee; + + /* The timestamp. */ + const char *lc_timestamp; + + /* The signature. */ + const char *lc_signature; +} sipLicenseDef; + + +/* + * The information describing a void pointer instance to be added to a + * dictionary. + */ +typedef struct _sipVoidPtrInstanceDef { + /* The void pointer name. */ + const char *vi_name; + + /* The void pointer value. */ + void *vi_val; +} sipVoidPtrInstanceDef; + + +/* + * The information describing a char instance to be added to a dictionary. + */ +typedef struct _sipCharInstanceDef { + /* The char name. */ + const char *ci_name; + + /* The char value. */ + char ci_val; + + /* The encoding used, either 'A', 'L', '8' or 'N'. */ + char ci_encoding; +} sipCharInstanceDef; + + +/* + * The information describing a string instance to be added to a dictionary. + */ +typedef struct _sipStringInstanceDef { + /* The string name. */ + const char *si_name; + + /* The string value. */ + const char *si_val; + + /* The encoding used, either 'A', 'L', '8' or 'N'. */ + char si_encoding; +} sipStringInstanceDef; + + +/* + * The information describing an int instance to be added to a dictionary. + */ +typedef struct _sipIntInstanceDef { + /* The int name. */ + const char *ii_name; + + /* The int value. */ + int ii_val; +} sipIntInstanceDef; + + +/* + * The information describing a long instance to be added to a dictionary. + */ +typedef struct _sipLongInstanceDef { + /* The long name. */ + const char *li_name; + + /* The long value. */ + long li_val; +} sipLongInstanceDef; + + +/* + * The information describing an unsigned long instance to be added to a + * dictionary. + */ +typedef struct _sipUnsignedLongInstanceDef { + /* The unsigned long name. */ + const char *uli_name; + + /* The unsigned long value. */ + unsigned long uli_val; +} sipUnsignedLongInstanceDef; + + +/* + * The information describing a long long instance to be added to a dictionary. + */ +typedef struct _sipLongLongInstanceDef { + /* The long long name. */ + const char *lli_name; + + /* The long long value. */ +#if defined(HAVE_LONG_LONG) + PY_LONG_LONG lli_val; +#else + long lli_val; +#endif +} sipLongLongInstanceDef; + + +/* + * The information describing an unsigned long long instance to be added to a + * dictionary. + */ +typedef struct _sipUnsignedLongLongInstanceDef { + /* The unsigned long long name. */ + const char *ulli_name; + + /* The unsigned long long value. */ +#if defined(HAVE_LONG_LONG) + unsigned PY_LONG_LONG ulli_val; +#else + unsigned long ulli_val; +#endif +} sipUnsignedLongLongInstanceDef; + + +/* + * The information describing a double instance to be added to a dictionary. + */ +typedef struct _sipDoubleInstanceDef { + /* The double name. */ + const char *di_name; + + /* The double value. */ + double di_val; +} sipDoubleInstanceDef; + + +/* + * The information describing a class or enum instance to be added to a + * dictionary. + */ +typedef struct _sipTypeInstanceDef { + /* The type instance name. */ + const char *ti_name; + + /* The actual instance. */ + void *ti_ptr; + + /* A pointer to the generated type. */ + struct _sipTypeDef **ti_type; + + /* The wrapping flags. */ + int ti_flags; +} sipTypeInstanceDef; + + +/* + * Define a mapping between a wrapped type identified by a string and the + * corresponding Python type. This is deprecated. + */ +typedef struct _sipStringTypeClassMap { + /* The type as a string. */ + const char *typeString; + + /* A pointer to the Python type. */ + struct _sipWrapperType **pyType; +} sipStringTypeClassMap; + + +/* + * Define a mapping between a wrapped type identified by an integer and the + * corresponding Python type. This is deprecated. + */ +typedef struct _sipIntTypeClassMap { + /* The type as an integer. */ + int typeInt; + + /* A pointer to the Python type. */ + struct _sipWrapperType **pyType; +} sipIntTypeClassMap; + + +/* + * A Python method's component parts. This allows us to re-create the method + * without changing the reference counts of the components. + */ +typedef struct _sipPyMethod { + /* The function. */ + PyObject *mfunc; + + /* Self if it is a bound method. */ + PyObject *mself; + +#if PY_MAJOR_VERSION < 3 + /* The class. */ + PyObject *mclass; +#endif +} sipPyMethod; + + +/* + * A slot (in the TQt, rather than Python, sense). + */ +typedef struct _sipSlot { + /* Name if a TQt or Python signal. */ + char *name; + + /* Signal or TQt slot object. */ + PyObject *pyobj; + + /* Python slot method, pyobj is NULL. */ + sipPyMethod meth; + + /* A weak reference to the slot, Py_True if pyobj has an extra reference. */ + PyObject *weakSlot; +} sipSlot; + + +/* + * The API exported by the SIP-TQt module, ie. pointers to all the data and + * functions that can be used by generated code. + */ +typedef struct _sipAPIDef { + /* + * This must be the first entry and it's signature must not change so that + * version number mismatches can be detected and reported. + */ + int (*api_export_module)(sipExportedModuleDef *client, unsigned api_major, + unsigned api_minor, void *unused); + + /* + * The following are part of the public API. + */ + PyTypeObject *api_simplewrapper_type; + PyTypeObject *api_wrapper_type; + PyTypeObject *api_wrappertype_type; + PyTypeObject *api_voidptr_type; + + void (*api_bad_catcher_result)(PyObject *method); + void (*api_bad_length_for_slice)(SIP_SSIZE_T seqlen, SIP_SSIZE_T slicelen); + PyObject *(*api_build_result)(int *isErr, const char *fmt, ...); + PyObject *(*api_call_method)(int *isErr, PyObject *method, const char *fmt, + ...); + PyObject *(*api_connect_rx)(PyObject *txObj, const char *sig, + PyObject *rxObj, const char *slot, int type); + SIP_SSIZE_T (*api_convert_from_sequence_index)(SIP_SSIZE_T idx, + SIP_SSIZE_T len); + int (*api_can_convert_to_type)(PyObject *pyObj, const sipTypeDef *td, + int flags); + void *(*api_convert_to_type)(PyObject *pyObj, const sipTypeDef *td, + PyObject *transferObj, int flags, int *statep, int *iserrp); + void *(*api_force_convert_to_type)(PyObject *pyObj, const sipTypeDef *td, + PyObject *transferObj, int flags, int *statep, int *iserrp); + int (*api_can_convert_to_enum)(PyObject *pyObj, const sipTypeDef *td); + void (*api_release_type)(void *cpp, const sipTypeDef *td, int state); + PyObject *(*api_convert_from_type)(void *cpp, const sipTypeDef *td, + PyObject *transferObj); + PyObject *(*api_convert_from_new_type)(void *cpp, const sipTypeDef *td, + PyObject *transferObj); + PyObject *(*api_convert_from_enum)(int eval, const sipTypeDef *td); + int (*api_get_state)(PyObject *transferObj); + PyObject *(*api_disconnect_rx)(PyObject *txObj, const char *sig, + PyObject *rxObj, const char *slot); + void (*api_free)(void *mem); + PyObject *(*api_get_pyobject)(void *cppPtr, const sipTypeDef *td); + void *(*api_malloc)(size_t nbytes); + int (*api_parse_result)(int *isErr, PyObject *method, PyObject *res, + const char *fmt, ...); + void (*api_trace)(unsigned mask, const char *fmt, ...); + void (*api_transfer_back)(PyObject *self); + void (*api_transfer_to)(PyObject *self, PyObject *owner); + void (*api_transfer_break)(PyObject *self); + unsigned long (*api_long_as_unsigned_long)(PyObject *o); + PyObject *(*api_convert_from_void_ptr)(void *val); + PyObject *(*api_convert_from_const_void_ptr)(const void *val); + PyObject *(*api_convert_from_void_ptr_and_size)(void *val, + SIP_SSIZE_T size); + PyObject *(*api_convert_from_const_void_ptr_and_size)(const void *val, + SIP_SSIZE_T size); + void *(*api_convert_to_void_ptr)(PyObject *obj); + int (*api_export_symbol)(const char *name, void *sym); + void *(*api_import_symbol)(const char *name); + const sipTypeDef *(*api_find_type)(const char *type); + int (*api_register_py_type)(PyTypeObject *type); + const sipTypeDef *(*api_type_from_py_type_object)(PyTypeObject *py_type); + const sipTypeDef *(*api_type_scope)(const sipTypeDef *td); + const char *(*api_resolve_typedef)(const char *name); + int (*api_register_attribute_getter)(const sipTypeDef *td, + sipAttrGetterFunc getter); + int (*api_is_api_enabled)(const char *name, int from, int to); + sipErrorState (*api_bad_callable_arg)(int arg_nr, PyObject *arg); + + /* + * The following are deprecated parts of the public API. + */ + PyTypeObject *(*api_find_named_enum)(const char *type); + const sipMappedType *(*api_find_mapped_type)(const char *type); + sipWrapperType *(*api_find_class)(const char *type); + sipWrapperType *(*api_map_int_to_class)(int typeInt, + const sipIntTypeClassMap *map, int maplen); + sipWrapperType *(*api_map_string_to_class)(const char *typeString, + const sipStringTypeClassMap *map, int maplen); + + /* + * The following may be used by TQt support code but no other handwritten + * code. + */ + void (*api_free_sipslot)(sipSlot *slot); + int (*api_same_slot)(const sipSlot *sp, PyObject *rxObj, const char *slot); + void *(*api_convert_rx)(sipWrapper *txSelf, const char *sigargs, + PyObject *rxObj, const char *slot, const char **memberp, + int flags); + PyObject *(*api_invoke_slot)(const sipSlot *slot, PyObject *sigargs); + int (*api_save_slot)(sipSlot *sp, PyObject *rxObj, const char *slot); + void (*api_clear_any_slot_reference)(sipSlot *slot); + int (*api_visit_slot)(sipSlot *slot, visitproc visit, void *arg); + + /* + * The following are not part of the public API. + */ + int (*api_init_module)(sipExportedModuleDef *client, PyObject *mod_dict); + int (*api_parse_args)(PyObject **parseErrp, PyObject *sipArgs, + const char *fmt, ...); + int (*api_parse_pair)(PyObject **parseErrp, PyObject *arg0, PyObject *arg1, + const char *fmt, ...); + void (*api_common_dtor)(sipSimpleWrapper *sipSelf); + void (*api_no_function)(PyObject *parseErr, const char *func, + const char *doc); + void (*api_no_method)(PyObject *parseErr, const char *scope, + const char *method, const char *doc); + void (*api_abstract_method)(const char *classname, const char *method); + void (*api_bad_class)(const char *classname); + void *(*api_get_cpp_ptr)(sipSimpleWrapper *w, const sipTypeDef *td); + void *(*api_get_complex_cpp_ptr)(sipSimpleWrapper *w); + PyObject *(*api_is_py_method)(sip_gilstate_t *gil, char *pymc, + sipSimpleWrapper *sipSelf, const char *cname, const char *mname); + void (*api_call_hook)(const char *hookname); + void (*api_start_thread)(void); + void (*api_end_thread)(void); + void (*api_raise_unknown_exception)(void); + void (*api_raise_type_exception)(const sipTypeDef *td, void *ptr); + int (*api_add_type_instance)(PyObject *dict, const char *name, + void *cppPtr, const sipTypeDef *td); + void (*api_bad_operator_arg)(PyObject *self, PyObject *arg, + sipPySlotType st); + PyObject *(*api_pyslot_extend)(sipExportedModuleDef *mod, sipPySlotType st, + const sipTypeDef *type, PyObject *arg0, PyObject *arg1); + void (*api_add_delayed_dtor)(sipSimpleWrapper *w); + char (*api_bytes_as_char)(PyObject *obj); + const char *(*api_bytes_as_string)(PyObject *obj); + char (*api_string_as_ascii_char)(PyObject *obj); + const char *(*api_string_as_ascii_string)(PyObject **obj); + char (*api_string_as_latin1_char)(PyObject *obj); + const char *(*api_string_as_latin1_string)(PyObject **obj); + char (*api_string_as_utf8_char)(PyObject *obj); + const char *(*api_string_as_utf8_string)(PyObject **obj); +#if defined(HAVE_WCHAR_H) + wchar_t (*api_unicode_as_wchar)(PyObject *obj); + wchar_t *(*api_unicode_as_wstring)(PyObject *obj); +#else + int (*api_unicode_as_wchar)(PyObject *obj); + int *(*api_unicode_as_wstring)(PyObject *obj); +#endif + int (*api_deprecated)(const char *classname, const char *method); + void (*api_keep_reference)(PyObject *self, int key, PyObject *obj); + int (*api_parse_kwd_args)(PyObject **parseErrp, PyObject *sipArgs, + PyObject *sipKwdArgs, const char **kwdlist, PyObject **unused, + const char *fmt, ...); + void (*api_add_exception)(sipErrorState es, PyObject **parseErrp); +} sipAPIDef; + + +/* + * The API implementing the optional TQt support. + */ +typedef struct _sipTQtAPI { + sipTypeDef **qt_qobject; + void *(*qt_create_universal_signal)(void *, const char **); + void *(*qt_find_universal_signal)(void *, const char **); + void *(*qt_create_universal_slot)(struct _sipWrapper *, const char *, + PyObject *, const char *, const char **, int); + void (*qt_destroy_universal_slot)(void *); + void *(*qt_find_slot)(void *, const char *, PyObject *, const char *, + const char **); + int (*qt_connect)(void *, const char *, void *, const char *, int); + int (*qt_disconnect)(void *, const char *, void *, const char *); + int (*qt_same_name)(const char *, const char *); + sipSlot *(*qt_find_sipslot)(void *, void **); + int (*tqt_emit_signal)(PyObject *, const char *, PyObject *); + int (*qt_connect_py_signal)(PyObject *, const char *, PyObject *, + const char *); + void (*qt_disconnect_py_signal)(PyObject *, const char *, PyObject *, + const char *); +} sipTQtAPI; + + +/* + * These are flags that can be passed to sipCanConvertToType(), + * sipConvertToType() and sipForceConvertToType(). + */ +#define SIP_NOT_NONE 0x01 /* Disallow None. */ +#define SIP_NO_CONVERTORS 0x02 /* Disable any type convertors. */ + + +/* + * These are the state flags returned by %ConvertToTypeCode. Note that these + * share the same "namespace" as the flags below. + */ +#define SIP_TEMPORARY 0x0001 /* A temporary instance. */ +#define SIP_DERIVED_CLASS 0x0002 /* The instance is derived. */ + + +/* + * These flags are specific to the TQt support API. + */ +#define SIP_SINGLE_SHOT 0x01 /* The connection is single shot. */ + + +/* + * Useful macros, not part of the public API. + */ +#define SIP_PY_OWNED 0x0004 /* Owned by Python. */ +#define SIP_INDIRECT 0x0008 /* If there is a level of indirection. */ +#define SIP_ACCFUNC 0x0010 /* If there is an access function. */ +#define SIP_NOT_IN_MAP 0x0020 /* If Python object not in the map. */ +#define SIP_SHARE_MAP 0x0040 /* If the map slot might be occupied. */ +#define SIP_CPP_HAS_REF 0x0080 /* If C/C++ has a reference. */ +#define SIP_POSSIBLE_PROXY 0x0100 /* If there might be a proxy slot. */ + +#define sipIsPyOwned(w) ((w)->flags & SIP_PY_OWNED) +#define sipSetPyOwned(w) ((w)->flags |= SIP_PY_OWNED) +#define sipResetPyOwned(w) ((w)->flags &= ~SIP_PY_OWNED) +#define sipIsDerived(w) ((w)->flags & SIP_DERIVED_CLASS) +#define sipIsIndirect(w) ((w)->flags & SIP_INDIRECT) +#define sipIsAccessFunc(w) ((w)->flags & SIP_ACCFUNC) +#define sipNotInMap(w) ((w)->flags & SIP_NOT_IN_MAP) +#define sipSetNotInMap(w) ((w)->flags |= SIP_NOT_IN_MAP) +#define sipCppHasRef(w) ((w)->flags & SIP_CPP_HAS_REF) +#define sipSetCppHasRef(w) ((w)->flags |= SIP_CPP_HAS_REF) +#define sipResetCppHasRef(w) ((w)->flags &= ~SIP_CPP_HAS_REF) +#define sipPossibleProxy(w) ((w)->flags & SIP_POSSIBLE_PROXY) +#define sipSetPossibleProxy(w) ((w)->flags |= SIP_POSSIBLE_PROXY) + + +#define SIP_TYPE_TYPE_MASK 0x0007 /* The type type mask. */ +#define SIP_TYPE_CLASS 0x0000 /* If the type is a C++ class. */ +#define SIP_TYPE_NAMESPACE 0x0001 /* If the type is a C++ namespace. */ +#define SIP_TYPE_MAPPED 0x0002 /* If the type is a mapped type. */ +#define SIP_TYPE_ENUM 0x0003 /* If the type is a named enum. */ +#define SIP_TYPE_ABSTRACT 0x0008 /* If the type is abstract. */ +#define SIP_TYPE_SCC 0x0010 /* If the type is subject to sub-class convertors. */ +#define SIP_TYPE_ALLOW_NONE 0x0020 /* If the type can handle None. */ +#define SIP_TYPE_STUB 0x0040 /* If the type is a stub. */ + + +/* + * The following are part of the public API. + */ +#define sipTypeIsClass(td) (((td)->td_flags & SIP_TYPE_TYPE_MASK) == SIP_TYPE_CLASS) +#define sipTypeIsNamespace(td) (((td)->td_flags & SIP_TYPE_TYPE_MASK) == SIP_TYPE_NAMESPACE) +#define sipTypeIsMapped(td) (((td)->td_flags & SIP_TYPE_TYPE_MASK) == SIP_TYPE_MAPPED) +#define sipTypeIsEnum(td) (((td)->td_flags & SIP_TYPE_TYPE_MASK) == SIP_TYPE_ENUM) +#define sipTypeAsPyTypeObject(td) ((td)->u.td_py_type) +#define sipTypeName(td) sipNameFromPool((td)->td_module, (td)->td_cname) + +#define sipIsExactWrappedType(wt) (sipTypeAsPyTypeObject((wt)->type) == (PyTypeObject *)(wt)) + +#define sipConvertFromSliceObject(o,len,start,stop,step,slen) \ + PySlice_GetIndicesEx((PySliceObject *)(o), (len), (start), (stop), \ + (step), (slen)) + + +/* + * The following are deprecated parts of the public API. + */ +#define sipClassName(w) PyString_FromString(Py_TYPE(w)->tp_name) + + +/* + * The following are not part of the public API. + */ +#define sipTypeIsAbstract(td) ((td)->td_flags & SIP_TYPE_ABSTRACT) +#define sipTypeHasSCC(td) ((td)->td_flags & SIP_TYPE_SCC) +#define sipTypeAllowNone(td) ((td)->td_flags & SIP_TYPE_ALLOW_NONE) +#define sipTypeIsStub(td) ((td)->td_flags & SIP_TYPE_STUB) +#define sipTypeSetStub(td) ((td)->td_flags |= SIP_TYPE_STUB) + +/* + * Get various names from the string pool for various data types. + */ +#define sipNameFromPool(em, mr) (&((em)->em_strings)[(mr)]) +#define sipNameOfModule(em) sipNameFromPool((em), (em)->em_name) +#define sipPyNameOfContainer(cod, td) sipNameFromPool((td)->td_module, (cod)->cod_name) +#define sipPyNameOfEnum(etd) sipNameFromPool((etd)->etd_base.td_module, (etd)->etd_name) + + +/* + * The following are PyTQt3-specific extensions. In SIP-TQt v5 they will be pushed + * out to a plugin supplied by PyTQt3. + */ + +typedef int (*pyqt3EmitFunc)(sipSimpleWrapper *, PyObject *); + + +/* + * Maps the name of a TQt signal to a wrapper function to emit it. + */ +typedef struct _pyqt3QtSignal { + /* The signal name. */ + const char *st_name; + + /* The emitter function. */ + pyqt3EmitFunc st_emitfunc; +} pyqt3QtSignal; + + +/* + * This is the PyTQt3-specific extension to the generated class type structure. + */ +typedef struct _pyqt3ClassTypeDef { + /* + * The super-type structure. This must be first in the structure so that + * it can be cast to sipClassTypeDef *. + */ + sipClassTypeDef super; + + /* The emit table for TQt signals. */ + pyqt3QtSignal *qt3_emit; +} pyqt3ClassTypeDef; + + +/* + * The following are PyQt4-specific extensions. In SIP-TQt v5 they will be pushed + * out to a plugin supplied by PyQt4. + */ + +/* + * The description of a TQt signal for PyQt4. + */ +typedef struct _pyqt4QtSignal { + /* The C++ name and signature of the signal. */ + const char *signature; + + /* The optional docstring. */ + const char *docstring; + + /* + * If the signal is an overload of regular methods then this points to the + * code that implements those methods. + */ + PyMethodDef *non_signals; +} pyqt4QtSignal; + + +/* + * This is the PyQt4-specific extension to the generated class type structure. + */ +typedef struct _pyqt4ClassTypeDef { + /* + * The super-type structure. This must be first in the structure so that + * it can be cast to sipClassTypeDef *. + */ + sipClassTypeDef super; + + /* A pointer to the QObject sub-class's staticMetaObject class variable. */ + const void *qt4_static_metaobject; + + /* + * A set of flags. At the moment only bit 0 is used to say if the type is + * derived from QFlags. + */ + unsigned qt4_flags; + + /* + * The table of signals emitted by the type. These are grouped by signal + * name. + */ + const pyqt4QtSignal *qt4_signals; +} pyqt4ClassTypeDef; + + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/siplib/sip.h b/siplib/sip.h deleted file mode 100644 index 3e9a3c6..0000000 --- a/siplib/sip.h +++ /dev/null @@ -1,1587 +0,0 @@ -/* - * The SIP module interface. - * - * Copyright (c) 2010 Riverbank Computing Limited - * - * This file is part of SIP. - * - * This copy of SIP is licensed for use under the terms of the SIP License - * Agreement. See the file LICENSE for more details. - * - * This copy of SIP may also used under the terms of the GNU General Public - * License v2 or v3 as published by the Free Software Foundation which can be - * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. - * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - */ - - -#ifndef _SIP_H -#define _SIP_H - - -/* - * This gets round a problem with TQt's moc and Python v2.3. Strictly speaking - * it's a TQt problem but later versions of Python include a fix for it so we - * might as well too. - */ -#undef slots - - -#include - -/* - * There is a mis-feature somewhere with the Borland compiler. This works - * around it. - */ -#if defined(__BORLANDC__) -#include -#endif - - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Sanity check on the Python version. */ -#if PY_VERSION_HEX < 0x02030000 -#error "This version of SIP requires Python v2.3 or later" -#endif - - -/* - * Define the SIP version number. - */ -#define SIP_VERSION 0x040a05 -#define SIP_VERSION_STR "4.10.5" - - -/* - * Define the current API version number. SIP must handle modules with the - * same major number and with the same or earlier minor number. Whenever data - * structure elements are added they must be appended and the minor number - * incremented. Whenever data structure elements are removed or the order - * changed then the major number must be incremented and the minor number set - * to 0. - * - * History: - * - * 7.1 Added the 'H' format character to sip_api_parse_result(). - * Deprecated the 'D' format character of sip_api_parse_result(). - * - * 7.0 Added sip_api_parse_kwd_args(). - * Added sipErrorState, sip_api_add_exception(). - * The type initialisation function is now passed a dictionary of keyword - * arguments. - * All argument parsers now update a set of error messages rather than an - * argument count. - * The signatures of sip_api_no_function() and sip_api_no_method() have - * changed. - * Added ctd_docstring to sipClassTypeDef. - * Added vf_docstring to sipVersionedFunctionDef. - * - * 6.0 Added the sipContainerDef structure to define the contents of a class - * or mapped type. Restructured sipClassDef and sipMappedTypeDef - * accordingly. - * Added the 'r' format character to sip_api_parse_args(). - * Added the 'r' format character to sip_api_call_method() and - * sip_api_build_result(). - * Added the assignment, array and copy allocation helpers. - * - * 5.0 Added sip_api_is_api_enabled(). - * Renamed the td_version_nr member of sipTypeDef to be int and where -1 - * indicates it is not versioned. - * Added the em_versions member to sipExportedModuleDef. - * Added the em_versioned_functions member to sipExportedModuleDef. - * - * 4.0 Much refactoring. - * - * 3.8 Added sip_api_register_qt_metatype() and sip_api_deprecated(). - * Added qt_register_meta_type() to the TQt support API. - * The C/C++ names of enums and types are now always defined in the - * relevant structures and don't default to the Python name. - * Added the 'XE' format characters to sip_api_parse_args(). - * - * 3.7 Added sip_api_convert_from_const_void_ptr(), - * sip_api_convert_from_void_ptr_and_size() and - * sip_api_convert_from_const_void_ptr_and_size(). - * Added the 'g' and 'G' format characters (to replace the now deprecated - * 'a' and 'A' format characters) to sip_api_build_result(), - * sip_api_call_method() and sip_api_parse_result(). - * Added the 'k' and 'K' format characters (to replace the now deprecated - * 'a' and 'A' format characters) to sip_api_parse_args(). - * Added sip_api_invoke_slot(). - * Added sip_api_parse_type(). - * Added sip_api_is_exact_wrapped_type(). - * Added sip_api_assign_instance(). - * Added sip_api_assign_mapped_type(). - * Added the td_assign and td_qt fields to the sipTypeDef structure. - * Added the mt_assign field to the sipMappedType structure. - * - * 3.6 Added the 'g' format character to sip_api_parse_args(). - * - * 3.5 Added the td_pickle field to the sipTypeDef structure. - * Added sip_api_transfer_break(). - * - * 3.4 Added qt_find_connection() to the TQt support API. - * Added sip_api_string_as_char(), sip_api_unicode_as_wchar(), - * sip_api_unicode_as_wstring(), sip_api_find_class(), - * sip_api_find_named_enum() and sip_api_parse_signature(). - * Added the 'A', 'w' and 'x' format characters to sip_api_parse_args(), - * sip_api_parse_result(), sip_api_build_result() and - * sip_api_call_method(). - * - * 3.3 Added sip_api_register_int_types(). - * - * 3.2 Added sip_api_export_symbol() and sip_api_import_symbol(). - * - * 3.1 Added sip_api_add_mapped_type_instance(). - * - * 3.0 Moved the TQt support out of the sip module and into PyTQt. This is - * such a dramatic change that there is no point in attempting to maintain - * backwards compatibility. - * - * 2.0 Added the td_flags field to the sipTypeDef structure. - * Added the first_child, sibling_next, sibling_prev and parent fields to - * the sipWrapper structure. - * Added the td_traverse and td_clear fields to the sipTypeDef structure. - * Added the em_api_minor field to the sipExportedModuleDef structure. - * Added sip_api_bad_operator_arg(). - * Added sip_api_wrapper_check(). - * - * 1.1 Added support for __pos__ and __abs__. - * - * 1.0 Removed all deprecated parts of the API. - * Removed the td_proxy field from the sipTypeDef structure. - * Removed the create proxy function from the 'q' and 'y' format - * characters to sip_api_parse_args(). - * Removed sip_api_emit_to_slot(). - * Reworked the enum related structures. - * - * 0.2 Added the 'H' format character to sip_api_parse_args(). - * - * 0.1 Added sip_api_add_class_instance(). - * Added the 't' format character to sip_api_parse_args(). - * Deprecated the 'J' and 'K' format characters to sip_api_parse_result(). - * - * 0.0 Original version. - */ -#define SIP_API_MAJOR_NR 7 -#define SIP_API_MINOR_NR 1 - - -/* Some compatibility stuff to help with handwritten code for SIP v3. */ -#if !defined(ANY) -#define ANY void -#endif - - -/* Some Python compatibility stuff. */ -#if PY_VERSION_HEX >= 0x02050000 - -#define SIP_SSIZE_T Py_ssize_t - -#define SIP_MLNAME_CAST(s) (s) -#define SIP_MLDOC_CAST(s) (s) -#define SIP_TPNAME_CAST(s) (s) - -#else - -#define SIP_SSIZE_T int - -#define SIP_MLNAME_CAST(s) ((char *)(s)) -#define SIP_MLDOC_CAST(s) ((char *)(s)) -#define SIP_TPNAME_CAST(s) ((char *)(s)) - -#endif - -#if PY_MAJOR_VERSION >= 3 - -#define SIPLong_FromLong PyLong_FromLong -#define SIPLong_AsLong PyLong_AsLong - -#define SIPBytes_Check PyBytes_Check -#define SIPBytes_FromString PyBytes_FromString -#define SIPBytes_FromStringAndSize PyBytes_FromStringAndSize -#define SIPBytes_AS_STRING PyBytes_AS_STRING -#define SIPBytes_GET_SIZE PyBytes_GET_SIZE - -#if PY_MINOR_VERSION >= 1 -#define SIP_USE_PYCAPSULE -#endif - -#else - -#define SIPLong_FromLong PyInt_FromLong -#define SIPLong_AsLong PyInt_AsLong - -#define SIPBytes_Check PyString_Check -#define SIPBytes_FromString PyString_FromString -#define SIPBytes_FromStringAndSize PyString_FromStringAndSize -#define SIPBytes_AS_STRING PyString_AS_STRING -#define SIPBytes_GET_SIZE PyString_GET_SIZE - -#if PY_MINOR_VERSION >= 7 -#define SIP_USE_PYCAPSULE -#endif - -#endif - -#if !defined(Py_REFCNT) -#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) -#endif - -#if !defined(Py_TYPE) -#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) -#endif - -#if !defined(PyVarObject_HEAD_INIT) -#define PyVarObject_HEAD_INIT(type, size) PyObject_HEAD_INIT(type) size, -#endif - - -/* - * The mask that can be passed to sipTrace(). - */ -#define SIP_TRACE_CATCHERS 0x0001 -#define SIP_TRACE_CTORS 0x0002 -#define SIP_TRACE_DTORS 0x0004 -#define SIP_TRACE_INITS 0x0008 -#define SIP_TRACE_DEALLOCS 0x0010 -#define SIP_TRACE_METHODS 0x0020 - - -/* - * Hide some thread dependent stuff. - */ -#ifdef WITH_THREAD -typedef PyGILState_STATE sip_gilstate_t; -#define SIP_RELEASE_GIL(gs) PyGILState_Release(gs); -#define SIP_BLOCK_THREADS {PyGILState_STATE sipGIL = PyGILState_Ensure(); -#define SIP_UNBLOCK_THREADS PyGILState_Release(sipGIL);} -#else -typedef int sip_gilstate_t; -#define SIP_RELEASE_GIL(gs) -#define SIP_BLOCK_THREADS -#define SIP_UNBLOCK_THREADS -#endif - - -/* - * The meta-type of a wrapper type. - */ -typedef struct _sipWrapperType { - /* - * The super-metatype. This must be first in the structure so that it can - * be cast to a PyTypeObject *. - */ - PyHeapTypeObject super; - - /* The generated type structure. */ - struct _sipTypeDef *type; - - /* The list of init extenders. */ - struct _sipInitExtenderDef *iextend; - - /* Set if the type's dictionary contains all lazy attributes. */ - int dict_complete; -} sipWrapperType; - - -/* - * The type of a simple C/C++ wrapper object. - */ -typedef struct _sipSimpleWrapper { - PyObject_HEAD - - union { - /* C/C++ object pointer. */ - void *cppPtr; - - /* Access function. */ - void *(*afPtr)(); - } u; - - /* Object flags. */ - int flags; - - /* The optional dictionary of extra references keyed by argument number. */ - PyObject *extra_refs; - - /* For the user to use. */ - PyObject *user; - - /* The instance dictionary. */ - PyObject *dict; - - /* Next object at this address. */ - struct _sipSimpleWrapper *next; -} sipSimpleWrapper; - - -/* - * The type of a C/C++ wrapper object that supports parent/child relationships. - */ -typedef struct _sipWrapper { - /* The super-type. */ - sipSimpleWrapper super; - - /* First child object. */ - struct _sipWrapper *first_child; - - /* Next sibling. */ - struct _sipWrapper *sibling_next; - - /* Previous sibling. */ - struct _sipWrapper *sibling_prev; - - /* Owning object. */ - struct _sipWrapper *parent; -} sipWrapper; - - -/* - * The meta-type of an enum type. (This is exposed only to support the - * deprecated sipConvertFromNamedEnum() macro.) - */ -typedef struct _sipEnumTypeObject { - /* - * The super-metatype. This must be first in the structure so that it can - * be cast to a PyTypeObject *. - */ - PyHeapTypeObject super; - - /* The generated type structure. */ - struct _sipTypeDef *type; -} sipEnumTypeObject; - - -/* - * Some convenient function pointers. - */ -typedef void *(*sipInitFunc)(sipSimpleWrapper *, PyObject *, PyObject *, - PyObject **, PyObject **, PyObject **); -typedef int (*sipTraverseFunc)(void *, visitproc, void *); -typedef int (*sipClearFunc)(void *); -#if PY_MAJOR_VERSION >= 3 -typedef int (*sipGetBufferFunc)(PyObject *, void *, Py_buffer *, int); -typedef void (*sipReleaseBufferFunc)(PyObject *, void *, Py_buffer *); -#else -typedef SIP_SSIZE_T (*sipBufferFunc)(PyObject *, void *, SIP_SSIZE_T, void **); -typedef SIP_SSIZE_T (*sipSegCountFunc)(PyObject *, void *, SIP_SSIZE_T *); -#endif -typedef void (*sipDeallocFunc)(sipSimpleWrapper *); -typedef void *(*sipCastFunc)(void *, const struct _sipTypeDef *); -typedef const struct _sipTypeDef *(*sipSubClassConvertFunc)(void **); -typedef int (*sipConvertToFunc)(PyObject *, void **, int *, PyObject *); -typedef PyObject *(*sipConvertFromFunc)(void *, PyObject *); -typedef int (*sipVirtHandlerFunc)(void *, PyObject *, ...); -typedef void (*sipAssignFunc)(void *, SIP_SSIZE_T, const void *); -typedef void *(*sipArrayFunc)(SIP_SSIZE_T); -typedef void *(*sipCopyFunc)(const void *, SIP_SSIZE_T); -typedef void (*sipReleaseFunc)(void *, int); -typedef PyObject *(*sipPickleFunc)(void *); -typedef int (*sipAttrGetterFunc)(const struct _sipTypeDef *, PyObject *); -typedef PyObject *(*sipVariableGetterFunc)(void *, PyObject *); -typedef int (*sipVariableSetterFunc)(void *, PyObject *, PyObject *); - - -/* - * The information describing an encoded type ID. - */ -typedef struct _sipEncodedTypeDef { - /* The type number. */ - unsigned sc_type:16; - - /* The module number (255 for this one). */ - unsigned sc_module:8; - - /* A context specific flag. */ - unsigned sc_flag:1; -} sipEncodedTypeDef; - - -/* - * The information describing an enum member. - */ -typedef struct _sipEnumMemberDef { - /* The member name. */ - const char *em_name; - - /* The member value. */ - int em_val; - - /* The member enum, -ve if anonymous. */ - int em_enum; -} sipEnumMemberDef; - - -/* - * The information describing static instances. - */ -typedef struct _sipInstancesDef { - /* The types. */ - struct _sipTypeInstanceDef *id_type; - - /* The void *. */ - struct _sipVoidPtrInstanceDef *id_voidp; - - /* The chars. */ - struct _sipCharInstanceDef *id_char; - - /* The strings. */ - struct _sipStringInstanceDef *id_string; - - /* The ints. */ - struct _sipIntInstanceDef *id_int; - - /* The longs. */ - struct _sipLongInstanceDef *id_long; - - /* The unsigned longs. */ - struct _sipUnsignedLongInstanceDef *id_ulong; - - /* The long longs. */ - struct _sipLongLongInstanceDef *id_llong; - - /* The unsigned long longs. */ - struct _sipUnsignedLongLongInstanceDef *id_ullong; - - /* The doubles. */ - struct _sipDoubleInstanceDef *id_double; -} sipInstancesDef; - - -/* - * The information describing a type initialiser extender. - */ -typedef struct _sipInitExtenderDef { - /* The API version range index. */ - int ie_api_range; - - /* The extender function. */ - sipInitFunc ie_extender; - - /* The class being extended. */ - sipEncodedTypeDef ie_class; - - /* The next extender for this class. */ - struct _sipInitExtenderDef *ie_next; -} sipInitExtenderDef; - - -/* - * The information describing a sub-class convertor. - */ -typedef struct _sipSubClassConvertorDef { - /* The convertor. */ - sipSubClassConvertFunc scc_convertor; - - /* The encoded base type. */ - sipEncodedTypeDef scc_base; - - /* The base type. */ - struct _sipTypeDef *scc_basetype; -} sipSubClassConvertorDef; - - -/* - * The different error states of handwritten code. - */ -typedef enum { - sipErrorNone, /* There is no error. */ - sipErrorFail, /* The error is a failure. */ - sipErrorContinue /* It may not apply if a later operation succeeds. */ -} sipErrorState; - - -/* - * The different Python slot types. - */ -typedef enum { - str_slot, /* __str__ */ - int_slot, /* __int__ */ -#if PY_MAJOR_VERSION < 3 - long_slot, /* __long__ */ -#endif - float_slot, /* __float__ */ - len_slot, /* __len__ */ - contains_slot, /* __contains__ */ - add_slot, /* __add__ for number */ - concat_slot, /* __add__ for sequence types */ - sub_slot, /* __sub__ */ - mul_slot, /* __mul__ for number types */ - repeat_slot, /* __mul__ for sequence types */ - div_slot, /* __div__ */ - mod_slot, /* __mod__ */ - floordiv_slot, /* __floordiv__ */ - truediv_slot, /* __truediv__ */ - and_slot, /* __and__ */ - or_slot, /* __or__ */ - xor_slot, /* __xor__ */ - lshift_slot, /* __lshift__ */ - rshift_slot, /* __rshift__ */ - iadd_slot, /* __iadd__ for number types */ - iconcat_slot, /* __iadd__ for sequence types */ - isub_slot, /* __isub__ */ - imul_slot, /* __imul__ for number types */ - irepeat_slot, /* __imul__ for sequence types */ - idiv_slot, /* __idiv__ */ - imod_slot, /* __imod__ */ - ifloordiv_slot, /* __ifloordiv__ */ - itruediv_slot, /* __itruediv__ */ - iand_slot, /* __iand__ */ - ior_slot, /* __ior__ */ - ixor_slot, /* __ixor__ */ - ilshift_slot, /* __ilshift__ */ - irshift_slot, /* __irshift__ */ - invert_slot, /* __invert__ */ - call_slot, /* __call__ */ - getitem_slot, /* __getitem__ */ - setitem_slot, /* __setitem__ */ - delitem_slot, /* __delitem__ */ - lt_slot, /* __lt__ */ - le_slot, /* __le__ */ - eq_slot, /* __eq__ */ - ne_slot, /* __ne__ */ - gt_slot, /* __gt__ */ - ge_slot, /* __ge__ */ -#if PY_MAJOR_VERSION < 3 - cmp_slot, /* __cmp__ */ -#endif - bool_slot, /* __bool__, __nonzero__ */ - neg_slot, /* __neg__ */ - repr_slot, /* __repr__ */ - hash_slot, /* __hash__ */ - pos_slot, /* __pos__ */ - abs_slot, /* __abs__ */ -#if PY_VERSION_HEX >= 0x02050000 - index_slot, /* __index__ */ -#endif - iter_slot, /* __iter__ */ - next_slot, /* __next__ */ -} sipPySlotType; - - -/* - * The information describing a Python slot function. - */ -typedef struct _sipPySlotDef { - /* The function. */ - void *psd_func; - - /* The type. */ - sipPySlotType psd_type; -} sipPySlotDef; - - -/* - * The information describing a Python slot extender. - */ -typedef struct _sipPySlotExtenderDef { - /* The function. */ - void *pse_func; - - /* The type. */ - sipPySlotType pse_type; - - /* The encoded class. */ - sipEncodedTypeDef pse_class; -} sipPySlotExtenderDef; - - -/* - * The information describing a typedef. - */ -typedef struct _sipTypedefDef { - /* The typedef name. */ - const char *tdd_name; - - /* The typedef value. */ - const char *tdd_type_name; -} sipTypedefDef; - - -/* - * The information describing a variable. - */ -typedef struct _sipVariableDef { - /* The variable name. */ - const char *vd_name; - - /* The variable getter. */ - sipVariableGetterFunc vd_getter; - - /* The variable setter. It is NULL if the variable is const. */ - sipVariableSetterFunc vd_setter; - - /* This is set if the variable is static. */ - int vd_is_static; -} sipVariableDef; - - -/* - * The information describing a type, either a C++ class (or C struct), a C++ - * namespace, a mapped type or a named enum. - */ -typedef struct _sipTypeDef { - /* The version range index, -1 if the type isn't versioned. */ - int td_version; - - /* The next version of this type. */ - struct _sipTypeDef *td_next_version; - - /* The module, 0 if the type hasn't been initialised. */ - struct _sipExportedModuleDef *td_module; - - /* Type flags, see the sipType*() macros. */ - int td_flags; - - /* The C/C++ name of the type. */ - int td_cname; - - /* - * The Python type object. This needs to be a union until we remove the - * deprecated sipClass_* macros. - */ - union { - PyTypeObject *td_py_type; - sipWrapperType *td_wrapper_type; - } u; -} sipTypeDef; - - -/* - * The information describing a container (ie. a class, namespace or a mapped - * type). - */ -typedef struct _sipContainerDef { - /* - * The Python name of the type, -1 if this is a namespace extender (in the - * context of a class) or doesn't require a namespace (in the context of a - * mapped type). */ - int cod_name; - - /* - * The scoping type or the namespace this is extending if it is a namespace - * extender. - */ - sipEncodedTypeDef cod_scope; - - /* The number of lazy methods. */ - int cod_nrmethods; - - /* The table of lazy methods. */ - PyMethodDef *cod_methods; - - /* The number of lazy enum members. */ - int cod_nrenummembers; - - /* The table of lazy enum members. */ - sipEnumMemberDef *cod_enummembers; - - /* The number of variables. */ - int cod_nrvariables; - - /* The table of variables. */ - sipVariableDef *cod_variables; - - /* The static instances. */ - sipInstancesDef cod_instances; -} sipContainerDef; - - -/* - * The information describing a C++ class (or C struct) or a C++ namespace. - */ -typedef struct _sipClassTypeDef { - /* The base type information. */ - sipTypeDef ctd_base; - - /* The container information. */ - sipContainerDef ctd_container; - - /* The docstring. */ - const char *ctd_docstring; - - /* - * The meta-type name, -1 to use the meta-type of the first super-type - * (normally sipWrapperType). - */ - int ctd_metatype; - - /* The super-type name, -1 to use sipWrapper. */ - int ctd_supertype; - - /* The super-types. */ - sipEncodedTypeDef *ctd_supers; - - /* The table of Python slots. */ - sipPySlotDef *ctd_pyslots; - - /* The initialisation function. */ - sipInitFunc ctd_init; - - /* The traverse function. */ - sipTraverseFunc ctd_traverse; - - /* The clear function. */ - sipClearFunc ctd_clear; - -#if PY_MAJOR_VERSION >= 3 - /* The get buffer function. */ - sipGetBufferFunc ctd_getbuffer; - - /* The release buffer function. */ - sipReleaseBufferFunc ctd_releasebuffer; -#else - /* The read buffer function. */ - sipBufferFunc ctd_readbuffer; - - /* The write buffer function. */ - sipBufferFunc ctd_writebuffer; - - /* The segment count function. */ - sipSegCountFunc ctd_segcount; - - /* The char buffer function. */ - sipBufferFunc ctd_charbuffer; -#endif - - /* The deallocation function. */ - sipDeallocFunc ctd_dealloc; - - /* The optional assignment function. */ - sipAssignFunc ctd_assign; - - /* The optional array allocation function. */ - sipArrayFunc ctd_array; - - /* The optional copy function. */ - sipCopyFunc ctd_copy; - - /* The release function, 0 if a C strict. */ - sipReleaseFunc ctd_release; - - /* The cast function, 0 if a C struct. */ - sipCastFunc ctd_cast; - - /* The optional convert to function. */ - sipConvertToFunc ctd_cto; - - /* The next namespace extender. */ - struct _sipClassTypeDef *ctd_nsextender; - - /* The pickle function. */ - sipPickleFunc ctd_pickle; -} sipClassTypeDef; - - -/* - * The information describing a mapped type. - */ -typedef struct _sipMappedTypeDef { - /* The base type information. */ - sipTypeDef mtd_base; - - /* The container information. */ - sipContainerDef mtd_container; - - /* The optional assignment function. */ - sipAssignFunc mtd_assign; - - /* The optional array allocation function. */ - sipArrayFunc mtd_array; - - /* The optional copy function. */ - sipCopyFunc mtd_copy; - - /* The optional release function. */ - sipReleaseFunc mtd_release; - - /* The convert to function. */ - sipConvertToFunc mtd_cto; - - /* The convert from function. */ - sipConvertFromFunc mtd_cfrom; -} sipMappedTypeDef; - - -/* - * The information describing a named enum. - */ -typedef struct _sipEnumTypeDef { - /* The base type information. */ - sipTypeDef etd_base; - - /* The Python name of the enum. */ - int etd_name; - - /* The scoping type, -1 if it is defined at the module level. */ - int etd_scope; - - /* The Python slots. */ - struct _sipPySlotDef *etd_pyslots; -} sipEnumTypeDef; - - -/* - * The information describing an external type. - */ -typedef struct _sipExternalTypeDef { - /* The index into the type table. */ - int et_nr; - - /* The name of the type. */ - const char *et_name; -} sipExternalTypeDef; - - -/* - * The information describing a mapped class. This (and anything that uses it) - * is deprecated. - */ -typedef sipTypeDef sipMappedType; - - -/* - * Defines an entry in the module specific list of delayed dtor calls. - */ -typedef struct _sipDelayedDtor { - /* The C/C++ instance. */ - void *dd_ptr; - - /* The class name. */ - const char *dd_name; - - /* Non-zero if dd_ptr is a derived class instance. */ - int dd_isderived; - - /* Next in the list. */ - struct _sipDelayedDtor *dd_next; -} sipDelayedDtor; - - -/* - * Defines an entry in the table of global functions all of whose overloads - * are versioned (so their names can't be automatically added to the module - * dictionary). - */ -typedef struct _sipVersionedFunctionDef { - /* The name, -1 marks the end of the table. */ - int vf_name; - - /* The function itself. */ - PyCFunction vf_function; - - /* The METH_* flags. */ - int vf_flags; - - /* The docstring. */ - const char *vf_docstring; - - /* The API version range index. */ - int vf_api_range; -} sipVersionedFunctionDef; - - -/* - * The information describing an imported module. - */ -typedef struct _sipImportedModuleDef { - /* The module name. */ - const char *im_name; - - /* The required version. */ - int im_version; - - /* The imported module. */ - struct _sipExportedModuleDef *im_module; -} sipImportedModuleDef; - - -/* - * The main client module structure. - */ -typedef struct _sipExportedModuleDef { - /* The next in the list. */ - struct _sipExportedModuleDef *em_next; - - /* The SIP API minor version number. */ - unsigned em_api_minor; - - /* The module name. */ - int em_name; - - /* The module name as an object. */ - PyObject *em_nameobj; - - /* The module version. */ - int em_version; - - /* The string pool. */ - const char *em_strings; - - /* The imported modules. */ - sipImportedModuleDef *em_imports; - - /* The optional TQt support API. */ - struct _sipTQtAPI *em_qt_api; - - /* The number of types. */ - int em_nrtypes; - - /* The table of types. */ - sipTypeDef **em_types; - - /* The table of external types. */ - sipExternalTypeDef *em_external; - - /* The number of members in global enums. */ - int em_nrenummembers; - - /* The table of members in global enums. */ - sipEnumMemberDef *em_enummembers; - - /* The number of typedefs. */ - int em_nrtypedefs; - - /* The table of typedefs. */ - sipTypedefDef *em_typedefs; - - /* The table of virtual handlers. */ - sipVirtHandlerFunc *em_virthandlers; - - /* The sub-class convertors. */ - sipSubClassConvertorDef *em_convertors; - - /* The static instances. */ - sipInstancesDef em_instances; - - /* The license. */ - struct _sipLicenseDef *em_license; - - /* The table of exception types. */ - PyObject **em_exceptions; - - /* The table of Python slot extenders. */ - sipPySlotExtenderDef *em_slotextend; - - /* The table of initialiser extenders. */ - sipInitExtenderDef *em_initextend; - - /* The delayed dtor handler. */ - void (*em_delayeddtors)(const sipDelayedDtor *); - - /* The list of delayed dtors. */ - sipDelayedDtor *em_ddlist; - - /* - * The array of API version definitions. Each definition takes up 3 - * elements. If the third element of a 3-tuple is negative then the first - * two elements define an API and its default version. All such - * definitions will appear at the end of the array. If the first element - * of a 3-tuple is negative then that is the last element of the array. - */ - int *em_versions; - - /* The optional table of versioned functions. */ - sipVersionedFunctionDef *em_versioned_functions; -} sipExportedModuleDef; - - -/* - * The information describing a license to be added to a dictionary. - */ -typedef struct _sipLicenseDef { - /* The type of license. */ - const char *lc_type; - - /* The licensee. */ - const char *lc_licensee; - - /* The timestamp. */ - const char *lc_timestamp; - - /* The signature. */ - const char *lc_signature; -} sipLicenseDef; - - -/* - * The information describing a void pointer instance to be added to a - * dictionary. - */ -typedef struct _sipVoidPtrInstanceDef { - /* The void pointer name. */ - const char *vi_name; - - /* The void pointer value. */ - void *vi_val; -} sipVoidPtrInstanceDef; - - -/* - * The information describing a char instance to be added to a dictionary. - */ -typedef struct _sipCharInstanceDef { - /* The char name. */ - const char *ci_name; - - /* The char value. */ - char ci_val; - - /* The encoding used, either 'A', 'L', '8' or 'N'. */ - char ci_encoding; -} sipCharInstanceDef; - - -/* - * The information describing a string instance to be added to a dictionary. - */ -typedef struct _sipStringInstanceDef { - /* The string name. */ - const char *si_name; - - /* The string value. */ - const char *si_val; - - /* The encoding used, either 'A', 'L', '8' or 'N'. */ - char si_encoding; -} sipStringInstanceDef; - - -/* - * The information describing an int instance to be added to a dictionary. - */ -typedef struct _sipIntInstanceDef { - /* The int name. */ - const char *ii_name; - - /* The int value. */ - int ii_val; -} sipIntInstanceDef; - - -/* - * The information describing a long instance to be added to a dictionary. - */ -typedef struct _sipLongInstanceDef { - /* The long name. */ - const char *li_name; - - /* The long value. */ - long li_val; -} sipLongInstanceDef; - - -/* - * The information describing an unsigned long instance to be added to a - * dictionary. - */ -typedef struct _sipUnsignedLongInstanceDef { - /* The unsigned long name. */ - const char *uli_name; - - /* The unsigned long value. */ - unsigned long uli_val; -} sipUnsignedLongInstanceDef; - - -/* - * The information describing a long long instance to be added to a dictionary. - */ -typedef struct _sipLongLongInstanceDef { - /* The long long name. */ - const char *lli_name; - - /* The long long value. */ -#if defined(HAVE_LONG_LONG) - PY_LONG_LONG lli_val; -#else - long lli_val; -#endif -} sipLongLongInstanceDef; - - -/* - * The information describing an unsigned long long instance to be added to a - * dictionary. - */ -typedef struct _sipUnsignedLongLongInstanceDef { - /* The unsigned long long name. */ - const char *ulli_name; - - /* The unsigned long long value. */ -#if defined(HAVE_LONG_LONG) - unsigned PY_LONG_LONG ulli_val; -#else - unsigned long ulli_val; -#endif -} sipUnsignedLongLongInstanceDef; - - -/* - * The information describing a double instance to be added to a dictionary. - */ -typedef struct _sipDoubleInstanceDef { - /* The double name. */ - const char *di_name; - - /* The double value. */ - double di_val; -} sipDoubleInstanceDef; - - -/* - * The information describing a class or enum instance to be added to a - * dictionary. - */ -typedef struct _sipTypeInstanceDef { - /* The type instance name. */ - const char *ti_name; - - /* The actual instance. */ - void *ti_ptr; - - /* A pointer to the generated type. */ - struct _sipTypeDef **ti_type; - - /* The wrapping flags. */ - int ti_flags; -} sipTypeInstanceDef; - - -/* - * Define a mapping between a wrapped type identified by a string and the - * corresponding Python type. This is deprecated. - */ -typedef struct _sipStringTypeClassMap { - /* The type as a string. */ - const char *typeString; - - /* A pointer to the Python type. */ - struct _sipWrapperType **pyType; -} sipStringTypeClassMap; - - -/* - * Define a mapping between a wrapped type identified by an integer and the - * corresponding Python type. This is deprecated. - */ -typedef struct _sipIntTypeClassMap { - /* The type as an integer. */ - int typeInt; - - /* A pointer to the Python type. */ - struct _sipWrapperType **pyType; -} sipIntTypeClassMap; - - -/* - * A Python method's component parts. This allows us to re-create the method - * without changing the reference counts of the components. - */ -typedef struct _sipPyMethod { - /* The function. */ - PyObject *mfunc; - - /* Self if it is a bound method. */ - PyObject *mself; - -#if PY_MAJOR_VERSION < 3 - /* The class. */ - PyObject *mclass; -#endif -} sipPyMethod; - - -/* - * A slot (in the TQt, rather than Python, sense). - */ -typedef struct _sipSlot { - /* Name if a TQt or Python signal. */ - char *name; - - /* Signal or TQt slot object. */ - PyObject *pyobj; - - /* Python slot method, pyobj is NULL. */ - sipPyMethod meth; - - /* A weak reference to the slot, Py_True if pyobj has an extra reference. */ - PyObject *weakSlot; -} sipSlot; - - -/* - * The API exported by the SIP module, ie. pointers to all the data and - * functions that can be used by generated code. - */ -typedef struct _sipAPIDef { - /* - * This must be the first entry and it's signature must not change so that - * version number mismatches can be detected and reported. - */ - int (*api_export_module)(sipExportedModuleDef *client, unsigned api_major, - unsigned api_minor, void *unused); - - /* - * The following are part of the public API. - */ - PyTypeObject *api_simplewrapper_type; - PyTypeObject *api_wrapper_type; - PyTypeObject *api_wrappertype_type; - PyTypeObject *api_voidptr_type; - - void (*api_bad_catcher_result)(PyObject *method); - void (*api_bad_length_for_slice)(SIP_SSIZE_T seqlen, SIP_SSIZE_T slicelen); - PyObject *(*api_build_result)(int *isErr, const char *fmt, ...); - PyObject *(*api_call_method)(int *isErr, PyObject *method, const char *fmt, - ...); - PyObject *(*api_connect_rx)(PyObject *txObj, const char *sig, - PyObject *rxObj, const char *slot, int type); - SIP_SSIZE_T (*api_convert_from_sequence_index)(SIP_SSIZE_T idx, - SIP_SSIZE_T len); - int (*api_can_convert_to_type)(PyObject *pyObj, const sipTypeDef *td, - int flags); - void *(*api_convert_to_type)(PyObject *pyObj, const sipTypeDef *td, - PyObject *transferObj, int flags, int *statep, int *iserrp); - void *(*api_force_convert_to_type)(PyObject *pyObj, const sipTypeDef *td, - PyObject *transferObj, int flags, int *statep, int *iserrp); - int (*api_can_convert_to_enum)(PyObject *pyObj, const sipTypeDef *td); - void (*api_release_type)(void *cpp, const sipTypeDef *td, int state); - PyObject *(*api_convert_from_type)(void *cpp, const sipTypeDef *td, - PyObject *transferObj); - PyObject *(*api_convert_from_new_type)(void *cpp, const sipTypeDef *td, - PyObject *transferObj); - PyObject *(*api_convert_from_enum)(int eval, const sipTypeDef *td); - int (*api_get_state)(PyObject *transferObj); - PyObject *(*api_disconnect_rx)(PyObject *txObj, const char *sig, - PyObject *rxObj, const char *slot); - void (*api_free)(void *mem); - PyObject *(*api_get_pyobject)(void *cppPtr, const sipTypeDef *td); - void *(*api_malloc)(size_t nbytes); - int (*api_parse_result)(int *isErr, PyObject *method, PyObject *res, - const char *fmt, ...); - void (*api_trace)(unsigned mask, const char *fmt, ...); - void (*api_transfer_back)(PyObject *self); - void (*api_transfer_to)(PyObject *self, PyObject *owner); - void (*api_transfer_break)(PyObject *self); - unsigned long (*api_long_as_unsigned_long)(PyObject *o); - PyObject *(*api_convert_from_void_ptr)(void *val); - PyObject *(*api_convert_from_const_void_ptr)(const void *val); - PyObject *(*api_convert_from_void_ptr_and_size)(void *val, - SIP_SSIZE_T size); - PyObject *(*api_convert_from_const_void_ptr_and_size)(const void *val, - SIP_SSIZE_T size); - void *(*api_convert_to_void_ptr)(PyObject *obj); - int (*api_export_symbol)(const char *name, void *sym); - void *(*api_import_symbol)(const char *name); - const sipTypeDef *(*api_find_type)(const char *type); - int (*api_register_py_type)(PyTypeObject *type); - const sipTypeDef *(*api_type_from_py_type_object)(PyTypeObject *py_type); - const sipTypeDef *(*api_type_scope)(const sipTypeDef *td); - const char *(*api_resolve_typedef)(const char *name); - int (*api_register_attribute_getter)(const sipTypeDef *td, - sipAttrGetterFunc getter); - int (*api_is_api_enabled)(const char *name, int from, int to); - sipErrorState (*api_bad_callable_arg)(int arg_nr, PyObject *arg); - - /* - * The following are deprecated parts of the public API. - */ - PyTypeObject *(*api_find_named_enum)(const char *type); - const sipMappedType *(*api_find_mapped_type)(const char *type); - sipWrapperType *(*api_find_class)(const char *type); - sipWrapperType *(*api_map_int_to_class)(int typeInt, - const sipIntTypeClassMap *map, int maplen); - sipWrapperType *(*api_map_string_to_class)(const char *typeString, - const sipStringTypeClassMap *map, int maplen); - - /* - * The following may be used by TQt support code but no other handwritten - * code. - */ - void (*api_free_sipslot)(sipSlot *slot); - int (*api_same_slot)(const sipSlot *sp, PyObject *rxObj, const char *slot); - void *(*api_convert_rx)(sipWrapper *txSelf, const char *sigargs, - PyObject *rxObj, const char *slot, const char **memberp, - int flags); - PyObject *(*api_invoke_slot)(const sipSlot *slot, PyObject *sigargs); - int (*api_save_slot)(sipSlot *sp, PyObject *rxObj, const char *slot); - void (*api_clear_any_slot_reference)(sipSlot *slot); - int (*api_visit_slot)(sipSlot *slot, visitproc visit, void *arg); - - /* - * The following are not part of the public API. - */ - int (*api_init_module)(sipExportedModuleDef *client, PyObject *mod_dict); - int (*api_parse_args)(PyObject **parseErrp, PyObject *sipArgs, - const char *fmt, ...); - int (*api_parse_pair)(PyObject **parseErrp, PyObject *arg0, PyObject *arg1, - const char *fmt, ...); - void (*api_common_dtor)(sipSimpleWrapper *sipSelf); - void (*api_no_function)(PyObject *parseErr, const char *func, - const char *doc); - void (*api_no_method)(PyObject *parseErr, const char *scope, - const char *method, const char *doc); - void (*api_abstract_method)(const char *classname, const char *method); - void (*api_bad_class)(const char *classname); - void *(*api_get_cpp_ptr)(sipSimpleWrapper *w, const sipTypeDef *td); - void *(*api_get_complex_cpp_ptr)(sipSimpleWrapper *w); - PyObject *(*api_is_py_method)(sip_gilstate_t *gil, char *pymc, - sipSimpleWrapper *sipSelf, const char *cname, const char *mname); - void (*api_call_hook)(const char *hookname); - void (*api_start_thread)(void); - void (*api_end_thread)(void); - void (*api_raise_unknown_exception)(void); - void (*api_raise_type_exception)(const sipTypeDef *td, void *ptr); - int (*api_add_type_instance)(PyObject *dict, const char *name, - void *cppPtr, const sipTypeDef *td); - void (*api_bad_operator_arg)(PyObject *self, PyObject *arg, - sipPySlotType st); - PyObject *(*api_pyslot_extend)(sipExportedModuleDef *mod, sipPySlotType st, - const sipTypeDef *type, PyObject *arg0, PyObject *arg1); - void (*api_add_delayed_dtor)(sipSimpleWrapper *w); - char (*api_bytes_as_char)(PyObject *obj); - const char *(*api_bytes_as_string)(PyObject *obj); - char (*api_string_as_ascii_char)(PyObject *obj); - const char *(*api_string_as_ascii_string)(PyObject **obj); - char (*api_string_as_latin1_char)(PyObject *obj); - const char *(*api_string_as_latin1_string)(PyObject **obj); - char (*api_string_as_utf8_char)(PyObject *obj); - const char *(*api_string_as_utf8_string)(PyObject **obj); -#if defined(HAVE_WCHAR_H) - wchar_t (*api_unicode_as_wchar)(PyObject *obj); - wchar_t *(*api_unicode_as_wstring)(PyObject *obj); -#else - int (*api_unicode_as_wchar)(PyObject *obj); - int *(*api_unicode_as_wstring)(PyObject *obj); -#endif - int (*api_deprecated)(const char *classname, const char *method); - void (*api_keep_reference)(PyObject *self, int key, PyObject *obj); - int (*api_parse_kwd_args)(PyObject **parseErrp, PyObject *sipArgs, - PyObject *sipKwdArgs, const char **kwdlist, PyObject **unused, - const char *fmt, ...); - void (*api_add_exception)(sipErrorState es, PyObject **parseErrp); -} sipAPIDef; - - -/* - * The API implementing the optional TQt support. - */ -typedef struct _sipTQtAPI { - sipTypeDef **qt_qobject; - void *(*qt_create_universal_signal)(void *, const char **); - void *(*qt_find_universal_signal)(void *, const char **); - void *(*qt_create_universal_slot)(struct _sipWrapper *, const char *, - PyObject *, const char *, const char **, int); - void (*qt_destroy_universal_slot)(void *); - void *(*qt_find_slot)(void *, const char *, PyObject *, const char *, - const char **); - int (*qt_connect)(void *, const char *, void *, const char *, int); - int (*qt_disconnect)(void *, const char *, void *, const char *); - int (*qt_same_name)(const char *, const char *); - sipSlot *(*qt_find_sipslot)(void *, void **); - int (*tqt_emit_signal)(PyObject *, const char *, PyObject *); - int (*qt_connect_py_signal)(PyObject *, const char *, PyObject *, - const char *); - void (*qt_disconnect_py_signal)(PyObject *, const char *, PyObject *, - const char *); -} sipTQtAPI; - - -/* - * These are flags that can be passed to sipCanConvertToType(), - * sipConvertToType() and sipForceConvertToType(). - */ -#define SIP_NOT_NONE 0x01 /* Disallow None. */ -#define SIP_NO_CONVERTORS 0x02 /* Disable any type convertors. */ - - -/* - * These are the state flags returned by %ConvertToTypeCode. Note that these - * share the same "namespace" as the flags below. - */ -#define SIP_TEMPORARY 0x0001 /* A temporary instance. */ -#define SIP_DERIVED_CLASS 0x0002 /* The instance is derived. */ - - -/* - * These flags are specific to the TQt support API. - */ -#define SIP_SINGLE_SHOT 0x01 /* The connection is single shot. */ - - -/* - * Useful macros, not part of the public API. - */ -#define SIP_PY_OWNED 0x0004 /* Owned by Python. */ -#define SIP_INDIRECT 0x0008 /* If there is a level of indirection. */ -#define SIP_ACCFUNC 0x0010 /* If there is an access function. */ -#define SIP_NOT_IN_MAP 0x0020 /* If Python object not in the map. */ -#define SIP_SHARE_MAP 0x0040 /* If the map slot might be occupied. */ -#define SIP_CPP_HAS_REF 0x0080 /* If C/C++ has a reference. */ -#define SIP_POSSIBLE_PROXY 0x0100 /* If there might be a proxy slot. */ - -#define sipIsPyOwned(w) ((w)->flags & SIP_PY_OWNED) -#define sipSetPyOwned(w) ((w)->flags |= SIP_PY_OWNED) -#define sipResetPyOwned(w) ((w)->flags &= ~SIP_PY_OWNED) -#define sipIsDerived(w) ((w)->flags & SIP_DERIVED_CLASS) -#define sipIsIndirect(w) ((w)->flags & SIP_INDIRECT) -#define sipIsAccessFunc(w) ((w)->flags & SIP_ACCFUNC) -#define sipNotInMap(w) ((w)->flags & SIP_NOT_IN_MAP) -#define sipSetNotInMap(w) ((w)->flags |= SIP_NOT_IN_MAP) -#define sipCppHasRef(w) ((w)->flags & SIP_CPP_HAS_REF) -#define sipSetCppHasRef(w) ((w)->flags |= SIP_CPP_HAS_REF) -#define sipResetCppHasRef(w) ((w)->flags &= ~SIP_CPP_HAS_REF) -#define sipPossibleProxy(w) ((w)->flags & SIP_POSSIBLE_PROXY) -#define sipSetPossibleProxy(w) ((w)->flags |= SIP_POSSIBLE_PROXY) - - -#define SIP_TYPE_TYPE_MASK 0x0007 /* The type type mask. */ -#define SIP_TYPE_CLASS 0x0000 /* If the type is a C++ class. */ -#define SIP_TYPE_NAMESPACE 0x0001 /* If the type is a C++ namespace. */ -#define SIP_TYPE_MAPPED 0x0002 /* If the type is a mapped type. */ -#define SIP_TYPE_ENUM 0x0003 /* If the type is a named enum. */ -#define SIP_TYPE_ABSTRACT 0x0008 /* If the type is abstract. */ -#define SIP_TYPE_SCC 0x0010 /* If the type is subject to sub-class convertors. */ -#define SIP_TYPE_ALLOW_NONE 0x0020 /* If the type can handle None. */ -#define SIP_TYPE_STUB 0x0040 /* If the type is a stub. */ - - -/* - * The following are part of the public API. - */ -#define sipTypeIsClass(td) (((td)->td_flags & SIP_TYPE_TYPE_MASK) == SIP_TYPE_CLASS) -#define sipTypeIsNamespace(td) (((td)->td_flags & SIP_TYPE_TYPE_MASK) == SIP_TYPE_NAMESPACE) -#define sipTypeIsMapped(td) (((td)->td_flags & SIP_TYPE_TYPE_MASK) == SIP_TYPE_MAPPED) -#define sipTypeIsEnum(td) (((td)->td_flags & SIP_TYPE_TYPE_MASK) == SIP_TYPE_ENUM) -#define sipTypeAsPyTypeObject(td) ((td)->u.td_py_type) -#define sipTypeName(td) sipNameFromPool((td)->td_module, (td)->td_cname) - -#define sipIsExactWrappedType(wt) (sipTypeAsPyTypeObject((wt)->type) == (PyTypeObject *)(wt)) - -#define sipConvertFromSliceObject(o,len,start,stop,step,slen) \ - PySlice_GetIndicesEx((PySliceObject *)(o), (len), (start), (stop), \ - (step), (slen)) - - -/* - * The following are deprecated parts of the public API. - */ -#define sipClassName(w) PyString_FromString(Py_TYPE(w)->tp_name) - - -/* - * The following are not part of the public API. - */ -#define sipTypeIsAbstract(td) ((td)->td_flags & SIP_TYPE_ABSTRACT) -#define sipTypeHasSCC(td) ((td)->td_flags & SIP_TYPE_SCC) -#define sipTypeAllowNone(td) ((td)->td_flags & SIP_TYPE_ALLOW_NONE) -#define sipTypeIsStub(td) ((td)->td_flags & SIP_TYPE_STUB) -#define sipTypeSetStub(td) ((td)->td_flags |= SIP_TYPE_STUB) - -/* - * Get various names from the string pool for various data types. - */ -#define sipNameFromPool(em, mr) (&((em)->em_strings)[(mr)]) -#define sipNameOfModule(em) sipNameFromPool((em), (em)->em_name) -#define sipPyNameOfContainer(cod, td) sipNameFromPool((td)->td_module, (cod)->cod_name) -#define sipPyNameOfEnum(etd) sipNameFromPool((etd)->etd_base.td_module, (etd)->etd_name) - - -/* - * The following are PyTQt3-specific extensions. In SIP v5 they will be pushed - * out to a plugin supplied by PyTQt3. - */ - -typedef int (*pyqt3EmitFunc)(sipSimpleWrapper *, PyObject *); - - -/* - * Maps the name of a TQt signal to a wrapper function to emit it. - */ -typedef struct _pyqt3QtSignal { - /* The signal name. */ - const char *st_name; - - /* The emitter function. */ - pyqt3EmitFunc st_emitfunc; -} pyqt3QtSignal; - - -/* - * This is the PyTQt3-specific extension to the generated class type structure. - */ -typedef struct _pyqt3ClassTypeDef { - /* - * The super-type structure. This must be first in the structure so that - * it can be cast to sipClassTypeDef *. - */ - sipClassTypeDef super; - - /* The emit table for TQt signals. */ - pyqt3QtSignal *qt3_emit; -} pyqt3ClassTypeDef; - - -/* - * The following are PyTQt4-specific extensions. In SIP v5 they will be pushed - * out to a plugin supplied by PyTQt4. - */ - -/* - * The description of a TQt signal for PyTQt4. - */ -typedef struct _pyqt4QtSignal { - /* The C++ name and signature of the signal. */ - const char *signature; - - /* The optional docstring. */ - const char *docstring; - - /* - * If the signal is an overload of regular methods then this points to the - * code that implements those methods. - */ - PyMethodDef *non_signals; -} pyqt4QtSignal; - - -/* - * This is the PyTQt4-specific extension to the generated class type structure. - */ -typedef struct _pyqt4ClassTypeDef { - /* - * The super-type structure. This must be first in the structure so that - * it can be cast to sipClassTypeDef *. - */ - sipClassTypeDef super; - - /* A pointer to the TQObject sub-class's staticMetaObject class variable. */ - const void *qt4_static_metaobject; - - /* - * A set of flags. At the moment only bit 0 is used to say if the type is - * derived from TQFlags. - */ - unsigned qt4_flags; - - /* - * The table of signals emitted by the type. These are grouped by signal - * name. - */ - const pyqt4QtSignal *qt4_signals; -} pyqt4ClassTypeDef; - - -#ifdef __cplusplus -} -#endif - - -#endif diff --git a/siplib/sipint.h b/siplib/sipint.h index 3758b36..f229fbe 100644 --- a/siplib/sipint.h +++ b/siplib/sipint.h @@ -1,18 +1,18 @@ /* - * This file defines the SIP library internal interfaces. + * This file defines the SIP-TQt library internal interfaces. * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ @@ -102,7 +102,7 @@ PyObject *sip_api_disconnect_rx(PyObject *txObj, const char *sig, /* - * These are part of the SIP API but are also used within the SIP module. + * These are part of the SIP-TQt API but are also used within the SIP-TQt module. */ void *sip_api_malloc(size_t nbytes); void sip_api_free(void *mem); @@ -121,7 +121,7 @@ int sip_api_save_slot(sipSlot *sp, PyObject *rxObj, const char *slot); /* - * These are not part of the SIP API but are used within the SIP module. + * These are not part of the SIP-TQt API but are used within the SIP-TQt module. */ void sipSaveMethod(sipPyMethod *pm,PyObject *meth); void *sipGetPending(sipWrapper **op, int *fp); diff --git a/siplib/siplib.c b/siplib/siplib.c index d43f121..e799280 100644 --- a/siplib/siplib.c +++ b/siplib/siplib.c @@ -1,18 +1,18 @@ /* - * SIP library code. + * SIP-TQt library code. * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ @@ -25,7 +25,7 @@ #include #include -#include "sip.h" +#include "sip-tqt.h" #include "sipint.h" @@ -51,7 +51,7 @@ static int sipWrapperType_setattro(PyObject *self, PyObject *name, static PyTypeObject sipWrapperType_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "sip.wrappertype", /* tp_name */ + "sip_tqt.wrappertype", /* tp_name */ sizeof (sipWrapperType), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -107,7 +107,7 @@ static sipWrapperType sipWrapper_Type = { #endif { PyVarObject_HEAD_INIT(&sipWrapperType_Type, 0) - "sip.wrapper", /* tp_name */ + "sip_tqt.wrapper", /* tp_name */ sizeof (sipWrapper), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)sipWrapper_dealloc, /* tp_dealloc */ @@ -254,7 +254,7 @@ static void sip_api_add_exception(sipErrorState es, PyObject **parseErrp); /* - * The data structure that represents the SIP API. + * The data structure that represents the SIP-TQt API. */ static const sipAPIDef sip_api = { /* This must be first. */ @@ -453,7 +453,7 @@ static PyObject *sipEnumType_alloc(PyTypeObject *self, SIP_SSIZE_T nitems); */ static PyTypeObject sipEnumType_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "sip.enumtype", /* tp_name */ + "sip_tqt.enumtype", /* tp_name */ sizeof (sipEnumTypeObject), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -654,13 +654,13 @@ static PyObject *bad_type_str(int arg_nr, PyObject *arg); * The Python module initialisation function. */ #if PY_MAJOR_VERSION >= 3 -#define SIP_MODULE_ENTRY PyInit_sip +#define SIP_MODULE_ENTRY PyInit_sip_tqt #define SIP_MODULE_TYPE PyObject * #define SIP_MODULE_DISCARD(m) Py_DECREF(m) #define SIP_FATAL(s) return NULL #define SIP_MODULE_RETURN(m) return (m) #else -#define SIP_MODULE_ENTRY initsip +#define SIP_MODULE_ENTRY initsip_tqt #define SIP_MODULE_TYPE void #define SIP_MODULE_DISCARD(m) #define SIP_FATAL(s) Py_FatalError(s) @@ -695,7 +695,7 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void) #if PY_MAJOR_VERSION >= 3 static PyModuleDef module_def = { PyModuleDef_HEAD_INIT, - "sip", /* m_name */ + "sip_tqt", /* m_name */ NULL, /* m_doc */ -1, /* m_size */ methods, /* m_methods */ @@ -717,13 +717,13 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void) sipWrapperType_Type.tp_base = &PyType_Type; if (PyType_Ready(&sipWrapperType_Type) < 0) - SIP_FATAL("sip: Failed to initialise sip.wrappertype type"); + SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.wrappertype type"); if (PyType_Ready((PyTypeObject *)&sipSimpleWrapper_Type) < 0) - SIP_FATAL("sip: Failed to initialise sip.simplewrapper type"); + SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.simplewrapper type"); if (sip_api_register_py_type((PyTypeObject *)&sipSimpleWrapper_Type) < 0) - SIP_FATAL("sip: Failed to register sip.simplewrapper type"); + SIP_FATAL("sip-tqt: Failed to register sip_tqt.simplewrapper type"); #if defined(STACKLESS) sipWrapper_Type.super.tp_base = (PyTypeObject *)&sipSimpleWrapper_Type; @@ -734,30 +734,30 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void) #endif if (PyType_Ready((PyTypeObject *)&sipWrapper_Type) < 0) - SIP_FATAL("sip: Failed to initialise sip.wrapper type"); + SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.wrapper type"); if (PyType_Ready(&sipMethodDescr_Type) < 0) - SIP_FATAL("sip: Failed to initialise sip.methoddescriptor type"); + SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.methoddescriptor type"); if (PyType_Ready(&sipVariableDescr_Type) < 0) - SIP_FATAL("sip: Failed to initialise sip.variabledescriptor type"); + SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.variabledescriptor type"); sipEnumType_Type.tp_base = &PyType_Type; if (PyType_Ready(&sipEnumType_Type) < 0) - SIP_FATAL("sip: Failed to initialise sip.enumtype type"); + SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.enumtype type"); if (PyType_Ready(&sipVoidPtr_Type) < 0) - SIP_FATAL("sip: Failed to initialise sip.voidptr type"); + SIP_FATAL("sip-tqt: Failed to initialise sip_tqt.voidptr type"); #if PY_MAJOR_VERSION >= 3 mod = PyModule_Create(&module_def); #else - mod = Py_InitModule("sip", methods); + mod = Py_InitModule("sip_tqt", methods); #endif if (mod == NULL) - SIP_FATAL("sip: Failed to intialise sip module"); + SIP_FATAL("sip-tqt: Failed to intialise sip_tqt module"); mod_dict = PyModule_GetDict(mod); @@ -768,12 +768,12 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void) if (type_unpickler == NULL || enum_unpickler == NULL) { SIP_MODULE_DISCARD(mod); - SIP_FATAL("sip: Failed to get pickle helpers"); + SIP_FATAL("sip-tqt: Failed to get pickle helpers"); } - /* Publish the SIP API. */ + /* Publish the SIP-TQt API. */ #if defined(SIP_USE_PYCAPSULE) - obj = PyCapsule_New((void *)&sip_api, "sip._C_API", NULL); + obj = PyCapsule_New((void *)&sip_api, "sip_tqt._C_API", NULL); #else obj = PyCObject_FromVoidPtr((void *)&sip_api, NULL); #endif @@ -781,7 +781,7 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void) if (obj == NULL) { SIP_MODULE_DISCARD(mod); - SIP_FATAL("sip: Failed to create _C_API object"); + SIP_FATAL("sip-tqt: Failed to create _C_API object"); } rc = PyDict_SetItemString(mod_dict, "_C_API", obj); @@ -790,31 +790,31 @@ PyMODINIT_FUNC SIP_MODULE_ENTRY(void) if (rc < 0) { SIP_MODULE_DISCARD(mod); - SIP_FATAL("sip: Failed to add _C_API object to module dictionary"); + SIP_FATAL("sip-tqt: Failed to add _C_API object to module dictionary"); } - /* Add the SIP version number, but don't worry about errors. */ + /* Add the SIP-TQt version number, but don't worry about errors. */ #if PY_MAJOR_VERSION >= 3 - obj = PyLong_FromLong(SIP_VERSION); + obj = PyLong_FromLong(SIP_TQT_VERSION); #else - obj = PyInt_FromLong(SIP_VERSION); + obj = PyInt_FromLong(SIP_TQT_VERSION); #endif if (obj != NULL) { - PyDict_SetItemString(mod_dict, "SIP_VERSION", obj); + PyDict_SetItemString(mod_dict, "SIP_TQT_VERSION", obj); Py_DECREF(obj); } #if PY_MAJOR_VERSION >= 3 - obj = PyUnicode_FromString(SIP_VERSION_STR); + obj = PyUnicode_FromString(SIP_TQT_VERSION_STR); #else - obj = PyString_FromString(SIP_VERSION_STR); + obj = PyString_FromString(SIP_TQT_VERSION_STR); #endif if (obj != NULL) { - PyDict_SetItemString(mod_dict, "SIP_VERSION_STR", obj); + PyDict_SetItemString(mod_dict, "SIP_TQT_VERSION_STR", obj); Py_DECREF(obj); } @@ -1009,7 +1009,7 @@ static PyObject *cast(PyObject *self, PyObject *args) td = wt->type; else { - PyErr_SetString(PyExc_TypeError, "argument 1 of sip.cast() must be an instance of a sub or super-type of argument 2"); + PyErr_SetString(PyExc_TypeError, "argument 1 of sip_tqt.cast() must be an instance of a sub or super-type of argument 2"); return NULL; } @@ -1175,17 +1175,17 @@ static int sip_api_export_module(sipExportedModuleDef *client, /* Check that we can support it. */ - if (api_major != SIP_API_MAJOR_NR || api_minor > SIP_API_MINOR_NR) + if (api_major != SIP_TQT_API_MAJOR_NR || api_minor > SIP_TQT_API_MINOR_NR) { -#if SIP_API_MINOR_NR > 0 +#if SIP_TQT_API_MINOR_NR > 0 PyErr_Format(PyExc_RuntimeError, - "the sip module implements API v%d.0 to v%d.%d but the %s module requires API v%d.%d", - SIP_API_MAJOR_NR, SIP_API_MAJOR_NR, SIP_API_MINOR_NR, + "the sip_tqt module implements API v%d.0 to v%d.%d but the %s module requires API v%d.%d", + SIP_TQT_API_MAJOR_NR, SIP_TQT_API_MAJOR_NR, SIP_TQT_API_MINOR_NR, full_name, api_major, api_minor); #else PyErr_Format(PyExc_RuntimeError, - "the sip module implements API v%d.0 but the %s module requires API v%d.%d", - SIP_API_MAJOR_NR, full_name, api_major, api_minor); + "the sip_tqt module implements API v%d.0 but the %s module requires API v%d.%d", + SIP_TQT_API_MAJOR_NR, full_name, api_major, api_minor); #endif return -1; @@ -1210,7 +1210,7 @@ static int sip_api_export_module(sipExportedModuleDef *client, if (em == NULL) { PyErr_Format(PyExc_RuntimeError, - "the %s module failed to register with the sip module", + "the %s module failed to register with the sip_tqt module", im->im_name); return -1; @@ -1237,11 +1237,11 @@ static int sip_api_export_module(sipExportedModuleDef *client, for (em = moduleList; em != NULL; em = em->em_next) { - /* SIP clients must have unique names. */ + /* SIP-TQt clients must have unique names. */ if (strcmp(sipNameOfModule(em), full_name) == 0) { PyErr_Format(PyExc_RuntimeError, - "the sip module has already registered a module called %s", + "the sip_tqt module has already registered a module called %s", full_name); return -1; @@ -1753,7 +1753,7 @@ static PyObject *sip_api_build_result(int *isErr, const char *fmt, ...) badfmt = TRUE; if (badfmt) - PyErr_Format(PyExc_SystemError,"sipBuildResult(): invalid format string \"%s\"",fmt); + PyErr_Format(PyExc_SystemError,"sipTQtBuildResult(): invalid format string \"%s\"",fmt); else if (tupsz < 0 || (res = PyTuple_New(tupsz)) != NULL) res = buildObject(res,fmt,va); @@ -2127,7 +2127,7 @@ static int sip_api_parse_result(int *isErr, PyObject *method, PyObject *res, { if (ch == '\0') { - PyErr_Format(PyExc_SystemError, "sipParseResult(): invalid format string \"%s\"", fmt - 1); + PyErr_Format(PyExc_SystemError, "sipTQtParseResult(): invalid format string \"%s\"", fmt - 1); rc = -1; break; @@ -2667,7 +2667,7 @@ static int sip_api_parse_result(int *isErr, PyObject *method, PyObject *res, break; default: - PyErr_Format(PyExc_SystemError,"sipParseResult(): invalid format character '%c'",ch); + PyErr_Format(PyExc_SystemError,"sipTQtParseResult(): invalid format character '%c'",ch); rc = -1; } @@ -6589,7 +6589,7 @@ static void sip_api_bad_catcher_result(PyObject *method) PyMethod_GET_SELF(method) == NULL) { PyErr_Format(PyExc_TypeError, - "invalid argument to sipBadCatcherResult()"); + "invalid argument to sipTQtBadCatcherResult()"); return; } @@ -6655,7 +6655,7 @@ static void sip_api_transfer_to(PyObject *self, PyObject *owner) { /* * There is a legitimate case where we try to transfer a PyObject that - * may not be a SIP generated class. The virtual handler code calls + * may not be a SIP-TQt generated class. The virtual handler code calls * this function to keep the C/C++ instance alive when it gets rid of * the Python object returned by the Python method. A class may have * handwritten code that converts a regular Python type - so we can't @@ -8526,7 +8526,7 @@ static PyObject *sipSimpleWrapper_new(sipWrapperType *wt, PyObject *args, /* * See if it cannot be instantiated or sub-classed from Python, eg. * it's an opaque class. Some restrictions might be overcome with - * better SIP support. + * better SIP-TQt support. */ if (((sipClassTypeDef *)td)->ctd_init == NULL) { @@ -8573,12 +8573,12 @@ static int sipSimpleWrapper_init(sipSimpleWrapper *self, PyObject *args, static int (*kw_handler)(PyObject *, void *, PyObject *); /* - * Get any keyword handler if necessary. In SIP v5 this will be + * Get any keyword handler if necessary. In SIP-TQt v5 this will be * generalised and not PyTQt specific. */ if (!got_kw_handler) { - kw_handler = sip_api_import_symbol("pyqt_kw_handler"); + kw_handler = sip_api_import_symbol("pytqt_kw_handler"); got_kw_handler = TRUE; } @@ -9131,7 +9131,7 @@ sipWrapperType sipSimpleWrapper_Type = { #endif { PyVarObject_HEAD_INIT(&sipWrapperType_Type, 0) - "sip.simplewrapper", /* tp_name */ + "sip_tqt.simplewrapper", /* tp_name */ sizeof (sipSimpleWrapper), /* tp_basicsize */ 0, /* tp_itemsize */ (destructor)sipSimpleWrapper_dealloc, /* tp_dealloc */ @@ -10461,7 +10461,7 @@ static int *sip_api_unicode_as_wstring(PyObject *obj) */ static void raiseNoWChar() { - PyErr_SetString(PyExc_SystemError, "sip built without wchar_t support"); + PyErr_SetString(PyExc_SystemError, "sip-tqt built without wchar_t support"); } #endif diff --git a/siplib/siplib.sbf b/siplib/siplib.sbf index 2e17ba5..27bee7c 100644 --- a/siplib/siplib.sbf +++ b/siplib/siplib.sbf @@ -2,18 +2,18 @@ # # Copyright (c) 2010 Riverbank Computing Limited # -# This file is part of SIP. +# This file is part of SIP-TQt. # -# This copy of SIP is licensed for use under the terms of the SIP License +# This copy of SIP-TQt is licensed for use under the terms of the SIP License # Agreement. See the file LICENSE for more details. # -# This copy of SIP may also used under the terms of the GNU General Public +# This copy of SIP-TQt may also used under the terms of the GNU General Public # License v2 or v3 as published by the Free Software Foundation which can be # found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. # -# SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of +# SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -target = sip +target = sip_tqt sources = siplib.c apiversions.c descriptors.c tqtlib.c threads.c objmap.c voidptr.c bool.cpp -headers = sip.h sipint.h +headers = sip-tqt.h sipint.h diff --git a/siplib/threads.c b/siplib/threads.c index 0854a0a..1ece9d4 100644 --- a/siplib/threads.c +++ b/siplib/threads.c @@ -1,25 +1,25 @@ /* - * Thread support for the SIP library. This module provides the hooks for + * Thread support for the SIP-TQt library. This module provides the hooks for * C++ classes that provide a thread interface to interact properly with the * Python threading infrastructure. * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -#include "sip.h" +#include "sip-tqt.h" #include "sipint.h" diff --git a/siplib/tqtlib.c b/siplib/tqtlib.c index 9bf065a..83e4add 100644 --- a/siplib/tqtlib.c +++ b/siplib/tqtlib.c @@ -1,19 +1,19 @@ /* - * The SIP library code that implements the interface to the optional module + * The SIP-TQt library code that implements the interface to the optional module * supplied TQt support. * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ @@ -22,7 +22,7 @@ #include #include -#include "sip.h" +#include "sip-tqt.h" #include "sipint.h" @@ -171,7 +171,7 @@ PyObject *sip_api_invoke_slot(const sipSlot *slot, PyObject *sigargs) if ((sfunc = PyObject_GetAttrString(self, mname)) == NULL || !PyCFunction_Check(sfunc)) { /* - * Note that in earlier versions of SIP this error would be + * Note that in earlier versions of SIP-TQt this error would be * detected when the slot was connected. */ PyErr_Format(PyExc_NameError,"Invalid slot %s",mname); diff --git a/siplib/voidptr.c b/siplib/voidptr.c index fc26046..65d4fe9 100644 --- a/siplib/voidptr.c +++ b/siplib/voidptr.c @@ -1,18 +1,18 @@ /* - * SIP library code. + * SIP-TQt library code. * * Copyright (c) 2010 Riverbank Computing Limited * - * This file is part of SIP. + * This file is part of SIP-TQt. * - * This copy of SIP is licensed for use under the terms of the SIP License + * This copy of SIP-TQt is licensed for use under the terms of the SIP License * Agreement. See the file LICENSE for more details. * - * This copy of SIP may also used under the terms of the GNU General Public + * This copy of SIP-TQt may also used under the terms of the GNU General Public * License v2 or v3 as published by the Free Software Foundation which can be * found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. * - * SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of + * SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ @@ -21,7 +21,7 @@ #include -#include "sip.h" +#include "sip-tqt.h" #include "sipint.h" @@ -134,7 +134,7 @@ static SIP_SSIZE_T sipVoidPtr_getwritebuffer(PyObject *self, SIP_SSIZE_T seg, if (((sipVoidPtrObject *)self)->rw) return sipVoidPtr_getbuffer(self, seg, ptr); - PyErr_SetString(PyExc_TypeError, "the sip.voidptr is not writeable"); + PyErr_SetString(PyExc_TypeError, "the sip_tqt.voidptr is not writeable"); return -1; } #endif @@ -230,7 +230,7 @@ static PyObject *sipVoidPtr_asstring(sipVoidPtrObject *v, PyObject *args, if (size < 0) { PyErr_SetString(PyExc_ValueError, - "a size must be given or the sip.voidptr must have a size"); + "a size must be given or the sip_tqt.voidptr must have a size"); return NULL; } @@ -395,7 +395,7 @@ static PyBufferProcs sipVoidPtr_BufferProcs = { /* The type data structure. */ PyTypeObject sipVoidPtr_Type = { PyVarObject_HEAD_INIT(NULL, 0) - "sip.voidptr", /* tp_name */ + "sip_tqt.voidptr", /* tp_name */ sizeof (sipVoidPtrObject), /* tp_basicsize */ 0, /* tp_itemsize */ 0, /* tp_dealloc */ @@ -442,7 +442,7 @@ void *sip_api_convert_to_void_ptr(PyObject *obj) { if (obj == NULL) { - PyErr_SetString(PyExc_TypeError, "sip.voidptr is NULL"); + PyErr_SetString(PyExc_TypeError, "sip_tqt.voidptr is NULL"); return NULL; } @@ -469,7 +469,7 @@ void *sip_api_convert_to_void_ptr(PyObject *obj) /* - * Convert a C/C++ void pointer to a sip.voidptr object. + * Convert a C/C++ void pointer to a sip_tqt.voidptr object. */ PyObject *sip_api_convert_from_void_ptr(void *val) { @@ -478,7 +478,7 @@ PyObject *sip_api_convert_from_void_ptr(void *val) /* - * Convert a C/C++ void pointer to a sip.voidptr object. + * Convert a C/C++ void pointer to a sip_tqt.voidptr object. */ PyObject *sip_api_convert_from_const_void_ptr(const void *val) { @@ -487,7 +487,7 @@ PyObject *sip_api_convert_from_const_void_ptr(const void *val) /* - * Convert a sized C/C++ void pointer to a sip.voidptr object. + * Convert a sized C/C++ void pointer to a sip_tqt.voidptr object. */ PyObject *sip_api_convert_from_void_ptr_and_size(void *val, SIP_SSIZE_T size) { @@ -496,7 +496,7 @@ PyObject *sip_api_convert_from_void_ptr_and_size(void *val, SIP_SSIZE_T size) /* - * Convert a sized C/C++ const void pointer to a sip.voidptr object. + * Convert a sized C/C++ const void pointer to a sip_tqt.voidptr object. */ PyObject *sip_api_convert_from_const_void_ptr_and_size(const void *val, SIP_SSIZE_T size) diff --git a/siputils.py b/siputils.py index ca3d92e..b5b1860 100644 --- a/siputils.py +++ b/siputils.py @@ -1,19 +1,19 @@ # This module is intended to be used by the build/installation scripts of -# extension modules created with SIP. It provides information about file +# extension modules created with SIP-TQt. It provides information about file # locations, version numbers etc., and provides some classes and functions. # # Copyright (c) 2010 Riverbank Computing Limited # -# This file is part of SIP. +# This file is part of SIP-TQt. # -# This copy of SIP is licensed for use under the terms of the SIP License +# This copy of SIP-TQt is licensed for use under the terms of the SIP License # Agreement. See the file LICENSE for more details. # -# This copy of SIP may also used under the terms of the GNU General Public +# This copy of SIP-TQt may also used under the terms of the GNU General Public # License v2 or v3 as published by the Free Software Foundation which can be # found in the files LICENSE-GPL2 and LICENSE-GPL3 included in this package. # -# SIP is supplied WITHOUT ANY WARRANTY; without even the implied warranty of +# SIP-TQt is supplied WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. @@ -24,7 +24,7 @@ import string import re -# These are installation specific values created when SIP was configured. +# These are installation specific values created when SIP-TQt was configured. # @SIP_CONFIGURATION@ # The stack of configuration dictionaries. @@ -32,7 +32,7 @@ _config_stack = [] class Configuration(object): - """The class that represents SIP configuration values. + """The class that represents SIP-TQt configuration values. """ def __init__(self, sub_cfg=None): """Initialise an instance of the class. @@ -412,7 +412,7 @@ class Makefile: for l in self.extra_lib_dirs: # Ignore relative directories. This is really a hack to handle - # SIP v3 inter-module linking. + # SIP-TQt v3 inter-module linking. if os.path.dirname(l) not in ("", ".", ".."): rpaths.append(l) @@ -1425,7 +1425,7 @@ class ModuleMakefile(Makefile): dl = getattr(sys, 'real_prefix', sys.exec_prefix).split(os.sep) if "Python.framework" not in dl: - error("SIP requires Python to be built as a framework") + error("SIP-TQt requires Python to be built as a framework") self.LFLAGS.append("-undefined dynamic_lookup") @@ -1436,7 +1436,7 @@ class ModuleMakefile(Makefile): # AIX needs a lot of special handling. if self.required_string('LINK') == 'g++': # g++ is used for linking. - # For SIP v4 and g++: + # For SIP-TQt v4 and g++: # 1.) Import the python symbols aix_lflags = ['-Wl,-bI:%s/python.exp' % self.config.py_lib_dir] @@ -1446,7 +1446,7 @@ class ModuleMakefile(Makefile): aix_lflags.append('-Wl,-bE:%s.exp' % self._target) else: # IBM VisualAge C++ is used for linking. - # For SIP v4 and xlC: + # For SIP-TQt v4 and xlC: # 1.) Create a shared object # 2.) Import the python symbols aix_lflags = ['-qmkshrobj', @@ -1485,12 +1485,12 @@ class ModuleMakefile(Makefile): self.LFLAGS.remove('-Wl,--no-undefined') def module_as_lib(self, mname): - """Return the name of a SIP v3.x module when it is used as a library. - This will raise an exception when used with SIP v4.x modules. + """Return the name of a SIP-TQt v3.x module when it is used as a library. + This will raise an exception when used with SIP-TQt v4.x modules. mname is the name of the module. """ - raise ValueError("module_as_lib() can only be used with SIP v3.x") + raise ValueError("module_as_lib() can only be used with SIP-TQt v3.x") def generate_macros_and_rules(self, mfile): """Generate the macros and rules generation. @@ -1643,13 +1643,13 @@ class ModuleMakefile(Makefile): class SIPModuleMakefile(ModuleMakefile): - """The class that represents a SIP generated module Makefile. + """The class that represents a SIP-TQt generated module Makefile. """ def __init__(self, configuration, build_file, install_dir=None, static=0, console=0, qt=0, opengl=0, threaded=0, warnings=1, debug=0, dir=None, makefile="Makefile", installs=None, strip=1, export_all=0, universal=None, arch=None, prot_is_public=0): - """Initialise an instance of a SIP generated module Makefile. + """Initialise an instance of a SIP-TQt generated module Makefile. prot_is_public is set if "protected" is to be redefined as "public". If the platform's C++ ABI allows it this can significantly reduce the @@ -1664,7 +1664,7 @@ class SIPModuleMakefile(ModuleMakefile): self._prot_is_public = prot_is_public def finalise(self): - """Finalise the macros for a SIP generated module Makefile. + """Finalise the macros for a SIP-TQt generated module Makefile. """ if self._prot_is_public: self.DEFINES.append('SIP_PROTECTED_IS_PUBLIC') @@ -2083,7 +2083,7 @@ def create_config_module(module, template, content, macros=None): def version_to_sip_tag(version, tags, description): - """Convert a version number to a SIP tag. + """Convert a version number to a SIP-TQt tag. version is the version number. If it is negative then the latest version is assumed. (This is typically useful if a snapshot is indicated by a diff --git a/specs/freebsd-clang b/specs/freebsd-clang new file mode 100644 index 0000000..a3a2da4 --- /dev/null +++ b/specs/freebsd-clang @@ -0,0 +1,81 @@ +# +# +# qmake configuration for freebsd-clang +# + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release thread link_prl + +QMAKE_CC = clang +QMAKE_LEX = flex +QMAKE_LEXFLAGS = +QMAKE_YACC = yacc +QMAKE_YACCFLAGS = -d +QMAKE_CFLAGS = -pipe -fvisibility=hidden +QMAKE_CFLAGS_DEPS = -M +QMAKE_CFLAGS_WARN_ON = -Wall -W +QMAKE_CFLAGS_WARN_OFF = -w +QMAKE_CFLAGS_RELEASE = -O2 +QMAKE_CFLAGS_DEBUG = -g +QMAKE_CFLAGS_SHLIB = -fPIC +QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses +QMAKE_CFLAGS_THREAD = -pthread -D_THREAD_SAFE + +QMAKE_CXX = clang++ +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -fvisibility-inlines-hidden +QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS +QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB +QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD + +# Addon software goes into /usr/local on the BSDs, by default we will look there +QMAKE_INCDIR = /usr/local/include +QMAKE_LIBDIR = /usr/local/lib +QMAKE_INCDIR_X11 = /usr/X11R6/include +QMAKE_LIBDIR_X11 = /usr/X11R6/lib +QMAKE_INCDIR_TQT = $(TQTDIR)/include +QMAKE_LIBDIR_TQT = $(TQTDIR)/lib +QMAKE_INCDIR_OPENGL = /usr/X11R6/include +QMAKE_LIBDIR_OPENGL = /usr/X11R6/lib + +QMAKE_LINK = clang++ +QMAKE_LINK_SHLIB = clang++ +QMAKE_LFLAGS = +QMAKE_LFLAGS_RELEASE = +QMAKE_LFLAGS_DEBUG = +QMAKE_LFLAGS_SHLIB = -shared +QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB +QMAKE_LFLAGS_SONAME = -Wl,-soname, +QMAKE_LFLAGS_THREAD = -pthread +QMAKE_RPATH = -Wl,-rpath, + +QMAKE_LIBS = +QMAKE_LIBS_DYNLOAD = +QMAKE_LIBS_X11 = -lXext -lX11 -lm +QMAKE_LIBS_X11SM = -lSM -lICE +QMAKE_LIBS_QT = -lqt +QMAKE_LIBS_QT_THREAD = -ltqt-mt +QMAKE_LIBS_OPENGL = -lGLU -lGL -lXmu +QMAKE_LIBS_OPENGL_QT = -lGL -lXmu +QMAKE_LIBS_THREAD = + +QMAKE_MOC = $(TQTDIR)/bin/tqmoc +QMAKE_UIC = $(TQTDIR)/bin/tquic + +QMAKE_AR = ar cqs +QMAKE_RANLIB = + +QMAKE_TAR = tar -cf +QMAKE_GZIP = gzip -9f + +QMAKE_COPY = cp -f +QMAKE_MOVE = mv -f +QMAKE_DEL_FILE = rm -f +QMAKE_DEL_DIR = rmdir +QMAKE_CHK_DIR_EXISTS = test -d +QMAKE_MKDIR = mkdir -p -- cgit v1.2.1