From 4156e8500f0d54a9ef1a93014cd3667637e0927c Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 8 Jun 2008 22:50:38 +0000 Subject: [PATCH] problem report segment may be 0 --- hostside/README.commands | 4 ++-- hostside/commands.c | 2 +- hostside/gui | 5 ++++- hostside/safety.c | 2 +- hostside/safety.h | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/hostside/README.commands b/hostside/README.commands index 80a7f66..b2fc91c 100644 --- a/hostside/README.commands +++ b/hostside/README.commands @@ -72,7 +72,7 @@ POSSIBLY-ASYNCHRONOUS REPORTING OF INTERNAL STATE CHANGES ETC. U< ?info save-dump U< ?train signalling-problem .... - U< ?train signalling-problem : + U< ?train signalling-problem |- : R< ?train at [-]:+- forwards|backwards R< ?train has [-][/].... @@ -115,7 +115,7 @@ COMMANDS AND RESPONSES O< ?ack O< ?ack [] : ... O< ?ack SignallingPredictedProblem \ - : ... + |- : ... when these come through the multiplexer, everything which is a result of _other_ clients' activities, between and diff --git a/hostside/commands.c b/hostside/commands.c index d7a2b52..02daa7a 100644 --- a/hostside/commands.c +++ b/hostside/commands.c @@ -31,7 +31,7 @@ struct ManualRetransmitNode { static void cmd_ppc(Train *tra, Segment *seg, void *pu, const char *message) { const CmdInfo *ci= pu; ouprintf("ack %s SignallingPredictedProblem %s %s : %s\n", - ci->name, tra->pname, seg->i->pname, message); + ci->name, tra->pname, seg ? seg->i->pname : "-", message); } #define MUSTECRPREDICT(requester) do{ \ diff --git a/hostside/gui b/hostside/gui index d386db5..acbfdc7 100755 --- a/hostside/gui +++ b/hostside/gui @@ -104,7 +104,10 @@ proc scmd_result {oknakerr message reporterrmsg} { register-event {} {} {^\+ack \S+ ok } { scmd_result ok $l "" } register-event {} {train segment error} \ {^\+ack \S+ SignallingPredictedProblem (\S+) (\S+) \: (.*) $} { - scmd_result err $l "$train @$segment: $error" + set m $train + if {[string compare - $segment]} { append m " @$segment" } + append m ": $error" + scmd_result err $l $m } register-event {} {} {^\+ack } { scmd_result err $l $l } register-event {} {} {^\+nack \S+ } { scmd_result nak $l $l } diff --git a/hostside/safety.c b/hostside/safety.c index a5b8504..689c986 100644 --- a/hostside/safety.c +++ b/hostside/safety.c @@ -1054,7 +1054,7 @@ void report_train_ownerships(Train *tra, Segment *hindmost, static void detection_report_problem(Train *tra, Segment *seg, void *pu, const char *message) { ouprintf("train %s signalling-problem %s : %s\n", - tra->pname, seg->i->pname, message); + tra->pname, seg ? seg->i->pname : "-", message); } void safety_notify_detection(Segment *seg) { diff --git a/hostside/safety.h b/hostside/safety.h index 6756e92..ff85afc 100644 --- a/hostside/safety.h +++ b/hostside/safety.h @@ -100,7 +100,7 @@ void safety_panic(Train *tra, Segment *seg, const char *fmt,...) * etc.). */ -typedef void PredictionProblemCallback(Train *tra, Segment *seg, +typedef void PredictionProblemCallback(Train *tra, Segment *seg /* may be 0 */, void *pu, const char *message); void safety_setdirection(Train* tra, int backwards); -- 2.30.2