30 Infinity = 0x7FFFFFFF, /* huge value for regexp address */
33 typedef struct Block Block;
34 typedef struct Buffer Buffer;
35 typedef struct Command Command;
36 typedef struct Column Column;
37 typedef struct Dirlist Dirlist;
38 typedef struct Dirtab Dirtab;
39 typedef struct Disk Disk;
40 typedef struct Expand Expand;
41 typedef struct Fid Fid;
42 typedef struct File File;
43 typedef struct Elog Elog;
44 typedef struct Mntdir Mntdir;
45 typedef struct Range Range;
46 typedef struct Rangeset Rangeset;
47 typedef struct Reffont Reffont;
48 typedef struct Row Row;
49 typedef struct Runestr Runestr;
50 typedef struct Text Text;
51 typedef struct Timer Timer;
52 typedef struct Window Window;
53 typedef struct Xfid Xfid;
69 uint addr; /* disk address in bytes */
72 uint n; /* number of used runes in block */
73 Block *next; /* pointer to next in free list */
80 uint addr; /* length of temp file */
81 Block *free[Maxblock/Blockincr+1];
85 Block* disknewblock(Disk*, uint);
86 void diskrelease(Disk*, Block*);
87 void diskread(Disk*, Block*, Rune*, uint);
88 void diskwrite(Disk*, Block**, Rune*, uint);
94 uint cnc; /* bytes in cache */
95 uint cmax; /* size of allocated cache */
96 uint cq; /* position of cache */
97 int cdirty; /* cache needs to be written */
98 uint cbi; /* index of cache Block */
99 Block **bl; /* array of blocks */
100 uint nbl; /* number of blocks */
102 void bufinsert(Buffer*, uint, Rune*, uint);
103 void bufdelete(Buffer*, uint, uint);
104 uint bufload(Buffer*, uint, int, int*);
105 void bufread(Buffer*, uint, Rune*, uint);
106 void bufclose(Buffer*);
107 void bufreset(Buffer*);
111 short type; /* Delete, Insert, Filename */
112 uint q0; /* location of change (unused in f) */
113 uint nd; /* number of deleted characters */
114 uint nr; /* # runes in string or file name */
117 void elogterm(File*);
118 void elogclose(File*);
119 void eloginsert(File*, int, Rune*, int);
120 void elogdelete(File*, int, int);
121 void elogreplace(File*, int, int, Rune*, int);
122 void elogapply(File*);
126 Buffer b; /* the data */
127 Buffer delta; /* transcript of changes */
128 Buffer epsilon; /* inversion of delta for redo */
129 Buffer *elogbuf; /* log of pending editor changes */
130 Elog elog; /* current pending change */
131 Rune *name; /* name of associated file */
132 int nname; /* size of name */
133 uvlong qidpath; /* of file when read */
134 uint mtime; /* of file when read */
135 int dev; /* of file when read */
136 int unread; /* file has not been read from disk */
137 int editclean; /* mark clean after edit command */
139 int seq; /* if seq==0, File acts like Buffer */
141 Text *curtext; /* most recently used associated text */
142 Text **text; /* list of associated texts */
144 int dumpid; /* used in dumping zeroxed windows */
146 File* fileaddtext(File*, Text*);
147 void fileclose(File*);
148 void filedelete(File*, uint, uint);
149 void filedeltext(File*, Text*);
150 void fileinsert(File*, uint, Rune*, uint);
151 uint fileload(File*, uint, int, int*);
152 void filemark(File*);
153 void filereset(File*);
154 void filesetname(File*, Rune*, int);
155 void fileundelete(File*, Buffer*, uint, uint);
156 void fileuninsert(File*, Buffer*, uint, uint);
157 void fileunsetname(File*, Buffer*);
158 void fileundo(File*, int, uint*, uint*);
159 uint fileredoseq(File*);
186 uint eq0; /* start of typing for ESC */
187 uint cq0; /* cache position */
188 int ncache; /* storage for insert */
194 uint textbacknl(Text*, uint, uint);
195 uint textbsinsert(Text*, uint, Rune*, uint, int, int*);
196 int textbswidth(Text*, Rune);
197 int textclickmatch(Text*, int, int, int, uint*);
198 void textclose(Text*);
199 void textcolumnate(Text*, Dirlist**, int);
200 void textcommit(Text*, int);
201 void textconstrain(Text*, uint, uint, uint*, uint*);
202 void textdelete(Text*, uint, uint, int);
203 void textdoubleclick(Text*, uint*, uint*);
204 void textfill(Text*);
205 void textframescroll(Text*, int);
206 void textinit(Text*, File*, Rectangle, Reffont*, Image**);
207 void textinsert(Text*, uint, Rune*, uint, int);
208 uint textload(Text*, uint, char*, int);
209 Rune textreadc(Text*, uint);
210 void textredraw(Text*, Rectangle, Font*, Image*, int);
211 void textreset(Text*);
212 int textresize(Text*, Rectangle);
213 void textscrdraw(Text*);
214 void textscroll(Text*, int);
215 void textselect(Text*);
216 int textselect2(Text*, uint*, uint*, Text**);
217 int textselect23(Text*, uint*, uint*, Image*, int);
218 int textselect3(Text*, uint*, uint*);
219 void textsetorigin(Text*, uint, int);
220 void textsetselect(Text*, uint, uint);
221 void textshow(Text*, uint, uint, int);
222 void texttype(Text*, Rune);
267 void wininit(Window*, Window*, Rectangle);
268 void winlock(Window*, int);
269 void winlock1(Window*, int);
270 void winunlock(Window*);
271 void wintype(Window*, Text*, Rune);
272 void winundo(Window*, int);
273 void winsetname(Window*, Rune*, int);
274 void winsettag(Window*);
275 void winsettag1(Window*);
276 void wincommit(Window*, Text*);
277 int winresize(Window*, Rectangle, int);
278 void winclose(Window*);
279 void windelete(Window*);
280 int winclean(Window*, int);
281 void windirfree(Window*);
282 void winevent(Window*, char*, ...);
283 void winmousebut(Window*);
284 void winaddincl(Window*, Rune*, int);
285 void wincleartag(Window*);
286 void winctlprint(Window*, char*, int);
298 void colinit(Column*, Rectangle);
299 Window* coladd(Column*, Window*, Window*, int);
300 void colclose(Column*, Window*, int);
301 void colcloseall(Column*);
302 void colresize(Column*, Rectangle);
303 Text* colwhich(Column*, Point);
304 void coldragwin(Column*, Window*, int);
305 void colgrow(Column*, Window*, int);
306 int colclean(Column*);
307 void colsort(Column*);
308 void colmousebut(Column*);
320 void rowinit(Row*, Rectangle);
321 Column* rowadd(Row*, Column *c, int);
322 void rowclose(Row*, Column*, int);
323 Text* rowwhich(Row*, Point);
324 Column* rowwhichcol(Row*, Point);
325 void rowresize(Row*, Rectangle);
326 Text* rowtype(Row*, Rune, Point);
327 void rowdragcol(Row*, Column*, int but);
329 void rowdump(Row*, char*);
330 void rowload(Row*, char*, int);
331 void rowloadfonts(char*);
337 Channel *c; /* chan(int) */
389 void *arg; /* args to xfidinit */
392 Channel *c; /* chan(void(*)(Xfid*)) */
399 void xfidctl(void *);
400 void xfidflush(Xfid*);
401 void xfidopen(Xfid*);
402 void xfidclose(Xfid*);
403 void xfidread(Xfid*);
404 void xfidwrite(Xfid*);
405 void xfidctlwrite(Xfid*, Window*);
406 void xfideventread(Xfid*, Window*);
407 void xfideventwrite(Xfid*, Window*);
408 void xfidindexread(Xfid*);
409 void xfidutfread(Xfid*, Text*, uint, int);
410 int xfidruneread(Xfid*, Text*, uint, uint);
418 Reffont *rfget(int, int, int, char*);
419 void rfclose(Reffont*);
445 int (*agetc)(void*, uint);
452 /* fbufalloc() guarantees room off end of BUFSIZE */
453 BUFSIZE = Maxblock+IOHDRSZ, /* size from fbufalloc() */
454 RBUFSIZE = BUFSIZE/sizeof(Rune),
456 Scrollwid = 12, /* width of scroll bar */
457 Scrollgap = 4, /* gap right of scroll bar */
458 Margin = 4, /* margin around text */
459 Border = 2, /* line between rows, cols, windows */
462 #define QID(w,q) ((w<<8)|(q))
463 #define WIN(q) ((((ulong)(q).path)>>8) & 0xFFFFFF)
464 #define FILE(q) ((q).path & 0xFF)
492 uint maxtab; /* size of a tab, in units of the '0' character */
499 Keyboardctl *keyboardctl;
512 Text *mousetext; /* global because Text.close needs to clear it */
513 Text *typetext; /* global because Text.close needs to clear it */
514 Text *barttext; /* shared between mousetask and keyboardthread */
525 Image *tagcols[NCOL];
526 Image *textcols[NCOL];
527 extern char wdir[]; /* must use extern because no dimension given */
530 int messagesize; /* negotiated in 9P version setup */
531 int globalautoindent;
534 Channel *ckeyboard; /* chan(Rune)[10] */
535 Channel *cplumb; /* chan(Plumbmsg*) */
536 Channel *cwait; /* chan(Waitmsg) */
537 Channel *ccommand; /* chan(Command*) */
538 Channel *ckill; /* chan(Rune*) */
539 Channel *cxfidalloc; /* chan(Xfid*) */
540 Channel *cxfidfree; /* chan(Xfid*) */
541 Channel *cnewwindow; /* chan(Channel*) */
542 Channel *mouseexit0; /* chan(int) */
543 Channel *mouseexit1; /* chan(int) */
544 Channel *cexit; /* chan(int) */
545 Channel *cerr; /* chan(char*) */
546 Channel *cedit; /* chan(int) */
547 Channel *cwarn; /* chan(void*)[1] (really chan(unit)[1]) */