summaryrefslogtreecommitdiffstats
path: root/docs/CONTRIBUTING
blob: 83f0aa655e552373c1da08c1c311984eeb6cf2ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
$Id$

               __________               __   ___.
     Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
     Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
     Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
     Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
                       \/            \/     \/    \/            \/
                                 Contribution Policies


In order for the project to run as smoothly as possible, it's best if all
contributors adhere to a few simple source code conventions:

Exceptions
----------
This project borrows and imports quite a lot of code from other free software
projects. We do not change style of such code unless we really have to, even
though they might be using style very different from others.

Language
--------
Write all code in C. Sometimes assembly is faster, but C is always more
readable and maintainable.

Language features
-----------------
Write normal C code. Keep it simple. Don't redefine the language. No new types
(structs are structs, not typedefs). No C++isms or Javaisms. No code in .h
files or #defines.

Identifiers
-----------
We do not want mixed case identifiers.
Variables and function names should be all lower case.
Struct and enum names should be all lower case.
Preprocessor symbols and enum constants should be all upper case.

Comments
--------
We only use plain old /* C standard comments */.
If you want to comment out large blocks containing other comments, use #if 0.

Style
-----
When changing code, follow the code style of the file you are editing.

When writing new files, you may use the brace placement style of your choice.

Braces for function declarations are put in a new line under the name, as in:

  int foo(char *name)
  {
     return FOO_NAME:
  }

Always indent your code with four spaces. Don't use TAB characters, as that
will mess up code display in CVS, printing, and a zillion other places.

Keep lines below 80 columns length. Use whitespace and newlines to make the
code easy to browse/read.

Text format
-----------
Use "unix style" line feeds: "LF" only. Do not use "CR+LF".

Use UTF-8 character set, but try to refrain from using any non-ascii
letters as they will only appear weird in some camps no matter what.

Patches
-------
Create a patch using 'svn diff > mychanges.patch
Trim your patches so they only contain relevant changes.

Submit your patch to the project via our patch tracker:
http://www.rockbox.org/tracker/index.php?type=4

Credits
-------
We believe in crediting all contributors by name. Before committing a patch to
SVN, we ask that you give us your full real name (no pseudonyms or nicknames)
for adding to the credits list.