From 3a7e6a9768e0f2e7ff3491b14ff2d768c64a1c34 Mon Sep 17 00:00:00 2001 From: Ferdi Franceschini Date: Tue, 23 Oct 2007 12:46:16 +1000 Subject: [PATCH] Added "abortbatch" command for use within batch files. It gives a user the option of aborting a batch file if their code detects an error. r2192 | ffr | 2007-10-23 12:46:16 +1000 (Tue, 23 Oct 2007) | 3 lines --- site_ansto/anstoutil.c | 5 +++++ site_ansto/anstoutil.h | 1 + site_ansto/site_ansto.c | 1 + 3 files changed, 7 insertions(+) diff --git a/site_ansto/anstoutil.c b/site_ansto/anstoutil.c index ccabe31b..3f93cbab 100644 --- a/site_ansto/anstoutil.c +++ b/site_ansto/anstoutil.c @@ -73,3 +73,8 @@ int portNumCmd(SConnection *pCon, SicsInterp *pInter, void *pData, int argc, cha //SCsetMacro(pCon,iMacro); return 1; } + +int AbortBatch(SConnection *pCon, SicsInterp *pInter, void *pData, int argc, char *argv[]) { + SCSetInterrupt(pCon,eAbortBatch); + return TCL_ERROR; +} diff --git a/site_ansto/anstoutil.h b/site_ansto/anstoutil.h index 8ab32374..57fc5a79 100644 --- a/site_ansto/anstoutil.h +++ b/site_ansto/anstoutil.h @@ -8,4 +8,5 @@ char *getParam(SConnection *pCon, Tcl_Interp *pTcl, char *params, char *parName, int mustHave ); int portNumCmd(SConnection *pCon, SicsInterp *pInter, void *pData, int argc, char *argv[]); int getPortNum(SConnection *pCon, char *portName); +int AbortBatch(SConnection *pCon, SicsInterp *pInter, void *pData, int argc, char *argv[]); #endif diff --git a/site_ansto/site_ansto.c b/site_ansto/site_ansto.c index 85f1e987..fe283ec2 100644 --- a/site_ansto/site_ansto.c +++ b/site_ansto/site_ansto.c @@ -65,6 +65,7 @@ static void AddCommands(SicsInterp *pInter) NHQ200InitProtocol(pInter); AddCommand(pInter,"MakeTCPSelector",VelSelTcpFactory,NULL,NULL); AddCommand(pInter,"portnum",portNumCmd,NULL,NULL); + AddCommand(pInter,"abortbatch",AbortBatch,NULL,NULL); AddCommand(pInter,"MakeHMControl_ANSTO",MakeHMControl_ANSTO,NULL,NULL); AddCommand(pInter,"MakeAsyncProtocol",AsyncProtocolFactory,NULL,NULL); AddCommand(pInter,"MakeAsyncQueue",AsyncQueueFactory,NULL,NULL);