summary refs log tree commit diff
path: root/doc.h
blob: 5e9c18c287408642bcb4e768972d825adfbf2e6c (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
28
29
30
31
32
33
#ifndef DOC_H
#define DOC_H

#include "buf.h"

enum doc_type {
	TYPE_UNKNOWN,
	TYPE_GOPHERDOC,
	TYPE_GEMTEXT,
	TYPE_PLAIN,
};

#define DOC_LINK_NONE 0xffff

struct doc_line {
	unsigned short prev, link, len;
	char txt[];
};

struct doc {
	struct buf txt, lnk;
	size_t latest;
};

void doc_init(struct doc *);
void doc_fini(struct doc *);

void doc_new_line(struct doc *);
void doc_add_line(struct doc *, const char *);
void doc_add_text(struct doc *, const char *);
void doc_add_textn(struct doc *, const char *, size_t);

#endif