regen with Github links, etc

This commit is contained in:
Troy D. Hanson 2013-03-12 17:23:06 -04:00
parent feec3bb950
commit 5fad67d673
35 changed files with 5796 additions and 2807 deletions

View File

@ -2,15 +2,25 @@
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.5.2" />
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.8" />
<title>tpl ChangeLog</title>
<style type="text/css">
/* Debug borders */
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
/*
border: 1px solid red;
*/
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
/* Default font. */
body {
font-family: Georgia,serif;
}
/* Title font. */
h1, h2, h3, h4, h5, h6,
div.title, caption.title,
thead, p.table.header,
#toctitle,
#author, #revnumber, #revdate, #revremark,
#footer {
font-family: Arial,Helvetica,sans-serif;
}
body {
@ -35,13 +45,8 @@ strong {
color: #083194;
}
tt {
color: navy;
}
h1, h2, h3, h4, h5, h6 {
color: #527bbd;
font-family: sans-serif;
margin-top: 1.2em;
margin-bottom: 0.5em;
line-height: 1.3;
@ -59,9 +64,11 @@ h3 {
h3 + * {
clear: left;
}
h5 {
font-size: 1.0em;
}
div.sectionbody {
font-family: serif;
margin-left: 0;
}
@ -77,45 +84,48 @@ p {
ul, ol, li > p {
margin-top: 0;
}
ul > li { color: #aaa; }
ul > li > * { color: black; }
pre {
.monospaced, code, pre {
font-family: "Courier New", Courier, monospace;
font-size: inherit;
color: navy;
padding: 0;
margin: 0;
}
span#author {
#author {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
font-size: 1.1em;
}
span#email {
#email {
}
span#revnumber, span#revdate, span#revremark {
font-family: sans-serif;
#revnumber, #revdate, #revremark {
}
div#footer {
font-family: sans-serif;
#footer {
font-size: small;
border-top: 2px solid silver;
padding-top: 0.5em;
margin-top: 4.0em;
}
div#footer-text {
#footer-text {
float: left;
padding-bottom: 0.5em;
}
div#footer-badges {
#footer-badges {
float: right;
padding-bottom: 0.5em;
}
div#preamble {
#preamble {
margin-top: 1.5em;
margin-bottom: 1.5em;
}
div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
div.imageblock, div.exampleblock, div.verseblock,
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
div.admonitionblock {
margin-top: 1.0em;
@ -135,7 +145,6 @@ div.content { /* Block element content. */
/* Block element titles. */
div.title, caption.title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
text-align: left;
margin-top: 1.0em;
@ -157,13 +166,15 @@ div.content + div.title {
div.sidebarblock > div.content {
background: #ffffee;
border: 1px solid silver;
border: 1px solid #dddddd;
border-left: 4px solid #f0f0f0;
padding: 0.5em;
}
div.listingblock > div.content {
border: 1px solid silver;
background: #f4f4f4;
border: 1px solid #dddddd;
border-left: 5px solid #f0f0f0;
background: #f8f8f8;
padding: 0.5em;
}
@ -171,8 +182,8 @@ div.quoteblock, div.verseblock {
padding-left: 1.0em;
margin-left: 1.0em;
margin-right: 10%;
border-left: 5px solid #dddddd;
color: #777777;
border-left: 5px solid #f0f0f0;
color: #888;
}
div.quoteblock > div.attribution {
@ -180,8 +191,9 @@ div.quoteblock > div.attribution {
text-align: right;
}
div.verseblock > div.content {
white-space: pre;
div.verseblock > pre.content {
font-family: inherit;
font-size: inherit;
}
div.verseblock > div.attribution {
padding-top: 0.75em;
@ -211,7 +223,7 @@ div.exampleblock > div.content {
}
div.imageblock div.content { padding-left: 0; }
span.image img { border-style: none; }
span.image img { border-style: none; vertical-align: text-bottom; }
a.image:visited { color: white; }
dl {
@ -254,35 +266,12 @@ div.compact div, div.compact div {
margin-bottom: 0.1em;
}
div.tableblock > table {
border: 3px solid #527bbd;
}
thead, p.table.header {
font-family: sans-serif;
font-weight: bold;
}
tfoot {
font-weight: bold;
}
td > div.verse {
white-space: pre;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
div.hdlist {
margin-top: 0.8em;
@ -339,25 +328,32 @@ span.footnote, span.footnoteref {
min-width: 100px;
}
@media print {
div#footer-badges { display: none; }
div.colist td {
padding-right: 0.5em;
padding-bottom: 0.3em;
vertical-align: top;
}
div.colist td img {
margin-top: 0.3em;
}
div#toc {
@media print {
#footer-badges { display: none; }
}
#toc {
margin-bottom: 2.5em;
}
div#toctitle {
#toctitle {
color: #527bbd;
font-family: sans-serif;
font-size: 1.1em;
font-weight: bold;
margin-top: 1.0em;
margin-bottom: 0.1em;
}
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
@ -373,51 +369,207 @@ div.toclevel4 {
margin-left: 6em;
font-size: 0.9em;
}
/* Workarounds for IE6's broken and incomplete CSS2. */
div.sidebar-content {
background: #ffffee;
border: 1px solid silver;
padding: 0.5em;
span.aqua { color: aqua; }
span.black { color: black; }
span.blue { color: blue; }
span.fuchsia { color: fuchsia; }
span.gray { color: gray; }
span.green { color: green; }
span.lime { color: lime; }
span.maroon { color: maroon; }
span.navy { color: navy; }
span.olive { color: olive; }
span.purple { color: purple; }
span.red { color: red; }
span.silver { color: silver; }
span.teal { color: teal; }
span.white { color: white; }
span.yellow { color: yellow; }
span.aqua-background { background: aqua; }
span.black-background { background: black; }
span.blue-background { background: blue; }
span.fuchsia-background { background: fuchsia; }
span.gray-background { background: gray; }
span.green-background { background: green; }
span.lime-background { background: lime; }
span.maroon-background { background: maroon; }
span.navy-background { background: navy; }
span.olive-background { background: olive; }
span.purple-background { background: purple; }
span.red-background { background: red; }
span.silver-background { background: silver; }
span.teal-background { background: teal; }
span.white-background { background: white; }
span.yellow-background { background: yellow; }
span.big { font-size: 2em; }
span.small { font-size: 0.6em; }
span.underline { text-decoration: underline; }
span.overline { text-decoration: overline; }
span.line-through { text-decoration: line-through; }
div.unbreakable { page-break-inside: avoid; }
/*
* xhtml11 specific
*
* */
div.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
}
div.sidebar-title, div.image-title {
color: #527bbd;
font-family: sans-serif;
div.tableblock > table {
border: 3px solid #527bbd;
}
thead, p.table.header {
font-weight: bold;
margin-top: 0.0em;
margin-bottom: 0.5em;
color: #527bbd;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
div.listingblock div.content {
border: 1px solid silver;
background: #f4f4f4;
padding: 0.5em;
/*
* html5 specific
*
* */
table.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
}
thead, p.tableblock.header {
font-weight: bold;
color: #527bbd;
}
p.tableblock {
margin-top: 0;
}
table.tableblock {
border-width: 3px;
border-spacing: 0px;
border-style: solid;
border-color: #527bbd;
border-collapse: collapse;
}
th.tableblock, td.tableblock {
border-width: 1px;
padding: 4px;
border-style: solid;
border-color: #527bbd;
}
div.quoteblock-attribution {
padding-top: 0.5em;
table.tableblock.frame-topbot {
border-left-style: hidden;
border-right-style: hidden;
}
table.tableblock.frame-sides {
border-top-style: hidden;
border-bottom-style: hidden;
}
table.tableblock.frame-none {
border-style: hidden;
}
th.tableblock.halign-left, td.tableblock.halign-left {
text-align: left;
}
th.tableblock.halign-center, td.tableblock.halign-center {
text-align: center;
}
th.tableblock.halign-right, td.tableblock.halign-right {
text-align: right;
}
div.verseblock-content {
white-space: pre;
th.tableblock.valign-top, td.tableblock.valign-top {
vertical-align: top;
}
div.verseblock-attribution {
padding-top: 0.75em;
text-align: left;
th.tableblock.valign-middle, td.tableblock.valign-middle {
vertical-align: middle;
}
th.tableblock.valign-bottom, td.tableblock.valign-bottom {
vertical-align: bottom;
}
div.exampleblock-content {
border-left: 3px solid #dddddd;
padding-left: 0.5em;
/*
* manpage specific
*
* */
body.manpage h1 {
padding-top: 0.5em;
padding-bottom: 0.5em;
border-top: 2px solid silver;
border-bottom: 2px solid silver;
}
body.manpage h2 {
border-style: none;
}
body.manpage div.sectionbody {
margin-left: 3em;
}
/* IE6 sets dynamically generated links as visited. */
div#toc a:visited { color: blue; }
@media print {
body.manpage div#toc { display: none; }
}
@media screen {
body {
max-width: 50em; /* approximately 80 characters wide */
margin-left: 16em;
}
#toc {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 13em;
padding: 0.5em;
padding-bottom: 1.5em;
margin: 0;
overflow: auto;
border-right: 3px solid #f8f8f8;
background-color: white;
}
#toc .toclevel1 {
margin-top: 0.5em;
}
#toc .toclevel2 {
margin-top: 0.25em;
display: list-item;
color: #aaaaaa;
}
#toctitle {
margin-top: 0.5em;
}
}
</style>
<script type="text/javascript">
/*<![CDATA[*/
window.onload = function(){asciidoc.footnotes();}
var asciidoc = { // Namespace.
/////////////////////////////////////////////////////////////////////
@ -459,7 +611,7 @@ toc: function (toclevels) {
function tocEntries(el, toclevels) {
var result = new Array;
var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
// Function that scans the DOM tree for header elements (the DOM2
// nodeIterator API would be a better technique but not supported by all
// browsers).
@ -479,6 +631,25 @@ toc: function (toclevels) {
}
var toc = document.getElementById("toc");
if (!toc) {
return;
}
// Delete existing TOC entries in case we're reloading the TOC.
var tocEntriesToRemove = [];
var i;
for (i = 0; i < toc.childNodes.length; i++) {
var entry = toc.childNodes[i];
if (entry.nodeName.toLowerCase() == 'div'
&& entry.getAttribute("class")
&& entry.getAttribute("class").match(/^toclevel/))
tocEntriesToRemove.push(entry);
}
for (i = 0; i < tocEntriesToRemove.length; i++) {
toc.removeChild(tocEntriesToRemove[i]);
}
// Rebuild TOC entries.
var entries = tocEntries(document.getElementById("content"), toclevels);
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i];
@ -506,24 +677,44 @@ toc: function (toclevels) {
*/
footnotes: function () {
var cont = document.getElementById("content");
// Delete existing footnote entries in case we're reloading the footnodes.
var i;
var noteholder = document.getElementById("footnotes");
if (!noteholder) {
return;
}
var entriesToRemove = [];
for (i = 0; i < noteholder.childNodes.length; i++) {
var entry = noteholder.childNodes[i];
if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
entriesToRemove.push(entry);
}
for (i = 0; i < entriesToRemove.length; i++) {
noteholder.removeChild(entriesToRemove[i]);
}
// Rebuild footnote entries.
var cont = document.getElementById("content");
var spans = cont.getElementsByTagName("span");
var refs = {};
var n = 0;
for (i=0; i<spans.length; i++) {
if (spans[i].className == "footnote") {
n++;
// Use [\s\S] in place of . so multi-line matches work.
// Because JavaScript has no s (dotall) regex flag.
note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
var note = spans[i].getAttribute("data-note");
if (!note) {
// Use [\s\S] in place of . so multi-line matches work.
// Because JavaScript has no s (dotall) regex flag.
note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
spans[i].innerHTML =
"[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
"' title='View footnote' class='footnote'>" + n + "</a>]";
spans[i].setAttribute("data-note", note);
}
noteholder.innerHTML +=
"<div class='footnote' id='_footnote_" + n + "'>" +
"<a href='#_footnoteref_" + n + "' title='Return to text'>" +
n + "</a>. " + note + "</div>";
spans[i].innerHTML =
"[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
"' title='View footnote' class='footnote'>" + n + "</a>]";
var id =spans[i].getAttribute("id");
if (id != null) refs["#"+id] = n;
}
@ -543,22 +734,55 @@ footnotes: function () {
}
}
}
},
install: function(toclevels) {
var timerId;
function reinstall() {
asciidoc.footnotes();
if (toclevels) {
asciidoc.toc(toclevels);
}
}
function reinstallAndRemoveTimer() {
clearInterval(timerId);
reinstall();
}
timerId = setInterval(reinstall, 500);
if (document.addEventListener)
document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
else
window.onload = reinstallAndRemoveTimer;
}
}
asciidoc.install(2);
/*]]>*/
</script>
</head>
<body>
<body class="article">
<div id="header">
<h1>tpl ChangeLog</h1>
<div id="toc">
<div id="toctitle">Table of Contents</div>
<noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
</div>
</div>
<div id="content">
<h2 id="_version_1_6_2010">Version 1.6 (2010-??-??)</h2>
<div class="sect1">
<h2 id="_version_1_6_2011">Version 1.6 (2011-??-??)</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
Added <code>const</code> to a number of API parameters and exposed tpl_map_va (thanks, Simon Dawson!)
</p>
</li>
<li>
<p>
Fixed a bug in the Windows version of tpl that prevented an application
from serializing more than once to the same file- the file stayed locked until
the application was closed. (thanks, Werner Krattenthaler!)
@ -566,8 +790,8 @@ Fixed a bug in the Windows version of tpl that prevented an application
</li>
<li>
<p>
Fixed a documentation error to indicate that <tt>tpl_dump</tt> when used in the
<tt>TPL_GETSIZE</tt> mode stores its result in a <tt>size_t</tt> rather than a <tt>uint32_t</tt>
Fixed a documentation error to indicate that <code>tpl_dump</code> when used in the
<code>TPL_GETSIZE</code> mode stores its result in a <code>size_t</code> rather than a <code>uint32_t</code>
(thanks, M. Nunberge!)
</p>
</li>
@ -578,6 +802,8 @@ Fixed a typo in the User Guide example of packing a linked link (thanks, Bryan M
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_version_1_5_2010_02_05">Version 1.5 (2010-02-05)</h2>
<div class="sectionbody">
<div class="ulist"><ul>
@ -593,17 +819,17 @@ there are now two download options: the <a href="http://downloads.sourceforge.ne
</li>
<li>
<p>
a crash in <tt>tpl_free</tt> on certain format strings has been fixed (thanks, Eric Rose!)
a crash in <code>tpl_free</code> on certain format strings has been fixed (thanks, Eric Rose!)
</p>
</li>
<li>
<p>
fixed a bug in <tt>tpl_dump</tt> on 64-bit, big-endian platforms
fixed a bug in <code>tpl_dump</code> on 64-bit, big-endian platforms
</p>
</li>
<li>
<p>
changed some pointer casts from <tt>long</tt> to <tt>uintptr_t</tt> since 64-bit Windows has 32-bit longs
changed some pointer casts from <code>long</code> to <code>uintptr_t</code> since 64-bit Windows has 32-bit longs
</p>
</li>
<li>
@ -613,82 +839,86 @@ tpl has been downloaded 4,195 times.
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_version_1_4_2009_04_21">Version 1.4 (2009-04-21)</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
fixed-length arrays can now be multi-dimensional like <tt>i##</tt>
fixed-length arrays can now be multi-dimensional like <code>i##</code>
</p>
</li>
<li>
<p>
fixed-length string arrays like <tt>s#</tt> are now supported
fixed-length string arrays like <code>s#</code> are now supported
</p>
</li>
<li>
<p>
nested structures can now be expressed, using the dollar symbol, e.g. <tt>S(ci$(cc))</tt>
nested structures can now be expressed, using the dollar symbol, e.g. <code>S(ci$(cc))</code>
</p>
</li>
<li>
<p>
<tt>tpl_dump</tt> can use a caller-allocated output buffer (<tt>TPL_MEM|TPL_PREALLOCD</tt>)
<code>tpl_dump</code> can use a caller-allocated output buffer (<code>TPL_MEM|TPL_PREALLOCD</code>)
</p>
</li>
<li>
<p>
<tt>tpl_load</tt> can tolerate excess space in input buffer (<tt>TPL_MEM|TPL_EXCESS_OK</tt>)
<code>tpl_load</code> can tolerate excess space in input buffer (<code>TPL_MEM|TPL_EXCESS_OK</code>)
</p>
</li>
<li>
<p>
implement <tt>TPL_FXLENS</tt> flag for <tt>tpl_peek</tt> to get lengths of fixed-length arrays
implement <code>TPL_FXLENS</code> flag for <code>tpl_peek</code> to get lengths of fixed-length arrays
</p>
</li>
<li>
<p>
implement <tt>TPL_GETSIZE</tt> flag for <tt>tpl_dump</tt> to get dump size without dumping
implement <code>TPL_GETSIZE</code> flag for <code>tpl_dump</code> to get dump size without dumping
</p>
</li>
<li>
<p>
fix success return code from <tt>tpl_dump(TPL_FD,...)</tt> (thanks, Max Lapan!)
fix success return code from <code>tpl_dump(TPL_FD,...)</code> (thanks, Max Lapan!)
</p>
</li>
<li>
<p>
deprecated the wildcard unpacking <tt>S(*)</tt> feature
deprecated the wildcard unpacking <code>S(*)</code> feature
</p>
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_version_1_3_2009_02_10">Version 1.3 (2009-02-10)</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
added <tt>TPL_DATAPEEK</tt> mode for <tt>tpl_peek</tt>
added <code>TPL_DATAPEEK</code> mode for <code>tpl_peek</code>
</p>
</li>
<li>
<p>
added support for <tt>NULL</tt> strings
added support for <code>NULL</code> strings
</p>
</li>
<li>
<p>
added support for 16-bit integer types (<tt>j</tt>,<tt>v</tt>)
added support for 16-bit integer types (<code>j</code>,<code>v</code>)
</p>
</li>
<li>
<p>
added <tt>tpl_jot</tt>
added <code>tpl_jot</code>
</p>
</li>
<li>
<p>
added support for fixed-length arrays of structures <tt>S(...)#</tt>
added support for fixed-length arrays of structures <code>S(...)#</code>
</p>
</li>
<li>
@ -708,7 +938,7 @@ added RPM spec file (thanks, Alessandro Ren!)
</li>
<li>
<p>
compiles cleanly with <tt>-Wall</tt> and <tt>-pedantic</tt> and with <tt>-O3</tt>
compiles cleanly with <code>-Wall</code> and <code>-pedantic</code> and with <code>-O3</code>
</p>
</li>
<li>
@ -740,6 +970,8 @@ added <a href="http://apps.sourceforge.net/mediawiki/tpl/">tpl wiki</a>
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_version_1_2_2007_04_27">Version 1.2 (2007-04-27)</h2>
<div class="sectionbody">
<div class="ulist"><ul>
@ -750,6 +982,8 @@ Perl API and XML converter support 64-bit types
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_version_1_1_2007_04_25">Version 1.1 (2007-04-25)</h2>
<div class="sectionbody">
<div class="ulist"><ul>
@ -775,6 +1009,8 @@ revised User Guide
</li>
</ul></div>
</div>
</div>
<div class="sect1">
<h2 id="_version_1_0_2006_09_28">Version 1.0 (2006-09-28)</h2>
<div class="sectionbody">
<div class="ulist"><ul>
@ -786,10 +1022,11 @@ Initial version
</ul></div>
</div>
</div>
</div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Last updated 2011-04-27 22:45:54 EDT
Last updated 2013-03-12 17:01:06 EDT
</div>
</div>
</body>

View File

@ -1,26 +1,16 @@
all: css userguide pdf changelog perl
HTML=$(patsubst %.txt,%.html,$(wildcard *.txt))
userguide: txt/userguide.txt
asciidoc --unsafe --out-file=html/userguide.html -a linkcss=1 -a theme=tdh txt/userguide.txt
all: $(HTML)
# when each target of a multi-target rule has its own prereq
# we use a static pattern rule.
$(HTML): %.html: %.txt
asciidoc -a toc2 $<
changelog: txt/ChangeLog.txt
asciidoc --out-file=html/ChangeLog.html txt/ChangeLog.txt
TMP=/tmp/tpl-gh-pages
stage:
mkdir -p ${TMP}
rm -if ${TMP}/*
cp *.html *.css *.png ${TMP}
.PHONY: pdf
pdf: txt/userguide.txt
a2x -f pdf $<
mv txt/userguide.pdf pdf/
cd html && ln -sf ../pdf/userguide.pdf userguide.pdf
rm -f txt/userguide.xml
perl: txt/perl.txt
asciidoc --unsafe --out-file=html/perl.html -a linkcss=1 -a theme=tdh txt/perl.txt
css: html/toc.css
cat /etc/asciidoc/stylesheets/xhtml11.css html/toc.css > html/tdh.css
cp /etc/asciidoc/stylesheets/xhtml11-quirks.css html/tdh-quirks.css
docbook: txt/userguide.txt
asciidoc -b docbook --out-file=/tmp/userguide.xml txt/userguide.txt
xmlto -o html html-nochunks /tmp/userguide.xml

View File

@ -1,11 +0,0 @@
# maintainer notes
# IE6 png gamma bug:
# PNG images in IE6 display with wrong background colors,
# solution: save PNG in Gimp *Without save gamma checked*
#update sourceforge web site:
#cd html
#scp *.{html,css} thanson@shell.sourceforge.net:/home/groups/t/tp/tpl/htdocs
#cd img
#scp *.png *.jpg thanson@shell.sourceforge.net:/home/groups/t/tp/tpl/htdocs/img

View File

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

827
doc/compiling.html Normal file
View File

@ -0,0 +1,827 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.6.8" />
<title></title>
<style type="text/css">
/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
/* Default font. */
body {
font-family: Georgia,serif;
}
/* Title font. */
h1, h2, h3, h4, h5, h6,
div.title, caption.title,
thead, p.table.header,
#toctitle,
#author, #revnumber, #revdate, #revremark,
#footer {
font-family: Arial,Helvetica,sans-serif;
}
body {
margin: 1em 5% 1em 5%;
}
a {
color: blue;
text-decoration: underline;
}
a:visited {
color: fuchsia;
}
em {
font-style: italic;
color: navy;
}
strong {
font-weight: bold;
color: #083194;
}
h1, h2, h3, h4, h5, h6 {
color: #527bbd;
margin-top: 1.2em;
margin-bottom: 0.5em;
line-height: 1.3;
}
h1, h2, h3 {
border-bottom: 2px solid silver;
}
h2 {
padding-top: 0.5em;
}
h3 {
float: left;
}
h3 + * {
clear: left;
}
h5 {
font-size: 1.0em;
}
div.sectionbody {
margin-left: 0;
}
hr {
border: 1px solid silver;
}
p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
ul, ol, li > p {
margin-top: 0;
}
ul > li { color: #aaa; }
ul > li > * { color: black; }
.monospaced, code, pre {
font-family: "Courier New", Courier, monospace;
font-size: inherit;
color: navy;
padding: 0;
margin: 0;
}
#author {
color: #527bbd;
font-weight: bold;
font-size: 1.1em;
}
#email {
}
#revnumber, #revdate, #revremark {
}
#footer {
font-size: small;
border-top: 2px solid silver;
padding-top: 0.5em;
margin-top: 4.0em;
}
#footer-text {
float: left;
padding-bottom: 0.5em;
}
#footer-badges {
float: right;
padding-bottom: 0.5em;
}
#preamble {
margin-top: 1.5em;
margin-bottom: 1.5em;
}
div.imageblock, div.exampleblock, div.verseblock,
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
div.admonitionblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
}
div.admonitionblock {
margin-top: 2.0em;
margin-bottom: 2.0em;
margin-right: 10%;
color: #606060;
}
div.content { /* Block element content. */
padding: 0;
}
/* Block element titles. */
div.title, caption.title {
color: #527bbd;
font-weight: bold;
text-align: left;
margin-top: 1.0em;
margin-bottom: 0.5em;
}
div.title + * {
margin-top: 0;
}
td div.title:first-child {
margin-top: 0.0em;
}
div.content div.title:first-child {
margin-top: 0.0em;
}
div.content + div.title {
margin-top: 0.0em;
}
div.sidebarblock > div.content {
background: #ffffee;
border: 1px solid #dddddd;
border-left: 4px solid #f0f0f0;
padding: 0.5em;
}
div.listingblock > div.content {
border: 1px solid #dddddd;
border-left: 5px solid #f0f0f0;
background: #f8f8f8;
padding: 0.5em;
}
div.quoteblock, div.verseblock {
padding-left: 1.0em;
margin-left: 1.0em;
margin-right: 10%;
border-left: 5px solid #f0f0f0;
color: #888;
}
div.quoteblock > div.attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock > pre.content {
font-family: inherit;
font-size: inherit;
}
div.verseblock > div.attribution {
padding-top: 0.75em;
text-align: left;
}
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
div.verseblock + div.attribution {
text-align: left;
}
div.admonitionblock .icon {
vertical-align: top;
font-size: 1.1em;
font-weight: bold;
text-decoration: underline;
color: #527bbd;
padding-right: 0.5em;
}
div.admonitionblock td.content {
padding-left: 0.5em;
border-left: 3px solid #dddddd;
}
div.exampleblock > div.content {
border-left: 3px solid #dddddd;
padding-left: 0.5em;
}
div.imageblock div.content { padding-left: 0; }
span.image img { border-style: none; vertical-align: text-bottom; }
a.image:visited { color: white; }
dl {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: normal;
color: navy;
}
dd > *:first-child {
margin-top: 0.1em;
}
ul, ol {
list-style-position: outside;
}
ol.arabic {
list-style-type: decimal;
}
ol.loweralpha {
list-style-type: lower-alpha;
}
ol.upperalpha {
list-style-type: upper-alpha;
}
ol.lowerroman {
list-style-type: lower-roman;
}
ol.upperroman {
list-style-type: upper-roman;
}
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
margin-top: 0.1em;
margin-bottom: 0.1em;
}
tfoot {
font-weight: bold;
}
td > div.verse {
white-space: pre;
}
div.hdlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
div.hdlist tr {
padding-bottom: 15px;
}
dt.hdlist1.strong, td.hdlist1.strong {
font-weight: bold;
}
td.hdlist1 {
vertical-align: top;
font-style: normal;
padding-right: 0.8em;
color: navy;
}
td.hdlist2 {
vertical-align: top;
}
div.hdlist.compact tr {
margin: 0;
padding-bottom: 0;
}
.comment {
background: yellow;
}
.footnote, .footnoteref {
font-size: 0.8em;
}
span.footnote, span.footnoteref {
vertical-align: super;
}
#footnotes {
margin: 20px 0 20px 0;
padding: 7px 0 0 0;
}
#footnotes div.footnote {
margin: 0 0 5px 0;
}
#footnotes hr {
border: none;
border-top: 1px solid silver;
height: 1px;
text-align: left;
margin-left: 0;
width: 20%;
min-width: 100px;
}
div.colist td {
padding-right: 0.5em;
padding-bottom: 0.3em;
vertical-align: top;
}
div.colist td img {
margin-top: 0.3em;
}
@media print {
#footer-badges { display: none; }
}
#toc {
margin-bottom: 2.5em;
}
#toctitle {
color: #527bbd;
font-size: 1.1em;
font-weight: bold;
margin-top: 1.0em;
margin-bottom: 0.1em;
}
div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
div.toclevel2 {
margin-left: 2em;
font-size: 0.9em;
}
div.toclevel3 {
margin-left: 4em;
font-size: 0.9em;
}
div.toclevel4 {
margin-left: 6em;
font-size: 0.9em;
}
span.aqua { color: aqua; }
span.black { color: black; }
span.blue { color: blue; }
span.fuchsia { color: fuchsia; }
span.gray { color: gray; }
span.green { color: green; }
span.lime { color: lime; }
span.maroon { color: maroon; }
span.navy { color: navy; }
span.olive { color: olive; }
span.purple { color: purple; }
span.red { color: red; }
span.silver { color: silver; }
span.teal { color: teal; }
span.white { color: white; }
span.yellow { color: yellow; }
span.aqua-background { background: aqua; }
span.black-background { background: black; }
span.blue-background { background: blue; }
span.fuchsia-background { background: fuchsia; }
span.gray-background { background: gray; }
span.green-background { background: green; }
span.lime-background { background: lime; }
span.maroon-background { background: maroon; }
span.navy-background { background: navy; }
span.olive-background { background: olive; }
span.purple-background { background: purple; }
span.red-background { background: red; }
span.silver-background { background: silver; }
span.teal-background { background: teal; }
span.white-background { background: white; }
span.yellow-background { background: yellow; }
span.big { font-size: 2em; }
span.small { font-size: 0.6em; }
span.underline { text-decoration: underline; }
span.overline { text-decoration: overline; }
span.line-through { text-decoration: line-through; }
div.unbreakable { page-break-inside: avoid; }
/*
* xhtml11 specific
*
* */
div.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
}
div.tableblock > table {
border: 3px solid #527bbd;
}
thead, p.table.header {
font-weight: bold;
color: #527bbd;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
/*
* html5 specific
*
* */
table.tableblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
}
thead, p.tableblock.header {
font-weight: bold;
color: #527bbd;
}
p.tableblock {
margin-top: 0;
}
table.tableblock {
border-width: 3px;
border-spacing: 0px;
border-style: solid;
border-color: #527bbd;
border-collapse: collapse;
}
th.tableblock, td.tableblock {
border-width: 1px;
padding: 4px;
border-style: solid;
border-color: #527bbd;
}
table.tableblock.frame-topbot {
border-left-style: hidden;
border-right-style: hidden;
}
table.tableblock.frame-sides {
border-top-style: hidden;
border-bottom-style: hidden;
}
table.tableblock.frame-none {
border-style: hidden;
}
th.tableblock.halign-left, td.tableblock.halign-left {
text-align: left;
}
th.tableblock.halign-center, td.tableblock.halign-center {
text-align: center;
}
th.tableblock.halign-right, td.tableblock.halign-right {
text-align: right;
}
th.tableblock.valign-top, td.tableblock.valign-top {
vertical-align: top;
}
th.tableblock.valign-middle, td.tableblock.valign-middle {
vertical-align: middle;
}
th.tableblock.valign-bottom, td.tableblock.valign-bottom {
vertical-align: bottom;
}
/*
* manpage specific
*
* */
body.manpage h1 {
padding-top: 0.5em;
padding-bottom: 0.5em;
border-top: 2px solid silver;
border-bottom: 2px solid silver;
}
body.manpage h2 {
border-style: none;
}
body.manpage div.sectionbody {
margin-left: 3em;
}
@media print {
body.manpage div#toc { display: none; }
}
@media screen {
body {
max-width: 50em; /* approximately 80 characters wide */
margin-left: 16em;
}
#toc {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 13em;
padding: 0.5em;
padding-bottom: 1.5em;
margin: 0;
overflow: auto;
border-right: 3px solid #f8f8f8;
background-color: white;
}
#toc .toclevel1 {
margin-top: 0.5em;
}
#toc .toclevel2 {
margin-top: 0.25em;
display: list-item;
color: #aaaaaa;
}
#toctitle {
margin-top: 0.5em;
}
}
</style>
<script type="text/javascript">
/*<![CDATA[*/
var asciidoc = { // Namespace.
/////////////////////////////////////////////////////////////////////
// Table Of Contents generator
/////////////////////////////////////////////////////////////////////
/* Author: Mihai Bazon, September 2002
* http://students.infoiasi.ro/~mishoo
*
* Table Of Content generator
* Version: 0.4
*
* Feel free to use this script under the terms of the GNU General Public
* License, as long as you do not remove or alter this notice.
*/
/* modified by Troy D. Hanson, September 2006. License: GPL */
/* modified by Stuart Rackham, 2006, 2009. License: GPL */
// toclevels = 1..4.
toc: function (toclevels) {
function getText(el) {
var text = "";
for (var i = el.firstChild; i != null; i = i.nextSibling) {
if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
text += i.data;
else if (i.firstChild != null)
text += getText(i);
}
return text;
}
function TocEntry(el, text, toclevel) {
this.element = el;
this.text = text;
this.toclevel = toclevel;
}
function tocEntries(el, toclevels) {
var result = new Array;
var re = new RegExp('[hH]([1-'+(toclevels+1)+'])');
// Function that scans the DOM tree for header elements (the DOM2
// nodeIterator API would be a better technique but not supported by all
// browsers).
var iterate = function (el) {
for (var i = el.firstChild; i != null; i = i.nextSibling) {
if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
var mo = re.exec(i.tagName);
if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
}
iterate(i);
}
}
}
iterate(el);
return result;
}
var toc = document.getElementById("toc");
if (!toc) {
return;
}
// Delete existing TOC entries in case we're reloading the TOC.
var tocEntriesToRemove = [];
var i;
for (i = 0; i < toc.childNodes.length; i++) {
var entry = toc.childNodes[i];
if (entry.nodeName.toLowerCase() == 'div'
&& entry.getAttribute("class")
&& entry.getAttribute("class").match(/^toclevel/))
tocEntriesToRemove.push(entry);
}
for (i = 0; i < tocEntriesToRemove.length; i++) {
toc.removeChild(tocEntriesToRemove[i]);
}
// Rebuild TOC entries.
var entries = tocEntries(document.getElementById("content"), toclevels);
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i];
if (entry.element.id == "")
entry.element.id = "_toc_" + i;
var a = document.createElement("a");
a.href = "#" + entry.element.id;
a.appendChild(document.createTextNode(entry.text));
var div = document.createElement("div");
div.appendChild(a);
div.className = "toclevel" + entry.toclevel;
toc.appendChild(div);
}
if (entries.length == 0)
toc.parentNode.removeChild(toc);
},
/////////////////////////////////////////////////////////////////////
// Footnotes generator
/////////////////////////////////////////////////////////////////////
/* Based on footnote generation code from:
* http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
*/
footnotes: function () {
// Delete existing footnote entries in case we're reloading the footnodes.
var i;
var noteholder = document.getElementById("footnotes");
if (!noteholder) {
return;
}
var entriesToRemove = [];
for (i = 0; i < noteholder.childNodes.length; i++) {
var entry = noteholder.childNodes[i];
if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
entriesToRemove.push(entry);
}
for (i = 0; i < entriesToRemove.length; i++) {
noteholder.removeChild(entriesToRemove[i]);
}
// Rebuild footnote entries.
var cont = document.getElementById("content");
var spans = cont.getElementsByTagName("span");
var refs = {};
var n = 0;
for (i=0; i<spans.length; i++) {
if (spans[i].className == "footnote") {
n++;
var note = spans[i].getAttribute("data-note");
if (!note) {
// Use [\s\S] in place of . so multi-line matches work.
// Because JavaScript has no s (dotall) regex flag.
note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
spans[i].innerHTML =
"[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
"' title='View footnote' class='footnote'>" + n + "</a>]";
spans[i].setAttribute("data-note", note);
}
noteholder.innerHTML +=
"<div class='footnote' id='_footnote_" + n + "'>" +
"<a href='#_footnoteref_" + n + "' title='Return to text'>" +
n + "</a>. " + note + "</div>";
var id =spans[i].getAttribute("id");
if (id != null) refs["#"+id] = n;
}
}
if (n == 0)
noteholder.parentNode.removeChild(noteholder);
else {
// Process footnoterefs.
for (i=0; i<spans.length; i++) {
if (spans[i].className == "footnoteref") {
var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
href = href.match(/#.*/)[0]; // Because IE return full URL.
n = refs[href];
spans[i].innerHTML =
"[<a href='#_footnote_" + n +
"' title='View footnote' class='footnote'>" + n + "</a>]";
}
}
}
},
install: function(toclevels) {
var timerId;
function reinstall() {
asciidoc.footnotes();
if (toclevels) {
asciidoc.toc(toclevels);
}
}
function reinstallAndRemoveTimer() {
clearInterval(timerId);
reinstall();
}
timerId = setInterval(reinstall, 500);
if (document.addEventListener)
document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
else
window.onload = reinstallAndRemoveTimer;
}
}
asciidoc.install(2);
/*]]>*/
</script>
</head>
<body class="article">
<div id="header">
<div id="toc">
<div id="toctitle">Table of Contents</div>
<noscript><p><b>JavaScript must be enabled in your browser to display the table of contents.</b></p></noscript>
</div>
</div>
<div id="content">
<div class="sect1">
<h2 id="_compiling_libtpl_a_and_libtpl_so">Compiling libtpl.a and libtpl.so</h2>
<div class="sectionbody">
<div class="sidebarblock">
<div class="content">
<div class="paragraph"><p>Normally in the top-level directory you simply run:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>./configure
make
make install</code></pre>
</div></div>
<div class="paragraph"><p>The rest of the document is not needed if you use this method.</p></div>
</div></div>
</div>
</div>
<div class="sect1">
<h2 id="_manual_compilation_of_static_and_shared_library_on_a_gnu_linux_system">Manual compilation of static and shared library on a GNU Linux system:</h2>
<div class="sectionbody">
<div class="paragraph"><p>First cd into the "src" directory.</p></div>
<div class="sect2">
<h3 id="_static_library">Static library</h3>
<div class="paragraph"><p>You can build the static library <code>libtpl.a</code> using these commands:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>cc -c tpl.c
ar rc libtpl.a tpl.o
ranlib libtpl.a</code></pre>
</div></div>
</div>
<div class="sect2">
<h3 id="_dynamic_library">Dynamic library</h3>
<div class="paragraph"><p>You can build the dynamic library <code>libtpl.so</code> using these commands:</p></div>
<div class="literalblock">
<div class="content">
<pre><code>cc -fpic -c tpl.c
cc -shared -o libtpl.so tpl.o</code></pre>
</div></div>
<div class="paragraph"><p>Keep in mind that you need to set the <code>LD_LIBRARY_PATH</code> environment variable
to include the directory where <code>libtpl.so</code> is installed in order for your
program to run. Alternatively you can put <code>libtpl.so</code> in a standard place like
<code>/usr/lib</code> and regenerate <code>ld.so.cache</code> using <code>ldconfig</code>.</p></div>
</div>
</div>
</div>
</div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Last updated 2013-03-12 17:01:06 EDT
</div>
</div>
</body>
</html>

