[Kde-bindings] KDE/kdebindings/qtruby
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Fri Dec 16 18:47:18 UTC 2005
SVN commit 489000 by rdale:
2005-12-16 Richard Dale <Richard_Dale at tipitina.demon.co.uk>
* The logger_backend() function has been removed and replaced with
qWarning() calls. This was because of problems with getting the
logger_backend() code to work on Windows.
CCMAIL: kde-bindings at kde.org
M +6 -0 ChangeLog
M +12 -42 rubylib/qtruby/Qt.cpp
M +5 -5 rubylib/qtruby/handlers.cpp
--- trunk/KDE/kdebindings/qtruby/ChangeLog #488999:489000
@@ -1,3 +1,9 @@
+2005-12-16 Richard Dale <Richard_Dale at tipitina.demon.co.uk>
+
+ * The logger_backend() function has been removed and replaced with
+ qWarning() calls. This was because of problems with getting the
+ logger_backend() code to work on Windows.
+
2005-12-08 Richard Dale <Richard_Dale at tipitina.demon.co.uk>
* The ruby display() method was clashing with a display() method in some
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/Qt.cpp #488999:489000
@@ -197,7 +197,7 @@
if (do_debug & qtdb_gc) {
const char *className = o->smoke->classes[o->classId].className;
- logger("unmapPointer (%s*)%p -> %p", className, ptr, obj_ptr);
+ qWarning("unmapPointer (%s*)%p -> %p", className, ptr, obj_ptr);
}
pointer_map.remove(ptr);
@@ -224,7 +224,7 @@
if (do_debug & qtdb_gc) {
const char *className = o->smoke->classes[o->classId].className;
- logger("mapPointer (%s*)%p -> %p", className, ptr, (void*)obj);
+ qWarning("mapPointer (%s*)%p -> %p", className, ptr, (void*)obj);
}
pointer_map.insert(ptr, obj_ptr);
@@ -780,7 +780,7 @@
VALUE obj = getPointerObject(ptr);
smokeruby_object *o = value_obj_info(obj);
if(do_debug & qtdb_gc) {
- logger("%p->~%s()", ptr, smoke->className(classId));
+ qWarning("%p->~%s()", ptr, smoke->className(classId));
}
if(!o || !o->ptr) {
return;
@@ -793,14 +793,14 @@
VALUE obj = getPointerObject(ptr);
smokeruby_object *o = value_obj_info(obj);
if(do_debug & qtdb_virtual)
- logger("virtual %p->%s::%s() called", ptr,
+ qWarning("virtual %p->%s::%s() called", ptr,
smoke->classes[smoke->methods[method].classId].className,
smoke->methodNames[smoke->methods[method].name]
);
if(!o) {
if( do_debug & qtdb_virtual ) // if not in global destruction
- logger("Cannot find object for virtual method %p -> %p", ptr, &obj);
+ qWarning("Cannot find object for virtual method %p -> %p", ptr, &obj);
return false;
}
@@ -824,36 +824,6 @@
}
};
-void rb_str_catf(VALUE self, const char *format, ...)
-{
- 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);
- }
- va_end(ap);
-}
-
-void logger_backend(const char *format, ...)
-{
- va_list ap;
- va_start(ap, format);
- char *p = 0;
- int len;
- VALUE val_str = rb_str_new2("");
- if (len = vasprintf(&p, format, ap), len != -1) {
- rb_str_cat(val_str, p, len);
- free(p);
- }
- // TODO - allow qtruby programs to override this fprintf with their own logging
- fprintf(stdout, "%s\n", StringValuePtr(val_str));
- fflush(stdout);
- va_end(ap);
-}
-
extern "C" {
static VALUE
@@ -1443,13 +1413,13 @@
Smoke::Index *rcid = methcache.value((const char *)mcid);
#ifdef DEBUG
- if (do_debug & qtdb_calls) logger("method_missing mcid: %s", (const char *) mcid);
+ if (do_debug & qtdb_calls) qWarning("method_missing mcid: %s", (const char *) mcid);
#endif
if (rcid) {
// Got a hit
#ifdef DEBUG
- if (do_debug & qtdb_calls) logger("method_missing cache hit, mcid: %s", (const char *) mcid);
+ if (do_debug & qtdb_calls) qWarning("method_missing cache hit, mcid: %s", (const char *) mcid);
#endif
_current_method = *rcid;
} else {
@@ -2324,12 +2294,12 @@
VALUE result = rb_ary_new();
Smoke::Index meth = qt_Smoke->findMethod(c, name);
#ifdef DEBUG
- if (do_debug & qtdb_calls) logger("DAMNIT on %s::%s => %d", c, name, meth);
+ if (do_debug & qtdb_calls) qWarning("DAMNIT on %s::%s => %d", c, name, meth);
#endif
if(!meth) {
meth = qt_Smoke->findMethod("QGlobalSpace", name);
#ifdef DEBUG
- if (do_debug & qtdb_calls) logger("DAMNIT on QGlobalSpace::%s => %d", name, meth);
+ if (do_debug & qtdb_calls) qWarning("DAMNIT on QGlobalSpace::%s => %d", name, meth);
#endif
}
@@ -2352,7 +2322,7 @@
if ((methodRef.flags & Smoke::mf_internal) == 0) {
rb_ary_push(result, INT2NUM(qt_Smoke->ambiguousMethodList[i]));
#ifdef DEBUG
- if (do_debug & qtdb_calls) logger("Ambiguous Method %s::%s => %d", c, name, qt_Smoke->ambiguousMethodList[i]);
+ if (do_debug & qtdb_calls) qWarning("Ambiguous Method %s::%s => %d", c, name, qt_Smoke->ambiguousMethodList[i]);
#endif
}
@@ -2379,7 +2349,7 @@
if(argc > 1 && TYPE(argv[1]) == T_STRING)
pat = StringValuePtr(argv[1]);
#ifdef DEBUG
- if (do_debug & qtdb_calls) logger("findAllMethods called with classid = %d, pat == %s", c, pat);
+ if (do_debug & qtdb_calls) qWarning("findAllMethods called with classid = %d, pat == %s", c, pat);
#endif
Smoke::Index imax = qt_Smoke->numMethodMaps;
Smoke::Index imin = 0, icur = -1, methmin, methmax;
@@ -2485,7 +2455,7 @@
return Qnil;
}
#ifdef DEBUG
- if (do_debug & qtdb_calls) logger("findAllMethodNames called with classid = %d", c);
+ if (do_debug & qtdb_calls) qWarning("findAllMethodNames called with classid = %d", c);
#endif
Smoke::Index imax = qt_Smoke->numMethodMaps;
Smoke::Index imin = 0, icur = -1, methmin, methmax;
--- trunk/KDE/kdebindings/qtruby/rubylib/qtruby/handlers.cpp #488999:489000
@@ -101,7 +101,7 @@
child = l.at(i);
obj = getPointerObject(child);
if (obj != Qnil) {
- if(do_debug & qtdb_gc) printf("Marking (%s*)%p -> %p\n", child->metaObject()->className(), child, (void*)obj);
+ if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p\n", child->metaObject()->className(), child, (void*)obj);
rb_gc_mark(obj);
}
@@ -116,7 +116,7 @@
smokeruby_object * o = (smokeruby_object *) p;
const char *className = o->smoke->classes[o->classId].className;
- if(do_debug & qtdb_gc) printf("Checking for mark (%s*)%p\n", className, o->ptr);
+ if(do_debug & qtdb_gc) qWarning("Checking for mark (%s*)%p\n", className, o->ptr);
if(o->ptr && o->allocated) {
/*
@@ -145,7 +145,7 @@
item = table->item(row, col);
obj = getPointerObject(item);
if (obj != Qnil) {
- if(do_debug & qtdb_gc) printf("Marking (%s*)%p -> %p\n", className, item, (void*)obj);
+ if(do_debug & qtdb_gc) qWarning("Marking (%s*)%p -> %p\n", className, item, (void*)obj);
rb_gc_mark(obj);
}
}
@@ -167,7 +167,7 @@
smokeruby_object *o = (smokeruby_object*)p;
const char *className = o->smoke->classes[o->classId].className;
- if(do_debug & qtdb_gc) printf("Checking for delete (%s*)%p allocated: %s\n", className, o->ptr, o->allocated ? "true" : "false");
+ if(do_debug & qtdb_gc) qWarning("Checking for delete (%s*)%p allocated: %s\n", className, o->ptr, o->allocated ? "true" : "false");
if(application_terminated || !o->allocated || o->ptr == 0) {
free(o);
@@ -236,7 +236,7 @@
}
}
- if(do_debug & qtdb_gc) printf("Deleting (%s*)%p\n", className, o->ptr);
+ if(do_debug & qtdb_gc) qWarning("Deleting (%s*)%p\n", className, o->ptr);
char *methodName = new char[strlen(className) + 2];
methodName[0] = '~';
More information about the Kde-bindings
mailing list