summaryrefslogtreecommitdiff
path: root/zap/include/zap/bs.h
blob: 3d31a345a386252f0e2352237eb75bc35d86ffb4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
	Copyright 2022-2023 Gabriel Jensen.
	This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
	If a copy of the MPL was not distributed with this file, You can obtain one at <https://mozilla.org/MPL/2.0>.
*/

#if !defined(zap_priv_hdr_bs)
#define zap_priv_hdr_bs

#include <csys.h>

#if defined(__cplusplus)
#define zap_priv_cdecl    extern "C" {
#define zap_priv_cdeclend }
#else
#define zap_priv_cdecl
#define zap_priv_cdeclend
#endif

#if defined(__GNUC__)
#define zap_priv_noret __attribute__ ((noreturn))
#elif __STDC_VERSION__ == 202311 || __cplusplus == 201103
#define zap_priv_noret [[noreturn]]
#elif __STDC_VERSION__ == 199901
#define zap_priv_noret _Noreturn
#else
#define zap_priv_noret
#endif

#if defined(__GNUC__)
#define zap_priv_nothrw __attribute__ ((nothrow))
#else
#define zap_priv_nothrw
#endif

#if defined(__GNUC__)
#define zap_priv_restr __restrict
#elif __STDC_VERSION__ == 199901
#define zap_priv_restr restrict
#else
#define zap_priv_restr
#endif

#if defined(__GNUC__)
#define zap_priv_unseq __attribute__ ((const))
#elif __STDC_VERSION__ == 202311
#define zap_priv_unseq [[unsequenced]]
#else
#define zap_priv_unseq
#endif

zap_priv_cdecl

#define zap_ver ((unsigned long)+0x16u)

#define zap_bytesz ((zap_sz)+0x8u)

#define zap_false ((zap_bool)+0x0u)
#define zap_true  ((zap_bool)-0x1)

#define zap_nopos ((zap_sz)-0x1)

#define zap_nullptr ((void *)0x0u)

typedef unsigned char      zap_i8;
typedef unsigned short     zap_i01;
typedef unsigned int       zap_i02;
#if \
	csys_arch_arm  \
	|| csys_arch_ia32 \
	|| (csys_os_win && csys_arch_amd64)
typedef unsigned long long zap_i04;
#else
typedef unsigned long      zap_i04;
#endif

typedef signed char zap_i8s;
typedef short       zap_i01s;
typedef int         zap_i02s;
typedef long        zap_i04s;

typedef zap_i8  zap_chr8;
typedef zap_i01 zap_chr01;
typedef zap_i02 zap_chr02;

typedef zap_i8  zap_bool;

#if \
	csys_arch_arm \
	|| csys_arch_ia32
typedef zap_i8  zap_byte;
typedef zap_i02 zap_ptr;
typedef zap_i02 zap_sz;
#else
typedef zap_i8  zap_byte;
typedef zap_i04 zap_ptr;
typedef zap_i04 zap_sz;
#endif

zap_priv_noret void zap_priv_trap(void);

zap_priv_cdeclend

#endif