EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: [Merge] ~epics-core/epics-base/+git/Com:iocsherr into epics-base:7.0
From: Keenan Lang via Core-talk <[email protected]>
To: mdavidsaver <[email protected]>
Date: Fri, 03 May 2019 22:42:35 -0000
More than just an iocshGetError would be needed to be done for this, then. 

Currently, the scope structure is created, mutated, and destroyed solely in the iocshBody. While a lua shell can be run within the context of the IOC shell, that isn't a requirement. Running the lua shell as your primary shell and calling iocsh.cmd(args), there wouldn't be any scope structure to hold the error, so an iocshGetError function would return nothing. The creation of the scope could be moved out of the ioc shell so then there's always access to error handling, but in addition to iocshGetError, you'd also need an iocshClearError function, so that you can reset things for a future iocsh.cmd(args) call.

But all this ends up getting into a more overarching software design issue. How integrated should the lua shell be in the interior workings of the ioc shell? Should an error handling setting in iocsh affect how luash deals with calls to outside functions? While the functions are technically registered with the ioc shell, does the ioc shell control their execution or is the function registrar something that is only under the purview of the ioc shell due to iocsh previously being the only shell?

I think the easiest way to sidestep answering some of these questions at this point would be to separate the error handling and the error generation. Split the calling of ioc shell registered functions out into its own function. That function would do a try-catch to get any c++ exceptions as well as monitor a thread variable that would still get set with iocshSetError(). If either an exception or a error happens this function returns some negative error code number, otherwise it returns a zero.

Error handling still happens in iocshBody, it just checks the return value of the function rather than the Scope structure. For outside code like luash, all you'd have to do is expose this checkForError function, luash would call it and get a return value to tell if there was an error or not. And since the thread variable representing an error happening no longer is used in other places in the code, the checkForError function can reset it before it returns, so there's no need for a iocshClearError() or similar.
-- 
https://code.launchpad.net/~epics-core/epics-base/+git/Com/+merge/366876
Your team EPICS Core Developers is subscribed to branch epics-base:7.0.

References:
[Merge] ~epics-core/epics-base/+git/Com:iocsherr into epics-base:7.0 mdavidsaver via Core-talk

Navigate by Date:
Prev: Build failed: EPICS Base base-3.15-392 AppVeyor via Core-talk
Next: Build failed: EPICS Base base-7.0-393 AppVeyor via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: [Merge] ~epics-core/epics-base/+git/Com:iocsherr into epics-base:7.0 Andrew Johnson via Core-talk
Next: Re: [Merge] ~epics-core/epics-base/+git/Com:iocsherr into epics-base:7.0 mdavidsaver via Core-talk
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
ANJ, 20 May 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·