Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 1 | #External |
| 2 | SkXXX |
| 3 | bmh_SkXXX |
| 4 | CL |
| 5 | Go |
| 6 | Visual_Studio |
| 7 | ## |
| 8 | |
| 9 | #Topic Bookmaker |
| 10 | |
| 11 | How to use the Bookmaker utility. |
| 12 | |
| 13 | Install |
| 14 | #A Go # https://golang.org/doc/install ## |
| 15 | if needed. |
| 16 | Get the fiddle command line interface tool. |
| 17 | By default this will appear in your home directory. |
| 18 | |
| 19 | #Code |
| 20 | $ go get go.skia.org/infra/fiddle/go/fiddlecli |
| 21 | ## |
| 22 | |
| 23 | Build Bookmaker. |
| 24 | |
| 25 | #Code |
| 26 | $ ninja -C out/dir bookmaker |
| 27 | ## |
| 28 | |
| 29 | Generate an starter Bookmaker file from an existing include. |
| 30 | |
| 31 | #Code |
| 32 | $ ./out/dir/bookmaker -i include/core/SkXXX.h -t docs |
| 33 | ## |
| 34 | |
| 35 | If a method or function has an unnamed parameter, bookmaker generates an error: |
| 36 | |
| 37 | #Code |
| 38 | ###$ |
| 39 | C:/puregit/include/core/SkPixmap.h(208): error: #Method missing param name |
| 40 | bool erase(const SkColor4f&, const SkIRect* subset = nullptr) const |
| 41 | ^ |
| 42 | $$$# |
| 43 | ## |
| 44 | |
| 45 | All parameters require names to allow markdown and doxygen documents to refer to |
| 46 | them. After naming all parameters, check in the include before continuing. |
| 47 | |
| 48 | A successful run generates |
| 49 | #Code |
| 50 | docs/SkXXX_Reference.bmh |
| 51 | ## |
| 52 | . |
| 53 | |
| 54 | Next, use your favorite editor to fill out |
| 55 | #Code |
| 56 | docs/SkXXX_Reference.bmh |
| 57 | ## |
| 58 | . |
| 59 | |
| 60 | #Subtopic Style |
| 61 | |
| 62 | Documentation consists of cross references, descriptions, and examples. |
| 63 | All structs, classes, enums, their members and methods, functions, and so on, |
| 64 | require descriptions. Most also require examples. |
| 65 | |
| 66 | All methods and functions should include examples if practical. |
Cary Clark | ca3ebcd | 2017-12-12 11:22:38 -0500 | [diff] [blame^] | 67 | It's difficult to think of a meaningful example for class destructors. |
| 68 | In cases like these, change the placeholder: |
| 69 | |
| 70 | ###$ |
| 71 | $Code |
| 72 | #Example |
| 73 | $$ |
| 74 | |
| 75 | to: |
| 76 | |
| 77 | $Code |
| 78 | #NoExample |
| 79 | $$ |
| 80 | $$$# |
Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 81 | |
| 82 | Descriptions start with an active verb. Descriptions are complete, punctuated |
| 83 | sentences unless they describe parameters or return values. Parameters and |
| 84 | returned values are described by phrases that start lower case and do not |
| 85 | include trailing punctuation. |
| 86 | |
| 87 | Descriptions are not self-referential; they do not include the thing they |
Cary Clark | ca3ebcd | 2017-12-12 11:22:38 -0500 | [diff] [blame^] | 88 | describe. Descriptions may contain upper case or camel case references to |
| 89 | definitions but otherwise should be free of jargon. |
Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 90 | |
| 91 | Descriptions may contain code and formulas, each bracketed by markup. |
| 92 | |
| 93 | Similar items may be grouped into topics. Topics may include subtopics. |
| 94 | |
| 95 | Each document begins with one or more indices that include the contents of |
| 96 | that file. A class reference includes an index listing contained topics, |
| 97 | a separate listing for constructors, one for methods, and so on. |
| 98 | |
| 99 | Class methods contain a description, any parameters, any return value, |
| 100 | an example, and any cross references. |
| 101 | |
| 102 | Each method must contain either one or more examples or markup indicating |
| 103 | that there is no example. |
| 104 | |
Cary Clark | ca3ebcd | 2017-12-12 11:22:38 -0500 | [diff] [blame^] | 105 | After editing is complete, searching for "incomplete" should fail, |
| 106 | assuming "incomplete" is not the perfect word to use in a description or |
| 107 | example! |
| 108 | |
Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 109 | ## |
| 110 | |
| 111 | Generate fiddle.json from all examples, including the ones you just wrote. |
| 112 | Error checking is syntatic: starting keywords are closed, keywords have the |
| 113 | correct parents. |
| 114 | If you run Bookmaker inside Visual_Studio, you can click on errors and it |
| 115 | will take you to the source line in question. |
| 116 | |
| 117 | #Code |
| 118 | $ ./out/dir/bookmaker -e fiddle.json -b docs |
| 119 | ## |
| 120 | |
| 121 | Once complete, run fiddlecli to generate the example hashes. |
| 122 | Errors are contained by the output but aren't reported yet. |
| 123 | |
| 124 | #Code |
| 125 | $ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json |
| 126 | ## |
| 127 | |
| 128 | Generate bmh_SkXXX.md from SkXXX.bmh and fiddleout.json. |
| 129 | Error checking includes: undefined references, fiddle compiler errors, |
| 130 | missing or mismatched printf output. |
| 131 | Again, you can click on any errors inside Visual_Studio. |
| 132 | |
| 133 | #Code |
| 134 | $ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json |
| 135 | ## |
| 136 | |
| 137 | The original include may have changed since you started creating the markdown. |
| 138 | Check to see if it is up to date. |
| 139 | This reports if a method no longer exists or its parameters have changed. |
| 140 | |
| 141 | #Code |
| 142 | $ ./out/dir/bookmaker -x -b docs/SkXXX.bmh -i include/core/SkXXX.h |
| 143 | ## |
| 144 | |
| 145 | Generate an updated include header. Run: |
| 146 | |
| 147 | #Code |
| 148 | $ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h |
| 149 | ## |
| 150 | |
| 151 | to write the updated SkXXX.h to the current directory. |
| 152 | |
Cary Clark | ca3ebcd | 2017-12-12 11:22:38 -0500 | [diff] [blame^] | 153 | Once adding the file is complete, add the file to status.json in the |
| 154 | Completed section. You may add it to the InProgress section during |
| 155 | development, or leave status.json unchanged. |
| 156 | |
| 157 | If the new file has been added to status.json, you can run |
| 158 | any of the above commands with -a docs/status.json in place of |
| 159 | -b docs or -i includes. |
| 160 | |
| 161 | Complete rebuilding of all bookmaker output looks like: |
| 162 | |
| 163 | #Code |
| 164 | ./out/skia/bookmaker.exe -a docs/status.json -e fiddle.json |
| 165 | ~/go/bin/fiddlecli.exe --input fiddle.json --output fiddleout.json |
| 166 | ./out/skia/bookmaker.exe -a docs/status.json -f fiddleout.json -r site/user/api -c |
| 167 | ./out/skia/bookmaker.exe -a docs/status.json -x |
| 168 | ./out/skia/bookmaker.exe -a docs/status.json -p |
| 169 | ## |
| 170 | |
Ben Wagner | 29380bd | 2017-10-09 14:43:00 -0400 | [diff] [blame] | 171 | #Subtopic Bugs |
| 172 | |
| 173 | Bookmaker bugs are tracked |
| 174 | #A here # bug.skia.org/6898 ## |
| 175 | . |
| 176 | |
| 177 | ## |
| 178 | |
| 179 | #Topic Bookmaker ## |