| Download - MAIN PAGE |
Unless stated otherwise, the input used for these examples is the following:
Different all twisty a of in maze are you, passages little.
Draws a standard box of the first valid design found in your config file. If you have the config file as it comes with the boxes distribution, you get a "C" box, as you can see above.
/**************************/ /* Different all twisty a */ /* of in maze are you, */ /* passages little. */ /**************************/
The -d design_name option selects another design from your config file.
________________________ /\ \ \_|Different all twisty a| |of in maze are you, | |passages little. | | ___________________|_ \_/_____________________/
The -a format option can be used to position the input text inside a box which is larger than needed for our text. hcvc stands for "horizontally centered, vertically centered".
/\ /\ /\ /\//\\/\ /\//\\/\ /\//\\/\ /\//\\\///\\/\//\\\///\\/\//\\\///\\/\ //\\\//\/\\///\\\//\/\\///\\\//\/\\///\\ \\//\/ \/\\// \/ \/ /\ Different all twisty a /\ //\\ of in maze are you, //\\ \\// passages little. \\// \/ \/ /\ /\ //\\/\ /\//\\ \\///\\/\//\\\///\\/\//\\\///\\/\//\\\// \/\\///\\\//\/\\///\\\//\/\\///\\\//\/ \/\\//\/ \/\\//\/ \/\\//\/ \/ \/ \/
This uses the third possible argument to the -a option, j. jr stands for "justification right" - consequences are obvious.
************************ *Different all twisty a* * of in maze are you,* * passages little.* ************************
Since noone really wants to type -a hcvcjc only to actually center text inside a box, there are shorthand notations (l, c, and r).
__ _,--="=--,_ __ / \." .-. "./ \ / ,/ _ : : _ \/` \ \ `| /o\ :_: /o\ |\__/ `-'| :="~` _ `~"=: | \` (_) `/ .-"-. \ | / .-"-. .---{ }--| /,.-'-.,\ |--{ }---. ) (_)_)_) \_/`~-===-~`\_/ (_(_(_) ( ( Different all twisty a ) ) of in maze are you, ( ( passages little. ) ) ( '---------------------------------------'
Using -s 40, we have set the box width to 40 characters.
You see, -s 40x11 sets both width and height. Guess how one can influence the height alone. :-)
/* _\|/_ (o o) +----oOO-{_}-OOo----------------------+ | | | | | Different all twisty a | | of in maze are you, | | passages little. | | | | | +------------------------------------*/
Normally, the padding values depend on the design. The "shell" design has no default padding, so we can see the effects of our command line option unchanged. a1l2 stands for "all 1, left 2" tells boxes to put one space (or empty line, in the vertical direction) around the input text block, except for the left side where two spaces shall be used.
########################### # # # Different all twisty a # # of in maze are you, # # passages little. # # # ###########################
This uses again the default design, which by default features a horizontal padding value of one space (as you know from the very first example). By specifying -p h0v0, we set all padding to zero ("horizontal 0, vertical 0"). The same could have been achieved by -p h0 or -p a0, of course.
/************************/ /*Different all twisty a*/ /*of in maze are you, */ /*passages little. */ /************************/
boxes -d c-cmt
if (!s2 || *s2 == '\0') return (char *) s1; /* error 1 */ if (!s1 || *s1 == '\0') return NULL; /* error 2 */ if (skip < 0) skip = 0; /* foo bar */
Note that the closing comment tags in the input text have been escaped by adding a backslash between the asterisk and the slash. This way, the comments that have been commented out along with the rest of the code will not interfere with the new comments.
/* if (!s2 || *s2 == '\0') */ /* return (char *) s1; /* error 1 *\/ */ /* if (!s1 || *s1 == '\0') */ /* return NULL; /* error 2 *\/ */ /* if (skip < 0) */ /* skip = 0; /* foo bar *\/ */
boxes -r
Should you decide to reactivate the code previouly commented out, the escaped closing comment tags are changed back into normal ones.
if (!s2 || *s2 == '\0') return (char *) s1; /* error 1 */ if (!s1 || *s1 == '\0') return NULL; /* error 2 */ if (skip < 0) skip = 0; /* foo bar */
boxes -r
/********************************************************************/ /* Generate sorted listing of available box styles. Uses design name from BOX spec and sample picture plus author. */ /* RETURNS: != 0 on error (out of memory) */ == 0 on success */ /********************************************************************/
The box correctly removed even though it's been badly damaged by editing of the text inside. Obviously, the box design was correctly autodected as being "C".
Generate sorted listing of available box styles. Uses design name from BOX spec and sample picture plus author. RETURNS: != 0 on error (out of memory) == 0 on success
boxes -r -d html
In such cases, as you see, -d design_name can be added to the -r command in order to tell boxes which design exactly to remove. It is always a good thing to use the -d option, because it makes autodetection unnecessary. Autodetection takes more time, because the entire config file must be parsed instead of just the one design needed, and all designs must be matched against the input text in order to see which one fits best.
Different all twisty a of in maze are you, passages little.
boxes -d java-cmt -i box
Different all twisty a of in maze are you, passages little.
The default indent mode is box, which indents the box by the same value as the input text was indented. As shown here, this is useful when adding regional comments to your source code, e.g. when "commenting out" a large portion of your code. IMHO, it is generally preferable to indent comments by the same value as the code they refer to, so they don't upset the code structure.
// Different all twisty a // of in maze are you, // passages little.
boxes -d vim-cmt -i text
By specifying -i text, the box is made to start at column zero and any input text indentation is retained inside the box.
" Different all twisty a " of in maze are you, " passages little.
boxes -d pound-cmt -i none
Finally, it is also possible to throw away any indentation altogther by specifying -i none.
# Different all twisty a # of in maze are you, # passages little.
boxes -d headline
Global Variables
The replace and reverse statements may contain regular expressions and backreferences, which can be used for more elaborate text modifications.
/*************************************/ /* G l o b a l V a r i a b l e s */ /*************************************/
boxes -d headline -r
Global Variables
| Download - MAIN PAGE |