| 1 |
/* knj.h: check for 2-Byte Kanji (CP 932, SJIS) codes. |
| 2 |
|
| 3 |
Copyright 2010, 2014, 2016 Akira Kakuto. |
| 4 |
Copyright 2013, 2014, 2020 TANAKA Takuji. |
| 5 |
|
| 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. |
| 10 |
|
| 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. |
| 15 |
|
| 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/>. */ |
| 18 |
|
| 19 |
#ifndef KPATHSEA_KNJ_H |
| 20 |
#define KPATHSEA_KNJ_H |
| 21 |
|
| 22 |
#ifdef __cplusplus |
| 23 |
extern "C" { |
| 24 |
#endif |
| 25 |
|
| 26 |
extern KPSEDLL wchar_t* get_wstring_from_mbstring(int cp, const char *mbstr, wchar_t *wstr); |
| 27 |
extern KPSEDLL char* get_mbstring_from_wstring(int cp, const wchar_t *wstr, char *mbstr); |
| 28 |
extern KPSEDLL int kpathsea_isknj(kpathsea kpse, int c); |
| 29 |
extern KPSEDLL int kpathsea_isknj2(kpathsea kpse, int c); |
| 30 |
extern KPSEDLL FILE* kpathsea_fsyscp_xfopen(kpathsea kpse, const char *filename, const char *mode); |
| 31 |
extern KPSEDLL FILE* kpathsea_fsyscp_fopen(kpathsea kpse, const char *filename, const char *mode); |
| 32 |
extern KPSEDLL FILE* kpathsea_fsyscp_popen(kpathsea kpse, const char *command, const char *mode); |
| 33 |
extern KPSEDLL int kpathsea_fsyscp_spawnvp(kpathsea kpse, int mode, const char *command, const char* const *argv); |
| 34 |
extern KPSEDLL int kpathsea_fsyscp_system(kpathsea kpse, const char *cmd); |
| 35 |
extern KPSEDLL int kpathsea_get_command_line_args_utf8(kpathsea kpse, const char *enc, int *p_ac, char ***p_av); |
| 36 |
extern KPSEDLL int kpathsea_win32_getc(kpathsea kpse, FILE *fp); |
| 37 |
extern KPSEDLL int kpathsea_win32_ungetc(kpathsea kpse, int c, FILE *fp); |
| 38 |
extern KPSEDLL int kpathsea_win32_fputs(kpathsea kpse, const char *str, FILE *fp); |
| 39 |
extern KPSEDLL int kpathsea_win32_puts(kpathsea kpse, const char *str); |
| 40 |
extern KPSEDLL int kpathsea_win32_vfprintf(kpathsea kpse, FILE *fp, const char *format, va_list argp); |
| 41 |
extern KPSEDLL int kpathsea_win32_fprintf(kpathsea kpse, FILE *fp, const char *format, ...); |
| 42 |
extern KPSEDLL int kpathsea_win32_putc(kpathsea kpse, int c, FILE *fp); |
| 43 |
extern KPSEDLL void kpathsea_win32_perror(kpathsea kpse, const char *str); |
| 44 |
extern KPSEDLL int kpathsea_IS_KANJI(kpathsea kpse, const char *p); |
| 45 |
extern KPSEDLL char *kpathsea_get_fsyscp_from_wstring(kpathsea kpse, const wchar_t *w,char *mb); |
| 46 |
extern KPSEDLL wchar_t *kpathsea_get_wstring_from_fsyscp(kpathsea kpse, const char *mb,wchar_t *w); |
| 47 |
|
| 48 |
#if defined (KPSE_COMPAT_API) |
| 49 |
#define is_cp932_system kpse_def->Is_cp932_system |
| 50 |
#define file_system_codepage kpse_def->File_system_codepage |
| 51 |
#define win32_codepage kpse_def->Win32_codepage |
| 52 |
|
| 53 |
extern KPSEDLL int isknj(int c); |
| 54 |
extern KPSEDLL int isknj2(int c); |
| 55 |
extern KPSEDLL FILE* fsyscp_xfopen(const char *filename, const char *mode); |
| 56 |
extern KPSEDLL FILE* fsyscp_fopen(const char *filename, const char *mode); |
| 57 |
extern KPSEDLL FILE* fsyscp_popen(const char *command, const char *mode); |
| 58 |
extern KPSEDLL int fsyscp_spawnvp(int mode, const char *command, const char* const *argv); |
| 59 |
extern KPSEDLL int fsyscp_system(const char *cmd); |
| 60 |
extern KPSEDLL int get_command_line_args_utf8(const char *enc, int *p_ac, char ***p_av); |
| 61 |
extern KPSEDLL int win32_getc(FILE *fp); |
| 62 |
extern KPSEDLL int win32_ungetc(int c, FILE *fp); |
| 63 |
extern KPSEDLL int win32_fputs(const char *str, FILE *fp); |
| 64 |
extern KPSEDLL int win32_puts(const char *str); |
| 65 |
extern KPSEDLL int win32_vfprintf(FILE *fp, const char *format, va_list argp); |
| 66 |
extern KPSEDLL int win32_fprintf(FILE *fp, const char *format, ...); |
| 67 |
extern KPSEDLL int win32_putc(int c, FILE *fp); |
| 68 |
extern KPSEDLL void win32_perror(const char *str); |
| 69 |
extern KPSEDLL int IS_KANJI(const char *p); |
| 70 |
extern KPSEDLL char *get_fsyscp_from_wstring(const wchar_t *w,char *mb); |
| 71 |
extern KPSEDLL wchar_t *get_wstring_from_fsyscp(const char *mb,wchar_t *w); |
| 72 |
#endif |
| 73 |
#ifdef __cplusplus |
| 74 |
} |
| 75 |
#endif |
| 76 |
|
| 77 |
/* Get wide string from multibyte string in UTF-8 */ |
| 78 |
#define get_wstring_from_utf8(mb,w) get_wstring_from_mbstring(CP_UTF8,mb,w) |
| 79 |
/* Get multibyte string in UTF-8 from wide string */ |
| 80 |
#define get_utf8_from_wstring(w,mb) get_mbstring_from_wstring(CP_UTF8,w,mb) |
| 81 |
|
| 82 |
#endif /* not KPATHSEA_KNJ_H */ |