[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/libs/kross/ruby
From: Cyrille Berger <cyb () lepi ! org>
Date: 2007-03-13 22:43:04
Message-ID: 1173825784.858042.24803.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 642310 by berger:
create a Kross rubymodule and put all those class in that module, much cleaner that \
way
M +1 -1 rubycallcache.cpp
M +3 -2 rubyextension.cpp
M +13 -1 rubyinterpreter.cpp
M +7 -0 rubyinterpreter.h
--- trunk/koffice/libs/kross/ruby/rubycallcache.cpp #642309:642310
@@ -150,7 +150,7 @@
{
if(RubyCallCachePrivate::s_rccObject == 0)
{
- RubyCallCachePrivate::s_rccObject = \
rb_define_class("KrossCallCache", rb_cObject); + \
RubyCallCachePrivate::s_rccObject = \
rb_define_class_under(RubyInterpreter::krossModule(), "CallCache", \
rb_cObject);
rb_define_method(RubyCallCachePrivate::s_rccObject, "cacheexec", \
(VALUE (*)(...))RubyCallCache::method_cacheexec, -1); }
m_self = Data_Wrap_Struct(RubyCallCachePrivate::s_rccObject, 0, \
RubyCallCache::delete_object, this);
--- trunk/koffice/libs/kross/ruby/rubyextension.cpp #642309:642310
@@ -22,6 +22,7 @@
#include "rubycallcache.h"
#include "rubyvariant.h"
+#include "rubyinterpreter.h"
#include <kross/core/metatype.h>
//#include <st.h>
@@ -355,7 +356,7 @@
VALUE RubyExtension::convertFromException(Kross::Exception::Ptr exc)
{
if(RubyExtensionPrivate::s_krossException == 0)
- RubyExtensionPrivate::s_krossException = rb_define_class("KrossException", \
rb_eRuntimeError); + RubyExtensionPrivate::s_krossException = \
rb_define_class_under(RubyInterpreter::krossModule(), "KrossException", \
rb_eRuntimeError); //exc->_KShared_ref(); //TODO
return Data_Wrap_Struct(RubyExtensionPrivate::s_krossException, 0, \
RubyExtension::delete_exception, exc.data() ); }
@@ -373,7 +374,7 @@
return 0;
if( RubyExtensionPrivate::s_krossObject == 0 ) {
- RubyExtensionPrivate::s_krossObject = rb_define_class("KrossObject", \
rb_cObject); + RubyExtensionPrivate::s_krossObject = \
rb_define_class_under(RubyInterpreter::krossModule(), "Object", \
rb_cObject );
rb_define_method(RubyExtensionPrivate::s_krossObject, "method_missing", \
(VALUE (*)(...))RubyExtension::method_missing, -1);
rb_define_method(RubyExtensionPrivate::s_krossObject, "clone", (VALUE \
(*)(...))RubyExtension::clone, 0); }
--- trunk/koffice/libs/kross/ruby/rubyinterpreter.cpp #642309:642310
@@ -1,7 +1,7 @@
/***************************************************************************
* rubyinterpreter.cpp
* This file is part of the KDE project
- * copyright (C)2005 by Cyrille Berger (cberger@cberger.net)
+ * copyright (C)2005,2007 by Cyrille Berger (cberger@cberger.net)
* copyright (C)2006 by Sebastian Sauer (mail@dipe.org)
*
* This program is free software; you can redistribute it and/or
@@ -48,10 +48,12 @@
class RubyInterpreterPrivate {
friend class RubyInterpreter;
QHash<QString, RubyModule* > modules;
+ static VALUE s_krossModule;
};
}
RubyInterpreterPrivate* RubyInterpreter::d = 0;
+VALUE RubyInterpreterPrivate::s_krossModule = 0;
RubyInterpreter::RubyInterpreter(Kross::InterpreterInfo* info)
: Kross::Interpreter(info)
@@ -92,6 +94,16 @@
rb_define_global_function("require", (VALUE (*)(...))RubyInterpreter::require, \
1); }
+VALUE RubyInterpreter::krossModule()
+{
+ if(RubyInterpreterPrivate::s_krossModule == 0)
+ {
+ RubyInterpreterPrivate::s_krossModule = rb_define_module("Kross");
+ }
+ return RubyInterpreterPrivate::s_krossModule;
+}
+
+
void RubyInterpreter::finalizeRuby()
{
if(d) {
--- trunk/koffice/libs/kross/ruby/rubyinterpreter.h #642309:642310
@@ -61,6 +61,13 @@
* @return the hash of \a RubyModule instances we know about.
*/
QHash<QString, RubyModule* > modules() const;
+ public:
+ /**
+ * @return the ruby object with the module Kross, this module holds \
class + * definition used by kross, and scripts object. All kross \
specific objects + * should be member of that module.
+ */
+ static VALUE krossModule();
private:
/// Initialize the ruby interpreter.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic