diff --git a/src/include/wxml.h b/src/include/wxml.h index 5d799a0..71dffce 100644 --- a/src/include/wxml.h +++ b/src/include/wxml.h @@ -69,6 +69,7 @@ namespace WXML /* Token + 大小:112字节 0x70 00(起点) B6 BF 00(文件内容) 80 CC BF 00 01 00 00 00(行数?) 01 00 00 00(行长度?) // 15 01 00 00 00(pos) 04 00 00 00(size) 00 00 00 00 00(布尔值) F6 97 00 // 31 38 F0 97 00 00 00 00 00 00 CC FA 00 CC F0 97 00 // 47(40是32字符串的 缓冲区起点) diff --git a/src/wxml/dom_lib/parser.cpp b/src/wxml/dom_lib/parser.cpp index 8613dd0..776db52 100644 --- a/src/wxml/dom_lib/parser.cpp +++ b/src/wxml/dom_lib/parser.cpp @@ -208,7 +208,6 @@ namespace WXML { int v17 = 0; char* v18 = &v16[0] + token.offset_16; - // offset_20第一次是3 while(token.offset_20 > v17) { int v19 = *(uint8_t *)(v18 + v17) - 9; diff --git a/src/wxml/dom_lib/wxml_dom.cpp b/src/wxml/dom_lib/wxml_dom.cpp index 34b1f5c..3d05626 100644 --- a/src/wxml/dom_lib/wxml_dom.cpp +++ b/src/wxml/dom_lib/wxml_dom.cpp @@ -80,7 +80,12 @@ namespace WXML { // DealSingleTokenToOps - 15 if (a7) { - int v26; + int v26 = 0; + for (auto &&i : v77) + { + v26 -= (i.offset_0 == 0) - 1; + } + if (v26 != a7) { a5->offset_56 = -3; @@ -251,7 +256,7 @@ namespace WXML { } else { - for (auto i = this->offset_48.rbegin(); i != this->offset_48.rend(); i++) + for (auto i = this->offset_48.begin(); i != this->offset_48.end(); i++) { if ( i->second.offset_20 @@ -621,7 +626,7 @@ namespace WXML { { throw this->Error(a2, cur->offset_84, "wx:else", "`wx:if not found, then something must be wrong`"); } - cur->offset_244 = v127; + cur->offset_244 = Stra; cur->offset_220.assign(v149); } Stra = 0; @@ -632,8 +637,8 @@ namespace WXML { { throw this->Error(a2, cur->offset_84, "wx:elif", "`wx:if not found, then something must be wrong`"); } + cur->offset_244 = Stra; Stra++; - cur->offset_244 = v127; cur->offset_220.assign(v149); } } @@ -769,9 +774,9 @@ namespace WXML { a15); goto LABEL_74; } - if (cur->offset_0 == "wx-import") + if (cur->offset_0 != "wx-import") { - if (cur->offset_0 == "wx-define") + if (cur->offset_0 != "wx-define") { std::string v155; a7->GetNextName(v155); @@ -841,6 +846,7 @@ namespace WXML { std::map * a15 ) { + // RenderNonDefine - 0 if (a13 && this->offset_24.size()) { a6 << "cs.push(\""; @@ -873,6 +879,7 @@ namespace WXML { return; } // TEXTNODE end + // RenderNonDefine - 5 if (this->offset_0 == "wx-define" || this->offset_0 == "wx-import" || this->offset_0 == "import" @@ -895,6 +902,9 @@ namespace WXML { std::string v333; std::string v336; std::string v339; + std::string v259 = ""; + int v274 = 0; + std::vector> _v339; if (this->offset_0 == "wx-repeat") { std::string target1 = "items"; @@ -1127,11 +1137,13 @@ namespace WXML { a6 << a12; a6 << "_2z(z,"; a6 << this->offset_48[target1].offset_56 << ","; - a6 << name1 << "," << a8 << "," << a9 << "," << a10 << "," << a5 << ","; - a6 << target3_1 << "," << target2_1 << ","; - a6 << this->offset_48[wxKey].ToAttrContent() << ")" << a12; + a6 << name1 << "," << a8 << "," << a9 << "," << a10 << "," << a5 << ",'"; + a6 << target3_1 << "','" << target2_1 << "','"; + a6 << this->offset_48[wxKey].ToAttrContent() << "')" << a12; goto LABEL_84; } // wx-repeat end + + // RenderNonDefine - 10 if (this->offset_0 == "block") { @@ -1169,6 +1181,7 @@ namespace WXML { } return; } + // RenderNonDefine - 15 if (this->offset_0 == "wx-template") { v281 = this->offset_48.find("is"); @@ -1237,11 +1250,11 @@ namespace WXML { a6 << this->offset_48["is"].offset_8 << ","; a6 << this->offset_48["is"].offset_12 << ","; a6 << ")" << a12; - LABEL_84: + LABEL_84: goto LABEL_169; } + // RenderNonDefine - 20 - // l:25109 for (auto j = this->offset_48.begin(); j != this->offset_48.end(); j++) { /* code */ @@ -1270,11 +1283,11 @@ namespace WXML { v324.emplace_back(j->first, j->second); } } + // RenderNonDefine - 25 std::sort(v324.begin(), v324.end(), WXML::DOMLib::AttrsCompartor); for (auto k = v324.begin(); k != v324.end(); k++) { - /* code */ v330.insert(k->first); } for (auto m = 0; m < v324.size(); m++) @@ -1296,12 +1309,17 @@ namespace WXML { } } + // RenderNonDefine - 30 v327 = ss.str(); - // if (v328) - // { - - // } - if (v324.end() - v324.begin() <= 0x88) + if (v327.length() > 0) + { + std::string v339 = a5; + v339.append(".rawAttr={"); + v339.append(v327); + v339.append("};"); + v327 = v339; + } + if (v324.end() - v324.begin() <= 1) { a6 << "var " << a5 << "=_n('"; a6 << this->offset_0 << "')" << a12; @@ -1344,29 +1362,76 @@ namespace WXML { } } + // RenderNonDefine - 35 a6 << "var " << a5 << "=_mz(z,'" << this->offset_0 << "',["; + v259 = ""; for (auto jj = v324.begin(); jj < v324.end(); jj++) { - + std::string str1c = jj->first; + std::string v342; + if (!strncmp(str1c.data(), "data-", 5u) || str1c.find(':') != -1) + { + v342 = jj->first; + if (!strncmp(str1c.data(), "generic:", 8u)) + { + // jj->second. + _v339.emplace_back(jj->first, jj->second); + } + } + else + { + v342 = WXML::DOMLib::WXMLDom::ToCamelStyle(jj->first); + } + a6 << v259; + a6 << "'" << v342 << "',"; + if (jj->second.offset_20) + { + a6 << (jj->second.offset_56 - v274); + if (!v274) + { + v274 = jj->second.offset_56; + } + + } + else + { + a6 << "-1"; + } + v259 = ","; } a6 << "],["; - // while (/* condition */) - // { - // /* code */ - // } + v259 = ""; + for (auto &&i : _v339) + { + a6 << v259 << "'wx-"; + a6 << i.first; + a6 << "',"; + if(i.second.offset_20) + { + a6 << i.second.offset_56; + } + else + { + a6 << "-1"; + } + v259 = ","; + } + + // RenderNonDefine - 40 a6 << "]," << a8 << "," << a9 << "," << a10 << ")" << a12; LABEL_164: - // if (v328) - // a6 << v327; + if (v327.length() > 0) + a6 << v327; this->RenderChildren(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); - // if ((a14 & 1) != 0) - // this->AddTestAttr(a5, a6, '\n'/*10*/); + if ((a14 & 1) != 0) + this->AddTestAttr(a5, a6, '\n'/*10*/); LABEL_169: if (a13 && this->offset_24.size()) { a6 << "cs.pop()" << a12; } + // RenderNonDefine - 45 } void WXMLDom::RecordAllPath(void) diff --git a/src/wxml/expr_lib/expr_syntax_tree.cpp b/src/wxml/expr_lib/expr_syntax_tree.cpp index a835a42..9eb9be8 100644 --- a/src/wxml/expr_lib/expr_syntax_tree.cpp +++ b/src/wxml/expr_lib/expr_syntax_tree.cpp @@ -40,7 +40,7 @@ namespace WXML } else { - a2 << WXML::EXPRLib::OPShort::CONST << ",'"; + a2 << WXML::EXPRLib::OPShort::CONST << ","; std::string v33 = this->offset_24.GetLiteral(); a2 << v33; diff --git a/test/wcc.disassembly.cpp b/test/wcc.disassembly.cpp index 1c7e465..5b0acac 100644 --- a/test/wcc.disassembly.cpp +++ b/test/wcc.disassembly.cpp @@ -24602,6 +24602,7 @@ int __thiscall WXML::DOMLib::WXMLDom::RenderNonDefine( int a14, int a15) */ + // RenderNonDefine - 0 // this int // this + 28 => this.offset_28 if ( a13 && *(_DWORD *)(this + 28) ) @@ -24666,6 +24667,7 @@ LABEL_69: std::operator<<>(v87, a12); goto LABEL_169; } // TEXTNODE end + // RenderNonDefine - 5 if ( !(unsigned __int8)std::operator!=(this, "wx-define") || !(unsigned __int8)std::operator!=(this, "wx-import") || !(unsigned __int8)std::operator!=(this, "import") @@ -24991,23 +24993,23 @@ LABEL_69: } } - /* - int this, - int *a2, - int *a3, - int a4, - int *a5, - int a6, - int *a7, - int *a8, - int *a9, - int *a10, - int *a11, - char a12, - unsigned __int8 a13, - int a14, - int a15) - */ + /* + int this, + int *a2, + int *a3, + int a4, + int *a5, + int a6, + int *a7, + int *a8, + int *a9, + int *a10, + int *a11, + char a12, + unsigned __int8 a13, + int a14, + int a15) + */ LABEL_189: if ( !std::operator==((int)&v336, "*this") ) { @@ -25030,28 +25032,28 @@ LABEL_69: goto LABEL_191; // LABEL_56 } } -LABEL_56: + LABEL_56: std::string::_M_dispose((void **)&v339); std::string::_M_dispose((void **)&v336); - /* - int this, - int *a2, - int *a3, - int a4, - int *a5, - int a6, - int *a7, - int *a8, - int *a9, - int *a10, - int *a11, - char a12, - unsigned __int8 a13, - int a14, - int a15) - */ -LABEL_57: + /* + int this, + int *a2, + int *a3, + int a4, + int *a5, + int a6, + int *a7, + int *a8, + int *a9, + int *a10, + int *a11, + char a12, + unsigned __int8 a13, + int a14, + int a15) + */ + LABEL_57: v241 = (std::ostream::sentry *)(a6 + 8); if ( *(_BYTE *)(this + 256) ) { @@ -25100,6 +25102,8 @@ LABEL_57: v72 = v312; goto LABEL_84; } // wx-repeat end + + // RenderNonDefine - 10 if ( std::operator==(this, "block") ) { WXML::DOMLib::WXMLDom::RenderChildren(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); @@ -25171,6 +25175,7 @@ LABEL_9: v242 = ");"; goto LABEL_68; } + // RenderNonDefine - 15 v270 = std::operator==(this, "wx-template"); if ( v270 ) { @@ -25364,10 +25369,11 @@ LABEL_9: std::string::_M_dispose((void **)&Str); std::string::_M_dispose((void **)&v336); v72 = (void **)&v333; -LABEL_84: + LABEL_84: std::string::_M_dispose(v72); goto LABEL_169; } + // RenderNonDefine - 20 v324 = 0; v325 = 0; v326 = 0; @@ -25424,6 +25430,7 @@ LABEL_84: std::pair::~pair((void **)v347); } } + // RenderNonDefine - 25 std::sort< __gnu_cxx::__normal_iterator *, std::vector>>, @@ -25523,6 +25530,7 @@ LABEL_84: } } } + // RenderNonDefine - 30 std::stringbuf::str((int)v342, (int)v349); std::string::operator=((unsigned __int8 **)&v327, (int)v342); std::string::_M_dispose((void **)v342); @@ -25638,8 +25646,13 @@ LABEL_158: std::string::_M_dispose((void **)&Str); } } + // RenderNonDefine - 35 v339 = 0; v340 = 0; + /* + int v341[4]; // [esp+214h] [ebp-174h] BYREF + int v342[2]; + */ v341[0] = 0; v175 = std::operator<<>(v305, "var "); v176 = std::operator<<(v175, a5); @@ -25648,7 +25661,8 @@ LABEL_158: std::operator<<>(v178, (char *)off_553DAF); v274 = 0; v259 = (char *)&byte_5537CA; - for ( jj = (int *)v324; jj != (int *)v325; jj += 34 ) + + for ( jj = (int *)v324; jj != (int *)v325; jj += 34 ) // 34 * 4 = 136 = 24 + 112 { Str1c = (char *)*jj; v342[0] = (int)&v343; @@ -25659,10 +25673,24 @@ LABEL_158: std::string::_M_assign((int)v342, (int)jj); if ( !strncmp(Str1c, "generic:", 8u) ) { - Str = Str1c + 8; + Str = Str1c + 8; // std::string缓冲区 + // jj + 6 -> jj.offset_24 -> jj->second WXML::DOMLib::Token::Token((int)&v345, (WXML::DOMLib::Token *)(jj + 6), v244); std::string::basic_string((void **)v347, Str); WXML::DOMLib::Token::Token(v350, (int)&v345); + /* + std::pair - 136 + WXML::DOMLib::Token - 112 + std::string - (136 - 112 = 24) + */ + /* + std::string: + int v347[2]; // [esp+2B0h] [ebp-D8h] BYREF + char v348[4]; // [esp+2B8h] [ebp-D0h] BYREF + char v349[12]; // [esp+2BCh] [ebp-CCh] BYREF + WXML::DOMLib::Token: + _DWORD v350[47]; // [esp+2C8h] [ebp-C0h] BYREF + */ std::vector>::emplace_back>( &v339, v347); @@ -25682,8 +25710,10 @@ LABEL_158: v179 = std::operator<<>(v305, "'"); v180 = std::operator<<(v179, v342); std::operator<<>(v180, "',"); + // jj->offset_44 -> jj->offset_24->offset_20 if ( jj[11] ) { + // jj->offset_80 -> jj->offset_24->offset_56 std::ostream::operator<<(jj[20] - (_DWORD)v274); if ( !v274 ) v274 = (std::ostream::sentry *)jj[20]; @@ -25706,8 +25736,10 @@ LABEL_158: Str1d = (char *)(136 * (_DWORD)v287); v183 = std::operator<<(v182, (int *)(v339 + 136 * (_DWORD)v287)); std::operator<<>(v183, "',"); + // cur->offset_44 if ( *(_DWORD *)(v339 + 136 * (_DWORD)v287 + 44) ) { + // cur->offset_80 -> cur->offset_24->offset_56 -> cur->second->offset_56 std::ostream::operator<<(*(_DWORD *)&Str1d[v339 + 80] - (_DWORD)v274); if ( !v274 ) v274 = *(std::ostream::sentry **)&Str1d[v339 + 80]; @@ -25719,6 +25751,7 @@ LABEL_158: v287 = (std::ostream::sentry *)((char *)v287 + 1); v181 = ","; } + // RenderNonDefine - 40 v184 = std::operator<<>(v305, "],"); v185 = std::operator<<(v184, a8); v186 = std::operator<<>(v185, ","); @@ -25742,6 +25775,7 @@ LABEL_169: v222 = std::operator<<>((std::ostream::sentry *)(a6 + 8), "cs.pop()"); std::operator<<>(v222, a12); } + // RenderNonDefine - 45 return 0; } // 4261A0: variable 'v243' is possibly undefined