diff options
-rw-r--r-- | doc/apis.txt | 69 | ||||
-rwxr-xr-x | doc/intern.txt | 12 | ||||
-rwxr-xr-x | tools/nimweb.nim | 11 |
3 files changed, 89 insertions, 3 deletions
diff --git a/doc/apis.txt b/doc/apis.txt new file mode 100644 index 000000000..02caa8c24 --- /dev/null +++ b/doc/apis.txt @@ -0,0 +1,69 @@ +========== +API design +========== + +The API is designed to be **easy to use** and consistent. Ease of use is +measured by the number of calls to achieve a concrete high level action. + + +Naming scheme +============= + +The library uses a simple naming scheme that makes use of common abbreviations +to keep the names short but meaningful. Since version 0.8.2 many symbols have +been renamed to fit this scheme. The ultimate goal is that the programmer can +*guess* a name. + + +------------------- ------------ -------------------------------------- +English word To use Notes +------------------- ------------ -------------------------------------- +find find should return the position where + something was found; for a bool result + use ``contains`` +contains contains often short for ``find() >= 0`` +append add use ``add`` instead of ``append`` +compare cmp should return an int with the + ``< 0`` ``== 0`` or ``> 0`` semantics; + for a bool result use ``sameXYZ`` +put put, ``[]=`` consider overloading ``[]=`` for put +get get, ``[]`` consider overloading ``[]`` for get; + consider to not use ``get`` as a + prefix: ``len`` instead of ``getLen`` +length len also used for *number of elements* +size size, len size should refer to a byte size +items items default iterator over a collection +pairs pairs iterator over (key, value) pairs +delete delete, del del is supposed to be faster than + delete, because it does not keep + the order; delete keeps the order +remove delete, del inconsistent right now +include incl +exclude excl +command cmd +execute exec +environment env +variable var +value value, val val is preferred, inconsistent right + now +executable exe +directory dir +path path path is the string "/usr/bin" (for + example), dir is the content of + "/usr/bin"; inconsistent right now +extension ext +separator sep +column col, column col is preferred, inconsistent right + now +configuration cfg +message msg +argument arg +object obj +parameter param +operator opr +procedure proc +function func +coordinate coord +rectangle rect +point point +------------------- ------------ -------------------------------------- diff --git a/doc/intern.txt b/doc/intern.txt index c45765b23..58879c659 100755 --- a/doc/intern.txt +++ b/doc/intern.txt @@ -119,6 +119,18 @@ be converted to Nimrod automatically: itself. +Coding Guidelines +================= + +* Use CamelCase, not underscored_identifiers. +* Indent with two spaces. +* Max line length is 80 characters. +* Provide spaces around binary operators if that enhances readability. +* Use a space after a colon, but not before it. +* Start types with a capital ``T``, unless they are pointers which start + with ``P``. + + Porting to new platforms ======================== diff --git a/tools/nimweb.nim b/tools/nimweb.nim index 135ba518a..ef59c2fb9 100755 --- a/tools/nimweb.nim +++ b/tools/nimweb.nim @@ -41,9 +41,9 @@ include "sunset.tmpl" const Version = "0.6" - Usage = "nimweb - Nimrod Installation Generator Version " & version & """ + Usage = "nimweb - Nimrod Website Generator Version " & version & """ - (c) 2008 Andreas Rumpf + (c) 2009 Andreas Rumpf Usage: nimweb [options] ini-file[.ini] [compile_options] Options: @@ -159,7 +159,6 @@ proc buildDoc(c: var TConfigData, destPath: string) = Exec("nimrod rst2html $# -o:$# --index=$#/theindex $#" % [c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"), destpath, d]) - Exec("nimrod rst2tex $# $#" % [c.nimrodArgs, d]) for d in items(c.srcdoc): Exec("nimrod doc $# -o:$# --index=$#/theindex $#" % [c.nimrodArgs, destPath / changeFileExt(splitFile(d).name, "html"), @@ -167,6 +166,12 @@ proc buildDoc(c: var TConfigData, destPath: string) = Exec("nimrod rst2html $1 -o:$2/theindex.html $2/theindex" % [c.nimrodArgs, destPath]) +proc buildPdfDoc(c: var TConfigData, destPath: string) = + for d in items(c.doc): + Exec("nimrod rst2tex $# $#" % [c.nimrodArgs, d]) + + + proc buildAddDoc(c: var TConfigData, destPath: string) = # build additional documentation (without the index): for d in items(c.webdoc): |