2019-01-01 13:09:57 +01:00
|
|
|
//----------------------------------------------------------------------------//
|
|
|
|
// GNU GPL OS/K //
|
|
|
|
// //
|
|
|
|
// Authors: spectral` //
|
|
|
|
// NeoX //
|
|
|
|
// //
|
|
|
|
// Desc: Kaleid general preprocessor constants //
|
|
|
|
//----------------------------------------------------------------------------//
|
|
|
|
|
|
|
|
#ifndef _KALDEFS_H
|
|
|
|
#define _KALDEFS_H
|
|
|
|
|
|
|
|
//------------------------------------------//
|
|
|
|
// Actual constants //
|
|
|
|
//------------------------------------------//
|
|
|
|
|
|
|
|
#ifndef TRUE
|
|
|
|
#define TRUE 1
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef FALSE
|
|
|
|
#define FALSE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef NULL
|
|
|
|
#define NULL ((void *)0)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef INITOK
|
|
|
|
#define INITOK ((unsigned int)0xCAFEBABE)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//------------------------------------------//
|
|
|
|
// Keywords and attributes //
|
|
|
|
//------------------------------------------//
|
|
|
|
|
2019-01-01 20:46:06 +01:00
|
|
|
#ifndef alignof
|
|
|
|
#define alignof _Alignof
|
|
|
|
#endif
|
|
|
|
|
2019-01-01 13:09:57 +01:00
|
|
|
#ifndef PACKED
|
2019-01-01 17:11:30 +01:00
|
|
|
#define PACKED __attribute__((__packed__))
|
2019-01-01 13:09:57 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef noreturn
|
2019-01-01 17:11:30 +01:00
|
|
|
#define noreturn __attribute__((__noreturn__))
|
2019-01-01 13:09:57 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef likely
|
|
|
|
#define likely(x) (__builtin_expect((x), 1))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef unlikely(x)
|
|
|
|
#define unlikely(x) (__builtin_expect((x), 0))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//------------------------------------------//
|
|
|
|
// API specific macros //
|
|
|
|
//------------------------------------------//
|
|
|
|
|
|
|
|
#ifndef KALAPI
|
|
|
|
# define KALAPI
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//------------------------------------------//
|
2019-01-01 20:46:06 +01:00
|
|
|
// Values for status_t //
|
2019-01-01 13:09:57 +01:00
|
|
|
//------------------------------------------//
|
|
|
|
|
|
|
|
#define STATUS_FAILED(x) ((x) < 0))
|
|
|
|
#define STATUS_SUCCESS(x) (!STATUS_FAILED(x))
|
|
|
|
|
|
|
|
#define SUCCESS (0) // everything went fine
|
|
|
|
|
|
|
|
#define FAILED (-1)
|
|
|
|
#define ERROR FAILED // something went wrong
|
|
|
|
#define NOT_PERMITTED (-2)
|
|
|
|
#define ACCESS_DENIED (-3)
|
|
|
|
|
|
|
|
#define BAD_ARGUMENT (-4) // invalid arguments
|
|
|
|
#define BAD_ARG_RANGE (-5) // arguments out of range
|
|
|
|
#define BAD_ARG_NULL (-6) // unexpected NULL argument
|
|
|
|
|
|
|
|
#define TRY_AGAIN (-7) // EAGAIN
|
|
|
|
|
|
|
|
//------------------------------------------//
|
|
|
|
// End of <kaldefs.h> //
|
|
|
|
//------------------------------------------//
|
|
|
|
|
|
|
|
#endif
|