hostside-old
hostside
safety
+topology-dump
t
u
t.*
AUTOINCS= auproto-pic.h layoutinfo.h selectors.h retransmit-table.h \
errorcodes.h stastate.h record-y.h record-l.h \
realtime+dflags.h
-TARGETS= hostside-old gui-plan-bot realtime \
+TARGETS= hostside-old gui-plan-bot realtime topology-dump \
$(addsuffix .speeds.ps, $(TRAINS)) \
$(addsuffix .speeds.record, $(TRAINS))
proto-expanded: ../cebpic/README.protocol
expand <$< $o
+topology-dump: topology-dump.o utils.o ../layout/ours.layout-data.o
+ $(LINK)
+
gui-plan-bot: gui-plan-%: gui-plan.o utils.o parseutils.o obc.o \
../layout/ours.dgram-%.plandata.o \
__oop-read-copy.o -loop
R< ditto, but saved for replay too
S messages to simulation log
+ D< static data printed by topology-dump
+
C> commands (reflected to other clients)
L> commands implemented by multiplexer and not reflected to other clients
O< framming output from commands
!pic =<pic-bytes> and
!nmra _<pic-bytes>
do exactly the same.
+
+======================================================================
+
+TOPOLOGY DUMP
+
+ D< topology segment <segment> <n_movfeats> <n_poscombs> i|n
+ D< topology movfeat <segment> <feat> <posns> <weight> point|relay
+ D< topology movposcomb <segment> <pname>|- \
+ <posn> <dist> [-]<backwards>|- [-]<forwards>|-
+ D< topology movfeatfixed <segment> <feat> <posn>
/*
* declarations common to
* - realtime daemon
- * - multiplexer daemon
+ * - gui-plan-* displayers
*/
#ifndef DAEMONS_H
--- /dev/null
+/*
+ * topology dumper
+ */
+
+#include "common.h"
+#include "../layout/layout-data.h"
+
+static const char *mfkpnames[/*MovFeatKind*/]=
+ { 0,"point","relay" };
+
+static void plink(const SegmentLinkInfo *p) {
+ putchar(' ');
+ if (!SOMEP(p->next)) { putchar('-'); return; }
+ if (p->next_backwards) putchar('-');
+ fputs(info_segments[p->next].pname,stdout);
+}
+
+const char *progname= "topology-dump";
+
+void die_hook(void) { }
+void die_vprintf_hook(const char *fmt, va_list al) { }
+
+int main(int argc, char **argv) {
+ const SegmentInfo *segi;
+ const MovFeatInfo *mfi;
+ const SegPosCombInfo *spci;
+ int segn, mfn, posn;
+
+ if (argc!=1) badusage("no arguments permitted");
+
+ for (segn=0, segi=info_segments; segn<info_nsegments; segn++, segi++) {
+ printf("topology segment %s %d %d %c\n", segi->pname,
+ segi->n_movfeats, segi->n_poscombs, "ni"[segi->invertible]);
+ for (mfn=0, mfi=segi->movfeats; mfn<segi->n_movfeats; mfn++, mfi++) {
+ MovFeatKind k= mfi->kind;
+ printf("topology movfeat %s %s %d %d %s\n", segi->pname, mfi->pname,
+ mfi->posns, mfi->weight, mfkpnames[k]);
+ }
+ for (mfn=0; mfn<segi->n_fixedmovfeats; mfn++, mfi++) {
+ printf("topology movfeatfixed %s %s %d\n", segi->pname, mfi->pname,
+ mfi->posns);
+ }
+ for (posn=0, spci=segi->poscombs; posn<segi->n_poscombs; posn++, spci++) {
+ printf("topology movposcomb %s %s %d %d", segi->pname,
+ segi->n_poscombs>1 ? spci->pname : "-",
+ posn, spci->dist);
+ plink(&spci->link[1]);
+ plink(&spci->link[0]);
+ putchar('\n');
+ }
+ }
+ mflushstdout();
+ return 0;
+}
# $segs{$seg}{BoOb}
# $segs{$seg}{Posns}
# $segs{$seg}{FeatCount} does not include Fixed
+# $segs{$seg}{FeatCountFixed}
# $segs{$seg}{Feats}{$feat}{Kind} Point, Fixed, or Relay
# $segs{$seg}{Feats}{$feat}{Weight} ) for Point or Relay only
# $segs{$seg}{Feats}{$feat}{Posns} ) for Point or Relay only
Kind => Fixed,
Fixed => $pos,
});
+ $segs{$seg}{FeatCountFixed}++;
}
sub begin_segment () { }
Obj => $boob->{Obj} } : undef,
Posns => 1,
Feats => { },
- FeatCount => 0
+ FeatCount => 0,
+ FeatCountFixed => 0
};
&{"line_segment_".($invertible?'invertible':'vanilla')}($boob);
}
my (@segs,$segn,$seg,$segr,$feat,$featv, $delim);
my ($comb,$pi,$end,$boob);
my ($node,$side,$otherend,$nodeotherside,$otherseg,$otherbackrelus);
- my ($ourinter,$pcname,$intere,$intother);
+ my ($ourinter,$pcname,$intere,$intother,$fixedi);
o("/* autogenerated - do not edit */\n\n");
@segs=();
for $seg (sort { nummap($a) cmp nummap($b) } keys %segs) {
}
o("\n};\n");
- next unless $segr->{FeatCount};
+ next unless $segr->{FeatCount} || $segr->{FeatCountFixed};
for $feat (keys %{ $segr->{Feats} }) {
$featv= $segr->{Feats}{$feat};
o("static const MovFeatInfo mfi_${seg}"."[]= {");
$delim='';
- for $feat (keys %{ $segr->{Feats} }) {
- $featv= $segr->{Feats}{$feat};
- next if exists $featv->{Fixed};
- o("$delim\n");
- o(" { \"$feat\", mfk_".lc($featv->{Kind}).",".
- " $featv->{Posns}, $featv->{Weight}, mfbo_${seg}_$feat }");
- $delim=',';
+ for $fixedi (qw(0 1)) {
+ for $feat (keys %{ $segr->{Feats} }) {
+ $featv= $segr->{Feats}{$feat};
+ next if $fixedi != !!exists $featv->{Fixed};
+ o("$delim\n");
+ o(" { \"$feat\", mfk_".lc($featv->{Kind}).",");
+ if (!$fixedi) {
+ o(" $featv->{Posns}, $featv->{Weight}, mfbo_${seg}_$feat");
+ } else {
+ o(" $featv->{Fixed}, 0, 0");
+ }
+ o(" }");
+ $delim=',';
+ }
}
o("\n};\n");
}
foreach $seg (@segs) {
$segr= $segs{$seg};
o("$delim\n");
- o(sprintf " { %-7s%d,%d,%2d,%-9s%d,%-10s%-6s,%-7s",
+ o(sprintf " { %-7s%d,%d,%2d,%d,%-9s%d,%-10s%-6s,%-7s",
"\"$seg\",",$segr->{InvBoOb}?1:0,$segr->{Inter}{Invert},
- $segr->{FeatCount}, ($segr->{FeatCount} ? "mfi_$seg," : '0,'),
+ $segr->{FeatCount}, $segr->{FeatCountFixed},
+ ($segr->{FeatCount}||$segr->{FeatCountFixed}) ? "mfi_$seg," : '0,',
$segr->{Posns}, "spci_$seg,",
so_objboob(1, $segr, \$sensenum),
so_boob(1, $segr->{InvBoOb}).',');
typedef enum {
mfk_none,
mfk_point,
- mfk_relay
- /* must also add new entries to movpos.c:methods[] */
+ mfk_relay,
+ /* must also add new entries to movpos.c:methods[] and topology-dump.c */
+ /* only entries up to here are used by movpos.c, since only
+ * the n_fixedmovfeats entries use mfk_ifxed. */
+ mfk_fixed
} MovFeatKind;
/*========== data from config files and layout cad/cam ==========*/
typedef struct {
const char *pname;
MovFeatKind kind;
- Small posns;
- MovPosComb weight;
- const BoardObject *boob;
+ Small posns; /* for mfk_fixed: is the actual position */
+ MovPosComb weight; /* for mfk_fixed: is 0 */
+ const BoardObject *boob; /* for mfk_fixed: is 0 */
} MovFeatInfo;
typedef struct {
typedef struct {
const char *pname;
unsigned invertible:1, interferes_polarity_opposed:1;
- Small n_movfeats;
- const MovFeatInfo *movfeats;
+ Small n_movfeats, n_fixedmovfeats;
+ const MovFeatInfo *movfeats; /* first n_movfeats then n_fixedmovfeats */
MovPosComb n_poscombs;
const SegPosCombInfo *poscombs;
BoardObject sense, invert;