rsc | e86ebdc | 2006-06-25 23:49:25 +0000 | [diff] [blame^] | 1 | AUTOLIB(acme) |
rsc | f3b8bf7 | 2006-05-25 06:25:28 +0000 | [diff] [blame] | 2 | |
| 3 | typedef struct Event Event; |
| 4 | typedef struct Win Win; |
| 5 | |
| 6 | #define EVENTSIZE 256 |
| 7 | struct Event |
| 8 | { |
| 9 | int c1; |
| 10 | int c2; |
rsc | f3b8bf7 | 2006-05-25 06:25:28 +0000 | [diff] [blame] | 11 | int q0; |
| 12 | int q1; |
rsc | e86ebdc | 2006-06-25 23:49:25 +0000 | [diff] [blame^] | 13 | int oq0; |
| 14 | int oq1; |
rsc | f3b8bf7 | 2006-05-25 06:25:28 +0000 | [diff] [blame] | 15 | int flag; |
| 16 | int nb; |
| 17 | int nr; |
| 18 | char text[EVENTSIZE*UTFmax+1]; |
| 19 | char arg[EVENTSIZE*UTFmax+1]; |
| 20 | char loc[EVENTSIZE*UTFmax+1]; |
| 21 | }; |
| 22 | |
| 23 | struct Win |
| 24 | { |
| 25 | int id; |
| 26 | CFid *ctl; |
| 27 | CFid *tag; |
| 28 | CFid *body; |
| 29 | CFid *addr; |
| 30 | CFid *event; |
| 31 | CFid *data; |
| 32 | CFid *xdata; |
| 33 | Channel *c; /* chan(Event) */ |
| 34 | Win *next; |
| 35 | Win *prev; |
| 36 | |
| 37 | /* events */ |
| 38 | int nbuf; |
| 39 | char buf[1024]; |
| 40 | char *bufp; |
| 41 | jmp_buf jmp; |
| 42 | Event e2; |
| 43 | Event e3; |
| 44 | Event e4; |
| 45 | }; |
| 46 | |
| 47 | Win *newwin(void); |
| 48 | Win *openwin(int, CFid*); |
| 49 | |
| 50 | int eventfmt(Fmt*); |
| 51 | int pipewinto(Win *w, char *name, int, char *fmt, ...); |
| 52 | int pipetowin(Win *w, char *name, int, char *fmt, ...); |
| 53 | char *sysrun(char*, ...); |
| 54 | int winaddr(Win *w, char *fmt, ...); |
| 55 | int winctl(Win *w, char *fmt, ...); |
| 56 | int windel(Win *w, int sure); |
| 57 | int winfd(Win *w, char *name, int); |
| 58 | char *winmread(Win *w, char *file); |
| 59 | int winname(Win *w, char *fmt, ...); |
| 60 | int winprint(Win *w, char *name, char *fmt, ...); |
| 61 | int winread(Win *w, char *file, void *a, int n); |
| 62 | int winseek(Win *w, char *file, int n, int off); |
| 63 | int winreadaddr(Win *w, uint*); |
| 64 | int winreadevent(Win *w, Event *e); |
| 65 | int winwrite(Win *w, char *file, void *a, int n); |
| 66 | int winwriteevent(Win *w, Event *e); |
| 67 | int winopenfd(Win *w, char *name, int mode); |
| 68 | void windeleteall(void); |
| 69 | void winfree(Win *w); |
| 70 | void winclosefiles(Win *w); |
| 71 | Channel *wineventchan(Win *w); |
| 72 | |
| 73 | void *erealloc(void*, uint); |
| 74 | void *emalloc(uint); |
| 75 | char *estrdup(char*); |
| 76 | char *evsmprint(char*, va_list); |