1075
doc/examples.html Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,11 @@
tpl examples
============
Troy D. Hanson <troydhanson@comcast.net>>
Troy D. Hanson <tdh@tkhanson.net>
v1.0, October 2006
include::sflogo.txt[]
include::topnav.txt[]
Examples
--------
include::toc.txt[]
This document is a set of representative examples demonstrating how to use
tpl. If you're looking for a more explanatory document, please read the

View File

Before

Width:  |  Height:  |  Size: 409 B

After

Width:  |  Height:  |  Size: 409 B

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Binary file not shown.

View File

@ -1,412 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.5.2" />
<title>tpl Perl API</title>
<link rel="stylesheet" href="./tdh.css" type="text/css" />
<link rel="stylesheet" href="./tdh-quirks.css" type="text/css" />
<script type="text/javascript">
/*<![CDATA[*/
window.onload = function(){asciidoc.footnotes();}
/*]]>*/
</script>
<script type="text/javascript" src="./asciidoc-xhtml11.js"></script>
</head>
<body>
<div id="header">
<h1>tpl Perl API</h1>
<span id="author">Troy D. Hanson</span><br />
<span id="email"><tt>&lt;<a href="mailto:troydhanson@comcast.net">troydhanson@comcast.net</a>&gt;</tt></span><br />
<span id="revnumber">version 1.1,</span>
<span id="revdate">April 2007</span>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<a style="float: right;" href="http://sourceforge.net/projects/tpl"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=157637&amp;type=16" width="150" height="40" alt="SourceForge.net" /></a>
<div id="topnav" style="font-size: 9pt; font-family: sans-serif;">
<a style="padding: 8px;" href="http://sourceforge.net/projects/tpl/">sf.net summary page</a> &gt;
<a style="padding: 8px;" href="index.html">tpl home</a> &gt;
tpl Perl API
<a style="padding: 8px;" href="userguide.pdf">[View PDF]</a>
</div>
</div>
</div>
<h2 id="_perl_api">Perl API</h2>
<div class="sectionbody">
<div id="toc"></div>
<script>
window.onload=generate_TOC
/* Author: Mihai Bazon, September 2002
* <a href="http://students.infoiasi.ro/~mishoo">http://students.infoiasi.ro/~mishoo</a>
*
* Table Of Content generator
* Version: 0.4
*
* Feel free to use this script under the terms of the GNU General Public
* License, as long as you do not remove or alter this notice.
*/
/* modified by Troy D. Hanson, September 2006. License: GPL */
function H_getText(el) {
var text = "";
for (var i = el.firstChild; i != null; i = i.nextSibling) {
if (i.nodeType == 3 /* Node.TEXT_NODE, IE doesn't speak constants */)
text += i.data;
else if (i.firstChild != null)
text += H_getText(i);
}
return text;
}
function TOC_EL(el, text, level) {
this.element = el;
this.text = text;
this.level = level;
}
function getHeadlines(el) {
var l = new Array;
var rx = /[hH]([2-3])/;
// internal recursive function that scans the DOM tree
var rec = function (el) {
for (var i = el.firstChild; i != null; i = i.nextSibling) {
if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
if (rx.exec(i.tagName))
l[l.length] = new TOC_EL(i, H_getText(i), parseInt(RegExp.$1));
rec(i);
}
}
}
rec(el);
return l;
}
function generate_TOC() {
var parent = document.getElementById("toc");
var toc_hdr = document.createElement("div");
var toc_hdr_txt = document.createTextNode("CONTENTS");
toc_hdr.appendChild(toc_hdr_txt);
/* toc_hdr.setAttribute("id","hdr"); */
toc_hdr.id = "hdr";
parent.appendChild(toc_hdr);
var hs = getHeadlines(document.getElementsByTagName("body")[0]);
for (var i = 0; i < hs.length; ++i) {
var hi = hs[i];
var d = document.createElement("div");
if (hi.element.id == "") hi.element.id = "gen" + i;
var a = document.createElement("a");
a.href = "#" + hi.element.id;
a.appendChild(document.createTextNode(hi.text));
d.appendChild(a);
d.className = "level" + hi.level;
parent.appendChild(d);
/*
if (hi.level == 3) {
var dvtop = document.createElement("div");
dvtop.className = "toplink";
dvtop.appendChild(document.createTextNode("^top^"));
dvtop.onclick=function(){scrollTo(0,0);};
hi.element.appendChild(dvtop);
}
*/
}
}
</script>
<div class="paragraph"><p>The Perl API for reading and writing tpl is nearly identical to the C API. This
document will briefly explain the Perl API and provide examples. The chief
motivation for having a Perl API is to communicate with C programs that use tpl.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">
<div class="title">Tip</div>
</td>
<td class="content">
<div class="title">Start with the C API</div>This document assumes familiarity with the C API. The concepts of using tpl
are not explained here. For an introduction to tpl and its C API, see the
<a href="userguide.html">User Guide</a>.</td>
</tr></table>
</div>
<h3 id="_tpl_pm">Tpl.pm</h3><div style="clear:left"></div>
<div class="paragraph"><p>The <tt>Tpl.pm</tt> file (in the <tt>lang/perl</tt>) directory contains the Perl module. You
can copy it to another directory if you wish. Your Perl program may need to
include a <tt>use lib</tt> statement to find the module.</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>#!/usr/bin/perl
use lib "/some/directory";
use Tpl;</tt></pre>
</div></div>
<h3 id="_tpl_map">tpl_map</h3><div style="clear:left"></div>
<div class="paragraph"><p>This function resembles the C version, except that it&#8217;s invoked via the <tt>Tpl</tt>
module, and it takes references to Perl variables after the format string.</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>my $i;
my $tpl = Tpl-&gt;tpl_map("A(i)",\$i);</tt></pre>
</div></div>
<div class="paragraph"><p>The return value is a tpl object; all other API calls are object methods.
Incidentally, there is no <tt>tpl_free()</tt> method corresponding to the C API.</p></div>
<h4 id="_fixed_length_arrays">Fixed-length arrays</h4>
<div class="paragraph"><p>Format strings such as <tt>i#</tt> denote a fixed-length array. In the Perl API,
fixed-length arrays require two arguments: a list reference, and the fixed
length. For example:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>my @x;
my $tpl = Tpl-&gt;tpl_map("i#", \@x, 10);</tt></pre>
</div></div>
<div class="paragraph"><p>When fixed-length arrays are packed or unpacked, the specified number of
elements will be copied from (or placed into) the designated list.</p></div>
<h4 id="_structures">Structures</h4>
<div class="paragraph"><p>Format strings containing <tt>S(...)</tt> are handled in the Perl API as if only the
interior, parenthesized part was present. (It does not work like the C API). So
simply ignore the <tt>S(...)</tt> and consider only its interior format characters when
constructing the argument list:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>my ($str, $int);
my $tpl = Tpl-&gt;tpl_map("S(si)", \$str, \$int);</tt></pre>
</div></div>
<div class="paragraph"><p>It really only makes sense to use <tt>S(...)</tt> in a format string in the Perl API if
you are communicating with a C program that uses structures.</p></div>
<h3 id="_tpl_pack">tpl_pack</h3><div style="clear:left"></div>
<div class="paragraph"><p>This is nearly identical to the C version. The only argument is the index
number to pack.</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>$tpl-&gt;tpl_pack(1);</tt></pre>
</div></div>
<h3 id="_tpl_dump">tpl_dump</h3><div style="clear:left"></div>
<div class="paragraph"><p>This method is a little different than the C version. Given no arguments, it
returns the tpl image; given one argument it writes a file with that name.</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>$tpl-&gt;tpl_dump("demo.tpl"); # writes demo.tpl</tt></pre>
</div></div>
<div class="paragraph"><p>Or,</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>my $img = $tpl-&gt;tpl_dump();</tt></pre>
</div></div>
<div class="paragraph"><p>The tpl image is a binary buffer. You can do whatever you want with it, such as
write it to a socket or pipe (probably to C program listening on the other end),
or save it somewhere and later re-load it using <tt>tpl_load()</tt>.</p></div>
<h3 id="_tpl_load">tpl_load</h3><div style="clear:left"></div>
<div class="paragraph"><p>This method loads a tpl image from a file or from a Perl variable. It takes
one argument. If it&#8217;s not a reference, it&#8217;s assumed to be a filename to load.</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>$tpl-&gt;tpl_load("demo.tpl");</tt></pre>
</div></div>
<div class="paragraph"><p>Otherwise, if the argument is a Perl reference, it&#8217;s construed as a variable
containing the tpl image:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>$tpl-&gt;tpl_load(\$img);</tt></pre>
</div></div>
<div class="paragraph"><p>The method will <tt>die</tt> if the image is invalid or the file doesn&#8217;t exist. You
can wrap it with <tt>eval</tt> to catch such errors:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>eval { $tpl-&gt;tpl_load(\$img); };
print "failed to load\n" if $@;</tt></pre>
</div></div>
<h3 id="_tpl_unpack">tpl_unpack</h3><div style="clear:left"></div>
<div class="paragraph"><p>This is nearly identical to the C version. The only argument is the index
number to unpack.</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>$tpl-&gt;tpl_unpack(1);</tt></pre>
</div></div>
</div>
<h2 id="_examples">Examples</h2>
<div class="sectionbody">
<h3 id="_integer_array">Integer array</h3><div style="clear:left"></div>
<div class="listingblock">
<div class="title">Packing A(i) to file</div>
<div class="content">
<pre><tt>#!/usr/bin/perl
use strict;
use warnings;
use Tpl;
my $i;
my $tpl = Tpl-&gt;tpl_map("A(i)",\$i);
for($i=0; $i&lt;10; $i++) {
$tpl-&gt;tpl_pack(1);
}
$tpl-&gt;tpl_dump("demo.tpl");</tt></pre>
</div></div>
<div class="listingblock">
<div class="title">Unpacking A(i) from file</div>
<div class="content">
<pre><tt>#!/usr/bin/perl
use strict;
use warnings;
use Tpl;
my $j;
my $tpl2 = Tpl-&gt;tpl_map("A(i)",\$j);
$tpl2-&gt;tpl_load("demo.tpl");
while($tpl2-&gt;tpl_unpack(1) &gt; 0) {
print "$j\n";
}</tt></pre>
</div></div>
<h3 id="_message_passing">Message-passing</h3><div style="clear:left"></div>
<div class="paragraph"><p>While the bulk of this example is socket handling, it demonstrates how you can
use tpl as a message-passing format. In the real-world, you might have a C
server and a Perl client, for example. In this example, we&#8217;ll code both a client
and a server in Perl.</p></div>
<div class="sidebarblock">
<div class="sidebar-content">
<div class="sidebar-title">A server that sums integers</div>
<div class="paragraph"><p>Programming literature is rife with contrived examples so we will follow in that
tradition. Our server will do no more than sum a list of integers. But in doing
so it will demonstrate message passing adequately. Both its input (the integer
array) and its output (an integer) are tpl images, passed over a TCP/IP socket.</p></div>
</div></div>
<h4 id="_server">Server</h4>
<div class="paragraph"><p>The server waits for a connection from a client. When it gets one, it accepts
the connection and immediately forks a child process to handle it. Then it goes
back to waiting for another new connection.</p></div>
<div class="paragraph"><p>The server child process handles the client by loading and unpacking the tpl
image sent by the client (containing an array of integers). It calculates their
sum and constructs a new tpl image containing the sum, which it sends back to
the client.</p></div>
<div class="listingblock">
<div class="title">Server</div>
<div class="content">
<pre><tt>#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::INET;
use Tpl;
$SIG{CHLD} = "IGNORE"; # don't create zombies
our $port = 2000;
sub handle_client {
my $client = shift;
undef $/;
my $request = &lt;$client&gt;; # get request (slurp)
# read input array, and calculate total
my ($i,$total);
my $tpl = Tpl-&gt;tpl_map("A(i)", \$i);
eval { $tpl-&gt;tpl_load(\$request); };
die "received invalid tpl" if $@;
$total += $i while $tpl-&gt;tpl_unpack(1) &gt; 0;
# formulate response and send
my $tpl2 = Tpl-&gt;tpl_map("i", \$total);
$tpl2-&gt;tpl_pack(0);
my $response = $tpl2-&gt;tpl_dump();
print $client $response;
close $client;
}
my $server = IO::Socket::INET-&gt;new(LocalPort =&gt; $port,
Type =&gt; SOCK_STREAM,
Reuse =&gt; 1,
Listen =&gt; 10 )
or die "Can't listen on port $port: $!\n";
while (1) {
my $client = $server-&gt;accept();
next unless $client;
# new connection
my $pid = fork;
die "can't fork: $!\n" unless defined $pid;
if ($pid &gt; 0) {
# parent
close $client;
} elsif ($pid == 0) {
# child
handle_client($client);
exit(0);
}
}
close ($server);</tt></pre>
</div></div>
<h4 id="_client">Client</h4>
<div class="paragraph"><p>The client is a simpler program. It constructs the tpl image containing the
integer array (taken from its command-line arguments), connects to the server
and sends the tpl image to it, and then awaits the response tpl. The response
containing the sum is loaded, unpacked and printed.</p></div>
<div class="listingblock">
<div class="title">Client</div>
<div class="content">
<pre><tt>#!/usr/bin/perl
use strict;
use warnings;
use IO::Socket::INET;
use Tpl;
our $port = 2000;
# construct tpl
my $i;
my $tpl = Tpl-&gt;tpl_map("A(i)",\$i);
$tpl-&gt;tpl_pack(1) while ($i=shift @ARGV);
my $request = $tpl-&gt;tpl_dump();
# send to server, get response
my $socket = IO::Socket::INET-&gt;new("localhost:$port") or die "can't connect";
print $socket $request;
shutdown($socket,1); # done writing (half-close)
undef $/;
my $response = &lt;$socket&gt;; # get reply (slurp)
# decode response (or print error)
my $total;
my $tpl2 = Tpl-&gt;tpl_map("i", \$total);
eval { $tpl2-&gt;tpl_load(\$response); };
die "invalid response\n" if $@;
$tpl2-&gt;tpl_unpack(0);
print "total is $total\n";</tt></pre>
</div></div>
<h4 id="_running_thise_example">Running thise example</h4>
<div class="paragraph"><p>If the client and server programs are in <tt>client.pl</tt> and <tt>server.pl</tt>, then
you can run the example by starting the server in one window:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>./server.pl</tt></pre>
</div></div>
<div class="paragraph"><p>Then run the client in another window. E.g.,</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>./client.pl 1 2 3 4 5</tt></pre>
</div></div>
<div class="paragraph"><p>The client runs and then exits, printing:</p></div>
<div class="literalblock">
<div class="content">
<pre><tt>total is 15</tt></pre>
</div></div>
<div class="paragraph"><p>You can re-run the client with different arguments. When done, type <tt>Ctrl-C</tt> in
the server window to terminate it.</p></div>
</div>
</div>
<div id="footnotes"><hr /></div>
<div id="footer">
<div id="footer-text">
Version 1.1<br />
Last updated 2010-07-18 21:14:17 EDT
</div>
</div>
</body>
</html>

