#ifndef DOC_H #define DOC_H #include "buf.h" #define DOC_LINK_NONE 0xffff struct doc_line { unsigned short prev, link, len; char txt[]; }; enum doc_type { DOC_UNKNOWN, DOC_GOPHERDOC, DOC_GEMTEXT, DOC_PLAIN, }; struct doc { buf_t 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); struct doc_line *doc_line_at(struct doc *d, size_t ofs); int doc_line_prev(struct doc *d, size_t *ofs); int doc_line_next(struct doc *d, size_t *ofs); #endif