diff --git a/.vscode/settings.json b/.vscode/settings.json index 24e9ce0..c8d2597 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -45,12 +45,32 @@ "streambuf": "cpp", "typeinfo": "cpp", "cstring": "cpp", - "map": "cpp" + "map": "cpp", + "set": "cpp" }, "cmake.debugConfig": { + "cwd": "/mnt/d/Work/WeChatProjects/miniprogram-demo/miniprogram", "args": [ - "-llw", - "111,222" + "\"-d\"", + "\"--split\"", + "\">_<109\"", + "\"-xc\"", + "\"9>_<109./miniprogram_npm/miniprogram-barrage/index.wxml>_<1090>_<109./miniprogram_npm/miniprogram-recycle-view/recycle-item.wxml>_<1090>_<109./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml>_<1090>_<109./miniprogram_npm/wxml-to-canvas/index.wxml>_<1090>_<109./page/API/index.wxml>_<1091>_<109set-tab-bar>_<109./page/API/components/set-tab-bar/set-tab-bar.wxml>_<1090>_<109./page/cloud/index.wxml>_<1090>_<109./page/component/index.wxml>_<1090>_<109./page/extend/index.wxml>_<1090\"", + "\"-lla\"", + "\"./miniprogram_npm/miniprogram-barrage/index>_<109./miniprogram_npm/miniprogram-recycle-view/recycle-item>_<109./miniprogram_npm/miniprogram-recycle-view/recycle-view>_<109./miniprogram_npm/wxml-to-canvas/index>_<109./page/API/index>_<109./page/API/components/set-tab-bar/set-tab-bar>_<109./page/cloud/index>_<109./page/component/index>_<109./page/extend/index\"", + "\"./miniprogram_npm/miniprogram-barrage/index.wxml\"", + "\"./miniprogram_npm/miniprogram-recycle-view/recycle-item.wxml\"", + "\"./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml\"", + "\"./miniprogram_npm/wxml-to-canvas/index.wxml\"", + "\"./page/API/index.wxml\"", + "\"./page/API/components/set-tab-bar/set-tab-bar.wxml\"", + "\"./page/cloud/index.wxml\"", + "\"./page/common/foot.wxml\"", + "\"./page/common/head.wxml\"", + "\"./page/component/index.wxml\"", + "\"./page/extend/index.wxml\"", + "\"-gn\"", + "\"\\$gwx1\"" ] } } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 813efc3..1a7443e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,15 @@ add_executable(wcc add_executable(wcsc src/wcsc.cpp ) +add_executable( + resolve_path + test/resolve_path.cpp + src/wxml/dom_lib/common.cpp + ) +add_test( + resolve_test + resolve_path + ) set(CPACK_PROJECT_NAME ${PROJECT_NAME}) set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) diff --git a/src/include/string_utils.h b/src/include/string_utils.h index 70af5f8..6a4769a 100644 --- a/src/include/string_utils.h +++ b/src/include/string_utils.h @@ -4,6 +4,6 @@ #include std::string& trim(std::string &s); -void split(std::vector result, std::string source, std::string mark); +void split(std::vector &result, std::string source, std::string mark); #endif \ No newline at end of file diff --git a/src/include/wxml.h b/src/include/wxml.h index 864ff4b..c9f8a6f 100644 --- a/src/include/wxml.h +++ b/src/include/wxml.h @@ -6,27 +6,171 @@ #include #include -namespace WXML{ - class Compiler +namespace WXML +{ + + + namespace DOMLib { - private: - /* data */ - public: - Compiler(/* args */); - ~Compiler(); + /** + * 参数值可能不是int + */ + bool AttrsCompartor(int a1, int a2); + /** + * + */ + std::string joinString(std::vector& str, char split); + std::vector splitString(std::string const& str, char split); + std::string resolvePath(std::string const&, std::string const&); + class WXMLDom + { + private: + /* data */ + public: + WXMLDom(/* args */); + ~WXMLDom(); + void Error(); + }; + + + class Token + { + private: + /* data */ + std::string str1; + std::string str2; + std::string str3; + public: + Token(/* args */); + Token(WXML::DOMLib::Token&&); + Token(WXML::DOMLib::Token const&); + std::string ToString(); + int ToAttrContent(); + bool IsValidVariableName(std::string const&); + bool IsMatch(char const&); + bool GetTemplateContent(std::string const&, std::string&); + ~Token(); + }; + - static std::string CompileLazy( + class Parser + { + private: + /* data */ + public: + Parser(/* args */); + ~Parser(); + void Match(); + /** + * wxml tag + * view | + */ + bool IsValidTag(std::string &); + WXML::DOMLib::Token Peek(); + bool Parse(char const*fileContent, // Str + std::string &, // a4 + std::string const&, // a5 + std::vector & // a6 + ); + + int Error(char const*, WXML::DOMLib::Token &); + std::string GetParsed(); + std::string DOM(); + std::string DOMS(); + std::vector ATTR_LIST(); + std::string ATTR(); + + }; + + }; + + namespace Compiler + { + + int CompileLazy( + std::map const& fileContent, + std::string& errorMessage, // 错误信息 + std::map& outputMap, // 输出1 + std::map& dict, // 输出2 + std::map>, + std::map>, // vecFileContentMap + std::vector const&, // splitedData + std::map const&, // mapData1 + bool, // isLLA + std::string const&, // gwxMark + uint, // mark + char, // '\n' + std::string const&, // 'e' + std::string const&, // const char off_5403C3[] = {'s','\0','e','\0'} + std::string const&, // "gg" + std::string const&, // "e_" + std::string const&, // "d_" + std::string const&, // "p_" + std::string const&, // '\0' + std::string const&, // "boxofchocolate" + std::string const&, // "$gdwx" + std::string const& // "f_" + ); + + std::string Compile( std::map const&, std::string&, std::map&, std::map&, - std::map, std::less, std::allocator>>>, + std::map>, std::allocator>, - std::allocator const&, + std::string const&, std::map const&, bool, + std::string const& gwxMark, + uint mark, + char lineEndMark, std::string const&, + std::string const& , + std::string const& ggMark, + std::string const& eMark, + std::string const& dMark, + std::string const& pMark, + std::string const& endMark, + std::string const& boxMark, + std::string const& gdwxMark, + std::string const& fMark); + + int DealWxsTag( + std::string const&, + std::string &, + std::string&, + std::string&, + std::string&, + int &, + std::string& + ); + + // void GetFuncId(); + void GetVersionInfo(std::string &a1, std::string a2); + int ParseSource( + std::string const& content, // 源码? + std::string const& fileName, // 文件名? + std::string const& , // ? + char lineEndMark, // '\n' + std::string const& gwxMark, // gwxMark + std::string & fMark, // "f_" + std::map const&, // fileData + std::string&, // 错误信息 + std::map,// map + std::map&,// ??? + std::map, // ??? + bool, // mark指定运算结果是否非0 + bool); // mark指定运算结果是否非0 + int RenderDefine( + WXML::DOMLib::WXMLDom &, + std::string const&, + std::map &, + std::string&, + std::stringstream &, + std::map const&, + bool, uint, char, std::string const&, @@ -39,26 +183,11 @@ namespace WXML{ std::string const&, std::string const&, std::string const&, - std::string const&); - - // static void DealWxsTag(); - // static void GetFuncId(); - static void GetVersionInfo(std::string &a1, std::string a2); - // static void ParseSource(); - // static void RenderDefine(); - static void WXMLHelperCode(std::string &result); + std::string const& + ); + void WXMLHelperCode(std::string &result); }; - - class DOMLib - { - private: - /* data */ - const char *szWXIFControlAttrs[4] = { "wx-if", "wx:if", "wx:elif", "wx:else" }; // weak - public: - DOMLib(/* args */); - ~DOMLib(); - }; class Rewrite { @@ -67,7 +196,7 @@ namespace WXML{ public: Rewrite(/* args */); ~Rewrite(); - + }; @@ -81,6 +210,26 @@ namespace WXML{ Tokenizer(/* args */); ~Tokenizer(); }; + + class ExprSyntaxTree + { + private: + /* data */ + public: + ExprSyntaxTree(/* args */); + ~ExprSyntaxTree(); + }; + + class Token + { + private: + /* data */ + public: + Token(/* args */); + ~Token(); + static const char * GetTokenName(const char **a1); + }; + } // namespace EXPRLib diff --git a/src/utils/file.cpp b/src/utils/file.cpp index 78e68de..601184c 100644 --- a/src/utils/file.cpp +++ b/src/utils/file.cpp @@ -42,10 +42,10 @@ int readFile (const char* fileName, std::string &result) { * * @param line 存储行数据的容器 * @param data 配置内容数据 - * @param lineEndMark 行结束标志 \n + * @param splitdMark 分割标志 */ -std::string getNextArg(std::string &data, std::string const & lineEndMark) { - int pos = data.find(lineEndMark, 0); +std::string getNextArg(std::string &data, std::string const & splitMark) { + int pos = data.find(splitMark, 0); std::string lineData; if (pos == -1) { lineData.assign(data); @@ -53,7 +53,7 @@ std::string getNextArg(std::string &data, std::string const & lineEndMark) { } else { lineData = data.substr(0, pos); - data = data.substr(pos); + data = data.substr(pos + splitMark.length()); } trim(lineData); return lineData; diff --git a/src/utils/string_utils.cpp b/src/utils/string_utils.cpp index 8b9c0bf..0d0a27b 100644 --- a/src/utils/string_utils.cpp +++ b/src/utils/string_utils.cpp @@ -13,16 +13,16 @@ std::string& trim(std::string &s) } -void split(std::vector result, std::string source, std::string mark) { +void split(std::vector &result, std::string source, std::string mark) { int currentPos = 0; for (int i = source.find(mark, 0); ; i = source.find(mark, currentPos)) { - std::string ele = source.substr(currentPos, i); + std::string ele = source.substr(currentPos, i - currentPos); trim(ele); result.emplace_back(ele); if (i == -1) break; - currentPos = i + 1; + currentPos = i + mark.length(); } } \ No newline at end of file diff --git a/src/wcc.cpp b/src/wcc.cpp index 9c58890..cf7fb27 100644 --- a/src/wcc.cpp +++ b/src/wcc.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include "include/file.h" #include "include/usage.h" #include "include/string_utils.h" @@ -11,8 +12,6 @@ using namespace std; int main(int argc, const char **argv) { - printf("argc: %d\n", argc); - string gwxMark = "$gwx"; string splitMarkStr = " "; bool hasConfigParam = false; @@ -20,6 +19,7 @@ int main(int argc, const char **argv) { vector paramList; string configData; + // 第一个参数是程序路径,忽略 for (int i = 1; i < argc; i++) { @@ -50,19 +50,21 @@ int main(int argc, const char **argv) { bool version = false; bool hasXCParam = false; bool hasCompleteCodeParam = false; + bool isLLA = false; bool hasLL = false; string xc_Or_completeCode_Param; string outputFileName; - vector temp; + vector fileList; vector splitedData; map mapData1; - map fileData; + map fileContentMap; + map> vecFileContentMap; for (int i = 0; i < paramList.size(); i++) { string param = paramList[i]; if (param[0] != '-') { // 不是参数名,跳过 - temp.push_back(param); + fileList.push_back(param); continue; } @@ -89,8 +91,9 @@ int main(int argc, const char **argv) { continue; } if (i + 1 < paramList.size()) { - temp.push_back(paramList[i + 1]); + fileList.push_back(paramList[i + 1]); isReadFromStdin = true; + continue; } break; case 'v': @@ -100,11 +103,12 @@ int main(int argc, const char **argv) { mark |= 0x10u; else version = true; + continue; break; case 'x': // -xc output simplified code for custom component /* code */ - if(param[2] == 'c' && i < paramList.size()) { + if(param[2] == 'c' && i + 1 < paramList.size()) { hasXCParam = true; if(paramList[i + 1][0] != '-') { xc_Or_completeCode_Param.assign(paramList[i + 1]); @@ -132,6 +136,7 @@ int main(int argc, const char **argv) { if (i + 1 < paramList.size()) { outputFileName = paramList[i + 1]; i++; + continue; } break; case 'g': @@ -140,22 +145,26 @@ int main(int argc, const char **argv) { if (param[2] == 'n' && i + 1 < paramList.size()) { gwxMark.assign(paramList[i + 1]); i++; + continue; } break; case 'p': /* code */ mark |= 0x20u; + continue; break; case 't': /* code */ mark |= 1u; + continue; break; case 'i': /* code */ mark |= 0x40u; + continue; break; default: @@ -197,6 +206,7 @@ int main(int argc, const char **argv) { printf("Error: expected -llw or -lla, but got %s\n", param.c_str()); return -1; } + isLLA = true; } string splitMark; if (!splitMarkStr.compare(" ")) { @@ -206,7 +216,9 @@ int main(int argc, const char **argv) { // 不是空格 splitMark = splitMarkStr; } + // 分割 -llw -lla 接下来的一个参数 split(splitedData, paramList[i + 1], splitMark); + i++; hasLL = true; } } @@ -223,7 +235,7 @@ int main(int argc, const char **argv) { } } - if (temp.empty()) { + if (fileList.empty()) { usage(argc, argv); return 0; } @@ -231,69 +243,84 @@ int main(int argc, const char **argv) { if (isReadFromStdin) { string content; readFile(0, content); - fileData[temp[0]] = content; + fileContentMap[fileList[0]] = content; } else { // 读取文件内容 - for (int i = 0; i < temp.size(); i++) + for (int i = 0; i < fileList.size(); i++) { string content; - readFile(temp[i].c_str(), content); - fileData[temp[i]] = content; + readFile(fileList[i].c_str(), content); + fileContentMap[fileList[i]] = content; } } - if (true) { + // 此if条件x64dbg得出 + if (!xc_Or_completeCode_Param.empty()) + { string data; + string arg2; + vector list; data = getNextArg(xc_Or_completeCode_Param, splitMarkStr); unsigned long long count = strtoull(&data[0], 0, 10); for (unsigned long long i = 0; i < count; i++) { - string data1 = getNextArg(xc_Or_completeCode_Param, splitMarkStr); + string arg1 = getNextArg(xc_Or_completeCode_Param, splitMarkStr); data = getNextArg(xc_Or_completeCode_Param, splitMarkStr); unsigned long long jCount = strtoull(&data[0], 0, 10); vector list; for (unsigned long long i = 0; i < jCount; i++) { - string data2 = getNextArg(xc_Or_completeCode_Param, splitMarkStr); - list.push_back(data2); - vector::iterator it = find(splitedData.begin(), splitedData.end(), data2); - if (it == splitedData.end()) { - splitedData.push_back(data2); + arg2 = getNextArg(xc_Or_completeCode_Param, splitMarkStr); + list.push_back(arg2); + auto it = vecFileContentMap.find(arg2); + if (it == vecFileContentMap.end()) + { + list.push_back(arg2); } } - auto fileContent = fileData.lower_bound(data1); - if (fileContent == fileData.end()) { - // fileData.ins(data1, 5) + // TODO: 还有问题 + auto it = vecFileContentMap.lower_bound(arg1); + if (it == vecFileContentMap.end() || arg1 < it->first) + { + vector d; + vecFileContentMap.emplace(arg1, d); } - //TODO... } - + vecFileContentMap["ALL"] = list; } // - if (hasLL) { - for (int i = 0; i < 999; i++) + if (hasLL) + { + // 处理文件路径 + for (int i = 0; i < splitedData.size(); i++) { - /* code */ + string path = splitedData[i]; + if (path[0] == '.' && path[1] == '/') + { + // 以"./"开头,去掉前两个字符 + splitedData[i] = path.substr(2); + } } map outputMap; const char off_5403C3[] = {'s','\0','e','\0'}; int compilerResult = 0; + string errorMessage; // compilerResult = WXML::Compiler::CompileLazy( - // &v107, - // (int *)v111, + // fileContentMap, + // errorMessage, // outputMap, // &v101, // &v121, - // v126, - // (int *)&v92, - // &v105, - // v53, - // (int)gwxMark, + // vecFileContentMap, // vecFileContentMap + // splitedData, + // mapData1, + // isLLA, + // gwxMark, // mark, // 10, // &off_5403C3[2], @@ -309,7 +336,8 @@ int main(int argc, const char **argv) { // while() // if() - if (1) { + if (1) + { string helperCode; WXML::Compiler::WXMLHelperCode(helperCode); string data = "var __wxAppData=__wxAppData||{};var __wxAppCode__=__wxAppCode__||{};var global=global||{};var __WXML_GLOBAL__=" @@ -321,7 +349,8 @@ int main(int argc, const char **argv) { data = data + helperCode; outputMap["__COMMON__"] = data; } - else { + else + { string helperCode; WXML::Compiler::WXMLHelperCode(helperCode); string commonData = "var __wxAppData=__wxAppData||{};var __wxAppCode__=__wxAppCode__||{};var global=global||{};var __WXML_GLOBAL__=" @@ -343,7 +372,8 @@ int main(int argc, const char **argv) { /* code */ if (j == "") break; - if (j[11] != j[10]) { + if (j[11] != j[10]) + { stringstream dep; dep << "__WXML_DEP__[\""; dep << "\"]=["; @@ -389,7 +419,7 @@ int main(int argc, const char **argv) { // v53, // (int *)gwxMark, // mark, - // 10, + // '\n', // off_5403C3[2], // off_5403C3[2] // off_5403C3, // off_5403C3 // "gg", // "gg" diff --git a/src/wxml/compiler.cpp b/src/wxml/compiler.cpp index 046eece..46bd1d0 100644 --- a/src/wxml/compiler.cpp +++ b/src/wxml/compiler.cpp @@ -4,28 +4,281 @@ namespace WXML{ - Compiler::Compiler(/* args */) + namespace Compiler { - } + + int CompileLazy( + std::map const& fileContentMap, + std::string& errorMessage, // 错误信息 + std::map& outputMap, // 输出 + std::map& dict, // 输出 + std::map>, + std::map>, // vecFileContentMap + std::vector const&, // splitedData + std::map const&, // mapData1 + bool, // isLLA + std::string const& gwxMark, // gwxMark + uint mark, // mark + char lineEndMark, // '\n' + std::string const&, // 'e' + std::string const&, // const char off_5403C3[] = {'s','\0','e','\0'} + std::string const&, // "gg" + std::string const&, // "e_" + std::string const&, // "d_" + std::string const&, // "p_" + std::string const& strEndMark, // '\0' + std::string const& boxMark, // "boxofchocolate" + std::string const& gdwxMark, // "$gdwx" + std::string const& fMark // "f_" + ) + { + for (auto it = fileContentMap.begin(); it != fileContentMap.end(); it++) + { + /* code */ + int parseResult = 0; + // parseResult = WXML::Compiler::ParseSource( + // it->second, // 源码? + // it->first, // 文件名 + // "\n",// ? + // lineEndMark, // '\n' + // gwxMark, // gwxMark + // fMark, // "f_" + // fileContentMap, // fileContentMap + // errorMessage, // 错误信息 + // &v304, // map + // &v309, // ??? + // &v311, // ??? + // (mark & 4) != 0, // a11 -> mark + // (mark & 0x20) != 0); + if (parseResult) { + return parseResult; + } + } + + return 0; + } + + + int DealWxsTag( + std::string const& a1, + std::string &a2, + std::string& a3, + std::string& a4, + std::string& a5, + int & a6, + std::string& a7) + { + int pos = a2.find('>', a2[4]); + std::string sub; + if (a2[pos - 1] == '/') + { + // 这个尖括号附近是这样的:/> + sub = a2.substr(a2[4] + 1, pos + 1 - a2[4] - 6); + } + else + { + sub = a2.substr(a2[4] + 1, pos + 1 - a2[4] - 5); + } + std::string data = ""); + for (int i = 1; i < a2[2]; i++) + { + data = "\n" + data; + } + for (int i = 1; i < a2[3]; i++) + { + data = " " + data; + } + // WXML::DOMLib::Parser::Parser(data); + return 0; + } - Compiler::~Compiler() - { - } - void Compiler::GetVersionInfo(std::string &a1, std::string a2) { - std::stringstream result; - result << "/*"; - result << "v0.5vv_20200413_syb_scopedata"; - result << "*/"; + void GetVersionInfo(std::string &a1, std::string a2) + { + std::stringstream result; + result << "/*"; + result << "v0.5vv_20200413_syb_scopedata"; + result << "*/"; - result << a2; - result << ".__wcc_version__='"; - result << "v0.5vv_20200413_syb_scopedata"; - result << "';"; - result << a2; - result << ".__wcc_version_info__={\"customComponents\":true,\"fixZeroRpx\":true,\"propValueDeepCopy\":false};"; - result.str(a1); - } - void Compiler::WXMLHelperCode(std::string &result) { - result.assign(aIfThisThisGUnd); - } + result << a2; + result << ".__wcc_version__='"; + result << "v0.5vv_20200413_syb_scopedata"; + result << "';"; + result << a2; + result << ".__wcc_version_info__={\"customComponents\":true,\"fixZeroRpx\":true,\"propValueDeepCopy\":false};"; + result.str(a1); + } + + int ParseSource( + std::string const& content, // 源码? + std::string const& fileName, // 文件名? + char lineEndMark, // '\n' + std::string const& gwxMark, // gwxMark + std::string& fMark, // "f_" + std::map const&, // fileContentMap + std::string& errorMessage, // 错误信息 + std::map result,// map + std::map& map1,// ??? + std::map map2, // ??? + bool b1, // mark指定运算结果是否非0 + bool b2) // mark指定运算结果是否非0 + { + bool isWxml = fileName.substr(fileName.length() - 5) == ".wxml"; + if (isWxml) + { + // parse + int parseResult = 0; + if (parseResult) + return parseResult; + + if (!parseResult) + { + // GetParsed + // result[fileName] = "" + int a; + int b; + std::stringstream ss; + if (a != b) + { + ss << "f_['"; + // ss << ToStringCode(fileName); + ss << "']={};"; + ss << lineEndMark; + } + for (int i = 0; i < 99; i++) + { + /* code */ + int dealResult = 0; + std::string t; + // dealResult = DealWxsTag(fileName, , t); + if (dealResult) + { + // 非0 + return dealResult; + } + ss << fMark; + ss << "['"; + //ss << ToStringCode(fileName); + ss << "']['"; + //ss << ToStringCode(t); + ss << "'] ="; + + int r = 1; + if (r) + { + std::string ret; + // PathCombine(fileName, ??, ret); + if (ret[0] == '/') + { + ret = '.' + ret; + } + if (/*??? && */ (gwxMark == "$gwx" || b2)) + { + std::stringstream errs; + errs << fileName; + errs << ":"; + // errs << v65; // 行号? + errs << ":"; + // errs << v66[28 * i + 3]; + errs << ":"; + // errs << v76; // 文件的某种路径 + errs << " not found from "; + errs << fileName; + errorMessage = errs.str(); + + // 清空 + errs.clear(); + return 1; + } + ss << "f_['"; + // ss << ToStringCode(v81); + ss << "'] || "; + + ss << "nv_require(\""; + // ss << ToStringCode("p_" + v81); + ss << "\");"; + ss << lineEndMark; + + ss << fMark; + ss << "['"; + // ss << ToStringCode(fileName); + ss << "']['"; + // ss << ToStringCode(v74); + ss << "']();"; + ss << lineEndMark; + + } + else + { + std::string data = "m_" + fileName; + data = data.append(":"); + data = data.append(t); + // GetFuncId + // compile_ns + int compilerResult = 1; + if (compilerResult) + { + return compilerResult; + } + ss << "nv_require(\""; + std::string m = "m_" + fileName; + m = m.append(":"); + // m = m.append(v74); + // ss << ToStringCode(m); + ss << "\");"; + ss << lineEndMark; + + // ss << v72; + ss << lineEndMark; + } + + } + std::string code = ss.str(); + + if (1) + { + map1[fileName].assign(code); + } + + } + } + else if(fileName.substr(fileName.length() - 4) == ".wxs") + { + std::string p = "p_" + fileName; + // GetFuncId(map2) + // compile_ns + int compilerResultCode = 0; + if (compilerResultCode) { + errorMessage.assign("error..."); + return compilerResultCode; + } + else + { + std::stringstream code; + code << "f_['"; + // code << ToStringCode(fileName); + code << "'] = nv_require("; + code << '"'; + // code << ToStringCode("p_" + fileName); + code << "\");"; + code << lineEndMark; + + // code << compileResultData; + code << lineEndMark; + + std::string strCode = code.str(); + map1[fileName] = strCode; + + } + } + return 0; + } + void WXMLHelperCode(std::string &result) + { + result.assign(aIfThisThisGUnd); + } + } // namespace Compiler + + } \ No newline at end of file diff --git a/src/wxml/dom_lib.cpp b/src/wxml/dom_lib.cpp deleted file mode 100644 index d51a3ca..0000000 --- a/src/wxml/dom_lib.cpp +++ /dev/null @@ -1,14 +0,0 @@ - -#include "../include/wxml.h" - -namespace WXML { - - - DOMLib::DOMLib(/* args */) - { - } - - DOMLib::~DOMLib() - { - } -} \ No newline at end of file diff --git a/src/wxml/dom_lib/common.cpp b/src/wxml/dom_lib/common.cpp new file mode 100644 index 0000000..9e114bc --- /dev/null +++ b/src/wxml/dom_lib/common.cpp @@ -0,0 +1,78 @@ +#include "../../include/wxml.h" + + +namespace WXML +{ + + + namespace DOMLib + { + bool AttrsCompartor(int a1, int a2) + { + return a1 < a2; + } + + std::string joinString(std::vector& data, char split) + { + std::stringstream ss; + for (int i = 0; i < data.size(); i++) + { + ss << data[i]; + if (i != data.size() - 1) + ss << split; + } + + return ss.str(); + } + std::vector splitString(std::string const& str, char split) + { + int pos = 0; + std::vector result; + for (int i = str.find(split, pos); i != -1; i = str.find(split, pos)) + { + auto sub = str.substr(pos, i - pos); + result.emplace_back(sub); + pos = i + 1; + } + result.emplace_back(str.substr(pos)); + return result; + } + + std::string resolvePath(std::string const& path1, std::string const& path2) + { + std::string result; + if (path2[0] != '/') + { + auto p1Split = splitString(path1, '/'); + auto p2Split = splitString(path2, '/'); + // 把文件名pop出去 + p1Split.pop_back(); + for (int i = 0; i < p2Split.size(); i++) + { + if (p2Split[i] == "..") + { + p1Split.pop_back(); + }else if(p2Split[i] != "\0" && p2Split[i] != ".") + { + p1Split.push_back(p2Split[i]); + } + } + result = joinString(p1Split, '/'); + + } + if (path1[0] == '.' && path2[0] == '/') + { + result = "." + path2; + } + if ( + // v5 <= 4 || + result.substr(result.size() - 5) != ".wxml" + ) + { + result.append(".wxml"); + } + return result; + } + } + +} \ No newline at end of file diff --git a/src/wxml/dom_lib/expr_syntax_tree.cpp b/src/wxml/dom_lib/expr_syntax_tree.cpp new file mode 100644 index 0000000..109e70e --- /dev/null +++ b/src/wxml/dom_lib/expr_syntax_tree.cpp @@ -0,0 +1,19 @@ +#include "../../include/wxml.h" + + +namespace WXML +{ + + + namespace EXPRLib + { + + ExprSyntaxTree::ExprSyntaxTree(/* args */) + { + } + + ExprSyntaxTree::~ExprSyntaxTree() + { + } + } +} \ No newline at end of file diff --git a/src/wxml/dom_lib/parser.cpp b/src/wxml/dom_lib/parser.cpp new file mode 100644 index 0000000..35669ba --- /dev/null +++ b/src/wxml/dom_lib/parser.cpp @@ -0,0 +1,24 @@ +#include "../../include/wxml.h" +#include + +namespace WXML +{ + namespace DOMLib + { + + const char *szWXIFControlAttrs[4] = { "wx-if", "wx:if", "wx:elif", "wx:else" }; // weak + + Parser::Parser(/* args */) + { + } + + Parser::~Parser() + { + } + + bool Parser::IsValidTag(std::string & tag) + { + return tag.compare("wx-") != 0; + } + } +} \ No newline at end of file diff --git a/src/wxml/dom_lib/str_cache.cpp b/src/wxml/dom_lib/str_cache.cpp new file mode 100644 index 0000000..e69de29 diff --git a/src/wxml/dom_lib/token.cpp b/src/wxml/dom_lib/token.cpp new file mode 100644 index 0000000..b956a73 --- /dev/null +++ b/src/wxml/dom_lib/token.cpp @@ -0,0 +1,27 @@ + +#include "../../include/wxml.h" + +namespace WXML +{ + namespace DOMLib + { + + Token::Token(/* args */) + { + } + + Token::Token(WXML::DOMLib::Token&& token) + { + } + + Token::~Token() + { + } + + bool IsMatch(char const&) + { + return true; + } + } +} + \ No newline at end of file diff --git a/src/wxml/dom_lib/wxml_dom.cpp b/src/wxml/dom_lib/wxml_dom.cpp new file mode 100644 index 0000000..9e3bcb5 --- /dev/null +++ b/src/wxml/dom_lib/wxml_dom.cpp @@ -0,0 +1,18 @@ + +#include "../../include/wxml.h" + +namespace WXML { + + + namespace DOMLib + { + + WXMLDom::WXMLDom(/* args */) + { + } + + WXMLDom::~WXMLDom() + { + } + } +} \ No newline at end of file diff --git a/src/wxml/expr_lib/token.cpp b/src/wxml/expr_lib/token.cpp new file mode 100644 index 0000000..5f22c18 --- /dev/null +++ b/src/wxml/expr_lib/token.cpp @@ -0,0 +1,45 @@ + +#include "../../include/wxml.h" + +namespace WXML +{ + namespace EXPRLib + { + Token::Token(/* args */) + { + } + + Token::~Token() + { + } + const char * Token::GetTokenName(const char **a1) + { + const char *result; // eax + + result = *a1; + switch ( (unsigned int)*a1 ) + { + case 0u: + result = (const char *)(a1 + 1); + break; + case 1u: + result = "$DECIMAL"; + break; + case 2u: + result = "$STRING"; + break; + case 3u: + result = "$VAR"; + break; + case 4u: + result = "$KEYWORD"; + break; + default: + return result; + } + return result; + } + + } +} + \ No newline at end of file diff --git a/test/cmd.txt b/test/cmd.txt new file mode 100644 index 0000000..d6b588c --- /dev/null +++ b/test/cmd.txt @@ -0,0 +1,4 @@ +"-d" "--split" ">_<109" "-xc" "9>_<109./miniprogram_npm/miniprogram-barrage/index.wxml>_<1090>_<109./miniprogram_npm/miniprogram-recycle-view/recycle-item.wxml>_<1090>_<109./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml>_<1090>_<109./miniprogram_npm/wxml-to-canvas/index.wxml>_<1090>_<109./page/API/index.wxml>_<1091>_<109set-tab-bar>_<109./page/API/components/set-tab-bar/set-tab-bar.wxml>_<1090>_<109./page/cloud/index.wxml>_<1090>_<109./page/component/index.wxml>_<1090>_<109./page/extend/index.wxml>_<1090" "-lla" "./miniprogram_npm/miniprogram-barrage/index>_<109./miniprogram_npm/miniprogram-recycle-view/recycle-item>_<109./miniprogram_npm/miniprogram-recycle-view/recycle-view>_<109./miniprogram_npm/wxml-to-canvas/index>_<109./page/API/index>_<109./page/API/components/set-tab-bar/set-tab-bar>_<109./page/cloud/index>_<109./page/component/index>_<109./page/extend/index" "./miniprogram_npm/miniprogram-barrage/index.wxml" "./miniprogram_npm/miniprogram-recycle-view/recycle-item.wxml" "./miniprogram_npm/miniprogram-recycle-view/recycle-view.wxml" "./miniprogram_npm/wxml-to-canvas/index.wxml" "./page/API/index.wxml" "./page/API/components/set-tab-bar/set-tab-bar.wxml" "./page/cloud/index.wxml" "./page/common/foot.wxml" "./page/common/head.wxml" "./page/component/index.wxml" "./page/extend/index.wxml" "-gn" "$gwx" + + + diff --git a/test/disassembly/compiler_lazy.cpp b/test/disassembly/compiler_lazy.cpp new file mode 100644 index 0000000..3cd6848 --- /dev/null +++ b/test/disassembly/compiler_lazy.cpp @@ -0,0 +1,1341 @@ +#define _DWORD unsigned long long +struct _Unwind_Exception * CompileLazy( + _DWORD *a1, // fileData + int *a2, // 错误信息 + _DWORD *a3, // 输出1 + _DWORD *a4, // 输出2 + _DWORD *a5, + _DWORD *a6, + int *a7,// splitedData + _DWORD *a8,// mapData1 + char a9,// isLLA + int a10,// gwxMark + int a11,// mark + char a12,// '\n' + int *a13,// 'e' + int *a14,// const char off_5403C3[] = {'s','\0','e','\0'} + int *a15, // "gg" + int *a16,// "e_" + int *a17,// "d_" + int *a18,// "p_" + int a19, // '\0' + int a20, // "boxofchocolate" + int a21, // "$gdwx" + int *a22) // "f_" +{ + volatile signed __int32 **v22; // eax + _DWORD *v23; // eax + int v24; // edx + _DWORD *v25; // edx + _DWORD *v26; // eax + char *v27; // eax + int v28; // edx + int insert_hint_unique_pos; // eax + _DWORD *v30; // edx + bool v31; // zf + struct _Unwind_Exception *v32; // eax + struct _Unwind_Exception *v33; // edx + _DWORD *v34; // eax + int k; // eax + std::ostream::sentry *v36; // eax + int *m; // eax + std::ostream::sentry *v38; // eax + std::ostream::sentry *v39; // eax + std::ostream::sentry *v40; // eax + bool v41; // zf + struct _Unwind_Exception *v42; // eax + struct _Unwind_Exception *v43; // edx + struct _Unwind_Exception *v44; // eax + _DWORD *v45; // eax + volatile signed __int32 *v46; // edx + char *v47; // ecx + volatile signed __int32 **n; // eax + unsigned int v49; // edx + int v50; // edx + int *v51; // eax + int *v52; // eax + std::ostream::sentry *v53; // eax + std::ostream::sentry *v54; // eax + std::ostream::sentry *v55; // eax + char *v56; // eax + std::ostream::sentry *v57; // eax + std::ostream::sentry *v58; // eax + std::ostream::sentry *v59; // eax + std::ostream::sentry *v60; // eax + std::ostream::sentry *v61; // eax + _DWORD *v62; // eax + std::ostream::sentry *v63; // eax + std::ostream::sentry *v64; // eax + std::ostream::sentry *v65; // eax + std::ostream::sentry *v66; // eax + std::ostream::sentry *v67; // eax + std::ostream::sentry *v68; // eax + std::ostream::sentry *v69; // eax + std::ostream::sentry *v70; // eax + std::ostream::sentry *v71; // eax + std::ostream::sentry *v72; // eax + std::ostream::sentry *v73; // eax + std::ostream::sentry *v74; // eax + std::ostream::sentry *v75; // eax + std::ostream::sentry *v76; // eax + std::ostream::sentry *v77; // eax + std::ostream::sentry *v78; // eax + std::ostream::sentry *v79; // eax + std::ostream::sentry *v80; // eax + std::ostream::sentry *v81; // eax + std::ostream::sentry *v82; // eax + std::ostream::sentry *v83; // eax + std::ostream::sentry *v84; // eax + std::ostream::sentry *v85; // eax + std::ostream::sentry *v86; // eax + std::ostream::sentry *v87; // eax + std::ostream::sentry *v88; // eax + std::ostream::sentry *v89; // eax + std::ostream::sentry *v90; // eax + std::ostream::sentry *v91; // eax + std::ostream::sentry *v92; // eax + std::ostream::sentry *v93; // eax + std::ostream::sentry *v94; // eax + std::ostream::sentry *v95; // eax + std::ostream::sentry *v96; // eax + char *v97; // eax + std::__cxx11 *v98; // eax + std::ostream::sentry *v99; // eax + std::ostream::sentry *v100; // eax + std::ostream::sentry *v101; // eax + std::ostream::sentry *v102; // eax + std::ostream::sentry *v103; // eax + std::ostream::sentry *v104; // eax + std::ostream::sentry *v105; // eax + std::ostream::sentry *v106; // eax + std::ostream::sentry *v107; // eax + std::ostream::sentry *v108; // eax + std::ostream::sentry *v109; // eax + std::ostream::sentry *v110; // eax + std::ostream::sentry *v111; // eax + std::ostream::sentry *v112; // eax + std::ostream::sentry *v113; // eax + std::ostream::sentry *v114; // eax + _DWORD *v115; // eax + std::ostream::sentry *v116; // eax + std::ostream::sentry *v117; // eax + std::ostream::sentry *v118; // eax + std::ostream::sentry *v119; // eax + std::ostream::sentry *v120; // eax + std::ostream::sentry *v121; // eax + std::ostream::sentry *v122; // eax + std::ostream::sentry *v123; // eax + std::ostream::sentry *v124; // eax + int *mm; // eax + std::ostream::sentry *v126; // eax + std::ostream::sentry *v127; // eax + std::ostream::sentry *v128; // eax + std::ostream::sentry *v129; // eax + std::ostream::sentry *v130; // eax + int *nn; // eax + std::ostream::sentry *v132; // eax + char *v133; // eax + volatile signed __int32 **v134; // ecx + char *v135; // eax + char *v136; // eax + std::ostream::sentry *v137; // eax + int StrID; // eax + std::ostream::sentry *v139; // eax + int *v140; // eax + unsigned int *v141; // eax + std::ostream::sentry *v142; // eax + int v143; // eax + std::ostream::sentry *v144; // eax + std::ostream::sentry *v145; // eax + int v146; // edx + _DWORD *v147; // eax + int v148; // eax + int v149; // eax + int v150; // edx + _DWORD *v151; // eax + int v152; // eax + int v153; // eax + std::ostream::sentry *v154; // eax + std::ostream::sentry *v155; // eax + std::ostream::sentry *v156; // eax + std::ostream::sentry *v157; // eax + std::ostream::sentry *v158; // eax + std::ostream::sentry *v159; // eax + std::ostream::sentry *v160; // eax + std::ostream::sentry *v161; // eax + std::ostream::sentry *v162; // eax + std::ostream::sentry *v163; // eax + std::ostream::sentry *v164; // eax + std::ostream::sentry *v165; // eax + std::ostream::sentry *v166; // eax + std::ostream::sentry *v167; // eax + std::ostream::sentry *v168; // eax + std::ostream::sentry *v169; // eax + std::ostream::sentry *v170; // eax + std::ostream::sentry *v171; // eax + std::ostream::sentry *v172; // eax + std::ostream::sentry *v173; // eax + std::ostream::sentry *v174; // eax + std::ostream::sentry *v175; // eax + std::ostream::sentry *v176; // eax + std::ostream::sentry *v177; // eax + std::ostream::sentry *v178; // eax + std::ostream::sentry *v179; // eax + std::ostream::sentry *v180; // eax + std::ostream::sentry *v181; // eax + std::ostream::sentry *v182; // eax + std::ostream::sentry *v183; // eax + std::ostream::sentry *v184; // eax + std::ostream::sentry *v185; // eax + std::ostream::sentry *v186; // eax + std::ostream::sentry *v187; // eax + std::ostream::sentry *v188; // eax + std::ostream::sentry *v189; // eax + std::ostream::sentry *v190; // eax + std::ostream::sentry *v191; // eax + char *v192; // eax + std::ostream::sentry *v193; // eax + std::ostream::sentry *v194; // eax + std::ostream::sentry *v195; // eax + char *v196; // eax + char *v197; // eax + char *v198; // eax + std::ostream::sentry *v199; // eax + std::ostream::sentry *v200; // eax + std::ostream::sentry *v201; // eax + struct _Unwind_Exception *i5; // eax + char *v203; // eax + _DWORD *v205; // [esp+60h] [ebp-2C8h] + _DWORD *v206; // [esp+60h] [ebp-2C8h] + int v207; // [esp+64h] [ebp-2C4h] + WXML::NameAllocator *v208; // [esp+68h] [ebp-2C0h] + bool v209; // [esp+70h] [ebp-2B8h] + int v210; // [esp+74h] [ebp-2B4h] + _DWORD *v211; // [esp+74h] [ebp-2B4h] + int v212; // [esp+74h] [ebp-2B4h] + _DWORD *v213; // [esp+74h] [ebp-2B4h] + _DWORD *v214; // [esp+74h] [ebp-2B4h] + int v215; // [esp+78h] [ebp-2B0h] + int v216; // [esp+78h] [ebp-2B0h] + _DWORD *v217; // [esp+78h] [ebp-2B0h] + int v218; // [esp+78h] [ebp-2B0h] + char *v219; // [esp+7Ch] [ebp-2ACh] + char *v220; // [esp+80h] [ebp-2A8h] + char *v221; // [esp+88h] [ebp-2A0h] + void *v222; // [esp+8Ch] [ebp-29Ch] + void *v223; // [esp+90h] [ebp-298h] + int v224; // [esp+94h] [ebp-294h] + bool v225; // [esp+ABh] [ebp-27Dh] + int v226; // [esp+ACh] [ebp-27Ch] + int v227; // [esp+ACh] [ebp-27Ch] + int v228; // [esp+ACh] [ebp-27Ch] + unsigned int *v229; // [esp+ACh] [ebp-27Ch] + _DWORD *v230; // [esp+ACh] [ebp-27Ch] + unsigned int v231; // [esp+ACh] [ebp-27Ch] + unsigned int i3; // [esp+ACh] [ebp-27Ch] + _DWORD *v233; // [esp+B0h] [ebp-278h] + int v234; // [esp+B4h] [ebp-274h] + int v235; // [esp+B4h] [ebp-274h] + char *v236; // [esp+B8h] [ebp-270h] + WXML::EXPRLib::Parser *v237; // [esp+BCh] [ebp-26Ch] + WXML::EXPRLib::Parser *v238; // [esp+BCh] [ebp-26Ch] + WXML::EXPRLib::Parser *v239; // [esp+BCh] [ebp-26Ch] + WXML::EXPRLib::Parser *v240; // [esp+BCh] [ebp-26Ch] + WXML::EXPRLib::Parser *v241; // [esp+BCh] [ebp-26Ch] + int ii; // [esp+BCh] [ebp-26Ch] + WXML::EXPRLib::Parser *v243; // [esp+BCh] [ebp-26Ch] + char *v244; // [esp+C0h] [ebp-268h] + WXML::NameAllocator *v245; // [esp+C0h] [ebp-268h] + WXML::NameAllocator *i2; // [esp+C0h] [ebp-268h] + _DWORD *Block; // [esp+C4h] [ebp-264h] + int v248; // [esp+C8h] [ebp-260h] + WXML::DOMLib::Parser *v249; // [esp+CCh] [ebp-25Ch] + int *v250; // [esp+CCh] [ebp-25Ch] + std::ostream::sentry *v251; // [esp+CCh] [ebp-25Ch] + std::ostream::sentry *v252; // [esp+CCh] [ebp-25Ch] + std::ostream::sentry *v253; // [esp+CCh] [ebp-25Ch] + std::ostream::sentry *v254; // [esp+CCh] [ebp-25Ch] + std::ostream::sentry *v255; // [esp+CCh] [ebp-25Ch] + char *v256; // [esp+CCh] [ebp-25Ch] + std::ostream::sentry *v257; // [esp+CCh] [ebp-25Ch] + struct _Unwind_Exception *v258; // [esp+D0h] [ebp-258h] + char v259; // [esp+D0h] [ebp-258h] + char *v260; // [esp+D0h] [ebp-258h] + struct _Unwind_Exception *v261; // [esp+D0h] [ebp-258h] + void *v262; // [esp+D0h] [ebp-258h] + char *v263; // [esp+D0h] [ebp-258h] + volatile signed __int32 *v264; // [esp+D0h] [ebp-258h] + int *kk; // [esp+D0h] [ebp-258h] + int *v266; // [esp+D0h] [ebp-258h] + int *v267; // [esp+D0h] [ebp-258h] + _DWORD *v268; // [esp+D0h] [ebp-258h] + WXML::NameAllocator *i1; // [esp+D0h] [ebp-258h] + _DWORD *v270; // [esp+D0h] [ebp-258h] + int *v271; // [esp+D0h] [ebp-258h] + int *i4; // [esp+D0h] [ebp-258h] + bool v273; // [esp+D0h] [ebp-258h] + int i; // [esp+D4h] [ebp-254h] + _DWORD *v275; // [esp+D4h] [ebp-254h] + struct _Unwind_Exception *v276; // [esp+D4h] [ebp-254h] + int *v277; // [esp+D4h] [ebp-254h] + int v278; // [esp+D4h] [ebp-254h] + void **v279; // [esp+D4h] [ebp-254h] + int v280; // [esp+D4h] [ebp-254h] + int v281; // [esp+D4h] [ebp-254h] + int v282; // [esp+D4h] [ebp-254h] + struct _Unwind_Exception *lpuexcpt; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcpta; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcpto; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptb; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptc; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptd; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcpte; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptf; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptg; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcpth; // [esp+D8h] [ebp-250h] + char *lpuexcpti; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptj; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptp; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptk; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptl; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptm; // [esp+D8h] [ebp-250h] + struct _Unwind_Exception *lpuexcptn; // [esp+D8h] [ebp-250h] + int v300[2]; // [esp+118h] [ebp-210h] BYREF + int v301; // [esp+120h] [ebp-208h] BYREF + _DWORD v302[2]; // [esp+124h] [ebp-204h] BYREF + _DWORD *v303; // [esp+12Ch] [ebp-1FCh] + int v304; // [esp+138h] [ebp-1F0h] BYREF + _DWORD v305[2]; // [esp+13Ch] [ebp-1ECh] BYREF + void *v306; // [esp+144h] [ebp-1E4h] + int v307; // [esp+150h] [ebp-1D8h] BYREF + _DWORD v308[5]; // [esp+154h] [ebp-1D4h] BYREF + int v309; // [esp+168h] [ebp-1C0h] BYREF + _DWORD v310[5]; // [esp+16Ch] [ebp-1BCh] BYREF + int v311; // [esp+180h] [ebp-1A8h] BYREF + _DWORD v312[5]; // [esp+184h] [ebp-1A4h] BYREF + int v313; // [esp+198h] [ebp-190h] BYREF + _DWORD v314[4]; // [esp+19Ch] [ebp-18Ch] BYREF + int v315; // [esp+1ACh] [ebp-17Ch] + int v316; // [esp+1B0h] [ebp-178h] BYREF + int v317[5]; // [esp+1B4h] [ebp-174h] BYREF + int v318[6]; // [esp+1C8h] [ebp-160h] BYREF + int v319; // [esp+1E0h] [ebp-148h] BYREF + volatile signed __int32 *v320[5]; // [esp+1E4h] [ebp-144h] BYREF + int v321[6]; // [esp+1F8h] [ebp-130h] BYREF + void *j; // [esp+210h] [ebp-118h] BYREF + struct _Unwind_Exception *v323; // [esp+214h] [ebp-114h] + int v324; // [esp+218h] [ebp-110h] + int jj; // [esp+228h] [ebp-100h] BYREF + volatile signed __int32 *v326; // [esp+22Ch] [ebp-FCh] BYREF + volatile signed __int32 *v327; // [esp+230h] [ebp-F8h] + int v328; // [esp+240h] [ebp-E8h] BYREF + volatile signed __int32 *v329; // [esp+244h] [ebp-E4h] BYREF + char v330[4]; // [esp+248h] [ebp-E0h] BYREF + volatile signed __int32 **v331; // [esp+24Ch] [ebp-DCh] + unsigned int v332; // [esp+254h] [ebp-D4h] + + std::_Rb_tree_header::_Rb_tree_header(v302); + std::_Rb_tree_header::_Rb_tree_header(v305); + std::_Rb_tree_header::_Rb_tree_header(v308); + std::_Rb_tree_header::_Rb_tree_header(v310); + std::_Rb_tree_header::_Rb_tree_header(v312); + lpuexcpt = (struct _Unwind_Exception *)a1[3]; + v249 = (WXML::DOMLib::Parser *)(a1 + 1); + while ( lpuexcpt != v249 ) + { + v258 = WXML::Compiler::ParseSource( + v249, + (int *)lpuexcpt + 4, + (char **)lpuexcpt + 10, + a12, + a10, + a22, + a1, + a2, + &v304, // map + &v309, + &v311, + (a11 & 4) != 0, + (a11 & 0x20) != 0); + // 源码解析失败,LABEL_187 -> return v258 + if ( v258 ) + goto LABEL_187; + lpuexcpt = (struct _Unwind_Exception *)std::_Rb_tree_increment((int)lpuexcpt); + } + v223 = operator new(0xD0u); + std::basic_stringstream,std::allocator>::basic_stringstream((int)v223); + zcc::shared_ptr,std::allocator>>::shared_ptr(&jj, (int)v223); + std::string::basic_string((void **)&v328, "__COMMON__"); + v22 = (volatile signed __int32 **)std::map,std::allocator>>>::operator[]( + &v301, + &v328); + // v22 = v301["__COMMON__"] + *v22 = (volatile signed __int32 *)jj; + // v301["__COMMON__"] = jj + std::__shared_count<(__gnu_cxx::_Lock_policy)2>::operator=(v22 + 1, v326); + std::string::_M_dispose((void **)&v328); + std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v326); + jj = 0; + v326 = 0; + v327 = 0; + std::string::basic_string((void **)&v328, "__COMMON__"); + v23 = std::map>::operator[](&v307, &v328); + // v23 = v307["__COMMON__"] + std::vector::operator=(v23, &jj); + // v307["__COMMON__"] = jj + std::string::_M_dispose((void **)&v328); + std::vector::~vector((void ***)&jj, v24); + std::string::basic_string((void **)&v328, "__COMMON__"); + v226 = *std::map,std::allocator>>>::operator[]( + &v301, + &v328); + // v226 = v301["__COMMON__"] + std::string::_M_dispose((void **)&v328); + v237 = (WXML::EXPRLib::Parser *)a7[1]; + for ( i = *a7; (WXML::EXPRLib::Parser *)i != v237; i += 24 ) + { + v222 = operator new(0xD0u); + std::basic_stringstream,std::allocator>::basic_stringstream((int)v222); + zcc::shared_ptr,std::allocator>>::shared_ptr( + &v328, + (int)v222); + lpuexcpta = (struct _Unwind_Exception *)std::_Rb_tree,std::allocator>>>,std::_Select1st,std::allocator>>>>,std::less,std::allocator,std::allocator>>>>>::lower_bound( + &v301, + i); + if ( lpuexcpta == (struct _Unwind_Exception *)v302 || (unsigned __int8)std::operator<(i, (int)lpuexcpta + 16) ) + { + Block = operator new(0x30u); + std::string::basic_string((char *)Block + 16, i); + Block[10] = 0; + Block[11] = 0; + lpuexcpta = (struct _Unwind_Exception *)std::_Rb_tree,std::allocator>>>,std::_Select1st,std::allocator>>>>,std::less,std::allocator,std::allocator>>>>>::_M_get_insert_hint_unique_pos( + &v301, + lpuexcpta, + (int)(Block + 4)); + if ( v25 ) + { + lpuexcpta = (struct _Unwind_Exception *)std::_Rb_tree,std::allocator>>>,std::_Select1st,std::allocator>>>>,std::less,std::allocator,std::allocator>>>>>::_M_insert_node( + &v301, + (int)lpuexcpta, + v25, + Block); + } + else + { + std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count((volatile signed __int32 **)Block + 11); + std::string::_M_dispose((void **)Block + 4); + operator delete(Block); + } + } + *((_DWORD *)lpuexcpta + 10) = v328; + std::__shared_count<(__gnu_cxx::_Lock_policy)2>::operator=((volatile signed __int32 **)lpuexcpta + 11, v329); + std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v329); + std::operator+((int)&jj, "./", i); + v26 = std::string::append(&jj, ".wxml"); + std::string::basic_string(&v328, v26); + j = 0; + v323 = 0; + v324 = 0; + j = std::_Vector_base::_M_allocate(1u); + lpuexcpto = (struct _Unwind_Exception *)((char *)j + 24); + v324 = (int)j + 24; + std::string::basic_string((char *)j, (int)&v328); + v323 = lpuexcpto; + v27 = std::map>::operator[](&v307, i); + std::vector::operator=(v27, (int *)&j); + std::vector::~vector((void ***)&j, v28); + std::string::_M_dispose((void **)&v328); + std::string::_M_dispose((void **)&jj); + } + v238 = (WXML::EXPRLib::Parser *)a7[1]; + lpuexcptb = (struct _Unwind_Exception *)*a7; + std::_Rb_tree_header::_Rb_tree_header(v314); + while ( v238 != lpuexcptb ) + { + insert_hint_unique_pos = std::_Rb_tree,std::less,std::allocator>::_M_get_insert_hint_unique_pos( + &v313, + v314, + (int)lpuexcptb); + v275 = v30; + if ( v30 ) + { + v259 = v30 == v314 || insert_hint_unique_pos != 0; + if ( !v259 ) + v259 = std::operator<((int)lpuexcptb, (int)(v30 + 4)); + v221 = (char *)operator new(0x28u); + std::string::basic_string(v221 + 16, (int)lpuexcptb); + std::_Rb_tree_insert_and_rebalance(v259, v221, v275, v314); + ++v315; + } + lpuexcptb = (struct _Unwind_Exception *)((char *)lpuexcptb + 24); + } + for ( j = v306; + j != v305; + std::_Rb_tree_iterator>>::operator++((int *)&j) ) + { + v260 = (char *)j + 16; + std::string::substr(&jj, (_DWORD *)j + 4, 2u, *((_DWORD *)j + 5) - 7); + lpuexcptc = (struct _Unwind_Exception *)v314[1]; + v276 = (struct _Unwind_Exception *)v314; + while ( lpuexcptc ) + { + v31 = (unsigned __int8)std::operator<((int)lpuexcptc + 16, (int)&jj) == 0; + v32 = v276; + v33 = (struct _Unwind_Exception *)*((_DWORD *)lpuexcptc + 3); + if ( v31 ) + { + v33 = (struct _Unwind_Exception *)*((_DWORD *)lpuexcptc + 2); + if ( v31 ) + v32 = lpuexcptc; + } + lpuexcptc = v33; + v276 = v32; + } + if ( v276 == (struct _Unwind_Exception *)v314 || (unsigned __int8)std::operator<((int)&jj, (int)v276 + 16) ) + { + std::string::basic_string((void **)&v328, "__COMMON__"); + v34 = std::map>::operator[](&v307, &v328); + std::vector::push_back((int)v34, (int)v260); + std::string::_M_dispose((void **)&v328); + } + std::string::_M_dispose((void **)&jj); + } + std::basic_stringstream,std::allocator>::basic_stringstream((int)&v328); + std::operator<<>( + (std::ostream::sentry *)v330, + "WXML::Compiler::CompileLazy: file name to paths:\n"); + std::operator<<>((std::ostream::sentry *)v330, " all files: [ "); + for ( k = a1[3]; ; k = std::_Rb_tree_increment((int)lpuexcptd) ) + { + lpuexcptd = (struct _Unwind_Exception *)k; + if ( (WXML::DOMLib::Parser *)k == v249 ) + break; + v36 = std::operator<<((std::ostream::sentry *)v330, (int *)(k + 16)); + std::operator<<>(v36, " "); + } + std::operator<<>((std::ostream::sentry *)v330, "];\n"); + for ( m = (int *)v308[2]; ; m = (int *)std::_Rb_tree_increment((int)v277) ) + { + v277 = m; + if ( m == v308 ) + break; + v38 = std::operator<<>((std::ostream::sentry *)v330, " "); + v39 = std::operator<<(v38, v277 + 4); + std::operator<<>(v39, ": [ "); + v239 = (WXML::EXPRLib::Parser *)v277[11]; + v250 = (int *)v277[10]; + while ( 1 ) + { + v234 = (int)v250; + if ( v239 == (WXML::EXPRLib::Parser *)v250 ) + break; + v40 = std::operator<<((std::ostream::sentry *)v330, v250); + std::operator<<>(v40, " "); + v261 = (struct _Unwind_Exception *)v305[1]; + lpuexcpte = (struct _Unwind_Exception *)v305; + while ( v261 ) + { + v41 = (unsigned __int8)std::operator<((int)v261 + 16, (int)v250) == 0; + v42 = lpuexcpte; + v43 = (struct _Unwind_Exception *)*((_DWORD *)v261 + 3); + if ( v41 ) + { + v43 = (struct _Unwind_Exception *)*((_DWORD *)v261 + 2); + if ( v41 ) + v42 = v261; + } + v261 = v43; + lpuexcpte = v42; + } + if ( lpuexcpte != (struct _Unwind_Exception *)v305 ) + { + v31 = (unsigned __int8)std::operator<((int)v250, (int)lpuexcpte + 16) == 0; + v44 = (struct _Unwind_Exception *)v305; + if ( v31 ) + v44 = lpuexcpte; + lpuexcpte = v44; + } + v250 += 6; + if ( lpuexcpte == (struct _Unwind_Exception *)v305 ) + { + std::operator+((int)&jj, "WXML file not found: ", v234); + std::string::operator=((unsigned __int8 **)a2, (int)&jj); + std::string::_M_dispose((void **)&jj); + std::basic_stringstream,std::allocator>::~basic_stringstream((int)&v328); + v258 = (struct _Unwind_Exception *)-1152; + goto LABEL_186; + } + } + std::operator<<>((std::ostream::sentry *)v330, "];\n"); + } + std::basic_stringstream,std::allocator>::~basic_stringstream((int)&v328); + for ( j = v306; + ; + std::_Rb_tree_iterator>>::operator++((int *)&j) ) + { + lpuexcptf = (struct _Unwind_Exception *)j; + if ( j == v305 ) + break; + std::_Rb_tree_header::_Rb_tree_header(&v329); + v262 = (char *)lpuexcptf + 16; + WXML::DOMLib::recurseDependencies((int *)lpuexcptf + 10, (int *)lpuexcptf + 4, &v328); + lpuexcptg = (struct _Unwind_Exception *)v332; + if ( v332 > 0x5555555 ) + std::__throw_length_error((std::length_error *)"cannot create std::vector larger than max_size()"); + jj = 0; + v326 = 0; + v327 = 0; + v45 = std::_Vector_base::_M_allocate(v332); + v278 = (int)v45; + jj = (int)v45; + v46 = &v45[6 * (_DWORD)lpuexcptg]; + v327 = v46; + while ( lpuexcptg ) + { + v47 = (char *)(v45 + 2); + v45[1] = 0; + v45 += 6; + *(v45 - 6) = v47; + *((_BYTE *)v45 - 16) = 0; + lpuexcptg = (struct _Unwind_Exception *)((char *)lpuexcptg - 1); + } + v326 = v46; + for ( n = v331; ; n = (volatile signed __int32 **)std::_Rb_tree_increment((int)lpuexcpth) ) + { + lpuexcpth = (struct _Unwind_Exception *)n; + if ( n == &v329 ) + break; + std::string::_M_assign(v278, (int)(n + 4)); + v278 += 24; + } + lpuexcpti = std::map>::operator[](a5, (int)v262); + if ( lpuexcpti != (char *)&jj ) + { + v240 = (WXML::EXPRLib::Parser *)v326; + v263 = (char *)jj; + v279 = *(void ***)lpuexcpti; + v251 = (std::ostream::sentry *)((char *)v326 - jj); + v49 = *((_DWORD *)lpuexcpti + 2) - *(_DWORD *)lpuexcpti; + v235 = -1431655765 * (((int)v326 - jj) >> 3); + if ( v49 >= (unsigned int)v326 - jj ) + { + v241 = (WXML::EXPRLib::Parser *)*((_DWORD *)lpuexcpti + 1); + if ( (unsigned int)v251 > v241 - (WXML::EXPRLib::Parser *)v279 ) + { + for ( ii = -1431655765 * ((v241 - (WXML::EXPRLib::Parser *)v279) >> 3); ii > 0; --ii ) + { + std::string::_M_assign((int)v279, (int)v263); + v263 += 24; + v279 += 6; + } + v264 = v326; + v281 = jj + *((_DWORD *)lpuexcpti + 1) - *(_DWORD *)lpuexcpti; + v219 = (char *)*((_DWORD *)lpuexcpti + 1); + while ( v264 != (volatile signed __int32 *)v281 ) + { + std::string::basic_string(v219, v281); + v281 += 24; + v219 += 24; + } + } + else + { + while ( v235 > 0 ) + { + std::string::_M_assign((int)v279, (int)v263); + v263 += 24; + v279 += 6; + --v235; + } + while ( v241 != (WXML::EXPRLib::Parser *)v279 ) + { + std::string::_M_dispose(v279); + v279 += 6; + } + } + } + else + { + v236 = (char *)std::_Vector_base::_M_allocate(-1431655765 * (((int)v326 - jj) >> 3)); + v280 = (int)v263; + v220 = v236; + while ( v240 != (WXML::EXPRLib::Parser *)v280 ) + { + std::string::basic_string(v220, v280); + v220 += 24; + v280 += 24; + } + std::_Destroy_aux::__destroy(v50, *(void ***)lpuexcpti, *((void ***)lpuexcpti + 1)); + if ( *(_DWORD *)lpuexcpti ) + operator delete(*(void **)lpuexcpti); + *(_DWORD *)lpuexcpti = v236; + *((_DWORD *)lpuexcpti + 2) = (char *)v251 + (_DWORD)v236; + } + *((_DWORD *)lpuexcpti + 1) = (char *)v251 + *(_DWORD *)lpuexcpti; + } + std::vector::~vector((void ***)&jj, v49); + std::_Rb_tree,std::less,std::allocator>::~_Rb_tree((int)&v328); + } + std::_Rb_tree_header::_Rb_tree_header(v317); + for ( jj = (int)v306; + ; + std::_Rb_tree_iterator>>::operator++(&jj) ) + { + lpuexcptj = (struct _Unwind_Exception *)jj; + if ( (_DWORD *)jj == v305 ) + break; + WXML::DOMLib::WXMLDom::RewriteTree(*(_DWORD *)(jj + 40)); + v282 = *((_DWORD *)lpuexcptj + 10); + std::string::basic_string((void **)&v328, (char *)off_550B3F); + v51 = std::map>::operator[](a6, &v328); + WXML::DOMLib::WXMLDom::MarkIfHasDescendant(v282, v51); + std::string::_M_dispose((void **)&v328); + if ( a9 ) + { + lpuexcptp = (struct _Unwind_Exception *)*((_DWORD *)lpuexcptj + 10); + std::string::basic_string((void **)&v328, (char *)off_550B3F); + v52 = std::map>::operator[](a6, &v328); + WXML::DOMLib::WXMLDom::CutDomsForCustomComponent(lpuexcptp, v52); + std::string::_M_dispose((void **)&v328); + } + } + lpuexcptk = (struct _Unwind_Exception *)(v226 + 8); + if ( a9 ) + std::string::basic_string((void **)&jj, "global"); + else + std::string::basic_string((void **)&jj, "__globalThis"); + WXML::Compiler::GetVersionInfo((int)&v328, &jj); + v53 = std::operator<<(lpuexcptk, &v328); + std::ostream::operator<<(v53, (int (__cdecl *)(void *))std::endl>); + std::string::_M_dispose((void **)&v328); + std::string::_M_dispose((void **)&jj); + WXML::NameAllocator::NameAllocator(&v328, a19, a20); + v54 = std::operator<<>(lpuexcptk, "var $gwxc"); + std::operator<<>(v54, a12); + v55 = std::operator<<>(lpuexcptk, "var $gaic={}"); + std::operator<<>(v55, a12); + if ( !a9 ) + std::operator<<>( + lpuexcptk, + "var outerGlobal=typeof __globalThis==='undefined'?window:__globalThis;"); + v224 = 0; + v233 = v303; + v209 = (a11 & 2) != 0; + while ( v233 != v302 ) + { + v243 = (WXML::EXPRLib::Parser *)v233[10]; + v248 = (int)(v233 + 4); + v225 = std::operator==((int)(v233 + 4), "__COMMON__"); + if ( v225 ) + { + std::string::basic_string((char *)v318, a10); + } + else + { + std::to_string((std::__cxx11 *)&jj, v224); + std::operator+((char *)&j, a10, "_XC_"); + std::operator+(v318, &j, (unsigned int *)&jj); + std::string::_M_dispose(&j); + std::string::_M_dispose((void **)&jj); + ++v224; + } + v56 = std::map::operator[](a4, v248); + std::string::_M_assign((int)v56, (int)v318); + lpuexcptl = (WXML::EXPRLib::Parser *)((char *)v243 + 8); + if ( (a11 & 2) != 0 ) + { + v57 = std::operator<<>((WXML::EXPRLib::Parser *)((char *)v243 + 8), "var cs = cs || [];"); + std::operator<<>(v57, a12); + } + v58 = std::operator<<(lpuexcptl, v318); + v59 = std::operator<<>( + v58, + "=function(_,_v,_n,_p,_s,_wp,_wl,$gwn,$gwl,$gwh,wh,$gstack,$gwrt,gra,grb,TestTest,wfor,_ca,_da,_r,_rz,_o,_oz," + "_1,_1z,_2,_2z,_m,_mz,nv_getDate,nv_getRegExp,nv_console,nv_parseInt,nv_parseFloat,nv_isNaN,nv_isFinite,nv_de" + "codeURI,nv_decodeURIComponent,nv_encodeURI,nv_encodeURIComponent,$gdc,nv_JSON,_af,_gv,_ai,_grp,_gd,_gapi,$ix" + "c,_ic,_w,_ev,_tsd){"); + v60 = std::operator<<>(v59, "return function(path,global){"); + std::operator<<>(v60, a12); + std::operator<<>( + lpuexcptl, + "if(typeof global==='undefined'){if (typeof __GWX_GLOBAL__==='undefined')global={};else global=__GWX_GLOBAL__;}"); + std::operator<<>(lpuexcptl, "if(typeof __WXML_GLOBAL__ === 'undefined') {"); + v61 = std::operator<<>(lpuexcptl, "__WXML_GLOBAL__={};"); + std::operator<<>(v61, a12); + if ( (a11 & 0x80) != 0 ) + { + std::string::basic_string((void **)&jj, "life_cycle_callback_content"); + v252 = (std::ostream::sentry *)std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::find( + a8, + (int)&jj); + std::string::_M_dispose((void **)&jj); + if ( a8 + 1 != (_DWORD *)v252 ) + { + std::string::basic_string((void **)&jj, "life_cycle_callback_content"); + v62 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::find( + a8, + (int)&jj); + std::operator<<(lpuexcptl, v62 + 10); + std::string::_M_dispose((void **)&jj); + } + } + std::operator<<>(lpuexcptl, "}"); + v63 = std::operator<<>(lpuexcptl, "__WXML_GLOBAL__.modules = __WXML_GLOBAL__.modules || {};"); + std::operator<<>(v63, a12); + if ( v225 && !std::operator==(a10, "$gwx") && (a11 & 0x60) == 0 ) + { + v64 = std::operator<<>(lpuexcptl, "$gwx('init', global);"); + std::operator<<>(v64, a12); + } + v65 = std::operator<<>(lpuexcptl, "var "); + v66 = std::operator<<(v65, a16); + v67 = std::operator<<>(v66, "={}"); + std::operator<<>(v67, a12); + v68 = std::operator<<>(lpuexcptl, "if(typeof(global.entrys)==='undefined')global.entrys={};"); + v69 = std::operator<<(v68, a16); + v70 = std::operator<<>(v69, "=global.entrys;"); + std::operator<<>(v70, a12); + v71 = std::operator<<>(lpuexcptl, "var "); + v72 = std::operator<<(v71, a17); + v73 = std::operator<<>(v72, "={}"); + std::operator<<>(v73, a12); + v74 = std::operator<<>( + lpuexcptl, + "if(typeof(global.defines)==='undefined')global.defines={};"); + v75 = std::operator<<(v74, a17); + v76 = std::operator<<>(v75, "=global.defines;"); + std::operator<<>(v76, a12); + v77 = std::operator<<>(lpuexcptl, "var "); + v78 = std::operator<<(v77, a22); + v79 = std::operator<<>(v78, "={}"); + std::operator<<>(v79, a12); + v80 = std::operator<<>( + lpuexcptl, + "if(typeof(global.modules)==='undefined')global.modules={};"); + v81 = std::operator<<(v80, a22); + v82 = std::operator<<>(v81, "=global.modules || {};"); + std::operator<<>(v82, a12); + v83 = std::operator<<>(lpuexcptl, "var "); + v84 = std::operator<<(v83, a18); + v85 = std::operator<<>(v84, "={}"); + std::operator<<>(v85, a12); + if ( (a11 & 2) != 0 ) + { + v86 = std::operator<<>(lpuexcptl, "var cs = cs || [];"); + std::operator<<>(v86, a12); + } + v87 = std::operator<<>( + lpuexcptl, + "__WXML_GLOBAL__.ops_cached = __WXML_GLOBAL__.ops_cached || {}"); + std::operator<<>(v87, a12); + v88 = std::operator<<>(lpuexcptl, "__WXML_GLOBAL__.ops_set = __WXML_GLOBAL__.ops_set || {};"); + std::operator<<>(v88, a12); + v89 = std::operator<<>( + lpuexcptl, + "__WXML_GLOBAL__.ops_init = __WXML_GLOBAL__.ops_init || {};"); + std::operator<<>(v89, a12); + v90 = std::operator<<>(lpuexcptl, "var z=__WXML_GLOBAL__.ops_set."); + v91 = std::operator<<(v90, v318); + v92 = std::operator<<>(v91, " || [];"); + std::operator<<>(v92, a12); + if ( (a11 & 4) != 0 ) + { + v93 = std::operator<<>( + lpuexcptl, + "__WXML_GLOBAL__.debuginfo_set = __WXML_GLOBAL__.debuginfo_set || {};"); + std::operator<<>(v93, a12); + v94 = std::operator<<>(lpuexcptl, "var debugInfo=__WXML_GLOBAL__.debuginfo_set."); + v95 = std::operator<<(v94, v318); + v96 = std::operator<<>(v95, " || [];"); + std::operator<<>(v96, a12); + } + v97 = std::map>::operator[](&v307, v248); + v253 = 0; + v227 = *((_DWORD *)v97 + 1); + for ( kk = *(int **)v97; kk != (int *)v227; kk += 6 ) + { + v244 = std::map>::operator[](&v304, (int)kk); + std::_Rb_tree_header::_Rb_tree_header(v320); + v253 = (std::ostream::sentry *)((char *)v253 + 1); + v300[1] = 0; + v300[0] = 0; + std::to_string(v98, (unsigned int)v253); + std::operator+((char *)&j, (int)v318, "_"); + std::operator+(v321, &j, (unsigned int *)&jj); + std::string::_M_dispose(&j); + std::string::_M_dispose((void **)&jj); + std::operator+((int)&j, "gz", (int)v321); + v99 = std::operator<<>(lpuexcptl, "function "); + v100 = std::operator<<(v99, (int *)&j); + v101 = std::operator<<>(v100, "(){"); + std::operator<<>(v101, a12); + v102 = std::operator<<>(lpuexcptl, "if( __WXML_GLOBAL__.ops_cached."); + v103 = std::operator<<(v102, v321); + std::operator<<>(v103, ")"); + v104 = std::operator<<>(lpuexcptl, "return __WXML_GLOBAL__.ops_cached."); + v105 = std::operator<<(v104, v321); + std::operator<<>(v105, a12); + v106 = std::operator<<>(lpuexcptl, "__WXML_GLOBAL__.ops_cached."); + v107 = std::operator<<(v106, v321); + v108 = std::operator<<>(v107, "=[];"); + std::operator<<>(v108, a12); + std::operator<<>(lpuexcptl, "(function(z){var a=11;"); + if ( (a11 & 4) != 0 ) + v109 = std::operator<<>( + lpuexcptl, + "function Z(ops,debugLine){z.push(['11182016',ops,debugLine])}"); + else + v109 = std::operator<<>(lpuexcptl, "function Z(ops){z.push(ops)}"); + std::operator<<>(v109, a12); + WXML::DOMLib::WXMLDom::RenderAllOpsAndRecord( + *(_DWORD **)v244, + kk, + (unsigned int *)a2, + v243, + &v319, + v300, + (a11 & 4) != 0, + (int)a8); + v110 = std::operator<<>(lpuexcptl, "})(__WXML_GLOBAL__.ops_cached."); + v111 = std::operator<<(v110, v321); + std::operator<<>(v111, ");"); + v112 = std::operator<<>(lpuexcptl, "return __WXML_GLOBAL__.ops_cached."); + v113 = std::operator<<(v112, v321); + std::operator<<>(v113, a12); + v114 = std::operator<<>(lpuexcptl, "}"); + std::operator<<>(v114, a12); + std::string::basic_string((void **)&jj, "get_page_z_name"); + v115 = std::map::operator[]((_DWORD *)(*(_DWORD *)v244 + 272), &jj); + std::string::_M_assign((int)v115, (int)&j); + std::string::_M_dispose((void **)&jj); + std::string::_M_dispose(&j); + std::string::_M_dispose((void **)v321); + std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::~_Rb_tree((int)&v319); + } + v116 = std::operator<<>(lpuexcptl, "__WXML_GLOBAL__.ops_set."); + v117 = std::operator<<(v116, v318); + v118 = std::operator<<>(v117, "=z;"); + std::operator<<>(v118, a12); + v119 = std::operator<<>(lpuexcptl, "__WXML_GLOBAL__.ops_init."); + v120 = std::operator<<(v119, v318); + v121 = std::operator<<>(v120, "=true;"); + std::operator<<>(v121, a12); + if ( (a11 & 4) != 0 ) + { + v122 = std::operator<<>(lpuexcptl, "__WXML_GLOBAL__.debuginfo_set."); + v123 = std::operator<<(v122, v318); + v124 = std::operator<<>(v123, "=debugInfo;"); + std::operator<<>(v124, a12); + } + if ( v225 ) + { + std::operator<<>(lpuexcptl, "var nv_require=function(){var nnm={"); + for ( mm = (int *)v312[2]; ; mm = (int *)std::_Rb_tree_increment((int)v266) ) + { + v266 = mm; + if ( mm == v312 ) + break; + v254 = std::operator<<>(lpuexcptl, 34); + WXML::Rewrite::ToStringCode((int)&jj, v266 + 4); + v126 = std::operator<<(v254, &jj); + v127 = std::operator<<>(v126, 34); + std::operator<<>(v127, ":np_"); + v128 = (std::ostream::sentry *)std::ostream::operator<<(v266[10]); + std::operator<<>(v128, ","); + std::string::_M_dispose((void **)&jj); + } + std::operator<<>(lpuexcptl, "};var nom={};return function(n){"); + std::operator<<>( + lpuexcptl, + "if(n[0]==='p'&&n[1]==='_'&&f_[n.slice(2)])return f_[n.slice(2)];"); + std::operator<<>(lpuexcptl, "return function(){if(!nnm[n]) return undefined;"); + std::operator<<>(lpuexcptl, "try{if(!nom[n])nom[n]=nnm[n]();return nom[n];}"); + std::operator<<>(lpuexcptl, "catch(e){"); + std::operator<<>(lpuexcptl, "e.message=e.message.replace(/nv_/g,'');"); + std::operator<<>(lpuexcptl, "var tmp = e.stack.substring(0,e.stack.lastIndexOf(n));"); + std::operator<<>(lpuexcptl, "e.stack = tmp.substring(0,tmp.lastIndexOf('\\n'));"); + std::operator<<>(lpuexcptl, "e.stack = e.stack.replace(/\\snv_/g,' ');"); + std::operator<<>(lpuexcptl, "e.stack = $gstack(e.stack);"); + v129 = std::operator<<>( + lpuexcptl, + "e.stack += '\\n at ' + n.substring(2);console.error(e);}"); + std::operator<<>(v129, a12); + v130 = std::operator<<>(lpuexcptl, "}}}()"); + std::operator<<>(v130, a12); + for ( nn = (int *)v310[2]; ; nn = (int *)std::_Rb_tree_increment((int)v267) ) + { + v267 = nn; + if ( nn == v310 ) + break; + v132 = std::operator<<(lpuexcptl, nn + 10); + std::operator<<>(v132, a12); + } + } + v268 = operator new(0x24u); + std::_Rb_tree_header::_Rb_tree_header(v268 + 1); + v268[6] = 0; + v268[7] = 0; + v268[8] = 0; + zcc::shared_ptr::shared_ptr(v268); + v133 = std::map>::operator[](&v307, v248); + v245 = (WXML::NameAllocator *)*((_DWORD *)v133 + 1); + for ( i1 = *(WXML::NameAllocator **)v133; ; i1 = (WXML::NameAllocator *)((char *)i1 + 24) ) + { + v255 = (std::ostream::sentry *)v319; + if ( i1 == v245 ) + break; + std::string::basic_string((char *)&jj, (int)i1); + WXML::DOMLib::StrCache::Insert(v255, (int)&jj); + std::string::_M_dispose((void **)&jj); + v134 = (volatile signed __int32 **)(*(_DWORD *)std::map>::operator[]( + &v304, + (int)i1) + + 252); + *(v134 - 1) = (volatile signed __int32 *)v319; + std::__shared_count<(__gnu_cxx::_Lock_policy)2>::operator=(v134, v320[0]); + v135 = std::map>::operator[](&v304, (int)i1); + WXML::DOMLib::WXMLDom::RecordAllPath(*(_DWORD **)v135); + } + WXML::DOMLib::StrCache::RenderPathDefine((_DWORD *)v319, (int)v243); + v136 = std::map>::operator[](&v307, v248); + v228 = 0; + v208 = (WXML::NameAllocator *)*((_DWORD *)v136 + 1); + for ( i2 = *(WXML::NameAllocator **)v136; v208 != i2; i2 = (WXML::NameAllocator *)((char *)i2 + 24) ) + { + v256 = std::map>::operator[](&v304, (int)i2); + v137 = std::operator<<(lpuexcptl, a17); + std::operator<<>(v137, (char *)off_55101C); + v270 = (_DWORD *)v319; + std::string::basic_string((char *)&jj, (int)i2); + StrID = WXML::DOMLib::StrCache::GetStrID(v270, (int)&jj); + std::ostream::operator<<(StrID); + std::string::_M_dispose((void **)&jj); + v139 = std::operator<<>(lpuexcptl, "]]={}"); + std::operator<<>(v139, a12); + std::string::basic_string((void **)&jj, "get_page_z_name"); + v140 = std::map::operator[]((_DWORD *)(*(_DWORD *)v256 + 272), &jj); + v258 = WXML::Compiler::RenderDefine( + (unsigned int **)v256, + i2, + &v316, + (int)a2, + (int)v243, + (int)a8, + v209, + a11, + a12, + a13, + a14, + a15, + a10, + a16, + a17, + a18, + a19, + a20, + a21, + v140); + std::string::_M_dispose((void **)&jj); + if ( v258 ) + goto LABEL_180; + v207 = v228 + 1; + std::to_string((std::__cxx11 *)&jj, v228); + v141 = std::string::insert((unsigned int *)&jj, 0, "m"); + std::string::basic_string(v321, v141); + std::string::_M_dispose((void **)&jj); + v229 = *(unsigned int **)v256; + std::string::basic_string(&j, "get_page_z_name"); + v271 = std::map::operator[]((_DWORD *)(*(_DWORD *)v256 + 272), &j); + std::string::basic_string((void **)&jj, "r"); + v258 = (struct _Unwind_Exception *)WXML::DOMLib::WXMLDom::RenderMeAsFunction( + v229, + (int *)i2, + a16, + (int)a2, + v321, + (int)v243, + &v328, + a13, + a14, + a15, + &jj, + a17, + a12, + a18, + 0, + v209, + a11, + v271); + std::string::_M_dispose((void **)&jj); + std::string::_M_dispose(&j); + if ( v258 ) + { + std::string::_M_dispose((void **)v321); +LABEL_180: + std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(v320); + std::string::_M_dispose((void **)v318); + goto LABEL_185; + } + v142 = std::operator<<(lpuexcptl, a16); + std::operator<<>(v142, (char *)off_55101C); + v230 = (_DWORD *)v319; + std::string::basic_string((char *)&jj, (int)i2); + v143 = WXML::DOMLib::StrCache::GetStrID(v230, (int)&jj); + std::ostream::operator<<(v143); + std::string::_M_dispose((void **)&jj); + v144 = std::operator<<>(lpuexcptl, "]]={f:"); + v145 = std::operator<<(v144, v321); + std::operator<<>(v145, ",j:[],i:[],ti:["); + v231 = 0; + v215 = 0; + while ( 1 ) + { + v146 = *(_DWORD *)(*(_DWORD *)v256 + 72); + if ( (*(_DWORD *)(*(_DWORD *)v256 + 76) - v146) >> 3 <= v231 ) + break; + if ( std::operator==(*(_DWORD *)(v146 + 8 * v231), "import") ) + { + v210 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)v256 + 72) + 8 * v231); + v205 = (_DWORD *)(v210 + 52); + std::string::basic_string((void **)&jj, (char *)off_547B7D); + v211 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::find( + (_DWORD *)(v210 + 48), + (int)&jj); + std::string::_M_dispose((void **)&jj); + if ( v211 != v205 ) + { + if ( v215 ) + std::operator<<>(lpuexcptl, ","); + std::operator<<>(lpuexcptl, "x["); + v206 = (_DWORD *)v319; + v212 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)v256 + 72) + 8 * v231); + std::string::basic_string(&j, (char *)off_547B7D); + v147 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::find( + (_DWORD *)(v212 + 48), + (int)&j); + v148 = WXML::DOMLib::Token::ToAttrContent[abi:cxx11]((int)(v147 + 10)); + std::string::basic_string((char *)&jj, v148); + v149 = WXML::DOMLib::StrCache::GetStrID(v206, (int)&jj); + std::ostream::operator<<(v149); + std::string::_M_dispose((void **)&jj); + std::string::_M_dispose(&j); + std::operator<<>(lpuexcptl, "]"); + ++v215; + } + } + ++v231; + } + std::operator<<>(lpuexcptl, "],ic:["); + for ( i3 = 0; ; ++i3 ) + { + v150 = *(_DWORD *)(*(_DWORD *)v256 + 72); + if ( (*(_DWORD *)(*(_DWORD *)v256 + 76) - v150) >> 3 <= i3 ) + break; + if ( std::operator==(*(_DWORD *)(v150 + 8 * i3), "include") ) + { + v216 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)v256 + 72) + 8 * i3); + v213 = (_DWORD *)(v216 + 52); + std::string::basic_string((void **)&jj, (char *)off_547B7D); + v217 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::find( + (_DWORD *)(v216 + 48), + (int)&jj); + std::string::_M_dispose((void **)&jj); + if ( v217 != v213 ) + { + if ( v258 ) + std::operator<<>(lpuexcptl, ","); + std::operator<<>(lpuexcptl, "x["); + v214 = (_DWORD *)v319; + v218 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)v256 + 72) + 8 * i3); + std::string::basic_string(&j, (char *)off_547B7D); + v151 = std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::find( + (_DWORD *)(v218 + 48), + (int)&j); + v152 = WXML::DOMLib::Token::ToAttrContent[abi:cxx11]((int)(v151 + 10)); + std::string::basic_string((char *)&jj, v152); + v153 = WXML::DOMLib::StrCache::GetStrID(v214, (int)&jj); + std::ostream::operator<<(v153); + std::string::_M_dispose((void **)&jj); + std::string::_M_dispose(&j); + std::operator<<>(lpuexcptl, "]"); + v258 = (struct _Unwind_Exception *)((char *)v258 + 1); + } + } + } + v154 = std::operator<<>(lpuexcptl, "]}"); + std::operator<<>(v154, a12); + std::string::_M_dispose((void **)v321); + v228 = v207; + } + v155 = std::operator<<>(lpuexcptl, "if(path&&"); + v156 = std::operator<<(v155, a16); + v157 = std::operator<<>(v156, "[path]){"); + std::operator<<>(v157, a12); + if ( !a9 ) + { + v158 = std::operator<<>(lpuexcptl, "outerGlobal.__wxml_comp_version__=0.02"); + std::operator<<>(v158, a12); + } + v159 = std::operator<<>( + lpuexcptl, + "return function(env,dd,global){$gwxc=0;var root={\"tag\":\"wx-page\"};root.children=[]"); + std::operator<<>(v159, a12); + v160 = std::operator<<>(lpuexcptl, ";g=\""); + v161 = std::operator<<(v160, v318); + std::operator<<>(v161, "\";"); + v162 = std::operator<<>(lpuexcptl, "var main="); + v163 = std::operator<<(v162, a16); + v164 = std::operator<<>(v163, "[path].f"); + std::operator<<>(v164, a12); + if ( (a11 & 2) != 0 ) + { + v165 = std::operator<<>(lpuexcptl, "cs=[]"); + std::operator<<>(v165, a12); + } + if ( (a11 & 0x10) != 0 ) + { + v166 = std::operator<<>(lpuexcptl, "console.log(path+': benv:\\n'+JSON.stringify(env))"); + std::operator<<>(v166, a12); + } + std::operator<<>(lpuexcptl, "if (typeof global===\"undefined\")global={};"); + v167 = std::operator<<>(lpuexcptl, "global.f=$gdc("); + v168 = std::operator<<(v167, a22); + v169 = std::operator<<>(v168, "[path],\"\",1);"); + std::operator<<>(v169, a12); + if ( !a9 ) + { + v170 = std::operator<<>( + lpuexcptl, + "if(typeof(outerGlobal.__webview_engine_version__)!='undefined'&&outerGlobal.__webview_engine_version__+1e" + "-6>=0.02+1e-6&&outerGlobal.__mergeData__)"); + std::operator<<>(v170, a12); + v171 = std::operator<<>(lpuexcptl, "{"); + std::operator<<>(v171, a12); + v172 = std::operator<<>(lpuexcptl, "env=outerGlobal.__mergeData__(env,dd);"); + std::operator<<>(v172, a12); + v173 = std::operator<<>(lpuexcptl, "}"); + std::operator<<>(v173, a12); + } + v174 = std::operator<<>(lpuexcptl, "try{"); + std::operator<<>(v174, a12); + if ( (a11 & 0x10) != 0 ) + { + v175 = std::operator<<>( + lpuexcptl, + "console.log(path+': aenv:\\n'+JSON.stringify(env)+', '+JSON.stringify(dd))"); + std::operator<<>(v175, a12); + } + if ( (a11 & 0x80) != 0 ) + { + std::operator<<>(lpuexcptl, "if(__WXML_GLOBAL__.before_calculate)"); + v176 = std::operator<<>(lpuexcptl, "__WXML_GLOBAL__.before_calculate(path, env)"); + std::operator<<>(v176, a12); + } + v177 = std::operator<<>(lpuexcptl, "main(env,{},root,global);"); + std::operator<<>(v177, a12); + if ( (a11 & 0x80) != 0 ) + { + std::operator<<>(lpuexcptl, "if(__WXML_GLOBAL__.after_calculate)"); + v178 = std::operator<<>(lpuexcptl, "__WXML_GLOBAL__.after_calculate(path, root)"); + std::operator<<>(v178, a12); + } + v179 = std::operator<<>(lpuexcptl, "_tsd(root)"); + std::operator<<>(v179, a12); + if ( !a9 ) + { + v180 = std::operator<<>( + lpuexcptl, + "if(typeof(outerGlobal.__webview_engine_version__)=='undefined'|| outerGlobal.__webview_engine_version__+1" + "e-6<0.01+1e-6){return _ev(root);}"); + std::operator<<>(v180, a12); + } + v181 = std::operator<<>(lpuexcptl, "}catch(err){"); + std::operator<<>(v181, a12); + if ( (a11 & 2) != 0 ) + { + v182 = std::operator<<>(lpuexcptl, "console.log(cs, env);"); + std::operator<<>(v182, a12); + } + v183 = std::operator<<>(lpuexcptl, "console.log(err)"); + std::operator<<>(v183, a12); + if ( (a11 & 2) != 0 ) + { + v184 = std::operator<<>(lpuexcptl, "throw err"); + std::operator<<>(v184, a12); + } + v185 = std::operator<<>(lpuexcptl, "}"); + std::operator<<>(v185, a12); + if ( (a11 & 0x10) != 0 ) + { + v186 = std::operator<<>(lpuexcptl, "console.log(path+': resp:\\n'+JSON.stringify(root))"); + std::operator<<>(v186, a12); + } + v187 = std::operator<<>(lpuexcptl, ";g=\"\";"); + std::operator<<>(v187, a12); + v188 = std::operator<<>(lpuexcptl, "return root;"); + std::operator<<>(v188, a12); + v189 = std::operator<<>(lpuexcptl, "}"); + std::operator<<>(v189, a12); + v190 = std::operator<<>(lpuexcptl, "}"); + std::operator<<>(v190, a12); + v191 = std::operator<<>(lpuexcptl, "}"); + std::operator<<>(v191, a12); + std::operator<<>( + lpuexcptl, + "}(__g.a,__g.b,__g.c,__g.d,__g.e,__g.f,__g.g,__g.h,__g.i,__g.j,__g.k,__g.l,__g.m,__g.n,__g.o,__g.p,__g.q,__g.r,__g." + "s,__g.t,__g.u,__g.v,__g.w,__g.x,__g.y,__g.z,__g.A,__g.B,__g.C,__g.D,__g.E,__g.F,__g.G,__g.H,__g.I,__g.J,__g.K,__g." + "L,__g.M,__g.N,__g.O,__g.P,__g.Q,__g.R,__g.S,__g.T,__g.U,__g.V,__g.W,__g.X,__g.Y,__g.Z,__g.aa);"); + if ( (a11 & 8) != 0 ) + { + v192 = std::map>::operator[](&v307, v248); + v257 = (std::ostream::sentry *)*((_DWORD *)v192 + 1); + for ( i4 = *(int **)v192; i4 != (int *)v257; i4 += 6 ) + { + v193 = std::operator<<>(lpuexcptl, "//"); + v194 = std::operator<<(v193, i4); + v195 = std::operator<<>(v194, ":"); + std::operator<<>(v195, a12); + v196 = std::map>::operator[](&v304, (int)i4); + WXML::DOMLib::WXMLDom::Print(*(_DWORD **)v196, 0, "//", (char *)v243); + } + } + v197 = std::map>::operator[](&v307, v248); + v273 = v225 || *((_DWORD *)v197 + 1) == *(_DWORD *)v197; + lpuexcptm = std::operator<<>(lpuexcptl, "if(__vd_version_info__.delayedGwx||"); + v198 = "true"; + if ( !v273 ) + v198 = "false"; + std::string::basic_string((void **)&jj, v198); + v199 = std::operator<<(lpuexcptm, &jj); + v200 = std::operator<<>(v199, ")"); + v201 = std::operator<<(v200, v318); + std::operator<<>(v201, "();"); + std::string::_M_dispose((void **)&jj); + std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(v320); + std::string::_M_dispose((void **)v318); + v233 = (_DWORD *)std::_Rb_tree_increment((int)v233); + } + for ( i5 = (struct _Unwind_Exception *)v303; ; i5 = (struct _Unwind_Exception *)std::_Rb_tree_increment((int)lpuexcptn) ) + { + lpuexcptn = i5; + if ( i5 == (struct _Unwind_Exception *)v302 ) + break; + std::stringbuf::str((int)&jj, *((_DWORD *)i5 + 10) + 12); + v203 = std::map::operator[](a3, (int)lpuexcptn + 16); + std::string::operator=((unsigned __int8 **)v203, (int)&jj); + std::string::_M_dispose((void **)&jj); + } + v258 = 0; +LABEL_185: + WXML::NameAllocator::~NameAllocator((int)&v328); + std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::~_Rb_tree((int)&v316); +LABEL_186: + std::_Rb_tree,std::less,std::allocator>::~_Rb_tree((int)&v313); +LABEL_187: + std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::~_Rb_tree((int)&v311); + std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::~_Rb_tree((int)&v309); + std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>>::_M_erase(v308[1]); + std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>>::~_Rb_tree((int)&v304); + std::_Rb_tree,std::allocator>>>,std::_Select1st,std::allocator>>>>,std::less,std::allocator,std::allocator>>>>>::_M_erase(v302[1]); + return v258; +} \ No newline at end of file diff --git a/test/disassembly/parse_source.cpp b/test/disassembly/parse_source.cpp new file mode 100644 index 0000000..fdad7fc --- /dev/null +++ b/test/disassembly/parse_source.cpp @@ -0,0 +1,421 @@ + +//----- (00405522) -------------------------------------------------------- +struct _Unwind_Exception *__usercall WXML::Compiler::ParseSource@( + WXML::DOMLib::Parser *a1@, + int *a2, // 文件名 + char **a3, + char a4, // '\n' + int a5, // gwxMark + int *a6, // "f_" + _DWORD *a7, // fileData + int *a8, // 错误信息 + _DWORD *a9, // map + _DWORD *a10,// ??? + _DWORD *a11,// ??? + int a12, // bool + char a13) // bool +{ + char *v13; // eax + std::ostream::sentry *v14; // eax + std::ostream::sentry *v15; // eax + std::ostream::sentry *v16; // eax + std::ostream::sentry *v17; // eax + std::ostream::sentry *v18; // eax + std::ostream::sentry *v19; // eax + std::ostream::sentry *v20; // eax + std::ostream::sentry *v21; // eax + std::ostream::sentry *v22; // eax + std::ostream::sentry *v23; // eax + std::ostream::sentry *v24; // eax + std::ostream::sentry *v25; // eax + std::ostream::sentry *v26; // eax + std::ostream::sentry *v27; // eax + std::ostream::sentry *v28; // eax + std::ostream::sentry *v29; // eax + std::ostream::sentry *v30; // eax + std::ostream::sentry *v31; // eax + void **v32; // ecx + _DWORD *v33; // eax + _DWORD *v34; // eax + _DWORD *v35; // eax + _DWORD *v36; // eax + std::ostream::sentry *v37; // eax + std::ostream::sentry *v38; // eax + std::ostream::sentry *v39; // eax + char *v40; // eax + std::ostream::sentry *v41; // eax + std::ostream::sentry *v42; // eax + std::ostream::sentry *v43; // eax + std::ostream::sentry *v44; // eax + std::ostream::sentry *v45; // eax + std::ostream::sentry *v46; // eax + char *v47; // eax + WXML::DOMLib::Parser *v49; // [esp+0h] [ebp-478h] + unsigned int i; // [esp+2Ch] [ebp-44Ch] + std::ostream::sentry *v51; // [esp+30h] [ebp-448h] + bool v52; // [esp+30h] [ebp-448h] + std::ostream::sentry *v53; // [esp+30h] [ebp-448h] + std::ostream::sentry *v54; // [esp+30h] [ebp-448h] + int v55; // [esp+34h] [ebp-444h] + std::ostream::sentry *v56; // [esp+34h] [ebp-444h] + std::ostream::sentry *v57; // [esp+34h] [ebp-444h] + std::ostream::sentry *v58; // [esp+34h] [ebp-444h] + std::ostream::sentry *v59; // [esp+34h] [ebp-444h] + std::ostream::sentry *v60; // [esp+34h] [ebp-444h] + std::ostream::sentry *v61; // [esp+34h] [ebp-444h] + std::ostream::sentry *v62; // [esp+34h] [ebp-444h] + bool lpuexcpta; // [esp+38h] [ebp-440h] + struct _Unwind_Exception *lpuexcpt; // [esp+38h] [ebp-440h] + int v65; // [esp+70h] [ebp-408h] BYREF + int **v66; // [esp+74h] [ebp-404h] BYREF + int **v67; // [esp+78h] [ebp-400h] + int v68; // [esp+7Ch] [ebp-3FCh] + char *v69; // [esp+80h] [ebp-3F8h] BYREF + int v70; // [esp+84h] [ebp-3F4h] + char v71; // [esp+88h] [ebp-3F0h] BYREF + int v72[2]; // [esp+98h] [ebp-3E0h] BYREF + char v73; // [esp+A0h] [ebp-3D8h] BYREF + void *v74[2]; // [esp+B0h] [ebp-3C8h] BYREF + char v75; // [esp+B8h] [ebp-3C0h] BYREF + int v76; // [esp+C8h] [ebp-3B0h] BYREF + int v77; // [esp+CCh] [ebp-3ACh] + char v78; // [esp+D0h] [ebp-3A8h] BYREF + void *v79[2]; // [esp+E0h] [ebp-398h] BYREF + char v80; // [esp+E8h] [ebp-390h] BYREF + int v81[2]; // [esp+F8h] [ebp-380h] BYREF + char v82; // [esp+100h] [ebp-378h] BYREF + void *v83[6]; // [esp+110h] [ebp-368h] BYREF + int v84[2]; // [esp+128h] [ebp-350h] BYREF + char v85; // [esp+130h] [ebp-348h] BYREF + int v86[6]; // [esp+140h] [ebp-338h] BYREF + int v87[6]; // [esp+158h] [ebp-320h] BYREF + int v88[2]; // [esp+170h] [ebp-308h] BYREF + char v89[4]; // [esp+178h] [ebp-300h] BYREF + char v90[196]; // [esp+17Ch] [ebp-2FCh] BYREF + int v91; // [esp+240h] [ebp-238h] BYREF + volatile signed __int32 *v92; // [esp+244h] [ebp-234h] BYREF + char v93[4]; // [esp+248h] [ebp-230h] BYREF + char v94[196]; // [esp+24Ch] [ebp-22Ch] BYREF + int v95[2]; // [esp+310h] [ebp-168h] BYREF + char v96[4]; // [esp+318h] [ebp-160h] BYREF + char v97[348]; // [esp+31Ch] [ebp-15Ch] BYREF + + // copy from param + WXML::DOMLib::Parser *a1@, + int *a2, // 文件名 + char **a3, + char a4, // '\n' + int a5, // gwxMark + int *a6, // "f_" + _DWORD *a7, // fileData + int *a8, // 错误信息 + _DWORD *a9, // map + _DWORD *a10,// ??? + _DWORD *a11,// ??? + int a12, // bool + char a13; // bool + // copy from param + + // 判断文件拓展名是否为 wxml + std::string::substr(v95, a2, a2[1] - 5, 0xFFFFFFFF); + lpuexcpta = std::operator==((int)v95, ".wxml"); + std::string::_M_dispose((void **)v95); + if ( lpuexcpta ) + { + // wxml文件 + v66 = 0; + v67 = 0; + v68 = 0; + WXML::DOMLib::Parser::Parser(v49); + lpuexcpt = (struct _Unwind_Exception *)WXML::DOMLib::Parser::Parse( + (int)v95, // 存放结果? + a1, // 源码? + *a3, // ? + (int)a8,// 错误信息 + (int)a2, // 文件名 + &v66 + ); + // Parse返回值0,正常 + if ( !lpuexcpt ) + { + WXML::DOMLib::Parser::GetParsed(&v91, (WXML::DOMLib::Parser *)v95); + // v91 = v95.GetParsed() + + // a2 文件名? + v13 = std::map>::operator[](a9, (int)a2); + // a9[a2] a9[fileName] + *(_DWORD *)v13 = v91; + // a9[a2] a9[fileName] = v91 + std::__shared_count<(__gnu_cxx::_Lock_policy)2>::operator=((volatile signed __int32 **)v13 + 1, v92); + std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v92); + v70 = 0; + v69 = &v71; + v71 = 0; + v72[0] = (int)&v73; + v72[1] = 0; + v73 = 0; + std::basic_stringstream,std::allocator>::basic_stringstream((int)v88); + if ( v66 != v67 ) + { + v51 = std::operator<<>((std::ostream::sentry *)v89, "f_['"); + WXML::Rewrite::ToStringCode((int)&v91, a2); + v14 = std::operator<<(v51, &v91); + v15 = std::operator<<>(v14, "']={};"); + std::operator<<>(v15, a4); + std::string::_M_dispose((void **)&v91); + } + for ( i = 0; -1227133513 * (((char *)v67 - (char *)v66) >> 4) > i; ++i ) + { + v74[1] = 0; + v79[0] = &v80; + v81[0] = (int)&v82; + v74[0] = &v75; + v76 = (int)&v78; + v75 = 0; + v77 = 0; + v78 = 0; + v79[1] = 0; + v80 = 0; + v81[1] = 0; + v82 = 0; + v55 = WXML::Compiler::DealWxsTag((int)a2, &v66[28 * i], v74, (int)&v76, (int)v79, &v65, a8); + if ( v55 ) + goto LABEL_20; + +// // copy from param +// WXML::DOMLib::Parser *a1@, +// int *a2, // 文件名 +// char **a3, +// char a4, // '\n' +// int a5, // gwxMark +// int *a6, // "f_" +// _DWORD *a7, // fileData +// int *a8, // 错误信息 +// _DWORD *a9, // map +// _DWORD *a10,// ??? +// _DWORD *a11,// ??? +// int a12, // bool +// char a13; // bool +// // copy from param + + v16 = std::operator<<((std::ostream::sentry *)v89, a6); + v56 = std::operator<<>(v16, "['"); + WXML::Rewrite::ToStringCode((int)v87, a2); + v17 = std::operator<<(v56, v87); + v57 = std::operator<<>(v17, "']['"); + WXML::Rewrite::ToStringCode((int)&v91, (int *)v74); + v18 = std::operator<<(v57, &v91); + std::operator<<>(v18, "'] ="); + std::string::_M_dispose((void **)&v91); + std::string::_M_dispose((void **)v87); + if ( v77 ) + { + MMBizWxaAppComm::PathCombine(a2, &v76, (unsigned int *)v81); + if ( *(_BYTE *)v81[0] == '/' /*47*/ ) + { + std::operator+((int)v86, '.'/*46*/, (int)v81); + std::string::operator=((unsigned __int8 **)v81, (int)v86); + std::string::_M_dispose((void **)v86); + } + if ( a7 + 1 == std::_Rb_tree,std::_Select1st>,std::less,std::allocator>>::find( + a7, + (int)v81) + && (std::operator==(a5, "$gwx") || a13) ) + { + std::basic_stringstream,std::allocator>::basic_stringstream((int)&v91); + v19 = std::operator<<((std::ostream::sentry *)v93, a2); + std::operator<<>(v19, ":"); + v20 = (std::ostream::sentry *)std::ostream::operator<<(v65); + std::operator<<>(v20, ":"); + v21 = (std::ostream::sentry *)std::ostream::operator<<(v66[28 * i + 3]); + v22 = std::operator<<>(v21, ":"); + v23 = std::operator<<(v22, &v76); + v24 = std::operator<<>(v23, " not found from "); + // a2 fileName + std::operator<<(v24, a2); + std::stringbuf::str((int)v87, (int)v94); + // v87.str(v94) + // a8 errorMessage + std::string::operator=((unsigned __int8 **)a8, (int)v87); + std::string::_M_dispose((void **)v87); + std::basic_stringstream,std::allocator>::~basic_stringstream((int)&v91); + v55 = 1; +LABEL_20: + std::string::_M_dispose((void **)v81); + std::string::_M_dispose(v79); + std::string::_M_dispose((void **)&v76); + std::string::_M_dispose(v74); + std::basic_stringstream,std::allocator>::~basic_stringstream((int)v88); + std::string::_M_dispose((void **)v72); + std::string::_M_dispose((void **)&v69); + lpuexcpt = (struct _Unwind_Exception *)v55; + goto LABEL_24; + } + v58 = std::operator<<>((std::ostream::sentry *)v89, "f_['"); + WXML::Rewrite::ToStringCode((int)&v91, v81); + v25 = std::operator<<(v58, &v91); + std::operator<<>(v25, "'] || "); + std::string::_M_dispose((void **)&v91); + v59 = std::operator<<>((std::ostream::sentry *)v89, "nv_require(\""); + std::operator+((int)v87, "p_", (int)v81); + WXML::Rewrite::ToStringCode((int)&v91, v87); + v26 = std::operator<<(v59, &v91); + v27 = std::operator<<>(v26, "\");"); + // lineEnd '\n' + std::operator<<>(v27, a4); + std::string::_M_dispose((void **)&v91); + std::string::_M_dispose((void **)v87); + v28 = std::operator<<((std::ostream::sentry *)v89, a6); + v60 = std::operator<<>(v28, "['"); + WXML::Rewrite::ToStringCode((int)v87, a2); + v29 = std::operator<<(v60, v87); + v61 = std::operator<<>(v29, "']['"); + WXML::Rewrite::ToStringCode((int)&v91, (int *)v74); + v30 = std::operator<<(v61, &v91); + v31 = std::operator<<>(v30, "']();"); + std::operator<<>(v31, a4); + std::string::_M_dispose((void **)&v91); + v32 = (void **)v87; + } + else + { + +// // copy from param +// WXML::DOMLib::Parser *a1@, +// int *a2, // 文件名 +// char **a3, +// char a4, // '\n' +// int a5, // gwxMark +// int *a6, // "f_" +// _DWORD *a7, // fileData +// int *a8, // 错误信息 +// _DWORD *a9, // map +// _DWORD *a10,// ??? +// _DWORD *a11,// ??? +// int a12, // bool +// char a13; // bool +// // copy from param + std::operator+((int)v86, "m_", (int)a2); + v33 = std::string::append(v86, ":"); + std::string::basic_string(v87, v33); + v34 = std::string::append(v87, (int)v74); + std::string::basic_string(&v91, v34); + WXML::Compiler::GetFuncId(v83, a11, (int)&v91); + std::string::_M_dispose((void **)&v91); + std::string::_M_dispose((void **)v87); + std::string::_M_dispose((void **)v86); + v55 = night::compile_ns((int)a2, (int)v83, (int)v79, v65, (unsigned int *)v72, 0); + if ( v55 ) + { + std::string::_M_assign((int)a8, (int)v72); + std::string::_M_dispose(v83); + goto LABEL_20; + } + v62 = std::operator<<>((std::ostream::sentry *)v89, "nv_require(\""); + std::operator+((int)v84, "m_", (int)a2); + v35 = std::string::append(v84, ":"); + std::string::basic_string(v86, v35); + v36 = std::string::append(v86, (int)v74); + std::string::basic_string(v87, v36); + WXML::Rewrite::ToStringCode((int)&v91, v87); + v37 = std::operator<<(v62, &v91); + v38 = std::operator<<>(v37, "\");"); + std::operator<<>(v38, a4); + std::string::_M_dispose((void **)&v91); + std::string::_M_dispose((void **)v87); + std::string::_M_dispose((void **)v86); + std::string::_M_dispose((void **)v84); + v39 = std::operator<<((std::ostream::sentry *)v89, v72); + std::operator<<>(v39, a4); + v32 = v83; + } + std::string::_M_dispose(v32); + std::string::_M_dispose((void **)v81); + std::string::_M_dispose(v79); + std::string::_M_dispose((void **)&v76); + std::string::_M_dispose(v74); + } + std::stringbuf::str((int)&v91, (int)v90); + // v90 = v91.str() + std::string::operator=((unsigned __int8 **)&v69, (int)&v91); + std::string::_M_dispose((void **)&v91); + std::basic_stringstream,std::allocator>::~basic_stringstream((int)v88); + std::string::_M_dispose((void **)v72); + if ( v70 ) + { + v40 = std::map::operator[](a10, (int)a2); + std::string::_M_assign((int)v40, (int)&v69); + } + std::string::_M_dispose((void **)&v69); + } +LABEL_24: + WXML::DOMLib::Parser::~Parser((int)v95); + std::vector::~vector((void **)&v66); + } + else + { + std::string::substr(v95, a2, a2[1] - 4, 0xFFFFFFFF); + v52 = std::operator==((int)v95, ".wxs"); + std::string::_M_dispose((void **)v95); + lpuexcpt = 0; + if ( v52 ) + { +// // copy from param +// WXML::DOMLib::Parser *a1@, +// int *a2, // 文件名 +// char **a3, +// char a4, // '\n' +// int a5, // gwxMark +// int *a6, // "f_" +// _DWORD *a7, // fileData +// int *a8, // 错误信息 +// _DWORD *a9, // map +// _DWORD *a10,// ??? +// _DWORD *a11,// ??? +// int a12, // bool +// char a13; // bool +// // copy from param + v84[0] = (int)&v85; + v84[1] = 0; + v85 = 0; + std::operator+((int)v95, "p_", (int)a2); + WXML::Compiler::GetFuncId((void **)v86, a11, (int)v95); + std::string::_M_dispose((void **)v95); + lpuexcpt = (struct _Unwind_Exception *)night::compile_ns((int)a2, (int)v86, (int)a3, 1, (unsigned int *)v84, 0); + if ( lpuexcpt ) + { + std::string::_M_assign((int)a8, (int)v84); + } + else + { + std::basic_stringstream,std::allocator>::basic_stringstream((int)v95); + v53 = std::operator<<>((std::ostream::sentry *)v96, "f_['"); + WXML::Rewrite::ToStringCode((int)v87, a2); + v41 = std::operator<<(v53, v87); + v42 = std::operator<<>(v41, "'] = nv_require("); + v54 = std::operator<<>(v42, '"'/*34*/); + std::operator+((int)v88, "p_", (int)a2); + WXML::Rewrite::ToStringCode((int)&v91, v88); + v43 = std::operator<<(v54, &v91); + v44 = std::operator<<>(v43, '"'/*34*/); + v45 = std::operator<<>(v44, ");"); + std::operator<<>(v45, a4); + std::string::_M_dispose((void **)&v91); + std::string::_M_dispose((void **)v88); + std::string::_M_dispose((void **)v87); + // v84 compile_ns结果? + v46 = std::operator<<((std::ostream::sentry *)v96, v84); + std::operator<<>(v46, a4); + std::stringbuf::str((int)&v91, (int)v97); + v47 = std::map::operator[](a10, (int)a2); + std::string::operator=((unsigned __int8 **)v47, (int)&v91); + std::string::_M_dispose((void **)&v91); + std::basic_stringstream,std::allocator>::~basic_stringstream((int)v95); + } + std::string::_M_dispose((void **)v86); + std::string::_M_dispose((void **)v84); + } + } + return lpuexcpt; +} +// 40561E: variable 'v49' is possibly undefined \ No newline at end of file diff --git a/test/resolve_path.cpp b/test/resolve_path.cpp new file mode 100644 index 0000000..bbbe039 --- /dev/null +++ b/test/resolve_path.cpp @@ -0,0 +1,14 @@ +#include +#include "../src/include/wxml.h" + +using namespace std; + +int main(void) +{ + printf("test....\n"); + string a = "./page/API/components/set-tab-bar/set-tab-bar.wxml"; + string b = "../../../common/head.wxml"; + string result = WXML::DOMLib::resolvePath(a, b); + printf("%s\n", result.c_str()); + return 0; +} \ No newline at end of file diff --git a/test/vector b/test/vector deleted file mode 100755 index ed641e6..0000000 Binary files a/test/vector and /dev/null differ diff --git a/test/wcc.cpp b/test/wcc.cpp index 1057f66..d905276 100644 --- a/test/wcc.cpp +++ b/test/wcc.cpp @@ -410,8 +410,10 @@ LABEL_72: v68 = -1; goto LABEL_153; } + // -lla v51 = 1; } + // -lla 或 -llw if ( !std::string::compare((int)blankStr, " ") ) std::string::basic_string((void **)&tempData, ","); else @@ -598,10 +600,12 @@ LABEL_84: if ( v43 ) { v70 = v93; + // 处理文件路径 for ( Streamg = (FILE *)v92; Streamg != (FILE *)v70; Streamg = (FILE *)((char *)Streamg + 24) ) { - if ( *Streamg->_ptr == 46 && Streamg->_ptr[1] == 47 ) + if ( *Streamg->_ptr == 46 /*.*/ && Streamg->_ptr[1] == 47 /*/*/ ) { + // 以"./"开头,去掉前两个字符 std::string::substr(&tempData, Streamg, 2u, 0xFFFFFFFF); std::string::operator=((unsigned __int8 **)Streamg, (int)&tempData); std::string::_M_dispose((void **)&tempData); @@ -627,18 +631,18 @@ LABEL_84: v126, (int)&v109); v68 = (int)WXML::Compiler::CompileLazy( - &v107, + &v107, // fileData std::map (file -> content) (int *)v111, - &v115, - &v101, + &v115, // outputMap std::map + &v101, // dict map &v121, v126, - (int *)&v92, - &v105, - v53, + (int *)&v92, // splitedData + &v105, // mapData1 + v53, // isLLA (int)gwxMark, mark, - 10, + 10, // asci -> '\n' (int *)v127, // 'e' (int *)v128, // const char off_5403C3[] = {'s','\0','e','\0'} (int *)v129, // "gg" diff --git a/test/wcc.disassembly.cpp b/test/wcc.disassembly.cpp index c309cfb..9dde493 100644 --- a/test/wcc.disassembly.cpp +++ b/test/wcc.disassembly.cpp @@ -8983,6 +8983,7 @@ int GetNextArg(int a1, int *a2, int a3) std::string::operator=((unsigned __int8 **)v6, (int)v8); std::string::_M_dispose(v8); std::string::substr(v9, a2, (unsigned int)lpuexcpt + *(_DWORD *)(a3 + 4), 0xFFFFFFFF); + // v9 = a2.substr(lpuexcpt) std::string::operator=((unsigned __int8 **)a2, (int)v9); std::string::_M_dispose(v9); } @@ -9088,6 +9089,7 @@ int __cdecl Split(int a1, int *a2, int a3) { v5 = i; std::string::substr(v7, a2, (unsigned int)lpuexcpt, i - (_DWORD)lpuexcpt); + // v7 = a2.substr(lpuexcpt, i - lpuexcpt) Trim((int)v8, (int)v7); std::vector::emplace_back((void **)a1, v8); std::string::_M_dispose(v8); @@ -10815,7 +10817,13 @@ void __fastcall std::deque::~deque(int a1) // 404665: variable 'v3' is possibly undefined //----- (0040469D) -------------------------------------------------------- -int __cdecl WXML::Compiler::DealWxsTag(int a1, int **a2, _DWORD *a3, int a4, int a5, _DWORD *a6, int *a7) +int __cdecl WXML::Compiler::DealWxsTag( + int a1, + int **a2, + _DWORD *a3, + int a4, int a5, + _DWORD *a6, + int *a7) { bool v7; // zf int *v8; // eax @@ -10878,14 +10886,15 @@ int __cdecl WXML::Compiler::DealWxsTag(int a1, int **a2, _DWORD *a3, int a4, int char v66[196]; // [esp+19Ch] [ebp-23Ch] BYREF void *v67[94]; // [esp+260h] [ebp-178h] BYREF - lpuexcptc = std::string::find(*a2, 62, (unsigned int)a2[4]); + lpuexcptc = std::string::find(*a2, '>'/*62*/, (unsigned int)a2[4]); + // a2.find('>') v40 = (unsigned int)(lpuexcptc + 1); std::string::basic_string(v51, ""); v53[0] = &v54; v54 = 0; v53[1] = 0; - v7 = *(_BYTE *)std::string::at(*a2, (unsigned int)(lpuexcptc - 1)) == 47; + v7 = *(_BYTE *)std::string::at(*a2, (unsigned int)(lpuexcptc - 1)) == '/'/*47*/; v8 = a2[4]; v9 = *a2; if ( v7 ) @@ -13180,28 +13189,28 @@ LABEL_118: //----- (0040A124) -------------------------------------------------------- struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy( - _DWORD *a1, - int *a2, - _DWORD *a3, - _DWORD *a4, + _DWORD *a1, // fileData + int *a2, // 错误信息 + _DWORD *a3, // 输出1 + _DWORD *a4, // 输出2 _DWORD *a5, - _DWORD *a6, - int *a7, - _DWORD *a8, - char a9, - int a10, - int a11, - char a12, - int *a13, - int *a14, - int *a15, - int *a16, - int *a17, - int *a18, - int a19, - int a20, - int a21, - int *a22) + _DWORD *a6, // vecFileContentMap + int *a7,// splitedData + _DWORD *a8,// mapData1 + char a9,// isLLA + int a10,// gwxMark + int a11,// mark + char a12,// '\n' + int *a13,// 'e' + int *a14,// const char off_5403C3[] = {'s','\0','e','\0'} + int *a15, // "gg" + int *a16,// "e_" + int *a17,// "d_" + int *a18,// "p_" + int a19, // '\0' + int a20, // "boxofchocolate" + int a21, // "$gdwx" + int *a22) // "f_" { volatile signed __int32 **v22; // eax _DWORD *v23; // eax @@ -13513,7 +13522,30 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy( char v330[4]; // [esp+248h] [ebp-E0h] BYREF volatile signed __int32 **v331; // [esp+24Ch] [ebp-DCh] unsigned int v332; // [esp+254h] [ebp-D4h] - +/* + _DWORD *a1, // fileData + int *a2, // 错误信息 + _DWORD *a3, // 输出1 + _DWORD *a4, // 输出2 + _DWORD *a5, + _DWORD *a6, // vecFileContentMap + int *a7,// splitedData + _DWORD *a8,// mapData1 + char a9,// isLLA + int a10,// gwxMark + int a11,// mark + char a12,// '\n' + int *a13,// 'e' + int *a14,// const char off_5403C3[] = {'s','\0','e','\0'} + int *a15, // "gg" + int *a16,// "e_" + int *a17,// "d_" + int *a18,// "p_" + int a19, // '\0' + int a20, // "boxofchocolate" + int a21, // "$gdwx" + int *a22) // "f_" +*/ std::_Rb_tree_header::_Rb_tree_header(v302); std::_Rb_tree_header::_Rb_tree_header(v305); std::_Rb_tree_header::_Rb_tree_header(v308); @@ -13524,19 +13556,20 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy( while ( lpuexcpt != v249 ) { v258 = WXML::Compiler::ParseSource( - v249, - (int *)lpuexcpt + 4, - (char **)lpuexcpt + 10, - a12, - a10, - a22, - a1, - a2, - &v304, - &v309, - &v311, - (a11 & 4) != 0, + v249, // 源码? + (int *)lpuexcpt + 4, // 文件名 + (char **)lpuexcpt + 10,// ? + a12, // '\n' + a10, // gwxMark + a22, // "f_" + a1, // fileData + a2, // 错误信息 + &v304, // map + &v309, // ??? + &v311, // ??? + (a11 & 4) != 0, // a11 -> mark (a11 & 0x20) != 0); + // 源码解析失败,LABEL_187 -> return v258 if ( v258 ) goto LABEL_187; lpuexcpt = (struct _Unwind_Exception *)std::_Rb_tree_increment((int)lpuexcpt); @@ -13548,7 +13581,9 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy( v22 = (volatile signed __int32 **)std::map,std::allocator>>>::operator[]( &v301, &v328); + // v22 = v301["__COMMON__"] *v22 = (volatile signed __int32 *)jj; + // v301["__COMMON__"] = jj std::__shared_count<(__gnu_cxx::_Lock_policy)2>::operator=(v22 + 1, v326); std::string::_M_dispose((void **)&v328); std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v326); @@ -13557,15 +13592,42 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy( v327 = 0; std::string::basic_string((void **)&v328, "__COMMON__"); v23 = std::map>::operator[](&v307, &v328); + // v23 = v307["__COMMON__"] std::vector::operator=(v23, &jj); + // v307["__COMMON__"] = jj std::string::_M_dispose((void **)&v328); std::vector::~vector((void ***)&jj, v24); std::string::basic_string((void **)&v328, "__COMMON__"); v226 = *std::map,std::allocator>>>::operator[]( &v301, &v328); + // v226 = v301["__COMMON__"] std::string::_M_dispose((void **)&v328); v237 = (WXML::EXPRLib::Parser *)a7[1]; + /* + _DWORD *a1, // fileData + int *a2, // 错误信息 + _DWORD *a3, // 输出1 + _DWORD *a4, // 输出2 + _DWORD *a5, + _DWORD *a6, // vecFileContentMap + int *a7,// splitedData + _DWORD *a8,// mapData1 + char a9,// isLLA + int a10,// gwxMark + int a11,// mark + char a12,// '\n' + int *a13,// 'e' + int *a14,// const char off_5403C3[] = {'s','\0','e','\0'} + int *a15, // "gg" + int *a16,// "e_" + int *a17,// "d_" + int *a18,// "p_" + int a19, // '\0' + int a20, // "boxofchocolate" + int a21, // "$gdwx" + int *a22) // "f_" +*/ for ( i = *a7; (WXML::EXPRLib::Parser *)i != v237; i += 24 ) { v222 = operator new(0xD0u); @@ -21684,7 +21746,7 @@ _DWORD *__fastcall WXML::DOMLib::Parser::Peek(_DWORD *a1) v2 = a1[22]; v3 = a1[25]; if ( v3 < -1227133513 * ((a1[23] - v2) >> 4) ) - return (_DWORD *)(v2 + 112 * v3); + return (_DWORD *)(v2 + 112 * v3); // 112 ascii -> 'p' return result; } @@ -21749,6 +21811,7 @@ int __cdecl WXML::DOMLib::joinString(int a1, _DWORD *a2, char a3) (unsigned int)lpuexcpt < -1431655765 * ((a2[1] - *a2) >> 3); lpuexcpt = (struct _Unwind_Exception *)((char *)lpuexcpt + 1) ) { + // -1431655765 * ((a2[1] - *a2) >> 3 =====> a2.size() std::operator<<((std::ostream::sentry *)v6, (int *)(24 * (_DWORD)lpuexcpt + *a2)); if ( (struct _Unwind_Exception *)(-1431655765 * ((a2[1] - *a2) >> 3) - 1) != lpuexcpt ) std::operator<<>((std::ostream::sentry *)v6, a3); @@ -22165,15 +22228,18 @@ int __cdecl WXML::DOMLib::resolvePath(int a1, int *a2, int *a3) *(_BYTE *)(a1 + 8) = 0; *(_DWORD *)a1 = a1 + 8; *(_DWORD *)(a1 + 4) = 0; - if ( *(_BYTE *)*a3 != 47 ) + if ( *(_BYTE *)*a3 != '/'/*47*/ ) { - WXML::DOMLib::splitString((int)&v10, a2, 47); + // path1 + WXML::DOMLib::splitString((int)&v10, a2, '/'/*47*/); v11 -= 6; std::string::_M_dispose(v11); - WXML::DOMLib::splitString((int)v13, a3, 47); + // path2 + WXML::DOMLib::splitString((int)v13, a3, '/'/*47*/); for ( i = 0; i < -1431655765 * ((v13[1] - v13[0]) >> 3); ++i ) { lpuexcpt = (struct _Unwind_Exception *)(24 * i); + // v13 p2Split if ( std::operator==(24 * i + v13[0], "..") ) { v11 -= 6; @@ -22185,13 +22251,13 @@ int __cdecl WXML::DOMLib::resolvePath(int a1, int *a2, int *a3) std::vector::push_back((int)&v10, (int)lpuexcpt + v13[0]); } } - WXML::DOMLib::joinString((int)v12, &v10, 47); + WXML::DOMLib::joinString((int)v12, &v10, '/'/*47*/); std::string::operator=((unsigned __int8 **)a1, (int)v12); std::string::_M_dispose(v12); std::vector::~vector((void ***)v13, v3); std::vector::~vector(&v10, v4); } - if ( *(_BYTE *)*a2 == 46 && *(_BYTE *)*a3 == 47 ) + if ( *(_BYTE *)*a2 == '.'/*46*/ && *(_BYTE *)*a3 == '/'/*47*/ ) { std::operator+((int)v13, ".", (int)a3); std::string::operator=((unsigned __int8 **)a1, (int)v13); @@ -22246,17 +22312,25 @@ void __fastcall WXML::DOMLib::Parser::ATTR(WXML::DOMLib::Parser *a1) for ( i = 0; v20 > i; ++i ) { v3 = *(_BYTE *)(v19[4] + *(_DWORD *)v19[0] + i); - if ( (unsigned __int8)((v3 & 0xDF) - 65) > 0x19u && (unsigned __int8)(v3 - 48) > 0xAu && v3 != 95 && v3 != 45 ) + if ( + // 0xDF -> 1101 1111 + (unsigned __int8)((v3 & 0xDF) - 'A'/*65*/) > 25/*0x19u*/ // 超出26个大写字母范围 + && (unsigned __int8)(v3 - '0'/*48*/) > 10 /*0xAu*/ // 不是9,可能把(冒号:)考虑进去了 + && v3 != '_'/*95*/ // 不是下划线 + && v3 != '-'/*45*/ // 不是连字符 + ) goto LABEL_12; } - if ( (unsigned int)(v20 - 1) > 0xFFFE ) + // 0xFFFE -> 1111 1111 1111 1110 + // 确保v20在1-65535之间 + if ( (unsigned int)(v20 - 1) > 0xFFFE ) // if (v20 > 0xFFFF) { LABEL_12: exception = __cxa_allocate_exception(0x18u); WXML::DOMLib::Parser::Error(exception, a1, "unexpected attribute name", 0); __cxa_throw( exception, - (struct type_info *)&`typeinfo for'WXML::DOMLib::ParseException, + (struct type_info *)&`typeinfo for WXML::DOMLib::ParseException, WXML::DOMLib::ParseException::~ParseException); } v4 = WXML::DOMLib::Token::ToString[abi:cxx11]((int)v19); @@ -23130,8 +23204,8 @@ void __usercall WXML::DOMLib::Parser::DOMS(WXML::DOMLib::Parser *a1@, WXML: //----- (00422450) -------------------------------------------------------- int __userpurge WXML::DOMLib::Parser::Parse@( int a1@, - WXML::DOMLib::Parser *a2@, - char *Str, + WXML::DOMLib::Parser *a2@, + char *Str, // fileName int a4, int a5, _DWORD *a6) @@ -28161,7 +28235,7 @@ int __thiscall WXML::EXPRLib::Parser::Parse(int this, char **a2, int a3, int a4, dword_53FCEC = (int)&dword_53FCE0; dword_53FCF0 = 0; byte_53FCF4 = 0; - __cxa_guard_release(&`guard variable for'WXML::EXPRLib::TransitTable::GetInstance(void)::ret); + // __cxa_guard_release(&`guard variable for'WXML::EXPRLib::TransitTable::GetInstance(void)::ret); atexit(__tcf_0_1); } WXML::EXPRLib::TransitTable::Init(v41); @@ -190139,7 +190213,7 @@ int main(int argc, const char **argv, const char **envp) } break; case 'v': - if ( v5[2] == 98 ) + if ( v5[2] == 'b'/*98*/ ) v60 |= 0x10u; else v44 = 1; @@ -190196,7 +190270,7 @@ LABEL_72: goto LABEL_84; case 'i': v60 |= 0x40u; - goto LABEL_84; + goto LABEL_84; // continue; } std::string::basic_string((void **)&v143, "--split"); v51 = std::operator==((int)&v89[v67], (int)&v143); @@ -190316,6 +190390,7 @@ LABEL_84: v110[3] = (int)v110; v110[4] = 0; Streamc = 0; + // isReadFromStdin if ( v45 ) { v143 = (int)v145; @@ -190341,7 +190416,7 @@ LABEL_84: Streamc = (FILE *)((char *)Streamc + 1); } } - if ( v96 ) + if ( v96 ) //if (!xc_Or_completeCode_Param.empty()) { GetNextArg((int)String, (int *)&v95, (int)v104); v52 = strtoull(String[0], 0, 10); @@ -190356,7 +190431,10 @@ LABEL_84: LOBYTE(v142[0]) = 0; memset(String, 0, 12); GetNextArg((int)v135, (int *)&v95, (int)v104); + // v95 xc_Or_completeCode_Param, v104 splitMarkStr + // v135 = GetNextArg(v95, v104) std::string::operator=((unsigned __int8 **)&v140, (int)v135); + // v140 = v135 = GetNextArg(v95, v104) std::string::_M_dispose(v135); GetNextArg((int)v136, (int *)&v95, (int)v104); v50 = strtoull(v136[0], 0, 10); @@ -190367,6 +190445,7 @@ LABEL_84: v143 = (int)v145; v145[0] = 0; GetNextArg((int)&v137, (int *)&v95, (int)v104); + // v137 = GetNextArg(v95, v104) std::string::operator=((unsigned __int8 **)&v143, (int)&v137); std::string::_M_dispose((void **)&v137); std::vector::push_back((int)String, (int)&v143); @@ -190375,26 +190454,33 @@ LABEL_84: v131, v132, (int)&v143) ) + // v143 arg2 std::vector::push_back((int)&v131, (int)&v143); std::string::_M_dispose((void **)&v143); } - Streame = (FILE *)std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>>::lower_bound( + Streame = (FILE *)std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>> + ::lower_bound( &v109, (int)&v140); + // Streame = v109.lower_bound(v140) + // v109 vecFileContentMap if ( Streame == (FILE *)v110 || (unsigned __int8)std::operator<((int)&v140, (int)&Streame->_file) ) { - Block = operator new(0x34u); + Block = operator new(0x34u); // 34 -> 4 std::string::basic_string((char *)Block + 16, (int)&v140); Block[10] = 0; Block[11] = 0; Block[12] = 0; - Streame = (FILE *)std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>>::_M_get_insert_hint_unique_pos( + Streame = (FILE *)std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>> + ::_M_get_insert_hint_unique_pos( &v109, Streame, (int)(Block + 4)); + // v109._M_get_insert_hint_unique_pos() if ( v22 ) { - Streame = (FILE *)std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>>::_M_insert_node( + Streame = (FILE *)std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>> + ::_M_insert_node( &v109, (int)Streame, v22, @@ -190428,7 +190514,7 @@ LABEL_84: v118 = &v116; v119 = &v116; v120 = 0; - if ( v43 ) + if ( v43 ) // hasLL { v70 = v93; for ( Streamg = (FILE *)v92; Streamg != (FILE *)v70; Streamg = (FILE *)((char *)Streamg + 24) ) @@ -190460,28 +190546,28 @@ LABEL_84: v126, (int)&v109); v68 = (int)WXML::Compiler::CompileLazy( - &v107, - (int *)v111, - &v115, - &v101, + &v107, // fileContent + (int *)v111, // errorMessage + &v115, // outputMap + &v101, // dict &v121, - v126, - (int *)&v92, - &v105, - v53, - (int)v103, - v60, - 10, - (int *)v127, - (int *)v128, - (int *)v129, - (int *)v130, - &v131, - (int *)String, - (int)v135, - (int)v136, - (int)&v137, - (int *)&v140); + v126, // vecFileContentMap + (int *)&v92, // splitedData + &v105, // mapData1 + v53, // isLLA + (int)v103,// gwxMark + v60, // mark + 10, // '\n' + (int *)v127, // 'e' + (int *)v128,// const char off_5403C3[] = {'s','\0','e','\0'} + (int *)v129,// "gg" + (int *)v130,// "e_" + &v131, // "d_" + (int *)String, // "p_" + (int)v135, // '\0' + (int)v136, // "boxofchocolate" + (int)&v137, // "$gdwx" + (int *)&v140); // "f_" std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>>::~_Rb_tree((int)v126); std::string::_M_dispose(v127); std::string::_M_dispose(v128); @@ -190644,19 +190730,19 @@ LABEL_84: v126, &v105, v53, - (int *)v103, - v60, - 10, - (int *)v127, - (int *)v128, - (int *)v129, - (int *)v130, - &v131, - (int *)String, - (int)v135, - (int)v136, - (int)&v137, - (int *)&v140); + (int *)v103, // gwxMark + v60, // mark + 10, // '\n' + (int *)v127, // off_5403C3[2] + (int *)v128, // off_5403C3 + (int *)v129, // "gg" + (int *)v130, // "e_" + &v131, // "d_" + (int *)String, // "p_" + (int)v135, // '\0' + (int)v136, // "boxofchocolate" + (int)&v137, // "$gdwx" + (int *)&v140); // "f_" std::_Rb_tree>,std::_Select1st>>,std::less,std::allocator>>>::~_Rb_tree((int)v126); std::string::_M_dispose(v127); std::string::_M_dispose(v128);