View File

@ -1,41 +0,0 @@
/* Workarounds for IE6's broken and incomplete CSS2. */
div.sidebar-content {
background: #ffffee;
border: 1px solid silver;
padding: 0.5em;
}
div.sidebar-title, div.image-title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
margin-top: 0.0em;
margin-bottom: 0.5em;
}
div.listingblock div.content {
border: 1px solid silver;
background: #f4f4f4;
padding: 0.5em;
}
div.quoteblock-attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock-content {
white-space: pre;
}
div.verseblock-attribution {
padding-top: 0.75em;
text-align: left;
}
div.exampleblock-content {
border-left: 3px solid #dddddd;
padding-left: 0.5em;
}
/* IE6 sets dynamically generated links as visited. */
div#toc a:visited { color: blue; }

View File

@ -1,402 +0,0 @@
/* Debug borders */
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
/*
border: 1px solid red;
*/
}
body {
margin: 1em 5% 1em 5%;
}
a {
color: blue;
text-decoration: underline;
}
a:visited {
color: fuchsia;
}
em {
font-style: italic;
color: navy;
}
strong {
font-weight: bold;
color: #083194;
}
tt {
color: navy;
}
h1, h2, h3, h4, h5, h6 {
color: #527bbd;
font-family: sans-serif;
margin-top: 1.2em;
margin-bottom: 0.5em;
line-height: 1.3;
}
h1, h2, h3 {
border-bottom: 2px solid silver;
}
h2 {
padding-top: 0.5em;
}
h3 {
float: left;
}
h3 + * {
clear: left;
}
div.sectionbody {
font-family: serif;
margin-left: 0;
}
hr {
border: 1px solid silver;
}
p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
ul, ol, li > p {
margin-top: 0;
}
pre {
padding: 0;
margin: 0;
}
span#author {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
font-size: 1.1em;
}
span#email {
}
span#revnumber, span#revdate, span#revremark {
font-family: sans-serif;
}
div#footer {
font-family: sans-serif;
font-size: small;
border-top: 2px solid silver;
padding-top: 0.5em;
margin-top: 4.0em;
}
div#footer-text {
float: left;
padding-bottom: 0.5em;
}
div#footer-badges {
float: right;
padding-bottom: 0.5em;
}
div#preamble {
margin-top: 1.5em;
margin-bottom: 1.5em;
}
div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
div.admonitionblock {
margin-top: 1.0em;
margin-bottom: 1.5em;
}
div.admonitionblock {
margin-top: 2.0em;
margin-bottom: 2.0em;
margin-right: 10%;
color: #606060;
}
div.content { /* Block element content. */
padding: 0;
}
/* Block element titles. */
div.title, caption.title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
text-align: left;
margin-top: 1.0em;
margin-bottom: 0.5em;
}
div.title + * {
margin-top: 0;
}
td div.title:first-child {
margin-top: 0.0em;
}
div.content div.title:first-child {
margin-top: 0.0em;
}
div.content + div.title {
margin-top: 0.0em;
}
div.sidebarblock > div.content {
background: #ffffee;
border: 1px solid silver;
padding: 0.5em;
}
div.listingblock > div.content {
border: 1px solid silver;
background: #f4f4f4;
padding: 0.5em;
}
div.quoteblock, div.verseblock {
padding-left: 1.0em;
margin-left: 1.0em;
margin-right: 10%;
border-left: 5px solid #dddddd;
color: #777777;
}
div.quoteblock > div.attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock > div.content {
white-space: pre;
}
div.verseblock > div.attribution {
padding-top: 0.75em;
text-align: left;
}
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
div.verseblock + div.attribution {
text-align: left;
}
div.admonitionblock .icon {
vertical-align: top;
font-size: 1.1em;
font-weight: bold;
text-decoration: underline;
color: #527bbd;
padding-right: 0.5em;
}
div.admonitionblock td.content {
padding-left: 0.5em;
border-left: 3px solid #dddddd;
}
div.exampleblock > div.content {
border-left: 3px solid #dddddd;
padding-left: 0.5em;
}
div.imageblock div.content { padding-left: 0; }
span.image img { border-style: none; }
a.image:visited { color: white; }
dl {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: normal;
color: navy;
}
dd > *:first-child {
margin-top: 0.1em;
}
ul, ol {
list-style-position: outside;
}
ol.arabic {
list-style-type: decimal;
}
ol.loweralpha {
list-style-type: lower-alpha;
}
ol.upperalpha {
list-style-type: upper-alpha;
}
ol.lowerroman {
list-style-type: lower-roman;
}
ol.upperroman {
list-style-type: upper-roman;
}
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
margin-top: 0.1em;
margin-bottom: 0.1em;
}
div.tableblock > table {
border: 3px solid #527bbd;
}
thead, p.table.header {
font-family: sans-serif;
font-weight: bold;
}
tfoot {
font-weight: bold;
}
td > div.verse {
white-space: pre;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
div.hdlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
div.hdlist tr {
padding-bottom: 15px;
}
dt.hdlist1.strong, td.hdlist1.strong {
font-weight: bold;
}
td.hdlist1 {
vertical-align: top;
font-style: normal;
padding-right: 0.8em;
color: navy;
}
td.hdlist2 {
vertical-align: top;
}
div.hdlist.compact tr {
margin: 0;
padding-bottom: 0;
}
.comment {
background: yellow;
}
.footnote, .footnoteref {
font-size: 0.8em;
}
span.footnote, span.footnoteref {
vertical-align: super;
}
#footnotes {
margin: 20px 0 20px 0;
padding: 7px 0 0 0;
}
#footnotes div.footnote {
margin: 0 0 5px 0;
}
#footnotes hr {
border: none;
border-top: 1px solid silver;
height: 1px;
text-align: left;
margin-left: 0;
width: 20%;
min-width: 100px;
}
@media print {
div#footer-badges { display: none; }
}
div#toc {
margin-bottom: 2.5em;
}
div#toctitle {
color: #527bbd;
font-family: sans-serif;
font-size: 1.1em;
font-weight: bold;
margin-top: 1.0em;
margin-bottom: 0.1em;
}
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
div.toclevel2 {
margin-left: 2em;
font-size: 0.9em;
}
div.toclevel3 {
margin-left: 4em;
font-size: 0.9em;
}
div.toclevel4 {
margin-left: 6em;
font-size: 0.9em;
}
#toc {
float: right;
font-family: sans-serif;
border: 1px solid #000;
margin: 0px 0px 20px 20px;
padding: 0px;
background: #f0f0f0;
font-size: 80%;
}
#toc #hdr {
color:#ffffff;
background:#98b1c4;
text-align:center;
margin-bottom:5px;
}
a img {
border: 0
}
#toc a:visited, #toc a:link { color:#000; text-decoration: none }
#toc a:hover { color:#00f; text-decoration: underline; }
#toc .level2 { margin-left: 1em; margin-top: 2px; margin-bottom: 2px; text-decoration: underline; }
#toc .level3 { margin-left: 2em; font-size: 0.8em }
.toplink {
float: right;
font-size: 50%;
cursor: pointer;
}
#topnav {font-weight: bold}
#topnav a {font-weight: normal}

