chiark / gitweb /
protocol improvements wip
authorian <ian>
Wed, 23 Apr 2008 19:59:21 +0000 (19:59 +0000)
committerian <ian>
Wed, 23 Apr 2008 19:59:21 +0000 (19:59 +0000)
hostside/README.commands
hostside/TODO
hostside/realtime.h
hostside/resolve.c

index fc37c0c63fc5bc860d502d0a9924bc1383f6da1d..5cbfd54da8f6e9000ec667fb4660743b526adfd7 100644 (file)
@@ -43,6 +43,7 @@ POSSIBLY-ASYNCHRONOUS REPORTING OF MESSAGES TO/FROM (MASTER) PIC
  U< warning watchdog : PIC watchdog timer triggered
  U< warning spurious <count> : spurious short circuit (fault) etc.
 
+ U< debug <context> : <debug message>
 
 ======================================================================
 
index 1d1bbba2c848615c028cf6b26a116ad2a296cd74..76ba310619525b96c34a028ea982680ffa2e12eb 100644 (file)
@@ -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 ?
 
index c85b96c79bae45ae50c52b61ed2524a16241cada..ff3e7729e3942e1745c8e0da8499e93e72f7072b 100644 (file)
@@ -163,6 +163,7 @@ void points_all_abandon(void);
 
 void choreographers_all_abandon(void);
 
+#define DUPO(ctx) UPO, "debug " ctx " : "
 
 #include "record.h"
 
index 35a6539e0ce9bf202f530f2abe2f3d681380b122..be94f48e7bbf00dc4a3a00b0ebdd9c5df0f54bd4 100644 (file)
@@ -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: