Hello community,
here is the log from the commit of package kross-interpreters for openSUSE:12.2 checked in at 2012-07-02 11:00:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:12.2/kross-interpreters (Old)
and /work/SRC/openSUSE:12.2/.kross-interpreters.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kross-interpreters", Maintainer is ""
Changes:
--------
--- /work/SRC/openSUSE:12.2/kross-interpreters/kross-interpreters.changes 2012-06-25 15:37:59.000000000 +0200
+++ /work/SRC/openSUSE:12.2/.kross-interpreters.new/kross-interpreters.changes 2012-07-02 11:00:18.000000000 +0200
@@ -1,0 +2,16 @@
+Mon Jul 2 07:20:17 UTC 2012 - coolo@suse.com
+
+- enhance Ismails ruby19 patch to check for exceptions
+
+-------------------------------------------------------------------
+Tue Jun 26 13:55:26 UTC 2012 - mvyskocil@suse.cz
+
+- use java-devel >= 1.6.0 for build
+
+-------------------------------------------------------------------
+Fri Jun 1 13:58:15 UTC 2012 - dmueller@suse.com
+
+- update to 4.8.4
+ * see http://kde.org/announcements/changelogs/changelog4_8_3to4_8_4.php for details
+
+-------------------------------------------------------------------
Old:
----
kross-interpreters-4.8.3.tar.xz
New:
----
kross-interpreters-4.8.4.tar.xz
kross-interpreters-ruby19.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ kross-interpreters.spec ++++++
--- /var/tmp/diff_new_pack.EVxqPS/_old 2012-07-02 11:00:18.000000000 +0200
+++ /var/tmp/diff_new_pack.EVxqPS/_new 2012-07-02 11:00:18.000000000 +0200
@@ -17,7 +17,7 @@
Name: kross-interpreters
-BuildRequires: java-1_6_0-openjdk-devel
+BuildRequires: java-devel >= 1.6.0
BuildRequires: kde4-filesystem
BuildRequires: libkde4-devel
BuildRequires: python-devel
@@ -26,9 +26,10 @@
Summary: Diverse bindings for KROSS
License: LGPL-2.1+
Group: Development/Libraries/KDE
-Version: 4.8.3
+Version: 4.8.4
Release: 0
Source0: %{name}-%{version}.tar.xz
+Patch0: kross-interpreters-ruby19.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -57,6 +58,9 @@
%prep
%setup -q -n %{name}-%{version}
+%if %suse_version >= 1220
+%patch0 -p1
+%endif
%build
%cmake_kde4 -d build
++++++ kross-interpreters-ruby19.patch ++++++
Index: kross-interpreters-4.8.4/ruby/rubyconfig.h
===================================================================
--- kross-interpreters-4.8.4.orig/ruby/rubyconfig.h 2011-07-27 20:42:32.312514751 +0200
+++ kross-interpreters-4.8.4/ruby/rubyconfig.h 2012-07-02 09:11:10.564640585 +0200
@@ -21,12 +21,10 @@
#define KROSS_RUBY_CONFIG_H
#include
-#include
-#include
-#include
-#include
+#include
+#include
-#include
+#include
//#include <typeinfo>
#include
Index: kross-interpreters-4.8.4/ruby/rubyextension.cpp
===================================================================
--- kross-interpreters-4.8.4.orig/ruby/rubyextension.cpp 2011-07-27 20:42:32.312514751 +0200
+++ kross-interpreters-4.8.4/ruby/rubyextension.cpp 2012-07-02 09:11:10.564640585 +0200
@@ -218,7 +218,7 @@ VALUE RubyExtension::property(int argc,
}
RubyExtension* extension = toExtension(self);
Q_ASSERT(extension);
- return RubyType<QVariant>::toVALUE( extension->d->m_object->property(STR2CSTR(name)) );
+ return RubyType<QVariant>::toVALUE( extension->d->m_object->property(StringValuePtr(name)) );
}
VALUE RubyExtension::setProperty(int argc, VALUE *argv, VALUE self)
@@ -231,7 +231,7 @@ VALUE RubyExtension::setProperty(int arg
}
RubyExtension* extension = toExtension(self);
Q_ASSERT(extension && extension->d->m_object);
- return RubyType<bool>::toVALUE( extension->d->m_object->setProperty(STR2CSTR(name), RubyType<QVariant>::toVariant(value)) );
+ return RubyType<bool>::toVALUE( extension->d->m_object->setProperty(StringValuePtr(name), RubyType<QVariant>::toVariant(value)) );
}
VALUE RubyExtension::callConnect(int argc, VALUE *argv, VALUE self)
@@ -291,7 +291,7 @@ VALUE RubyExtension::callConnect(int arg
QObject* receiver = 0; // the receiver object
QByteArray receiverslot; // the receiver slot
if( TYPE(argv[idx]) == T_DATA ) {
-#if(RUBY_VERSION_MAJOR==1 && RUBY_VERSION_MINOR==8 && RUBY_VERSION_TEENY==4)
+#if(RUBY_API_VERSION_MAJOR==1 && RUBY_API_VERSION_MINOR==8 && RUBY_API_VERSION_TEENY==4)
//Ruby sucks sometimes; http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/201285
{ // just always assume the user provides a method here for now...
#else
@@ -308,7 +308,7 @@ VALUE RubyExtension::callConnect(int arg
receiver = receiverextension->object();
}
*/
-#if(!(RUBY_VERSION_MAJOR==1 && RUBY_VERSION_MINOR==8 && RUBY_VERSION_TEENY==4))
+#if(!(RUBY_API_VERSION_MAJOR==1 && RUBY_API_VERSION_MINOR==8 && RUBY_API_VERSION_TEENY==4))
else {
rb_raise(rb_eTypeError, ::QString("The argument number %1 is invalid.").arg(idx).toLatin1().constData());
return Qfalse;
Index: kross-interpreters-4.8.4/ruby/rubyvariant.h
===================================================================
--- kross-interpreters-4.8.4.orig/ruby/rubyvariant.h 2011-07-27 20:42:32.312514751 +0200
+++ kross-interpreters-4.8.4/ruby/rubyvariant.h 2012-07-02 09:11:10.567640444 +0200
@@ -124,7 +124,7 @@ namespace Kross {
case T_BIGNUM:
return rb_big2int(value);
case T_FLOAT:
- return (int)(RFLOAT(value)->value);
+ return (int)(RFLOAT_VALUE(value));
default:
break;
}
@@ -147,7 +147,7 @@ namespace Kross {
case T_BIGNUM:
return rb_big2uint(value);
case T_FLOAT:
- return (uint)(RFLOAT(value)->value);
+ return (uint)(RFLOAT_VALUE(value));
default:
break;
}
@@ -226,10 +226,10 @@ namespace Kross {
//return STR2CSTR( rb_inspect(value) );
return QByteArray("");
}
- long length = LONG2NUM( RSTRING(value)->len );
+ long length = LONG2NUM( RSTRING_LEN(value) );
if( length < 0 )
return QByteArray("");
- char* ca = rb_str2cstr(value, &length);
+ char* ca = RSTRING_PTR(StringValue(value));
return QByteArray(ca, length);
}
};
@@ -246,7 +246,7 @@ namespace Kross {
rb_raise(rb_eTypeError, "QString must be a string");
return QString();
}
- return STR2CSTR(value);
+ return StringValuePtr(value);
}
};
@@ -261,7 +261,7 @@ namespace Kross {
return l;
}
inline static QSize toVariant(VALUE value) {
- if( TYPE(value) != T_ARRAY || RARRAY(value)->len != 2 ) {
+ if( TYPE(value) != T_ARRAY || RARRAY_LEN(value) != 2 ) {
rb_raise(rb_eTypeError, "QSize must be an array with 2 elements");
return QSize();
}
@@ -280,7 +280,7 @@ namespace Kross {
return l;
}
inline static QSizeF toVariant(VALUE value) {
- if( TYPE(value) != T_ARRAY || RARRAY(value)->len != 2 ) {
+ if( TYPE(value) != T_ARRAY || RARRAY_LEN(value) != 2 ) {
rb_raise(rb_eTypeError, "QSizeF must be an array with 2 elements");
return QSizeF();
}
@@ -300,7 +300,7 @@ namespace Kross {
return l;
}
inline static QPoint toVariant(VALUE value) {
- if( TYPE(value) != T_ARRAY || RARRAY(value)->len != 2 ) {
+ if( TYPE(value) != T_ARRAY || RARRAY_LEN(value) != 2 ) {
rb_raise(rb_eTypeError, "QPoint must be an array with 2 elements");
return QPoint();
}
@@ -319,7 +319,7 @@ namespace Kross {
return l;
}
inline static QPointF toVariant(VALUE value) {
- if( TYPE(value) != T_ARRAY || RARRAY(value)->len != 2 ) {
+ if( TYPE(value) != T_ARRAY || RARRAY_LEN(value) != 2 ) {
rb_raise(rb_eTypeError, "QPointF must be an array with 2 elements");
return QPointF();
}
@@ -340,7 +340,7 @@ namespace Kross {
return l;
}
inline static QRect toVariant(VALUE value) {
- if( TYPE(value) != T_ARRAY || RARRAY(value)->len != 4 ) {
+ if( TYPE(value) != T_ARRAY || RARRAY_LEN(value) != 4 ) {
rb_raise(rb_eTypeError, "QRect must be an array with 4 elements");
return QRect();
}
@@ -362,7 +362,7 @@ namespace Kross {
return l;
}
inline static QRectF toVariant(VALUE value) {
- if( TYPE(value) != T_ARRAY || RARRAY(value)->len != 4 ) {
+ if( TYPE(value) != T_ARRAY || RARRAY_LEN(value) != 4 ) {
rb_raise(rb_eTypeError, "QRectF must be an array with 4 elements");
return QRectF();
}
@@ -447,7 +447,7 @@ namespace Kross {
return QStringList();
}
QStringList l;
- for(int i = 0; i < RARRAY(value)->len; i++)
+ for(int i = 0; i < RARRAY_LEN(value); i++)
l.append( RubyType<QString>::toVariant( rb_ary_entry(value, i) ) );
return l;
}
@@ -469,7 +469,7 @@ namespace Kross {
return QVariantList();
}
QVariantList l;
- for(int i = 0; i < RARRAY(value)->len; i++)
+ for(int i = 0; i < RARRAY_LEN(value); i++)
l.append( RubyType<QVariant>::toVariant( rb_ary_entry(value, i) ) );
return l;
}
@@ -490,7 +490,7 @@ namespace Kross {
QVariantMap* map;
Data_Get_Struct(vmap, QVariantMap, map);
if (key != Qundef)
- map->insert(STR2CSTR(key), RubyType<QVariant>::toVariant(value));
+ map->insert(StringValuePtr(key), RubyType<QVariant>::toVariant(value));
return ST_CONTINUE;
}
inline static QVariantMap toVariant(VALUE value) {
Index: kross-interpreters-4.8.4/ruby/rubyvariant.cpp
===================================================================
--- kross-interpreters-4.8.4.orig/ruby/rubyvariant.cpp 2011-07-27 20:42:32.312514751 +0200
+++ kross-interpreters-4.8.4/ruby/rubyvariant.cpp 2012-07-02 09:11:10.567640444 +0200
@@ -487,7 +487,7 @@ MetaType* RubyMetaTypeFactory::create(co
#endif
QList list;
if( TYPE(value) == T_ARRAY ) {
- for(int i = 0; i < RARRAY(value)->len; i++)
+ for(int i = 0; i < RARRAY_LEN(value); i++)
if( void *ptr = VoidList::extractVoidStar(rb_ary_entry(value, i)) )
list << ptr;
}
Index: kross-interpreters-4.8.4/ruby/rubyfunction.h
===================================================================
--- kross-interpreters-4.8.4.orig/ruby/rubyfunction.h 2011-07-27 20:42:32.312514751 +0200
+++ kross-interpreters-4.8.4/ruby/rubyfunction.h 2012-07-02 09:11:10.568640397 +0200
@@ -56,7 +56,7 @@ namespace Kross {
m_debuginfo = QString("sender=%1 signature=%2 method=%3")
.arg( sender ? QString("%1 (%2)").arg(sender->objectName()).arg(sender->metaObject()->className()) : "NULL" )
.arg( signal.data() )
- .arg( STR2CSTR(rb_inspect(method)) );
+ .arg( StringValuePtr(rb_inspect(method)) );
krossdebug( QString("RubyFunction Ctor %1").arg(m_debuginfo) );
#endif
rb_gc_register_address(&m_method);
@@ -80,19 +80,22 @@ namespace Kross {
static VALUE callFunctionException(VALUE args, VALUE error)
{
//#ifdef KROSS_RUBY_FUNCTION_DEBUG
+ VALUE v_args = rb_inspect(args);
+ VALUE v_error = rb_inspect(error);
krossdebug( QString("RubyFunction callFunctionException args=%1 error=%2")
- .arg( STR2CSTR(rb_inspect(args)) ).arg( STR2CSTR(rb_inspect(error)) ) );
+ .arg( StringValuePtr(v_args) ).arg( StringValuePtr(v_error) ) );
//#else
// Q_UNUSED(args);
// Q_UNUSED(error);
//#endif
VALUE info = rb_gv_get("$!");
VALUE bt = rb_funcall(info, rb_intern("backtrace"), 0);
- VALUE message = RARRAY(bt)->ptr[0];
- fprintf(stderr,"%s: %s (%s)\n", STR2CSTR(message), STR2CSTR(rb_obj_as_string(info)), rb_class2name(CLASS_OF(info)));
- for(int i = 1; i < RARRAY(bt)->len; ++i)
- if( TYPE(RARRAY(bt)->ptr[i]) == T_STRING )
- fprintf(stderr,"\tfrom %s\n", STR2CSTR(RARRAY(bt)->ptr[i]));
+ VALUE message = RARRAY_PTR(bt)[0];
+ VALUE v_info = rb_obj_as_string(info);
+ fprintf(stderr,"%s: %s (%s)\n", StringValuePtr(message), StringValuePtr(v_info), rb_class2name(CLASS_OF(info)));
+ for(int i = 1; i < RARRAY_LEN(bt); ++i)
+ if( TYPE(RARRAY_PTR(bt)[i]) == T_STRING )
+ fprintf(stderr,"\tfrom %s\n", StringValuePtr(RARRAY_PTR(bt)[i]));
//ruby_nerrs++;
return Qnil;
}
@@ -105,7 +108,7 @@ namespace Kross {
static VALUE callFunction(VALUE args)
{
#ifdef KROSS_RUBY_FUNCTION_DEBUG
- krossdebug( QString("RubyFunction callFunction args=%1").arg(STR2CSTR(rb_inspect(args))) );
+ krossdebug( QString("RubyFunction callFunction args=%1").arg(StringValuePtr(rb_inspect(args))) );
#endif
Q_ASSERT( TYPE(args) == T_ARRAY );
VALUE self = rb_ary_entry(args, 0);
@@ -116,9 +119,9 @@ namespace Kross {
{
argumentsP[idx] = rb_ary_entry(arguments, idx+1);
}
- //krossdebug(QString("RubyScript::callExecute script=%1").arg(STR2CSTR( rb_inspect(script) )));
- //krossdebug(QString("RubyScript::callExecute fileName=%1").arg(STR2CSTR( rb_inspect(fileName) )));
- //krossdebug(QString("RubyScript::callExecute src=%1").arg(STR2CSTR( rb_inspect(src) )));
+ //krossdebug(QString("RubyScript::callExecute script=%1").arg(StringValuePtr( rb_inspect(script) )));
+ //krossdebug(QString("RubyScript::callExecute fileName=%1").arg(StringValuePtr( rb_inspect(fileName) )));
+ //krossdebug(QString("RubyScript::callExecute src=%1").arg(StringValuePtr( rb_inspect(src) )));
VALUE result = rb_funcall2(self, rb_intern("call"), argsize, argumentsP);
delete[] argumentsP;
return result;
@@ -198,19 +201,19 @@ namespace Kross {
//VALUE result = rb_funcall2(m_method, rb_intern("call"), argsize, args);
//TODO optimize
- ruby_in_eval++;
+ //ruby_in_eval++
VALUE argarray = rb_ary_new2(3);
rb_ary_store(argarray, 0, m_method); //self
rb_ary_store(argarray, 1, INT2FIX(argsize));
rb_ary_store(argarray, 2, args);
VALUE result = rb_rescue2((VALUE(*)(...))callFunction, argarray, (VALUE(*)(...))callFunctionException, Qnil, rb_eException, 0);
- ruby_in_eval--;
+ //ruby_in_eval--;
// finally set the returnvalue
m_tmpResult = RubyType<QVariant>::toVariant(result);
#ifdef KROSS_RUBY_FUNCTION_DEBUG
QObject* sender = QObject::sender();
- krossdebug( QString("RubyFunction::qt_metacall sender.objectName=%1 sender.className=%2 result=%3 variantresult=%4").arg(sender->objectName()).arg(sender->metaObject()->className()).arg(STR2CSTR(rb_inspect(result))).arg(m_tmpResult.toString()) );
+ krossdebug( QString("RubyFunction::qt_metacall sender.objectName=%1 sender.className=%2 result=%3 variantresult=%4").arg(sender->objectName()).arg(sender->metaObject()->className()).arg(StringValuePtr(rb_inspect(result))).arg(m_tmpResult.toString()) );
#endif
//_a[0] = Kross::MetaTypeVariant<QVariant>(d->tmpResult).toVoidStar();
_a[0] = &(m_tmpResult);
Index: kross-interpreters-4.8.4/ruby/rubyscript.cpp
===================================================================
--- kross-interpreters-4.8.4.orig/ruby/rubyscript.cpp 2011-07-27 20:42:32.312514751 +0200
+++ kross-interpreters-4.8.4/ruby/rubyscript.cpp 2012-07-02 09:16:15.872314642 +0200
@@ -32,41 +32,40 @@
#include <QMetaObject>
#include <QMetaMethod>
-extern NODE *ruby_eval_tree;
-
using namespace Kross;
static VALUE callExecuteException(VALUE self, VALUE error)
{
//#ifdef KROSS_RUBY_SCRIPT_DEBUG
+ VALUE v_self = rb_inspect(self);
+ VALUE v_error = rb_inspect(error);
krossdebug( QString("RubyScript::callExecuteException script=%1 error=%2")
- .arg( STR2CSTR(rb_inspect(self)) ).arg( STR2CSTR(rb_inspect(error)) ) );
+ .arg( StringValuePtr(v_self) ).arg( StringValuePtr(v_error) ) );
//#else
//Q_UNUSED(error);
//#endif
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];
+ VALUE v_info = rb_obj_as_string(info);
QString errormessage = QString("%1: %2 (%3)")
- .arg( STR2CSTR(message) )
- .arg( STR2CSTR(rb_obj_as_string(info)) )
+ .arg( StringValuePtr(message) )
+ .arg( StringValuePtr(v_info) )
.arg( rb_class2name(CLASS_OF(info)) );
fprintf(stderr, "%s\n", errormessage.toLatin1().data());
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( StringValuePtr(RARRAY_PTR(bt)[i]) );
Q_ASSERT( ! s.isNull() );
tracemessage += s;
fprintf(stderr, "\t%s", s.toLatin1().data());
}
}
- ruby_nerrs++;
-
VALUE rubyscriptvalue = rb_funcall(self, rb_intern("const_get"), 1, ID2SYM(rb_intern("RUBYSCRIPTOBJ")));
RubyScript* rubyscript;
Data_Get_Struct(rubyscriptvalue, RubyScript, rubyscript);
@@ -79,7 +78,7 @@ static VALUE callExecuteException(VALUE
static VALUE callExecute(VALUE args)
{
#ifdef KROSS_RUBY_SCRIPT_DEBUG
- krossdebug( QString("RubyScript::callExecute args=%1").arg( STR2CSTR(rb_inspect(args)) ) );
+ krossdebug( QString("RubyScript::callExecute args=%1").arg( StringValuePtr(rb_inspect(args)) ) );
#endif
Q_ASSERT( TYPE(args) == T_ARRAY );
VALUE self = rb_ary_entry(args, 0);
@@ -88,9 +87,9 @@ static VALUE callExecute(VALUE args)
Q_ASSERT( ! NIL_P(src) );
VALUE fileName = rb_ary_entry(args, 2);
Q_ASSERT( ! NIL_P(fileName) && TYPE(fileName) == T_STRING );
- //krossdebug(QString("RubyScript::callExecute script=%1").arg(STR2CSTR( rb_inspect(script) )));
- //krossdebug(QString("RubyScript::callExecute fileName=%1").arg(STR2CSTR( rb_inspect(fileName) )));
- //krossdebug(QString("RubyScript::callExecute src=%1").arg(STR2CSTR( rb_inspect(src) )));
+ //krossdebug(QString("RubyScript::callExecute script=%1").arg(StringValuePtr( rb_inspect(script) )));
+ //krossdebug(QString("RubyScript::callExecute fileName=%1").arg(StringValuePtr( rb_inspect(fileName) )));
+ //krossdebug(QString("RubyScript::callExecute src=%1").arg(StringValuePtr( rb_inspect(src) )));
return rb_funcall(self, rb_intern("module_eval"), 2, src, fileName);
}
@@ -124,11 +123,11 @@ namespace Kross {
const char *methodname = rb_id2name(SYM2ID(unit));
#ifdef KROSS_RUBY_SCRIPT_METHODADDED_DEBUG
- krossdebug(QString("RubyScriptPrivate::method_added methodname=%1 self=%2 module=%3").arg(methodname).arg(STR2CSTR( rb_inspect(self) )).arg(STR2CSTR( rb_inspect(module) )));
+ krossdebug(QString("RubyScriptPrivate::method_added methodname=%1 self=%2 module=%3").arg(methodname).arg(StringValuePtr( rb_inspect(self) )).arg(StringValuePtr( rb_inspect(module) )));
#endif
VALUE rubyscriptvalue = rb_funcall(self, rb_intern("const_get"), 1, ID2SYM(rb_intern("RUBYSCRIPTOBJ")));
- //krossdebug(QString("RubyScriptPrivate::method_added rubyscriptvalue=%1").arg(STR2CSTR( rb_inspect(rubyscriptvalue) )));
+ //krossdebug(QString("RubyScriptPrivate::method_added rubyscriptvalue=%1").arg(StringValuePtr( rb_inspect(rubyscriptvalue) )));
RubyScript* rubyscript;
Data_Get_Struct(rubyscriptvalue, RubyScript, rubyscript);
@@ -142,7 +141,7 @@ namespace Kross {
VALUE method = rb_funcall(self, rb_intern("method"), 1, rb_str_new2(methodname));
#ifdef KROSS_RUBY_SCRIPT_METHODADDED_DEBUG
- krossdebug(QString("RubyScriptPrivate::method_added method=%1").arg(STR2CSTR( rb_inspect(method) )));
+ krossdebug(QString("RubyScriptPrivate::method_added method=%1").arg(StringValuePtr( rb_inspect(method) )));
#endif
RubyFunction* function = rubyscript->connectFunction(f.first, f.second.toLatin1(), method);
@@ -173,11 +172,8 @@ namespace Kross {
// needed to prevent infinitive loops ifour scripting call uses e.g. callFunction
m_hasBeenSuccessFullyExecuted = true;
- const int critical = rb_thread_critical;
- rb_thread_critical = Qtrue;
-
- ruby_nerrs = 0;
- ruby_errinfo = Qnil;
+ VALUE mutex;
+ rb_mutex_lock(mutex);
VALUE args = rb_ary_new2(3);
rb_ary_store(args, 0, m_script); //self
@@ -192,11 +188,9 @@ namespace Kross {
}
*/
- ruby_in_eval++;
VALUE result = rb_rescue2((VALUE(*)(...))callExecute, args, (VALUE(*)(...))callExecuteException, m_script, rb_eException, 0);
- ruby_in_eval--;
- if (ruby_nerrs != 0) {
+ if (rb_obj_is_kind_of(result, rb_eException)) {
//#ifdef KROSS_RUBY_SCRIPT_EXECUTE_DEBUG
krossdebug( QString("Compilation has failed. errorMessage=%1 errorTrace=\n%2\n").arg(q->errorMessage()).arg(q->errorTrace()) );
//#endif
@@ -205,11 +199,12 @@ namespace Kross {
m_hasBeenSuccessFullyExecuted = true;
}
+
#ifdef KROSS_RUBY_EXPLICIT_GC
rb_gc();
#endif
- rb_thread_critical = critical;
+ rb_mutex_unlock(mutex);
return result;
}
@@ -353,7 +348,7 @@ QStringList RubyScript::functionNames()
static VALUE callFunction2(VALUE args)
{
#ifdef KROSS_RUBY_SCRIPT_DEBUG
- krossdebug( QString("RubyScript::callFunction2 args=%1").arg( STR2CSTR(rb_inspect(args)) ) );
+ krossdebug( QString("RubyScript::callFunction2 args=%1").arg( StringValuePtr(rb_inspect(args)) ) );
#endif
Q_ASSERT( TYPE(args) == T_ARRAY );
VALUE self = rb_ary_entry(args, 0);
@@ -361,7 +356,7 @@ static VALUE callFunction2(VALUE args)
ID functionId = rb_ary_entry(args, 1);
VALUE arguments = rb_ary_entry(args, 2);
Q_ASSERT( TYPE(arguments) == T_ARRAY );
- return rb_funcall2(self, functionId, RARRAY(arguments)->len, RARRAY(arguments)->ptr);
+ return rb_funcall2(self, functionId, RARRAY_LEN(arguments), RARRAY_PTR(arguments));
}
QVariant RubyScript::callFunction(const QString& name, const QVariantList& args)
@@ -371,10 +366,10 @@ QVariant RubyScript::callFunction(const
krossdebug( QString("RubyScript::callFunction() name=%1").arg(name) );
#endif
- const int critical = rb_thread_critical;
- rb_thread_critical = Qtrue;
- ruby_in_eval++;
//ruby_current_node
+ VALUE mutex;
+ rb_mutex_lock(mutex);
+
if( ! d->m_hasBeenSuccessFullyExecuted ) {
execute();
@@ -383,11 +378,12 @@ QVariant RubyScript::callFunction(const
#ifdef KROSS_RUBY_SCRIPT_CALLFUNCTION_DEBUG
krossdebug("RubyScript::callFunction failed");
#endif
- setError( QString("Failed to call function \"%1\": %2").arg(name).arg(STR2CSTR( rb_obj_as_string(ruby_errinfo) )) ); // TODO: get the error
+ VALUE v_errinfo = rb_obj_as_string(rb_errinfo());
+ setError( QString("Failed to call function \"%1\": %2").arg(name).arg(StringValuePtr( v_errinfo )) ); // TODO: get the error
}
else {
//VALUE self = rb_eval_string("self");
- //krossdebug(QString("RubyScript::callFunction() ===> %1").arg(STR2CSTR(rb_inspect(self))));
+ //krossdebug(QString("RubyScript::callFunction() ===> %1").arg(StringValuePtr(rb_inspect(self))));
const int rnargs = args.size();
VALUE *rargs = new VALUE[rnargs];
@@ -413,8 +409,7 @@ QVariant RubyScript::callFunction(const
// rb_gc(); // This one is plainly wrong, since there is a good deal of chance that it will delete the content of result before it is used
#endif
- ruby_in_eval--;
- rb_thread_critical = critical;
+ rb_mutex_unlock(mutex);
return result;
}
@@ -433,12 +428,13 @@ RubyFunction* RubyScript::connectFunctio
QByteArray sendersignal = QString("2%1").arg(signature.data()).toLatin1(); //prepanding 2 means SIGNAL()
QByteArray receiverslot = QString("1%1").arg(signature.data()).toLatin1(); //prepanding 1 means SLOT()
if( ! QObject::connect(sender, sendersignal, function, receiverslot) ) {
- krosswarning( QString("RubyScript::method_added failed to connect object='%1' signal='%2' method='%3'").arg(sender->objectName()).arg(signature.data()).arg(STR2CSTR(rb_inspect(method))) );
+ VALUE v_method = rb_inspect(method);
+ krosswarning( QString("RubyScript::method_added failed to connect object='%1' signal='%2' method='%3'").arg(sender->objectName()).arg(signature.data()).arg(StringValuePtr(v_method)) );
delete function;
return 0;
}
#ifdef KROSS_RUBY_SCRIPT_CONNECTFUNCTION_DEBUG
- krossdebug( QString("RubyScript::method_added connected object='%1' signal='%2' method='%3'").arg(sender->objectName()).arg(signature.data()).arg(STR2CSTR(rb_inspect(method))) );
+ krossdebug( QString("RubyScript::method_added connected object='%1' signal='%2' method='%3'").arg(sender->objectName()).arg(signature.data()).arg(StringValuePtr(rb_inspect(method))) );
#endif
d->m_rubyfunctions.append( function );
return function;
Index: kross-interpreters-4.8.4/ruby/rubyobject.cpp
===================================================================
--- kross-interpreters-4.8.4.orig/ruby/rubyobject.cpp 2011-07-27 20:42:32.312514751 +0200
+++ kross-interpreters-4.8.4/ruby/rubyobject.cpp 2012-07-02 09:11:10.587639506 +0200
@@ -34,25 +34,26 @@ static VALUE callExecuteException(VALUE
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];
+ VALUE v_info = rb_obj_as_string(info);
QString errormessage = QString("%1: %2 (%3)")
- .arg( STR2CSTR(message) )
- .arg( STR2CSTR(rb_obj_as_string(info)) )
+ .arg( StringValuePtr(message) )
+ .arg( StringValuePtr(v_info) )
.arg( rb_class2name(CLASS_OF(info)) );
fprintf(stderr, "%s\n", errormessage.toLatin1().data());
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 ) {
+ VALUE v = RARRAY_PTR(bt)[i];
+ QString s = QString("%1\n").arg( StringValuePtr(v) );
Q_ASSERT( ! s.isNull() );
tracemessage += s;
fprintf(stderr, "\t%s", s.toLatin1().data());
}
}
- ruby_nerrs++;
/*
VALUE rubyscriptvalue = rb_funcall(self, rb_intern("const_get"), 1, ID2SYM(rb_intern("RUBYSCRIPTOBJ")));
RubyScript* rubyscript;
@@ -66,7 +67,8 @@ static VALUE callExecuteException(VALUE
static VALUE callFunction2(VALUE args)
{
#ifdef KROSS_RUBY_OBJECT_DEBUG
- krossdebug( QString("RubyObject::callFunction2 args=%1").arg( STR2CSTR(rb_inspect(args)) ) );
+ VALUE v_args = rb_inspect(args);
+ krossdebug( QString("RubyObject::callFunction2 args=%1").arg( StringValuePtr(v_args) ) );
#endif
Q_ASSERT( TYPE(args) == T_ARRAY );
VALUE self = rb_ary_entry(args, 0);
@@ -74,7 +76,7 @@ static VALUE callFunction2(VALUE args)
ID functionId = rb_ary_entry(args, 1);
VALUE arguments = rb_ary_entry(args, 2);
Q_ASSERT( TYPE(arguments) == T_ARRAY );
- return rb_funcall2(self, functionId, RARRAY(arguments)->len, RARRAY(arguments)->ptr);
+ return rb_funcall2(self, functionId, RARRAY_LEN(arguments), RARRAY_PTR(arguments));
}
class RubyObject::Private
@@ -104,7 +106,8 @@ RubyObject::RubyObject(const VALUE& obje
, d(new Private(object))
{
#ifdef KROSS_RUBY_OBJECT_DEBUG
- d->debug = QString("type=%1 value=%2").arg(TYPE(object)).arg(STR2CSTR(rb_inspect(object)));
+ VALUE v_object = rb_inspect(object);
+ d->debug = QString("type=%1 value=%2").arg(TYPE(object)).arg(StringValuePtr(v_object));
krossdebug( QString("RubyObject::RubyObject(const VALUE& object) constructor: %1").arg(d->debug) );
#endif
@@ -112,8 +115,8 @@ RubyObject::RubyObject(const VALUE& obje
VALUE methods;
const char* method;
methods = rb_class_instance_methods(1, args, CLASS_OF(object));
- for (int i = 0; i < RARRAY(methods)->len; i++) {
- method = StringValuePtr(RARRAY(methods)->ptr[i]);
+ for (int i = 0; i < RARRAY_LEN(methods); i++) {
+ method = StringValuePtr(RARRAY_PTR(methods)[i]);
krossdebug( QString("RubyObject::RubyObject() method=%1").arg( method ));
d->calls << method;
}
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org