-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlanguage_utils.ads
More file actions
54 lines (48 loc) · 2.17 KB
/
Copy pathlanguage_utils.ads
File metadata and controls
54 lines (48 loc) · 2.17 KB
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
-- -----------------------------------------------------------------------------
-- Copyright (C) 2003-2019 Stichting Mapcode Foundation (http://www.mapcode.com)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-- -----------------------------------------------------------------------------
-- Utilities for handling languages
package Language_Utils is
-- The unicode sequence to provide a language name in its language
-- A Unicode number
subtype Unicode_Number is Natural range 0 .. 16#10FFFF#;
type Unicode_Sequence is array (Positive range <>) of Unicode_Number;
function To_Unicode (Str : String) return Unicode_Sequence;
-- A variable unicode sequence stored
Text_Max_Length : constant := 15;
subtype Text_Len is Natural range 0 .. Text_Max_Length;
type Text (Len : Text_Len := 0) is record
Txt : Unicode_Sequence (1 .. Len);
end record;
-- The descriptor of a language
-- Char set of a language
-- Array (A..Z, 0..9) of wide characters
subtype Char_Set is Wide_String (1 .. 36);
-- Array of codes for a language and construction of char set
subtype Char_Code_Range is Natural
range 0 .. Wide_Character'Pos (Wide_Character'Last);
type Char_Code is array (Char_Set'Range) of Char_Code_Range;
-- The descriptor
type Language_Desc (Len : Text_Len := 0) is record
-- The name of the language in it own language
Name : Text (Len);
-- The conversion characters in the language for A .. Z, 0 .. 9
Set : Char_Set;
-- First and last character of the set
First, Last : Wide_Character;
end record;
function Build_Desc (Name : Unicode_Sequence;
Code : Char_Code) return Language_Desc;
end Language_Utils;