View File

@ -1,35 +0,0 @@
#toc {
float: right;
font-family: sans-serif;
border: 1px solid #000;
margin: 0px 0px 20px 20px;
padding: 0px;
background: #f0f0f0;
font-size: 80%;
}
#toc #hdr {
color:#ffffff;
background:#98b1c4;
text-align:center;
margin-bottom:5px;
}
a img {
border: 0
}
#toc a:visited, #toc a:link { color:#000; text-decoration: none }
#toc a:hover { color:#00f; text-decoration: underline; }
#toc .level2 { margin-left: 1em; margin-top: 2px; margin-bottom: 2px; text-decoration: underline; }
#toc .level3 { margin-left: 2em; font-size: 0.8em }
.toplink {
float: right;
font-size: 50%;
cursor: pointer;
}
#topnav {font-weight: bold}
#topnav a {font-weight: normal}

File diff suppressed because it is too large Load Diff

View File

@ -13,8 +13,11 @@
</div> <!-- banner -->
<div id="topnav">
<a href="http://sourceforge.net/projects/tpl/">sf.net summary page</a> &gt;
<a href="http://github.com/troydhanson/tpl">GitHub page</a> &gt;
tpl home
<a href="https://twitter.com/share" class="twitter-share-button" data-via="troydhanson">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div> <!-- topnav -->
<hr />
@ -24,38 +27,27 @@
<h2>documentation</h2>
<div><a href="userguide.html">user guide</a> (<a href="userguide.html">html</a>, <a href="userguide.pdf">pdf</a>)</div>
<div><a href="userguide.html">user guide</a></div>
<h2>activity</h2>
<div><a href="ChangeLog.html">ChangeLog</a></div>
<h2>download</h2>
<h3>Linux, Mac OSX, Solaris, BSD</h3>
<div><a href="http://downloads.sourceforge.net/tpl/libtpl-1.5.tar.bz2">libtpl-1.5.tar.bz2</a></div>
<h3>Visual Studio 2008 Solution</h3>
<div><a href="http://downloads.sourceforge.net/tpl/tpl-1.5-vs2008.zip">tpl-1.5-vs2008.zip</a></div>
<h2>last release</h2>
<div>February, 2010</div>
<div><a href="ChangeLog.html">ChangeLog</a></div>
<h3>Linux, Windows, BSD, OS X</h3>
<div><a href=https://github.com/troydhanson/tpl/archive/master.zip>tpl-master.zip</a></div>
<div><a href=https://github.com/troydhanson/tpl>git clone</a></div>
<h2>license</h2>
<div><a href="license.html">BSD revised</a></div>
<h2>news feed</h2>
<div><a href="http://troydhanson.wordpress.com/">updates blog</a> (<a href="http://troydhanson.wordpress.com/feed/">rss</a>)<img alt=" rss" src="img/rss.png"/></div>
<h2>platforms</h2>
<div>linux</div>
<div>os x</div>
<div>windows</div>
<div>solaris</div>
<div>openbsd</div>
<h2>other projects</h2>
<div><a href="http://uthash.sourceforge.net/">uthash</a></div>
<div><a href="http://tkhanson.net/misc/">scripts & snippets</a></div>
<h2>developer</h2>
<div>Troy D. Hanson</div>
<div>tdh at tkhanson.net</div>
<div><a href="http://troydhanson.wordpress.com/">my blog</a><img src="rss.png"/></div>
<div><a href="http://tkhanson.net/">my projects</a></div>
<a href="https://twitter.com/troydhanson" class="twitter-follow-button" data-show-count="false" data-show-screen-name="false">Follow @troydhanson</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
</div> <!-- nav -->
@ -152,9 +144,6 @@ For a more thorough explanation and more examples, please read the
<hr />
<div id="footer">
<a href="http://sourceforge.net/projects/tpl"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=157637&amp;type=13" width="120" height="30" alt="SourceForge.net." /></a>
<p>This project is hosted on SourceForge.net</p>
<p>$Id: index.html 192 2009-04-24 10:35:30Z thanson $</p>
</div> <!-- footer -->
</body>

