summary refs log tree commit diff
path: root/doc.h
diff options
context:
space:
mode:
authorwrmr2024-11-02 19:33:08 -0500
committerwrmr2024-11-02 19:33:08 -0500
commit610808a5902adad751a4acdbcc310803a51fed5d (patch)
tree76599dc60cccf6a3765f484dfa1b19e1af88efa1 /doc.h
parent58214ec5f982c1b97aadce254c958a5f922c9724 (diff)
very different document data structure
Diffstat (limited to 'doc.h')
-rw-r--r--doc.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/doc.h b/doc.h
index 3c5dfcc..5e9c18c 100644
--- a/doc.h
+++ b/doc.h
@@ -1,6 +1,8 @@
 #ifndef DOC_H
 #define DOC_H
 
+#include "buf.h"
+
 enum doc_type {
 	TYPE_UNKNOWN,
 	TYPE_GOPHERDOC,
@@ -8,17 +10,24 @@ enum doc_type {
 	TYPE_PLAIN,
 };
 
-void doc_new(void);
-void doc_prev(void);
-void doc_next(void);
+#define DOC_LINK_NONE 0xffff
+
+struct doc_line {
+	unsigned short prev, link, len;
+	char txt[];
+};
 
-void doc_add(const char *, size_t);
-void doc_adds(const char *);
+struct doc {
+	struct buf txt, lnk;
+	size_t latest;
+};
 
-void doc_back_line(void);
-void doc_print_line(void);
+void doc_init(struct doc *);
+void doc_fini(struct doc *);
 
-void doc_init(void);
-void doc_fini(void);
+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