FreeEMS  0.2.0-SNAPSHOT-285-g028e24c
codingStyle.h
Go to the documentation of this file.
1 /* FreeEMS - the open source engine management system
2  *
3  * Copyright 2010 Fred Cooke
4  *
5  * This file is part of the FreeEMS project.
6  *
7  * FreeEMS software is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * FreeEMS software is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with any FreeEMS software. If not, see http://www.gnu.org/licenses/
19  *
20  * We ask that if you make any changes to this file you email them upstream to
21  * us at admin(at)diyefi(dot)org or, even better, fork the code on github.com!
22  *
23  * Thank you for choosing FreeEMS to run your engine!
24  */
25 
26 /** @page codingStyle Coding Style
27  *
28  * @b Sections:
29  * - Licensing
30  * - Copyright
31  * - Documentation
32  * - Doxygen
33  * - Naming
34  * - Abbreviations
35  * - Multiple names - which to use
36  * - Formatting
37  * - Reserved words
38  * - Language use
39  * - References
40  * - Structure
41  * - New variables
42  * - New features/functions
43  *
44  * @b Details:
45  * - All new files should be based on the gpl.template.* files and have documentation about their intended use
46  * - All files should have the GPL header inside them
47  * - When you work on a file that exists, add your name to the copyright (unless the edit is extremely minor http://www.gnu.org/prep/maintain/html_node/Legally-Significant.html)
48  * - If the the copyright year is not the current year, extend the range
49  * - eg Copyright 2008-2012 Fred Cooke
50  * - Dates in the code should be DD/MM/YY for easy reading
51  * - Dates in file names should be YYYY-MM-DD for easy sorting
52  * - Use Doxygen style comments
53  * - Document all parameters
54  * - Document return object details
55  * - use @ instead of \
56  * - to start a function comment block use ** instead of *!
57  * - when declaring a pointer make it (type* name) not (type *name)
58  * - Never use int, always char, short or long
59  * - Always use full types, eg unsigned char not char and signed short instead of short
60  * - use // style comments for temporary work/documentation and block comments for permanent stuff.
61  * - order for doc tags : author, param(s), return
62  * - tabs should be used for indentation
63  * - spaces should be used to space out from variable width text before more tabs
64  * - generally, two blank lines between functions, one blank line between logical blocks
65  * - default tab size is 4 spaces, currently best viewed with that, but working on making it clean for any.
66  * - Include order should have the most general thing first and most specific last :
67  * @code
68  * #include <string.h>
69  * #include "inc/freeEMS.h"
70  * #include "inc/utils.h"
71  * #include "inc/thisFilesHeader.h"
72  * @endcode
73  *
74  * - braces should be positioned as follows with the opening brace on the same line as the function name and no leading space:
75  * @code
76  * void function(){
77  * // code
78  * }
79  * @endcode
80  *
81  * - case statements should always use braces :
82  * @code
83  * switch(var){
84  * case 666:
85  * {
86  * // code
87  * }
88  * }
89  * @endcode
90  *
91  * - parameter lists should look like this with a space after each comma and no leading or trailing spaces
92  * @code
93  * void function(unsigned char one, signed short another){
94  * // code
95  * }
96  *
97  * function(255, -32768);
98  * @endcode
99  *
100  * @b Discussion:
101  *
102  * We need to figure out a consistent way of naming variables and functions and
103  * files etc. The main thing that needs deciding is which scheme from the following:
104  * - UPPER_CASE
105  * - lower_case
106  * - lowerCamelCase
107  * - UpperCamelCase
108  * - Other ways?
109  *
110  * The categories of names required to be discussed are as follows:
111  * - hash defines
112  * - register aliases
113  * - register masks
114  * - custom masks
115  * - error codes
116  * - payload IDs
117  * - constant values (would be literals)
118  * - what else?
119  * - structs (and unions)
120  * - struct typedefs
121  * - struct members
122  * - struct instances
123  * - local variables
124  * - global variables
125  * - files
126  * - header see source :
127  * - source - RPM ISRs and data initialisers UpperCamelCase - the rest lowerCamelCase
128  * - doxygen
129  * - standalone documentation
130  * - JSON files and schemas
131  * - linker scripts
132  * - makefiles
133  * - readme/readme.txt/README/README.txt
134  *
135  * Please see the following Mantis issue for the original mandate to produce this document:
136  * - http://issues.freeems.org/view.php?id=10
137  */
138 
139 /** @file
140  *
141  * @ingroup doxygenDocFiles
142  * @brief Doxygen Coding Style page definition
143  */