From 31a60b358fa0bc9f327e4a0def18d1fc56140000 Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 4 May 2008 19:32:17 +0000 Subject: [PATCH] prevent execution of speed and movfeat commands in < Sta_Run --- hostside/commands.c | 14 +++++++------- hostside/errorcodes.h.gen | 1 + hostside/realtime.c | 4 ++++ hostside/realtime.h | 3 +++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/hostside/commands.c b/hostside/commands.c index 5145261..653af23 100644 --- a/hostside/commands.c +++ b/hostside/commands.c @@ -249,7 +249,7 @@ static int cmd_movpos(ParseState *ps, const CmdInfo *ci) { MUSTECR( ps_neednoargs(ps) ); - if (!ci->xarg) + if (!(ci->xarg & CIXF_FORCE)) MUSTECRPREDICT( safety_check_movposchange(move,CMDPPC) ); MUSTECR( movpos_change(move,poscomb,ms,0) ); @@ -272,11 +272,11 @@ static int cmd_speed(ParseState *ps, const CmdInfo *ci) { } const CmdInfo toplevel_cmds[]= { - { "!pic", cmd_pic }, - { "!nmra", cmd_nmra, }, - { "noop", cmd_noop }, - { "movpos", cmd_movpos }, - { "!movpos", cmd_movpos, 1 }, - { "speed", cmd_speed }, + { "!pic", cmd_pic, CIXF_ANYSTA|CIXF_FORCE }, + { "!nmra", cmd_nmra, }, + { "noop", cmd_noop, CIXF_ANYSTA }, + { "movpos", cmd_movpos }, + { "!movpos", cmd_movpos, CIXF_ANYSTA|CIXF_FORCE }, + { "speed", cmd_speed }, { 0 } }; diff --git a/hostside/errorcodes.h.gen b/hostside/errorcodes.h.gen index c5d5cbc..1860744 100755 --- a/hostside/errorcodes.h.gen +++ b/hostside/errorcodes.h.gen @@ -8,6 +8,7 @@ MovFeatRouteNotFound BufferFull BadCmd + InvalidState SignallingPredictedProblem SignallingHorizonReached ); diff --git a/hostside/realtime.c b/hostside/realtime.c index 9721fa5..7d78a0b 100644 --- a/hostside/realtime.c +++ b/hostside/realtime.c @@ -207,6 +207,10 @@ static void command_doline(ParseState *ps, CommandInput *cmdi_arg) { ci= some_needword_lookup(ps, toplevel_cmds, "command"); if (!ci) return; oprintf(UPO, "executing %s\n",ci->name); + if (sta_state < Sta_Run && !(ci->xarg & CIXF_ANYSTA)) { + oprintf(UPO,"ack %s InvalidState : layout not ready\n",ci->name); + return; + } r= ci->fn(ps,ci); switch (r) { case 0: oprintf(UPO, "ack %s ok\n", ci->name); break; diff --git a/hostside/realtime.h b/hostside/realtime.h index a261eea..b8c8017 100644 --- a/hostside/realtime.h +++ b/hostside/realtime.h @@ -115,6 +115,9 @@ extern int picio_send_noise; #define UPO (&(cmdi.out)) +#define CIXF_ANYSTA 1u +#define CIXF_FORCE 2u + /*---------- from/for startup.c ----------*/ #include "stastate.h" -- 2.30.2