feat: 完善一些逻辑

This commit is contained in:
msojocs 2023-07-15 22:09:16 +08:00
parent 6513e930c9
commit 28874d0330
5 changed files with 166 additions and 67 deletions

View File

@ -69,6 +69,7 @@ namespace WXML
/* /*
Token Token
112 0x70
00 B6 BF 00 80 CC BF 00 01 00 00 00(?) 01 00 00 00(?) // 15 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 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字符串的 缓冲区起点) 38 F0 97 00 00 00 00 00 00 CC FA 00 CC F0 97 00 // 47(40是32字符串的 缓冲区起点)

View File

@ -208,7 +208,6 @@ namespace WXML
{ {
int v17 = 0; int v17 = 0;
char* v18 = &v16[0] + token.offset_16; char* v18 = &v16[0] + token.offset_16;
// offset_20第一次是3
while(token.offset_20 > v17) while(token.offset_20 > v17)
{ {
int v19 = *(uint8_t *)(v18 + v17) - 9; int v19 = *(uint8_t *)(v18 + v17) - 9;

View File

@ -80,7 +80,12 @@ namespace WXML {
// DealSingleTokenToOps - 15 // DealSingleTokenToOps - 15
if (a7) if (a7)
{ {
int v26; int v26 = 0;
for (auto &&i : v77)
{
v26 -= (i.offset_0 == 0) - 1;
}
if (v26 != a7) if (v26 != a7)
{ {
a5->offset_56 = -3; a5->offset_56 = -3;
@ -251,7 +256,7 @@ namespace WXML {
} }
else 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 ( if (
i->second.offset_20 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`"); 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); cur->offset_220.assign(v149);
} }
Stra = 0; 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`"); throw this->Error(a2, cur->offset_84, "wx:elif", "`wx:if not found, then something must be wrong`");
} }
cur->offset_244 = Stra;
Stra++; Stra++;
cur->offset_244 = v127;
cur->offset_220.assign(v149); cur->offset_220.assign(v149);
} }
} }
@ -769,9 +774,9 @@ namespace WXML {
a15); a15);
goto LABEL_74; 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; std::string v155;
a7->GetNextName(v155); a7->GetNextName(v155);
@ -841,6 +846,7 @@ namespace WXML {
std::map<std::string,std::string> * a15 std::map<std::string,std::string> * a15
) )
{ {
// RenderNonDefine - 0
if (a13 && this->offset_24.size()) if (a13 && this->offset_24.size())
{ {
a6 << "cs.push(\""; a6 << "cs.push(\"";
@ -873,6 +879,7 @@ namespace WXML {
return; return;
} // TEXTNODE end } // TEXTNODE end
// RenderNonDefine - 5
if (this->offset_0 == "wx-define" if (this->offset_0 == "wx-define"
|| this->offset_0 == "wx-import" || this->offset_0 == "wx-import"
|| this->offset_0 == "import" || this->offset_0 == "import"
@ -895,6 +902,9 @@ namespace WXML {
std::string v333; std::string v333;
std::string v336; std::string v336;
std::string v339; std::string v339;
std::string v259 = "";
int v274 = 0;
std::vector<std::pair<std::string, WXML::DOMLib::Token>> _v339;
if (this->offset_0 == "wx-repeat") if (this->offset_0 == "wx-repeat")
{ {
std::string target1 = "items"; std::string target1 = "items";
@ -1127,11 +1137,13 @@ namespace WXML {
a6 << a12; a6 << a12;
a6 << "_2z(z,"; a6 << "_2z(z,";
a6 << this->offset_48[target1].offset_56 << ","; a6 << this->offset_48[target1].offset_56 << ",";
a6 << name1 << "," << a8 << "," << a9 << "," << a10 << "," << a5 << ","; a6 << name1 << "," << a8 << "," << a9 << "," << a10 << "," << a5 << ",'";
a6 << target3_1 << "," << target2_1 << ","; a6 << target3_1 << "','" << target2_1 << "','";
a6 << this->offset_48[wxKey].ToAttrContent() << ")" << a12; a6 << this->offset_48[wxKey].ToAttrContent() << "')" << a12;
goto LABEL_84; goto LABEL_84;
} // wx-repeat end } // wx-repeat end
// RenderNonDefine - 10
if (this->offset_0 == "block") if (this->offset_0 == "block")
{ {
@ -1169,6 +1181,7 @@ namespace WXML {
} }
return; return;
} }
// RenderNonDefine - 15
if (this->offset_0 == "wx-template") if (this->offset_0 == "wx-template")
{ {
v281 = this->offset_48.find("is"); 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_8 << ",";
a6 << this->offset_48["is"].offset_12 << ","; a6 << this->offset_48["is"].offset_12 << ",";
a6 << ")" << a12; a6 << ")" << a12;
LABEL_84: LABEL_84:
goto LABEL_169; goto LABEL_169;
} }
// RenderNonDefine - 20
// l:25109
for (auto j = this->offset_48.begin(); j != this->offset_48.end(); j++) for (auto j = this->offset_48.begin(); j != this->offset_48.end(); j++)
{ {
/* code */ /* code */
@ -1270,11 +1283,11 @@ namespace WXML {
v324.emplace_back(j->first, j->second); v324.emplace_back(j->first, j->second);
} }
} }
// RenderNonDefine - 25
std::sort(v324.begin(), v324.end(), WXML::DOMLib::AttrsCompartor); std::sort(v324.begin(), v324.end(), WXML::DOMLib::AttrsCompartor);
for (auto k = v324.begin(); k != v324.end(); k++) for (auto k = v324.begin(); k != v324.end(); k++)
{ {
/* code */
v330.insert(k->first); v330.insert(k->first);
} }
for (auto m = 0; m < v324.size(); m++) for (auto m = 0; m < v324.size(); m++)
@ -1296,12 +1309,17 @@ namespace WXML {
} }
} }
// RenderNonDefine - 30
v327 = ss.str(); v327 = ss.str();
// if (v328) if (v327.length() > 0)
// { {
std::string v339 = a5;
// } v339.append(".rawAttr={");
if (v324.end() - v324.begin() <= 0x88) v339.append(v327);
v339.append("};");
v327 = v339;
}
if (v324.end() - v324.begin() <= 1)
{ {
a6 << "var " << a5 << "=_n('"; a6 << "var " << a5 << "=_n('";
a6 << this->offset_0 << "')" << a12; a6 << this->offset_0 << "')" << a12;
@ -1344,29 +1362,76 @@ namespace WXML {
} }
} }
// RenderNonDefine - 35
a6 << "var " << a5 << "=_mz(z,'" << this->offset_0 << "',["; a6 << "var " << a5 << "=_mz(z,'" << this->offset_0 << "',[";
v259 = "";
for (auto jj = v324.begin(); jj < v324.end(); jj++) 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 << "],["; a6 << "],[";
// while (/* condition */) v259 = "";
// { for (auto &&i : _v339)
// /* code */ {
// } 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; a6 << "]," << a8 << "," << a9 << "," << a10 << ")" << a12;
LABEL_164: LABEL_164:
// if (v328) if (v327.length() > 0)
// a6 << v327; a6 << v327;
this->RenderChildren(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); this->RenderChildren(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15);
// if ((a14 & 1) != 0) if ((a14 & 1) != 0)
// this->AddTestAttr(a5, a6, '\n'/*10*/); this->AddTestAttr(a5, a6, '\n'/*10*/);
LABEL_169: LABEL_169:
if (a13 && this->offset_24.size()) if (a13 && this->offset_24.size())
{ {
a6 << "cs.pop()" << a12; a6 << "cs.pop()" << a12;
} }
// RenderNonDefine - 45
} }
void WXMLDom::RecordAllPath(void) void WXMLDom::RecordAllPath(void)

