* updated the HACKING instructions

This commit is contained in:
djcb
2012-03-24 11:17:11 +02:00
parent 3fb7e5d6ff
commit d44cb572ef

24
HACKING
View File

@ -7,10 +7,12 @@
so as long as any new code 'fits in', it should go a long way in satisfying so as long as any new code 'fits in', it should go a long way in satisfying
them. them.
I should add some notes for the Lisp/Scheme code as well...
** Coding style ** Coding style
For consistency and, even more important, to keep things understandable, mu For consistency and, even more important, to keep things understandable, mu
follows the following rules: attempts to follow the following rules:
1. basic code layout is like in the Linux kernel coding style, with the '{' 1. basic code layout is like in the Linux kernel coding style, with the '{'
on the same line as the statement, except for functions. Tabs/spaces on the same line as the statement, except for functions. Tabs/spaces
@ -18,10 +20,9 @@
2. lines must not exceed 80 characters (C) or 100 characters (C++) 2. lines must not exceed 80 characters (C) or 100 characters (C++)
3. functions must not exceed 40 lines (there could be rare exceptions, 3. functions must not exceed 35 lines. You can easily check if any functions
currently there are none in mu), and 30 lines is already pretty long. You violate this rule with 'make line35', which lists all functions with more
can easily check if any functions violate this rule with 'make line33', than 35 non-comment lines.
which lists all functions with more than 33 non-comment lines.
4. source files should not exceed 1000 lines 4. source files should not exceed 1000 lines
@ -31,7 +32,8 @@
can use 'make cc10' to list all functions that violate this rule; there can use 'make cc10' to list all functions that violate this rule; there
should be none. should be none.
6. filenames have their components separated with dashes (e.g, 'mu-log.h') 6. filenames have their components separated with dashes (e.g, 'mu-log.h'),
and start with 'mu-' where appropriate.
7. global functions have the prefix based on their module, e.g., mu-foo.h 7. global functions have the prefix based on their module, e.g., mu-foo.h
declares a function of 'mu_foo_bar (int a);', mu-foo.c implements this. declares a function of 'mu_foo_bar (int a);', mu-foo.c implements this.
@ -62,7 +64,7 @@
12. functions calls have a space between function name and arguments, unless 12. functions calls have a space between function name and arguments, unless
there are none, so: there are none, so:
foo(12, 3); foo (12, 3);
and and
@ -75,7 +77,7 @@
C) C)
** Logging ** Logging
For logging, mu uses the GLib logging functions/macros as listed below, For logging, mu uses the GLib logging functions/macros as listed below,
except when logging may not have been initialized. except when logging may not have been initialized.
@ -103,9 +105,9 @@
Anyhow, to compile straight from git: Anyhow, to compile straight from git:
$ git clone git://gitorious.org/mu/mu.git $ git clone https://github.com/djcb/mu
$ cd mu $ cd mu
$ autoreconf -i $ autoreconf -i
$ ./configure $ ./configure
$ make $ make
@ -113,5 +115,3 @@
# Local Variables: # Local Variables:
# mode: org; org-startup-folded: nil # mode: org; org-startup-folded: nil
# End: # End: