blob: e4267707904e45d91a48a0c30115c6231e5e4ede [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-----------------
28Write normal C code. Don't redefine the language. No new types (structs are
Björn Stenberg83b8ede2004-11-11 09:40:48 +000029structs, not typedefs), no C++isms or Javaisms.
Robert Hak40bafc52002-08-21 10:19:23 +000030
Linus Nielsen Feltzingd5b02462007-10-24 13:08:00 +000031Identifiers
Robert Hak40bafc52002-08-21 10:19:23 +000032-----
Linus Nielsen Feltzingd5b02462007-10-24 13:08:00 +000033We do not want mixed case identifiers.
Robert Hak40bafc52002-08-21 10:19:23 +000034Variables and function names should be all lower case.
Linus Nielsen Feltzingd5b02462007-10-24 13:08:00 +000035Struct and enum names should be all lower case.
36Preprocessor symbols and enum constants should be all upper case.
Robert Hak40bafc52002-08-21 10:19:23 +000037
Daniel Stenberg071898e2003-03-04 15:06:53 +000038Comments
39--------
40We only use plain old /* C standard comments */.
Tomas Salfischbergerabf975d2006-02-27 15:01:34 +000041If you want to comment out large blocks containing other comments, use #if 0.
Daniel Stenberg071898e2003-03-04 15:06:53 +000042
Robert Hak40bafc52002-08-21 10:19:23 +000043Style
44-----
45When changing code, follow the code style of the file you are editing.
46
47When writing new files, you may use the brace placement style of your choice.
48
Daniel Stenberg8e757342007-09-06 11:08:23 +000049Braces for function declarations are put in a new line under the name, as in:
50
51 int foo(char *name)
52 {
53 return FOO_NAME:
54 }
55
Robert Hak40bafc52002-08-21 10:19:23 +000056Always indent your code with four spaces. Don't use TAB characters, as that
57will mess up code display in CVS, printing, and a zillion other places.
58
59Keep lines below 80 columns length. Use whitespace and newlines to make the
60code easy to browse/read.
61
62Text format
63-----------
64Use "unix style" line feeds: "LF" only. Do not use "CR+LF".
65
Daniel Stenberg95cde0b2005-10-28 10:44:50 +000066Use ISO-8859-1 character set, but try to refrain from using any non-ascii
67letters as they will only appear weird in some camps no matter what.
68
Robert Hak40bafc52002-08-21 10:19:23 +000069Patches
70-------
Peter D'Hoye9ae05c32007-01-10 21:25:59 +000071Create a patch using 'svn diff > mychanges.patch
Robert Hak40bafc52002-08-21 10:19:23 +000072Trim your patches so they only contain relevant changes.
Robert Hak40bafc52002-08-21 10:19:23 +000073
Daniel Stenberg55da2792006-02-26 23:28:15 +000074Submit your patch to the project via our patch tracker:
Dave Chapman2c3fd0c2006-08-11 00:21:42 +000075http://www.rockbox.org/tracker/index.php?type=4
Björn Stenberg4a67c872006-03-09 14:58:15 +000076
77Credits
78-------
79We believe in crediting all contributors by name. Before committing a patch to
Nicolas Pennequin77bdacc2007-05-24 18:56:09 +000080SVN, we ask that you give us your full real name (no pseudonyms or nicknames)
Björn Stenberg4a67c872006-03-09 14:58:15 +000081for adding to the credits list.