You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update CONTRIBUTING.md (after our new C coding style guide)
Part of CONTRIBUTING.md is redundant now, AtomVM C Coding Style guide is
a replacement (that also covers additional topics).
Signed-off-by: Davide Bettio <davide@uninstall.it>
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+1-98Lines changed: 1 addition & 98 deletions
Original file line number
Diff line number
Diff line change
@@ -66,107 +66,10 @@ All source code modules should include copyright headers that are formatted for
66
66
67
67
### C Code
68
68
69
-
C source code style is enforced with [`clang-format-16`](https://releases.llvm.org/16.0.0/tools/clang/docs/ClangFormat.html). To automatically fix a file, run:
69
+
C source code follows the [AtomVM C Coding Style Guide (AVMCCS)](C_CODING_STYLE.md). The style is enforced with [`clang-format-16`](https://releases.llvm.org/16.0.0/tools/clang/docs/ClangFormat.html). To automatically fix a file, run:
70
70
71
71
clang-format-16 --style=file -i file.c
72
72
73
-
#### Indentation
74
-
75
-
*[K&R indentation and braces style](https://en.wikipedia.org/wiki/Indentation_style#K&R_style)
* All other names (e.g. functions and variables) are snake_case (e.g. `term_is_integer`)
104
-
* Always prefix exported function names with the module in which they are defined (e.g. `term_is_nil`, `term_is_integer`, `context_new`, `context_destroy`)
105
-
106
-
#### Other Coding Conventions
107
-
108
-
* Pointers (`*`) should be with the variable name rather than with the type (e.g. `char *name`, not
109
-
`char* name`)
110
-
* Avoid long lines, use intermediate variables with meaningful names.
111
-
* Function definitions should be separated by 1 empty line
112
-
113
-
Function declarations should be structured as follows:
where `context` is a context structure (such as `Context` or `GlobalContext`).
118
-
119
-
Any functions that are not exported should be qualified with the `static` keyword.
120
-
121
-
Functions that return booleans should be named `is_something` (or possibly `module_is_something`, if the function is exported).
122
-
123
-
C header modules (`.h`) should be organized as follows:
124
-
125
-
+-------------------
126
-
| Copyright Header
127
-
|
128
-
| #ifdef MODULE__H__
129
-
| #define MODULE__H__
130
-
|
131
-
| #ifdef __cplusplus
132
-
| extern "C" {
133
-
| #endif
134
-
|
135
-
| #includes (alphabetical)
136
-
|
137
-
| #defines
138
-
|
139
-
| type definitions
140
-
|
141
-
| function declarations
142
-
|
143
-
| #ifdef __cplusplus
144
-
| }
145
-
| #endif
146
-
|
147
-
| #endif
148
-
+-------------------
149
-
module.h
150
-
151
-
C source modules (`.c`) should be organized as follows:
152
-
153
-
+-------------------
154
-
| Copyright Header
155
-
|
156
-
| #includes (alphabetical)
157
-
|
158
-
| #defines
159
-
|
160
-
| type definitions
161
-
|
162
-
| forward declarations (only if necessary)
163
-
|
164
-
| function definitions
165
-
| dependent static functions first
166
-
| exported functions and entrypoints last
167
-
+-------------------
168
-
module.c
169
-
170
73
#### Documentation
171
74
172
75
[Doxygen Javadoc style](https://www.doxygen.nl/manual/docblocks.html) code comments will be picked up and added to the documentation. Changes will automatically be added to the [libAtomVM Source Files](https://doc.atomvm.org/main/apidocs/libatomvm/index.html#libatomvm-source-files) and the [libAtomVM Index](https://doc.atomvm.org/main/apidocs/libatomvm/index.html#libatomvm-index). But to have `Data Structures`, `Types`, `MACROS`, and `Functions` appear in the correct C Library APIs section the corresponding entries must be added to the similarly named `*.rst` files in the `AtomVM/doc/src/apidocs/libatomvm/` directory. The exact names of the files that need to be altered are: `data_structures.rst`, `functions.rst`, `macros.rst`, and `types.rst`. The other files in the directory handle auto`generated content and do not need to be altered.
0 commit comments