Parameter-Mode.html 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <html lang="en">
  2. <head>
  3. <title>Parameter Mode - avram - a virtual machine code interpreter</title>
  4. <meta http-equiv="Content-Type" content="text/html">
  5. <meta name="description" content="avram - a virtual machine code interpreter">
  6. <meta name="generator" content="makeinfo 4.13">
  7. <link title="Top" rel="start" href="index.html#Top">
  8. <link rel="up" href="Modes-of-Operation.html#Modes-of-Operation" title="Modes of Operation">
  9. <link rel="prev" href="Filter-Mode.html#Filter-Mode" title="Filter Mode">
  10. <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
  11. <meta http-equiv="Content-Style-Type" content="text/css">
  12. <style type="text/css"><!--
  13. pre.display { font-family:inherit }
  14. pre.format { font-family:inherit }
  15. pre.smalldisplay { font-family:inherit; font-size:smaller }
  16. pre.smallformat { font-family:inherit; font-size:smaller }
  17. pre.smallexample { font-size:smaller }
  18. pre.smalllisp { font-size:smaller }
  19. span.sc { font-variant:small-caps }
  20. span.roman { font-family:serif; font-weight:normal; }
  21. span.sansserif { font-family:sans-serif; font-weight:normal; }
  22. --></style>
  23. </head>
  24. <body>
  25. <div class="node">
  26. <a name="Parameter-Mode"></a>
  27. <p>
  28. Previous:&nbsp;<a rel="previous" accesskey="p" href="Filter-Mode.html#Filter-Mode">Filter Mode</a>,
  29. Up:&nbsp;<a rel="up" accesskey="u" href="Modes-of-Operation.html#Modes-of-Operation">Modes of Operation</a>
  30. <hr>
  31. </div>
  32. <h4 class="subsection">1.2.2 Parameter Mode</h4>
  33. <p><a name="index-parameter-mode-24"></a>In parameter mode, the argument to the function given by the virtual
  34. code is a data structure containing environment variables and command
  35. line parameters including files, application specific options, and
  36. possibly standard input. The result obtained by evaluating the
  37. function is either a data structure representing a set of files to be
  38. written, which may include standard output, or a sequence of shell
  39. commands to be executed, or a combination of both. Parameter mode is
  40. indicated whenever either of these conditions is met.
  41. <ul>
  42. <li>Any of the parameter mode options appears on the
  43. command line preceding the first filename parameter.
  44. See <a href="Parameter-Mode-Options.html#Parameter-Mode-Options">Parameter Mode Options</a>.
  45. <li>At least one additional filename parameter or option follows the first
  46. filename parameter, and the option <samp><span class="option">--unparameterized</span></samp> does not
  47. precede it.
  48. </ul>
  49. <p class="noindent">Examples:
  50. <dl>
  51. <dt><kbd>avram --map-to-each-file prettyprinter.avm *.c *.h --extra-pretty</kbd><dd>In this example, parameter mode is indicated both by the parameter
  52. mode option <samp><span class="option">--map-to-each-file</span></samp> and by the presence of input
  53. file names and the <samp><span class="option">--extra-pretty</span></samp> option. The latter is
  54. specific to the hypothetical <code>prettyprinter.avm</code> virtual code
  55. application, as indicated by its position on the command line, and is
  56. therefore passed to it by <code>avram</code>.
  57. <br><dt><kbd>cat ~/specfile | avram reportgenerator -v - /var/log/syslog</kbd><dd>In this example, a hypothetical parameter mode application
  58. <code>reportgenerator</code> is able to read <samp><span class="file">~/specfile</span></samp> from standard
  59. input because of the <code>-</code> used as a parameter.
  60. <br><dt><kbd>avram --parameterized grepenv</kbd><dd>In this example, a hypothetical application that searches shell
  61. variables is invoked in parameter mode even with no input files or
  62. application specific options, because of the <samp><span class="option">--parameterized</span></samp>
  63. option. Parameter mode invocation is required by the application to give
  64. it access to the environment.
  65. <br><dt><kbd>avram grepenv --search-targets=PATH,MANPATH</kbd><dd>This example shows an application specific option with both a keyword
  66. and a parameter list. They suffice to indicate parameter mode without
  67. an explicit <samp><span class="option">--parameterized</span></samp> option.
  68. </dl>
  69. </body></html>