OSDN Git Service

Show "(BOM)" if the byte sequence has BOM.
[nkf/nkf.git] / nkf.h
diff --git a/nkf.h b/nkf.h
index f6005a1..7f41361 100755 (executable)
--- a/nkf.h
+++ b/nkf.h
@@ -2,10 +2,11 @@
  * 
  * nkf.h - Header file for nkf
  * 
  * 
  * 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
  */
 
 #ifndef NKF_H
+#define NKF_H
 
 /* Wrapper of configurations */
 
 
 /* Wrapper of configurations */
 
 #endif
 
 #if DEFAULT_NEWLINE == 0x0D0A
 #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
 #elif DEFAULT_NEWLINE == 0x0D
-#define PUT_NEWLINE(func) func(0x0D)
-#define OCONV_NEWLINE(func) func(0, 0x0D)
 #else
 #define DEFAULT_NEWLINE 0x0A
 #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
 #endif
 #ifdef HELP_OUTPUT_STDERR
 #define HELP_OUTPUT stderr
@@ -51,7 +40,7 @@ typedef int nkf_char;
 #define NKF_INT32_C(n)   (n)
 #endif
 
 #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 MSDOS
 #if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)
 #define __WIN32__
@@ -94,7 +83,7 @@ void  setbinmode(FILE *fp)
 #define setbinmode(fp) setmode(fileno(fp), O_BINARY)
 #endif
 #else /* UNIX */
 #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
 
 #ifdef _IOFBF /* SysV and MSDOS, Windows */
@@ -143,15 +132,34 @@ void  setbinmode(FILE *fp)
 #endif
 #endif
 
 #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
 
 #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
 #endif
 
 #ifdef HAVE_LANGINFO_H