Defines | |
#define | ur_blkFree ur_arrFree |
A block is a simple array. | |
Functions | |
UIndex | ur_makeBlock (UThread *ut, int size) |
Generate a single block of type UT_BLOCK. | |
UBuffer * | ur_makeBlockCell (UThread *ut, int type, int size, UCell *cell) |
Generate a single block and set cell to reference it. | |
void | ur_blkInit (UBuffer *buf, int type, int size) |
Initialize block buffer. | |
UCell * | ur_blkAppendNew (UBuffer *buf, int type) |
Add cell to end of block. | |
void | ur_blkAppendCells (UBuffer *buf, const UCell *cells, int count) |
Append cells to block. | |
void | ur_blkInsert (UBuffer *buf, UIndex it, const UCell *cells, int count) |
Insert cells into block. | |
void | ur_blkPush (UBuffer *buf, const UCell *cell) |
Copy cell to end of block. | |
UCell * | ur_blkPop (UBuffer *buf) |
Remove cell from end of block. | |
void | ur_blkSlice (UThread *ut, UBlockIter *bi, const UCell *cell) |
Set UBlockIter to block slice. | |
int | ur_blkSliceM (UThread *ut, UBlockIterM *bi, const UCell *cell) |
Set UBlockIterM to block slice. | |
UIndex | ur_blkClone (UThread *ut, UIndex blkN) |
Make deep copy of block. |
Append cells to block.
buf | Initialized block buffer. | |
cells | Cells to copy. | |
count | Number of cells to copy. |
Add cell to end of block.
UIndex ur_blkClone | ( | UThread * | ut, | |
UIndex | blkN | |||
) |
Make deep copy of block.
blkN | Buffer id of block to clone. |
void ur_blkInit | ( | UBuffer * | buf, | |
int | type, | |||
int | size | |||
) |
Initialize block buffer.
type | Buffer type (Normally UT_BLOCK). | |
size | Number of cells to reserve. |
Insert cells into block.
This performs a memcpy, so the source cells must not overlap the buf cells.
buf | Initialized block buffer. | |
it | Position in buf. | |
cells | Cells to copy. | |
count | Number of cells to copy. |
Remove cell from end of block.
Set UBlockIter to block slice.
bi | Iterator struct to fill. | |
cell | Pointer to a valid block cell. |
Set UBlockIterM to block slice.
If cell references a block in shared storage then an error is generated and UR_THROW is returned. Otherwise, bi is initialized. If the slice is empty then bi->it and bi->end are set to zero.
bi | Iterator struct to fill. | |
cell | Pointer to a valid block cell. |
UIndex ur_makeBlock | ( | UThread * | ut, | |
int | size | |||
) |
Generate a single block of type UT_BLOCK.
If you need multiple buffers then ur_genBuffers() should be used.
The caller must create a UCell for this block in a held block before the next ur_recycle() or else it will be garbage collected.
size | Number of cells to reserve. |
Generate a single block and set cell to reference it.
If you need multiple buffers then ur_genBuffers() should be used.
type | Type (UT_BLOCK, UT_PAREN, etc.). | |
size | Number of cells to reserve. | |
cell | Cell to initialize. |