diff options
author | Hans Hagen <pragma@wxs.nl> | 2022-09-16 15:53:42 +0200 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2022-09-16 15:53:42 +0200 |
commit | c161b7d6fe142231346cc1844e6e27c0ab7718c1 (patch) | |
tree | 3fd877b8986137703e987e4651a2db8e946a0f72 /source/luametatex/source/libraries/pplib/ppheap.h | |
parent | e94fa4dc30ec28a6727aa85e17aaac18b76aeadb (diff) | |
download | context-c161b7d6fe142231346cc1844e6e27c0ab7718c1.tar.gz |
2022-09-16 14:41:00
Diffstat (limited to 'source/luametatex/source/libraries/pplib/ppheap.h')
-rw-r--r-- | source/luametatex/source/libraries/pplib/ppheap.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/source/luametatex/source/libraries/pplib/ppheap.h b/source/luametatex/source/libraries/pplib/ppheap.h new file mode 100644 index 000000000..85a59ee0a --- /dev/null +++ b/source/luametatex/source/libraries/pplib/ppheap.h @@ -0,0 +1,46 @@ + +#ifndef PP_HEAP_H +#define PP_HEAP_H + +#include "utilmem.h" + +#define pp_malloc util_malloc +//#define pp_callic util_calloc +//#define pp_realloc util_realloc +#define pp_free util_free + +#include "utilmemheapiof.h" +//#include "utilmeminfo.h" + +#define ppbytes_heap heap16 +#define ppbytes_heap_init(heap, space, large, flags) (heap16_init(&(heap)->bytesheap, space, large, flags), heap16_head(&(heap)->bytesheap)) +//#define ppbytes_heap_some(heap, size, pspace) _heap16_some(&(heap)->bytesheap, size, pspace) +#define ppbytes_heap_done(heap, data, written) heap16_done(&(heap)->bytesheap, data, written) +#define ppbytes_heap_clear(heap) heap16_clear(&(heap)->bytesheap) +#define ppbytes_heap_free(heap) heap16_free(&(heap)->bytesheap) +#define ppbytes_heap_info(heap, info, append) heap16_stats(&(heap)->bytesheap, info, append) + +#define ppbytes_take(heap, size) _heap16_take(&(heap)->bytesheap, size) +#define ppbytes_buffer_init(heap) heap16_buffer_init(&(heap)->bytesheap, &(heap)->bytesbuffer) +#define ppbytes_buffer(heap, atleast) _heap16_buffer_some(&(heap)->bytesheap, &(heap)->bytesbuffer, atleast) + +#define ppstruct_heap heap64 +#define ppstruct_heap_init(heap, space, large, flags) (heap64_init(&(heap)->structheap, space, large, flags), heap64_head(&(heap)->structheap)) +#define ppstruct_heap_clear(heap) heap64_clear(&(heap)->structheap) +#define ppstruct_heap_free(heap) heap64_free(&(heap)->structheap) +#define ppstruct_heap_info(heap, info, append) heap64_stats(&(heap)->structheap, info, append) +#define ppstruct_take(heap, size) _heap64_take(&(heap)->structheap, size) + +typedef struct { + ppbytes_heap bytesheap; + ppstruct_heap structheap; + iof bytesbuffer; +} ppheap; + +ppbyte * ppbytes_flush (ppheap *heap, iof *O, size_t *psize); + +void ppheap_init (ppheap *heap); +void ppheap_free (ppheap *heap); +void ppheap_renew (ppheap *heap); + +#endif
\ No newline at end of file |