Ada
4.1.1
Fast spec-compliant URL parser
Toggle main menu visibility
Loading...
Searching...
No Matches
mapping_tables.cpp
Go to the documentation of this file.
1
// IDNA 18.0.0
2
// Two-level compressed mapping table (constants only).
3
// Array payloads are stored in the DEFLATE blob (see table_store.hpp /
4
// scripts/pack_tables.py).
5
// Regenerate with: python3 scripts/idna_table.py --write
6
// Logical table size: 51037 bytes (49.8 KB)
7
// stage1: 8162 bytes (4081 uint16_t entries)
8
// stage2: 23424 bytes (183 mixed blocks x 64)
9
// bool_blocks: 1800 bytes (225 uint64_t words)
10
// utf8 maps: 17651 bytes
11
12
// clang-format off
13
#ifndef ADA_IDNA_MAPPING_TABLE_H
14
#define ADA_IDNA_MAPPING_TABLE_H
15
#include <cstdint>
16
17
namespace
ada::idna
{
18
19
// Block size for two-level table (2^6 = 64 code points per block).
20
constexpr
uint32_t
IDNA_BLOCK_BITS
= 6u;
21
constexpr
uint32_t
IDNA_BLOCK_SIZE
= 64u;
22
constexpr
uint32_t
IDNA_BLOCK_MASK
= 63u;
23
24
// Sentinel values stored in stage2 / returned by lookup.
25
constexpr
uint16_t
IDNA_VALID
= 0xFFFF;
// code point is valid as-is
26
constexpr
uint16_t
IDNA_DISALLOWED
= 0xFFFE;
// code point is disallowed
27
constexpr
uint16_t
IDNA_IGNORED
= 0x0000;
// ignored (index into empty UTF-8 entry)
28
29
// Bit 15 of a stage1 entry: set = boolean block, clear = mixed block.
30
constexpr
uint16_t
IDNA_BOOL_FLAG
= 0x8000;
31
32
// Two-level table covers code points [0, IDNA_LOW_RANGE_END).
33
// Derived from the highest non-disallowed code point below the high-ignored range,
34
// rounded up to the next 64-code-point block boundary.
35
constexpr
uint32_t
IDNA_LOW_RANGE_END
= 0x0003FC40;
36
37
// Variation selectors supplement: U+E0100..U+E01EF are all ignored.
38
// These are handled with a simple range check; everything else above
39
// IDNA_LOW_RANGE_END is disallowed.
40
constexpr
uint32_t
IDNA_HIGH_IGNORED_START
= 0x000E0100;
41
constexpr
uint32_t
IDNA_HIGH_IGNORED_END
= 0x000E01F0;
// exclusive
42
43
// Large arrays (idna_stage1/stage2/bool_blocks/utf8_mappings) live in table_blob.
44
45
}
// namespace ada::idna
46
#endif
// ADA_IDNA_MAPPING_TABLE_H
ada::idna
Definition
identifier.h:7
ada::idna::IDNA_BLOCK_MASK
constexpr uint32_t IDNA_BLOCK_MASK
Definition
ada_idna.cpp:5120
ada::idna::IDNA_BOOL_FLAG
constexpr uint16_t IDNA_BOOL_FLAG
Definition
ada_idna.cpp:5128
ada::idna::IDNA_BLOCK_BITS
constexpr uint32_t IDNA_BLOCK_BITS
Definition
ada_idna.cpp:5118
ada::idna::IDNA_BLOCK_SIZE
constexpr uint32_t IDNA_BLOCK_SIZE
Definition
ada_idna.cpp:5119
ada::idna::IDNA_VALID
constexpr uint16_t IDNA_VALID
Definition
ada_idna.cpp:5123
ada::idna::IDNA_HIGH_IGNORED_START
constexpr uint32_t IDNA_HIGH_IGNORED_START
Definition
ada_idna.cpp:5138
ada::idna::IDNA_LOW_RANGE_END
constexpr uint32_t IDNA_LOW_RANGE_END
Definition
ada_idna.cpp:5133
ada::idna::IDNA_IGNORED
constexpr uint16_t IDNA_IGNORED
Definition
ada_idna.cpp:5125
ada::idna::IDNA_HIGH_IGNORED_END
constexpr uint32_t IDNA_HIGH_IGNORED_END
Definition
ada_idna.cpp:5139
ada::idna::IDNA_DISALLOWED
constexpr uint16_t IDNA_DISALLOWED
Definition
ada_idna.cpp:5124