[Kde-bindings] KDE/kdebindings/qtruby
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Wed Apr 19 13:03:05 UTC 2006
SVN commit 531486 by rdale:
* Removed a call to vasprintf() as it didn't compile with mingw
on Windows. Replaced with qvsnprintf() using a statically
allocated buffer.
* Fixed bugs in slot/signal marshalling. The qint64 type is now
marshalled correctly.
* Added a line to extconf.rb for the libraries needed to link the
QtRuby extension on Window.
CCMAIL: kde-bindings at kde.org
M +10 -0 ChangeLog
M +0 -2 rubylib/examples/network/http/httpwindow.rb
M +18 -10 rubylib/qtruby/Qt.cpp
M +6 -0 rubylib/qtruby/extconf.rb
M +10 -2 rubylib/qtruby/marshall_types.cpp
--- trunk/KDE/kdebindings/qtruby/ChangeLog #531485:531486
@@ -1,3 +1,13 @@
+2006-04-19 Richard Dale <rdale at foton.es>
+
+ * Removed a call to vasprintf() as it didn't compile with mingw
+ on Windows. Replaced with qvsnprintf() using a statically
+ allocated buffer.
+ * Fixed bugs in slot/signal marshalling. The qint64 type is now
+ marshalled correctly.
+ * Added a line to extconf.rb for the libraries needed to link the
+ QtRuby extension on Window.
+
2006-04-18 Richard Dale <rdale at foton.es>
* Added the network/http and loopback examples
--- trunk/KDE/kdebindings/qtruby/rubylib/examples/network/http/httpwindow.rb #531485:531486
@@ -161,8 +161,6 @@
end
def readResponseHeader(responseHeader)
-p responseHeader
-p responseHeader.statusCode
if responseHeader.statusCode != 200
Qt::MessageBox.information(self, tr("HTTP"),
tr("Download failed: %s." %
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/Qt.cpp #531485:531486
@@ -311,14 +311,13 @@
void rb_str_catf(VALUE self, const char *format, ...)
{
+#define CAT_BUFFER_SIZE 2048
+static char p[CAT_BUFFER_SIZE];
va_list ap;
va_start(ap, format);
- char *p = 0;
- int len;
- if (len = vasprintf(&p, format, ap), len != -1) {
- rb_str_cat(self, p, len);
- free(p);
- }
+ qvsnprintf(p, CAT_BUFFER_SIZE, format, ap);
+ p[CAT_BUFFER_SIZE - 1] = '\0';
+ rb_str_cat2(self, p);
va_end(ap);
}
@@ -804,7 +803,7 @@
}
value_list.append(">");
- rb_str_cat(inspect_str, value_list.toLatin1(), strlen(value_list.toLatin1()));
+ rb_str_cat2(inspect_str, value_list.toLatin1());
return inspect_str;
}
@@ -1635,6 +1634,7 @@
}
QMetaMethod method = metaobject->method(id);
+
VALUE mocArgs = rb_funcall( qt_internal_module,
rb_intern("getMocArguments"),
1,
@@ -1822,27 +1822,35 @@
char *static_type = StringValuePtr(static_type_value);
MocArgument *arg = 0;
Data_Get_Struct(ptr, MocArgument, arg);
+ Smoke::Index typeId = 0;
if (strcmp(static_type, "ptr") == 0) {
arg[idx].argType = xmoc_ptr;
- if (! name.contains('*')) {
- name += "*";
+ typeId = qt_Smoke->idType((const char *) name);
+ if (typeId == 0 && !name.contains('*')) {
+ name += "&";
+ typeId = qt_Smoke->idType((const char *) name);
}
} else if (strcmp(static_type, "bool") == 0) {
arg[idx].argType = xmoc_bool;
+ typeId = qt_Smoke->idType((const char *) name);
} else if (strcmp(static_type, "int") == 0) {
arg[idx].argType = xmoc_int;
+ typeId = qt_Smoke->idType((const char *) name);
} else if (strcmp(static_type, "double") == 0) {
arg[idx].argType = xmoc_double;
+ typeId = qt_Smoke->idType((const char *) name);
} else if (strcmp(static_type, "char*") == 0) {
arg[idx].argType = xmoc_charstar;
+ typeId = qt_Smoke->idType((const char *) name);
} else if (strcmp(static_type, "QString") == 0) {
arg[idx].argType = xmoc_QString;
name += "*";
+ typeId = qt_Smoke->idType((const char *) name);
}
- Smoke::Index typeId = qt_Smoke->idType((const char *) name);
if (typeId == 0) {
+ rb_raise(rb_eArgError, "Cannot handle '%s' as slot argument\n", StringValuePtr(name_value));
return Qfalse;
}
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/extconf.rb #531485:531486
@@ -1,5 +1,11 @@
require 'mkmf'
dir_config('smoke')
dir_config('qt')
+
+# For Linux, BSD*, Mac OS X etc:
$LOCAL_LIBS += '-lsmokeqt -lQtCore -lQtGui -lQtNetwork -lQtOpenGL -lQtSql -lQtXml -lstdc++'
+
+# For Windows the Qt library names end in '4':
+# $LOCAL_LIBS += '-lsmokeqt -lQtCore4 -lQtGui4 -lQtNetwork4 -lQtOpenGL4 -lQtSql4 -lQtXml4 -lstdc++'
+
create_makefile("qtruby")
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/marshall_types.cpp #531485:531486
@@ -448,7 +448,11 @@
}
case Smoke::t_class:
case Smoke::t_voidp:
- p = &si->s_voidp;
+ if (strchr(t.name(), '*') != 0) {
+ p = &si->s_voidp;
+ } else {
+ p = si->s_voidp;
+ }
break;
default:
p = 0;
@@ -578,7 +582,11 @@
break;
case Smoke::t_class:
case Smoke::t_voidp:
- _stack[i].s_voidp = *(void **)p;
+ if (strchr(t.name(), '*') != 0) {
+ _stack[i].s_voidp = *(void **)p;
+ } else {
+ _stack[i].s_voidp = p;
+ }
break;
}
}
More information about the Kde-bindings
mailing list