blob: 4e1f84b864a4fe9c0065e9f78ac004acc41bc1c0 [file] [log] [blame]
Cary Clark8032b982017-07-28 11:04:54 -04001#External
2SkXXX
3bmh_SkXXX
4CL
Cary Clarka523d2d2017-08-30 08:58:10 -04005Go
Cary Clark8032b982017-07-28 11:04:54 -04006Visual_Studio
7##
8
9#Topic Bookmaker
10
11How to use the Bookmaker utility.
12
Cary Clark6fc50412017-09-21 12:31:06 -040013Install
14#A Go # https://golang.org/doc/install ##
15 if needed.
Cary Clark8032b982017-07-28 11:04:54 -040016Get the fiddle command line interface tool.
Cary Clarka523d2d2017-08-30 08:58:10 -040017By default this will appear in your home directory.
Cary Clark8032b982017-07-28 11:04:54 -040018
19#Code
20$ go get go.skia.org/infra/fiddle/go/fiddlecli
21##
22
Cary Clarkbad5ad72017-08-03 17:14:08 -040023Build Bookmaker.
Cary Clark8032b982017-07-28 11:04:54 -040024
25#Code
Cary Clark8032b982017-07-28 11:04:54 -040026$ ninja -C out/dir bookmaker
27##
28
29Generate an starter Bookmaker file from an existing include.
Cary Clark8032b982017-07-28 11:04:54 -040030
31#Code
Cary Clarkd0530ba2017-09-14 11:25:39 -040032$ ./out/dir/bookmaker -i include/core/SkXXX.h -t docs
Cary Clark8032b982017-07-28 11:04:54 -040033##
34
Cary Clarkd0530ba2017-09-14 11:25:39 -040035If 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.
Cary Clark8032b982017-07-28 11:04:54 -040059
Cary Clarka523d2d2017-08-30 08:58:10 -040060#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
Cary Clark8032b982017-07-28 11:04:54 -040093Generate 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
Cary Clarkbad5ad72017-08-03 17:14:08 -0400100$ ./out/dir/bookmaker -e fiddle.json -b docs
Cary Clark8032b982017-07-28 11:04:54 -0400101##
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
Cary Clarkbad5ad72017-08-03 17:14:08 -0400116$ ./out/dir/bookmaker -r site/user/api -b docs -f fiddleout.json
Cary Clark8032b982017-07-28 11:04:54 -0400117##
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
Cary Clarkbad5ad72017-08-03 17:14:08 -0400124$ ./out/dir/bookmaker -x -b docs/SkXXX.bmh -i include/core/SkXXX.h
Cary Clark8032b982017-07-28 11:04:54 -0400125##
126
Cary Clarkd0530ba2017-09-14 11:25:39 -0400127Generate an updated include header. Run:
Cary Clarkbad5ad72017-08-03 17:14:08 -0400128
129#Code
130$ ./out/dir/bookmaker -p -b docs -i include/core/SkXXX.h
Cary Clark8032b982017-07-28 11:04:54 -0400131##
132
Cary Clarkd0530ba2017-09-14 11:25:39 -0400133to write the updated SkXXX.h to the current directory.
134
Cary Clarkbad5ad72017-08-03 17:14:08 -0400135#Subtopic Bugs
136
Cary Clark6fc50412017-09-21 12:31:06 -0400137Bookmaker bugs are tracked
138#A here # bug.skia.org/6898 ##
139.
Cary Clarkbad5ad72017-08-03 17:14:08 -0400140
Cary Clark8032b982017-07-28 11:04:54 -0400141##
142
143#Topic Bookmaker ##