# HG changeset patch # User Rob Landley # Date 1198813004 21600 # Node ID ca48a878255d401198456ded14dcb23075852308 # Parent 5697a3f7c8cfa91d400ce4d6e777c2145fdf2fb9 Brief note about code style. diff -r 5697a3f7c8cf -r ca48a878255d www/code.html --- a/www/code.html Thu Dec 27 21:36:33 2007 -0600 +++ b/www/code.html Thu Dec 27 21:36:44 2007 -0600 @@ -1,5 +1,20 @@ +

Code style

+ +

Toybox source is formatted to be read with 4-space tab stops. Each file +starts with a special comment telling vi to set the tab stop to 4. Note that +one of the bugs in Ubuntu 7.10 broke vi's ability to parse these comments; you +must either rebuild vim from source, or go ":ts=4" yourself each time you load +the file.

+ +

Gotos are allowed for error handling, and for breaking out of +nested loops. In general, a goto should only jump forward (not back), and +should either jump to the end of an outer loop, or to error handling code +at the end of the function. Goto labels are never indented: they override the +block structure of the file. Putting them at the left edge makes them easy +to spot as overrides to the normal flow of control, which they are.

+

Infrastructure:

The toybox source code is in three directories. The top level directory