Ruby  2.5.0dev(2017-10-22revision60238)
Data Structures | Macros | Enumerations | Functions | Variables
nkf.c File Reference
#include "config.h"
#include "nkf.h"
#include "utf8tbl.h"
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  nkf_native_encoding
 
struct  nkf_encoding
 
struct  input_code
 
struct  nkf_buf_t
 
struct  nkf_state_t
 

Macros

#define NKF_VERSION   "2.1.4"
 
#define NKF_RELEASE_DATE   "2015-12-12"
 
#define COPY_RIGHT
 
#define FIXED_MIME   7
 
#define STRICT_MIME   8
 
#define BS   0x08
 
#define TAB   0x09
 
#define LF   0x0a
 
#define CR   0x0d
 
#define ESC   0x1b
 
#define SP   0x20
 
#define DEL   0x7f
 
#define SI   0x0f
 
#define SO   0x0e
 
#define SS2   0x8e
 
#define SS3   0x8f
 
#define CRLF   0x0D0A
 
#define is_alnum(c)   (('a'<=c && c<='z')||('A'<= c && c<='Z')||('0'<=c && c<='9'))
 
#define nkf_toupper(c)   (('a'<=c && c<='z')?(c-('a'-'A')):c)
 
#define nkf_isoctal(c)   ('0'<=c && c<='7')
 
#define nkf_isdigit(c)   ('0'<=c && c<='9')
 
#define nkf_isxdigit(c)   (nkf_isdigit(c) || ('a'<=c && c<='f') || ('A'<=c && c <= 'F'))
 
#define nkf_isblank(c)   (c == SP || c == TAB)
 
#define nkf_isspace(c)   (nkf_isblank(c) || c == CR || c == LF)
 
#define nkf_isalpha(c)   (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))
 
#define nkf_isalnum(c)   (nkf_isdigit(c) || nkf_isalpha(c))
 
#define nkf_isprint(c)   (SP<=c && c<='~')
 
#define nkf_isgraph(c)   ('!'<=c && c<='~')
 
#define hex2bin(c)
 
#define bin2hex(c)   ("0123456789ABCDEF"[c&15])
 
#define is_eucg3(c2)   (((unsigned short)c2 >> 8) == SS3)
 
#define nkf_noescape_mime(c)
 
#define is_ibmext_in_sjis(c2)   (CP932_TABLE_BEGIN <= c2 && c2 <= CP932_TABLE_END)
 
#define nkf_byte_jisx0201_katakana_p(c)   (SP <= c && c <= 0x5F)
 
#define HOLD_SIZE   1024
 
#define IOBUF_SIZE   16384
 
#define DEFAULT_J   'B'
 
#define DEFAULT_R   'B'
 
#define GETA1   0x22
 
#define GETA2   0x2e
 
#define UCS_MAP_ASCII   0
 
#define UCS_MAP_MS   1
 
#define UCS_MAP_CP932   2
 
#define UCS_MAP_CP10001   3
 
#define NKF_UNSPECIFIED   (-TRUE)
 
#define PREFIX_EUCG3   NKF_INT32_C(0x8F00)
 
#define CLASS_MASK   NKF_INT32_C(0xFF000000)
 
#define CLASS_UNICODE   NKF_INT32_C(0x01000000)
 
#define VALUE_MASK   NKF_INT32_C(0x00FFFFFF)
 
#define UNICODE_BMP_MAX   NKF_INT32_C(0x0000FFFF)
 
#define UNICODE_MAX   NKF_INT32_C(0x0010FFFF)
 
#define nkf_char_euc3_new(c)   ((c) | PREFIX_EUCG3)
 
#define nkf_char_unicode_new(c)   ((c) | CLASS_UNICODE)
 
#define nkf_char_unicode_p(c)   ((c & CLASS_MASK) == CLASS_UNICODE)
 
#define nkf_char_unicode_bmp_p(c)   ((c & VALUE_MASK) <= UNICODE_BMP_MAX)
 
#define nkf_char_unicode_value_p(c)   ((c & VALUE_MASK) <= UNICODE_MAX)
 
#define UTF16_TO_UTF32(lead, trail)   (((lead) << 10) + (trail) - NKF_INT32_C(0x35FDC00))
 
#define FOLD_MARGIN   10
 
#define DEFAULT_FOLD   60
 
#define nkf_xfree(ptr)   free(ptr)
 
#define nkf_enc_name(enc)   (enc)->name
 
#define nkf_enc_to_index(enc)   (enc)->id
 
