Hi Ralph,
On 09/21/2015 05:28 AM, Ralph Lange wrote:
>> What is this for?
>
> Application: a new iocsh command.
>
> iocshLoadDir <pathname> <macros>
>
> Source files inside a directory.
> iocshLoadDir creates a list of all files in the specified directory
> that are not directories themselves and whose file names
>
> * start with a number,
> * do not contain a dot ('. '), and
> * do not end with a tilde ('~').
>
> It then sources (via the iocshLoad command) all matching files in
> alphabetical order, supplying the specified macro substitutions.
>
>
> This will allow to get rid of all the ugliness linked to sets of '<
> stcmd-snippet' lines with fixed names and orders inside a st.cmd file,
> replacing it with a standard mechanism that allows easy non-conflicting
> installation of st.cmd snippets by different apps, different system
> packages etc.
> The actual names, phases and related numbers are completely left to the
> users' conventions - base just provides the mechanism.
Interesting idea, can I suggest a different implementation? Would it be
acceptable for the directory parsing to be implemented in a Perl script
that runs at build-time (e.g. in iocBoot/ioc*/Makefile) instead?
The script would generate a single .cmd file that pulls in all the
others and would be included by the main st.cmd file. Using Perl would
simplify the code and avoid the need to add the readdir() API to libCom.
I would probably suggest that the script be given the directory name as
an argument, and that it write its output file into the same directory
only using relative paths.
> I was also considering to add a test on the first argument to an IOC
> binary an the command line (the name of the command file to run), and
> call iocshLoadDir() instead of iocshLoad() if the argument is a directory.
> But that's less important than the command itself, and does add changes
> to an existing file, so ... well, maybe. What do you think?
If we could do this by only modifying the build system it will work on
all older releases as well, and would need much less testing.
> This and the rsrv-binds-to-specified-interface issue are the two things
> I intend to get into 3.15.3 (in addition to all fixes).
Ok by me, thanks.
- Andrew
--
Light thinks it travels faster than anything but it is wrong.
No matter how fast light travels, it finds the darkness has
always got there first, and is waiting for it.
-- Terry Pratchett, Reaper Man
- Replies:
- Re: Q: Portable way to construct a filename? Ralph Lange
- References:
- Q: Portable way to construct a filename? Ralph Lange
- Re: Q: Portable way to construct a filename? Andrew Johnson
- Re: Q: Portable way to construct a filename? Ralph Lange
- Navigate by Date:
- Prev:
Re: Q: Portable way to construct a filename? Ralph Lange
- Next:
Re: Q: Portable way to construct a filename? Ralph Lange
- 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:
Re: Q: Portable way to construct a filename? Ralph Lange
- Next:
Re: Q: Portable way to construct a filename? Ralph Lange
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
<2015>
2016
2017
2018
2019
2020
2021
2022
2023
2024
|