#ifndef DOC_H #define DOC_H #include "str.h" #define DOC_LINK_NONE 0xffff struct doc_line { unsigned short prev, link, len; char txt[]; }; enum doc_type { DOC_UNKNOWN, DOC_GOPHERMAP, DOC_GEMTEXT, DOC_PLAIN, }; struct doc { str_t txt, lnk; size_t latest; unsigned short linkc; }; void doc_init(struct doc *); void doc_fini(struct doc *); void doc_new_line(struct doc *); void doc_add_line(struct doc *, strv_t); void doc_add_text(struct doc *, strv_t); struct doc_line *doc_line_at(struct doc *d, size_t ofs); int doc_line_prevp(struct doc *d, size_t ofs); int doc_line_nextp(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); const char *doc_get_link(struct doc *d, unsigned short lnk); void doc_set_link(struct doc *d, unsigned short lnk); unsigned short doc_add_link(struct doc *d, strv_t url); #endif