#define nkf_enc_to_base_encoding(enc)   (enc)->base_encoding
 
#define nkf_enc_to_iconv(enc)   nkf_enc_to_base_encoding(enc)->iconv
 
#define nkf_enc_to_oconv(enc)   nkf_enc_to_base_encoding(enc)->oconv
 
#define nkf_enc_asciicompat(enc)
 
#define nkf_enc_unicode_p(enc)
 
#define nkf_enc_cp5022x_p(enc)
 
#define nkf_buf_length(buf)   ((buf)->len)
 
#define nkf_buf_empty_p(buf)   ((buf)->len == 0)
 
#define SJ0162   0x00e1 /* 01 - 62 ku offset */
 
#define SJ6394   0x0161 /* 63 - 94 ku offset */
 
#define X0213_SURROGATE_FIND(tbl, size, euc)
 
#define NKF_ICONV_INVALID_CODE_RANGE   -13
 
#define NKF_ICONV_WAIT_COMBINING_CHAR   -14
 
#define NKF_ICONV_NOT_COMBINED   -15
 
#define NKF_ICONV_NEED_ONE_MORE_BYTE   (size_t)-1
 
#define NKF_ICONV_NEED_TWO_MORE_BYTES   (size_t)-2
 
#define output_ascii_escape_sequence(mode)
 
#define OUTPUT_UTF8(val)
 
#define OUTPUT_UTF16_BYTES(c1, c2)
 
#define OUTPUT_UTF16(val)
 
#define OUTPUT_UTF32(c)
 
#define SCORE_L2   (1) /* Kanji Level 2 */
 
#define SCORE_KANA   (SCORE_L2 << 1) /* Halfwidth Katakana */
 
#define SCORE_DEPEND   (SCORE_KANA << 1) /* MD Characters */
 
#define SCORE_CP932   (SCORE_DEPEND << 1) /* IBM extended characters */
 
#define SCORE_X0212   (SCORE_CP932 << 1) /* JIS X 0212 */
 
#define SCORE_X0213   (SCORE_X0212 << 1) /* JIS X 0213 */
 
#define SCORE_NO_EXIST   (SCORE_X0213 << 1) /* Undefined Characters */
 
#define SCORE_iMIME   (SCORE_NO_EXIST << 1) /* MIME selected */
 
#define SCORE_ERROR   (SCORE_iMIME << 1) /* Error */
 
#define SCORE_INIT   (SCORE_iMIME)
 
#define STD_GC_BUFSIZE   (256)
 
#define char_size(c2, c1)   (c2?2:1)
 
#define rot13(c)
 
#define rot47(c)
 
#define RANGE_NUM_MAX   18
 
#define MIME_BUF_SIZE   (1024) /* 2^n ring buffer */
 
#define MIME_BUF_MASK   (MIME_BUF_SIZE-1)
 
#define mime_input_buf(n)   mime_input_state.buf[(n)&MIME_BUF_MASK]
 
#define MAXRECOVER   20
 
#define MIMEOUT_BUF_LENGTH   74
 
#define NEXT   continue /* no output, get next */
 
#define SKIP   c2=0;continue /* no output, get next */
 
#define MORE   c2=c1;continue /* need one more byte */
 
#define SEND   (void)0 /* output c1 and c2, get next */
 
#define LAST   break /* end of loop, go closing */
 
#define set_input_mode(mode)
 

Enumerations

enum  byte_order { ENDIAN_BIG = 1, ENDIAN_LITTLE = 2, ENDIAN_2143 = 3, ENDIAN_3412 = 4 }
 
enum  nkf_encodings {
  ASCII, ISO_8859_1, ISO_2022_JP, CP50220,
  CP50221, CP50222, ISO_2022_JP_1, ISO_2022_JP_3,
  ISO_2022_JP_2004, SHIFT_JIS, WINDOWS_31J, CP10001,
  EUC_JP, EUCJP_NKF, CP51932, EUCJP_MS,
  EUCJP_ASCII, SHIFT_JISX0213, SHIFT_JIS_2004, EUC_JISX0213,
  EUC_JIS_2004, UTF_8, UTF_8N, UTF_8_BOM,
  UTF8_MAC, UTF_16, UTF_16BE, UTF_16BE_BOM,
  UTF_16LE, UTF_16LE_BOM, UTF_32, UTF_32BE,
  UTF_32BE_BOM, UTF_32LE, UTF_32LE_BOM, BINARY,
  NKF_ENCODING_TABLE_SIZE, JIS_X_0201_1976_K = 0x1013, JIS_X_0208 = 0x1168, JIS_X_0212 = 0x1159,
  JIS_X_0213_2 = 0x1229, JIS_X_0213_1 = 0x1233
}
 

