Ruby
1.9.3p448(2013-06-27revision41675)
Main Page
Modules
Data Structures
Files
File List
Globals
ext
nkf
nkf-utf8
nkf.h
Go to the documentation of this file.
1
/*
2
*
3
* nkf.h - Header file for nkf
4
*
5
* $Id: nkf.h 27437 2010-04-22 08:04:13Z nobu $
6
*/
7
8
#ifndef 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
#define PUT_NEWLINE(func) do {\
21
func(0x0D);\
22
func(0x0A);\
23
} while (0)
24
#define OCONV_NEWLINE(func) do {\
25
func(0, 0x0D);\
26
func(0, 0x0A);\
27
} while (0)
28
#elif DEFAULT_NEWLINE == 0x0D
29
#define PUT_NEWLINE(func) func(0x0D)
30
#define OCONV_NEWLINE(func) func(0, 0x0D)
31
#else
32
#define DEFAULT_NEWLINE 0x0A
33
#define PUT_NEWLINE(func) func(0x0A)
34
#define OCONV_NEWLINE(func) func(0, 0x0A)
35
#endif
36
#ifdef HELP_OUTPUT_STDERR
37
#define HELP_OUTPUT stderr
38
#else
39
#define HELP_OUTPUT stdout
40
#endif
41
42
43
/* Compatibility definitions */
44
45
#ifdef nkf_char
46
#elif defined(INT_IS_SHORT)
47
typedef
long
nkf_char
;
48
#define NKF_INT32_C(n) (n##L)
49
#else
50
typedef
int
nkf_char
;
51
#define NKF_INT32_C(n) (n)
52
#endif
53
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)
55
#define MSDOS
56
#if (defined(__Win32__) || defined(_WIN32)) && !defined(__WIN32__)
57
#define __WIN32__
58
#endif
59
#endif
60
61
#ifdef PERL_XS
62
#undef OVERWRITE
63
#endif
64
65
#ifndef PERL_XS
66
#include <stdio.h>
67
#endif
68
69
#include <stdlib.h>
70
#include <string.h>
71
72
#if defined(MSDOS) || defined(__OS2__)
73
#include <fcntl.h>
74
#include <
io.h
>
75
#if defined(_MSC_VER) || defined(__WATCOMC__)
76
#define mktemp _mktemp
77
#endif
78
#endif
79
80
#ifdef MSDOS
81
#ifdef LSI_C
82
#define setbinmode(fp) fsetbin(fp)
83
#elif defined(__DJGPP__)
84
#include <libc/dosio.h>
85
void
setbinmode
(
FILE
*fp)
86
{
87
/* we do not use libc's setmode(), which changes COOKED/RAW mode in device. */
88
int
fd, m;
89
fd =
fileno
(fp);
90
m = (__file_handle_modes[fd] & (~O_TEXT)) |
O_BINARY
;
91
__file_handle_set(fd, m);
92
}
93
#else
/* Microsoft C, Turbo C */
94
#define setbinmode(fp) setmode(fileno(fp), O_BINARY)
95
#endif
96
#else
/* UNIX */
97
#define setbinmode(fp)
98
#endif
99
100
#ifdef _IOFBF
/* SysV and MSDOS, Windows */
101
#define setvbuffer(fp, buf, size) setvbuf(fp, buf, _IOFBF, size)
102
#else
/* BSD */
103
#define setvbuffer(fp, buf, size) setbuffer(fp, buf, size)
104
#endif
105
106
/*Borland C++ 4.5 EasyWin*/
107
#if defined(__TURBOC__) && defined(_Windows) && !defined(__WIN32__)
/*Easy Win */
108
#define EASYWIN
109
#ifndef __WIN16__
110
#define __WIN16__
111
#endif
112
#include <windows.h>
113
#endif
114
115
#ifdef OVERWRITE
116
/* added by satoru@isoternet.org */
117
#if defined(__EMX__)
118
#include <sys/types.h>
119
#endif
120
#include <sys/stat.h>
121
#if !defined(MSDOS) || defined(__DJGPP__)
/* UNIX, djgpp */
122
#include <unistd.h>
123
#if defined(__WATCOMC__)
124
#include <sys/utime.h>
125
#else
126
#include <utime.h>
127
#endif
128
#else
/* defined(MSDOS) */
129
#ifdef __WIN32__
130
#ifdef __BORLANDC__
/* BCC32 */
131
#include <utime.h>
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 */
139
#include <utime.h>
140
#elif defined(LSI_C)
/* LSI C */
141
#endif
/* (__WIN32__) */
142
#endif
143
#endif
144
#endif
145
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
150
#endif
151
152
#ifdef DEFAULT_CODE_LOCALE
153
154
#if defined(__WIN32__)
/* not win32 should be posix */
155
# ifndef HAVE_LOCALE_H
156
# define HAVE_LOCALE_H
157
# endif
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
162
# endif
163
#elif defined(MSDOS)
164
# ifndef HAVE_LOCALE_H
165
# define HAVE_LOCALE_H
166
# endif
167
#else
168
# ifndef HAVE_LANGINFO_H
169
# define HAVE_LANGINFO_H
170
# endif
171
# ifndef HAVE_LOCALE_H
172
# define HAVE_LOCALE_H
173
# endif
174
#endif
175
176
#ifdef HAVE_LANGINFO_H
177
#include <langinfo.h>
178
#endif
179
#ifdef HAVE_LOCALE_H
180
#include <locale.h>
181
#endif
182
183
#endif
/* DEFAULT_CODE_LOCALE */
184
185
#define FALSE 0
186
#define TRUE 1
187
188
#ifdef WIN32DLL
189
#include "nkf32.h"
190
#endif
191
192
#endif
/* NKF_H */
193
Generated on Fri Jun 28 2013 02:34:34 for Ruby by
1.8.3