ライブラリ
- ビルトイン (84)
- e2mmap (12)
-
fiddle
/ import (72) -
irb
/ cmd / chws (24) -
irb
/ cmd / help (12) -
irb
/ cmd / load (12) -
irb
/ cmd / nop (24) -
irb
/ cmd / pushws (36) -
irb
/ ext / use-loader (24) - open-uri (36)
- openssl (48)
- socket (24)
クラス
- IO (24)
-
IRB
:: ExtendCommand :: ChangeWorkspace (12) -
IRB
:: ExtendCommand :: CurrentWorkingWorkspace (12) -
IRB
:: ExtendCommand :: Help (12) -
IRB
:: ExtendCommand :: Load (12) -
IRB
:: ExtendCommand :: Nop (24) -
IRB
:: ExtendCommand :: PopWorkspace (12) -
IRB
:: ExtendCommand :: PushWorkspace (12) -
IRB
:: ExtendCommand :: Workspaces (12) - Module (12)
- Object (48)
-
OpenSSL
:: SSL :: SSLSocket (24) - UDPSocket (12)
- UNIXServer (12)
モジュール
- Exception2MessageMapper (12)
-
Fiddle
:: Importer (72) -
IRB
:: ExtendCommandBundle (24) -
OpenSSL
:: Buffering (24) -
OpenURI
:: OpenRead (36)
キーワード
- Fail (6)
- Raise (6)
-
accept
_ nonblock (24) - bind (12)
-
connect
_ nonblock (12) -
create
_ value (12) - execute (96)
- extended (12)
-
irb
_ context (12) -
irb
_ load (12) -
irb
_ require (12) -
is
_ a? (12) -
kind
_ of? (12) - open (24)
- read (12)
-
read
_ nonblock (24) -
recvfrom
_ nonblock (12) -
singleton
_ methods (12) - sizeof (12)
- struct (12)
- union (12)
- value (12)
-
write
_ nonblock (24)
検索結果
先頭5件
- Fiddle
:: Importer # value(type , val = nil) -> Fiddle :: CStruct - Exception2MessageMapper
# Fail(exception _ class = nil , *rest) -> () - Exception2MessageMapper
# Raise(exception _ class = nil , *rest) -> () - Fiddle
:: Importer # bind(signature , *opts) { . . . } -> Fiddle :: Function - IRB
:: ExtendCommand :: Load # execute(file _ name , priv = nil) -> nil
-
Fiddle
:: Importer # value(type , val = nil) -> Fiddle :: CStruct (3119.0) -
型が type で要素名が "value" であるような構造体を 定義(Fiddle::Importer#struct)し、 その構造体のメモリを Fiddle::CStruct#malloc で確保し、 確保したメモリを保持しているオブジェクトを返します。
...型が type で要素名が "value" であるような構造体を
定義(Fiddle::Importer#struct)し、
その構造体のメモリを Fiddle::CStruct#malloc で確保し、
確保したメモリを保持しているオブジェクトを返します。
type は "int", "void*" といった文字列......された構造体に
その値を代入します。
@param type 型を表す文字列
@param val 構造体に確保される初期値
例
require 'fiddle/import'
module M
extend Fiddle::Importer
end
v = M.value("int", 32)
p v.value # => 32
v.value = 48
p v.value # => 48... -
Exception2MessageMapper
# Fail(exception _ class = nil , *rest) -> () (3113.0) -
登録されている情報を使用して、例外を発生させます。
...@param exception_class 例外クラス。
@param rest メッセージに埋め込む値。
@raise Exception2MessageMapper::ErrNotRegisteredException 指定された例外クラスに対応するメッセージが存在しない場合に発生します。
例:
class Foo
extend Exception2M......essageMapper
p def_exception :NewExceptionClass, "message...%d, %d and %d" # =>
def foo
Raise NewExceptionClass, 1, 2, 3
end
end
Foo.new().foo() #=> in `Raise': message...1, 2 and 3 (Foo::NewExceptionClass)
# という例外が発生します。......Foo.Raise Foo::NewExceptionClass, 1, 3, 5 #=> in `Raise': message...1, 3 and 5 (Foo::NewExceptionClass)
# という例外が発生します。... -
Exception2MessageMapper
# Raise(exception _ class = nil , *rest) -> () (3113.0) -
登録されている情報を使用して、例外を発生させます。
...@param exception_class 例外クラス。
@param rest メッセージに埋め込む値。
@raise Exception2MessageMapper::ErrNotRegisteredException 指定された例外クラスに対応するメッセージが存在しない場合に発生します。
例:
class Foo
extend Exception2M......essageMapper
p def_exception :NewExceptionClass, "message...%d, %d and %d" # =>
def foo
Raise NewExceptionClass, 1, 2, 3
end
end
Foo.new().foo() #=> in `Raise': message...1, 2 and 3 (Foo::NewExceptionClass)
# という例外が発生します。......Foo.Raise Foo::NewExceptionClass, 1, 3, 5 #=> in `Raise': message...1, 3 and 5 (Foo::NewExceptionClass)
# という例外が発生します。... -
Fiddle
:: Importer # bind(signature , *opts) { . . . } -> Fiddle :: Function (3113.0) -
Ruby のブロックを C の関数で wrap し、その関数をモジュールに インポートします。
...Ruby のブロックを C の関数で wrap し、その関数をモジュールに
インポートします。
これでインポートされた関数はモジュール関数として定義されます。
また、Fiddle::Importer#[] で Fiddle::Function オブジェクトとして
取り出す......ば
"int compare(void*, void*)" のように指定します。
opts には :stdcall もしくは :cdecl を渡すことができ、
呼出規約を明示することができます。
@return インポートした関数を表す Fiddle::Function オブジェクトを返します。
@param signatu......グチャ
@param opts オプション
例
require 'fiddle/import'
module M
extend Fiddle::Importer
dlload "libc.so.6"
typealias "size_t", "unsigned long"
extern "int qsort(void*, size_t, size_t, void*)"
bind("int compare(void*, void*)"){|px, py|
x = px.to_s(Fid... -
IRB
:: ExtendCommand :: Load # execute(file _ name , priv = nil) -> nil (3101.0) -
ファイル path を Ruby スクリプトとみなし、現在の irb インタプリタ上で実 行します。
...ファイル path を Ruby スクリプトとみなし、現在の irb インタプリタ上で実
行します。
Kernel.#load と異なり、path の内容を irb で一行ずつタイプしたかの
ように、irb 上で一行ずつ評価されます。
@param file_name ファイル名を文......字列で指定します。
@param priv 真を指定した場合は実行は内部的に生成される無名モジュール上
で行われ、グローバルな名前空間を汚染しません。
@raise LoadError 読み込みに失敗した場合に発生します。... -
IRB
:: ExtendCommandBundle # irb _ load(*opts , &b) -> nil (3101.0) -
現在の irb に関する IRB::Context に対して irb_load コマンドを実行 します。
...現在の irb に関する IRB::Context に対して irb_load コマンドを実行
します。
@see IRB::ExtendCommand::Load#execute... -
IRB
:: ExtendCommandBundle # irb _ require(*opts , &b) -> bool (3101.0) -
現在の irb に関する IRB::Context に対して irb_require コマンドを 実行します。
...現在の irb に関する IRB::Context に対して irb_require コマンドを
実行します。
@see IRB::ExtendCommand::Require#execute... -
Fiddle
:: Importer # sizeof(t) -> Integer (3025.0) -
C における sizeof(t) の値を返します。
...った値を返します。
Fiddle::Importer#struct で定義した
構造体クラスを渡すと、その構造体のサイズを返します。
Fiddle::Importer#union で定義した共用体クラスも同様です。
t がクラスの場合、t が to_ptr というインスタンスメソッ......は Pointer[t].size を返します。
@param t サイズを計算する対象
@raise Fiddle::DLError t として文字列を渡し、それが表している型を Fiddle が知らなかった
場合に発生します
例:
require 'fiddle/import'
module M
extend Fiddle::Importe......r
Timeval = struct(["long tv_sec", "long tv_usec"])
p sizeof("char") # => 1
p sizeof("void*") # => 8
p sizeof(Timeval) # => 16
end... -
Fiddle
:: Importer # struct(signature) -> Class (3019.0) -
C の構造体型に対応する Ruby のクラスを構築して返します。
...* to_ptr
* to_i
* 構造体の各メンバへのアクセサ
返されるクラスは Fiddle::CStruct を継承しています。詳しくは
そちらを参照してください。
@param signature 構造体の各要素を文字列で表現したものの配列
require 'fiddle/import'......module M
extend Fiddle::Importer
dlload "libc.so.6"
extern "int gettimeofday(void*, void*)"
Timeval = struct(["long tv_sec", "long tv_usec"])
end
time = M::Timeval.malloc
M.gettimeofday(time, Fiddle::NULL)
p time.tv_sec
p time.tv_usec... -
UDPSocket
# recvfrom _ nonblock(maxlen , flags=0) -> [String , Array] (3013.0) -
ソケットをノンブロッキングモードに設定した後、 recvfrom(2) でソケットからデータを受け取ります。
...adable が extend
されています。
require 'socket'
s1 = UDPSocket.new
s1.bind("127.0.0.1", 0)
s2 = UDPSocket.new
s2.bind("127.0.0.1", 0)
s2.connect(*s1.addr.values_at(3,1))
s1.connect(*s2.addr.values_at(3,1))
s1.send "aaa", 0
begin # emulate blocking recvfrom
p s2.recvfr......om_nonblock(10)
#=> ["aaa", ["AF_INET", 33302, "localhost.localdomain", "127.0.0.1"]]
rescue IO::WaitReadable
IO.select([s2])
retry
end
@param maxlen 受け取るデータの最大バイト数
@param flags フラグ
@see IPSocket#recvfrom...