Do some #ifdef'ing to make the Player happy.
[kugel-rb.git] / firmware / include / rbunicode.h
blob39fe253f3dc20109ed2df41f81847c116456783e
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 #ifndef __PCTOOL__
32 #include "config.h"
33 #endif
35 #define MASK 0xC0 /* 11000000 */
36 #define COMP 0x80 /* 10x */
38 #ifdef HAVE_LCD_BITMAP
40 enum 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
46 #else /* !HAVE_LCD_BITMAP, reduced support */
48 enum codepages {
49 ISO_8859_1 = 0, ISO_8859_7, WIN_1251, ISO_8859_9,
50 ISO_8859_2, WIN_1250, UTF_8, NUM_CODEPAGES
53 #endif
55 /* Encode a UCS value as UTF-8 and return a pointer after this UTF-8 char. */
56 unsigned char* utf8encode(unsigned long ucs, unsigned char *utf8);
57 unsigned char* iso_decode(const unsigned char *latin1, unsigned char *utf8, int cp, int count);
58 unsigned char* utf16LEdecode(const unsigned char *utf16, unsigned char *utf8, int count);
59 unsigned char* utf16BEdecode(const unsigned char *utf16, unsigned char *utf8, int count);
60 unsigned long utf8length(const unsigned char *utf8);
61 const unsigned char* utf8decode(const unsigned char *utf8, unsigned short *ucs);
62 void set_codepage(int cp);
63 int utf8seek(const unsigned char* utf8, int offset);
64 const char* get_codepage_name(int cp);
65 #endif /* _RBUNICODE_H_ */