Functions

int main (int argc, char **argv)
 

Variables

nkf_native_encoding NkfEncodingASCII = { "ASCII", e_iconv, e_oconv }
 
nkf_native_encoding NkfEncodingISO_2022_JP = { "ISO-2022-JP", e_iconv, j_oconv }
 
nkf_native_encoding NkfEncodingShift_JIS = { "Shift_JIS", s_iconv, s_oconv }
 
nkf_native_encoding NkfEncodingEUC_JP = { "EUC-JP", e_iconv, e_oconv }
 
nkf_native_encoding NkfEncodingUTF_8 = { "UTF-8", w_iconv, w_oconv }
 
nkf_native_encoding NkfEncodingUTF_16 = { "UTF-16", w_iconv16, w_oconv16 }
 
nkf_native_encoding NkfEncodingUTF_32 = { "UTF-32", w_iconv32, w_oconv32 }
 
nkf_encoding nkf_encoding_table []
 
struct {
   const char *   name
 
   const int   id
 
encoding_name_to_id_table []
 
struct input_code input_code_list []
 
nkf_char(* mime_priority_func [])(nkf_char c2, nkf_char c1, nkf_char c0)
 

Macro Definition Documentation

◆ bin2hex

#define bin2hex (   c)    ("0123456789ABCDEF"[c&15])

Definition at line 295 of file nkf.c.

◆ BS

#define BS   0x08

Definition at line 70 of file nkf.c.

◆ char_size

#define char_size (   c2,
  c1 
)    (c2?2:1)

Definition at line 3811 of file nkf.c.

◆ CLASS_MASK

#define CLASS_MASK   NKF_INT32_C(0xFF000000)

Definition at line 423 of file nkf.c.

◆ CLASS_UNICODE

#define CLASS_UNICODE   NKF_INT32_C(0x01000000)

Definition at line 424 of file nkf.c.

◆ COPY_RIGHT

#define COPY_RIGHT
Value:
"Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).\n" \
"Copyright (C) 1996-2015, The nkf Project."

Definition at line 25 of file nkf.c.

◆ CR

#define CR   0x0d

Definition at line 73 of file nkf.c.

◆ CRLF

#define CRLF   0x0D0A

Definition at line 81 of file nkf.c.

◆ DEFAULT_FOLD

#define DEFAULT_FOLD   60

Definition at line 505 of file nkf.c.

◆ DEFAULT_J

#define DEFAULT_J   'B'

Definition at line 311 of file nkf.c.

◆ DEFAULT_R

#define DEFAULT_R   'B'

Definition at line 312 of file nkf.c.

◆ DEL

#define DEL   0x7f

Definition at line 76 of file nkf.c.

◆ ESC

#define ESC   0x1b

Definition at line 74 of file nkf.c.

◆ FIXED_MIME

#define FIXED_MIME   7

Definition at line 57 of file nkf.c.

◆ FOLD_MARGIN

#define FOLD_MARGIN   10

Definition at line 504 of file nkf.c.

◆ GETA1

#define GETA1   0x22

Definition at line 315 of file nkf.c.

◆ GETA2

#define GETA2   0x2e

Definition at line 316 of file nkf.c.

◆ hex2bin

#define hex2bin (   c)
Value:
(('0'<=c&&c<='9') ? (c-'0') : \
('A'<=c&&c<='F') ? (c-'A'+10) : \
('a'<=c&&c<='f') ? (c-'a'+10) : 0)
struct ComplexDateData c
Definition: date_core.c:285

Definition at line 292 of file nkf.c.

◆ HOLD_SIZE

#define HOLD_SIZE   1024

Definition at line 304 of file nkf.c.

◆ IOBUF_SIZE

#define IOBUF_SIZE   16384

Definition at line 308 of file nkf.c.

◆ is_alnum

#define is_alnum (   c)    (('a'<=c && c<='z')||('A'<= c && c<='Z')||('0'<=c && c<='9'))

Definition at line 278 of file nkf.c.

◆ is_eucg3

#define is_eucg3 (   c2)    (((unsigned short)c2 >> 8) == SS3)

Definition at line 296 of file nkf.c.

◆ is_ibmext_in_sjis

#define is_ibmext_in_sjis (   c2)    (CP932_TABLE_BEGIN <= c2 && c2 <= CP932_TABLE_END)

