feat: 完善CompileLazy

This commit is contained in:
msojocs 2023-07-03 22:29:08 +08:00
parent 7be7c0c473
commit 91d1768c96
11 changed files with 732 additions and 140 deletions

View File

@ -46,7 +46,9 @@
"typeinfo": "cpp",
"cstring": "cpp",
"map": "cpp",
"set": "cpp"
"set": "cpp",
"ctime": "cpp",
"iomanip": "cpp"
},
"cmake.debugConfig": {
"cwd": "/mnt/d/Work/WeChatProjects/miniprogram-demo/miniprogram",

9
src/include/wcc.h Normal file
View File

@ -0,0 +1,9 @@
#ifndef __MAIN_H__
#define __MAIN_H__
#include <iostream>
#include <map>
std::string DictToJsonString(std::map<std::string,std::string> const&);
std::string EscapeToJsonString(std::string const&);
#endif

View File

@ -221,11 +221,29 @@ namespace WXML
public:
StrCache(/* args */);
~StrCache();
void RenderPathDefine(std::stringstream ss);
void RenderPathDefine(std::stringstream &ss);
void Insert(std::string);
int GetStrID(std::string);
};
class RVMOpCodePosition
{
private:
/* data */
public:
RVMOpCodePosition(/* args */);
~RVMOpCodePosition();
};
class RVMOpCodePositionRecorder
{
private:
/* data */
public:
RVMOpCodePositionRecorder(/* args */);
~RVMOpCodePositionRecorder();
};
class WXMLDom
{
private:
@ -239,7 +257,9 @@ namespace WXML
int offset_104; // len
int offset_140;
std::string offset_144;
StrCache offset_248;
std::string offset_196;
std::string offset_220;
int offset_244;
int componentCnt = 0;
public:
std::string offset_0; // type
@ -247,8 +267,10 @@ namespace WXML
std::string offset_24; // ???
std::map<std::string, WXML::DOMLib::Token> offset_48;
std::vector<std::shared_ptr<WXML::DOMLib::WXMLDom>> offset_72; //
int offset_256; // ???
WXML::DOMLib::Token offset_84; // token
StrCache offset_248;
int offset_256; // ???
std::map<std::string, std::string> offset_272;
WXMLDom(/* args */);
~WXMLDom();
std::string Error(
@ -321,10 +343,18 @@ namespace WXML
bool HasSpAttrPrefix(void);
void MarkIfHasDescendant(std::vector<std::string> const&);
void CutDomsForCustomComponent(std::vector<std::string> const&);
void RenderAllOpsAndRecord(
std::string const&,
std::string&,
std::stringstream &,
std::map<std::string,WXML::DOMLib::RVMOpCodePosition> &,
WXML::DOMLib::RVMOpCodePositionRecorder *,
bool,
const std::map<std::string,std::string> &);
};
void recurseDependencies(WXML::DOMLib::WXMLDom const&,std::string const&,std::set<std::string> &);
void recurseDependencies(std::shared_ptr<WXML::DOMLib::WXMLDom> const&,std::string const&,std::set<std::string> &);
class Parser
{
@ -410,30 +440,27 @@ namespace WXML
std::string const&, // "$gdwx"
std::string const& // "f_"
);
std::string Compile(
std::map<std::string,std::string> const&,
std::string&,
std::map<std::string,std::string>&,
std::map<std::string,std::string>&,
std::map<std::string, std::vector<std::string>>,
std::allocator<std::pair<const std::string, std::string>>,
std::string const&,
std::map<std::string,std::string> 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 Compile(
std::map<std::string,std::string> const&,// a1
std::string&, // a2
std::string&, // a3
std::map<std::string, std::vector<std::string>>,// a4
std::map<std::string,std::string> const&,// a5
bool,// a6
std::string const& gwxMark,// a7
uint mark, // a8
char lineEndMark, // a9
std::string const&, // a10
std::string const&, // a11
std::string const& , // a12
std::string const& ggMark, // a13
std::string const& eMark, // a14
std::string const& dMark, // a15
std::string const& pMark, // a16
std::string const& endMark, // a17
std::string const& boxMark, // a18
std::string const& gdwxMark, // a19
std::string const& fMark); // a20
int DealWxsTag(
std::string const& a1,

View File

@ -1,12 +1,14 @@
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include "include/file.h"
#include "include/usage.h"
#include "include/string_utils.h"
#include "include/wxml.h"
#include "include/wcc.h"
using namespace std;
@ -15,7 +17,7 @@ int main(int argc, const char **argv)
try
{
// main - 0
string gwxMark = "$gwx";
string splitMarkStr = " ";
bool hasConfigParam = false;
@ -23,6 +25,7 @@ int main(int argc, const char **argv)
vector<string> paramList;
string configData;
// main - 5
// 第一个参数是程序路径,忽略
for (int i = 1; i < argc; i++)
{
@ -43,6 +46,7 @@ int main(int argc, const char **argv)
}
}
// main - 10
// 有配置文件,从配置文件解析
if (hasConfigParam)
{
@ -56,6 +60,7 @@ int main(int argc, const char **argv)
}
}
}
// main - 15
int mark = 0;
bool isReadFromStdin = false;
bool version = false;
@ -70,6 +75,7 @@ int main(int argc, const char **argv)
map<string, string> mapData1;
map<string, string> fileContentMap;
map<string, vector<string>> componentListMap;
// main - 20
for (int i = 0; i < paramList.size(); i++)
{
string param = paramList[i];
@ -259,6 +265,7 @@ int main(int argc, const char **argv)
}
}
// main - 25
if (version)
{
std::string versionInfo;
@ -272,12 +279,14 @@ int main(int argc, const char **argv)
}
}
// main - 30
if (fileList.empty())
{
usage(argc, argv);
return 0;
}
// main - 35
if (isReadFromStdin)
{
string content;
@ -296,6 +305,7 @@ int main(int argc, const char **argv)
}
}
// main - 40
// 此if条件x64dbg得出
if (!xc_Or_completeCode_Param.empty())
{
@ -327,6 +337,7 @@ int main(int argc, const char **argv)
}
componentListMap["ALL"] = allComponentList;
}
// main - 45
//
if (hasLL)
@ -371,19 +382,7 @@ int main(int argc, const char **argv)
"boxofchocolate",
"$gdwx",
"f_");
// while(!outputMap1.empty())
// {
// /**
// * v60可能值 0xF30D70:0xF30DB8:"miniprogram_npm/miniprogram-recycle-view/recycle-view"
// */
// // if(v60 == "__COMMON__")
// // {
// // }
// }
// if()
if (1)
if (outputContentMap.count("__COMMON__") == 0)
{
string helperCode;
WXML::Compiler::WXMLHelperCode(helperCode);
@ -406,63 +405,64 @@ int main(int argc, const char **argv)
"var Behavior=Behavior||function(){};var __vd_version_info__=__vd_version_info__||{};var __GWX_GLOBAL__=__GWX_G"
"LOBAL__||{};var __globalThis=(typeof __vd_version_info__!=='undefined'&&typeof __vd_version_info__.globalThis!"
"=='undefined')?__vd_version_info__.globalThis:(typeof window!=='undefined'?window:globalThis);";
commonData += helperCode;
commonData = commonData + helperCode;
commonData = commonData.append(outputContentMap["__COMMON__"]);
outputContentMap["__COMMON__"] = commonData;
}
string dep = ";var __WXML_DEP__=__WXML_DEP__||{};";
// TODO: 起始并不是0
for (string j = "";;)
{
/* code */
if (j == "")
break;
if (j[11] != j[10])
{
stringstream dep;
dep << "__WXML_DEP__[\"";
dep << "\"]=[";
for (int k = 0; k < 10; k++)
dep << ";var __WXML_DEP__=__WXML_DEP__||{};";
// dependencyListMap v121
for (auto j = dependencyListMap.begin(); j != dependencyListMap.end(); j++)
{
if (j->second.begin() != j->second.end())
{
dep << "__WXML_DEP__[\"";
dep << j->first;
dep << "\"]=[";
auto list = j->second;
for (auto k = list.begin(); k != list.end(); k++)
{
/* code */
dep << "\"";
dep << WXML::Rewrite::ToStringCode(*k);
dep << "\",";
}
dep << "];";
}
}
// ???
outputContentMap["__COMMON__"].append("");
std::string v140 = dep.str();
outputContentMap["__COMMON__"].append(v140);
if (compilerResult)
{
// CompileLazy出现异常
// 标准错误输出
fprintf(stderr, "Error %d: %s\n", 1, "123");
fprintf(stderr, "Error %d: %s\n", 1, errorMessage.data());
}
else
{
FILE *f = stdout;
if (!outputFileName.empty())
f = fopen(outputFileName.c_str(), "w");
// DictToJsonString
// DictToJsonString
fprintf(f, " {\"generateFunctionContent\":%s,\"generateFunctionName\":%s} ", "", "");
auto v136 = DictToJsonString(outputContentMap);
auto v137 = DictToJsonString(outputFuncMap);
fprintf(f, " {\"generateFunctionContent\":%s,\"generateFunctionName\":%s} ", v136.data(), v137.data());
fclose(f);
}
}
// main - 50
else
{
std::string errorMessage;
const char off_5403C3[] = {'s', '\0', 'e', '\0'};
int compilerResult = 0;
// compilerResult = WXML::Compiler::Compile(
// v3,
// &v107,
// (int *)v111,
// errorMessage
// (unsigned __int8 **)v113,
// v126,
// &v105,
@ -484,19 +484,20 @@ int main(int argc, const char **argv)
if (compilerResult)
{
f = stderr;
fprintf(f, "%s\n", "error...");
fprintf(f, "%s\n", errorMessage.data());
}
else
{
f = stdout;
if (!outputFileName.empty())
{
f = fopen(outputFileName.c_str(), "w");
f = fopen(outputFileName.data(), "w");
}
fprintf(f, "%s\n", "result...");
fclose(f);
}
}
// main - 55
}
catch (const std::exception &e)
{
@ -505,3 +506,50 @@ int main(int argc, const char **argv)
return 0;
}
std::string DictToJsonString(std::map<std::string, std::string> const& a2)
{
std::stringstream ret;
ret << "{";
bool isFirst = true;
for(auto kv: a2)
{
if (!isFirst)
{
ret << ",";
}
ret << "\"";
// key
ret << EscapeToJsonString(kv.first);
ret << "\":";
ret << "\"";
// value
ret << EscapeToJsonString(kv.second);
ret << "\"";
isFirst = false;
}
ret << "}";
return ret.str();
}
std::string EscapeToJsonString(std::string const& a2)
{
stringstream ret;
for (int i = 0; i < a2.length(); i++)
{
char cur = a2[i];
if (cur == '\\' || cur == '"' || cur <= 0x1Fu)
{
ret << "\\u";
ret << std::hex << std::setw(4) << std::setfill('0')<< cur;
}
else
{
ret << cur;
}
}
return ret.str();
}

