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