next up previous contents index
Next: Index Up: Contents Previous: The onyx program   Contents   Index

Subsections

The libonyx library

The libonyx library implements an embeddable Onyx interpreter. libonyx is designed to allow multiple interpreter instances in the same program, though since Onyx is a multi-threaded language, in most cases it makes more sense to use a single interpreter instance with multiple threads.

The Onyx language is described elsewhere in this manual, so this chapter documents the C API with as little information about the Onyx language as possible.

A minimal program that runs the Onyx interpreter interactively looks like:

#include <libonyx/libonyx.h>

int
main(int argc, char **argv, char **envp)
{
        cw_nx_t         nx;
        cw_nxo_t        thread, *nxo;

        /* Initialize libonyx and the Onyx interpreter. */
        libonyx_init();
        nx_new(&nx, NULL, argc, argv, envp);

        /* Create a thread. */
        nxo_thread_new(&thread, &nx);

        /* Set up stdin for evaluation. */
        nxo = nxo_stack_push(nxo_thread_ostack_get(&thread));
        nxo_dup(nxo, nxo_thread_stdin_get(&thread));
        nxo_attr_set(nxo, NXOA_EXECUTABLE);

        /* Start the thread. */
        nxo_thread_start(&thread);

        /* Clean up. */
        nx_delete(&nx);
        libonyx_shutdown();
        return 0;
}

In most cases, an application will need to implement additional Onyx operators (and make them accessible from within the Onyx interpreter) in order to make the application accessible/controllable from the Onyx interpreter. If the application user interface is to be interaction with the Onyx interpreter, then little else needs to be done.

Compilation

Use the following compiler command line to compile applications with libonyx.
cc <file> -lonyx -lpthread

Types

libonyx is careful to use the following data types rather than the built-in types (other than when using system library functions and string pointers (char *)) to allow easy porting and explicit knowledge of variable sizes:
cw_bool_t:
Boolean, either FALSE or TRUE.
cw_sint8_t:
Signed 8 bit variable.
cw_uint8_t:
Unsigned 8 bit variable.
cw_sint16_t:
Signed 16 bit variable.
cw_uint16_t:
Unsigned 16 bit variable.
cw_sint32_t:
Signed 32 bit variable.
cw_uint32_t:
Unsigned 32 bit variable.
cw_sint64_t:
Signed 64 bit variable.
cw_uint64_t:
Unsigned 64 bit variable.

Global variables

libonyx defines the following global variables, which can be used by the application:
cw_g_mem:
mem instance, default memory allocator.

Object instantiation

Many classes provide a means for external memory allocation, and in some cases for automatic cleanup during destruction. This feature enables improved performance and cache locality, but if misunderstood, can result in mysterious memory corruption and leaks.

Threads

libonyx encapsulates each interpreter instance in an nx object. An nx object supports running multiple concurrent threads. Each thread context is encapsulated by an nxo thread object.

In general, each process thread should execute in its own nxo thread object context, though the only explicit restriction placed on nxo thread object operations is that only one thread can be executing in an nxo thread object context at a time. In other words, the nxo thread class does not synchronize access to its internals, since there is normally no reason for multiple threads to execute in the same nxo thread object context.

Garbage collection

Since there can be arbitrary threads executing in the interpreter concurrently, there are two ways to implement safe garbage collection: concurrent or atomic. libonyx uses atomic garbage collection, which means that the thread doing garbage collection suspends all other threads that are created via thd_new(..., TRUE) during the mark phase. In order for this to work, the garbage collector must not do any locking while the other threads are suspended, or else there is a high probability of eventual deadlock. libonyx itself meets these criteria, as must any C extensions to the interpreter that are executed by the garbage collector during the mark phase (reference iteration).

Exceptions

libonyx reserves xep exception numbers 0 to 127 and defines the following exceptions:
_CW_ONYXX_OOM:
Memory allocation error.
_CW_ONYXX_EXIT:
Internal use, for the exit operator.
_CW_ONYXX_STOP:
Internal use, for the stop operator.
_CW_ONYXX_QUIT:
Internal use, for the quit operator.

Integration issues

Thread creation

libonyx's garbage collector uses the thd class to suspend and resume all other threads during the mark phase of atomic collection. For this to work, all threads that have any contact with libonyx must be created as suspendible threads using the thd class.

This can cause integration headaches for existing threaded applications, but there is no other portable way to suspend and resume threads. The only alternative is to assure that only one thread is executing in the interpreter and to disable timeout-based (asynchronous) collection.

Restarted interrupted system calls

As mentioned above, libonyx uses thread suspension and resumption to implement garbage collection. This has the side-effect of making restarted interrupted system calls a real possibility. However, the operating system will return with a partial result if the system call was partially complete when it was interrupted. In practice, what this means is that short reads and writes are possible where they otherwise wouldn't happen, so the application should not make any assumptions about interruptible system calls always completing with a full result. See the thd class documentation for more details.

Guidlines for writing extensions

When embedding libonyx in an application, it is usually desireable to add some operators so that the interpreter can interact with the rest of the application. The libonyx source code contains hundreds of operators that can be used as examples when writing new operators. However, there are some very important rules that operators must follow, some of which may not be obvious when reading the code.

Since Onyx type checking is dynamic, it is the responsibility of the operators to assure objects are the correct type before calling any of the type-specific nxo_*() functions. Failure to do so will result in unpredictable behavior and likely crashes.

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, out_std, and out_err.
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:
Allocate 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_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 file descriptor 2.
Exception(s):
None.
Description:
If the expression evaluates to zero, print an error message to file descriptor 2 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 file descriptor 2.
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 file descriptor 2.
Exception(s):
None.
Description:
If a_pointer is NULL, print an error message to file descriptor 2 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 file descriptor 2.
Exception(s):
None.
Description:
Print the contents of a_str, followed by a carriage return, to file descriptor 2.
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.

Classes


ch

The ch class implements chained hashing. It uses a simple bucket chaining hash table implementation. Table size is set at creation time, and cannot be changed, so performance will suffer if a ch object is over-filled. The main cw_ch_t data structure and the table are contiguously allocated, which means that care must be taken when manually pre-allocating space for the structure. Each item that is inserted into the ch object is encapsulated by a chi object, for which space can optionally be passed in as a parameter to ch_insert(). If no space for the chi object is passed in, the mem class is used internally for allocation.

Multiple entries with the same key are allowed and are stored in LIFO order.

Calling ch_remove_iterate() and ch_get_iterate() are guaranteed to operate on the oldest item in the hash table, which means that the hash code has an integrated FIFO queue.

The ch class is meant to be small and simple without compromising performance. Note that it is not well suited for situations where the number of items can vary wildly; the dch class is designed for such situations.

API

cw_uint32_t _CW_CH_TABLE2SIZEOF(cw_uint32_t a_table_size):

Input(s):
a_table_size:
Number of slots in the hash table.
Output(s):
retval:
Size of a ch object with a_table_size slots.
Exception(s):
None.
Description:
Calculate the size of a ch object with a_table_size slots.
ch_new(cw_ch_t *a_ch, cw_opaque_alloc_t *a_alloc, cw_opaque_dealloc_t *a_dealloc, void *a_arg, cw_uint32_t a_table_size, cw_ch_hash_t *a_hash, cw_ch_key_comp_t *a_key_comp):

Input(s):
a_ch:
Pointer to space for a ch with a_table_size slots, or NULL. Use the _CW_CH_TABLE2SIZEOF() macro to calculate the total space needed for a given table size.
a_alloc:
Pointer to an allocation function to use internally.
a_dealloc:
Pointer to a deallocation function to use internally.
a_arg:
Opaque pointer to pass to a_alloc() and a_dealloc().
a_table_size:
Number of slots in the hash table.
a_hash:
Pointer to a hashing function.
a_key_comp:
Pointer to a key comparison function.
Output(s):
retval:
Pointer to a ch.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void ch_delete(cw_ch_t *a_ch):

Input(s):
a_ch:
Pointer to a ch.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
cw_uint32_t ch_count(cw_ch_t *a_ch):

Input(s):
a_ch:
Pointer to a ch.
Output(s):
retval:
Number of items in a_ch.
Exception(s):
None.
Description:
Return the number of items in a_ch.
void ch_insert(cw_ch_t *a_ch, const void *a_key, const void *a_data, cw_chi_t *a_chi):

Input(s):
a_ch:
Pointer to a ch.
a_key:
Pointer to a key.
a_data:
Pointer to data associated with a_key.
a_chi:
Pointer to space for a chi, or NULL.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Insert a_data into a_ch, using key a_key. Use a_chi for the internal chi container if non-NULL.
cw_bool_t ch_remove(cw_ch_t *a_ch, const void *a_search_key, void **r_key, void **r_data, cw_chi_t **r_chi):

Input(s):
a_ch:
Pointer to a ch.
a_search_key:
Pointer to the key to search with.
r_key:
Pointer to a key pointer, or NULL.
r_data:
Pointer to a data pointer, or NULL.
r_chi:
Pointer to a chi pointer, or NULL.
Output(s):
retval:
FALSE:
Success.
TRUE:
Item with key a_search_key not found.
*r_key:
If (r_key != NULL) and (retval == FALSE), pointer to a key. Otherwise, undefined.
*r_data:
If (r_data != NULL) and (retval == FALSE), pointer to data. Otherwise, undefined.
*r_chi:
If (r_chi != NULL) and (retval == FALSE), pointer to space for a chi, or NULL. Otherwise, undefined.
Exception(s):
None.
Description:
Remove the item from a_ch that was most recently inserted with key a_search_key. If successful, set *r_key and *r_data to point to the key, data, and externally allocated chi, respectively.
cw_bool_t ch_search(cw_ch_t *a_ch, const void *a_key, void **r_data):

Input(s):
a_ch:
Pointer to a ch.
a_key:
Pointer to a key.
r_data:
Pointer to a data pointer, or NULL.
Output(s):
retval:
FALSE:
Success.
TRUE:
Item with key a_key not found in a_ch.
*r_data:
If (r_data != NULL) and (retval == FALSE), pointer to data.
Exception(s):
None.
Description:
Search for the most recently inserted item with key a_key. If found, *r_data to point to the associated data.
cw_bool_t ch_get_iterate(cw_ch_t *a_ch, void **r_key, void **r_data):

Input(s):
a_ch:
Pointer to a ch.
r_key:
Pointer to a key pointer, or NULL.
r_data:
Pointer to a data pointer, or NULL.
Output(s):
retval:
FALSE:
Success.
TRUE:
a_ch is empty.
*r_key:
If (r_key != NULL) and (retval == FALSE), pointer to a key. Otherwise, undefined.
*r_data:
If (r_data != NULL) and (retval == FALSE), pointer to data. Otherwise, undefined.
Exception(s):
None.
Description:
Set *r_key and *r_data to point to the oldest item in a_ch. Promote the item so that it is the newest item in a_ch.
cw_bool_t ch_remove_iterate(cw_ch_t *a_ch, void **r_key, void **r_data, cw_chi_t **r_chi):

Input(s):
a_ch:
Pointer to a ch.
r_key:
Pointer to a key pointer, or NULL.
r_data:
Pointer to a data pointer, or NULL.
r_chi:
Pointer to a chi pointer, or NULL.
Output(s):
retval:
FALSE:
Success.
TRUE:
a_ch is empty.
*r_key:
If (r_key != NULL) and (retval == FALSE), pointer to a key. Otherwise, undefined.
*r_data:
If (r_data != NULL) and (retval == FALSE), pointer to data. Otherwise, undefined.
*r_chi:
If (r_chi != NULL) and (retval == FALSE), pointer to a chi, or NULL. Otherwise, undefined.
Exception(s):
None.
Description:
Set *r_key and *r_data to point to the oldest item in a_ch, set *r_chi to point to the item's container, if externally allocated, and remove the item from a_ch.
cw_uint32_t ch_string_hash(const void *a_key):

Input(s):
a_key:
Pointer to a key.
Output(s):
retval:
Hash result.
Exception(s):
None.
Description:
NULL-terminated string hashing function.
cw_uint32_t ch_direct_hash(const void *a_key):

Input(s):
a_key:
Pointer to a key.
Output(s):
retval:
Hash result.
Exception(s):
None.
Description:
Direct (pointer) hashing function.
cw_bool_t ch_string_key_comp(const void *a_k1, const void *a_k2):

Input(s):
a_k1:
Pointer to a key.
a_k2:
Pointer to a key.
Output(s):
retval:
FALSE:
Not equal.
TRUE:
Equal.
Exception(s):
None.
Description:
Test two keys (NULL-terminated strings) for equality.
cw_bool_t ch_direct_key_comp(const void *a_k1, const void *a_k2):

Input(s):
a_k1:
Pointer to a key.
a_k2:
Pointer to a key.
Output(s):
retval:
FALSE:
Not equal.
TRUE:
Equal.
Exception(s):
None.
Description:
Test two keys (pointers) for equality.


cnd

The cnd class implements condition variables, which can be used in conjunction with the mtx class to wait for a condition to occur.

API

void cnd_new(cw_cnd_t *a_cnd):

Input(s):
a_cnd:
Pointer to space for a cnd.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
void cnd_delete(cw_cnd_t *a_cnd):

Input(s):
a_cnd:
Pointer to a cnd.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
void cnd_signal(cw_cnd_t *a_cnd):

Input(s):
a_cnd:
Pointer to a cnd.
Output(s):
None.
Exception(s):
None.
Description:
Signal one thread waiting on a_cnd, if there are any waiters.
void cnd_broadcast(cw_cnd_t *a_cnd):

Input(s):
a_cnd:
Pointer to a cnd.
Output(s):
None.
Exception(s):
None.
Description:
Signal all threads waiting on a_cnd.
cw_bool_t cnd_timedwait(cw_cnd_t *a_cnd, cw_mtx_t *a_mtx, const struct timespec *a_timeout):

