(mapped-buffer channel)
(mapped-buffer channel size-or-flag)
(mapped-buffer channel size flag)
(mapped-buffer channel offset size flag)
(mask table flags)
(mask table flag flags)
(mask table flag1 flag2 flags)
Converts keywords to a bitfield mask.
Given one or more keyword flag
s, creates a long bitmask
that can be consumed by native functions. Needs a hashmap table
that
contains possible long mappings, 0-2 keywords, and a (possibly empty)
list of additional keywords.
If called with nil
table or an unknown keyword, throws Illegalargumentexception
.
The inverse function is unmask
.
Examples:
(mask {:a 1 :b 2 :c 4} [:a :c]) => 5
(mask {:a 1 :b 2 :c 4} :a [:c]) => 5
(mask {:a 1 :b 2 :c 4} :a :c []) => 5
Converts keywords to a bitfield mask. Given one or more keyword `flag`s, creates a long bitmask that can be consumed by native functions. Needs a hashmap `table` that contains possible long mappings, 0-2 keywords, and a (possibly empty) list of additional keywords. If called with `nil` table or an unknown keyword, throws `Illegalargumentexception`. The inverse function is [[unmask]]. Examples: (mask {:a 1 :b 2 :c 4} [:a :c]) => 5 (mask {:a 1 :b 2 :c 4} :a [:c]) => 5 (mask {:a 1 :b 2 :c 4} :a :c []) => 5
(unmask table mask)
Converts a bitfield mask
to keywords.
Given a mapping table
and a bitfield mask
, returns a lazy sequence
with decoded keyword flags contained in the bitmask.
The reverse function is mask
.
Examples:
(unmask {:a 1 :b 2 :c 4} 5) => '(:a :c)
Converts a bitfield `mask` to keywords. Given a mapping `table` and a bitfield `mask`, returns a lazy sequence with decoded keyword flags contained in the bitmask. The reverse function is [[mask]]. Examples: (unmask {:a 1 :b 2 :c 4} 5) => '(:a :c)
(unmask1 table mask)
Converts a bitfield mask
to one keyword.
Given a mapping table
and a bitfield mask
, returns the first decoded keyword
that is contained in the bitmask. This is useful when we know that just
one of the values in the table fits the bitmask, so the result of unmask
would contain one element anyway.
The reverse function is mask
.
Examples:
(unmask1 {:a 1 :b 2 :c 4} 2) => :b
Converts a bitfield `mask` to one keyword. Given a mapping `table` and a bitfield `mask`, returns the first decoded keyword that is contained in the bitmask. This is useful when we know that just one of the values in the table fits the bitmask, so the result of [[unmask]] would contain one element anyway. The reverse function is [[mask]]. Examples: (unmask1 {:a 1 :b 2 :c 4} 2) => :b
(with-check error-fn status form)
Evaluates form
if status
is zero (e.g. CL_SUCCESS
), otherwise throws
an appropriate ExceptionInfo
with decoded informative details.
It helps with native interop methods that return error codes directly, while
returning computation results through side-effects in arguments.
Example:
(with-check (some-call-that-returns-error-code) result)
Evaluates `form` if `status` is zero (e.g. `CL_SUCCESS`), otherwise throws an appropriate `ExceptionInfo` with decoded informative details. It helps with native interop methods that return error codes directly, while returning computation results through side-effects in arguments. Example: (with-check (some-call-that-returns-error-code) result)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close