View File

@ -4,28 +4,24 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<link rel="stylesheet" type="text/css" href="styles.css" />
<title>tpl home page</title>
<title>tpl: binary serialization for C</title>
</head>
<body>
<div id="banner">
<img src="img/banner.png" alt="serialization in C: easy data storage and retrieval" />
<img src="banner.png" alt="tpl: binary serialization for C" />
</div> <!-- banner -->
<div id="topnav">
<a href="http://sourceforge.net/projects/tpl/">sf.net summary page</a> &gt;
<a href="index.html">tpl home</a> &gt;
<a href="http://troydhanson.github.com/tpl/">tpl home</a> &gt;
BSD license
</div> <!-- topnav -->
</div>
<hr />
<div id="mid">
<div id="main">
<pre>
Copyright (c) 2005-2010, Troy D. Hanson http://tpl.sourceforge.net
Copyright (c) 2005-2013, Troy D. Hanson http://troydhanson.github.com/tpl/
All rights reserved.
Redistribution and use in source and binary forms, with or without
@ -46,16 +42,14 @@ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</pre>
</div> <!-- main -->
</div> <!-- mid -->
</div> <!-- main -->
<hr />
<div id="footer">
<a href="http://sourceforge.net/projects/tpl"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=157637&amp;type=13" width="120" height="30" alt="SourceForge.net." /></a>
<p>This project is hosted on SourceForge.net</p>
<p>$Id: index.html 124 2007-04-27 06:41:36Z thanson $</p>
</div> <!-- footer -->
</body>
</html>

