Generic value representations. More...
Macros | |
#define | lh_value_null |
Null value. | |
#define | lh_ptr_value(v) |
Convert an lh_value back to a pointer. | |
#define | lh_value_any_ptr(p) |
Convert any pointer into a lh_value. | |
#define | lh_value_ptr(p) |
Convert a pointer to an lh_value. More... | |
#define | lh_value_value(v) |
Identity; used to aid macros. | |
#define | lh_int_value(v) |
Convert an lh_value back to an int . | |
#define | lh_value_int(i) |
Convert an int to an lh_value. | |
#define | lh_long_value(v) |
Convert an lh_value back to a long . | |
#define | lh_value_long(i) |
Convert a long to an lh_value. | |
#define | lh_uint64_t_value(v) |
Convert an lh_value back to a uint64_t . | |
#define | lh_value_uint64_t(i) |
Convert a uint64_t to an lh_value. | |
#define | lh_bool_value(v) |
Convert an lh_value back to a bool . | |
#define | lh_value_bool(b) |
Convert a bool to an lh_value. | |
#define | lh_lh_string_value(v) |
Convert an lh_value back to a const char* . | |
#define | lh_value_lh_string(v) |
Convert a const char* to an lh_value. | |
#define | lh_optag_value(v) |
#define | lh_value_optag(o) |
#define | lh_lh_voidptr_value(v) |
Convert an lh_value back to a void* . | |
#define | lh_value_lh_voidptr(p) |
Convert a void* to an lh_value. | |
#define | lh_value_fun_ptr(f) |
Convert a function pointer into a lh_value. | |
Typedefs | |
typedef long long | lh_value |
Generic values are represented by an lh_value . More... | |
typedef const char * | lh_string |
Type definition for strings to aid with macros. | |
typedef void * | lh_voidptr |
Type definition for void pointers to aid with macros. | |
typedef void() | lh_voidfun() |
Generic function pointer. | |
typedef lh_value() | lh_actionfun(lh_value) |
A generic action working on generic lh_value s. | |
typedef lh_value() | lh_resultfun(lh_value local, lh_value arg) |
A lh_resultfun is called when a handled action is done. | |
typedef lh_value | lh_acquirefun(lh_value local) |
An acquire function copies the local state in a handler when required. | |
typedef void | lh_releasefun(lh_value local) |
A release function releases the local state in a handler when required. | |
Functions | |
lh_value | lh_check_value_ptr (const void *p) |
lh_voidfun * | lh_fun_ptr_value (lh_value v) |
Convert an lh_value back to a function pointer. | |
Generic value representations.
The lh_value is used to define generic functions in C where we can convert basic values to and from an lh_value, using the lh_<to>_<from>
defines.
#define lh_value_ptr | ( | p | ) |
Convert a pointer to an lh_value.
The pointer should not point into the stack.
typedef long long lh_value |
Generic values are represented by an lh_value
.
These can hold a long long
(which is at least 64-bits). The macros lh_<to>_<from>
are used to convert to and from lh_value
s.