View File

@ -236,7 +236,7 @@ namespace WXML{
(mark & 0x20) != 0); // a13
}
// mark - 5
std::shared_ptr<std::stringstream> v301_localCommonStream1; // v301
std::shared_ptr<std::stringstream> v301_localCommonStream1(new std::stringstream()); // v301
ssDataMap["__COMMON__"] = v301_localCommonStream1;
std::vector<std::string> commonVec;
v307_localVecStrMap1["__COMMON__"] = commonVec;
@ -244,7 +244,7 @@ namespace WXML{
// mark - 10
for (int i = 0; i < splitedData.size(); i++)
{
std::shared_ptr<std::stringstream> v328_ss;
std::shared_ptr<std::stringstream> v328_ss(new std::stringstream());
auto it = ssDataMap.lower_bound(splitedData[i]);
if (it == ssDataMap.end())
{
@ -307,7 +307,7 @@ namespace WXML{
for (auto i = v304.begin(); i != v304.end(); i++)
{
std::set<std::string> v328;
WXML::DOMLib::recurseDependencies(*i->second, i->first, v328);
WXML::DOMLib::recurseDependencies(i->second, i->first, v328);
// TODO: ...
}
// mark - 45
@ -357,23 +357,376 @@ namespace WXML{
{
jj = "__globalThis";
}
std::string v328;
WXML::Compiler::GetVersionInfo(v328, jj);
*v301_localCommonStream1 << v328 << std::endl;
// WXML::NameAllocator::NameAllocator();
std::string verInfo;
WXML::Compiler::GetVersionInfo(verInfo, jj);
*v301_localCommonStream1 << verInfo << std::endl;
WXML::NameAllocator v328(strEndMark, boxMark);
*v301_localCommonStream1 << "var $gwxc" << lineEndMark << "var $gaic={}" << lineEndMark;
if (!isLLA)
*v301_localCommonStream1 << "var outerGlobal=typeof __globalThis==='undefined'?window:__globalThis;";
// mark - 55
// for (size_t i = 0; i < count; i++)
// {
// /* code */
// }
int v224 = 0;
for (auto i = ssDataMap.begin(); i != ssDataMap.end(); i++)
{
std::string v318;
bool v225 = i->first == "__COMMON__";
if (v225)
{
v318 = gwxMark;
}
else
{
v318 = gwxMark + "_XC_" + std::to_string(v224);
v224++;
}
outputFuncMap[i->first].assign(v318);
auto ss = i->second;
if ((mark & 2) != 0)
{
*ss << "var cs = cs || [];" << lineEndMark;
}
*ss << v318;
*ss << "=function(_,_v,_n,_p,_s,_wp,_wl,$gwn,$gwl,$gwh,wh,$gstack,$gwrt,gra,grb,TestTest,wfor,_ca,_da,_r,_rz,_o,_oz,";
*ss << "_1,_1z,_2,_2z,_m,_mz,nv_getDate,nv_getRegExp,nv_console,nv_parseInt,nv_parseFloat,nv_isNaN,nv_isFinite,nv_de";
*ss << "codeURI,nv_decodeURIComponent,nv_encodeURI,nv_encodeURIComponent,$gdc,nv_JSON,_af,_gv,_ai,_grp,_gd,_gapi,$ix";
*ss << "c,_ic,_w,_ev,_tsd){";
*ss << "return function(path,global){" << lineEndMark;
*ss << "if(typeof global==='undefined'){if (typeof __GWX_GLOBAL__==='undefined')global={};else global=__GWX_GLOBAL__;}" << lineEndMark;
*ss << "if(typeof __WXML_GLOBAL__ === 'undefined') {";
*ss << "__WXML_GLOBAL__={};" << lineEndMark;
if ((mark & 0x80) != 0)
{
// TODO
}
*ss << "}";
*ss << "__WXML_GLOBAL__.modules = __WXML_GLOBAL__.modules || {};" << lineEndMark;
if (v225 && gwxMark == "$gwx" && (mark & 0x60) == 0)
{
*ss << "$gwx('init', global);" << lineEndMark;
}
*ss << "var " << eMark << "=global.entrys;" << lineEndMark;
*ss << "var " << dMark << "={}" << lineEndMark;
*ss << "if(typeof(global.defines)==='undefined')global.defines={};" << dMark << "=global.defines;" << lineEndMark;
*ss << "var " << fMark << "={}" << lineEndMark;
*ss << "if(typeof(global.modules)==='undefined')global.modules={};" << fMark << "=global.modules || {};" << lineEndMark;
*ss << "var " << pMark << "={}" << lineEndMark;
if ((mark & 2) != 0)
{
*ss << "var cs = cs || [];" << lineEndMark;
}
*ss << "__WXML_GLOBAL__.ops_cached = __WXML_GLOBAL__.ops_cached || {}" << lineEndMark;
*ss << "__WXML_GLOBAL__.ops_set = __WXML_GLOBAL__.ops_set || {};" << lineEndMark;
*ss << "__WXML_GLOBAL__.ops_init = __WXML_GLOBAL__.ops_init || {};" << lineEndMark;
*ss << "var z=__WXML_GLOBAL__.ops_set." << v318 << " || [];" << lineEndMark;
if ((mark & 4) != 0)
{
*ss << "__WXML_GLOBAL__.debuginfo_set = __WXML_GLOBAL__.debuginfo_set || {};" << lineEndMark;
*ss << "var debugInfo=__WXML_GLOBAL__.debuginfo_set." << v318 << " || [];" << lineEndMark;
}
// i->first v248
auto v97 = v307_localVecStrMap1[i->first];
int cnt = 0;
for (auto i = v97.begin(); i != v97.end(); i++)
{
std::shared_ptr<WXML::DOMLib::WXMLDom> v244 = v304[*i];
cnt++;
std::string v98 = std::to_string(cnt);
std::string v321 = v318 + "_" + v98;
std::string j = "gz" + v321; // 可能有点问题
*ss << "function " << j << "(){" << lineEndMark;
*ss << "if( __WXML_GLOBAL__.ops_cached." << v321 << ")";
*ss << "return __WXML_GLOBAL__.ops_cached." << v321 << lineEndMark;
*ss << "__WXML_GLOBAL__.ops_cached." << v321 << "=[];" << lineEndMark;
*ss << "(function(z){var a=11;";
if ((mark & 4) != 0)
{
*ss << "function Z(ops,debugLine){z.push(['11182016',ops,debugLine])}";
}
else
{
*ss << "function Z(ops){z.push(ops)}";
}
*ss << lineEndMark;
// TODO: RenderAllOpsAndRecord
*ss << "})(__WXML_GLOBAL__.ops_cached." << v321 << ");";
*ss << "return __WXML_GLOBAL__.ops_cached." << v321 << lineEndMark;
*ss << "}" << lineEndMark;
v244->offset_272["get_page_z_name"].assign(j);
}
*ss << "__WXML_GLOBAL__.ops_set." << v318 << "=z;" << lineEndMark;
*ss <<"__WXML_GLOBAL__.ops_init." << v318 << "=true;" << lineEndMark;
if ((mark & 4) != 0)
{
*ss << "__WXML_GLOBAL__.debuginfo_set." << v318 << "=debugInfo;" << lineEndMark;
}
if (v225)
{
*ss << "var nv_require=function(){var nnm={";
for (auto i = v311.begin(); i != v311.end(); i++)
{
*ss << '"';
*ss << WXML::Rewrite::ToStringCode(i->first);
*ss << '"';
*ss << ":np_" << i->second << ",";
}
*ss << "};var nom={};return function(n){";
*ss << "if(n[0]==='p'&&n[1]==='_'&&f_[n.slice(2)])return f_[n.slice(2)];";
*ss << "return function(){if(!nnm[n]) return undefined;";
*ss << "try{if(!nom[n])nom[n]=nnm[n]();return nom[n];}";
*ss << "catch(e){";
*ss << "e.message=e.message.replace(/nv_/g,'');";
*ss << "var tmp = e.stack.substring(0,e.stack.lastIndexOf(n));";
*ss << "e.stack = tmp.substring(0,tmp.lastIndexOf('\\n'));";
*ss << "e.stack = e.stack.replace(/\\snv_/g,' ');";
*ss << "e.stack = $gstack(e.stack);";
*ss << "e.stack += '\\n at ' + n.substring(2);console.error(e);}";
*ss << lineEndMark;
*ss << "}}}()" << lineEndMark;
for (auto i = v309.begin(); i != v309.end(); i++)
{
*ss << i->second << lineEndMark;
}
}
// test/wcc.disassembly.cpp line 14346
auto v133 = v307_localVecStrMap1[i->first];
WXML::DOMLib::StrCache v319;
for (auto i1 = v133.begin(); i1 != v133.end(); i1++)
{
v319.Insert(*i1);
auto v134 = v304[*i1];
v134->offset_248 = v319;
v134->RecordAllPath();
}
v319.RenderPathDefine(*ss);
auto v136 = v307_localVecStrMap1[i->first];
int v228 = 0;
for (auto i2 = v136.begin(); i2 != v136.end(); i2++)
{
auto v256 = v304[*i2];
*ss << dMark << "[x[";
auto StrID = v319.GetStrID(*i2);
*ss << StrID << "]]={}" << lineEndMark;
std::string v140 = v256->offset_272["get_page_z_name"];
std::map<std::string, std::string> v316;
int ret = WXML::Compiler::RenderDefine(
*v256,
*i2,
v316,
errorMessage, // a2
*ss,
mapData1,
(mark & 2) != 0, // v209
mark, // a11
lineEndMark,
eMark1,
charArr,
ggMark,
gwxMark,
eMark,
dMark,
pMark,
strEndMark,
boxMark,
gdwxMark,
v140
);
if (ret)
{
throw "error";
}
std::string jj = std::to_string(v228);
std::string v321 = jj.insert(0, "m");
std::string v271 = v256->offset_272["get_page_z_name"];
v256->RenderMeAsFunction(
*i2,
eMark,
errorMessage,
v321,
*ss,
&v328,
eMark1, // a13
charArr, // a14
ggMark, // a15
"r", // jj
dMark, // a17
lineEndMark, // a12
pMark, // a18
0,
(mark & 2) != 0,
mark,
v271
);
*ss << eMark << "[x[";
*ss << v319.GetStrID(*i2);
*ss << "]]={f:" << v321 << ",j:[],i:[],ti:[";
std::vector<std::shared_ptr<WXML::DOMLib::WXMLDom>> v146 = v256->offset_72;
bool isNeedComma = false;
for (int i = 0; i < v146.size(); i++)
{
std::shared_ptr<WXML::DOMLib::WXMLDom> item = v146[i];
if (item->offset_0 == "import")
{
auto v211 = item->offset_48.find("src");
if (v211 != item->offset_48.end())
{
if (isNeedComma)
{
*ss << ",";
}
*ss << "x[";
auto v148 = v211->second.ToAttrContent();
*ss << v319.GetStrID(v148);
*ss << "]";
isNeedComma = true;
}
}
}
*ss << "],ic:[";
// line 14507
isNeedComma = false;
for (int i = 0; i < v146.size(); i++)
{
std::shared_ptr<WXML::DOMLib::WXMLDom> item = v146[i];
if (item->offset_0 == "include")
{
auto v217 = item->offset_48.find("src");
if (v217 != item->offset_48.end())
{
if (isNeedComma)
{
*ss << ",";
}
*ss << "x[";
std::string v152 = v217->second.ToAttrContent();
*ss << v319.GetStrID(v152);
*ss << "]";
isNeedComma = true;
}
}
}
*ss << "}}" << lineEndMark;
}
*ss << "if(path&&" << eMark << "[path]){" << lineEndMark;
if (!isLLA)
{
*ss << "outerGlobal.__wxml_comp_version__=0.02" << lineEndMark;
}
*ss << "return function(env,dd,global){$gwxc=0;var root={\"tag\":\"wx-page\"};root.children=[]" << lineEndMark;
*ss << ";g=\"" << v318 << "\";" << "var main=" << eMark << "[path].f" << lineEndMark;
if ( (mark & 2) != 0)
{
*ss << "cs=[]" << lineEndMark;
}
if ((mark & 0x10) != 0)
{
*ss << "console.log(path+': benv:\\n'+JSON.stringify(env))" << lineEndMark;
}
*ss << "if (typeof global===\"undefined\")global={};";
*ss << "global.f=$gdc(" << fMark << "[path],\"\",1);" << lineEndMark;
if (!isLLA)
{
*ss << "if(typeof(outerGlobal.__webview_engine_version__)!='undefined'&&outerGlobal.__webview_engine_version__+1e";
*ss << "-6>=0.02+1e-6&&outerGlobal.__mergeData__)" << lineEndMark;
*ss << "{" << lineEndMark;
*ss << "env=outerGlobal.__mergeData__(env,dd);" << lineEndMark;
*ss << "}" << lineEndMark;
}
*ss << "try{" << lineEndMark;
if ((mark & 0x10) != 0)
{
*ss << "console.log(path+': aenv:\\n'+JSON.stringify(env)+', '+JSON.stringify(dd))" << lineEndMark;
}
if ( (mark & 0x80) != 0 )
{
*ss << "if(__WXML_GLOBAL__.before_calculate)" << "__WXML_GLOBAL__.before_calculate(path, env)" << lineEndMark;
}
*ss << "main(env,{},root,global);" << lineEndMark;
if ((mark & 0x80) != 0)
{
*ss << "if(__WXML_GLOBAL__.after_calculate)";
*ss << "__WXML_GLOBAL__.after_calculate(path, root)" << lineEndMark;
}
*ss << "_tsd(root)" << lineEndMark;
if (!isLLA)
{
*ss << "if(typeof(outerGlobal.__webview_engine_version__)=='undefined'|| outerGlobal.__webview_engine_version__+1";
*ss << "e-6<0.01+1e-6){return _ev(root);}" << lineEndMark;
}
*ss << "}catch(err){" << lineEndMark;
if ((mark & 2) != 0)
{
*ss << "console.log(cs, env);" << lineEndMark;
}
*ss << "console.log(err)" << lineEndMark;
if ((mark & 2) != 0)
{
*ss << "throw err" << lineEndMark;
}
*ss << "}" << lineEndMark;
if ((mark & 0x10) != 0)
{
*ss << "console.log(path+': resp:\\n'+JSON.stringify(root))" << lineEndMark;
}
*ss << ";g=\"\";" << lineEndMark;
*ss << "return root;" << lineEndMark;
*ss << "}" << lineEndMark;
*ss << "}" << lineEndMark;
*ss << "}" << lineEndMark;
*ss << "}(__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.";
*ss << "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.";
*ss << "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 ( (mark & 8) != 0 )
{
std::vector<std::string> v192 = v307_localVecStrMap1[i->first];
for (auto i4 = v192.begin(); i4 != v192.end(); i4++)
{
*ss << "//" << *i4 << ":" << lineEndMark;
v304[*i4]->Print(0, "//", ss.get());
}
}
auto v197 = v307_localVecStrMap1[i->first];
*ss << "if(__vd_version_info__.delayedGwx||";
std::string v198 = "true";
if (!( v225 || v197.size() > 0))
{
v198 = "false";
}
*ss << v198 << ")" << v318 << "();";
}
/*
std::map<std::string,std::string> const& fileContentMap, // a1
std::string& errorMessage, // 错误信息 a2
std::map<std::string,std::string>& outputContentMap, // 输出 a3
std::map<std::string,std::string>& outputFuncMap, // 输出 a4
std::map<std::string, std::vector<std::string>>& dependencyListMap, // a5
std::map<std::string, std::vector<std::string>>& componentListMap, // componentListMap a6
std::vector<std::string> const& splitedData, // splitedData a7
std::map<std::string,std::string> const& mapData1, // mapData1 a8
bool isLLA, // isLLA a9
std::string const& gwxMark, // gwxMark a10
uint mark, // mark a11
char lineEndMark, // '\n' a12
std::string const& eMark1, // 'e' a13
std::string const& charArr, // const char off_5403C3[] = {'s','\0','e','\0'} a14
std::string const& ggMark, // "gg" a15
std::string const& eMark, // "e_" a16
std::string const& dMark, // "d_" a17
std::string const& pMark, // "p_" a18
std::string const& strEndMark, // '\0' a19
std::string const& boxMark, // "boxofchocolate" a20
std::string const& gdwxMark, // "$gdwx" a21
std::string const& fMark // "f_" a22
*/
// mark - 60
// for (size_t i = 0; i < count; i++)
// {
// /* code */
// }
for (auto i = ssDataMap.begin(); i != ssDataMap.end(); i++)
{
auto jj = i->second->str();
outputContentMap[i->first] = jj;
}
// mark - 65
// }
@ -385,6 +738,30 @@ namespace WXML{
return 0;
}
int Compile(
std::map<std::string,std::string> const&,// a1
std::string&, // a2
std::string&, // a3
std::map<std::string, std::vector<std::string>>,// a4
std::map<std::string,std::string> const&,// a5
bool,// a6
std::string const& gwxMark,// a7
uint mark, // a8
char lineEndMark, // a9
std::string const&, // a10
std::string const&, // a11
std::string const& , // a12
std::string const& ggMark, // a13
std::string const& eMark, // a14
std::string const& dMark, // a15
std::string const& pMark, // a16
std::string const& endMark, // a17
std::string const& boxMark, // a18
std::string const& gdwxMark, // a19
std::string const& fMark) // a20
{
return 0;
}
int DealWxsTag(
std::string const& filePath,
WXML::DOMLib::Token & a2,

View File

@ -71,29 +71,24 @@ namespace WXML
return result;
}
void recurseDependencies(WXML::DOMLib::WXMLDom const& dom, std::string const& filePath, std::set<std::string> & pathSet)
void recurseDependencies(std::shared_ptr<WXML::DOMLib::WXMLDom> const& dom, std::string const& filePath, std::set<std::string> & pathSet)
{
std::string a1;
std::string a1 = dom->offset_0;
if (a1 == "import" || a1 == "include")
{
// TODO: map来源
std::map<std::string,WXML::DOMLib::Token> map;
if(map.count("src"))
if(dom->offset_48.count("src"))
{
std::string relativePath = map["src"].ToAttrContent();
std::string relativePath = dom->offset_48["src"].ToAttrContent();
std::string depPath = resolvePath(filePath, relativePath);
pathSet.insert(depPath);
}
}
for (int i = 0; ; i++)
for (int i = 0; i < dom->offset_72.size(); i++)
{
// if (i >= )
// break;
// recurseDependencies(, filePath, pathSet)
recurseDependencies(dom->offset_72[i], filePath, pathSet);
}
}
bool AttrsCompartor(std::pair<std::string,WXML::DOMLib::Token> const& a1,std::pair<std::string,WXML::DOMLib::Token> const& a2)

View File

@ -0,0 +1,19 @@
#include "../../include/wxml.h"
namespace WXML
{
namespace DOMLib
{
/**
*
*/
RVMOpCodePosition::RVMOpCodePosition(/* args */)
{
}
RVMOpCodePosition::~RVMOpCodePosition()
{
}
} // namespace DOMLib
} // namespace WXML

View File

@ -0,0 +1,20 @@
#include "../../include/wxml.h"
namespace WXML
{
namespace DOMLib
{
/**
*
*/
RVMOpCodePositionRecorder::RVMOpCodePositionRecorder(/* args */)
{
}
RVMOpCodePositionRecorder::~RVMOpCodePositionRecorder()
{
}
} // namespace DOMLib
} // namespace WXML

View File

@ -14,7 +14,7 @@ namespace WXML {
StrCache::~StrCache()
{
}
void StrCache::RenderPathDefine(std::stringstream ss)
void StrCache::RenderPathDefine(std::stringstream &ss)
{
ss << "var x=[";
// TODO...

View File

@ -657,8 +657,13 @@ namespace WXML {
}
}
}
void WXMLDom::Print(int, char const*, std::stringstream *)
void WXMLDom::Print(int a2, char const* a3, std::stringstream * a4)
{
this->PrintMe(a2, a3, a4);
for (int i = 0; i < this->offset_72.size(); i++)
{
this->Print(a2 + 1, a3, a4);
}
}
@ -745,7 +750,7 @@ namespace WXML {
void WXMLDom::PrintMe(
int a2,
char const* a3,
std::stringstream* a4)
std::stringstream * a4)
{
std::stringstream v34;
std::stringstream *v4 = &v34;
@ -794,22 +799,33 @@ namespace WXML {
{
*v4 << "attr: ";
}
// TODO: this + 60是什么
// for (size_t i = 0; i < count; i++)
// {
// /* code */
// }
for (auto j = this->offset_48.begin(); j != this->offset_48.end(); j++)
{
if (v4->tellp() != 0)
{
std::string v13 = j->second.ToString();
printf("%s->%s,", j->first.data(), v13.data());
}
else
{
*v4 << j->first << "->";
*v4 << j->second.ToString();
*v4 << " ";
*v4 << j->second.offset_0; // 待确认
*v4 << " ";
}
}
}
else if(v4->tellp() != 0)
{
//TODO: this+84是什么
printf(
"pos: %d, %d, len: %d, %s",
this->offset_92,
this->offset_96,
this->offset_104,
"TODO..."
this->offset_84.ToString().data()
);
}
else
@ -817,7 +833,37 @@ namespace WXML {
*v4 << "pos: " << this->offset_92
<< ", " << this->offset_96 << ", len: " << this->offset_104
<< ", ";
// *v4 << this->offset_84;
*v4 << this->offset_84.ToString();
}
if (v4->tellp() != 0)
{
printf(
"icn: %s, icc: %u, ivwn: %s",
this->offset_196.data(),
this->offset_244,
this->offset_220.data());
}
else
{
*v4 << "icn:" << this->offset_196 << ", icc: " << this->offset_244;
*v4 << ", ivwn: " << this->offset_220;
}
if (v4->tellp() != 0)
{
printf(", hasXComponentDescendant %d", this->offset_256);
}
else
{
*v4 << ", hasXComponentDescendant " << this->offset_256;
}
if (v4->tellp() != 0)
{
printf("\n");
}
else
{
*v4 << "\n";
}
}
@ -936,14 +982,17 @@ namespace WXML {
{
if (a2.size() > 0)
{
auto v4 = this->offset_72.size();
int v4 = this->offset_72.size();
while (--v4 >= 0)
{
this->MarkIfHasDescendant(a2);
auto v6 = this->offset_72[v4]->offset_0;
auto ret = std::find(a2.begin(), a2.end(), v6);
// 0x48 -> 72
this->offset_72[v4]->MarkIfHasDescendant(a2);
auto v6 = this->offset_72[v4];
this->offset_256 = v6->offset_256;
auto ret = std::find(a2.begin(), a2.end(), v6->offset_0);
if (ret != a2.end())
{
// HasDescendant
this->offset_256 = 1;
}
}
@ -956,7 +1005,7 @@ namespace WXML {
int v3 = this->offset_72.size();
while (--v3 >= 0)
{
this->CutDomsForCustomComponent(a2);
this->offset_72[v3]->CutDomsForCustomComponent(a2);
if (
this->offset_72[v3]->offset_0 != "include"
&& this->offset_72[v3]->offset_0 != "import"
@ -977,7 +1026,7 @@ namespace WXML {
{
this->offset_72.erase(this->offset_72.begin() + v3);
}
else if(v5->offset_72.size() == 8
else if(v5->offset_72.size() == 1
&& !v5->HasSpAttrPrefix())
{
auto v6 = this->offset_72[v3];

View File

@ -9009,12 +9009,12 @@ int __cdecl EscapeToJsonString(int a1, int a2)
lpuexcpt = (struct _Unwind_Exception *)((char *)lpuexcpt + 1) )
{
v2 = *(_BYTE *)lpuexcpt;
if ( *(_BYTE *)lpuexcpt == 92 || v2 == 34 || v2 <= 0x1Fu )
if ( *(_BYTE *)lpuexcpt == '\\'/*92*/ || v2 == '"'/*34*/ || v2 <= 0x1Fu )
{
v3 = (char *)std::operator<<<std::char_traits<char>>((std::ostream::sentry *)&v8, "\\u");
v4 = std::ostream::operator<<(v3, (void (__cdecl *)(char *))std::hex);
*(_DWORD *)&v4[*(_DWORD *)(*(_DWORD *)v4 - 12) + 8] = 4;
std::operator<<<char,std::char_traits<char>>(v4, 48);
std::operator<<<char,std::char_traits<char>>(v4, 48); // 48 -> '0'
std::ostream::operator<<(*(char *)lpuexcpt);
}
else
@ -14079,9 +14079,11 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
lpuexcptk,
"var outerGlobal=typeof __globalThis==='undefined'?window:__globalThis;");
v224 = 0;
// v301 ssDataMap
v233 = v303;
v209 = (a11 & 2) != 0;
// mark - 55
// v233 会递增
while ( v233 != v302 )
{
v243 = (WXML::EXPRLib::Parser *)v233[10];
@ -14128,6 +14130,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
std::operator<<<std::char_traits<char>>(lpuexcptl, "if(typeof __WXML_GLOBAL__ === 'undefined') {");
v61 = std::operator<<<std::char_traits<char>>(lpuexcptl, "__WXML_GLOBAL__={};");
std::operator<<<std::char_traits<char>>(v61, a12);
// a11 mark
if ( (a11 & 0x80) != 0 )
{
std::string::basic_string((void **)&jj, "life_cycle_callback_content");
@ -14158,7 +14161,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
v67 = std::operator<<<std::char_traits<char>>(v66, "={}");
std::operator<<<std::char_traits<char>>(v67, a12);
v68 = std::operator<<<std::char_traits<char>>(lpuexcptl, "if(typeof(global.entrys)==='undefined')global.entrys={};");
v69 = std::operator<<<char>(v68, a16);
v69 = std::operator<<<char>(v68, a16); // eMark
v70 = std::operator<<<std::char_traits<char>>(v69, "=global.entrys;");
std::operator<<<std::char_traits<char>>(v70, a12);
v71 = std::operator<<<std::char_traits<char>>(lpuexcptl, "var ");
@ -14172,7 +14175,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
v76 = std::operator<<<std::char_traits<char>>(v75, "=global.defines;");
std::operator<<<std::char_traits<char>>(v76, a12);
v77 = std::operator<<<std::char_traits<char>>(lpuexcptl, "var ");
v78 = std::operator<<<char>(v77, a22);
v78 = std::operator<<<char>(v77, a22); // fMark
v79 = std::operator<<<std::char_traits<char>>(v78, "={}");
std::operator<<<std::char_traits<char>>(v79, a12);
v80 = std::operator<<<std::char_traits<char>>(
@ -14216,8 +14219,9 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
std::operator<<<std::char_traits<char>>(v96, a12);
}
v97 = std::map<std::string,std::vector<std::string>>::operator[](&v307, v248);
// v307[v248]
v253 = 0;
v227 = *((_DWORD *)v97 + 1);
v227 = *((_DWORD *)v97 + 1); // end
for ( kk = *(int **)v97; kk != (int *)v227; kk += 6 )
{
v244 = std::map<std::string,zcc::shared_ptr<WXML::DOMLib::WXMLDom>>::operator[](&v304, (int)kk);
@ -14272,6 +14276,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
std::operator<<<std::char_traits<char>>(v114, a12);
std::string::basic_string((void **)&jj, "get_page_z_name");
v115 = std::map<std::string,std::string>::operator[]((_DWORD *)(*(_DWORD *)v244 + 272), &jj);
// ["get_page_z_name"].assign(j)
std::string::_M_assign((int)v115, (int)&j);
std::string::_M_dispose((void **)&jj);
std::string::_M_dispose(&j);
@ -14286,6 +14291,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
v120 = std::operator<<<char>(v119, v318);
v121 = std::operator<<<std::char_traits<char>>(v120, "=true;");
std::operator<<<std::char_traits<char>>(v121, a12);
// a11 mark
if ( (a11 & 4) != 0 )
{
v122 = std::operator<<<std::char_traits<char>>(lpuexcptl, "__WXML_GLOBAL__.debuginfo_set.");
@ -14296,12 +14302,13 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
if ( v225 )
{
std::operator<<<std::char_traits<char>>(lpuexcptl, "var nv_require=function(){var nnm={");
// v311
for ( mm = (int *)v312[2]; ; mm = (int *)std::_Rb_tree_increment((int)v266) )
{
v266 = mm;
if ( mm == v312 )
if ( mm == v312 ) // end
break;
v254 = std::operator<<<std::char_traits<char>>(lpuexcptl, 34);
v254 = std::operator<<<std::char_traits<char>>(lpuexcptl, 34); // '"'
WXML::Rewrite::ToStringCode((int)&jj, v266 + 4);
v126 = std::operator<<<char>(v254, &jj);
v127 = std::operator<<<std::char_traits<char>>(v126, 34);
@ -14343,8 +14350,11 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
v268[7] = 0;
v268[8] = 0;
zcc::shared_ptr<WXML::DOMLib::StrCache>::shared_ptr(v268);
// v248 i->first
v133 = std::map<std::string,std::vector<std::string>>::operator[](&v307, v248);
// v307[v248]
v245 = (WXML::NameAllocator *)*((_DWORD *)v133 + 1);
// std::vector<std::string>
for ( i1 = *(WXML::NameAllocator **)v133; ; i1 = (WXML::NameAllocator *)((char *)i1 + 24) )
{
v255 = (std::ostream::sentry *)v319;
@ -14363,6 +14373,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
WXML::DOMLib::WXMLDom::RecordAllPath(*(_DWORD **)v135);
}
WXML::DOMLib::StrCache::RenderPathDefine((_DWORD *)v319, (int)v243);
// v248 i->first
v136 = std::map<std::string,std::vector<std::string>>::operator[](&v307, v248);
v228 = 0;
v208 = (WXML::NameAllocator *)*((_DWORD *)v136 + 1);
@ -14370,7 +14381,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
{
v256 = std::map<std::string,zcc::shared_ptr<WXML::DOMLib::WXMLDom>>::operator[](&v304, (int)i2);
v137 = std::operator<<<char>(lpuexcptl, a17);
std::operator<<<std::char_traits<char>>(v137, (char *)off_55101C);
std::operator<<<std::char_traits<char>>(v137, (char *)off_55101C);// "[x["
v270 = (_DWORD *)v319;
std::string::basic_string((char *)&jj, (int)i2);
StrID = WXML::DOMLib::StrCache::GetStrID(v270, (int)&jj);
@ -14403,7 +14414,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
v140);
std::string::_M_dispose((void **)&jj);
if ( v258 )
goto LABEL_180;
goto LABEL_180; // 销毁数据,返回
v207 = v228 + 1;
std::to_string((std::__cxx11 *)&jj, v228);
v141 = std::string::insert((unsigned int *)&jj, 0, "m");
@ -14419,7 +14430,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
a16,
(int)a2,
v321,
(int)v243,
(int)v243, // *ss
&v328,
a13,
a14,
@ -14443,10 +14454,11 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
goto LABEL_185; // 销毁数据,返回
}
v142 = std::operator<<<char>(lpuexcptl, a16);
std::operator<<<std::char_traits<char>>(v142, (char *)off_55101C);
std::operator<<<std::char_traits<char>>(v142, (char *)off_55101C); // "[x["
v230 = (_DWORD *)v319;
std::string::basic_string((char *)&jj, (int)i2);
v143 = WXML::DOMLib::StrCache::GetStrID(v230, (int)&jj);
// v230.GetStrID(i2) -> v319.GetStrID(i2)
std::ostream::operator<<(v143);
std::string::_M_dispose((void **)&jj);
v144 = std::operator<<<std::char_traits<char>>(lpuexcptl, "]]={f:");
@ -14457,13 +14469,14 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
while ( 1 )
{
v146 = *(_DWORD *)(*(_DWORD *)v256 + 72);
// v231 -> index
if ( (*(_DWORD *)(*(_DWORD *)v256 + 76) - v146) >> 3 <= v231 )
break;
if ( std::operator==<char>(*(_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);
std::string::basic_string((void **)&jj, (char *)off_547B7D); // "src"
v211 = std::_Rb_tree<std::string,std::pair<std::string const,WXML::DOMLib::Token>,std::_Select1st<std::pair<std::string const,WXML::DOMLib::Token>>,std::less<std::string>,std::allocator<std::pair<std::string const,WXML::DOMLib::Token>>>::find(
(_DWORD *)(v210 + 48),
(int)&jj);
@ -14475,7 +14488,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
std::operator<<<std::char_traits<char>>(lpuexcptl, "x[");
v206 = (_DWORD *)v319;
v212 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)v256 + 72) + 8 * v231);
std::string::basic_string(&j, (char *)off_547B7D);
std::string::basic_string(&j, (char *)off_547B7D); // src
v147 = std::_Rb_tree<std::string,std::pair<std::string const,WXML::DOMLib::Token>,std::_Select1st<std::pair<std::string const,WXML::DOMLib::Token>>,std::less<std::string>,std::allocator<std::pair<std::string const,WXML::DOMLib::Token>>>::find(
(_DWORD *)(v212 + 48),
(int)&j);
@ -14499,9 +14512,9 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
break;
if ( std::operator==<char>(*(_DWORD *)(v150 + 8 * i3), "include") )
{
v216 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)v256 + 72) + 8 * i3);
v216 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)v256 + 72) + 8 * i3); // item
v213 = (_DWORD *)(v216 + 52);
std::string::basic_string((void **)&jj, (char *)off_547B7D);
std::string::basic_string((void **)&jj, (char *)off_547B7D); // src
v217 = std::_Rb_tree<std::string,std::pair<std::string const,WXML::DOMLib::Token>,std::_Select1st<std::pair<std::string const,WXML::DOMLib::Token>>,std::less<std::string>,std::allocator<std::pair<std::string const,WXML::DOMLib::Token>>>::find(
(_DWORD *)(v216 + 48),
(int)&jj);
@ -14512,7 +14525,7 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
std::operator<<<std::char_traits<char>>(lpuexcptl, ",");
std::operator<<<std::char_traits<char>>(lpuexcptl, "x[");
v214 = (_DWORD *)v319;
v218 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)v256 + 72) + 8 * i3);
v218 = *(_DWORD *)(*(_DWORD *)(*(_DWORD *)v256 + 72) + 8 * i3); // item
std::string::basic_string(&j, (char *)off_547B7D);
v151 = std::_Rb_tree<std::string,std::pair<std::string const,WXML::DOMLib::Token>,std::_Select1st<std::pair<std::string const,WXML::DOMLib::Token>>,std::less<std::string>,std::allocator<std::pair<std::string const,WXML::DOMLib::Token>>>::find(
(_DWORD *)(v218 + 48),
@ -14682,10 +14695,11 @@ struct _Unwind_Exception *__cdecl WXML::Compiler::CompileLazy(
v233 = (_DWORD *)std::_Rb_tree_increment((int)v233);
}
// mark - 60
// v301 ssDataMap
for ( i5 = (struct _Unwind_Exception *)v303; ; i5 = (struct _Unwind_Exception *)std::_Rb_tree_increment((int)lpuexcptn) )
{
lpuexcptn = i5;
if ( i5 == (struct _Unwind_Exception *)v302 )
if ( i5 == (struct _Unwind_Exception *)v302 ) // end
break;
std::stringbuf::str((int)&jj, *((_DWORD *)i5 + 10) + 12);
v203 = std::map<std::string,std::string>::operator[](a3, (int)lpuexcptn + 16);
@ -23062,6 +23076,7 @@ void __cdecl WXML::DOMLib::recurseDependencies(int *a1, int *a2, _DWORD *a3)
if ( lpuexcptb ) // 大于0
{
// const char off_5539C8[] = {'s','r','c','\0'}
// v9 = "src"
std::string::basic_string(v9, (char *)off_5539C8);
v3 = std::map<std::string,WXML::DOMLib::Token>::operator[]((_DWORD *)(*a1 + 48), v9);
v4 = (int *)WXML::DOMLib::Token::ToAttrContent[abi:cxx11]((int)v3);
@ -53051,7 +53066,9 @@ unsigned int __thiscall WXML::DOMLib::WXMLDom::Print(_DWORD *this, int a2, char
WXML::DOMLib::WXMLDom::PrintMe((int)this, a2, a3, a4);
while ( 1 )
{
result = (this[19] - this[18]) >> 3;
// this.offset_(19*4) -> offset_76
// this.offset_(18*4) -> offset_72
result = (this[19] - this[18]) >> 3; // size
if ( result <= v4 )
break;
++v4;
@ -53136,11 +53153,13 @@ void __thiscall WXML::DOMLib::WXMLDom::PrintMe(int this, int a2, char *a3, char
printf("attr: ");
else
std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(v35 + 2), "attr: ");
// int this
for ( j = *(_DWORD *)(this + 60); ; j = std::_Rb_tree_increment(v32) )
{
v32 = j;
if ( j == this + 52 )
break;
// int j
if ( (*(_DWORD *)((char *)v35 + *(_DWORD *)(*v35 - 12) + 20) & 5) != 0 )
{
v13 = WXML::DOMLib::Token::ToString[abi:cxx11](j + 40);
@ -53150,6 +53169,7 @@ void __thiscall WXML::DOMLib::WXMLDom::PrintMe(int this, int a2, char *a3, char
{
v14 = std::operator<<<char>((std::ostream::sentry *)(v35 + 2), (int *)(j + 16));
v29 = std::operator<<<std::char_traits<char>>(v14, "->");
// int v32
v15 = (int *)WXML::DOMLib::Token::ToString[abi:cxx11](v32 + 40);
v16 = std::operator<<<char>(v29, v15);
std::operator<<<std::char_traits<char>>(v16, " ");
@ -190505,6 +190525,7 @@ int main(int argc, const char **argv, const char **envp)
v102[2] = (int)v102;
v102[3] = (int)v102;
v102[4] = 0;
// main - 0
std::string::basic_string(v103, "$gwx");
std::string::basic_string(v104, " ");
v106[0] = 0;
@ -190512,6 +190533,7 @@ int main(int argc, const char **argv, const char **envp)
v106[2] = (int)v106;
v106[3] = (int)v106;
v106[4] = 0;
// main - 5
for ( Stream = 1; Stream < v47; ++Stream )
{
std::string::basic_string((void **)&v143, "--config-path");
@ -190534,6 +190556,7 @@ int main(int argc, const char **argv, const char **envp)
}
}
// main - 10
if ( v99 )
{
v138 = 0;
@ -190550,6 +190573,7 @@ int main(int argc, const char **argv, const char **envp)
}
std::string::_M_dispose((void **)&v137);
}
// main - 15
Streama = 0;
v43 = 0;
v44 = 0;
@ -190558,6 +190582,7 @@ int main(int argc, const char **argv, const char **envp)
v55 = -1431655765 * ((v90 - (int)v89) >> 3);
v45 = 0;
FileNamea = 0;
// main - 20
while ( (int)Streama < v55 )
{
v67 = 6 * (_DWORD)Streama;
@ -190634,7 +190659,7 @@ int main(int argc, const char **argv, const char **envp)
if ( (int)&Streama->_ptr + 1 < v55 )
{
FileNamea = (char *)v89[v67 + 6];
LABEL_72:
LABEL_72:
Streama = v8;
goto LABEL_84;
}
@ -190714,7 +190739,7 @@ LABEL_72:
v14 = ___acrt_iob_func(2u);
fprintf(v14, "Error: expected -llw or -lla, but got %s", (const char *)v49);
v68 = -1;
goto LABEL_153;
goto LABEL_153; // 销毁数据,返回
}
v51 = 1;
}
@ -190743,9 +190768,10 @@ LABEL_72:
v53 = v51;
}
}
LABEL_84:
LABEL_84:
Streama = (FILE *)((char *)Streama + 1);
}
// main - 25
if ( v44 )
{
std::string::basic_string((void **)&v143, "global");
@ -190758,9 +190784,11 @@ LABEL_84:
fclose(Streamb);
std::string::_M_dispose((void **)&v140);
}
// main - 30
if ( v86 == v87 )
{
v68 = Usage(v47, v46);
// 直接销毁,返回
}
else
{
@ -190775,6 +190803,7 @@ LABEL_84:
v110[3] = (int)v110;
v110[4] = 0;
Streamc = 0;
// main - 35
// isReadFromStdin
if ( v45 )
{
@ -190801,6 +190830,7 @@ LABEL_84:
Streamc = (FILE *)((char *)Streamc + 1);
}
}
// main - 40
if ( v96 ) //if (!xc_Or_completeCode_Param.empty())
{
GetNextArg((int)String, (int *)&v95, (int)v104);
@ -190888,6 +190918,7 @@ LABEL_84:
std::string::_M_dispose((void **)&v143);
std::vector<std::string>::~vector((void ***)&v131, v25);
}
// main - 45
v111[1] = 0;
v111[0] = &v112;
v113[0] = &v114;
@ -190933,10 +190964,10 @@ LABEL_84:
v68 = (int)WXML::Compiler::CompileLazy(
&v107, // fileContentMap
(int *)v111, // errorMessage
&v115, // outputMap
&v101, // dict
&v121,
v126, // vecFileContentMap
&v115, // outputContentMap
&v101, // outputFuncMap
&v121, // dependencyListMap
v126, // componentListMap
(int *)&v92, // splitedData
&v105, // mapData1
v53, // isLLA
@ -190966,8 +190997,10 @@ LABEL_84:
std::string::_M_dispose((void **)&v140);
std::string::_M_dispose((void **)&v143);
std::string::basic_string((void **)&v140, "__COMMON__");
v61 = v117;
Streamh = &v116;
// int v115 -> outputContentMap
v61 = v117; // 根节点
Streamh = &v116; // 0
// 查找outputContentMap有没有名为__COMMON__的key
while ( v61 )
{
v27 = (unsigned __int8)std::operator<<char>((int)v61 + 16, (int)&v140) == 0;
@ -191004,6 +191037,7 @@ LABEL_84:
"=='undefined')?__vd_version_info__.globalThis:(typeof window!=='undefined'?window:globalThis);");
std::operator+<char>(&v143, &v137, (unsigned int *)&v140);
std::string::basic_string((void **)v136, "__COMMON__");
// v115["__COMMON__"] = v137 + v140
v33 = (unsigned __int8 **)std::map<std::string,std::string>::operator[](&v115, v136);
std::string::operator=(v33, (int)&v143);
std::string::_M_dispose((void **)v136);
@ -191013,7 +191047,9 @@ LABEL_84:
else
{
std::string::basic_string((void **)&v140, "__COMMON__");
// int v115 -> outputContentMap
Streamm = (FILE *)std::map<std::string,std::string>::operator[](&v115, &v140);
// v115["__COMMON__"]
WXML::Compiler::WXMLHelperCode[abi:cxx11]((void **)v136);
std::string::basic_string(
v135,
@ -191024,10 +191060,13 @@ LABEL_84:
"LOBAL__||{};var __globalThis=(typeof __vd_version_info__!=='undefined'&&typeof __vd_version_info__.globalThis!"
"=='undefined')?__vd_version_info__.globalThis:(typeof window!=='undefined'?window:globalThis);");
std::operator+<char>(&v137, v135, (unsigned int *)v136);
// v137 = v135 + v136
v31 = std::string::append(&v137, (int)Streamm);
// v137.append(Streamm)
std::string::basic_string(&v143, v31);
std::string::basic_string((void **)String, "__COMMON__");
v32 = (unsigned __int8 **)std::map<std::string,std::string>::operator[](&v115, String);
// v115["__COMMON__"] = v143
std::string::operator=(v32, (int)&v143);
std::string::_M_dispose((void **)String);
std::string::_M_dispose((void **)&v143);
@ -191038,19 +191077,22 @@ LABEL_84:
std::string::_M_dispose((void **)&v140);
std::basic_stringstream<char,std::char_traits<char>,std::allocator<char>>::basic_stringstream((int)&v143);
std::operator<<<std::char_traits<char>>((std::ostream::sentry *)v145, ";var __WXML_DEP__=__WXML_DEP__||{};");
// int *j
for ( j = v123; ; j = (int *)std::_Rb_tree_increment((int)Streami) )
{
Streami = (FILE *)j;
if ( j == v122 )
if ( j == v122 ) // end
break;
if ( j[11] != j[10] )
{
v62 = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)v145, "__WXML_DEP__[\"");
// key
WXML::Rewrite::ToStringCode((int)&v140, &Streami->_file);
v35 = std::operator<<<char>(v62, (int *)&v140);
std::operator<<<std::char_traits<char>>(v35, "\"]=[");
std::string::_M_dispose((void **)&v140);
flag = (int *)Streami[1]._flag;
// value - 引用列表
for ( k = (int *)Streami[1]._base; flag != k; k += 6 )
{
v57 = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)v145, "\"");
@ -191064,14 +191106,16 @@ LABEL_84:
}
std::stringbuf::str((int)&v140, (int)v146);
std::string::basic_string((void **)&v137, "__COMMON__");
// int v115 -> outputContentMap
v37 = std::map<std::string,std::string>::operator[](&v115, &v137);
// v37 = v115["__COMMON__"]
std::string::append(v37, (int)&v140);
std::string::_M_dispose((void **)&v137);
std::string::_M_dispose((void **)&v140);
if ( v68 )
{
Streamn = (FILE *)v111[0];
v38 = ___acrt_iob_func(2u);
v38 = ___acrt_iob_func(2u); // stderr
fprintf(v38, "Error %d: %s\n", v68, (const char *)Streamn);
}
else
@ -191091,6 +191135,7 @@ LABEL_84:
std::basic_stringstream<char,std::char_traits<char>,std::allocator<char>>::~basic_stringstream((int)&v143);
std::_Rb_tree<std::string,std::pair<std::string const,std::vector<std::string>>,std::_Select1st<std::pair<std::string const,std::vector<std::string>>>,std::less<std::string>,std::allocator<std::pair<std::string const,std::vector<std::string>>>>::~_Rb_tree((int)&v121);
}
// main - 50
else
{
std::string::basic_string((void **)&v143, "l_");
@ -191143,18 +191188,19 @@ LABEL_84:
if ( v68 )
{
Streaml = (FILE *)v111[0];
v26 = ___acrt_iob_func(2u);
v26 = ___acrt_iob_func(2u); // stderr
fprintf(v26, "%s\n", (const char *)Streaml);
}
else
{
Streamf = ___acrt_iob_func(1u);
Streamf = ___acrt_iob_func(1u); // stdout
if ( FileNamea && *FileNamea )
Streamf = fopen(FileNamea, "w");
Streamf = fopen(FileNamea, "w"); // specify file
fprintf(Streamf, "%s\n", (const char *)v113[0]);
fclose(Streamf);
}
}
// main - 55
std::_Rb_tree<std::string,std::pair<std::string const,std::string>,std::_Select1st<std::pair<std::string const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string const,std::string>>>::~_Rb_tree((int)&v115);
std::string::_M_dispose(v113);
std::string::_M_dispose(v111);