![]() |
Boron 2.1.0
|
Data Structures | |
struct | UBindTarget |
Holds information for binding functions. More... | |
struct | USeriesIter |
Iterator for const series of any type. More... | |
struct | UBlockIt |
Iterator for const UCell array. More... | |
union | UCell |
A cell holds a single value of a simple type or a reference (often to a UBuffer) for a complex type. More... | |
struct | UBuffer |
The UBuffer struct holds information about a resource, usually a chunk of memory. More... | |
struct | UThread |
The UThread struct stores the data specific to a thread of execution. More... | |
struct | UEnvParameters |
The UEnvParameters struct allows the user to override default buffer and structure sizes. More... | |
Macros | |
#define | ur_type(c) |
Return UrlanDataType of cell. | |
#define | ur_setId(c, t) |
Set type and initialize the other 24 bits of UCellId to zero. | |
#define | ur_isShared(n) |
True if buffer number refers to a buffer in the shared environment. | |
#define | ur_isSliced(c) |
True if the end member of a series cell is set. | |
#define | ur_foreach(bi) |
Loop over all members of an iterator struct. | |
#define | ur_hold(n) |
Convenience macro for ur_holdBuffer(). | |
#define | ur_release(h) |
Convenience macro for ur_releaseBuffer(). | |
#define | ur_pop(ut) |
Decrement stack.used. | |
#define | ur_buffer(n) |
Macro to get buffer known to be in thread dataStore. | |
#define | ur_bufferE(n) |
Convenience macro for ur_bufferEnv(). | |
#define | ur_bufferSer(c) |
Convenience macro for ur_bufferSeries(). | |
#define | ur_bufferSerM(c) |
Convenience macro for ur_bufferSeriesM(). | |
Functions | |
const char * | ur_atomCStr (UThread *ut, UAtom atom) |
Get name of atom. | |
UThread * | ur_makeThread (const UThread *ut, uint32_t flags) |
Create a new thread. | |
int | ur_destroyThread (UThread *ut) |
Free memory used by UThread. | |
UEnvParameters * | ur_envParam (UEnvParameters *par) |
Initialize UEnvParameters structure to default values. | |
UThread * | ur_makeEnv (const UEnvParameters *par) |
Allocate UEnv and initial UThread. | |
void | ur_freeEnv (UThread *ut) |
Free environment and the initial thread. | |
void | ur_freezeEnv (UThread *ut) |
Move the startup thread dataStore to the shared environment. | |
int | ur_datatypeCount (UThread *ut) |
Get number of datatypes installed in the environment. | |
UAtom | ur_intern (UThread *ut, const char *name, int len) |
Add a single atom to the shared environment. | |
UAtom | ur_internAtom (UThread *ut, const char *it, const char *end) |
Add a single atom to the shared environment. | |
UAtom * | ur_internAtoms (UThread *ut, const char *words, UAtom *atoms) |
Add atoms to the shared environment. | |
UBuffer * | ur_genBuffers (UThread *ut, int count, UIndex *index) |
Generate new buffers in dataStore. | |
UBuffer * | ur_generate (UThread *ut, int count, UIndex *index, const uint8_t *types) |
Generate and initialize buffers of given types. | |
void | ur_destroyBuffer (UThread *ut, UBuffer *buf) |
Destroy buffer in dataStore. | |
UIndex | ur_holdBuffer (UThread *ut, UIndex bufN) |
Keeps buffer in thread dataStore from being garbage collected by ur_recycle(). | |
void | ur_releaseBuffer (UThread *ut, UIndex hold) |
Enables garbage collection of dataStore buffer which was held by ur_holdBuffer(). | |
UCell * | ur_push (UThread *ut, int type) |
Set id of cell on top of stack and increment stack.used. | |
UCell * | ur_pushCell (UThread *ut, const UCell *src) |
Copy cell to top of stack and increment stack.used. | |
UBuffer * | ur_threadContext (UThread *ut) |
Get thread global context. | |
UBuffer * | ur_envContext (UThread *ut) |
Get shared global context. | |
UStatus | ur_error (UThread *ut, int errorType, const char *fmt,...) |
Create error! exception. | |
void | ur_appendTrace (UThread *ut, UIndex blkN, UIndex it) |
Append block position to the current exception error! trace. | |
int | ur_true (const UCell *cell) |
Check if a value is "true". | |
int | ur_same (UThread *ut, const UCell *a, const UCell *b) |
int | ur_equal (UThread *ut, const UCell *a, const UCell *b) |
int | ur_equalCase (UThread *ut, const UCell *a, const UCell *b) |
Case-sensitive equality test. | |
int | ur_compare (UThread *ut, const UCell *a, const UCell *b) |
int | ur_compareCase (UThread *ut, const UCell *a, const UCell *b) |
Case-sensitive ordering comparison. | |
void | ur_toStr (UThread *ut, const UCell *cell, UBuffer *str, int depth) |
Append data representation of cell to a string. | |
void | ur_toText (UThread *ut, const UCell *cell, UBuffer *str) |
Append textual representation of cell to a string. | |
const UCell * | ur_wordCell (UThread *ut, const UCell *cell) |
Get word value for read-only operations. | |
UCell * | ur_wordCellM (UThread *ut, const UCell *cell) |
Get modifiable word value. | |
UStatus | ur_setWord (UThread *ut, const UCell *word, const UCell *src) |
Set word. | |
const UBuffer * | ur_bufferEnv (UThread *ut, UIndex n) |
Get buffer from either the thread dataStore or environment sharedStore. | |
const UBuffer * | ur_bufferSeries (const UThread *ut, const UCell *cell) |
Get series buffer. | |
UBuffer * | ur_bufferSeriesM (UThread *ut, const UCell *cell) |
Get modifiable series buffer. | |
void | ur_seriesSlice (const UThread *ut, USeriesIter *si, const UCell *cell) |
Set USeriesIter to series slice. | |
UStatus | ur_seriesSliceM (UThread *ut, USeriesIterM *si, const UCell *cell) |
Set USeriesIterM to modifiable series slice. | |
const UBuffer * | ur_blockIt (const UThread *ut, UBlockIt *bi, const UCell *blkCell) |
Set UBlockIt to the start and end of a block slice. | |
UStatus | ur_tokenizeB (UThread *ut, UIndex blkN, int inputEncoding, const uint8_t *start, const uint8_t *end) |
Parse UTF-8 or Latin1 data into block. | |
UIndex | ur_tokenize (UThread *ut, const char *it, const char *end, UCell *res) |
Convert a UTF-8 data string into a block. | |
Variables | |
const UBuffer * | USeriesIter::buf |
Buffer pointer. | |
UIndex | USeriesIter::it |
Start position. | |
UIndex | USeriesIter::end |
End position. | |
const UCell * | UBlockIt::it |
Start position. | |
const UCell * | UBlockIt::end |
End position. | |
#define ur_foreach | ( | bi | ) |
Loop over all members of an iterator struct.
These include UBlockIt, UBlockIter, USeriesIter.
#define ur_pop | ( | ut | ) |
Decrement stack.used.
Must not be called if stack.used is zero.
Append block position to the current exception error! trace.
blkN | Block id. |
it | Position in block blkN. |
const char * ur_atomCStr | ( | UThread * | ut, |
UAtom | atom ) |
Get name of atom.
atom | Valid atom. |
Set UBlockIt to the start and end of a block slice.
bi | Iterator struct to fill. |
blkCell | Pointer to a valid block cell. |
Get buffer from either the thread dataStore or environment sharedStore.
The macro ur_bufferE() should normally be used to call this function.
n | Buffer identifier. |
Get series buffer.
The macro ur_bufferSer() should normally be used to call this function.
cell | Pointer to valid series or bound word cell. |
Get modifiable series buffer.
The macro ur_bufferSerM() should normally be used to call this function.
cell | Pointer to valid series or bound word cell. |
Case-sensitive ordering comparison.
int ur_datatypeCount | ( | UThread * | ut | ) |
Get number of datatypes installed in the environment.
Destroy buffer in dataStore.
The buffer must be valid. This function must not be called with a buffer which has not been generated with ur_genBuffers(), has not been initialized, or has already been destroyed.
buf | Pointer to valid buffer. |
int ur_destroyThread | ( | UThread * | ut | ) |
Free memory used by UThread.
To destroy a thread created with ur_makeEnv(), use ur_freeEnv().
ut | Thread created with ur_makeThread() |
Get shared global context.
Case-sensitive equality test.
Create error! exception.
The errorType is only descriptive, it has no real function.
errorType | UrlanErrorType (UR_ERR_TYPE, UR_ERR_SCRIPT, etc.). |
fmt | Error message with printf() style formatting. |
void ur_freeEnv | ( | UThread * | ut | ) |
Free environment and the initial thread.
The caller must make sure no other threads created with ur_makeThread() are running.
ut | UThread created with ur_makeEnv(). It is safe to pass zero. |
void ur_freezeEnv | ( | UThread * | ut | ) |
Move the startup thread dataStore to the shared environment.
This may only be called once after ur_makeEnv(), and must be done before a second thread is created.
The thread method UR_THREAD_FREEZE is called before any adjustments are made. After the store has been converted, all buffer holds are removed and a fresh thread dataStore is created.
ut | UThread created with ur_makeEnv(). |
Generate new buffers in dataStore.
This may trigger the garbage collector.
The new buffers are completely unintialized, so the caller must make them valid before the next garbage recycle.
count | Number of buffers to obtain. |
index | Return array of buffer ids. This must large enough to to hold count indices. |
Generate and initialize buffers of given types.
Strings will have an UR_ENC_LATIN1 form. Vectors will have an UR_VEC_I32 form.
count | Number of buffers to obtain. |
index | Return array of buffer ids. This must large enough to to hold count indices. |
types | Array of UrlanDataType. |
Keeps buffer in thread dataStore from being garbage collected by ur_recycle().
UAtom ur_intern | ( | UThread * | ut, |
const char * | name, | ||
int | len ) |
Add a single atom to the shared environment.
name | Pointer to atom name. |
len | Length of name. |
UAtom ur_internAtom | ( | UThread * | ut, |
const char * | it, | ||
const char * | end ) |
Add a single atom to the shared environment.
it | Start of word. |
end | End of word. |
UAtom * ur_internAtoms | ( | UThread * | ut, |
const char * | words, | ||
UAtom * | atoms ) |
Add atoms to the shared environment.
words | C string containing words separated by whitespace. |
atoms | Return area for atoms of the words. |
UThread * ur_makeEnv | ( | const UEnvParameters * | par | ) |
Allocate UEnv and initial UThread.
atomLimit | Maximum number of atoms. Memory usage is ((12 + 12) * atomLimit) bytes. |
dtTable | Array of pointers to user defined datatypes. Pass zero if dtCount is zero. |
dtCount | Number of datatypes in dtTable. |
thrSize | Byte size of each thread in the environment. Pass zero if no extra memory is needed. |
thrMethod | Callback function to initialize and cleanup threads. This may be zero. |
par | Environment parameters. |
Create a new thread.
ut | Existing thread. |
flags | Zero or UR_TFLAG_FIBRE. |
Set id of cell on top of stack and increment stack.used.
Copy cell to top of stack and increment stack.used.
void ur_seriesSlice | ( | const UThread * | ut, |
USeriesIter * | si, | ||
const UCell * | cell ) |
Set USeriesIter to series slice.
si | Iterator struct to fill. |
cell | Pointer to a valid series cell. |
Set USeriesIterM to modifiable series slice.
si | Iterator struct to fill. |
cell | Pointer to a valid series cell. |
Set word.
This copies src into the cell which the word is bound to.
If the word is unbound or bound to the shared environment then an error is generated and UR_THROW is returned.
word | Word to set. |
src | Source value to copy. |
Get thread global context.
Convert a UTF-8 data string into a block.
it | Start of string. |
end | End of string. |
res | Cell to initialize as UT_BLOCK if non-zero is returned. |
UStatus ur_tokenizeB | ( | UThread * | ut, |
UIndex | blkN, | ||
int | inputEncoding, | ||
const uint8_t * | start, | ||
const uint8_t * | end ) |
Parse UTF-8 or Latin1 data into block.
blkN | Index of initialized block buffer. |
inputEncoding | UR_ENC_UTF8 or UR_ENC_LATIN1 |
start | Pointer to start of input data. |
end | Pointer to end of input data. |
Append data representation of cell to a string.
str | String to add to. |
Append textual representation of cell to a string.
str | String to add to. |
int ur_true | ( | const UCell * | cell | ) |
Check if a value is "true".
Note that a word bound to 'none is true.
Get word value for read-only operations.
cell | Pointer to word cell. |