mirror of
https://github.com/open-goal/jak-project.git
synced 2025-01-30 10:23:25 +00:00
Cleaned up some unneeded changes
This commit is contained in:
parent
14c1b8be74
commit
a87060320a
@ -76,7 +76,7 @@ class TypeSystem {
|
||||
auto x = lookup_type(type_name);
|
||||
T* result = dynamic_cast<T*>(x);
|
||||
if (!result) {
|
||||
throw std::runtime_error("Failed to get the right type");
|
||||
throw std::runtime_error("Failed to get " + type_name + " as the right type");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ std::string combine_path(const std::string& parent, const std::string& child) {
|
||||
|
||||
std::vector<uint8_t> read_binary_file(const std::string& filename) {
|
||||
auto fp = fopen(filename.c_str(), "rb");
|
||||
if(!fp) throw std::runtime_error("File cannot be opened");
|
||||
if(!fp) throw std::runtime_error("File " + filename + " cannot be opened");
|
||||
fseek(fp, 0, SEEK_END);
|
||||
auto len = ftell(fp);
|
||||
rewind(fp);
|
||||
@ -25,7 +25,7 @@ std::vector<uint8_t> read_binary_file(const std::string& filename) {
|
||||
data.resize(len);
|
||||
|
||||
if(fread(data.data(), len, 1, fp) != 1) {
|
||||
throw std::runtime_error("File cannot be read");
|
||||
throw std::runtime_error("File " + filename + " cannot be read");
|
||||
}
|
||||
|
||||
return data;
|
||||
|
@ -48,7 +48,7 @@ int64_t Timer::getNs() {
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
#elif _WIN32
|
||||
clock_gettime_monotonic(&now);
|
||||
#endif;
|
||||
#endif
|
||||
return (int64_t)(now.tv_nsec - _startTime.tv_nsec) +
|
||||
1000000000 * (now.tv_sec - _startTime.tv_sec);
|
||||
}
|
||||
}
|
||||
|
@ -19,8 +19,6 @@ class Timer {
|
||||
int clock_gettime_monotonic(struct timespec* tv);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
* Start the timer
|
||||
*/
|
||||
@ -29,7 +27,7 @@ class Timer {
|
||||
/*!
|
||||
* Get milliseconds elapsed
|
||||
*/
|
||||
double getMs() { return (double)getNs() / 1.e6; }
|
||||
double getMs() { return (double)getNs() / 1.e6; }
|
||||
|
||||
double getUs() { return (double)getNs() / 1.e3; }
|
||||
|
||||
|
@ -97,7 +97,7 @@ void Interpreter::disable_printfs() {
|
||||
*/
|
||||
void Interpreter::load_goos_library() {
|
||||
auto cmd = "(load-file \"goalc/gs/goos-lib.gs\")";
|
||||
eval_with_rewind(reader.read_from_string(cmd), global_environment.as_env());
|
||||
eval_with_rewind(reader.read_from_string(cmd), global_environment.as_env());
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -137,8 +137,8 @@ void Interpreter::execute_repl() {
|
||||
* for debugging.
|
||||
*/
|
||||
void Interpreter::throw_eval_error(const Object& o, const std::string& err) {
|
||||
throw std::runtime_error("[GOOS] Evaluation error on " + o.print() + ": " + err + "\n" +
|
||||
reader.db.get_info_for(o));
|
||||
throw std::runtime_error("[GOOS] Evaluation error on " + o.print() + ": " + err + "\n" +
|
||||
reader.db.get_info_for(o));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -918,4 +918,4 @@ Object Interpreter::eval_while(const Object& form,
|
||||
return rv;
|
||||
}
|
||||
|
||||
} // namespace goos
|
||||
} // namespace goos
|
||||
|
@ -151,7 +151,7 @@ bool Object::operator==(const Object& other) const {
|
||||
}
|
||||
|
||||
default:
|
||||
throw std::runtime_error("equality not implemented for");
|
||||
throw std::runtime_error("equality not implemented for " + print());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -222,7 +222,7 @@ class Object {
|
||||
|
||||
std::shared_ptr<PairObject> as_pair() const {
|
||||
if (type != ObjectType::PAIR) {
|
||||
throw std::runtime_error("as_pair called on a " + object_type_to_string(type) + " " +
|
||||
throw std::runtime_error("as_pair called on a " + object_type_to_string(type) + " " +
|
||||
print());
|
||||
}
|
||||
return std::dynamic_pointer_cast<PairObject>(heap_obj);
|
||||
@ -246,7 +246,7 @@ class Object {
|
||||
std::shared_ptr<StringObject> as_string() const {
|
||||
if (type != ObjectType::STRING) {
|
||||
throw std::runtime_error("as_string called on a " + object_type_to_string(type) + " " +
|
||||
print());
|
||||
print());
|
||||
}
|
||||
return std::dynamic_pointer_cast<StringObject>(heap_obj);
|
||||
}
|
||||
@ -269,7 +269,7 @@ class Object {
|
||||
|
||||
std::shared_ptr<ArrayObject> as_array() const {
|
||||
if (type != ObjectType::ARRAY) {
|
||||
throw std::runtime_error("as_array called on a " + object_type_to_string(type) + " " +
|
||||
throw std::runtime_error("as_array called on a " + object_type_to_string(type) + " " +
|
||||
print());
|
||||
}
|
||||
return std::dynamic_pointer_cast<ArrayObject>(heap_obj);
|
||||
@ -284,7 +284,7 @@ class Object {
|
||||
|
||||
FloatType& as_float() {
|
||||
if (type != ObjectType::FLOAT) {
|
||||
throw std::runtime_error("as_float called on a " + object_type_to_string(type) + " " +
|
||||
throw std::runtime_error("as_float called on a " + object_type_to_string(type) + " " +
|
||||
print());
|
||||
}
|
||||
return float_obj.value;
|
||||
|
@ -588,7 +588,7 @@ bool Reader::try_token_as_binary(const Token& tok, Object& obj) {
|
||||
|
||||
for (uint32_t i = 2; i < tok.text.size(); i++) {
|
||||
if (value & (0x8000000000000000)) {
|
||||
throw std::runtime_error("overflow in binary constant:)");
|
||||
throw std::runtime_error("overflow in binary constant: " + tok.text);
|
||||
}
|
||||
|
||||
value <<= 1u;
|
||||
@ -628,7 +628,7 @@ bool Reader::try_token_as_hex(const Token& tok, Object& obj) {
|
||||
obj = Object::make_integer(v);
|
||||
return true;
|
||||
} catch (std::exception& e) {
|
||||
throw std::runtime_error("The number cannot be a hexadecimal constant");
|
||||
throw std::runtime_error("The number " + tok.text + " cannot be a hexadecimal constant");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -662,7 +662,7 @@ bool Reader::try_token_as_integer(const Token& tok, Object& obj) {
|
||||
obj = Object::make_integer(v);
|
||||
return true;
|
||||
} catch (std::exception& e) {
|
||||
throw std::runtime_error("The number cannot be an integer constant");
|
||||
throw std::runtime_error("The number " + tok.text + " cannot be an integer constant");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -697,7 +697,8 @@ bool Reader::try_token_as_char(const Token& tok, Object& obj) {
|
||||
* Used for reader errors, like "missing close paren" or similar.
|
||||
*/
|
||||
void Reader::throw_reader_error(TextStream& here, const std::string& err, int seek_offset) {
|
||||
throw std::runtime_error("Reader error at");
|
||||
throw std::runtime_error("Reader error:\n" + err + "\nat " +
|
||||
db.get_info_for(here.text, here.seek + seek_offset));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -706,4 +707,4 @@ void Reader::throw_reader_error(TextStream& here, const std::string& err, int se
|
||||
std::string Reader::get_source_dir() {
|
||||
return source_dir;
|
||||
}
|
||||
} // namespace goos
|
||||
} // namespace goos
|
||||
|
@ -7,7 +7,7 @@ namespace util {
|
||||
std::string read_text_file(const std::string& path) {
|
||||
std::ifstream file(path);
|
||||
if (!file.good()) {
|
||||
throw std::runtime_error("couldn't open ");
|
||||
throw std::runtime_error("couldn't open " + path);
|
||||
}
|
||||
std::stringstream ss;
|
||||
ss << file.rdbuf();
|
||||
|
@ -7748,7 +7748,7 @@ const char* all_syms[7941] = {"ripple-for-lava",
|
||||
"list-control",
|
||||
"sunken-pipegame-idle",
|
||||
"anim-test-edit-seq-insert-item",
|
||||
"anim-tester-interfaces",
|
||||
"anim-tester-interface",
|
||||
"anim-tester-adjust-frame",
|
||||
"extra-radius",
|
||||
"*volume-descriptor*",
|
||||
|
2
third-party/fmt/format-inl.h
vendored
2
third-party/fmt/format-inl.h
vendored
@ -227,7 +227,7 @@ FMT_FUNC void system_error::init(int err_code, string_view format_str,
|
||||
memory_buffer buffer;
|
||||
format_system_error(buffer, err_code, vformat(format_str, args));
|
||||
std::runtime_error& base = *this;
|
||||
// base = std::runtime_error(to_string(buffer));
|
||||
base = std::runtime_error(to_string(buffer));
|
||||
}
|
||||
|
||||
namespace detail {
|
||||
|
4
third-party/fmt/format.h
vendored
4
third-party/fmt/format.h
vendored
@ -713,8 +713,8 @@ FMT_CLASS_API
|
||||
class FMT_API format_error : public std::runtime_error {
|
||||
public:
|
||||
explicit format_error(const char* message) : std::runtime_error(message) {}
|
||||
explicit format_error(const std::string& message);
|
||||
// : std::runtime_error(message) {}
|
||||
explicit format_error(const std::string& message)
|
||||
: std::runtime_error(message) {}
|
||||
format_error(const format_error&) = default;
|
||||
format_error& operator=(const format_error&) = default;
|
||||
format_error(format_error&&) = default;
|
||||
|
36
third-party/json.hpp
vendored
36
third-party/json.hpp
vendored
@ -70,7 +70,7 @@ SOFTWARE.
|
||||
|
||||
|
||||
#include <exception> // exception
|
||||
#include <stdexcept> // exception
|
||||
#include <stdexcept> // runtime_error
|
||||
#include <string> // to_string
|
||||
|
||||
// #include <nlohmann/detail/input/position_t.hpp>
|
||||
@ -92,7 +92,7 @@ struct position_t
|
||||
/// the number of lines read
|
||||
std::size_t lines_read = 0;
|
||||
|
||||
/// conversion to size_t to preserve SAX interfaces
|
||||
/// conversion to size_t to preserve SAX interface
|
||||
constexpr operator size_t() const
|
||||
{
|
||||
return chars_read_total;
|
||||
@ -2324,7 +2324,7 @@ namespace detail
|
||||
/*!
|
||||
@brief general exception of the @ref basic_json class
|
||||
|
||||
This class is an extension of `std::runtime_error` objects with a member @a id for
|
||||
This class is an extension of `std::exception` objects with a member @a id for
|
||||
exception ids. It is used as the base class for all exceptions thrown by the
|
||||
@ref basic_json class. This class can hence be used as "wildcard" to catch
|
||||
exceptions.
|
||||
@ -2349,7 +2349,7 @@ caught.,exception}
|
||||
|
||||
@since version 3.0.0
|
||||
*/
|
||||
class exception : public std::runtime_error
|
||||
class exception : public std::exception
|
||||
{
|
||||
public:
|
||||
/// returns the explanatory string
|
||||
@ -4823,7 +4823,7 @@ class input_stream_adapter
|
||||
std::char_traits<char>::int_type get_character()
|
||||
{
|
||||
auto res = sb->sbumpc();
|
||||
// set eof manually, as we don't use the istream interfaces.
|
||||
// set eof manually, as we don't use the istream interface.
|
||||
if (JSON_HEDLEY_UNLIKELY(res == EOF))
|
||||
{
|
||||
is->clear(is->rdstate() | std::ios::eofbit);
|
||||
@ -5191,9 +5191,9 @@ namespace nlohmann
|
||||
{
|
||||
|
||||
/*!
|
||||
@brief SAX interfaces
|
||||
@brief SAX interface
|
||||
|
||||
This class describes the SAX interfaces used by @ref nlohmann::json::sax_parse.
|
||||
This class describes the SAX interface used by @ref nlohmann::json::sax_parse.
|
||||
Each function is called in different situations while the input is parsed. The
|
||||
boolean return value informs the parser whether to continue processing the
|
||||
input.
|
||||
@ -5314,7 +5314,7 @@ namespace detail
|
||||
/*!
|
||||
@brief SAX implementation to create a JSON value from SAX events
|
||||
|
||||
This class implements the @ref json_sax interfaces and processes the SAX events
|
||||
This class implements the @ref json_sax interface and processes the SAX events
|
||||
to create a JSON value which makes it basically a DOM parser. The structure or
|
||||
hierarchy of the JSON value is managed by the stack `ref_stack` which contains
|
||||
a pointer to the respective array or object for each recursion depth.
|
||||
@ -7198,7 +7198,7 @@ scan_number_done:
|
||||
/*
|
||||
@brief get next character from the input
|
||||
|
||||
This function provides the interfaces to the used input adapter. It does
|
||||
This function provides the interface to the used input adapter. It does
|
||||
not throw in case the input reached EOF, but returns a
|
||||
`std::char_traits<char>::eof()` in that case. Stores the scanned characters
|
||||
for use in error messages.
|
||||
@ -9881,7 +9881,7 @@ class binary_reader
|
||||
/*!
|
||||
@brief get next character from the input
|
||||
|
||||
This function provides the interfaces to the used input adapter. It does
|
||||
This function provides the interface to the used input adapter. It does
|
||||
not throw in case the input reached EOF, but returns a -'ve valued
|
||||
`std::char_traits<char_type>::eof()` in that case.
|
||||
|
||||
@ -10184,7 +10184,7 @@ class parser
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief public parser interfaces
|
||||
@brief public parser interface
|
||||
|
||||
@param[in] strict whether to expect the last token to be EOF
|
||||
@param[in,out] result parsed JSON value
|
||||
@ -10249,7 +10249,7 @@ class parser
|
||||
}
|
||||
|
||||
/*!
|
||||
@brief public accept interfaces
|
||||
@brief public accept interface
|
||||
|
||||
@param[in] strict whether to expect the last token to be EOF
|
||||
@return whether the input is a proper JSON text
|
||||
@ -12628,7 +12628,7 @@ namespace nlohmann
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
/// abstract output adapter interfaces
|
||||
/// abstract output adapter interface
|
||||
template<typename CharType> struct output_adapter_protocol
|
||||
{
|
||||
virtual void write_character(CharType c) = 0;
|
||||
@ -12636,7 +12636,7 @@ template<typename CharType> struct output_adapter_protocol
|
||||
virtual ~output_adapter_protocol() = default;
|
||||
};
|
||||
|
||||
/// a type to simplify interfaces
|
||||
/// a type to simplify interface
|
||||
template<typename CharType>
|
||||
using output_adapter_t = std::shared_ptr<output_adapter_protocol<CharType>>;
|
||||
|
||||
@ -16724,7 +16724,7 @@ class basic_json
|
||||
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
|
||||
|
||||
using input_format_t = detail::input_format_t;
|
||||
/// SAX interfaces type, see @ref nlohmann::json_sax
|
||||
/// SAX interface type, see @ref nlohmann::json_sax
|
||||
using json_sax_t = json_sax<basic_json>;
|
||||
|
||||
////////////////
|
||||
@ -21253,7 +21253,7 @@ class basic_json
|
||||
element as string (see example).
|
||||
|
||||
@param[in] ref reference to a JSON value
|
||||
@return iteration proxy object wrapping @a ref with an interfaces to use in
|
||||
@return iteration proxy object wrapping @a ref with an interface to use in
|
||||
range-based for loops
|
||||
|
||||
@liveexample{The following code shows how the wrapper is used,iterator_wrapper}
|
||||
@ -21341,7 +21341,7 @@ class basic_json
|
||||
<https://github.com/nlohmann/json/issues/2040> for more
|
||||
information.
|
||||
|
||||
@return iteration proxy object wrapping @a ref with an interfaces to use in
|
||||
@return iteration proxy object wrapping @a ref with an interface to use in
|
||||
range-based for loops
|
||||
|
||||
@liveexample{The following code shows how the function is used.,items}
|
||||
@ -23249,7 +23249,7 @@ class basic_json
|
||||
/*!
|
||||
@brief generate SAX events
|
||||
|
||||
The SAX event lister must follow the interfaces of @ref json_sax.
|
||||
The SAX event lister must follow the interface of @ref json_sax.
|
||||
|
||||
This function reads from a compatible input. Examples are:
|
||||
- an std::istream object
|
||||
|
2
third-party/minilzo/lzoconf.h
vendored
2
third-party/minilzo/lzoconf.h
vendored
@ -264,7 +264,7 @@ typedef int
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
|
||||
|
||||
/* Callback interfaces. Currently only the progress indicator ("nprogress")
|
||||
/* Callback interface. Currently only the progress indicator ("nprogress")
|
||||
* is used, but this may change in a future release. */
|
||||
|
||||
struct lzo_callback_t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user