Definition at line 301 of file nkf.c.

◆ LAST

#define LAST   break /* end of loop, go closing */

Definition at line 5825 of file nkf.c.

◆ LF

#define LF   0x0a

Definition at line 72 of file nkf.c.

◆ MAXRECOVER

#define MAXRECOVER   20

Definition at line 4316 of file nkf.c.

◆ MIME_BUF_MASK

#define MIME_BUF_MASK   (MIME_BUF_SIZE-1)

Definition at line 4306 of file nkf.c.

◆ MIME_BUF_SIZE

#define MIME_BUF_SIZE   (1024) /* 2^n ring buffer */

Definition at line 4305 of file nkf.c.

◆ mime_input_buf

#define mime_input_buf (   n)    mime_input_state.buf[(n)&MIME_BUF_MASK]

Definition at line 4307 of file nkf.c.

◆ MIMEOUT_BUF_LENGTH

#define MIMEOUT_BUF_LENGTH   74

Definition at line 5039 of file nkf.c.

◆ MORE

#define MORE   c2=c1;continue /* need one more byte */

Definition at line 5823 of file nkf.c.

◆ NEXT

#define NEXT   continue /* no output, get next */

Definition at line 5821 of file nkf.c.

◆ nkf_buf_empty_p

#define nkf_buf_empty_p (   buf)    ((buf)->len == 0)

Definition at line 860 of file nkf.c.

◆ nkf_buf_length

#define nkf_buf_length (   buf)    ((buf)->len)

Definition at line 859 of file nkf.c.

◆ nkf_byte_jisx0201_katakana_p

#define nkf_byte_jisx0201_katakana_p (   c)    (SP <= c && c <= 0x5F)

Definition at line 302 of file nkf.c.

◆ nkf_char_euc3_new

#define nkf_char_euc3_new (   c)    ((c) | PREFIX_EUCG3)

Definition at line 428 of file nkf.c.

◆ nkf_char_unicode_bmp_p

#define nkf_char_unicode_bmp_p (   c)    ((c & VALUE_MASK) <= UNICODE_BMP_MAX)

Definition at line 431 of file nkf.c.

◆ nkf_char_unicode_new

#define nkf_char_unicode_new (   c)    ((c) | CLASS_UNICODE)

Definition at line 429 of file nkf.c.

◆ nkf_char_unicode_p

#define nkf_char_unicode_p (   c)    ((c & CLASS_MASK) == CLASS_UNICODE)

Definition at line 430 of file nkf.c.

◆ nkf_char_unicode_value_p

#define nkf_char_unicode_value_p (   c)    ((c & VALUE_MASK) <= UNICODE_MAX)

Definition at line 432 of file nkf.c.

◆ nkf_enc_asciicompat

#define nkf_enc_asciicompat (   enc)
Value:
(\
nkf_enc_to_base_encoding(enc) == &NkfEncodingASCII ||\
nkf_enc_to_base_encoding(enc) == &NkfEncodingISO_2022_JP)
nkf_native_encoding NkfEncodingASCII
Definition: nkf.c:153
nkf_native_encoding NkfEncodingISO_2022_JP
Definition: nkf.c:154

Definition at line 763 of file nkf.c.

◆ nkf_enc_cp5022x_p

#define nkf_enc_cp5022x_p (   enc)
Value:
(\
nkf_enc_to_index(enc) == CP50220 ||\
nkf_enc_to_index(enc) == CP50221 ||\
nkf_enc_to_index(enc) == CP50222)
Definition: nkf.c:90
Definition: nkf.c:91
Definition: nkf.c:92

Definition at line 770 of file nkf.c.

◆ nkf_enc_name

#define nkf_enc_name (   enc)    (enc)->name

Definition at line 758 of file nkf.c.

◆ nkf_enc_to_base_encoding

#define nkf_enc_to_base_encoding (   enc)    (enc)->base_encoding

Definition at line 760 of file nkf.c.

◆ nkf_enc_to_iconv

#define nkf_enc_to_iconv (   enc)    nkf_enc_to_base_encoding(enc)->iconv

Definition at line 761 of file nkf.c.

◆ nkf_enc_to_index

#define nkf_enc_to_index (   enc)    (enc)->id

Definition at line 759 of file nkf.c.

◆ nkf_enc_to_oconv

#define nkf_enc_to_oconv (   enc)    nkf_enc_to_base_encoding(enc)->oconv

Definition at line 762 of file nkf.c.

◆ nkf_enc_unicode_p

