summaryrefslogtreecommitdiff
path: root/firmware/include/rbunicode.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include/rbunicode.h')
-rw-r--r--firmware/include/rbunicode.h46
1 files changed, 44 insertions, 2 deletions
diff --git a/firmware/include/rbunicode.h b/firmware/include/rbunicode.h
index 6e61905685..39fe253f3d 100644
--- a/firmware/include/rbunicode.h
+++ b/firmware/include/rbunicode.h
@@ -1,16 +1,56 @@
1/* Some conversion functions for handling UTF-8 1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (c) 2004,2005 by Marcoen Hirschberg
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
2 * 19 *
3 * copyright Marcoen Hirschberg (2004,2005) 20 ****************************************************************************/
21/* Some conversion functions for handling UTF-8
4 * 22 *
5 * I got all the info from: 23 * I got all the info from:
6 * http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 24 * http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
7 * and 25 * and
8 * http://en.wikipedia.org/wiki/Unicode 26 * http://en.wikipedia.org/wiki/Unicode
9 */ 27 */
28#ifndef _RBUNICODE_H_
29#define _RBUNICODE_H_
30
31#ifndef __PCTOOL__
32#include "config.h"
33#endif
10 34
11#define MASK 0xC0 /* 11000000 */ 35#define MASK 0xC0 /* 11000000 */
12#define COMP 0x80 /* 10x */ 36#define COMP 0x80 /* 10x */
13 37
38#ifdef HAVE_LCD_BITMAP
39
40enum codepages {
41 ISO_8859_1 = 0, ISO_8859_7, ISO_8859_8, WIN_1251,
42 ISO_8859_11, WIN_1256, ISO_8859_9, ISO_8859_2, WIN_1250,
43 SJIS, GB_2312, KSX_1001, BIG_5, UTF_8, NUM_CODEPAGES
44};
45
46#else /* !HAVE_LCD_BITMAP, reduced support */
47
48enum codepages {
49 ISO_8859_1 = 0, ISO_8859_7, WIN_1251, ISO_8859_9,
50 ISO_8859_2, WIN_1250, UTF_8, NUM_CODEPAGES
51};
52
53#endif
14 54
15/* Encode a UCS value as UTF-8 and return a pointer after this UTF-8 char. */ 55/* Encode a UCS value as UTF-8 and return a pointer after this UTF-8 char. */
16unsigned char* utf8encode(unsigned long ucs, unsigned char *utf8); 56unsigned char* utf8encode(unsigned long ucs, unsigned char *utf8);
@@ -21,3 +61,5 @@ unsigned long utf8length(const unsigned char *utf8);
21const unsigned char* utf8decode(const unsigned char *utf8, unsigned short *ucs); 61const unsigned char* utf8decode(const unsigned char *utf8, unsigned short *ucs);
22void set_codepage(int cp); 62void set_codepage(int cp);
23int utf8seek(const unsigned char* utf8, int offset); 63int utf8seek(const unsigned char* utf8, int offset);
64const char* get_codepage_name(int cp);
65#endif /* _RBUNICODE_H_ */