[Kde-bindings] KDE/kdebindings/ruby/qtruby/src
Arno Rehn
kde at arnorehn.de
Sat Jan 30 15:07:22 UTC 2010
SVN commit 1082439 by arnorehn:
const-correctness++
make PUSH_QTRUBY_METHOD use the correct smoke module
CCMAIL: kde-bindings at kde.org
M +20 -20 Qt.cpp
M +6 -6 qtruby.cpp
--- trunk/KDE/kdebindings/ruby/qtruby/src/Qt.cpp #1082438:1082439
@@ -241,7 +241,7 @@
smokeruby_object *o = value_obj_info(obj);
if (do_debug & qtdb_virtual) {
- Smoke::Method & meth = smoke->methods[method];
+ const Smoke::Method & meth = smoke->methods[method];
QByteArray signature(smoke->methodNames[meth.name]);
signature += "(";
for (int i = 0; i < meth.numArgs; i++) {
@@ -525,14 +525,14 @@
if (i == 0) { // shouldn't happen
rb_raise(rb_eArgError, "Corrupt method %s::%s", c, name);
} else if(i > 0) { // single match
- Smoke::Method &methodRef = meth.smoke->methods[i];
+ const Smoke::Method &methodRef = meth.smoke->methods[i];
if ((methodRef.flags & Smoke::mf_internal) == 0) {
rb_ary_push(result, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(meth.smoke)), INT2NUM(i)));
}
} else { // multiple match
i = -i; // turn into ambiguousMethodList index
while (meth.smoke->ambiguousMethodList[i]) {
- Smoke::Method &methodRef = meth.smoke->methods[meth.smoke->ambiguousMethodList[i]];
+ const Smoke::Method &methodRef = meth.smoke->methods[meth.smoke->ambiguousMethodList[i]];
if ((methodRef.flags & Smoke::mf_internal) == 0) {
rb_ary_push(result, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(meth.smoke)), INT2NUM(meth.smoke->ambiguousMethodList[i])));
//#ifdef DEBUG
@@ -596,14 +596,14 @@
Smoke::Index ix = smoke->methodMaps[i].method;
VALUE meths = rb_ary_new();
if (ix >= 0) { // single match
- Smoke::Method &methodRef = smoke->methods[ix];
+ const Smoke::Method &methodRef = smoke->methods[ix];
if ((methodRef.flags & Smoke::mf_internal) == 0) {
rb_ary_push(meths, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(smoke)), INT2NUM((int) ix)));
}
} else { // multiple match
ix = -ix; // turn into ambiguousMethodList index
while (smoke->ambiguousMethodList[ix]) {
- Smoke::Method &methodRef = smoke->methods[smoke->ambiguousMethodList[ix]];
+ const Smoke::Method &methodRef = smoke->methods[smoke->ambiguousMethodList[ix]];
if ((methodRef.flags & Smoke::mf_internal) == 0) {
rb_ary_push(meths, rb_funcall(moduleindex_class, rb_intern("new"), 2, INT2NUM(smokeList.indexOf(smoke)), INT2NUM((int)smoke->ambiguousMethodList[ix])));
}
@@ -628,11 +628,11 @@
#define PUSH_QTRUBY_METHOD \
if ( (methodRef.flags & (Smoke::mf_internal|Smoke::mf_ctor|Smoke::mf_dtor)) == 0 \
- && strcmp(qtcore_Smoke->methodNames[methodRef.name], "operator=") != 0 \
- && strcmp(qtcore_Smoke->methodNames[methodRef.name], "operator!=") != 0 \
- && strcmp(qtcore_Smoke->methodNames[methodRef.name], "operator--") != 0 \
- && strcmp(qtcore_Smoke->methodNames[methodRef.name], "operator++") != 0 \
- && strncmp(qtcore_Smoke->methodNames[methodRef.name], "operator ", strlen("operator ")) != 0 \
+ && strcmp(s->methodNames[methodRef.name], "operator=") != 0 \
+ && strcmp(s->methodNames[methodRef.name], "operator!=") != 0 \
+ && strcmp(s->methodNames[methodRef.name], "operator--") != 0 \
+ && strcmp(s->methodNames[methodRef.name], "operator++") != 0 \
+ && strncmp(s->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 \
&& (methodRef.flags & Smoke::mf_enum) == 0 \
@@ -641,18 +641,18 @@
|| ( flags == Smoke::mf_protected \
&& (methodRef.flags & Smoke::mf_static) == 0 \
&& (methodRef.flags & Smoke::mf_protected) == Smoke::mf_protected ) ) ) { \
- if (strncmp(qtcore_Smoke->methodNames[methodRef.name], "operator", strlen("operator")) == 0) { \
- if (op_re.indexIn(qtcore_Smoke->methodNames[methodRef.name]) != -1) { \
+ if (strncmp(s->methodNames[methodRef.name], "operator", strlen("operator")) == 0) { \
+ if (op_re.indexIn(s->methodNames[methodRef.name]) != -1) { \
rb_ary_push(result, rb_str_new2((op_re.cap(1) + op_re.cap(2)).toLatin1())); \
} else { \
- rb_ary_push(result, rb_str_new2(qtcore_Smoke->methodNames[methodRef.name] + strlen("operator"))); \
+ rb_ary_push(result, rb_str_new2(s->methodNames[methodRef.name] + strlen("operator"))); \
} \
- } else if (predicate_re.indexIn(qtcore_Smoke->methodNames[methodRef.name]) != -1 && methodRef.numArgs == 0) { \
+ } else if (predicate_re.indexIn(s->methodNames[methodRef.name]) != -1 && methodRef.numArgs == 0) { \
rb_ary_push(result, rb_str_new2((predicate_re.cap(2).toLower() + predicate_re.cap(3) + "?").toLatin1())); \
- } else if (set_re.indexIn(qtcore_Smoke->methodNames[methodRef.name]) != -1 && methodRef.numArgs == 1) { \
+ } else if (set_re.indexIn(s->methodNames[methodRef.name]) != -1 && methodRef.numArgs == 1) { \
rb_ary_push(result, rb_str_new2((set_re.cap(2).toLower() + set_re.cap(3) + "=").toLatin1())); \
} else { \
- rb_ary_push(result, rb_str_new2(qtcore_Smoke->methodNames[methodRef.name])); \
+ rb_ary_push(result, rb_str_new2(s->methodNames[methodRef.name])); \
} \
}
@@ -701,13 +701,13 @@
if (icmp == 0) {
for (Smoke::Index i=methmin ; i <= methmax ; i++) {
Smoke::Index ix= s->methodMaps[i].method;
- if (ix >= 0) { // single match
- Smoke::Method &methodRef = s->methods[ix];
+ if (ix > 0) { // single match
+ const Smoke::Method &methodRef = s->methods[ix];
PUSH_QTRUBY_METHOD
} else { // multiple match
ix = -ix; // turn into ambiguousMethodList index
while (s->ambiguousMethodList[ix]) {
- Smoke::Method &methodRef = s->methods[s->ambiguousMethodList[ix]];
+ const Smoke::Method &methodRef = s->methods[s->ambiguousMethodList[ix]];
PUSH_QTRUBY_METHOD
ix++;
}
@@ -1232,7 +1232,7 @@
VALUE prettyPrintMethod(Smoke::Index id)
{
VALUE r = rb_str_new2("");
- Smoke::Method &meth = qtcore_Smoke->methods[id];
+ const Smoke::Method &meth = qtcore_Smoke->methods[id];
const char *tname = qtcore_Smoke->types[meth.ret].name;
if(meth.flags & Smoke::mf_static) rb_str_catf(r, "static ");
rb_str_catf(r, "%s ", (tname ? tname:"void"));
--- trunk/KDE/kdebindings/ruby/qtruby/src/qtruby.cpp #1082438:1082439
@@ -777,7 +777,7 @@
if ( qstrcmp( o->smoke->types[o->smoke->argumentList[o->smoke->methods[o->smoke->ambiguousMethodList[i]].args + 2]].name,
"void*" ) == 0 )
{
- Smoke::Method &m = o->smoke->methods[o->smoke->ambiguousMethodList[i]];
+ const Smoke::Method &m = o->smoke->methods[o->smoke->ambiguousMethodList[i]];
Smoke::ClassFn fn = o->smoke->classes[m.classId].classFn;
Smoke::StackItem stack[4];
stack[1].s_int = NUM2INT(argv[0]);
@@ -1437,7 +1437,7 @@
Smoke::ModuleIndex classIdx(o->smoke, o->classId);
Smoke::ModuleIndex meth = nameId.smoke->findMethod(classIdx, nameId);
if (meth.index > 0) {
- Smoke::Method &m = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
+ const Smoke::Method &m = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
Smoke::ClassFn fn = meth.smoke->classes[m.classId].classFn;
Smoke::StackItem i[4];
i[1].s_enum = _c;
@@ -1719,7 +1719,7 @@
int smokeIndex = NUM2INT(rb_funcall(method_value, rb_intern("smoke"), 0));
Smoke * smoke = smokeList[smokeIndex];
int idx = NUM2INT(idx_value);
- Smoke::Method &m = smoke->methods[method];
+ const Smoke::Method &m = smoke->methods[method];
Smoke::Index *args = smoke->argumentList + m.args;
return rb_str_new2((char*)smoke->types[args[idx]].name);
}
@@ -1803,7 +1803,7 @@
// Should never happen..
}
- Smoke::Method &methodId = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
+ const Smoke::Method &methodId = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
Smoke::ClassFn fn = o->smoke->classes[methodId.classId].classFn;
Smoke::StackItem i[1];
(*fn)(methodId.method, o->ptr, i);
@@ -1963,7 +1963,7 @@
Smoke::ModuleIndex classIdx(o->smoke, o->classId);
Smoke::ModuleIndex meth = nameId.smoke->findMethod(classIdx, nameId);
if(meth.index > 0) {
- Smoke::Method &m = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
+ const Smoke::Method &m = meth.smoke->methods[meth.smoke->methodMaps[meth.index].method];
Smoke::ClassFn fn = meth.smoke->classes[m.classId].classFn;
Smoke::StackItem i[1];
(*fn)(m.method, o->ptr, i);
@@ -2036,7 +2036,7 @@
rb_str_catf(errmsg, "\t");
int id = NUM2INT(rb_funcall(rb_ary_entry(rmeths, i), rb_intern("index"), 0));
Smoke* smoke = smokeList[NUM2INT(rb_funcall(rb_ary_entry(rmeths, i), rb_intern("smoke"), 0))];
- Smoke::Method &meth = smoke->methods[id];
+ const Smoke::Method &meth = smoke->methods[id];
const char *tname = smoke->types[meth.ret].name;
if(meth.flags & Smoke::mf_enum) {
rb_str_catf(errmsg, "enum ");
More information about the Kde-bindings
mailing list