}
void actual_inversions_start(void) {
+ int i;
polarityinsn.l= (info_maxreverse + 4 + 6) / 7;
+ for (i=1; i<polarityinsn.l-1; i++)
+ polarityinsn.d[i] |= 0x80;
}
void actual_inversions_segment(Segment *seg) {
void cmdin_new(CommandInput *cmdi, int readfd) {
int r;
-
+
obc_init(&cmdi->out);
events->on_fd(events, readfd, OOP_EXCEPTION, cmdi_exception, cmdi);
/* set by user: */
char *desc;
int fd;
+ int limit; /* 0 means obc_init will set a default */
OutBufferError *error;
/* set/used by obc_..., oprintf, etc., only */
- int done_of_head;
+ int done_of_head, total;
struct { OutBuffer *head, *tail; } obs;
};
}
if (ch->done_of_head == ob->l) {
LIST_UNLINK(ch->obs, ob);
- free(ob);
free(ob->m);
+ free(ob);
ch->done_of_head= 0;
continue;
}
}
assert(r>=0);
ch->done_of_head += r;
+ ch->total -= r;
assert(ch->done_of_head <= ob->l);
}
}
if (!ch->obs.head)
events->on_fd(events, ch->fd, OOP_WRITE, writeable, ch);
LIST_LINK_TAIL(ch->obs, ob);
+ ch->total += ob->l;
+ obc_tryflush(ch);
+ if (ch->total > ch->limit) {
+ char what[128];
+ snprintf(what,sizeof(what)-1,"`%.*s...'", ob->l,ob->m);
+ what[sizeof(what)-1]= 0;
+ ch->error(ch,"buffer limit exceeded",what);
+ }
}
void obc_init(OutBufferChain *ch) {
int r;
ch->done_of_head= 0;
+ ch->total= 0;
+ if (!ch->limit) ch->limit= 128*1024;
r= oop_fd_nonblock(ch->fd, 1);
if (r) diee("nonblock(OutBufferChain->fd,1)");
LIST_INIT(ch->obs);
#include "realtime.h"
const char *persist_fn= "persist";
-const char *persist_record_converted;
+char *persist_record_converted;
static int fd= -1;
static void *mapbase;
try(FN1(data), FN1(conv)) ||
try(FN(data,old), FN(conv,old)) ||
try(FN1(data), FN(conv,old)) ||
- (persist_record_converted= 0);
+ (free(persist_record_converted),
+ persist_record_converted=0);
}
/*---------- stupid mmap workaround ----------*/
}
static void obc_error(OutBufferChain *ch, const char *e1, const char *e2) {
- comms_error(ch->desc, e1, e2);
+ if (!e1) { assert(!e2); exit(0); }
+ fprintf(stderr,"command communication error: %s%s%s\n",
+ e1, e2?": ":"", e2?e2:"");
+ exit(-1);
}
void ouhex(const char *word, const Byte *command, int length) {
void persist_install(void);
extern const char *persist_fn;
-extern const char *persist_record_converted;
+extern char *persist_record_converted;
void persist_map_veryearly(void);
FOR_SEG {
seg->res_detect= 0;
seg->tr_updated= 0;
- seg->seg_inverted &= segi->invertible;
- actual_inversions_segment(seg);
+ if (segi->invertible)
+ actual_inversions_segment(seg);
+ else
+ seg->seg_inverted= 0;
}
actual_inversions_done();
}
/* 3. we have a violation of D \subset U, namely d */
oprintf(UPO, "resolving violation @%s\n", di->pname);
- nextphase= 0;
if (d->owner) { /* 3a perhaps */
oprintf(UPO, "resolving expected %s\n", t->pname);
/* Yay! 3a. */
t->resolution= RR_E;
+ nextphase= 0;
already_3a:
oprintf(UPO, "resolving supposing %s as-expected\n", t->pname);
continue;
if (tplus->resolution == RR_E) {
oprintf(UPO, "resolving supposing %s absent\n", tplus->pname);
tplus->resolution= RR_N;
+ nextphase= 0;
}
}
/* Now must trim U to correspond to our setting of R(t+)=N
}
t1->resolution= RR_H;
+ nextphase= 0;
oprintf(UPO, "resolving supposing %s at-home\n", t1->pname);
continue;
#define FOR_SEGMENT(seg, initx, stepx) \
for (seg##n=0, seg=segments, seg##i=info_segments; \
- seg##n <= NUM_SEGMENTS; \
+ seg##n < NUM_SEGMENTS; \
seg##n++, seg++, seg##i++, stepx)
#define FOR_TRAIN(tra, initx, stepx) \
typedef enum {
mfk_none,
mfk_point
+ /* must also add new entries to movpos.c:methodinfos */
} MovFeatKind;
/*========== data from config files and layout cad/cam ==========*/
extern const BoardObject info_maxreverse; /* max. reverse + 1 */
-#define NOTA(x) (-1)
+#define NOTA(thing) (-1)
#define SOMEP(x) ((x) >= 0)
#endif /*LAYOUT_DATA_H*/