blob: f0f79d213e464a29aaa89671830f1448499f738e [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.
67
68Descriptions start with an active verb. Descriptions are complete, punctuated
69sentences unless they describe parameters or return values. Parameters and
70returned values are described by phrases that start lower case and do not
71include trailing punctuation.
72
73Descriptions are not self-referential; they do not include the thing they
74describe. Descriptions may contain upper case references to definitions
75but otherwise should be free of jargon.
76
77Descriptions may contain code and formulas, each bracketed by markup.
78
79Similar items may be grouped into topics. Topics may include subtopics.
80
81Each document begins with one or more indices that include the contents of
82that file. A class reference includes an index listing contained topics,
83a separate listing for constructors, one for methods, and so on.
84
85Class methods contain a description, any parameters, any return value,
86an example, and any cross references.
87
88Each method must contain either one or more examples or markup indicating
89that there is no example.
90
91##
92
93Generate fiddle.json from all examples, including the ones you just wrote.
94Error checking is syntatic: starting keywords are closed, keywords have the
95correct parents.
96If you run Bookmaker inside Visual_Studio, you can click on errors and it
97will take you to the source line in question.
98
99#Code
100$ ./out/dir/bookmaker -e fiddle.json -b docs
101##
102
103Once complete, run fiddlecli to generate the example hashes.
104Errors are contained by the output but aren't reported yet.
105
106#Code
107$ $GOPATH/bin/fiddlecli --input fiddle.json --output fiddleout.json
108##
109
110Generate bmh_SkXXX.md from SkXXX.bmh and fiddleout.json.
111Error checking includes: undefined references, fiddle compiler errors,
112missing or mismatched printf output.
113Again, you can click on any errors inside Visual_Studio.
114
115#Code
116$ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json
117##
118
119The original include may have changed since you started creating the markdown.
120Check to see if it is up to date.
121This reports if a method no longer exists or its parameters have changed.
122
123#Code
124$ ./out/dir/bookmaker -x -b docs/SkXXX.bmh -i include/core/SkXXX.h
125##
126
127Generate an updated include header. Run:
128
129#Code
130$ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h
131##
132
133to write the updated SkXXX.h to the current directory.
134
135#Subtopic Bugs
136
137Bookmaker bugs are tracked
138#A here # bug.skia.org/6898 ##
139.
140
141##
142
143#Topic Bookmaker ##