factor/vm/byte_arrays.hpp

24 lines
440 B
C++
Raw Normal View History

2009-05-04 02:46:13 -04:00
namespace factor
{
2009-05-04 05:50:24 -04:00
byte_array *allot_byte_array(cell size);
2009-05-02 05:04:19 -04:00
PRIMITIVE(byte_array);
PRIMITIVE(uninitialized_byte_array);
PRIMITIVE(resize_byte_array);
2009-05-02 05:04:19 -04:00
/* Macros to simulate a byte vector in C */
2009-05-02 10:19:09 -04:00
struct growable_byte_array {
2009-05-04 05:50:24 -04:00
cell count;
gc_root<byte_array> elements;
2009-05-02 05:04:19 -04:00
2009-05-04 05:50:24 -04:00
growable_byte_array() : count(0), elements(allot_byte_array(2)) { }
2009-05-02 05:04:19 -04:00
2009-05-04 05:50:24 -04:00
void append_bytes(void *elts, cell len);
void append_byte_array(cell elts);
2009-05-02 05:04:19 -04:00
2009-05-02 10:19:09 -04:00
void trim();
};
2009-05-04 02:46:13 -04:00
}