mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
feat: 增加部分函数
This commit is contained in:
parent
e726f77afa
commit
d76457d794
@ -8,9 +8,11 @@ add_executable(wcc
|
|||||||
src/wcc.cpp
|
src/wcc.cpp
|
||||||
src/include/wxml.h
|
src/include/wxml.h
|
||||||
src/wcc/usage.cpp
|
src/wcc/usage.cpp
|
||||||
|
src/wxml/rewrite.cpp
|
||||||
src/wxml/name_allocator.cpp
|
src/wxml/name_allocator.cpp
|
||||||
src/wxml/dom_lib/token.cpp
|
src/wxml/dom_lib/token.cpp
|
||||||
src/wxml/compiler.cpp
|
src/wxml/compiler.cpp
|
||||||
|
src/wxml/dom_lib/str_cache.cpp
|
||||||
src/wxml/dom_lib/wxml_dom.cpp
|
src/wxml/dom_lib/wxml_dom.cpp
|
||||||
src/wxml/dom_lib/machine.cpp
|
src/wxml/dom_lib/machine.cpp
|
||||||
src/wxml/dom_lib/parser.cpp
|
src/wxml/dom_lib/parser.cpp
|
||||||
|
@ -10,6 +10,18 @@
|
|||||||
|
|
||||||
namespace WXML
|
namespace WXML
|
||||||
{
|
{
|
||||||
|
namespace Rewrite
|
||||||
|
{
|
||||||
|
void ToStringCode(char const*, int, std::stringstream &ss);
|
||||||
|
void ToStringCode(std::string const&, std::stringstream &);
|
||||||
|
void ToStringCode(std::string const&, std::string&);
|
||||||
|
std::string ToStringCode(std::string const&);
|
||||||
|
std::string ToStringCode2(char const*, int);
|
||||||
|
std::string ToStringCode2(std::string const&);
|
||||||
|
std::string ToStringCode3(char const*, int);
|
||||||
|
std::string ToStringCode3(std::string const&);
|
||||||
|
}
|
||||||
|
|
||||||
class NameAllocator
|
class NameAllocator
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@ -28,10 +40,6 @@ namespace WXML
|
|||||||
|
|
||||||
namespace DOMLib
|
namespace DOMLib
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 参数值可能不是int
|
|
||||||
*/
|
|
||||||
bool AttrsCompartor(int a1, int a2);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼接字符串
|
* 拼接字符串
|
||||||
@ -83,36 +91,93 @@ namespace WXML
|
|||||||
~Token();
|
~Token();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
bool AttrsCompartor(
|
||||||
|
std::pair<std::string,WXML::DOMLib::Token> const& a1,
|
||||||
|
std::pair<std::string,WXML::DOMLib::Token> const& a2);
|
||||||
|
|
||||||
|
class StrCache
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
/* data */
|
||||||
|
std::map<std::string, int> d;
|
||||||
|
std::vector<std::string> offset_6;
|
||||||
|
public:
|
||||||
|
StrCache(/* args */);
|
||||||
|
~StrCache();
|
||||||
|
void RenderPathDefine(std::stringstream ss);
|
||||||
|
void Insert(std::string);
|
||||||
|
int GetStrID(std::string);
|
||||||
|
};
|
||||||
|
|
||||||
class WXMLDom
|
class WXMLDom
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/* data */
|
/* data */
|
||||||
|
std::string type;
|
||||||
|
bool offset_28;
|
||||||
|
int offset_92;
|
||||||
|
int offset_96;
|
||||||
|
StrCache offset_62;
|
||||||
public:
|
public:
|
||||||
std::string tag;
|
std::string tag;
|
||||||
std::map<std::string, WXML::DOMLib::Token> offset_12;
|
std::map<std::string, WXML::DOMLib::Token> offset_12;
|
||||||
WXMLDom(/* args */);
|
WXMLDom(/* args */);
|
||||||
~WXMLDom();
|
~WXMLDom();
|
||||||
void Error();
|
void Error();
|
||||||
// void RenderMeAsFunction(
|
void RenderMeAsFunction(
|
||||||
// std::string const&,
|
std::string const&,
|
||||||
// std::string const&,
|
std::string const&,
|
||||||
// std::string&,
|
std::string&,
|
||||||
// std::string const&,
|
std::string const&,
|
||||||
// std::stringstream &,
|
std::stringstream &,
|
||||||
// // WXML::NameAllocator *,
|
WXML::NameAllocator *,
|
||||||
// std::string const&,
|
std::string const&,
|
||||||
// std::string const&,
|
std::string const&,
|
||||||
// std::string const&,
|
std::string const&,
|
||||||
// std::string const&,
|
std::string const&,
|
||||||
// std::string const&,
|
std::string const&,
|
||||||
// char,
|
char,
|
||||||
// std::string const&,
|
std::string const&,
|
||||||
// bool,
|
bool,
|
||||||
// bool,
|
bool,
|
||||||
// uint,
|
uint,
|
||||||
// std::string const&
|
std::string const&
|
||||||
// );
|
);
|
||||||
|
void RenderChildren(
|
||||||
|
std::string const& a2,
|
||||||
|
std::string const& a3,
|
||||||
|
std::string& a4,
|
||||||
|
std::string const& a5,
|
||||||
|
std::stringstream & a6,
|
||||||
|
WXML::NameAllocator * a7,
|
||||||
|
std::string const& a8,
|
||||||
|
std::string const& a9,
|
||||||
|
std::string const& a10,
|
||||||
|
std::string const& a11,
|
||||||
|
char a12,
|
||||||
|
bool a13,
|
||||||
|
uint a14,
|
||||||
|
std::map<std::string,std::string> * a15
|
||||||
|
);
|
||||||
|
void RenderNonDefine(
|
||||||
|
std::string const& a2,
|
||||||
|
std::string const& a3,
|
||||||
|
std::string& a4,
|
||||||
|
std::string const& a5,
|
||||||
|
std::stringstream &a6,
|
||||||
|
WXML::NameAllocator *a7,
|
||||||
|
std::string const& a8,
|
||||||
|
std::string const& a9,
|
||||||
|
std::string const& a10,
|
||||||
|
std::string const& a11,
|
||||||
|
char a12,
|
||||||
|
bool a13,
|
||||||
|
uint a14,
|
||||||
|
std::map<std::string,std::string> * a15
|
||||||
|
);
|
||||||
bool operator==(std::string tag);
|
bool operator==(std::string tag);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -175,6 +240,8 @@ namespace WXML
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace Compiler
|
namespace Compiler
|
||||||
@ -281,15 +348,6 @@ namespace WXML
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Rewrite
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
/* data */
|
|
||||||
public:
|
|
||||||
Rewrite(/* args */);
|
|
||||||
~Rewrite();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
namespace EXPRLib
|
namespace EXPRLib
|
||||||
|
@ -347,28 +347,28 @@ namespace WXML{
|
|||||||
}
|
}
|
||||||
if (a1 == "wx-define")
|
if (a1 == "wx-define")
|
||||||
{
|
{
|
||||||
|
WXML::NameAllocator na(a17, a18);
|
||||||
auto token = a1.offset_12["name"];
|
auto token = a1.offset_12["name"];
|
||||||
auto attr = token.ToAttrContent();
|
auto attr = token.ToAttrContent();
|
||||||
a3[attr].assign(a2);
|
a3[attr].assign(a2);
|
||||||
// WXML::DOMLib::WXMLDom::RenderMeAsFunction(
|
a1.RenderMeAsFunction(
|
||||||
// a1,
|
a2,
|
||||||
// (int *)a2,
|
a14,
|
||||||
// a14,
|
a4,
|
||||||
// a4,
|
attr,
|
||||||
// (int *)v31,
|
a5,
|
||||||
// a5,
|
&na,
|
||||||
// (int *)v33,
|
a10,
|
||||||
// a10,
|
a11,
|
||||||
// a11,
|
a12,
|
||||||
// a12,
|
"r", // "r"
|
||||||
// (int *)v32, // "r"
|
a15,
|
||||||
// a15,
|
a9,
|
||||||
// a9,
|
a16,
|
||||||
// a16,
|
1,
|
||||||
// 1,
|
a7,
|
||||||
// a7,
|
a8,
|
||||||
// a8,
|
a20);
|
||||||
// a20);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++)
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
#include "../../include/wxml.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace WXML {
|
||||||
|
|
||||||
|
|
||||||
|
namespace DOMLib
|
||||||
|
{
|
||||||
|
StrCache::StrCache(/* args */)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
StrCache::~StrCache()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
void StrCache::RenderPathDefine(std::stringstream ss)
|
||||||
|
{
|
||||||
|
ss << "var x=[";
|
||||||
|
// TODO...
|
||||||
|
// return ss;
|
||||||
|
}
|
||||||
|
void StrCache::Insert(std::string s)
|
||||||
|
{
|
||||||
|
if (!this->d.count(s))
|
||||||
|
{
|
||||||
|
// this->d[s] = this[5]; // ???
|
||||||
|
this->offset_6.push_back(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int StrCache::GetStrID(std::string s)
|
||||||
|
{
|
||||||
|
int result = -1;
|
||||||
|
if(this->d.count(s))
|
||||||
|
{
|
||||||
|
return this->d[s];
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,192 @@ namespace WXML {
|
|||||||
|
|
||||||
WXMLDom::~WXMLDom()
|
WXMLDom::~WXMLDom()
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
const char off_553FDC[] = {'[','x','[','\0'};
|
||||||
|
void WXMLDom::RenderMeAsFunction(
|
||||||
|
std::string const& a2,
|
||||||
|
std::string const& a3,
|
||||||
|
std::string& a4,
|
||||||
|
std::string const& a5,
|
||||||
|
std::stringstream & a6,
|
||||||
|
WXML::NameAllocator * a7,
|
||||||
|
std::string const& a8,
|
||||||
|
std::string const& a9,
|
||||||
|
std::string const& a10,
|
||||||
|
std::string const& a11,
|
||||||
|
std::string const& a12,
|
||||||
|
char a13,
|
||||||
|
std::string const& a14,
|
||||||
|
bool a15,
|
||||||
|
bool a16,
|
||||||
|
uint a17,
|
||||||
|
std::string const& a18
|
||||||
|
)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
a7->GetNextName(name);
|
||||||
|
if (a15)
|
||||||
|
{
|
||||||
|
a6 << a12 << off_553FDC;
|
||||||
|
int id = offset_62.GetStrID(a2);
|
||||||
|
a6 << id;
|
||||||
|
a6 << "]][\"";
|
||||||
|
WXML::Rewrite::ToStringCode(a5, a6);
|
||||||
|
a6 << "\"]";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
a6 << "var " << a5;
|
||||||
|
}
|
||||||
|
a6 << "=function(";
|
||||||
|
a6 << a8 << ",";
|
||||||
|
a6 << a9 << ",";
|
||||||
|
a6 << a11 << ",";
|
||||||
|
a6 << a10 << "){";
|
||||||
|
a6 << a13;
|
||||||
|
// if (a18)
|
||||||
|
{
|
||||||
|
a6 << "var z=" << a18 << "()" << a13;
|
||||||
|
}
|
||||||
|
if (a15)
|
||||||
|
{
|
||||||
|
a6 << "var " << name;
|
||||||
|
a6 << "=x[";
|
||||||
|
int id = this->offset_62.GetStrID(a2);
|
||||||
|
a6 << id << "]";
|
||||||
|
a6 << "+':";
|
||||||
|
WXML::Rewrite::ToStringCode(a5, a6);
|
||||||
|
a6 << "'" << a13 << a11 << ".wxVkey=";
|
||||||
|
a6 << name << a13 << a10 << ".f=$gdc(f_[\"";
|
||||||
|
a6 << WXML::Rewrite::ToStringCode(a2);
|
||||||
|
a6 << "\"],\"\",1)";
|
||||||
|
a6 << a13;
|
||||||
|
a6 << "if(" << a14 << "[" << name << "]{_wl(";
|
||||||
|
a6 << name << ",x[";
|
||||||
|
id = this->offset_62.GetStrID(a2);
|
||||||
|
a6 << id << "]);return}" << a13;
|
||||||
|
|
||||||
|
a6 << a14 << "[" << name << "]=true";
|
||||||
|
a6 << a13 << "try{" << a13;
|
||||||
|
}
|
||||||
|
// RenderChildren
|
||||||
|
if (a15)
|
||||||
|
{
|
||||||
|
a6 << "}catch(err){" << a13;
|
||||||
|
a6 << a14 << "[" << name << "]=false";
|
||||||
|
a6 << a13 << "throw err" << a13 << "}";
|
||||||
|
a6 << a13 << a14 << "[" << name << "]=false" << a13;
|
||||||
|
}
|
||||||
|
a6 << "return " << a11 << a13 << "}" << a13;
|
||||||
|
}
|
||||||
|
catch(const std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << e.what() << '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
void WXMLDom::RenderChildren(
|
||||||
|
std::string const& a2,
|
||||||
|
std::string const& a3,
|
||||||
|
std::string& a4,
|
||||||
|
std::string const& a5,
|
||||||
|
std::stringstream & a6,
|
||||||
|
WXML::NameAllocator * a7,
|
||||||
|
std::string const& a8,
|
||||||
|
std::string const& a9,
|
||||||
|
std::string const& a10,
|
||||||
|
std::string const& a11,
|
||||||
|
char a12,
|
||||||
|
bool a13,
|
||||||
|
uint a14,
|
||||||
|
std::map<std::string,std::string> * a15
|
||||||
|
)
|
||||||
|
{
|
||||||
|
auto size = a6.tellp();
|
||||||
|
if (size > 52428800)
|
||||||
|
{
|
||||||
|
throw "Interal error: generated code (>10M) will be too heavy to fly in a narrow wind.";
|
||||||
|
}
|
||||||
|
// while (/* condition */)
|
||||||
|
// {
|
||||||
|
// /* code */
|
||||||
|
// }
|
||||||
|
int Stra;
|
||||||
|
// for (int i = 0; ; i = Stra)
|
||||||
|
// {
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void WXMLDom::RenderNonDefine(
|
||||||
|
std::string const& a2,
|
||||||
|
std::string const& a3,
|
||||||
|
std::string& a4,
|
||||||
|
std::string const& a5,
|
||||||
|
std::stringstream &a6,
|
||||||
|
WXML::NameAllocator *a7,
|
||||||
|
std::string const& a8,
|
||||||
|
std::string const& a9,
|
||||||
|
std::string const& a10,
|
||||||
|
std::string const& a11,
|
||||||
|
char a12,
|
||||||
|
bool a13,
|
||||||
|
uint a14,
|
||||||
|
std::map<std::string,std::string> * a15
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (a13 && this->offset_28)
|
||||||
|
{
|
||||||
|
a6 << "cs.push(\"";
|
||||||
|
std::string sc = WXML::Rewrite::ToStringCode(a2);
|
||||||
|
a6 << sc << ":" << this->tag << ":" << this->offset_92 << ":" << this->offset_96 << "\")";
|
||||||
|
}
|
||||||
|
if (this->type == "TEXTNODE")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if (this->type == "wx-define"
|
||||||
|
||this->type == "wx-import"
|
||||||
|
||this->type == "import"
|
||||||
|
||this->type == "template")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if (this->type == "wx-repeat")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if (this->type == "block")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if (this->type == "include")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
if (this->type == "wx-template")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
// for (size_t i = 0; i < count; i++)
|
||||||
|
// {
|
||||||
|
// /* code */
|
||||||
|
// }
|
||||||
|
// sort
|
||||||
|
// for (size_t i = 0; i < count; i++)
|
||||||
|
// {
|
||||||
|
// /* code */
|
||||||
|
// }
|
||||||
|
// if ()
|
||||||
|
// {
|
||||||
|
// ".rawAttr="
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
bool WXMLDom::operator==(std::string tag)
|
bool WXMLDom::operator==(std::string tag)
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,14 @@ namespace WXML {
|
|||||||
this->offset_7.assign(a3);
|
this->offset_7.assign(a3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO:
|
||||||
|
*/
|
||||||
|
void NameAllocator::GetNextName(std::string & a2)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
NameAllocator::~NameAllocator()
|
NameAllocator::~NameAllocator()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,232 @@
|
|||||||
|
|
||||||
namespace WXML {
|
namespace WXML {
|
||||||
|
|
||||||
|
namespace Rewrite
|
||||||
Rewrite::Rewrite(/* args */)
|
|
||||||
{
|
{
|
||||||
|
void ToStringCode(char const* src, int len, std::stringstream &ss)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
char v4 = src[i];
|
||||||
|
if ( v4 == '\''/*39*/ )
|
||||||
|
{
|
||||||
|
ss << "\\x27";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v4 <= '\''/*39*/ )
|
||||||
|
{
|
||||||
|
if ( v4 == '"'/*34*/ )
|
||||||
|
{
|
||||||
|
ss << "\\x22";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v4 > '"'/*34*/ )
|
||||||
|
{
|
||||||
|
if ( v4 == '&'/*38*/ )
|
||||||
|
{
|
||||||
|
ss << "\\x26";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( v4 == '\n'/*10*/ )
|
||||||
|
{
|
||||||
|
ss << "\\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v4 == '\r'/*13*/ )
|
||||||
|
{
|
||||||
|
ss << "\\r";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goto LABEL_31;
|
||||||
|
}
|
||||||
|
if ( v4 == '>' /*62*/ )
|
||||||
|
{
|
||||||
|
ss << "\\x3e";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v4 <= '>' /*62*/ )
|
||||||
|
{
|
||||||
|
if ( v4 == '<'/*60*/ )
|
||||||
|
{
|
||||||
|
ss << "\\x3c";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v4 == '='/*61*/ )
|
||||||
|
{
|
||||||
|
ss << "\\x3d";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
LABEL_31:
|
||||||
|
ss << v4;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v4 != '\\'/*92*/ ){
|
||||||
|
ss << v4;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
char v6 = src[i + 1];
|
||||||
|
if ( v6 - '\\'/*92*/ > 0x18u )
|
||||||
|
{
|
||||||
|
if ( v6 == '\''/*39*/ || v6 == '"'/*34*/ )
|
||||||
|
{
|
||||||
|
LABEL_29:
|
||||||
|
ss << "\\";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ( ((0x1440001u >> (v6 - '\\'/*92*/)) & 1) != 0 )
|
||||||
|
{
|
||||||
|
goto LABEL_29;
|
||||||
|
}
|
||||||
|
ss << "\\x5c";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Rewrite::~Rewrite()
|
}
|
||||||
|
void ToStringCode(std::string const&src, std::stringstream & ss)
|
||||||
{
|
{
|
||||||
|
ToStringCode(src.data(), src.size(), ss);
|
||||||
|
}
|
||||||
|
void ToStringCode(std::string const& a1, std::string& a2)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
ToStringCode(a1.data(), a1.size(), ss);
|
||||||
|
// TODO:
|
||||||
|
a2 = ss.str();
|
||||||
|
}
|
||||||
|
catch(const std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << e.what() << '\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::string ToStringCode(std::string const&a2)
|
||||||
|
{
|
||||||
|
std::string result;
|
||||||
|
ToStringCode(a2, result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
std::string ToStringCode2(char const* src, int len)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
for (size_t i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
char v3 = src[i];
|
||||||
|
if ( v3 == '\''/*39*/ )
|
||||||
|
{
|
||||||
|
ss << "\\x27";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v3 > 39 ) // '\''
|
||||||
|
{
|
||||||
|
if ( v3 == 62 ) // '>'
|
||||||
|
{
|
||||||
|
ss << "\\x3e";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v3 > 62 ) // '>'
|
||||||
|
{
|
||||||
|
if ( v3 == 92 ) // '\'
|
||||||
|
{
|
||||||
|
ss << "\\\\";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( v3 == 60 ) // '<'
|
||||||
|
{
|
||||||
|
ss << "\\x3c";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v3 == 61 ) // '='
|
||||||
|
{
|
||||||
|
ss << "\\x3d";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( v3 == 34 ) // '"'
|
||||||
|
{
|
||||||
|
ss << "\\x22";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v3 > 34 )
|
||||||
|
{
|
||||||
|
if ( v3 == 38 ) // '&'
|
||||||
|
{
|
||||||
|
ss << "\\x26";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( v3 == 10 ) // '\n'
|
||||||
|
{
|
||||||
|
ss << "\\n";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v3 == 13 )
|
||||||
|
{
|
||||||
|
ss << "\\r";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ss << v3;
|
||||||
|
}
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
std::string ToStringCode2(std::string const&src)
|
||||||
|
{
|
||||||
|
return ToStringCode2(src.data(), src.size());
|
||||||
|
}
|
||||||
|
std::string ToStringCode3(char const* src, int len)
|
||||||
|
{
|
||||||
|
std::stringstream ss;
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
char v3 = src[i];
|
||||||
|
if ( v3 == 61 ) // '='
|
||||||
|
{
|
||||||
|
ss << "\\x3d";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v3 > 61 ) // '='
|
||||||
|
{
|
||||||
|
if ( v3 == 62 ) // '>'
|
||||||
|
{
|
||||||
|
ss << "\\x3e";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( v3 == 38 ) // '&'
|
||||||
|
{
|
||||||
|
ss << "\\x26";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v3 == 60 ) // '<'
|
||||||
|
{
|
||||||
|
ss << "\\x3c";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ss << v3;
|
||||||
|
}
|
||||||
|
return ss.str();
|
||||||
|
}
|
||||||
|
std::string ToStringCode3(std::string const& src)
|
||||||
|
{
|
||||||
|
return ToStringCode3(src.data(), src.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -9483,21 +9483,21 @@ std::ostream::sentry *__cdecl WXML::Rewrite::ToStringCode(int a1, int a2, int a3
|
|||||||
for ( i = 0; i < a2; ++i )
|
for ( i = 0; i < a2; ++i )
|
||||||
{
|
{
|
||||||
v4 = *(_BYTE *)(a1 + i);
|
v4 = *(_BYTE *)(a1 + i);
|
||||||
if ( v4 == 39 )
|
if ( v4 == '\''/*39*/ )
|
||||||
{
|
{
|
||||||
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x27");
|
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x27");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( v4 <= 39 )
|
if ( v4 <= '\''/*39*/ )
|
||||||
{
|
{
|
||||||
if ( v4 == 34 )
|
if ( v4 == '"'/*34*/ )
|
||||||
{
|
{
|
||||||
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x22");
|
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x22");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( v4 > 34 )
|
if ( v4 > '"'/*34*/ )
|
||||||
{
|
{
|
||||||
if ( v4 == 38 )
|
if ( v4 == '&'/*38*/ )
|
||||||
{
|
{
|
||||||
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x26");
|
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x26");
|
||||||
continue;
|
continue;
|
||||||
@ -9505,12 +9505,12 @@ std::ostream::sentry *__cdecl WXML::Rewrite::ToStringCode(int a1, int a2, int a3
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( v4 == 10 )
|
if ( v4 == '\n'/*10*/ )
|
||||||
{
|
{
|
||||||
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\n");
|
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( v4 == 13 )
|
if ( v4 == '\r'/*13*/ )
|
||||||
{
|
{
|
||||||
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\r");
|
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\r");
|
||||||
continue;
|
continue;
|
||||||
@ -9518,19 +9518,19 @@ std::ostream::sentry *__cdecl WXML::Rewrite::ToStringCode(int a1, int a2, int a3
|
|||||||
}
|
}
|
||||||
goto LABEL_31;
|
goto LABEL_31;
|
||||||
}
|
}
|
||||||
if ( v4 == 62 )
|
if ( v4 == '>' /*62*/ )
|
||||||
{
|
{
|
||||||
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x3e");
|
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x3e");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( v4 <= 62 )
|
if ( v4 <= '>' /*62*/ )
|
||||||
{
|
{
|
||||||
if ( v4 == 60 )
|
if ( v4 == '<'/*60*/ )
|
||||||
{
|
{
|
||||||
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x3c");
|
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x3c");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( v4 == 61 )
|
if ( v4 == '='/*61*/ )
|
||||||
{
|
{
|
||||||
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x3d");
|
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\x3d");
|
||||||
continue;
|
continue;
|
||||||
@ -9540,19 +9540,19 @@ LABEL_31:
|
|||||||
result = std::__ostream_insert<char,std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), (int)&v7, 1);
|
result = std::__ostream_insert<char,std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), (int)&v7, 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ( v4 != 92 )
|
if ( v4 != '\\'/*92*/ )
|
||||||
goto LABEL_31;
|
goto LABEL_31;
|
||||||
v6 = *(_BYTE *)(a1 + i + 1);
|
v6 = *(_BYTE *)(a1 + i + 1);
|
||||||
if ( (unsigned __int8)(v6 - 92) > 0x18u )
|
if ( (unsigned __int8)(v6 - '\\'/*92*/) > 0x18u )
|
||||||
{
|
{
|
||||||
if ( v6 == 39 || v6 == 34 )
|
if ( v6 == '\''/*39*/ || v6 == '"'/*34*/ )
|
||||||
{
|
{
|
||||||
LABEL_29:
|
LABEL_29:
|
||||||
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\");
|
result = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)(a3 + 8), "\\");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( ((0x1440001u >> (v6 - 92)) & 1) != 0 )
|
else if ( ((0x1440001u >> (v6 - '\\'/*92*/)) & 1) != 0 )
|
||||||
{
|
{
|
||||||
goto LABEL_29;
|
goto LABEL_29;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user