Banjo API 0.0.1
Multi-purpose C99 API
Loading...
Searching...
No Matches
api.h
Go to the documentation of this file.
1
4
10#pragma once
11
12#include <stddef.h>
13#include <stdint.h>
14
16#define BJ_VERSION_MAJOR(version) (((version) >> 22U) & 0x3FFU)
17
19#define BJ_VERSION_MINOR(version) (((version) >> 12U) & 0x3FFU)
20
22#define BJ_VERSION_PATCH(version) ((version) & 0xFFFU)
23
29#define BJ_MAKE_VERSION(major, minor, patch) \
30 ((((uint32_t)(major)) << 22U) | (((uint32_t)(minor)) << 12U) | ((uint32_t)(patch)))
31
32#define BJ_VERSION_MAJOR_NUMBER 0
33#define BJ_VERSION_MINOR_NUMBER 1
34#define BJ_VERSION_PATCH_NUMBER 0
35
37#define BJ_VERSION BJ_MAKE_VERSION(BJ_VERSION_MAJOR_NUMBER, BJ_VERSION_MINOR_NUMBER, BJ_VERSION_PATCH_NUMBER)
38
40#define BJ_NAME "Banjo"
41
43#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
44# define BJ_OS_WINDOWS
45#elif defined(__linux__) || defined(__gnu_linux__)
46# define BJ_OS_LINUX
47#elif __APPLE__
48# define BJ_OS_APPLE
49# include <TargetConditionals.h>
50# if TARGET_OS_IPHONE
51# define BJ_OS_IOS
52# elif TARGET_IPHONE_SIMULATOR
53# define BJ_OS_IOS
54# define BJ_OS_IOS_SIMULATOR
55# elif TARGET_OS_MAC
56# define BJ_OS_MACOS
57# define BJ_OS_UNIX
58# else
59# define BJ_OS_APPLE_UNKNOWN
60# endif
61#else
62# define BJ_OS_UNKNOWN
63#endif
64
65#if defined(__unix__)
66# define BJ_OS_UNIX
67#endif
68
69// Compiler Detection
70#if defined(__GNUC__) && !defined(__clang__)
71 #define BJ_COMPILER_GCC
72 #define BJ_COMPILER_NAME "GCC"
73 #define BJ_COMPILER_VERSION __GNUC__
74#elif defined(__clang__)
75 #define BJ_COMPILER_CLANG
76 #define BJ_COMPILER_NAME "Clang"
77 #define BJ_COMPILER_VERSION __clang_major__
78#elif defined(_MSC_VER)
79 #define BJ_COMPILER_MSVC
80 #define BJ_COMPILER_NAME "MSVC"
81 #define BJ_COMPILER_VERSION _MSC_VER
82#elif defined(__MINGW32__)
83 #define BJ_COMPILER_MINGW
84 #define BJ_COMPILER_NAME "MinGW"
85 #define BJ_COMPILER_VERSION 0
86#else
87 #define BJ_COMPILER_UNKNOWN
88 #define BJ_COMPILER_NAME "Unknown"
89 #define BJ_COMPILER_VERSION 0
90#endif
91
92#ifdef NDEBUG
93# define BJ_BUILD_RELEASE
94#else
95# define BJ_BUILD_DEBUG
96#endif
97
98#ifdef BANJO_STATIC
99# define BANJO_EXPORT
100# define BANJO_NO_EXPORT
101#else
102# ifdef _MSC_VER
103# ifndef BANJO_EXPORT
104# ifdef BANJO_EXPORTS
105# define BANJO_EXPORT __declspec(dllexport)
106# else
107# define BANJO_EXPORT __declspec( dllexport )
108# endif
109# endif
110# ifndef BANJO_NO_EXPORT
111# define BANJO_NO_EXPORT
112# endif
113# else
114# ifndef BANJO_EXPORT
115# ifdef BANJO_EXPORTS
116# define BANJO_EXPORT __attribute__((visibility("default")))
117# else
118# define BANJO_EXPORT __attribute__((visibility("default")))
119# endif
120# endif
121# ifndef BANJO_NO_EXPORT
122# define BANJO_NO_EXPORT __attribute__((visibility("hidden")))
123# endif
124# endif
125#endif
126
127typedef uint32_t bj_bool;
128
129#define BJ_FALSE ((bj_bool)0)
130#define BJ_TRUE ((bj_bool)1)
131
133typedef struct {
134 const char* p_name;
135 uint32_t version;
136 const char* compiler_name;
138 bj_bool debug;
140 bj_bool feature_x11;
141 bj_bool feature_mme;
142 bj_bool feature_alsa;
148
157BANJO_EXPORT const bj_build_info* bj_get_build_info(void);
158
uint32_t version
Built version (BJ_VERSION)
Definition api.h:135
bj_bool feature_win32
Compiled with support for Win32 windows.
Definition api.h:139
bj_bool feature_x11
Compiled with support for Win32 windows.
Definition api.h:140
const char * compiler_name
Compiler C-String name.
Definition api.h:136
const char * p_name
API Name (BJ_NAME)
Definition api.h:134
bj_bool debug
Built with debug information.
Definition api.h:138
bj_bool config_checks_abort
When checks feature is on, a failed check will abort execution.
Definition api.h:143
bj_bool config_pedantic
Banjo runtime will make costly extra checks.
Definition api.h:146
bj_bool feature_mme
Compiled with support for Windows Multimedia Extension (for audio).
Definition api.h:141
int compiler_version
Compiler version specifier.
Definition api.h:137
bj_bool feature_alsa
Compiled with support for ALSA (for audio).
Definition api.h:142
bj_bool config_checks_log
If checks feature is on, failed check with log.
Definition api.h:144
bj_bool config_log_color
Banjo logs will have colored output.
Definition api.h:145
const bj_build_info * bj_get_build_info(void)
Returns the build information of the runtime Banjo binaries.
Structure holding build information of the binary.
Definition api.h:133