55 #ifndef ETISS_INCLUDE_RETURNCODE_H_
56 #define ETISS_INCLUDE_RETURNCODE_H_
58 #include "etiss/jit/types.h"
74 extern std::map<etiss::int32, const char *> &getErrorMessages();
79 extern std::map<etiss::int32, const char *> &getErrorNames();
81 extern int32_t setTemporary(
const std::string &msg);
93 #ifndef etiss_toString
94 #define etiss__toString_(X) #X
95 #define etiss_toString(X) etiss__toString_(X)
98 #define etiss__merge2_(X, Y) X##Y
99 #define etiss_merge2(X, Y) etiss__merge2_(X, Y)
106 #ifdef ETISS_RETURNCODE_REGISTRATION_BODY
108 #define defineReturnCodeClass_(UNIQUENUMBER, NAME, VALUE, MSG) \
109 static class ReturnCodeRegistration_##UNIQUENUMBER \
112 ReturnCodeRegistration_##UNIQUENUMBER() \
114 auto entry = etiss::RETURNCODE::getErrorNames().find(VALUE); \
115 if (entry != etiss::RETURNCODE::getErrorNames().end()) \
117 if (std::string(entry->second) != etiss_toString(NAME)) \
119 std::stringstream ss; \
120 ss << "Duplicated RETURNCODE " << VALUE << ": "; \
121 ss << etiss::RETURNCODE::getErrorNames().find(VALUE)->second << "," << etiss_toString(NAME); \
122 etiss::log(etiss::ERROR, ss.str()); \
125 etiss::RETURNCODE::getErrorMessages()[VALUE] = MSG; \
126 etiss::RETURNCODE::getErrorNames()[VALUE] = etiss_toString(NAME); \
128 } returnCodeRegistration_##UNIQUENUMBER
130 #define defineReturnCodeClass(UNIQUENUMBER, NAME, VALUE, MSG) defineReturnCodeClass_(UNIQUENUMBER, NAME, VALUE, MSG)
132 #define defineReturnCode(NAME, VALUE, MSG) \
135 namespace RETURNCODE \
137 static const etiss::int32 NAME = VALUE; \
140 static const etiss_int32 etiss_merge2(ETISS_RETURNCODE_, NAME) = VALUE; \
141 defineReturnCodeClass(__COUNTER__, NAME, VALUE, MSG)
143 #define defineReturnCode(NAME, VALUE, MSG) \
146 namespace RETURNCODE \
148 static const etiss::int32 NAME = VALUE; \
151 static const etiss_int32 ETISS_RETURNCODE_##NAME = VALUE
154 #define defineReturnCode(NAME, VALUE, MSG) static const etiss_int32 ETISS_RETURNCODE_##NAME = VALUE
167 defineReturnCode(RELOADCURRENTBLOCK, -3,
"Clear the cached block that returned this code.");
181 "Has the same effect as NOERROR but allows exiting a block where NOERROR "
182 "would have continued block execution.");
187 "Finished cpu execution. This is the proper way to exit from "
188 "etiss::CPUCore::execute.");
190 "Terminates cpu execution. this is the proper way to force an "
191 "exit from etiss::CPUCore::execute (e.g. by a debugger).");
197 "An ETISS_System structure doesn't contain "
198 "the neccessary function pointers.");
207 #define ETISS_RETURNCODE_TEMPORARY_COUNT 8
general configuration and logging
static __inline__ int32_t
int32_t etiss_returncode_setTemporary(const char *msg)
sets the message of a temporary return code and returns the returncode.
#define defineReturnCode(NAME, VALUE, MSG)
define RETURNCODE definition template for easy use with c and c++
MM_EXPORT const int32_t NOERROR
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.