33 Infinity = 0x7FFFFFFF /* huge value for regexp address */
36 #define Buffer AcmeBuffer
37 typedef struct Block Block;
38 typedef struct Buffer Buffer;
39 typedef struct Command Command;
40 typedef struct Column Column;
41 typedef struct Dirlist Dirlist;
42 typedef struct Dirtab Dirtab;
43 typedef struct Disk Disk;
44 typedef struct Expand Expand;
45 typedef struct Fid Fid;
46 typedef struct File File;
47 typedef struct Elog Elog;
48 typedef struct Mntdir Mntdir;
49 typedef struct Range Range;
50 typedef struct Rangeset Rangeset;
51 typedef struct Reffont Reffont;
52 typedef struct Row Row;
53 typedef struct Runestr Runestr;
54 typedef struct Text Text;
55 typedef struct Timer Timer;
56 typedef struct Window Window;
57 typedef struct Xfid Xfid;
73 vlong addr; /* disk address in bytes */
76 uint n; /* number of used runes in block */
77 Block *next; /* pointer to next in free list */
84 vlong addr; /* length of temp file */
85 Block *free[Maxblock/Blockincr+1];
89 Block* disknewblock(Disk*, uint);
90 void diskrelease(Disk*, Block*);
91 void diskread(Disk*, Block*, Rune*, uint);
92 void diskwrite(Disk*, Block**, Rune*, uint);
98 uint cnc; /* bytes in cache */
99 uint cmax; /* size of allocated cache */
100 uint cq; /* position of cache */
101 int cdirty; /* cache needs to be written */
102 uint cbi; /* index of cache Block */
103 Block **bl; /* array of blocks */
104 uint nbl; /* number of blocks */
106 void bufinsert(Buffer*, uint, Rune*, uint);
107 void bufdelete(Buffer*, uint, uint);
108 uint bufload(Buffer*, uint, int, int*, DigestState*);
109 void bufread(Buffer*, uint, Rune*, uint);
110 void bufclose(Buffer*);
111 void bufreset(Buffer*);
115 short type; /* Delete, Insert, Filename */
116 uint q0; /* location of change (unused in f) */
117 uint nd; /* number of deleted characters */
118 uint nr; /* # runes in string or file name */
121 void elogterm(File*);
122 void elogclose(File*);
123 void eloginsert(File*, int, Rune*, int);
124 void elogdelete(File*, int, int);
125 void elogreplace(File*, int, int, Rune*, int);
126 void elogapply(File*);
130 Buffer b; /* the data */
131 Buffer delta; /* transcript of changes */
132 Buffer epsilon; /* inversion of delta for redo */
133 Buffer *elogbuf; /* log of pending editor changes */
134 Elog elog; /* current pending change */
135 Rune *name; /* name of associated file */
136 int nname; /* size of name */
137 uvlong qidpath; /* of file when read */
138 ulong mtime; /* of file when read */
139 int dev; /* of file when read */
140 uchar sha1[20]; /* of file when read */
141 int unread; /* file has not been read from disk */
142 int editclean; /* mark clean after edit command */
144 int seq; /* if seq==0, File acts like Buffer */
146 Text *curtext; /* most recently used associated text */
147 Text **text; /* list of associated texts */
149 int dumpid; /* used in dumping zeroxed windows */
151 File* fileaddtext(File*, Text*);
152 void fileclose(File*);
153 void filedelete(File*, uint, uint);
154 void filedeltext(File*, Text*);
155 void fileinsert(File*, uint, Rune*, uint);
156 uint fileload(File*, uint, int, int*, DigestState*);
157 void filemark(File*);
158 void filereset(File*);
159 void filesetname(File*, Rune*, int);
160 void fileundelete(File*, Buffer*, uint, uint);
161 void fileuninsert(File*, Buffer*, uint, uint);
162 void fileunsetname(File*, Buffer*);
163 void fileundo(File*, int, uint*, uint*);
164 uint fileredoseq(File*);
191 uint iq1; /* last input position */
192 uint eq0; /* start of typing for ESC */
193 uint cq0; /* cache position */
194 int ncache; /* storage for insert */
201 uint textbacknl(Text*, uint, uint);
202 uint textbsinsert(Text*, uint, Rune*, uint, int, int*);
203 int textbswidth(Text*, Rune);
204 int textclickhtmlmatch(Text*, uint*, uint*);
205 int textclickmatch(Text*, int, int, int, uint*);
206 void textclose(Text*);
207 void textcolumnate(Text*, Dirlist**, int);
208 void textcommit(Text*, int);
209 void textconstrain(Text*, uint, uint, uint*, uint*);
210 void textdelete(Text*, uint, uint, int);
211 void textdoubleclick(Text*, uint*, uint*);
212 void textfill(Text*);
213 void textframescroll(Text*, int);
214 void textinit(Text*, File*, Rectangle, Reffont*, Image**);
215 void textinsert(Text*, uint, Rune*, uint, int);
216 int textload(Text*, uint, char*, int);
217 Rune textreadc(Text*, uint);
218 void textredraw(Text*, Rectangle, Font*, Image*, int);
219 void textreset(Text*);
220 int textresize(Text*, Rectangle, int);
221 void textscrdraw(Text*);
222 void textscroll(Text*, int);
223 void textselect(Text*);
224 int textselect2(Text*, uint*, uint*, Text**);
225 int textselect23(Text*, uint*, uint*, Image*, int);
226 int textselect3(Text*, uint*, uint*);
227 void textsetorigin(Text*, uint, int);
228 void textsetselect(Text*, uint, uint);
229 void textshow(Text*, uint, uint, int);
230 void texttype(Text*, Rune);
272 int tagsafe; /* taglines is correct */
279 void wininit(Window*, Window*, Rectangle);
280 void winlock(Window*, int);
281 void winlock1(Window*, int);
282 void winunlock(Window*);
283 void wintype(Window*, Text*, Rune);
284 void winundo(Window*, int);
285 void winsetname(Window*, Rune*, int);
286 void winsettag(Window*);
287 void winsettag1(Window*);
288 void wincommit(Window*, Text*);
289 int winresize(Window*, Rectangle, int, int);
290 void winclose(Window*);
291 void windelete(Window*);
292 int winclean(Window*, int);
293 void windirfree(Window*);
294 void winevent(Window*, char*, ...);
295 void winmousebut(Window*);
296 void winaddincl(Window*, Rune*, int);
297 void wincleartag(Window*);
298 char *winctlprint(Window*, char*, int);
310 void colinit(Column*, Rectangle);
311 Window* coladd(Column*, Window*, Window*, int);
312 void colclose(Column*, Window*, int);
313 void colcloseall(Column*);
314 void colresize(Column*, Rectangle);
315 Text* colwhich(Column*, Point);
316 void coldragwin(Column*, Window*, int);
317 void colgrow(Column*, Window*, int);
318 int colclean(Column*);
319 void colsort(Column*);
320 void colmousebut(Column*);
332 void rowinit(Row*, Rectangle);
333 Column* rowadd(Row*, Column *c, int);
334 void rowclose(Row*, Column*, int);
335 Text* rowwhich(Row*, Point);
336 Column* rowwhichcol(Row*, Point);
337 void rowresize(Row*, Rectangle);
338 Text* rowtype(Row*, Rune, Point);
339 void rowdragcol(Row*, Column*, int but);
341 void rowdump(Row*, char*);
342 int rowload(Row*, char*, int);
343 void rowloadfonts(char*);
349 Channel *c; /* chan(int) */
396 vlong logoff; // for putlog
402 void *arg; /* args to xfidinit */
405 Channel *c; /* chan(void(*)(Xfid*)) */
411 void xfidctl(void *);
412 void xfidflush(Xfid*);
413 void xfidopen(Xfid*);
414 void xfidclose(Xfid*);
415 void xfidread(Xfid*);
416 void xfidwrite(Xfid*);
417 void xfidctlwrite(Xfid*, Window*);
418 void xfideventread(Xfid*, Window*);
419 void xfideventwrite(Xfid*, Window*);
420 void xfidindexread(Xfid*);
421 void xfidutfread(Xfid*, Text*, uint, int);
422 int xfidruneread(Xfid*, Text*, uint, uint);
423 void xfidlogopen(Xfid*);
424 void xfidlogread(Xfid*);
425 void xfidlogflush(Xfid*);
426 void xfidlog(Window*, char*);
434 Reffont *rfget(int, int, int, char*);
435 void rfclose(Reffont*);
461 int (*agetc)(void*, uint);
468 /* fbufalloc() guarantees room off end of BUFSIZE */
469 BUFSIZE = Maxblock+IOHDRSZ, /* size from fbufalloc() */
470 RBUFSIZE = BUFSIZE/sizeof(Rune),
474 #define Scrollwid scalesize(display, 12)
475 #define Scrollgap scalesize(display, 4)
476 #define Margin scalesize(display, 4)
477 #define Border scalesize(display, 2)
478 #define ButtonBorder scalesize(display, 2)
480 #define QID(w,q) ((w<<8)|(q))
481 #define WIN(q) ((((ulong)(q).path)>>8) & 0xFFFFFF)
482 #define FILE(q) ((q).path & 0xFF)
513 uint maxtab; /* size of a tab, in units of the '0' character */
520 Keyboardctl *keyboardctl;
533 Text *mousetext; /* global because Text.close needs to clear it */
534 Text *typetext; /* global because Text.close needs to clear it */
535 Text *barttext; /* shared between mousetask and keyboardthread */
537 int swapscrollbuttons;
548 Image *tagcols[NCOL];
549 Image *textcols[NCOL];
550 extern char wdir[]; /* must use extern because no dimension given */
553 int messagesize; /* negotiated in 9P version setup */
554 int globalautoindent;
560 Kscrolloneup = KF|0x20,
561 Kscrollonedown = KF|0x21
564 Channel *cplumb; /* chan(Plumbmsg*) */
565 Channel *cwait; /* chan(Waitmsg) */
566 Channel *ccommand; /* chan(Command*) */
567 Channel *ckill; /* chan(Rune*) */
568 Channel *cxfidalloc; /* chan(Xfid*) */
569 Channel *cxfidfree; /* chan(Xfid*) */
570 Channel *cnewwindow; /* chan(Channel*) */
571 Channel *mouseexit0; /* chan(int) */
572 Channel *mouseexit1; /* chan(int) */
573 Channel *cexit; /* chan(int) */
574 Channel *cerr; /* chan(char*) */
575 Channel *cedit; /* chan(int) */
576 Channel *cwarn; /* chan(void*)[1] (really chan(unit)[1]) */