Robert Hak | 40bafc5 | 2002-08-21 10:19:23 +0000 | [diff] [blame] | 1 | $Id$ |
| 2 | |
Robert Hak | 465ba3e | 2002-08-21 10:29:58 +0000 | [diff] [blame] | 3 | __________ __ ___. |
| 4 | Open \______ \ ____ ____ | | _\_ |__ _______ ___ |
| 5 | Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / |
| 6 | Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < |
| 7 | Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ |
| 8 | \/ \/ \/ \/ \/ |
| 9 | Contribution Policies |
| 10 | |
| 11 | |
Robert Hak | 40bafc5 | 2002-08-21 10:19:23 +0000 | [diff] [blame] | 12 | In order for the project to run as smoothly as possible, it's best if all |
Daniel Stenberg | e248eac | 2006-03-03 07:31:54 +0000 | [diff] [blame] | 13 | contributors adhere to a few simple source code conventions: |
| 14 | |
| 15 | Exceptions |
| 16 | ---------- |
| 17 | This project borrows and imports quite a lot of code from other free software |
| 18 | projects. We do not change style of such code unless we really have to, even |
| 19 | though they might be using style very different from others. |
Robert Hak | 40bafc5 | 2002-08-21 10:19:23 +0000 | [diff] [blame] | 20 | |
| 21 | Language |
| 22 | -------- |
| 23 | Write all code in C. Sometimes assembly is faster, but C is always more |
| 24 | readable and maintainable. |
| 25 | |
| 26 | Language features |
| 27 | ----------------- |
| 28 | Write normal C code. Don't redefine the language. No new types (structs are |
Björn Stenberg | 83b8ede | 2004-11-11 09:40:48 +0000 | [diff] [blame] | 29 | structs, not typedefs), no C++isms or Javaisms. |
Robert Hak | 40bafc5 | 2002-08-21 10:19:23 +0000 | [diff] [blame] | 30 | |
| 31 | Names |
| 32 | ----- |
| 33 | Variables and function names should be all lower case. |
| 34 | Preprocessor symbols should be all uppercase. |
| 35 | |
Daniel Stenberg | 071898e | 2003-03-04 15:06:53 +0000 | [diff] [blame] | 36 | Comments |
| 37 | -------- |
| 38 | We only use plain old /* C standard comments */. |
Tomas Salfischberger | abf975d | 2006-02-27 15:01:34 +0000 | [diff] [blame] | 39 | If you want to comment out large blocks containing other comments, use #if 0. |
Daniel Stenberg | 071898e | 2003-03-04 15:06:53 +0000 | [diff] [blame] | 40 | |
Robert Hak | 40bafc5 | 2002-08-21 10:19:23 +0000 | [diff] [blame] | 41 | Style |
| 42 | ----- |
| 43 | When changing code, follow the code style of the file you are editing. |
| 44 | |
| 45 | When writing new files, you may use the brace placement style of your choice. |
| 46 | |
Daniel Stenberg | 8e75734 | 2007-09-06 11:08:23 +0000 | [diff] [blame^] | 47 | Braces for function declarations are put in a new line under the name, as in: |
| 48 | |
| 49 | int foo(char *name) |
| 50 | { |
| 51 | return FOO_NAME: |
| 52 | } |
| 53 | |
Robert Hak | 40bafc5 | 2002-08-21 10:19:23 +0000 | [diff] [blame] | 54 | Always indent your code with four spaces. Don't use TAB characters, as that |
| 55 | will mess up code display in CVS, printing, and a zillion other places. |
| 56 | |
| 57 | Keep lines below 80 columns length. Use whitespace and newlines to make the |
| 58 | code easy to browse/read. |
| 59 | |
| 60 | Text format |
| 61 | ----------- |
| 62 | Use "unix style" line feeds: "LF" only. Do not use "CR+LF". |
| 63 | |
Daniel Stenberg | 95cde0b | 2005-10-28 10:44:50 +0000 | [diff] [blame] | 64 | Use ISO-8859-1 character set, but try to refrain from using any non-ascii |
| 65 | letters as they will only appear weird in some camps no matter what. |
| 66 | |
Robert Hak | 40bafc5 | 2002-08-21 10:19:23 +0000 | [diff] [blame] | 67 | Patches |
| 68 | ------- |
Peter D'Hoye | 9ae05c3 | 2007-01-10 21:25:59 +0000 | [diff] [blame] | 69 | Create a patch using 'svn diff > mychanges.patch |
Robert Hak | 40bafc5 | 2002-08-21 10:19:23 +0000 | [diff] [blame] | 70 | Trim your patches so they only contain relevant changes. |
Robert Hak | 40bafc5 | 2002-08-21 10:19:23 +0000 | [diff] [blame] | 71 | |
Daniel Stenberg | 55da279 | 2006-02-26 23:28:15 +0000 | [diff] [blame] | 72 | Submit your patch to the project via our patch tracker: |
Dave Chapman | 2c3fd0c | 2006-08-11 00:21:42 +0000 | [diff] [blame] | 73 | http://www.rockbox.org/tracker/index.php?type=4 |
Björn Stenberg | 4a67c87 | 2006-03-09 14:58:15 +0000 | [diff] [blame] | 74 | |
| 75 | Credits |
| 76 | ------- |
| 77 | We believe in crediting all contributors by name. Before committing a patch to |
Nicolas Pennequin | 77bdacc | 2007-05-24 18:56:09 +0000 | [diff] [blame] | 78 | SVN, we ask that you give us your full real name (no pseudonyms or nicknames) |
Björn Stenberg | 4a67c87 | 2006-03-09 14:58:15 +0000 | [diff] [blame] | 79 | for adding to the credits list. |