Author: dmacvicar Date: Wed Jun 27 00:22:26 2007 New Revision: 39039 URL: http://svn.opensuse.org/viewcvs/yast?rev=39039&view=rev Log: - fix function calling - fix 64 bit path Modified: branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt branches/tmp/dmacvicar/ruby-yast/cmake/modules/FindYast.cmake branches/tmp/dmacvicar/ruby-yast/examples/ruby/ycp_from_ruby.rb branches/tmp/dmacvicar/ruby-yast/src/ruby/YRuby.cc Modified: branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt?rev=39039&r1=39038&r2=39039&view=diff ============================================================================== --- branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt (original) +++ branches/tmp/dmacvicar/ruby-yast/CMakeLists.txt Wed Jun 27 00:22:26 2007 @@ -1,4 +1,16 @@ PROJECT(yast2-bindings) + +# Library +IF ( DEFINED LIB ) + SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB}" ) +ELSE ( DEFINED LIB ) + IF (CMAKE_SIZEOF_VOID_P MATCHES "8") + SET( LIB_SUFFIX "64" ) + ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8") + SET ( LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}" ) +ENDIF ( DEFINED LIB ) +MESSAGE(STATUS "Libraries will be installed in ${LIB_INSTALL_DIR}" ) + # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH}) #SET(CMAKE_MODULE_PATH ${CMAKE_INSTALL_PREFIX}/share/cmake/Modules ${CMAKE_MODULE_PATH}) Modified: branches/tmp/dmacvicar/ruby-yast/cmake/modules/FindYast.cmake URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/cmake/modules/FindYast.cmake?rev=39039&r1=39038&r2=39039&view=diff ============================================================================== --- branches/tmp/dmacvicar/ruby-yast/cmake/modules/FindYast.cmake (original) +++ branches/tmp/dmacvicar/ruby-yast/cmake/modules/FindYast.cmake Wed Jun 27 00:22:26 2007 @@ -14,7 +14,7 @@ /usr/local/include/YaST2 ) -SET(YAST_PLUGIN_DIR ${CMAKE_INSTALL_PREFIX}/lib/YaST2/plugin) +SET(YAST_PLUGIN_DIR ${LIB_INSTALL_DIR}/YaST2/plugin) FIND_LIBRARY(YAST_LIBRARY NAMES y2 PATHS Modified: branches/tmp/dmacvicar/ruby-yast/examples/ruby/ycp_from_ruby.rb URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/examples/ruby/ycp_from_ruby.rb?rev=39039&r1=39038&r2=39039&view=diff ============================================================================== --- branches/tmp/dmacvicar/ruby-yast/examples/ruby/ycp_from_ruby.rb (original) +++ branches/tmp/dmacvicar/ruby-yast/examples/ruby/ycp_from_ruby.rb Wed Jun 27 00:22:26 2007 @@ -1,14 +1,14 @@ require 'yast' -# m = YaST::Module.new("Arch") -# puts m.sparc32 -# puts m.arch_short -# puts m.is_xen +m = YaST::Module.new("Arch") +puts m.sparc32 +puts m.arch_short +puts m.is_xen m = YaST::Module.new("Popup") m.Message("Hello") -exit + m = YaST::Module.new("Storage") dp = m.GetDiskPartition("/dev/sda1") dp.each do | key, value | Modified: branches/tmp/dmacvicar/ruby-yast/src/ruby/YRuby.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/dmacvicar/ruby-yast/src/ruby/YRuby.cc?rev=39039&r1=39038&r2=39039&view=diff ============================================================================== --- branches/tmp/dmacvicar/ruby-yast/src/ruby/YRuby.cc (original) +++ branches/tmp/dmacvicar/ruby-yast/src/ruby/YRuby.cc Wed Jun 27 00:22:26 2007 @@ -128,19 +128,24 @@ return YCPVoid(); } + // first element of the list is ignored int size = argList.size(); + // make rooms for size-1 arguments to + // the ruby function VALUE values[size-1]; - int i=1; - for ( ; i < size; ++i ) + int i=0; + for ( ; i < size-1; ++i ) { - YCPValue v = argList->value(i); - y2milestone("Adding argument of type %s", v->valuetype_str()); + // get the + YCPValue v = argList->value(i+1); + y2milestone("Adding argument %d of type %s", i, v->valuetype_str()); values[i] = ycpvalue_2_rbvalue(v); } - y2milestone( "Wll call function '%s' in module '%s' with '%d' arguments", function.c_str(), module_name.c_str(), size); - VALUE result = rb_funcall( module, rb_intern(function.c_str()), size-1, values ); + y2milestone( "Wll call function '%s' in module '%s' with '%d' arguments", function.c_str(), module_name.c_str(), size-1); + VALUE result = rb_funcall2( module, rb_intern(function.c_str()), size-1, values ); + //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); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org