From 9250184bb44c6da99727dbcee9284d8eda4cbbc3 Mon Sep 17 00:00:00 2001 From: ahrenholz Date: Thu, 11 Jun 2009 20:25:46 +0000 Subject: [PATCH] updates --- wiki/Hacking.wiki | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/wiki/Hacking.wiki b/wiki/Hacking.wiki index b14ffa57..6ae5c712 100644 --- a/wiki/Hacking.wiki +++ b/wiki/Hacking.wiki @@ -15,18 +15,35 @@ Any contributions to the CORE project must adhere to these standards. * Tcl/Tk: * function names are CamelCase with a lowercase first letter, example: `proc findFreeIPv6Net { mask } {` * variable names are lowercase words, can have underscores; global variables that are not lists or arrays have a `g_` prefix, example: `set node_types "remote"; global g_prefs` + * constants are defined in all uppercase, with underscores separating words; defined constants should be used instead of magic numbers, example: `set DEFAULT_RANGE 275` * C: * function names are lowercase words separated by underscores, example: `int receive_file_msg(int, uin8_t *, uint16_t);` * variable names are lowercase letters or words with words separated by underscores, example: `int max, err, do_flush;` + * constants are defined in all uppercase, with underscores separating words; defined constants should be used instead of magic numbers, example: `#define MAX_NODES 32` * global variables are used sparingly, named in all lowercase as above, should have a `g_` prefix, example: `struct core_wlan_model *g_models` * macros are defined in all caps with words combined together, example: `#define MAC2STR(addr) ...\` +*indentation* + * Tcl/Tk: proc declarations are not indented; *four-space indenting* is used, with tabs used to represent each indentation of *eight spaces*; example +{{{ +proc myProc { node } { +....foreach ifc [ifcList $node] { +>-------set peer [peerByIfc $ifc] +}}} + + * C: lines start with an *eight-space tab indenting* (a tab character, not eight space characters) and each level is indented with a tab character, example: +{{{ +>-------if (do_daemon) { +>------->-------/* do something */ +>------->-------if (error_condition) +>------->------->-------exit(1); +}}} + + defined types -macros -constants -indentation + comments expressions globals