aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/bookmaker/mdOut.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2017-09-14 11:25:39 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-09-14 16:05:21 +0000
commitd0530ba8f406ef287ce89a995ce7be4b32ab6e85 (patch)
tree4a4f575d252e68364d041a4a67ee38739e7b5e1b /tools/bookmaker/mdOut.cpp
parentd29f0e7ccb84993562f34f2d8e3933a19a3ed676 (diff)
wip pixmap docs
wip pixmap docs Docs-Preview: https://skia.org/?cl=42522 Bug: skia: 6898 Change-Id: I85947bc36ea057ed008b87d7bef2efa82d7c89ad Reviewed-on: https://skia-review.googlesource.com/42522 Reviewed-by: Cary Clark <caryclark@skia.org> Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tools/bookmaker/mdOut.cpp')
-rw-r--r--tools/bookmaker/mdOut.cpp50
1 files changed, 49 insertions, 1 deletions
diff --git a/tools/bookmaker/mdOut.cpp b/tools/bookmaker/mdOut.cpp
index 0a53fc4147..b0cec6659b 100644
--- a/tools/bookmaker/mdOut.cpp
+++ b/tools/bookmaker/mdOut.cpp
@@ -22,7 +22,9 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
bool lineStart = true;
string ref;
string leadingSpaces;
+ int distFromParam = 99;
do {
+ ++distFromParam;
const char* base = t.fChar;
t.skipWhiteSpace();
const char* wordStart = t.fChar;
@@ -138,6 +140,8 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
const Definition* def;
if (fMethod && (def = fMethod->hasParam(ref))) {
result += linkRef(leadingSpaces, def, ref);
+ fLastParam = def;
+ distFromParam = 0;
continue;
} else if (!fInDescription && ref[0] != '0'
&& string::npos != ref.find_first_of("ABCDEFGHIJKLMNOPQRSTUVWXYZ")) {
@@ -145,6 +149,23 @@ string MdOut::addReferences(const char* refStart, const char* refEnd,
if (('f' != ref[0] && string::npos == ref.find("()"))
// || '.' != t.backup(ref.c_str())
&& ('k' != ref[0] && string::npos == ref.find("_Private"))) {
+ if ('.' == wordStart[0] && distFromParam == 1) {
+ const Definition* paramType = this->findParamType();
+ if (paramType) {
+ string fullName = paramType->fName + "::" + ref;
+ bool found = false;
+ for (auto child : paramType->fChildren) {
+ if (fullName == child->fName) {
+ result += linkRef(leadingSpaces, paramType, ref);
+ found = true;
+ break;
+ }
+ }
+ if (found) {
+ continue;
+ }
+ }
+ }
if (BmhParser::Resolvable::kOut != resolvable) {
t.reportError("missed camelCase");
return result;
@@ -242,6 +263,7 @@ bool MdOut::buildRefFromFile(const char* name, const char* outDir) {
filename = match + ".md";
match += ".bmh";
fOut = nullptr;
+ string fullName;
for (const auto& topic : fBmhParser.fTopicMap) {
Definition* topicDef = topic.second;
if (topicDef->fParent) {
@@ -255,7 +277,7 @@ bool MdOut::buildRefFromFile(const char* name, const char* outDir) {
continue;
}
if (!fOut) {
- string fullName(outDir);
+ fullName = outDir;
if ('/' != fullName.back()) {
fullName += '/';
}
@@ -279,6 +301,7 @@ bool MdOut::buildRefFromFile(const char* name, const char* outDir) {
if (fOut) {
this->writePending();
fclose(fOut);
+ SkDebugf("wrote %s\n", fullName.c_str());
fOut = nullptr;
}
return true;
@@ -330,6 +353,31 @@ void MdOut::childrenOut(const Definition* def, const char* start) {
}
}
+const Definition* MdOut::findParamType() {
+ SkASSERT(fMethod);
+ TextParser parser(fMethod->fFileName, fMethod->fStart, fMethod->fContentStart,
+ fMethod->fLineCount);
+ string lastFull;
+ do {
+ parser.skipToAlpha();
+ if (parser.eof()) {
+ return nullptr;
+ }
+ const char* word = parser.fChar;
+ parser.skipFullName();
+ SkASSERT(!parser.eof());
+ string name = string(word, parser.fChar - word);
+ if (fLastParam->fName == name) {
+ const Definition* paramType = this->isDefined(parser, lastFull, false);
+ return paramType;
+ }
+ if (isupper(name[0])) {
+ lastFull = name;
+ }
+ } while (true);
+ return nullptr;
+}
+
const Definition* MdOut::isDefined(const TextParser& parser, const string& ref, bool report) const {
auto rootIter = fBmhParser.fClassMap.find(ref);
if (rootIter != fBmhParser.fClassMap.end()) {