OSDN Git Service

ba649e2b08b2a2048de76dac4f0f24b3a42b5954
[pf3gnuchains/gcc-fork.git] / gcc / ada / locales.c
1 /****************************************************************************
2  *                                                                          *
3  *                         GNAT COMPILER COMPONENTS                         *
4  *                                                                          *
5  *                             L O C A L E S                                *
6  *                                                                          *
7  *                          C Implementation File                           *
8  *                                                                          *
9  *             Copyright (C) 2010, Free Software Foundation, Inc.           *
10  *                                                                          *
11  * GNAT is free software;  you can  redistribute it  and/or modify it under *
12  * terms of the  GNU General Public License as published  by the Free Soft- *
13  * ware  Foundation;  either version 3,  or (at your option) any later ver- *
14  * sion.  GNAT is distributed in the hope that it will be useful, but WITH- *
15  * OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY *
16  * or FITNESS FOR A PARTICULAR PURPOSE.                                     *
17  *                                                                          *
18  * As a special exception under Section 7 of GPL version 3, you are granted *
19  * additional permissions described in the GCC Runtime Library Exception,   *
20  * version 3.1, as published by the Free Software Foundation.               *
21  *                                                                          *
22  * You should have received a copy of the GNU General Public License and    *
23  * a copy of the GCC Runtime Library Exception along with this program;     *
24  * see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    *
25  * <http://www.gnu.org/licenses/>.                                          *
26  *                                                                          *
27  * GNAT was originally developed  by the GNAT team at  New York University. *
28  * Extensive contributions were provided by Ada Core Technologies Inc.      *
29  *                                                                          *
30  ****************************************************************************/
31
32 /*  This file provides OS-dependent support for the Ada.Locales package.    */
33
34 typedef char char4 [4];
35
36 /*
37   c_get_language_code needs to fill in the Alpha-3 encoding of the
38   language code (3 lowercase letters). That shoud be "und" if the
39   language is unknown. [see Ada.Locales]
40 */
41 void c_get_language_code (char4 p) {
42   char *r = "und";
43   for (; *r != '\0'; p++, r++)
44     *p = *r;
45 }
46
47 /*
48   c_get_country_code needs to fill in the Alpha-2 encoding of the
49   country code (2 uppercase letters). That shoud be "ZZ" if the
50   country is unknown. [see Ada.Locales]
51 */
52 void c_get_country_code (char4 p) {
53   char *r = "ZZ";
54   for (; *r != '\0'; p++, r++)
55     *p = *r;
56 }