hruby 0.3.2 → 0.3.3
raw patch · 4 files changed
+48/−41 lines, 4 files
Files
- Foreign/Ruby/Bindings.hsc +37/−40
- cbits/shim.c +8/−0
- cbits/shim.h +2/−0
- hruby.cabal +1/−1
Foreign/Ruby/Bindings.hsc view
@@ -90,48 +90,45 @@ foreign import ccall "rb_ary_new2" rb_ary_new2 :: CLong -> IO RValue foreign import ccall "rb_ary_new4" rb_ary_new4 :: CLong -> Ptr RValue -> IO RValue #endif-foreign import ccall "rb_load_protect" c_rb_load_protect :: RValue -> Int -> Ptr Int -> IO ()-foreign import ccall "rb_funcall" c_rb_funcall_0 :: RValue -> RID -> Int -> IO RValue-foreign import ccall "rb_funcall" c_rb_funcall_1 :: RValue -> RID -> Int -> RValue -> IO RValue-foreign import ccall "rb_funcall" c_rb_funcall_2 :: RValue -> RID -> Int -> RValue -> RValue -> IO RValue-foreign import ccall "rb_funcall" c_rb_funcall_3 :: RValue -> RID -> Int -> RValue -> RValue -> RValue -> IO RValue-foreign import ccall "rb_funcall" c_rb_funcall_4 :: RValue -> RID -> Int -> RValue -> RValue -> RValue -> RValue -> IO RValue-foreign import ccall "rb_funcall" c_rb_funcall_5 :: RValue -> RID -> Int -> RValue -> RValue -> RValue -> RValue -> RValue -> IO RValue-foreign import ccall "rb_gv_get" c_rb_gv_get :: CString -> IO RValue-foreign import ccall "rb_intern" c_rb_intern :: CString -> IO RID-foreign import ccall "rb_id2name" rb_id2name :: RID -> IO CString-foreign import ccall "rb_string_value_ptr" c_rb_string_value_ptr :: Ptr RValue -> IO CString-foreign import ccall "&rb_cObject" rb_cObject :: Ptr RValue-foreign import ccall "rb_iv_set" c_rb_iv_set :: RValue -> CString -> RValue -> IO RValue-foreign import ccall "rb_define_class" c_rb_define_class :: CString -> RValue -> IO RValue-foreign import ccall "rb_define_method" c_rb_define_method :: RValue -> CString -> FunPtr a -> Int -> IO ()-foreign import ccall "rb_define_global_function" c_rb_define_global_function :: CString -> FunPtr a -> Int -> IO ()-foreign import ccall "rb_const_get" rb_const_get :: RValue -> RID -> IO RValue-foreign import ccall "&safeCall" safeCallback :: FunPtr (RValue -> IO RValue)-foreign import ccall "rb_protect" c_rb_protect :: FunPtr (RValue -> IO RValue) -> RValue -> Ptr Int -> IO RValue-foreign import ccall "rb_string_value_cstr" c_rb_string_value_cstr :: Ptr RValue -> IO CString-foreign import ccall "rb_ary_new" rb_ary_new :: IO RValue-foreign import ccall "rb_ary_push" rb_ary_push :: RValue -> RValue -> IO RValue-foreign import ccall "rb_ary_entry" rb_ary_entry :: RValue -> CLong -> IO RValue-foreign import ccall "rb_hash_foreach" rb_hash_foreach :: RValue -> FunPtr a -> RValue -> IO ()-foreign import ccall "rb_big2str" rb_big2str :: RValue -> CInt -> IO RValue-foreign import ccall "rb_cstr_to_inum" rb_cstr_to_inum :: CString -> CInt -> CInt -> IO RValue-foreign import ccall "newFloat" newFloat :: Double -> IO RValue-foreign import ccall "rb_hash_new" rb_hash_new :: IO RValue-foreign import ccall "rb_hash_aset" rb_hash_aset :: RValue -> RValue -> RValue -> IO RValue-foreign import ccall "rb_define_module" c_rb_define_module :: CString -> IO ()--foreign import ccall "arrayLength" arrayLength :: RValue -> IO CLong-foreign import ccall "rubyType" rubyType :: RValue -> IO CInt-foreign import ccall "num2dbl" num2dbl :: RValue -> IO Double-foreign import ccall "int2num" int2num :: CLong -> IO RValue-foreign import ccall "num2long" num2long :: RValue -> IO CLong+foreign import ccall safe "rb_load_protect" c_rb_load_protect :: RValue -> Int -> Ptr Int -> IO ()+foreign import ccall safe "rb_funcall" c_rb_funcall_0 :: RValue -> RID -> Int -> IO RValue+foreign import ccall safe "rb_funcall" c_rb_funcall_1 :: RValue -> RID -> Int -> RValue -> IO RValue+foreign import ccall safe "rb_funcall" c_rb_funcall_2 :: RValue -> RID -> Int -> RValue -> RValue -> IO RValue+foreign import ccall safe "rb_funcall" c_rb_funcall_3 :: RValue -> RID -> Int -> RValue -> RValue -> RValue -> IO RValue+foreign import ccall safe "rb_funcall" c_rb_funcall_4 :: RValue -> RID -> Int -> RValue -> RValue -> RValue -> RValue -> IO RValue+foreign import ccall safe "rb_funcall" c_rb_funcall_5 :: RValue -> RID -> Int -> RValue -> RValue -> RValue -> RValue -> RValue -> IO RValue+foreign import ccall unsafe "rb_gv_get" c_rb_gv_get :: CString -> IO RValue+foreign import ccall unsafe "rb_intern" c_rb_intern :: CString -> IO RID+foreign import ccall unsafe "rb_id2name" rb_id2name :: RID -> IO CString+foreign import ccall unsafe "rb_string_value_ptr" c_rb_string_value_ptr :: Ptr RValue -> IO CString+foreign import ccall unsafe "&rb_cObject" rb_cObject :: Ptr RValue+foreign import ccall unsafe "rb_iv_set" c_rb_iv_set :: RValue -> CString -> RValue -> IO RValue+foreign import ccall safe "rb_define_class" c_rb_define_class :: CString -> RValue -> IO RValue+foreign import ccall safe "rb_define_method" c_rb_define_method :: RValue -> CString -> FunPtr a -> Int -> IO ()+foreign import ccall safe "rb_define_global_function" c_rb_define_global_function :: CString -> FunPtr a -> Int -> IO ()+foreign import ccall unsafe "rb_const_get" rb_const_get :: RValue -> RID -> IO RValue+foreign import ccall safe "&safeCall" safeCallback :: FunPtr (RValue -> IO RValue)+foreign import ccall safe "rb_protect" c_rb_protect :: FunPtr (RValue -> IO RValue) -> RValue -> Ptr Int -> IO RValue+foreign import ccall unsafe "rb_string_value_cstr" c_rb_string_value_cstr :: Ptr RValue -> IO CString+foreign import ccall unsafe "rb_ary_new" rb_ary_new :: IO RValue+foreign import ccall unsafe "rb_ary_push" rb_ary_push :: RValue -> RValue -> IO RValue+foreign import ccall unsafe "rb_ary_entry" rb_ary_entry :: RValue -> CLong -> IO RValue+foreign import ccall safe "rb_hash_foreach" rb_hash_foreach :: RValue -> FunPtr a -> RValue -> IO ()+foreign import ccall unsafe "rb_big2str" rb_big2str :: RValue -> CInt -> IO RValue+foreign import ccall unsafe "rb_cstr_to_inum" rb_cstr_to_inum :: CString -> CInt -> CInt -> IO RValue+foreign import ccall unsafe "newFloat" newFloat :: Double -> IO RValue+foreign import ccall unsafe "rb_hash_new" rb_hash_new :: IO RValue+foreign import ccall unsafe "rb_hash_aset" rb_hash_aset :: RValue -> RValue -> RValue -> IO RValue+foreign import ccall unsafe "rb_define_module" c_rb_define_module :: CString -> IO () -sym2id :: RValue -> RID-sym2id x = (fromIntegral (ptrToIntPtr x)) `shiftR` 8+foreign import ccall unsafe "arrayLength" arrayLength :: RValue -> IO CLong+foreign import ccall unsafe "rubyType" rubyType :: RValue -> IO CInt+foreign import ccall unsafe "num2dbl" num2dbl :: RValue -> IO Double+foreign import ccall unsafe "int2num" int2num :: CLong -> IO RValue+foreign import ccall unsafe "num2long" num2long :: RValue -> IO CLong -id2sym :: RID -> RValue-id2sym x = intPtrToPtr (fromIntegral ( (x `shiftL` 8) .|. 0x0e ))+foreign import ccall unsafe "id2sym" id2sym :: RID -> RValue+foreign import ccall unsafe "sym2id" sym2id :: RValue -> RID rbFalse,rbTrue,rbNil,rbUndef :: RValue #ifdef RUBY2
cbits/shim.c view
@@ -18,6 +18,14 @@ #endif } +VALUE id2sym(ID i) {+ return ID2SYM(i);+}++ID sym2id(VALUE v) {+ return SYM2ID(v);+}+ VALUE safeCall(VALUE args) { struct s_dispatch * d = (struct s_dispatch *) args;
cbits/shim.h view
@@ -20,6 +20,8 @@ VALUE int2num(long x); long num2long(VALUE v); double num2dbl(VALUE v);+VALUE id2sym(ID i);+ID sym2id(VALUE v); #ifdef RUBY18 #define RUBY_T_NONE T_NONE
hruby.cabal view
@@ -2,7 +2,7 @@ -- see http://haskell.org/cabal/users-guide/ name: hruby-version: 0.3.2+version: 0.3.3 synopsis: Embed a Ruby intepreter in your Haskell program ! description: This doesn't work with Ruby 1.9. Everything you need should be in Foreign.Ruby.Safe. license: BSD3