Ruby  2.5.0dev(2017-10-22revision60238)
nkf.h
Go to the documentation of this file.
1 /*
2  *
3  * nkf.h - Header file for nkf
4  *
5  */
6 
7 #ifndef NKF_H
8 #define NKF_H
9 
10 /* Wrapper of configurations */
11 
12 #ifndef MIME_DECODE_DEFAULT
13 #define MIME_DECODE_DEFAULT STRICT_MIME
14 #endif
15 #ifndef X0201_DEFAULT
16 #define X0201_DEFAULT TRUE
17 #endif
18 
19 #if DEFAULT_NEWLINE == 0x0D0A
20 #elif DEFAULT_NEWLINE == 0x0D
21 #else
22 #define DEFAULT_NEWLINE 0x0A
23 #endif
24 #ifdef HELP_OUTPUT_STDERR
25 #define HELP_OUTPUT stderr
26 #else
27 #define HELP_OUTPUT stdout
28 #endif
29 
30 
31 /* Compatibility definitions */
32 
33 #ifdef nkf_char
34 #elif defined(INT_IS_SHORT)
35 typedef long nkf_char;
36 #define NKF_INT32_C(n) (n##L)
37 #else
38 typedef int nkf_char;
39 #define NKF_INT32_C(n) (n)
40 #endif
41 
42 #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)
43 #define MSDOS
44 #if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)
45 #define __WIN32__
46 #endif
47 #endif
48 
49 #ifdef PERL_XS
50 #undef OVERWRITE
51 #endif
52 
53 #ifndef PERL_XS
54 #include <stdio.h>
55 #endif
56 
57 #include <stdlib.h>
58 #include <string.h>
59 
60 #if defined(MSDOS) || defined(__OS2__)
61 #include <fcntl.h>
62 #include <io.h>
63 #if defined(_MSC_VER) || defined(__WATCOMC__)
64 #define mktemp _mktemp
65 #endif
66 #endif
67 
68 #ifdef MSDOS
69 #ifdef LSI_C
70 #define setbinmode(fp) fsetbin(fp)
71 #elif defined(__DJGPP__)
72 #include <libc/dosio.h>
73 void setbinmode(FILE *fp)
74 {
75  /* we do not use libc's setmode(), which changes COOKED/RAW mode in device. */
76  int fd, m;
77  fd = fileno(fp);
78  m = (__file_handle_modes[fd] & (~O_TEXT)) | O_BINARY;
79  __file_handle_set(fd, m);
80 }
81 #else /* Microsoft C, Turbo C */
82 #define setbinmode(fp) setmode(fileno(fp), O_BINARY)
83 #endif
84 #else /* UNIX */
85 #define setbinmode(fp) (void)(fp)
86 #endif
87 
88 #ifdef _IOFBF /* SysV and MSDOS, Windows */
89 #define setvbuffer(fp, buf, size) setvbuf(fp, buf, _IOFBF, size)
90 #else /* BSD */
91 #define setvbuffer(fp, buf, size) setbuffer(fp, buf, size)
92 #endif
93 
94 /*Borland C++ 4.5 EasyWin*/
95 #if defined(__TURBOC__) && defined(_Windows) && !defined(__WIN32__) /*Easy Win */
96 #define EASYWIN
97 #ifndef __WIN16__
98 #define __WIN16__
99 #endif
100 #include <windows.h>
101 #endif
102 
103 #ifdef OVERWRITE
104 /* added by satoru@isoternet.org */
105 #if defined(__EMX__)
106 #include <sys/types.h>
107 #endif
108 #include <sys/stat.h>
109 #if !defined(MSDOS) || defined(__DJGPP__) /* UNIX, djgpp */
110 #include <unistd.h>
111 #if defined(__WATCOMC__)
112 #include <sys/utime.h>
113 #else
114 #include <utime.h>
115 #endif
116 #else /* defined(MSDOS) */
117 #ifdef __WIN32__
118 #ifdef __BORLANDC__ /* BCC32 */
119 #include <utime.h>
120 #else /* !defined(__BORLANDC__) */
121 #include <sys/utime.h>
122 #endif /* (__BORLANDC__) */
123 #else /* !defined(__WIN32__) */
124 #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__WATCOMC__) || defined(__OS2__) || defined(__EMX__) || defined(__IBMC__) || defined(__IBMCPP__) /* VC++, MinGW, Watcom, emx+gcc, IBM VAC++ */
125 #include <sys/utime.h>
126 #elif defined(__TURBOC__) /* BCC */
127 #include <utime.h>
128 #elif defined(LSI_C) /* LSI C */
129 #endif /* (__WIN32__) */
130 #endif
131 #endif
132 #endif
133 
134 #if !defined(DEFAULT_CODE_JIS) && !defined(DEFAULT_CODE_SJIS) && \
135  !defined(DEFAULT_CODE_WINDOWS_31J) && !defined(DEFAULT_CODE_EUC) && \
136  !defined(DEFAULT_CODE_UTF8) && !defined(DEFAULT_CODE_LOCALE)
137 #define DEFAULT_CODE_LOCALE
138 #endif
139 
140 #ifdef DEFAULT_CODE_LOCALE
141 
142 #if defined(__WIN32__) /* not win32 should be posix */
143 # ifndef HAVE_LOCALE_H
144 # define HAVE_LOCALE_H
145 # endif
146 #elif defined(__OS2__)
147 # undef HAVE_LANGINFO_H /* We do not use kLIBC's langinfo. */
148 # ifndef HAVE_LOCALE_H
149 # define HAVE_LOCALE_H
150 # endif
151 #elif defined(MSDOS)
152 # ifndef HAVE_LOCALE_H
153 # define HAVE_LOCALE_H
154 # endif
155 #elif defined(__BIONIC__) /* bionic doesn't have locale */
156 #else
157 # ifndef HAVE_LANGINFO_H
158 # define HAVE_LANGINFO_H
159 # endif
160 # ifndef HAVE_LOCALE_H
161 # define HAVE_LOCALE_H
162 # endif
163 #endif
164 
165 #ifdef HAVE_LANGINFO_H
166 #include <langinfo.h>
167 #endif
168 #ifdef HAVE_LOCALE_H
169 #include <locale.h>
170 #endif
171 
172 #endif /* DEFAULT_CODE_LOCALE */
173 
174 #define FALSE 0
175 #define TRUE 1
176 
177 #ifndef ARG_UNUSED
178 #if defined(__GNUC__)
179 # define ARG_UNUSED __attribute__ ((unused))
180 #else
181 # define ARG_UNUSED
182 #endif
183 #endif
184 
185 #ifdef WIN32DLL
186 #include "nkf32.h"
187 #endif
188 
189 #endif /* NKF_H */
#define setbinmode(fp)
Definition: nkf.h:85
#define fileno(p)
Definition: vsnprintf.c:219
int nkf_char
Definition: nkf.h:38
#define O_BINARY
Definition: _sdbm.c:88