[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.4/kdebindings/ruby/qtruby/src
From:       Arno Rehn <kde () arnorehn ! de>
Date:       2010-01-30 15:08:21
Message-ID: 1264864101.602193.14162.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1082440 by arnorehn:

const-correctness++
make PUSH_QTRUBY_METHOD use the correct smoke module


 M  +20 -20    Qt.cpp  
 M  +6 -6      qtruby.cpp  


--- branches/KDE/4.4/kdebindings/ruby/qtruby/src/Qt.cpp #1082439:1082440
@@ -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"));
--- branches/KDE/4.4/kdebindings/ruby/qtruby/src/qtruby.cpp #1082439:1082440
@@ -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);
@@ -2032,7 +2032,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 ");


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic