*
* nkf.h - Header file for nkf
*
- * $Id: nkf.h,v 1.4 2008/10/22 18:27:57 naruse Exp $
+ * $Id: nkf.h,v 1.6 2008/11/07 02:43:43 naruse Exp $
*/
#ifndef NKF_H
+#define NKF_H
/* Wrapper of configurations */
#endif
#if DEFAULT_NEWLINE == 0x0D0A
-#define PUT_NEWLINE(func) do {\
- func(0x0D);\
- func(0x0A);\
-} while (0)
-#define OCONV_NEWLINE(func) do {\
- func(0, 0x0D);\
- func(0, 0x0A);\
-} while (0)
#elif DEFAULT_NEWLINE == 0x0D
-#define PUT_NEWLINE(func) func(0x0D)
-#define OCONV_NEWLINE(func) func(0, 0x0D)
#else
#define DEFAULT_NEWLINE 0x0A
-#define PUT_NEWLINE(func) func(0x0A)
-#define OCONV_NEWLINE(func) func(0, 0x0A)
#endif
#ifdef HELP_OUTPUT_STDERR
#define HELP_OUTPUT stderr
#define NKF_INT32_C(n) (n)
#endif
-#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(LSI_C) || defined(__MINGW32__) || defined(__EMX__) || defined(__MSDOS__) || defined(__WINDOWS__) || defined(__DOS__) || defined(__OS2__)) && !defined(MSDOS)
+#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)
#define MSDOS
#if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)
#define __WIN32__
#define setbinmode(fp) setmode(fileno(fp), O_BINARY)
#endif
#else /* UNIX */
-#define setbinmode(fp)
+#define setbinmode(fp) (void)(fp)
#endif
#ifdef _IOFBF /* SysV and MSDOS, Windows */
#endif
#endif
+#if !defined(DEFAULT_CODE_JIS) && !defined(DEFAULT_CODE_SJIS) && \
+ !defined(DEFAULT_CODE_WINDOWS_31J) && !defined(DEFAULT_CODE_EUC) && \
+ !defined(DEFAULT_CODE_UTF8) && !defined(DEFAULT_CODE_LOCALE)
+#define DEFAULT_CODE_LOCALE
+#endif
+
#ifdef DEFAULT_CODE_LOCALE
-#ifndef __WIN32__ /* not win32 should be posix */
-#ifndef HAVE_LANGINFO_H
-#define HAVE_LANGINFO_H
-#endif
-#ifndef HAVE_LOCALE_H
-#define HAVE_LOCALE_H
-#endif
+#if defined(__WIN32__) /* not win32 should be posix */
+# ifndef HAVE_LOCALE_H
+# define HAVE_LOCALE_H
+# endif
+#elif defined(__OS2__)
+# undef HAVE_LANGINFO_H /* We do not use kLIBC's langinfo. */
+# ifndef HAVE_LOCALE_H
+# define HAVE_LOCALE_H
+# endif
+#elif defined(MSDOS)
+# ifndef HAVE_LOCALE_H
+# define HAVE_LOCALE_H
+# endif
+#else
+# ifndef HAVE_LANGINFO_H
+# define HAVE_LANGINFO_H
+# endif
+# ifndef HAVE_LOCALE_H
+# define HAVE_LOCALE_H
+# endif
#endif
#ifdef HAVE_LANGINFO_H