Complete Examples
Your primary source of examples is of course the
examples page. This page,
however, shows the simplest possible design and a very complex design
in source code. Verify your insights from the previous sections.
The simplest possible box design:
BOX simple
sample
++++++++++++
+ +
++++++++++++
ends
shapes {
n("+") s("+") e("+") w("+")
nw("+") ne("+") se("+") sw("+")
}
elastic (n,s,e,w)
END simple
A complete, very complex box design:
BOX tjc
author "Thomas Jensen
<boxes(at)thomasjensen.com>
"
revision "1.1"
revdate "July 16, 1999 (Friday, 18:55h)"
created "April 02, 1999 (Friday, 19:26h)"
Sample
static char *foo (const int a, const int b)
/*
* Do the foo on the bar and around again.
*
* a number of doodlefrobs
* b barfoo mode (0 == off)
*
* Memory will be allocated for the result.
* Should only be called for lines of length > 0;
*
* RETURNS: Success: Pointer to result line
* Error: 0 (e.g. out of memory)
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
{
static char temp ....
int ii; ....
ends
indent "none" # alternatives: "box", "text"
shapes {
wnw ("/*")
w (" *")
sw ("* ", " *")
ssw ("*", "/")
s (" *", " ")
}
elastic (s, w)
delimiter ?"
replace "\*/" with "*\/" # quote closing comment tags
reverse "\*\\/" to "*/"
padding {
left 2
vertical 1
}
END tjc
Note the SAMPLE block of the latter example. It shows much more than
just the box itself, trying to give the user an impression of what the box
would look like if used in reality. We only need half the backslashes in the
REVERSE and REPLACE statements because we use
delimiter to change the escape character from backslash to question
mark.
[ up | next ]
boxes
©1999 by Thomas Jensen
<boxes(at)thomasjensen.com>
Page created April 06, 1999, last touched: 26-Feb-2006.
All rights reserved.