move some code from .h files to .c files and polish unicode.c a bit

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8174 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Marcoen Hirschberg 2005-12-06 15:04:48 +00:00
parent d622e64165
commit f9752c408d
8 changed files with 258 additions and 257 deletions

View file

@ -48,6 +48,7 @@ drivers/lcd-player-charset.c
drivers/lcd-player.c drivers/lcd-player.c
#endif #endif
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
arabjoin.c
bidi.c bidi.c
#if LCD_DEPTH == 2 #if LCD_DEPTH == 2
drivers/lcd-h100.c drivers/lcd-h100.c

199
firmware/arabjoin.c Normal file
View file

@ -0,0 +1,199 @@
#include "arabjoin.h"
const arab_t zwj = {0x20,0x20,0x20,0x20}; //zero-width joiner
const arab_t lamaleph[] = {
{0xfefb,0xfefc,0,0},
{0xfef9,0xfefa,0,0},
{0xfef7,0xfef8,0,0},
{0xfef5,0xfef6,0,0}
};
const arab_t jointable[] = {
{0xfe80,0x0000,0x0000,0x0000}, // 0x0621
{0xfe81,0xfe82,0x0000,0x0000}, // 0x0622
{0xfe83,0xfe84,0x0000,0x0000}, // 0x0623
{0xfe85,0xfe86,0x0000,0x0000}, // 0x0624
{0xfe87,0xfe88,0x0000,0x0000}, // 0x0625
{0xfe89,0xfe8a,0xfe8c,0xfe8b}, // 0x0626
{0xfe8d,0xfe8e,0x0000,0x0000}, // 0x0627
{0xfe8f,0xfe90,0xfe92,0xfe91}, // 0x0628
{0xfe93,0xfe94,0x0000,0x0000}, // 0x0629
{0xfe95,0xfe96,0xfe98,0xfe97}, // 0x062a
{0xfe99,0xfe9a,0xfe9c,0xfe9b}, // 0x062b
{0xfe9d,0xfe9e,0xfea0,0xfe9f}, // 0x062c
{0xfea1,0xfea2,0xfea4,0xfea3}, // 0x062d
{0xfea5,0xfea6,0xfea8,0xfea7}, // 0x062e
{0xfea9,0xfeaa,0x0000,0x0000}, // 0x062f
{0xfeab,0xfeac,0x0000,0x0000}, // 0x0630
{0xfead,0xfeae,0x0000,0x0000}, // 0x0631
{0xfeaf,0xfeb0,0x0000,0x0000}, // 0x0632
{0xfeb1,0xfeb2,0xfeb4,0xfeb3}, // 0x0633
{0xfeb5,0xfeb6,0xfeb8,0xfeb7}, // 0x0634
{0xfeb9,0xfeba,0xfebc,0xfebb}, // 0x0635
{0xfebd,0xfebe,0xfec0,0xfebf}, // 0x0636
{0xfec1,0xfec2,0xfec4,0xfec3}, // 0x0637
{0xfec5,0xfec6,0xfec8,0xfec7}, // 0x0638
{0xfec9,0xfeca,0xfecc,0xfecb}, // 0x0639
{0xfecd,0xfece,0xfed0,0xfecf}, // 0x063a
#if 0
{0x0000,0x0000,0x0000,0x0000}, // 0x063b
{0x0000,0x0000,0x0000,0x0000}, // 0x063c
{0x0000,0x0000,0x0000,0x0000}, // 0x063d
{0x0000,0x0000,0x0000,0x0000}, // 0x063e
{0x0000,0x0000,0x0000,0x0000}, // 0x063f
#endif
{0x0640,0x0640,0x0640,0x0640}, // 0x0640
{0xfed1,0xfed2,0xfed4,0xfed3}, // 0x0641
{0xfed5,0xfed6,0xfed8,0xfed7}, // 0x0642
{0xfed9,0xfeda,0xfedc,0xfedb}, // 0x0643
{0xfedd,0xfede,0xfee0,0xfedf}, // 0x0644
{0xfee1,0xfee2,0xfee4,0xfee3}, // 0x0645
{0xfee5,0xfee6,0xfee8,0xfee7}, // 0x0646
{0xfee9,0xfeea,0xfeec,0xfeeb}, // 0x0647
{0xfeed,0xfeee,0x0000,0x0000}, // 0x0648
{0xfeef,0xfef0,0x0000,0x0000}, // 0x0649
{0xfef1,0xfef2,0xfef4,0xfef3}, // 0x064a
# if 0
{0x0000,0x0000,0x0000,0x0000}, // 0x064b
{0x0000,0x0000,0x0000,0x0000}, // 0x064c
{0x0000,0x0000,0x0000,0x0000}, // 0x064d
{0x0000,0x0000,0x0000,0x0000}, // 0x064e
{0x0000,0x0000,0x0000,0x0000}, // 0x064f
{0x0000,0x0000,0x0000,0x0000}, // 0x0650
{0x0000,0x0000,0x0000,0x0000}, // 0x0651
{0x0000,0x0000,0x0000,0x0000}, // 0x0652
{0x0000,0x0000,0x0000,0x0000}, // 0x0653
{0x0000,0x0000,0x0000,0x0000}, // 0x0654
{0x0000,0x0000,0x0000,0x0000}, // 0x0655
{0x0000,0x0000,0x0000,0x0000}, // 0x0656
{0x0000,0x0000,0x0000,0x0000}, // 0x0657
{0x0000,0x0000,0x0000,0x0000}, // 0x0658
{0x0000,0x0000,0x0000,0x0000}, // 0x0659
{0x0000,0x0000,0x0000,0x0000}, // 0x065a
{0x0000,0x0000,0x0000,0x0000}, // 0x065b
{0x0000,0x0000,0x0000,0x0000}, // 0x065c
{0x0000,0x0000,0x0000,0x0000}, // 0x065d
{0x0000,0x0000,0x0000,0x0000}, // 0x065e
{0x0000,0x0000,0x0000,0x0000}, // 0x065f
{0x0000,0x0000,0x0000,0x0000}, // 0x0660
{0x0000,0x0000,0x0000,0x0000}, // 0x0661
{0x0000,0x0000,0x0000,0x0000}, // 0x0662
{0x0000,0x0000,0x0000,0x0000}, // 0x0663
{0x0000,0x0000,0x0000,0x0000}, // 0x0664
{0x0000,0x0000,0x0000,0x0000}, // 0x0665
{0x0000,0x0000,0x0000,0x0000}, // 0x0666
{0x0000,0x0000,0x0000,0x0000}, // 0x0667
{0x0000,0x0000,0x0000,0x0000}, // 0x0668
{0x0000,0x0000,0x0000,0x0000}, // 0x0669
{0x0000,0x0000,0x0000,0x0000}, // 0x066a
{0x0000,0x0000,0x0000,0x0000}, // 0x066b
{0x0000,0x0000,0x0000,0x0000}, // 0x066c
{0x0000,0x0000,0x0000,0x0000}, // 0x066d
{0x0000,0x0000,0x0000,0x0000}, // 0x066e
{0x0000,0x0000,0x0000,0x0000}, // 0x066f
{0x0000,0x0000,0x0000,0x0000}, // 0x0670
#endif
{0xfb50,0x0000,0x0000,0x0000}, // 0x0671
{0x0672,0x0672,0x0000,0x0000}, // 0x0672
{0x0673,0x0673,0x0000,0x0000}, // 0x0673
{0x0674,0x0000,0x0000,0x0000}, // 0x0674
{0x0675,0x0675,0x0000,0x0000}, // 0x0675
{0x0676,0x0676,0x0000,0x0000}, // 0x0676
{0xfbdd,0x0677,0x0000,0x0000}, // 0x0677
{0x0678,0x0678,0x0678,0x0678}, // 0x0678
{0xfb66,0xfb67,0xfb69,0xfb68}, // 0x0679
{0xfb5e,0xfb5f,0xfb61,0xfb60}, // 0x067a
{0xfb52,0xfb53,0xfb55,0xfb54}, // 0x067b
{0x067c,0x067c,0x067c,0x067c}, // 0x067c
{0x067d,0x067d,0x067d,0x067d}, // 0x067d
{0xfb56,0xfb57,0xfb59,0xfb58}, // 0x067e
{0xfb62,0xfb63,0xfb65,0xfb64}, // 0x067f
{0xfb5a,0xfb5b,0xfb5d,0xfb5c}, // 0x0680
{0x0681,0x0681,0x0681,0x0681}, // 0x0681
{0x0682,0x0682,0x0682,0x0682}, // 0x0682
{0xfb76,0xfb77,0xfb79,0xfb78}, // 0x0683
{0xfb72,0xfb73,0xfb75,0xfb74}, // 0x0684
{0x0685,0x0685,0x0685,0x0685}, // 0x0685
{0xfb7a,0xfb7b,0xfb7d,0xfb7c}, // 0x0686
{0xfb7e,0xfb7f,0xfb81,0xfb80}, // 0x0687
{0xfb88,0xfb89,0x0000,0x0000}, // 0x0688
{0x0689,0x0689,0x0000,0x0000}, // 0x0689
{0x068a,0x068a,0x0000,0x0000}, // 0x068a
{0x068b,0x068b,0x0000,0x0000}, // 0x068b
{0xfb84,0xfb85,0x0000,0x0000}, // 0x068c
{0xfb82,0xfb83,0x0000,0x0000}, // 0x068d
{0xfb86,0xfb87,0x0000,0x0000}, // 0x068e
{0x068f,0x068f,0x0000,0x0000}, // 0x068f
{0x0690,0x0690,0x0000,0x0000}, // 0x0690
{0xfb8c,0xfb8d,0x0000,0x0000}, // 0x0691
{0x0692,0x0692,0x0000,0x0000}, // 0x0692
{0x0693,0x0693,0x0000,0x0000}, // 0x0693
{0x0694,0x0694,0x0000,0x0000}, // 0x0694
{0x0695,0x0695,0x0000,0x0000}, // 0x0695
{0x0695,0x0696,0x0000,0x0000}, // 0x0696
{0x0697,0x0697,0x0000,0x0000}, // 0x0697
{0xfb8a,0xfb8b,0x0000,0x0000}, // 0x0698
{0x0699,0x0699,0x0000,0x0000}, // 0x0699
{0x069a,0x069a,0x069a,0x069a}, // 0x069a
{0x069b,0x069b,0x069b,0x069b}, // 0x069b
{0x069c,0x069c,0x069c,0x069c}, // 0x069c
{0x069d,0x069d,0x069d,0x069d}, // 0x069d
{0x069e,0x069e,0x069e,0x069e}, // 0x069e
{0x069f,0x069f,0x069f,0x069f}, // 0x069f
{0x06a0,0x06a0,0x06a0,0x06a0}, // 0x06a0
{0x06a1,0x06a1,0x06a1,0x06a1}, // 0x06a1
{0x06a2,0x06a2,0x06a2,0x06a2}, // 0x06a2
{0x06a3,0x06a3,0x06a3,0x06a3}, // 0x06a3
{0xfb6a,0xfb6b,0xfb6d,0xfb6c}, // 0x06a4
{0x06a5,0x06a5,0x06a5,0x06a5}, // 0x06a5
{0xfb6e,0xfb6f,0xfb71,0xfb70}, // 0x06a6
{0x06a7,0x06a7,0x06a7,0x06a7}, // 0x06a7
{0x06a8,0x06a8,0x06a8,0x06a8}, // 0x06a8
{0xfb8e,0xfb8f,0xfb91,0xfb90}, // 0x06a9
{0x06aa,0x06aa,0x06aa,0x06aa}, // 0x06aa
{0x06ab,0x06ab,0x06ab,0x06ab}, // 0x06ab
{0x06ac,0x06ac,0x06ac,0x06ac}, // 0x06ac
{0xfbd3,0xfbd4,0xfbd6,0xfbd5}, // 0x06ad
{0x06ae,0x06ae,0x06ae,0x06ae}, // 0x06ae
{0xfb92,0xfb93,0xfb95,0xfb94}, // 0x06af
{0x06b0,0x06b0,0x06b0,0x06b0}, // 0x06b0
{0xfb9a,0xfb9b,0xfb9d,0xfb9c}, // 0x06b1
{0x06b2,0x06b2,0x06b2,0x06b2}, // 0x06b2
{0xfb96,0xfb97,0xfb99,0xfb98}, // 0x06b3
{0x06b4,0x06b4,0x06b4,0x06b4}, // 0x06b4
{0x06b5,0x06b5,0x06b5,0x06b5}, // 0x06b5
{0x06b6,0x06b6,0x06b6,0x06b6}, // 0x06b6
{0x06b7,0x06b7,0x06b7,0x06b7}, // 0x06b7
{0x0000,0x0000,0x0000,0x0000}, // 0x06b8
{0x0000,0x0000,0x0000,0x0000}, // 0x06b9
{0xfb9e,0xfb9f,0x06ba,0x06ba}, // 0x06ba
{0xfba0,0xfba1,0xfba3,0xfba2}, // 0x06bb
{0x06bc,0x06bc,0x06bc,0x06bc}, // 0x06bc
{0x06bd,0x06bd,0x06bd,0x06bd}, // 0x06bd
{0xfbaa,0xfbab,0xfbad,0xfbac}, // 0x06be
{0x0000,0x0000,0x0000,0x0000}, // 0x06bf
{0xfba4,0xfba5,0x0000,0x0000}, // 0x06c0
{0x06c1,0x06c1,0x06c1,0x06c1}, // 0x06c1
{0x06c2,0x06c2,0x0000,0x0000}, // 0x06c2
{0x06c3,0x06c3,0x0000,0x0000}, // 0x06c3
{0x06c4,0x06c4,0x0000,0x0000}, // 0x06c4
{0x06c5,0x06c5,0x0000,0x0000}, // 0x06c5
{0x06c6,0x06c6,0x0000,0x0000}, // 0x06c6
{0x06c7,0x06c7,0x0000,0x0000}, // 0x06c7
{0x06c8,0x06c8,0x0000,0x0000}, // 0x06c8
{0x06c9,0x06c9,0x0000,0x0000}, // 0x06c9
{0x06ca,0x06ca,0x0000,0x0000}, // 0x06ca
{0x06cb,0x06cb,0x0000,0x0000}, // 0x06cb
{0x06cc,0x06cc,0x06cc,0x06cc}, // 0x06cc
{0x06cd,0x06cd,0x0000,0x0000}, // 0x06cd
{0x06ce,0x06ce,0x06ce,0x06ce}, // 0x06ce
{0x0000,0x0000,0x0000,0x0000}, // 0x06cf
{0x06d0,0x06d0,0x06d0,0x06d0}, // 0x06d0
{0x06d1,0x06d1,0x06d1,0x06d1}, // 0x06d1
{0xfbae,0xfbaf,0x0000,0x0000}, // 0x06d2
{0xfbb0,0xfbb1,0x0000,0x0000}, // 0x06d3
{0x0000,0x0000,0x0000,0x0000}, // 0x06d4
{0x06d5,0x0000,0x0000,0x0000} // 0x06d5
};

