Dear
All,
With respect to the
proposed changes to msi, we have some questions of usage and meaning of the
"global variables" feature for consideration.
(1) We make use of
the default value syntax in templates, so that a default value is supplied if no
value is specified in the substitution file, effectively defining "optional"
macros.
This allows us to add
new macro definitions to a template to handle new situations without
invalidating existing substitution files for an existing IOC, whilst still
completing the expansion.
In example.template
file:
record(ao,
"$(device):RLY:SETSP") { field(DESC,
"$(rlysp_desc=$(device))") field(FLNK, "$(device):RLY:SEQ")
field(EGU, "mbar") field(PREC, "1") field(HOPR,
"$(rlysp_hopr=1.2e2)") field(LOPR, "$(rlysp_lopr=2.7e-3)")
field(DRVH, "$(rlysp_drvh=1.2e2)") field(DRVL,
"$(rlysp_drvl=2.7e-3)") field(DOL,
"$(rlysp_level=1.0e-2)") }
In
example.substitution file:
file
example.template { pattern
{device} {EXMPL-VA-EX-01} }
file
example.template { pattern
{device,rlysp_level,rlysp_high} {EXMPL-VA-EX-02,7,7.1} }
file
example.template { pattern
{device,rlysp_level,rlysp_high,rlysp_hihi,rlysp_drvh,rlysp_hopr} {EXMPL-VA-EX-03,1000,1100,1200,1200,1200} }
When we
first tried this, we were using the old msi with the fall-through behaviour
and it did not work properly.
We upgraded
to the newer scoped msi and the defaulting behaviour worked sensibly
for us as apparently intended.
As a
result we also discovered several problems in our systems where the
fall-through feature had expanded some macros that had been entirely
unintentionally missed of patterns in substitution files and hid the fact that
macros had not been defined correctly for some templates, nicely illustrating
the disadvantage of global variables.
So the question
is how do the two features of global definitions versus macro default
values sit together? Does a global definition in a substitution file
override a default definition of a macro of the same name in a template or vice
versa?
Presumably a value
specified in substitution pattern overrides a global defined
value?
Also can we be
assured that changes to the behaviour for missing macros and empty lists, etc
under discussion would not break this usage?
(2) At what level are
these truly globals? Since a database can be partially expanded again
and again, will the global definitions be passed on to the expanded file
recursively?
(3) We concatenate
substitution files and database files together as part of our build.
Introducing global sections that only go out of scope at the end of a file could
become interesting, since there way to "ifdef" or "undef" in files
that will become part of a larger one and there is no proposed syntax to
delineate their actual scope. We probably won't be definining global
variables in our systems, however we do use other people's modules so we would
be concerned about side effects if widespread use of global variables appeared
in synapps, for instance. Would a naming convention be
useful?
Linda Pratt
Software Systems Engineer
Controls Department
[email protected]
+44 (0)1235 778058
www.diamond.ac.uk
Diamond Light
Source Ltd
Diamond
House
Harwell Science and
Innovation Campus
DIDCOT
Oxfordshire
OX11
0DE
UK
--
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
|