1 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
2 | |
---|
3 | .. Copyright (C) 2018, 2020 embedded brains GmbH (http://www.embedded-brains.de) |
---|
4 | .. Copyright (C) 2018, 2020 Sebastian Huber |
---|
5 | |
---|
6 | File Templates |
---|
7 | ============== |
---|
8 | |
---|
9 | Every source code file shall have a copyright and license block. Corresponding |
---|
10 | to the license, every file shall have an |
---|
11 | `SPDX License Identifier <https://spdx.org/ids-how>`_ in the first possible line |
---|
12 | of the file. C/C++ files should have a Doxygen file comment block. |
---|
13 | |
---|
14 | The preferred license for source code is |
---|
15 | `BSD-2-Clause <https://spdx.org/licenses/BSD-2-Clause.html>`_. The preferred |
---|
16 | license for documentation is |
---|
17 | `CC-BY-SA-4.0 <https://creativecommons.org/licenses/by-sa/4.0/legalcode>`_. |
---|
18 | |
---|
19 | .. _FileHeaderCopyright: |
---|
20 | |
---|
21 | Copyright and License Block |
---|
22 | --------------------------- |
---|
23 | |
---|
24 | You are the copyright holder. Use the following copyright and license block for |
---|
25 | your source code contributions to the RTEMS Project. Place it after the SPDX |
---|
26 | License Identifier line and the optional file documentation block. Replace the |
---|
27 | <FIRST YEAR> placeholder with the year of your first substantial contribution to |
---|
28 | this file. Update the <LAST YEAR> with the year of your last substantial |
---|
29 | contribution to this file. If the first and last years are the same, then |
---|
30 | remove the <LAST YEAR> placeholder with the comma. Replace the <COPYRIGHT |
---|
31 | HOLDER> placeholder with your name. |
---|
32 | |
---|
33 | In case you are a real person, then use the following format for |
---|
34 | <COPYRIGHT HOLDER>: <FIRST NAME> <MIDDLE NAMES> <LAST NAME>. The <FIRST NAME> |
---|
35 | is your first name (also known as given name), the <MIDDLE NAMES> are your |
---|
36 | optional middle names, the <LAST NAME> is your last name (also known as family |
---|
37 | name). |
---|
38 | |
---|
39 | If more than one copyright holder exists for a file, then sort the copyright |
---|
40 | lines by the first year (earlier years are below later years) followed by the |
---|
41 | copyright holder in alphabetical order (A is above B in the file). |
---|
42 | |
---|
43 | Use the following template for a copyright and license block. Do not change the |
---|
44 | license text. |
---|
45 | |
---|
46 | .. code-block:: none |
---|
47 | |
---|
48 | Copyright (C) <FIRST YEAR>, <LAST YEAR> <COPYRIGHT HOLDER> |
---|
49 | |
---|
50 | Redistribution and use in source and binary forms, with or without |
---|
51 | modification, are permitted provided that the following conditions |
---|
52 | are met: |
---|
53 | 1. Redistributions of source code must retain the above copyright |
---|
54 | notice, this list of conditions and the following disclaimer. |
---|
55 | 2. Redistributions in binary form must reproduce the above copyright |
---|
56 | notice, this list of conditions and the following disclaimer in the |
---|
57 | documentation and/or other materials provided with the distribution. |
---|
58 | |
---|
59 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
60 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
61 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
62 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
63 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
64 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
65 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
66 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
67 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
68 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
69 | POSSIBILITY OF SUCH DAMAGE. |
---|
70 | |
---|
71 | Check the top-level :file:`COPYING` file of the repository. If you are a new |
---|
72 | copyright holder, then add yourself to the top of the list. If your last year |
---|
73 | of a substantial contribution changed, then please update your copyright line. |
---|
74 | |
---|
75 | C/C++ Header File Template |
---|
76 | -------------------------- |
---|
77 | |
---|
78 | Use the following guidelines and template for C and C++ header files (here |
---|
79 | :file:`<foo/bar/baz.h>`): |
---|
80 | |
---|
81 | * Place the SPDX License Identifier in the first line of the file. |
---|
82 | |
---|
83 | * Add a Doxygen file documentation block. |
---|
84 | |
---|
85 | * Place the copyright and license comment block after the documentation block. |
---|
86 | |
---|
87 | * For the <FIRST YEAR>, <LAST YEAR>, and <COPYRIGHT HOLDER> placeholders see |
---|
88 | :ref:`FileHeaderCopyright`. |
---|
89 | |
---|
90 | * Separate comment blocks by exactly one blank line. |
---|
91 | |
---|
92 | * Separate the Doxygen comment block from the copyright and license, so that |
---|
93 | the copyright and license information is not included in the Doxygen output. |
---|
94 | |
---|
95 | * For C++ header files discard the extern "C". |
---|
96 | |
---|
97 | .. code-block:: c |
---|
98 | |
---|
99 | /* SPDX-License-Identifier: BSD-2-Clause |
---|
100 | |
---|
101 | /** |
---|
102 | * @file |
---|
103 | * |
---|
104 | * @ingroup TheGroupForThisFile |
---|
105 | * |
---|
106 | * @brief Short "Table of Contents" Description of File Contents |
---|
107 | * |
---|
108 | * A short description of the purpose of this file. |
---|
109 | */ |
---|
110 | |
---|
111 | /* |
---|
112 | * Copyright (C) <FIRST YEAR>, <LAST YEAR> <COPYRIGHT HOLDER> |
---|
113 | * |
---|
114 | * Redistribution and use in source and binary forms, with or without |
---|
115 | * modification, are permitted provided that the following conditions |
---|
116 | * are met: |
---|
117 | * 1. Redistributions of source code must retain the above copyright |
---|
118 | * notice, this list of conditions and the following disclaimer. |
---|
119 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
120 | * notice, this list of conditions and the following disclaimer in the |
---|
121 | * documentation and/or other materials provided with the distribution. |
---|
122 | * |
---|
123 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
124 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
125 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
126 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
127 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
128 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
129 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
130 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
131 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
132 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
133 | * POSSIBILITY OF SUCH DAMAGE. |
---|
134 | */ |
---|
135 | |
---|
136 | #ifndef _FOO_BAR_BAZ_H |
---|
137 | #define _FOO_BAR_BAZ_H |
---|
138 | |
---|
139 | #include <foo/bar/xyz.h> |
---|
140 | |
---|
141 | #ifdef __cplusplus |
---|
142 | extern "C" { |
---|
143 | #endif |
---|
144 | |
---|
145 | /* Declarations, defines, macros, inline functions, etc. */ |
---|
146 | |
---|
147 | #ifdef __cplusplus |
---|
148 | } |
---|
149 | #endif |
---|
150 | |
---|
151 | #endif /* _FOO_BAR_BAZ_H */ |
---|
152 | |
---|
153 | C/C++/Assembler Source File Template |
---|
154 | ------------------------------------ |
---|
155 | |
---|
156 | Use the following template for C, C++, and assembler source files (here |
---|
157 | implementation of :file:`<foo/bar/baz.h>`). For the <FIRST YEAR>, <LAST YEAR>, |
---|
158 | and <COPYRIGHT HOLDER> placeholders see :ref:`FileHeaderCopyright`. |
---|
159 | |
---|
160 | .. code-block:: c |
---|
161 | |
---|
162 | /* SPDX-License-Identifier: BSD-2-Clause */ |
---|
163 | |
---|
164 | /** |
---|
165 | * @file |
---|
166 | * |
---|
167 | * @ingroup TheGroupForThisFile |
---|
168 | * |
---|
169 | * @brief Short "Table of Contents" Description of File Contents |
---|
170 | * |
---|
171 | * A short description of the purpose of this file. |
---|
172 | */ |
---|
173 | |
---|
174 | /* |
---|
175 | * Copyright (C) <FIRST YEAR>, <LAST YEAR> <COPYRIGHT HOLDER> |
---|
176 | * |
---|
177 | * Redistribution and use in source and binary forms, with or without |
---|
178 | * modification, are permitted provided that the following conditions |
---|
179 | * are met: |
---|
180 | * 1. Redistributions of source code must retain the above copyright |
---|
181 | * notice, this list of conditions and the following disclaimer. |
---|
182 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
183 | * notice, this list of conditions and the following disclaimer in the |
---|
184 | * documentation and/or other materials provided with the distribution. |
---|
185 | * |
---|
186 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
187 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
188 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
189 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
190 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
191 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
192 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
193 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
194 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
195 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
196 | * POSSIBILITY OF SUCH DAMAGE. |
---|
197 | */ |
---|
198 | |
---|
199 | #ifdef HAVE_CONFIG_H |
---|
200 | #include "config.h" |
---|
201 | #endif |
---|
202 | |
---|
203 | #include <foo/bar/baz.h> |
---|
204 | |
---|
205 | /* Definitions, etc. */ |
---|
206 | |
---|
207 | Python File Template |
---|
208 | -------------------- |
---|
209 | |
---|
210 | Use the following template for Python source files and other files which accept |
---|
211 | a ``#``-style comment block. For the <FIRST YEAR>, <LAST YEAR>, and |
---|
212 | <COPYRIGHT HOLDER> placeholders see :ref:`FileHeaderCopyright`. |
---|
213 | |
---|
214 | .. code-block:: python |
---|
215 | |
---|
216 | #!/usr/bin/env python |
---|
217 | # SPDX-License-Identifier: BSD-2-Clause |
---|
218 | |
---|
219 | # File documentation block |
---|
220 | |
---|
221 | # Copyright (C) <FIRST YEAR>, <LAST YEAR> <COPYRIGHT HOLDER> |
---|
222 | # |
---|
223 | # Redistribution and use in source and binary forms, with or without |
---|
224 | # modification, are permitted provided that the following conditions |
---|
225 | # are met: |
---|
226 | # 1. Redistributions of source code must retain the above copyright |
---|
227 | # notice, this list of conditions and the following disclaimer. |
---|
228 | # 2. Redistributions in binary form must reproduce the above copyright |
---|
229 | # notice, this list of conditions and the following disclaimer in the |
---|
230 | # documentation and/or other materials provided with the distribution. |
---|
231 | # |
---|
232 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
233 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
234 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
235 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
---|
236 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
237 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
238 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
239 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
240 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
241 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
---|
242 | # POSSIBILITY OF SUCH DAMAGE. |
---|
243 | |
---|
244 | reStructuredText File Template |
---|
245 | ------------------------------ |
---|
246 | |
---|
247 | Use the following template for reStructuredText (reST) source files. For the |
---|
248 | <FIRST YEAR>, <LAST YEAR>, and <COPYRIGHT HOLDER> placeholders see |
---|
249 | :ref:`FileHeaderCopyright`. |
---|
250 | |
---|
251 | .. code-block:: rest |
---|
252 | |
---|
253 | .. SPDX-License-Identifier: CC-BY-SA-4.0 |
---|
254 | |
---|
255 | .. Copyright (C) <FIRST YEAR>, <LAST YEAR> <COPYRIGHT HOLDER> |
---|