2017-07-28 15:04:54 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef bookmaker_DEFINED
|
|
|
|
#define bookmaker_DEFINED
|
|
|
|
|
2017-10-09 19:45:33 +00:00
|
|
|
#include <algorithm>
|
2017-07-28 15:04:54 +00:00
|
|
|
#include <cmath>
|
|
|
|
#include <cctype>
|
2018-11-01 13:29:36 +00:00
|
|
|
#include <cstring>
|
2017-07-28 15:04:54 +00:00
|
|
|
#include <forward_list>
|
|
|
|
#include <list>
|
2018-11-01 13:29:36 +00:00
|
|
|
#include <sstream>
|
2017-07-28 15:04:54 +00:00
|
|
|
#include <string>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include <vector>
|
|
|
|
|
2018-11-01 13:29:36 +00:00
|
|
|
#include "SkTypes.h"
|
|
|
|
|
|
|
|
using std::forward_list;
|
|
|
|
using std::list;
|
|
|
|
using std::string;
|
|
|
|
using std::unordered_map;
|
|
|
|
using std::vector;
|
|
|
|
|
|
|
|
class Definition;
|
|
|
|
|
|
|
|
class NonAssignable {
|
|
|
|
public:
|
|
|
|
NonAssignable(NonAssignable const&) = delete;
|
|
|
|
NonAssignable& operator=(NonAssignable const&) = delete;
|
|
|
|
NonAssignable() {}
|
|
|
|
};
|
|
|
|
|
2018-10-31 16:14:03 +00:00
|
|
|
#define FPRINTF(...) \
|
|
|
|
if (fDebugOut) { \
|
|
|
|
SkDebugf(__VA_ARGS__); \
|
|
|
|
} \
|
|
|
|
fprintf(fOut, __VA_ARGS__)
|
|
|
|
|
2017-07-28 15:04:54 +00:00
|
|
|
// std::to_string isn't implemented on android
|
|
|
|
template <typename T>
|
2018-11-01 13:29:36 +00:00
|
|
|
string to_string(T value)
|
2017-07-28 15:04:54 +00:00
|
|
|
{
|
|
|
|
std::ostringstream os ;
|
|
|
|
os << value ;
|
|
|
|
return os.str() ;
|
|
|
|
}
|
|
|
|
|
|
|
|
enum class KeyWord {
|
|
|
|
kNone,
|
2017-08-29 21:36:51 +00:00
|
|
|
kSK_API,
|
2017-10-26 11:58:48 +00:00
|
|
|
kSK_BEGIN_REQUIRE_DENSE,
|
2018-08-10 17:09:13 +00:00
|
|
|
kAlignAs,
|
2017-07-28 15:04:54 +00:00
|
|
|
kBool,
|
|
|
|
kChar,
|
|
|
|
kClass,
|
|
|
|
kConst,
|
|
|
|
kConstExpr,
|
|
|
|
kDefine,
|
|
|
|
kDouble,
|
|
|
|
kElif,
|
|
|
|
kElse,
|
|
|
|
kEndif,
|
|
|
|
kEnum,
|
2018-01-26 17:56:22 +00:00
|
|
|
kError,
|
2017-07-28 15:04:54 +00:00
|
|
|
kFloat,
|
|
|
|
kFriend,
|
|
|
|
kIf,
|
|
|
|
kIfdef,
|
|
|
|
kIfndef,
|
|
|
|
kInclude,
|
|
|
|
kInline,
|
|
|
|
kInt,
|
|
|
|
kOperator,
|
|
|
|
kPrivate,
|
|
|
|
kProtected,
|
|
|
|
kPublic,
|
|
|
|
kSigned,
|
|
|
|
kSize_t,
|
|
|
|
kStatic,
|
|
|
|
kStruct,
|
|
|
|
kTemplate,
|
|
|
|
kTypedef,
|
2018-06-07 13:59:07 +00:00
|
|
|
kTypename,
|
2017-09-14 15:25:39 +00:00
|
|
|
kUint16_t,
|
2017-07-28 15:04:54 +00:00
|
|
|
kUint32_t,
|
2017-09-14 15:25:39 +00:00
|
|
|
kUint64_t,
|
|
|
|
kUint8_t,
|
2018-05-21 15:56:57 +00:00
|
|
|
kUintPtr_t,
|
2017-07-28 15:04:54 +00:00
|
|
|
kUnion,
|
|
|
|
kUnsigned,
|
2018-10-08 18:57:48 +00:00
|
|
|
kUsing,
|
2017-07-28 15:04:54 +00:00
|
|
|
kVoid,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class MarkType {
|
|
|
|
kNone,
|
|
|
|
kAnchor,
|
|
|
|
kAlias,
|
|
|
|
kBug,
|
|
|
|
kClass,
|
|
|
|
kCode,
|
|
|
|
kColumn,
|
|
|
|
kComment,
|
|
|
|
kConst,
|
|
|
|
kDefine,
|
|
|
|
kDescription,
|
2018-05-16 11:07:07 +00:00
|
|
|
kDetails, // used by #Const to specify #Subtopic details with examples and so on
|
2018-01-11 15:35:44 +00:00
|
|
|
kDuration,
|
2017-07-28 15:04:54 +00:00
|
|
|
kEnum,
|
|
|
|
kEnumClass,
|
|
|
|
kExample,
|
|
|
|
kExternal,
|
2018-06-07 13:59:07 +00:00
|
|
|
kFile,
|
2018-10-16 14:30:28 +00:00
|
|
|
kFilter,
|
2017-07-28 15:04:54 +00:00
|
|
|
kFormula,
|
|
|
|
kFunction,
|
|
|
|
kHeight,
|
2018-02-27 14:54:21 +00:00
|
|
|
kIllustration,
|
2017-07-28 15:04:54 +00:00
|
|
|
kImage,
|
2018-01-30 15:08:57 +00:00
|
|
|
kIn,
|
2017-07-28 15:04:54 +00:00
|
|
|
kLegend,
|
2018-01-30 15:08:57 +00:00
|
|
|
kLine,
|
2018-06-27 15:00:21 +00:00
|
|
|
kLink, // used internally by #Anchor
|
2017-07-28 15:04:54 +00:00
|
|
|
kList,
|
2017-10-26 11:58:48 +00:00
|
|
|
kLiteral, // don't lookup hyperlinks, do substitution, etc
|
2017-07-28 15:04:54 +00:00
|
|
|
kMarkChar,
|
|
|
|
kMember,
|
|
|
|
kMethod,
|
|
|
|
kNoExample,
|
2018-05-16 11:07:07 +00:00
|
|
|
kNoJustify, // don't contribute this #Line to tabular comment measure, even if it fits
|
2017-10-26 11:58:48 +00:00
|
|
|
kOutdent,
|
2017-07-28 15:04:54 +00:00
|
|
|
kParam,
|
2018-03-05 18:26:16 +00:00
|
|
|
kPhraseDef,
|
2018-05-16 11:07:07 +00:00
|
|
|
kPhraseParam,
|
2018-03-05 18:26:16 +00:00
|
|
|
kPhraseRef,
|
2017-07-28 15:04:54 +00:00
|
|
|
kPlatform,
|
2018-02-01 14:37:32 +00:00
|
|
|
kPopulate,
|
2017-07-28 15:04:54 +00:00
|
|
|
kReturn,
|
|
|
|
kRow,
|
|
|
|
kSeeAlso,
|
2018-01-03 13:37:53 +00:00
|
|
|
kSet,
|
2017-07-28 15:04:54 +00:00
|
|
|
kStdOut,
|
|
|
|
kStruct,
|
|
|
|
kSubstitute,
|
|
|
|
kSubtopic,
|
|
|
|
kTable,
|
|
|
|
kTemplate,
|
|
|
|
kText,
|
|
|
|
kToDo,
|
|
|
|
kTopic,
|
|
|
|
kTypedef,
|
|
|
|
kUnion,
|
2018-10-08 18:57:48 +00:00
|
|
|
kUsing,
|
2017-07-28 15:04:54 +00:00
|
|
|
kVolatile,
|
|
|
|
kWidth,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
Last_MarkType = (int) MarkType::kWidth,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class Bracket {
|
|
|
|
kNone,
|
|
|
|
kParen,
|
|
|
|
kSquare,
|
|
|
|
kBrace,
|
|
|
|
kAngle,
|
|
|
|
kString,
|
|
|
|
kChar,
|
|
|
|
kSlashStar,
|
|
|
|
kSlashSlash,
|
|
|
|
kPound,
|
|
|
|
kColon,
|
2017-08-29 21:36:51 +00:00
|
|
|
kDebugCode, // parens get special treatment so SkDEBUGCODE( isn't treated as method
|
2017-07-28 15:04:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class Punctuation { // catch-all for misc symbols tracked in C
|
|
|
|
kNone,
|
|
|
|
kAsterisk, // for pointer-to
|
|
|
|
kSemicolon, // e.g., to delinate xxx() const ; const int* yyy()
|
|
|
|
kLeftBrace,
|
|
|
|
kColon, // for foo() : bar(1), baz(2) {}
|
|
|
|
};
|
|
|
|
|
2017-09-14 15:25:39 +00:00
|
|
|
enum class KeyProperty {
|
|
|
|
kNone,
|
|
|
|
kClassSection,
|
|
|
|
kFunction,
|
|
|
|
kModifier,
|
|
|
|
kNumber,
|
|
|
|
kObject,
|
|
|
|
kPreprocessor,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct IncludeKey {
|
|
|
|
const char* fName;
|
|
|
|
KeyWord fKeyWord;
|
|
|
|
KeyProperty fProperty;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern const IncludeKey kKeyWords[];
|
|
|
|
|
2018-10-31 16:14:03 +00:00
|
|
|
struct NameMap {
|
|
|
|
void copyToParent(NameMap* parent) const;
|
2018-11-07 19:59:03 +00:00
|
|
|
void setParams(Definition* bmhDef, Definition* iMethod);
|
2018-10-31 16:14:03 +00:00
|
|
|
|
|
|
|
string fName;
|
|
|
|
NameMap* fParent = nullptr;
|
|
|
|
unordered_map<string, string> fLinkMap; // from SkRect to #Rect
|
|
|
|
// ref map includes "xxx", "xxx ", "xxx yyy", "xxx zzz", etc.
|
|
|
|
unordered_map<string, Definition*> fRefMap; // e.g., from #Substitute entry to #Topic entry
|
|
|
|
};
|
|
|
|
|
2018-11-01 13:29:36 +00:00
|
|
|
enum class Resolvable {
|
|
|
|
kNo, // neither resolved nor output
|
|
|
|
kYes, // resolved, output
|
|
|
|
kOut, // mostly resolved, output (FIXME: is this really different from kYes?)
|
|
|
|
kCode, // resolve methods as they are used, not as they are prototyped
|
|
|
|
kFormula, // kCode, plus make most spaces non-breaking
|
|
|
|
kLiteral, // output untouched
|
|
|
|
kClone, // resolved, output, with references to clones as well
|
|
|
|
kSimple, // resolve simple words (used to resolve method declarations)
|
|
|
|
kInclude, // like simple, plus reverse resolve SkXXX to XXX
|
2017-07-28 15:04:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|