Input(s):
a_cnd:
Pointer to a cnd.
a_mtx:
Pointer to a mtx.
a_timeout:
Timeout, specified as an absolute time interval.
Output(s):
retval:
FALSE:
Success.
TRUE:
Timeout.
Exception(s):
None.
Description:
Wait for a_cnd for at least a_time.
void cnd_wait(cw_cnd_t *a_cnd, cw_mtx_t *a_mtx):

Input(s):
a_cnd:
Pointer to a cnd.
a_mtx:
Pointer to a mtx.
Output(s):
None.
Exception(s):
None.
Description:
Wait for a_cnd.


dch

The dch class implements dynamic chained hashing. The dch class is a wrapper around the ch class that enforces fullness/emptiness constraints and rebuilds the hash table when necessary. Other than this added functionality, the dch class behaves almost exactly like the ch class. See the ch class documentation for more additional information.

API

dch_new(cw_dch_t *a_dch, cw_opaque_alloc_t *a_alloc, cw_opaque_dealloc_t *a_dealloc, void *a_arg, cw_uint32_t a_base_table, cw_uint32_t a_base_grow, cw_uint32_t a_base_shrink, cw_ch_hash_t *a_hash, cw_ch_key_comp_t *a_key_comp):

Input(s):
a_dch:
Pointer to space for a dch, or NULL.
a_alloc:
Pointer to an allocation function to use internally.
a_dealloc:
Pointer to a deallocation function to use internally.
a_arg:
Opaque pointer to pass to a_alloc() and a_dealloc().
a_base_table:
Number of slots in the initial hash table.
a_base_grow:
Maximum number of items to allow in a_dch before doubling the hash table size. The same proportions (in relation to a_base_table) are used to decide when to double the table additional times.
a_base_shrink:
Minimum proportional (with respect to a_base_table) emptiness to allow in the hash table before cutting the hash table size in half.
a_hash:
Pointer to a hashing function.
a_key_comp:
Pointer to a key comparison function.
Output(s):
retval:
Pointer to a dch.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void dch_delete(cw_dch_t *a_dch):

Input(s):
a_dch:
Pointer to a dch.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
cw_uint32_t dch_count(cw_dch_t *a_dch):

Input(s):
a_dch:
Pointer to a dch.
Output(s):
retval:
Number of items in a_dch.
Exception(s):
None.
Description:
Return the number of items in a_dch.
void dch_insert(cw_dch_t *a_dch, const void *a_key, const void *a_data, cw_chi_t *a_chi):

Input(s):
a_dch:
Pointer to a dch.
a_key:
Pointer to a key.
a_data:
Pointer to data associated with a_key.
a_chi:
Pointer to space for a chi, or NULL.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Insert a_data into a_dch, using key a_key. Use a_chi for the internal chi container if non-NULL.
cw_bool_t dch_remove(cw_dch_t *a_dch, const void *a_search_key, void **r_key, void **r_data, cw_chi_t **r_chi):

Input(s):
a_dch:
Pointer to a dch.
a_search_key:
Pointer to the key to search with.
r_key:
Pointer to a key pointer, or NULL.
r_data:
Pointer to a data pointer, or NULL.
r_chi:
Pointer to a chi pointer, or NULL.
Output(s):
retval:
FALSE:
Success.
TRUE:
Item with key a_search_key not found.
*r_key:
If (r_key != NULL) and (retval == FALSE), pointer to a key. Otherwise, undefined.
*r_data:
If (r_data != NULL) and (retval == FALSE), pointer to data. Otherwise, undefined.
*r_chi:
If (r_chi != NULL) and (retval == FALSE), pointer to space for a chi, or NULL. Otherwise, undefined.
Exception(s):
None.
Description:
Remove the item from a_dch that was most recently inserted with key a_search_key. If successful, set *r_key and *r_data to point to the key, data, and externally allocated chi, respectively.
cw_bool_t dch_search(cw_dch_t *a_dch, const void *a_key, void **r_data):

Input(s):
a_dch:
Pointer to a dch.
a_key:
Pointer to a key.
r_data:
Pointer to a data pointer, or NULL.
Output(s):
retval:
FALSE:
Success.
TRUE:
Item with key a_key not found in a_dch.
*r_data:
If (r_data != NULL) and (retval == FALSE), pointer to data.
Exception(s):
None.
Description:
Search for the most recently inserted item with key a_key. If found, *r_data to point to the associated data.
cw_bool_t dch_get_iterate(cw_dch_t *a_dch, void **r_key, void **r_data):

Input(s):
a_dch:
Pointer to a dch.
r_key:
Pointer to a key pointer, or NULL.
r_data:
Pointer to a data pointer, or NULL.
Output(s):
retval:
FALSE:
Success.
TRUE:
a_dch is empty.
*r_key:
If (r_key != NULL) and (retval == FALSE), pointer to a key. Otherwise, undefined.
*r_data:
If (r_data != NULL) and (retval == FALSE), pointer to data. Otherwise, undefined.
Exception(s):
None.
Description:
Set *r_key and *r_data to point to the oldest item in a_dch. Promote the item so that it is the newest item in a_dch.
cw_bool_t dch_remove_iterate(cw_dch_t *a_dch, void **r_key, void **r_data, cw_chi_t **r_chi):

Input(s):
a_dch:
Pointer to a dch.
r_key:
Pointer to a key pointer, or NULL.
r_data:
Pointer to a data pointer, or NULL.
r_chi:
Pointer to a chi pointer, or NULL.
Output(s):
retval:
FALSE:
Success.
TRUE:
a_dch is empty.
*r_key:
If (r_key != NULL) and (retval == FALSE), pointer to a key. Otherwise, undefined.
*r_data:
If (r_data != NULL) and (retval == FALSE), pointer to data. Otherwise, undefined.
*r_chi:
If (r_chi != NULL) and (retval == FALSE), pointer to a chi, or NULL. Otherwise, undefined.
Exception(s):
None.
Description:
Set *r_key and *r_data to point to the oldest item in a_dch, set *r_chi to point to the item's container, if externally allocated, and remove the item from a_dch.


mem

The mem class implements a memory allocation (malloc) wrapper. For the debug version of libonyx, extra information is hashed for each memory allocation that allows tracking of the following:

If any memory leaks are detected, diagnostic output is printed to out_err.

Also, the debug version of libonyx sets all newly allocated bytes to 0xa5, and all deallocated bytes to 0x5a (except in the case of mem_calloc()). This tends to cause things to break sooner when uninitialized or deallocated memory is referenced.

In general, the mem class doesn't need to be used directly. Instead, there are several preprocessor macros that can be used: _cw_malloc(), _cw_calloc(), _cw_realloc(), and _cw_free().

API

cw_mem_t * mem_new(cw_mem_t *a_mem, cw_mem_t *a_internal):

Input(s):
a_mem:
Pointer to space for a mem, or NULL.
a_internal:
Pointer to a mem to use for internal memory allocation, or NULL.
Output(s):
retval:
Pointer to a mem.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void mem_delete(cw_mem_t *a_mem):

Input(s):
a_mem:
Pointer to a mem.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
void * mem_malloc_e(cw_mem_t *a_mem, size_t a_size, const char *a_filename, cw_uint32_t a_line_num):

void * mem_malloc(cw_mem_t *a_mem, size_t a_size):

void * _cw_malloc(size_t a_size):

Input(s):
a_mem:
Pointer to a mem.
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:
malloc() wrapper.
void * mem_calloc_e(cw_mem_t *a_mem, size_t a_number, size_t a_size, const char *a_filename, cw_uint32_t a_line_num):

void * mem_calloc(cw_mem_t *a_mem, size_t a_number, size_t a_size):

void * _cw_calloc(size_t a_number, size_t a_size):

Input(s):
a_mem:
Pointer to a mem.
a_number:
Number of elements to allocate.
a_size:
Size of each element to allocate.
a_filename:
Should be __FILE__.
a_line_num:
Should be __LINE__.
Output(s):
retval:
Pointer to a zeroed memory range.
Exception(s):
_CW_ONYXX_OOM.
Description:
calloc() wrapper.
void * mem_realloc_e(cw_mem_t *a_mem, void *a_ptr, size_t a_size, const char *a_filename, cw_uint32_t a_line_num):

void * mem_realloc(cw_mem_t *a_mem, void *a_ptr, size_t a_size):

void * _cw_realloc(void *a_ptr, size_t a_size):

Input(s):
a_mem:
Pointer to a mem.
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:
realloc() wrapper.
void mem_free_e(cw_mem_t *a_mem, void *a_ptr, size_t a_size, const char *a_filename, cw_uint32_t a_line_num):

void mem_free(cw_mem_t *a_mem, void *a_ptr, size_t a_size):

void _cw_free(void *a_ptr):

Input(s):
a_mem:
Pointer to a mem.
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:
free() wrapper.


mq

The mq class implements a simple unidirectional message queue. In addition to putting and getting messages, there are methods that control the ability to get or put. This provides a simple out of band state transition capability.

API

void mq_new(cw_mq_t *a_mq, cw_mem_t *a_mem, cw_uint32_t a_msg_size):

Input(s):
a_mq:
Pointer to space for a mq.
a_mem:
Pointer to the allocator to use internally.
a_msg_size:
Size (in bytes) of messages used for all subsequent calls to mq_*get() and mq_put().
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void mq_delete(cw_mq_t *a_mq):

Input(s):
a_mq:
Pointer to a mq.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
cw_bool_t mq_tryget(cw_mq_t *a_mq, ...):

Input(s):
a_mq:
Pointer to a mq.
...:
Pointer to space to store a message.
Output(s):
retval:
FALSE:
Success.
TRUE:
No messages in the queue, or get is in the stop state.
*...:
If retval is FALSE, a message. Otherwise, undefined.
Exception(s):
None.
Description:
Try to get a message, but return TRUE if none are available.
cw_bool_t mq_timedget(cw_mq_t *a_mq, const struct timespec *a_timeout, ...):

Input(s):
a_mq:
Pointer to a mq.
a_timeout:
Timeout, specified as an absolute time interval.
...:
Pointer to space to store a message.
Output(s):
retval:
FALSE:
Success.
TRUE:
No messages in the queue, or get is in the stop state.
*...:
If retval is FALSE, a message. Otherwise, undefined.
Exception(s):
None.
Description:
Get a message. If none are available, block until a message is available, or until timeout.
cw_bol_t mq_get(cw_mq_t *a_mq, ...):

Input(s):
a_mq:
Pointer to a mq.
...:
Pointer to space to store a message.
Output(s):
retval:
FALSE:
Success.
TRUE:
Get is in the stop state.
*...:
If retval is FALSE, a message. Otherwise, undefined.
Exception(s):
None.
Description:
Get a message. If none are available, block until a message is available.
cw_bool_t mq_put(cw_mq_t *a_mq, ...):

Input(s):
a_mq:
Pointer to a mq.
...:
A message.
Output(s):
retval:
FALSE:
Success.
TRUE:
Failure due to put being in the stop state.
Exception(s):
_CW_ONYXX_OOM.
Description:
Put a message in a_mq.
cw_bool_t mq_get_start(cw_mq_t *a_mq):

Input(s):
a_mq:
Pointer to a mq.
Output(s):
retval:
FALSE:
Success.
TRUE:
Error (already in start state).
Exception(s):
None.
Description:
Change the get operation to the start state ( mq_get() will not return TRUE).
cw_bool_t mq_get_stop(cw_mq_t *a_mq):

Input(s):
a_mq:
Pointer to a mq.
Output(s):
retval:
FALSE:
Success.
TRUE:
Error (already in stop state).
Exception(s):
None.
Description:
Change the get operation to the stop state ( mq_get() will return TRUE).
cw_bool_t mq_put_start(cw_mq_t *a_mq):

Input(s):
a_mq:
Pointer to a mq.
Output(s):
retval:
FALSE:
Success.
TRUE:
Error (already in start state).
Exception(s):
None.
Description:
Change the put operation to the start state ( mq_put() will not return TRUE).
cw_bool_t mq_put_stop(cw_mq_t *a_mq):

Input(s):
a_mq:
Pointer to a mq.
Output(s):
retval:
FALSE:
Success.
TRUE:
Error (already in stop state).
Exception(s):
None.
Description:
Change the put operation to the stop state ( mq_put() will return TRUE).


mtx

The mtx class implements typical mutual exclusion locks. Only one thread can hold a lock at a time, and attempting to attain the lock while already owning it has undefined results.

API

void mtx_new(cw_mtx_t *a_mtx):

Input(s):
a_mtx:
Pointer to space for a mtx.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
void mtx_delete(cw_mtx_t *a_mtx):

Input(s):
a_mtx:
Pointer to a mtx.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
void mtx_lock(cw_mtx_t *a_mtx):

Input(s):
a_mtx:
Pointer to a mtx.
Output(s):
None.
Exception(s):
None.
Description:
Lock a_mtx.
cw_bool_t mtx_trylock(cw_mtx_t *a_mtx):

Input(s):
a_mtx:
Pointer to a mtx.
Output(s):
retval:
FALSE:
Success.
TRUE:
Failure.
Exception(s):
None.
Description:
Try to lock a_mtx, but return immediately instead of blocking if a_mtx is already locked.
void mtx_unlock(cw_mtx_t *a_mtx):

Input(s):
a_mtx:
Pointer to a mtx.
Output(s):
None.
Exception(s):
None.
Description:
Unlock a_mtx.


nx

The nx class encapsulates an Onyx interpreter instance. It contains a number of interpreter-global objects, as well as the garbage collector. Reclamation all objects associated with an nx instance is managed by a garbage collector, so when an nx is destroyed, all associated objects are deallocated.

