#include #include #include #include #include #include "locator.h" #include "ktype.h" #include "log.h" #include "file.h" #include "show.h" #include "util.h" /* bool is_error(katom_t t) { return t == katom_t::undefined || t == katom_t::no_matching_end || t == katom_t::no_matching_begin || t == katom_t::karg_error || t == katom_t::klammer_definition_type_error || t == katom_t::eval_error; } */ bool is_active(katom_t type) { return type != katom_t::ignored && type != katom_t::replaced; } bool is_printable(katom_t type) { return printable_katom_types.find(type) != printable_katom_types.end(); } bool is_deftype(katom_t type) { return type == katom_t::klammer_definition || type == katom_t::klammer_instance || type == katom_t::klammer_override || type == katom_t::klammer_default; } const Ktype& type_to_katom_instance(katom_t type) { auto var = std::find_if(katom_types.begin(), katom_types.end(), [&] (const Ktype& t) { return t.m_type == type; }); if (var == katom_types.end()) { throw std::logic_error( "type_to_katom_instance: katom type " + std::to_string(static_cast(type)) + " has no entry in katom_types. See file mac/ktype.h."); } return *var; } std::string type_to_name(katom_t type) { return type_to_katom_instance(type).m_name; }