mirror of
https://github.com/open-goal/jak-project
synced 2026-08-31 09:41:05 -04:00
fix format
This commit is contained in:
@@ -61,8 +61,8 @@ void replace_exactly_one_in(std::vector<T>& v, T old, T replace) {
|
||||
*/
|
||||
class CfgVtx {
|
||||
public:
|
||||
virtual std::string to_string() = 0; // convert to a single line string for debugging
|
||||
virtual goos::Object to_form() = 0; // recursive print as LISP form.
|
||||
virtual std::string to_string() = 0; // convert to a single line string for debugging
|
||||
virtual goos::Object to_form() = 0; // recursive print as LISP form.
|
||||
virtual ~CfgVtx() = default;
|
||||
|
||||
CfgVtx* parent = nullptr; // parent structure, or nullptr if top level
|
||||
|
||||
+23
-13
@@ -2,8 +2,8 @@
|
||||
#include "decompiler/ObjectFile/LinkedObjectFile.h"
|
||||
|
||||
std::string IR::print(const LinkedObjectFile& file) const {
|
||||
// return to_form(file)->toStringPretty();
|
||||
return pretty_print::to_string(to_form(file));
|
||||
// return to_form(file)->toStringPretty();
|
||||
return pretty_print::to_string(to_form(file));
|
||||
}
|
||||
|
||||
goos::Object IR_Register::to_form(const LinkedObjectFile& file) const {
|
||||
@@ -12,7 +12,8 @@ goos::Object IR_Register::to_form(const LinkedObjectFile& file) const {
|
||||
}
|
||||
|
||||
goos::Object IR_Set::to_form(const LinkedObjectFile& file) const {
|
||||
return pretty_print::build_list(pretty_print::to_symbol("set!"), dst->to_form(file), src->to_form(file));
|
||||
return pretty_print::build_list(pretty_print::to_symbol("set!"), dst->to_form(file),
|
||||
src->to_form(file));
|
||||
}
|
||||
|
||||
goos::Object IR_Store::to_form(const LinkedObjectFile& file) const {
|
||||
@@ -46,7 +47,8 @@ goos::Object IR_Store::to_form(const LinkedObjectFile& file) const {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
return pretty_print::build_list(pretty_print::to_symbol(store_operator), dst->to_form(file), src->to_form(file));
|
||||
return pretty_print::build_list(pretty_print::to_symbol(store_operator), dst->to_form(file),
|
||||
src->to_form(file));
|
||||
}
|
||||
|
||||
goos::Object IR_Failed::to_form(const LinkedObjectFile& file) const {
|
||||
@@ -142,7 +144,8 @@ goos::Object IR_FloatMath2::to_form(const LinkedObjectFile& file) const {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
return pretty_print::build_list(pretty_print::to_symbol(math_operator), arg0->to_form(file), arg1->to_form(file));
|
||||
return pretty_print::build_list(pretty_print::to_symbol(math_operator), arg0->to_form(file),
|
||||
arg1->to_form(file));
|
||||
}
|
||||
|
||||
goos::Object IR_IntMath2::to_form(const LinkedObjectFile& file) const {
|
||||
@@ -196,7 +199,8 @@ goos::Object IR_IntMath2::to_form(const LinkedObjectFile& file) const {
|
||||
default:
|
||||
assert(false);
|
||||
}
|
||||
return pretty_print::build_list(pretty_print::to_symbol(math_operator), arg0->to_form(file), arg1->to_form(file));
|
||||
return pretty_print::build_list(pretty_print::to_symbol(math_operator), arg0->to_form(file),
|
||||
arg1->to_form(file));
|
||||
}
|
||||
|
||||
goos::Object IR_IntMath1::to_form(const LinkedObjectFile& file) const {
|
||||
@@ -251,11 +255,14 @@ goos::Object BranchDelay::to_form(const LinkedObjectFile& file) const {
|
||||
case NOP:
|
||||
return pretty_print::build_list("nop");
|
||||
case SET_REG_FALSE:
|
||||
return pretty_print::build_list(pretty_print::to_symbol("set!"), destination->to_form(file), "'#f");
|
||||
return pretty_print::build_list(pretty_print::to_symbol("set!"), destination->to_form(file),
|
||||
"'#f");
|
||||
case SET_REG_TRUE:
|
||||
return pretty_print::build_list(pretty_print::to_symbol("set!"), destination->to_form(file), "'#t");
|
||||
return pretty_print::build_list(pretty_print::to_symbol("set!"), destination->to_form(file),
|
||||
"'#t");
|
||||
case SET_REG_REG:
|
||||
return pretty_print::build_list(pretty_print::to_symbol("set!"), destination->to_form(file), source->to_form(file));
|
||||
return pretty_print::build_list(pretty_print::to_symbol("set!"), destination->to_form(file),
|
||||
source->to_form(file));
|
||||
case UNKNOWN:
|
||||
return pretty_print::build_list("unknown-branch-delay");
|
||||
default:
|
||||
@@ -363,12 +370,14 @@ goos::Object Condition::to_form(const LinkedObjectFile& file) const {
|
||||
}
|
||||
|
||||
if (nargs == 2) {
|
||||
return pretty_print::build_list(pretty_print::to_symbol(condtion_operator), src0->to_form(file), src1->to_form(file));
|
||||
return pretty_print::build_list(pretty_print::to_symbol(condtion_operator), src0->to_form(file),
|
||||
src1->to_form(file));
|
||||
} else if (nargs == 1) {
|
||||
if (condtion_operator.empty()) {
|
||||
return src0->to_form(file);
|
||||
} else {
|
||||
return pretty_print::build_list(pretty_print::to_symbol(condtion_operator), src0->to_form(file));
|
||||
return pretty_print::build_list(pretty_print::to_symbol(condtion_operator),
|
||||
src0->to_form(file));
|
||||
}
|
||||
} else if (nargs == 0) {
|
||||
return pretty_print::to_symbol(condtion_operator);
|
||||
@@ -378,8 +387,9 @@ goos::Object Condition::to_form(const LinkedObjectFile& file) const {
|
||||
}
|
||||
|
||||
goos::Object IR_Branch::to_form(const LinkedObjectFile& file) const {
|
||||
return pretty_print::build_list(pretty_print::to_symbol(likely ? "bl!" : "b!"), condition.to_form(file),
|
||||
pretty_print::to_symbol(file.get_label_name(dest_label_idx)), branch_delay.to_form(file));
|
||||
return pretty_print::build_list(
|
||||
pretty_print::to_symbol(likely ? "bl!" : "b!"), condition.to_form(file),
|
||||
pretty_print::to_symbol(file.get_label_name(dest_label_idx)), branch_delay.to_form(file));
|
||||
}
|
||||
|
||||
goos::Object IR_Compare::to_form(const LinkedObjectFile& file) const {
|
||||
|
||||
@@ -714,7 +714,8 @@ std::string LinkedObjectFile::print_scripts() {
|
||||
if (label_id != -1) {
|
||||
auto& label = labels.at(label_id);
|
||||
if ((label.offset & 7) == 2) {
|
||||
//result += to_form_script(seg, word_idx, already_printed)->toStringPretty(0, 100) + "\n";
|
||||
// result += to_form_script(seg, word_idx, already_printed)->toStringPretty(0, 100) +
|
||||
// "\n";
|
||||
result += pretty_print::to_string(to_form_script(seg, word_idx, already_printed)) + "\n";
|
||||
}
|
||||
}
|
||||
@@ -737,9 +738,7 @@ bool LinkedObjectFile::is_empty_list(int seg, int byte_idx) {
|
||||
* Note : this takes the address of the car of the pair. which is perhaps a bit confusing
|
||||
* (in GOAL, this would be (&-> obj car))
|
||||
*/
|
||||
goos::Object LinkedObjectFile::to_form_script(int seg,
|
||||
int word_idx,
|
||||
std::vector<bool>& seen) {
|
||||
goos::Object LinkedObjectFile::to_form_script(int seg, int word_idx, std::vector<bool>& seen) {
|
||||
// the object to currently print. to start off, create pair from the car address we've been given.
|
||||
int goal_print_obj = word_idx * 4 + 2;
|
||||
|
||||
@@ -811,8 +810,8 @@ bool LinkedObjectFile::is_string(int seg, int byte_idx) {
|
||||
* Convert a (pointer object) to some nice representation.
|
||||
*/
|
||||
goos::Object LinkedObjectFile::to_form_script_object(int seg,
|
||||
int byte_idx,
|
||||
std::vector<bool>& seen) {
|
||||
int byte_idx,
|
||||
std::vector<bool>& seen) {
|
||||
goos::Object result;
|
||||
|
||||
switch (byte_idx & 7) {
|
||||
|
||||
Reference in New Issue
Block a user