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