new beta-0.90.0
[luatex.git] / source / texk / kpathsea / knj.h
blobfc1b808b2311e0d4170bcd86f6a1521ac5b0edab
1 /* knj.h: check for 2-Byte Kanji (CP 932, SJIS) codes.
3 Copyright 2010, 2014 Akira Kakuto.
4 Copyright 2013, 2014 TANAKA Takuji.
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public License
17 along with this library; if not, see <http://www.gnu.org/licenses/>. */
19 #ifndef KPATHSEA_KNJ_H
20 #define KPATHSEA_KNJ_H
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
26 extern KPSEDLL int is_cp932_system;
27 extern KPSEDLL int file_system_codepage;
29 extern KPSEDLL int isknj(int c);
30 extern KPSEDLL int isknj2(int c);
32 extern KPSEDLL wchar_t* get_wstring_from_mbstring(int cp, const char *mbstr, wchar_t *wstr);
33 extern KPSEDLL char* get_mbstring_from_wstring(int cp, const wchar_t *wstr, char *mbstr);
34 extern KPSEDLL FILE* fsyscp_xfopen(const char *filename, const char *mode);
35 extern KPSEDLL FILE* fsyscp_fopen(const char *filename, const char *mode);
36 extern KPSEDLL FILE* fsyscp_popen(const char *command, const char *mode);
37 extern KPSEDLL int fsyscp_spawnvp(int mode, const char *command, const char* const *argv);
38 extern KPSEDLL int fsyscp_system(const char *cmd);
39 extern KPSEDLL int get_command_line_args_utf8(const char *enc, int *p_ac, char ***p_av);
40 extern KPSEDLL int win32_getc(FILE *fp);
41 extern KPSEDLL int win32_ungetc(int c, FILE *fp);
42 extern KPSEDLL int win32_fputs(const char *str, FILE *fp);
43 extern KPSEDLL int win32_puts(const char *str);
44 extern KPSEDLL int win32_vfprintf(FILE *fp, const char *format, va_list argp);
45 extern KPSEDLL int win32_putc(int c, FILE *fp);
47 #ifdef __cplusplus
49 #endif
51 /* True if P points to a 2-Byte Kanji (CP 932, SJIS) code. */
52 #define IS_KANJI(p) is_cp932_system && isknj(*(p)) && isknj2(*(p+1))
54 /* Get wide string from multibyte string in UTF-8 */
55 #define get_wstring_from_utf8(mb,w) get_wstring_from_mbstring(CP_UTF8,mb,w)
56 /* Get multibyte string in UTF-8 from wide string */
57 #define get_utf8_from_wstring(w,mb) get_mbstring_from_wstring(CP_UTF8,w,mb)
58 /* Get wide string from multibyte string in file system codepage */
59 #define get_wstring_from_fsyscp(mb,w) get_wstring_from_mbstring(file_system_codepage,mb,w)
60 /* Get multibyte string in file system codepage from wide string */
61 #define get_fsyscp_from_wstring(w,mb) get_mbstring_from_wstring(file_system_codepage,w,mb)
63 #endif /* not KPATHSEA_KNJ_H */