Rev 1915 | Rev 3794 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#! /bin/sh
cd `dirname $0`
cat <<@ >index.phtml
!! This file is automatically generated! Do not edit it.
!! Edit the script 'mkindex'.
!if adm/createxo isin \$module
!set slib_cmd=help
!endif
!read tabletheme
!default slib_cmd=resume
!default slib_detname=special_cmd
!set slib_detail=\$(\$slib_detname)
<p>
!if \$slib_detail!=\$empty
!readproc slib/\$slib_detail slib_header
!distribute lines \$slib_parms into slpcnt,slp1,slp2,slp3,slp4,slp5,slp6,slp7,slp8,slp9,slp10,slp11,slp12
!for i=1 to \$slpcnt
!set slpdflt\$i=!item 1 of \$(slp\$i)
!set slp\$i=!item 2 to -1 of \$(slp\$i)
!next i
<p><center>
\$table_header
<caption>Library script</caption>
\$table_tr<th>Name</th><td><tt>\$slib_detail</tt></td></tr>
\$table_tr<th>Effect</th><td>\$slib_title</td></tr>
\$table_tr<th>Call from module</th><td><tt>!readproc slib/\$slib_detail [parameters]</tt></td></tr>
\$table_tr<th>Call from OEF / DOC</th><td><tt>slib(\$slib_detail [parameters])</tt></td></tr>
\$table_tr<th>Parameters</th><td>
!if \$slpcnt>1
!if + isin \$slpcnt
Variable list of comma-separated items
!else
Up to \$slpcnt, comma-separated
!endif
!else
\$slpcnt
!endif
</td></tr>
!for i=1 to \$slpcnt
\$table_tr<th>Parameter \$i
!ifval \$i=\$slpcnt and + isin \$slpcnt
and up
!endif
</th>
<td>\$(slp\$i)
!if \$(slpdflt\$i)!=\$empty
<em>(default: \$(slpdflt\$i))</em>
!endif
</td></tr>
!next i
\$table_tr<th>Output</th><td>\$slib_out</td></tr>
!if \$slib_comment!=\$empty
\$table_tr<th>Comment</th><td>\$slib_comment</td></tr>
!endif
!if \$slib_require!=\$empty
\$table_tr<th>Required Software</th><td><tt>\$slib_require</tt></td></tr>
!endif
!if \$slib_example!=\$empty
!set excnt=!linecnt \$slib_example
\$table_tr<th>Examples OEF </th><td>
!for i=1 to \$excnt
!set slib_exemple=!line \$i of \$slib_example
<tt><b>\text{A=slib(\$slib_detail \$slib_exemple)}</b></tt>
!readproc slib/\$slib_detail \$slib_exemple
!set z=!linecnt \$slib_out
!if \$z > 2
<p>Output:
<font color="green"><small><pre>\$slib_out</pre></small></font>
!else
<br>Output: <tt><b><font color="green">\$slib_out</font></b></tt>
!endif
<br>
!next i
!reset \$slib_exemple</td></tr>
!endif
</table> <p>
!reset \$slib_detname
!exit
!endif
Scripts in this library can be called from modules using the command
<tt>!read</tt> (or <tt>!readproc</tt> from within a phtml file).
For example, the line
<pre>
\$ !read slib/matrix/random 3, 5, 10
</pre>
generates a 3×5 matrix with random integer coefficients in [-10, 10].
The result is placed in the variable <tt>slib_out</tt>.
To call an slib script from OEF exercises, documents or forum
messages, use the function <tt>slib()</tt>.
<p>
Only variables prefixed by <tt>slib_</tt> are modified by these scripts.
<p><center>
\$table_header
<caption>Available scripts in slib</caption>
\$table_tr<th>Name</th><th>Effect</th></tr>
@
cnt=0
for f in `find . -type f | sed 's!^\./!!g' | grep ./ | sort`
do
tit=`awk -F= '$1=="slib_title" {print $2; exit}' $f`
if [ -n "$tit" ]; then
echo $f
cnt=`expr $cnt + 1`
cat <<@ >>index.phtml
\$table_tr<td><tt>$f</tt></td><td>$tit
!href cmd=\$slib_cmd&special_parm=slib&\$slib_detname=$f\$slib_detailanchor [detail]
</td></tr>
@
fi
done
cat <<@ >>index.phtml
</table></center> <p>
@
echo
echo Indexed $cnt scripts.
echo