PP502x USB: It seems r29087 introduced additional parasitic current consumption after...
[kugel-rb.git] / firmware / include / rbunicode.h
bloba97ebb469b8864a22a365b0a10dbe0819386ce23
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (c) 2004,2005 by Marcoen Hirschberg
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 /* Some conversion functions for handling UTF-8
23 * I got all the info from:
24 * http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
25 * and
26 * http://en.wikipedia.org/wiki/Unicode
28 #ifndef _RBUNICODE_H_
29 #define _RBUNICODE_H_
31 #include "config.h"
33 #define MASK 0xC0 /* 11000000 */
34 #define COMP 0x80 /* 10x */
36 #ifdef HAVE_LCD_BITMAP
38 enum codepages {
39 ISO_8859_1 = 0, /* Latin1 */
40 ISO_8859_7, /* Greek */
41 ISO_8859_8, /* Hebrew */
42 WIN_1251, /* Cyrillic */
43 ISO_8859_11, /* Thai */
44 WIN_1256, /* Arabic */
45 ISO_8859_9, /* Turkish */
46 ISO_8859_2, /* Latin Extended */
47 WIN_1250, /* Central European */
48 SJIS, /* Japanese */
49 GB_2312, /* Simp. Chinese */
50 KSX_1001, /* Korean */
51 BIG_5, /* Trad. Chinese */
52 UTF_8, /* Unicode */
53 NUM_CODEPAGES
56 #else /* !HAVE_LCD_BITMAP, reduced support */
58 enum codepages {
59 ISO_8859_1 = 0, /* Latin1 */
60 ISO_8859_7, /* Greek */
61 WIN_1251, /* Cyrillic */
62 ISO_8859_9, /* Turkish */
63 ISO_8859_2, /* Latin Extended */
64 WIN_1250, /* Central European */
65 UTF_8, /* Unicode */
66 NUM_CODEPAGES
69 #endif
71 /* Encode a UCS value as UTF-8 and return a pointer after this UTF-8 char. */
72 unsigned char* utf8encode(unsigned long ucs, unsigned char *utf8);
73 unsigned char* iso_decode(const unsigned char *latin1, unsigned char *utf8, int cp, int count);
74 unsigned char* utf16LEdecode(const unsigned char *utf16, unsigned char *utf8, int count);
75 unsigned char* utf16BEdecode(const unsigned char *utf16, unsigned char *utf8, int count);
76 unsigned long utf8length(const unsigned char *utf8);
77 const unsigned char* utf8decode(const unsigned char *utf8, unsigned short *ucs);
78 void set_codepage(int cp);
79 int utf8seek(const unsigned char* utf8, int offset);
80 const char* get_codepage_name(int cp);
81 #endif /* _RBUNICODE_H_ */