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