2 * declarations common to
4 * - gui-plan-* displayers
15 typedef struct CommandInput CommandInput;
17 /*---------- from obc.c ----------*/
19 typedef struct OutBuffer OutBuffer;
20 typedef struct OutBufferChain OutBufferChain;
21 typedef void OutBufferError(OutBufferChain*, const char *e1, const char *e2
22 /* on error: both e1 and e2 non-0. say `$e1: $e2'
23 * on eof: both e1 and e2 =0. */);
25 typedef void CopyCallBack(char *m, size_t l, void *u);
27 struct OutBufferChain {
31 int limit; /* 0 means obc_init will set a default */
32 OutBufferError *error;
33 /* set/used by obc_..., oprintf, etc., only */
34 int done_of_head, total;
35 struct { OutBuffer *head, *tail; } obs;
38 void obc_init(OutBufferChain *ch);
39 void obc_init_core(OutBufferChain *ch); /* doesn't mess with fd */
40 int obc_tryflush(OutBufferChain *ch);
41 /* returns 0 for all flushed or errno, including particularly EWOULDBLOCK */
43 void ovprintf_ccb(OutBufferChain *ch, CopyCallBack *ccb, void *ccbu,
44 const char *fmt, va_list al)
45 __attribute__((format(printf,4,0)));
46 void ovprintf(OutBufferChain *ch, const char *fmt, va_list al)
47 __attribute__((format(printf,2,0)));
48 void oprintf(OutBufferChain *ch, const char *msg, ...)
49 __attribute__((format(printf,2,3)));
50 void owrite(OutBufferChain *ch, const char *data, int l);
51 void voerror(OutBufferChain *ch, const char *fmt, va_list al)
52 __attribute__((format(printf,2,0)));
54 /*---------- from cmdinput.c ----------*/
56 extern oop_source *events;
58 typedef void CommandInputCallback(ParseState *ps, CommandInput *cmdi);
62 CommandInputCallback *doline;
66 void cmdin_new(CommandInput *cmdi, int readfd);
67 /* fill in cmdi->out's `set by user' fields before calling cmdin_new,
68 * as cmdin_new will call obc_init and will use cmdi->out->fd. */