diff --git a/src/gsc/assembler.cpp b/src/gsc/assembler.cpp index 6fbf0d0d..05f8adf5 100644 --- a/src/gsc/assembler.cpp +++ b/src/gsc/assembler.cpp @@ -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(0); - stack_.write(ctx_->hash_id(inst.data[0])); + stack_.write(ctx_->path_id(path)); stack_.write(ctx_->hash_id(inst.data[1])); } diff --git a/src/gsc/context.cpp b/src/gsc/context.cpp index b0bfe514..eedecdc7 100644 --- a/src/gsc/context.cpp +++ b/src/gsc/context.cpp @@ -12,7 +12,7 @@ namespace xsk::gsc extern std::array, 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 diff --git a/src/gsc/context.hpp b/src/gsc/context.hpp index 26bf0b10..7d79540f 100644 --- a/src/gsc/context.hpp +++ b/src/gsc/context.hpp @@ -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_; diff --git a/src/gsc/misc/types.hpp b/src/gsc/misc/types.hpp index 296f0b7a..90cf69fd 100644 --- a/src/gsc/misc/types.hpp +++ b/src/gsc/misc/types.hpp @@ -21,6 +21,12 @@ namespace xsk::gsc { +enum class instance : u8 +{ + server, + client, +}; + enum class build : u8 { dev, diff --git a/src/gsc/preprocessor.cpp b/src/gsc/preprocessor.cpp index 19b12fd2..391befce 100644 --- a/src/gsc/preprocessor.cpp +++ b/src/gsc/preprocessor.cpp @@ -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) {