#define nkf_enc_unicode_p (   enc)
Value:
(\
nkf_enc_to_base_encoding(enc) == &NkfEncodingUTF_8 ||\
nkf_enc_to_base_encoding(enc) == &NkfEncodingUTF_16 ||\
nkf_enc_to_base_encoding(enc) == &NkfEncodingUTF_32)
nkf_native_encoding NkfEncodingUTF_32
Definition: nkf.c:159
nkf_native_encoding NkfEncodingUTF_16
Definition: nkf.c:158
nkf_native_encoding NkfEncodingUTF_8
Definition: nkf.c:157

Definition at line 766 of file nkf.c.

◆ NKF_ICONV_INVALID_CODE_RANGE

#define NKF_ICONV_INVALID_CODE_RANGE   -13

Definition at line 2319 of file nkf.c.

◆ NKF_ICONV_NEED_ONE_MORE_BYTE

#define NKF_ICONV_NEED_ONE_MORE_BYTE   (size_t)-1

Definition at line 2391 of file nkf.c.

◆ NKF_ICONV_NEED_TWO_MORE_BYTES

#define NKF_ICONV_NEED_TWO_MORE_BYTES   (size_t)-2

Definition at line 2392 of file nkf.c.

◆ NKF_ICONV_NOT_COMBINED

#define NKF_ICONV_NOT_COMBINED   -15

Definition at line 2321 of file nkf.c.

◆ NKF_ICONV_WAIT_COMBINING_CHAR

#define NKF_ICONV_WAIT_COMBINING_CHAR   -14

Definition at line 2320 of file nkf.c.

◆ nkf_isalnum

#define nkf_isalnum (   c)    (nkf_isdigit(c) || nkf_isalpha(c))

Definition at line 289 of file nkf.c.

◆ nkf_isalpha

#define nkf_isalpha (   c)    (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z'))

Definition at line 288 of file nkf.c.

◆ nkf_isblank

#define nkf_isblank (   c)    (c == SP || c == TAB)

Definition at line 286 of file nkf.c.

◆ nkf_isdigit

#define nkf_isdigit (   c)    ('0'<=c && c<='9')

Definition at line 284 of file nkf.c.

◆ nkf_isgraph

#define nkf_isgraph (   c)    ('!'<=c && c<='~')

Definition at line 291 of file nkf.c.

◆ nkf_isoctal

#define nkf_isoctal (   c)    ('0'<=c && c<='7')

Definition at line 283 of file nkf.c.

◆ nkf_isprint

#define nkf_isprint (   c)    (SP<=c && c<='~')

Definition at line 290 of file nkf.c.

◆ nkf_isspace

#define nkf_isspace (   c)    (nkf_isblank(c) || c == CR || c == LF)

Definition at line 287 of file nkf.c.

◆ nkf_isxdigit

#define nkf_isxdigit (   c)    (nkf_isdigit(c) || ('a'<=c && c<='f') || ('A'<=c && c <= 'F'))

Definition at line 285 of file nkf.c.

◆ nkf_noescape_mime

#define nkf_noescape_mime (   c)
Value:
((c == CR) || (c == LF) || \
((c > SP) && (c < DEL) && (c != '?') && (c != '=') && (c != '_') \
&& (c != '(') && (c != ')') && (c != '.') && (c != 0x22)))
#define SP
Definition: nkf.c:75
struct ComplexDateData c
Definition: date_core.c:285
#define LF
Definition: nkf.c:72
#define CR
Definition: nkf.c:73
#define DEL
Definition: nkf.c:76

Definition at line 297 of file nkf.c.

◆ NKF_RELEASE_DATE

#define NKF_RELEASE_DATE   "2015-12-12"

Definition at line 24 of file nkf.c.

◆ nkf_toupper

#define nkf_toupper (   c)    (('a'<=c && c<='z')?(c-('a'-'A')):c)

Definition at line 282 of file nkf.c.

◆ NKF_UNSPECIFIED

#define NKF_UNSPECIFIED   (-TRUE)

Definition at line 387 of file nkf.c.

◆ NKF_VERSION

#define NKF_VERSION   "2.1.4"

Definition at line 23 of file nkf.c.

◆ nkf_xfree

#define nkf_xfree (   ptr)    free(ptr)

Definition at line 714 of file nkf.c.

◆ output_ascii_escape_sequence

