vss_24.0.0_b4d0be7c/tools/gen_ucd/gen_ucd-driver.adb

 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
--
--  Copyright (C) 2021, AdaCore
--
--  SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
--

with Ada.Command_Line;      use Ada.Command_Line;
with Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
use  Ada.Strings.UTF_Encoding.Wide_Wide_Strings;
with Ada.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO;

with UCD.Case_Folding_Loader;
with UCD.Characters;
with UCD.Derived_Core_Properties_Loader;
with UCD.Derived_Normalization_Props_Loader;
with UCD.Emoji_Data_Loader;
with UCD.Grapheme_Break_Property_Loader;
with UCD.Hangul_Syllable_Type_Loader;
with UCD.Prop_List_Loader;
with UCD.Property_Aliases_Loader;
with UCD.Property_Value_Aliases_Loader;
with UCD.Special_Casing_Loader;
with UCD.Unicode_Data_Loader;
with UCD.Word_Break_Property_Loader;

with Gen_UCD.Casing;
with Gen_UCD.Core_Properties;
with Gen_UCD.Normalization;

procedure Gen_UCD.Driver is
begin
   if Ada.Command_Line.Argument_Count /= 2 then
      raise Program_Error;
   end if;

   declare
      UCD_Root : constant Wide_Wide_String := Decode (Argument (1));

   begin
      UCD.Property_Aliases_Loader.Load (UCD_Root);
      UCD.Property_Value_Aliases_Loader.Load (UCD_Root);

      UCD.Characters.Initialize_Character_Database;

      UCD.Unicode_Data_Loader.Load (UCD_Root);
      UCD.Prop_List_Loader.Load (UCD_Root);
      UCD.Derived_Core_Properties_Loader.Load (UCD_Root);
      UCD.Grapheme_Break_Property_Loader.Load (UCD_Root);
      UCD.Word_Break_Property_Loader.Load (UCD_Root);
      UCD.Derived_Normalization_Props_Loader.Load (UCD_Root);
      UCD.Hangul_Syllable_Type_Loader.Load (UCD_Root);
      UCD.Special_Casing_Loader.Load (UCD_Root);
      UCD.Case_Folding_Loader.Load (UCD_Root);
      UCD.Emoji_Data_Loader.Load (UCD_Root);
   end;

   Put_Line ("Processing...");
   Gen_UCD.Core_Properties.Build;
   Gen_UCD.Casing.Build;
   Gen_UCD.Normalization.Build;

   declare
      Ada_File : File_Type;

   begin
      Put_Line ("Generating...");

      Create (Ada_File, Out_File, Argument (2));

      Gen_UCD.Core_Properties.Generate (Ada_File);
      Gen_UCD.Casing.Generate (Ada_File);
      Gen_UCD.Normalization.Generate (Ada_File);

      Close (Ada_File);
   end;
end Gen_UCD.Driver;