|
Lines 110-116
Link Here
|
| 110 |
}; |
110 |
}; |
| 111 |
|
111 |
|
| 112 |
#define logger logger_backend |
112 |
#define logger logger_backend |
| 113 |
void rb_str_catf(VALUE self, const char *format, ...) __attribute__ ((format (printf, 2, 3))); |
113 |
void rb_str_catf_1(VALUE self, const char *format, ...) __attribute__ ((format (printf, 2, 3))); |
| 114 |
|
114 |
|
| 115 |
static VALUE (*_new_kde)(int, VALUE *, VALUE) = 0; |
115 |
static VALUE (*_new_kde)(int, VALUE *, VALUE) = 0; |
| 116 |
static VALUE (*_kconfigskeletonitem_immutable)(VALUE) = 0; |
116 |
static VALUE (*_kconfigskeletonitem_immutable)(VALUE) = 0; |
|
Lines 820-826
Link Here
|
| 820 |
} |
820 |
} |
| 821 |
}; |
821 |
}; |
| 822 |
|
822 |
|
| 823 |
void rb_str_catf(VALUE self, const char *format, ...) |
823 |
void rb_str_catf_1(VALUE self, const char *format, ...) |
| 824 |
{ |
824 |
{ |
| 825 |
va_list ap; |
825 |
va_list ap; |
| 826 |
va_start(ap, format); |
826 |
va_start(ap, format); |
|
Lines 985-1000
Link Here
|
| 985 |
VALUE r = rb_str_new2(""); |
985 |
VALUE r = rb_str_new2(""); |
| 986 |
Smoke::Method &meth = qt_Smoke->methods[id]; |
986 |
Smoke::Method &meth = qt_Smoke->methods[id]; |
| 987 |
const char *tname = qt_Smoke->types[meth.ret].name; |
987 |
const char *tname = qt_Smoke->types[meth.ret].name; |
| 988 |
if(meth.flags & Smoke::mf_static) rb_str_catf(r, "static "); |
988 |
if(meth.flags & Smoke::mf_static) rb_str_catf_1(r, "static "); |
| 989 |
rb_str_catf(r, "%s ", (tname ? tname:"void")); |
989 |
rb_str_catf_1(r, "%s ", (tname ? tname:"void")); |
| 990 |
rb_str_catf(r, "%s::%s(", qt_Smoke->classes[meth.classId].className, qt_Smoke->methodNames[meth.name]); |
990 |
rb_str_catf_1(r, "%s::%s(", qt_Smoke->classes[meth.classId].className, qt_Smoke->methodNames[meth.name]); |
| 991 |
for(int i = 0; i < meth.numArgs; i++) { |
991 |
for(int i = 0; i < meth.numArgs; i++) { |
| 992 |
if(i) rb_str_catf(r, ", "); |
992 |
if(i) rb_str_catf_1(r, ", "); |
| 993 |
tname = qt_Smoke->types[qt_Smoke->argumentList[meth.args+i]].name; |
993 |
tname = qt_Smoke->types[qt_Smoke->argumentList[meth.args+i]].name; |
| 994 |
rb_str_catf(r, "%s", (tname ? tname:"void")); |
994 |
rb_str_catf_1(r, "%s", (tname ? tname:"void")); |
| 995 |
} |
995 |
} |
| 996 |
rb_str_catf(r, ")"); |
996 |
rb_str_catf_1(r, ")"); |
| 997 |
if(meth.flags & Smoke::mf_const) rb_str_catf(r, " const"); |
997 |
if(meth.flags & Smoke::mf_const) rb_str_catf_1(r, " const"); |
| 998 |
return r; |
998 |
return r; |
| 999 |
} |
999 |
} |
| 1000 |
|
1000 |
|
|
Lines 1177-1183
Link Here
|
| 1177 |
// Start with #<TQt::HBoxLayout:0x30139030> from the original inspect() call |
1177 |
// Start with #<TQt::HBoxLayout:0x30139030> from the original inspect() call |
| 1178 |
// Drop the closing '>' |
1178 |
// Drop the closing '>' |
| 1179 |
VALUE inspect_str = rb_call_super(0, 0); |
1179 |
VALUE inspect_str = rb_call_super(0, 0); |
| 1180 |
rb_str_resize(inspect_str, RSTRING(inspect_str)->len - 1); |
1180 |
rb_str_resize(inspect_str, RSTRING_LEN(inspect_str) - 1); |
| 1181 |
|
1181 |
|
| 1182 |
smokeruby_object * o = 0; |
1182 |
smokeruby_object * o = 0; |
| 1183 |
Data_Get_Struct(self, smokeruby_object, o); |
1183 |
Data_Get_Struct(self, smokeruby_object, o); |
|
Lines 1220-1226
Link Here
|
| 1220 |
// Start with #<TQt::HBoxLayout:0x30139030> |
1220 |
// Start with #<TQt::HBoxLayout:0x30139030> |
| 1221 |
// Drop the closing '>' |
1221 |
// Drop the closing '>' |
| 1222 |
VALUE inspect_str = rb_funcall(self, rb_intern("to_s"), 0, 0); |
1222 |
VALUE inspect_str = rb_funcall(self, rb_intern("to_s"), 0, 0); |
| 1223 |
rb_str_resize(inspect_str, RSTRING(inspect_str)->len - 1); |
1223 |
rb_str_resize(inspect_str, RSTRING_LEN(inspect_str) - 1); |
| 1224 |
rb_funcall(pp, rb_intern("text"), 1, inspect_str); |
1224 |
rb_funcall(pp, rb_intern("text"), 1, inspect_str); |
| 1225 |
rb_funcall(pp, rb_intern("breakable"), 0); |
1225 |
rb_funcall(pp, rb_intern("breakable"), 0); |
| 1226 |
|
1226 |
|
|
Lines 1236-1242
Link Here
|
| 1236 |
VALUE obj = getPointerObject(qobject->parent()); |
1236 |
VALUE obj = getPointerObject(qobject->parent()); |
| 1237 |
if (obj != Qnil) { |
1237 |
if (obj != Qnil) { |
| 1238 |
VALUE parent_inspect_str = rb_funcall(obj, rb_intern("to_s"), 0, 0); |
1238 |
VALUE parent_inspect_str = rb_funcall(obj, rb_intern("to_s"), 0, 0); |
| 1239 |
rb_str_resize(parent_inspect_str, RSTRING(parent_inspect_str)->len - 1); |
1239 |
rb_str_resize(parent_inspect_str, RSTRING_LEN(parent_inspect_str) - 1); |
| 1240 |
parentInspectString = StringValuePtr(parent_inspect_str); |
1240 |
parentInspectString = StringValuePtr(parent_inspect_str); |
| 1241 |
} else { |
1241 |
} else { |
| 1242 |
parentInspectString.sprintf("#<%s:0x0", qobject->parent()->className()); |
1242 |
parentInspectString.sprintf("#<%s:0x0", qobject->parent()->className()); |
|
Lines 1382-1388
Link Here
|
| 1382 |
return *(c.var()); |
1382 |
return *(c.var()); |
| 1383 |
} else if ( argc == 1 |
1383 |
} else if ( argc == 1 |
| 1384 |
&& TYPE(argv[0]) == T_ARRAY |
1384 |
&& TYPE(argv[0]) == T_ARRAY |
| 1385 |
&& RARRAY(argv[0])->len > 0 |
1385 |
&& RARRAY_LEN(argv[0]) > 0 |
| 1386 |
&& TYPE(rb_ary_entry(argv[0], 0)) != T_STRING ) |
1386 |
&& TYPE(rb_ary_entry(argv[0], 0)) != T_STRING ) |
| 1387 |
{ |
1387 |
{ |
| 1388 |
_current_method = new_qvariant_qlist; |
1388 |
_current_method = new_qvariant_qlist; |
|
Lines 1741-1747
Link Here
|
| 1741 |
VALUE * local_argv = (VALUE *) calloc(argc + 1, sizeof(VALUE)); |
1741 |
VALUE * local_argv = (VALUE *) calloc(argc + 1, sizeof(VALUE)); |
| 1742 |
VALUE temp = rb_ary_dup(argv[0]); |
1742 |
VALUE temp = rb_ary_dup(argv[0]); |
| 1743 |
rb_ary_unshift(temp, rb_gv_get("$0")); |
1743 |
rb_ary_unshift(temp, rb_gv_get("$0")); |
| 1744 |
local_argv[0] = INT2NUM(RARRAY(temp)->len); |
1744 |
local_argv[0] = INT2NUM(RARRAY_LEN(temp)); |
| 1745 |
local_argv[1] = temp; |
1745 |
local_argv[1] = temp; |
| 1746 |
result = new_qt(2, local_argv, klass); |
1746 |
result = new_qt(2, local_argv, klass); |
| 1747 |
free(local_argv); |
1747 |
free(local_argv); |
|
Lines 1772-1778
Link Here
|
| 1772 |
VALUE |
1772 |
VALUE |
| 1773 |
getmetainfo(VALUE self, int &offset, int &index) |
1773 |
getmetainfo(VALUE self, int &offset, int &index) |
| 1774 |
{ |
1774 |
{ |
| 1775 |
const char * signalname = rb_id2name(rb_frame_last_func()); |
1775 |
const char * signalname = rb_id2name(rb_frame_this_func()); |
| 1776 |
VALUE metaObject_value = rb_funcall(qt_internal_module, rb_intern("getMetaObject"), 1, self); |
1776 |
VALUE metaObject_value = rb_funcall(qt_internal_module, rb_intern("getMetaObject"), 1, self); |
| 1777 |
|
1777 |
|
| 1778 |
smokeruby_object *ometa = value_obj_info(metaObject_value); |
1778 |
smokeruby_object *ometa = value_obj_info(metaObject_value); |
|
Lines 1862-1868
Link Here
|
| 1862 |
// Now, I need to find out if this means me |
1862 |
// Now, I need to find out if this means me |
| 1863 |
int index; |
1863 |
int index; |
| 1864 |
char *slotname; |
1864 |
char *slotname; |
| 1865 |
bool isSignal = tqstrcmp(rb_id2name(rb_frame_last_func()), "qt_emit") == 0; |
1865 |
bool isSignal = tqstrcmp(rb_id2name(rb_frame_this_func()), "qt_emit") == 0; |
| 1866 |
VALUE mocArgs = getslotinfo(self, id, slotname, index, isSignal); |
1866 |
VALUE mocArgs = getslotinfo(self, id, slotname, index, isSignal); |
| 1867 |
if(mocArgs == Qnil) { |
1867 |
if(mocArgs == Qnil) { |
| 1868 |
// No ruby slot/signal found, assume the target is a C++ one |
1868 |
// No ruby slot/signal found, assume the target is a C++ one |
|
Lines 2009-2015
Link Here
|
| 2009 |
return Qnil; |
2009 |
return Qnil; |
| 2010 |
} |
2010 |
} |
| 2011 |
TQByteArray * dataArray = (TQByteArray*) o->ptr; |
2011 |
TQByteArray * dataArray = (TQByteArray*) o->ptr; |
| 2012 |
dataArray->setRawData(StringValuePtr(data), RSTRING(data)->len); |
2012 |
dataArray->setRawData(StringValuePtr(data), RSTRING_LEN(data)); |
| 2013 |
return self; |
2013 |
return self; |
| 2014 |
} |
2014 |
} |
| 2015 |
|
2015 |
|
|
Lines 2195-2201
Link Here
|
| 2195 |
m->name = new char[strlen(name) + 1]; // this too |
2195 |
m->name = new char[strlen(name) + 1]; // this too |
| 2196 |
strcpy((char*)m->name, name); |
2196 |
strcpy((char*)m->name, name); |
| 2197 |
m->parameters = 0; |
2197 |
m->parameters = 0; |
| 2198 |
m->count = RARRAY(params)->len; |
2198 |
m->count = RARRAY_LEN(params); |
| 2199 |
|
2199 |
|
| 2200 |
if (m->count > 0) { |
2200 |
if (m->count > 0) { |
| 2201 |
m->parameters = new TQUParameter[m->count]; |
2201 |
m->parameters = new TQUParameter[m->count]; |
|
Lines 2213-2219
Link Here
|
| 2213 |
static VALUE |
2213 |
static VALUE |
| 2214 |
make_QMetaData_tbl(VALUE /*self*/, VALUE list) |
2214 |
make_QMetaData_tbl(VALUE /*self*/, VALUE list) |
| 2215 |
{ |
2215 |
{ |
| 2216 |
long count = RARRAY(list)->len; |
2216 |
long count = RARRAY_LEN(list); |
| 2217 |
TQMetaData *m = new TQMetaData[count]; |
2217 |
TQMetaData *m = new TQMetaData[count]; |
| 2218 |
|
2218 |
|
| 2219 |
for (long i = 0; i < count; i++) { |
2219 |
for (long i = 0; i < count; i++) { |
|
Lines 2281-2287
Link Here
|
| 2281 |
static VALUE |
2281 |
static VALUE |
| 2282 |
add_signal_methods(VALUE self, VALUE klass, VALUE signalNames) |
2282 |
add_signal_methods(VALUE self, VALUE klass, VALUE signalNames) |
| 2283 |
{ |
2283 |
{ |
| 2284 |
for (long index = 0; index < RARRAY(signalNames)->len; index++) { |
2284 |
for (long index = 0; index < RARRAY_LEN(signalNames); index++) { |
| 2285 |
VALUE signal = rb_ary_entry(signalNames, index); |
2285 |
VALUE signal = rb_ary_entry(signalNames, index); |
| 2286 |
rb_define_method(klass, StringValuePtr(signal), (VALUE (*) (...)) qt_signal, -1); |
2286 |
rb_define_method(klass, StringValuePtr(signal), (VALUE (*) (...)) qt_signal, -1); |
| 2287 |
} |
2287 |
} |
|
Lines 2597-2624
Link Here
|
| 2597 |
{ |
2597 |
{ |
| 2598 |
VALUE errmsg = rb_str_new2(""); |
2598 |
VALUE errmsg = rb_str_new2(""); |
| 2599 |
if(rmeths != Qnil) { |
2599 |
if(rmeths != Qnil) { |
| 2600 |
int count = RARRAY(rmeths)->len; |
2600 |
int count = RARRAY_LEN(rmeths); |
| 2601 |
for(int i = 0; i < count; i++) { |
2601 |
for(int i = 0; i < count; i++) { |
| 2602 |
rb_str_catf(errmsg, "\t"); |
2602 |
rb_str_catf_1(errmsg, "\t"); |
| 2603 |
int id = NUM2INT(rb_ary_entry(rmeths, i)); |
2603 |
int id = NUM2INT(rb_ary_entry(rmeths, i)); |
| 2604 |
Smoke::Method &meth = qt_Smoke->methods[id]; |
2604 |
Smoke::Method &meth = qt_Smoke->methods[id]; |
| 2605 |
const char *tname = qt_Smoke->types[meth.ret].name; |
2605 |
const char *tname = qt_Smoke->types[meth.ret].name; |
| 2606 |
if(meth.flags & Smoke::mf_enum) { |
2606 |
if(meth.flags & Smoke::mf_enum) { |
| 2607 |
rb_str_catf(errmsg, "enum "); |
2607 |
rb_str_catf_1(errmsg, "enum "); |
| 2608 |
rb_str_catf(errmsg, "%s::%s", qt_Smoke->classes[meth.classId].className, qt_Smoke->methodNames[meth.name]); |
2608 |
rb_str_catf_1(errmsg, "%s::%s", qt_Smoke->classes[meth.classId].className, qt_Smoke->methodNames[meth.name]); |
| 2609 |
rb_str_catf(errmsg, "\n"); |
2609 |
rb_str_catf_1(errmsg, "\n"); |
| 2610 |
} else { |
2610 |
} else { |
| 2611 |
if(meth.flags & Smoke::mf_static) rb_str_catf(errmsg, "static "); |
2611 |
if(meth.flags & Smoke::mf_static) rb_str_catf(errmsg, "static "); |
| 2612 |
rb_str_catf(errmsg, "%s ", (tname ? tname:"void")); |
2612 |
rb_str_catf_1(errmsg, "%s ", (tname ? tname:"void")); |
| 2613 |
rb_str_catf(errmsg, "%s::%s(", qt_Smoke->classes[meth.classId].className, qt_Smoke->methodNames[meth.name]); |
2613 |
rb_str_catf_1(errmsg, "%s::%s(", qt_Smoke->classes[meth.classId].className, qt_Smoke->methodNames[meth.name]); |
| 2614 |
for(int i = 0; i < meth.numArgs; i++) { |
2614 |
for(int i = 0; i < meth.numArgs; i++) { |
| 2615 |
if(i) rb_str_catf(errmsg, ", "); |
2615 |
if(i) rb_str_catf_1(errmsg, ", "); |
| 2616 |
tname = qt_Smoke->types[qt_Smoke->argumentList[meth.args+i]].name; |
2616 |
tname = qt_Smoke->types[qt_Smoke->argumentList[meth.args+i]].name; |
| 2617 |
rb_str_catf(errmsg, "%s", (tname ? tname:"void")); |
2617 |
rb_str_catf_1(errmsg, "%s", (tname ? tname:"void")); |
| 2618 |
} |
2618 |
} |
| 2619 |
rb_str_catf(errmsg, ")"); |
2619 |
rb_str_catf_1(errmsg, ")"); |
| 2620 |
if(meth.flags & Smoke::mf_const) rb_str_catf(errmsg, " const"); |
2620 |
if(meth.flags & Smoke::mf_const) rb_str_catf_1(errmsg, " const"); |
| 2621 |
rb_str_catf(errmsg, "\n"); |
2621 |
rb_str_catf_1(errmsg, "\n"); |
| 2622 |
} |
2622 |
} |
| 2623 |
} |
2623 |
} |
| 2624 |
} |
2624 |
} |