#define output_ascii_escape_sequence (   mode)
Value:
do { \
if (output_mode != ASCII && output_mode != ISO_8859_1) { \
(*o_putc)(ESC); \
(*o_putc)('('); \
(*o_putc)(ascii_intro); \
output_mode = mode; \
} \
} while (0)
Definition: nkf.c:87
#define ESC
Definition: nkf.c:74
Definition: nkf.c:88

Definition at line 2539 of file nkf.c.

◆ OUTPUT_UTF16

#define OUTPUT_UTF16 (   val)
Value:
do { \
c2 = (val >> 8) & 0xff; \
c1 = val & 0xff; \
OUTPUT_UTF16_BYTES(c1, c2); \
} else { \
val &= VALUE_MASK; \
if (val <= UNICODE_MAX) { \
c2 = (val >> 10) + NKF_INT32_C(0xD7C0); /* high surrogate */ \
c1 = (val & 0x3FF) + NKF_INT32_C(0xDC00); /* low surrogate */ \
OUTPUT_UTF16_BYTES(c2 & 0xff, (c2 >> 8) & 0xff); \
OUTPUT_UTF16_BYTES(c1 & 0xff, (c1 >> 8) & 0xff); \
} \
} \
} while (0)
#define nkf_char_unicode_bmp_p(c)
Definition: nkf.c:431
#define VALUE_MASK
Definition: nkf.c:425
#define UNICODE_MAX
Definition: nkf.c:427
#define val
#define NKF_INT32_C(n)
Definition: nkf.h:39

Definition at line 2845 of file nkf.c.

◆ OUTPUT_UTF16_BYTES

#define OUTPUT_UTF16_BYTES (   c1,
  c2 
)
Value:
do { \
if (output_endian == ENDIAN_LITTLE){ \
(*o_putc)(c1); \
(*o_putc)(c2); \
}else{ \
(*o_putc)(c2); \
(*o_putc)(c1); \
} \
} while (0)

Definition at line 2835 of file nkf.c.

◆ OUTPUT_UTF32

#define OUTPUT_UTF32 (   c)
Value:
do { \
if (output_endian == ENDIAN_LITTLE){ \
(*o_putc)( (c) & 0xFF); \
(*o_putc)(((c) >> 8) & 0xFF); \
(*o_putc)(((c) >> 16) & 0xFF); \
(*o_putc)(0); \
}else{ \
(*o_putc)(0); \
(*o_putc)(((c) >> 16) & 0xFF); \
(*o_putc)(((c) >> 8) & 0xFF); \
(*o_putc)( (c) & 0xFF); \
} \
} while (0)
struct ComplexDateData c
Definition: date_core.c:285

Definition at line 2889 of file nkf.c.

◆ OUTPUT_UTF8

#define OUTPUT_UTF8 (   val)
Value:
do { \
nkf_unicode_to_utf8(val, &c1, &c2, &c3, &c4); \
(*o_putc)(c1); \
if (c2) (*o_putc)(c2); \
if (c3) (*o_putc)(c3); \
if (c4) (*o_putc)(c4); \
} while (0)
#define val

Definition at line 2790 of file nkf.c.

◆ PREFIX_EUCG3

#define PREFIX_EUCG3   NKF_INT32_C(0x8F00)

Definition at line 422 of file nkf.c.

◆ RANGE_NUM_MAX

#define RANGE_NUM_MAX   18

◆ rot13

#define rot13 (   c)
Value:
( \
( c < 'A') ? c: \
(c <= 'M') ? (c + 13): \
(c <= 'Z') ? (c - 13): \
(c < 'a') ? (c): \
(c <= 'm') ? (c + 13): \
(c <= 'z') ? (c - 13): \
(c) \
)
struct ComplexDateData c
Definition: date_core.c:285

Definition at line 4143 of file nkf.c.

◆ rot47

#define rot47 (   c)
Value:
( \
( c < '!') ? c: \
( c <= 'O') ? (c + 47) : \
( c <= '~') ? (c - 47) : \
c \
)
struct ComplexDateData c
Definition: date_core.c:285

Definition at line 4153 of file nkf.c.

◆ SCORE_CP932

#define SCORE_CP932   (SCORE_DEPEND << 1) /* IBM extended characters */

Definition at line 2946 of file nkf.c.

◆ SCORE_DEPEND

#define SCORE_DEPEND   (SCORE_KANA << 1) /* MD Characters */

Definition at line 2945 of file nkf.c.

◆ SCORE_ERROR

#define SCORE_ERROR   (SCORE_iMIME << 1) /* Error */

Definition at line 2951 of file nkf.c.

◆ SCORE_iMIME

#define SCORE_iMIME   (SCORE_NO_EXIST << 1) /* MIME selected */

