Significantly revised, added stuff about default values.
This commit is contained in:
579
msi.html
579
msi.html
@@ -6,215 +6,400 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>msi: Macro Substitution and Include Tool</h1>
|
||||
Marty Kraimer <br>
|
||||
Argonne National Laboratory - Advanced Photon Source <br>
|
||||
Original: April 26, 1999
|
||||
|
||||
<blockquote>
|
||||
<p>Version 1.4, June 2004<br>
|
||||
Marty Kraimer (Advanced Photon Source, Argonne National Laboratory)</p>
|
||||
</blockquote>
|
||||
|
||||
<h2>Introduction</h2>
|
||||
msi is a general purpose macro substitution/include tool. It accepts as input
|
||||
an ascii template file. It looks for lines containing two reserved command
|
||||
names: include and substitute. It also looks for and performs substitutions
|
||||
on macros of the form $(var) and ${var}. It uses the macLib, an epics base
|
||||
library created by William Lupton, to perform the substitutions.
|
||||
|
||||
<p>msi is a general purpose macro substitution/include tool. It accepts as
|
||||
input an ascii template file. It looks for lines containing two reserved
|
||||
command names: include and substitute. It also looks for and performs
|
||||
substitutions on macros of the form $(var) and ${var}. It uses macLib, an EPICS
|
||||
Base library created by William Lupton, to perform the substitutions.</p>
|
||||
|
||||
<p>msi also allows substitutions to be specified via a separate substitution
|
||||
file. This substitution file allows the same format as the substitution files
|
||||
accepted by dbLoadTemplate or subtool. <br>
|
||||
</p>
|
||||
accepted by dbLoadTemplate or subtool.</p>
|
||||
|
||||
<h2>Command Syntax:</h2>
|
||||
|
||||
<pre>msi -V -ofile -Idir -Msub -Ssubfile template</pre>
|
||||
NOTE: All parameters are optional and a space is optional between -o,
|
||||
-I, -M, and -S and the associated value. Output is written to
|
||||
stdout unless the -o option is given.
|
||||
|
||||
<p>Where:</p>
|
||||
<p>All parameters are optional. The -o, -I, -M, and -S switches may be
|
||||
separated from their associated value string by spaces if desired. Output will
|
||||
be written to stdout unless the -o option is given.</p>
|
||||
|
||||
<p><tt>-V</tt></p>
|
||||
<ul>
|
||||
If this parameter is specified then an undefined macro is considered an
|
||||
error. An error message is generated and when msi terminates it will do so
|
||||
with an exit status of 2.
|
||||
<p>Switches have the following meanings:</p>
|
||||
|
||||
<p></p>
|
||||
</ul>
|
||||
<tt>-o file</tt>
|
||||
<ul>
|
||||
Output will be written to the specifed file rather than to the standard
|
||||
output.
|
||||
|
||||
<p></p>
|
||||
</ul>
|
||||
<tt>-I dir</tt>
|
||||
<ul>
|
||||
This parameter, which may be repeated, specifies a search path for include
|
||||
commands. For example:</ul>
|
||||
<dl>
|
||||
<dd><tt> msi -I "/home/phoebus/MRK/examples:." -I".."
|
||||
template</tt></dd>
|
||||
<dt><tt>-V</tt></dt>
|
||||
<dd>If this parameter is specified then any undefined macro discovered in
|
||||
the template file which does not have an associated default value is
|
||||
considered an error. An error message is generated and when msi terminates
|
||||
it will do so with an exit status of 2.</dd>
|
||||
|
||||
<dt><tt>-o</tt> <i>file</i></dt>
|
||||
<dd>Output will be written to the specifed file rather than to the standard
|
||||
output.</dd>
|
||||
|
||||
<dt><tt>-I</tt> <i>dir</i></dt>
|
||||
<dd>This parameter, which may be repeated, specifies a search path for
|
||||
include commands. For example:
|
||||
|
||||
<blockquote>
|
||||
<pre>msi -I "/home/phoebus/MRK/examples:." -I".." template</pre>
|
||||
</blockquote>
|
||||
|
||||
specifies that all named files should be searched for in the following
|
||||
locations in the order given:
|
||||
|
||||
<ol>
|
||||
<li><tt>/home/phoebus/MRK/examples</tt></li>
|
||||
<li><tt>.</tt> (the current directory)</li>
|
||||
<li><tt>..</tt> (the parent of the current directory)</li>
|
||||
</ol>
|
||||
</dd>
|
||||
|
||||
<dt><tt>-M</tt> <i>substitutions</i></dt>
|
||||
<dd>This parameter specifies macro values for the template instance.
|
||||
Multiple macro values can be specified in one substitution parameter, or in
|
||||
multiple <tt>-M</tt> parameters. For example:
|
||||
|
||||
<blockquote>
|
||||
<pre>msi -M "a=aval,b=bval" -Mc=cval template</pre>
|
||||
</blockquote>
|
||||
|
||||
specifies that in the template file each occurrence of:
|
||||
|
||||
<dl>
|
||||
<dd><tt>$(a)</tt> or <tt>${a}</tt> is replaced by <tt>aval</tt></dd>
|
||||
<dd><tt>$(b)</tt> or <tt>${b}</tt> is replaced by <tt>bval</tt></dd>
|
||||
<dd><tt>$(c)</tt> or <tt>${c}</tt> is replaced by <tt>cval</tt></dd>
|
||||
</dl>
|
||||
</dd>
|
||||
|
||||
<dt><tt>-S</tt> <i>subfile</i></dt>
|
||||
<dd>The substitution file. See below for format.</dd>
|
||||
|
||||
<dt><i>template</i></dt>
|
||||
<dd> The input file. If no file is specified then input is taken from
|
||||
stdin, i.e. msi can be used as a filter. See below for a description of
|
||||
commands that can be embedded in the template file.</dd>
|
||||
</dl>
|
||||
<dd>specifies the search path:</dd>
|
||||
<dd><tt> /home/phoebus/MRK/examples:.:..</tt></dd>
|
||||
<br>
|
||||
-M substitutions
|
||||
<ul>
|
||||
This parameter, which may be repeated, specifies marco substitutions. For
|
||||
example:</ul>
|
||||
<dl>
|
||||
<dd><tt> msi -M "a=aval,b=bval" -M"c=cval"
|
||||
template</tt></dd>
|
||||
</dl>
|
||||
<ul>
|
||||
specifies that in the template file each occurrence of:</ul>
|
||||
<ul>
|
||||
<dl>
|
||||
<dd>$(a) or ${a} is replaced by aval</dd>
|
||||
</dl>
|
||||
<dd>$(b) or ${b} is replaced by bval</dd>
|
||||
<dd>$(c) or ${c} is replaced by cval</dd>
|
||||
</ul>
|
||||
-S subfile
|
||||
<ul>
|
||||
The substitution file. See below for format.</ul>
|
||||
template
|
||||
<ul>
|
||||
The input file. If no file is specified then input is taken from stdin,
|
||||
i.e. msi can be used as a filter. See below for a description of commands
|
||||
that can be embedded in the template file.</ul>
|
||||
NOTE: It is not possible to display usage by just typing <tt>msi</tt> since
|
||||
executing the command with no arguments i s a valid command. To show usage
|
||||
specify an illegal switch, e.g.
|
||||
<ul>
|
||||
</ul>
|
||||
|
||||
<p>It is not possible to display usage by just typing <tt>msi</tt> since
|
||||
executing the command with no arguments is a valid command. To show usage
|
||||
specify an illegal switch, e.g.</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>msi -help</pre>
|
||||
</blockquote>
|
||||
|
||||
<h2>Exit Status</h2>
|
||||
|
||||
<dl>
|
||||
<dt>0<dd>Success.
|
||||
<dt>1<dd>Can't open/create file, or other I/O error.
|
||||
<dt>2<dd>Undefined macros encountered with the <tt>-V</tt> option specified.
|
||||
</dl>
|
||||
|
||||
<h2>Template File Format</h2>
|
||||
This file contains the text to be read and written to the output after macro
|
||||
|
||||
<p>This file contains the text to be read and written to the output after macro
|
||||
substitution is performed. If no file is given then input is read from stdin.
|
||||
In addition the file can have lines containing include and substitute
|
||||
commands. The format of these commands are:
|
||||
<pre> include "file"</pre>
|
||||
<pre> substitute "var=value,var=value,..."</pre>
|
||||
For example let the command be:
|
||||
<pre> msi template</pre>
|
||||
and file includeFile contain:
|
||||
<pre> first name is ${first}
|
||||
family name is ${family}</pre>
|
||||
and template is <br>
|
||||
|
||||
<pre> substitute "first=Marty,family=Kraimer"
|
||||
include "includeFile"
|
||||
substitute "first=Irma,family=Kraimer"
|
||||
include "includeFile"</pre>
|
||||
then the following is written to the output.
|
||||
<pre> first name is Marty
|
||||
family name is Kraimer
|
||||
first name is Irma
|
||||
family name is Kraimer</pre>
|
||||
Variable instances to be substituted by macro values are expressed in the
|
||||
template using the syntax <tt>$(</tt><i>name</i><tt>)</tt> or
|
||||
<tt>${</tt><i>name</i><tt>}</tt>. If msi has been built with EPICS Base version
|
||||
3.14.7 or later, the template can also provide default values to be used when a
|
||||
macro has not been given a value, using the syntax
|
||||
<tt>$(</tt><i>name</i><tt>=</tt><i>default</i><tt>)</tt> or
|
||||
<tt>${</tt><i>name</i><tt>=</tt><i>default</i><tt>}</tt>.</p>
|
||||
|
||||
<p>For example, using the command</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>msi -M name=Marty template</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>where the file template contains</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>My name is $(name)
|
||||
My age is $(age=none of your business)</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>results in this output:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>My name is Marty
|
||||
My age is none of your business</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>Macro variables and their default values can be expressed in terms of other
|
||||
macros if necessary, to almost any level of complexity. Recursive definitions
|
||||
will generate warning messages on stderr and result in undefined output.</p>
|
||||
|
||||
<p>The template file is read and processed one line at a time, where the
|
||||
maximum length of a line before and/or after macro expansion is 1023 characters
|
||||
— longer input or output lines will cause msi to fail. Within the context
|
||||
of a single line, macro expansion does not occur when the variable instance
|
||||
appears inside a single-quoted string, or where the dollar sign <tt>$</tt> is
|
||||
preceded by a back-slash character <tt>\</tt>, but as with the standard Unix
|
||||
shells, variables inside double quoted strings are expanded properly.</p>
|
||||
|
||||
<p>However neither back-slash characters nor quotes or either variety are
|
||||
removed when generating the output file, so depending on what is being output
|
||||
the single quote behaviour may not be useful and may even be a hinderance. It
|
||||
cannot be disabled in the current version of msi.</p>
|
||||
|
||||
<h3>Template file commands</h3>
|
||||
|
||||
<p>In addition to the regular text and variable instances described above, the
|
||||
template file may also contain commands which allow the insertion of other
|
||||
template files and the ability to set macro values inside the template file
|
||||
itself. These commands are:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>include "file"
|
||||
substitute "var=value,var=value,..."</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>Lines containing commands must be in one of these forms:</p>
|
||||
|
||||
<ul>
|
||||
<li><tt>include "</tt><i>filename</i><tt>"</tt></li>
|
||||
<li><tt>substitute "</tt><i>name1=value1, name2=value2, ...</i><tt>"</tt></li>
|
||||
</ul>
|
||||
|
||||
<p>White space is allowed before and after the command verb, and after the
|
||||
quoted string. If embedded quotes are needed, the backslash character
|
||||
<tt>\</tt> can be used as an escape character. For example</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>substitute "a=\"val\""</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>specifies that (unless <tt>a</tt> is subsequently redefined) wherever a
|
||||
<tt>$(a)</tt> macro appears in the template below this point, the text
|
||||
<tt>"val"</tt> (including the double quote characters) will appear in the
|
||||
output instead.</p>
|
||||
|
||||
<p>If a line does match either syntax above it is just passed to macLib for
|
||||
processing without any notification. Thus the input line:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>include "myfile" #include file</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>would just be passed to macLib, i.e. it would <em>not</em> be considered an
|
||||
include command.</p>
|
||||
|
||||
<p>As an example of these commands, let the Unix command be:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>msi template</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>and file includeFile contain:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>first name is ${first}
|
||||
family name is ${family}</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>and template is</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>substitute "first=Marty,family=Kraimer"
|
||||
include "includeFile"
|
||||
substitute "first=Irma,family=Kraimer"
|
||||
include "includeFile"</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>then the following is written to the output.</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>first name is Marty
|
||||
family name is Kraimer
|
||||
first name is Irma
|
||||
family name is Kraimer</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>Note that on an IOC when using the <tt>dbLoadTemplate</tt> command, the
|
||||
template file does not support the <tt>substitute</tt> command, although
|
||||
<tt>include</tt> is supported.</p>
|
||||
|
||||
<h2>Substitution File Format</h2>
|
||||
The optional substitution file has three formats: regular, pattern, and
|
||||
dbTemplate format. Lets discuss each separately <br>
|
||||
|
||||
|
||||
<h3>regular format</h3>
|
||||
<p>The optional substitution file has three formats: regular, pattern, and
|
||||
dbTemplate format. We will discuss each separately.</p>
|
||||
|
||||
<h3>Regular format</h3>
|
||||
|
||||
<blockquote>
|
||||
<pre>{var1=value1,var2=value2,...}
|
||||
{var1=value1,var2=value2,...}
|
||||
...</pre>
|
||||
<pre>{var1=set1_val1, var2=set1_val2, ...}
|
||||
{var2=set2_val2, var1=set2_val1, ...}
|
||||
{var1=set3_val1, var2=set3_val2, ...}
|
||||
{var2=set4_val2, var1=set4_val1, ...}</pre>
|
||||
</blockquote>
|
||||
After reading each set of replacements within braces, the
|
||||
template file is read and macro substitution performed. <br>
|
||||
|
||||
|
||||
<h3>pattern format:</h3>
|
||||
<p>The template file is output with macro substitutions performed once for each
|
||||
set of braces containing macro replacement values.</p>
|
||||
|
||||
<h3>Pattern format</h3>
|
||||
|
||||
<blockquote>
|
||||
<pre>pattern {var1,var2,...}
|
||||
{value1,value2,...}
|
||||
{value1,value2,...}
|
||||
pattern {var1,var2,...}
|
||||
{value1,value2,...}
|
||||
{value1,value2,...}</pre>
|
||||
<pre>pattern {var1, var2, ...}
|
||||
{set1_val1, set1_val2, ...}
|
||||
{set2_val1, set2_val2, ...}
|
||||
pattern {var2, var1, ...}
|
||||
{set3_val2, set3_val1, ...}
|
||||
{set4_val2, set4_val2, ...}</pre>
|
||||
</blockquote>
|
||||
This is the same as the regular format:
|
||||
|
||||
<blockquote>
|
||||
<pre>{var1=value1,var2=value2}
|
||||
...</pre>
|
||||
</blockquote>
|
||||
<p>This produces the same result as the regular format example above.</p>
|
||||
|
||||
<h3>dbTemplate Format</h3>
|
||||
|
||||
<p>This format is an extension of the format accepted by the EPICS IOC command
|
||||
<tt>dbLoadTemplate</tt>, and allows templates to be expanded on the host rather
|
||||
by using dbLoadTemplate at IOC boot time.</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>file template {
|
||||
pattern format or regular format
|
||||
}</pre>
|
||||
<pre>file template {
|
||||
pattern format or regular format
|
||||
<pre>file template {
|
||||
<i>pattern format or regular format</i>
|
||||
}
|
||||
file "${WHERE}/template2" {
|
||||
<i>pattern format or regular format</i>
|
||||
}</pre>
|
||||
</blockquote>
|
||||
For the template format, the command line template argument is optional. If
|
||||
it specified it is used, otherwise the file template is used. This format is
|
||||
an extension of the format accepted by dbLoadTemplate. It allows templates to
|
||||
be expanded on the host rather via dbLoadTemplate. The file name may
|
||||
appear inside double quotation marks; these are only required if the name
|
||||
contains any environment variable macros of the form ${ENV_VAR} which will be
|
||||
expanded before the file is opened. Environment variable macro expansion
|
||||
is available when msi is linked with EPICS base R3.14.3 or newer.
|
||||
|
||||
<p>For the dbTemplate format, the template filename does not have to be given
|
||||
on the command line, and is usually specified in the substitutions file
|
||||
instead. If a template filename is given on the command line it will override
|
||||
the filenames listed in the substitutions files.</p>
|
||||
|
||||
<h3>Syntax for all formats</h3>
|
||||
|
||||
<p>A comment line may appear anywhere in a substitution file, and will be
|
||||
ignored. A comment line is any line beginning with the character <tt>#</tt>,
|
||||
which must be the very first character on the line.</p>
|
||||
|
||||
<p>For definitions within braces given in any of the file formats, a separator
|
||||
must be given between items. A separator is either a comma, or one or more of
|
||||
the standard white space characters (space, formfeed, newline, carriage return,
|
||||
tab or vertical tab).</p>
|
||||
|
||||
<p>Each item within braces can be an alphanumeric token, or a double-quoted
|
||||
string. A back-slash character <tt>\</tt> can be used to escape a quote
|
||||
character needed inside a quoted string. These three sets of substitutions are
|
||||
all equivalent:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>{a=aa b=bb c="\"cc\""}
|
||||
{b="bb",a=aa,c="\"cc\""}
|
||||
{
|
||||
c="\"cc\""
|
||||
b=bb
|
||||
a="aa"
|
||||
}</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>Within a substitutions file, the file name may appear inside double
|
||||
quotation marks; these are only required if the name contains environment
|
||||
variable macros of the form ${ENV_VAR} or $(ENV_VAR), which will be expanded
|
||||
before the file is opened. Environment variable macro expansion is only
|
||||
available when msi has been built using EPICS base R3.14.3 or newer.</p>
|
||||
|
||||
<h3>Regular substitution example</h3>
|
||||
Let the command be:
|
||||
<pre> msi -S substitute template</pre>
|
||||
<tt>template</tt> is
|
||||
<pre> first name is ${first}
|
||||
family name is ${family}</pre>
|
||||
<tt>substitute</tt> is
|
||||
<pre> {first=Marty,family=Kraimer}
|
||||
{first=Irma,family=Kraimer}</pre>
|
||||
The following is written to the output.
|
||||
<pre> first name is Marty
|
||||
family name is Kraimer
|
||||
first name is Irma
|
||||
family name is Kraimer</pre>
|
||||
|
||||
<p>Let the command be:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>msi -S substitute template</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>The file <tt>template</tt> contains</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>first name is ${first}
|
||||
family name is ${family}</pre>
|
||||
</blockquote>
|
||||
|
||||
<p> and the file <tt>substitute</tt> is</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>{first=Marty,family=Kraimer}
|
||||
{first=Irma,family=Kraimer}</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>The following is the output produced:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>first name is Marty
|
||||
family name is Kraimer
|
||||
first name is Irma
|
||||
family name is Kraimer</pre>
|
||||
</blockquote>
|
||||
|
||||
<h3>Pattern substitution example</h3>
|
||||
Let the command be:
|
||||
<pre> msi -S pattern template</pre>
|
||||
<tt>pattern</tt> is
|
||||
<pre> pattern {first,last}
|
||||
{Marty,Kraimer}
|
||||
{Irma,Kraimer}</pre>
|
||||
<tt>template</tt> is the same as in the previous example.
|
||||
|
||||
<p>The following is written to the output.</p>
|
||||
<pre> first name is Marty
|
||||
family name is Kraimer
|
||||
first name is Irma
|
||||
family name is Kraimer</pre>
|
||||
<p>Let the command be:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>msi -S pattern template</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>The file <tt>pattern</tt> contains</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>pattern {first,last}
|
||||
{Marty,Kraimer}
|
||||
{Irma,Kraimer}</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>and <tt>template</tt> is the same as the previous example:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>first name is ${first}
|
||||
family name is ${family}</pre>
|
||||
</blockquote>
|
||||
|
||||
<p>This is the output:</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>first name is Marty
|
||||
family name is Kraimer
|
||||
first name is Irma
|
||||
family name is Kraimer</pre>
|
||||
</blockquote>
|
||||
|
||||
<h3>dbTemplate example</h3>
|
||||
Let the command be
|
||||
|
||||
<blockquote>
|
||||
<pre>msi -S xxx.substitutions</pre>
|
||||
<pre>msi -S xxx.substitutions</pre>
|
||||
</blockquote>
|
||||
|
||||
<tt>xxx.substitutions</tt> is
|
||||
|
||||
<blockquote>
|
||||
<pre>file template {
|
||||
pattern {first,last}
|
||||
{Marty,Kraimer}
|
||||
{Irma,Kraimer}
|
||||
pattern {last,first}
|
||||
{Smith,Bill}
|
||||
{Smith,Mary}
|
||||
<pre>file template {
|
||||
pattern {first,last}
|
||||
{Marty,Kraimer}
|
||||
{Irma,Kraimer}
|
||||
pattern {last,first}
|
||||
{Smith,Bill}
|
||||
{Smith,Mary}
|
||||
}
|
||||
file template {
|
||||
{first=Marty,last=Kraimer}
|
||||
{first=Irma,last=Kraimer}
|
||||
{first=Marty,last=Kraimer}
|
||||
{first=Irma,last=Kraimer}
|
||||
}</pre>
|
||||
</blockquote>
|
||||
<tt>template</tt> is the same as in the previous example..
|
||||
@@ -222,7 +407,7 @@ file template {
|
||||
<p>The following is written to the output</p>
|
||||
|
||||
<blockquote>
|
||||
<pre>first name is Marty
|
||||
<pre>first name is Marty
|
||||
family name is Kraimer
|
||||
first name is Irma
|
||||
family name is Kraimer
|
||||
@@ -236,77 +421,13 @@ first name is Irma
|
||||
family name is Kraimer</pre>
|
||||
</blockquote>
|
||||
|
||||
<h2>Some Details</h2>
|
||||
Building msi
|
||||
<ul>
|
||||
msi is built as a normal extensions product. It should be built with base
|
||||
version 3.13.0beta11 or later.</ul>
|
||||
<dl>
|
||||
<dt>Line length limits</dt>
|
||||
</dl>
|
||||
<ul>
|
||||
All buffers containing input or output lines are set for a maximum line
|
||||
length of 1024. Longer input or output lines will cause msi to fail.</ul>
|
||||
macLib
|
||||
<ul>
|
||||
Currently the only macLib documentation is in macLibNOTES and macLibREADME
|
||||
which are in base/src/libCom.</ul>
|
||||
template file syntax
|
||||
<ul>
|
||||
except for lines containing include or substitute commands each line is
|
||||
just passed to macLib. Lines containing these commands MUST be of the
|
||||
form:</ul>
|
||||
<pre> include "<file name>"</pre>
|
||||
<pre> or</pre>
|
||||
<pre> substitute "<substitutions>"</pre>
|
||||
<ul>
|
||||
White space is allowed before and after the command and after the quoted
|
||||
string. If embedded quotes are needed the \ character can be used as an
|
||||
escape character. For example:</ul>
|
||||
<pre> substitute "a=\"val\""</pre>
|
||||
<ul>
|
||||
specifies the substitution</ul>
|
||||
<pre> a=val</pre>
|
||||
<ul>
|
||||
If a line does have the above syntax it is just passed to macLib for
|
||||
processing without any notification. Thus the input line:</ul>
|
||||
<pre> include "myfile" #include file</pre>
|
||||
<ul>
|
||||
would just be passed to macLib, i.e. it would NOT be considered an include
|
||||
command.</ul>
|
||||
substitution file syntax
|
||||
<ul>
|
||||
A comment line may appear anywhere and is just ignored. A comment line is
|
||||
any line beginning with the character #, which MUST be the very first
|
||||
character of the comment line.
|
||||
<h2>Building msi</h2>
|
||||
|
||||
<p>For items within braces separators may be given between items. A
|
||||
separator is either white space or a comma. White space is any of the
|
||||
following: space, formfeed, newline, carriage return, tab, vertical tab.</p>
|
||||
<p>msi is built as a normal extensions product, and can be built with any
|
||||
version of EPICS Base from 3.13.0beta11 onwards. Base version 3.14.3 or later
|
||||
is required if the ability to expand environment variables in filenames is
|
||||
needed. Base version 3.14.7 or later is required to allow the use of default
|
||||
macro values in template files.</p>
|
||||
|
||||
<p>Each item within braces can be an alphanumeric token or a quoted string.
|
||||
The characters \" can be used for embedded quotes. The rules for non quoted
|
||||
strings are actually more relaxed but any item that is not an alphanumeric
|
||||
string should be given as a quoted string.</p>
|
||||
|
||||
<p>Thus</p>
|
||||
</ul>
|
||||
<pre> {a=aa b=bb c="\"cc\""}</pre>
|
||||
and
|
||||
<pre> {a=aa,b=bb,c="\"cc\""}</pre>
|
||||
and
|
||||
<pre> {
|
||||
a="aa"
|
||||
b="bb",
|
||||
c="\"cc\""
|
||||
}</pre>
|
||||
are all equivalent.
|
||||
|
||||
<p></p>
|
||||
|
||||
<h2>Exit Status</h2>
|
||||
<p>0 - Success.</p>
|
||||
<p>1 - Can't open/create file, or other I/O error.</p>
|
||||
<p>2 - <b>-V</b> option specified and one or more undefined macros were encountered.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user