forked from dnsmkl/fsqlf
-
Notifications
You must be signed in to change notification settings - Fork 2
/
CONTRIBUTING
64 lines (50 loc) · 1.69 KB
/
CONTRIBUTING
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Folder layout:
./buildtools - things specific for building (except for makefile)
./cli - code specific to command line interface
./gui - code specific to graphical user interface
./include - header of fsqlf library
./lib_fsqlf - code of fsqlf library
./tests - things specific to testing (tools & test-cases)
./utils - generic code of considerable size. External code files also go here.
Shortnames used:
'kw' - keyword with all its settings
'kwmap' - collection of all 'kw's
'nl', 'tab', 'sp' - new line, tabulation/indentation, space character.
Code style:
Dialect: C99.
Target platforms: windows and linux (more is better; but no promises).
Indentation: 4 spaces (no tabs).
Line limit: 79 characters (soft).
Exported public symbols: prefix "fsqlf_".
Exported private symbols: prefix "FSQLF_" (static functions don't need these).
Also, names of similar things, should share same prefix. (mimic namespacing)
Avoid typedef'ing structs. (only if need to hide or separate from struct)
Follow K&R style.
External code files should go under utils, and follow their own conventions.
Code style illustration:
----
#include <stdio.h> // puts()
char * FSQLF_first()
{
// For things that have names (functions, structs, enums),
// opening curly brace goes on new line.
if (1 == 1) {
// Opening bracket for if/for/while/switch go on same line.
return NULL;
}
}
// Two lines between adjacent functions.
// (same for any other significant top level blocks)
// If there is need to split arguments on separate lines,
// closing parenthesis goes on new line.
static void second(
struct long_configuration *cfg,
char *out_buffer
)
{
puts(FSQLF_first());
puts(
"NULL"
);
}
----