Definition at line 2950 of file nkf.c.

◆ SCORE_INIT

#define SCORE_INIT   (SCORE_iMIME)

Definition at line 2953 of file nkf.c.

◆ SCORE_KANA

#define SCORE_KANA   (SCORE_L2 << 1) /* Halfwidth Katakana */

Definition at line 2944 of file nkf.c.

◆ SCORE_L2

#define SCORE_L2   (1) /* Kanji Level 2 */

Definition at line 2943 of file nkf.c.

◆ SCORE_NO_EXIST

#define SCORE_NO_EXIST   (SCORE_X0213 << 1) /* Undefined Characters */

Definition at line 2949 of file nkf.c.

◆ SCORE_X0212

#define SCORE_X0212   (SCORE_CP932 << 1) /* JIS X 0212 */

Definition at line 2947 of file nkf.c.

◆ SCORE_X0213

#define SCORE_X0213   (SCORE_X0212 << 1) /* JIS X 0213 */

Definition at line 2948 of file nkf.c.

◆ SEND

#define SEND   (void)0 /* output c1 and c2, get next */

Definition at line 5824 of file nkf.c.

◆ set_input_mode

#define set_input_mode (   mode)
Value:
do { \
input_mode = mode; \
shift_mode = 0; \
set_input_codename("ISO-2022-JP"); \
debug("ISO-2022-JP"); \
} while (0)

Definition at line 5826 of file nkf.c.

◆ SI

#define SI   0x0f

Definition at line 77 of file nkf.c.

◆ SJ0162

#define SJ0162   0x00e1 /* 01 - 62 ku offset */

◆ SJ6394

#define SJ6394   0x0161 /* 63 - 94 ku offset */

◆ SKIP

#define SKIP   c2=0;continue /* no output, get next */

Definition at line 5822 of file nkf.c.

◆ SO

#define SO   0x0e

Definition at line 78 of file nkf.c.

◆ SP

#define SP   0x20

Definition at line 75 of file nkf.c.

◆ SS2

#define SS2   0x8e

Definition at line 79 of file nkf.c.

◆ SS3

#define SS3   0x8f

Definition at line 80 of file nkf.c.

◆ STD_GC_BUFSIZE

#define STD_GC_BUFSIZE   (256)

Definition at line 3308 of file nkf.c.

◆ STRICT_MIME

#define STRICT_MIME   8

Definition at line 58 of file nkf.c.

◆ TAB

#define TAB   0x09

Definition at line 71 of file nkf.c.

◆ UCS_MAP_ASCII

#define UCS_MAP_ASCII   0

Definition at line 347 of file nkf.c.

◆ UCS_MAP_CP10001

#define UCS_MAP_CP10001   3

Definition at line 350 of file nkf.c.

◆ UCS_MAP_CP932

#define UCS_MAP_CP932   2

Definition at line 349 of file nkf.c.

◆ UCS_MAP_MS

#define UCS_MAP_MS   1

Definition at line 348 of file nkf.c.

◆ UNICODE_BMP_MAX

#define UNICODE_BMP_MAX   NKF_INT32_C(0x0000FFFF)

Definition at line 426 of file nkf.c.

◆ UNICODE_MAX

#define UNICODE_MAX   NKF_INT32_C(0x0010FFFF)

Definition at line 427 of file nkf.c.

◆ UTF16_TO_UTF32

#define UTF16_TO_UTF32 (   lead,
  trail 
)    (((lead) << 10) + (trail) - NKF_INT32_C(0x35FDC00))

Definition at line 434 of file nkf.c.

◆ VALUE_MASK

#define VALUE_MASK   NKF_INT32_C(0x00FFFFFF)

Definition at line 425 of file nkf.c.

◆ X0213_SURROGATE_FIND

#define X0213_SURROGATE_FIND (   tbl,
  size,
  euc 
)
Value:
do { \
int i; \
for (i = 0; i < size; i++) \
if (tbl[i][0] == euc) { \
low = tbl[i][2]; \
break; \
} \
} while (0)
int size
Definition: encoding.c:57

Definition at line 1963 of file nkf.c.

Enumeration Type Documentation

◆ byte_order

enum byte_order
Enumerator
ENDIAN_BIG 
ENDIAN_LITTLE 
ENDIAN_2143 
ENDIAN_3412 

Definition at line 61 of file nkf.c.

◆ nkf_encodings