Binary file not shown.

1103
doc/perl.html Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,10 @@
tpl Perl API
============
Troy D. Hanson <troydhanson@comcast.net>
Troy D. Hanson <tdh@tkhanson.net>
v1.1, April 2007
include::sflogo.txt[]
include::topnav.txt[]
Perl API
--------
include::toc.txt[]
The Perl API for reading and writing tpl is nearly identical to the C API. This
document will briefly explain the Perl API and provide examples. The chief

0
doc/html/img/rss.png → doc/rss.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 689 B

After

Width:  |  Height:  |  Size: 689 B

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -1,52 +0,0 @@
For future reference these are some API design ideas- not working code!
--------------------------------------------------------------------------------
Java API ideas
--------------------------------------------------------------------------------
http://www.ioplex.com/~miallen/encdec/ (binary pack/unpack utilities)
The Java API would take an object, and a list of field names, then use the
Java Reflection API to read or write those fields during packing and
unpacking.
I.e. if you are going to unpack a tpl with format string A(if), you
might create a Java class that has two instance variables (an int and
a double). Then you create an object of that class, and pass it to
tpl_map (or perhaps a constructor for the Tpl class), like
class Unpacker {
int count;
double weight;
}
...
Unpacker up = new Unpacker();
Tpl tn = new Tpl("A(if)", up, "count", "weight");
tn.tpl_unpack(1); // stores unpacked values into count,weight using Reflection
--------------------------------------------------------------------------------
Ruby API ideas
--------------------------------------------------------------------------------
#!/usr/local/ruby/bin/ruby -w
class Tpl < Hash
def initialize(fmt, *args)
@fmt = fmt
@args = args
end
def pack
@args.each {|key| puts "#{key} #{self[key]}"}
end
end
p = Tpl.new("A(i)", :id);
10.times do |i|
p[:id] = i
p.pack
end
p.dump("/tmp/file.tpl") # p.dump(arg) checks arg.respond_to?(:write)
p = Tpl.new("A(i)", :id);
p.load("/tmp/file.tpl")
p.unpack(1) {|h| puts h[:id]}

