This file is indexed.

/usr/share/doc/pyxplot/html/ex-macro.html is in pyxplot-doc 0.8.4-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta name="generator" content="plasTeX" />
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
<title>PyXPlot Users' Guide: Macros</title>

<link href="sect0039.html" title="The exec command" rel="next" />
<link href="ex-pendulum.html" title="Subroutines" rel="prev" />
<link href="sect0031.html" title="Programming and Flow Control" rel="up" />
<link rel="stylesheet" href="styles/styles.css" />
</head>
<body>

<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="ex-pendulum.html" title="Subroutines"><img alt="Previous: Subroutines" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="sect0031.html" title="Programming and Flow Control"><img alt="Up: Programming and Flow Control" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="sect0039.html" title="The exec command"><img alt="Next: The exec command" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>

<td><a href="sect0255.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>

<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<div class="breadcrumbs">
<span>
<span>
<a href="index.html">PyXPlot Users' Guide</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sect0001.html">Introduction to PyXPlot</a> <b>:</b>
</span>

</span><span>
<span>
<a href="sect0031.html">Programming and Flow Control</a> <b>:</b>
</span>

</span><span>

<span>
<b class="current">Macros</b>
</span>
</span>
<hr />
</div>

<div><h1 id="ex:macro">6.10 Macros</h1>
<p> <a name="a0000000599" id="a0000000599"></a> <a name="a0000000600" id="a0000000600"></a> </p><p>The <img src="images/img-0330.png" alt="$@$" style="vertical-align:0px; 
                                     width:12px; 
                                     height:12px" class="math gen" /> operator can be used for literal substitution of the content of a string variable into the command line. The name of the string variable follows the <img src="images/img-0330.png" alt="$@$" style="vertical-align:0px; 
                                     width:12px; 
                                     height:12px" class="math gen" /> sign, and its content is expanded to the command line, as in this example </p><pre>
mac = "with lines lw 2 lt 1"
plot sin(x) @mac
</pre><p> which is equivalent to </p><pre>
plot sin(x) with lines lw 2 lt 1
</pre><p>The macro, being a string, can contain any characters, but as with other variable names, the name of the macro can contain only alphanumeric characters and the underscore sign. This also means that any operator, with the exception of the <tt class="tt">and</tt> and <tt class="tt">or</tt> operators, can signify the end of the macro name, without the need for a trailing white space. Therefore, in the example </p><pre>
foo = "50"
print @foo*3
</pre><p> the end result is 150; <tt class="tt">50*3</tt> is passed to the command line interpreter. </p><p>One application of macros may be to supply arbitrary algebraic expressions for later evaluation. </p><p> <span class="upshape"><span class="mdseries"><span class="rm">Using a macro to calculate the mean of a dataset.</span></span></span></p><div>

<table cellspacing="0" class="tabular">
<tr>

    
    <td style="border-top-style:solid; border-left:1px solid black; border-right:1px solid black; border-top-color:black; border-top-width:1px; text-align:left"><p> In this example, we create a subroutine which calculates the mean value of an arbitrary function of the columns in a datafile. The subroutine takes two arguments: the name of the datafileand a string containing the function to be averaged. </p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">subroutine mean(filename, func)</tt><br /><tt class="tt">{</tt><br /><tt class="tt">N_data = 0</tt><br /><tt class="tt">sum_x = 0</tt><br /></p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">foreach datum x in filename using <img src="images/img-0330.png" alt="$@$" style="vertical-align:0px; 
                                     width:12px; 
                                     height:12px" class="math gen" />func</tt><br /><tt class="tt">{</tt><br /><tt class="tt">N_data = N_data + 1</tt><br /><tt class="tt">sum_x = sum_x + x</tt><br /><tt class="tt">}</tt><br /><tt class="tt">if(N_data &gt; 0) { ; return sum_x / N_data ; } </tt><br /><tt class="tt">}</tt><br /></p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p>This subroutine can be called from the command line as in the example <br /></p></td>

</tr><tr>

    
    <td style="text-align:left; border-right:1px solid black; border-left:1px solid black"><p><tt class="tt">print mean(’data.dat’, "sin($1)*exp($2)")</tt> <br /></p></td>

</tr><tr>

    
    <td style="border-bottom-style:solid; border-bottom-width:1px; border-left:1px solid black; border-right:1px solid black; text-align:left; border-bottom-color:black"><p>where it returns the mean of the product of the sine of the first column, and the exponential of the second column.  </p></td>

</tr>
</table>
</div></div>





<div class="navigation">
<table cellspacing="2" cellpadding="0" width="100%">
<tr>
<td><a href="ex-pendulum.html" title="Subroutines"><img alt="Previous: Subroutines" border="0" src="icons/previous.gif" width="32" height="32" /></a></td>

<td><a href="sect0031.html" title="Programming and Flow Control"><img alt="Up: Programming and Flow Control" border="0" src="icons/up.gif" width="32" height="32" /></a></td>

<td><a href="sect0039.html" title="The exec command"><img alt="Next: The exec command" border="0" src="icons/next.gif" width="32" height="32" /></a></td>

<td class="navtitle" align="center">PyXPlot Users' Guide</td>
<td><a href="index.html" title="Table of Contents"><img border="0" alt="" src="icons/contents.gif" width="32" height="32" /></a></td>

<td><a href="sect0255.html" title="Index"><img border="0" alt="" src="icons/index.gif" width="32" height="32" /></a></td>

<td><img border="0" alt="" src="icons/blank.gif" width="32" height="32" /></td>
</tr>
</table>
</div>

<script language="javascript" src="icons/imgadjust.js" type="text/javascript"></script>

</body>
</html>