On Jan 13, 2021, at 7:03 AM, Heinz Junkes via Core-talk <core-talk at aps.anl.gov> wrote:
In EPICS 7, a macro IOCFUNCDEF_HAS_USAGE is defined in ioch.h.
Taking that into account, my code looks like this (it's not "pretty") :
----
static const iocshFuncDef rtshellFuncDef = { “rt”,2, rtshellArgs
#ifdef IOCFUNCDEF_HAS_USAGE
,
“run rtems shell command”
#endif
};
----
How do you get it to look nice?
It doesn’t look as bad if you don’t use that huge indentation (personally I dislike that indent style, it gets line-wrapped in emails and any changes to the variable name mean you have to redo the number of spaces in the indentation of all the
lines below it). I would probably write it like this:
static const iocshFuncDef rtshellFuncDef = {
“rt”, 2, rtshellArgs
#ifdef IOCFUNCDEF_HAS_USAGE
, “run rtems shell command”
#endif
};
You could also define your own macro:
#ifdef IOCFUNCDEF_HAS_USAGE
#define IOCSH_USAGE(msg) ,msg
#else
#define IOCSH_USAGE(msg)
#endif
Then the code becomes:
static const iocshFuncDef rtshellFuncDef = {
“rt”, 2, rtshellArgs
IOCSH_USAGE(“run rtems shell command”)
};
- Andrew
--
Complexity comes for free, simplicity you have to work for.
|