Hello community, here is the log from the commit of package yast2-ruby-bindings for openSUSE:Factory checked in at 2012-06-13 13:25:12 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-ruby-bindings (Old) and /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-ruby-bindings", Maintainer is "[email protected]" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-ruby-bindings/yast2-ruby-bindings.changes 2012-04-12 10:00:10.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-ruby-bindings.new/yast2-ruby-bindings.changes 2012-06-13 13:25:13.000000000 +0200 @@ -1,0 +2,10 @@ +Tue Jun 12 13:33:01 UTC 2012 - [email protected] + +- finish the ruby 1.9 port + +------------------------------------------------------------------- +Thu Jun 7 15:44:29 UTC 2012 - [email protected] + +- port to ruby 1.9 + +------------------------------------------------------------------- Old: ---- yast2-ruby-bindings-0.3.10.tar.bz2 New: ---- ruby1.9-patch yast2-ruby-bindings-0.3.11.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-ruby-bindings.spec ++++++ --- /var/tmp/diff_new_pack.mZCu6L/_old 2012-06-13 13:25:15.000000000 +0200 +++ /var/tmp/diff_new_pack.mZCu6L/_new 2012-06-13 13:25:15.000000000 +0200 @@ -21,10 +21,11 @@ # Name: yast2-ruby-bindings -Version: 0.3.10 +Version: 0.3.11 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: yast2-ruby-bindings-%{version}.tar.bz2 +Patch0: ruby1.9-patch Prefix: /usr BuildRequires: cmake @@ -49,6 +50,7 @@ %prep %setup -n yast2-ruby-bindings-%{version} +%patch0 -p1 %build mkdir build cd build @@ -62,6 +64,7 @@ make %{?jobs:-j %jobs} VERBOSE=1 %install +chmod a+x tests/ycp/run_ycp_test.sh cd build make install DESTDIR=$RPM_BUILD_ROOT cd .. ++++++ ruby1.9-patch ++++++ Nur in /var/tmp/build-root-openSUSE_Factory-x86_64-YaST:Head-yast2-ruby-bindings/home/abuild/rpmbuild/BUILD/yast2-ruby-bindings-0.3.11/: build. Nur in /var/tmp/build-root-openSUSE_Factory-x86_64-YaST:Head-yast2-ruby-bindings/home/abuild/rpmbuild/BUILD/yast2-ruby-bindings-0.3.11/: core. Index: yast2-ruby-bindings-0.3.11/src/ruby/Y2RubyTypeConv.cc =================================================================== --- yast2-ruby-bindings-0.3.11.orig/src/ruby/Y2RubyTypeConv.cc 2012-06-07 17:45:44.000000000 +0200 +++ yast2-ruby-bindings-0.3.11/src/ruby/Y2RubyTypeConv.cc 2012-06-12 15:30:25.171419923 +0200 @@ -104,6 +104,10 @@ static void ycpexternal_finalizer(void * { VALUE value = (VALUE)value_v; + if (!YRuby::yRuby()) { + return; // we're finalized + } + YRuby::refcount_map_t& vrby = YRuby::yRuby()->value_references_from_ycp; YRuby::refcount_map_t::iterator it = vrby.find(value); if (it == vrby.end()) { Index: yast2-ruby-bindings-0.3.11/src/ruby/YRuby.cc =================================================================== --- yast2-ruby-bindings-0.3.11.orig/src/ruby/YRuby.cc 2012-06-07 17:45:44.000000000 +0200 +++ yast2-ruby-bindings-0.3.11/src/ruby/YRuby.cc 2012-06-12 15:31:25.430593704 +0200 @@ -28,6 +28,7 @@ as published by the Free Software Founda // Ruby stuff #include <ruby.h> +#include <ruby/encoding.h> #define y2log_component "Y2Ruby" @@ -68,14 +69,19 @@ void inject_last_exception_method(VALUE& } YRuby * YRuby::_yRuby = 0; +bool YRuby::_y_ruby_finalized = false; YRuby::YRuby() { y2milestone( "Initializing ruby interpreter." ); + + RUBY_INIT_STACK; ruby_init(); ruby_script("yast"); ruby_init_loadpath(); + rb_enc_find_index("encdb"); + VALUE ycp_references = Data_Wrap_Struct(rb_cObject, gc_mark, gc_free, & value_references_from_ycp); rb_global_variable(&ycp_references); } @@ -107,13 +113,14 @@ YRuby::~YRuby() { y2milestone( "Shutting down ruby interpreter." ); ruby_finalize(); + _y_ruby_finalized = true; } YRuby * YRuby::yRuby() { - if ( ! _yRuby ) + if ( ! _yRuby && !_y_ruby_finalized ) _yRuby = new YRuby(); return _yRuby; @@ -142,8 +149,9 @@ YRuby::loadModule( YCPList argList ) if ( argList->size() != 2 || ! argList->value(0)->isString() || ! argList->value(1)->isString() ) return YCPError( "Ruby::loadModule() / Ruby::Use() : Bad arguments: String expected!" ); string module_path = argList->value(1)->asString()->value(); - VALUE result = rb_require(module_path.c_str()); - if ( result == Qfalse ) + int error = 0; + VALUE result = rb_protect( (VALUE (*)(VALUE))rb_require, (VALUE) module_path.c_str(), &error); + if ( result == Qfalse || error) return YCPError( "Ruby::loadModule() / Can't load ruby module '" + module_path + "'" ); return YCPVoid(); } Index: yast2-ruby-bindings-0.3.11/src/ruby/YRuby.h =================================================================== --- yast2-ruby-bindings-0.3.11.orig/src/ruby/YRuby.h 2012-06-07 17:45:44.000000000 +0200 +++ yast2-ruby-bindings-0.3.11/src/ruby/YRuby.h 2012-06-12 15:30:25.172419876 +0200 @@ -113,6 +113,7 @@ private: public: static YRuby * _yRuby; + static bool _y_ruby_finalized; refcount_map_t value_references_from_ycp; }; Index: yast2-ruby-bindings-0.3.11/src/ruby/YRubyNamespace.cc =================================================================== --- yast2-ruby-bindings-0.3.11.orig/src/ruby/YRubyNamespace.cc 2012-06-07 17:45:44.000000000 +0200 +++ yast2-ruby-bindings-0.3.11/src/ruby/YRubyNamespace.cc 2012-06-12 15:30:42.571603816 +0200 @@ -194,6 +194,9 @@ YRubyNamespace::YRubyNamespace (string n for(i = 0; i < RARRAY_LEN(methods); i++) { VALUE current = rb_funcall( methods, rb_intern("at"), 1, rb_fix_new(i) ); + if (rb_type(current) == RUBY_T_SYMBOL) { + current = rb_funcall( current, rb_intern("to_s"), 0); + } y2milestone("New method: '%s'", RSTRING_PTR(current)); // figure out arity. ++++++ yast2-ruby-bindings-0.3.10.tar.bz2 -> yast2-ruby-bindings-0.3.11.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/README new/yast2-ruby-bindings-0.3.11/README --- old/yast2-ruby-bindings-0.3.10/README 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/README 2012-06-07 17:45:44.000000000 +0200 @@ -15,3 +15,8 @@ Based on yast2-perl-bindings by Martin Vidner <[email protected]> Stefan Hundhammer <[email protected]> + + +Exception handling +================= +When ruby code raise exception, then method return `nil` in YCP and add method last_exception, that returns message of exception. Also exception details are logged. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/VERSION.cmake new/yast2-ruby-bindings-0.3.11/VERSION.cmake --- old/yast2-ruby-bindings-0.3.10/VERSION.cmake 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/VERSION.cmake 2012-06-07 17:45:44.000000000 +0200 @@ -1,3 +1,3 @@ SET(VERSION_MAJOR "0") SET(VERSION_MINOR "3") -SET(VERSION_PATCH "10") +SET(VERSION_PATCH "11") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/cmake/modules/FindRuby.cmake new/yast2-ruby-bindings-0.3.11/cmake/modules/FindRuby.cmake --- old/yast2-ruby-bindings-0.3.10/cmake/modules/FindRuby.cmake 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/cmake/modules/FindRuby.cmake 2012-06-07 17:45:44.000000000 +0200 @@ -15,65 +15,46 @@ set(RUBY_FIND_QUIETLY TRUE) endif (RUBY_LIBRARY AND RUBY_INCLUDE_PATH) -# RUBY_ARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"archdir"@:>@)'` -# RUBY_SITEARCHDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitearchdir"@:>@)'` -# RUBY_SITEDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"sitelibdir"@:>@)'` -# RUBY_LIBDIR=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"libdir"@:>@)'` -# RUBY_LIBRUBYARG=`$RUBY -r rbconfig -e 'printf("%s",Config::CONFIG@<:@"LIBRUBYARG_SHARED"@:>@)'` +FIND_PROGRAM(RUBY_EXECUTABLE NAMES ruby ruby1.9 ruby19 ) -FIND_PROGRAM(RUBY_EXECUTABLE NAMES ruby ruby1.8 ruby18 ) - -EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['archdir']" +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['archdir']" OUTPUT_VARIABLE RUBY_ARCH_DIR) -EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['libdir']" + EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['libdir']" OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_PATH) -EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['rubylibdir']" + EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['rubylibdir']" OUTPUT_VARIABLE RUBY_RUBY_LIB_PATH) # site_ruby -EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitearchdir']" +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitearchdir']" OUTPUT_VARIABLE RUBY_SITEARCH_DIR) -EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitelibdir']" +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['sitelibdir']" OUTPUT_VARIABLE RUBY_SITELIB_DIR) -# vendor_ruby -EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print '-rvendor-specific'" - OUTPUT_VARIABLE RUBY_VENDOR_ARG) - -IF(RUBY_VENDOR_ARG) - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorarchdir']" - OUTPUT_VARIABLE RUBY_VENDORARCH_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorlibdir']" - OUTPUT_VARIABLE RUBY_VENDORLIB_DIR) -ELSE(RUBY_VENDOR_ARG) - # fall back to site*dir - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitearchdir']" - OUTPUT_VARIABLE RUBY_VENDORARCH_DIR) - - EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitelibdir']" - OUTPUT_VARIABLE RUBY_VENDORLIB_DIR) -ENDIF(RUBY_VENDOR_ARG) - -# this is not needed if you use "print" inside the ruby statements -# remove the new lines from the output by replacing them with empty strings -#STRING(REPLACE "\n" "" RUBY_ARCH_DIR "${RUBY_ARCH_DIR}") -#STRING(REPLACE "\n" "" RUBY_POSSIBLE_LIB_PATH "${RUBY_POSSIBLE_LIB_PATH}") -#STRING(REPLACE "\n" "" RUBY_RUBY_LIB_PATH "${RUBY_RUBY_LIB_PATH}") +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['vendorarchdir']" + OUTPUT_VARIABLE RUBY_VENDORARCH_DIR) + +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['vendorlibdir']" + OUTPUT_VARIABLE RUBY_VENDORLIB_DIR) + +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['rubyhdrdir']" + OUTPUT_VARIABLE RUBY_HEADER_DIR) + +EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print RbConfig::CONFIG['arch']" + OUTPUT_VARIABLE RUBY_ARCH) FIND_PATH(RUBY_INCLUDE_PATH NAMES ruby.h PATHS - ${RUBY_ARCH_DIR} - /usr/lib/ruby/1.8/i586-linux-gnu/ ) + ${RUBY_HEADER_DIR} +) FIND_LIBRARY(RUBY_LIBRARY - NAMES ruby ruby1.8 + NAMES ruby ruby1.9 PATHS ${RUBY_POSSIBLE_LIB_PATH} ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/modules/MyModule.ycp new/yast2-ruby-bindings-0.3.11/modules/MyModule.ycp --- old/yast2-ruby-bindings-0.3.10/modules/MyModule.ycp 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/modules/MyModule.ycp 1970-01-01 01:00:00.000000000 +0100 @@ -1,14 +0,0 @@ -{ - module "MyModule"; - - global void nothing() - { - y2milestone("doing nothing, returning nothing"); - } - - global integer half( integer value ) - { - return value / 2; - } -} - \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/package/yast2-ruby-bindings.changes new/yast2-ruby-bindings-0.3.11/package/yast2-ruby-bindings.changes --- old/yast2-ruby-bindings-0.3.10/package/yast2-ruby-bindings.changes 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/package/yast2-ruby-bindings.changes 2012-06-07 17:45:44.000000000 +0200 @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Thu Jun 7 15:44:29 UTC 2012 - [email protected] + +- port to ruby 1.9 + +------------------------------------------------------------------- Thu Apr 5 10:32:47 CEST 2012 - [email protected] - removed libxcrypt-devel from buildrequires diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/src/ruby/CMakeLists.txt new/yast2-ruby-bindings-0.3.11/src/ruby/CMakeLists.txt --- old/yast2-ruby-bindings-0.3.10/src/ruby/CMakeLists.txt 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/src/ruby/CMakeLists.txt 2012-06-07 17:45:44.000000000 +0200 @@ -34,6 +34,8 @@ ) include_directories( ${RUBY_INCLUDE_PATH} ) +#include also arch specific config.h +include_directories( ${RUBY_HEADER_DIR}/${RUBY_ARCH} ) include_directories( ${YAST_INCLUDE_DIR} ) link_directories(${YAST_PLUGIN_DIR}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/src/ruby/Y2CCRuby.cc new/yast2-ruby-bindings-0.3.11/src/ruby/Y2CCRuby.cc --- old/yast2-ruby-bindings-0.3.10/src/ruby/Y2CCRuby.cc 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/src/ruby/Y2CCRuby.cc 2012-06-07 17:45:44.000000000 +0200 @@ -33,7 +33,7 @@ Y2Component *Y2CCRuby::provideNamespace (const char *name) { - y2debug ("Y2CCRuby::provideNamespace %s", name); + y2milestone ("Y2CCRuby::provideNamespace %s", name); if (strcmp (name, "Ruby") == 0) { // low level functions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/src/ruby/Y2RubyTypeConv.cc new/yast2-ruby-bindings-0.3.11/src/ruby/Y2RubyTypeConv.cc --- old/yast2-ruby-bindings-0.3.10/src/ruby/Y2RubyTypeConv.cc 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/src/ruby/Y2RubyTypeConv.cc 2012-06-07 17:45:44.000000000 +0200 @@ -66,13 +66,12 @@ static YCPMap rbhash_2_ycpmap( VALUE value ) { YCPMap map; - VALUE keys = rb_funcall(value, rb_intern("keys"), 0); - int n = NUM2LONG(rb_funcall(keys, rb_intern("size"), 0)); - for ( int i=0; i<n; ++i) + VALUE list = rb_funcall(value, rb_intern("to_a"), 0); //get array of two items array, first is key and second is value + for ( unsigned i=0; i<RARRAY_LEN(list); ++i) { - VALUE rkey = rb_funcall(keys, rb_intern("at"), 1, INT2NUM(i)); - YCPValue ykey = rbvalue_2_ycpvalue(rkey); - YCPValue yvalue = rbvalue_2_ycpvalue( rb_funcall(value, rb_intern("[]"), 1, rkey) ); + VALUE kv_list = *(RARRAY_PTR(list)+i); + YCPValue ykey = rbvalue_2_ycpvalue(*RARRAY_PTR(kv_list)); + YCPValue yvalue = rbvalue_2_ycpvalue(*(RARRAY_PTR(kv_list)+1)); map.add(ykey, yvalue); } return map; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/src/ruby/Y2RubyTypeTerm.cc new/yast2-ruby-bindings-0.3.11/src/ruby/Y2RubyTypeTerm.cc --- old/yast2-ruby-bindings-0.3.10/src/ruby/Y2RubyTypeTerm.cc 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/src/ruby/Y2RubyTypeTerm.cc 2012-06-07 17:45:44.000000000 +0200 @@ -85,7 +85,7 @@ // we need at least the name to create a YCPTerm Check_Type( argv[0], T_STRING); - wrapper->term = YCPTerm( RSTRING(argv[0])->ptr ); + wrapper->term = YCPTerm( RSTRING_PTR(argv[0])); // add the remaining YCPTerm arguments if (argc > 1) { @@ -146,17 +146,6 @@ return rb_str_new2(wrapper->term.name().c_str()); } -// static VALUE -// ryast_term_set_name(VALUE self, VALUE name) -// { -// Check_Type(name, T_STRING); -// ryast_Term_Wrapper *wrapper; -// Data_Get_Struct(self, ryast_Term_Wrapper, wrapper); -// -// wrapper->term->setName(RSTRING(name)->ptr); -// return self; -// } - void ryast_term_init( VALUE super ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/src/ruby/YCP.cc new/yast2-ruby-bindings-0.3.11/src/ruby/YCP.cc --- old/yast2-ruby-bindings-0.3.10/src/ruby/YCP.cc 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/src/ruby/YCP.cc 2012-06-07 17:45:44.000000000 +0200 @@ -630,7 +630,7 @@ { Check_Type(argv[i], T_STRING); } - y2_logger((loglevel_t)NUM2INT(argv[0]),RSTRING(argv[1])->ptr,RSTRING(argv[2])->ptr,NUM2INT(argv[3]),"",RSTRING(argv[5])->ptr); + y2_logger((loglevel_t)NUM2INT(argv[0]),RSTRING_PTR(argv[1]),RSTRING_PTR(argv[2]),NUM2INT(argv[3]),"",RSTRING_PTR(argv[5])); return Qnil; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/src/ruby/YRuby.cc new/yast2-ruby-bindings-0.3.11/src/ruby/YRuby.cc --- old/yast2-ruby-bindings-0.3.10/src/ruby/YRuby.cc 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/src/ruby/YRuby.cc 2012-06-07 17:45:44.000000000 +0200 @@ -67,30 +67,12 @@ rb_funcall(module, rb_intern("eval"), 1, rb_str_new2(code.c_str())); } -static void prependModulePath() -{ - YCPPathSearch::initialize (); - - list<string>::const_iterator - b = YCPPathSearch::searchListBegin (YCPPathSearch::Module), - e = YCPPathSearch::searchListEnd (YCPPathSearch::Module), - i; - - // count the number of directories to prepend -// int n = 0; -// for (i = b; i != e; ++i) -// { -// // do something -// } -} - YRuby * YRuby::_yRuby = 0; YRuby::YRuby() { y2milestone( "Initializing ruby interpreter." ); ruby_init(); - //ruby_options(argc - 1, ++argv); ruby_script("yast"); ruby_init_loadpath(); @@ -102,13 +84,13 @@ { refcount_map_t * vrby = (refcount_map_t *) object; - y2internal("mark: map size is %u", vrby->size()); + y2milestone("mark: map size is %u", vrby->size()); refcount_map_t::iterator b = vrby->begin(), e = vrby->end(), it; for (it = b; it != e; ++it) { - y2internal("marking: value %ld refcount %d", it->first, it->second); + y2milestone("marking: value %ld refcount %d", it->first, it->second); rb_gc_mark(it->first); } } @@ -117,7 +99,7 @@ { refcount_map_t * vrby = (refcount_map_t *) object; - y2internal("free: map size is %u", vrby->size()); + y2milestone("free: map size is %u", vrby->size()); y2internal("should happen quite last or we are in trouble FIXME"); } @@ -142,9 +124,10 @@ YRuby::destroy() { if ( _yRuby ) + { delete _yRuby; - - _yRuby = 0; + _yRuby = 0; + } return YCPVoid(); } @@ -156,48 +139,15 @@ YRuby::loadModule( YCPList argList ) { YRuby::yRuby(); - //y2milestone("loadModule 1"); if ( argList->size() != 2 || ! argList->value(0)->isString() || ! argList->value(1)->isString() ) return YCPError( "Ruby::loadModule() / Ruby::Use() : Bad arguments: String expected!" ); - //y2milestone("loadModule 2"); - string module_name = argList->value(0)->asString()->value(); string module_path = argList->value(1)->asString()->value(); - //y2milestone("loadModule 3: '%s'", module_name.c_str()); VALUE result = rb_require(module_path.c_str()); if ( result == Qfalse ) return YCPError( "Ruby::loadModule() / Can't load ruby module '" + module_path + "'" ); - //y2milestone("loadModule 4"); return YCPVoid(); } - -// snprintf into a temp string -static char * -fmtstr(const char* fmt, ...) -{ - va_list ap; - int len; - char* str; - - va_start(ap, fmt); - len = vsnprintf(NULL, 0, fmt, ap); - va_end(ap); - if (len <= 0) - { - return NULL; - } - str = (char*)malloc(len+1); - if (str == NULL) - { - return NULL; - } - va_start(ap, fmt); - vsnprintf(str, len+1, fmt, ap); - va_end(ap); - return str; -} - - // rb_protect-enabled rb_funcall, see below static VALUE protected_call(VALUE args) @@ -250,10 +200,7 @@ VALUE reason = rb_funcall(exception, rb_intern("message"), 0 ); VALUE trace = rb_gv_get("$@"); /* get last exception trace */ VALUE backtrace = rb_funcall(trace, rb_intern("join"), 1, rb_str_new("\n\t", 2)); - - char* tmp = fmtstr("%s\n\t%s", StringValuePtr(reason), StringValuePtr(backtrace)); - y2error("%s.%s failed\n%s", module_name.c_str(), function.c_str(), tmp); - free(tmp); + y2error("%s.%s failed\n%s\n\t%s", module_name.c_str(), function.c_str(), StringValuePtr(reason),StringValuePtr(backtrace)); //workaround if last_exception failed, then return always string with message if(function == "last_exception") //TODO constantify last_exception { @@ -264,7 +211,6 @@ } else { - //VALUE result = rb_funcall( module, rb_intern(function.c_str()), 2, INT2NUM(2), INT2NUM(3) ); y2milestone( "Called function '%s' in module '%s'", function.c_str(), module_name.c_str()); } return rbvalue_2_ycpvalue(result); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/src/ruby/YRubyNamespace.cc new/yast2-ruby-bindings-0.3.11/src/ruby/YRubyNamespace.cc --- old/yast2-ruby-bindings-0.3.10/src/ruby/YRubyNamespace.cc 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/src/ruby/YRubyNamespace.cc 2012-06-07 17:45:44.000000000 +0200 @@ -37,17 +37,6 @@ #include "Y2RubyUtils.h" /** - * using this instead of plain strcmp - * enables embedding argument names into the typeinfo - */ -static bool firstWordIs (const char *where, const char *what) -{ - size_t n = strlen (what); - return !strncmp (where, what, n) && - (where[n] == '\0' || isspace (where[n])); -} - -/** * The definition of a function that is implemented in Ruby */ class Y2RubyFunctionCall : public Y2Function @@ -202,56 +191,44 @@ } int i; - for(i = 0; i < RARRAY(methods)->len; i++) + for(i = 0; i < RARRAY_LEN(methods); i++) { - VALUE current = RARRAY(methods)->ptr[i]; - y2milestone("New method: '%s'", RSTRING(current)->ptr); + VALUE current = rb_funcall( methods, rb_intern("at"), 1, rb_fix_new(i) ); + y2milestone("New method: '%s'", RSTRING_PTR(current)); - constTypePtr sym_tp = Type::Unspec; - //sym_tp = parseTypeinfo (*sym_ti) - if (sym_tp->isError ()) + // figure out arity. + Check_Type(module,T_MODULE); + VALUE methodobj = rb_funcall( module, rb_intern("method"), 1, current ); + if ( methodobj == Qnil ) { - y2error ("Cannot parse $TYPEINFO{%s}", RSTRING(current)->ptr); + y2error ("Cannot access method object '%s'", RSTRING_PTR(current)); continue; } - if (sym_tp->isUnspec ()) + string signature = "any( "; + VALUE rbarity = rb_funcall( methodobj, rb_intern("arity"), 0); + int arity = NUM2INT(rbarity); + for ( int k=0; k < arity; ++k ) { - //sym_tp = new FunctionType (Type::Any, new FunctionType(Type::Any) ); - // figure out arity. - Check_Type(module,T_MODULE); - VALUE methodobj = rb_funcall( module, rb_intern("method"), 1, current ); - //VALUE methodobj = rb_funcall( module, rb_intern("send"), 2, rb_str_new2("method"), current ); - if ( methodobj == Qnil ) - { - y2error ("Cannot access method object '%s'", RSTRING(current)->ptr); - continue; - } - string signature = "any( "; - VALUE rbarity = rb_funcall( methodobj, rb_intern("arity"), 0); - int arity = NUM2INT(rbarity); - for ( int k=0; k < arity; ++k ) - { - signature += "any"; - if ( k < (arity - 1) ) - signature += ","; - } - signature += ")"; - y2internal("going to parse signature: '%s'", signature.c_str()); - sym_tp = Type::fromSignature(signature); + signature += "any"; + if ( k < (arity - 1) ) + signature += ","; } + signature += ")"; + y2internal("going to parse signature: '%s'", signature.c_str()); + constTypePtr sym_tp = Type::fromSignature(signature); constFunctionTypePtr fun_tp = (constFunctionTypePtr) sym_tp; // symbol entry for the function SymbolEntry *fun_se = new SymbolEntry ( this, i,// position. arbitrary numbering. must stay consistent when? - RSTRING(current)->ptr, // passed to Ustring, no need to strdup + RSTRING_PTR(current), // passed to Ustring, no need to strdup SymbolEntry::c_function, sym_tp); fun_se->setGlobal (true); // enter it to the symbol table enterSymbol (fun_se, 0); - y2milestone("method: '%s' added", RSTRING(current)->ptr); + y2milestone("method: '%s' added", RSTRING_PTR(current)); } //add to all modules method last_exception to get last exception raised inside module constTypePtr sym_tp = Type::fromSignature("any()"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/src/ruby/ptr new/yast2-ruby-bindings-0.3.11/src/ruby/ptr --- old/yast2-ruby-bindings-0.3.10/src/ruby/ptr 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-ruby-bindings-0.3.11/src/ruby/ptr 2012-06-07 17:45:44.000000000 +0200 @@ -0,0 +1,217 @@ +Y2RubyTypeTerm.cc:1:/*---------------------------------------------------------------------\ +Y2RubyTypeTerm.cc:11:\----------------------------------------------------------------------/ +Y2RubyTypeTerm.cc:13:Author: Duncan Mac-Vicar <[email protected]> +Y2RubyTypeTerm.cc:32: : term("init-me") +Y2RubyTypeTerm.cc:39://----------------------------------------------------------------------------- +Y2RubyTypeTerm.cc:47: wrapper->term = term; +Y2RubyTypeTerm.cc:63: return wrapper->term; +Y2RubyTypeTerm.cc:88: wrapper->term = YCPTerm( RSTRING(argv[0])->ptr ); +Y2RubyTypeTerm.cc:95: wrapper->term->add(rbvalue_2_ycpvalue(argv[i])); +Y2RubyTypeTerm.cc:117: wrapper->term->add(value); +Y2RubyTypeTerm.cc:138: return rb_str_new2(wrapper->term.toString().c_str()); +Y2RubyTypeTerm.cc:146: return rb_str_new2(wrapper->term.name().c_str()); +Y2RubyTypeTerm.cc:156:// wrapper->term->setName(RSTRING(name)->ptr); +Y2RubyTypeTerm.cc:166: rb_define_method( ryast_cTerm, "initialize", RB_METHOD( ryast_term_initialize ), -1 ); +Y2RubyTypeTerm.cc:167: rb_define_method( ryast_cTerm, "add", RB_METHOD( ryast_term_add ), -1 ); +Y2CCRuby.h:1:/*---------------------------------------------------------------------\ +Y2CCRuby.h:11:\----------------------------------------------------------------------/ +Y2CCRuby.h:13:Author: Duncan Mac-Vicar <[email protected]> +Y2CCRuby.h:28: * @short Y2ComponentCreator that creates Ruby-from-YCP bindings. +Y2CCRuby.h:31: * It receives a component name and - if it knows how to create +Y2CCRuby.h:32: * such a component - returns a newly created component of this +YRubyNamespace.cc:1:/*---------------------------------------------------------------------\ +YRubyNamespace.cc:11:\----------------------------------------------------------------------/ +YRubyNamespace.cc:13:Author: Duncan Mac-Vicar <[email protected]> +YRubyNamespace.cc:63: m_call->add (YCPVoid ()); +YRubyNamespace.cc:72: return YRuby::yRuby()->callInner ( m_module_name, +YRubyNamespace.cc:76: m_type->returnType() ); +YRubyNamespace.cc:84: m_call->set (position+1, arg); +YRubyNamespace.cc:96: // -1 for the function name +YRubyNamespace.cc:97: int params_so_far = m_call->size ()-1; +YRubyNamespace.cc:98: return m_type->parameterType (params_so_far); +YRubyNamespace.cc:107: y2internal("Adding parameter to function %s::%s of type %s", m_module_name.c_str(), m_local_name.c_str(), arg->valuetype_str()); +YRubyNamespace.cc:108: m_call->add (arg); +YRubyNamespace.cc:126: m_call->add (YCPVoid ()); +YRubyNamespace.cc:182: // we will perform operator- to determine the module methods +YRubyNamespace.cc:185: VALUE methods = rb_funcall( mymodulemethods, rb_intern("-"), 1, moduleklassmethods ); +YRubyNamespace.cc:194: for(i = 0; i < RARRAY(methods)->len; i++) +YRubyNamespace.cc:196: VALUE current = RARRAY(methods)->ptr[i]; +YRubyNamespace.cc:197: y2milestone("New method: '%s'", RSTRING(current)->ptr); +YRubyNamespace.cc:204: y2error ("Cannot access method object '%s'", RSTRING(current)->ptr); +YRubyNamespace.cc:213: if ( k < (arity - 1) ) +YRubyNamespace.cc:225: RSTRING(current)->ptr, // passed to Ustring, no need to strdup +YRubyNamespace.cc:228: fun_se->setGlobal (true); +YRubyNamespace.cc:231: y2milestone("method: '%s' added", RSTRING(current)->ptr); +YRubyNamespace.cc:241: fun_se->setGlobal (true); +YRubyNamespace.cc:281: TableEntry *func_te = table ()->find (name.c_str (), SymbolEntry::c_function); +YRubyNamespace.cc:284: constTypePtr t = required_type ? required_type : (constFunctionTypePtr)func_te->sentry()->type (); +YRuby.cc:1:/*---------------------------------------------------------------------\ +YRuby.cc:11:\----------------------------------------------------------------------/ +YRuby.cc:13:Author: Duncan Mac-Vicar <[email protected]> +YRuby.cc:87: y2milestone("mark: map size is %u", vrby->size()); +YRuby.cc:89: b = vrby->begin(), +YRuby.cc:90: e = vrby->end(), +YRuby.cc:93: y2milestone("marking: value %ld refcount %d", it->first, it->second); +YRuby.cc:94: rb_gc_mark(it->first); +YRuby.cc:102: y2milestone("free: map size is %u", vrby->size()); +YRuby.cc:142: if ( argList->size() != 2 || ! argList->value(0)->isString() || ! argList->value(1)->isString() ) +YRuby.cc:144: string module_path = argList->value(1)->asString()->value(); +YRuby.cc:151:// rb_protect-enabled rb_funcall, see below +YRuby.cc:177: // make rooms for size-1 arguments to +YRuby.cc:181: VALUE values[size-1+3]; +YRuby.cc:184: for ( ; i < size-1; ++i ) +YRuby.cc:187: YCPValue v = argList->value(i+1); +YRuby.cc:188: y2milestone("Adding argument %d of type %s", i, v->valuetype_str()); +YRuby.cc:192: y2milestone( "Will call function '%s' in module '%s' with '%d' arguments", function.c_str(), module_name.c_str(), size-1); +YRuby.cc:195: values[2] = size-1; +RubyLogger.cc:1:/*---------------------------------------------------------------------\ +RubyLogger.cc:11:\----------------------------------------------------------------------/ +RubyLogger.cc:13:Author: Duncan Mac-Vicar <[email protected]> +Y2RubyTypePath.h:1:/*---------------------------------------------------------------------\ +Y2RubyTypePath.h:11:\----------------------------------------------------------------------/ +Y2RubyTypePath.h:13:Author: Duncan Mac-Vicar <[email protected]> +Y2RubyComponent.cc:1:/*---------------------------------------------------------------------\ +Y2RubyComponent.cc:11:\----------------------------------------------------------------------/ +Y2RubyComponent.cc:13:Author: Duncan Mac-Vicar <[email protected]> +Y2RubyComponent.cc:68: module.erase (module.size () - 3 /* strlen (".pm") */); +Y2RubyComponent.cc:70: args->add (YCPString(/*module*/ name)); +Y2RubyComponent.cc:71: args->add (YCPString(/*module*/ module)); +Y2RubyTypeConv.cc:1:/*---------------------------------------------------------------------\ +Y2RubyTypeConv.cc:11:\----------------------------------------------------------------------/ +Y2RubyTypeConv.cc:13:Author: Duncan Mac-Vicar <[email protected]> +Y2RubyTypeConv.cc:62: * Internal helper for Hash -> YCPMap +Y2RubyTypeConv.cc:84: * Internal helper for Array -> YCPList +Y2RubyTypeConv.cc:107: YRuby::refcount_map_t& vrby = YRuby::yRuby()->value_references_from_ycp; +Y2RubyTypeConv.cc:110: // YRuby got re-constructed during final cleanup; do nothing +Y2RubyTypeConv.cc:114: int & count = it->second; +Y2RubyTypeConv.cc:115: --count; +Y2RubyTypeConv.cc:129: int count = ++YRuby::yRuby()->value_references_from_ycp[value]; +Y2RubyTypeConv.cc:147: if (ycpval->isVoid()) +Y2RubyTypeConv.cc:151: else if (ycpval->isBoolean()) +Y2RubyTypeConv.cc:153: return ycpval->asBoolean()->value() ? Qtrue : Qfalse; +Y2RubyTypeConv.cc:155: else if (ycpval->isString()) +Y2RubyTypeConv.cc:157: return rb_str_new2(ycpval->asString()->value().c_str()); +Y2RubyTypeConv.cc:159: else if (ycpval->isPath()) +Y2RubyTypeConv.cc:162: return rb_str_new2(ycpval->asPath()->asString()->value().c_str()); +Y2RubyTypeConv.cc:164: else if (ycpval->isTerm()) +Y2RubyTypeConv.cc:166: return ryast_rterm_from_yterm(ycpval->asTerm()); +Y2RubyTypeConv.cc:168: else if (ycpval->isInteger()) +Y2RubyTypeConv.cc:170: return INT2NUM( ycpval->asInteger()->value() ); +Y2RubyTypeConv.cc:172: else if (ycpval->isFloat()) +Y2RubyTypeConv.cc:174: return rb_float_new(ycpval->asFloat()->value()); +Y2RubyTypeConv.cc:176: else if ( ycpval->isMap() ) +Y2RubyTypeConv.cc:180: YCPMap map = ycpval->asMap(); +Y2RubyTypeConv.cc:183: for (YCPMap::const_iterator it = map->begin(); it != map->end(); ++it) +Y2RubyTypeConv.cc:185: YCPValue key = it->first; +Y2RubyTypeConv.cc:186: YCPValue value = it->second; +Y2RubyTypeConv.cc:191: else if (ycpval->isList()) +Y2RubyTypeConv.cc:195: YCPList list = ycpval->asList(); +Y2RubyTypeConv.cc:203: else if (ycpval->isSymbol()) +Y2RubyTypeConv.cc:205: YCPSymbol symbol = ycpval->asSymbol(); +Y2RubyTypeConv.cc:206: return rb_intern(symbol->symbol_cstr()); +Y2RubyTypeConv.cc:208: else if (ycpval->isExternal()) +Y2RubyTypeConv.cc:210: YCPExternal ex = ycpval->asExternal(); +Y2RubyTypeConv.cc:211: if (ex->magic() == string(YCP_EXTERNAL_MAGIC)) { +Y2RubyTypeConv.cc:212: return (VALUE)(ex->payload()); // FIXME reference counting +Y2RubyTypeConv.cc:214: y2error("Unexpected magic '%s'.", (ex->magic()).c_str()); +Y2RubyTypeConv.cc:216: rb_raise( rb_eTypeError, "Conversion of YCP type %s not supported", ycpval->toString().c_str() ); +Y2RubyComponent.h:1:/*---------------------------------------------------------------------\ +Y2RubyComponent.h:11:\----------------------------------------------------------------------/ +Y2RubyComponent.h:13:Author: Duncan Mac-Vicar <[email protected]> +YRuby.h:1:/*---------------------------------------------------------------------\ +YRuby.h:11:\----------------------------------------------------------------------/ +YRuby.h:13:Author: Duncan Mac-Vicar <[email protected]> +YRuby.h:48: * Load a Ruby module - equivalent to "use" in Ruby. +YRuby.h:102: * To protect them from being garbage-collected, they must be marked +Y2RubyUtils.h:1:/*---------------------------------------------------------------------\ +Y2RubyUtils.h:11:\----------------------------------------------------------------------/ +Y2RubyUtils.h:13:Author: Duncan Mac-Vicar <[email protected]> +Y2RubyTypePath.cc:12://----------------------------------------------------------------------------- +Y2RubyTypePath.cc:20: wrapper->path = path; +Y2RubyTypePath.cc:55: wrapper->path = YCPPath(); +Y2RubyTypePath.cc:74: rb_define_method( ryast_cPath, "initialize", RB_METHOD( ryast_path_initialize ), -1 ); +RubyLogger.h:1:/*---------------------------------------------------------------------\ +RubyLogger.h:11:\----------------------------------------------------------------------/ +RubyLogger.h:13:Author: Duncan Mac-Vicar <[email protected]> +ycp.rb:1:# -----------------------------------------------------------------------\ +ycp.rb:11:# \----------------------------------------------------------------------/ +ycp.rb:13:# Author: Duncan Mac-Vicar <[email protected]> +ycp.rb:24:#-------------------------------------- +ycp.rb:40: m.module_eval <<-"END" +ycp.rb:69: m.module_eval <<-"END" +ycp.rb:80:#-------------------------------------- +ycp.rb:110:#-------------------------------------- +ycp.rb:160:#-------------------------------------- +ycp.rb:205:#-------------------------------------- +Y2RubyTypeConv.h:1:/*---------------------------------------------------------------------\ +Y2RubyTypeConv.h:11:\----------------------------------------------------------------------/ +Y2RubyTypeConv.h:13:Author: Duncan Mac-Vicar <[email protected]> +Y2RubyTypeTerm.h:1:/*---------------------------------------------------------------------\ +Y2RubyTypeTerm.h:11:\----------------------------------------------------------------------/ +Y2RubyTypeTerm.h:13:Author: Duncan Mac-Vicar <[email protected]> +YRubyNamespace.h:1:/*---------------------------------------------------------------------\ +YRubyNamespace.h:11:\----------------------------------------------------------------------/ +YRubyNamespace.h:13:Author: Duncan Mac-Vicar <[email protected]> +Y2CCRuby.cc:1:/*---------------------------------------------------------------------\ +Y2CCRuby.cc:11:\----------------------------------------------------------------------/ +Y2CCRuby.cc:13:Author: Duncan Mac-Vicar <[email protected]> +YCP.cc:1:/*---------------------------------------------------------------------\ +YCP.cc:11:\----------------------------------------------------------------------/ +YCP.cc:13:Author: Duncan Mac-Vicar <[email protected]> +YCP.cc:24:#include <ycp-ui/YUIComponent.h> +YCP.cc:85: ns->initialize (); +YCP.cc:91:/*-------------------------------------------- +YCP.cc:93: * Document-module: YCP::Ui +YCP.cc:95: *-------------------------------------------- +YCP.cc:103: * call-seq: +YCP.cc:142: // got it - initialize, remember +YCP.cc:143: c->setServerOptions (0, NULL); +YCP.cc:149: y2debug ("UI component already present: %s", c->name ().c_str ()); +YCP.cc:155:/*-------------------------------------------- +YCP.cc:157: * Document-module: YCP +YCP.cc:163: *-------------------------------------------- +YCP.cc:187: y2internal("component name %s\n", c->name().c_str()); +YCP.cc:210: y2internal("namespace created from %s\n", ns->filename().c_str()); +YCP.cc:221: * call-seq: +YCP.cc:236: * ycp_module_each_symbol(namespace) -> iterator +YCP.cc:241: * call-seq: +YCP.cc:258: y2internal("got namespace from %s\n", ns->filename().c_str()); +YCP.cc:261: for (unsigned int i=0; i < ns->symbolCount(); ++i) +YCP.cc:263: SymbolEntryPtr s = ns->symbolEntry(i); +YCP.cc:265: rb_ary_push(arr, rb_str_new2(s->name())); +YCP.cc:266: rb_ary_push(arr, ID2SYM(rb_intern(s->catString().c_str()))); +YCP.cc:307: * each_builtin_symbol(name) -> iterator +YCP.cc:321: * call-seq: +YCP.cc:331: static_declarations.symbolTable()->forEach(__find_symbol); +YCP.cc:344: if ( ys->table() ) ys->table()->forEach(_yield_symbol_entry); +YCP.cc:357: * call-seq: +YCP.cc:366: static_declarations.symbolTable()->forEach(_yield_symbol_entry); +YCP.cc:404: //Y2Namespace *ns = c->import(namespace_name); +YCP.cc:413: y2internal("Namespace created from %s\n", ns->filename().c_str()); +YCP.cc:418: TableEntry *sym_te = ns->table()->find(function_name); +YCP.cc:427: if (sym_te->sentry ()->isVariable () || +YCP.cc:428: sym_te->sentry ()->isReference ()) +YCP.cc:432: //ret_yv = YCP_getset_variable (aTHX_ ns_name, sym_te->sentry (), args); +YCP.cc:436: Y2Function* call = ns->createFunctionCall(function_name, 0 /*Type::fromSignature("list<string>()")*/); +YCP.cc:448: call->appendParameter (v); +YCP.cc:450: call->finishParameters (); +YCP.cc:452: YCPValue res = call->evaluateCall (); +YCP.cc:455: //y2internal ("Result: %i\n", res->asList()->size()); +YCP.cc:523: constTypePtr act_param_tp = Type::vt2type (param_v->valuetype ()); +YCP.cc:527: constTypePtr err_tp = bi_call->attachParameter (param_c, act_param_tp); +YCP.cc:530: if (err_tp->isError ()) +YCP.cc:538: y2internal ("attachParameter returned %s", err_tp->toString ().c_str ()); +YCP.cc:546: constTypePtr err_tp = bi_call->finalize (RubyLogger::instance ()); +YCP.cc:551: err_tp->toString ().c_str (), qualified_name); +YCP.cc:557: YCPValue ret_yv = bi_call->evaluate (false /* no const subexpr elim */); +YCP.cc:578: res = _call_ycp_builtin( namespace_name, symbol_str, argc-2, argv+2); +YCP.cc:601: res = _call_ycp_builtin( "", function_name, argc-1, argv+1); +YCP.cc:606:/*-------------------------------------------- +YCP.cc:608: * Document-module: YaST +YCP.cc:612: *-------------------------------------------- +YCP.cc:633: y2_logger((loglevel_t)NUM2INT(argv[0]),RSTRING(argv[1])->ptr,RSTRING(argv[2])->ptr,NUM2INT(argv[3]),"",RSTRING(argv[5])->ptr); +YCP.cc:671: rb_define_singleton_method( rb_mYCP, "call_ycp_function", RUBY_METHOD_FUNC(ycp_module_call_ycp_function), -1); +YCP.cc:672: rb_define_singleton_method( rb_mYCP, "call_ycp_builtin", RUBY_METHOD_FUNC(ycp_module_call_ycp_builtin), -1); +YCP.cc:673: rb_define_singleton_method( rb_mYCP, "method_missing", RUBY_METHOD_FUNC(ycp_method_missing), -1); +YCP.cc:683: rb_define_singleton_method( rb_mUi, "init", RUBY_METHOD_FUNC(ui_init), -1); +YCP.cc:689: rb_define_method( rb_mYaST, "logger", RUBY_METHOD_FUNC(yast_y2_logger), -1); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/tests/ycp/InRuby.rb new/yast2-ruby-bindings-0.3.11/tests/ycp/InRuby.rb --- old/yast2-ruby-bindings-0.3.10/tests/ycp/InRuby.rb 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/tests/ycp/InRuby.rb 2012-06-07 17:45:44.000000000 +0200 @@ -6,4 +6,8 @@ def self.raising_code raise "Wow exception!" end + + def self.get_hash + return { "a" => "b", "b" => "c" } + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/tests/ycp/ruby_from_ycp.ycp new/yast2-ruby-bindings-0.3.11/tests/ycp/ruby_from_ycp.ycp --- old/yast2-ruby-bindings-0.3.10/tests/ycp/ruby_from_ycp.ycp 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/tests/ycp/ruby_from_ycp.ycp 2012-06-07 17:45:44.000000000 +0200 @@ -16,7 +16,15 @@ y2error("exception completely ignored result: %1",result); return false; } + map h = tomap(InRuby::get_hash()); + y2milestone("get hash: %1",h); + if ( tostring(h["a"]:"") != "b" || tostring(h["b"]:"") != "c" ) + { + y2error("map is not properly returned: %1",result); + return false; + } import "CamelCase"; result = tostring(CamelCase::inc(10)); y2milestone("result: %1", result); + return true; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-ruby-bindings-0.3.10/tests/ycp/run_ycp_test.sh new/yast2-ruby-bindings-0.3.11/tests/ycp/run_ycp_test.sh --- old/yast2-ruby-bindings-0.3.10/tests/ycp/run_ycp_test.sh 2012-04-05 15:31:55.000000000 +0200 +++ new/yast2-ruby-bindings-0.3.11/tests/ycp/run_ycp_test.sh 2012-06-07 17:45:44.000000000 +0200 @@ -1,5 +1,10 @@ #!/bin/sh # $1 is the test case +if [ -z "$1" ]; then + echo "Missing file to run" >&2 + echo "Usage: run_ycp_test.sh <test file>" >&2 + exit 1 +fi DIR=${1%/*} # RPM_BUILD_ROOT will hold the YCP Ruby plugin at rpm build time if [ -d $RPM_BUILD_ROOT/usr/lib64 ]; then #we are on 64bit -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
