typedef struct OutBuffer OutBuffer;
typedef struct OutBufferChain OutBufferChain;
typedef void OutBufferError(OutBufferChain*, const char *e1, const char *e2
- /* both e1 and e2 always non-0. say `$e1: $e2' */);
+ /* on error: both e1 and e2 non-0. say `$e1: $e2'
+ * on eof: both e1 and e2 =0. */);
struct OutBufferChain {
/* set by user: */
static void comms_error(const char *ch, const char *e1,
const char *e2 /* may be 0 */) {
+ if (!e1 && !e2) e1= "end of file";
die("communications error: %s: %s%s%s", ch, e1, e2?": ":"", e2?e2:"");
}
if (!serial_buf.l) break;
buf_used -= serial_buf.l;
memmove(serial_buf.d, serial_buf.d + serial_buf.l, buf_used);
+ if (!buf_used) break;
}
serial_buf.l= buf_used;
return OOP_CONTINUE;
int i;
assert(!(as & (~0UL << argbits)));
- out->l= 1 + argbits;
+ out->l= 1 + argbits/7;
for (i= out->l - 1;
i >= 0;
i--, as >>= 7)
}
}
+ if (objnum_r && pii) *objnum_r= val & ((1u << pii->argbits) - 1);
*pii_r= pii;
- if (objnum_r) *objnum_r= val & ((1u << pii->argbits) - 1);
}
const PicInsnInfo pic_command_infos[]= {
static void timedout_onward(TimeoutEvent *toev) {
assert(sta_state != Sta_Run);
- sta_goto(sta_state + 1);
+ sta_goto(sta_state == Sta_Flush ? Sta_Ping : sta_state + 1);
}
static void timedout_ping(TimeoutEvent *toev) {