Next:
4.10 Classes
Up:
4. The libonyx library
Previous:
4.8 Guidelines for writing
 
Contents
 
Index
4.9 API
void
libonyx_init
(void):
Input(s):
None.
Output(s):
None.
Exception(s):
CW_ONYXX_OOM
.
Description:
Initialize various global variables. In particular, initialize
cw_g_mem
.
void
libonyx_shutdown
(void):
Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Clean up the global variables that are initialized by
libonyx_init
().
void *
cw_opaque_alloc_t
(void *a_arg, size_t a_size, const char *a_filename, cw_uint32_t a_line_num):
Input(s):
a_arg:
Opaque pointer.
a_size:
Size of memory range to allocate.
a_filename:
Should be __FILE__.
a_line_num:
Should be __LINE__.
Output(s):
retval:
Pointer to a memory range.
Exception(s):
CW_ONYXX_OOM
.
Description:
Allocate
a_size
of space and return a pointer to it.
void *
cw_opaque_realloc_t
(void *a_arg, void *a_ptr, size_t a_size, const char *a_filename, cw_uint32_t a_line_num):
Input(s):
a_arg:
Opaque pointer.
a_ptr:
Pointer to memory range to be reallocated.
a_size:
Size of memory range to allocate.
a_filename:
Should be __FILE__.
a_line_num:
Should be __LINE__.
Output(s):
retval:
Pointer to a memory range.
Exception(s):
CW_ONYXX_OOM
.
Description:
Reallocate
a_size
of space and return a pointer to it.
void
cw_opaque_dealloc_t
(void *a_mem, void *a_ptr, size_t a_size, const char *a_filename, cw_uint32_t a_line_num):
Input(s):
a_arg:
Opaque pointer.
a_ptr:
Pointer to to memory range to be freed.
a_size:
Sizef of memory range pointed to by
a_ptr
.
a_filename:
Should be __FILE__.
a_line_num:
Should be __LINE__.
Output(s):
None.
Exception(s):
None.
Description:
Deallocate the memory pointed to by
a_ptr
.
void *
cw_opaque_alloc
(cw_opaque_alloc_t *a_func, void *a_arg, size_t a_size):
Input(s):
a_func:
Opaque allocator function pointer.
a_arg:
Opaque pointer.
a_size:
Size of memory range to allocate.
Output(s):
retval:
Pointer to a memory range.
Exception(s):
CW_ONYXX_OOM
.
Description:
Allocate
a_size
of space and return a pointer to it.
void *
cw_opaque_realloc
(cw_opaque_realloc_t *a_func, void *a_arg, void *a_ptr, size_t a_size):
Input(s):
a_func:
Opaque allocator function pointer.
a_arg:
Opaque pointer.
a_ptr:
Pointer to memory range to be reallocated.
a_size:
Size of memory range to allocate.
Output(s):
retval:
Pointer to a memory range.
Exception(s):
CW_ONYXX_OOM
.
Description:
Reallocate
a_size
of space and return a pointer to it.
void
cw_opaque_dealloc
(cw_opaque_dealloc_t *a_func, void *a_mem, void *a_ptr, size_t a_size):
Input(s):
a_func:
Opaque allocator function pointer.
a_arg:
Opaque pointer.
a_ptr:
Pointer to to memory range to be freed.
a_size:
Sizef of memory range pointed to by
a_ptr
.
Output(s):
None.
Exception(s):
None.
Description:
Deallocate the memory pointed to by
a_ptr
.
void
cw_onyx_code
(cw_nxo_t *a_thread, const char *a_code):
Input(s):
a_thread:
Pointer to a thread
nxo
.
a_code:
A "-delimited string constant.
Output(s):
None.
Exception(s):
Depends on actions of a_code.
Description:
Convenience macro for static embedded
Onyx
code.
void
cw_assert
(expression):
Input(s):
expression:
C expression that evaluates to zero or non-zero.
Output(s):
Possible error printed to
stderr
.
Exception(s):
None.
Description:
If the expression evaluates to zero, print an error message to
stderr
and
abort
().
Note: This macro is only active if the
CW_ASSERT
cpp macro is defined.
void
cw_not_reached
(void):
Input(s):
None.
Output(s):
Error printed to
stderr
.
Exception(s):
None.
Description:
Abort with an error message.
Note: This macro is only active if the
CW_ASSERT
cpp macro is defined.
void
cw_check_ptr
(a_pointer):
Input(s):
a_pointer:
A pointer.
Output(s):
Possible error printed to
stderr
.
Exception(s):
None.
Description:
If
a_pointer
is NULL, print an error message to
stderr
and
abort
().
Note: This macro is only active if the
CW_ASSERT
cpp macro is defined.
void
cw_error
(const char *a_str):
Input(s):
a_str:
Pointer to a NULL-terminated character array.
Output(s):
Contents of
a_str
, followed by a carriage return, printed to
stderr
.
Exception(s):
None.
Description:
Print the contents of
a_str
, followed by a carriage return, to
stderr
.
cw_uint64_t
cw_ntohq
(cw_uint64_t a_val):
Input(s):
a_val:
64 bit integer.
Output(s):
retval:
64 bit integer.
Exception(s):
None.
Description:
Convert
a_val
from network byte order to host byte order and return the result.
cw_uint64_t
cw_htonq
(cw_uint64_t a_val):
Input(s):
a_val:
64 bit integer.
Output(s):
retval:
64 bit integer.
Exception(s):
None.
Description:
Convert
a_val
from host byte order to network byte order and return the result.
cw_uint32_t
cw_offsetof
(<type> a_type, <field_name> a_field):
Input(s):
a_type:
C structure type name.
a_field:
Name of a field within
a_type
.
Output(s):
retval:
Offset of
a_field
into
a_type
.
Exception(s):
None.
Description:
Calculate the offset of
a_field
into
a_type
and return the result.
Next:
4.10 Classes
Up:
4. The libonyx library
Previous:
4.8 Guidelines for writing
 
Contents
 
Index
Jason Evans 2003-01-31