mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
feat: support for --wxs
This commit is contained in:
parent
fc07e7cc38
commit
2c0cb9bdfc
@ -5,6 +5,7 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
recursive: true,
|
recursive: true,
|
||||||
spec: "./test/spec/**/*.spec.ts",
|
spec: "./test/spec/**/*.spec.ts",
|
||||||
// spec: "test/spec/wcsc/module/module.spec.ts",
|
// spec: 'test/spec/wcc/module/module.spec.ts',
|
||||||
|
// spec: "test/spec/wcc/wxs/wxs.spec.ts",
|
||||||
timeout: 20000,
|
timeout: 20000,
|
||||||
}
|
}
|
103
.vscode/launch.json
vendored
103
.vscode/launch.json
vendored
@ -5,6 +5,105 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "wcc wxs sample2",
|
||||||
|
"type": "lldb",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/wcc",
|
||||||
|
"args": [
|
||||||
|
"--wxs",
|
||||||
|
"${workspaceRoot}/test/spec/wcc/wxs/sample2.json"
|
||||||
|
],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${workspaceRoot}/",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Set Disassembly Flavor to Intel",
|
||||||
|
"text": "-gdb-set disassembly-flavor intel",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sourceFileMap":{
|
||||||
|
"${workspaceRoot}": {
|
||||||
|
"editorPath": "${workspaceRoot}",
|
||||||
|
"useForBreakpoints": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "wcc wxs sample3",
|
||||||
|
"type": "lldb",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/wcc",
|
||||||
|
"args": [
|
||||||
|
"--wxs",
|
||||||
|
"${workspaceRoot}/test/spec/wcc/wxs/sample3.json"
|
||||||
|
],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${workspaceRoot}/",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Set Disassembly Flavor to Intel",
|
||||||
|
"text": "-gdb-set disassembly-flavor intel",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sourceFileMap":{
|
||||||
|
"${workspaceRoot}": {
|
||||||
|
"editorPath": "${workspaceRoot}",
|
||||||
|
"useForBreakpoints": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "wcc wxs sample4",
|
||||||
|
"type": "lldb",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/wcc",
|
||||||
|
"args": [
|
||||||
|
"--wxs",
|
||||||
|
"${workspaceRoot}/test/spec/wcc/wxs/sample4.json"
|
||||||
|
],
|
||||||
|
"stopAtEntry": false,
|
||||||
|
"cwd": "${workspaceRoot}/",
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Enable pretty-printing for gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Set Disassembly Flavor to Intel",
|
||||||
|
"text": "-gdb-set disassembly-flavor intel",
|
||||||
|
"ignoreFailures": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sourceFileMap":{
|
||||||
|
"${workspaceRoot}": {
|
||||||
|
"editorPath": "${workspaceRoot}",
|
||||||
|
"useForBreakpoints": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "(gdb) Launch",
|
"name": "(gdb) Launch",
|
||||||
"type": "cppdbg",
|
"type": "cppdbg",
|
||||||
@ -12,10 +111,10 @@
|
|||||||
"program": "${workspaceFolder}/build/wcc",
|
"program": "${workspaceFolder}/build/wcc",
|
||||||
"args": [
|
"args": [
|
||||||
"\"--config-path\"",
|
"\"--config-path\"",
|
||||||
"\"/home/msojocs/github/wx-compiler/test/spec/issue/102/case1.txt\""
|
"\"${workspaceRoot}/test/spec/issue/102/case1.txt\""
|
||||||
],
|
],
|
||||||
"stopAtEntry": false,
|
"stopAtEntry": false,
|
||||||
"cwd": "/home/msojocs/github/wx-compiler/test/spec/issue/102/wxapp",
|
"cwd": "${workspaceRoot}/test/spec/issue/102/wxapp",
|
||||||
"environment": [],
|
"environment": [],
|
||||||
"externalConsole": false,
|
"externalConsole": false,
|
||||||
"MIMode": "gdb",
|
"MIMode": "gdb",
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
## 🌈 v0.1.0 / 2024-07-13
|
||||||
|
|
||||||
|
🚀Features
|
||||||
|
|
||||||
|
- 编译器:支持 `--wxs` 参数
|
||||||
|
|
||||||
## 🌈 v0.0.9 / 2024-07-07
|
## 🌈 v0.0.9 / 2024-07-07
|
||||||
|
|
||||||
🚀Features
|
🚀Features
|
||||||
|
File diff suppressed because one or more lines are too long
@ -6,4 +6,5 @@
|
|||||||
std::string DictToJsonString(std::map<std::string,std::string> const&);
|
std::string DictToJsonString(std::map<std::string,std::string> const&);
|
||||||
|
|
||||||
std::string EscapeToJsonString(std::string const&);
|
std::string EscapeToJsonString(std::string const&);
|
||||||
|
int GetJsonDict(std::string &a1, std::map<std::string, std::string>& a2);
|
||||||
#endif
|
#endif
|
@ -54,6 +54,7 @@ namespace night
|
|||||||
|
|
||||||
int compile_ns(std::string const&,std::string const&,std::string const&,uint,std::string&,bool);
|
int compile_ns(std::string const&,std::string const&,std::string const&,uint,std::string&,bool);
|
||||||
void compile_ns_with_sourcemap(std::string const&,std::string const&,std::string const&,std::string const&,uint,std::string&,std::string&);
|
void compile_ns_with_sourcemap(std::string const&,std::string const&,std::string const&,std::string const&,uint,std::string&,std::string&);
|
||||||
|
int compile_ns_no_wrapper(std::string const& a1, std::string const& a2, uint a5, std::string& a6, bool a7);
|
||||||
void readfile(char const*, std::string &);
|
void readfile(char const*, std::string &);
|
||||||
void writefile(char const*, std::string &);
|
void writefile(char const*, std::string &);
|
||||||
|
|
||||||
@ -310,7 +311,7 @@ namespace night
|
|||||||
std::vector<std::string> * offset_28 = nullptr;
|
std::vector<std::string> * offset_28 = nullptr;
|
||||||
int offset_32 = 0;
|
int offset_32 = 0;
|
||||||
std::vector<night::ns_sourcemap> offset_36;
|
std::vector<night::ns_sourcemap> offset_36;
|
||||||
int offset_48;
|
int offset_48 = 1;
|
||||||
NSCompileJs(/* args */);
|
NSCompileJs(/* args */);
|
||||||
~NSCompileJs();
|
~NSCompileJs();
|
||||||
std::string compile(night::ns_node *);
|
std::string compile(night::ns_node *);
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
#ifndef __WXML_H_
|
#ifndef __WXML_H_
|
||||||
#define __WXML_H_
|
#define __WXML_H_
|
||||||
|
|
||||||
|
#include "define.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -711,6 +713,19 @@ namespace WXML
|
|||||||
|
|
||||||
} // namespace EXPRLib
|
} // namespace EXPRLib
|
||||||
|
|
||||||
|
namespace GlassEaselWxs {
|
||||||
|
const std::string sWrapper = "function n(nv_require,nv_exports,nv_module){%s}const t={nv_exports:{}};n((function(n){n.startsWith(\"p_\")&&(n=\"/\"+n.slice(2)),n.endsWith(\".wxs\")&&(n=n.slice(0,n.length-4));const t=gdc(require(n),\"nv_\");return function(){return t}}),t.nv_exports,t),Object.assign(module,gdc(t,void 0));";
|
||||||
|
const std::string sGenFuncDeepCopy = "var gdc=function(){var e=function(){return void 0!==this?this:\"undefined\"!=typeof globalThis?globalThis:\"undefine"
|
||||||
|
"d\"!=typeof self?self:\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:{}}();return function("
|
||||||
|
"n,t,o,i=e){if(null==n)return n;if(\"undefined\"!=typeof __wxCodeSpace__&&\"function\"==typeof __wxCodeSpace__.isWxsS"
|
||||||
|
"tateObject&&__wxCodeSpace__.isWxsStateObject(n))return n;if(\"string\"==typeof n||\"boolean\"==typeof n||\"number\"="
|
||||||
|
"=typeof n)return n;if(Array.isArray(n)){const e=[];for(let i=0;i<n.length;i++)e.push(gdc(n[i],t,o,n));return e}if(n "
|
||||||
|
"instanceof Date){const e=new Date;return e.setTime(n.getTime()),e}if(n instanceof RegExp){let e=\"\";return n.global"
|
||||||
|
"&&(e+=\"g\"),n.ignoreCase&&(e+=\"i\"),n.multiline&&(e+=\"m\"),new RegExp(n.source,e)}if(\"object\"==typeof n){const "
|
||||||
|
"e={};for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&(void 0===t?e[i.substring(3)]=gdc(n[i],t,o,n):e[t+i]="
|
||||||
|
"gdc(n[i],t,o,n));return e}return\"function\"==typeof n?1===o?null:function(...e){const o=gdc(e,void 0===t?\"nv_\":vo"
|
||||||
|
"id 0),r=n.apply(i,o);return gdc(r,t)}:null}}();";
|
||||||
|
const std::string sWxsEnvInit = aUndefinedTypeo;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -1,12 +1,14 @@
|
|||||||
// hello.cc
|
// hello.cc
|
||||||
#include "./include/wcc.hh"
|
#include "./include/wcc.hh"
|
||||||
#include "../include/file.h"
|
#include "../include/file.h"
|
||||||
|
#include "../include/night.h"
|
||||||
#include "../include/string_utils.h"
|
#include "../include/string_utils.h"
|
||||||
#include "../include/wxml.h"
|
#include "../include/wxml.h"
|
||||||
#include "v8.h"
|
#include "v8.h"
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cstdio>
|
||||||
#include <node.h>
|
#include <node.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
namespace wx_compiler {
|
namespace wx_compiler {
|
||||||
|
|
||||||
@ -26,6 +28,7 @@ using std::vector;
|
|||||||
|
|
||||||
int compile(Isolate *isolate, WCCOptions &options, Local<Value> &result,
|
int compile(Isolate *isolate, WCCOptions &options, Local<Value> &result,
|
||||||
std::string &errMsg) {
|
std::string &errMsg) {
|
||||||
|
try {
|
||||||
int mark = 0;
|
int mark = 0;
|
||||||
if (options.debug) {
|
if (options.debug) {
|
||||||
mark |= 2u;
|
mark |= 2u;
|
||||||
@ -34,47 +37,73 @@ int compile(Isolate *isolate, WCCOptions &options, Local<Value> &result,
|
|||||||
mark |= 4u;
|
mark |= 4u;
|
||||||
}
|
}
|
||||||
std::map<std::string, std::string> fileContentMap;
|
std::map<std::string, std::string> fileContentMap;
|
||||||
|
std::map<std::string, std::string> wxsMap;
|
||||||
for (int i = 0; i < options.files.size(); i++) {
|
for (int i = 0; i < options.files.size(); i++) {
|
||||||
fileContentMap[options.files[i]] = options.contents[i];
|
auto file = options.files[i];
|
||||||
|
fileContentMap[file] = options.contents[i];
|
||||||
|
if (file.find(".wxs") != std::string::npos) {
|
||||||
|
wxsMap[file] = options.contents[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
map<string, vector<string>> componentListMap;
|
map<string, vector<string>> componentListMap;
|
||||||
|
|
||||||
std::string xc_Or_completeCode_Param = options.wxmlCompileConfig;
|
std::string xc_Or_completeCode_Param = options.wxmlCompileConfig;
|
||||||
if (!xc_Or_completeCode_Param.empty())
|
if (!xc_Or_completeCode_Param.empty()) {
|
||||||
{
|
|
||||||
string data;
|
string data;
|
||||||
vector<string> allComponentList;
|
vector<string> allComponentList;
|
||||||
data = getNextArg(xc_Or_completeCode_Param, options.wxmlCompileConfigSplit);
|
data =
|
||||||
|
getNextArg(xc_Or_completeCode_Param, options.wxmlCompileConfigSplit);
|
||||||
unsigned long long count = strtoull(&data[0], 0, 10);
|
unsigned long long count = strtoull(&data[0], 0, 10);
|
||||||
for (unsigned long long i = 0; i < count; i++)
|
for (unsigned long long i = 0; i < count; i++) {
|
||||||
{
|
|
||||||
vector<string> componentList;
|
vector<string> componentList;
|
||||||
string arg1 = getNextArg(xc_Or_completeCode_Param, options.wxmlCompileConfigSplit);
|
string arg1 = getNextArg(xc_Or_completeCode_Param,
|
||||||
data = getNextArg(xc_Or_completeCode_Param, options.wxmlCompileConfigSplit);
|
options.wxmlCompileConfigSplit);
|
||||||
|
data = getNextArg(xc_Or_completeCode_Param,
|
||||||
|
options.wxmlCompileConfigSplit);
|
||||||
unsigned long long jCount = strtoull(&data[0], 0, 10);
|
unsigned long long jCount = strtoull(&data[0], 0, 10);
|
||||||
for (unsigned long long i = 0; i < jCount; i++)
|
for (unsigned long long i = 0; i < jCount; i++) {
|
||||||
{
|
string componentName = getNextArg(xc_Or_completeCode_Param,
|
||||||
string componentName = getNextArg(xc_Or_completeCode_Param, options.wxmlCompileConfigSplit);
|
options.wxmlCompileConfigSplit);
|
||||||
componentList.push_back(componentName);
|
componentList.push_back(componentName);
|
||||||
auto it = std::find(allComponentList.begin(), allComponentList.end(), componentName);
|
auto it = std::find(allComponentList.begin(), allComponentList.end(),
|
||||||
if (it == allComponentList.end())
|
componentName);
|
||||||
{
|
if (it == allComponentList.end()) {
|
||||||
allComponentList.push_back(componentName);
|
allComponentList.push_back(componentName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto it = componentListMap.lower_bound(arg1);
|
auto it = componentListMap.lower_bound(arg1);
|
||||||
if (it == componentListMap.end() || arg1 < it->first)
|
if (it == componentListMap.end() || arg1 < it->first) {
|
||||||
{
|
|
||||||
componentListMap.emplace(arg1, componentList);
|
componentListMap.emplace(arg1, componentList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentListMap["ALL"] = allComponentList;
|
componentListMap["ALL"] = allComponentList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wxsMap.size())
|
||||||
|
{
|
||||||
|
std::string wxs;
|
||||||
|
|
||||||
|
for (auto m=wxsMap.begin(); m != wxsMap.end(); m++) {
|
||||||
|
auto v152 = m->first;
|
||||||
|
auto v156 = m->second;
|
||||||
|
std::string v146;
|
||||||
|
if ( night::compile_ns_no_wrapper(v152, v156, 1, v146, 0) )
|
||||||
|
{
|
||||||
|
errMsg = "Error: " + v146 + "\n";
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
auto v31 = snprintf(0, 0, WXML::GlassEaselWxs::sWrapper.c_str(),
|
||||||
|
v146.c_str()) + 1; char *v32 = (char *)operator new[](v31);
|
||||||
|
snprintf(v32, v31, WXML::GlassEaselWxs::sWrapper.c_str(),
|
||||||
|
v146.c_str()); wxsMap[v152] = v32; delete[] v32;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (options.lazyload) {
|
if (options.lazyload) {
|
||||||
|
|
||||||
// 懒加载
|
// 懒加载
|
||||||
std::vector<std::string> splitedData;
|
std::vector<std::string> splitedData;
|
||||||
split(splitedData, options.lazyloadConfig, options.wxmlCompileConfigSplit);
|
split(splitedData, options.lazyloadConfig,
|
||||||
|
options.wxmlCompileConfigSplit);
|
||||||
// 处理文件路径
|
// 处理文件路径
|
||||||
for (int i = 0; i < splitedData.size(); i++) {
|
for (int i = 0; i < splitedData.size(); i++) {
|
||||||
string path = splitedData[i];
|
string path = splitedData[i];
|
||||||
@ -110,7 +139,8 @@ int compile(Isolate *isolate, WCCOptions &options, Local<Value> &result,
|
|||||||
"__WXML_GLOBAL__="
|
"__WXML_GLOBAL__="
|
||||||
"__WXML_GLOBAL__||{entrys:{},defines:{},modules:{},ops:[],wxs_nf_"
|
"__WXML_GLOBAL__||{entrys:{},defines:{},modules:{},ops:[],wxs_nf_"
|
||||||
"init:undefined,total_ops:0};var Component=Comp"
|
"init:undefined,total_ops:0};var Component=Comp"
|
||||||
"onent||function(){};var definePlugin=definePlugin||function(){};var "
|
"onent||function(){};var "
|
||||||
|
"definePlugin=definePlugin||function(){};var "
|
||||||
"requirePlugin=requirePlugin||function(){};"
|
"requirePlugin=requirePlugin||function(){};"
|
||||||
"var Behavior=Behavior||function(){};var "
|
"var Behavior=Behavior||function(){};var "
|
||||||
"__vd_version_info__=__vd_version_info__||{};var "
|
"__vd_version_info__=__vd_version_info__||{};var "
|
||||||
@ -131,7 +161,8 @@ int compile(Isolate *isolate, WCCOptions &options, Local<Value> &result,
|
|||||||
"__WXML_GLOBAL__="
|
"__WXML_GLOBAL__="
|
||||||
"__WXML_GLOBAL__||{entrys:{},defines:{},modules:{},ops:[],wxs_nf_"
|
"__WXML_GLOBAL__||{entrys:{},defines:{},modules:{},ops:[],wxs_nf_"
|
||||||
"init:undefined,total_ops:0};var Component=Comp"
|
"init:undefined,total_ops:0};var Component=Comp"
|
||||||
"onent||function(){};var definePlugin=definePlugin||function(){};var "
|
"onent||function(){};var "
|
||||||
|
"definePlugin=definePlugin||function(){};var "
|
||||||
"requirePlugin=requirePlugin||function(){};"
|
"requirePlugin=requirePlugin||function(){};"
|
||||||
"var Behavior=Behavior||function(){};var "
|
"var Behavior=Behavior||function(){};var "
|
||||||
"__vd_version_info__=__vd_version_info__||{};var "
|
"__vd_version_info__=__vd_version_info__||{};var "
|
||||||
@ -201,7 +232,8 @@ int compile(Isolate *isolate, WCCOptions &options, Local<Value> &result,
|
|||||||
|
|
||||||
// 创建一个实例
|
// 创建一个实例
|
||||||
v8::Local<v8::Object> object_instance = v8::Object::New(isolate);
|
v8::Local<v8::Object> object_instance = v8::Object::New(isolate);
|
||||||
auto _ = object_instance->Set(isolate->GetCurrentContext(),
|
auto _ = object_instance->Set(
|
||||||
|
isolate->GetCurrentContext(),
|
||||||
String::NewFromUtf8(isolate, "generateFunctionName",
|
String::NewFromUtf8(isolate, "generateFunctionName",
|
||||||
v8::NewStringType::kNormal)
|
v8::NewStringType::kNormal)
|
||||||
.ToLocalChecked(),
|
.ToLocalChecked(),
|
||||||
@ -247,6 +279,11 @@ int compile(Isolate *isolate, WCCOptions &options, Local<Value> &result,
|
|||||||
.ToLocalChecked();
|
.ToLocalChecked();
|
||||||
return compilerResult;
|
return compilerResult;
|
||||||
}
|
}
|
||||||
|
} catch (std::string err) {
|
||||||
|
fprintf(stderr, "err: %s\n", err.c_str());
|
||||||
|
errMsg = err;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,8 +317,12 @@ void wcc(const FunctionCallbackInfo<Value> &args) {
|
|||||||
// Convert the "msg" property to a C++ string and return it.
|
// Convert the "msg" property to a C++ string and return it.
|
||||||
if (code) {
|
if (code) {
|
||||||
// error
|
// error
|
||||||
args.GetReturnValue().Set(
|
// args.GetReturnValue().Set(
|
||||||
String::NewFromUtf8(isolate, errMsg.c_str(), NewStringType::kNormal)
|
// String::NewFromUtf8(isolate, errMsg.c_str(), NewStringType::kNormal)
|
||||||
|
// .ToLocalChecked());
|
||||||
|
isolate->ThrowException(String::NewFromUtf8(isolate,
|
||||||
|
errMsg.c_str(),
|
||||||
|
NewStringType::kNormal)
|
||||||
.ToLocalChecked());
|
.ToLocalChecked());
|
||||||
} else {
|
} else {
|
||||||
// ok
|
// ok
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "../include/night.h"
|
#include "../include/night.h"
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace night
|
namespace night
|
||||||
{
|
{
|
||||||
@ -156,6 +157,42 @@ namespace night
|
|||||||
throw "not implement";
|
throw "not implement";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int compile_ns_no_wrapper(
|
||||||
|
std::string const& a1,
|
||||||
|
std::string const& a2,
|
||||||
|
uint a3,
|
||||||
|
std::string& a4,
|
||||||
|
bool a5
|
||||||
|
)
|
||||||
|
{
|
||||||
|
const char off_51B9E4[] = { '\0', '%', 'u', '\0' }; // idb
|
||||||
|
a4 = off_51B9E4;
|
||||||
|
// a4 = "";
|
||||||
|
night::NSStream v22(a1, a2, a3);
|
||||||
|
night::NSGod v8;
|
||||||
|
|
||||||
|
night::NSToken v11;
|
||||||
|
v11.offset_0 = &v8;
|
||||||
|
v11.offset_4 = &v22;
|
||||||
|
|
||||||
|
std::string v13 = a1;
|
||||||
|
night::NSASTParse v23(v13, &v11, &v8);
|
||||||
|
v13 = "";
|
||||||
|
|
||||||
|
night::NSCompileJs compile;
|
||||||
|
compile.offset_24 = &v23;
|
||||||
|
std::vector<std::string> v9;
|
||||||
|
std::string v10 = compile.compile_once(a4, &v9, a5);
|
||||||
|
v8.hamlet();
|
||||||
|
|
||||||
|
int v5 =0;
|
||||||
|
if(v10.length())
|
||||||
|
{
|
||||||
|
a4 = v10;
|
||||||
|
v5 = 121;
|
||||||
|
}
|
||||||
|
return v5;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 此函数只有定义实现,没有调用
|
* 此函数只有定义实现,没有调用
|
||||||
* 所以,没有必要实现
|
* 所以,没有必要实现
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include "../include/night.h"
|
#include "../include/night.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
namespace night
|
namespace night
|
||||||
{
|
{
|
||||||
@ -694,6 +696,7 @@ namespace night
|
|||||||
int inner_compile_once_i = compile_once_i;
|
int inner_compile_once_i = compile_once_i;
|
||||||
this->offset_28 = a4;
|
this->offset_28 = a4;
|
||||||
a3 = "";
|
a3 = "";
|
||||||
|
try {
|
||||||
night::ns_node* v5 = this->offset_24->top_down();
|
night::ns_node* v5 = this->offset_24->top_down();
|
||||||
if (a5)
|
if (a5)
|
||||||
{
|
{
|
||||||
@ -702,6 +705,13 @@ namespace night
|
|||||||
}
|
}
|
||||||
std::string v9 = this->compile(v5);
|
std::string v9 = this->compile(v5);
|
||||||
a3.assign(v9);
|
a3.assign(v9);
|
||||||
|
}
|
||||||
|
catch(const std::exception& err)
|
||||||
|
{
|
||||||
|
// printf("%s\n", err.what());
|
||||||
|
std::string ret(err.what());
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
return this->offset_0;
|
return this->offset_0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,11 +31,11 @@ namespace night
|
|||||||
{
|
{
|
||||||
if (this->offset_24.length())
|
if (this->offset_24.length())
|
||||||
{
|
{
|
||||||
sprintf(str, "(%d,%d)type[%s] value[%s]", this->offset_48, this->offset_52, this->offset_0, this->offset_60);
|
sprintf(str, "(%d,%d)type[%s] value[%s]", this->offset_48, this->offset_52, this->offset_0.c_str(), this->offset_60.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(str, "type[%s] value[%s]", this->offset_0, this->offset_60);
|
sprintf(str, "type[%s] value[%s]", this->offset_0.c_str(), this->offset_60.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
@ -49,22 +49,22 @@ namespace night
|
|||||||
{
|
{
|
||||||
if (this->offset_24.length())
|
if (this->offset_24.length())
|
||||||
{
|
{
|
||||||
sprintf(str, "(%d,%d)type[%s] value[%s]", this->offset_48, this->offset_52, this->offset_0, this->offset_60);
|
sprintf(str, "(%d,%d)type[%s] value[%s]", this->offset_48, this->offset_52, this->offset_0.c_str(), this->offset_60.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(str, "type[%s] value[%s]", this->offset_0, this->offset_60);
|
sprintf(str, "type[%s] value[%s]", this->offset_0.c_str(), this->offset_60.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ("var" == this->offset_0)
|
if ("var" == this->offset_0)
|
||||||
{
|
{
|
||||||
if (this->offset_24.length())
|
if (this->offset_24.length())
|
||||||
{
|
{
|
||||||
sprintf(str, "(%d,%d)type[%s] value[%s] flag[%d]", this->offset_48, this->offset_52, this->offset_0, this->offset_60, this->offset_56);
|
sprintf(str, "(%d,%d)type[%s] value[%s] flag[%d]", this->offset_48, this->offset_52, this->offset_0.c_str(), this->offset_60.c_str(), this->offset_56);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf(str, "type[%s] value[%s] flag[%d]", this->offset_0, this->offset_60, this->offset_56);
|
sprintf(str, "type[%s] value[%s] flag[%d]", this->offset_0.c_str(), this->offset_60.c_str(), this->offset_56);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// debug_no_space - 5
|
// debug_no_space - 5
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
#include "../include/night.h"
|
#include "../include/night.h"
|
||||||
|
#include <exception>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace night
|
namespace night
|
||||||
{
|
{
|
||||||
@ -128,7 +130,8 @@ namespace night
|
|||||||
v12.append(":");
|
v12.append(":");
|
||||||
v10 += v12;
|
v10 += v12;
|
||||||
v10 += a2;
|
v10 += a2;
|
||||||
throw v10;
|
|
||||||
|
throw std::runtime_error(v10.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -320,12 +320,12 @@ namespace night
|
|||||||
|
|
||||||
bool NSToken::tk_is_whitespace(char ch, void *)
|
bool NSToken::tk_is_whitespace(char ch, void *)
|
||||||
{
|
{
|
||||||
auto v1 = night::NS_BUILTIN_SPACE.find(ch, 0);
|
int v1 = night::NS_BUILTIN_SPACE.find(ch, 0);
|
||||||
return v1 != -1;
|
return v1 != -1;
|
||||||
}
|
}
|
||||||
bool NSToken::tk_is_not_line_break(char ch, void *)
|
bool NSToken::tk_is_not_line_break(char ch, void *)
|
||||||
{
|
{
|
||||||
return ch != 10;
|
return ch != 10; // \n
|
||||||
}
|
}
|
||||||
bool NSToken::tk_is_valid_op_str(char ch, void *t)
|
bool NSToken::tk_is_valid_op_str(char ch, void *t)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
#include <cstdint>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
std::string EscapeToJsonString(std::string const& a2)
|
std::string EscapeToJsonString(std::string const& a2)
|
||||||
{
|
{
|
||||||
@ -48,3 +50,233 @@ std::string DictToJsonString(std::map<std::string, std::string> const& a2)
|
|||||||
ret << "}";
|
ret << "}";
|
||||||
return ret.str();
|
return ret.str();
|
||||||
}
|
}
|
||||||
|
int HexDigit(char a1, int a2)
|
||||||
|
{
|
||||||
|
int v2; // eax
|
||||||
|
|
||||||
|
if ( (uint8_t)(a1 - 48) > 9u )
|
||||||
|
{
|
||||||
|
if ( (uint8_t)(a1 - 97) > 5u )
|
||||||
|
{
|
||||||
|
v2 = 0;
|
||||||
|
if ( (uint8_t)(a1 - 65) <= 5u )
|
||||||
|
v2 = a1 - 55;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v2 = a1 - 87;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v2 = a1 - 48;
|
||||||
|
}
|
||||||
|
return v2 << a2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int GetUnicodeNum(std::string &a1, int a2)
|
||||||
|
{
|
||||||
|
int v3; // ebx
|
||||||
|
int v4; // ebx
|
||||||
|
int v5; // ebx
|
||||||
|
|
||||||
|
v3 = HexDigit(a1[a2 + 2], 12);
|
||||||
|
v4 = HexDigit(a1[a2 + 3], 8) + v3;
|
||||||
|
v5 = HexDigit(a1[a2 + 4], 4) + v4;
|
||||||
|
return v5 + HexDigit(a1[a2 + 5], 0);
|
||||||
|
}
|
||||||
|
void GetUnicode(std::string& a1, unsigned int a2)
|
||||||
|
{
|
||||||
|
char v2; // bl
|
||||||
|
unsigned int v3; // eax
|
||||||
|
unsigned int v4; // eax
|
||||||
|
|
||||||
|
v2 = a2;
|
||||||
|
if ( a2 > 0x7F )
|
||||||
|
{
|
||||||
|
if ( a2 > 0x7FF )
|
||||||
|
{
|
||||||
|
if ( a2 > 0xFFFF )
|
||||||
|
{
|
||||||
|
a1.push_back((a2 >> 18) | 0xF0);
|
||||||
|
v4 = (a2 >> 12) & 0x3F | 0xFFFFFF80;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v4 = (a2 >> 12) | 0xFFFFFFE0;
|
||||||
|
}
|
||||||
|
a1.push_back(v4);
|
||||||
|
v3 = (a2 >> 6) & 0x3F | 0xFFFFFF80;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v3 = (a2 >> 6) | 0xFFFFFFC0;
|
||||||
|
}
|
||||||
|
a1.push_back(v3);
|
||||||
|
v2 = a2 & 0x3F | 0x80;
|
||||||
|
}
|
||||||
|
a1.push_back(v2);
|
||||||
|
}
|
||||||
|
int GetJsonString(std::string &a1, int *a2, std::string& a3)
|
||||||
|
{
|
||||||
|
|
||||||
|
std::ostringstream v17;
|
||||||
|
int v3 = *a2;
|
||||||
|
if ( a1[*a2] != '"' )
|
||||||
|
{
|
||||||
|
LABEL_41:
|
||||||
|
int v9 = ~v3;
|
||||||
|
return v9;
|
||||||
|
}
|
||||||
|
std::string v16;
|
||||||
|
for ( *a2 = v3 + 1; ; ++*a2 )
|
||||||
|
{
|
||||||
|
v3 = *a2;
|
||||||
|
char v12;
|
||||||
|
int v6;
|
||||||
|
int v14 = a1.length();
|
||||||
|
if ( *a2 >= v14 )
|
||||||
|
return ~v3;
|
||||||
|
char v5 = a1[v3];
|
||||||
|
if ( v5 == '"' )
|
||||||
|
break;
|
||||||
|
if ( v5 == '\\' )
|
||||||
|
{
|
||||||
|
if ( v3 + 1 >= v14 )
|
||||||
|
{
|
||||||
|
v6 = -2;
|
||||||
|
LABEL_31:
|
||||||
|
return v6 - v3;
|
||||||
|
}
|
||||||
|
char v7 = a1[v3 + 1];
|
||||||
|
if ( v7 == 'n' )
|
||||||
|
{
|
||||||
|
v12 = 10;
|
||||||
|
goto LABEL_26;
|
||||||
|
}
|
||||||
|
if ( v7 <= 'n' )
|
||||||
|
{
|
||||||
|
if ( v7 == 'b' )
|
||||||
|
{
|
||||||
|
v12 = 8;
|
||||||
|
goto LABEL_26;
|
||||||
|
}
|
||||||
|
if ( v7 <= 'b' )
|
||||||
|
{
|
||||||
|
if ( v7 != '/' && v7 != '\\' && v7 != '"' )
|
||||||
|
goto LABEL_41;
|
||||||
|
v17 << a1[v3 + 1];
|
||||||
|
goto LABEL_27;
|
||||||
|
}
|
||||||
|
if ( v7 != 'f' )
|
||||||
|
goto LABEL_41;
|
||||||
|
v12 = 12;
|
||||||
|
LABEL_26:
|
||||||
|
v17 << v12;
|
||||||
|
LABEL_27:
|
||||||
|
++*a2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( v7 == 't' )
|
||||||
|
{
|
||||||
|
int v12 = 9;
|
||||||
|
goto LABEL_26;
|
||||||
|
}
|
||||||
|
if ( v7 != 'u' )
|
||||||
|
{
|
||||||
|
if ( v7 != 'r' )
|
||||||
|
goto LABEL_41;
|
||||||
|
int v12 = 13;
|
||||||
|
goto LABEL_26;
|
||||||
|
}
|
||||||
|
int UnicodeNum = GetUnicodeNum(a1, v3);
|
||||||
|
if ( (unsigned int)(UnicodeNum - 55296) > 0x3FF )
|
||||||
|
{
|
||||||
|
*a2 = v3 + 5;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( v3 + 11 >= v14 || a1[v3 + 6] != '\\' )
|
||||||
|
{
|
||||||
|
v6 = -7;
|
||||||
|
goto LABEL_31;
|
||||||
|
}
|
||||||
|
if ( a1[v3 + 7] != 'u' )
|
||||||
|
{
|
||||||
|
v6 = -8;
|
||||||
|
goto LABEL_31;
|
||||||
|
}
|
||||||
|
int v10 = GetUnicodeNum(a1, v3 + 6);
|
||||||
|
*a2 = v3 + 11;
|
||||||
|
UnicodeNum = (v10 & 0x3FF | (UnicodeNum << 10) & 0xFFC00) + 0x10000;
|
||||||
|
}
|
||||||
|
GetUnicode(v16, UnicodeNum);
|
||||||
|
v17 << v16;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v17 << a1[v3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*a2 = v3 + 1;
|
||||||
|
a3 = v17.str();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int GetJsonDict(std::string &a1, std::map<std::string, std::string>& a2)
|
||||||
|
{
|
||||||
|
if ( a1[0] != '{' )
|
||||||
|
return -1;
|
||||||
|
int v10 = 1;
|
||||||
|
while ( 1 )
|
||||||
|
{
|
||||||
|
int v3 = a1.length();
|
||||||
|
if ( v10 >= v3 )
|
||||||
|
return 0;
|
||||||
|
std::string v11;
|
||||||
|
std::string v13;
|
||||||
|
while ( v10 < v3 )
|
||||||
|
{
|
||||||
|
if ( a1[v10] == '"' )
|
||||||
|
goto LABEL_9;
|
||||||
|
++v10;
|
||||||
|
}
|
||||||
|
if ( v10 == v3 )
|
||||||
|
return 0;
|
||||||
|
LABEL_9:
|
||||||
|
int JsonString = GetJsonString(a1, &v10, v11);
|
||||||
|
if ( JsonString )
|
||||||
|
return JsonString;
|
||||||
|
int v5 = a1.length();
|
||||||
|
while ( v10 < v5 )
|
||||||
|
{
|
||||||
|
if ( a1[v10] == ':' )
|
||||||
|
goto LABEL_18;
|
||||||
|
++v10;
|
||||||
|
}
|
||||||
|
if ( v10 == v5 )
|
||||||
|
{
|
||||||
|
LABEL_26:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
LABEL_18:
|
||||||
|
while ( v10 < v5 )
|
||||||
|
{
|
||||||
|
if (a1[v10] == '"' )
|
||||||
|
goto LABEL_20;
|
||||||
|
++v10;
|
||||||
|
}
|
||||||
|
if ( v10 == v5 )
|
||||||
|
return 0;
|
||||||
|
LABEL_20:
|
||||||
|
JsonString = GetJsonString(a1, &v10, v13);
|
||||||
|
if ( JsonString )
|
||||||
|
{
|
||||||
|
LABEL_27:
|
||||||
|
return JsonString;
|
||||||
|
}
|
||||||
|
a2[v11] = v13;
|
||||||
|
int v7 = a1.length();
|
||||||
|
while ( v10 < v7 && a1[v10] != ',' )
|
||||||
|
++v10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
95
src/wcc.cpp
95
src/wcc.cpp
@ -1,4 +1,6 @@
|
|||||||
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -7,6 +9,7 @@
|
|||||||
#include "include/string_utils.h"
|
#include "include/string_utils.h"
|
||||||
#include "include/wxml.h"
|
#include "include/wxml.h"
|
||||||
#include "include/json.h"
|
#include "include/json.h"
|
||||||
|
#include "include/night.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -64,6 +67,9 @@ int main(int argc, const char **argv)
|
|||||||
bool version = false;
|
bool version = false;
|
||||||
bool isLLA = false;
|
bool isLLA = false;
|
||||||
bool hasLL = false;
|
bool hasLL = false;
|
||||||
|
bool isWxs = false;
|
||||||
|
bool isGDC = false;
|
||||||
|
bool isWxsEnv = false;
|
||||||
string xc_Or_completeCode_Param;
|
string xc_Or_completeCode_Param;
|
||||||
string outputFileName;
|
string outputFileName;
|
||||||
vector<string> fileList;
|
vector<string> fileList;
|
||||||
@ -218,9 +224,7 @@ int main(int argc, const char **argv)
|
|||||||
mapData1["life_cycle_callback_content"] = callbackData;
|
mapData1["life_cycle_callback_content"] = callbackData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (!param.compare("--pm"))
|
||||||
{
|
|
||||||
if (!param.compare("--pm"))
|
|
||||||
{
|
{
|
||||||
// 参数是--pm
|
// 参数是--pm
|
||||||
if (i + 1 < paramList.size())
|
if (i + 1 < paramList.size())
|
||||||
@ -229,6 +233,9 @@ int main(int argc, const char **argv)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
if (param[1] == 'l' && param[2] == 'l')
|
if (param[1] == 'l' && param[2] == 'l')
|
||||||
{
|
{
|
||||||
// -ll
|
// -ll
|
||||||
@ -259,6 +266,19 @@ int main(int argc, const char **argv)
|
|||||||
i++;
|
i++;
|
||||||
hasLL = true;
|
hasLL = true;
|
||||||
}
|
}
|
||||||
|
else if (!param.compare("--wxs"))
|
||||||
|
{
|
||||||
|
isWxs = true;
|
||||||
|
}
|
||||||
|
else if (!param.compare("--gdc"))
|
||||||
|
{
|
||||||
|
isGDC = true;
|
||||||
|
}
|
||||||
|
else if (!param.compare("--wxs-env"))
|
||||||
|
{
|
||||||
|
isWxsEnv = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,6 +300,74 @@ int main(int argc, const char **argv)
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isWxs)
|
||||||
|
{
|
||||||
|
std::string wxs;
|
||||||
|
if (fileList.size() == 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "WXS file is needed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if ( readFile(fileList[0].c_str(), wxs))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to read input from %s\n", fileList[0].c_str());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
std::map<std::string, std::string> cfg;
|
||||||
|
int ret = GetJsonDict(wxs, cfg);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Failed to read JSON at position %d (%c)", ret, wxs[ret]);
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto m=cfg.begin(); m != cfg.end(); m++) {
|
||||||
|
auto v152 = m->first;
|
||||||
|
auto v156 = m->second;
|
||||||
|
std::string v146;
|
||||||
|
if ( night::compile_ns_no_wrapper(v152, v156, 1, v146, 0) )
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Error in file %s: %s\n", v152.c_str(), v146.c_str());
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
auto v31 = snprintf(0, 0, WXML::GlassEaselWxs::sWrapper.c_str(), v146.c_str()) + 1;
|
||||||
|
char *v32 = (char *)operator new[](v31);
|
||||||
|
snprintf(v32, v31, WXML::GlassEaselWxs::sWrapper.c_str(), v146.c_str());
|
||||||
|
cfg[v152] = v32;
|
||||||
|
delete[] v32;
|
||||||
|
}
|
||||||
|
std::string v136 = DictToJsonString(cfg);
|
||||||
|
FILE *f = stdout;
|
||||||
|
if (!outputFileName.empty())
|
||||||
|
f = fopen(outputFileName.c_str(), "w");
|
||||||
|
fprintf(f, "%s\n", v136.data());
|
||||||
|
if (f != stdout)
|
||||||
|
return fclose(f);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (isGDC)
|
||||||
|
{
|
||||||
|
std::string v136 = WXML::GlassEaselWxs::sGenFuncDeepCopy.c_str();
|
||||||
|
FILE *f = stdout;
|
||||||
|
if (!outputFileName.empty())
|
||||||
|
f = fopen(outputFileName.c_str(), "w");
|
||||||
|
fprintf(f, "%s\n", v136.data());
|
||||||
|
if (f != stdout)
|
||||||
|
return fclose(f);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (isWxsEnv)
|
||||||
|
{
|
||||||
|
std::string v136 = WXML::GlassEaselWxs::sWxsEnvInit.c_str();
|
||||||
|
FILE *f = stdout;
|
||||||
|
if (!outputFileName.empty())
|
||||||
|
f = fopen(outputFileName.c_str(), "w");
|
||||||
|
fprintf(f, "%s\n", v136.data());
|
||||||
|
if (f != stdout)
|
||||||
|
return fclose(f);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// main - 30
|
// main - 30
|
||||||
if (fileList.empty())
|
if (fileList.empty())
|
||||||
{
|
{
|
||||||
@ -498,6 +586,7 @@ int main(int argc, const char **argv)
|
|||||||
f = fopen(outputFileName.data(), "w");
|
f = fopen(outputFileName.data(), "w");
|
||||||
}
|
}
|
||||||
fprintf(f, "%s\n", v113.data());
|
fprintf(f, "%s\n", v113.data());
|
||||||
|
if (f != stdout)
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
919
test/main.cpp
Normal file
919
test/main.cpp
Normal file
@ -0,0 +1,919 @@
|
|||||||
|
|
||||||
|
//----- (00500ED0) --------------------------------------------------------
|
||||||
|
int main(int argc, const char **argv, const char **envp)
|
||||||
|
{
|
||||||
|
int v3; // ebx
|
||||||
|
char **v4; // edi
|
||||||
|
int v5; // eax
|
||||||
|
bool v6; // dl
|
||||||
|
int v7; // edi
|
||||||
|
int v8; // ebx
|
||||||
|
void **v9; // eax
|
||||||
|
_BYTE *v10; // edx
|
||||||
|
char v11; // al
|
||||||
|
char v12; // al
|
||||||
|
void **v13; // eax
|
||||||
|
void **v14; // eax
|
||||||
|
bool v15; // si
|
||||||
|
_BYTE *v16; // edx
|
||||||
|
char *v17; // eax
|
||||||
|
_DWORD *v18; // eax
|
||||||
|
const char **v19; // ecx
|
||||||
|
_BYTE *v20; // eax
|
||||||
|
void **v21; // esi
|
||||||
|
_DWORD *v22; // eax
|
||||||
|
char v23; // dl
|
||||||
|
void **v24; // ebx
|
||||||
|
char *v25; // ecx
|
||||||
|
int v26; // edx
|
||||||
|
int v27; // edx
|
||||||
|
FILE *v28; // ebx
|
||||||
|
int JsonDict; // eax
|
||||||
|
char **m; // ebx
|
||||||
|
int v31; // edi
|
||||||
|
char *v32; // esi
|
||||||
|
_DWORD *v33; // eax
|
||||||
|
const char **v34; // edx
|
||||||
|
unsigned int v35; // ebx
|
||||||
|
_DWORD *v36; // eax
|
||||||
|
_DWORD *v37; // eax
|
||||||
|
int v38; // esi
|
||||||
|
int v39; // edi
|
||||||
|
int v40; // esi
|
||||||
|
int *inserted; // ebx
|
||||||
|
char *v42; // eax
|
||||||
|
void **v43; // edi
|
||||||
|
char *v44; // esi
|
||||||
|
int insert_hint_unique_pos; // eax
|
||||||
|
_DWORD *v46; // edx
|
||||||
|
int v47; // edx
|
||||||
|
_DWORD *v48; // eax
|
||||||
|
int v49; // edx
|
||||||
|
FILE *v50; // ebx
|
||||||
|
int v51; // edi
|
||||||
|
void **j; // ebx
|
||||||
|
int *v53; // eax
|
||||||
|
int *v54; // esi
|
||||||
|
_DWORD *v55; // ebx
|
||||||
|
_DWORD *v56; // eax
|
||||||
|
_DWORD *v57; // eax
|
||||||
|
void **v58; // ecx
|
||||||
|
_DWORD *v59; // eax
|
||||||
|
int *k; // edi
|
||||||
|
std::ostream::sentry *v61; // esi
|
||||||
|
std::ostream::sentry *v62; // eax
|
||||||
|
int *v63; // ebx
|
||||||
|
std::ostream::sentry *v64; // eax
|
||||||
|
_DWORD *v65; // eax
|
||||||
|
FILE *v66; // ebx
|
||||||
|
int v67; // edx
|
||||||
|
int v68; // edx
|
||||||
|
int v69; // edx
|
||||||
|
void (__cdecl *v71)(void *); // [esp-6Ch] [ebp-414h]
|
||||||
|
char v72; // [esp+6h] [ebp-3A2h]
|
||||||
|
char v73; // [esp+7h] [ebp-3A1h]
|
||||||
|
char v74; // [esp+8h] [ebp-3A0h]
|
||||||
|
char v75; // [esp+9h] [ebp-39Fh]
|
||||||
|
char v76; // [esp+Ah] [ebp-39Eh]
|
||||||
|
char v77; // [esp+Bh] [ebp-39Dh]
|
||||||
|
const char **v78; // [esp+Ch] [ebp-39Ch]
|
||||||
|
char **v79; // [esp+Ch] [ebp-39Ch]
|
||||||
|
int v80; // [esp+10h] [ebp-398h]
|
||||||
|
int v81; // [esp+10h] [ebp-398h]
|
||||||
|
char v82; // [esp+14h] [ebp-394h]
|
||||||
|
int *v83; // [esp+14h] [ebp-394h]
|
||||||
|
int v84; // [esp+18h] [ebp-390h]
|
||||||
|
std::ostream::sentry *i; // [esp+18h] [ebp-390h]
|
||||||
|
std::ostream::sentry *v86; // [esp+18h] [ebp-390h]
|
||||||
|
bool excb; // [esp+1Ch] [ebp-38Ch]
|
||||||
|
int exc; // [esp+1Ch] [ebp-38Ch]
|
||||||
|
int exca; // [esp+1Ch] [ebp-38Ch]
|
||||||
|
char *FileName; // [esp+28h] [ebp-380h] BYREF
|
||||||
|
const char **v91; // [esp+2Ch] [ebp-37Ch] BYREF
|
||||||
|
void **v92; // [esp+30h] [ebp-378h]
|
||||||
|
int v93; // [esp+34h] [ebp-374h]
|
||||||
|
void **v94; // [esp+38h] [ebp-370h] BYREF
|
||||||
|
int v95; // [esp+3Ch] [ebp-36Ch]
|
||||||
|
int v96; // [esp+40h] [ebp-368h]
|
||||||
|
void **v97; // [esp+44h] [ebp-364h] BYREF
|
||||||
|
int v98; // [esp+48h] [ebp-360h]
|
||||||
|
int v99; // [esp+4Ch] [ebp-35Ch]
|
||||||
|
char *v100; // [esp+50h] [ebp-358h] BYREF
|
||||||
|
int v101; // [esp+54h] [ebp-354h]
|
||||||
|
char v102; // [esp+58h] [ebp-350h] BYREF
|
||||||
|
char *v103; // [esp+68h] [ebp-340h] BYREF
|
||||||
|
int v104; // [esp+6Ch] [ebp-33Ch]
|
||||||
|
char v105; // [esp+70h] [ebp-338h] BYREF
|
||||||
|
int v106; // [esp+80h] [ebp-328h] BYREF
|
||||||
|
int v107[5]; // [esp+84h] [ebp-324h] BYREF
|
||||||
|
int v108[6]; // [esp+98h] [ebp-310h] BYREF
|
||||||
|
void *v109[6]; // [esp+B0h] [ebp-2F8h] BYREF
|
||||||
|
int v110; // [esp+C8h] [ebp-2E0h] BYREF
|
||||||
|
int v111[5]; // [esp+CCh] [ebp-2DCh] BYREF
|
||||||
|
int v112; // [esp+E0h] [ebp-2C8h] BYREF
|
||||||
|
int v113[5]; // [esp+E4h] [ebp-2C4h] BYREF
|
||||||
|
int v114; // [esp+F8h] [ebp-2B0h] BYREF
|
||||||
|
int v115[5]; // [esp+FCh] [ebp-2ACh] BYREF
|
||||||
|
int v116[2]; // [esp+110h] [ebp-298h] BYREF
|
||||||
|
char v117; // [esp+118h] [ebp-290h] BYREF
|
||||||
|
void *v118[2]; // [esp+128h] [ebp-280h] BYREF
|
||||||
|
char v119; // [esp+130h] [ebp-278h] BYREF
|
||||||
|
int v120; // [esp+140h] [ebp-268h] BYREF
|
||||||
|
int v121[5]; // [esp+144h] [ebp-264h] BYREF
|
||||||
|
int v122; // [esp+158h] [ebp-250h] BYREF
|
||||||
|
int v123[5]; // [esp+15Ch] [ebp-24Ch] BYREF
|
||||||
|
int v124; // [esp+170h] [ebp-238h] BYREF
|
||||||
|
int v125[5]; // [esp+174h] [ebp-234h] BYREF
|
||||||
|
int v126; // [esp+188h] [ebp-220h] BYREF
|
||||||
|
int v127[5]; // [esp+18Ch] [ebp-21Ch] BYREF
|
||||||
|
int v128[6]; // [esp+1A0h] [ebp-208h] BYREF
|
||||||
|
int v129[6]; // [esp+1B8h] [ebp-1F0h] BYREF
|
||||||
|
int v130[6]; // [esp+1D0h] [ebp-1D8h] BYREF
|
||||||
|
int v131[6]; // [esp+1E8h] [ebp-1C0h] BYREF
|
||||||
|
int v132[6]; // [esp+200h] [ebp-1A8h] BYREF
|
||||||
|
int v133; // [esp+218h] [ebp-190h] BYREF
|
||||||
|
int v134; // [esp+21Ch] [ebp-18Ch]
|
||||||
|
int v135; // [esp+220h] [ebp-188h]
|
||||||
|
int v136; // [esp+230h] [ebp-178h] BYREF
|
||||||
|
int v137; // [esp+234h] [ebp-174h]
|
||||||
|
int v138; // [esp+238h] [ebp-170h]
|
||||||
|
char *String; // [esp+248h] [ebp-160h] BYREF
|
||||||
|
int v140; // [esp+24Ch] [ebp-15Ch]
|
||||||
|
int v141; // [esp+250h] [ebp-158h] BYREF
|
||||||
|
int v142; // [esp+260h] [ebp-148h] BYREF
|
||||||
|
char *v143[5]; // [esp+264h] [ebp-144h] BYREF
|
||||||
|
char *v144; // [esp+278h] [ebp-130h] BYREF
|
||||||
|
int v145[5]; // [esp+27Ch] [ebp-12Ch] BYREF
|
||||||
|
int v146; // [esp+290h] [ebp-118h] BYREF
|
||||||
|
int v147; // [esp+294h] [ebp-114h]
|
||||||
|
char v148[16]; // [esp+298h] [ebp-110h] BYREF
|
||||||
|
char *Format; // [esp+2A8h] [ebp-100h] BYREF
|
||||||
|
int v150; // [esp+2ACh] [ebp-FCh]
|
||||||
|
int v151[4]; // [esp+2B0h] [ebp-F8h] BYREF
|
||||||
|
int v152; // [esp+2C0h] [ebp-E8h] BYREF
|
||||||
|
int v153; // [esp+2C4h] [ebp-E4h]
|
||||||
|
char v154[4]; // [esp+2C8h] [ebp-E0h] BYREF
|
||||||
|
int v155[3]; // [esp+2CCh] [ebp-DCh] BYREF
|
||||||
|
char v156[192]; // [esp+2D8h] [ebp-D0h] BYREF
|
||||||
|
int *p_argc; // [esp+398h] [ebp-10h]
|
||||||
|
|
||||||
|
p_argc = &argc;
|
||||||
|
v80 = argc;
|
||||||
|
v78 = argv;
|
||||||
|
__main();
|
||||||
|
FileName = 0;
|
||||||
|
v100 = &v102;
|
||||||
|
v91 = 0;
|
||||||
|
v92 = 0;
|
||||||
|
v93 = 0;
|
||||||
|
v101 = 0;
|
||||||
|
v102 = 0;
|
||||||
|
v103 = &v105;
|
||||||
|
v104 = 0;
|
||||||
|
v105 = 0;
|
||||||
|
v94 = 0;
|
||||||
|
v95 = 0;
|
||||||
|
v96 = 0;
|
||||||
|
v97 = 0;
|
||||||
|
v98 = 0;
|
||||||
|
v99 = 0;
|
||||||
|
std::_Rb_tree_header::_Rb_tree_header(v107);
|
||||||
|
std::string::basic_string((void **)v108, "$gwx");
|
||||||
|
std::string::basic_string(v109, " ");
|
||||||
|
v3 = 1;
|
||||||
|
std::_Rb_tree_header::_Rb_tree_header(v111);
|
||||||
|
while ( v3 < v80 )
|
||||||
|
{
|
||||||
|
std::string::basic_string((void **)&v152, "--config-path");
|
||||||
|
v4 = (char **)&v78[v3];
|
||||||
|
v5 = std::string::compare((int)&v152, *v4);
|
||||||
|
v6 = 0;
|
||||||
|
if ( !v5 )
|
||||||
|
v6 = v3 + 1 < v80;
|
||||||
|
excb = v6;
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
if ( excb )
|
||||||
|
{
|
||||||
|
std::string::operator=((unsigned int *)&v103, (char *)v78[++v3]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string::basic_string((void **)&v152, *v4);
|
||||||
|
std::vector<std::string>::emplace_back<std::string>(&v94, &v152);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
}
|
||||||
|
++v3;
|
||||||
|
}
|
||||||
|
if ( v104 )
|
||||||
|
{
|
||||||
|
v147 = 0;
|
||||||
|
v146 = (int)v148;
|
||||||
|
v148[0] = 0;
|
||||||
|
ReadFile(v103, (unsigned int *)&v146);
|
||||||
|
while ( v147 )
|
||||||
|
{
|
||||||
|
std::string::basic_string((void **)&Format, "\n");
|
||||||
|
GetNextArg(&v152, &v146, (int)&Format);
|
||||||
|
std::vector<std::string>::emplace_back<std::string>(&v94, &v152);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
}
|
||||||
|
std::string::_M_dispose((void **)&v146);
|
||||||
|
}
|
||||||
|
v7 = 0;
|
||||||
|
exc = 0;
|
||||||
|
v72 = 0;
|
||||||
|
v73 = 0;
|
||||||
|
v74 = 0;
|
||||||
|
v75 = 0;
|
||||||
|
v84 = -1431655765 * ((v95 - (int)v94) >> 3);
|
||||||
|
v76 = 0;
|
||||||
|
v82 = 0;
|
||||||
|
v77 = 0;
|
||||||
|
while ( v7 < v84 )
|
||||||
|
{
|
||||||
|
v8 = 6 * v7;
|
||||||
|
v9 = &v94[6 * v7];
|
||||||
|
v10 = *v9;
|
||||||
|
if ( *(_BYTE *)*v9 != 45 )
|
||||||
|
{
|
||||||
|
std::vector<std::string>::push_back(&v91, (int)v9);
|
||||||
|
goto LABEL_90;
|
||||||
|
}
|
||||||
|
v11 = v10[1];
|
||||||
|
switch ( v11 )
|
||||||
|
{
|
||||||
|
case 'd':
|
||||||
|
v12 = v10[2];
|
||||||
|
if ( !v12 )
|
||||||
|
{
|
||||||
|
exc |= 2u;
|
||||||
|
goto LABEL_90;
|
||||||
|
}
|
||||||
|
if ( v12 == 115 )
|
||||||
|
{
|
||||||
|
exc |= 4u;
|
||||||
|
goto LABEL_90;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
if ( v10[2] == 116 )
|
||||||
|
{
|
||||||
|
exc |= 8u;
|
||||||
|
goto LABEL_90;
|
||||||
|
}
|
||||||
|
if ( v7 + 1 < v84 )
|
||||||
|
{
|
||||||
|
v77 = 1;
|
||||||
|
std::vector<std::string>::push_back(&v91, (int)&v94[v8 + 6]);
|
||||||
|
goto LABEL_90;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
if ( v10[2] == 98 )
|
||||||
|
exc |= 0x10u;
|
||||||
|
else
|
||||||
|
v76 = 1;
|
||||||
|
goto LABEL_90;
|
||||||
|
case 'x':
|
||||||
|
if ( v10[2] == 99 && v7 + 1 < v84 )
|
||||||
|
{
|
||||||
|
v13 = &v94[v8 + 6];
|
||||||
|
v82 = 1;
|
||||||
|
if ( *(_BYTE *)*v13 != 45 )
|
||||||
|
{
|
||||||
|
std::string::_M_assign((int)&v100, (int)v13);
|
||||||
|
v82 = 1;
|
||||||
|
++v7;
|
||||||
|
}
|
||||||
|
goto LABEL_90;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'c':
|
||||||
|
if ( v10[2] == 99 && v7 + 1 < v84 )
|
||||||
|
{
|
||||||
|
v14 = &v94[v8 + 6];
|
||||||
|
v82 = 0;
|
||||||
|
if ( *(_BYTE *)*v14 != 45 )
|
||||||
|
{
|
||||||
|
std::string::_M_assign((int)&v100, (int)v14);
|
||||||
|
v82 = 0;
|
||||||
|
++v7;
|
||||||
|
}
|
||||||
|
goto LABEL_90;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'o':
|
||||||
|
if ( v7 + 1 < v84 )
|
||||||
|
{
|
||||||
|
++v7;
|
||||||
|
FileName = (char *)v94[v8 + 6];
|
||||||
|
goto LABEL_90;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'g':
|
||||||
|
if ( v10[2] == 110 && v7 + 1 < v84 )
|
||||||
|
{
|
||||||
|
std::string::_M_assign((int)v108, (int)&v94[v8 + 6]);
|
||||||
|
++v7;
|
||||||
|
goto LABEL_90;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'p':
|
||||||
|
exc |= 0x20u;
|
||||||
|
goto LABEL_90;
|
||||||
|
case 't':
|
||||||
|
exc |= 1u;
|
||||||
|
goto LABEL_90;
|
||||||
|
case 'i':
|
||||||
|
exc |= 0x40u;
|
||||||
|
goto LABEL_90;
|
||||||
|
}
|
||||||
|
std::string::basic_string((void **)&v152, "--split");
|
||||||
|
v15 = std::operator==<char>((int)&v94[v8], (int)&v152);
|
||||||
|
if ( v15 )
|
||||||
|
v15 = v7 + 1 < v84;
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
if ( v15 )
|
||||||
|
{
|
||||||
|
++v7;
|
||||||
|
std::string::_M_assign((int)v109, (int)&v94[v8 + 6]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v16 = v94[6 * v7];
|
||||||
|
if ( v16[1] == 99 && v16[2] == 98 )
|
||||||
|
{
|
||||||
|
++v7;
|
||||||
|
LOBYTE(v151[0]) = 0;
|
||||||
|
Format = (char *)v151;
|
||||||
|
v17 = (char *)v94[v8 + 6];
|
||||||
|
exc |= 0x80u;
|
||||||
|
v150 = 0;
|
||||||
|
ReadFile(v17, (unsigned int *)&Format);
|
||||||
|
if ( v150 )
|
||||||
|
{
|
||||||
|
std::string::basic_string((void **)&v152, "life_cycle_callback_content");
|
||||||
|
v18 = std::map<std::string,std::string>::operator[](&v110, &v152);
|
||||||
|
std::string::_M_assign((int)v18, (int)&Format);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
}
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
}
|
||||||
|
else if ( !std::string::compare((int)&v94[v8], "--pm") && v7 + 1 < v84 )
|
||||||
|
{
|
||||||
|
v21 = &v94[v8 + 6];
|
||||||
|
std::string::basic_string((void **)&v152, "plain_text_marker");
|
||||||
|
v22 = std::map<std::string,std::string>::operator[](&v110, &v152);
|
||||||
|
std::string::_M_assign((int)v22, (int)v21);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
++v7;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v19 = (const char **)&v94[v8];
|
||||||
|
v20 = v94[v8];
|
||||||
|
if ( v20[1] == 108/*l*/ && v20[2] == 108/*l*/ )
|
||||||
|
{
|
||||||
|
v23 = v20[3];
|
||||||
|
if ( v23 != 119 )
|
||||||
|
{
|
||||||
|
if ( v23 != 97 )
|
||||||
|
{
|
||||||
|
fprintf(&__iob[2], "Error: expected -llw or -lla, but got %s", *v19);
|
||||||
|
exca = -1;
|
||||||
|
goto LABEL_177;
|
||||||
|
}
|
||||||
|
v15 = 1;
|
||||||
|
}
|
||||||
|
if ( !std::string::compare((int)v109, " ") )
|
||||||
|
std::string::basic_string((void **)&v152, ",");
|
||||||
|
else
|
||||||
|
std::string::basic_string(&v152, (int)v109);
|
||||||
|
++v7;
|
||||||
|
Split((int)&v133, (int *)&v94[v8 + 6], (int)&v152);
|
||||||
|
v24 = (void **)v133;
|
||||||
|
v25 = (char *)v97;
|
||||||
|
v133 = 0;
|
||||||
|
v26 = v98;
|
||||||
|
v97 = v24;
|
||||||
|
Format = v25;
|
||||||
|
v98 = v134;
|
||||||
|
v151[0] = v99;
|
||||||
|
v150 = v26;
|
||||||
|
v99 = v135;
|
||||||
|
v134 = 0;
|
||||||
|
v135 = 0;
|
||||||
|
std::vector<std::string>::~vector((void ***)&Format, v26);
|
||||||
|
std::vector<std::string>::~vector((void ***)&v133, v27);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
v75 = 1;
|
||||||
|
v82 = v15;
|
||||||
|
}
|
||||||
|
else if ( !std::string::compare((int)v19, "--wxs") )
|
||||||
|
{
|
||||||
|
v74 = 1;
|
||||||
|
}
|
||||||
|
else if ( !std::string::compare((int)&v94[v8], "--gdc") )
|
||||||
|
{
|
||||||
|
v73 = 1;
|
||||||
|
}
|
||||||
|
else if ( !std::string::compare((int)&v94[v8], "--wxs-env") )
|
||||||
|
{
|
||||||
|
v72 = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LABEL_90:
|
||||||
|
++v7;
|
||||||
|
}
|
||||||
|
// version
|
||||||
|
if ( v76 )
|
||||||
|
{
|
||||||
|
std::string::basic_string((void **)&v152, "global");
|
||||||
|
WXML::Compiler::GetVersionInfo((int)&Format, &v152);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
if ( FileName && *FileName )
|
||||||
|
v28 = fopen(FileName, "w");
|
||||||
|
else
|
||||||
|
v28 = &__iob[1];
|
||||||
|
fprintf(v28, "%s\n", Format);
|
||||||
|
fclose(v28);
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
}
|
||||||
|
// not wxs
|
||||||
|
if ( !v74 )
|
||||||
|
{
|
||||||
|
v34 = (const char **)&WXML::GlassEaselWxs::sGenFuncDeepCopy;
|
||||||
|
// not gdc
|
||||||
|
if ( !v73 )
|
||||||
|
{
|
||||||
|
// not wxs env
|
||||||
|
if ( !v72 )
|
||||||
|
{
|
||||||
|
// empty
|
||||||
|
if ( v91 == (const char **)v92 )
|
||||||
|
{
|
||||||
|
exca = Usage(v80, v78);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v35 = 0;
|
||||||
|
std::_Rb_tree_header::_Rb_tree_header(v113);
|
||||||
|
std::_Rb_tree_header::_Rb_tree_header(v115);
|
||||||
|
if ( v77 )
|
||||||
|
{
|
||||||
|
v152 = (int)v154;
|
||||||
|
v153 = 0;
|
||||||
|
v154[0] = 0;
|
||||||
|
ReadFile(0, (unsigned int *)&v152);
|
||||||
|
v36 = std::map<std::string,std::string>::operator[](&v112, (int)v91);
|
||||||
|
std::string::_M_assign((int)v36, (int)&v152);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while ( v35 < -1431655765 * (((char *)v92 - (char *)v91) >> 3) )
|
||||||
|
{
|
||||||
|
v154[0] = 0;
|
||||||
|
v152 = (int)v154;
|
||||||
|
v153 = 0;
|
||||||
|
ReadFile((char *)v91[6 * v35], (unsigned int *)&v152);
|
||||||
|
v37 = std::map<std::string,std::string>::operator[](&v112, (int)&v91[6 * v35]);
|
||||||
|
std::string::_M_assign((int)v37, (int)&v152);
|
||||||
|
++v35;
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( v101 )
|
||||||
|
{
|
||||||
|
GetNextArg(&String, (int *)&v100, (int)v109);
|
||||||
|
v81 = strtoull(String, 0, 10);
|
||||||
|
std::string::_M_dispose((void **)&String);
|
||||||
|
v136 = 0;
|
||||||
|
v137 = 0;
|
||||||
|
v138 = 0;
|
||||||
|
for ( i = 0; (int)i < v81; i = (std::ostream::sentry *)((char *)i + 1) )
|
||||||
|
{
|
||||||
|
v150 = 0;
|
||||||
|
Format = (char *)v151;
|
||||||
|
LOBYTE(v151[0]) = 0;
|
||||||
|
String = 0;
|
||||||
|
v140 = 0;
|
||||||
|
v141 = 0;
|
||||||
|
GetNextArg(&v142, (int *)&v100, (int)v109);
|
||||||
|
std::string::operator=(&Format, &v142);
|
||||||
|
std::string::_M_dispose((void **)&v142);
|
||||||
|
std::__find_if<__gnu_cxx::__normal_iterator<std::string *,std::vector<std::string>>,__gnu_cxx::__ops::_Iter_equals_val<std::string const>>(
|
||||||
|
(int)v91,
|
||||||
|
(int)v92,
|
||||||
|
(int)&Format);
|
||||||
|
GetNextArg(&v144, (int *)&v100, (int)v109);
|
||||||
|
v38 = 0;
|
||||||
|
v79 = (char **)strtoull(v144, 0, 10);
|
||||||
|
std::string::_M_dispose((void **)&v144);
|
||||||
|
while ( v38 < (int)v79 )
|
||||||
|
{
|
||||||
|
v153 = 0;
|
||||||
|
v152 = (int)v154;
|
||||||
|
v154[0] = 0;
|
||||||
|
GetNextArg(&v146, (int *)&v100, (int)v109);
|
||||||
|
std::string::operator=(&v152, &v146);
|
||||||
|
std::string::_M_dispose((void **)&v146);
|
||||||
|
std::vector<std::string>::push_back(&String, (int)&v152);
|
||||||
|
v39 = v137;
|
||||||
|
if ( v39 == std::__find_if<__gnu_cxx::__normal_iterator<std::string *,std::vector<std::string>>,__gnu_cxx::__ops::_Iter_equals_val<std::string const>>(
|
||||||
|
v136,
|
||||||
|
v137,
|
||||||
|
(int)&v152) )
|
||||||
|
std::vector<std::string>::push_back(&v136, (int)&v152);
|
||||||
|
++v38;
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
}
|
||||||
|
v40 = v115[1];
|
||||||
|
inserted = v115;
|
||||||
|
while ( v40 )
|
||||||
|
{
|
||||||
|
if ( (unsigned __int8)std::operator<<char>(v40 + 16, (int)&Format) )
|
||||||
|
{
|
||||||
|
v40 = *(_DWORD *)(v40 + 12);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
inserted = (int *)v40;
|
||||||
|
v40 = *(_DWORD *)(v40 + 8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( inserted == v115 || (unsigned __int8)std::operator<<char>((int)&Format, (int)(inserted + 4)) )
|
||||||
|
{
|
||||||
|
v42 = (char *)operator new((struct type_info *)0x34, v71);
|
||||||
|
v43 = (void **)(v42 + 16);
|
||||||
|
v44 = v42;
|
||||||
|
std::string::basic_string((_DWORD *)v42 + 4, (int)&Format);
|
||||||
|
*((_DWORD *)v44 + 10) = 0;
|
||||||
|
*((_DWORD *)v44 + 11) = 0;
|
||||||
|
*((_DWORD *)v44 + 12) = 0;
|
||||||
|
insert_hint_unique_pos = 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>>>>::_M_get_insert_hint_unique_pos(
|
||||||
|
&v114,
|
||||||
|
inserted,
|
||||||
|
(int)v43);
|
||||||
|
inserted = (int *)insert_hint_unique_pos;
|
||||||
|
if ( v46 )
|
||||||
|
{
|
||||||
|
inserted = 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>>>>::_M_insert_node(
|
||||||
|
&v114,
|
||||||
|
insert_hint_unique_pos,
|
||||||
|
v46,
|
||||||
|
v44);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::vector<std::string>::~vector((void ***)v44 + 10, 0);
|
||||||
|
std::string::_M_dispose(v43);
|
||||||
|
operator delete(v44);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::vector<std::string>::operator=((int)(inserted + 10), (int *)&String);
|
||||||
|
std::vector<std::string>::~vector((void ***)&String, v47);
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
}
|
||||||
|
std::string::basic_string((void **)&v152, "ALL");
|
||||||
|
v48 = std::map<std::string,std::vector<std::string>>::operator[](&v114, &v152);
|
||||||
|
std::vector<std::string>::operator=((int)v48, &v136);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
std::vector<std::string>::~vector((void ***)&v136, v49);
|
||||||
|
}
|
||||||
|
v116[1] = 0;
|
||||||
|
v116[0] = (int)&v117;
|
||||||
|
v117 = 0;
|
||||||
|
v118[0] = &v119;
|
||||||
|
v118[1] = 0;
|
||||||
|
v119 = 0;
|
||||||
|
std::_Rb_tree_header::_Rb_tree_header(v121);
|
||||||
|
if ( v75 )
|
||||||
|
{
|
||||||
|
v51 = v98;
|
||||||
|
for ( j = v97; (void **)v51 != j; j += 6 )
|
||||||
|
{
|
||||||
|
if ( *(_BYTE *)*j == 46 && *((_BYTE *)*j + 1) == 47 )
|
||||||
|
{
|
||||||
|
std::string::substr((void **)&v152, j, 2u, 0xFFFFFFFF);
|
||||||
|
std::string::operator=(j, &v152);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::_Rb_tree_header::_Rb_tree_header(v123);
|
||||||
|
std::_Rb_tree_header::_Rb_tree_header(v125);
|
||||||
|
std::_Rb_tree_header::_Rb_tree_header(v127);
|
||||||
|
std::string::basic_string((void **)&v152, "l_");
|
||||||
|
std::string::basic_string((void **)&Format, "f_");
|
||||||
|
std::string::basic_string((void **)&v146, "$gdwx");
|
||||||
|
std::string::basic_string((void **)&v144, "boxofchocolate");
|
||||||
|
std::string::basic_string((void **)&v142, (char *)&byte_5173B0);
|
||||||
|
std::string::basic_string((void **)&String, "p_");
|
||||||
|
std::string::basic_string((void **)&v136, "d_");
|
||||||
|
std::string::basic_string((void **)&v133, "e_");
|
||||||
|
std::string::basic_string((void **)v132, "gg");
|
||||||
|
std::string::basic_string((void **)v131, (char *)&off_5174F9);
|
||||||
|
std::string::basic_string((void **)v130, (_BYTE *)&off_5174F9 + 2);
|
||||||
|
std::string::basic_string((void **)v129, (char *)&byte_5173B0);
|
||||||
|
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(
|
||||||
|
v128,
|
||||||
|
(int)&v114);
|
||||||
|
exca = WXML::Compiler::CompileLazy(
|
||||||
|
(std::_Rb_tree_header *)&v112,
|
||||||
|
(unsigned int *)v116,
|
||||||
|
&v120,
|
||||||
|
&v106,
|
||||||
|
&v122,
|
||||||
|
(int)&v124,
|
||||||
|
(int)v128,
|
||||||
|
(std::_Rb_tree_header *)&v97,
|
||||||
|
0,
|
||||||
|
v129,
|
||||||
|
(int)&v126,
|
||||||
|
&v110,
|
||||||
|
v82,
|
||||||
|
(int)v108,
|
||||||
|
exc,
|
||||||
|
10,
|
||||||
|
v130,
|
||||||
|
v131,
|
||||||
|
v132,
|
||||||
|
&v133,
|
||||||
|
&v136,
|
||||||
|
(int *)&String,
|
||||||
|
(int)&v142,
|
||||||
|
(int)&v144,
|
||||||
|
(int)&v146,
|
||||||
|
(int *)&Format);
|
||||||
|
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)v128);
|
||||||
|
std::string::_M_dispose((void **)v129);
|
||||||
|
std::string::_M_dispose((void **)v130);
|
||||||
|
std::string::_M_dispose((void **)v131);
|
||||||
|
std::string::_M_dispose((void **)v132);
|
||||||
|
std::string::_M_dispose((void **)&v133);
|
||||||
|
std::string::_M_dispose((void **)&v136);
|
||||||
|
std::string::_M_dispose((void **)&String);
|
||||||
|
std::string::_M_dispose((void **)&v142);
|
||||||
|
std::string::_M_dispose((void **)&v144);
|
||||||
|
std::string::_M_dispose((void **)&v146);
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
std::string::basic_string((void **)&Format, "__COMMON__");
|
||||||
|
v53 = (int *)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>>>::_M_lower_bound(
|
||||||
|
v121[1],
|
||||||
|
(int)v121,
|
||||||
|
(int)&Format);
|
||||||
|
v54 = v53;
|
||||||
|
if ( v53 != v121 && (unsigned __int8)std::operator<<char>((int)&Format, (int)(v53 + 4)) )
|
||||||
|
v54 = v121;
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
if ( v54 == v121 )
|
||||||
|
{
|
||||||
|
WXML::Compiler::WXMLHelperCode[abi:cxx11]((void **)&Format);
|
||||||
|
std::string::basic_string(
|
||||||
|
(void **)&v146,
|
||||||
|
"var __wxAppData=__wxAppData||{};var __wxAppCode__=__wxAppCode__||{};var global=global||{};var __WXML_GLO"
|
||||||
|
"BAL__=__WXML_GLOBAL__||{entrys:{},defines:{},modules:{},ops:[],wxs_nf_init:undefined,total_ops:0};var Co"
|
||||||
|
"mponent=Component||function(){};var definePlugin=definePlugin||function(){};var requirePlugin=requirePlu"
|
||||||
|
"gin||function(){};var Behavior=Behavior||function(){};var __vd_version_info__=__vd_version_info__||{};va"
|
||||||
|
"r __GWX_GLOBAL__=__GWX_GLOBAL__||{};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>(&v152, &v146, (unsigned int *)&Format);
|
||||||
|
std::string::basic_string((void **)&v144, "__COMMON__");
|
||||||
|
v59 = std::map<std::string,std::string>::operator[](&v120, &v144);
|
||||||
|
std::string::operator=(v59, &v152);
|
||||||
|
std::string::_M_dispose((void **)&v144);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
v58 = (void **)&v146;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string::basic_string((void **)&Format, "__COMMON__");
|
||||||
|
v55 = std::map<std::string,std::string>::operator[](&v120, &Format);
|
||||||
|
WXML::Compiler::WXMLHelperCode[abi:cxx11]((void **)&v144);
|
||||||
|
std::string::basic_string(
|
||||||
|
(void **)&v142,
|
||||||
|
"var __wxAppData=__wxAppData||{};var __wxAppCode__=__wxAppCode__||{};var global=global||{};var __WXML_GLO"
|
||||||
|
"BAL__=__WXML_GLOBAL__||{entrys:{},defines:{},modules:{},ops:[],wxs_nf_init:undefined,total_ops:0};var Co"
|
||||||
|
"mponent=Component||function(){};var definePlugin=definePlugin||function(){};var requirePlugin=requirePlu"
|
||||||
|
"gin||function(){};var Behavior=Behavior||function(){};var __vd_version_info__=__vd_version_info__||{};va"
|
||||||
|
"r __GWX_GLOBAL__=__GWX_GLOBAL__||{};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>(&v146, &v142, (unsigned int *)&v144);
|
||||||
|
v56 = std::string::append(&v146, (int)v55);
|
||||||
|
std::string::basic_string(&v152, v56);
|
||||||
|
std::string::basic_string((void **)&String, "__COMMON__");
|
||||||
|
v57 = std::map<std::string,std::string>::operator[](&v120, &String);
|
||||||
|
std::string::operator=(v57, &v152);
|
||||||
|
std::string::_M_dispose((void **)&String);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
std::string::_M_dispose((void **)&v146);
|
||||||
|
std::string::_M_dispose((void **)&v142);
|
||||||
|
v58 = (void **)&v144;
|
||||||
|
}
|
||||||
|
std::string::_M_dispose(v58);
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
std::basic_stringstream<char,std::char_traits<char>,std::allocator<char>>::basic_stringstream((int)&v152);
|
||||||
|
std::operator<<<std::char_traits<char>>((std::ostream::sentry *)v154, ";var __WXML_DEP__=__WXML_DEP__||{};");
|
||||||
|
for ( k = (int *)v123[2]; k != v123; k = (int *)std::_Rb_tree_increment((int)k) )
|
||||||
|
{
|
||||||
|
if ( k[11] != k[10] )
|
||||||
|
{
|
||||||
|
v61 = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)v154, "__WXML_DEP__[\"");
|
||||||
|
WXML::Rewrite::ToStringCode((int)&Format, k + 4);
|
||||||
|
v62 = std::operator<<<char>(v61, (int *)&Format);
|
||||||
|
std::operator<<<std::char_traits<char>>(v62, "\"]=[");
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
v63 = (int *)k[10];
|
||||||
|
v83 = (int *)k[11];
|
||||||
|
while ( v83 != v63 )
|
||||||
|
{
|
||||||
|
v86 = std::operator<<<std::char_traits<char>>((std::ostream::sentry *)v154, "\"");
|
||||||
|
WXML::Rewrite::ToStringCode((int)&Format, v63);
|
||||||
|
v64 = std::operator<<<char>(v86, (int *)&Format);
|
||||||
|
std::operator<<<std::char_traits<char>>(v64, "\",");
|
||||||
|
v63 += 6;
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
}
|
||||||
|
std::operator<<<std::char_traits<char>>((std::ostream::sentry *)v154, "];");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::stringbuf::str((int)&Format, v155);
|
||||||
|
std::string::basic_string((void **)&v146, "__COMMON__");
|
||||||
|
v65 = std::map<std::string,std::string>::operator[](&v120, &v146);
|
||||||
|
std::string::operator+=(v65, (int)&Format);
|
||||||
|
std::string::_M_dispose((void **)&v146);
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
if ( exca )
|
||||||
|
{
|
||||||
|
fprintf(&__iob[2], "Error %d: %s\n", exca, (const char *)v116[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( FileName && *FileName )
|
||||||
|
v66 = fopen(FileName, "w");
|
||||||
|
else
|
||||||
|
v66 = &__iob[1];
|
||||||
|
DictToJsonString((int)&v144, (int)&v120);
|
||||||
|
DictToJsonString((int)&v146, (int)&v106);
|
||||||
|
std::string::basic_string(
|
||||||
|
(void **)&Format,
|
||||||
|
" {\"generateFunctionContent\":%s,\"generateFunctionName\":%s} ");
|
||||||
|
fprintf(v66, Format, v144, v146);
|
||||||
|
fclose(v66);
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
std::string::_M_dispose((void **)&v146);
|
||||||
|
std::string::_M_dispose((void **)&v144);
|
||||||
|
}
|
||||||
|
std::basic_stringstream<char,std::char_traits<char>,std::allocator<char>>::~basic_stringstream((int)&v152);
|
||||||
|
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)&v126);
|
||||||
|
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)&v124);
|
||||||
|
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)&v122);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string::basic_string((void **)&v152, "l_");
|
||||||
|
std::string::basic_string((void **)&Format, "f_");
|
||||||
|
std::string::basic_string((void **)&v146, "$gdwx");
|
||||||
|
std::string::basic_string((void **)&v144, "boxofchocolate");
|
||||||
|
std::string::basic_string((void **)&v142, (char *)&byte_5173B0);
|
||||||
|
std::string::basic_string((void **)&String, "p_");
|
||||||
|
std::string::basic_string((void **)&v136, "d_");
|
||||||
|
std::string::basic_string((void **)&v133, "e_");
|
||||||
|
std::string::basic_string((void **)v132, "gg");
|
||||||
|
std::string::basic_string((void **)v131, (char *)&off_5174F9);
|
||||||
|
std::string::basic_string((void **)v130, (_BYTE *)&off_5174F9 + 2);
|
||||||
|
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(
|
||||||
|
v129,
|
||||||
|
(int)&v114);
|
||||||
|
exca = WXML::Compiler::Compile(
|
||||||
|
&v112,
|
||||||
|
(unsigned int *)v116,
|
||||||
|
v118,
|
||||||
|
v129,
|
||||||
|
&v110,
|
||||||
|
v82,
|
||||||
|
v108,
|
||||||
|
exc,
|
||||||
|
10,
|
||||||
|
v130,
|
||||||
|
v131,
|
||||||
|
v132,
|
||||||
|
&v133,
|
||||||
|
&v136,
|
||||||
|
(int *)&String,
|
||||||
|
(int)&v142,
|
||||||
|
(int)&v144,
|
||||||
|
(int)&v146,
|
||||||
|
(int *)&Format);
|
||||||
|
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)v129);
|
||||||
|
std::string::_M_dispose((void **)v130);
|
||||||
|
std::string::_M_dispose((void **)v131);
|
||||||
|
std::string::_M_dispose((void **)v132);
|
||||||
|
std::string::_M_dispose((void **)&v133);
|
||||||
|
std::string::_M_dispose((void **)&v136);
|
||||||
|
std::string::_M_dispose((void **)&String);
|
||||||
|
std::string::_M_dispose((void **)&v142);
|
||||||
|
std::string::_M_dispose((void **)&v144);
|
||||||
|
std::string::_M_dispose((void **)&v146);
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
std::string::_M_dispose((void **)&v152);
|
||||||
|
if ( exca )
|
||||||
|
{
|
||||||
|
fprintf(&__iob[2], "%s\n", (const char *)v116[0]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( FileName && *FileName )
|
||||||
|
v50 = fopen(FileName, "w");
|
||||||
|
else
|
||||||
|
v50 = &__iob[1];
|
||||||
|
fprintf(v50, "%s\n", (const char *)v118[0]);
|
||||||
|
fclose(v50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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)&v120);
|
||||||
|
std::string::_M_dispose(v118);
|
||||||
|
std::string::_M_dispose((void **)v116);
|
||||||
|
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)&v114);
|
||||||
|
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)&v112);
|
||||||
|
}
|
||||||
|
goto LABEL_177; // 清理数据
|
||||||
|
}
|
||||||
|
v34 = (const char **)&WXML::GlassEaselWxs::sWxsEnvInit;
|
||||||
|
}
|
||||||
|
main::{lambda(std::string const&)#1}::operator()((const char **)&FileName, v34);
|
||||||
|
exca = 0;
|
||||||
|
goto LABEL_177; // 清理数据
|
||||||
|
}
|
||||||
|
v140 = 0;
|
||||||
|
String = (char *)&v141;
|
||||||
|
LOBYTE(v141) = 0;
|
||||||
|
std::_Rb_tree_header::_Rb_tree_header(v143);
|
||||||
|
std::_Rb_tree_header::_Rb_tree_header(v145);
|
||||||
|
if ( ReadFile((char *)*v91, (unsigned int *)&String) )
|
||||||
|
{
|
||||||
|
fprintf(&__iob[2], "Failed to read input from %s", *v91);
|
||||||
|
exca = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JsonDict = GetJsonDict((int *)&String, (int)&v142);
|
||||||
|
exca = JsonDict;
|
||||||
|
if ( JsonDict )
|
||||||
|
{
|
||||||
|
fprintf(&__iob[2], "Failed to read JSON at position %d (%c)", ~JsonDict, String[~JsonDict]);
|
||||||
|
LABEL_106:
|
||||||
|
exca = -2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for ( m = (char **)v143[2]; m != v143; m = (char **)std::_Rb_tree_increment((int)m) )
|
||||||
|
{
|
||||||
|
std::string::basic_string(&v152, (int)(m + 4));
|
||||||
|
std::string::basic_string(v156, (int)(m + 10));
|
||||||
|
v146 = (int)v148;
|
||||||
|
v147 = 0;
|
||||||
|
v148[0] = 0;
|
||||||
|
if ( night::compile_ns_no_wrapper((int)&v152, (int)v156, 1, (unsigned int *)&v146, 0) )
|
||||||
|
{
|
||||||
|
fprintf(&__iob[2], "Error in file %s: %s\n", (const char *)v152, (const char *)v146);
|
||||||
|
std::string::_M_dispose((void **)&v146);
|
||||||
|
std::pair<std::string const,std::string>::~pair((void **)&v152);
|
||||||
|
goto LABEL_106;
|
||||||
|
}
|
||||||
|
v31 = snprintf(0, 0, WXML::GlassEaselWxs::sWrapper, v146) + 1;
|
||||||
|
v32 = (char *)operator new[](v31);
|
||||||
|
snprintf(v32, v31, WXML::GlassEaselWxs::sWrapper, v146);
|
||||||
|
std::string::basic_string((void **)&Format, v32);
|
||||||
|
v33 = std::map<std::string,std::string>::operator[](&v144, (int)&v152);
|
||||||
|
std::string::operator=(v33, &Format);
|
||||||
|
std::string::_M_dispose((void **)&Format);
|
||||||
|
operator delete[](v32);
|
||||||
|
std::string::_M_dispose((void **)&v146);
|
||||||
|
std::pair<std::string const,std::string>::~pair((void **)&v152);
|
||||||
|
}
|
||||||
|
DictToJsonString((int)&v136, (int)&v144);
|
||||||
|
main::{lambda(std::string const&)#1}::operator()((const char **)&FileName, (const char **)&v136);
|
||||||
|
std::string::_M_dispose((void **)&v136);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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)&v144);
|
||||||
|
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)&v142);
|
||||||
|
std::string::_M_dispose((void **)&String);
|
||||||
|
LABEL_177:
|
||||||
|
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)&v110);
|
||||||
|
std::string::_M_dispose(v109);
|
||||||
|
std::string::_M_dispose((void **)v108);
|
||||||
|
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)&v106);
|
||||||
|
std::vector<std::string>::~vector(&v97, v67);
|
||||||
|
std::vector<std::string>::~vector(&v94, v68);
|
||||||
|
std::string::_M_dispose((void **)&v103);
|
||||||
|
std::string::_M_dispose((void **)&v100);
|
||||||
|
std::vector<std::string>::~vector((void ***)&v91, v69);
|
||||||
|
return exca;
|
||||||
|
}
|
@ -37,7 +37,7 @@ const HTTP = {
|
|||||||
// console.log('No more data in response.');
|
// console.log('No more data in response.');
|
||||||
if (ret?.startsWith('server error'))
|
if (ret?.startsWith('server error'))
|
||||||
{
|
{
|
||||||
console.log('error:', ret)
|
console.log('response error:\n', ret)
|
||||||
}
|
}
|
||||||
if (compilerOptions.lazyloadConfig || compilerOptions.lazyload)
|
if (compilerOptions.lazyloadConfig || compilerOptions.lazyload)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ describe("wcc - module", function () {
|
|||||||
const w = await windows.wcc(p);
|
const w = await windows.wcc(p);
|
||||||
const n = await linux.wcc(p, '');
|
const n = await linux.wcc(p, '');
|
||||||
// console.log('windows:', typeof w)
|
// console.log('windows:', typeof w)
|
||||||
// console.log('linux:', typeof n)
|
// console.log('linux:', n)
|
||||||
|
|
||||||
assert.equal(typeof n, typeof w);
|
assert.equal(typeof n, typeof w);
|
||||||
if (typeof w == 'string')
|
if (typeof w == 'string')
|
||||||
|
1
test/spec/wcc/wxs/sample1.json
Normal file
1
test/spec/wcc/wxs/sample1.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
1
test/spec/wcc/wxs/sample2.json
Normal file
1
test/spec/wcc/wxs/sample2.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"compile_placeholder.wxs":"/* compile_placeholder */"}
|
3
test/spec/wcc/wxs/sample3.json
Normal file
3
test/spec/wcc/wxs/sample3.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"pages/comm": "// /pages/comm.wxs\n\nvar foo = \"'hello world' from comm.wxs\";\nvar bar = function(d) {\n return d;\n}\nmodule.exports = {\n foo: foo,\n bar: bar\n};"
|
||||||
|
}
|
93
test/spec/wcc/wxs/wxs.spec.ts
Normal file
93
test/spec/wcc/wxs/wxs.spec.ts
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
|
||||||
|
import assert from 'assert';
|
||||||
|
import path from 'path';
|
||||||
|
import linux from '../../../runner/binary-linux'
|
||||||
|
import windows from '../../../runner/binary-windows'
|
||||||
|
import * as fs from 'fs'
|
||||||
|
import { describe } from "mocha";
|
||||||
|
|
||||||
|
describe("wcc - wxs", function () {
|
||||||
|
describe("wxs: node output should equal with wine", function () {
|
||||||
|
// afterEach(function(){
|
||||||
|
// if(this.currentTest.state === 'failed'){
|
||||||
|
// console.error('failed', this.currentTest)
|
||||||
|
// }
|
||||||
|
// })
|
||||||
|
it("sample1", async function () {
|
||||||
|
const projectPath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
"../../../projects/miniprogram-demo/miniprogram"
|
||||||
|
);
|
||||||
|
const p = path.resolve(__dirname, './sample1.json')
|
||||||
|
const args = [
|
||||||
|
"--wxs",
|
||||||
|
p
|
||||||
|
];
|
||||||
|
const w = (await windows.wcc(args, projectPath)).replace(/\r\n/g, '\n')
|
||||||
|
const n = await linux.wcc(args, projectPath);
|
||||||
|
const storagePath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
`miniprogram-demo/${this.test?.title}`
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(storagePath, { recursive: true });
|
||||||
|
} catch (error) {}
|
||||||
|
|
||||||
|
assert.equal(typeof w, typeof n);
|
||||||
|
fs.writeFileSync(`${storagePath}/wine-output.js`, w);
|
||||||
|
fs.writeFileSync(`${storagePath}/node-output.js`, n);
|
||||||
|
assert.equal(w, n);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("sample2", async function () {
|
||||||
|
const projectPath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
"../../../projects/miniprogram-demo/miniprogram"
|
||||||
|
);
|
||||||
|
const p = path.resolve(__dirname, './sample2.json')
|
||||||
|
const args = [
|
||||||
|
"--wxs",
|
||||||
|
p
|
||||||
|
];
|
||||||
|
const w = (await windows.wcc(args, projectPath)).replace(/\r\n/g, '\n')
|
||||||
|
const n = await linux.wcc(args, projectPath);
|
||||||
|
const storagePath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
`miniprogram-demo/${this.test?.title}`
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(storagePath, { recursive: true });
|
||||||
|
} catch (error) {}
|
||||||
|
|
||||||
|
assert.equal(typeof w, typeof n);
|
||||||
|
fs.writeFileSync(`${storagePath}/wine-output.js`, w);
|
||||||
|
fs.writeFileSync(`${storagePath}/node-output.js`, n);
|
||||||
|
assert.equal(w, n);
|
||||||
|
});
|
||||||
|
it("sample3", async function () {
|
||||||
|
const projectPath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
"../../../projects/miniprogram-demo/miniprogram"
|
||||||
|
);
|
||||||
|
const p = path.resolve(__dirname, './sample3.json')
|
||||||
|
const args = [
|
||||||
|
"--wxs",
|
||||||
|
p
|
||||||
|
];
|
||||||
|
const w = (await windows.wcc(args, projectPath)).replace(/\r\n/g, '\n')
|
||||||
|
const n = await linux.wcc(args, projectPath);
|
||||||
|
const storagePath = path.resolve(
|
||||||
|
__dirname,
|
||||||
|
`miniprogram-demo/${this.test?.title}`
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
fs.mkdirSync(storagePath, { recursive: true });
|
||||||
|
} catch (error) {}
|
||||||
|
|
||||||
|
assert.equal(typeof w, typeof n);
|
||||||
|
fs.writeFileSync(`${storagePath}/wine-output.js`, w);
|
||||||
|
fs.writeFileSync(`${storagePath}/node-output.js`, n);
|
||||||
|
assert.equal(w, n);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
18181
test/wcc.disassembly.cpp
18181
test/wcc.disassembly.cpp
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user