View file

@ -1,205 +0,0 @@
typedef struct {
unsigned short isolated;
unsigned short final;
unsigned short medial;
unsigned short initial;
} arab_t;
//static arab_t dummy = {0,0,0,0};
static arab_t zwj = {0x20,0x20,0x20,0x20}; //zero-width joiner
static arab_t lamaleph[] = {
{0xfefb,0xfefc,0,0},
{0xfef9,0xfefa,0,0},
{0xfef7,0xfef8,0,0},
{0xfef5,0xfef6,0,0}
};
static arab_t jointable[] = {
{0xfe80,0x0000,0x0000,0x0000}, // 0x0621
{0xfe81,0xfe82,0x0000,0x0000}, // 0x0622
{0xfe83,0xfe84,0x0000,0x0000}, // 0x0623
{0xfe85,0xfe86,0x0000,0x0000}, // 0x0624
{0xfe87,0xfe88,0x0000,0x0000}, // 0x0625
{0xfe89,0xfe8a,0xfe8c,0xfe8b}, // 0x0626
{0xfe8d,0xfe8e,0x0000,0x0000}, // 0x0627
{0xfe8f,0xfe90,0xfe92,0xfe91}, // 0x0628
{0xfe93,0xfe94,0x0000,0x0000}, // 0x0629
{0xfe95,0xfe96,0xfe98,0xfe97}, // 0x062a
{0xfe99,0xfe9a,0xfe9c,0xfe9b}, // 0x062b
{0xfe9d,0xfe9e,0xfea0,0xfe9f}, // 0x062c
{0xfea1,0xfea2,0xfea4,0xfea3}, // 0x062d
{0xfea5,0xfea6,0xfea8,0xfea7}, // 0x062e
{0xfea9,0xfeaa,0x0000,0x0000}, // 0x062f
{0xfeab,0xfeac,0x0000,0x0000}, // 0x0630
{0xfead,0xfeae,0x0000,0x0000}, // 0x0631
{0xfeaf,0xfeb0,0x0000,0x0000}, // 0x0632
{0xfeb1,0xfeb2,0xfeb4,0xfeb3}, // 0x0633
{0xfeb5,0xfeb6,0xfeb8,0xfeb7}, // 0x0634
{0xfeb9,0xfeba,0xfebc,0xfebb}, // 0x0635
{0xfebd,0xfebe,0xfec0,0xfebf}, // 0x0636
{0xfec1,0xfec2,0xfec4,0xfec3}, // 0x0637
{0xfec5,0xfec6,0xfec8,0xfec7}, // 0x0638
{0xfec9,0xfeca,0xfecc,0xfecb}, // 0x0639
{0xfecd,0xfece,0xfed0,0xfecf}, // 0x063a
#if 0
{0x0000,0x0000,0x0000,0x0000}, // 0x063b
{0x0000,0x0000,0x0000,0x0000}, // 0x063c
{0x0000,0x0000,0x0000,0x0000}, // 0x063d
{0x0000,0x0000,0x0000,0x0000}, // 0x063e
{0x0000,0x0000,0x0000,0x0000}, // 0x063f
#endif
{0x0640,0x0640,0x0640,0x0640}, // 0x0640
{0xfed1,0xfed2,0xfed4,0xfed3}, // 0x0641
{0xfed5,0xfed6,0xfed8,0xfed7}, // 0x0642
{0xfed9,0xfeda,0xfedc,0xfedb}, // 0x0643
{0xfedd,0xfede,0xfee0,0xfedf}, // 0x0644
{0xfee1,0xfee2,0xfee4,0xfee3}, // 0x0645
{0xfee5,0xfee6,0xfee8,0xfee7}, // 0x0646
{0xfee9,0xfeea,0xfeec,0xfeeb}, // 0x0647
{0xfeed,0xfeee,0x0000,0x0000}, // 0x0648
{0xfeef,0xfef0,0x0000,0x0000}, // 0x0649
{0xfef1,0xfef2,0xfef4,0xfef3}, // 0x064a
# if 0
{0x0000,0x0000,0x0000,0x0000}, // 0x064b
{0x0000,0x0000,0x0000,0x0000}, // 0x064c
{0x0000,0x0000,0x0000,0x0000}, // 0x064d
{0x0000,0x0000,0x0000,0x0000}, // 0x064e
{0x0000,0x0000,0x0000,0x0000}, // 0x064f
{0x0000,0x0000,0x0000,0x0000}, // 0x0650
{0x0000,0x0000,0x0000,0x0000}, // 0x0651
{0x0000,0x0000,0x0000,0x0000}, // 0x0652
{0x0000,0x0000,0x0000,0x0000}, // 0x0653
{0x0000,0x0000,0x0000,0x0000}, // 0x0654
{0x0000,0x0000,0x0000,0x0000}, // 0x0655
{0x0000,0x0000,0x0000,0x0000}, // 0x0656
{0x0000,0x0000,0x0000,0x0000}, // 0x0657
{0x0000,0x0000,0x0000,0x0000}, // 0x0658
{0x0000,0x0000,0x0000,0x0000}, // 0x0659
{0x0000,0x0000,0x0000,0x0000}, // 0x065a
{0x0000,0x0000,0x0000,0x0000}, // 0x065b
{0x0000,0x0000,0x0000,0x0000}, // 0x065c
{0x0000,0x0000,0x0000,0x0000}, // 0x065d
{0x0000,0x0000,0x0000,0x0000}, // 0x065e
{0x0000,0x0000,0x0000,0x0000}, // 0x065f
{0x0000,0x0000,0x0000,0x0000}, // 0x0660
{0x0000,0x0000,0x0000,0x0000}, // 0x0661
{0x0000,0x0000,0x0000,0x0000}, // 0x0662
{0x0000,0x0000,0x0000,0x0000}, // 0x0663
{0x0000,0x0000,0x0000,0x0000}, // 0x0664
{0x0000,0x0000,0x0000,0x0000}, // 0x0665
{0x0000,0x0000,0x0000,0x0000}, // 0x0666
{0x0000,0x0000,0x0000,0x0000}, // 0x0667
{0x0000,0x0000,0x0000,0x0000}, // 0x0668
{0x0000,0x0000,0x0000,0x0000}, // 0x0669
{0x0000,0x0000,0x0000,0x0000}, // 0x066a
{0x0000,0x0000,0x0000,0x0000}, // 0x066b
{0x0000,0x0000,0x0000,0x0000}, // 0x066c
{0x0000,0x0000,0x0000,0x0000}, // 0x066d
{0x0000,0x0000,0x0000,0x0000}, // 0x066e
{0x0000,0x0000,0x0000,0x0000}, // 0x066f
{0x0000,0x0000,0x0000,0x0000}, // 0x0670
#endif
{0xfb50,0x0000,0x0000,0x0000}, // 0x0671
{0x0672,0x0672,0x0000,0x0000}, // 0x0672
{0x0673,0x0673,0x0000,0x0000}, // 0x0673
{0x0674,0x0000,0x0000,0x0000}, // 0x0674
{0x0675,0x0675,0x0000,0x0000}, // 0x0675
{0x0676,0x0676,0x0000,0x0000}, // 0x0676
{0xfbdd,0x0677,0x0000,0x0000}, // 0x0677
{0x0678,0x0678,0x0678,0x0678}, // 0x0678
{0xfb66,0xfb67,0xfb69,0xfb68}, // 0x0679
{0xfb5e,0xfb5f,0xfb61,0xfb60}, // 0x067a
{0xfb52,0xfb53,0xfb55,0xfb54}, // 0x067b
{0x067c,0x067c,0x067c,0x067c}, // 0x067c
{0x067d,0x067d,0x067d,0x067d}, // 0x067d
{0xfb56,0xfb57,0xfb59,0xfb58}, // 0x067e
{0xfb62,0xfb63,0xfb65,0xfb64}, // 0x067f
{0xfb5a,0xfb5b,0xfb5d,0xfb5c}, // 0x0680
{0x0681,0x0681,0x0681,0x0681}, // 0x0681
{0x0682,0x0682,0x0682,0x0682}, // 0x0682
{0xfb76,0xfb77,0xfb79,0xfb78}, // 0x0683
{0xfb72,0xfb73,0xfb75,0xfb74}, // 0x0684
{0x0685,0x0685,0x0685,0x0685}, // 0x0685
{0xfb7a,0xfb7b,0xfb7d,0xfb7c}, // 0x0686
{0xfb7e,0xfb7f,0xfb81,0xfb80}, // 0x0687
{0xfb88,0xfb89,0x0000,0x0000}, // 0x0688
{0x0689,0x0689,0x0000,0x0000}, // 0x0689
{0x068a,0x068a,0x0000,0x0000}, // 0x068a
{0x068b,0x068b,0x0000,0x0000}, // 0x068b
{0xfb84,0xfb85,0x0000,0x0000}, // 0x068c
{0xfb82,0xfb83,0x0000,0x0000}, // 0x068d
{0xfb86,0xfb87,0x0000,0x0000}, // 0x068e
{0x068f,0x068f,0x0000,0x0000}, // 0x068f
{0x0690,0x0690,0x0000,0x0000}, // 0x0690
{0xfb8c,0xfb8d,0x0000,0x0000}, // 0x0691
{0x0692,0x0692,0x0000,0x0000}, // 0x0692
{0x0693,0x0693,0x0000,0x0000}, // 0x0693
{0x0694,0x0694,0x0000,0x0000}, // 0x0694
{0x0695,0x0695,0x0000,0x0000}, // 0x0695
{0x0695,0x0696,0x0000,0x0000}, // 0x0696
{0x0697,0x0697,0x0000,0x0000}, // 0x0697
{0xfb8a,0xfb8b,0x0000,0x0000}, // 0x0698
{0x0699,0x0699,0x0000,0x0000}, // 0x0699
{0x069a,0x069a,0x069a,0x069a}, // 0x069a
{0x069b,0x069b,0x069b,0x069b}, // 0x069b
{0x069c,0x069c,0x069c,0x069c}, // 0x069c
{0x069d,0x069d,0x069d,0x069d}, // 0x069d
{0x069e,0x069e,0x069e,0x069e}, // 0x069e
{0x069f,0x069f,0x069f,0x069f}, // 0x069f
{0x06a0,0x06a0,0x06a0,0x06a0}, // 0x06a0
{0x06a1,0x06a1,0x06a1,0x06a1}, // 0x06a1
{0x06a2,0x06a2,0x06a2,0x06a2}, // 0x06a2
{0x06a3,0x06a3,0x06a3,0x06a3}, // 0x06a3
{0xfb6a,0xfb6b,0xfb6d,0xfb6c}, // 0x06a4
{0x06a5,0x06a5,0x06a5,0x06a5}, // 0x06a5
{0xfb6e,0xfb6f,0xfb71,0xfb70}, // 0x06a6
{0x06a7,0x06a7,0x06a7,0x06a7}, // 0x06a7
{0x06a8,0x06a8,0x06a8,0x06a8}, // 0x06a8
{0xfb8e,0xfb8f,0xfb91,0xfb90}, // 0x06a9
{0x06aa,0x06aa,0x06aa,0x06aa}, // 0x06aa
{0x06ab,0x06ab,0x06ab,0x06ab}, // 0x06ab
{0x06ac,0x06ac,0x06ac,0x06ac}, // 0x06ac
{0xfbd3,0xfbd4,0xfbd6,0xfbd5}, // 0x06ad
{0x06ae,0x06ae,0x06ae,0x06ae}, // 0x06ae
{0xfb92,0xfb93,0xfb95,0xfb94}, // 0x06af
{0x06b0,0x06b0,0x06b0,0x06b0}, // 0x06b0
{0xfb9a,0xfb9b,0xfb9d,0xfb9c}, // 0x06b1
{0x06b2,0x06b2,0x06b2,0x06b2}, // 0x06b2
{0xfb96,0xfb97,0xfb99,0xfb98}, // 0x06b3
{0x06b4,0x06b4,0x06b4,0x06b4}, // 0x06b4
{0x06b5,0x06b5,0x06b5,0x06b5}, // 0x06b5
{0x06b6,0x06b6,0x06b6,0x06b6}, // 0x06b6
{0x06b7,0x06b7,0x06b7,0x06b7}, // 0x06b7
{0x0000,0x0000,0x0000,0x0000}, // 0x06b8
{0x0000,0x0000,0x0000,0x0000}, // 0x06b9
{0xfb9e,0xfb9f,0x06ba,0x06ba}, // 0x06ba
{0xfba0,0xfba1,0xfba3,0xfba2}, // 0x06bb
{0x06bc,0x06bc,0x06bc,0x06bc}, // 0x06bc
{0x06bd,0x06bd,0x06bd,0x06bd}, // 0x06bd
{0xfbaa,0xfbab,0xfbad,0xfbac}, // 0x06be
{0x0000,0x0000,0x0000,0x0000}, // 0x06bf
{0xfba4,0xfba5,0x0000,0x0000}, // 0x06c0
{0x06c1,0x06c1,0x06c1,0x06c1}, // 0x06c1
{0x06c2,0x06c2,0x0000,0x0000}, // 0x06c2
{0x06c3,0x06c3,0x0000,0x0000}, // 0x06c3
{0x06c4,0x06c4,0x0000,0x0000}, // 0x06c4
{0x06c5,0x06c5,0x0000,0x0000}, // 0x06c5
{0x06c6,0x06c6,0x0000,0x0000}, // 0x06c6
{0x06c7,0x06c7,0x0000,0x0000}, // 0x06c7
{0x06c8,0x06c8,0x0000,0x0000}, // 0x06c8
{0x06c9,0x06c9,0x0000,0x0000}, // 0x06c9
{0x06ca,0x06ca,0x0000,0x0000}, // 0x06ca
{0x06cb,0x06cb,0x0000,0x0000}, // 0x06cb
{0x06cc,0x06cc,0x06cc,0x06cc}, // 0x06cc
{0x06cd,0x06cd,0x0000,0x0000}, // 0x06cd
{0x06ce,0x06ce,0x06ce,0x06ce}, // 0x06ce
{0x0000,0x0000,0x0000,0x0000}, // 0x06cf
{0x06d0,0x06d0,0x06d0,0x06d0}, // 0x06d0
{0x06d1,0x06d1,0x06d1,0x06d1}, // 0x06d1
{0xfbae,0xfbaf,0x0000,0x0000}, // 0x06d2
{0xfbb0,0xfbb1,0x0000,0x0000}, // 0x06d3
{0x0000,0x0000,0x0000,0x0000}, // 0x06d4
{0x06d5,0x0000,0x0000,0x0000} // 0x06d5
};

