blob: 83f0aa655e552373c1da08c1c311984eeb6cf2ba [file] [log] [blame]
Robert Hak40bafc52002-08-21 10:19:23 +00001$Id$
2
Robert Hak465ba3e2002-08-21 10:29:58 +00003 __________ __ ___.
4 Open \______ \ ____ ____ | | _\_ |__ _______ ___
5 Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6 Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7 Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 \/ \/ \/ \/ \/
9 Contribution Policies
10
11
Robert Hak40bafc52002-08-21 10:19:23 +000012In order for the project to run as smoothly as possible, it's best if all
Daniel Stenberge248eac2006-03-03 07:31:54 +000013contributors adhere to a few simple source code conventions:
14
15Exceptions
16----------
17This project borrows and imports quite a lot of code from other free software
18projects. We do not change style of such code unless we really have to, even
19though they might be using style very different from others.
Robert Hak40bafc52002-08-21 10:19:23 +000020
21Language
22--------
23Write all code in C. Sometimes assembly is faster, but C is always more
24readable and maintainable.
25
26Language features
27-----------------
Björn Stenbergff8e9d92009-10-23 07:26:48 +000028Write normal C code. Keep it simple. Don't redefine the language. No new types
29(structs are structs, not typedefs). No C++isms or Javaisms. No code in .h
30files or #defines.
Robert Hak40bafc52002-08-21 10:19:23 +000031
Linus Nielsen Feltzingd5b02462007-10-24 13:08:00 +000032Identifiers
Frank Gevaertsb411f5e2009-02-12 20:49:53 +000033-----------
Linus Nielsen Feltzingd5b02462007-10-24 13:08:00 +000034We do not want mixed case identifiers.
Robert Hak40bafc52002-08-21 10:19:23 +000035Variables and function names should be all lower case.
Linus Nielsen Feltzingd5b02462007-10-24 13:08:00 +000036Struct and enum names should be all lower case.
37Preprocessor symbols and enum constants should be all upper case.
Robert Hak40bafc52002-08-21 10:19:23 +000038
Daniel Stenberg071898e2003-03-04 15:06:53 +000039Comments
40--------
41We only use plain old /* C standard comments */.
Tomas Salfischbergerabf975d2006-02-27 15:01:34 +000042If you want to comment out large blocks containing other comments, use #if 0.
Daniel Stenberg071898e2003-03-04 15:06:53 +000043
Robert Hak40bafc52002-08-21 10:19:23 +000044Style
45-----
46When changing code, follow the code style of the file you are editing.
47
48When writing new files, you may use the brace placement style of your choice.
49
Daniel Stenberg8e757342007-09-06 11:08:23 +000050Braces for function declarations are put in a new line under the name, as in:
51
52 int foo(char *name)
53 {
54 return FOO_NAME:
55 }
56
Robert Hak40bafc52002-08-21 10:19:23 +000057Always indent your code with four spaces. Don't use TAB characters, as that
58will mess up code display in CVS, printing, and a zillion other places.
59
60Keep lines below 80 columns length. Use whitespace and newlines to make the
61code easy to browse/read.
62
63Text format
64-----------
65Use "unix style" line feeds: "LF" only. Do not use "CR+LF".
66
Nicolas Pennequin357ffb32008-05-05 10:32:46 +000067Use UTF-8 character set, but try to refrain from using any non-ascii
Daniel Stenberg95cde0b2005-10-28 10:44:50 +000068letters as they will only appear weird in some camps no matter what.
69
Robert Hak40bafc52002-08-21 10:19:23 +000070Patches
71-------
Peter D'Hoye9ae05c32007-01-10 21:25:59 +000072Create a patch using 'svn diff > mychanges.patch
Robert Hak40bafc52002-08-21 10:19:23 +000073Trim your patches so they only contain relevant changes.
Robert Hak40bafc52002-08-21 10:19:23 +000074
Daniel Stenberg55da2792006-02-26 23:28:15 +000075Submit your patch to the project via our patch tracker:
Dave Chapman2c3fd0c2006-08-11 00:21:42 +000076http://www.rockbox.org/tracker/index.php?type=4
Björn Stenberg4a67c872006-03-09 14:58:15 +000077
78Credits
79-------
80We believe in crediting all contributors by name. Before committing a patch to
Nicolas Pennequin77bdacc2007-05-24 18:56:09 +000081SVN, we ask that you give us your full real name (no pseudonyms or nicknames)
Björn Stenberg4a67c872006-03-09 14:58:15 +000082for adding to the credits list.