| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| 2 |
<HTML> |
| 3 |
<HEAD> |
| 4 |
<META NAME="generator" CONTENT="http://txt2tags.sf.net"> |
| 5 |
<LINK REL="stylesheet" TYPE="text/css" HREF="style.css"> |
| 6 |
<TITLE>LeMock</TITLE> |
| 7 |
</HEAD> |
| 8 |
<BODY> |
| 9 |
|
| 10 |
<DIV CLASS="header" ID="header"> |
| 11 |
<H1>LeMock</H1> |
| 12 |
</DIV> |
| 13 |
|
| 14 |
<DIV CLASS="body" ID="page-DEVEL"> |
| 15 |
<ul id="main_menu"> |
| 16 |
<li id="main_menu-README"><a href="README.html" >Readme</a></li> |
| 17 |
<li id="main_menu-COPYRIGHT"><a href="COPYRIGHT.html">License</a></li> |
| 18 |
<li id="main_menu-userguide"><a href="userguide.html">Userguide</a></li> |
| 19 |
<li id="main_menu-HISTORY"><a href="HISTORY.html" >History</a></li> |
| 20 |
<li id="main_menu-DEVEL"><a href="DEVEL.html" >Devel</a></li> |
| 21 |
</ul> |
| 22 |
<H1>Developer Notes</H1> |
| 23 |
<P> |
| 24 |
LeMock is implemented in Lua 5.1, but its source code is written as |
| 25 |
literate documents, and usees the tool noweb to generate the .lua files. |
| 26 |
The distributed source archive includes all the tangled files in the build |
| 27 |
directory, to avoid dependending on noweb for installation. |
| 28 |
</P> |
| 29 |
<P> |
| 30 |
The source is contained in the src directory in the form of literate |
| 31 |
documents. To extract (tangle) the final files from the sources, the tool |
| 32 |
<A HREF="http://www.cs.tufts.edu/~nr/noweb/">noweb</A> is needed. |
| 33 |
</P> |
| 34 |
<P> |
| 35 |
The source files are meant to be tangled together all at once, because the |
| 36 |
contents of a target file can be spread over several source files. The |
| 37 |
target files are all the chunk names that are roots. These can be found |
| 38 |
with noroots in the noweb toolbox. To automate the tangle process, there is |
| 39 |
a custom script named autotangle in the tools directory. This script finds |
| 40 |
all the target file names and tangles them in the current directory, |
| 41 |
creating subdirectories as needed. The script is written for yet another |
| 42 |
obscure tool, <A HREF="http://www.libra-aries-books.co.uk/software/rc">rc</A> [1]. It |
| 43 |
is probably easy to port the short rc script to your favourit language. It |
| 44 |
is invoked (in rc syntax) as: |
| 45 |
</P> |
| 46 |
<PRE> |
| 47 |
../tools/autotangle `{find ../src -name '*.nw'} |
| 48 |
</PRE> |
| 49 |
<P></P> |
| 50 |
<P> |
| 51 |
which means it wants all (recursively) .nw files in the src directory as |
| 52 |
arguments. |
| 53 |
</P> |
| 54 |
<P> |
| 55 |
The documentation is written in <A HREF="http://txt2tags.sourceforge.net/">txt2tags</A>, |
| 56 |
which can generate HTML among many other formats. The README, HISTORY, |
| 57 |
COPYRIGHT, and this DEVEL text file are written as simple txt2tags |
| 58 |
documents to remain readable as is. The .nw source files define wrapper |
| 59 |
txt2tags documents for the web pages, which use txt2tags' include mechanism |
| 60 |
to include the actual txt2tags files. The user guide is defined in the .nw |
| 61 |
sources as a separate txt2tags document, so it can be easily generated as a |
| 62 |
LaTeX document or Unix man page, but it too is included in a wrapper |
| 63 |
txt2tags document when generating the web pages. |
| 64 |
</P> |
| 65 |
<P> |
| 66 |
The building of the web pages is done with |
| 67 |
<A HREF="http://en.wikipedia.org/wiki/Mk_%28software%29">mk</A>, a Unix port of the |
| 68 |
Plan9 make tool. (The mk files uses rc syntax.) |
| 69 |
</P> |
| 70 |
<P> |
| 71 |
A set of unit tests (defined in the .nw source) can be run with |
| 72 |
<A HREF="http://www.nessie.de/mroth/lunit/index.html">lunit</A> with the command: |
| 73 |
</P> |
| 74 |
<PRE> |
| 75 |
lunit unit/*.lua |
| 76 |
</PRE> |
| 77 |
<P></P> |
| 78 |
<P> |
| 79 |
A program like <A HREF="http://luacov.luaforge.net/">luacov</A> can be used to check |
| 80 |
the coverage of the unit tests. |
| 81 |
</P> |
| 82 |
<HR NOSHADE SIZE=1> |
| 83 |
<H2>Footnotes</H2> |
| 84 |
<DL> |
| 85 |
<DT>[1]</DT><DD> |
| 86 |
I use Byron's Unix port, which syntax is extended and incompatible with |
| 87 |
the original (and other ports). |
| 88 |
</DL> |
| 89 |
|
| 90 |
<HR NOSHADE SIZE=1> |
| 91 |
<P> |
| 92 |
2009-05-31 |
| 93 |
</P> |
| 94 |
</DIV> |
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
</BODY></HTML> |