/** Usage of the create_error_macros: */ #define __create_error(keyword, ...) \ create_error( \ __FUNCTION__, __FILE__, __LINE__, \ Memory::get_keyword(keyword), \ __VA_ARGS__) #define create_out_of_memory_error(...) \ __create_error("out-of-memory", __VA_ARGS__) #define create_generic_error(...) \ __create_error("generic", __VA_ARGS__) #define create_not_yet_implemented_error() \ __create_error("not-yet-implemented", "This feature has not yet been implemented.") #define create_parsing_error(...) \ __create_error("parsing-error", __VA_ARGS__) #define create_symbol_undefined_error(...) \ __create_error("symbol-undefined", __VA_ARGS__) #define create_type_missmatch_error(expected, actual) \ __create_error("type-missmatch", \ "Type missmatch: expected %s, got %s", \ expected, actual) #ifdef _DEBUG #define assert_type(_node, _type) \ do { \ if (Memory::get_type(_node) != _type) { \ create_type_missmatch_error( \ Lisp_Object_Type_to_string(_type), \ Lisp_Object_Type_to_string(Memory::get_type(_node))); \ } \ } while(0) #define assert(condition) \ do { \ if (!(condition)) { \ create_generic_error("Assertion-error."); \ } \ } while(0) #else # define assert_arguments_length(expected, actual) do {} while (0) # define assert_arguments_length_less_equal(expected, actual) do {} while (0) # define assert_arguments_length_greater_equal(expected, actual) do {} while (0) # define assert_type(_node, _type) do {} while (0) # define assert(condition) do {} while (0) #endif