diff options
author | Simon Howard | 2006-09-20 10:47:13 +0000 |
---|---|---|
committer | Simon Howard | 2006-09-20 10:47:13 +0000 |
commit | ac7b10dceb0a254ff960c11c24ba14abe568f7e0 (patch) | |
tree | 0f3311b0dad82a3b5ee25da8cbed89a0c948b657 | |
parent | 2a5258d085faade1dc06aee71ddae7ca6b425adf (diff) | |
download | chocolate-doom-ac7b10dceb0a254ff960c11c24ba14abe568f7e0.tar.gz chocolate-doom-ac7b10dceb0a254ff960c11c24ba14abe568f7e0.tar.bz2 chocolate-doom-ac7b10dceb0a254ff960c11c24ba14abe568f7e0.zip |
Add HACKING file with guidelines for Chocolate Doom hackers.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 631
-rw-r--r-- | HACKING | 134 | ||||
-rw-r--r-- | Makefile.am | 1 |
2 files changed, 135 insertions, 0 deletions
diff --git a/HACKING b/HACKING new file mode 100644 index 00000000..98a9876c --- /dev/null +++ b/HACKING @@ -0,0 +1,134 @@ + +Coding style guidelines +======================= + +You should set tabs to display as eight spaces, not four. However, +_indentation_ should be four spaces. If possible, do not use tab +characters at all. There is a utility called "expand" which will +remove tab characters. + +Please write code to an 80 column limit so that it fits within a +standard 80 column terminal. + +Functions should be named like this: 'AB_FunctionName'. The 'AB' prefix +denotes the subsystem (AM_ for automap, G_ for game, etc). If a +function is static, you can omit the prefix and just name it like +'FunctionName'. Functions and global variables should always be +made static if possible. + +Put '_t' on the end of types created with typedef. Type names like this +should be all lowercase and have the subsystem name at the start. An +example of this is 'txt_window_t'. When creating structures, always +typedef them. + +Do not use the goto statement. + +Use C++-style comments, ie. '//' comments, not '/* ... */' comments. +I don't care that this isn't standard C. + +Variables should be named like this: 'my_variable_name', not like +this: 'MyVariableName'. In pointer variable declarations, place +the '*' next to the variable name, not the type. + +When using an if, do, while, or for statement, always use the { } +braces even when they are not necessary. For example, do this: + + if (condition) + { + body; + } + +Not this: + + if (condition) // NO + body; + +Write code like this: + +typedef struct +{ + int member1; + char *member2; +} my_structure_t; + +void FunctionName(int argument, int arg2, int arg3, int arg4, int arg5, + int arg6, int arg7) +{ + if (condition) + { + body; + } + else if (condition) + { + body; + } + else + { + body; + } + + if (very_long_condition_like_this_one_that_forces_a_line_break + && other_condition) + { + body; + } + + switch (argument) + { + case FIRST: + code; + break; + + case SECOND: + code; + break; + + default: + break; + } + + for (a=0; a<10; ++a) + { + loop_body; + } + + while (a < 10) + { + loop_body; + } + + do + { + + } while (condition); +} + +GNU GPL and licensing +===================== + +All code submitted to the project must be licensed under the GNU GPL or +a compatible license. If you use code that you haven't 100% written +yourself, say so. Add a copyright header to the start of every file. +Use this template: + +// Emacs style mode select -*- C++ -*- +//----------------------------------------------------------------------------- +// +// Copyright(C) YEAR Author's name +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. + + diff --git a/Makefile.am b/Makefile.am index 835fb846..b3d7ee81 100644 --- a/Makefile.am +++ b/Makefile.am @@ -21,6 +21,7 @@ EXTRA_DIST= \ $(MSVC_FILES) \ $(CODEBLOCKS_FILES) \ config.h \ + HACKING \ TODO \ BUGS \ data/chocolate-doom.png \ |