Subject: |
Re: [Merge] lp:~jlmuir/epics-base/iocsh-if-flow-control-3.14 into lp:epics-base |
From: |
Andrew Johnson <[email protected]> |
To: |
[email protected] |
Date: |
Mon, 09 Jan 2012 21:15:27 -0000 |
Hi Lewis,
You can't get your diff to be clean because you've been developing against the 3.14 branch of Base, but you're proposing a merge into 3.15 which is currently missing 4 revisions from the 3.14 branch (those are the additional changes that are appearing in your proposal). Don't worry about them for now, it's not hard to ignore those changes since they have nothing to do with the iocsh code.
Unfortunately this proposal bothers me for several reasons:
1. The current iocsh.cpp code is pretty clean and simple to understand. Your changes add quite a lot of complication to handle the ability to skip the commands in non-active conditional sections. I'm not saying your code is bad, that complexity is inevitable if we want to implement conditional execution to iocsh.
2. It is relatively easy to execute external scripts conditionally with the existing code. A construct like this
< pilatus-$(PILATUS_ENABLED).cmd
requires you to put the conditional code in a script named pilatus-YES.cmd and to have an empty file named pilatus-NO.cmd. It is even possible to include the conditional code inline if you can choose the conditional variable values; if you make them empty or just contain spaces when true, and have the string "#" when they're false, then you just do this:
$(PILATUS_ENABLED) dbpf("x7PIL1:det1:TriggerMode","Ext. Trigger")
There are similar options using the $(VAR=DEFAULT) feature of macros; if the variable is undefined when false and can be empty (or just contain spaces) when true you can use this:
$(PILATUS_ENABLED=#) dbpf("x7PIL1:det1:TriggerMode","Ext. Trigger")
I agree that these techniques are not quite as convenient as putting conditional expressions in a single script file, but you can use them without modifying iocsh and can thus include them in modules that you distribute to other people.
3. As Eric Norum puts it, this is a Camel's Nose issue. If we introduce conditionals someone else will want to add subroutines, and pretty soon we could have a full-blown Turing-complete scripting language to maintain. It would be better to embed a standard scripting language interpreter into the IOC and add the ability to execute registered iocsh commands from within that language.
My first preference for a suitable language would be Lua since the licensing is suitable (MIT) and there is a glue layer available for running it on vxWorks which allows Lua scripts to call functions found through the vxWorks symbol table. It should be relatively easy to extend Lua to run registered iocsh commands as well.
If you can persuade enough other EPICS users to ask for conditionals in iocsh I will reconsider, but I think you'll get similar objections from several other people as well.
I do like your iocsh test program though, I might steal that part.
- Andrew
--
https://code.launchpad.net/~jlmuir/epics-base/iocsh-if-flow-control-3.14/+merge/87972
Your team EPICS Core Developers is requested to review the proposed merge of lp:~jlmuir/epics-base/iocsh-if-flow-control-3.14 into lp:epics-base.
- Replies:
- Re: [Merge] lp:~jlmuir/epics-base/iocsh-if-flow-control-3.14 into lp:epics-base J. Lewis Muir
- Re: [Merge] lp:~jlmuir/epics-base/iocsh-if-flow-control-3.14 into lp:epics-base J. Lewis Muir
- References:
- [Merge] lp:~jlmuir/epics-base/iocsh-if-flow-control-3.14 into lp:epics-base J. Lewis Muir
- Navigate by Date:
- Prev:
[Merge] lp:~jlmuir/epics-base/iocsh-if-flow-control-3.14 into lp:epics-base J. Lewis Muir
- Next:
Re: [Merge] lp:~jlmuir/epics-base/iocsh-if-flow-control-3.14 into lp:epics-base J. Lewis Muir
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
[Merge] lp:~jlmuir/epics-base/iocsh-if-flow-control-3.14 into lp:epics-base J. Lewis Muir
- Next:
Re: [Merge] lp:~jlmuir/epics-base/iocsh-if-flow-control-3.14 into lp:epics-base J. Lewis Muir
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
<2012>
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|