feature(gsc): instance & iw9 path (#73)

This commit is contained in:
Xenxo Espasandín 2023-02-19 17:57:25 +01:00 committed by GitHub
parent 9c08cbd8c6
commit c515ef6890
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 10 deletions

View File

@ -362,8 +362,12 @@ auto assembler::assemble_far_call(instruction const& inst, bool thread) -> void
}
else
{
auto path = inst.data[0];
if (!path.starts_with("_id_"))
path.append(ctx_->instance() == instance::server ? ".gsc" : ".csc");
script_.write<u32>(0);
stack_.write<u64>(ctx_->hash_id(inst.data[0]));
stack_.write<u64>(ctx_->path_id(path));
stack_.write<u64>(ctx_->hash_id(inst.data[1]));
}

View File

@ -12,7 +12,7 @@ namespace xsk::gsc
extern std::array<std::pair<opcode, std::string_view>, opcode_count> const opcode_list;
context::context(gsc::props props, gsc::engine engine, gsc::endian endian, gsc::system system, u32 str_count)
: props_{ props }, engine_{ engine }, endian_{ endian }, system_{ system }, str_count_{ str_count },
: props_{ props }, engine_{ engine }, endian_{ endian }, system_{ system }, instance_{ gsc::instance::server }, str_count_{ str_count },
source_{ this }, assembler_{ this }, disassembler_{ this }, compiler_{ this }, decompiler_{ this }
{
opcode_map_.reserve(opcode_list.size());
@ -409,8 +409,6 @@ auto context::func_exists(std::string const& name) const -> bool
{
return func_map_rev_.contains(name);
}
return false;
}
auto context::func_add(std::string const& name, u16 id) -> void
@ -520,8 +518,6 @@ auto context::meth_exists(std::string const& name) const -> bool
{
return meth_map_rev_.contains(name);
}
return false;
}
auto context::meth_add(std::string const& name, u16 id) -> void

View File

@ -32,6 +32,8 @@ public:
auto system() const -> system { return system_; }
auto instance() const -> instance { return instance_; }
auto str_count() const -> u32 { return str_count_; }
auto source() -> source& { return source_; }
@ -115,6 +117,7 @@ protected:
gsc::engine engine_;
gsc::endian endian_;
gsc::system system_;
gsc::instance instance_;
u32 str_count_;
gsc::source source_;
gsc::assembler assembler_;

View File

@ -21,6 +21,12 @@
namespace xsk::gsc
{
enum class instance : u8
{
server,
client,
};
enum class build : u8
{
dev,

View File

@ -509,11 +509,11 @@ auto preprocessor::read_directive_define(token&) -> void
throw ppr_error(next.pos, "variadic macros not supported");
//
if (!last_comma || last_elips)
throw ppr_error(next.pos, "misplaced elipsis in macro param list");
// if (!last_comma || last_elips)
// throw ppr_error(next.pos, "misplaced elipsis in macro param list");
last_elips = true;
last_comma = false;
// last_elips = true;
// last_comma = false;
}
else if (next.type == token::COMMA)
{