1 |
27 |
unneback |
#ifndef CYGONCE_LIBC_I18N_INTERNAL_H
|
2 |
|
|
#define CYGONCE_LIBC_I18N_INTERNAL_H
|
3 |
|
|
|
4 |
|
|
/*===========================================================================
|
5 |
|
|
//
|
6 |
|
|
// internal.h
|
7 |
|
|
//
|
8 |
|
|
// Internal header file to support the i18n locale functions.
|
9 |
|
|
//
|
10 |
|
|
//===========================================================================
|
11 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
12 |
|
|
// -------------------------------------------
|
13 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
14 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
15 |
|
|
//
|
16 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
17 |
|
|
// the terms of the GNU General Public License as published by the Free
|
18 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
21 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License along
|
26 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
30 |
|
|
// or inline functions from this file, or you compile this file and link it
|
31 |
|
|
// with other works to produce a work based on this file, this file does not
|
32 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
33 |
|
|
// License. However the source code for this file must still be made available
|
34 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
37 |
|
|
// this file might be covered by the GNU General Public License.
|
38 |
|
|
//
|
39 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
40 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
41 |
|
|
// -------------------------------------------
|
42 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
43 |
|
|
//===========================================================================
|
44 |
|
|
//#####DESCRIPTIONBEGIN####
|
45 |
|
|
//
|
46 |
|
|
// Author(s): jjohnstn
|
47 |
|
|
// Contributors:
|
48 |
|
|
// Date: 2000-11-16
|
49 |
|
|
// Purpose:
|
50 |
|
|
// Description:
|
51 |
|
|
// Usage: This file is used internally by i18n functions.
|
52 |
|
|
//
|
53 |
|
|
//####DESCRIPTIONEND####
|
54 |
|
|
//
|
55 |
|
|
//=========================================================================*/
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
/* escape character used for JIS encoding */
|
59 |
|
|
#define ESC_CHAR 0x1b
|
60 |
|
|
|
61 |
|
|
/* PROTOTYPES */
|
62 |
|
|
|
63 |
|
|
typedef int (*mbtowc_fn_type)(wchar_t *pwc, const char *s, size_t n, int *state);
|
64 |
|
|
typedef int (*wctomb_fn_type)(char *s, wchar_t wchar, int *state );
|
65 |
|
|
|
66 |
|
|
extern int __mbtowc_jp ( wchar_t *__pwc, const char *__s, size_t __n, int *__state );
|
67 |
|
|
extern int __mbtowc_c ( wchar_t *__pwc, const char *__s, size_t __n, int *__state );
|
68 |
|
|
extern int __wctomb_jp ( char *__s, wchar_t __wchar, int *__state );
|
69 |
|
|
|
70 |
|
|
/* MACROS used to support SHIFT_JIS, EUC-JP, and JIS multibyte encodings */
|
71 |
|
|
|
72 |
|
|
#define _issjis1(c) (((c) >= 0x81 && (c) <= 0x9f) || ((c) >= 0xe0 && (c) <= 0xef))
|
73 |
|
|
#define _issjis2(c) (((c) >= 0x40 && (c) <= 0x7e) || ((c) >= 0x80 && (c) <= 0xfc))
|
74 |
|
|
#define _iseucjp(c) ((c) >= 0xa1 && (c) <= 0xfe)
|
75 |
|
|
#define _isjis(c) ((c) >= 0x21 && (c) <= 0x7e)
|
76 |
|
|
|
77 |
|
|
// TYPE DEFINITIONS
|
78 |
|
|
|
79 |
|
|
// define a type to encapsulate the locale. In time this will get much
|
80 |
|
|
// richer and complete
|
81 |
|
|
|
82 |
|
|
typedef struct {
|
83 |
|
|
const char *name;
|
84 |
|
|
struct lconv numdata;
|
85 |
|
|
int mb_cur_max;
|
86 |
|
|
/* if next two fields are NULL, it implies the default "C" single-byte handling. */
|
87 |
|
|
mbtowc_fn_type mbtowc_fn;
|
88 |
|
|
wctomb_fn_type wctomb_fn;
|
89 |
|
|
} Cyg_libc_locale_t;
|
90 |
|
|
|
91 |
|
|
// ctype locale pointer shared between setlocale and mb routines
|
92 |
|
|
extern const Cyg_libc_locale_t *__current_ctype_locale;
|
93 |
|
|
|
94 |
|
|
#endif /* CYGONCE_LIBC_I18N_INTERNAL_H */
|
95 |
|
|
|