Replace various strings '#define'd in tqtinterface

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/31/head
Michele Calgaro 1 year ago
parent 8e834e227d
commit 062982a6c9
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -148,7 +148,7 @@ void *value_to_ptr(VALUE ruby_value) { // ptr on success, null on fail
VALUE getPointerObject(void *ptr);
bool isTQObject(Smoke *smoke, Smoke::Index classId) {
if(tqstrcmp(smoke->classes[classId].className, "TQObject") == 0)
if(qstrcmp(smoke->classes[classId].className, "TQObject") == 0)
return true;
for(Smoke::Index *p = smoke->inheritanceList + smoke->classes[classId].parents;
*p;
@ -356,7 +356,7 @@ public:
void unsupported() {
rb_raise(rb_eArgError, "Cannot handle '%s' as return-type of %s::%s",
type().name(),
tqstrcmp(_smoke->className(method().classId), "TQGlobalSpace") == 0 ? "" : _smoke->className(method().classId),
qstrcmp(_smoke->className(method().classId), "TQGlobalSpace") == 0 ? "" : _smoke->className(method().classId),
_smoke->methodNames[method().name]);
}
Smoke *smoke() { return _smoke; }
@ -421,7 +421,7 @@ public:
}
void unsupported() {
if (tqstrcmp(_smoke->className(method().classId), "TQGlobalSpace") == 0) {
if (qstrcmp(_smoke->className(method().classId), "TQGlobalSpace") == 0) {
rb_raise(rb_eArgError, "Cannot handle '%s' as argument to %s",
type().name(),
_smoke->methodNames[method().name]);
@ -964,15 +964,15 @@ get_VALUEtype(VALUE ruby_value)
const char *r = "";
if(ruby_value == Qnil)
r = "u";
else if(TYPE(ruby_value) == T_FIXNUM || TYPE(ruby_value) == T_BIGNUM || tqstrcmp(classname, "TQt::Integer") == 0)
else if(TYPE(ruby_value) == T_FIXNUM || TYPE(ruby_value) == T_BIGNUM || qstrcmp(classname, "TQt::Integer") == 0)
r = "i";
else if(TYPE(ruby_value) == T_FLOAT)
r = "n";
else if(TYPE(ruby_value) == T_STRING)
r = "s";
else if(ruby_value == Qtrue || ruby_value == Qfalse || tqstrcmp(classname, "TQt::Boolean") == 0)
else if(ruby_value == Qtrue || ruby_value == Qfalse || qstrcmp(classname, "TQt::Boolean") == 0)
r = "B";
else if(tqstrcmp(classname, "TQt::Enum") == 0) {
else if(qstrcmp(classname, "TQt::Enum") == 0) {
VALUE temp = rb_funcall(qt_internal_module, rb_intern("get_qenum_type"), 1, ruby_value);
r = StringValuePtr(temp);
} else if(TYPE(ruby_value) == T_DATA) {
@ -1375,9 +1375,9 @@ static Smoke::Index new_qvariant_qmap = 0;
while (qt_Smoke->ambiguousMethodList[i] != 0) {
const char * argType = qt_Smoke->types[qt_Smoke->argumentList[qt_Smoke->methods[qt_Smoke->ambiguousMethodList[i]].args]].name;
if (tqstrcmp(argType, "const TQValueList<TQVariant>&" ) == 0) {
if (qstrcmp(argType, "const TQValueList<TQVariant>&" ) == 0) {
new_qvariant_qlist = qt_Smoke->ambiguousMethodList[i];
} else if (tqstrcmp(argType, "const TQStringVariantMap&" ) == 0) {
} else if (qstrcmp(argType, "const TQStringVariantMap&" ) == 0) {
new_qvariant_qmap = qt_Smoke->ambiguousMethodList[i];
}
@ -1493,11 +1493,11 @@ static TQString * pred = 0;
VALUE retval = rb_funcall2(qt_internal_module, rb_intern("do_method_missing"), argc+3, temp_stack);
if (_current_method == -1) {
const char * op = rb_id2name(SYM2ID(argv[0]));
if ( tqstrcmp(op, "-") == 0
|| tqstrcmp(op, "+") == 0
|| tqstrcmp(op, "/") == 0
|| tqstrcmp(op, "%") == 0
|| tqstrcmp(op, "|") == 0 )
if ( qstrcmp(op, "-") == 0
|| qstrcmp(op, "+") == 0
|| qstrcmp(op, "/") == 0
|| qstrcmp(op, "%") == 0
|| qstrcmp(op, "|") == 0 )
{
// Look for operator methods of the form 'operator+=', 'operator-=' and so on..
char op1[3];
@ -1872,7 +1872,7 @@ tqt_invoke(int /*argc*/, VALUE * argv, VALUE self)
// Now, I need to find out if this means me
int index;
char *slotname;
bool isSignal = tqstrcmp(rb_id2name(rb_frame_this_func()), "qt_emit") == 0;
bool isSignal = qstrcmp(rb_id2name(rb_frame_this_func()), "qt_emit") == 0;
VALUE mocArgs = getslotinfo(self, id, slotname, index, isSignal);
if(mocArgs == Qnil) {
// No ruby slot/signal found, assume the target is a C++ one
@ -2050,17 +2050,17 @@ setMocType(VALUE /*self*/, VALUE ptr, VALUE idx_value, VALUE name_value, VALUE s
MocArgument *arg = 0;
Data_Get_Struct(ptr, MocArgument, arg);
arg[idx].st.set(qt_Smoke, typeId);
if(tqstrcmp(static_type, "ptr") == 0)
if(qstrcmp(static_type, "ptr") == 0)
arg[idx].argType = xmoc_ptr;
else if(tqstrcmp(static_type, "bool") == 0)
else if(qstrcmp(static_type, "bool") == 0)
arg[idx].argType = xmoc_bool;
else if(tqstrcmp(static_type, "int") == 0)
else if(qstrcmp(static_type, "int") == 0)
arg[idx].argType = xmoc_int;
else if(tqstrcmp(static_type, "double") == 0)
else if(qstrcmp(static_type, "double") == 0)
arg[idx].argType = xmoc_double;
else if(tqstrcmp(static_type, "char*") == 0)
else if(qstrcmp(static_type, "char*") == 0)
arg[idx].argType = xmoc_charstar;
else if(tqstrcmp(static_type, "TQString") == 0)
else if(qstrcmp(static_type, "TQString") == 0)
arg[idx].argType = xmoc_QString;
return Qtrue;
}
@ -2166,16 +2166,16 @@ make_QUParameter(VALUE /*self*/, VALUE name_value, VALUE type_value, VALUE /*ext
TQUParameter *p = new TQUParameter;
p->name = new char[strlen(name) + 1];
strcpy((char*)p->name, name);
if(tqstrcmp(type, "bool") == 0)
if(qstrcmp(type, "bool") == 0)
p->type = &static_QUType_bool;
else if(tqstrcmp(type, "int") == 0)
else if(qstrcmp(type, "int") == 0)
p->type = &static_QUType_int;
else if(tqstrcmp(type, "double") == 0)
else if(qstrcmp(type, "double") == 0)
p->type = &static_QUType_double;
else if(tqstrcmp(type, "char*") == 0 || tqstrcmp(type, "const char*") == 0)
else if(qstrcmp(type, "char*") == 0 || qstrcmp(type, "const char*") == 0)
p->type = &static_QUType_charstar;
else if(tqstrcmp(type, "TQString") == 0 || tqstrcmp(type, "TQString&") == 0 ||
tqstrcmp(type, "const TQString") == 0 || tqstrcmp(type, "const TQString&") == 0)
else if(qstrcmp(type, "TQString") == 0 || qstrcmp(type, "TQString&") == 0 ||
qstrcmp(type, "const TQString") == 0 || qstrcmp(type, "const TQString&") == 0)
p->type = &static_QUType_TQString;
else
p->type = &static_QUType_ptr;
@ -2513,10 +2513,10 @@ findAllMethods(int argc, VALUE * argv, VALUE /*self*/)
#define PUSH_QTRUBY_METHOD \
if ( (methodRef.flags & (Smoke::mf_internal|Smoke::mf_ctor|Smoke::mf_dtor)) == 0 \
&& tqstrcmp(qt_Smoke->methodNames[methodRef.name], "operator=") != 0 \
&& tqstrcmp(qt_Smoke->methodNames[methodRef.name], "operator!=") != 0 \
&& tqstrcmp(qt_Smoke->methodNames[methodRef.name], "operator--") != 0 \
&& tqstrcmp(qt_Smoke->methodNames[methodRef.name], "operator++") != 0 \
&& qstrcmp(qt_Smoke->methodNames[methodRef.name], "operator=") != 0 \
&& qstrcmp(qt_Smoke->methodNames[methodRef.name], "operator!=") != 0 \
&& qstrcmp(qt_Smoke->methodNames[methodRef.name], "operator--") != 0 \
&& qstrcmp(qt_Smoke->methodNames[methodRef.name], "operator++") != 0 \
&& tqstrncmp(qt_Smoke->methodNames[methodRef.name], "operator ", strlen("operator ")) != 0 \
&& ( (flags == 0 && (methodRef.flags & (Smoke::mf_static|Smoke::mf_enum|Smoke::mf_protected)) == 0) \
|| ( flags == Smoke::mf_static \
@ -2747,7 +2747,7 @@ create_qobject_class(VALUE /*self*/, VALUE package_value)
if (TQString(package).startsWith("TQt::")) {
klass = rb_define_class_under(qt_module, package+strlen("TQt::"), qt_base_class);
if (tqstrcmp(package, "TQt::Application") == 0) {
if (qstrcmp(package, "TQt::Application") == 0) {
rb_define_singleton_method(klass, "new", (VALUE (*) (...)) new_qapplication, -1);
rb_define_method(klass, "ARGV", (VALUE (*) (...)) qapplication_argv, 0);
}
@ -2788,16 +2788,16 @@ create_qt_class(VALUE /*self*/, VALUE package_value)
klass = kde_package_to_class(package, qt_base_class);
}
if (tqstrcmp(package, "TQt::MetaObject") == 0) {
if (qstrcmp(package, "TQt::MetaObject") == 0) {
qmetaobject_class = klass;
} else if (tqstrcmp(package, "TQt::Variant") == 0) {
} else if (qstrcmp(package, "TQt::Variant") == 0) {
qvariant_class = klass;
rb_define_singleton_method(qvariant_class, "new", (VALUE (*) (...)) new_qvariant, -1);
} else if (tqstrcmp(package, "TQt::ByteArray") == 0) {
} else if (qstrcmp(package, "TQt::ByteArray") == 0) {
rb_define_method(klass, "data", (VALUE (*) (...)) qbytearray_data, 0);
rb_define_method(klass, "size", (VALUE (*) (...)) qbytearray_size, 0);
rb_define_method(klass, "setRawData", (VALUE (*) (...)) qbytearray_setRawData, 1);
} else if (tqstrcmp(package, "TQt::Char") == 0) {
} else if (qstrcmp(package, "TQt::Char") == 0) {
rb_define_method(klass, "to_s", (VALUE (*) (...)) qchar_to_s, 0);
}

@ -194,15 +194,15 @@ smokeruby_free(void * p)
unmapPointer(o, o->classId, 0);
object_count --;
if ( tqstrcmp(className, "TQObject") == 0
|| tqstrcmp(className, "TQListBoxItem") == 0
|| tqstrcmp(className, "TQStyleSheetItem") == 0
|| tqstrcmp(className, "KCommand") == 0
|| tqstrcmp(className, "KNamedCommand") == 0
|| tqstrcmp(className, "KMacroCommand") == 0
|| tqstrcmp(className, "TDEAboutData") == 0
|| tqstrcmp(className, "TDECmdLineArgs") == 0
|| tqstrcmp(className, "TQSqlCursor") == 0 )
if ( qstrcmp(className, "TQObject") == 0
|| qstrcmp(className, "TQListBoxItem") == 0
|| qstrcmp(className, "TQStyleSheetItem") == 0
|| qstrcmp(className, "KCommand") == 0
|| qstrcmp(className, "KNamedCommand") == 0
|| qstrcmp(className, "KMacroCommand") == 0
|| qstrcmp(className, "TDEAboutData") == 0
|| qstrcmp(className, "TDECmdLineArgs") == 0
|| qstrcmp(className, "TQSqlCursor") == 0 )
{
// Don't delete instances of these classes for now
free(o);
@ -213,19 +213,19 @@ smokeruby_free(void * p)
free(o);
return;
}
} else if (tqstrcmp(className, "TQIconViewItem") == 0) {
} else if (qstrcmp(className, "TQIconViewItem") == 0) {
TQIconViewItem * item = (TQIconViewItem *) o->ptr;
if (item->iconView() != 0) {
free(o);
return;
}
} else if (tqstrcmp(className, "TQCheckListItem") == 0) {
} else if (qstrcmp(className, "TQCheckListItem") == 0) {
TQCheckListItem * item = (TQCheckListItem *) o->ptr;
if (item->parent() != 0 || item->listView() != 0) {
free(o);
return;
}
} else if (tqstrcmp(className, "TQListViewItem") == 0) {
} else if (qstrcmp(className, "TQListViewItem") == 0) {
TQListViewItem * item = (TQListViewItem *) o->ptr;
if (item->parent() != 0 || item->listView() != 0) {
free(o);
@ -237,7 +237,7 @@ smokeruby_free(void * p)
free(o);
return;
}
} else if (tqstrcmp(className, "TQPopupMenu") == 0) {
} else if (qstrcmp(className, "TQPopupMenu") == 0) {
TQPopupMenu * item = (TQPopupMenu *) o->ptr;
if (item->parentWidget(false) != 0) {
free(o);
@ -411,7 +411,7 @@ matches_arg(Smoke *smoke, Smoke::Index meth, Smoke::Index argidx, const char *ar
{
Smoke::Index *arg = smoke->argumentList + smoke->methods[meth].args + argidx;
SmokeType type = SmokeType(smoke, *arg);
return type.name() && tqstrcmp(type.name(), argtype) == 0;
return type.name() && qstrcmp(type.name(), argtype) == 0;
}
void *
@ -819,9 +819,9 @@ static void
init_codec() {
VALUE temp = rb_gv_get("$KCODE");
KCODE = StringValuePtr(temp);
if (tqstrcmp(KCODE, "EUC") == 0) {
if (qstrcmp(KCODE, "EUC") == 0) {
codec = TQTextCodec::codecForName("eucJP");
} else if (tqstrcmp(KCODE, "SJIS") == 0) {
} else if (qstrcmp(KCODE, "SJIS") == 0) {
codec = TQTextCodec::codecForName("Shift-JIS");
}
}
@ -833,13 +833,13 @@ qstringFromRString(VALUE rstring) {
}
TQString * s;
if (tqstrcmp(KCODE, "UTF8") == 0)
if (qstrcmp(KCODE, "UTF8") == 0)
s = new TQString(TQString::fromUtf8(StringValuePtr(rstring), RSTRING_LEN(rstring)));
else if (tqstrcmp(KCODE, "EUC") == 0)
else if (qstrcmp(KCODE, "EUC") == 0)
s = new TQString(codec->toUnicode(StringValuePtr(rstring)));
else if (tqstrcmp(KCODE, "SJIS") == 0)
else if (qstrcmp(KCODE, "SJIS") == 0)
s = new TQString(codec->toUnicode(StringValuePtr(rstring)));
else if(tqstrcmp(KCODE, "NONE") == 0)
else if(qstrcmp(KCODE, "NONE") == 0)
s = new TQString(TQString::fromLatin1(StringValuePtr(rstring)));
else
s = new TQString(TQString::fromLocal8Bit(StringValuePtr(rstring), RSTRING_LEN(rstring)));
@ -852,13 +852,13 @@ rstringFromTQString(TQString * s) {
init_codec();
}
if (tqstrcmp(KCODE, "UTF8") == 0)
if (qstrcmp(KCODE, "UTF8") == 0)
return rb_str_new2(s->utf8());
else if (tqstrcmp(KCODE, "EUC") == 0)
else if (qstrcmp(KCODE, "EUC") == 0)
return rb_str_new2(codec->fromUnicode(*s));
else if (tqstrcmp(KCODE, "SJIS") == 0)
else if (qstrcmp(KCODE, "SJIS") == 0)
return rb_str_new2(codec->fromUnicode(*s));
else if (tqstrcmp(KCODE, "NONE") == 0)
else if (qstrcmp(KCODE, "NONE") == 0)
return rb_str_new2(s->latin1());
else
return rb_str_new2(s->local8Bit());
@ -1789,7 +1789,7 @@ void marshall_ValueItemList(Marshall *m) {
smokeruby_object *o = value_obj_info(item);
// Special case for the TQValueList<TQVariant> type
if ( tqstrcmp(ItemSTR, "TQVariant") == 0
if ( qstrcmp(ItemSTR, "TQVariant") == 0
&& (!o || !o->ptr || o->classId != o->smoke->idClass("TQVariant")) )
{
// If the value isn't a TQt::Variant, then try and construct

@ -66,7 +66,7 @@ public:
bool operator ==(const SmokeType &b) const {
const SmokeType &a = *this;
if(a.name() == b.name()) return true;
if(a.name() && b.name() && tqstrcmp(a.name(), b.name()) == 0)
if(a.name() && b.name() && qstrcmp(a.name(), b.name()) == 0)
return true;
return false;
}
@ -100,7 +100,7 @@ public:
bool operator ==(const SmokeClass &b) const {
const SmokeClass &a = *this;
if(a.className() == b.className()) return true;
if(a.className() && b.className() && tqstrcmp(a.className(), b.className()) == 0)
if(a.className() && b.className() && qstrcmp(a.className(), b.className()) == 0)
return true;
return false;
}

Loading…
Cancel
Save