3 * nkf.h - Header file for nkf
5 * $Id: nkf.h,v 1.5 2008/11/07 02:37:21 naruse Exp $
10 /* Wrapper of configurations */
12 #ifndef MIME_DECODE_DEFAULT
13 #define MIME_DECODE_DEFAULT STRICT_MIME
16 #define X0201_DEFAULT TRUE
19 #if DEFAULT_NEWLINE == 0x0D0A
20 #define PUT_NEWLINE(func) do {\
24 #define OCONV_NEWLINE(func) do {\
28 #elif DEFAULT_NEWLINE == 0x0D
29 #define PUT_NEWLINE(func) func(0x0D)
30 #define OCONV_NEWLINE(func) func(0, 0x0D)
32 #define DEFAULT_NEWLINE 0x0A
33 #define PUT_NEWLINE(func) func(0x0A)
34 #define OCONV_NEWLINE(func) func(0, 0x0A)
36 #ifdef HELP_OUTPUT_STDERR
37 #define HELP_OUTPUT stderr
39 #define HELP_OUTPUT stdout
43 /* Compatibility definitions */
46 #elif defined(INT_IS_SHORT)
47 typedef long nkf_char;
48 #define NKF_INT32_C(n) (n##L)
51 #define NKF_INT32_C(n) (n)
54 #if (defined(__TURBOC__) || defined(_MSC_VER) || defined(LSI_C) || (defined(__WATCOMC__) && defined(__386__) && !defined(__LINUX__)) || defined(__MINGW32__) || defined(__EMX__) || defined(__MSDOS__) || defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)) && !defined(MSDOS)
56 #if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)
72 #if defined(MSDOS) || defined(__OS2__)
75 #if defined(_MSC_VER) || defined(__WATCOMC__)
76 #define mktemp _mktemp
82 #define setbinmode(fp) fsetbin(fp)
83 #elif defined(__DJGPP__)
84 #include <libc/dosio.h>
85 void setbinmode(FILE *fp)
87 /* we do not use libc's setmode(), which changes COOKED/RAW mode in device. */
90 m = (__file_handle_modes[fd] & (~O_TEXT)) | O_BINARY;
91 __file_handle_set(fd, m);
93 #else /* Microsoft C, Turbo C */
94 #define setbinmode(fp) setmode(fileno(fp), O_BINARY)
97 #define setbinmode(fp)
100 #ifdef _IOFBF /* SysV and MSDOS, Windows */
101 #define setvbuffer(fp, buf, size) setvbuf(fp, buf, _IOFBF, size)
103 #define setvbuffer(fp, buf, size) setbuffer(fp, buf, size)
106 /*Borland C++ 4.5 EasyWin*/
107 #if defined(__TURBOC__) && defined(_Windows) && !defined(__WIN32__) /*Easy Win */
116 /* added by satoru@isoternet.org */
118 #include <sys/types.h>
120 #include <sys/stat.h>
121 #if !defined(MSDOS) || defined(__DJGPP__) /* UNIX, djgpp */
123 #if defined(__WATCOMC__)
124 #include <sys/utime.h>
128 #else /* defined(MSDOS) */
130 #ifdef __BORLANDC__ /* BCC32 */
132 #else /* !defined(__BORLANDC__) */
133 #include <sys/utime.h>
134 #endif /* (__BORLANDC__) */
135 #else /* !defined(__WIN32__) */
136 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__OS2__) || defined(__EMX__) || defined(__IBMC__) || defined(__IBMCPP__) /* VC++, MinGW, Watcom, emx+gcc, IBM VAC++ */
137 #include <sys/utime.h>
138 #elif defined(__TURBOC__) /* BCC */
140 #elif defined(LSI_C) /* LSI C */
141 #endif /* (__WIN32__) */
146 #if !defined(DEFAULT_CODE_JIS) && !defined(DEFAULT_CODE_SJIS) && \
147 !defined(DEFAULT_CODE_WINDOWS_31J) && !defined(DEFAULT_CODE_EUC) && \
148 !defined(DEFAULT_CODE_UTF8) && !defined(DEFAULT_CODE_LOCALE)
149 #define DEFAULT_CODE_LOCALE
152 #ifdef DEFAULT_CODE_LOCALE
154 #if defined(__WIN32__) /* not win32 should be posix */
155 # ifndef HAVE_LOCALE_H
156 # define HAVE_LOCALE_H
158 #elif defined(__OS2__)
159 # undef HAVE_LANGINFO_H /* We do not use kLIBC's langinfo. */
160 # ifndef HAVE_LOCALE_H
161 # define HAVE_LOCALE_H
164 # ifndef HAVE_LOCALE_H
165 # define HAVE_LOCALE_H
168 # ifndef HAVE_LANGINFO_H
169 # define HAVE_LANGINFO_H
171 # ifndef HAVE_LOCALE_H
172 # define HAVE_LOCALE_H
177 #ifdef HAVE_LANGINFO_H
178 #include <langinfo.h>
184 #endif /* DEFAULT_CODE_LOCALE */