types.ha (9666B)
1 // SPDX-License-Identifier: MPL-2.0 2 // (c) Hare authors <https://harelang.org> 3 4 use types; 5 6 // Integer type compatible with `signed char`, as specified by ISO/IEC 9899. 7 export type schar = i8; 8 9 // Minimum value which can be stored in an [[schar]] type. 10 export def SCHAR_MIN: schar = types::I8_MIN; 11 12 // Maximum value which can be stored in an [[schar]] type. 13 export def SCHAR_MAX: schar = types::I8_MAX; 14 15 // Integer type compatible with `unsigned char`, as specified by ISO/IEC 9899. 16 export type uchar = u8; 17 18 // Minimum value which can be stored in a [[uchar]] type. 19 export def UCHAR_MIN: uchar = types::U8_MIN; 20 21 // Maximum value which can be stored in a [[uchar]] type. 22 export def UCHAR_MAX: uchar = types::U8_MAX; 23 24 // Integer type compatible with `char8_t`, as defined in <uchar.h> and specified 25 // by ISO/IEC 9899:2023. 26 export type char8 = uchar; 27 28 // Minimum value which can be stored in a [[char8]] type. 29 export def CHAR8_MIN: char8 = UCHAR_MIN; 30 31 // Maximum value which can be stored in a [[char8]] type. 32 export def CHAR8_MAX: char8 = UCHAR_MAX; 33 34 // Integer type compatible with `char16_t`, as defined in <uchar.h> and 35 // specified by ISO/IEC 9899:2011. 36 export type char16 = uint_least16; 37 38 // Minimum value which can be stored in a [[char16]] type. 39 export def CHAR16_MIN: char16 = UINT_LEAST16_MIN; 40 41 // Maximum value which can be stored in a [[char16]] type. 42 export def CHAR16_MAX: char16 = UINT_LEAST16_MAX; 43 44 // Integer type compatible with `char32_t`, as defined in <uchar.h> and 45 // specified by ISO/IEC 9899:2011. 46 export type char32 = uint_least32; 47 48 // Minimum value which can be stored in a [[char32]] type. 49 export def CHAR32_MIN: char32 = UINT_LEAST32_MIN; 50 51 // Maximum value which can be stored in a [[char32]] type. 52 export def CHAR32_MAX: char32 = UINT_LEAST32_MAX; 53 54 // Integer type compatible with `intmax_t`, as defined in <stdint.h> and 55 // specified by ISO/IEC 9899:1999. 56 // 57 // Note that this type isn't necessarily the actual maximum integer type. This 58 // type should only be used when required for C interop. 59 export type intmax = i64; 60 61 // Minimum value which can be stored in an [[intmax]] type. 62 export def INTMAX_MIN: intmax = types::I64_MIN; 63 64 // Maximum value which can be stored in an [[intmax]] type. 65 export def INTMAX_MAX: intmax = types::I64_MAX; 66 67 // Integer type compatible with `uintmax_t`, as defined in <stdint.h> and 68 // specified by ISO/IEC 9899:1999. 69 // 70 // Note that this type isn't necessarily the actual maximum integer type. This 71 // type should only be used when required for C interop. 72 export type uintmax = u64; 73 74 // Minimum value which can be stored in a [[uintmax]] type. 75 export def UINTMAX_MIN: uintmax = types::U64_MIN; 76 77 // Maximum value which can be stored in a [[uintmax]] type. 78 export def UINTMAX_MAX: uintmax = types::U64_MAX; 79 80 // Integer type compatible with `int_least8_t`, as defined in <stdint.h> and 81 // specified by ISO/IEC 9899:1999. 82 export type int_least8 = i8; 83 84 // Minimum value which can be stored in an [[int_least8]] type. 85 export def INT_LEAST8_MIN: int_least8 = types::I8_MIN; 86 87 // Maximum value which can be stored in an [[int_least8]] type. 88 export def INT_LEAST8_MAX: int_least8 = types::I8_MAX; 89 90 // Integer type compatible with `int_least16_t`, as defined in <stdint.h> and 91 // specified by ISO/IEC 9899:1999. 92 export type int_least16 = i16; 93 94 // Minimum value which can be stored in an [[int_least16]] type. 95 export def INT_LEAST16_MIN: int_least16 = types::I16_MIN; 96 97 // Maximum value which can be stored in an [[int_least16]] type. 98 export def INT_LEAST16_MAX: int_least16 = types::I16_MAX; 99 100 // Integer type compatible with `int_least32_t`, as defined in <stdint.h> and 101 // specified by ISO/IEC 9899:1999. 102 export type int_least32 = i32; 103 104 // Minimum value which can be stored in an [[int_least32]] type. 105 export def INT_LEAST32_MIN: int_least32 = types::I32_MIN; 106 107 // Maximum value which can be stored in an [[int_least32]] type. 108 export def INT_LEAST32_MAX: int_least32 = types::I32_MAX; 109 110 // Integer type compatible with `int_least64_t`, as defined in <stdint.h> and 111 // specified by ISO/IEC 9899:1999. 112 export type int_least64 = i64; 113 114 // Minimum value which can be stored in an [[int_least64]] type. 115 export def INT_LEAST64_MIN: int_least64 = types::I64_MIN; 116 117 // Maximum value which can be stored in an [[int_least64]] type. 118 export def INT_LEAST64_MAX: int_least64 = types::I64_MAX; 119 120 // Integer type compatible with `uint_least8_t`, as defined in <stdint.h> and 121 // specified by ISO/IEC 9899:1999. 122 export type uint_least8 = u8; 123 124 // Minimum value which can be stored in a [[uint_least8]] type. 125 export def UINT_LEAST8_MIN: uint_least8 = types::U8_MIN; 126 127 // Maximum value which can be stored in a [[uint_least8]] type. 128 export def UINT_LEAST8_MAX: uint_least8 = types::U8_MAX; 129 130 // Integer type compatible with `uint_least16_t`, as defined in <stdint.h> and 131 // specified by ISO/IEC 9899:1999. 132 export type uint_least16 = u16; 133 134 // Minimum value which can be stored in a [[uint_least16]] type. 135 export def UINT_LEAST16_MIN: uint_least16 = types::U16_MIN; 136 137 // Maximum value which can be stored in a [[uint_least16]] type. 138 export def UINT_LEAST16_MAX: uint_least16 = types::U16_MAX; 139 140 // Integer type compatible with `uint_least32_t`, as defined in <stdint.h> and 141 // specified by ISO/IEC 9899:1999. 142 export type uint_least32 = u32; 143 144 // Minimum value which can be stored in a [[uint_least32]] type. 145 export def UINT_LEAST32_MIN: uint_least32 = types::U32_MIN; 146 147 // Maximum value which can be stored in a [[uint_least32]] type. 148 export def UINT_LEAST32_MAX: uint_least32 = types::U32_MAX; 149 150 // Integer type compatible with `uint_least64_t`, as defined in <stdint.h> and 151 // specified by ISO/IEC 9899:1999. 152 export type uint_least64 = u64; 153 154 // Minimum value which can be stored in a [[uint_least64]] type. 155 export def UINT_LEAST64_MIN: uint_least64 = types::U64_MIN; 156 157 // Maximum value which can be stored in a [[uint_least64]] type. 158 export def UINT_LEAST64_MAX: uint_least64 = types::U64_MAX; 159 160 // Integer type compatible with `int_fast8_t`, as defined in <stdint.h> and 161 // specified by ISO/IEC 9899:1999. 162 export type int_fast8 = i8; 163 164 // Minimum value which can be stored in an [[int_fast8]] type. 165 export def INT_FAST8_MIN: int_fast8 = types::I8_MIN; 166 167 // Maximum value which can be stored in an [[int_fast8]] type. 168 export def INT_FAST8_MAX: int_fast8 = types::I8_MAX; 169 170 // Integer type compatible with `int_fast16_t`, as defined in <stdint.h> and 171 // specified by ISO/IEC 9899:1999. 172 export type int_fast16 = i16; 173 174 // Minimum value which can be stored in an [[int_fast16]] type. 175 export def INT_FAST16_MIN: int_fast16 = types::I16_MIN; 176 177 // Maximum value which can be stored in an [[int_fast16]] type. 178 export def INT_FAST16_MAX: int_fast16 = types::I16_MAX; 179 180 // Integer type compatible with `int_fast32_t`, as defined in <stdint.h> and 181 // specified by ISO/IEC 9899:1999. 182 export type int_fast32 = i32; 183 184 // Minimum value which can be stored in an [[int_fast32]] type. 185 export def INT_FAST32_MIN: int_fast32 = types::I32_MIN; 186 187 // Maximum value which can be stored in an [[int_fast32]] type. 188 export def INT_FAST32_MAX: int_fast32 = types::I32_MAX; 189 190 // Integer type compatible with `int_fast64_t`, as defined in <stdint.h> and 191 // specified by ISO/IEC 9899:1999. 192 export type int_fast64 = i64; 193 194 // Minimum value which can be stored in an [[int_fast64]] type. 195 export def INT_FAST64_MIN: int_fast64 = types::I64_MIN; 196 197 // Maximum value which can be stored in an [[int_fast64]] type. 198 export def INT_FAST64_MAX: int_fast64 = types::I64_MAX; 199 200 // Integer type compatible with `uint_fast8_t`, as defined in <stdint.h> and 201 // specified by ISO/IEC 9899:1999. 202 export type uint_fast8 = u8; 203 204 // Minimum value which can be stored in a [[uint_fast8]] type. 205 export def UINT_FAST8_MIN: uint_fast8 = types::U8_MIN; 206 207 // Maximum value which can be stored in a [[uint_fast8]] type. 208 export def UINT_FAST8_MAX: uint_fast8 = types::U8_MAX; 209 210 // Integer type compatible with `uint_fast16_t`, as defined in <stdint.h> and 211 // specified by ISO/IEC 9899:1999. 212 export type uint_fast16 = u16; 213 214 // Minimum value which can be stored in a [[uint_fast16]] type. 215 export def UINT_FAST16_MIN: uint_fast16 = types::U16_MIN; 216 217 // Maximum value which can be stored in a [[uint_fast16]] type. 218 export def UINT_FAST16_MAX: uint_fast16 = types::U16_MAX; 219 220 // Integer type compatible with `uint_fast32_t`, as defined in <stdint.h> and 221 // specified by ISO/IEC 9899:1999. 222 export type uint_fast32 = u32; 223 224 // Minimum value which can be stored in a [[uint_fast32]] type. 225 export def UINT_FAST32_MIN: uint_fast32 = types::U32_MIN; 226 227 // Maximum value which can be stored in a [[uint_fast32]] type. 228 export def UINT_FAST32_MAX: uint_fast32 = types::U32_MAX; 229 230 // Integer type compatible with `uint_fast64_t`, as defined in <stdint.h> and 231 // specified by ISO/IEC 9899:1999. 232 export type uint_fast64 = u64; 233 234 // Minimum value which can be stored in a [[uint_fast64]] type. 235 export def UINT_FAST64_MIN: uint_fast64 = types::U64_MIN; 236 237 // Maximum value which can be stored in a [[uint_fast64]] type. 238 export def UINT_FAST64_MAX: uint_fast64 = types::U64_MAX; 239 240 // Integer type compatible with `wchar_t`, as defined in <stddef.h> and 241 // specified by ISO/IEC 9899. 242 export type wchar = i32; 243 244 // Minimum value which can be stored in a [[wchar]] type. 245 export def WCHAR_MIN: wchar = types::I32_MIN; 246 247 // Maximum value which can be stored in a [[wchar]] type. 248 export def WCHAR_MAX: wchar = types::I32_MAX; 249 250 // Integer type compatible with `wint_t`, as defined in <stdint.h> and specified 251 // by ISO/IEC 9899:1994. 252 export type wint = u32; 253 254 // Minimum value which can be stored in a [[wint]] type. 255 export def WINT_MIN: wint = types::U32_MIN; 256 257 // Maximum value which can be stored in a [[wint]] type. 258 export def WINT_MAX: wint = types::U32_MAX;