streamline web documentation

This is the next step in reducing the amount of typing
in bookmaker, and presenting a web-base interface that
more closely matches the include documentation.

Moving towards making xxx_Reference solely contain
use documentation, and xxx_Overview (unpublished)
contain theory of operation documentation.

Fixed quite a few bugs along the way, and made
function and member documentation tighter.

TBR=caryclark@google.com
Docs-Preview: https://skia.org/?cl=160640
Change-Id: I763df4d59baa5dfd0177f0523294b5316434c4b0
Reviewed-on: https://skia-review.googlesource.com/c/160640
Reviewed-by: Cary Clark <caryclark@skia.org>
Commit-Queue: Cary Clark <caryclark@skia.org>
Auto-Submit: Cary Clark <caryclark@skia.org>
diff --git a/tools/bookmaker/includeParser.cpp b/tools/bookmaker/includeParser.cpp
index 50ba723..ad77119 100644
--- a/tools/bookmaker/includeParser.cpp
+++ b/tools/bookmaker/includeParser.cpp
@@ -9,9 +9,6 @@
 #include "SkOSFile.h"
 #include "SkOSPath.h"
 
-const char IncludeParser::gAttrDeprecated[] = "SK_ATTR_DEPRECATED";
-const size_t IncludeParser::kAttrDeprecatedLen = sizeof(gAttrDeprecated) - 1;
-
 const IncludeKey kKeyWords[] = {
     { "",           KeyWord::kNone,         KeyProperty::kNone           },
     { "SK_API",     KeyWord::kSK_API,       KeyProperty::kModifier       },
@@ -410,7 +407,11 @@
     int lastIndent = 0;
     bool lastDoubleMeUp = false;
     fCheck.reset();
-    this->codeBlockSpaces(result, startIndent);
+    if (MarkType::kDefine == markType) {
+        result = "#define ";
+    } else {
+        this->codeBlockSpaces(result, startIndent);
+    }
     do {
         if (!this->advanceInclude(i)) {
             continue;
@@ -610,19 +611,21 @@
     return result;
 }
 
-void IncludeParser::writeCodeBlock(const BmhParser& bmhParser) {
+void IncludeParser::writeCodeBlock() {
     for (auto& classMapper : fIClassMap) {
-        string className = classMapper.first;
-        auto finder = bmhParser.fClassMap.find(className);
-        if (bmhParser.fClassMap.end() != finder) {
-            classMapper.second.fCode = this->writeCodeBlock(classMapper.second, MarkType::kClass);
-            continue;
-        }
-        SkASSERT(string::npos != className.find("::"));
+        classMapper.second.fCode = this->writeCodeBlock(classMapper.second, MarkType::kClass);
     }
     for (auto& enumMapper : fIEnumMap) {
-            enumMapper.second->fCode = this->writeCodeBlock(*enumMapper.second,
-                    enumMapper.second->fMarkType);
+        enumMapper.second->fCode = this->writeCodeBlock(*enumMapper.second,
+                enumMapper.second->fMarkType);
+    }
+    for (auto& typedefMapper : fITypedefMap) {
+        typedefMapper.second->fCode = this->writeCodeBlock(*typedefMapper.second,
+                typedefMapper.second->fMarkType);
+    }
+    for (auto& defineMapper : fIDefineMap) {
+        defineMapper.second->fCode = this->writeCodeBlock(*defineMapper.second,
+                defineMapper.second->fMarkType);
     }
 }
 
@@ -754,10 +757,6 @@
                         }
                     }
                     if (!def) {
-                        if (gAttrDeprecated == token.fName) {
-                            fAttrDeprecated = &token;
-                            break;
-                        }
                         if (0 == token.fName.find("SkDEBUGCODE")) {
                             break;
                         }
@@ -1756,6 +1755,25 @@
     return this->writeCodeBlock(i, markType, 0);
 }
 
+ string IncludeParser::filteredBlock(string inContents, string filterContents) {
+    string result;
+    const unordered_map<string, Definition*>* mapPtr = nullptr;
+    MarkType markType = MarkType::kNone;
+    if ("Constant" == inContents) {
+        mapPtr = &fIConstMap;
+        markType = MarkType::kConst;
+    } else {
+        SkASSERT(0); // only Constant supported for now
+    }
+    for (auto entry : *mapPtr) {
+        if (string::npos == entry.first.find(filterContents)) {
+            continue;
+        }
+        result += this->writeCodeBlock(*entry.second, markType);
+    }
+    return result;
+}
+
 bool IncludeParser::findComments(const Definition& includeDef, Definition* markupDef) {
     // add comment preceding class, if any
     const Definition* parent = includeDef.fParent;
@@ -2071,6 +2089,7 @@
     markupChild->fTerminator = markupChild->fContentEnd;
     IClassDefinition& classDef = fIClassMap[markupDef->fName];
     classDef.fConsts[child->fName] = markupChild;
+    fIConstMap[child->fName] = markupChild;
     return true;
 }
 
@@ -2155,6 +2174,7 @@
         return false;
     }
     classDef.fDefines[nameStr] = markupChild;
+    fIDefineMap[nameStr] = markupChild;
     return true;
 }
 
@@ -2612,26 +2632,11 @@
         case Definition::Type::kBracket:
             switch (child->fBracket) {
                 case Bracket::kParen:
-                    if (fLastObject) {
-                        TextParser checkDeprecated(child->fFileName, fLastObject->fTerminator + 1,
-                                child->fStart, fLastObject->fLineCount);
-                        if (!checkDeprecated.eof()) {
-                            checkDeprecated.skipWhiteSpace();
-                            if (checkDeprecated.startsWith(gAttrDeprecated)) {
-                                fAttrDeprecated = child;
-                                break;
-                            }
-                        }
-                    }
                     {
                         auto tokenIter = child->fParent->fTokens.begin();
                         std::advance(tokenIter, child->fParentIndex);
                         tokenIter = std::prev(tokenIter);
                         TextParser previousToken(&*tokenIter);
-                        if (previousToken.startsWith(gAttrDeprecated)) {
-                            fAttrDeprecated = &*tokenIter;
-                            break;
-                        }
                         if (this->isMember(*tokenIter)) {
                             break;
                         }
@@ -2653,11 +2658,6 @@
                     if (!this->parseMethod(child, markupDef)) {
                         return child->reportError<bool>("failed to parse method");
                     }
-                    if (fAttrDeprecated) {
-                        Definition* lastMethod = &markupDef->fTokens.back();
-                        lastMethod->fDeprecated = true;
-                        fAttrDeprecated = nullptr;
-                    }
                 break;
                 case Bracket::kSlashSlash:
                 case Bracket::kSlashStar:
@@ -2763,6 +2763,7 @@
     IClassDefinition& classDef = fIClassMap[markupDef->fName];
     classDef.fTypedefs[nameStr] = markupChild;
     child->fName = markupDef->fName + "::" + nameStr;
+    fITypedefMap[child->fName] = markupChild;
     return true;
 }
 
@@ -3337,6 +3338,9 @@
     if (fIEnumMap.end() != fIEnumMap.find(root)) {
         return true;
     }
+    if (fITypedefMap.end() != fITypedefMap.find(root)) {
+        return true;
+    }
     if (fIFunctionMap.end() != fIFunctionMap.find(root)) {
         return true;
     }