1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
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*);
|