|
|
|
@ -75,7 +75,6 @@ static void generateConsolidatedCpp(sipSpec *pt, const char *codeDir,
|
|
|
|
|
static void generateComponentCpp(sipSpec *pt, const char *codeDir,
|
|
|
|
|
const char *consModule);
|
|
|
|
|
static void generateSipImport(moduleDef *mod, FILE *fp);
|
|
|
|
|
static void generateSipImportVariables(FILE *fp);
|
|
|
|
|
static void generateModInitStart(moduleDef *mod, int gen_c, FILE *fp);
|
|
|
|
|
static void generateModDefinition(moduleDef *mod, const char *methods,
|
|
|
|
|
FILE *fp);
|
|
|
|
@ -246,8 +245,6 @@ static void prCachedName(FILE *fp, nameDef *nd, const char *prefix);
|
|
|
|
|
static void generateSignalTableEntry(sipSpec *pt, classDef *cd, overDef *sig,
|
|
|
|
|
memberDef *md, int membernr, FILE *fp);
|
|
|
|
|
static void generateTypesTable(sipSpec *pt, moduleDef *mod, FILE *fp);
|
|
|
|
|
static int py2OnlySlot(slotType st);
|
|
|
|
|
static int py2_5LaterSlot(slotType st);
|
|
|
|
|
static int keepPyReference(argDef *ad);
|
|
|
|
|
static int isDuplicateProtected(classDef *cd, overDef *target);
|
|
|
|
|
static char getEncoding(argType atype);
|
|
|
|
@ -865,11 +862,7 @@ static void generateCompositeCpp(sipSpec *pt, const char *codeDir)
|
|
|
|
|
"\n"
|
|
|
|
|
"static void sip_import_component_module(PyObject *d, const char *name)\n"
|
|
|
|
|
"{\n"
|
|
|
|
|
"#if PY_VERSION_HEX >= 0x02050000\n"
|
|
|
|
|
" PyObject *mod = PyImport_ImportModule(name);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" PyObject *mod = PyImport_ImportModule((char *)name);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" /*\n"
|
|
|
|
|
" * Note that we don't complain if the module can't be imported. This\n"
|
|
|
|
@ -891,11 +884,7 @@ static void generateCompositeCpp(sipSpec *pt, const char *codeDir)
|
|
|
|
|
"\n"
|
|
|
|
|
" PyObject *sipModule, *sipModuleDict;\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" sipModule = PyModule_Create(&sip_module_def);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" sipModule = Py_InitModule(\"%s\", 0);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" if (sipModule == NULL)\n"
|
|
|
|
|
" SIP_MODULE_RETURN(NULL);\n"
|
|
|
|
@ -956,11 +945,7 @@ static void generateConsolidatedCpp(sipSpec *pt, const char *codeDir,
|
|
|
|
|
for (mod = pt->modules; mod != NULL; mod = mod->next)
|
|
|
|
|
if (mod->container == pt->module)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
"extern PyObject *sip_init_%s(void);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
"extern void sip_init_%s(void);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"extern PyObject *sip_init_%s(void);\n"
|
|
|
|
|
, mod->name
|
|
|
|
|
, mod->name);
|
|
|
|
|
|
|
|
|
@ -980,11 +965,7 @@ static void generateConsolidatedCpp(sipSpec *pt, const char *codeDir,
|
|
|
|
|
"{\n"
|
|
|
|
|
" struct component {\n"
|
|
|
|
|
" const char *name;\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" PyObject *(*init)(void);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" void (*init)(void);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
" };\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" static struct component components[] = {\n"
|
|
|
|
@ -1003,27 +984,14 @@ static void generateConsolidatedCpp(sipSpec *pt, const char *codeDir,
|
|
|
|
|
" const char *name;\n"
|
|
|
|
|
" struct component *scd;\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" name = PyBytes_AsString(arg);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" name = PyString_AsString(arg);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" if (name == NULL)\n"
|
|
|
|
|
" return NULL;\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" for (scd = components; scd->name != NULL; ++scd)\n"
|
|
|
|
|
" if (strcmp(scd->name, name) == 0)\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" return (*scd->init)();\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" {\n"
|
|
|
|
|
" (*scd->init)();\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" Py_INCREF(Py_None);\n"
|
|
|
|
|
" return Py_None;\n"
|
|
|
|
|
" }\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" PyErr_Format(PyExc_ImportError, \"unknown component module %%s\", name);\n"
|
|
|
|
|
"\n"
|
|
|
|
@ -1044,13 +1012,9 @@ static void generateConsolidatedCpp(sipSpec *pt, const char *codeDir,
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" return PyModule_Create(&sip_module_def);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" Py_InitModule(\"%s\", sip_methods);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"}\n"
|
|
|
|
|
, mname);
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
closeFile(fp);
|
|
|
|
|
free(cppfile);
|
|
|
|
@ -1088,18 +1052,10 @@ static void generateComponentCpp(sipSpec *pt, const char *codeDir,
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" /* Ask the consolidated module to do the initialistion. */\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" sip_result = PyObject_CallMethod(sip_mod, \"init\", \"y\", \"%s\");\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" sip_result = PyObject_CallMethod(sip_mod, \"init\", \"s\", \"%s\");\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
" Py_DECREF(sip_mod);\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" return sip_result;\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" Py_XDECREF(sip_result);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"}\n"
|
|
|
|
|
, pt->module->fullname->text
|
|
|
|
|
, pt->module->fullname->text);
|
|
|
|
@ -1311,24 +1267,10 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
|
|
|
|
|
for (od = mod->overs; od != NULL; od = od->next)
|
|
|
|
|
if (od->common == md)
|
|
|
|
|
{
|
|
|
|
|
if (py2OnlySlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_MAJOR_VERSION < 3\n"
|
|
|
|
|
);
|
|
|
|
|
else if (py2_5LaterSlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_VERSION_HEX >= 0x02050000\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" {(void *)slot_%s, %s, {0, 0, 0}},\n"
|
|
|
|
|
, md->pyname->text, slotName(md->slot));
|
|
|
|
|
|
|
|
|
|
if (py2OnlySlot(md->slot) || py2_5LaterSlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -1336,15 +1278,6 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
|
|
|
|
|
for (cd = mod->proxies; cd != NULL; cd = cd->next)
|
|
|
|
|
for (md = cd->members; md != NULL; md = md->next)
|
|
|
|
|
{
|
|
|
|
|
if (py2OnlySlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_MAJOR_VERSION < 3\n"
|
|
|
|
|
);
|
|
|
|
|
else if (py2_5LaterSlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_VERSION_HEX >= 0x02050000\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" {(void *)slot_%L_%s, %s, ", cd->iff, md->pyname->text, slotName(md->slot));
|
|
|
|
|
|
|
|
|
@ -1352,11 +1285,6 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
|
|
|
|
|
|
|
|
|
|
prcode(fp, "},\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (py2OnlySlot(md->slot) || py2_5LaterSlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
@ -1430,23 +1358,9 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
|
|
|
|
|
|
|
|
|
|
if ((stype = slotName(slot->slot)) != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (py2OnlySlot(slot->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_MAJOR_VERSION < 3\n"
|
|
|
|
|
);
|
|
|
|
|
else if (py2_5LaterSlot(slot->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_VERSION_HEX >= 0x02050000\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" {(void *)slot_%C_%s, %s},\n"
|
|
|
|
|
, ed->fqcname, slot->pyname->text, stype);
|
|
|
|
|
|
|
|
|
|
if (py2OnlySlot(slot->slot) || py2_5LaterSlot(slot->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1904,15 +1818,9 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
|
|
|
|
|
if (mod->container == pt->module)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
"#define SIP_MODULE_DISCARD(r) Py_DECREF(r)\n"
|
|
|
|
|
"#define SIP_MODULE_RETURN(r) return (r)\n"
|
|
|
|
|
"PyObject *sip_init_%s()\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
"#define SIP_MODULE_DISCARD(r)\n"
|
|
|
|
|
"#define SIP_MODULE_RETURN(r) return\n"
|
|
|
|
|
"void sip_init_%s()\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"{\n"
|
|
|
|
|
, mname
|
|
|
|
|
, mname);
|
|
|
|
@ -1966,31 +1874,12 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
|
|
|
|
|
" PyObject *sipModule, *sipModuleDict;\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
generateSipImportVariables(fp);
|
|
|
|
|
|
|
|
|
|
/* Generate any pre-initialisation code. */
|
|
|
|
|
generateCppCodeBlock(mod->preinitcode, fp);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" /* Initialise the module and get it's dictionary. */\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" sipModule = PyModule_Create(&sip_module_def);\n"
|
|
|
|
|
"#elif PY_VERSION_HEX >= 0x02050000\n"
|
|
|
|
|
" sipModule = Py_InitModule(%N, sip_methods);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
, mod->fullname);
|
|
|
|
|
|
|
|
|
|
if (generating_c)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" sipModule = Py_InitModule((char *)%N, sip_methods);\n"
|
|
|
|
|
, mod->fullname);
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" sipModule = Py_InitModule(const_cast<char *>(%N), sip_methods);\n"
|
|
|
|
|
, mod->fullname);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" if (sipModule == NULL)\n"
|
|
|
|
|
" SIP_MODULE_RETURN(NULL);\n"
|
|
|
|
@ -2008,9 +1897,6 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
|
|
|
|
|
" /* Export the module and publish it's API. */\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"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
" SIP_MODULE_DISCARD(sipModule);\n"
|
|
|
|
|
" SIP_MODULE_RETURN(0);\n"
|
|
|
|
|
" }\n"
|
|
|
|
@ -2034,9 +1920,6 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
|
|
|
|
|
" /* Initialise the module now all its dependencies have been set up. */\n"
|
|
|
|
|
" if (sipInitModule(&sipModuleAPI_%s,sipModuleDict) < 0)\n"
|
|
|
|
|
" {\n"
|
|
|
|
|
"#if !defined(SIP_USE_PYCAPSULE)\n"
|
|
|
|
|
" Py_DECREF(sip_sipmod);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
" SIP_MODULE_DISCARD(sipModule);\n"
|
|
|
|
|
" SIP_MODULE_RETURN(0);\n"
|
|
|
|
|
" }\n"
|
|
|
|
@ -2076,11 +1959,7 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
" if ((exceptionsTable[%d] = PyErr_NewException(\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" \"%s.%s\",\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" const_cast<char *>(\"%s.%s\"),\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
" "
|
|
|
|
|
, xd->exceptionnr
|
|
|
|
|
, xd->iff->module->name, xd->pyname
|
|
|
|
@ -2095,9 +1974,6 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir,
|
|
|
|
|
|
|
|
|
|
prcode(fp, ",NULL)) == NULL || PyDict_SetItemString(sipModuleDict,\"%s\",exceptionsTable[%d]) < 0)\n"
|
|
|
|
|
" {\n"
|
|
|
|
|
"#if !defined(SIP_USE_PYCAPSULE)\n"
|
|
|
|
|
" Py_DECREF(sip_sipmod);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
" SIP_MODULE_DISCARD(sipModule);\n"
|
|
|
|
|
" SIP_MODULE_RETURN(0);\n"
|
|
|
|
|
" }\n"
|
|
|
|
@ -2215,8 +2091,6 @@ static void generateSipImport(moduleDef *mod, FILE *fp)
|
|
|
|
|
{
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" /* Get the SIP-TQt module's API. */\n"
|
|
|
|
|
"#if defined(SIP_USE_PYCAPSULE)\n"
|
|
|
|
|
"\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (generating_c)
|
|
|
|
@ -2235,71 +2109,7 @@ static void generateSipImport(moduleDef *mod, FILE *fp)
|
|
|
|
|
" SIP_MODULE_DISCARD(sipModule);\n"
|
|
|
|
|
" SIP_MODULE_RETURN(NULL);\n"
|
|
|
|
|
" }\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_VERSION_HEX >= 0x02050000\n"
|
|
|
|
|
" sip_sipmod = PyImport_ImportModule(\"sip_tqt\");\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
, mod->name);
|
|
|
|
|
|
|
|
|
|
if (generating_c)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" sip_sipmod = PyImport_ImportModule((char *)\"sip_tqt\");\n"
|
|
|
|
|
);
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" sip_sipmod = PyImport_ImportModule(const_cast<char *>(\"sip_tqt\"));\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" if (sip_sipmod == NULL)\n"
|
|
|
|
|
" {\n"
|
|
|
|
|
" SIP_MODULE_DISCARD(sipModule);\n"
|
|
|
|
|
" SIP_MODULE_RETURN(NULL);\n"
|
|
|
|
|
" }\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" sip_capiobj = PyDict_GetItemString(PyModule_GetDict(sip_sipmod), \"_C_API\");\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" if (sip_capiobj == NULL || !PyCObject_Check(sip_capiobj))\n"
|
|
|
|
|
" {\n"
|
|
|
|
|
" Py_DECREF(sip_sipmod);\n"
|
|
|
|
|
" SIP_MODULE_DISCARD(sipModule);\n"
|
|
|
|
|
" SIP_MODULE_RETURN(NULL);\n"
|
|
|
|
|
" }\n"
|
|
|
|
|
"\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (generating_c)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" sipAPI_%s = (const sipAPIDef *)PyCObject_AsVoidPtr(sip_capiobj);\n"
|
|
|
|
|
, mod->name);
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" sipAPI_%s = reinterpret_cast<const sipAPIDef *>(PyCObject_AsVoidPtr(sip_capiobj));\n"
|
|
|
|
|
, mod->name);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Generate the variables needed by generateSipImport().
|
|
|
|
|
*/
|
|
|
|
|
static void generateSipImportVariables(FILE *fp)
|
|
|
|
|
{
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if !defined(SIP_USE_PYCAPSULE)\n"
|
|
|
|
|
" PyObject *sip_sipmod, *sip_capiobj;\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2312,17 +2122,10 @@ static void generateModInitStart(moduleDef *mod, int gen_c, FILE *fp)
|
|
|
|
|
"\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"/* The Python module initialisation function. */\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
"#define SIP_MODULE_ENTRY PyInit_%s\n"
|
|
|
|
|
"#define SIP_MODULE_TYPE PyObject *\n"
|
|
|
|
|
"#define SIP_MODULE_DISCARD(r) Py_DECREF(r)\n"
|
|
|
|
|
"#define SIP_MODULE_RETURN(r) return (r)\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
"#define SIP_MODULE_ENTRY init%s\n"
|
|
|
|
|
"#define SIP_MODULE_TYPE void\n"
|
|
|
|
|
"#define SIP_MODULE_DISCARD(r)\n"
|
|
|
|
|
"#define SIP_MODULE_RETURN(r) return\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if (defined(__GNUC__) && __GNUC__ >= 4) || defined(__clang__)\n"
|
|
|
|
|
"#pragma GCC visibility push(default)\n"
|
|
|
|
@ -2350,7 +2153,6 @@ static void generateModDefinition(moduleDef *mod, const char *methods,
|
|
|
|
|
{
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" static PyModuleDef sip_module_def = {\n"
|
|
|
|
|
" PyModuleDef_HEAD_INIT,\n"
|
|
|
|
|
" \"%s\",\n"
|
|
|
|
@ -2362,7 +2164,6 @@ static void generateModDefinition(moduleDef *mod, const char *methods,
|
|
|
|
|
" NULL,\n"
|
|
|
|
|
" NULL\n"
|
|
|
|
|
" };\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
, mod->fullname->text
|
|
|
|
|
, methods);
|
|
|
|
|
}
|
|
|
|
@ -4363,11 +4164,7 @@ static void generateVariableGetter(ifaceFileDef *scope, varDef *vd, FILE *fp)
|
|
|
|
|
case utf8_string_type:
|
|
|
|
|
if (vd->type.nrderefs == 0)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" return PyUnicode_FromStringAndSize(&sipVal, 1);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" return PyUnicode_DecodeUTF8(&sipVal, 1, NULL);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
@ -4377,11 +4174,7 @@ static void generateVariableGetter(ifaceFileDef *scope, varDef *vd, FILE *fp)
|
|
|
|
|
" return Py_None;\n"
|
|
|
|
|
" }\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" return PyUnicode_FromString(sipVal);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" return PyUnicode_DecodeUTF8(sipVal, strlen(sipVal), NULL);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
@ -4394,7 +4187,7 @@ static void generateVariableGetter(ifaceFileDef *scope, varDef *vd, FILE *fp)
|
|
|
|
|
|
|
|
|
|
if (vd->type.nrderefs == 0)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" return SIPBytes_FromStringAndSize(%s&sipVal, 1);\n"
|
|
|
|
|
" return PyBytes_FromStringAndSize(%s&sipVal, 1);\n"
|
|
|
|
|
, cast);
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
@ -4404,7 +4197,7 @@ static void generateVariableGetter(ifaceFileDef *scope, varDef *vd, FILE *fp)
|
|
|
|
|
" return Py_None;\n"
|
|
|
|
|
" }\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" return SIPBytes_FromString(%ssipVal);\n"
|
|
|
|
|
" return PyBytes_FromString(%ssipVal);\n"
|
|
|
|
|
, cast);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -4458,7 +4251,7 @@ static void generateVariableGetter(ifaceFileDef *scope, varDef *vd, FILE *fp)
|
|
|
|
|
case cint_type:
|
|
|
|
|
case int_type:
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" return SIPLong_FromLong(sipVal);\n"
|
|
|
|
|
" return PyLong_FromLong(sipVal);\n"
|
|
|
|
|
);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -4789,7 +4582,7 @@ static int generateObjToCppConversion(argDef *ad,FILE *fp)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case enum_type:
|
|
|
|
|
prcode(fp, "(%E)SIPLong_AsLong(sipPy);\n"
|
|
|
|
|
prcode(fp, "(%E)PyLong_AsLong(sipPy);\n"
|
|
|
|
|
, ad->u.ed);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
@ -4866,7 +4659,7 @@ static int generateObjToCppConversion(argDef *ad,FILE *fp)
|
|
|
|
|
|
|
|
|
|
case bool_type:
|
|
|
|
|
case cbool_type:
|
|
|
|
|
rhs = "(bool)SIPLong_AsLong(sipPy)";
|
|
|
|
|
rhs = "(bool)PyLong_AsLong(sipPy)";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ushort_type:
|
|
|
|
@ -4874,7 +4667,7 @@ static int generateObjToCppConversion(argDef *ad,FILE *fp)
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case short_type:
|
|
|
|
|
rhs = "(short)SIPLong_AsLong(sipPy)";
|
|
|
|
|
rhs = "(short)PyLong_AsLong(sipPy)";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case uint_type:
|
|
|
|
@ -4883,7 +4676,7 @@ static int generateObjToCppConversion(argDef *ad,FILE *fp)
|
|
|
|
|
|
|
|
|
|
case int_type:
|
|
|
|
|
case cint_type:
|
|
|
|
|
rhs = "(int)SIPLong_AsLong(sipPy)";
|
|
|
|
|
rhs = "(int)PyLong_AsLong(sipPy)";
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ulong_type:
|
|
|
|
@ -5146,15 +4939,6 @@ static void generateSlot(moduleDef *mod, classDef *cd, enumDef *ed,
|
|
|
|
|
"\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (py2OnlySlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_MAJOR_VERSION < 3\n"
|
|
|
|
|
);
|
|
|
|
|
else if (py2_5LaterSlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_VERSION_HEX >= 0x02050000\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!generating_c)
|
|
|
|
|
{
|
|
|
|
|
prcode(fp,
|
|
|
|
@ -5204,7 +4988,7 @@ static void generateSlot(moduleDef *mod, classDef *cd, enumDef *ed,
|
|
|
|
|
, (md->slot == cmp_slot ? "-2" : (ret_int ? "-1" : "0")));
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" %S sipCpp = static_cast<%S>(SIPLong_AsLong(sipSelf));\n"
|
|
|
|
|
" %S sipCpp = static_cast<%S>(PyLong_AsLong(sipSelf));\n"
|
|
|
|
|
"\n"
|
|
|
|
|
, fqcname, fqcname);
|
|
|
|
|
}
|
|
|
|
@ -5311,11 +5095,6 @@ static void generateSlot(moduleDef *mod, classDef *cd, enumDef *ed,
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"}\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (py2OnlySlot(md->slot) || py2_5LaterSlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -5564,7 +5343,6 @@ static void generateClassFunctions(sipSpec *pt, moduleDef *mod, classDef *cd,
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!generating_c)
|
|
|
|
@ -5596,7 +5374,6 @@ static void generateClassFunctions(sipSpec *pt, moduleDef *mod, classDef *cd,
|
|
|
|
|
"\n"
|
|
|
|
|
" return sipRes;\n"
|
|
|
|
|
"}\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -5605,7 +5382,6 @@ static void generateClassFunctions(sipSpec *pt, moduleDef *mod, classDef *cd,
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!generating_c)
|
|
|
|
@ -5629,158 +5405,6 @@ static void generateClassFunctions(sipSpec *pt, moduleDef *mod, classDef *cd,
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"}\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cd->readbufcode != NULL)
|
|
|
|
|
{
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION < 3\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!generating_c)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"extern \"C\" {static SIP_SSIZE_T getreadbuffer_%C(PyObject *, void *, SIP_SSIZE_T, void **);}\n"
|
|
|
|
|
, classFTQCName(cd));
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"static SIP_SSIZE_T getreadbuffer_%C(PyObject *%s, void *sipCppV, SIP_SSIZE_T %s, void **%s)\n"
|
|
|
|
|
"{\n"
|
|
|
|
|
" ", classFTQCName(cd)
|
|
|
|
|
, argName("sipSelf", cd->readbufcode)
|
|
|
|
|
, argName("sipSegment", cd->readbufcode)
|
|
|
|
|
, argName("sipPtrPtr", cd->readbufcode));
|
|
|
|
|
|
|
|
|
|
generateClassFromVoid(cd, "sipCpp", "sipCppV", fp);
|
|
|
|
|
|
|
|
|
|
prcode(fp, ";\n"
|
|
|
|
|
" SIP_SSIZE_T sipRes;\n"
|
|
|
|
|
"\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
generateCppCodeBlock(cd->readbufcode, fp);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
" return sipRes;\n"
|
|
|
|
|
"}\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cd->writebufcode != NULL)
|
|
|
|
|
{
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION < 3\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!generating_c)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"extern \"C\" {static SIP_SSIZE_T getwritebuffer_%C(PyObject *, void *, SIP_SSIZE_T, void **);}\n"
|
|
|
|
|
, classFTQCName(cd));
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"static SIP_SSIZE_T getwritebuffer_%C(PyObject *%s, void *sipCppV, SIP_SSIZE_T %s, void **%s)\n"
|
|
|
|
|
"{\n"
|
|
|
|
|
" ", classFTQCName(cd)
|
|
|
|
|
, argName("sipSelf", cd->writebufcode)
|
|
|
|
|
, argName("sipSegment", cd->writebufcode)
|
|
|
|
|
, argName("sipPtrPtr", cd->writebufcode));
|
|
|
|
|
|
|
|
|
|
generateClassFromVoid(cd, "sipCpp", "sipCppV", fp);
|
|
|
|
|
|
|
|
|
|
prcode(fp, ";\n"
|
|
|
|
|
" SIP_SSIZE_T sipRes;\n"
|
|
|
|
|
"\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
generateCppCodeBlock(cd->writebufcode, fp);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
" return sipRes;\n"
|
|
|
|
|
"}\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cd->segcountcode != NULL)
|
|
|
|
|
{
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION < 3\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!generating_c)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"extern \"C\" {static SIP_SSIZE_T getsegcount_%C(PyObject *, void *, SIP_SSIZE_T *);}\n"
|
|
|
|
|
, classFTQCName(cd));
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"static SIP_SSIZE_T getsegcount_%C(PyObject *%s, void *sipCppV, SIP_SSIZE_T *%s)\n"
|
|
|
|
|
"{\n"
|
|
|
|
|
" ", classFTQCName(cd)
|
|
|
|
|
, argName("sipSelf", cd->segcountcode)
|
|
|
|
|
, argName("sipLenPtr", cd->segcountcode));
|
|
|
|
|
|
|
|
|
|
generateClassFromVoid(cd, "sipCpp", "sipCppV", fp);
|
|
|
|
|
|
|
|
|
|
prcode(fp, ";\n"
|
|
|
|
|
" SIP_SSIZE_T sipRes;\n"
|
|
|
|
|
"\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
generateCppCodeBlock(cd->segcountcode, fp);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
" return sipRes;\n"
|
|
|
|
|
"}\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (cd->charbufcode != NULL)
|
|
|
|
|
{
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION < 3\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!generating_c)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"extern \"C\" {static SIP_SSIZE_T getcharbuffer_%C(PyObject *, void *, SIP_SSIZE_T, void **);}\n"
|
|
|
|
|
, classFTQCName(cd));
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"static SIP_SSIZE_T getcharbuffer_%C(PyObject *%s, void *sipCppV, SIP_SSIZE_T %s, void **%s)\n"
|
|
|
|
|
"{\n"
|
|
|
|
|
" ", classFTQCName(cd)
|
|
|
|
|
, argName("sipSelf", cd->charbufcode)
|
|
|
|
|
, argName("sipSegment", cd->charbufcode)
|
|
|
|
|
, argName("sipPtrPtr", cd->charbufcode));
|
|
|
|
|
|
|
|
|
|
generateClassFromVoid(cd, "sipCpp", "sipCppV", fp);
|
|
|
|
|
|
|
|
|
|
prcode(fp, ";\n"
|
|
|
|
|
" SIP_SSIZE_T sipRes;\n"
|
|
|
|
|
"\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
generateCppCodeBlock(cd->charbufcode, fp);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"\n"
|
|
|
|
|
" return sipRes;\n"
|
|
|
|
|
"}\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -8962,23 +8586,9 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp)
|
|
|
|
|
|
|
|
|
|
if ((stype = slotName(md->slot)) != NULL)
|
|
|
|
|
{
|
|
|
|
|
if (py2OnlySlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_MAJOR_VERSION < 3\n"
|
|
|
|
|
);
|
|
|
|
|
else if (py2_5LaterSlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_VERSION_HEX >= 0x02050000\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" {(void *)slot_%L_%s, %s},\n"
|
|
|
|
|
, cd->iff, md->pyname->text, stype);
|
|
|
|
|
|
|
|
|
|
if (py2OnlySlot(md->slot) || py2_5LaterSlot(md->slot))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -9398,10 +9008,6 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp)
|
|
|
|
|
" 0,\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (cd->getbufcode != NULL)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" getbuffer_%C,\n"
|
|
|
|
@ -9420,50 +9026,6 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp)
|
|
|
|
|
" 0,\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#else\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (cd->readbufcode != NULL)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" getreadbuffer_%C,\n"
|
|
|
|
|
, classFTQCName(cd));
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" 0,\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (cd->writebufcode != NULL)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" getwritebuffer_%C,\n"
|
|
|
|
|
, classFTQCName(cd));
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" 0,\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (cd->segcountcode != NULL)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" getsegcount_%C,\n"
|
|
|
|
|
, classFTQCName(cd));
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" 0,\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (cd->charbufcode != NULL)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" getcharbuffer_%C,\n"
|
|
|
|
|
, classFTQCName(cd));
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" 0,\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#endif\n"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (needDealloc(cd))
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" dealloc_%L,\n"
|
|
|
|
@ -9614,28 +9176,6 @@ static void generateSignalTableEntry(sipSpec *pt, classDef *cd, overDef *sig,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Return TRUE if the slot is specific to Python v2.
|
|
|
|
|
*/
|
|
|
|
|
static int py2OnlySlot(slotType st)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
* Note that we place interpretations on div_slot and idiv_slot for Python
|
|
|
|
|
* v3 so they are not included.
|
|
|
|
|
*/
|
|
|
|
|
return (st == long_slot || st == cmp_slot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Return TRUE if the slot is specific to Python v2.5 and later.
|
|
|
|
|
*/
|
|
|
|
|
static int py2_5LaterSlot(slotType st)
|
|
|
|
|
{
|
|
|
|
|
return (st == index_slot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Return the sip module's string equivalent of a slot.
|
|
|
|
|
*/
|
|
|
|
@ -10912,11 +10452,7 @@ static void generateHandleResult(overDef *od, int isNew, int result_size,
|
|
|
|
|
case utf8_string_type:
|
|
|
|
|
if (ad->nrderefs == 0)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" %s PyUnicode_FromStringAndSize(&%s, 1);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" %s PyUnicode_DecodeUTF8(&%s, 1, NULL);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
, prefix, vname
|
|
|
|
|
, prefix, vname);
|
|
|
|
|
else
|
|
|
|
@ -10927,11 +10463,7 @@ static void generateHandleResult(overDef *od, int isNew, int result_size,
|
|
|
|
|
" return Py_None;\n"
|
|
|
|
|
" }\n"
|
|
|
|
|
"\n"
|
|
|
|
|
"#if PY_MAJOR_VERSION >= 3\n"
|
|
|
|
|
" %s PyUnicode_FromString(%s);\n"
|
|
|
|
|
"#else\n"
|
|
|
|
|
" %s PyUnicode_DecodeUTF8(%s, strlen(%s), NULL);\n"
|
|
|
|
|
"#endif\n"
|
|
|
|
|
, vname
|
|
|
|
|
, prefix, vname
|
|
|
|
|
, prefix, vname, vname);
|
|
|
|
@ -10943,7 +10475,7 @@ static void generateHandleResult(overDef *od, int isNew, int result_size,
|
|
|
|
|
case string_type:
|
|
|
|
|
if (ad->nrderefs == 0)
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" %s SIPBytes_FromStringAndSize(%s&%s,1);\n"
|
|
|
|
|
" %s PyBytes_FromStringAndSize(%s&%s,1);\n"
|
|
|
|
|
,prefix,(ad->atype != string_type) ? "(char *)" : "",vname);
|
|
|
|
|
else
|
|
|
|
|
prcode(fp,
|
|
|
|
@ -10953,7 +10485,7 @@ static void generateHandleResult(overDef *od, int isNew, int result_size,
|
|
|
|
|
" return Py_None;\n"
|
|
|
|
|
" }\n"
|
|
|
|
|
"\n"
|
|
|
|
|
" %s SIPBytes_FromString(%s%s);\n"
|
|
|
|
|
" %s PyBytes_FromString(%s%s);\n"
|
|
|
|
|
,vname
|
|
|
|
|
,prefix,(ad->atype != string_type) ? "(char *)" : "",vname);
|
|
|
|
|
|
|
|
|
@ -10994,7 +10526,7 @@ static void generateHandleResult(overDef *od, int isNew, int result_size,
|
|
|
|
|
case int_type:
|
|
|
|
|
case cint_type:
|
|
|
|
|
prcode(fp,
|
|
|
|
|
" %s SIPLong_FromLong(%s);\n"
|
|
|
|
|
" %s PyLong_FromLong(%s);\n"
|
|
|
|
|
,prefix,vname);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|