View File

@ -1,5 +0,0 @@
ifdef::backend-xhtml11[]
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<a style="float: right;" href="http://sourceforge.net/projects/tpl"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=157637&amp;type=16" width="150" height="40" alt="SourceForge.net" /></a>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
endif::backend-xhtml11[]

View File

@ -1,85 +0,0 @@
ifdef::backend-xhtml11[]
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<div id="toc"></div>
<script>
window.onload=generate_TOC
/* Author: Mihai Bazon, September 2002
* http://students.infoiasi.ro/~mishoo
*
* Table Of Content generator
* Version: 0.4
*
* Feel free to use this script under the terms of the GNU General Public
* License, as long as you do not remove or alter this notice.
*/
/* modified by Troy D. Hanson, September 2006. License: GPL */
function H_getText(el) {
var text = "";
for (var i = el.firstChild; i != null; i = i.nextSibling) {
if (i.nodeType == 3 /* Node.TEXT_NODE, IE doesn't speak constants */)
text += i.data;
else if (i.firstChild != null)
text += H_getText(i);
}
return text;
}
function TOC_EL(el, text, level) {
this.element = el;
this.text = text;
this.level = level;
}
function getHeadlines(el) {
var l = new Array;
var rx = /[hH]([2-3])/;
// internal recursive function that scans the DOM tree
var rec = function (el) {
for (var i = el.firstChild; i != null; i = i.nextSibling) {
if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
if (rx.exec(i.tagName))
l[l.length] = new TOC_EL(i, H_getText(i), parseInt(RegExp.$1));
rec(i);
}
}
}
rec(el);
return l;
}
function generate_TOC() {
var parent = document.getElementById("toc");
var toc_hdr = document.createElement("div");
var toc_hdr_txt = document.createTextNode("CONTENTS");
toc_hdr.appendChild(toc_hdr_txt);
/* toc_hdr.setAttribute("id","hdr"); */
toc_hdr.id = "hdr";
parent.appendChild(toc_hdr);
var hs = getHeadlines(document.getElementsByTagName("body")[0]);
for (var i = 0; i < hs.length; ++i) {
var hi = hs[i];
var d = document.createElement("div");
if (hi.element.id == "") hi.element.id = "gen" + i;
var a = document.createElement("a");
a.href = "#" + hi.element.id;
a.appendChild(document.createTextNode(hi.text));
d.appendChild(a);
d.className = "level" + hi.level;
parent.appendChild(d);
/*
if (hi.level == 3) {
var dvtop = document.createElement("div");
dvtop.className = "toplink";
dvtop.appendChild(document.createTextNode("^top^"));
dvtop.onclick=function(){scrollTo(0,0);};
hi.element.appendChild(dvtop);
}
*/
}
}
</script>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
endif::backend-xhtml11[]