API

cw_nx_t * nx_new(cw_nx_t *a_nx, cw_op_t *a_thread_init, int a_argc, char **a_argv, char **a_envp):

Input(s):
a_nx:
Pointer to space for an nx, or NULL.
a_thread_init:
Pointer to an initialization function to be called during thread initialization, or NULL.
a_argc:
Number of command line arguments.
a_argv:
Pointer to an array of command line argument strings.
a_envp:
Pointer to an array of environment variable strings.
Output(s):
retval:
Pointer to an nx.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void nx_delete(cw_nx_t *a_nx):

Input(s):
Pointer to an nx.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
cw_nxa_t * nx_nxa_get(cw_nx_t *a_nx):

Input(s):
Pointer to an nx.
Output(s):
retval:
Pointer to an nxa.
Exception(s):
None.
Description:
Return a pointer to the garbage collector.
cw_nxo_t * nx_systemdict_get(cw_nx_t *a_nx):

Input(s):
a_nx:
Pointer to an nx.
Output(s):
retval:
Pointer to the nxo corresponding to systemdict .
Exception(s):
None.
Description:
Return a pointer to the nxo corresponding to systemdict .
cw_nxo_t * nx_globaldict_get(cw_nx_t *a_nx):

Input(s):
a_nx:
Pointer to an nx.
Output(s):
retval:
Pointer to the nxo corresponding to globaldict .
Exception(s):
None.
Description:
Return a pointer to the nxo corresponding to globaldict .
cw_nxo_t * nx_envdict_get(cw_nx_t *a_nx):

Input(s):
a_nx:
Pointer to an nx.
Output(s):
retval:
Pointer to the nxo corresponding to envdict .
Exception(s):
None.
Description:
Return a pointer to the nxo corresponding to envdict .
cw_nxo_t * nx_stdin_get(cw_nx_t *a_nx):

Input(s):
a_nx:
Pointer to an nx.
Output(s):
retval:
Pointer to the nxo corresponding to stdin .
Exception(s):
None.
Description:
Return a pointer to the nxo corresponding to stdin .
cw_nxo_t * nx_stdout_get(cw_nx_t *a_nx):

Input(s):
a_nx:
Pointer to an nx.
Output(s):
retval:
Pointer to the nxo corresponding to stdout .
Exception(s):
None.
Description:
Return a pointer to the nxo corresponding to stdout .
cw_nxo_t * nx_stderr_get(cw_nx_t *a_nx):

Input(s):
a_nx:
Pointer to an nx.
Output(s):
retval:
Pointer to the nxo corresponding to stderr .
Exception(s):
None.
Description:
Return a pointer to the nxo corresponding to stderr .


nxa

The nxa class implements garbage collection. The garbage collector runs a separate thread that is controlled via an asynchronous message queue. The collector thread is only responsible for doing asynchronous collection due to allocation inactivity and all sweeping; all other marking is synchronously done in the thread context of the mutator that triggers collection.

API

void nxa_new(cw_nxa_t *a_nxa, cw_nx_t *a_nx):

Input(s):
a_nxa:
Pointer to a nxa.
a_nx:
Pointer to a nx.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void nxa_delete(cw_nxa_t *a_nxa):

Input(s):
a_nxa:
Pointer to a nxa.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
void * nxa_malloc_e(cw_nxa_t *a_nxa, size_t a_size, const char *a_filename, cw_uint32_t a_line_num):

void * nxa_malloc(cw_nxa_t *a_nxa, size_t a_size):

Input(s):
a_nxa:
Pointer to a nxa.
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:
malloc() wrapper.
void * nxa_free_e(cw_nxa_t *a_nxa, void *a_ptr, size_t a_size, const char *a_filename, cw_uint32_t a_line_num):

void * nxa_free(cw_nxa_t *a_nxa, void *a_ptr, size_t a_size):

Input(s):
a_nxa:
Pointer to a nxa.
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:
free() wrapper.
void nxa_collect(cw_nxa_t *a_nxa):

Input(s):
a_nxa:
Pointer to a nxa.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Do a synchronous garbage collection.
void nxa_dump(cw_nxa_t *a_nxa, cw_nxo_t *a_thread):

Input(s):
a_nxa:
Pointer to a nxa.
a_thread:
Pointer to a thread nxo.
Output(s):
Output printed to stdout .
Exception(s):
_CW_ONYXX_OOM.
Description:
Print the internal state of gcdict to stdout .
cw_bool_t nxa_active_get(cw_nxa_t *a_nxa):

Input(s):
a_nxa:
Pointer to a nxa.
Output(s):
retval:
FALSE:
Garbage collector deactivated.
TRUE:
Garbage collector active.
Exception(s):
None.
Description:
Return whether the garbage collector is active (runnable).
void nxa_active_set(cw_nxa_t *a_nxa, cw_bool_t a_active):

Input(s):
a_nxa:
Pointer to a nxa.
a_active:
FALSE:
Deactivate garbage collector.
TRUE:
Activate garbage collector.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Send a message to the garbage collector to activate or deactivate. The asynchronous nature of the message means that it is possible for the garbage collector to run after this function returns, even if a deactivation message has been sent.
cw_nxoi_t nxa_period_get(cw_nxa_t *a_nxa):

Input(s):
a_nxa:
Pointer to a nxa.
Output(s):
retval:
Current inactivity period in seconds that the garbage collector waits before doing a collection.
Exception(s):
None.
Description:
Return the current inactivity period in seconds that the garbage collector waits before doing a collection.
void nxa_period_set(cw_nxa_t *a_nxa, cw_nxoi_t a_period):

Input(s):
a_nxa:
Pointer to a nxa.
a_period:
Inactivity period in seconds that the garbage collector should wait before doing a collection. If 0, the garbage collector will never run due to inactivity.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Set the inactivity period in seconds that the garbage collector should wait before doing a collection.
cw_nxoi_t nxa_threshold_get(cw_nxa_t *a_nxa):

Input(s):
a_nxa:
Pointer to a nxa.
Output(s):
retval:
Number of bytes of memory allocated since the last garbage collection that will trigger the garbage collector to run.
Exception(s):
None.
Description:
Return the number of bytes of memory allocated since the last garbage collection that will trigger the garbage collector to run.
void nxa_threshold_set(cw_nxa_t *a_nxa, cw_nxoi_t a_threshold):

Input(s):
a_nxa:
Pointer to a nxa.
a_threshold:
The number of bytes of memory allocated since the last garbage collection that will trigger the garbage collector to run.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Set the number of bytes of memory allocated since the last garbage collection that will trigger the garbage collector to run.
void nxa_stats_get(cw_nxa_t *a_nxa, cw_nxoi_t *r_collections, cw_nxoi_t *r_count, cw_nxoi_t *r_ccount, cw_nxoi_t *r_cmark, cw_nxoi_t *r_csweep, cw_nxoi_t *r_mcount, cw_nxoi_t *r_mmark, cw_nxoi_t *r_msweep, cw_nxoi_t *r_scount, cw_nxoi_t *r_smark, cw_nxoi_t *r_ssweep):

Input(s):
a_nxa:
Pointer to a nxa.
r_collections:
Pointer to an integer.
r_count:
Pointer to an integer.
r_ccount:
Pointer to an integer.
r_cmark:
Pointer to an integer.
r_csweep:
Pointer to an integer.
r_mcount:
Pointer to an integer.
r_mmark:
Pointer to an integer.
r_msweep:
Pointer to an integer.
r_scount:
Pointer to an integer.
r_smark:
Pointer to an integer.
r_ssweep:
Pointer to an integer.
Output(s):
*r_collections:
Number of times the garbage collector has run.
*r_count:
Current number of bytes of memory allocated.
*r_ccount:
Number of bytes of memory allocated as of the end of the most recent garbage collection.
*r_cmark:
Number of microseconds spent in the mark phase of the most recent garbage collection.
*r_csweep:
Number of microseconts spent in the sweep phase of the most recent garbage collection.
*r_mcount:
Largest number of bytes of memory ever allocated at any point in time.
*r_mmark:
Largest number of microseconds ever spent in the mark phase of a garbage collection.
*r_msweep:
Largest number of microseconts spent in the sweep phase of a garbage collection.
*r_scount:
Total number of bytes of memory ever allocated.
*r_smark:
Total number of microseconds spent in the mark phase of all garbage collections.
*r_ssweep:
Total number of microseconts spent in the sweep phase of all garbage collections.
Exception(s):
None.
Description:
Return garbage collector statistics.
cw_nx_t * nxa_nx_get(cw_nxa_t *a_nxa):

Input(s):
a_nxa:
Pointer to a nxa.
Output(s):
retval:
Pointer to a nx.
Exception(s):
None.
Description:
Return a pointer to the nx associated with a_nxa.
cw_nxo_t * nxa_gcdict_get(cw_nxa_t *a_nxa):

Input(s):
a_nxa:
Pointer to a nxa.
Output(s):
retval:
Pointer to a dict nxo.
Exception(s):
None.
Description:
Return a pointer to the dict nxo corresponding to gcdict .


nxn

The nxn class provides access to a table of string constants. The main reason for this class's existence is that multiple C files often use identical string constants, and this saves memory by allowing all to refer to a single string.

API

const cw_uint8_t * nxn_str(cw_nxn_t a_nxn):

Input(s):
a_nxn:
A number that corresponds to an entry in the string table.
Output(s):
retval:
Pointer to a string constant.
Exception(s):
None.
Description:
Return a pointer to the string constant associated with a_nxn.
cw_uint32_t nxn_len(cw_nxn_t a_nxn):

Input(s):
a_nxn:
A number that corresponds to an entry in the string table.
Output(s):
retval:
String length of a string constant.
Exception(s):
None.
Description:
Return the string length of the string constant associated with a_nxn.


nxo

The nxo class is the basis for the Onyx type system. nxo objects can be any of the following types, as determined by the cw_nxot_t type:

NXOT_NO:
nxo_no
NXOT_ARRAY:
nxo_array
NXOT_BOOLEAN:
nxo_boolean
NXOT_CONDITION:
nxo_condition
NXOT_DICT:
nxo_dict
NXOT_FILE:
nxo_file
NXOT_FINO:
nxo_fino
NXOT_HOOK:
nxo_hook
NXOT_INTEGER:
nxo_integer
NXOT_MARK:
nxo_mark
NXOT_MUTEX:
nxo_mutex
NXOT_NAME:
nxo_name
NXOT_NULL:
nxo_null
NXOT_OPERATOR:
nxo_operator
NXOT_STACK:
nxo_stack
NXOT_STRING:
nxo_string
NXOT_THREAD:
nxo_thread

Due to limitations of the C programming language, it is the responsibility of the application to do type checking to assure that an incompatible nxo object is not passed to a type-specific function. For example, passing a file nxo to nxo_string_get() is prohibited, and will result in undefined behaviour (including crashes).

Composite objects contain a reference to an nxoe object. For the most part, the application does not need to be aware of this. The only exception is when writing extensions with the hook type. Hook objects need to be able to iterate over the objects they reference internally, and return nxoe references to the garbage collector.

The following functions are applicable to all types of nxo objects.

API

cw_sint32_t nxo_compare(cw_nxo_t *a_a, cw_nxo_t *a_b):

Input(s):
a_a:
Pointer to an nxo.
a_b:
Pointer to an nxo.
Output(s):
retval:
-1:
For types which it is meaninful (integer, string), a_a is less than a_b.
0:
a_a and a_b are equal.
1:
For types which it is meaninful (integer, string), a_a is greater than a_b.
2:
Incompatible types, or not the same composite object.
Exception(s):
None.
Description:
Compare a_a and a_b.
void nxo_dup(cw_nxo_t *a_to, cw_nxo_t *a_from):

Input(s):
a_to:
Pointer to an nxo.
a_from:
Pointer to an nxo.
Output(s):
None.
Exception(s):
None.
Description:
Duplicate a_from to a_to. This does not do a copy of composite objects; rather it creates a new reference to the value of a composite object.
cw_nxot_t nxo_type_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an nxo.
Output(s):
retval:
NXOT_NO:
nxo_no
NXOT_ARRAY:
nxo_array
NXOT_BOOLEAN:
nxo_boolean
NXOT_CONDITION:
nxo_condition
NXOT_DICT:
nxo_dict
NXOT_FILE:
nxo_file
NXOT_FINO:
nxo_fino
NXOT_HOOK:
nxo_hook
NXOT_INTEGER:
nxo_integer
NXOT_MARK:
nxo_mark
NXOT_MUTEX:
nxo_mutex
NXOT_NAME:
nxo_name
NXOT_NULL:
nxo_null
NXOT_OPERATOR:
nxo_operator
NXOT_STACK:
nxo_stack
NXOT_STRING:
nxo_string
NXOT_THREAD:
nxo_thread
Exception(s):
None.
Description:
Return the type of a_nxo.
cw_nxoe_t * nxo_nxoe_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an nxo.
Output(s):
retval:
Pointer to the nxoe associated with a_nxo, or NULL if a_nxo is not composite.
Exception(s):
None.
Description:
Return a pointer to the nxoe associated with a_nxo.
cw_bool_t nxo_lcheck():

Input(s):
a_nxo:
Pointer to an array, dict, file, stack, or string nxo.
Output(s):
retval:
FALSE:
a_nxo is not implicitly locked.
TRUE:
a_nxo is implicitly locked.
Exception(s):
None.
Description:
For array, dict, file, stack, or string nxos, return whether a_nxo is implicitly locked.
cw_nxoa_t nxo_attr_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an nxo.
Output(s):
retval:
NXOA_LITERAL:
a_nxo is literal.
NXOA_EXECUTABLE:
a_nxo is executable.
Exception(s):
None.
Description:
Return the attribute for a_nxo.
void nxo_attr_set(cw_nxo_t *a_nxo, cw_nxoa_t a_attr):