View File

@ -40,7 +40,7 @@ namespace WXML
} }
else else
{ {
a2 << WXML::EXPRLib::OPShort::CONST << ",'"; a2 << WXML::EXPRLib::OPShort::CONST << ",";
std::string v33 = this->offset_24.GetLiteral(); std::string v33 = this->offset_24.GetLiteral();
a2 << v33; a2 << v33;

View File

@ -24602,6 +24602,7 @@ int __thiscall WXML::DOMLib::WXMLDom::RenderNonDefine(
int a14, int a14,
int a15) int a15)
*/ */
// RenderNonDefine - 0
// this int // this int
// this + 28 => this.offset_28 // this + 28 => this.offset_28
if ( a13 && *(_DWORD *)(this + 28) ) if ( a13 && *(_DWORD *)(this + 28) )
@ -24666,6 +24667,7 @@ LABEL_69:
std::operator<<<std::char_traits<char>>(v87, a12); std::operator<<<std::char_traits<char>>(v87, a12);
goto LABEL_169; goto LABEL_169;
} // TEXTNODE end } // TEXTNODE end
// RenderNonDefine - 5
if ( !(unsigned __int8)std::operator!=<char>(this, "wx-define") if ( !(unsigned __int8)std::operator!=<char>(this, "wx-define")
|| !(unsigned __int8)std::operator!=<char>(this, "wx-import") || !(unsigned __int8)std::operator!=<char>(this, "wx-import")
|| !(unsigned __int8)std::operator!=<char>(this, "import") || !(unsigned __int8)std::operator!=<char>(this, "import")
@ -24991,23 +24993,23 @@ LABEL_69:
} }
} }
/* /*
int this, int this,
int *a2, int *a2,
int *a3, int *a3,
int a4, int a4,
int *a5, int *a5,
int a6, int a6,
int *a7, int *a7,
int *a8, int *a8,
int *a9, int *a9,
int *a10, int *a10,
int *a11, int *a11,
char a12, char a12,
unsigned __int8 a13, unsigned __int8 a13,
int a14, int a14,
int a15) int a15)
*/ */
LABEL_189: LABEL_189:
if ( !std::operator==<char>((int)&v336, "*this") ) if ( !std::operator==<char>((int)&v336, "*this") )
{ {
@ -25030,28 +25032,28 @@ LABEL_69:
goto LABEL_191; // LABEL_56 goto LABEL_191; // LABEL_56
} }
} }
LABEL_56: LABEL_56:
std::string::_M_dispose((void **)&v339); std::string::_M_dispose((void **)&v339);
std::string::_M_dispose((void **)&v336); std::string::_M_dispose((void **)&v336);
/* /*
int this, int this,
int *a2, int *a2,
int *a3, int *a3,
int a4, int a4,
int *a5, int *a5,
int a6, int a6,
int *a7, int *a7,
int *a8, int *a8,
int *a9, int *a9,
int *a10, int *a10,
int *a11, int *a11,
char a12, char a12,
unsigned __int8 a13, unsigned __int8 a13,
int a14, int a14,
int a15) int a15)
*/ */
LABEL_57: LABEL_57:
v241 = (std::ostream::sentry *)(a6 + 8); v241 = (std::ostream::sentry *)(a6 + 8);
if ( *(_BYTE *)(this + 256) ) if ( *(_BYTE *)(this + 256) )
{ {
@ -25100,6 +25102,8 @@ LABEL_57:
v72 = v312; v72 = v312;
goto LABEL_84; goto LABEL_84;
} // wx-repeat end } // wx-repeat end
// RenderNonDefine - 10
if ( std::operator==<char>(this, "block") ) if ( std::operator==<char>(this, "block") )
{ {
WXML::DOMLib::WXMLDom::RenderChildren(a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15); 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 = ");"; v242 = ");";
goto LABEL_68; goto LABEL_68;
} }
// RenderNonDefine - 15
v270 = std::operator==<char>(this, "wx-template"); v270 = std::operator==<char>(this, "wx-template");
if ( v270 ) if ( v270 )
{ {
@ -25364,10 +25369,11 @@ LABEL_9:
std::string::_M_dispose((void **)&Str); std::string::_M_dispose((void **)&Str);
std::string::_M_dispose((void **)&v336); std::string::_M_dispose((void **)&v336);
v72 = (void **)&v333; v72 = (void **)&v333;
LABEL_84: LABEL_84:
std::string::_M_dispose(v72); std::string::_M_dispose(v72);
goto LABEL_169; goto LABEL_169;
} }
// RenderNonDefine - 20
v324 = 0; v324 = 0;
v325 = 0; v325 = 0;
v326 = 0; v326 = 0;
@ -25424,6 +25430,7 @@ LABEL_84:
std::pair<std::string,WXML::DOMLib::Token>::~pair((void **)v347); std::pair<std::string,WXML::DOMLib::Token>::~pair((void **)v347);
} }
} }
// RenderNonDefine - 25
std::sort< std::sort<
__gnu_cxx::__normal_iterator<std::pair<std::string,WXML::DOMLib::Token> *, __gnu_cxx::__normal_iterator<std::pair<std::string,WXML::DOMLib::Token> *,
std::vector<std::pair<std::string,WXML::DOMLib::Token>>>, std::vector<std::pair<std::string,WXML::DOMLib::Token>>>,
@ -25523,6 +25530,7 @@ LABEL_84:
} }
} }
} }
// RenderNonDefine - 30
std::stringbuf::str((int)v342, (int)v349); std::stringbuf::str((int)v342, (int)v349);
std::string::operator=((unsigned __int8 **)&v327, (int)v342); std::string::operator=((unsigned __int8 **)&v327, (int)v342);
std::string::_M_dispose((void **)v342); std::string::_M_dispose((void **)v342);
@ -25638,8 +25646,13 @@ LABEL_158:
std::string::_M_dispose((void **)&Str); std::string::_M_dispose((void **)&Str);
} }
} }
// RenderNonDefine - 35
v339 = 0; v339 = 0;
v340 = 0; v340 = 0;
/*
int v341[4]; // [esp+214h] [ebp-174h] BYREF
int v342[2];
*/
v341[0] = 0; v341[0] = 0;
v175 = std::operator<<<std::char_traits<char>>(v305, "var "); v175 = std::operator<<<std::char_traits<char>>(v305, "var ");
v176 = std::operator<<<char>(v175, a5); v176 = std::operator<<<char>(v175, a5);
@ -25648,7 +25661,8 @@ LABEL_158:
std::operator<<<std::char_traits<char>>(v178, (char *)off_553DAF); std::operator<<<std::char_traits<char>>(v178, (char *)off_553DAF);
v274 = 0; v274 = 0;
v259 = (char *)&byte_5537CA; 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; Str1c = (char *)*jj;
v342[0] = (int)&v343; v342[0] = (int)&v343;
@ -25659,10 +25673,24 @@ LABEL_158:
std::string::_M_assign((int)v342, (int)jj); std::string::_M_assign((int)v342, (int)jj);
if ( !strncmp(Str1c, "generic:", 8u) ) 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); WXML::DOMLib::Token::Token((int)&v345, (WXML::DOMLib::Token *)(jj + 6), v244);
std::string::basic_string((void **)v347, Str); std::string::basic_string((void **)v347, Str);
WXML::DOMLib::Token::Token(v350, (int)&v345); WXML::DOMLib::Token::Token(v350, (int)&v345);
/*
std::pair<std::string,WXML::DOMLib::Token> - 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<std::pair<std::string,WXML::DOMLib::Token>>::emplace_back<std::pair<std::string,WXML::DOMLib::Token>>( std::vector<std::pair<std::string,WXML::DOMLib::Token>>::emplace_back<std::pair<std::string,WXML::DOMLib::Token>>(
&v339, &v339,
v347); v347);
@ -25682,8 +25710,10 @@ LABEL_158:
v179 = std::operator<<<std::char_traits<char>>(v305, "'"); v179 = std::operator<<<std::char_traits<char>>(v305, "'");
v180 = std::operator<<<char>(v179, v342); v180 = std::operator<<<char>(v179, v342);
std::operator<<<std::char_traits<char>>(v180, "',"); std::operator<<<std::char_traits<char>>(v180, "',");
// jj->offset_44 -> jj->offset_24->offset_20
if ( jj[11] ) if ( jj[11] )
{ {
// jj->offset_80 -> jj->offset_24->offset_56
std::ostream::operator<<(jj[20] - (_DWORD)v274); std::ostream::operator<<(jj[20] - (_DWORD)v274);
if ( !v274 ) if ( !v274 )
v274 = (std::ostream::sentry *)jj[20]; v274 = (std::ostream::sentry *)jj[20];
@ -25706,8 +25736,10 @@ LABEL_158:
Str1d = (char *)(136 * (_DWORD)v287); Str1d = (char *)(136 * (_DWORD)v287);
v183 = std::operator<<<char>(v182, (int *)(v339 + 136 * (_DWORD)v287)); v183 = std::operator<<<char>(v182, (int *)(v339 + 136 * (_DWORD)v287));
std::operator<<<std::char_traits<char>>(v183, "',"); std::operator<<<std::char_traits<char>>(v183, "',");
// cur->offset_44
if ( *(_DWORD *)(v339 + 136 * (_DWORD)v287 + 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); std::ostream::operator<<(*(_DWORD *)&Str1d[v339 + 80] - (_DWORD)v274);
if ( !v274 ) if ( !v274 )
v274 = *(std::ostream::sentry **)&Str1d[v339 + 80]; v274 = *(std::ostream::sentry **)&Str1d[v339 + 80];
@ -25719,6 +25751,7 @@ LABEL_158:
v287 = (std::ostream::sentry *)((char *)v287 + 1); v287 = (std::ostream::sentry *)((char *)v287 + 1);
v181 = ","; v181 = ",";
} }
// RenderNonDefine - 40
v184 = std::operator<<<std::char_traits<char>>(v305, "],"); v184 = std::operator<<<std::char_traits<char>>(v305, "],");
v185 = std::operator<<<char>(v184, a8); v185 = std::operator<<<char>(v184, a8);
v186 = std::operator<<<std::char_traits<char>>(v185, ","); v186 = std::operator<<<std::char_traits<char>>(v185, ",");
@ -25742,6 +25775,7 @@ LABEL_169:
v222 = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a6 + 8), "cs.pop()"); v222 = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a6 + 8), "cs.pop()");
std::operator<<<std::char_traits<char>>(v222, a12); std::operator<<<std::char_traits<char>>(v222, a12);
} }
// RenderNonDefine - 45
return 0; return 0;
} }
// 4261A0: variable 'v243' is possibly undefined // 4261A0: variable 'v243' is possibly undefined