Functions | |
| UIndex | ur_makeBinary (UThread *ut, int size) |
| Generate and initialize a single binary buffer. | |
| UBuffer * | ur_makeBinaryCell (UThread *ut, int size, UCell *cell) |
| Generate a single binary and set cell to reference it. | |
| void | ur_binInit (UBuffer *buf, int size) |
| Initialize buffer to type UT_BINARY. | |
| void | ur_binFree (UBuffer *buf) |
| Free binary data. | |
| void | ur_binReserve (UBuffer *buf, int size) |
| Allocates enough memory to hold size bytes. | |
| void | ur_binErase (UBuffer *buf, int start, int count) |
| Remove bytes from the binary. | |
| void | ur_binExpand (UBuffer *buf, int index, int count) |
| Create space in the binary for count bytes starting at index. | |
| void | ur_binAppendData (UBuffer *buf, const uint8_t *data, int len) |
| Append data to binary buffer. | |
| void | ur_binAppendArray (UBuffer *buf, const USeriesIter *si) |
| Append array slice to binary buffer. | |
| const char * | ur_binAppendBase (UBuffer *buf, const char *it, const char *end, enum UrlanBinaryEncoding enc) |
| Append encoded ASCII string to binary buffer. | |
| void | ur_binSlice (UThread *ut, UBinaryIter *bi, const UCell *cell) |
| Set UBinaryIter to binary slice. | |
| int | ur_binSliceM (UThread *ut, UBinaryIterM *bi, const UCell *cell) |
| Set UBinaryIterM to binary slice. | |
| void | ur_binToStr (UBuffer *buf, int encoding) |
| Convert binary buffer to string buffer. | |
| void ur_binAppendArray | ( | UBuffer * | buf, | |
| const USeriesIter * | si | |||
| ) |
Append array slice to binary buffer.
| buf | Initialized binary buffer. | |
| si | Data to append. si.buf->elemSize must be valid. |
| const char* ur_binAppendBase | ( | UBuffer * | buf, | |
| const char * | it, | |||
| const char * | end, | |||
| enum UrlanBinaryEncoding | enc | |||
| ) |
Append encoded ASCII string to binary buffer.
| buf | Initialized binary buffer. | |
| it | Start of string | |
| end | End of string | |
| enc | Encoding of string. |
| void ur_binAppendData | ( | UBuffer * | buf, | |
| const uint8_t * | data, | |||
| int | len | |||
| ) |
Append data to binary buffer.
| buf | Initialized binary buffer. | |
| data | Data to append. | |
| len | Number of bytes from data to append. |
| void ur_binErase | ( | UBuffer * | buf, | |
| int | start, | |||
| int | count | |||
| ) |
Remove bytes from the binary.
| buf | Initialized binary buffer. | |
| start | Start index of erase. | |
| count | Number of bytes to remove. |
| void ur_binExpand | ( | UBuffer * | buf, | |
| int | index, | |||
| int | count | |||
| ) |
Create space in the binary for count bytes starting at index.
The memory in the new space is uninitialized.
| buf | Initialized binary buffer. | |
| index | Position to expand at. | |
| count | Number of bytes to expand. |
| void ur_binFree | ( | UBuffer * | buf | ) |
Free binary data.
buf->ptr and buf->used are set to zero.
| void ur_binInit | ( | UBuffer * | buf, | |
| int | size | |||
| ) |
Initialize buffer to type UT_BINARY.
| size | Number of bytes to reserve. |
| void ur_binReserve | ( | UBuffer * | buf, | |
| int | size | |||
| ) |
Allocates enough memory to hold size bytes.
buf->used is not changed.
| buf | Initialized binary buffer. | |
| size | Total number of bytes. |
Set UBinaryIter to binary slice.
| bi | Iterator struct to fill. | |
| cell | Pointer to a valid binary cell. |
Set UBinaryIterM to binary slice.
If cell references a binary 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 binary cell. |
| void ur_binToStr | ( | UBuffer * | buf, | |
| int | encoding | |||
| ) |
Convert binary buffer to string buffer.
The data that buf->ptr points to is not touched.
| buf | Initialized binary buffer. | |
| encoding | Encoding |
| UIndex ur_makeBinary | ( | UThread * | ut, | |
| int | size | |||
| ) |
Generate and initialize a single binary buffer.
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 bytes to reserve. |
Generate a single binary and set cell to reference it.
If you need multiple buffers then ur_genBuffers() should be used.
| size | Number of bytes to reserve. | |
| cell | Cell to initialize. |