summaryrefslogtreecommitdiff
path: root/handbook
diff options
context:
space:
mode:
authorMichal Zima <xhire@tuxportal.cz>2009-07-06 13:46:10 +0200
committerMichal Zima <xhire@tuxportal.cz>2009-07-06 13:46:10 +0200
commitdd094a1c6598648c013ae1483c303eea34fc3bbe (patch)
tree8075b8dda6e96801d39e04e8962dedbaf9735713 /handbook
parentcd8d3fef9569f7ff9973ab466f914944af6829ab (diff)
Handbook extented with new Code style section
Diffstat (limited to 'handbook')
-rw-r--r--handbook/codestyle57
-rw-r--r--handbook/handbook34
2 files changed, 91 insertions, 0 deletions
diff --git a/handbook/codestyle b/handbook/codestyle
new file mode 100644
index 0000000..38237e1
--- /dev/null
+++ b/handbook/codestyle
@@ -0,0 +1,57 @@
+~~~ Code style ~~~
+- based on K&R conventions
+- line length: 80 characters
+- comments: /* like this */
+
+
+%%% If statements
+if (var <= 64) {
+ return TRUE;
+} else if (var - vor >= 64 &&
+ var + vor <= 128) {
+ return TRUE;
+} else {
+ return FALSE;
+}
+
+
+%%% Switch statement
+/* between case blocks could be one empty line if they are enough big */
+switch (var) {
+ case 10:
+ return 3;
+ break;
+ case 20:
+ return 30;
+ break;
+ default:
+ return 0;
+ break;
+}
+
+
+%%% Header files
+#ifndef FOO_H
+#define FOO_H
+
+#include <foolib.h>
+#include "bar.h"
+
+#define FOO 1
+#define BAR 2
+
+typedef struct foobar_struct {
+ int foo;
+ char *bar;
+} foobar_t;
+
+typedef struct {
+ int foo;
+ char *bar;
+} barfoo_t;
+
+/* breaking lines only when longer than 80 characters or for special purposes */
+extern foobar_t* foo_new(int faa, int fae,
+ char *bor, char *ber);
+
+#endif /* FOO_H */
diff --git a/handbook/handbook b/handbook/handbook
new file mode 100644
index 0000000..b60f2ea
--- /dev/null
+++ b/handbook/handbook
@@ -0,0 +1,34 @@
+~~~ Developer's Handbook ~~~
+* Basic rules
+- always discuss your problem with other developers or with maintainer of the appropriate section
+- be present on developer's IRC
+- try not to break the code in master
+- if you do one large thing that surely will break the code, create your own branch
+- this Handbook is maintained by xHire - if you want to add or modify something, ask him first!
+
+* Directories
+- client/ client code; mainly using SDL
+- server/ server code; mustn't use SDL
+- base/ code in common for client and server; doesn't use SDL
+- widget/ GUI code
+- screen/ code for designing each one screen of GUI
+- audio/ code that handles audio - sounds and music
+- modules/ code of all modules
+- net/ code that operates networking
+
+* Filenames
+- keep letters small
+- if you need more words in a filename, then use this character for separating them: _
+
+* Identificators
+- if you need more words in an identificator, then use this character for separating them: _
+- don't use global variables
+
+* Translation strings
+- keep them clear and following standard scheme
+- if a filename is to be mentioned, don't use any quotes and try to situate it to the end of the string
+
+* Writing a module
+
+* Creating a package
+- let us know and we will tell you everything :c)