View file

@ -38,7 +38,7 @@
#define _isnewline(c) ((c=='\n' || c=='\r') ? 1 : 0) #define _isnewline(c) ((c=='\n' || c=='\r') ? 1 : 0)
#define XOR(a,b) ((a||b) && !(a&&b)) #define XOR(a,b) ((a||b) && !(a&&b))
arab_t * arab_lookup(unsigned short uchar) const arab_t * arab_lookup(unsigned short uchar)
{ {
if (uchar >= 0x621 && uchar <= 0x63a) if (uchar >= 0x621 && uchar <= 0x63a)
return &(jointable[uchar - 0x621]); return &(jointable[uchar - 0x621]);
@ -56,9 +56,9 @@ void arabjoin(unsigned short * stringprt, int length){
bool connected = false; bool connected = false;
unsigned short * writeprt = stringprt; unsigned short * writeprt = stringprt;
arab_t * prev = 0; const arab_t * prev = 0;
arab_t * cur; const arab_t * cur;
arab_t * ligature = 0; const arab_t * ligature = 0;
short uchar; short uchar;
int i; int i;

View file

@ -73,7 +73,8 @@ int load_cp_table(int cp)
while (i < tablesize) { while (i < tablesize) {
if (!read(file, tmp, 2)) { if (!read(file, tmp, 2)) {
DEBUGF("Can't read from codepage file: %s.cp\n", filename[table-1]); DEBUGF("Can't read from codepage file: %s.cp\n",
filename[table-1]);
loaded_cp_table = 0; loaded_cp_table = 0;
return 0; return 0;
} }
@ -170,13 +171,16 @@ unsigned char* iso_decode(const unsigned char *iso, unsigned char *utf8,
} }
/* Recode a UTF-16 string with little-endian byte ordering to UTF-8 */ /* Recode a UTF-16 string with little-endian byte ordering to UTF-8 */
unsigned char* utf16LEdecode(const unsigned char *utf16, unsigned char *utf8, unsigned int count) unsigned char* utf16LEdecode(const unsigned char *utf16, unsigned char *utf8,
unsigned int count)
{ {
unsigned long ucs; unsigned long ucs;
while (count != 0) { while (count != 0) {
if (utf16[1] >= 0xD8 && utf16[1] < 0xE0) { /* Check for a surrogate pair */ /* Check for a surrogate pair */
ucs = 0x10000 + ((utf16[0] << 10) | ((utf16[1] - 0xD8) << 18) | utf16[2] | ((utf16[3] - 0xDC) << 8)); if (utf16[1] >= 0xD8 && utf16[1] < 0xE0) {
ucs = 0x10000 + ((utf16[0] << 10) | ((utf16[1] - 0xD8) << 18)
| utf16[2] | ((utf16[3] - 0xDC) << 8));
utf16 += 4; utf16 += 4;
count -= 2; count -= 2;
} else { } else {
@ -190,13 +194,15 @@ unsigned char* utf16LEdecode(const unsigned char *utf16, unsigned char *utf8, un
} }
/* Recode a UTF-16 string with big-endian byte ordering to UTF-8 */ /* Recode a UTF-16 string with big-endian byte ordering to UTF-8 */
unsigned char* utf16BEdecode(const unsigned char *utf16, unsigned char *utf8, unsigned int count) unsigned char* utf16BEdecode(const unsigned char *utf16, unsigned char *utf8,
unsigned int count)
{ {
unsigned long ucs; unsigned long ucs;
while (count != 0) { while (count != 0) {
if (*utf16 >= 0xD8 && *utf16 < 0xE0) { /* Check for a surrogate pair */ if (*utf16 >= 0xD8 && *utf16 < 0xE0) { /* Check for a surrogate pair */
ucs = 0x10000 + (((utf16[0] - 0xD8) << 18) | (utf16[1] << 10) | ((utf16[2] - 0xDC) << 8) | utf16[3]); ucs = 0x10000 + (((utf16[0] - 0xD8) << 18) | (utf16[1] << 10)
| ((utf16[2] - 0xDC) << 8) | utf16[3]);
utf16 += 4; utf16 += 4;
count -= 2; count -= 2;
} else { } else {
@ -210,8 +216,8 @@ unsigned char* utf16BEdecode(const unsigned char *utf16, unsigned char *utf8, un
} }
/* Recode any UTF-16 string to UTF-8 */ /* Recode any UTF-16 string to UTF-8 */
//unsigned char* utf16decode(unsigned const char *utf16, unsigned char *utf8, unsigned int count) unsigned char* utf16decode(const unsigned char *utf16, unsigned char *utf8,
unsigned char* utf16decode(const unsigned char *utf16, unsigned char *utf8, unsigned int count) unsigned int count)
{ {
unsigned long ucs; unsigned long ucs;

View file

@ -41,7 +41,7 @@ ipod_fw: ipod_fw.c
convbdf: convbdf.c convbdf: convbdf.c
$(CC) -g $+ -o $@ $(CC) -g $+ -o $@
codepages: codepages.c codepages: codepages.c codepage_tables.c
$(CC) -g $+ -o $@ $(CC) -g $+ -o $@
generate_rocklatin: generate_rocklatin.c ../firmware/drivers/lcd-player-charset.c generate_rocklatin: generate_rocklatin.c ../firmware/drivers/lcd-player-charset.c

View file

@ -17,7 +17,41 @@
* *
****************************************************************************/ ****************************************************************************/
static const unsigned short cp932_table[] = { #include "codepage_tables.h"
const unsigned short iso8859_7_to_uni[] = {
0x2018, 0x2019, 0x00A3, 0x20AC, 0x20AF, 0x00A6, 0x00A7, /* A1-A7 */
0x00A8, 0x00A9, 0x037A, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, /* A8-AF */
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7 /* B0-B7 */
};
const unsigned short cp1251_to_uni[] = {
0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, /* 80-87 */
0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, /* 88-8F */
0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, /* 90-97 */
0x0098, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, /* 98-9F */
0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, /* A0-A7 */
0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, /* A8-AF */
0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, /* B0-B7 */
0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457 /* B8-BF */
};
const unsigned short iso8859_2_to_uni[] = {
0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, /* A1-A7 */
0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, /* A8-AF */
0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, /* B0-B7 */
0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, /* B8-BF */
0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, /* C0-C7 */
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, /* C8-CF */
0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, /* D0-D7 */
0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, /* D8-DF */
0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, /* E0-E7 */
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, /* E8-EF */
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, /* F0-F7 */
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 /* F8-FF */
};
const unsigned short cp932_table[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@ -4116,8 +4150,7 @@ static const unsigned short cp932_table[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
}; };
const unsigned short cp936_table[] = {
static const unsigned short cp936_table[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@ -8217,7 +8250,7 @@ static const unsigned short cp936_table[] = {
}; };
static const unsigned short cp949_table[] = { const unsigned short cp949_table[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@ -12317,7 +12350,7 @@ static const unsigned short cp949_table[] = {
}; };
static const unsigned short cp950_table[] = { const unsigned short cp950_table[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@ -16416,4 +16449,3 @@ static const unsigned short cp950_table[] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
}; };

View file

@ -19,44 +19,12 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "codepages.h" #include "codepage_tables.h"
#define MAX_TABLE_SIZE 32768 #define MAX_TABLE_SIZE 32768
static unsigned short iso_table[MAX_TABLE_SIZE]; static unsigned short iso_table[MAX_TABLE_SIZE];
static const unsigned short iso8859_7_to_uni[] = {
0x2018, 0x2019, 0x00A3, 0x20AC, 0x20AF, 0x00A6, 0x00A7, /* A1-A7 */
0x00A8, 0x00A9, 0x037A, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x2015, /* A8-AF */
0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x0384, 0x0385, 0x0386, 0x00B7 /* B0-B7 */
};
static const unsigned short cp1251_to_uni[] = {
0x0402, 0x0403, 0x201A, 0x0453, 0x201E, 0x2026, 0x2020, 0x2021, /* 80-87 */
0x20AC, 0x2030, 0x0409, 0x2039, 0x040A, 0x040C, 0x040B, 0x040F, /* 88-8F */
0x0452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, /* 90-97 */
0x0098, 0x2122, 0x0459, 0x203A, 0x045A, 0x045C, 0x045B, 0x045F, /* 98-9F */
0x00A0, 0x040E, 0x045E, 0x0408, 0x00A4, 0x0490, 0x00A6, 0x00A7, /* A0-A7 */
0x0401, 0x00A9, 0x0404, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x0407, /* A8-AF */
0x00B0, 0x00B1, 0x0406, 0x0456, 0x0491, 0x00B5, 0x00B6, 0x00B7, /* B0-B7 */
0x0451, 0x2116, 0x0454, 0x00BB, 0x0458, 0x0405, 0x0455, 0x0457 /* B8-BF */
};
static const unsigned short iso8859_2_to_uni[] = {
0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, /* A1-A7 */
0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, /* A8-AF */
0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, /* B0-B7 */
0x00B8, 0x0161, 0x015F, 0x0165, 0x017A, 0x02DD, 0x017E, 0x017C, /* B8-BF */
0x0154, 0x00C1, 0x00C2, 0x0102, 0x00C4, 0x0139, 0x0106, 0x00C7, /* C0-C7 */
0x010C, 0x00C9, 0x0118, 0x00CB, 0x011A, 0x00CD, 0x00CE, 0x010E, /* C8-CF */
0x0110, 0x0143, 0x0147, 0x00D3, 0x00D4, 0x0150, 0x00D6, 0x00D7, /* D0-D7 */
0x0158, 0x016E, 0x00DA, 0x0170, 0x00DC, 0x00DD, 0x0162, 0x00DF, /* D8-DF */
0x0155, 0x00E1, 0x00E2, 0x0103, 0x00E4, 0x013A, 0x0107, 0x00E7, /* E0-E7 */
0x010D, 0x00E9, 0x0119, 0x00EB, 0x011B, 0x00ED, 0x00EE, 0x010F, /* E8-EF */
0x0111, 0x0144, 0x0148, 0x00F3, 0x00F4, 0x0151, 0x00F6, 0x00F7, /* F0-F7 */
0x0159, 0x016F, 0x00FA, 0x0171, 0x00FC, 0x00FD, 0x0163, 0x02D9 /* F8-FF */
};
unsigned short iso_decode(unsigned char *latin1, int cp, int count) unsigned short iso_decode(unsigned char *latin1, int cp, int count)
{ {
unsigned short ucs = 0; unsigned short ucs = 0;