126 | | For errors and warnings please use the `G_fatal_error()` and |
127 | | `G_warning()` functions. General messages for the user should use |
128 | | `G_message()` while debug messages should use `G_debug()` whenever |
129 | | possible. There are two variants to `G_message()`: `G_verbose_message()` |
130 | | which will only display the message if in `--verbose` mode, and |
131 | | `G_important_message()` which will always show the message unless |
132 | | the module is running in `--quiet` mode. `G_fatal_error()` and |
133 | | `G_warning()` will always be displayed regardless of verbosity setting. |
134 | | Messages sent to any of these functions will be printed to stderr. |
| 126 | For errors and warnings please use the `G_fatal_error()` and `G_warning()` functions. General messages for the user should use `G_message()` while debug messages should use `G_debug()` whenever |
| 127 | possible. There are two variants to `G_message()`: `G_verbose_message()` which will only display the message if in `--verbose` mode, and `G_important_message()` which will always show the message unless the module is running in `--quiet` mode. `G_fatal_error()` and `G_warning()` will always be displayed regardless of verbosity setting. Messages sent to any of these functions will be printed to stderr. |
184 | | 11. Use the following GRASS library functions instead of the standard C |
185 | | functions. The reason for this is that the following functions ensure |
186 | | good programming practice (e.g. always checking if memory was allocated) |
187 | | and/or improves portability. PLEASE refer to the programmers manual |
188 | | for the proper use (e.g. determining if any casts are needed for arguments |
189 | | or return values) of these library functions. They may perform a task |
190 | | slightly different from their corresponding C library function, and thus, |
191 | | their use may not be the same. |
| 169 | 11. Use the following GRASS library functions instead of the standard C functions. The reason for this is that the following functions ensure good programming practice (e.g. always checking if memory was allocated) |
| 170 | and/or improves portability. PLEASE refer to the programmers manual for the proper use (e.g. determining if any casts are needed for arguments or return values) of these library functions. They may perform a task slightly different from their corresponding C library function, and thus, their use may not be the same. |
225 | | Functions in the library must be documented in doxygen style to |
226 | | get them into the programmer's manual (generate with `make pdfdocs` or `make htmldocs`). |
227 | | See [src:grass/trunk/lib/gis/] for examples. |
228 | | |
229 | | |
230 | | 14. PLEASE take the time to add comments throughout your code explaining what |
231 | | the code is doing. It will save a HUGE amount of time and frustration for |
232 | | other programmers that may have to change your code in the future. |
233 | | |
234 | | |
235 | | 15. To promote a consistent coding style, please use the "indent" program |
236 | | on all new C modules using the following switches: |
| 202 | Functions in the library must be documented in doxygen style to get them into the programmer's manual (generate with `make pdfdocs` or `make htmldocs`). See [src:grass/trunk/lib/gis/] for examples. |
| 203 | |
| 204 | |
| 205 | 14. PLEASE take the time to add comments throughout your code explaining what the code is doing. It will save a HUGE amount of time and frustration for other programmers that may have to change your code in the future. |
| 206 | |
| 207 | |
| 208 | 15. To promote a consistent coding style, please use the "indent" program on all new C modules using the following switches: |
242 | | Existing code should not be re-indented except in extreme cases, as this |
243 | | will make "diff" comparisons with older versions impossible. If indent is |
244 | | needed, do not check in any changes other than the indentation in the same |
245 | | commit! Do add the indent switches and any indent warning messages to the |
246 | | SVN log. Any change or fix mixed in with an indent is very hard to track |
247 | | making it hard for others to follow the change or fix any new bugs. |
248 | | For your convenience use the src:grass/trunk/tools/grass_indent.sh script. |
| 214 | Existing code should not be re-indented except in extreme cases, as this will make "diff" comparisons with older versions impossible. If indent is needed, do not check in any changes other than the indentation in the same commit! Do add the indent switches and any indent warning messages to the SVN log. Any change or fix mixed in with an indent is very hard to track |
| 215 | making it hard for others to follow the change or fix any new bugs. For your convenience use the src:grass/trunk/tools/grass_indent.sh script. |
310 | | 22. Standard parser options: use `G_define_standard_option()` whenever possible |
311 | | to define standard module command line options. This will save you time, |
312 | | create fewer bugs, and make things easier on the translators. |
313 | | See [src:grass/trunklib/gis/parser.c] for details of the function definition. |
| 270 | 22. Standard parser options: use `G_define_standard_option()` whenever possible to define standard module command line options. This will save you time, create fewer bugs, and make things easier on the translators. |
| 271 | See source:grass/trunklib/gis/parser.c for details of the function definition. |
325 | | If you add a new variable, please follow the naming convention. |
326 | | All variables are described in src:grass/trunk/lib/init/variables.html |
327 | | |
328 | | |
329 | | 26. Be sure to develop on top of the LATEST GRASS code (which is in our SVN |
330 | | repository). You can re-check before submission with `svn diff`: |
331 | | |
332 | | Be sure to create unified (`diff -u`) format. "Plain" diffs (the default |
333 | | format) are risky, because they will apply without warning to code which |
334 | | has been substantially changed; they are also harder to read than unified. |
335 | | |
336 | | Such diffs should be made from the top-level directory, e.g. |
337 | | `svn diff display/d.vect/main.c`; that way, the diff will |
338 | | include the pathname rather than just an ambiguous `main.c`. |
| 283 | If you add a new variable, please follow the naming convention. All variables are described in src:grass/trunk/lib/init/variables.html |
| 284 | |
| 285 | |
| 286 | 26. Be sure to develop on top of the LATEST GRASS code (which is in our SVN repository). You can re-check before submission with `svn diff`: |
| 287 | |
| 288 | Be sure to create unified (`diff -u`) format. "Plain" diffs (the default format) are risky, because they will apply without warning to code which has been substantially changed; they are also harder to read than unified. |
| 289 | |
| 290 | Such diffs should be made from the top-level directory, e.g. `svn diff display/d.vect/main.c`; that way, the diff will include the pathname rather than just an ambiguous `main.c`. |
371 | | If your module is part of GRASS and you created some standard test |
372 | | cases, please contact the developers to add your tests to the |
373 | | default test suite. This will automatize complex test scenarios |
374 | | and assure to find bugs much faster, if changes were made to your |
375 | | modules or to the grass library. |
376 | | |
377 | | Consider to subscribe to the GRASS Quality Assessment System to |
378 | | get immediate notification about the code quality: |
| 323 | If your module is part of GRASS and you created some standard test cases, please contact the developers to add your tests to the default test suite. This will automatize complex test scenarios and assure to find bugs much faster, if changes were made to your modules or to the grass library. |
| 324 | |
| 325 | Consider to subscribe to the GRASS Quality Assessment System to get immediate notification about the code quality: |
437 | | 30. Use doxygen style for source code documentation. It is required |
438 | | for GRASS libraries, but also recommended for GRASS modules. |
439 | | |
440 | | Do not use structural command inside documentation block since it |
441 | | leads to some duplication of information (e.g. do not use `\fn` |
442 | | command in comment blocks). The exception is `\file` command for |
443 | | documenting a file, in this case structural command is required. |
| 384 | 30. Use doxygen style for source code documentation. It is required for GRASS libraries, but also recommended for GRASS modules. |
| 385 | |
| 386 | Do not use structural command inside documentation block since it leads to some duplication of information (e.g. do not use `\fn` command in comment blocks). The exception is `\file` command for documenting a file, in this case structural command is required. |