summaryrefslogtreecommitdiff
path: root/sys/src/cmd/wikifs/wiki.h
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 15:46:40 +0300
commite5888a1ffdae813d7575f5fb02275c6bb07e5199 (patch)
treed8d51eac403f07814b9e936eed0c9a79195e2450 /sys/src/cmd/wikifs/wiki.h
Import sources from 2011-03-30 iso image
Diffstat (limited to 'sys/src/cmd/wikifs/wiki.h')
-rwxr-xr-xsys/src/cmd/wikifs/wiki.h121
1 files changed, 121 insertions, 0 deletions
diff --git a/sys/src/cmd/wikifs/wiki.h b/sys/src/cmd/wikifs/wiki.h
new file mode 100755
index 000000000..88cb53388
--- /dev/null
+++ b/sys/src/cmd/wikifs/wiki.h
@@ -0,0 +1,121 @@
+typedef struct Map Map;
+typedef struct Mapel Mapel;
+typedef struct Sub Sub;
+typedef struct Wdoc Wdoc;
+typedef struct Whist Whist;
+typedef struct Wpage Wpage;
+
+enum {
+ Tcache = 5, /* seconds */
+ Maxmap = 10*1024*1024,
+ Maxfile = 100*1024,
+};
+enum {
+ Wpara,
+ Wheading,
+ Wbullet,
+ Wlink,
+ Wman,
+ Wplain,
+ Wpre,
+ Whr,
+ Nwtxt,
+};
+
+struct Wpage {
+ int type;
+ char *text;
+ int section; /* Wman */
+ char *url; /* Wlink */
+ Wpage *next;
+};
+
+struct Whist {
+ Ref;
+ int n;
+ char *title;
+ Wdoc *doc;
+ int ndoc;
+ int current;
+};
+
+struct Wdoc {
+ char *author;
+ char *comment;
+ int conflict;
+ ulong time;
+ Wpage *wtxt;
+};
+
+enum {
+ Tpage,
+ Tedit,
+ Tdiff,
+ Thistory,
+ Tnew,
+ Toldpage,
+ Twerror,
+ Ntemplate,
+};
+
+struct Sub {
+ char *match;
+ char *sub;
+};
+
+struct Mapel {
+ char *s;
+ int n;
+};
+
+struct Map {
+ Ref;
+ Mapel *el;
+ int nel;
+ ulong t;
+ char *buf;
+ Qid qid;
+};
+
+void *erealloc(void*, ulong);
+void *emalloc(ulong);
+char *estrdup(char*);
+char *estrdupn(char*, int);
+char *strcondense(char*, int);
+char *strlower(char*);
+
+String *s_appendsub(String*, char*, int, Sub*, int);
+String *s_appendlist(String*, ...);
+Whist *Brdwhist(Biobuf*);
+Wpage *Brdpage(char*(*)(void*,int), void*);
+
+void printpage(Wpage*);
+String *pagehtml(String*, Wpage*, int);
+String *pagetext(String*, Wpage*, int);
+String *tohtml(Whist*, Wdoc*, int);
+String *totext(Whist*, Wdoc*, int);
+String *doctext(String*, Wdoc*);
+
+Whist *getcurrent(int);
+Whist *getcurrentbyname(char*);
+Whist *gethistory(int);
+void closewhist(Whist*);
+int allocnum(char*, int);
+void freepage(Wpage*);
+int nametonum(char*);
+char *numtoname(int);
+int writepage(int, ulong, String*, char*);
+void voidcache(int);
+
+void closemap(Map*);
+void currentmap(int);
+
+extern Map *map;
+extern RWLock maplock;
+extern char *wikidir;
+Biobuf *wBopen(char*, int);
+int wopen(char*, int);
+int wcreate(char*, int, long);
+int waccess(char*, int);
+Dir *wdirstat(char*);
+int opentemp(char*);