aboutsummaryrefslogtreecommitdiffstats
path: root/textlist.h
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:05:14 +0000
committerTatsuya Kinoshita <tats@vega.ocn.ne.jp>2011-05-04 07:05:14 +0000
commit72f72d64a422d6628c4796f5c0bf2e508f134214 (patch)
tree0c9ea90cc53310832c977265521fb44db24a515e /textlist.h
parentAdding upstream version 0.3 (diff)
downloadw3m-upstream/0.5.1.tar.gz
w3m-upstream/0.5.1.zip
Adding upstream version 0.5.1upstream/0.5.1
Diffstat (limited to 'textlist.h')
-rw-r--r--textlist.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/textlist.h b/textlist.h
new file mode 100644
index 0000000..f28b199
--- /dev/null
+++ b/textlist.h
@@ -0,0 +1,76 @@
+/* $Id: textlist.h,v 1.6 2003/01/20 15:30:22 ukai Exp $ */
+#ifndef TEXTLIST_H
+#define TEXTLIST_H
+#include "Str.h"
+
+/* General doubly linked list */
+
+typedef struct _listitem {
+ void *ptr;
+ struct _listitem *next;
+ struct _listitem *prev;
+} ListItem;
+
+typedef struct _generallist {
+ ListItem *first;
+ ListItem *last;
+ short nitem;
+} GeneralList;
+
+extern ListItem *newListItem(void *s, ListItem *n, ListItem *p);
+extern GeneralList *newGeneralList(void);
+extern void pushValue(GeneralList *tl, void *s);
+extern void *popValue(GeneralList *tl);
+extern void *rpopValue(GeneralList *tl);
+extern void delValue(GeneralList *tl, ListItem *it);
+extern GeneralList *appendGeneralList(GeneralList *, GeneralList *);
+
+/* Text list */
+
+typedef struct _textlistitem {
+ char *ptr;
+ struct _textlistitem *next;
+ struct _textlistitem *prev;
+} TextListItem;
+
+typedef struct _textlist {
+ TextListItem *first;
+ TextListItem *last;
+ short nitem;
+} TextList;
+
+#define newTextList() ((TextList *)newGeneralList())
+#define pushText(tl, s) pushValue((GeneralList *)(tl), (void *)allocStr((s),-1))
+#define popText(tl) ((char *)popValue((GeneralList *)(tl)))
+#define rpopText(tl) ((char *)rpopValue((GeneralList *)(tl)))
+#define delText(tl, i) delValue((GeneralList *)(tl), (void *)(i))
+#define appendTextList(tl, tl2) ((TextList *)appendGeneralList((GeneralList *)(tl), (GeneralList *)(tl2)))
+
+/* Line text list */
+
+typedef struct _TextLine {
+ Str line;
+ short pos;
+} TextLine;
+
+typedef struct _textlinelistitem {
+ TextLine *ptr;
+ struct _textlinelistitem *next;
+ struct _textlinelistitem *prev;
+} TextLineListItem;
+
+typedef struct _textlinelist {
+ TextLineListItem *first;
+ TextLineListItem *last;
+ short nitem;
+} TextLineList;
+
+extern TextLine *newTextLine(Str line, int pos);
+extern void appendTextLine(TextLineList *tl, Str line, int pos);
+#define newTextLineList() ((TextLineList *)newGeneralList())
+#define pushTextLine(tl,lbuf) pushValue((GeneralList *)(tl),(void *)(lbuf))
+#define popTextLine(tl) ((TextLine *)popValue((GeneralList *)(tl)))
+#define rpopTextLine(tl) ((TextLine *)rpopValue((GeneralList *)(tl)))
+#define appendTextLineList(tl, tl2) ((TextLineList *)appendGeneralList((GeneralList *)(tl), (GeneralList *)(tl2)))
+
+#endif /* not TEXTLIST_H */