comparison compat.c @ 74:f794f2baabf2

Added codepage translation for Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 18 Feb 2002 19:10:28 +0000
parents 2f339dd13496
children c0388006bb0d
comparison
equal deleted inserted replaced
73:2f339dd13496 74:f794f2baabf2
761 buf[z] = 0; 761 buf[z] = 0;
762 return; 762 return;
763 } 763 }
764 } 764 }
765 } 765 }
766
767 #ifdef __WIN32__
768 #define LOCALE_CHARACTERS 62
769 static char locale_table[LOCALE_CHARACTERS * 2] = {
770 0xc0, 0xb7, 0xc1, 0xb5, 0xc2, 0xb6, 0xc3, 0xc7, 0xc4, 0x8e, 0xc5, 0x8f,
771 0xc6, 0x92, 0xc7, 0x80, 0xc8, 0xd4, 0xc9, 0x90, 0xcb, 0xd3, 0xcc, 0xde,
772 0xcd, 0xd6, 0xce, 0xd7, 0xcf, 0xd8, 0xd0, 0xd1, 0xd1, 0xa5, 0xd2, 0xe3,
773 0xd3, 0xe0, 0xd4, 0xe2, 0xd5, 0xe5, 0xd6, 0x99, 0xd8, 0x9d, 0xd9, 0xeb,
774 0xda, 0xe9, 0xdb, 0xea, 0xdc, 0x9a, 0xde, 0xed, 0xde, 0xe8, 0xdf, 0xe1,
775 0xe0, 0x85, 0xe1, 0xa0, 0xe2, 0x83, 0xe3, 0xc6, 0xe4, 0x84, 0xe5, 0x86,
776 0xe6, 0x91, 0xe7, 0x87, 0xe8, 0x8a, 0xe9, 0x82, 0xea, 0x88, 0xeb, 0x89,
777 0xec, 0x8d, 0xed, 0xa1, 0xee, 0x8c, 0xef, 0x8b, 0xf0, 0xd0, 0xf1, 0xa4,
778 0xf2, 0x95, 0xf3, 0xa3, 0xf4, 0x93, 0xf5, 0xe4, 0xf6, 0x94, 0xf7, 0xf6,
779 0xf8, 0x9b, 0xf9, 0x97, 0xfa, 0xa3, 0xfb, 0x96, 0xfc, 0x81, 0xfd, 0xec,
780 0xfe, 0xe7, 0xff, 0x9e
781
782 };
783
784 char locale_convert(int codepage, char c)
785 {
786 int z;
787
788 for(z=0;z<LOCALE_CHARACTERS;z++)
789 {
790 if(locale_table[(z*2)+1] == c)
791 return locale_table[z*2];
792 }
793 return c;
794 }
795 #endif
766 796
767 /* Initialize the locale engine 797 /* Initialize the locale engine
768 * Returns: TRUE on success, FALSE on failure. 798 * Returns: TRUE on success, FALSE on failure.
769 */ 799 */
770 int locale_init(char *filename, int my_locale) 800 int locale_init(char *filename, int my_locale)
834 x++; 864 x++;
835 z++; 865 z++;
836 } 866 }
837 else 867 else
838 { 868 {
869 #ifdef __WIN32__
870 locale_text[current][x] = locale_convert(1252, text[z]);
871 #else
839 locale_text[current][x] = text[z]; 872 locale_text[current][x] = text[z];
873 #endif
840 x++; 874 x++;
841 } 875 }
842 } 876 }
843 } 877 }
844 current++; 878 current++;