This file is indexed.

/usr/share/doc/grads/html/gsf.html is in grads 3:2.2.0-2.

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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!--Copyright (C) 1988-2005 by the Institute of Global Environment and Society (IGES). See file COPYRIGHT for more information.-->

<html>
<head>
<title>GrADS Script Functions</title>
</head>
<body bgcolor="e0f0ff" text="#000000">
<h2>Dynamic Loading of Script Functions</h2> 

<p>
Script variables are generally local to the functions (scripts) they
are contained in; they exist in memory only while the function is
executing. If a variable name starts with an underscore (_), then it
becomes a <i>global</i> script variable and keeps its value throughout
the execution of the main script file. The drawback to global
variables was that the functions they are defined in had to be
included in the main script file. With a new capability that comes
with GrADS version 1.8, that is no longer the case.

<p>
Dynamic loading of script functions means that when your main script
calls a function (subscript), all global variables from that function
will be retained in memory and can continue to be used by main
script. Commonly used functions do not have to be copied into every script
that calls them.

<p>
The names of GrADS script functions may now have 16 characters and include 
the underscore, although they still must begin with an alphabetic character.
Grads script function names are case sensitive.

<p>
Error messages will include the file name
where the error ocurred -- in this case, the full path name of
the file that was actually opened.

<p>
<h3>Using GrADS Script Functions</h3>

<p>
The tricks to using GrADS script functions are (1) to enable dynamic
loading and (2) to teach GrADS how to find the script functions you
call from your main script.

<p>
To enable the dynamic loading of script functions, put this at the top
of your script:

<p>
<ul><code>rc = gsfallow("on")</code></ul>

<p>
To teach Grads how to find the script functions you call from your
main script, you must first know how Grads searches for main
script file names. 

<p>
<b><i>How GrADS searches for main script file names</i></b>

<p>
Let's assume the user wants to run a script called
<code>do_eof.gs</code> and gives the Grads command:

<p>
<ul><code>ga-> do_eof</code></ul>

<p>
Grads will search in the currently directory for the script name, as
provided. If it doesn't find the script, it appends .gs to the script
name and tries again. If the script is still not found, then the
environment variable GASCRP is examined. GrADS attemps to open the
script file in all the directories listed in the GASCRP variable,
first with the provided name, then with the .gs appended.

<p>
If GASCRP contains "<code>/usr/local/gradslib
/usr/homes/myhome</code>", then GrADS will search for the script
<code>do_eof</code> in the following order:

<ul>
<code>
<li>do_eof
<li>do_eof.gs
<li>/usr/local/gradslib/do_eof
<li>/usr/local/gradslib/do_eof.gs
<li>/usr/homes/myhome/do_eof
<li>/usr/homes/myhome/do_eof.gs
</code>
</ul>

<p>
GrADS uses the first file it finds. Once found, the directory that
contains the script file is remembered as the "main function prefix".

<p>
<b><i>How GrADS searches for script function file names</i></b>

<p>
Continuing with our example, let's further assume that GrADS
encounters a function in <code>do_eof.gs</code> that is not included
in the stuff already loaded from the main script file. GrADS will look
for a .gsf file to load, using the following search path:

<p>
<ul>
<code>
<li>&lt;main-function-prefix&gt;/&lt;function-name&gt;.gsf
<li>&lt;main-function-prefix&gt;/&lt;private-paths&gt;/&lt;function-name&gt;.gsf
<li>&lt;GASCRP-paths&gt;/&lt;function-name&gt;.gsf
</code>
</ul>

<p>
The private path directory list is an optional list that 
is provided via the <code>gsfpath</code> function:

<p>
<ul><code>rc = gsfpath("dirlist")</code></ul>

If used, the declaration of the private path directory list should
appear at the top of the main script just underneath the statement
enabling the dynamic script loading.

<p>
For example, if our main script "do_eof.gs" is executed with the command:

<p>
<ul><code>run /usr/local/gradslib/do_eof</code></ul>

<p>
and this script file contains the following lines at the front:

<p>
<ul><code>
rc = gsfallow("on")<br>
rc = gsfpath("math1 string2")
</code></ul>

<p>
and the script calls a function <code>str_chop</code> which is not found in
the main script, then the search path would be:

<p>
<ol>
<li>/usr/local/gradslib/str_chop.gsf
<li>/usr/local/gradslib/math1/str_chop.gsf
<li>/usr/local/gradslib/string2/str_chop.gsf
</ol>

</body>
</html>