From 516b57ebce3521c14478f079db7b5fb201894f70 Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 23 Apr 2008 19:59:21 +0000 Subject: [PATCH] protocol improvements wip --- hostside/README.commands | 1 + hostside/TODO | 6 ++---- hostside/realtime.h | 1 + hostside/resolve.c | 34 +++++++++++++++++----------------- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/hostside/README.commands b/hostside/README.commands index fc37c0c..5cbfd54 100644 --- a/hostside/README.commands +++ b/hostside/README.commands @@ -43,6 +43,7 @@ POSSIBLY-ASYNCHRONOUS REPORTING OF MESSAGES TO/FROM (MASTER) PIC U< warning watchdog : PIC watchdog timer triggered U< warning spurious : spurious short circuit (fault) etc. + U< debug : ====================================================================== diff --git a/hostside/TODO b/hostside/TODO index 1d1bbba..76ba310 100644 --- a/hostside/TODO +++ b/hostside/TODO @@ -1,10 +1,8 @@ -currently - eliminating logmsg and documenting the resulting protocol -also want to +want to + eliminate logmsg and documenting the resulting protocol say something from movpos when we change a point say something from prediction when we confirm a plan at least segment ownership and intended movposcombs - change `resolving' to debugs (new `debugmsg' function?) document commands [!]movfeat and speed stop all trains command ? diff --git a/hostside/realtime.h b/hostside/realtime.h index c85b96c..ff3e772 100644 --- a/hostside/realtime.h +++ b/hostside/realtime.h @@ -163,6 +163,7 @@ void points_all_abandon(void); void choreographers_all_abandon(void); +#define DUPO(ctx) UPO, "debug " ctx " : " #include "record.h" diff --git a/hostside/resolve.c b/hostside/resolve.c index 35a6539..be94f48 100644 --- a/hostside/resolve.c +++ b/hostside/resolve.c @@ -179,16 +179,16 @@ int resolve_complete(void) { for (phase=0; phase<3; phase=nextphase) { nextphase= phase+1; - oprintf(UPO, "resolving iteration %c\n", "EHX"[phase]); + oprintf(DUPO("resolving") "iteration %c\n", "EHX"[phase]); - oprintf(UPO, "resolving calculate-u\n"); + oprintf(DUPO("resolving") " calculate-u\n"); FOR_SEGMENT(d,NOOP,NOOP) { /* calculate U */ unsigned updated= 0; #define ADDTO_U_EH(homeowner,HH_HE,string) \ if (d->homeowner && d->homeowner->resolution == HH_HE) { \ - oprintf(UPO, "resolving covered @%s " string " %s\n", \ + oprintf(DUPO("resolving") " covered @%s " string " %s\n", \ di->pname, d->homeowner->pname); \ updated++; \ } @@ -199,29 +199,29 @@ int resolve_complete(void) { d->iselem_u= updated; } - oprintf(UPO, "resolving searching\n"); + oprintf(DUPO("resolving") " searching\n"); FOR_SEGMENT(d, NOOP, NOOP) { if (!(d->res_detect && !d->iselem_u)) continue; /* 3. we have a violation of D \subset U, namely d */ - oprintf(UPO, "resolving violation @%s\n", di->pname); + oprintf(DUPO("resolving") " violation @%s\n", di->pname); if (d->owner) { /* 3a perhaps */ - oprintf(UPO, "resolving expected %s\n", t->pname); + oprintf(DUPO("resolving") " expected %s\n", t->pname); if (t->addr < 0) { - oprintf(UPO, "resolving expected-is-not-addressable\n"); + oprintf(DUPO("resolving") " expected-is-not-addressable\n"); goto not_3a; } if (t->resolution == RR_H) { - oprintf(UPO, "resolving expected-is-at-home\n"); + oprintf(DUPO("resolving") " expected-is-at-home\n"); goto not_3a; } if (d->movposcomb < 0) { - oprintf(UPO, "resolving track-unknown-position\n"); + oprintf(DUPO("resolving") " track-unknown-position\n"); goto not_3a; } @@ -236,7 +236,7 @@ int resolve_complete(void) { if (d1->owner == t && d1->iselem_u) { FOR_TRAIN(t2, NOOP, NOOP) { if (t2->resolution == RR_H && d1->owner == t2) { - oprintf(UPO, "resolving clash @%s %s\n", + oprintf(DUPO("resolving") " clash @%s %s\n", d1i->pname, t2->pname); clashes++; } @@ -244,7 +244,7 @@ int resolve_complete(void) { } } if (clashes) { - oprintf(UPO, "resolving expected-has-clashes\n"); + oprintf(DUPO("resolving") " expected-has-clashes\n"); goto not_3a; } @@ -252,7 +252,7 @@ int resolve_complete(void) { t->resolution= RR_E; nextphase= 0; already_3a: - oprintf(UPO, "resolving supposing %s as-expected\n", t->pname); + oprintf(DUPO("resolving") " supposing %s as-expected\n", t->pname); continue; } not_3a: @@ -262,17 +262,17 @@ int resolve_complete(void) { continue; Train *t1= d->home; /* t' st d \elem H(t') */ - oprintf(UPO, "resolving home %s\n", t1->pname); + oprintf(DUPO("resolving") " home %s\n", t1->pname); if (t1->addr < 0) { - oprintf(UPO, "resolving home-is-not-addressable\n"); + oprintf(DUPO("resolving") " home-is-not-addressable\n"); goto not_3b; } - oprintf(UPO, "resolving reset-expecteds\n"); + oprintf(DUPO("resolving") " reset-expecteds\n"); FOR_TRAIN(tplus, NOOP,NOOP) { if (tplus->resolution == RR_E) { - oprintf(UPO, "resolving supposing %s absent\n", tplus->pname); + oprintf(DUPO("resolving") " supposing %s absent\n", tplus->pname); tplus->resolution= RR_N; nextphase= 0; } @@ -288,7 +288,7 @@ int resolve_complete(void) { t1->resolution= RR_H; nextphase= 0; - oprintf(UPO, "resolving supposing %s at-home\n", t1->pname); + oprintf(DUPO("resolving") " supposing %s at-home\n", t1->pname); continue; } not_3b: -- 2.30.2