share Make errors.h assembler friendly too

This commit is contained in:
2025-10-03 22:32:50 +02:00
parent 3c1c63e970
commit 08793178f1

View File

@ -1,23 +1,23 @@
#ifndef ERRORS_H_ #ifndef ERRORS_H_
#define ERRORS_H_ #define ERRORS_H_
enum { #define E_OK 0
E_OK = 0, #define E_NOMEMORY -1
E_NOMEMORY = -1, #define E_UNKNOWN_FSTYPE -2
E_UNKNOWN_FSTYPE = -2, #define E_NOENTRY -3
E_NOENTRY = -3, #define E_OUTOFBOUNDS -4
E_OUTOFBOUNDS = -4, #define E_UNKNOWN_SDTYPE -5
E_UNKNOWN_SDTYPE = -5, #define E_TODO -6
E_TODO = -6, #define E_BADIO -7
E_BADIO = -7, #define E_BADSYSCALL -8
E_BADSYSCALL = -8, #define E_DOSCHEDULING -9
E_DOSCHEDULING = -9, #define E_INVALIDARGUMENT -10
E_INVALIDARGUMENT = -10, #define E_INVALIDOPER -11
E_INVALIDOPER = -11, #define E_RESOURCEAVAIL -12
E_RESOURCEAVAIL = -12, #define E_SPAWNERROR -13
E_SPAWNERROR = -13, #define E_NOTYET -14
E_NOTYET = -14,
}; #if !defined(__ASSEMBLER__)
static const char *_ERROR_STRINGS[] = { static const char *_ERROR_STRINGS[] = {
"OK", "OK",
@ -39,4 +39,6 @@ static const char *_ERROR_STRINGS[] = {
#define ERRSTRING_INDEX(ioh) ((size_t)((ioh) < 0 ? (ioh) * (-1) : (ioh))) #define ERRSTRING_INDEX(ioh) ((size_t)((ioh) < 0 ? (ioh) * (-1) : (ioh)))
#define ERRSTRING(ioh) (_ERROR_STRINGS[ERRSTRING_INDEX(ioh)]) #define ERRSTRING(ioh) (_ERROR_STRINGS[ERRSTRING_INDEX(ioh)])
#endif
#endif // ERRORS_H_ #endif // ERRORS_H_