summaryrefslogtreecommitdiff
path: root/Build/source/libs/pplib/pplib-src/src/ppheap.c
diff options
context:
space:
mode:
authorLuigi Scarso <luigi.scarso@gmail.com>2020-04-21 18:43:36 +0000
committerLuigi Scarso <luigi.scarso@gmail.com>2020-04-21 18:43:36 +0000
commit7c0b908f1a6e1489834fbdb0789766eed8a37b49 (patch)
treecb55d631b861bfcf95fe853713af6f760227ba0f /Build/source/libs/pplib/pplib-src/src/ppheap.c
parente783b071ded7eef421d0333416b47142bc5542cb (diff)
pplib under libs -- WORK IN PROGRSS grep '?' out
git-svn-id: svn://tug.org/texlive/trunk@54824 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/pplib/pplib-src/src/ppheap.c')
-rw-r--r--Build/source/libs/pplib/pplib-src/src/ppheap.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/Build/source/libs/pplib/pplib-src/src/ppheap.c b/Build/source/libs/pplib/pplib-src/src/ppheap.c
new file mode 100644
index 00000000000..f2fbc2b7e4f
--- /dev/null
+++ b/Build/source/libs/pplib/pplib-src/src/ppheap.c
@@ -0,0 +1,40 @@
+
+#include "pplib.h"
+
+#define PPBYTES_HEAP_BLOCK 0xFFF
+#define PPBYTES_HEAP_LARGE (PPBYTES_HEAP_BLOCK >> 2)
+#define PPSTRUCT_HEAP_BLOCK 0xFFF
+#define PPSTRUCT_HEAP_LARGE (PPSTRUCT_HEAP_BLOCK >> 2)
+
+void ppheap_init (ppheap *heap)
+{
+ ppstruct_heap_init(heap, PPSTRUCT_HEAP_BLOCK, PPSTRUCT_HEAP_LARGE, 0);
+ ppbytes_heap_init(heap, PPBYTES_HEAP_BLOCK, PPBYTES_HEAP_LARGE, 0);
+}
+
+void ppheap_free (ppheap *heap)
+{
+ ppstruct_heap_free(heap);
+ ppbytes_heap_free(heap);
+}
+
+void ppheap_renew (ppheap *heap)
+{
+ ppstruct_heap_clear(heap);
+ ppbytes_heap_clear(heap);
+ ppbytes_buffer_init(heap);
+}
+
+ppbyte * ppbytes_flush (ppheap *heap, iof *O, size_t *psize)
+{
+ ppbyte *data;
+ size_t size;
+
+ //ASSERT(&heap->bytesheap == O->link);
+ iof_put(O, '\0');
+ data = (ppbyte *)O->buf;
+ size = (size_t)iof_size(O);
+ ppbytes_heap_done(heap, data, size);
+ *psize = size - 1;
+ return data;
+} \ No newline at end of file