/autotools/autogen.html_node/apply-code.html
HTML | 171 lines | 128 code | 9 blank | 34 comment | 0 complexity | fc534075d558fcb45c033f301adb3c5c MD5 | raw file
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html401/loose.dtd">
- <html>
- <!-- This manual is for GNU AutoGen version 5.18, updated August 2015.
- Copyright C 1992-2015 by Bruce Korb.
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.2 or
- any later version published by the Free Software Foundation; with no
- Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
- -->
- <!-- Created on August 21, 2015 by texi2html 1.82
- texi2html was written by:
- Lionel Cons <Lionel.Cons@cern.ch> (original author)
- Karl Berry <karl@freefriends.org>
- Olaf Bachmann <obachman@mathematik.uni-kl.de>
- and many others.
- Maintained by: Many creative people.
- Send bugs and suggestions to <texi2html-bug@nongnu.org>
- -->
- <head>
- <title>GNU AutoGen - The Automated Program Generator: 3.3.1 Apply Code</title>
- <meta name="description" content="GNU AutoGen - The Automated Program Generator: 3.3.1 Apply Code">
- <meta name="keywords" content="GNU AutoGen - The Automated Program Generator: 3.3.1 Apply Code">
- <meta name="resource-type" content="document">
- <meta name="distribution" content="global">
- <meta name="Generator" content="texi2html 1.82">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <style type="text/css">
- <!--
- a.summary-letter {text-decoration: none}
- blockquote.smallquotation {font-size: smaller}
- pre.display {font-family: serif}
- pre.format {font-family: serif}
- pre.menu-comment {font-family: serif}
- pre.menu-preformatted {font-family: serif}
- pre.smalldisplay {font-family: serif; font-size: smaller}
- pre.smallexample {font-size: smaller}
- pre.smallformat {font-family: serif; font-size: smaller}
- pre.smalllisp {font-size: smaller}
- span.roman {font-family:serif; font-weight:normal;}
- span.sansserif {font-family:sans-serif; font-weight:normal;}
- ul.toc {list-style: none}
- -->
- </style>
- <link rel="stylesheet" type="text/css" href="/software/gnulib/manual.css">
- </head>
- <body lang="en" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#800080" alink="#FF0000">
- <a name="apply-code"></a>
- <table cellpadding="1" cellspacing="1" border="0">
- <tr><td valign="middle" align="left">[<a href="expression-syntax.html#expression-syntax" title="Previous section in reading order"> < </a>]</td>
- <td valign="middle" align="left">[<a href="basic-expression.html#basic-expression" title="Next section in reading order"> > </a>]</td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left">[<a href="Template-File.html#Template-File" title="Beginning of this chapter or previous chapter"> << </a>]</td>
- <td valign="middle" align="left">[<a href="expression-syntax.html#expression-syntax" title="Up section"> Up </a>]</td>
- <td valign="middle" align="left">[<a href="Augmenting-AutoGen.html#Augmenting-AutoGen" title="Next chapter"> >> </a>]</td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
- <td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
- <td valign="middle" align="left">[<a href="AutoOpts.html#AutoOpts" title="Index">Index</a>]</td>
- <td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
- </tr></table>
- <hr size="1">
- <a name="Apply-Code"></a>
- <h3 class="subsection">3.3.1 Apply Code</h3>
- <p>The "apply code" selected determines the method of evaluating the
- expression. There are five apply codes, including the non-use
- of an apply code.
- </p>
- <dl compact="compact">
- <dt> ‘<samp>no apply code</samp>’</dt>
- <dd><p>This is the most common expression type.
- Expressions of this sort come in three flavors:
- </p>
- <dl compact="compact">
- <dt> ‘<samp><value-name></samp>’</dt>
- <dd><p>The result is the value of <var>value-name</var>, if defined.
- Otherwise it is the empty string.
- </p>
- </dd>
- <dt> ‘<samp><basic-expr></samp>’</dt>
- <dd><p>The result of the basic expression is the result of the full expression,
- See section <a href="basic-expression.html#basic-expression">Basic Expression</a>.
- </p>
- </dd>
- <dt> ‘<samp><value-name> <basic-expr></samp>’</dt>
- <dd><p>If there is a defined value for <var>value-name</var>, then the <var>basic-expr</var>
- is evaluated. Otherwise, the result is the empty string.
- </p></dd>
- </dl>
- </dd>
- <dt> ‘<samp>% <value-name> <basic-expr></samp>’</dt>
- <dd><p>If <var>value-name</var> is defined, use <var>basic-expr</var> as a format
- string for sprintf. Then, if the <var>basic-expr</var> is either a back-quoted
- string or a parenthesized expression, then hand the result to the
- appropriate interpreter for further evaluation. Otherwise, for single
- and double quote strings, the result is the result of the sprintf operation.
- Naturally, if <var>value-name</var> is not defined, the result is the empty
- string.
- </p>
- <p>For example, assume that ‘<samp>fumble</samp>’ had the string value, ‘<samp>stumble</samp>’:
- </p><table><tr><td> </td><td><pre class="example">[+ % fumble `printf '%%x\\n' $%s` +]
- </pre></td></tr></table>
- <p>This would cause the shell to evaluate "‘<samp>printf '%x\n' $stumble</samp>’".
- Assuming that the shell variable ‘<samp>stumble</samp>’ had a numeric value,
- the expression result would be that number, in hex. Note the need
- for doubled percent characters and backslashes.
- </p>
- </dd>
- <dt> ‘<samp>? <value-name> <basic-expr-1> <basic-expr-2></samp>’</dt>
- <dd><p>Two <var>basic-expr</var>-s are required. If the <var>value-name</var> is
- defined, then the first <var>basic-expr-1</var> is evaluated, otherwise
- <var>basic-expr-2</var> is.
- </p>
- </dd>
- <dt> ‘<samp>- <value-name> <basic-expr></samp>’</dt>
- <dd><p>Evaluate <var>basic-expr</var> only if <var>value-name</var> is <i>not</i> defined.
- </p>
- </dd>
- <dt> ‘<samp>?% <value-name> <basic-expr-1> <basic-expr-2></samp>’</dt>
- <dd><p>This combines the functions of ‘<samp>?</samp>’ and ‘<samp>%</samp>’. If <var>value-name</var> is
- defined, it behaves exactly like ‘<samp>%</samp>’, above, using <var>basic-expr-1</var>.
- If not defined, then <var>basic-expr-2</var> is evaluated.
- </p>
- <p>For example, assume again that ‘<samp>fumble</samp>’ had the string value,
- ‘<samp>stumble</samp>’:
- </p><table><tr><td> </td><td><pre class="example">[+ ?% fumble `cat $%s` `pwd` +]
- </pre></td></tr></table>
- <p>This would cause the shell to evaluate "‘<samp>cat $stumble</samp>’".
- If ‘<samp>fumble</samp>’ were not defined, then the result would be the name
- of our current directory.
- </p></dd>
- </dl>
- <hr size="1">
- <table cellpadding="1" cellspacing="1" border="0">
- <tr><td valign="middle" align="left">[<a href="expression-syntax.html#expression-syntax" title="Previous section in reading order"> < </a>]</td>
- <td valign="middle" align="left">[<a href="basic-expression.html#basic-expression" title="Next section in reading order"> > </a>]</td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left">[<a href="Template-File.html#Template-File" title="Beginning of this chapter or previous chapter"> << </a>]</td>
- <td valign="middle" align="left">[<a href="expression-syntax.html#expression-syntax" title="Up section"> Up </a>]</td>
- <td valign="middle" align="left">[<a href="Augmenting-AutoGen.html#Augmenting-AutoGen" title="Next chapter"> >> </a>]</td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left"> </td>
- <td valign="middle" align="left">[<a href="autogen.html#Top" title="Cover (top) of document">Top</a>]</td>
- <td valign="middle" align="left">[<a href="autogen_toc.html#SEC_Contents" title="Table of contents">Contents</a>]</td>
- <td valign="middle" align="left">[<a href="AutoOpts.html#AutoOpts" title="Index">Index</a>]</td>
- <td valign="middle" align="left">[<a href="autogen_abt.html#SEC_About" title="About (help)"> ? </a>]</td>
- </tr></table>
- <p>
- <font size="-1">
- This document was generated by <em>Bruce Korb</em> on <em>August 21, 2015</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.
- </font>
- <br>
- </p>
- </body>
- </html>