errors.c (3770B)
1 #include <stddef.h> 2 3 #include "errors.h" 4 5 miniroon_error miniroon_current_error = 0; 6 char const *miniroon_errmsg[8] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; 7 unsigned char miniroon_errmsg_count = 0; 8 9 miniroon_error miniroon_err1(miniroon_error e, char const* const m1) { 10 miniroon_errmsg[0] = m1; 11 miniroon_errmsg[1] = NULL; 12 miniroon_errmsg[2] = NULL; 13 miniroon_errmsg[3] = NULL; 14 miniroon_errmsg[4] = NULL; 15 miniroon_errmsg[5] = NULL; 16 miniroon_errmsg[6] = NULL; 17 miniroon_errmsg[7] = NULL; 18 miniroon_errmsg_count = 1; 19 miniroon_current_error = e; 20 return e; 21 } 22 23 miniroon_error miniroon_err2(miniroon_error e, char const* const m1, char const* const m2) { 24 miniroon_errmsg[0] = m1; 25 miniroon_errmsg[1] = m2; 26 miniroon_errmsg[2] = NULL; 27 miniroon_errmsg[3] = NULL; 28 miniroon_errmsg[4] = NULL; 29 miniroon_errmsg[5] = NULL; 30 miniroon_errmsg[6] = NULL; 31 miniroon_errmsg[7] = NULL; 32 miniroon_errmsg_count = 2; 33 miniroon_current_error = e; 34 return e; 35 } 36 37 miniroon_error miniroon_err3(miniroon_error e, char const* const m1, char const* const m2, char const* const m3) { 38 miniroon_errmsg[0] = m1; 39 miniroon_errmsg[1] = m2; 40 miniroon_errmsg[2] = m3; 41 miniroon_errmsg[3] = NULL; 42 miniroon_errmsg[4] = NULL; 43 miniroon_errmsg[5] = NULL; 44 miniroon_errmsg[6] = NULL; 45 miniroon_errmsg[7] = NULL; 46 miniroon_errmsg_count = 3; 47 miniroon_current_error = e; 48 return e; 49 } 50 51 miniroon_error miniroon_err4(miniroon_error e, char const* const m1, char const* const m2, char const* const m3, char const* const m4) { 52 miniroon_errmsg[0] = m1; 53 miniroon_errmsg[1] = m2; 54 miniroon_errmsg[2] = m3; 55 miniroon_errmsg[3] = m4; 56 miniroon_errmsg[4] = NULL; 57 miniroon_errmsg[5] = NULL; 58 miniroon_errmsg[6] = NULL; 59 miniroon_errmsg[7] = NULL; 60 miniroon_errmsg_count = 4; 61 miniroon_current_error = e; 62 return e; 63 } 64 65 miniroon_error miniroon_err5(miniroon_error e, char const* const m1, char const* const m2, char const* const m3, char const* const m4, char const* const m5) { 66 miniroon_errmsg[0] = m1; 67 miniroon_errmsg[1] = m2; 68 miniroon_errmsg[2] = m3; 69 miniroon_errmsg[3] = m4; 70 miniroon_errmsg[4] = m5; 71 miniroon_errmsg[5] = NULL; 72 miniroon_errmsg[6] = NULL; 73 miniroon_errmsg[7] = NULL; 74 miniroon_errmsg_count = 5; 75 miniroon_current_error = e; 76 return e; 77 } 78 79 miniroon_error miniroon_err6(miniroon_error e, char const* const m1, char const* const m2, char const* const m3, char const* const m4, char const* const m5, char const* const m6) { 80 miniroon_errmsg[0] = m1; 81 miniroon_errmsg[1] = m2; 82 miniroon_errmsg[2] = m3; 83 miniroon_errmsg[3] = m4; 84 miniroon_errmsg[4] = m5; 85 miniroon_errmsg[5] = m6; 86 miniroon_errmsg[6] = NULL; 87 miniroon_errmsg[7] = NULL; 88 miniroon_errmsg_count = 6; 89 miniroon_current_error = e; 90 return e; 91 } 92 93 miniroon_error miniroon_err7(miniroon_error e, char const* const m1, char const* const m2, char const* const m3, char const* const m4, char const* const m5, char const* const m6, char const* const m7) { 94 miniroon_errmsg[0] = m1; 95 miniroon_errmsg[1] = m2; 96 miniroon_errmsg[2] = m3; 97 miniroon_errmsg[3] = m4; 98 miniroon_errmsg[4] = m5; 99 miniroon_errmsg[5] = m6; 100 miniroon_errmsg[6] = m7; 101 miniroon_errmsg[7] = NULL; 102 miniroon_errmsg_count = 7; 103 miniroon_current_error = e; 104 return e; 105 } 106 107 108 miniroon_error miniroon_err8(miniroon_error e, char const* const m1, char const* const m2, char const* const m3, char const* const m4, char const* const m5, char const* const m6, char const* const m7, char const* const m8) { 109 miniroon_errmsg[0] = m1; 110 miniroon_errmsg[1] = m2; 111 miniroon_errmsg[2] = m3; 112 miniroon_errmsg[3] = m4; 113 miniroon_errmsg[4] = m5; 114 miniroon_errmsg[5] = m6; 115 miniroon_errmsg[6] = m7; 116 miniroon_errmsg[7] = m8; 117 miniroon_errmsg_count = 8; 118 miniroon_current_error = e; 119 return e; 120 }