View File

@ -1,10 +0,0 @@
ifdef::backend-xhtml11[]
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<div id="topnav" style="font-size: 9pt; font-family: sans-serif;">
<a style="padding: 8px;" href="http://sourceforge.net/projects/tpl/">sf.net summary page</a> &gt;
<a style="padding: 8px;" href="index.html">tpl home</a> &gt;
{doctitle}
<a style="padding: 8px;" href="userguide.pdf">[View PDF]</a>
</div>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
endif::backend-xhtml11[]

2371
doc/userguide.html Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,14 +1,13 @@
tpl User Guide
==============
Troy D. Hanson <thanson@users.sourceforge.net>
Troy D. Hanson <tdh@tkhanson.net>
v1.5, February 2010
include::sflogo.txt[]
include::topnav.txt[]
To download tpl, follow this link back to the
https://github.com/troydhanson/tpl[GitHub project page].
Overview
--------
include::toc.txt[]
Serialization in C
~~~~~~~~~~~~~~~~~~
@ -117,18 +116,30 @@ It is free and open source.
Download
~~~~~~~~
Please follow the link to download on the
http://tpl.sourceforge.net[tpl website].
You can clone tpl, or get a zipfile, from the
https://github.com/troydhanson/tpl[GitHub project page].
Getting help
~~~~~~~~~~~~
If you need help, you are welcome to email the author at
mailto:thanson@users.sourceforge.net[].
Please ask on Github if you need help. You can email the author at
Troy D. Hanson <tdh@tkhanson.net>, but I am often behind on email by weeks or
months. Sorry!
Resources
~~~~~~~~~
News::
The author has a news feed for http://troydhanson.wordpress.com/feed/[software updates] image:img/rss.png[(RSS)].
Contributing
~~~~~~~~~~~~
If you add a new feature or fix something in tpl or in the extras, please
make a pull request on Github. For anything other than a trivial change, include
a unit test and documentation if you possibly can. (And don't be discouraged if
it takes weeks or even months for me to merge it. Sorry, my life is busy!) Thanks!
News
~~~~
The author has a blog for http://troydhanson.wordpress.com/[software updates]
image:rss.png[(RSS)]. You can also follow @troydhanson on Twitter for updates.
Other software
^^^^^^^^^^^^^^
Other open-source software by the author is listed at http://tkhanson.net.
Build and install
-----------------