On 2/3/21 4:21 PM, Johnson, Andrew N. via Core-talk wrote:
> A colleague just presented me with one of those frustrating little problems where his database wouldn’t load because he spelled a calcout.OOPT field value using “to” instead of “To” and he couldn’t find it.
Menu strings are certainly a gotcha which gets me.
For me, even after a decade I _still_ try to set SCAN to "10 seconds".
I think I have some kind of mental block at this point.
I don't see case as being particularly special though, and I'm not a
fan of relaxing strictness. Nor of changing all of the other parsers.
(Are you volunteering to handle VDCT?)
How about improving the error message by printing the choices list from
dbPutString() in a way which invites copy+paste?
> Can't set "foo.SCAN" to "10 seconds" Extraneous characters
> Error at or before ")" in path "." file "badchoice.db" line 2
> dbLoadRecords: failed to load 'badchoice.db'
> Error: Failed to load: badchoice.db
might become
> Can't set "foo.SCAN" to "10 seconds" Extraneous characters
> Menu Choices:
> "Passive"
> "Event"
> "I/O Intr"
> "10 second"
> "5 second"
> "2 second"
> "1 second"
> ".5 second"
> ".2 second"
> ".1 second"
> Error at or before ")" in path "." file "badchoice.db" line 2
> dbLoadRecords: failed to load 'badchoice.db'
> Error: Failed to load: badchoice.db
> How about when putting to a menu field we do a second pass through the choice strings using epicsStrCaseCmp() so this kind of thing would be silently accepted? The first pass should still use strcmp() in case some IOC has choices (in mbbo strings) that only differ by case, but the second pass would accept the first to match even when the cases differ.
>
> We could make this configurable so sites could turn it off, or even have it display a warning, but I’m not sure who would really want that much strictness.
>
> I already wrote the code, although it could be posted as a Codeathon project instead (requiring tests and Release Notes as well).
>
> - Andrew
>
> --
> Complexity comes for free, simplicity you have to work for.
>
- Replies:
- Re: CaSe-IndepeDent Menu SEARches? Michael Davidsaver via Core-talk
- References:
- CaSe-IndepeDent Menu SEARches? Johnson, Andrew N. via Core-talk
- Navigate by Date:
- Prev:
CaSe-IndepeDent Menu SEARches? Johnson, Andrew N. via Core-talk
- Next:
Re: CaSe-IndepeDent Menu SEARches? Torsten Bögershausen via Core-talk
- 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:
CaSe-IndepeDent Menu SEARches? Johnson, Andrew N. via Core-talk
- Next:
Re: CaSe-IndepeDent Menu SEARches? Michael Davidsaver via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
<2021>
2022
2023
2024
|