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