diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2023-01-22 12:15:55 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2023-01-22 13:23:20 +0100 |
commit | d768e91379d44b22260cddb3559c1e2243c3b1f5 (patch) | |
tree | e17b20e8c6e752c94fb29c8e02810afb3bb6923f /sipgen | |
parent | 0f630aff5c42d03eb301cd3fc5faff80d9c3c727 (diff) | |
download | sip4-tqt-d768e91379d44b22260cddb3559c1e2243c3b1f5.tar.gz sip4-tqt-d768e91379d44b22260cddb3559c1e2243c3b1f5.zip |
Drop the remaining Qt4 related parts.r14.1.0
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'sipgen')
-rw-r--r-- | sipgen/gencode.c | 250 | ||||
-rw-r--r-- | sipgen/parser.y | 15 | ||||
-rw-r--r-- | sipgen/sip.h | 4 |
3 files changed, 5 insertions, 264 deletions
diff --git a/sipgen/gencode.c b/sipgen/gencode.c index 7dbe6ad..b0e3eb7 100644 --- a/sipgen/gencode.c +++ b/sipgen/gencode.c @@ -242,8 +242,6 @@ static int generateSubClassConvertors(sipSpec *pt, moduleDef *mod, FILE *fp); static void generateNameCache(sipSpec *pt, FILE *fp); static const char *resultOwner(overDef *od); 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 keepPyReference(argDef *ad); static int isDuplicateProtected(classDef *cd, overDef *target); @@ -497,12 +495,6 @@ static void generateInternalAPIHeader(sipSpec *pt, moduleDef *mod, , mname , mname); - if (pluginPyQt4(pt)) - prcode(fp, -"\n" -"#include <TQMetaType>\n" - ); - /* Define the enabled features. */ noIntro = TRUE; @@ -799,21 +791,6 @@ static void generateInternalAPIHeader(sipSpec *pt, moduleDef *mod, , mname, mld->module->name); } - if (pluginPyQt4(pt)) - prcode(fp, -"\n" -"typedef const TQMetaObject *(*sip_tqt_metaobject_func)(sipSimpleWrapper *,sipTypeDef *);\n" -"extern sip_tqt_metaobject_func sip_%s_tqt_metaobject;\n" -"\n" -"typedef int (*sip_tqt_metacall_func)(sipSimpleWrapper *,sipTypeDef *,TQMetaObject::Call,int,void **);\n" -"extern sip_tqt_metacall_func sip_%s_tqt_metacall;\n" -"\n" -"typedef int (*sip_tqt_metacast_func)(sipSimpleWrapper *,sipTypeDef *,const char *);\n" -"extern sip_tqt_metacast_func sip_%s_tqt_metacast;\n" - , mname - , mname - , mname); - /* * Note that we don't forward declare the virtual handlers. This is * because we would need to #include everything needed for their argument @@ -1803,16 +1780,6 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir, "const sipExportedModuleDef *sipModuleAPI_%s_%s;\n" , mname, mld->module->name); - if (pluginPyQt4(pt)) - prcode(fp, -"\n" -"sip_tqt_metaobject_func sip_%s_tqt_metaobject;\n" -"sip_tqt_metacall_func sip_%s_tqt_metacall;\n" -"sip_tqt_metacast_func sip_%s_tqt_metacast;\n" - , mname - , mname - , mname); - /* Generate the Python module initialisation function. */ if (mod->container == pt->module) @@ -1902,20 +1869,6 @@ static void generateCpp(sipSpec *pt, moduleDef *mod, const char *codeDir, " }\n" , mname); - if (pluginPyQt4(pt)) - { - /* Import the helpers. */ - prcode(fp, -"\n" -" sip_%s_tqt_metaobject = (sip_tqt_metaobject_func)sipImportSymbol(\"tqtcore_tqt_metaobject\");\n" -" sip_%s_tqt_metacall = (sip_tqt_metacall_func)sipImportSymbol(\"tqtcore_tqt_metacall\");\n" -" sip_%s_tqt_metacast = (sip_tqt_metacast_func)sipImportSymbol(\"tqtcore_tqt_metacast\");\n" -"\n" - , mname - , mname - , mname); - } - prcode(fp, " /* Initialise the module now all its dependencies have been set up. */\n" " if (sipInitModule(&sipModuleAPI_%s,sipModuleDict) < 0)\n" @@ -2037,7 +1990,7 @@ static void generateTypesTable(sipSpec *pt, moduleDef *mod, FILE *fp) argDef *ad; const char *type_suffix; - type_suffix = (pluginPyQt4(pt) || pluginPyTQt(pt)) ? ".super" : ""; + type_suffix = pluginPyTQt(pt) ? ".super" : ""; prcode(fp, "\n" @@ -3623,7 +3576,7 @@ static void generateTypeDefLink(sipSpec *pt, ifaceFileDef *iff, FILE *fp) if (iff->next_alt->type == mappedtype_iface) prcode(fp, ".mtd_base"); - else if (pluginPyTQt(pt) || pluginPyQt4(pt)) + else if (pluginPyTQt(pt)) prcode(fp, ".super.ctd_base"); else prcode(fp, ".ctd_base"); @@ -5695,42 +5648,6 @@ static void generateShadowCode(sipSpec *pt, moduleDef *mod, classDef *cd, ); } - /* The meta methods if required. */ - if (pluginPyQt4(pt) && isTQObjectSubClass(cd)) - { - if (!noPyQt4TQMetaObject(cd)) - prcode(fp, -"\n" -"const TQMetaObject *sip%C::metaObject() const\n" -"{\n" -" return sip_%s_tqt_metaobject(sipPySelf,sipType_%C);\n" -"}\n" - , classFTQCName(cd) - , mod->name, classFTQCName(cd)); - - prcode(fp, -"\n" -"int sip%C::qt_metacall(TQMetaObject::Call _c,int _id,void **_a)\n" -"{\n" -" _id = %S::qt_metacall(_c,_id,_a);\n" -"\n" -" if (_id >= 0)\n" -" _id = sip_%s_tqt_metacall(sipPySelf,sipType_%C,_c,_id,_a);\n" -"\n" -" return _id;\n" -"}\n" -"\n" -"void *sip%C::qt_metacast(const char *_clname)\n" -"{\n" -" return (sip_%s_tqt_metacast && sip_%s_tqt_metacast(sipPySelf,sipType_%C,_clname)) ? this : %S::qt_metacast(_clname);\n" -"}\n" - , classFTQCName(cd) - , classFTQCName(cd) - , mod->name, classFTQCName(cd) - , classFTQCName(cd) - , mod->name, mod->name, classFTQCName(cd), classFTQCName(cd)); - } - /* Generate the virtual catchers. */ virtNr = 0; @@ -7652,9 +7569,7 @@ static void generateClassAPI(classDef *cd, sipSpec *pt, FILE *fp) { const char *type_prefix; - if (pluginPyQt4(pt)) - type_prefix = "pyqt4"; - else if (pluginPyTQt(pt)) + if (pluginPyTQt(pt)) type_prefix = "pytqt"; else type_prefix = "sip"; @@ -7808,21 +7723,6 @@ static void generateShadowClassDeclaration(sipSpec *pt,classDef *cd,FILE *fp) " %s~sip%C()%X;\n" ,(cd->vmembers != NULL ? "virtual " : ""),classFTQCName(cd),cd->dtorexceptions); - /* The metacall methods if required. */ - if (pluginPyQt4(pt) && isTQObjectSubClass(cd)) - { - prcode(fp, -"\n" -" int tqt_metacall(TQMetaObject::Call,int,void **);\n" -" void *tqt_metacast(const char *);\n" - ); - - if (!noPyQt4TQMetaObject(cd)) - prcode(fp, -" const TQMetaObject *metaObject() const;\n" - ); - } - /* The exposure of protected enums. */ generateProtectedEnums(pt,cd,fp); @@ -8530,7 +8430,7 @@ static void generateSimpleFunctionCall(fcallDef *fcd,FILE *fp) static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp) { const char *mname, *sep, *type_prefix; - int is_slots, is_signals, nr_methods, nr_enums, nr_vars, embedded; + int is_slots, nr_methods, nr_enums, nr_vars, embedded; int is_inst_class, is_inst_voidp, is_inst_char, is_inst_string; int is_inst_int, is_inst_long, is_inst_ulong, is_inst_longlong; int is_inst_ulonglong, is_inst_double, has_docstring; @@ -8602,79 +8502,6 @@ 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 PyQt4 signals table. */ - is_signals = FALSE; - - if (pluginPyQt4(pt) && isTQObjectSubClass(cd)) - { - /* The signals must be grouped by name. */ - for (md = cd->members; md != NULL; md = md->next) - { - overDef *od; - int membernr = md->membernr; - - for (od = cd->overs; od != NULL; od = od->next) - { - int a, nr_args; - - if (od->common != md || !isSignal(od)) - continue; - - if (membernr >= 0) - { - /* See if there is a non-signal overload. */ - - overDef *nsig; - - for (nsig = cd->overs; nsig != NULL; nsig = nsig->next) - if (nsig != od && nsig->common == md && !isSignal(nsig)) - break; - - if (nsig == NULL) - membernr = -1; - } - - if (!is_signals) - { - is_signals = TRUE; - - prcode(fp, -"\n" -"\n" -"/* Define this type's PyQt4 signals. */\n" -"static const pyqt4QtSignal pyqt4_signals_%C[] = {\n" - , classFTQCName(cd)); - } - - /* - * Default arguments are handled as multiple signals. We make - * sure the largest is first and the smallest last. - */ - generateSignalTableEntry(pt, cd, od, md, membernr, fp); - membernr = -1; - - nr_args = od->cppsig->nrArgs; - - for (a = nr_args - 1; a >= 0; --a) - { - if (od->cppsig->args[a].defval == NULL) - break; - - od->cppsig->nrArgs = a; - generateSignalTableEntry(pt, cd, od, md, -1, fp); - } - - od->cppsig->nrArgs = nr_args; - } - } - - if (is_signals) - prcode(fp, -" {0, 0, 0}\n" -"};\n" - ); - } - /* Generate the variable handlers. */ nr_vars = 0; @@ -8751,12 +8578,7 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp) has_docstring = TRUE; } - if (pluginPyQt4(pt)) - { - type_prefix = "pyqt4"; - embedded = TRUE; - } - else if (pluginPyTQt(pt)) + if (pluginPyTQt(pt)) { type_prefix = "pytqt"; embedded = TRUE; @@ -9108,31 +8930,6 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp) ); } - if (pluginPyQt4(pt)) - { - if (isTQObjectSubClass(cd) && !noPyQt4TQMetaObject(cd)) - prcode(fp, -" &%U::staticMetaObject,\n" - , cd); - else - prcode(fp, -" 0,\n" - ); - - prcode(fp, -" %u,\n" - , cd->pyqt4_flags); - - if (is_signals) - prcode(fp, -" pyqt4_signals_%C\n" - , classFTQCName(cd)); - else - prcode(fp, -" 0\n" - ); - } - prcode(fp, "};\n" ); @@ -9140,43 +8937,6 @@ static void generateTypeDefinition(sipSpec *pt, classDef *cd, FILE *fp) /* - * Generate an entry in the PyQt4 signal table. - */ -static void generateSignalTableEntry(sipSpec *pt, classDef *cd, overDef *sig, - memberDef *md, int membernr, FILE *fp) -{ - prcode(fp, -" {\"%s(", sig->cppname); - - generateCalledArgs(cd->iff, sig->cppsig, Declaration, TRUE, fp); - - prcode(fp,")\", "); - - if (docstrings) - { - fprintf(fp, "\"\\1"); - prScopedPythonName(fp, cd->ecd, cd->pyname->text); - fprintf(fp, ".%s", md->pyname->text); - prPythonSignature(pt, fp, &sig->pysig, FALSE, FALSE, FALSE, FALSE, - TRUE); - fprintf(fp, "\", "); - } - else - { - prcode(fp, "0, "); - } - - if (membernr >= 0) - prcode(fp, "&methods_%L[%d]", cd->iff, membernr); - else - prcode(fp, "0"); - - prcode(fp,"},\n" - ); -} - - -/* * Return the sip module's string equivalent of a slot. */ static const char *slotName(slotType st) diff --git a/sipgen/parser.y b/sipgen/parser.y index da83b35..7670cab 100644 --- a/sipgen/parser.y +++ b/sipgen/parser.y @@ -3262,12 +3262,6 @@ static void finishClass(sipSpec *pt, moduleDef *mod, classDef *cd, if ((flg = findOptFlag(of, "Supertype", dotted_name_flag)) != NULL) cd->supertype = cacheName(pt, flg->fvalue.sval); - if ((flg = findOptFlag(of, "PyQt4Flags", integer_flag)) != NULL) - cd->pyqt4_flags = flg->fvalue.ival; - - if (findOptFlag(of, "PyQt4NoQMetaObject", bool_flag) != NULL) - setPyQt4NoTQMetaObject(cd); - if (isOpaque(cd)) { if (findOptFlag(of, "External", bool_flag) != NULL) @@ -6069,15 +6063,6 @@ int pluginPyTQt(sipSpec *pt) /* - * Return TRUE if the PyQt4 plugin was specified. - */ -int pluginPyQt4(sipSpec *pt) -{ - return stringFind(pt->plugins, "PyQt4"); -} - - -/* * Return TRUE if a list of strings contains a given entry. */ static int stringFind(stringList *sl, const char *s) diff --git a/sipgen/sip.h b/sipgen/sip.h index 5e4a79e..905f319 100644 --- a/sipgen/sip.h +++ b/sipgen/sip.h @@ -137,8 +137,6 @@ #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 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 +987,6 @@ typedef struct _mroDef { typedef struct _classDef { int classflags; /* The class flags. */ - int pyqt4_flags; /* The PyQt4 specific flags. */ nameDef *pyname; /* The Python name. */ ifaceFileDef *iff; /* The interface file. */ struct _classDef *ecd; /* The enclosing scope. */ @@ -1140,7 +1137,6 @@ ifaceFileDef *findIfaceFile(sipSpec *pt, moduleDef *mod, scopedNameDef *fqname, ifaceFileType iftype, apiVersionRangeDef *api_range, argDef *ad); int pluginPyTQt(sipSpec *pt); -int pluginPyQt4(sipSpec *pt); void yywarning(char *); nameDef *cacheName(sipSpec *pt, const char *name); scopedNameDef *encodedTemplateName(templateDef *td); |