Original patch as attached on the bugreport
[midnight-commander.git] / src / charsets.h
blobb701d5abab07f06053b93cbc9b0e1a1979198440
1 #ifndef MC_CHARSETS_H
2 #define MC_CHARSETS_H
4 #ifdef HAVE_CHARSET
6 #define UNKNCHAR '\001'
8 #define CHARSETS_INDEX "mc.charsets"
10 extern int n_codepages;
12 extern unsigned char conv_displ[256];
13 extern unsigned char conv_input[256];
15 struct codepage_desc {
16 char *id;
17 char *name;
20 extern struct codepage_desc *codepages;
22 const char *get_codepage_id (int n);
23 int get_codepage_index (const char *id);
24 int load_codepages_list (void);
25 void free_codepages_list (void);
26 const char *init_translation_table (int cpsource, int cpdisplay);
27 void convert_to_display (char *str);
28 void convert_from_input (char *str);
29 void convert_string (unsigned char *str);
31 /* Convert single characters */
32 static inline int
33 convert_to_display_c (int c)
35 if (c < 0 || c >= 256)
36 return c;
37 return conv_displ[c];
40 static inline int
41 convert_from_input_c (int c)
43 if (c < 0 || c >= 256)
44 return c;
45 return conv_input[c];
48 #else /* !HAVE_CHARSET */
50 #define convert_to_display_c(c) (c)
51 #define convert_from_input_c(c) (c)
52 #define convert_to_display(str) do {} while (0)
53 #define convert_from_input(str) do {} while (0)
55 #endif /* HAVE_CHARSET */
57 #endif