31 Infinity = 0x7FFFFFFF, /* huge value for regexp address */
34 #define Buffer AcmeBuffer
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 b; /* 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 */
196 uint textbacknl(Text*, uint, uint);
197 uint textbsinsert(Text*, uint, Rune*, uint, int, int*);
198 int textbswidth(Text*, Rune);
199 int textclickmatch(Text*, int, int, int, uint*);
200 void textclose(Text*);
201 void textcolumnate(Text*, Dirlist**, int);
202 void textcommit(Text*, int);
203 void textconstrain(Text*, uint, uint, uint*, uint*);
204 void textdelete(Text*, uint, uint, int);
205 void textdoubleclick(Text*, uint*, uint*);
206 void textfill(Text*);
207 void textframescroll(Text*, int);
208 void textinit(Text*, File*, Rectangle, Reffont*, Image**);
209 void textinsert(Text*, uint, Rune*, uint, int);
210 uint textload(Text*, uint, char*, int);
211 Rune textreadc(Text*, uint);
212 void textredraw(Text*, Rectangle, Font*, Image*, int);
213 void textreset(Text*);
214 int textresize(Text*, Rectangle);
215 void textscrdraw(Text*);
216 void textscroll(Text*, int);
217 void textselect(Text*);
218 int textselect2(Text*, uint*, uint*, Text**);
219 int textselect23(Text*, uint*, uint*, Image*, int);
220 int textselect3(Text*, uint*, uint*);
221 void textsetorigin(Text*, uint, int);
222 void textsetselect(Text*, uint, uint);
223 void textshow(Text*, uint, uint, int);
224 void texttype(Text*, Rune);
269 void wininit(Window*, Window*, Rectangle);
270 void winlock(Window*, int);
271 void winlock1(Window*, int);
272 void winunlock(Window*);
273 void wintype(Window*, Text*, Rune);
274 void winundo(Window*, int);
275 void winsetname(Window*, Rune*, int);
276 void winsettag(Window*);
277 void winsettag1(Window*);
278 void wincommit(Window*, Text*);
279 int winresize(Window*, Rectangle, int);
280 void winclose(Window*);
281 void windelete(Window*);
282 int winclean(Window*, int);
283 void windirfree(Window*);
284 void winevent(Window*, char*, ...);
285 void winmousebut(Window*);
286 void winaddincl(Window*, Rune*, int);
287 void wincleartag(Window*);
288 void winctlprint(Window*, char*, int);
300 void colinit(Column*, Rectangle);
301 Window* coladd(Column*, Window*, Window*, int);
302 void colclose(Column*, Window*, int);
303 void colcloseall(Column*);
304 void colresize(Column*, Rectangle);
305 Text* colwhich(Column*, Point);
306 void coldragwin(Column*, Window*, int);
307 void colgrow(Column*, Window*, int);
308 int colclean(Column*);
309 void colsort(Column*);
310 void colmousebut(Column*);
322 void rowinit(Row*, Rectangle);
323 Column* rowadd(Row*, Column *c, int);
324 void rowclose(Row*, Column*, int);
325 Text* rowwhich(Row*, Point);
326 Column* rowwhichcol(Row*, Point);
327 void rowresize(Row*, Rectangle);
328 Text* rowtype(Row*, Rune, Point);
329 void rowdragcol(Row*, Column*, int but);
331 void rowdump(Row*, char*);
332 void rowload(Row*, char*, int);
333 void rowloadfonts(char*);
339 Channel *c; /* chan(int) */
391 void *arg; /* args to xfidinit */
394 Channel *c; /* chan(void(*)(Xfid*)) */
401 void xfidctl(void *);
402 void xfidflush(Xfid*);
403 void xfidopen(Xfid*);
404 void xfidclose(Xfid*);
405 void xfidread(Xfid*);
406 void xfidwrite(Xfid*);
407 void xfidctlwrite(Xfid*, Window*);
408 void xfideventread(Xfid*, Window*);
409 void xfideventwrite(Xfid*, Window*);
410 void xfidindexread(Xfid*);
411 void xfidutfread(Xfid*, Text*, uint, int);
412 int xfidruneread(Xfid*, Text*, uint, uint);
420 Reffont *rfget(int, int, int, char*);
421 void rfclose(Reffont*);
447 int (*agetc)(void*, uint);
454 /* fbufalloc() guarantees room off end of BUFSIZE */
455 BUFSIZE = Maxblock+IOHDRSZ, /* size from fbufalloc() */
456 RBUFSIZE = BUFSIZE/sizeof(Rune),
458 Scrollwid = 12, /* width of scroll bar */
459 Scrollgap = 4, /* gap right of scroll bar */
460 Margin = 4, /* margin around text */
461 Border = 2, /* line between rows, cols, windows */
464 #define QID(w,q) ((w<<8)|(q))
465 #define WIN(q) ((((ulong)(q).path)>>8) & 0xFFFFFF)
466 #define FILE(q) ((q).path & 0xFF)
494 uint maxtab; /* size of a tab, in units of the '0' character */
501 Keyboardctl *keyboardctl;
514 Text *mousetext; /* global because Text.close needs to clear it */
515 Text *typetext; /* global because Text.close needs to clear it */
516 Text *barttext; /* shared between mousetask and keyboardthread */
527 Image *tagcols[NCOL];
528 Image *textcols[NCOL];
529 extern char wdir[]; /* must use extern because no dimension given */
532 int messagesize; /* negotiated in 9P version setup */
533 int globalautoindent;
537 Kscrolloneup = KF|0x20,
538 Kscrollonedown = KF|0x21,
541 Channel *ckeyboard; /* chan(Rune)[10] */
542 Channel *cplumb; /* chan(Plumbmsg*) */
543 Channel *cwait; /* chan(Waitmsg) */
544 Channel *ccommand; /* chan(Command*) */
545 Channel *ckill; /* chan(Rune*) */
546 Channel *cxfidalloc; /* chan(Xfid*) */
547 Channel *cxfidfree; /* chan(Xfid*) */
548 Channel *cnewwindow; /* chan(Channel*) */
549 Channel *mouseexit0; /* chan(int) */
550 Channel *mouseexit1; /* chan(int) */
551 Channel *cexit; /* chan(int) */
552 Channel *cerr; /* chan(char*) */
553 Channel *cedit; /* chan(int) */
554 Channel *cwarn; /* chan(void*)[1] (really chan(unit)[1]) */