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);
245 uchar indent[NINDENT];
276 int tagsafe; /* taglines is correct */
282 void wininit(Window*, Window*, Rectangle);
283 void winlock(Window*, int);
284 void winlock1(Window*, int);
285 void winunlock(Window*);
286 void wintype(Window*, Text*, Rune);
287 void winundo(Window*, int);
288 void winsetname(Window*, Rune*, int);
289 void winsettag(Window*);
290 void winsettag1(Window*);
291 void wincommit(Window*, Text*);
292 int winresize(Window*, Rectangle, int);
293 void winclose(Window*);
294 void windelete(Window*);
295 int winclean(Window*, int);
296 void windirfree(Window*);
297 void winevent(Window*, char*, ...);
298 void winmousebut(Window*);
299 void winaddincl(Window*, Rune*, int);
300 void wincleartag(Window*);
301 char *winctlprint(Window*, char*, int);
313 void colinit(Column*, Rectangle);
314 Window* coladd(Column*, Window*, Window*, int);
315 void colclose(Column*, Window*, int);
316 void colcloseall(Column*);
317 void colresize(Column*, Rectangle);
318 Text* colwhich(Column*, Point);
319 void coldragwin(Column*, Window*, int);
320 void colgrow(Column*, Window*, int);
321 int colclean(Column*);
322 void colsort(Column*);
323 void colmousebut(Column*);
335 void rowinit(Row*, Rectangle);
336 Column* rowadd(Row*, Column *c, int);
337 void rowclose(Row*, Column*, int);
338 Text* rowwhich(Row*, Point);
339 Column* rowwhichcol(Row*, Point);
340 void rowresize(Row*, Rectangle);
341 Text* rowtype(Row*, Rune, Point);
342 void rowdragcol(Row*, Column*, int but);
344 void rowdump(Row*, char*);
345 int rowload(Row*, char*, int);
346 void rowloadfonts(char*);
352 Channel *c; /* chan(int) */
404 void *arg; /* args to xfidinit */
407 Channel *c; /* chan(void(*)(Xfid*)) */
414 void xfidctl(void *);
415 void xfidflush(Xfid*);
416 void xfidopen(Xfid*);
417 void xfidclose(Xfid*);
418 void xfidread(Xfid*);
419 void xfidwrite(Xfid*);
420 void xfidctlwrite(Xfid*, Window*);
421 void xfideventread(Xfid*, Window*);
422 void xfideventwrite(Xfid*, Window*);
423 void xfidindexread(Xfid*);
424 void xfidutfread(Xfid*, Text*, uint, int);
425 int xfidruneread(Xfid*, Text*, uint, uint);
433 Reffont *rfget(int, int, int, char*);
434 void rfclose(Reffont*);
460 int (*agetc)(void*, uint);
467 /* fbufalloc() guarantees room off end of BUFSIZE */
468 BUFSIZE = Maxblock+IOHDRSZ, /* size from fbufalloc() */
469 RBUFSIZE = BUFSIZE/sizeof(Rune),
471 Scrollwid = 12, /* width of scroll bar */
472 Scrollgap = 4, /* gap right of scroll bar */
473 Margin = 4, /* margin around text */
474 Border = 2, /* line between rows, cols, windows */
477 #define QID(w,q) ((w<<8)|(q))
478 #define WIN(q) ((((ulong)(q).path)>>8) & 0xFFFFFF)
479 #define FILE(q) ((q).path & 0xFF)
507 uint maxtab; /* size of a tab, in units of the '0' character */
514 Keyboardctl *keyboardctl;
527 Text *mousetext; /* global because Text.close needs to clear it */
528 Text *typetext; /* global because Text.close needs to clear it */
529 Text *barttext; /* shared between mousetask and keyboardthread */
540 char acmeerrorfile[128];
541 Image *tagcols[NCOL];
542 Image *textcols[NCOL];
547 int messagesize; /* negotiated in 9P version setup */
548 int globalindent[NINDENT];
550 Channel *cplumb; /* chan(Plumbmsg*) */
551 Channel *cwait; /* chan(Waitmsg) */
552 Channel *ccommand; /* chan(Command*) */
553 Channel *ckill; /* chan(Rune*) */
554 Channel *cxfidalloc; /* chan(Xfid*) */
555 Channel *cxfidfree; /* chan(Xfid*) */
556 Channel *cnewwindow; /* chan(Channel*) */
557 Channel *mouseexit0; /* chan(int) */
558 Channel *mouseexit1; /* chan(int) */
559 Channel *cexit; /* chan(int) */
560 Channel *cerr; /* chan(char*) */
561 Channel *cedit; /* chan(int) */
562 Channel *cwarn; /* chan(void*)[1] (really chan(unit)[1]) */