Input(s):
a_nxo:
Pointer to an nxo.
a_attr:
Value of attribute to set for a_nxo.
Output(s):
None.
Exception(s):
None.
Description:
Set the attribute for a_nxo to a_attr.


nxo_array

The nxo_array class is a subclass of the nxo class.

API

void nxo_array_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking, cw_uint32_t a_len):

Input(s):
a_nxo:
Pointer to an array nxo.
a_nx:
Pointer to an nx.
a_locking:
Implicit locking mode.
a_len:
Number of array elements.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void nxo_array_subarray_new(cw_nxo_t *a_nxo, cw_nxo_t *a_array, cw_nx_t *a_nx, cw_uint32_t a_offset, cw_uint32_t a_len):

Input(s):
a_nxo:
Pointer to an array nxo.
a_array:
Pointer to an array nxo to create a subarray of.
a_nx:
Pointer to an nx.
a_offset:
Offset into a_array.
a_len:
Number of array elements.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Subarray constructor.
void nxo_array_copy(cw_nxo_t *a_to, cw_nxo_t *a_from):

Input(s):
a_to:
Pointer to an array nxo.
a_from:
Pointer to an array nxo.
Output(s):
None.
Exception(s):
None.
Description:
Copy the contents of a_from to a_to. The length of a_to must be at least that of a_from.
cw_uint32_t nxo_array_len_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an array nxo.
Output(s):
retval:
Number of elements in a_nxo.
Exception(s):
None.
Description:
Return the number of elements in a_nxo.
void nxo_array_el_get(cw_nxo_t *a_nxo, cw_nxoi_t a_offset, cw_nxo_t *r_el):

Input(s):
a_nxo:
Pointer to an array nxo.
a_offset:
Offset of element to get.
r_el:
Pointer to space to dup an object to.
Output(s):
*r_el:
A dup of the element of a_nxo at offset a_offset.
Exception(s):
None.
Description:
Get a dup of the element of a_nxo at offset a_offset.
void nxo_array_el_set(cw_nxo_t *a_nxo, cw_nxo_t *a_el, cw_nxoi_t a_offset):

Input(s):
a_nxo:
Pointer to an array nxo.
a_el:
Pointer to an nxo.
a_offset:
Offset of element in a_nxo to replace with a_el.
Output(s):
None.
Exception(s):
None.
Description:
Dup a_el into the element of a_nxo at offset a_offset.


nxo_boolean

The nxo_boolean class is a subclass of the nxo class.

API

void nxo_boolean_new(cw_nxo_t *a_nxo, cw_bool_t a_val):

Input(s):
a_nxo:
Pointer to a boolean nxo.
a_val:
Initial value.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
cw_bool_t nxo_boolean_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a boolean nxo.
Output(s):
retval:
Value of a_nxo.
Exception(s):
None.
Description:
Return the value of a_nxo.
void nxo_boolean_set(cw_nxo_t *a_nxo, cw_bool_t a_val):

Input(s):
a_nxo:
Pointer to a boolean nxo.
a_val:
Value to set a_nxo to.
Output(s):
None.
Exception(s):
None.
Description:
Set the value of a_nxo to a_val.


nxo_condition

The nxo_condition class is a subclass of the nxo class.

API

void nxo_condition_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx):

