mirror of
https://onedev.site.tesses.net/crosslang
synced 2026-02-09 01:25:45 +00:00
Add embeddir finally and embedstrm
This commit is contained in:
@@ -83,6 +83,18 @@ namespace Tesses::CrossLang {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class PushResourceStreamChunkInstruction : public ChunkInstruction {
|
||||
public:
|
||||
PushResourceStreamChunkInstruction(std::string v) : value(v)
|
||||
{}
|
||||
std::string value;
|
||||
size_t Size()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
};
|
||||
|
||||
class LabelChunkInstruction : public ChunkInstruction {
|
||||
public:
|
||||
LabelChunkInstruction(std::string lbl) : lbl(lbl)
|
||||
@@ -285,6 +297,10 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
instrs.push_back(std::make_shared<SimpleChunkInstruction>(LINEINFO));
|
||||
}
|
||||
else if(name == "embeddir")
|
||||
{
|
||||
instrs.push_back(std::make_shared<SimpleChunkInstruction>(PUSHRESOUURCEDIR));
|
||||
}
|
||||
else if(name == "pushclosure")
|
||||
{
|
||||
auto closure = std::make_shared<ClosureChunkInstruction>(true);
|
||||
@@ -325,6 +341,14 @@ namespace Tesses::CrossLang {
|
||||
instrs.push_back(std::make_shared<PushResourceChunkInstruction>(str));
|
||||
}
|
||||
}
|
||||
else if(name == "embedstrm")
|
||||
{
|
||||
if(i < tokens.size() && tokens[i].type == LexTokenType::String)
|
||||
{
|
||||
std::string str = tokens[i++].text;
|
||||
instrs.push_back(std::make_shared<PushResourceStreamChunkInstruction>(str));
|
||||
}
|
||||
}
|
||||
else if(name == "push")
|
||||
{
|
||||
if(IsSym("."))
|
||||
@@ -1031,6 +1055,7 @@ namespace Tesses::CrossLang {
|
||||
auto chr = std::dynamic_pointer_cast<PushCharChunkInstruction>(item);
|
||||
auto chk = std::dynamic_pointer_cast<ClosureChunkInstruction>(item);
|
||||
auto reso = std::dynamic_pointer_cast<PushResourceChunkInstruction>(item);
|
||||
auto resos = std::dynamic_pointer_cast<PushResourceStreamChunkInstruction>(item);
|
||||
auto jmp = std::dynamic_pointer_cast<JumpStyleChunkInstruction>(item);
|
||||
auto scopeend = std::dynamic_pointer_cast<ScopeEndTimesChunkInstruction>(item);
|
||||
if(lbl)
|
||||
@@ -1066,6 +1091,10 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
chunks[chunkId].second.push_back(std::make_shared<EmbedInstruction>(GetResource(reso->value)));
|
||||
}
|
||||
if(resos)
|
||||
{
|
||||
chunks[chunkId].second.push_back(std::make_shared<EmbedStreamInstruction>(GetResource(reso->value)));
|
||||
}
|
||||
if(jmp)
|
||||
{
|
||||
chunks[chunkId].second.push_back(std::make_shared<JumpStyleInstruction>(jmp->instr,jmp->lbl));
|
||||
|
||||
@@ -223,6 +223,7 @@ namespace Tesses::CrossLang {
|
||||
{
|
||||
switch(code[i++])
|
||||
{
|
||||
case PUSHRESOURCESTREAM:
|
||||
case PUSHRESOURCE:
|
||||
case PUSHSTRING:
|
||||
case SCOPEENDTIMES:
|
||||
@@ -381,6 +382,9 @@ namespace Tesses::CrossLang {
|
||||
case APPENDDICT:
|
||||
buffer.append("appenddict");
|
||||
break;
|
||||
case PUSHRESOUURCEDIR:
|
||||
buffer.append("embeddir");
|
||||
break;
|
||||
case PUSHRESOURCE:
|
||||
{
|
||||
uint32_t clId = (uint32_t)code[i++] << 24;
|
||||
@@ -391,6 +395,16 @@ namespace Tesses::CrossLang {
|
||||
buffer.append(EscapeString(name + "-" + version.ToString()+"_"+ std::to_string(clId) + ".bin",true));
|
||||
}
|
||||
break;
|
||||
case PUSHRESOURCESTREAM:
|
||||
{
|
||||
uint32_t clId = (uint32_t)code[i++] << 24;
|
||||
clId |= (uint32_t)code[i++] << 16;
|
||||
clId |= (uint32_t)code[i++] << 8;
|
||||
clId |= (uint32_t)code[i++];
|
||||
buffer.append("embedstrm ");
|
||||
buffer.append(EscapeString(name + "-" + version.ToString()+"_"+ std::to_string(clId) + ".bin",true));
|
||||
}
|
||||
break;
|
||||
case PUSHLONG:
|
||||
{
|
||||
uint64_t number = (uint64_t)code[i++] << 56;
|
||||
|
||||
Reference in New Issue
Block a user