Enumerator
ASCII 
ISO_8859_1 
ISO_2022_JP 
CP50220 
CP50221 
CP50222 
ISO_2022_JP_1 
ISO_2022_JP_3 
ISO_2022_JP_2004 
SHIFT_JIS 
WINDOWS_31J 
CP10001 
EUC_JP 
EUCJP_NKF 
CP51932 
EUCJP_MS 
EUCJP_ASCII 
SHIFT_JISX0213 
SHIFT_JIS_2004 
EUC_JISX0213 
EUC_JIS_2004 
UTF_8 
UTF_8N 
UTF_8_BOM 
UTF8_MAC 
UTF_16 
UTF_16BE 
UTF_16BE_BOM 
UTF_16LE 
UTF_16LE_BOM 
UTF_32 
UTF_32BE 
UTF_32BE_BOM 
UTF_32LE 
UTF_32LE_BOM 
BINARY 
NKF_ENCODING_TABLE_SIZE 
JIS_X_0201_1976_K 
JIS_X_0208 
JIS_X_0212 
JIS_X_0213_2 
JIS_X_0213_1 

Definition at line 86 of file nkf.c.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 6921 of file nkf.c.

Referenced by nl_langinfo_codeset(), and rb_parser_set_context().

Variable Documentation

◆ alias

const char* alias

Definition at line 1151 of file nkf.c.

Referenced by Init_enc_set_filesystem_encoding().

◆ buf

unsigned char buf[MIMEOUT_BUF_LENGTH+1]

◆ count

int count

Definition at line 5042 of file nkf.c.

Referenced by nkf_split_options().

◆ encoding_name_to_id_table

struct { ... } encoding_name_to_id_table[]

◆ id

const int id

◆ input

unsigned int input

Definition at line 4312 of file nkf.c.

◆ input_code_list

struct input_code input_code_list[]
Initial value:
= {
{"EUC-JP", 0, 0, 0, {0, 0, 0}, e_status, e_iconv, 0},
{"Shift_JIS", 0, 0, 0, {0, 0, 0}, s_status, s_iconv, 0},
{"UTF-8", 0, 0, 0, {0, 0, 0}, w_status, w_iconv, 0},
{"UTF-16", 0, 0, 0, {0, 0, 0}, NULL, w_iconv16, 0},
{"UTF-32", 0, 0, 0, {0, 0, 0}, NULL, w_iconv32, 0},
{NULL, 0, 0, 0, {0, 0, 0}, NULL, NULL, 0}
}
#define NULL
Definition: _sdbm.c:102

Definition at line 475 of file nkf.c.

◆ last

unsigned int last

◆ mime_priority_func

nkf_char(* mime_priority_func[])(nkf_char c2, nkf_char c1, nkf_char c0)
Initial value:
= {
e_iconv, s_iconv, 0, 0, 0, 0, 0,
w_iconv, w_iconv,
0,
}

Definition at line 4276 of file nkf.c.

◆ name

const char* name

◆ nkf_encoding_table

nkf_encoding nkf_encoding_table[]

Definition at line 167 of file nkf.c.

◆ NkfEncodingASCII

nkf_native_encoding NkfEncodingASCII = { "ASCII", e_iconv, e_oconv }

Definition at line 153 of file nkf.c.

◆ NkfEncodingEUC_JP

nkf_native_encoding NkfEncodingEUC_JP = { "EUC-JP", e_iconv, e_oconv }

Definition at line 156 of file nkf.c.

◆ NkfEncodingISO_2022_JP

nkf_native_encoding NkfEncodingISO_2022_JP = { "ISO-2022-JP", e_iconv, j_oconv }

Definition at line 154 of file nkf.c.

◆ NkfEncodingShift_JIS

nkf_native_encoding NkfEncodingShift_JIS = { "Shift_JIS", s_iconv, s_oconv }

Definition at line 155 of file nkf.c.

◆ NkfEncodingUTF_16

nkf_native_encoding NkfEncodingUTF_16 = { "UTF-16", w_iconv16, w_oconv16 }

Definition at line 158 of file nkf.c.

◆ NkfEncodingUTF_32

nkf_native_encoding NkfEncodingUTF_32 = { "UTF-32", w_iconv32, w_oconv32 }

Definition at line 159 of file nkf.c.

◆ NkfEncodingUTF_8

nkf_native_encoding NkfEncodingUTF_8 = { "UTF-8", w_iconv, w_oconv }

Definition at line 157 of file nkf.c.

◆ top

unsigned int top

Definition at line 4310 of file nkf.c.

Referenced by getaddrinfo(), and rb_ary_shift().