2017-03-23 02:45:12 -04:00
|
|
|
<!doctype html public "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
|
|
|
|
|
|
<html>
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<!-- steal these colour values from JavaDocs; meh -->
|
|
|
|
<style type = "text/css">
|
|
|
|
a:link, a:visited { color: #4a6782; }
|
|
|
|
a:hover, a:focus { color: #bb7a2a; }
|
|
|
|
a:active { color: #4A6782; }
|
|
|
|
tr:nth-child(even) { background: #dee3e9; }
|
|
|
|
div {
|
|
|
|
margin: 4px 0;
|
|
|
|
padding: 0 4px 4px 4px;
|
|
|
|
}
|
|
|
|
table { width: 100%; }
|
|
|
|
td { padding: 4px; }
|
|
|
|
h3, h1 {
|
|
|
|
color: #2c4557;
|
|
|
|
background-color: #dee3e9;
|
|
|
|
padding: 4px;
|
|
|
|
}
|
|
|
|
h3 {
|
|
|
|
margin: 0 -4px;
|
|
|
|
padding: 4px;
|
|
|
|
}
|
|
|
|
</style>
|
2017-03-26 22:00:13 -04:00
|
|
|
<title>Parser</title>
|
2017-03-23 02:45:12 -04:00
|
|
|
</head>
|
|
|
|
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2017-03-26 22:00:13 -04:00
|
|
|
<h1>Parser</h1>
|
2017-03-23 02:45:12 -04:00
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li><a href = "#_declarations">Declarations</a></li>
|
|
|
|
<li><a href = "#_summary">Function Summary</a></li>
|
|
|
|
<li><a href = "#_detail">Function Detail</a></li>
|
|
|
|
</ul>
|
|
|
|
|
2017-03-26 22:00:13 -04:00
|
|
|
<p>
|
|
|
|
Copyright 2008, 2012 Neil Edelman, distributed under the terms of the
|
|
|
|
GNU General Public License, see copying.txt
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Parsing of strings. '~' on a line by itself is recognised in ".newsfile.rss"
|
|
|
|
and ".sitemap.xml" as a <head>~<body>~<tail>; there should be two of them.
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
Parsed in ".index.html",
|
|
|
|
</p>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
@(content) prints <em>content.d</em>, or, if it is missing, <em>index.d</em>;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(files){} repeats for all the files in the directory the contents of the
|
|
|
|
argument;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(htmlcontent);
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(pwd){} prints the directory, the argument is the separator;
|
|
|
|
eg, @(pwd){/};
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(root){}, like @(pwd), except up instead of down;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(now) prints the date and the time in UTC.
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p>
|
|
|
|
Further parsed in @(files)<em></em> in ".index.html",
|
|
|
|
</p>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
@(filealt) prints Dir or File;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(filedesc);
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(filehref) prints the filename or the <em>.link</em>;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(fileicon) prints it's <em>.d.jpeg</em>, or if it is not there, <em>dir.jpeg</em> or
|
|
|
|
<em>file.jpeg</em>;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(filename) prints the file name;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(filesize) prints the file size, if it exits;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(now) prints the date and the time in UTC.
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
<p>
|
|
|
|
Parsed in ".newsfeed.rss",
|
|
|
|
</p>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
@(date) prints the date on the news file;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(news) prints the contents of the file (as a text file);
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(newsname) prints the filename of the news story;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(now) prints the date and the time in UTC;
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
@(title) prints the second line in the <em>.news</em>.
|
|
|
|
</li>
|
|
|
|
</ul>
|
2017-03-23 02:45:12 -04:00
|
|
|
<dl>
|
2017-03-26 22:00:13 -04:00
|
|
|
<dt>minimum standard</dt>
|
|
|
|
<dd>C89/90</dd>
|
|
|
|
<dt>author</dt>
|
|
|
|
<dd>Neil</dd>
|
|
|
|
<dt>version</dt>
|
|
|
|
<dd>1.1; 2017-03 fixed pedantic warnings; command-line improvements</dd>
|
|
|
|
<dt>since</dt>
|
|
|
|
<dd>0.6; 2008-03-21</dd>
|
2017-03-23 02:45:12 -04:00
|
|
|
</dl>
|
|
|
|
|
|
|
|
|
|
|
|
<a name = "_declarations"><!-- --></a><h2>Declarations</h2>
|
|
|
|
|
2017-03-26 04:47:35 -04:00
|
|
|
<div><a name = "struct Parser"><!-- --></a>
|
|
|
|
<h3>struct Parser</h3>
|
|
|
|
<pre><b>struct Parser</b></pre>
|
|
|
|
<p>
|
|
|
|
See <a href = "#Parser">Parser</a>.
|
|
|
|
</p>
|
|
|
|
<dl>
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div><a name = "struct Files"><!-- --></a>
|
|
|
|
<h3>struct Files</h3>
|
|
|
|
<pre><b>struct Files</b></pre>
|
|
|
|
<p>
|
2017-03-26 22:00:13 -04:00
|
|
|
Dependancy on <em>Files</em>.
|
2017-03-26 04:47:35 -04:00
|
|
|
</p>
|
|
|
|
<dl>
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
2017-03-26 20:08:32 -04:00
|
|
|
<div><a name = "typedef int (*ParserWidget)(struct Files *const files, FILE *const fp)"><!-- --></a>
|
|
|
|
<h3>typedef int (*ParserWidget)(struct Files *const files, FILE *const fp)</h3>
|
|
|
|
<pre><b>typedef int (*ParserWidget)(struct Files *const files, FILE *const fp)</b></pre>
|
2017-03-26 04:47:35 -04:00
|
|
|
<p>
|
2017-03-26 22:00:13 -04:00
|
|
|
All <em>ParserWidget</em>s are in <em>Widget.c</em>.
|
2017-03-26 04:47:35 -04:00
|
|
|
</p>
|
|
|
|
<dl>
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
2017-03-23 02:45:12 -04:00
|
|
|
|
|
|
|
<a name = "_summary"><!-- --></a><h2>Function Summary</h2>
|
|
|
|
|
|
|
|
<table>
|
|
|
|
<tr><th>Return Type</th><th>Function Name</th><th>Argument List</th></tr>
|
|
|
|
<tr>
|
2017-03-26 04:47:35 -04:00
|
|
|
<td>struct Parser *</td>
|
|
|
|
<td><a href = "#Parser">Parser</a></td>
|
2017-03-26 20:08:32 -04:00
|
|
|
<td>char *const str</td>
|
2017-03-26 04:47:35 -04:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>void</td>
|
|
|
|
<td><a href = "#Parser_">Parser_</a></td>
|
|
|
|
<td>struct Parser **const p_ptr</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>void</td>
|
|
|
|
<td><a href = "#ParserRewind">ParserRewind</a></td>
|
|
|
|
<td>struct Parser *p</td>
|
2017-03-23 02:45:12 -04:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>int</td>
|
|
|
|
<td><a href = "#ParserParse">ParserParse</a></td>
|
2017-03-26 20:08:32 -04:00
|
|
|
<td>struct Parser *p, struct Files *const f, int invisible,
|
2017-03-26 04:47:35 -04:00
|
|
|
FILE *fp</td>
|
2017-03-23 02:45:12 -04:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
|
|
|
|
|
|
|
<a name = "_detail"><!-- --></a><h2>Function Detail</h2>
|
|
|
|
|
2017-03-26 04:47:35 -04:00
|
|
|
<div><a name = "Parser"><!-- --></a>
|
|
|
|
<h3>Parser</h3>
|
2017-03-26 20:08:32 -04:00
|
|
|
<pre>struct Parser * <b>Parser</b> (char *const str)</pre>
|
2017-03-26 04:47:35 -04:00
|
|
|
<dl>
|
|
|
|
<dt>return</dt>
|
|
|
|
<dd>Creates a parser for the string, <em>str</em>.</dd>
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div><a name = "Parser_"><!-- --></a>
|
|
|
|
<h3>Parser_</h3>
|
|
|
|
<pre>void <b>Parser_</b> (struct Parser **const p_ptr)</pre>
|
|
|
|
<dl>
|
|
|
|
<dt>parameter: p_ptr</dt>
|
|
|
|
<dd>A pointer to the <em>Parser</em> that's to be destucted.</dd>
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div><a name = "ParserRewind"><!-- --></a>
|
|
|
|
<h3>ParserRewind</h3>
|
|
|
|
<pre>void <b>ParserRewind</b> (struct Parser *p)</pre>
|
2017-03-23 02:45:12 -04:00
|
|
|
<p>
|
2017-03-26 04:47:35 -04:00
|
|
|
Resets the parser, <em>p</em>.
|
2017-03-23 02:45:12 -04:00
|
|
|
</p>
|
|
|
|
<dl>
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div><a name = "ParserParse"><!-- --></a>
|
|
|
|
<h3>ParserParse</h3>
|
2017-03-26 20:08:32 -04:00
|
|
|
<pre>int <b>ParserParse</b> (struct Parser *p, struct Files *const f, int invisible,
|
2017-03-26 04:47:35 -04:00
|
|
|
FILE *fp)</pre>
|
2017-03-23 02:45:12 -04:00
|
|
|
<p>
|
2017-03-26 04:47:35 -04:00
|
|
|
Parse, called recursively.
|
2017-03-23 02:45:12 -04:00
|
|
|
</p>
|
|
|
|
<dl>
|
2017-03-26 04:47:35 -04:00
|
|
|
<dt>parameter: f</dt>
|
|
|
|
<dd>Called in the handler to <em>ParserWidget</em>s.</dd>
|
|
|
|
<dt>parameter: invisible</dt>
|
|
|
|
<dd>No output.</dd>
|
|
|
|
<dt>parameter: fp</dt>
|
|
|
|
<dd>Output.</dd>
|
|
|
|
<dt>fixme</dt>
|
|
|
|
<dd>This fn needs rewriting; messy.</dd>
|
|
|
|
<dt>fixme</dt>
|
|
|
|
<dd>Invisible, hack.</dd>
|
2017-03-23 02:45:12 -04:00
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|