Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xensik committed Dec 21, 2024
1 parent 8ae8c23 commit 22c2a34
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 35 deletions.
5 changes: 3 additions & 2 deletions include/xsk/arc/assembler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
namespace xsk::arc
{

class assembler
struct assembler
{
private:
context const* ctx_;
function const* func_;
assembly const* assembly_;
Expand All @@ -26,7 +27,7 @@ class assembler
u32 devmap_count_;

public:
assembler(context const* ctx);
explicit assembler(context const* ctx);
auto assemble(assembly const& data, std::string const& name = {}) -> std::pair<buffer, buffer>;

private:
Expand Down
20 changes: 10 additions & 10 deletions include/xsk/arc/common/exception.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,40 @@
namespace xsk::arc
{

class error : public std::runtime_error
struct error : public std::runtime_error
{
public:
error(std::string const& what);
explicit error(std::string const& what);
};

class asm_error : public std::runtime_error
struct asm_error : public std::runtime_error
{
public:
asm_error(std::string const& what);
explicit asm_error(std::string const& what);
};

class disasm_error : public std::runtime_error
struct disasm_error : public std::runtime_error
{
public:
disasm_error(std::string const& what);
explicit disasm_error(std::string const& what);
};

class ppr_error : public std::runtime_error
struct ppr_error : public std::runtime_error
{
public:
ppr_error(location const& loc, std::string const& what);
};

class comp_error : public std::runtime_error
struct comp_error : public std::runtime_error
{
public:
comp_error(location const& loc, std::string const& what);
};

class decomp_error : public std::runtime_error
struct decomp_error : public std::runtime_error
{
public:
decomp_error(std::string const& what);
explicit decomp_error(std::string const& what);
};

} // namespace xsk::arc
4 changes: 2 additions & 2 deletions include/xsk/arc/common/location.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
namespace xsk::arc
{

class position
struct position
{
public:
typedef const std::string filename_type;
Expand Down Expand Up @@ -78,7 +78,7 @@ std::basic_ostream<T>& operator<<(std::basic_ostream<T> &ostr, const position &p
return ostr << pos.line << '.' << pos.column;
}

class location
struct location
{
public:
typedef position::filename_type filename_type;
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/common/lookahead.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct lookahead

lookahead(char const* data, usize size);
auto advance() -> void;
auto ended() { return available == 0; };
auto ended() const { return available == 0; };
};

} // namespace xsk::arc
2 changes: 1 addition & 1 deletion include/xsk/arc/common/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ struct locjmp
};

// fordward decl for modules ref
class context;
struct context;

} // namespace xsk::arc
5 changes: 3 additions & 2 deletions include/xsk/arc/compiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
namespace xsk::arc
{

class compiler
struct compiler
{
private:
context* ctx_;
assembly::ptr assembly_;
function::ptr function_;
Expand All @@ -28,7 +29,7 @@ class compiler
bool developer_thread_;

public:
compiler(context* ctx);
explicit compiler(context* ctx);
auto compile(program const& data) -> assembly::ptr;
auto compile(std::string const& file, std::vector<u8>& data) -> assembly::ptr;

Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace xsk::arc
{

class context
struct context
{
public:
using fs_callback = std::function<std::vector<u8>(std::string const&)>;
Expand Down
5 changes: 3 additions & 2 deletions include/xsk/arc/decompiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
namespace xsk::arc
{

class decompiler
struct decompiler
{
private:
context const* ctx_;
program::ptr program_;
decl_function::ptr func_;
Expand All @@ -28,7 +29,7 @@ class decompiler
bool retbool_;

public:
decompiler(context const* ctx);
explicit decompiler(context const* ctx);
auto decompile(assembly const& data) -> program::ptr;

private:
Expand Down
5 changes: 3 additions & 2 deletions include/xsk/arc/disassembler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
namespace xsk::arc
{

class disassembler
struct disassembler
{
private:
context const* ctx_;
function::ptr func_;
assembly::ptr assembly_;
Expand All @@ -22,7 +23,7 @@ class disassembler
std::map<usize, animtree_ref::ptr> anim_refs_;

public:
disassembler(context const* ctx);
explicit disassembler(context const* ctx);
auto disassemble(buffer const& data) -> assembly::ptr;
auto disassemble(std::vector<u8> const& data) -> assembly::ptr;
auto disassemble(u8 const* data, usize data_size) -> assembly::ptr;
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/engine/jup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ constexpr usize code_count = 0;
constexpr usize hash_count = 0;
constexpr u64 header_magic = 0x38000A0D43534780;

class context : public arc::context
struct context : public arc::context
{
public:
context();
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/engine/t6_pc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace xsk::arc::t6::pc

constexpr u64 header_magic = 0x06000A0D43534780;

class context : public arc::context
struct context : public arc::context
{
public:
context();
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/engine/t6_ps3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace xsk::arc::t6::ps3

constexpr u64 header_magic = 0x804753430D0A0006;

class context : public arc::context
struct context : public arc::context
{
public:
context();
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/engine/t6_wiiu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace xsk::arc::t6::wiiu

constexpr u64 header_magic = 0x804753430D0A0006;

class context : public arc::context
struct context : public arc::context
{
public:
context();
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/engine/t6_xb2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace xsk::arc::t6::xb2

constexpr u64 header_magic = 0x804753430D0A0006;

class context : public arc::context
struct context : public arc::context
{
public:
context();
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/engine/t7.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ constexpr usize code_count = 16384;
constexpr usize hash_count = 178806;
constexpr u64 header_magic = 0x1C000A0D43534780;

class context : public arc::context
struct context : public arc::context
{
public:
context();
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/engine/t8.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ constexpr usize code_count = 0;
constexpr usize hash_count = 0;
constexpr u64 header_magic = 0x36000A0D43534780;

class context : public arc::context
struct context : public arc::context
{
public:
context();
Expand Down
2 changes: 1 addition & 1 deletion include/xsk/arc/engine/t9.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ constexpr usize code_count = 0;
constexpr usize hash_count = 0;
constexpr u64 header_magic = 0x38000A0D43534780;

class context : public arc::context
struct context : public arc::context
{
public:
context();
Expand Down
3 changes: 2 additions & 1 deletion include/xsk/arc/lexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
namespace xsk::arc
{

class lexer
struct lexer
{
private:
context const* ctx_;
lookahead reader_;
location loc_;
Expand Down
3 changes: 2 additions & 1 deletion include/xsk/arc/preprocessor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
namespace xsk::arc
{

class preprocessor
struct preprocessor
{
private:
context* ctx_;
std::stack<lexer> lexer_;
std::vector<std::string> includes_;
Expand Down
5 changes: 3 additions & 2 deletions include/xsk/arc/source.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
namespace xsk::arc
{

class source
struct source
{
private:
context* ctx_;
std::vector<u8> buf_;
u32 indent_;

public:
source(context* ctx);
explicit source(context* ctx);
auto parse_assembly(buffer const& data) -> assembly::ptr;
auto parse_assembly(std::vector<u8> const& data) -> assembly::ptr;
auto parse_assembly(u8 const* data, usize size) -> assembly::ptr;
Expand Down

0 comments on commit 22c2a34

Please sign in to comment.