32 Infinity = 0x7FFFFFFF, /* huge value for regexp address */
35 typedef struct Block Block;
36 typedef struct Buffer Buffer;
37 typedef struct Command Command;
38 typedef struct Column Column;
39 typedef struct Dirlist Dirlist;
40 typedef struct Dirtab Dirtab;
41 typedef struct Disk Disk;
42 typedef struct Expand Expand;
43 typedef struct Fid Fid;
44 typedef struct File File;
45 typedef struct Elog Elog;
46 typedef struct Mntdir Mntdir;
47 typedef struct Range Range;
48 typedef struct Rangeset Rangeset;
49 typedef struct Reffont Reffont;
50 typedef struct Row Row;
51 typedef struct Runestr Runestr;
52 typedef struct Text Text;
53 typedef struct Timer Timer;
54 typedef struct Window Window;
55 typedef struct Xfid Xfid;
71 uint addr; /* disk address in bytes */
74 uint n; /* number of used runes in block */
75 Block *next; /* pointer to next in free list */
82 uint addr; /* length of temp file */
83 Block *free[Maxblock/Blockincr+1];
87 Block* disknewblock(Disk*, uint);
88 void diskrelease(Disk*, Block*);
89 void diskread(Disk*, Block*, Rune*, uint);
90 void diskwrite(Disk*, Block**, Rune*, uint);
96 uint cnc; /* bytes in cache */
97 uint cmax; /* size of allocated cache */
98 uint cq; /* position of cache */
99 int cdirty; /* cache needs to be written */
100 uint cbi; /* index of cache Block */
101 Block **bl; /* array of blocks */
102 uint nbl; /* number of blocks */
104 void bufinsert(Buffer*, uint, Rune*, uint);
105 void bufdelete(Buffer*, uint, uint);
106 uint bufload(Buffer*, uint, int, int*);
107 void bufread(Buffer*, uint, Rune*, uint);
108 void bufclose(Buffer*);
109 void bufreset(Buffer*);
113 short type; /* Delete, Insert, Filename */
114 uint q0; /* location of change (unused in f) */
115 uint nd; /* number of deleted characters */
116 uint nr; /* # runes in string or file name */
119 void elogterm(File*);
120 void elogclose(File*);
121 void eloginsert(File*, int, Rune*, int);
122 void elogdelete(File*, int, int);
123 void elogreplace(File*, int, int, Rune*, int);
124 void elogapply(File*);
128 Buffer; /* the data */
129 Buffer delta; /* transcript of changes */
130 Buffer epsilon; /* inversion of delta for redo */
131 Buffer *elogbuf; /* log of pending editor changes */
132 Elog elog; /* current pending change */
133 Rune *name; /* name of associated file */
134 int nname; /* size of name */
135 uvlong qidpath; /* of file when read */
136 uint mtime; /* of file when read */
137 int dev; /* of file when read */
138 int unread; /* file has not been read from disk */
139 int editclean; /* mark clean after edit command */
141 int seq; /* if seq==0, File acts like Buffer */
143 Text *curtext; /* most recently used associated text */
144 Text **text; /* list of associated texts */
146 int dumpid; /* used in dumping zeroxed windows */
148 File* fileaddtext(File*, Text*);
149 void fileclose(File*);
150 void filedelete(File*, uint, uint);
151 void filedeltext(File*, Text*);
152 void fileinsert(File*, uint, Rune*, uint);
153 uint fileload(File*, uint, int, int*);
154 void filemark(File*);
155 void filereset(File*);
156 void filesetname(File*, Rune*, int);
157 void fileundelete(File*, Buffer*, uint, uint);
158 void fileuninsert(File*, Buffer*, uint, uint);
159 void fileunsetname(File*, Buffer*);
160 void fileundo(File*, int, uint*, uint*);
161 uint fileredoseq(File*);
188 uint eq0; /* start of typing for ESC */
189 uint cq0; /* cache position */
190 int ncache; /* storage for insert */
197 uint textbacknl(Text*, uint, uint);
198 uint textbsinsert(Text*, uint, Rune*, uint, int, int*);
199 int textbswidth(Text*, Rune);
200 int textclickmatch(Text*, int, int, int, uint*);
201 void textclose(Text*);
202 void textcolumnate(Text*, Dirlist**, int);
203 void textcommit(Text*, int);
204 void textconstrain(Text*, uint, uint, uint*, uint*);
205 void textdelete(Text*, uint, uint, int);
206 void textdoubleclick(Text*, uint*, uint*);
207 void textfill(Text*);
208 void textframescroll(Text*, int);
209 void textinit(Text*, File*, Rectangle, Reffont*, Image**);
210 void textinsert(Text*, uint, Rune*, uint, int);
211 uint textload(Text*, uint, char*, int);
212 Rune textreadc(Text*, uint);
213 void textredraw(Text*, Rectangle, Font*, Image*, int);
214 void textreset(Text*);
215 int textresize(Text*, Rectangle);
216 void textscrdraw(Text*);
217 void textscroll(Text*, int);
218 void textselect(Text*);
219 int textselect2(Text*, uint*, uint*, Text**);
220 int textselect23(Text*, uint*, uint*, Image*, int);
221 int textselect3(Text*, uint*, uint*);
222 void textsetorigin(Text*, uint, int);
223 void textsetselect(Text*, uint, uint);
224 void textshow(Text*, uint, uint, int);
225 void texttype(Text*, Rune);
269 int tagsafe; /* taglines is correct */
275 void wininit(Window*, Window*, Rectangle);
276 void winlock(Window*, int);
277 void winlock1(Window*, int);
278 void winunlock(Window*);
279 void wintype(Window*, Text*, Rune);
280 void winundo(Window*, int);
281 void winsetname(Window*, Rune*, int);
282 void winsettag(Window*);
283 void winsettag1(Window*);
284 void wincommit(Window*, Text*);
285 int winresize(Window*, Rectangle, int);
286 void winclose(Window*);
287 void windelete(Window*);
288 int winclean(Window*, int);
289 void windirfree(Window*);
290 void winevent(Window*, char*, ...);
291 void winmousebut(Window*);
292 void winaddincl(Window*, Rune*, int);
293 void wincleartag(Window*);
294 char *winctlprint(Window*, char*, int);
306 void colinit(Column*, Rectangle);
307 Window* coladd(Column*, Window*, Window*, int);
308 void colclose(Column*, Window*, int);
309 void colcloseall(Column*);
310 void colresize(Column*, Rectangle);
311 Text* colwhich(Column*, Point);
312 void coldragwin(Column*, Window*, int);
313 void colgrow(Column*, Window*, int);
314 int colclean(Column*);
315 void colsort(Column*);
316 void colmousebut(Column*);
328 void rowinit(Row*, Rectangle);
329 Column* rowadd(Row*, Column *c, int);
330 void rowclose(Row*, Column*, int);
331 Text* rowwhich(Row*, Point);
332 Column* rowwhichcol(Row*, Point);
333 void rowresize(Row*, Rectangle);
334 Text* rowtype(Row*, Rune, Point);
335 void rowdragcol(Row*, Column*, int but);
337 void rowdump(Row*, char*);
338 int rowload(Row*, char*, int);
339 void rowloadfonts(char*);
345 Channel *c; /* chan(int) */
397 void *arg; /* args to xfidinit */
400 Channel *c; /* chan(void(*)(Xfid*)) */
407 void xfidctl(void *);
408 void xfidflush(Xfid*);
409 void xfidopen(Xfid*);
410 void xfidclose(Xfid*);
411 void xfidread(Xfid*);
412 void xfidwrite(Xfid*);
413 void xfidctlwrite(Xfid*, Window*);
414 void xfideventread(Xfid*, Window*);
415 void xfideventwrite(Xfid*, Window*);
416 void xfidindexread(Xfid*);
417 void xfidutfread(Xfid*, Text*, uint, int);
418 int xfidruneread(Xfid*, Text*, uint, uint);
426 Reffont *rfget(int, int, int, char*);
427 void rfclose(Reffont*);
453 int (*agetc)(void*, uint);
460 /* fbufalloc() guarantees room off end of BUFSIZE */
461 BUFSIZE = Maxblock+IOHDRSZ, /* size from fbufalloc() */
462 RBUFSIZE = BUFSIZE/sizeof(Rune),
464 Scrollwid = 12, /* width of scroll bar */
465 Scrollgap = 4, /* gap right of scroll bar */
466 Margin = 4, /* margin around text */
467 Border = 2, /* line between rows, cols, windows */
470 #define QID(w,q) ((w<<8)|(q))
471 #define WIN(q) ((((ulong)(q).path)>>8) & 0xFFFFFF)
472 #define FILE(q) ((q).path & 0xFF)
500 uint maxtab; /* size of a tab, in units of the '0' character */
507 Keyboardctl *keyboardctl;
520 Text *mousetext; /* global because Text.close needs to clear it */
521 Text *typetext; /* global because Text.close needs to clear it */
522 Text *barttext; /* shared between mousetask and keyboardthread */
533 char acmeerrorfile[128];
534 Image *tagcols[NCOL];
535 Image *textcols[NCOL];
540 int messagesize; /* negotiated in 9P version setup */
541 int globalautoindent;
543 Channel *cplumb; /* chan(Plumbmsg*) */
544 Channel *cwait; /* chan(Waitmsg) */
545 Channel *ccommand; /* chan(Command*) */
546 Channel *ckill; /* chan(Rune*) */
547 Channel *cxfidalloc; /* chan(Xfid*) */
548 Channel *cxfidfree; /* chan(Xfid*) */
549 Channel *cnewwindow; /* chan(Channel*) */
550 Channel *mouseexit0; /* chan(int) */
551 Channel *mouseexit1; /* chan(int) */
552 Channel *cexit; /* chan(int) */
553 Channel *cerr; /* chan(char*) */
554 Channel *cedit; /* chan(int) */
555 Channel *cwarn; /* chan(void*)[1] (really chan(unit)[1]) */