Mercurial > audlegacy
annotate src/libguess/arabic_impl.c @ 3383:e2e875f3d02b trunk
Make playlist_load_ins handle the case when playlist is not the currently active one
author | Kieran Clancy <clancy.kieran+audacious@gmail.com> |
---|---|
date | Sun, 26 Aug 2007 07:23:52 +0930 |
parents | 6bcfc6561711 |
children |
rev | line source |
---|---|
3206
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
1 #include "libguess.h" |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
2 |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
3 static const char *_guess_ar(const unsigned char *ptr, int size) |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
4 { |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
5 int i; |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
6 |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
7 for (i = 0; i < size; i++) |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
8 { |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
9 if ((ptr[i] >= 0x80 && ptr[i] <= 0x9F) || |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
10 ptr[i] == 0xA1 || ptr[i] == 0xA2 || ptr[i] == 0xA3 || |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
11 (ptr[i] >= 0xA5 && ptr[i] <= 0xAB) || |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
12 (ptr[i] >= 0xAE && ptr[i] <= 0xBA) || |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
13 ptr[i] == 0xBC || ptr[i] == 0xBD || |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
14 ptr[i] == 0xBE || ptr[i] == 0xC0 || |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
15 (ptr[i] >= 0xDB && ptr[i] <= 0xDF) || (ptr[i] >= 0xF3)) |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
16 return "CP1256"; |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
17 } |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
18 |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
19 return "ISO-8859-6"; |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
20 } |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
21 |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
22 const char *guess_ar(const char *ptr, int size) |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
23 { |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
24 if (dfa_validate_utf8(ptr, size)) |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
25 return "UTF-8"; |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
26 |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
27 return _guess_ar((const unsigned char *)ptr, size); |
6bcfc6561711
Implement support for Arabic and Turkish.
William Pitcock <nenolod@atheme-project.org>
parents:
diff
changeset
|
28 } |