Debian Codegraph @

Headers/SheenBidi/SBBase.h

raw ◀ ▶
Source reconstructed at patch state 0 of 1 — not the installed (fully patched) source.
1 Debian patch touch this file
1 /*
2 * Copyright (C) 2014-2026 Muhammad Tayyab Akram
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #ifndef _SB_PUBLIC_BASE_H
18 #define _SB_PUBLIC_BASE_H
19
20 #include <stdint.h>
21
22 #ifdef __cplusplus
23 #define SB_EXTERN_C_BEGIN extern "C" {
24 #define SB_EXTERN_C_END }
25 #else
26 #define SB_EXTERN_C_BEGIN
27 #define SB_EXTERN_C_END
28 #endif
29
30 #ifdef _WIN32
31
32 #if defined(SB_CONFIG_DLL_EXPORT)
33 #define SB_PUBLIC __declspec(dllexport)
34 #elif defined(SB_CONFIG_DLL_IMPORT)
35 #define SB_PUBLIC __declspec(dllimport)
36 #endif
37
38 #endif
39
40 #ifndef SB_PUBLIC
41 #define SB_PUBLIC
42 #endif
43
44 #if defined(SB_CONFIG_EXPERIMENTAL_TEXT_API)
45 #define SB_TEXT_API_SUPPORTED 1
46 #else
47 #define SB_TEXT_API_SUPPORTED 0
48 #endif
49
50 #if defined(__cplusplus) && __cplusplus >= 201402L
51 #define SB_DEPRECATED [[deprecated]]
52 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
53 #define SB_DEPRECATED [[deprecated]]
54 #elif defined(__clang__) || defined(__GNUC__)
55 #define SB_DEPRECATED __attribute__((deprecated))
56 #elif defined(_MSC_VER)
57 #define SB_DEPRECATED __declspec(deprecated)
58 #else
59 #define SB_DEPRECATED
60 #endif
61
62 SB_EXTERN_C_BEGIN
63
64 /**
65 * A type to represent an 8-bit signed integer.
66 */
67 typedef int8_t SBInt8;
68
69 /**
70 * A type to represent a 16-bit signed integer.
71 */
72 typedef int16_t SBInt16;
73
74 /**
75 * A type to represent a 32-bit signed integer.
76 */
77 typedef int32_t SBInt32;
78
79 /**
80 * A type to represent an 8-bit unsigned integer.
81 */
82 typedef uint8_t SBUInt8;
83
84 /**
85 * A type to represent a 16-bit unsigned integer.
86 */
87 typedef uint16_t SBUInt16;
88
89 /**
90 * A type to represent a 32-bit unsigned integer.
91 */
92 typedef uint32_t SBUInt32;
93
94 /**
95 * A signed integer type whose width is equal to the width of the machine word.
96 */
97 typedef intptr_t SBInteger;
98
99 /**
100 * An unsigned integer type whose width is equal to the width of the machine word.
101 */
102 typedef uintptr_t SBUInteger;
103
104 /**
105 * Constants that specify the states of a boolean.
106 */
107 enum {
108 SBFalse = 0, /**< A value representing the false state. */
109 SBTrue = 1 /**< A value representing the true state. */
110 };
111 /**
112 * A type to represent a boolean value.
113 */
114 typedef SBUInt8 SBBoolean;
115
116 #define SBUInt8InRange(v, s, e) \
117 ( \
118 (SBUInt8)((v) - (s)) \
119 <= (SBUInt8)((e) - (s)) \
120 )
121
122 #define SBUInt16InRange(v, s, e) \
123 ( \
124 (SBUInt16)((v) - (s)) \
125 <= (SBUInt16)((e) - (s)) \
126 )
127
128 #define SBUInt32InRange(v, s, e) \
129 ( \
130 (SBUInt32)((v) - (s)) \
131 <= (SBUInt32)((e) - (s)) \
132 )
133
134
135 /**
136 * A type to represent a bidi level.
137 */
138 typedef SBUInt8 SBLevel;
139
140 /**
141 * A value representing an invalid bidi level.
142 */
143 #define SBLevelInvalid 0xFF
144
145 /**
146 * A value representing maximum explicit embedding level.
147 */
148 #define SBLevelMax 125
149
150 /**
151 * A value specifying to set base level to zero (left-to-right) if there is no strong character.
152 */
153 #define SBLevelDefaultLTR 0xFE
154
155 /**
156 * A value specifying to set base level to one (right-to-left) if there is no strong character.
157 */
158 #define SBLevelDefaultRTL 0xFD
159
160 SB_EXTERN_C_END
161
162 #endif