32 Infinity = 0x7FFFFFFF /* huge value for regexp address */
35 #define Buffer AcmeBuffer
36 typedef struct Block Block;
37 typedef struct Buffer Buffer;
38 typedef struct Command Command;
39 typedef struct Column Column;
40 typedef struct Dirlist Dirlist;
41 typedef struct Dirtab Dirtab;
42 typedef struct Disk Disk;
43 typedef struct Expand Expand;
44 typedef struct Fid Fid;
45 typedef struct File File;
46 typedef struct Elog Elog;
47 typedef struct Mntdir Mntdir;
48 typedef struct Range Range;
49 typedef struct Rangeset Rangeset;
50 typedef struct Reffont Reffont;
51 typedef struct Row Row;
52 typedef struct Runestr Runestr;
53 typedef struct Text Text;
54 typedef struct Timer Timer;
55 typedef struct Window Window;
56 typedef struct Xfid Xfid;
72 uint addr; /* disk address in bytes */
75 uint n; /* number of used runes in block */
76 Block *next; /* pointer to next in free list */
83 uint addr; /* length of temp file */
84 Block *free[Maxblock/Blockincr+1];
88 Block* disknewblock(Disk*, uint);
89 void diskrelease(Disk*, Block*);
90 void diskread(Disk*, Block*, Rune*, uint);
91 void diskwrite(Disk*, Block**, Rune*, uint);
97 uint cnc; /* bytes in cache */
98 uint cmax; /* size of allocated cache */
99 uint cq; /* position of cache */
100 int cdirty; /* cache needs to be written */
101 uint cbi; /* index of cache Block */
102 Block **bl; /* array of blocks */
103 uint nbl; /* number of blocks */
105 void bufinsert(Buffer*, uint, Rune*, uint);
106 void bufdelete(Buffer*, uint, uint);
107 uint bufload(Buffer*, uint, int, int*);
108 void bufread(Buffer*, uint, Rune*, uint);
109 void bufclose(Buffer*);
110 void bufreset(Buffer*);
114 short type; /* Delete, Insert, Filename */
115 uint q0; /* location of change (unused in f) */
116 uint nd; /* number of deleted characters */
117 uint nr; /* # runes in string or file name */
120 void elogterm(File*);
121 void elogclose(File*);
122 void eloginsert(File*, int, Rune*, int);
123 void elogdelete(File*, int, int);
124 void elogreplace(File*, int, int, Rune*, int);
125 void elogapply(File*);
129 Buffer b; /* the data */
130 Buffer delta; /* transcript of changes */
131 Buffer epsilon; /* inversion of delta for redo */
132 Buffer *elogbuf; /* log of pending editor changes */
133 Elog elog; /* current pending change */
134 Rune *name; /* name of associated file */
135 int nname; /* size of name */
136 uvlong qidpath; /* of file when read */
137 uint mtime; /* of file when read */
138 int dev; /* of file when read */
139 int unread; /* file has not been read from disk */
140 int editclean; /* mark clean after edit command */
142 int seq; /* if seq==0, File acts like Buffer */
144 Text *curtext; /* most recently used associated text */
145 Text **text; /* list of associated texts */
147 int dumpid; /* used in dumping zeroxed windows */
149 File* fileaddtext(File*, Text*);
150 void fileclose(File*);
151 void filedelete(File*, uint, uint);
152 void filedeltext(File*, Text*);
153 void fileinsert(File*, uint, Rune*, uint);
154 uint fileload(File*, uint, int, int*);
155 void filemark(File*);
156 void filereset(File*);
157 void filesetname(File*, Rune*, int);
158 void fileundelete(File*, Buffer*, uint, uint);
159 void fileuninsert(File*, Buffer*, uint, uint);
160 void fileunsetname(File*, Buffer*);
161 void fileundo(File*, int, uint*, uint*);
162 uint fileredoseq(File*);
189 uint eq0; /* start of typing for ESC */
190 uint cq0; /* cache position */
191 int ncache; /* storage for insert */
198 uint textbacknl(Text*, uint, uint);
199 uint textbsinsert(Text*, uint, Rune*, uint, int, int*);
200 int textbswidth(Text*, Rune);
201 int textclickmatch(Text*, int, int, int, uint*);
202 void textclose(Text*);
203 void textcolumnate(Text*, Dirlist**, int);
204 void textcommit(Text*, int);
205 void textconstrain(Text*, uint, uint, uint*, uint*);
206 void textdelete(Text*, uint, uint, int);
207 void textdoubleclick(Text*, uint*, uint*);
208 void textfill(Text*);
209 void textframescroll(Text*, int);
210 void textinit(Text*, File*, Rectangle, Reffont*, Image**);
211 void textinsert(Text*, uint, Rune*, uint, int);
212 uint textload(Text*, uint, char*, int);
213 Rune textreadc(Text*, uint);
214 void textredraw(Text*, Rectangle, Font*, Image*, int);
215 void textreset(Text*);
216 int textresize(Text*, Rectangle, int);
217 void textscrdraw(Text*);
218 void textscroll(Text*, int);
219 void textselect(Text*);
220 int textselect2(Text*, uint*, uint*, Text**);
221 int textselect23(Text*, uint*, uint*, Image*, int);
222 int textselect3(Text*, uint*, uint*);
223 void textsetorigin(Text*, uint, int);
224 void textsetselect(Text*, uint, uint);
225 void textshow(Text*, uint, uint, int);
226 void texttype(Text*, Rune);
268 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, 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)
503 uint maxtab; /* size of a tab, in units of the '0' character */
510 Keyboardctl *keyboardctl;
523 Text *mousetext; /* global because Text.close needs to clear it */
524 Text *typetext; /* global because Text.close needs to clear it */
525 Text *barttext; /* shared between mousetask and keyboardthread */
527 int swapscrollbuttons;
537 Image *tagcols[NCOL];
538 Image *textcols[NCOL];
539 extern char wdir[]; /* must use extern because no dimension given */
542 int messagesize; /* negotiated in 9P version setup */
543 int globalautoindent;
548 Kscrolloneup = KF|0x20,
549 Kscrollonedown = KF|0x21
552 Channel *cplumb; /* chan(Plumbmsg*) */
553 Channel *cwait; /* chan(Waitmsg) */
554 Channel *ccommand; /* chan(Command*) */
555 Channel *ckill; /* chan(Rune*) */
556 Channel *cxfidalloc; /* chan(Xfid*) */
557 Channel *cxfidfree; /* chan(Xfid*) */
558 Channel *cnewwindow; /* chan(Channel*) */
559 Channel *mouseexit0; /* chan(int) */
560 Channel *mouseexit1; /* chan(int) */
561 Channel *cexit; /* chan(int) */
562 Channel *cerr; /* chan(char*) */
563 Channel *cedit; /* chan(int) */
564 Channel *cwarn; /* chan(void*)[1] (really chan(unit)[1]) */