nac3/nac3core/irrt/irrt_error_context.hpp

31 lines
752 B
C++

#pragma once
#include "irrt_printer.hpp"
namespace {
#define MAX_ERROR_NAME_LEN 32
// TODO: right now just to report some messages for now
struct ErrorContext {
Printer error;
// TODO: add error_class_name??
void initialize(char* string_base_ptr, uint32_t max_length) {
error.initialize(string_base_ptr, max_length);
}
bool has_error() {
return error.length > 0;
}
};
}
extern "C" {
void __nac3_error_context_init(ErrorContext* ctx, char* string_base_ptr, uint32_t max_length) {
ctx->initialize(string_base_ptr, max_length);
}
uint8_t __nac3_error_context_has_error(ErrorContext* ctx) {
return (uint8_t) ctx->has_error();
}
}