blob: e367825d26573bcc93ef622bcaa1c9521bb5cb6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include <stdio.h>
#include <stdint.h>
#include <stddef.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#define ARENA_IMPL
#include "wrmr.h"
#include "arena.h"
#include "txt.h"
int main(void) {
Arena a = arena_init(1L << 20);
Txt txt = { 0 };
txt_open(&txt, "test.txt");
txt_insert(&txt, txt.len, "wheeee", 6);
txt_delete(&txt, txt.len, 6);
for (u32 i = 0; i < txt.ptbl.n; i++) {
TxtPiece *p = &txt.ptbl.v[i];
printf("%u. %.*s\n", i, (int)p->n, txt.buf[p->buf].s + p->ofs);
}
arena_free(&a);
return 0;
}
|