55件ヒット
[1-55件を表示]
(0.051秒)
ライブラリ
- ビルトイン (19)
-
fiddle
/ import (36)
モジュール
-
Fiddle
:: Importer (36)
検索結果
先頭5件
-
Fiddle
:: Importer # union(signature) -> Class (21114.0) -
C の共用体型に対応する Ruby のクラスを構築して返します。
...方法は Fiddle::Importer#struct と
ほぼ同様です。C における
typedef union epoll_data
{
void *ptr;
int fd;
uint32_t u32;
uint64_t u64;
} epoll_data_t;
は、Ruby上では
require 'fiddle/import'
module M
extend Fiddle::Importer
dlload "libc.so.6"......ned int")
typealias("uint64_t", "unsigned long long")
EPollData = union(["void *ptr",
"int fd",
"uint32_t u32",
"uint64_t u64",
])
end
となります。
返されるクラスは Fiddle::CUnion... -
Array
# union(*other _ arrays) -> Array (18132.0) -
集合の和演算です。self と other_arrays の配列にどれかに含まれる要素を 全て含む新しい配列を返します。重複する要素は取り除かれます。
...ect#hash により行われます。
@param other_arrays 0個以上の配列を指定します。
//emlist[例][ruby]{
["a", "b", "c"].union([ "c", "d", "a" ]) #=> ["a", "b", "c", "d"]
["a"].union(["e", "b"], ["a", "c", "b"]) #=> ["a", "e", "b", "c"]
["a"].union # => ["a"]
//}
@see Array#|... -
Fiddle
:: Importer # sizeof(t) -> Integer (3007.0) -
C における sizeof(t) の値を返します。
...zeof("char*") は環境によって 4 や 8 といった値を返します。
Fiddle::Importer#struct で定義した
構造体クラスを渡すと、その構造体のサイズを返します。
Fiddle::Importer#union で定義した共用体クラスも同様です。
t がクラスの場合、......@param t サイズを計算する対象
@raise Fiddle::DLError t として文字列を渡し、それが表している型を Fiddle が知らなかった
場合に発生します
例:
require 'fiddle/import'
module M
extend Fiddle::Importer
Timeval = struct(["long tv_sec",......"long tv_usec"])
p sizeof("char") # => 1
p sizeof("void*") # => 8
p sizeof(Timeval) # => 16
end... -
Fiddle
:: Importer # typealias(new , orig) -> () (3007.0) -
extern や struct で利用する型の別名を定義します。
...extern や struct で利用する型の別名を定義します。
@param new 別名(文字列)
@param orig 別名を付けたい型の名前(文字列)
@see Fiddle::Importer#extern, Fiddle::Importer#sizeof,
Fiddle::Importer#struct, Fiddle::Importer#union... -
Object
# to _ regexp -> Regexp (19.0) -
オブジェクトの Regexp への暗黙の変換が必要なときに内部で呼ばれます。 デフォルトでは定義されていません。
...ての場面で代置可能であるような、
* 正規表現そのものとみなせるようなもの
という厳しいものになっています。
//emlist[][ruby]{
class Foo
def to_regexp
/[\d]+/
end
end
it = Foo.new
p Regexp.union(/^at/, it) #=> /(?-mix:^at)|(?-mix:[\d]+)/
//}...