packer_defs.h (561B)
1 #pragma once 2 3 #include <stddef.h> 4 #include <stdint.h> 5 6 // Max possible length: bytecode + 8 int/float bytes 7 // Ext objects are maximum 8=3+5 (nested uint32 payload) 8 #define MPACK_ITEM_SIZE 9 9 10 typedef struct packer_buffer_t PackerBuffer; 11 12 // Must ensure at least MPACK_ITEM_SIZE of space. 13 typedef void (*PackerBufferFlush)(PackerBuffer *self); 14 15 struct packer_buffer_t { 16 char *startptr; 17 char *ptr; 18 char *endptr; 19 20 // these are free to be used by packer_flush for any purpose, if want 21 void *anydata; 22 int64_t anyint; 23 PackerBufferFlush packer_flush; 24 };