Input(s):
a_nxo:
Pointer to a condition nxo.
a_nx:
Pointer to an nx.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void nxo_condition_signal(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a condition nxo.
Output(s):
None.
Exception(s):
None.
Description:
Signal one thread waiting on a_nxo, if there are any waiters.
void nxo_condition_broadcast(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a condition nxo.
Output(s):
None.
Exception(s):
None.
Description:
Signal all threads waiting on a_nxo.
void nxo_condition_wait(cw_nxo_t *a_nxo, cw_nxo_t *a_mutex):

Input(s):
a_nxo:
Pointer to a condition nxo.
a_mutex:
Pointer to a mutex nxo.
Output(s):
None.
Exception(s):
None.
Description:
Wait for a_nxo.
cw_bool_t nxo_condition_timedwait(cw_nxo_t *a_nxo, cw_nxo_t *a_mutex, const struct timespec *a_timeout):

Input(s):
a_nxo:
Pointer to a condition nxo.
a_mutex:
Pointer to a mutex nxo.
a_timeout:
Timeout, specified as an absolute time interval.
Output(s):
retval:
FALSE:
Success.
TRUE:
Timeout.
Exception(s):
None.
Description:
Wait for a_nxo for at least a_timeout.


nxo_dict

The nxo_dict class is a subclass of the nxo class.

API

void nxo_dict_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking, cw_uint32_t a_dict_size):

Input(s):
a_nxo:
Pointer to a dict nxo.
a_nx:
Pointer to an nx.
a_locking:
Implicit locking mode.
a_dict_size:
Initial number of slots. Dictionaries dynamically grow and shrink as needed, but if the maximum size of a_nxo is known, it should be specified here to save space.
Output(s):
None
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
nxo_dict_copy(cw_nxo_t *a_to, cw_nxo_t *a_from, cw_nx_t *a_nx):

Input(s):
a_to:
Pointer to a dict nxo.
a_from:
Pointer to a dict nxo.
a_nx:
Pointer to an nx.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Do a deep copy (actual contents are copied) of a_from to a_to.
void nxo_dict_def(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_nxo_t *a_key, cw_nxo_t *a_val):

Input(s):
a_nxo:
Pointer to a dict nxo.
a_nx:
Pointer to an nx.
a_key:
Pointer to an nxo.
a_val:
Pointer to an nxo.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Define a_key with value a_val in a_nxo.
void nxo_dict_undef(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_nxo_t *a_key):

Input(s):
a_nxo:
Pointer to a dict nxo.
a_nx:
Pointer to an nx.
a_key:
Pointer to an nxo.
Output(s):
None.
Exception(s):
None.
Description:
Undefine a_key in a_nxo, if defined.
cw_bool_t nxo_dict_lookup(cw_nxo_t *a_nxo, const cw_nxo_t *a_key, cw_nxo_t *r_nxo):

Input(s):
a_nxo:
Pointer to a dict nxo.
a_key:
Pointer to an nxo.
r_nxo:
Pointer to an nxo.
Output(s):
retval:
FALSE:
Success.
TRUE:
a_key not found.
r_nxo:
If retval is FALSE, value associated with a_key in a_nxo, otherwise unmodified.
Exception(s):
None.
Description:
Find a_key in a_nxo and dup its associated value to r_nxo.
cw_uint32_t nxo_dict_count(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a dict nxo.
Output(s):
retval:
The number of key/value pairs in a_nxo.
Exception(s):
None.
Description:
Return the number of key/value pairs in a_nxo.
void nxo_dict_iterate(cw_nxo_t *a_nxo, cw_nxo_t *r_nxo):

Input(s):
a_nxo:
Pointer to a dict nxo.
r_nxo:
Pointer to an nxo.
Output(s):
FALSE:
Success.
TRUE:
a_nxo is empty.
r_nxo:
If retval is FALSE, A key in a_nxo, otherwise unmodified.
Exception(s):
None.
Description:
Iteratively get a key in a_nxo. Each successive call to this function will get the next key, and wrap back around to the first key when all keys have been returned.


nxo_file

The nxo_file class is a subclass of the nxo class.

API

cw_sint32_t cw_nxo_file_read_t(void *a_arg, cw_nxo_t *a_file, cw_uint32_t a_len, cw_uint8_t *r_str):

Input(s):
a_arg:
Opaque data pointer.
a_file:
Pointer to a file nxo.
a_len:
Length of r_str.
r_str:
Pointer to space to put read data.
Output(s):
retval:
-1:
Read error.
>= 0:
Number of bytes stored in r_str.
r_str:
If retval is non-negative, retval bytes of read data, otherwise undefined.
Exception(s):
Application specific.
Description:
Read up to a_len bytes of data from a_file and store the result in r_str.
cw_bool_t cw_nxo_file_write_t(void *a_arg, cw_nxo_t *a_file, const cw_uint8_t *a_str, cw_uint32_t a_len):

Input(s):
a_arg:
Opaque data pointer.
a_file:
Pointer to a file nxo.
a_str:
Pointer to data to write.
a_len:
Length of a_str.
Output(s):
retval:
FALSE:
Success.
TRUE:
Write error.
Exception(s):
Application specific.
Description:
Write a_len bytes of data from a_str to a_file.
cw_nxoe_t * cw_nxo_file_ref_iter_t(void *a_arg, cw_bool_t a_reset):

Input(s):
a_arg:
Opaque data pointer.
a_reset:
FALSE:
At least one iteration has already occurred.
TRUE:
First iteration.
Output(s):
retval:
non-NULL:
Pointer to an nxoe.
NULL:
No more references.
Exception(s):
None.
Description:
Reference iterator function typedef.
void cw_nxo_file_delete_t(void *a_arg, cw_nx_t *a_nx):

Input(s):
a_arg:
Opaque data pointer.
a_nx:
Pointer to an nx.
Output(s):
None.
Exception(s):
None.
Description:
Destructor function typedef.
void nxo_file_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking):

Input(s):
a_nxo:
Pointer to a file nxo.
a_nx:
Pointer to an nx.
a_locking:
Implicit locking mode.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void nxo_file_fd_wrap(cw_nxo_t *a_nxo, cw_uint32_t a_fd):

Input(s):
a_nxo:
Pointer to a file nxo.
a_fd:
File descriptor number.
Output(s):
None.
Exception(s):
None.
Description:
Wrap file descriptor a_fd so that operations on a_nxo will be backed by the file descriptor.
void nxo_file_synthetic(cw_nxo_t *a_nxo, cw_nxo_file_read_t *a_read, cw_nxo_file_write_t *a_write, cw_nxo_file_ref_iter_t *a_ref_iter, cw_nxo_file_delet_t *a_delete, void *a_arg):

Input(s):
a_nxo:
Pointer to a file nxo.
a_read:
Pointer to a read function.
a_write:
Pointer to a write function.
a_ref_iter:
Pointer to a reference iterator function.
a_delete:
Pointer to a destructor function.
a_arg:
Opaque pointer to be passed to the read and write functions.
Output(s):
None.
Exception(s):
None.
Description:
Set up a_nxo to call the specified read and write functions to satisfy file operations.
cw_nxo_threade_t nxo_file_open(cw_nxo_t *a_nxo, const cw_uint8_t *a_filename, cw_uint32_t a_nlen, const cw_uint8_t *a_flags, cw_uint32_t a_flen):

Input(s):
a_nxo:
Pointer to a file nxo.
a_filename:
Pointer to a string (not required to be '\0' terminated) that represents a filename.
a_nlen:
Length in bytes of a_filename.
a_flags:
Pointer to a string (not required to be '\0' terminated) that represents a file mode:
``r'':
Read only.
``r+'':
Read/write, starting at offset 0.
``w'':
Write only. Create file if necessary. Truncate file if non-zero length.
``w+'':
Read/write, starting at offset 0. Create file if necessary.
``a'':
Write only, starting at end of file.
``a+'':
Read/write, starting at end of file.
a_flen:
Length in bytes of a_flags.
Output(s):
retval:
NXO_THREADE_NONE.
NXO_THREADE_IOERROR.
NXO_THREADE_INVALIDFILEACCESS.
NXO_THREADE_LIMITCHECK.
Exception(s):
None.
Description:
Open a file.
cw_nxo_threade_t nxo_file_close(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a file nxo.
Output(s):
retval:
NXO_THREADE_NONE.
NXO_THREADE_IOERROR.
Exception(s):
None.
Description:
Close a file.
cw_sint32_t nxo_file_fd_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a file nxo.
Output(s):
retval:
-1:
Invalid or synthetic file.
>= 0:
File descriptor number.
Exception(s):
None.
Description:
Return the file descriptor associated with a_nxo.
cw_sint32_t nxo_file_read(cw_nxo_t *a_nxo, cw_uint32_t a_len, cw_uint8_t *r_str):

Input(s):
a_nxo:
Pointer to a file nxo.
a_len:
Length in bytes of r_str.
r_str:
Pointer to a string to store read data into.
Output(s):
retval:
-1:
NXO_THREADE_IOERROR.
>= 0:
Number of bytes of data read into r_str.
r_str:
If retval is non-negative, retval bytes of read data.
Exception(s):
None.
Description:
Read data.
cw_nxo_threade_t nxo_file_readline(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking, cw_nxo_t *r_string, cw_bool_t *r_eof):

Input(s):
a_nxo:
Pointer to a file nxo.
a_nx:
Pointer to an nx.
a_locking:
Implicit locking mode.
r_string:
Pointer to an nxo.
r_eof:
Pointer to a cw_bool_t .
Output(s):
retval:
NXO_THREADE_NONE.
NXO_THREADE_IOERROR.
r_string:
If retval is NXO_THREADE_NONE, a string object, otherwise unmodified.
*r_eof:
FALSE:
End of file not reached.
TRUE:
End of file reached.
Exception(s):
_CW_ONYXX_OOM.
Description:
Read a line, terminated by ``\r'', ``\r\n'', or EOF.
cw_nxo_threade_t nxo_file_write(cw_nxo_t *a_nxo, const cw_uint8_t *a_str, cw_uint32_t a_len):

Input(s):
a_nxo:
Pointer to a file nxo.
a_str:
Pointer to data to write.
a_len:
Length of a_str.
Output(s):
retval:
NXO_THREADE_NONE.
NXO_THREADE_IOERROR.
Exception(s):
None.
Description:
Write the a_len bytes of data pointed to a_str.
cw_nxo_threade_t nxo_file_truncate(cw_nxo_t *a_nxo, off_t a_length):

Input(s):
a_nxo:
Pointer to a file nxo.
a_length:
Length to set file to.
Output(s):
retval:
NXO_THREADE_NONE.
NXO_THREADE_IOERROR.
Exception(s):
None.
Description:
Truncate or extend the file associated with a_nxo so that it is a_length bytes long.
cw_nxoi_t nxo_file_position_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a file nxo.
Output(s):
retval:
-1:
NXO_THREADE_IOERROR.
>= 0:
Current file position.
Exception(s):
None.
Description:
Get the current file position.
cw_nxo_threade_t nxo_file_position_set(cw_nxo_t *a_nxo, cw_nxoi_t a_position):

Input(s):
a_nxo:
Pointer to a file nxo.
a_position:
File position.
Output(s):
retval:
NXO_THREADE_NONE.
NXO_THREADE_IOERROR.
Exception(s):
None.
Description:
Move the current file position to a_position.
cw_uint32_t nxo_file_buffer_size_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a file nxo.
Output(s):
retval:
Size in bytes of the internal data buffer.
Exception(s):
None.
Description:
Return the size of the internal data buffer.
void nxo_file_buffer_size_set(cw_nxo_t *a_nxo, cw_uint32_t a_size):

Input(s):
a_nxo:
Pointer to a file nxo.
a_size:
Size in bytes of internal buffer to use.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Use an internal buffer of a_size bytes.
cw_nxoi_t nxo_file_buffer_count(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a file nxo.
Output(s):
retval:
Current number of buffered bytes available for reading.
Exception(s):
None.
Description:
Return the current number of buffered bytes available for reading.
cw_nxo_threade_t nxo_file_buffer_flush(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a file nxo.
Output(s):
retval:
NXO_THREADE_NONE.
NXO_THREADE_IOERROR.
Exception(s):
None.
Description:
Flush any buffered write data to disk, and discard any buffered read data.


nxo_fino

The nxo_fino class is a subclass of the nxo class.

API

void nxo_fino_new(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an nxo.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.


nxo_hook

The nxo_hook class is a subclass of the nxo class.

API

void cw_nxo_hook_eval_t(void *a_data, cw_nxo_t *a_thread):

Input(s):
a_data:
Opaque data pointer.
a_thread:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
Hook-dependent.
Description:
Evaluation function typedef.
cw_nxoe_t * cw_nxo_hook_ref_iter_t(void *a_data, cw_bool_t a_reset):

Input(s):
a_data:
Opaque data pointer.
a_reset:
FALSE:
At least one iteration has already occurred.
TRUE:
First iteration.
Output(s):
retval:
non-NULL:
Pointer to an nxoe.
NULL:
No more references.
Exception(s):
None.
Description:
Reference iterator function typedef.
void cw_nxo_hook_delete_t(void *a_data, cw_nx_t *a_nx):

Input(s):
a_data:
Opaque data pointer.
a_nx:
Pointer to an nx.
Output(s):
None.
Exception(s):
None.
Description:
Destructor function typedef.
void nxo_hook_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, void *a_data, cw_nxo_hook_eval_t *a_eval_f, cw_nxo_hook_ref_iter_t *a_ref_iter_f, cw_nxo_hook_delete_t *a_delete_f):

Input(s):
a_nxo:
Pointer to a hook nxo.
a_nx:
Pointer to an nx.
a_data:
Opaque data pointer to be passed to a_eval_f, a_ref_iter_f, and a_delete_f.
a_eval_f:
Pointer to an evaluation function.
a_ref_iter_f:
Pointer to a reference iterator function.
a_delete_f:
Pointer to a destructor function.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
cw_nxo_t * nxo_hook_tag_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a hook nxo.
Output(s):
retval:
Pointer to the tag object associated with a_nxo.
Exception(s):
None.
Description:
Return a pointer to the tag object associated with a_nxo. This object pointer can safely be used for modifying the tag object.
void * nxo_hook_data_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a hook nxo.
Output(s):
retval:
Opaque data pointer.
Exception(s):
None.
Description:
Return the opaque data pointer associated with a_nxo.
void nxo_hook_data_set(cw_nxo_t *a_nxo, void *a_data):

Input(s):
a_nxo:
Pointer to a hook nxo.
a_data:
Opaque data pointer.
Output(s):
None.
Exception(s):
None.
Description:
Set the opaque data pointer associated with a_nxo.
void nxo_hook_eval(cw_nxo_t *a_nxo, cw_nxo_t *a_thread):

Input(s):
a_nxo:
Pointer to a hook nxo.
a_thread:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
Hook-specific.
Description:
Evaluate the a_nxo. If there is no evaluation function associated with a_nxo, it is pushed onto ostack.


nxo_integer

The nxo_integer class is a subclass of the nxo class.

API

void nxo_integer_new(cw_nxo_t *a_nxo, cw_nxoi_t a_val):

Input(s):
a_nxo:
Pointer to an integer nxo.
a_val:
Initial value.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
cw_nxoi_t nxo_integer_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an integer nxo.
Output(s):
retval:
Value of a_nxo.
Exception(s):
None.
Description:
Return the value of a_nxo.
void nxo_integer_set(cw_nxo_t *a_nxo, cw_nxoi_t a_val):

Input(s):
a_nxo:
Pointer to an integer nxo.
a_val:
Integer value.
Output(s):
None.
Exception(s):
None.
Description:
Set the value of a_nxo to a_val.


nxo_mark

The nxo_mark class is a subclass of the nxo class.

API

void nxo_mark_new(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an nxo.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.


nxo_mutex

The nxo_mutex class is a subclass of the nxo class.

API

void nxo_mutex_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx):

Input(s):
a_nxo:
Pointer to a mutex nxo.
a_nx:
Pointer to an nx.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void nxo_mutex_lock(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a mutex nxo.
Output(s):
None.
Exception(s):
None.
Description:
Lock a_nxo.
cw_bool_t nxo_mutex_trylock(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a mutex nxo.
Output(s):
retval:
FALSE:
Success.
TRUE:
Failure.
Exception(s):
None.
Description:
Try to lock a_nxo, but return immediately with an error if unable to do so.
void nxo_mutex_unlock(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a mutex nxo.
Output(s):
None.
Exception(s):
None.
Description:
Unlock a_nxo.


nxo_name

The nxo_name class is a subclass of the nxo class.

API

void nxo_name_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, const cw_uint8_t *a_str, cw_uint32_t a_len, cw_bool_t a_is_static):

Input(s):
a_nxo:
Pointer to a name nxo.
a_nx:
Pointer to an nx.
a_str:
Pointer to a character string (not required to be '\0' terminated).
a_len:
Length in bytes of a_str.
a_is_static:
FALSE:
a_str may be modified or deallocated during the lifetime of the program.
TRUE:
a_str will not be modified for the lifetime of the program.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
const cw_uint8_t * nxo_name_str_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a name nxo.
Output(s):
retval:
Pointer to a string that represents a_nxo.
Exception(s):
None.
Description:
Return a pointer to a string that represents a_nxo.
cw_uint32_t nxo_name_len_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a name nxo.
Output(s):
retval:
Length in bytes of the name associated with a_nxo.
Exception(s):
None.
Description:
Return the length in bytes of the name associated with a_nxo.


nxo_no

The nxo_no class is a subclass of the nxo class.

API

void nxo_no_new(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an nxo.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.


nxo_null

The nxo_null class is a subclass of the nxo class.

API

void nxo_null_new(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an nxo.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.


nxo_operator

The nxo_operator class is a subclass of the nxo class.

API

void nxo_operator_new(cw_nxo_t *a_nxo, cw_op_t *a_op, cw_nxn_t a_nxn):

Input(s):
a_nxo:
Pointer to an operator nxo.
a_op:
Pointer to an operator function.
a_nxn:
NXN_ZERO, or an nxn.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
cw_op_t * nxo_operator_f(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an operator nxo.
Output(s):
retval:
Pointer to an operator function.
Exception(s):
None.
Description:
Return the operator function associated with a_nxo.


nxo_pmark

The nxo_pmark class is a subclass of the nxo class.

API

void nxo_pmark_new(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to an nxo.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.


nxo_stack

The nxo_stack class is a subclass of the nxo class.

API

void nxo_stack_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking):

Input(s):
a_nxo:
Pointer to a stack nxo.
a_nx:
Pointer to an nx.
a_locking:
Implicit locking mode.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void nxo_stack_copy(cw_nxo_t *a_to, cw_nxo_t *a_from):

Input(s):
a_to:
Pointer to a stack nxo.
a_from:
Pointer to a stack nxo.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Copy the objects in a_from onto a_to.
cw_uint32_t nxo_stack_count(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a stack nxo.
Output(s):
retval:
Number of objects on a_nxo.
Exception(s):
None.
Description:
Return the number of objects on a_nxo.
cw_nxo_t * nxo_stack_push(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a stack nxo.
Output(s):
retval:
Pointer to a no nxo that has been pushed onto a_nxo.
Exception(s):
_CW_ONYXX_OOM.
Description:
Push a no nxo onto a_nxo and return a pointer to it.
cw_nxo_t * nxo_stack_under_push(cw_nxo_t *a_nxo, cw_nxo_t *a_object):

Input(s):
a_nxo:
Pointer to a stack nxo.
a_object:
Pointer to an nxo on a_nxo.
Output(s):
retval:
Pointer to a no nxo that has been pushed under a_object on a_nxo.
Exception(s):
_CW_ONYXX_OOM.
Description:
Push a no nxo under a_object on a_nxo.
cw_bool_t nxo_stack_pop(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a stack nxo.
Output(s):
retval:
FALSE:
Success.
TRUE:
Stack underflow.
Exception(s):
None.
Description:
Pop an object off of a_nxo.
cw_bool_t nxo_stack_npop(cw_nxo_t *a_nxo, cw_uint32_t a_count):

Input(s):
a_nxo:
Pointer to a stack nxo.
a_count:
Number of objects to pop off of a_nxo.
Output(s):
retval:
FALSE:
Success.
TRUE:
Stack underflow.
Exception(s):
None.
Description:
Pop a_count objects off of a_nxo.
cw_nxo_t * nxo_stack_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a stack nxo.
Output(s):
retval:
non-NULL:
Pointer to the top nxo on a_nxo.
NULL:
Stack underflow.
Exception(s):
None.
Description:
Return a pointer to the top nxo on a_nxo.
cw_nxo_t * nxo_stack_nget(cw_nxo_t *a_nxo, cw_uint32_t a_index):

Input(s):
a_nxo:
Pointer to a stack nxo.
a_index:
Index of object in a_nxo to return a pointer to.
Output(s):
retval:
non-NULL:
Pointer to the nxo on a_nxo at index a_index.
NULL:
Stack underflow.
Exception(s):
None.
Description:
Return a pointer to the nxo on a_nxo at index a_index.
cw_nxo_t * nxo_stack_down_get(cw_nxo_t *a_nxo, cw_nxo_t *a_object):

Input(s):
a_nxo:
Pointer to a stack nxo.
a_object:
Pointer to an object on a_nxo, or NULL for the top object on a_nxo.
Output(s):
retval:
non-NULL:
Pointer to the nxo on a_nxo under a_object.
NULL:
Stack underflow.
Exception(s):
None. Return a pointer to the nxo on a_nxo under a_object.
Description:
cw_bool_t nxo_stack_exch(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a stack nxo.
Output(s):
retval:
FALSE:
Success.
TRUE:
Stack underflow.
Exception(s):
None.
Description:
Exchange the top two objects on a_nxo.
cw_bool_t nxo_stack_roll(cw_nxo_t *a_nxo, cw_uint32_t a_count, cw_sint32_t a_amount):

Input(s):
a_nxo:
Pointer to a stack nxo.
a_count:
Number of objects in roll region.
a_amount:
Amount to roll upward. A negative value rolls downward.
Output(s):
retval:
FALSE:
Success.
TRUE:
Stack underflow.
Exception(s):
None.
Description:
Roll the top a_count objects on a_nxo up by a_amount.


nxo_string

The nxo_string class is a subclass of the nxo class.

API

void nxo_string_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx, cw_bool_t a_locking, cw_uint32_t a_len):

Input(s):
a_nxo:
Pointer to a string nxo.
a_nx:
Pointer to an nx.
a_locking:
Implicit locking mode.
a_len:
Length in bytes of string to create.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void nxo_string_substring_new(cw_nxo_t *a_nxo, cw_nxo_t *a_string, cw_nx_t *a_nx, cw_uint32_t a_offset, cw_uint32_t a_len):

Input(s):
a_nxo:
Pointer to a string nxo.
a_string:
Pointer to a string nxo to create a substring of.
a_nx:
Pointer to an nx.
a_offset:
Offset into a_string.
a_len:
Length in bytes of substring to create.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Substring constructor.
void nxo_string_copy(cw_nxo_t *a_to, cw_nxo_t *a_from):

Input(s):
a_to:
Pointer to a string nxo.
a_from:
Pointer to a string nxo.
Output(s):
None.
Exception(s):
None.
Description:
Copy the contents of a_from to a_to. The length of a_to must be at least that of a_from.
cw_uint32_t nxo_string_len_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a string nxo.
Output(s):
retval:
Length of a_nxo.
Exception(s):
None.
Description:
Return the length of a_nxo.
void nxo_string_el_get(cw_nxo_t *a_nxo, cw_nxoi_t a_offset, cw_uint8_t *r_el):

Input(s):
a_nxo:
Pointer to a string nxo.
a_offset:
Offset of character to get.
r_el:
Pointer to space to copy a character to.
Output(s):
*r_el:
A copy of the character of a_nxo at offset a_offset.
Exception(s):
None.
Description:
Get a copy of the character of a_nxo at offset a_offset.
void nxo_string_el_set(cw_nxo_t *a_nxo, cw_uint8_t a_el, cw_nxoi_t a_offset):

Input(s):
a_nxo:
Pointer to a string nxo.
a_el:
A character.
a_offset:
Offset of character in a_nxo to replace with a_el.
Output(s):
None.
Exception(s):
None.
Description:
Copy a_el into the element of a_nxo at offset a_offset.
void nxo_string_lock(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a string nxo.
Output(s):
None.
Exception(s):
None.
Description:
If implicit locking is activated for a_nxo, lock it.
void nxo_string_unlock(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a string nxo.
Output(s):
None.
Exception(s):
None.
Description:
If implicit locking is activated for a_nxo, unlock it.
cw_uint8_t * nxo_string_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a string nxo.
Output(s):
retval:
Pointer to the string internal to a_nxo.
Exception(s):
None.
Description:
Return a pointer to the string internal to a_nxo.
void nxo_string_set(cw_nxo_t *a_nxo, cw_uint32_t a_offset, const cw_uint8_t *a_str, cw_uint32_t a_len):

Input(s):
a_nxo:
Pointer to a string nxo.
a_offset:
Offset into a_nxo to replace.
a_str:
String to replace a range of a_nxo with.
a_len:
Length in bytes of a_str.
Output(s):
None.
Exception(s):
None.
Description:
Replace a_len bytes of a_nxo at offset a_offset with a_str.


nxo_thread

The nxo_thread class is a subclass of the nxo class.

The threadp class is a helper class that contains scanner position information. The threadp state is used when recording syntax errors.

Errors are of type cw_nxo_threade_t :

NXO_THREADE_NONE:
No error.
NXO_THREADE_DSTACKUNDERFLOW:
No poppable dictionary on dstack.
NXO_THREADE_ESTACKOVERFLOW:
estack too deep.
NXO_THREADE_INTERRUPT:
Interrupt.
NXO_THREADE_INVALIDACCESS:
Permission error.
NXO_THREADE_INVALIDEXIT:
exit operator called outside loop.
NXO_THREADE_INVALIDFILEACCESS:
Insufficient file permissions.
NXO_THREADE_IOERROR:
read()/write()/etc. error.
NXO_THREADE_LIMITCHECK:
Value outside legal range.
NXO_THREADE_RANGECHECK:
Out of bounds string or array use.
NXO_THREADE_STACKUNDERFLOW:
Not enough objects on ostack.
NXO_THREADE_SYNTAXERROR:
Scanner syntax error.
NXO_THREADE_TIMEOUT:
Timeout.
NXO_THREADE_TYPECHECK:
Incorrect argument type.
NXO_THREADE_UNDEFINED:
Object not found in dstack.
NXO_THREADE_UNDEFINEDFILENAME:
Bad filename.
NXO_THREADE_UNDEFINEDRESULT:
Divide by 0.
NXO_THREADE_UNMATCHEDFINO:
No fino on ostack.
NXO_THREADE_UNMATCHEDMARK:
No mark on ostack.
NXO_THREADE_UNREGISTERED:
Other non-enumerated error.

API

cw_nxn_t nxo_threade_nxn(cw_nxo_threade_t a_threade):

Input(s):
a_threade:
A threade error code.
Output(s):
retval:
An nxn corresponding to a_threade.
Exception(s):
None.
Description:
Return an nxn corresponding to a_threade.
void nxo_threadp_new(cw_nxo_threadp_t *a_threadp):

Input(s):
a_threadp:
Pointer to space for a threadp.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
void nxo_threadp_delete(cw_nxo_threadp_t *a_threadp, cw_nxo_t *a_thread):

Input(s):
a_threadp:
Pointer to a threadp.
a_thread:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
void nxo_threadp_position_get(cw_nxo_threadp_t *a_threadp, cw_uint32_t *r_line, cw_uint32_t *r_column):

Input(s):
a_threadp:
Pointer to space for a threadp.
r_line:
Pointer to a location to store a line number.
r_column:
Pointer to a location to store a column number.
Output(s):
*r_line:
Line number.
*r_column:
Column number.
Exception(s):
None.
Description:
Retrieve the line number and column number.
void nxo_threadp_position_set(cw_nxo_threadp_t *a_threadp, cw_uint32_t a_line, cw_uint32_t a_column):

Input(s):
a_threadp:
Pointer to space for a threadp.
a_line:
Line number.
a_column:
Column number.
Output(s):
None.
Exception(s):
None.
Description:
Set the line number and column number.
void nxo_thread_new(cw_nxo_t *a_nxo, cw_nx_t *a_nx):

Input(s):
a_nxo:
Pointer to a thread nxo.
a_nx:
Pointer to an nx.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor.
void nxo_thread_start(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
Application dependent.
Description:
Start a thread running by calling the start operator such that the top object on ostack will be executed.
void nxo_thread_exit(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
None.
Description:
Terminate the thread. This has the same effect as a detached thread exiting. Calling this function may is necessary (depending on the application) to allow the thread to be garbage collected, much the same way as the detach and join operators do.
void nxo_thread_thread(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
Create a new thread. The new thread calls nxo_thread_start().
void nxo_thread_detach(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
None.
Description:
Detach a_nxo so that when it exits it can be garbage collected.
void nxo_thread_join(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
None.
Description:
Wait for a_nxo to exit.
cw_nxo_threadts_t nxo_thread_state(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
The current scanner state of a_nxo.
THREADTS_START:
Start state.
THREADTS_SLASH_CONT:
One '/' seen.
THREADTS_COMMENT:
'%' seen, but no line break yet.
THREADTS_INTEGER:
Scanning an integer.
THREADTS_INTEGER_RADIX:
Scanning a radix integer.
THREADTS_STRING:
Scanning a string.
THREADTS_STRING_NEWLINE_CONT:
'\r' seen in a string.
THREADTS_STRING_PROT_CONT:
'\\' seen in a string.
THREADTS_STRING_CRLF_CONT:
'\' '\r' seen in a string.
THREADTS_STRING_HEX_CONT:
'\' 'x' seen in a string.
THREADTS_STRING_HEX_FINISH:
First hex digit of a ``\xDD'' string escape sequence seen.
THREADTS_NAME:
Scanning a name.
Exception(s):
None.
Description:
Return the current scanner state. In general this is only useful when implementing an interactive environment for which the prompt behaves differently depending on what state the scanner is in. For example the interactive onyx shell needs only to know whether the scanner is in the start state.
cw_bool_t nxo_thread_deferred(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
FALSE:
Execution is not deferred.
TRUE:
Execution is deferred.
Exception(s):
None.
Description:
Return whether the scanner is currently in deferred execution mode. See Section 1.2 for information on deferred execution. In general this is only useful when implementing an interactive environment for which the prompt behaves differently depending on what state the scanner is in.
void nxo_thread_reset(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
None.
Description:
Reset the scanner to the start state, and turn deferral off. This is a dangerous feature that should be used with great care. nxo_no objects should never be visible from inside the interpreter, so the caller must assure that any nxo_no objects are removed before further processing is done in the context of a_nxo.
void nxo_thread_loop(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
None.
Exception(s):
Application specific.
Description:
Execute the top object on estack. The caller is responsible for placing the object on estack, but it is removed before this function returns.
void nxo_thread_interpret(cw_nxo_t *a_nxo, cw_nxo_threadp_t *a_threadp, const cw_uint8_t *a_str, cw_uint32_t a_len):

Input(s):
a_nxo:
Pointer to a thread nxo.
a_threadp:
A threadp.
a_str:
Pointer to a string to interpret.
a_len:
Length in bytes of a_str.
Output(s):
None.
Exception(s):
Application specific.
Description:
Interpret the string pointed to by a_str.
void nxo_thread_flush(cw_nxo_t *a_nxo, cw_nxo_threadp_t *a_threadp):

Input(s):
a_nxo:
Pointer to a thread nxo.
a_threadp:
A threadp.
Output(s):
None.
Exception(s):
Application specific.
Description:
Do the equivalent of interpreting a carriage return in order to force acceptance of the previous token if no whitespace has yet followed.
void nxo_thread_error(cw_nxo_t *a_nxo, cw_nxo_threade_t a_threade):

Input(s):
a_nxo:
Pointer to a thread nxo.
a_threade:
An error code.
Output(s):
None.
Exception(s):
Application dependent.
Description:
Throw an error.
cw_bool_t nxo_thread_dstack_search(cw_nxo_t *a_nxo, cw_nxo_t *a_key, cw_nxo_t *r_value):

Input(s):
a_nxo:
Pointer to a thread nxo.
a_key:
Pointer to an nxo.
r_value:
Pointer to an nxo.
Output(s):
retval:
FALSE:
Success.
TRUE:
a_key not found on dstack.
r_value:
Top value in dstack associated with a_key.
Exception(s):
None.
Description:
Search dstack for the topmost definition of a_key and dup its value to r_value.
cw_bool_t nxo_thread_currentlocking(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
FALSE:
Implicit locking deactivated for new objects.
TRUE:
Implicit locking activated for new objects.
Exception(s):
None.
Description:
Return whether implicit locking is activated for new objects.
void nxo_thread_setlocking(cw_nxo_t *a_nxo, cw_bool_t a_locking):

Input(s):
a_nxo:
Pointer to a thread nxo.
a_locking:
FALSE:
Do not implicitly lock new objects.
TRUE:
Implicitly lock new objects.
Output(s):
None.
Exception(s):
None.
Description:
Activate or deactivate implicit locking for new objects.
cw_nx_t * nxo_thread_nx_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nx.
Exception(s):
None.
Description:
Return the nx associated with a_nxo.
cw_nxo_t * nxo_thread_userdict_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the userdict associated with a_nxo.
cw_nxo_t * nxo_thread_errordict_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the errordict associated with a_nxo.
cw_nxo_t * nxo_thread_currenterror_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the currenterror associated with a_nxo.
cw_nxo_t * nxo_thread_ostack_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the ostack associated with a_nxo.
cw_nxo_t * nxo_thread_dstack_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the dstack associated with a_nxo.
cw_nxo_t * nxo_thread_estack_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the estack associated with a_nxo.
cw_nxo_t * nxo_thread_istack_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the istack associated with a_nxo.
cw_nxo_t * nxo_thread_tstack_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the tstack associated with a_nxo.
cw_nxo_t * nxo_thread_stdin_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the stdin associated with a_nxo.
cw_nxo_t * nxo_thread_stdout_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the stdout associated with a_nxo.
cw_nxo_t * nxo_thread_stderr_get(cw_nxo_t *a_nxo):

Input(s):
a_nxo:
Pointer to a thread nxo.
Output(s):
retval:
Pointer to an nxo that can safely be used without risk of being garbage collected.
Exception(s):
None.
Description:
Return a pointer to the stderr associated with a_nxo.


ql

The ql macros implement operations on a list. The type of the list elements and which field of the elements to use are determined by arguments that are passed into the macros. The macros are optimized for speed and code size, which means that there is minimal error checking built in. As a result, care must be taken to assure that these macros are ussed as intended, or strange things can happen.

Internally, the list is represented as a ring, so with some care, the ql and qr interfaces can be used in conjunction with each other.

Since a ql is actually a ring, it is possible to have multiple ql heads that share the same ring. This works just fine, with the caveat that operations on one ql can have side-effects on another.

API

ql_head(<ql_type> a_type):

Input(s):
a_type:
Data type for the ql elements.
Output(s):
A data structure that can be used as a ql head.
Exception(s):
None.
Description:
Generate code for a ql head data structure.
ql_head_initializer(<ql_type> *a_head):

Input(s):
a_head:
Pointer to a ql head.
Output(s):
None.
Exception(s):
None.
Description:
Statically initialize a ql head.
ql_elm(<ql_type> a_type):

Input(s):
a_type:
Data type for the ql elements.
Output(s):
A data structure that can be used as a ql element.
Exception(s):
None.
Description:
Generate code for a ql element data structure.
void ql_new(<ql_head> *a_head):

Input(s):
a_head:
Pointer to a ql head.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
void ql_elm_new(<ql_type> *a_elm, <field_name> a_field):

Input(s):
a_elm:
Pointer to an element.
a_field:
Field within the ql elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
<ql_type> * ql_first(<ql_head> *a_head):

Input(s):
a_head:
Pointer to a ql head.
Output(s):
retval:
non-NULL:
Pointer to the first element in a_head.
NULL:
a_head is empty.
Exception(s):
None.
Description:
Return a pointer to the first element in the ql.
<ql_type> * ql_last(<ql_head> *a_head):

Input(s):
a_head:
Pointer to a ql head.
Output(s):
retval:
non-NULL:
Pointer to the last element in a_head.
NULL:
a_head is empty.
Exception(s):
None.
Description:
Return a pointer to the last element in the ql.
<ql_type> * ql_next(<ql_head> *a_head, <ql_type> *a_elm, <field_name> a_field):

Input(s):
a_head:
Pointer to a ql head.
a_elm:
Pointer to an element.
a_field:
Field within the ql elements to use.
Output(s):
retval:
non-NULL:
Pointer to the element after a_elm.
NULL:
a_elm is the last element in a_head.
Exception(s):
None.
Description:
Return a pointer to the element in a_head after a_elm.
<ql_type> * ql_prev(<ql_head> *a_head, <ql_type> *a_elm, <field_name> a_field):

Input(s):
a_head:
Pointer to a ql head.
a_elm:
Pointer to an element.
a_field:
Field within the ql elements to use.
Output(s):
retval:
non-NULL:
Pointer to the element before a_elm.
NULL:
a_elm is the first element in a_head.
Exception(s):
None.
Description:
Return a pointer to the element in a_head before a_elm.
void ql_before_insert(<ql_head> *a_head, <ql_type> *a_qlelm, <ql_type> *a_elm, <field_name> a_field):

Input(s):
a_head:
Pointer to a ql head.
a_qlelm:
Pointer to an element within a_head.
a_elm:
Pointer to an element.
a_field:
Field within the ql elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Insert a_elm into a_head before a_qlelm.
void ql_after_insert(<ql_head> *a_head, <ql_type> *a_qlelm, <ql_type> *a_elm, <field_name> a_field):

Input(s):
a_head:
Pointer to a ql head.
a_qlelm:
Pointer to an element within a_head.
a_elm:
Pointer to an element.
a_field:
Field within the ql elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Insert a_elm into a_head after a_qlelm.
void ql_head_insert(<ql_head> *a_head, <ql_type> *a_elm, <field_name> a_field):

Input(s):
a_head:
Pointer to a ql head.
a_elm:
Pointer to an element.
a_field:
Field within the ql elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Insert a_elm at the head of a_head.
void ql_tail_insert(<ql_head> *a_head, <ql_type> *a_elm, <field_name> a_field):

Input(s):
a_head:
Pointer to a ql head.
a_elm:
Pointer to an element.
a_field:
Field within the ql elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Insert a_elm at the tail of a_head.
void ql_remove(<ql_head> *a_head, <ql_type> *a_elm, <field_name> a_field):

Input(s):
a_head:
Pointer to a ql head.
a_elm:
Pointer to an element.
a_field:
Field within the ql elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Remove a_elm from a_head.
void ql_head_remove(<ql_head> *a_head, <ql_type> a_type, <field_name> a_field):

Input(s):
a_head:
Pointer to a ql head.
a_type:
Data type for the ql elements.
a_field:
Field within the ql elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Remove the head element of a_head.
void ql_tail_remove(<ql_head> *a_head, <ql_type> a_type, <field_name> a_field):

Input(s):
a_head:
Pointer to a ql head.
a_type:
Data type for the ql elements.
a_field:
Field within the ql elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Remove the tail element of a_head.
ql_foreach(<ql_type> *a_var, <ql_type> *a_head, <field_name> a_field):

Input(s):
a_var:
The name of a temporary variable to use for iteration.
a_head:
Pointer to a ql head.
a_field:
Field within the ql elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Iterate through the ql, storing a pointer to each element in a_var along the way.
ql_foreach_reverse(<ql_type> *a_var, <ql_type> *a_head, <field_name> a_field):

Input(s):
a_var:
The name of a temporary variable to use for iteration.
a_head:
Pointer to a ql head.
a_field:
Field within the ql elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Iterate through the ql in the reverse direction, storing a pointer to each element in a_var along the way.


qr

The qr macros implement operations on a ring. The type of the ring elements and which field of the elements to use are determined by arguments that are passed into the macros. The macros are optimized for speed and code size, which means that there is minimal error checking built in. As a result, care must be taken to assure that these are used as intended, or strange things can happen.

API

qr(<qr_type> a_type):

Input(s):
a_type:
Data type for the qr.
Output(s):
A data structure that can be used for a qr.
Exception(s):
None.
Description:
Generate code for a qr data structure.
void qr_new(<qr_type> *a_qr, <field_name> a_field):

Input(s):
a_qr:
Pointer to a qr.
a_field:
Field within the qr elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
<qr_type> * qr_next(<qr_type> *a_qr, <field_name> a_field):

Input(s):
a_qr:
Pointer to a qr.
a_field:
Field within the qr elements to use.
Output(s):
retval:
Pointer to the next element in the qr.
Exception(s):
None.
Description:
Return a pointer to the next element in the qr.
<qr_type> * qr_prev(<qr_type> *a_qr, <field_name> a_field):

Input(s):
a_qr:
Pointer to a qr.
a_field:
Field within the qr elements to use.
Output(s):
retval:
Pointer to the previous element in the qr.
Exception(s):
None.
Description:
Return a pointer to the previous element in the qr.
void qr_before_insert(<qr_type> *a_qrelm, <qr_type> *a_qr, <field_name> a_field):

Input(s):
a_qrelm:
Pointer to an element in a qr.
a_qr:
Pointer to an element that is the only element in its ring.
a_field:
Field within the qr elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Insert a_qr before a_qrelm.
void qr_after_insert(<qr_type> *a_qrelm, <qr_type> *a_qr, <field_name> a_field):

Input(s):
a_qrelm:
Pointer to an element in a qr.
a_qr:
Pointer to an element that is the only element in its ring.
a_field:
Field within the qr elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Insert a_qr after a_qrelm.
void qr_meld(<qr_type> *a_qr_a, <qr_type> *a_qr_b, <field_name> a_field):

Input(s):
a_qr_a:
Pointer to a qr.
a_qr_b:
Pointer to a qr.
a_field:
Field within the qr elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Meld a_qr_a and a_qr_b into one ring.
void qr_split(<qr_type> *a_qr_a, <qr_type> *a_qr_b, <field_name> a_field):

Input(s):
a_qr_a:
Pointer to a qr.
a_qr_b:
Pointer to a qr.
a_field:
Field within the qr elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Split a ring at a_qr_a and a_qr_b.
void qr_remove(<qr_type> *a_qr, <field_name> a_field):

Input(s):
a_qr:
Pointer to a qr.
a_field:
Field within the qr elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Remove a_qr from the ring.
qr_foreach(<qr_type> *a_var, <qr_type> *a_qr, <field_name> a_field):

Input(s):
a_var:
The name of a temporary variable to use for iteration.
a_qr:
Pointer to a qr.
a_field:
Field within the qr elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Iterate through the qr, storing a pointer to each element in a_var along the way.
qr_foreach_reverse(<qr_type> *a_var, <qr_type> *a_qr, <field_name> a_field):

Input(s):
a_var:
The name of a temporary variable to use for iteration.
a_qr:
Pointer to a qr.
a_field:
Field within the qr elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Iterate through the qr in the reverse direction, storing a pointer to each element in a_var along the way.


qs

The qs macros implement operations on a stack. The type of the stack elements and which field of the elements to use are determined by arguments that are passed into the macros. The macros are optimized for speed and code size, which means that there is minimal error checking built in. As a result, care must be taken to assure that these macros are used as intended, or strange things can happen.

API

qs_head(<qs_type> a_type):

Input(s):
a_type:
Data type for the qs.
Output(s):
A data structure that can be used as a qs head.
Exception(s):
None.
Description:
Generate code for a qs head data structure.
qs_head_initializer(<qs_type> *a_head):

Input(s):
a_head:
Pointer to a qs head.
Output(s):
None.
Exception(s):
None.
Description:
Statically initialize a qs head.
qs_elm(<qs_elm_type> a_type):

Input(s):
a_type:
Data type for the qs elements.
Output(s):
A data structure that can be used as a qs element.
Exception(s):
None.
Description:
Generate code for a qs element data structure.
void qs_new(<qs_type> *a_head):

Input(s):
a_head:
Pointer to a qs head.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
void qs_elm_new(<qs_elm_type> *a_elm, <field_name> a_field):

Input(s):
a_head:
Pointer to a qs element.
a_field:
Field within the qs elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
<qs_type> * qs_top(<qs_type> *a_head):

Input(s):
a_head:
Pointer to a qs head.
Output(s):
retval:
Pointer to the top element in the qs.
Exception(s):
None.
Description:
Return a pointer to the top element in the qs.
<qs_type> * qs_down(<qs_elm_type> *a_elm, <field_name> a_field):

Input(s):
a_elm:
Pointer to a qs element.
a_field:
Field within the qs elements to use.
Output(s):
retval:
non-NULL:
Pointer to the next element in the qs.
NULL:
a_elm is the bottom element in the qs.
Exception(s):
None.
Description:
Return a pointer to the next element in the qs below a_elm.
void qs_push(<qs_type> *a_head, <qs_elm_type> *a_elm, <field_name> a_field):

Input(s):
a_head:
Pointer to a qs head.
a_elm:
Pointer to an element.
a_field:
Field within the qs elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Push a_elm onto the qs.
void qs_under_push(<qs_elm_type> *a_qselm, <qs_elm_type> *a_elm, <field_name> a_field):

Input(s):
a_qselm:
Pointer to a qs element.
a_elm:
Pointer to an element.
a_field:
Field within the qs elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Push a_elm under a_qselm.
void qs_pop(<qs_type> *a_head, <field_name> a_field):

Input(s):
a_head:
Pointer to a qs head.
a_field:
Field within the qs elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Pop an element off of a_head.
qs_foreach(<qs_elm_type> *a_var, <qs_type> *a_head, <field_name> a_field):

Input(s):
a_var:
The name of a temporary variable to use for iteration.
a_head:
Pointer to a qs head.
a_field:
Field within the qs elements to use.
Output(s):
None.
Exception(s):
None.
Description:
Iterate down the qs, storing a pointer to each element in a_var along the way.


thd

The thd class implements a wrapper around the system threads library (POSIX threads only, so far). In most regards, this is a thin wrapper around the normal threads functionality provided by the system, but some extra information is kept in order to allow implmentation of thread suspension/resumption, ``critical sections'', and ``single sections''.

In most cases, the additional functionality is implemented with the aid of signals. As a result, system calls may be interrupted by signals. The system calls will be automaticalaly restarted if they have made no progress at the time of interruption, but will return a partial result otherwise. Therefore, if any of the additional functionality is utilized, the application must be careful to handle partial system call results. At least the following system calls can be interrupted: read(), write(), sendto(), recvfrom(), sendmsg(), recvmsg(), ioctl(), and wait(). See the system documentation for additional information.

API

cw_thd_t * thd_new(void *(*a_start_func)(void *), void *a_arg, cw_bool_t a_suspendible):

Input(s):
a_start_func:
Pointer to a start function.
a_arg:
Argument passed to a_start_func().
a_suspendible:
FALSE:
Not suspendible.
TRUE:
Suspendible.
Output(s):
retval:
Pointer to a thd.
Exception(s):
_CW_ONYXX_OOM.
Description:
Constructor (creates a new thread).
void thd_delete(cw_thd_t *a_thd):

Input(s):
a_thd:
Pointer to a thd.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
void * thd_join(cw_thd_t *a_thd):

Input(s):
a_thd:
Pointer to a thd.
Output(s):
retval:
Return value from thread entry function.
Exception(s):
None.
Description:
Join (wait for) the thread associated with a_thd.
cw_thd_t * thd_self(void):

Input(s):
None.
Output(s):
retval:
Pointer to the calling thread's thd structure.
Exception(s):
None.
Description:
Return a pointer to the thd structure that corresponds to the calling thread.
void thd_yield(void):

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Give up the rest of the calling thread's time slice.
int thd_sigmask(int a_how, const sigset_t *a_set, sigset_t *r_oset):

Input(s):
a_how:
SIG_BLOCK:
Block signals in a_set.
SIG_UNBLOCK:
Unblock signals in a_set.
SIG_SETMASK:
Set signal mask to a_set.
a_set:
Pointer to a signal set.
r_oset:
non-NULL:
Pointer space to store the old signal mask.
NULL:
Ignored.
Output(s):
retval:
Always zero, unless the arguments are invalid.
*r_oset:
Old signal set.
Exception(s):
None.
Description:
Set the calling thread's signal mask.
void thd_crit_enter(void):

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Enter a critical region where the calling thread may not be suspended by thd_suspend(), thd_trysuspend(), or thd_single_enter().
void thd_crit_leave(void):

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Leave a critical section; the calling thread may once again be suspended.
void thd_single_enter(void):

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Enter a critical region where all other suspendible threads must be suspended.
void thd_single_leave(void):

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Leave a critical section where all other threads must be suspended. All threads that were suspended in thd_single_enter() are resumed.
void thd_suspend(cw_thd_t *a_thd):

Input(s):
a_thd:
Pointer to a thd.
Output(s):
None.
Exception(s):
None.
Description:
Suspend a_thd.
cw_bool_t thd_trysuspend(cw_thd_t *a_thd):

Input(s):
a_thd:
Pointer to a thd.
Output(s):
retval:
FALSE:
Success.
TRUE:
Failure.
Exception(s):
None.
Description:
Try to suspend a_thd, but fail if it is in a critical section.
void thd_resume(cw_thd_t *a_thd):

Input(s):
a_thd:
Pointer to a thd.
Output(s):
None.
Exception(s):
None.
Description:
Resume (make runnable) a_thd.


tsd

The tsd class implements thread-specific data. A tsd instance can be created, then any number of threads can use that same instance to store and retrieve a thread-specific pointer to data.

API

void tsd_new(cw_tsd_t *a_tsd, void (*a_func)(void *)):

Input(s):
a_tsd:
Pointer to space for a tsd.
a_func:
Pointer to a cleanup function, or NULL.
Output(s):
None.
Exception(s):
None.
Description:
Constructor.
void tsd_delete(cw_tsd_t *a_tsd):

Input(s):
a_tsd:
Pointer to a tsd.
Output(s):
None.
Exception(s):
None.
Description:
Destructor.
void * tsd_get(cw_tsd_t *a_tsd):

Input(s):
a_tsd:
Pointer to a tsd.
Output(s):
retval:
Pointer to thread-specific data.
Exception(s):
None.
Description:
Get thread-specific data pointer.
tsd_set(cw_tsd_t *a_tsd, void *a_val):

Input(s):
a_tsd:
Pointer to a tsd.
a_val:
Pointer to thread-specific data.
Output(s):
None.
Exception(s):
None.
Description:
Set thread-specific data pointer.


xep

The xep class implements exception handling, with support for xep_try, xep_catch(), and xep_finally blocks. Minimal use must include at least:
xep_begin();
xep_try {
        /* Code that might throw an exception. */
}
xep_end();

A more complete skeleton looks like:

xep_begin();
xep_try {
        /* Code that might throw an exception. */
}
xep_catch(SOME_EXCEPTION) {
        /* Handle exception... */
        xep_handled();
}
xep_catch(ANOTHER_EXCEPTION)
xep_mcatch(YET_ANOTHER) {
        /* React to exception, but propagate... */
}
xep_acatch {
        /* Handle all exceptions not explicitly handled above... */
        xep_handled();
}
xep_finally {
        /* Execute after everything else. */
}
xep_end();

Note that there is some serious cpp macro magic behind the xep interface, and as such, if usage deviates significantly from the above templates, compiler errors may result.

Exception values are of type cw_xepv_t . 0 to 127 are reserved by libonyx, and other ranges may be reserved by other libraries. See their documentation for details.

An exception is not implicitly handled if an exception handler is executed for that exception. Instead, xep_handled() must be manually called to avoid propagating the exception up the handler chain.

It is not legal to return from a function within an exception handling code block; doing so will corrupt the exception handler chain.

API

void xep_begin(void):

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Begin an exception handling code block.
void xep_end(void):

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
End an exception handling block.
xep_try ...:

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Begin a block of code that is to be executed, with the possibility that an exception might be thrown.
xep_catch(cw_xepv_t a_xepv) ...:

Input(s):
a_xepv:
Exception number.
Output(s):
None.
Exception(s):
None.
Description:
Begin a block of code that catches an exception. The exception is not considered handled unless xep_handled() is called.
xep_mcatch(cw_xepv_t a_xepv) ...:

Input(s):
a_xepv:
Exception number.
Output(s):
None.
Exception(s):
None.
Description:
Begin a block of code that catches an exception. Must immediately follow a xep_catch() call. This interface is used for the case where more than one exception type is to be handled by the same code block. The exception is not considered handled unless xep_handled() is called.
xep_acatch ...:

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Begin a block of code that catches all exceptions not explicitly caught by xep_catch() and xep_mcatch() blocks. There may only be one xep_acatch block within a try/catch block. The exception is not considered handled unless xep_handled() is called.
xep_finally ...:

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Begin a block of code that is executed if no exceptions are thrown in the exception handling code block or if an exception handler is executed.
cw_xepv_t xep_value(void):

Input(s):
None.
Output(s):
retval:
Value of the current exception being handled.
Exception(s):
None.
Description:
Return the value of the current exception being handled.
void xep_throw_e(cw_xepv_t a_xepv, const char *a_filename, cw_uint32_t a_line_num):

void xep_throw(cw_xepv_t a_xepv):

Input(s):
a_xepv:
Exception number to throw.
a_filename:
Should be __FILE__.
a_line_num:
Should be __LINE__.
Output(s):
None.
Exception(s):
a_xepv.
Description:
Throw an exception.
void xep_retry(void):

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Implicitly handle the current exception and retry the xep_try code block.
void xep_handled(void):

Input(s):
None.
Output(s):
None.
Exception(s):
None.
Description:
Mark the current exception as handled.

Dictionaries


gcdict

The gcdict functions implement the operators contained in gcdict . Only the C API is documented here; see Section 1.8.4 for operator semantics.

API

void gcdict_active(cw_nxo_t *a_thread):

void gcdict_collect(cw_nxo_t *a_thread):

void gcdict_period(cw_nxo_t *a_thread):

void gcdict_setactive(cw_nxo_t *a_thread):

void gcdict_setperiod(cw_nxo_t *a_thread):

void gcdict_setthreshold(cw_nxo_t *a_thread):

void gcdict_stats(cw_nxo_t *a_thread):

void gcdict_threshold(cw_nxo_t *a_thread):

Input(s):
a_thread:
Pointer to a thread.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
C interfaces to Onyx operators that control garbage collection.


systemdict

The systemdict functions implement the operators contained in systemdict . Only the C API is documented here; see Section 1.8.8 for operator semantics.

API

void systemdict_abs(cw_nxo_t *a_thread):

void systemdict_add(cw_nxo_t *a_thread):

void systemdict_and(cw_nxo_t *a_thread):

void systemdict_array(cw_nxo_t *a_thread):

void systemdict_begin(cw_nxo_t *a_thread):

void systemdict_bind(cw_nxo_t *a_thread):

void systemdict_broadcast(cw_nxo_t *a_thread):

void systemdict_bytesavailable(cw_nxo_t *a_thread):

void systemdict_catenate(cw_nxo_t *a_thread):

void systemdict_cd(cw_nxo_t *a_thread):

void systemdict_chmod(cw_nxo_t *a_thread):

void systemdict_chown(cw_nxo_t *a_thread):

void systemdict_clear(cw_nxo_t *a_thread):

void systemdict_cleardstack(cw_nxo_t *a_thread):

void systemdict_cleartomark(cw_nxo_t *a_thread):

void systemdict_close(cw_nxo_t *a_thread):

void systemdict_condition(cw_nxo_t *a_thread):

void systemdict_copy(cw_nxo_t *a_thread):

void systemdict_count(cw_nxo_t *a_thread):

void systemdict_countdstack(cw_nxo_t *a_thread):

void systemdict_countestack(cw_nxo_t *a_thread):

void systemdict_counttomark(cw_nxo_t *a_thread):

void systemdict_currentdict(cw_nxo_t *a_thread):

void systemdict_currentlocking(cw_nxo_t *a_thread):

void systemdict_cve(cw_nxo_t *a_thread):

void systemdict_cvlit(cw_nxo_t *a_thread):

void systemdict_cvn(cw_nxo_t *a_thread):

void systemdict_cvrs(cw_nxo_t *a_thread):

void systemdict_cvs(cw_nxo_t *a_thread):

void systemdict_cvx(cw_nxo_t *a_thread):

void systemdict_def(cw_nxo_t *a_thread):

void systemdict_detach(cw_nxo_t *a_thread):

void systemdict_dict(cw_nxo_t *a_thread):

void systemdict_dirforeach(cw_nxo_t *a_thread):

void systemdict_div(cw_nxo_t *a_thread):

void systemdict_dstack(cw_nxo_t *a_thread):

void systemdict_dup(cw_nxo_t *a_thread):

void systemdict_echeck(cw_nxo_t *a_thread):

void systemdict_egid(cw_nxo_t *a_thread):

void systemdict_end(cw_nxo_t *a_thread):

void systemdict_eq(cw_nxo_t *a_thread):

void systemdict_estack(cw_nxo_t *a_thread):

void systemdict_euid(cw_nxo_t *a_thread):

void systemdict_eval(cw_nxo_t *a_thread):

void systemdict_exch(cw_nxo_t *a_thread):

void systemdict_exec(cw_nxo_t *a_thread):

void systemdict_exit(cw_nxo_t *a_thread):

void systemdict_exp(cw_nxo_t *a_thread):

void systemdict_flush(cw_nxo_t *a_thread):

void systemdict_flushfile(cw_nxo_t *a_thread):

void systemdict_for(cw_nxo_t *a_thread):

void systemdict_foreach(cw_nxo_t *a_thread):

void systemdict_fork(cw_nxo_t *a_thread):

void systemdict_ge(cw_nxo_t *a_thread):

void systemdict_get(cw_nxo_t *a_thread):

void systemdict_getinterval(cw_nxo_t *a_thread):

void systemdict_gid(cw_nxo_t *a_thread):

void systemdict_gt(cw_nxo_t *a_thread):

void systemdict_hooktag(cw_nxo_t *a_thread):

void systemdict_if(cw_nxo_t *a_thread):

void systemdict_ifelse(cw_nxo_t *a_thread):

void systemdict_index(cw_nxo_t *a_thread):

void systemdict_join(cw_nxo_t *a_thread):

void systemdict_known(cw_nxo_t *a_thread):

void systemdict_lcheck(cw_nxo_t *a_thread):

void systemdict_le(cw_nxo_t *a_thread):

void systemdict_length(cw_nxo_t *a_thread):

void systemdict_link(cw_nxo_t *a_thread):

void systemdict_load(cw_nxo_t *a_thread):

void systemdict_lock(cw_nxo_t *a_thread):

void systemdict_loop(cw_nxo_t *a_thread):

void systemdict_lt(cw_nxo_t *a_thread):

void systemdict_mark(cw_nxo_t *a_thread):

void systemdict_mkdir(cw_nxo_t *a_thread):

void systemdict_mod(cw_nxo_t *a_thread):

void systemdict_monitor(cw_nxo_t *a_thread):

void systemdict_mul(cw_nxo_t *a_thread):

void systemdict_mutex(cw_nxo_t *a_thread):

void systemdict_ndup(cw_nxo_t *a_thread):

void systemdict_ne(cw_nxo_t *a_thread):

void systemdict_neg(cw_nxo_t *a_thread):

void systemdict_not(cw_nxo_t *a_thread):

void systemdict_npop(cw_nxo_t *a_thread):

void systemdict_nsleep(cw_nxo_t *a_thread):

void systemdict_open(cw_nxo_t *a_thread):

void systemdict_or(cw_nxo_t *a_thread):

void systemdict_ostack(cw_nxo_t *a_thread):

void systemdict_pid(cw_nxo_t *a_thread):

void systemdict_pop(cw_nxo_t *a_thread):

void systemdict_ppid(cw_nxo_t *a_thread):

void systemdict_print(cw_nxo_t *a_thread):

void systemdict_put(cw_nxo_t *a_thread):

void systemdict_putinterval(cw_nxo_t *a_thread):

void systemdict_pwd(cw_nxo_t *a_thread):

void systemdict_quit(cw_nxo_t *a_thread):

void systemdict_rand(cw_nxo_t *a_thread):

void systemdict_read(cw_nxo_t *a_thread):

void systemdict_readline(cw_nxo_t *a_thread):

void systemdict_realtime(cw_nxo_t *a_thread):

void systemdict_rename(cw_nxo_t *a_thread):

void systemdict_repeat(cw_nxo_t *a_thread):

void systemdict_rmdir(cw_nxo_t *a_thread):

void systemdict_roll(cw_nxo_t *a_thread):

void systemdict_sclear(cw_nxo_t *a_thread):

void systemdict_scleartomark(cw_nxo_t *a_thread):

void systemdict_scount(cw_nxo_t *a_thread):

void systemdict_scounttomark(cw_nxo_t *a_thread):

void systemdict_sdup(cw_nxo_t *a_thread):

void systemdict_seek(cw_nxo_t *a_thread):

void systemdict_self(cw_nxo_t *a_thread):

void systemdict_setegid(cw_nxo_t *a_thread):

void systemdict_setenv(cw_nxo_t *a_thread):

void systemdict_seteuid(cw_nxo_t *a_thread):

void systemdict_setgid(cw_nxo_t *a_thread):

void systemdict_setlocking(cw_nxo_t *a_thread):

void systemdict_setuid(cw_nxo_t *a_thread):

void systemdict_sexch(cw_nxo_t *a_thread):

void systemdict_shift(cw_nxo_t *a_thread):

void systemdict_signal(cw_nxo_t *a_thread):

void systemdict_sindex(cw_nxo_t *a_thread):

void systemdict_spop(cw_nxo_t *a_thread):

void systemdict_sprint(cw_nxo_t *a_thread):

void systemdict_spush(cw_nxo_t *a_thread):

void systemdict_srand(cw_nxo_t *a_thread):

void systemdict_sroll(cw_nxo_t *a_thread):

void systemdict_stack(cw_nxo_t *a_thread):

void systemdict_start(cw_nxo_t *a_thread):

void systemdict_status(cw_nxo_t *a_thread):

void systemdict_stderr(cw_nxo_t *a_thread):

void systemdict_stdin(cw_nxo_t *a_thread):

void systemdict_stdout(cw_nxo_t *a_thread):

void systemdict_stop(cw_nxo_t *a_thread):

void systemdict_stopped(cw_nxo_t *a_thread):

void systemdict_string(cw_nxo_t *a_thread):

void systemdict_sub(cw_nxo_t *a_thread):

void systemdict_sym_rp(cw_nxo_t *a_thread) (``)''):

void systemdict_sym_gt(cw_nxo_t *a_thread) (``>''):

void systemdict_sym_rb(cw_nxo_t *a_thread) (``]''):

void systemdict_symlink(cw_nxo_t *a_thread):

void systemdict_tell(cw_nxo_t *a_thread):

void systemdict_test(cw_nxo_t *a_thread):

void systemdict_thread(cw_nxo_t *a_thread):

void systemdict_timedwait(cw_nxo_t *a_thread):

void systemdict_token(cw_nxo_t *a_thread):

void systemdict_truncate(cw_nxo_t *a_thread):

void systemdict_trylock(cw_nxo_t *a_thread):

void systemdict_type(cw_nxo_t *a_thread):

void systemdict_uid(cw_nxo_t *a_thread):

void systemdict_undef(cw_nxo_t *a_thread):

void systemdict_unlink(cw_nxo_t *a_thread):

void systemdict_unlock(cw_nxo_t *a_thread):

void systemdict_unsetenv(cw_nxo_t *a_thread):

void systemdict_wait(cw_nxo_t *a_thread):

void systemdict_waitpid(cw_nxo_t *a_thread):

void systemdict_where(cw_nxo_t *a_thread):

void systemdict_write(cw_nxo_t *a_thread):

void systemdict_xcheck(cw_nxo_t *a_thread):

void systemdict_xor(cw_nxo_t *a_thread):

void systemdict_yield(cw_nxo_t *a_thread):

Input(s):
a_thread:
Pointer to a thread.
Output(s):
None.
Exception(s):
_CW_ONYXX_OOM.
Description:
C interfaces to onyx operators.


next up previous contents index
Next: Index Up: Contents Previous: The onyx program   Contents   Index
Jason Evans 2001-08-21