Home | History | Annotate | Download | only in compiler

Lines Matching defs:blob

36 /* The blob functions implement a simple, low-level API for serializing and
39 * All objects written to a blob will be serialized directly, (without any
42 * by knowing exactly what data is expected, or by writing to the blob
45 * A blob is efficient in that it dynamically grows by doubling in size, so
49 struct blob {
50 /* The data actually written to the blob. */
67 * allocation blob.
75 * 1. blob->current should be equal to blob->end, (if not, too little was
78 * 2. blob->overrun should be false, (otherwise, too much was read).
88 * Init a new, empty blob.
91 blob_init(struct blob *blob);
94 * Init a new, fixed-size blob.
96 * A fixed-size blob has a fixed block of data that will not be freed on
100 * If a fixed-size blob has a NULL data pointer then the data is written but
105 blob_init_fixed(struct blob *blob, void *data, size_t size);
108 * Finish a blob and free its memory.
110 * If \blob was initialized with blob_init_fixed, the data pointer is
114 blob_finish(struct blob *blob)
116 if (!blob->fixed_allocation)
117 free(blob->data);
121 * Add some unstructured, fixed-size data to a blob.
126 blob_write_bytes(struct blob *blob, const void *bytes, size_t to_write);
129 * Reserve space in \blob for a number of bytes.
131 * Space will be allocated within the blob for these byes, but the bytes will
135 * \return An offset to space allocated within \blob to which \to_write bytes
139 blob_reserve_bytes(struct blob *blob, size_t to_write);
147 blob_reserve_uint32(struct blob *blob);
155 blob_reserve_intptr(struct blob *blob);
158 * Overwrite some data previously written to the blob.
160 * Writes data to an existing portion of the blob at an offset of \offset.
161 * This data range must have previously been written to the blob by one of the
167 * the current blob's size.
170 blob_overwrite_bytes(struct blob *blob,
176 * Add a uint32_t to a blob.
179 * beginning of the blob's data, so some padding bytes may be added to the
180 * blob if this write follows some unaligned write (such as
186 blob_write_uint32(struct blob *blob, uint32_t value);
189 * Overwrite a uint32_t previously written to the blob.
191 * Writes a uint32_t value to an existing portion of the blob at an offset of
192 * \offset. This data range must have previously been written to the blob by
200 * offset = blob_reserve_uint32(blob);
201 * ... various blob write calls, writing N items ...
202 * blob_overwrite_uint32 (blob, offset, N);
205 * the current blob's size.
208 blob_overwrite_uint32(struct blob *blob,
213 * Add a uint64_t to a blob.
216 * beginning of the blob's data, so some padding bytes may be added to the
217 * blob if this write follows some unaligned write (such as
223 blob_write_uint64(struct blob *blob, uint64_t value);
226 * Add an intptr_t to a blob.
229 * beginning of the blob's data, so some padding bytes may be added to the
230 * blob if this write follows some unaligned write (such as
236 blob_write_intptr(struct blob *blob, intptr_t value);
239 * Overwrite an intptr_t previously written to the blob.
241 * Writes a intptr_t value to an existing portion of the blob at an offset of
242 * \offset. This data range must have previously been written to the blob by
248 * the current blob's size.
251 blob_overwrite_intptr(struct blob *blob,
256 * Add a NULL-terminated string to a blob, (including the NULL terminator).
261 blob_write_string(struct blob *blob, const char *str);
264 * Start reading a blob, (initializing the contents of \blob for reading).
275 blob_reader_init(struct blob_reader *blob, const void *data, size_t size);
281 * \note The memory returned belongs to the data underlying the blob reader. The
283 * underlying the blob reader.
288 blob_read_bytes(struct blob_reader *blob, size_t size);
295 blob_copy_bytes(struct blob_reader *blob, void *dest, size_t size);
302 * beginning of the blob's data, so some padding bytes may be skipped.
307 blob_read_uint32(struct blob_reader *blob);
314 * beginning of the blob's data, so some padding bytes may be skipped.
319 blob_read_uint64(struct blob_reader *blob);
326 * beginning of the blob's data, so some padding bytes may be skipped.
331 blob_read_intptr(struct blob_reader *blob);
337 * \note The memory returned belongs to the data underlying the blob reader. The
339 * of the data underlying the blob reader.
342 * there is no NULL byte remaining within the blob, this function returns
346 blob_read_string(struct blob_reader *blob);