33#define UR_VERSION_STR "2.96.0"
34#define UR_VERSION 0x0209600
74 UT_REFERENCE_BUF = UT_WORD
80#define UR_FLAG_INT_HEX 0x01
81#define UR_FLAG_TIMECODE_DF 0x01
82#define UR_FLAG_SOL 0x80
97enum UrlanBinaryEncoding
106enum UrlanStringEncoding
145#define UR_INVALID_BUF 0
146#define UR_INVALID_HOLD -1
147#define UR_INVALID_ATOM 0xffff
151typedef uint16_t UAtom;
188#define UR_COORD_MAX 6
195 int16_t
n[ UR_COORD_MAX ];
208#define UR_SELECT_ATOM 1
209#define UR_SELECT_INT 2
291#define UR_STRING_ENC_UP 0x01
292#define UR_STATIC 0x80
295typedef struct UEnv UEnv;
327#define UR_MAIN_CONTEXT 1
331#define UR_TFLAG_INITIAL 1
332#define UR_TFLAG_FIBRE 2
415 UR_COMPARE_EQUAL_CASE,
417 UR_COMPARE_ORDER_CASE,
525void ur_atomsSort( UAtomEntry* entries,
int low,
int high );
526int ur_atomsSearch(
const UAtomEntry* entries,
int count, UAtom atom );
544 const uint8_t* start,
const uint8_t* end );
560 const UCell* blkCell );
589 enum UrlanBinaryEncoding enc );
613 enum UrlanBinaryEncoding enc );
621 const uint8_t* charSet,
int len );
623 const uint8_t* charSet,
int len );
629#define ur_strFree ur_arrFree
630#define ur_strIsUcs2(buf) ((buf)->form == UR_ENC_UCS2)
644 uint32_t typeMask,
UBuffer* dest,
int unique );
645#define ur_blkFree ur_arrFree
667#define ur_ctxLookupNoSort ur_ctxLookup
668#define ur_ctxCell(c,n) ((c)->ptr.cell + (n))
686#define ur_ptr(T,buf) ((T*) (buf)->ptr.v)
687#define ur_avail(buf) (buf)->ptr.i32[-1]
688#define ur_testAvail(buf) (buf->ptr.v ? ur_avail(buf) : 0)
690#define ur_arrExpand1(T,buf,elem) \
691 ur_arrReserve(buf, buf->used + 1); \
692 elem = ur_ptr(T,buf) + buf->used; \
695#define ur_type(c) (c)->id.type
697#define ur_setId(c,t) *((uint32_t*) (c)) = (t) << 24
698#define ur_initCoord(c,n) *((uint32_t*) (c)) = UT_COORD << 24 | (n)
699#define ur_bufHeader(type,es,form,fl) (type<<24 | es<<16 | form<<8 | fl)
701#define ur_setId(c,t) *((uint32_t*) (c)) = t
702#define ur_initCoord(c,n) *((uint32_t*) (c)) = UT_COORD | (n) << 16
703#define ur_bufHeader(type,es,form,fl) (fl<<24 | form<<16 | es<<8 | type)
705#define ur_setFlags(c,m) (c)->id.flags |= m
706#define ur_clrFlags(c,m) (c)->id.flags &= ~(m)
707#define ur_flags(c,m) ((c)->id.flags & m)
708#define ur_is(c,t) ((c)->id.type == (t))
710#define ur_atom(c) (c)->word.atom
711#define ur_datatype(c) (c)->datatype.n
712#define ur_logic(c) (c)->id.ext
713#define ur_char(c) (c)->number.eb.i64
714#define ur_int(c) (c)->number.eb.i64
715#define ur_double(c) (c)->number.eb.d
717#define ur_isWordType(t) ((t) >= UT_WORD && (t) <= UT_OPTION)
718#define ur_binding(c) (c)->word.binding
719#define ur_setBinding(c,bindType) (c)->word.binding = bindType
721#define ur_isBlockType(t) ((t) == UT_BLOCK || (t) == UT_PAREN)
722#define ur_isPathType(t) ((t) >= UT_PATH && (t) <= UT_SETPATH)
723#define ur_isStringType(t) ((t) == UT_STRING || (t) == UT_FILE)
725#define ur_isSeriesType(t) ((t) >= UT_BINARY && (t) < UT_PATH)
726#define ur_isShared(n) (n < 0)
727#define ur_isSliced(c) ((c)->series.end > -1)
729#define ur_setWordUnbound(c,atm) \
730 (c)->word.atom = atm; \
731 (c)->word.ctx = UR_INVALID_BUF
735#define ur_setSeries(c,bn,sit) \
736 (c)->series.buf = bn; \
737 (c)->series.it = sit; \
740#define ur_setSlice(c,bn,sit,send) \
741 (c)->series.buf = bn; \
742 (c)->series.it = sit; \
743 (c)->series.end = send
745#define ur_stackTop(ut) (ut->stack.ptr.cell + ut->stack.used - 1)
746#define ur_exception(ut) ut->stack.ptr.cell
747#define ur_pop(ut) --(ut)->stack.used
748#define ur_hold(n) ur_holdBuffer(ut,n)
749#define ur_release(h) ur_releaseBuffer(ut,h)
750#define ur_buffer(n) (ut->dataStore.ptr.buf + (n))
751#define ur_bufferE(n) ur_bufferEnv(ut,n)
752#define ur_bufferSer(c) ur_bufferSeries(ut,c)
753#define ur_bufferSerM(c) ur_bufferSeriesM(ut,c)
755#define ur_bufferInit(b,head,count,data) \
756 *((uint32_t*) b) = head; \
760#define ur_foreach(bi) for(; bi.it != bi.end; ++bi.it)
762#define ur_wordCStr(c) ur_atomCStr(ut, ur_atom(c))
764#define ur_cstr(strC,bin) \
765 ur_cstring(ur_bufferSer(strC), bin, strC->series.it, strC->series.end)
void ur_binToStr(UBuffer *, int encoding)
Convert binary buffer to string buffer.
Definition binary.c:486
const char * ur_binAppendBase(UBuffer *buf, const char *it, const char *end, enum UrlanBinaryEncoding enc)
Append encoded ASCII string to binary buffer.
Definition binary.c:282
UStatus ur_binSliceM(UThread *, UBinaryIterM *, const UCell *cell)
Set UBinaryIterM to binary slice.
Definition binary.c:456
void ur_binErase(UBuffer *, int start, int count)
Remove bytes from the binary.
Definition binary.c:171
void ur_binAppendData(UBuffer *, const uint8_t *data, int len)
Append data to binary buffer.
Definition binary.c:213
UBuffer * ur_makeBinaryCell(UThread *, int size, UCell *cell)
Generate a single binary and set cell to reference it.
Definition binary.c:74
void ur_binReserve(UBuffer *, int size)
Allocates enough memory to hold size bytes.
Definition binary.c:138
void ur_binInit(UBuffer *, int size)
Initialize buffer to type UT_BINARY.
Definition binary.c:93
void ur_binFree(UBuffer *)
Free binary data.
Definition binary.c:120
void ur_binSlice(UThread *, UBinaryIter *, const UCell *cell)
Set UBinaryIter to binary slice.
Definition binary.c:423
void ur_binAppendArray(UBuffer *, const USeriesIter *si)
Append array slice to binary buffer.
Definition binary.c:227
void ur_binExpand(UBuffer *, int index, int count)
Create space in the binary for count bytes starting at index.
Definition binary.c:194
UIndex ur_makeBinary(UThread *, int size)
Generate and initialize a single binary buffer.
Definition binary.c:56
UIndex ur_blkClone(UThread *, UIndex blkN)
Make deep copy of block.
Definition block.c:256
void ur_blkInsert(UBuffer *, UIndex it, const UCell *cells, int count)
Insert cells into block.
Definition block.c:143
void ur_blkInit(UBuffer *, int type, int size)
Initialize block buffer.
Definition block.c:96
void ur_blkCollectType(UThread *, const UCell *blkCell, uint32_t typeMask, UBuffer *dest, int unique)
Find all values of a certain type and append them to another block.
Definition block.c:297
UCell * ur_blkPop(UBuffer *)
Remove cell from end of block.
Definition block.c:166
void ur_blkPush(UBuffer *, const UCell *cell)
Copy cell to end of block.
Definition block.c:153
void ur_blkSlice(UThread *, UBlockIter *, const UCell *cell)
Set UBlockIter to block slice.
Definition block.c:189
UStatus ur_blkSliceM(UThread *, UBlockIterM *, const UCell *cell)
Set UBlockIterM to block slice.
Definition block.c:224
UCell * ur_blkAppendNew(UBuffer *, int type)
Add cell to end of block.
Definition block.c:109
UIndex ur_makeBlock(UThread *, int size)
Generate a single block of type UT_BLOCK.
Definition block.c:57
void ur_blkAppendCells(UBuffer *, const UCell *cells, int count)
Append cells to block.
Definition block.c:125
UBuffer * ur_makeBlockCell(UThread *, int type, int size, UCell *cell)
Generate a single block and set cell to reference it.
Definition block.c:76
UBuffer * ur_ctxMirror(UThread *, const UBuffer *src, UCell *cell)
Create a shallow copy of a context and set cell to reference the new context.
Definition context.c:257
void ur_infuse(UThread *, UCell *it, UCell *end, const UBuffer *ctx)
Replace words in cells with their values from a context.
Definition context.c:837
UBuffer * ur_ctxClone(UThread *, const UBuffer *src, UCell *cell)
Clone a new context and set cell to reference it.
Definition context.c:220
UCell * ur_ctxAddWord(UBuffer *, UAtom atom)
Similar to ur_ctxAddWordI(), but safely returns the cell pointer.
Definition context.c:437
int ur_ctxAddWordI(UBuffer *, UAtom atom)
Add word to context if it does not already exist.
Definition context.c:420
void ur_ctxFree(UBuffer *)
Free context data.
Definition context.c:316
int ur_ctxLookup(const UBuffer *, UAtom atom)
Find word in context by atom.
Definition context.c:579
void ur_bindCells(UThread *, UCell *it, UCell *end, const UBindTarget *bt)
Bind an array of cells to a target.
Definition context.c:614
int ur_atomsSearch(const UAtomEntry *entries, int count, UAtom atom)
Find an atom in a UAtomEntry table using a binary search.
Definition context.c:355
void ur_atomsSort(UAtomEntry *entries, int low, int high)
Sort UAtomEntry table in ascending atom value order.
Definition context.c:459
void ur_ctxSetWords(UBuffer *, const UCell *it, const UCell *end)
Add the set-word! values in a series of cells to the words in a context.
Definition context.c:283
UBuffer * ur_makeContextCell(UThread *, int size, UCell *cell)
Generate a single context and set cell to reference it.
Definition context.c:111
UBuffer * ur_ctxSort(UBuffer *)
Sort the internal context search table so ur_ctxLookup() is faster.
Definition context.c:510
int ur_ctxAppendWord(UBuffer *, UAtom atom)
Append word to context.
Definition context.c:390
void ur_bindCopy(UThread *, const UBuffer *ctx, UCell *it, UCell *end)
Recursively bind blocks to the bindings found in a context.
Definition context.c:732
void ur_ctxWordAtoms(const UBuffer *, UAtom *atoms)
Get word atoms in order.
Definition context.c:334
UIndex ur_makeContext(UThread *, int size)
Generate and initialize a single context.
Definition context.c:93
void ur_unbindCells(UThread *, UCell *it, UCell *end, int deep)
Unbind all words in an array of cells.
Definition context.c:790
void ur_bind(UThread *, UBuffer *blk, const UBuffer *ctx, int bindType)
Bind block to context.
Definition context.c:690
const UBuffer * ur_sortedContext(UThread *, const UCell *)
Get context and make sure it is fully sorted for minimal ur_ctxLookup() time.
Definition context.c:547
void ur_ctxReserve(UBuffer *, int size)
Allocates enough memory to hold size words.
Definition context.c:133
void ur_ctxInit(UBuffer *, int size)
Initialize context buffer.
Definition context.c:299
UStatus ur_setPath(UThread *, const UCell *path, const UCell *src)
Set path.
Definition path.c:361
UBuffer * ur_makePathCell(UThread *, const UCell *nodes, int size, UCell *cell)
Initialize path cell and generate block if needed.
Definition path.c:65
UBuffer * ur_makeStringCell(UThread *, int enc, int size, UCell *cell)
Generate a single string and set cell to reference it.
Definition string.c:104
int ur_strChar(const UBuffer *, UIndex pos)
Return the character at a given position.
Definition string.c:1659
UIndex ur_strFindCharsRev(const UBuffer *, UIndex start, UIndex end, const uint8_t *charSet, int len)
Find the last character of a set in a string.
Definition string.c:1388
void ur_strAppendBinary(UBuffer *, const uint8_t *it, const uint8_t *end, enum UrlanBinaryEncoding enc)
Append binary data as text of the specified encoding.
Definition string.c:998
int ur_strIsAscii(const UBuffer *)
Test if all characters are ASCII.
Definition string.c:1066
void ur_strAppendChar(UBuffer *, int)
Append a single UCS2 character to a string.
Definition string.c:611
UIndex ur_strFindChars(const UBuffer *, UIndex start, UIndex end, const uint8_t *charSet, int len)
Find the first character of a set in a string.
Definition string.c:1353
void ur_strAppendIndent(UBuffer *, int depth)
Append tabs to a string.
Definition string.c:851
UIndex ur_makeString(UThread *, int enc, int size)
Generate and initialize a single string buffer.
Definition string.c:85
UIndex ur_strFindRev(const USeriesIter *, const USeriesIter *, int matchCase)
Find last string in another string or binary series.
Definition string.c:1531
UIndex ur_makeStringUtf8(UThread *, const uint8_t *it, const uint8_t *end)
Generate and initialize a single string buffer from memory holding a UTF-8 string.
Definition string.c:415
void ur_strAppendHex(UBuffer *, uint32_t n, uint32_t hi)
Append a hexidecimal integer to a string.
Definition string.c:765
UIndex ur_strMatch(const USeriesIter *, const USeriesIter *, int matchCase)
Compare characters in two string or binary series.
Definition string.c:1584
void ur_strTermNull(UBuffer *)
Terminate with null character so buffer can be used as a C string.
Definition string.c:1049
void ur_strInitUtf8(UBuffer *, const uint8_t *it, const uint8_t *end)
Initialize a single string buffer from memory holding a UTF-8 string.
Definition string.c:345
void ur_strAppendInt(UBuffer *, int32_t)
Append an integer to a string.
Definition string.c:706
void ur_strInit(UBuffer *, int enc, int size)
Initialize buffer to type UT_STRING.
Definition string.c:430
UIndex ur_strFindChar(const UBuffer *, UIndex, UIndex, int ch, int opt)
Find the first instance of a character in a string.
Definition string.c:1292
char * ur_cstring(const UBuffer *, UBuffer *bin, UIndex start, UIndex end)
Make null terminated UTF-8 string in binary buffer.
Definition string.c:1684
void ur_strAppend(UBuffer *, const UBuffer *strB, UIndex itB, UIndex endB)
Append another string buffer to this string.
Definition string.c:899
void ur_strLowercase(UBuffer *str, UIndex start, UIndex send)
Convert characters of string slice to lowercase.
Definition string.c:1178
void ur_strAppendDouble(UBuffer *, double)
Append a double to a string.
Definition string.c:787
UIndex ur_strFind(const USeriesIter *, const USeriesIter *, int matchCase)
Find string in another string or binary series.
Definition string.c:1451
void ur_strAppendFloat(UBuffer *, float)
Append a float to a string.
Definition string.c:813
void ur_strAppendInt64(UBuffer *, int64_t)
Append an 64-bit integer to a string.
Definition string.c:725
void ur_strAppendCStr(UBuffer *, const char *)
Append a null-terminated UTF-8 string to a string buffer.
Definition string.c:641
void ur_strFlatten(UBuffer *)
Convert a UTF-8 or UCS-2 string buffer to Latin-1 if possible.
Definition string.c:1104
void ur_strUppercase(UBuffer *str, UIndex start, UIndex send)
Convert characters of string slice to uppercase.
Definition string.c:1216
UIndex ur_makeStringLatin1(UThread *, const uint8_t *it, const uint8_t *end)
Generate and initialize a single string buffer from memory holding a Latin-1 string.
Definition string.c:133
void ur_seriesSlice(const UThread *, USeriesIter *si, const UCell *cell)
Set USeriesIter to series slice.
Definition env.c:1338
void ur_releaseBuffer(UThread *, UIndex hold)
Enables garbage collection of dataStore buffer which was held by ur_holdBuffer().
Definition env.c:877
void ur_freeEnv(UThread *)
Free environment and the initial thread.
Definition env.c:480
@ UT_TYPEMASK
Used in UCellDatatype to declare a multi-type datatype!.
Definition urlan.h:73
const char * ur_atomCStr(UThread *, UAtom atom)
Get name of atom.
Definition atoms.c:47
const UBuffer * ur_bufferEnv(UThread *, UIndex n)
Get buffer from either the thread dataStore or environment sharedStore.
Definition env.c:1258
UIndex ur_tokenize(UThread *, const char *it, const char *end, UCell *res)
Convert a UTF-8 data string into a block.
Definition tokenize.c:1197
UIndex it
Start position.
Definition urlan.h:338
UStatus ur_error(UThread *, int errorType, const char *fmt,...)
Create error! exception.
Definition env.c:964
UCell * ur_push(UThread *, int type)
Set id of cell on top of stack and increment stack.used.
Definition env.c:906
const UCell * ur_wordCell(UThread *, const UCell *cell)
Get word value for read-only operations.
Definition env.c:1132
void ur_freezeEnv(UThread *)
Move the startup thread dataStore to the shared environment.
Definition env.c:517
UAtom ur_intern(UThread *, const char *name, int len)
Add a single atom to the shared environment.
Definition env.c:596
UBuffer * ur_bufferSeriesM(UThread *, const UCell *cell)
Get modifiable series buffer.
Definition env.c:1298
const UBuffer * ur_bufferSeries(const UThread *, const UCell *cell)
Get series buffer.
Definition env.c:1282
UAtom ur_internAtom(UThread *, const char *it, const char *end)
Add a single atom to the shared environment.
Definition env.c:612
UBuffer * ur_envContext(UThread *)
Get shared global context.
Definition env.c:945
const UCell * end
End position.
Definition urlan.h:388
UStatus ur_setWord(UThread *, const UCell *wordCell, const UCell *src)
Set word.
Definition env.c:1225
int ur_same(UThread *, const UCell *a, const UCell *b)
Definition env.c:1041
void ur_toText(UThread *, const UCell *cell, UBuffer *str)
Append textual representation of cell to a string.
Definition env.c:1118
UStatus ur_seriesSliceM(UThread *, USeriesIterM *si, const UCell *cell)
Set USeriesIterM to modifiable series slice.
Definition env.c:1356
UStatus ur_tokenizeB(UThread *, UIndex blkN, int inputEncoding, const uint8_t *start, const uint8_t *end)
Parse UTF-8 or Latin1 data into block.
Definition tokenize.c:654
UIndex end
End position.
Definition urlan.h:339
const UCell * it
Start position.
Definition urlan.h:387
UBuffer * ur_threadContext(UThread *)
Get thread global context.
Definition env.c:934
UThread * ur_makeEnv(const UEnvParameters *)
Allocate UEnv and initial UThread.
Definition env.c:332
@ UR_THROW
Returned to indicate an evaluation exception occured.
Definition urlan.h:117
@ UR_OK
Returned to indicate successful evaluation/operation.
Definition urlan.h:118
int ur_destroyThread(UThread *)
Free memory used by UThread.
Definition env.c:214
UBuffer * ur_generate(UThread *, int count, UIndex *index, const uint8_t *)
Generate and initialize buffers of given types.
Definition env.c:771
int ur_true(const UCell *cell)
Check if a value is "true".
Definition env.c:1029
const UBuffer * ur_blockIt(const UThread *ut, UBlockIt *bi, const UCell *blkCell)
Set UBlockIt to the start and end of a block slice.
Definition env.c:1388
int ur_equal(UThread *, const UCell *a, const UCell *b)
Definition env.c:1053
@ UR_THREAD_FREEZE
The thread dataStore is being moved to the shared environment.
Definition urlan.h:304
@ UR_THREAD_INIT
The new thread must be initialized.
Definition urlan.h:302
@ UR_THREAD_FREE
The thread is being freed.
Definition urlan.h:303
const UBuffer * buf
Buffer pointer.
Definition urlan.h:337
UAtom * ur_internAtoms(UThread *, const char *words, UAtom *atoms)
Add atoms to the shared environment.
Definition env.c:645
int ur_datatypeCount(UThread *)
Get number of datatypes installed in the environment.
Definition env.c:580
void ur_appendTrace(UThread *, UIndex blkN, UIndex it)
Append block position to the current exception error! trace.
Definition env.c:1012
void ur_destroyBuffer(UThread *, UBuffer *)
Destroy buffer in dataStore.
Definition env.c:825
int ur_compare(UThread *, const UCell *a, const UCell *b)
Definition env.c:1079
int ur_equalCase(UThread *, const UCell *a, const UCell *b)
Case-sensitive equality test.
Definition env.c:1066
int ur_compareCase(UThread *, const UCell *a, const UCell *b)
Case-sensitive ordering comparison.
Definition env.c:1093
UIndex ur_holdBuffer(UThread *, UIndex bufN)
Keeps buffer in thread dataStore from being garbage collected by ur_recycle().
Definition env.c:854
UBuffer * ur_genBuffers(UThread *, int count, UIndex *index)
Generate new buffers in dataStore.
Definition env.c:685
UCell * ur_pushCell(UThread *, const UCell *)
Copy cell to top of stack and increment stack.used.
Definition env.c:920
UCell * ur_wordCellM(UThread *, const UCell *cell)
Get modifiable word value.
Definition env.c:1178
UEnvParameters * ur_envParam(UEnvParameters *par)
Initialize UEnvParameters structure to default values.
Definition env.c:288
void ur_toStr(UThread *, const UCell *cell, UBuffer *str, int depth)
Append data representation of cell to a string.
Definition env.c:1107
UThread * ur_makeThread(const UThread *, uint32_t flags)
Create a new thread.
Definition env.c:160
Holds information for binding functions.
Definition urlan.h:402
const UBuffer * ctx
Context buffer to lookup words in.
Definition urlan.h:403
UIndex ctxN
Words in the block which are found in the UBindTarget::ctx will have their UCell.word....
Definition urlan.h:404
int bindType
Binding type to make.
Definition urlan.h:405
Iterator for const UCell array.
Definition urlan.h:386
The UBuffer struct holds information about a resource, usually a chunk of memory.
Definition urlan.h:266
uint8_t * b
bytes
Definition urlan.h:277
uint8_t form
This can indicate a specific form of the data (such as a string encoding).
Definition urlan.h:269
void * v
Other.
Definition urlan.h:285
int32_t * i32
int32_t
Definition urlan.h:281
char * c
chars
Definition urlan.h:276
UBuffer * buf
Array of buffers.
Definition urlan.h:274
int32_t * i
int32_t
Definition urlan.h:280
uint32_t * u32
uint32_t
Definition urlan.h:282
UIndex used
This typically holds the number of elements in the buffer.
Definition urlan.h:271
uint16_t * u16
uint16_t
Definition urlan.h:279
int16_t * i16
int16_t
Definition urlan.h:278
float * f
floats
Definition urlan.h:284
uint8_t type
UrlanDataType identifier.
Definition urlan.h:267
uint8_t flags
Indicates special features of the buffer (UR_STATIC, UR_STRING_ENC_UP).
Definition urlan.h:270
UCell * cell
Array of cells.
Definition urlan.h:275
double * d
doubles
Definition urlan.h:283
union UBuffer::@312146223224040072236377336057316010374162171270 ptr
This typically holds a pointer to a chunk of memory.
uint8_t elemSize
This typically holds the byte size of each element.
Definition urlan.h:268
UCell structure for coord type.
Definition urlan.h:191
uint8_t type
UrlanDataType.
Definition urlan.h:192
int16_t n[UR_COORD_MAX]
Holds six, 16-bit integers.
Definition urlan.h:195
uint16_t len
Number of integers used in array n.
Definition urlan.h:194
uint8_t flags
Bit field for type-specific properties.
Definition urlan.h:193
UCell structure for datatype! type.
Definition urlan.h:164
uint8_t n
The UrlanDataType.
Definition urlan.h:167
uint32_t mask0
Low 32 bits of type mask.
Definition urlan.h:169
uint32_t mask1
Middle 32 bits of type mask.
Definition urlan.h:170
UCell structure for error! type.
Definition urlan.h:236
UIndex messageStr
Index of message string! buffer.
Definition urlan.h:240
uint16_t exType
The UrlanErrorType.
Definition urlan.h:239
UIndex traceBlk
Index of block! buffer where error occurred.
Definition urlan.h:241
Basic type identification.
Definition urlan.h:155
uint8_t type
UrlanDataType.
Definition urlan.h:156
uint16_t ext
Extra datatype specific field.
Definition urlan.h:158
uint8_t flags
Bit field for type-specific properties.
Definition urlan.h:157
UCell structure for number types.
Definition urlan.h:177
UCellId id
Type and flags.
Definition urlan.h:178
double d
Double for double!, date!, and time! type.
Definition urlan.h:182
int64_t i64
Integer for char! and int! types.
Definition urlan.h:181
UCell structure for series types.
Definition urlan.h:226
UIndex end
Slice end index.
Definition urlan.h:230
UIndex buf
Buffer id.
Definition urlan.h:228
UIndex it
Iterator index.
Definition urlan.h:229
UCellId id
Type and flags.
Definition urlan.h:227
UCell structure for vec3! type.
Definition urlan.h:201
float xyz[3]
The three float values.
Definition urlan.h:203
UCellId id
The standard UCell header.
Definition urlan.h:202
UCell structure for word types.
Definition urlan.h:212
uint16_t index
Normally the word index into a context.
Definition urlan.h:218
uint8_t flags
Bit field for type-specific properties.
Definition urlan.h:214
uint8_t binding
Specifies what UrlanWordBindings the UCellWord::ctx refers to.
Definition urlan.h:215
uint8_t type
UrlanDataType.
Definition urlan.h:213
UAtom atom
The name of the word.
Definition urlan.h:219
UIndex ctx
Normally the buffer id of a context.
Definition urlan.h:217
The UDatatype struct holds methods for a specific class of data.
Definition urlan.h:439
void(* mark)(UThread *, UCell *cell)
Responsible for marking any buffers referenced by the cell as used.
Definition urlan.h:453
void(* toString)(UThread *, const UCell *cell, UBuffer *str, int depth)
Convert cell to its string data representation.
Definition urlan.h:449
void(* toText)(UThread *, const UCell *cell, UBuffer *str, int depth)
Convert cell to its string textual representation.
Definition urlan.h:450
int(* compare)(UThread *, const UCell *a, const UCell *b, int test)
Perform a comparison between cells.
Definition urlan.h:445
void(* recycle)(UThread *, int phase)
Performs thread global garbage collection duties for the datatype.
Definition urlan.h:452
int(* convert)(UThread *, const UCell *from, UCell *res)
Convert data to a new instance of the type.
Definition urlan.h:443
int(* make)(UThread *, const UCell *from, UCell *res)
Make a new instance of the type.
Definition urlan.h:442
void(* destroy)(UBuffer *buf)
Free any memory or other resources the buffer uses.
Definition urlan.h:454
int(* operate)(UThread *, const UCell *, const UCell *, UCell *res, int)
Perform an operation on two cells.
Definition urlan.h:446
void(* toShared)(UCell *cell)
Change any buffer ids in the cell so that they reference the shared environment (negate the id).
Definition urlan.h:456
const char * name
ASCII name of type, ending with '!'.
Definition urlan.h:440
void(* bind)(UThread *, UCell *cell, const UBindTarget *bt)
Bind cell to target.
Definition urlan.h:458
void(* markBuf)(UThread *, UBuffer *buf)
Responsible for marking other buffers referenced by this buffer as used.
Definition urlan.h:455
void(* copy)(UThread *, const UCell *from, UCell *res)
Make a clone of an existing value.
Definition urlan.h:444
The UEnvParameters struct allows the user to override default buffer and structure sizes.
Definition urlan.h:497
const UDatatype ** dtTable
Pointers to user defined datatypes.
Definition urlan.h:498
uint16_t dtCount
Number of entries in dtTable.
Definition urlan.h:501
uint32_t envSize
Byte size of environment structure.
Definition urlan.h:504
uint32_t user0
A user defined parameter.
Definition urlan.h:506
uint16_t atomLimit
Maximum number of atoms.
Definition urlan.h:502
uint32_t threadSize
Byte size of thread structure.
Definition urlan.h:505
uint32_t atomNamesSize
Fixed byte size of atom name buffer.
Definition urlan.h:503
void(* threadMethod)(UThread *, enum UThreadMethod)
Function to handle initialization and cleanup of user data attached to threads.
Definition urlan.h:500
Iterator for const series of any type.
Definition urlan.h:336
The USeriesType struct holds extra methods for series datatypes.
Definition urlan.h:469
void(* reverse)(const USeriesIterM *si)
Reverse series elements.
Definition urlan.h:479
int(* insert)(UThread *, UBuffer *buf, UIndex index, const UCell *val, UIndex part)
Insert a value into the series.
Definition urlan.h:474
int(* find)(UThread *, const USeriesIter *si, const UCell *val, int opt)
Search for a value in the series.
Definition urlan.h:480
void(* remove)(UThread *, USeriesIterM *si, UIndex part)
Remove part of the series.
Definition urlan.h:478
int(* change)(UThread *, USeriesIterM *si, const UCell *val, UIndex part)
Change part of the series.
Definition urlan.h:476
int(* append)(UThread *, UBuffer *buf, const UCell *val)
Append a value to the series.
Definition urlan.h:473
void(* poke)(UBuffer *buf, UIndex n, const UCell *val)
Replace a single value in the series.
Definition urlan.h:472
void(* pick)(const UBuffer *buf, UIndex n, UCell *res)
Get a single value from the series.
Definition urlan.h:471
The UThread struct stores the data specific to a thread of execution.
Definition urlan.h:309
UBuffer holds
An array of buffer ids which will not be garbage collected.
Definition urlan.h:312
UBuffer gcBits
Used by ur_recycle() to denote buffers which are in use.
Definition urlan.h:313
const UDatatype ** types
Pointer to the datatypes.
Definition urlan.h:322
UBuffer dataStore
An array of buffers.
Definition urlan.h:310
UIndex freeBufList
Buffer index of an unused buffer.
Definition urlan.h:319
int32_t freeBufCount
Number of unused buffers.
Definition urlan.h:318
UEnv * env
Pointer to the shared environment.
Definition urlan.h:321
A cell holds a single value of a simple type or a reference (often to a UBuffer) for a complex type.
Definition urlan.h:248
UCellWord word
For word!, lit-word!, set-word!, get-word! types.
Definition urlan.h:251
UCellError error
For error! type.
Definition urlan.h:258
UCellVec3 vec3
For vec3! type.
Definition urlan.h:254
UCellNumber number
For int!, double! types.
Definition urlan.h:252
UCellCoord coord
For coord! type.
Definition urlan.h:253
UCellSeries series
For binary!, bitset!, string!, file!, block!, paren!, path! types.
Definition urlan.h:255
UCellSeries context
For context! type.
Definition urlan.h:256
UCellId id
Basic type identification.
Definition urlan.h:249
UCellSeries port
For port! type.
Definition urlan.h:257
UCellDatatype datatype
For datatype! type.
Definition urlan.h:250
UrlanDataType
Definition urlan.h:38
UBuffer * ur_makeVectorCell(UThread *, enum UrlanVectorType, int size, UCell *)
Generate a single vector and set cell to reference it.
Definition vector.c:86
UStatus ur_serialize(UThread *, UIndex blkN, UCell *res)
Serialize block.
Definition serialize.c:527
void ur_arrAppendInt32(UBuffer *, int32_t)
Append int32_t to array.
Definition array.c:180
UStatus
Definition urlan.h:116
void ur_arrExpand(UBuffer *, int index, int count)
Create space in the array for count elements starting at index.
Definition array.c:161
int ur_charUppercase(int c)
Convert UCS2 character to uppercase.
Definition ucs2_case.c:313
void ur_makeDatatype(UCell *cell, int type)
Initialize cell to be a UT_DATATYPE value of the given type.
Definition datatypes.c:389
int ur_charLowercase(int c)
Convert UCS2 character to lowercase.
Definition ucs2_case.c:293
UrlanErrorType
Definition urlan.h:124
@ UR_ERR_SCRIPT
General script evaluation error.
Definition urlan.h:126
@ UR_ERR_INTERNAL
Fatal internal problem.
Definition urlan.h:129
@ UR_ERR_ACCESS
Problem accessing external resources.
Definition urlan.h:128
@ UR_ERR_TYPE
Invalid argument/parameter datatype.
Definition urlan.h:125
@ UR_ERR_SYNTAX
Syntax error.
Definition urlan.h:127
UStatus ur_unserialize(UThread *, const uint8_t *start, const uint8_t *end, UCell *res)
Unserialize binary.
Definition serialize.c:1002
UThreadMethod
Definition urlan.h:301
void ur_datatypeAddType(UCell *cell, int type)
Add type to multi-type UT_DATATYPE cell.
Definition datatypes.c:414
void ur_arrFree(UBuffer *)
Free array data.
Definition array.c:79
UIndex ur_makeVector(UThread *, enum UrlanVectorType, int size)
Generate a single vector buffer.
Definition vector.c:66
int ur_isDatatype(const UCell *cell, const UCell *datatype)
Test if cell is of a certain datatype.
Definition datatypes.c:376
UrlanRecyclePhase
Definition urlan.h:433
@ UR_RECYCLE_MARK
Phase passed to UDatatype::recycle.
Definition urlan.h:434
@ UR_RECYCLE_SWEEP
Phase passed to UDatatype::recycle.
Definition urlan.h:435
void ur_arrInit(UBuffer *, int size, int count)
Initialize array buffer.
Definition array.c:47
int ur_markBuffer(UThread *, UIndex bufN)
Makes sure the buffer is marked as used.
Definition gc.c:326
UrlanWordBindings
Definition urlan.h:86
@ UR_BIND_THREAD
Bound to buffer in thread dataStore.
Definition urlan.h:88
@ UR_BIND_USER
Start of user defined bindings.
Definition urlan.h:93
@ UR_BIND_SECURE
As UR_BIND_THREAD but unbind if not in context.
Definition urlan.h:92
@ UR_BIND_UNBOUND
ur_setId() zeros binding so this is default.
Definition urlan.h:87
@ UR_BIND_ENV
Bound to buffer in shared env dataStore.
Definition urlan.h:89
@ UR_BIND_SELF
Evaluate to bound context rather than value.
Definition urlan.h:91
@ UR_BIND_STACK
Bound to thread stack.
Definition urlan.h:90
int32_t UIndex
This is an index into an array.
Definition urlan.h:150
void ur_arrAppendFloat(UBuffer *, float)
Append float to array.
Definition array.c:193
void ur_arrErase(UBuffer *, int start, int count)
Remove elements from the array.
Definition array.c:137
void ur_arrReserve(UBuffer *, int count)
Allocates enough memory to hold count elements.
Definition array.c:98
void ur_recycle(UThread *)
Perform garbage collection on thread dataStore.
Definition gc.c:156