1 /* 2 * gretl -- Gnu Regression, Econometrics and Time-series Library 3 * Copyright (C) 2001 Allin Cottrell and Riccardo "Jack" Lucchetti 4 * 5 * This program is free software: you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation, either version 3 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 * 18 */ 19 20 #ifndef GRETL_INTL_H 21 #define GRETL_INTL_H 22 23 void gretl_push_c_numeric_locale (void); 24 25 void gretl_pop_c_numeric_locale (void); 26 27 int doing_nls (void); 28 29 int reset_local_decpoint (void); 30 31 int get_local_decpoint (void); 32 33 char *iso_to_ascii (char *s); 34 35 char *u8_to_ascii_convert (char *targ, const char *src, 36 int maxlen, char sub); 37 38 char *asciify_utf8_varname (char *s); 39 40 /* the following enumeration is organized by alphabetical order of 41 English name of language: Albanian, Basque, Bulgarian, ... 42 */ 43 44 typedef enum { 45 LANG_AUTO = 0, 46 LANG_C, 47 LANG_SQ, 48 LANG_EU, 49 LANG_BG, 50 LANG_CA, 51 LANG_ZH_TW, 52 LANG_ZH_CN, 53 LANG_CS, 54 LANG_FR, 55 LANG_GL, 56 LANG_DE, 57 LANG_EL, 58 LANG_IT, 59 LANG_JA, 60 LANG_PL, 61 LANG_PT, 62 LANG_PT_BR, 63 LANG_RO, 64 LANG_RU, 65 LANG_ES, 66 LANG_TR, 67 LANG_UK, 68 LANG_MAX 69 } GretlLangCode; 70 71 const char *lang_string_from_id (int langid); 72 73 char *utf8_to_rtf (const char *s); 74 75 int lang_id_from_name (const char *s); 76 77 int lang_id_from_code (const char *s); 78 79 void set_lcnumeric (int langid, int lcnumeric); 80 81 int gretl_is_ascii (const char *buf); 82 83 int force_language (int langid); 84 85 int test_locale (const char *langstr); 86 87 int gretl_recode_file (const char *path1, 88 const char *path2, 89 const char *from_set, 90 const char *to_set, 91 PRN *prn); 92 93 int chinese_locale (void); 94 95 int japanese_locale (void); 96 97 int east_asian_locale (void); 98 99 int get_utf_width (const char *str, int width); 100 101 #ifdef ENABLE_NLS 102 103 char *sprint_l2_to_ascii (char *targ, const char *s, size_t len); 104 105 int get_translated_width (const char *str); 106 107 # define UTF_WIDTH(s, w) get_utf_width(s, w) 108 # define TRANSLATED_WIDTH(s) get_translated_width(s) 109 110 #else /* !ENABLE_NLS */ 111 112 # define gettext(s) s 113 # define UTF_WIDTH(s, w) w 114 # define TRANSLATED_WIDTH(s) strlen(s) 115 116 #endif /* ENABLE_NLS */ 117 118 #endif /* GRETL_INTL_H */ 119