[Kde-bindings] KDE/kdebindings/ruby/korundum

Richard Dale Richard_Dale at tipitina.demon.co.uk
Mon Feb 2 15:20:43 UTC 2009


SVN commit 920227 by rdale:

* Make Korundum build with Ruby 1.9

CCMAIL: kde-bindings at kde.org



 M  +3 -0      ChangeLog  
 M  +4 -0      src/CMakeLists.txt  
 M  +3 -3      src/Korundum.cpp  
 M  +5 -0      src/krubyapplication.cpp  
 M  +8 -4      src/krubypluginfactory.cpp  


--- trunk/KDE/kdebindings/ruby/korundum/ChangeLog #920226:920227
@@ -1,3 +1,6 @@
+2009-02-02  Richard Dale  <richard.j.dale at gmail.com>
+	* Make Korundum build with Ruby 1.9
+
 2009-01-13  Richard Dale  <richard.j.dale at gmail.com>
 	* The enum KDE::File::File was conflicting with the Ruby class 'File' and
 	  not working properly. So special case it and make it a constant. Thanks
--- trunk/KDE/kdebindings/ruby/korundum/src/CMakeLists.txt #920226:920227
@@ -5,6 +5,10 @@
     ADD_DEFINITIONS (-DQT_QTDBUS)
 ENDIF(QT_QTDBUS_FOUND)
 
+if(RUBY_VERSION)
+    ADD_DEFINITIONS (-DRUBY_VERSION=0x${RUBY_VERSION_NUMBER})
+ENDIF(RUBY_VERSION)
+
 include_directories( ${CMAKE_SOURCE_DIR}/smoke ${RUBY_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/ruby/qtruby/src ${KDE4_INCLUDE_DIR} ${QT_INCLUDES}  )
 
 set(korundum_LIB_SRCS 
--- trunk/KDE/kdebindings/ruby/korundum/src/Korundum.cpp #920226:920227
@@ -112,7 +112,7 @@
 	}
 	
 	if (TYPE(argv[0]) != T_DATA) {
-		rb_raise(rb_eArgError, "wrong argument type, expected KDE::ConfigSkeletonItem\n", argc);
+		rb_raise(rb_eArgError, "wrong argument type, expected KDE::ConfigSkeletonItem\n");
 	}
 	
 	smokeruby_object *c = value_obj_info(argv[0]);
@@ -254,7 +254,7 @@
 
 	QStringList * reference = new QStringList();
     VALUE list = argv[2];
-	int count = RARRAY(list)->len;
+	int count = RARRAY_LEN(list);
 	for(int i = 0; i < count; i++) {
 		VALUE item = rb_ary_entry(list, i);
 		reference->append(QString::fromLatin1(StringValuePtr(item)));
@@ -269,7 +269,7 @@
 	} else if (argc == 4) {
 		QStringList defaultList;
 		list = argv[3];
-		int count = RARRAY(list)->len;
+		int count = RARRAY_LEN(list);
 		for(int i = 0; i < count; i++) {
 			VALUE item = rb_ary_entry(list, i);
 			defaultList.append(QString::fromLatin1(StringValuePtr(item)));
--- trunk/KDE/kdebindings/ruby/korundum/src/krubyapplication.cpp #920226:920227
@@ -65,7 +65,12 @@
     ruby_init();
     ruby_init_loadpath();
     ruby_incpush(QFile::encodeName(program.path()));
+#if RUBY_VERSION < 0x10900
     ruby_options(argc+1, rubyargs); 
     ruby_script(QFile::encodeName(program.fileName()));
     ruby_run();
+#else
+    ruby_script(QFile::encodeName(program.fileName()));
+    ruby_run_node(ruby_options(argc+1, rubyargs));
+#endif
 }
--- trunk/KDE/kdebindings/ruby/korundum/src/krubypluginfactory.cpp #920226:920227
@@ -54,7 +54,7 @@
 {
     VALUE info = rb_gv_get("$!");
     VALUE bt = rb_funcall(info, rb_intern("backtrace"), 0);
-    VALUE message = RARRAY(bt)->ptr[0];
+    VALUE message = RARRAY_PTR(bt)[0];
 
     QString errormessage = QString("%1: %2 (%3)")
                             .arg( STR2CSTR(message) )
@@ -63,9 +63,9 @@
     fprintf(stderr, "%s\n", errormessage.toLatin1().constData());
 
     QString tracemessage;
-    for(int i = 1; i < RARRAY(bt)->len; ++i) {
-        if( TYPE(RARRAY(bt)->ptr[i]) == T_STRING ) {
-            QString s = QString("%1\n").arg( STR2CSTR(RARRAY(bt)->ptr[i]) );
+    for(int i = 1; i < RARRAY_LEN(bt); ++i) {
+        if( TYPE(RARRAY_PTR(bt)[i]) == T_STRING ) {
+            QString s = QString("%1\n").arg( STR2CSTR(RARRAY_PTR(bt)[i]) );
             Q_ASSERT( ! s.isNull() );
             tracemessage += s;
             fprintf(stderr, "\t%s", s.toLatin1().constData());
@@ -135,7 +135,11 @@
     RUBY_INIT_STACK
 #endif
 
+#if RUBY_VERSION < 0x10900
     bool firstTime = (rb_load_path == 0);
+#else
+    bool firstTime = true;
+#endif
 
     ruby_init();
     ruby_script(QFile::encodeName(program.fileName()));



More information about the Kde-bindings mailing list