diff mbox

[Ada] Update Ada.Locales for RM 2012 COR:1:2016

Message ID 20170120103611.GA93272@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Jan. 20, 2017, 10:36 a.m. UTC
Tested on x86_64-pc-linux-gnu, committed on trunk

2017-01-20  Pascal Obry  <obry@adacore.com>

	* a-locale.adb, a-locale.ads: Update Ada.Locales for RM 2012 COR:1:2016
diff mbox

Patch

Index: a-locale.adb
===================================================================
--- a-locale.adb	(revision 244691)
+++ a-locale.adb	(working copy)
@@ -33,8 +33,7 @@ 
 
 package body Ada.Locales is
 
-   type Lower_4 is array (1 .. 4) of Character range 'a' .. 'z';
-   type Upper_4 is array (1 .. 4) of Character range 'A' .. 'Z';
+   type Str_4 is new String (1 .. 4);
 
    --------------
    -- Language --
@@ -43,7 +42,7 @@ 
    function Language return Language_Code is
       procedure C_Get_Language_Code (P : Address);
       pragma Import (C, C_Get_Language_Code);
-      F : Lower_4;
+      F : Str_4;
    begin
       C_Get_Language_Code (F'Address);
       return Language_Code (F (1 .. 3));
@@ -56,7 +55,7 @@ 
    function Country return Country_Code is
       procedure C_Get_Country_Code (P : Address);
       pragma Import (C, C_Get_Country_Code);
-      F : Upper_4;
+      F : Str_4;
    begin
       C_Get_Country_Code (F'Address);
       return Country_Code (F (1 .. 2));
Index: a-locale.ads
===================================================================
--- a-locale.ads	(revision 244691)
+++ a-locale.ads	(working copy)
@@ -19,9 +19,14 @@ 
    pragma Preelaborate (Locales);
    pragma Remote_Types (Locales);
 
-   type Language_Code is array (1 .. 3) of Character range 'a' .. 'z';
-   type Country_Code  is array (1 .. 2) of Character range 'A' .. 'Z';
+   type Language_Code is new String (1 .. 3)
+      with Dynamic_Predicate =>
+         (for all E of Language_Code => E in 'a' .. 'z');
 
+   type Country_Code is new String (1 .. 2)
+      with Dynamic_Predicate =>
+         (for all E of Country_Code => E in 'A' .. 'Z');
+
    Language_Unknown : constant Language_Code := "und";
    Country_Unknown  : constant Country_Code := "ZZ";