Minos Galanakis | f4ca6ac | 2017-12-11 02:39:21 +0100 | [diff] [blame] | 1 | #------------------------------------------------------------------------------- |
| 2 | # Copyright (c) 2017-2019, Arm Limited and Contributors. All rights reserved. |
| 3 | # |
| 4 | # SPDX-License-Identifier: BSD-3-Clause |
| 5 | # |
| 6 | #------------------------------------------------------------------------------- |
| 7 | |
| 8 | /*! @page pgSoxygenSh Using Doxygen for documenting shell scripts |
| 9 | |
| 10 | To overcome Doxygen's shortcoming of not understand shell scripts, a basic |
| 11 | filter is used to convert the shell scripts to C source. The filter will keep |
| 12 | lines starting with '##' or '#!' and drop all other lines. |
| 13 | |
| 14 | Doxygen must find the C declaration of all documented entities and thus |
| 15 | fake definitions of each documented entity must be added. It is planned to |
| 16 | develop a smarter filter program which will eliminate the need of fake C code. |
| 17 | This task is lowest possible priority though. |
| 18 | |
| 19 | @section pgDoxygenShs0 Instrumenting shell scrips |
| 20 | - Use <em>##</em> to add the Doxygen documentation (i.e. stuff you would add to C |
| 21 | comments in C source files). |
| 22 | - Use <em>#!</em> for to add fake C code. |
| 23 | - The documented item and the and the fake C conterpart must match. I.e. the |
| 24 | fingerprint of a variable definition must match the fake C declaration. |
| 25 | |
| 26 | Notes: |
| 27 | - You can use a "type" like <em>string</em> or <em>path</em> to make more |
| 28 | specific what a variable is expected to hold or a function is expected to |
| 29 | return. These are still is just documentation hoint's as the |
| 30 | "shell comand language" does not support types. |
| 31 | |
| 32 | @section pgDoxygenShs1 Example file documentation |
| 33 | To get any documentation genertased for a shell script file, please incude a |
| 34 | <em>\@file</em> special command in it. |
| 35 | |
| 36 | @code{.sh} |
| 37 | ## |
| 38 | ##@file |
| 39 | ##@brief Shell documentation examples |
| 40 | ## |
| 41 | ##Detailed description. |
| 42 | ## |
| 43 | @endcode |
| 44 | |
| 45 | This is how the generated documentation looks like: \ref examples.sh |
| 46 | |
| 47 | @section pgDoxygenShs2 Example variable documentation |
| 48 | @code{.sh} |
| 49 | ##@var string example_variable |
| 50 | ##@brief Example variable |
| 51 | ## |
| 52 | ##This is an example to show ho to document variables. |
| 53 | ## |
| 54 | #This is needed for doxygen for now. |
| 55 | #!string example_variable; |
| 56 | @endcode |
| 57 | |
| 58 | This is how the generated documentation looks like: \ref example_variable. |
| 59 | |
| 60 | Notes: |
| 61 | - The variable definition at line 1 and line 7, i.e. the documented variable |
| 62 | and the fake C conterpart must match. |
| 63 | |
| 64 | @section pgDoxygenShs3 Example function documentation |
| 65 | @code{.sh} |
| 66 | ##@fn example_function(path build_base_dir, string build_config_name) |
| 67 | ##@brief En example function. |
| 68 | ##@param[in] build_base_dir |
| 69 | ##@param[in] build_config_name |
| 70 | ##@returns N/A |
| 71 | ## |
| 72 | ##This function was only made to show how-to document a function. |
| 73 | ## |
| 74 | ##Usage: |
| 75 | ## command | result |
| 76 | ## --------|------- |
| 77 | ## example_function "test_build_st32" "somestring" | Do whatever is done. |
| 78 | ## |
| 79 | #This is needed for doxygen for now. |
| 80 | #!void example_function(path build_base_dir, string build_config_name){}; |
| 81 | # |
| 82 | @endcode |
| 83 | |
| 84 | This is how the generated documentation looks like: \ref example_function. |
| 85 | |
| 86 | Notes: |
| 87 | - The function definition at line 1 and line 15, i.e. the documented function |
| 88 | and the fake C conterpart must match. |
| 89 | |
| 90 | |
| 91 | @section pgSoxygenShs2 General documentation |
| 92 | All documentation which is not documenting source code (shell script) |
| 93 | shall be added to *.dox files. |
| 94 | |
| 95 | */ |