ext/nkf/nkf-utf8/nkf.h

Go to the documentation of this file.
00001 /*
00002  *
00003  * nkf.h - Header file for nkf
00004  *
00005  * $Id: nkf.h 27437 2010-04-22 08:04:13Z nobu $
00006  */
00007 
00008 #ifndef NKF_H
00009 
00010 /* Wrapper of configurations */
00011 
00012 #ifndef MIME_DECODE_DEFAULT
00013 #define MIME_DECODE_DEFAULT STRICT_MIME
00014 #endif
00015 #ifndef X0201_DEFAULT
00016 #define X0201_DEFAULT TRUE
00017 #endif
00018 
00019 #if DEFAULT_NEWLINE == 0x0D0A
00020 #define PUT_NEWLINE(func) do {\
00021     func(0x0D);\
00022     func(0x0A);\
00023 } while (0)
00024 #define OCONV_NEWLINE(func) do {\
00025     func(0, 0x0D);\
00026     func(0, 0x0A);\
00027 } while (0)
00028 #elif DEFAULT_NEWLINE == 0x0D
00029 #define PUT_NEWLINE(func) func(0x0D)
00030 #define OCONV_NEWLINE(func) func(0, 0x0D)
00031 #else
00032 #define DEFAULT_NEWLINE 0x0A
00033 #define PUT_NEWLINE(func) func(0x0A)
00034 #define OCONV_NEWLINE(func) func(0, 0x0A)
00035 #endif
00036 #ifdef HELP_OUTPUT_STDERR
00037 #define HELP_OUTPUT stderr
00038 #else
00039 #define HELP_OUTPUT stdout
00040 #endif
00041 
00042 
00043 /* Compatibility definitions */
00044 
00045 #ifdef nkf_char
00046 #elif defined(INT_IS_SHORT)
00047 typedef long nkf_char;
00048 #define NKF_INT32_C(n)   (n##L)
00049 #else
00050 typedef int nkf_char;
00051 #define NKF_INT32_C(n)   (n)
00052 #endif
00053 
00054 #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)
00055 #define MSDOS
00056 #if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)
00057 #define __WIN32__
00058 #endif
00059 #endif
00060 
00061 #ifdef PERL_XS
00062 #undef OVERWRITE
00063 #endif
00064 
00065 #ifndef PERL_XS
00066 #include <stdio.h>
00067 #endif
00068 
00069 #include <stdlib.h>
00070 #include <string.h>
00071 
00072 #if defined(MSDOS) || defined(__OS2__)
00073 #include <fcntl.h>
00074 #include <io.h>
00075 #if defined(_MSC_VER) || defined(__WATCOMC__)
00076 #define mktemp _mktemp
00077 #endif
00078 #endif
00079 
00080 #ifdef MSDOS
00081 #ifdef LSI_C
00082 #define setbinmode(fp) fsetbin(fp)
00083 #elif defined(__DJGPP__)
00084 #include <libc/dosio.h>
00085 void  setbinmode(FILE *fp)
00086 {
00087     /* we do not use libc's setmode(), which changes COOKED/RAW mode in device. */
00088     int fd, m;
00089     fd = fileno(fp);
00090     m = (__file_handle_modes[fd] & (~O_TEXT)) | O_BINARY;
00091     __file_handle_set(fd, m);
00092 }
00093 #else /* Microsoft C, Turbo C */
00094 #define setbinmode(fp) setmode(fileno(fp), O_BINARY)
00095 #endif
00096 #else /* UNIX */
00097 #define setbinmode(fp)
00098 #endif
00099 
00100 #ifdef _IOFBF /* SysV and MSDOS, Windows */
00101 #define       setvbuffer(fp, buf, size)       setvbuf(fp, buf, _IOFBF, size)
00102 #else /* BSD */
00103 #define       setvbuffer(fp, buf, size)       setbuffer(fp, buf, size)
00104 #endif
00105 
00106 /*Borland C++ 4.5 EasyWin*/
00107 #if defined(__TURBOC__) && defined(_Windows) && !defined(__WIN32__) /*Easy Win */
00108 #define         EASYWIN
00109 #ifndef __WIN16__
00110 #define __WIN16__
00111 #endif
00112 #include <windows.h>
00113 #endif
00114 
00115 #ifdef OVERWRITE
00116 /* added by satoru@isoternet.org */
00117 #if defined(__EMX__)
00118 #include <sys/types.h>
00119 #endif
00120 #include <sys/stat.h>
00121 #if !defined(MSDOS) || defined(__DJGPP__) /* UNIX, djgpp */
00122 #include <unistd.h>
00123 #if defined(__WATCOMC__)
00124 #include <sys/utime.h>
00125 #else
00126 #include <utime.h>
00127 #endif
00128 #else /* defined(MSDOS) */
00129 #ifdef __WIN32__
00130 #ifdef __BORLANDC__ /* BCC32 */
00131 #include <utime.h>
00132 #else /* !defined(__BORLANDC__) */
00133 #include <sys/utime.h>
00134 #endif /* (__BORLANDC__) */
00135 #else /* !defined(__WIN32__) */
00136 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__OS2__) || defined(__EMX__) || defined(__IBMC__) || defined(__IBMCPP__)  /* VC++, MinGW, Watcom, emx+gcc, IBM VAC++ */
00137 #include <sys/utime.h>
00138 #elif defined(__TURBOC__) /* BCC */
00139 #include <utime.h>
00140 #elif defined(LSI_C) /* LSI C */
00141 #endif /* (__WIN32__) */
00142 #endif
00143 #endif
00144 #endif
00145 
00146 #if !defined(DEFAULT_CODE_JIS) && !defined(DEFAULT_CODE_SJIS) && \
00147         !defined(DEFAULT_CODE_WINDOWS_31J) && !defined(DEFAULT_CODE_EUC) && \
00148         !defined(DEFAULT_CODE_UTF8) && !defined(DEFAULT_CODE_LOCALE)
00149 #define DEFAULT_CODE_LOCALE
00150 #endif
00151 
00152 #ifdef DEFAULT_CODE_LOCALE
00153 
00154 #if defined(__WIN32__) /* not win32 should be posix */
00155 # ifndef HAVE_LOCALE_H
00156 #  define HAVE_LOCALE_H
00157 # endif
00158 #elif defined(__OS2__)
00159 # undef HAVE_LANGINFO_H /* We do not use kLIBC's langinfo. */
00160 # ifndef HAVE_LOCALE_H
00161 #  define HAVE_LOCALE_H
00162 # endif
00163 #elif defined(MSDOS)
00164 # ifndef HAVE_LOCALE_H
00165 #  define HAVE_LOCALE_H
00166 # endif
00167 #else
00168 # ifndef HAVE_LANGINFO_H
00169 #  define HAVE_LANGINFO_H
00170 # endif
00171 # ifndef HAVE_LOCALE_H
00172 #  define HAVE_LOCALE_H
00173 # endif
00174 #endif
00175 
00176 #ifdef HAVE_LANGINFO_H
00177 #include <langinfo.h>
00178 #endif
00179 #ifdef HAVE_LOCALE_H
00180 #include <locale.h>
00181 #endif
00182 
00183 #endif /* DEFAULT_CODE_LOCALE */
00184 
00185 #define         FALSE   0
00186 #define         TRUE    1
00187 
00188 #ifdef WIN32DLL
00189 #include "nkf32.h"
00190 #endif
00191 
00192 #endif /* NKF_H */
00193 

Generated on Wed Aug 10 09:17:00 2011 for Ruby by  doxygen 1.4.7