typedef b32_s status_i_t; typedef struct { status_i_t id; b8 group; } status_t; #define status_id_success 0 #define status_group_undefined 0 #define status_init \ status_t status = {status_id_success, status_group_undefined} #define status_reset status_set_both(status_group_undefined, status_id_success) #define status_success_p (status_id_success == status.id) #define status_failure_p !status_success_p #define status_goto goto exit #define status_set_group(group_id) status.group = group_id #define status_set_id(status_id) status.id = status_id #define status_set_both(group_id, status_id) \ status_set_group(group_id); \ status_set_id(status_id) #define status_require \ if (status_failure_p) { \ status_goto; \ } #define status_require_x(expression) \ status = expression; \ if (status_failure_p) { \ status_goto; \ } #define status_set_id_goto(status_id) \ status_set_id(status_id); \ status_goto #define status_set_group_goto(group_id) \ status_set_group(group_id); \ status_goto #define status_set_both_goto(group_id, status_id) \ status_set_both(group_id, status_id); \ status_goto #define status_id_is_p(status_id) (status_id == status.id)