Data Structures | Defines | Enumerations | Functions | Variables

ext/nkf/nkf-utf8/nkf.c File Reference

#include "config.h"
#include "nkf.h"
#include "utf8tbl.h"
#include <assert.h>
Include dependency graph for nkf.c:
This graph shows which files directly or indirectly include this file:

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

Defines

#define NKF_VERSION   "2.1.1"
#define NKF_RELEASE_DATE   "2010-04-28"
#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 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
#define SJ6394   0x0161
#define NKF_ICONV_INVALID_CODE_RANGE   -13
#define NKF_ICONV_NEED_ONE_MORE_BYTE   (size_t)-1
#define NKF_ICONV_NEED_TWO_MORE_BYTES   (size_t)-2
#define UTF16_TO_UTF32(lead, trail)   (((lead) << 10) + (trail) - NKF_INT32_C(0x35FDC00))
#define output_ascii_escape_sequence(mode)
#define SCORE_L2   (1)
#define SCORE_KANA   (SCORE_L2 << 1)
#define SCORE_DEPEND   (SCORE_KANA << 1)
#define SCORE_CP932   (SCORE_DEPEND << 1)
#define SCORE_X0212   (SCORE_CP932 << 1)
#define SCORE_NO_EXIST   (SCORE_X0212 << 1)
#define SCORE_iMIME   (SCORE_NO_EXIST << 1)
#define SCORE_ERROR   (SCORE_iMIME << 1)
#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)
#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
#define SKIP   c2=0;continue
#define MORE   c2=c1;continue
#define SEND   (void)0
#define LAST   break
#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

static nkf_char s_iconv (nkf_char c2, nkf_char c1, nkf_char c0)
static nkf_char e_iconv (nkf_char c2, nkf_char c1, nkf_char c0)
static nkf_char w_iconv (nkf_char c2, nkf_char c1, nkf_char c0)
static nkf_char w_iconv16 (nkf_char c2, nkf_char c1, nkf_char c0)
static nkf_char w_iconv32 (nkf_char c2, nkf_char c1, nkf_char c0)
static void j_oconv (nkf_char c2, nkf_char c1)
static void s_oconv (nkf_char c2, nkf_char c1)
static void e_oconv (nkf_char c2, nkf_char c1)
static void w_oconv (nkf_char c2, nkf_char c1)
static void w_oconv16 (nkf_char c2, nkf_char c1)
static void w_oconv32 (nkf_char c2, nkf_char c1)
static void w_status (struct input_code *, nkf_char)
static void std_putc (nkf_char c)
static nkf_char std_getc (FILE *f)
static nkf_char std_ungetc (nkf_char c, FILE *f)
static nkf_char broken_getc (FILE *f)
static nkf_char broken_ungetc (nkf_char c, FILE *f)
static nkf_char mime_getc (FILE *f)
static void mime_putc (nkf_char c)
static void no_putc (nkf_char c)
static void debug (const char *str)
static void set_input_codename (const char *codename)
static void e_status (struct input_code *, nkf_char)
static void s_status (struct input_code *, nkf_char)
static nkf_char no_connection2 (nkf_char c2, nkf_char c1, nkf_char c0)
static void no_connection (nkf_char c2, nkf_char c1)
static void * nkf_xmalloc (size_t size)
static void * nkf_xrealloc (void *ptr, size_t size)
static int nkf_str_caseeql (const char *src, const char *target)
static nkf_encodingnkf_enc_from_index (int idx)
static int nkf_enc_find_index (const char *name)
static nkf_encodingnkf_enc_find (const char *name)
static const char * nkf_locale_charmap ()
static nkf_encodingnkf_locale_encoding ()
static nkf_encodingnkf_utf8_encoding ()
static nkf_encodingnkf_default_encoding ()
static nkf_buf_tnkf_buf_new (int length)
static nkf_char nkf_buf_at (nkf_buf_t *buf, int index)
static void nkf_buf_clear (nkf_buf_t *buf)
static void nkf_buf_push (nkf_buf_t *buf, nkf_char c)
static nkf_char nkf_buf_pop (nkf_buf_t *buf)
static void version (void)
static void usage (void)
static void show_configuration (void)
static char * get_backup_filename (const char *suffix, const char *filename)
static void nkf_each_char_to_hex (void(*f)(nkf_char c2, nkf_char c1), nkf_char c)
static void encode_fallback_html (nkf_char c)
static void encode_fallback_xml (nkf_char c)
static void encode_fallback_java (nkf_char c)
static void encode_fallback_perl (nkf_char c)
static void encode_fallback_subchar (nkf_char c)
static void set_input_encoding (nkf_encoding *enc)
static void set_output_encoding (nkf_encoding *enc)
static struct input_codefind_inputcode_byfunc (nkf_char(*iconv_func)(nkf_char c2, nkf_char c1, nkf_char c0))
static void set_iconv (nkf_char f, nkf_char(*iconv_func)(nkf_char c2, nkf_char c1, nkf_char c0))
static nkf_char x0212_shift (nkf_char c)
static nkf_char x0212_unshift (nkf_char c)
static nkf_char e2s_conv (nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
static nkf_char s2e_conv (nkf_char c2, nkf_char c1, nkf_char *p2, nkf_char *p1)
static void nkf_unicode_to_utf8 (nkf_char val, nkf_char *p1, nkf_char *p2, nkf_char *p3, nkf_char *p4)
static nkf_char nkf_utf8_to_unicode (nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
static int unicode_to_jis_common2 (nkf_char c1, nkf_char c0, const unsigned short *const *pp, nkf_char psize, nkf_char *p2, nkf_char *p1)
static int unicode_to_jis_common (nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1)
static nkf_char e2w_conv (nkf_char c2, nkf_char c1)
static nkf_char w2e_conv (nkf_char c2, nkf_char c1, nkf_char c0, nkf_char *p2, nkf_char *p1)
static nkf_char w16e_conv (nkf_char val, nkf_char *p2, nkf_char *p1)
static size_t unicode_iconv (nkf_char wc)
static size_t nkf_iconv_utf_16 (nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
static size_t nkf_iconv_utf_32 (nkf_char c1, nkf_char c2, nkf_char c3, nkf_char c4)
static void output_escape_sequence (int mode)
static void set_code_score (struct input_code *ptr, nkf_char score)
static void clr_code_score (struct input_code *ptr, nkf_char score)
static void code_score (struct input_code *ptr)
static void status_disable (struct input_code *ptr)
static void status_push_ch (struct input_code *ptr, nkf_char c)
static void status_clear (struct input_code *ptr)
static void status_reset (struct input_code *ptr)
static void status_reinit (struct input_code *ptr)
static void status_check (struct input_code *ptr, nkf_char c)
static void code_status (nkf_char c)
static void nkf_state_init (void)
static nkf_char push_hold_buf (nkf_char c2)
static int h_conv (FILE *f, nkf_char c1, nkf_char c2)
static void check_bom (FILE *f)
static void eol_conv (nkf_char c2, nkf_char c1)
static void put_newline (void(*func)(nkf_char))
static void oconv_newline (void(*func)(nkf_char, nkf_char))
static void fold_conv (nkf_char c2, nkf_char c1)
static void z_conv (nkf_char c2, nkf_char c1)
static void rot_conv (nkf_char c2, nkf_char c1)
static void hira_conv (nkf_char c2, nkf_char c1)
static void iso2022jp_check_conv (nkf_char c2, nkf_char c1)
static void mime_input_buf_unshift (nkf_char c)
static nkf_char mime_ungetc (nkf_char c, FILE *f)
static nkf_char mime_ungetc_buf (nkf_char c, FILE *f)
static nkf_char mime_getc_buf (FILE *f)
static void switch_mime_getc (void)
static void unswitch_mime_getc (void)
static nkf_char mime_integrity (FILE *f, const unsigned char *p)
static nkf_char mime_begin_strict (FILE *f)
static nkf_char mime_begin (FILE *f)
static const char * get_guessed_code (void)
static void print_guessed_code (char *filename)
static nkf_char hex_getc (nkf_char ch, FILE *f, nkf_char(*g)(FILE *f), nkf_char(*u)(nkf_char c, FILE *f))
static nkf_char cap_getc (FILE *f)
static nkf_char cap_ungetc (nkf_char c, FILE *f)
static nkf_char url_getc (FILE *f)
static nkf_char url_ungetc (nkf_char c, FILE *f)
static nkf_char numchar_getc (FILE *f)
static nkf_char numchar_ungetc (nkf_char c, FILE *f)
static nkf_char nfc_getc (FILE *f)
static nkf_char nfc_ungetc (nkf_char c, FILE *f)
static nkf_char base64decode (nkf_char c)
static void open_mime (nkf_char mode)
static void mime_prechar (nkf_char c2, nkf_char c1)
static void close_mime (void)
static void eof_mime (void)
static void mimeout_addchar (nkf_char c)
static void base64_conv (nkf_char c2, nkf_char c1)
static void reinit (void)
static int module_connection (void)
static nkf_char noconvert (FILE *f)
static int kanji_convert (FILE *f)
static int options (unsigned char *cp)
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 []
static const char * input_codename = NULL
static nkf_encodinginput_encoding = NULL
static nkf_encodingoutput_encoding = NULL
static int ms_ucs_map_f = UCS_MAP_ASCII
static int no_cp932ext_f = FALSE
static int no_best_fit_chars_f = FALSE
static int input_endian = ENDIAN_BIG
static nkf_char unicode_subchar = '?'
static void(* encode_fallback )(nkf_char c) = NULL
static int output_bom_f = FALSE
static int output_endian = ENDIAN_BIG
static unsigned char stdibuf [IOBUF_SIZE]
static unsigned char stdobuf [IOBUF_SIZE]
static int unbuf_f = FALSE
static int estab_f = FALSE
static int nop_f = FALSE
static int binmode_f = TRUE
static int rot_f = FALSE
static int hira_f = FALSE
static int alpha_f = FALSE
static int mime_f = MIME_DECODE_DEFAULT
static int mime_decode_f = FALSE
static int mimebuf_f = FALSE
static int broken_f = FALSE
static int iso8859_f = FALSE
static int mimeout_f = FALSE
static int x0201_f = NKF_UNSPECIFIED
static int iso2022jp_f = FALSE
static int nfc_f = FALSE
static nkf_char(* i_nfc_getc )(FILE *) = std_getc
static nkf_char(* i_nfc_ungetc )(nkf_char c, FILE *f) = std_ungetc
static int cap_f = FALSE
static nkf_char(* i_cgetc )(FILE *) = std_getc
static nkf_char(* i_cungetc )(nkf_char c, FILE *f) = std_ungetc
static int url_f = FALSE
static nkf_char(* i_ugetc )(FILE *) = std_getc
static nkf_char(* i_uungetc )(nkf_char c, FILE *f) = std_ungetc
static int numchar_f = FALSE
static nkf_char(* i_ngetc )(FILE *) = std_getc
static nkf_char(* i_nungetc )(nkf_char c, FILE *f) = std_ungetc
static int noout_f = FALSE
static int debug_f = FALSE
static nkf_char(* iconv_for_check )(nkf_char c2, nkf_char c1, nkf_char c0)=0
static int guess_f = 0
static int cp51932_f = FALSE
static int cp932inv_f = TRUE
static int x0212_f = FALSE
static int x0213_f = FALSE
static unsigned char prefix_table [256]
struct input_code input_code_list []
static int mimeout_mode = 0
static int base64_count = 0
static int f_line = 0
static int f_prev = 0
static int fold_preserve_f = FALSE
static int fold_f = FALSE
static int fold_len = 0
static unsigned char kanji_intro = DEFAULT_J
static unsigned char ascii_intro = DEFAULT_R
static int fold_margin = FOLD_MARGIN
static nkf_char(* iconv )(nkf_char c2, nkf_char c1, nkf_char c0) = no_connection2
static void(* oconv )(nkf_char c2, nkf_char c1) = no_connection
static void(* o_zconv )(nkf_char c2, nkf_char c1) = no_connection
static void(* o_fconv )(nkf_char c2, nkf_char c1) = no_connection
static void(* o_eol_conv )(nkf_char c2, nkf_char c1) = no_connection
static void(* o_rot_conv )(nkf_char c2, nkf_char c1) = no_connection
static void(* o_hira_conv )(nkf_char c2, nkf_char c1) = no_connection
static void(* o_base64conv )(nkf_char c2, nkf_char c1) = no_connection
static void(* o_iso2022jp_check_conv )(nkf_char c2, nkf_char c1) = no_connection
static void(* o_putc )(nkf_char c) = std_putc
static nkf_char(* i_getc )(FILE *f) = std_getc
static nkf_char(* i_ungetc )(nkf_char c, FILE *f) = std_ungetc
static nkf_char(* i_bgetc )(FILE *) = std_getc
static nkf_char(* i_bungetc )(nkf_char c, FILE *f) = std_ungetc
static void(* o_mputc )(nkf_char c) = std_putc
static nkf_char(* i_mgetc )(FILE *) = std_getc
static nkf_char(* i_mungetc )(nkf_char c, FILE *f) = std_ungetc
static nkf_char(* i_mgetc_buf )(FILE *) = std_getc
static nkf_char(* i_mungetc_buf )(nkf_char c, FILE *f) = std_ungetc
static int output_mode = ASCII
static int input_mode = ASCII
static int mime_decode_mode = FALSE
static const unsigned char cv []
static const unsigned char dv []
static const unsigned char ev []
static const unsigned char fv []
static int option_mode = 0
static int file_out_f = FALSE
static int overwrite_f = FALSE
static int preserve_time_f = FALSE
static int backup_f = FALSE
static char * backup_suffix = ""
static int eolmode_f = 0
static int input_eol = 0
static nkf_char prev_cr = 0
struct {
   const char *   name
   const char *   alias
long_option []
static const nkf_char score_table_A0 []
static const nkf_char score_table_F0 []
static nkf_state_tnkf_state = NULL
static nkf_char hold_buf [HOLD_SIZE *2]
static int hold_count = 0
static nkf_char z_prev2 = 0
static nkf_char z_prev1 = 0
static const unsigned char * mime_pattern []
nkf_char(* mime_priority_func [])(nkf_char c2, nkf_char c1, nkf_char c0)
static const nkf_char mime_encode []
static const nkf_char mime_encode_method []
struct {
   unsigned char   buf [MIME_BUF_SIZE]
   unsigned int   top
   unsigned int   last
   unsigned int   input
mime_input_state
static nkf_char(* mime_iconv_back )(nkf_char c2, nkf_char c1, nkf_char c0) = NULL
static const char basis_64 [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
struct {
   char   buf [MIMEOUT_BUF_LENGTH+1]
   int   count
mimeout_state

Define Documentation

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

Definition at line 295 of file nkf.c.

Referenced by encode_fallback_java(), mimeout_addchar(), and nkf_each_char_to_hex().

#define BS   0x08

Definition at line 70 of file nkf.c.

Referenced by fold_conv().

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

Definition at line 3423 of file nkf.c.

Referenced by fold_conv().

#define CLASS_MASK   NKF_INT32_C(0xFF000000)

Definition at line 422 of file nkf.c.

#define CLASS_UNICODE   NKF_INT32_C(0x01000000)

Definition at line 423 of file nkf.c.

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

Definition at line 25 of file nkf.c.

Referenced by version().

#define CR   0x0d
#define CRLF   0x0D0A

Definition at line 81 of file nkf.c.

Referenced by eol_conv(), oconv_newline(), print_guessed_code(), put_newline(), and show_configuration().

#define DEFAULT_FOLD   60

Definition at line 502 of file nkf.c.

Referenced by options().

#define DEFAULT_J   'B'

Definition at line 311 of file nkf.c.

#define DEFAULT_R   'B'

Definition at line 312 of file nkf.c.

#define DEL   0x7f
#define ESC   0x1b

Definition at line 74 of file nkf.c.

Referenced by broken_getc(), h_conv(), and kanji_convert().

#define FIXED_MIME   7

Definition at line 57 of file nkf.c.

Referenced by eof_mime(), mime_getc(), mime_putc(), and module_connection().

#define FOLD_MARGIN   10

Definition at line 501 of file nkf.c.

#define GETA1   0x22

Definition at line 315 of file nkf.c.

#define GETA2   0x2e

Definition at line 316 of file nkf.c.

#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)

Definition at line 292 of file nkf.c.

Referenced by hex_getc(), mime_getc(), numchar_getc(), and options().

#define HOLD_SIZE   1024

Definition at line 304 of file nkf.c.

Referenced by push_hold_buf().

#define IOBUF_SIZE   16384

Definition at line 308 of file nkf.c.

Referenced by main().

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

Definition at line 278 of file nkf.c.

Referenced by fold_conv(), mime_begin(), and mime_integrity().

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

Definition at line 296 of file nkf.c.

Referenced by e2s_conv(), e2w_conv(), e_oconv(), j_oconv(), s_oconv(), unicode_to_jis_common(), and x0212_shift().

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

Definition at line 301 of file nkf.c.

Referenced by s2e_conv(), and s_status().

#define LAST   break

Definition at line 5422 of file nkf.c.

Referenced by kanji_convert().

#define LF   0x0a
#define MAXRECOVER   20

Definition at line 3920 of file nkf.c.

#define MIME_BUF_MASK   (MIME_BUF_SIZE-1)

Definition at line 3910 of file nkf.c.

Referenced by mime_integrity().

#define MIME_BUF_SIZE   (1024)

Definition at line 3909 of file nkf.c.

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

Definition at line 4636 of file nkf.c.

Referenced by mime_putc().

#define MORE   c2=c1;continue

Definition at line 5420 of file nkf.c.

#define NEXT   continue

Definition at line 5418 of file nkf.c.

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

Definition at line 836 of file nkf.c.

Referenced by broken_getc(), nkf_buf_pop(), and std_getc().

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

Definition at line 835 of file nkf.c.

Referenced by broken_ungetc(), and nfc_getc().

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

Definition at line 302 of file nkf.c.

Referenced by kanji_convert().

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

Definition at line 427 of file nkf.c.

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

Definition at line 430 of file nkf.c.

Referenced by encode_fallback_java(), nkf_unicode_to_utf8(), w16e_conv(), and w_oconv16().

#define nkf_char_unicode_new (   c  )     ((c) | CLASS_UNICODE)
#define nkf_char_unicode_p (   c  )     ((c & CLASS_MASK) == CLASS_UNICODE)
#define nkf_char_unicode_value_p (   c  )     ((c & VALUE_MASK) <= UNICODE_MAX)

Definition at line 431 of file nkf.c.

Referenced by nkf_unicode_to_utf8().

#define nkf_enc_asciicompat (   enc  ) 
Value:

Definition at line 739 of file nkf.c.

Referenced by kanji_convert().

#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 at line 746 of file nkf.c.

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

Definition at line 734 of file nkf.c.

Referenced by rb_nkf_convert(), rb_nkf_enc_get(), and show_configuration().

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

Definition at line 736 of file nkf.c.

Referenced by rb_nkf_enc_get().

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

Definition at line 737 of file nkf.c.

Referenced by module_connection().

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

Definition at line 735 of file nkf.c.

Referenced by rb_nkf_convert(), set_input_encoding(), and set_output_encoding().

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

Definition at line 738 of file nkf.c.

Referenced by module_connection().

#define nkf_enc_unicode_p (   enc  ) 
#define NKF_ICONV_INVALID_CODE_RANGE   -13

Definition at line 2179 of file nkf.c.

#define NKF_ICONV_NEED_ONE_MORE_BYTE   (size_t)-1

Definition at line 2205 of file nkf.c.

#define NKF_ICONV_NEED_TWO_MORE_BYTES   (size_t)-2

Definition at line 2206 of file nkf.c.

Referenced by kanji_convert().

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

Definition at line 289 of file nkf.c.

Referenced by mimeout_addchar().

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

Definition at line 288 of file nkf.c.

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

Definition at line 286 of file nkf.c.

Referenced by fold_conv(), mime_getc(), mime_putc(), and open_mime().

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

Definition at line 284 of file nkf.c.

Referenced by numchar_getc(), and options().

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

Definition at line 291 of file nkf.c.

Referenced by e2s_conv(), e_oconv(), and options().

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

Definition at line 283 of file nkf.c.

Referenced by options().

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

Definition at line 290 of file nkf.c.

Referenced by s_oconv().

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

Definition at line 287 of file nkf.c.

Referenced by mime_putc(), and open_mime().

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

Definition at line 285 of file nkf.c.

Referenced by hex_getc(), numchar_getc(), and options().

#define nkf_noescape_mime (   c  ) 
Value:
((c == CR) || (c == LF) || \
                              ((c > SP) && (c < DEL) && (c != '?') && (c != '=') && (c != '_') \
                               && (c != '(') && (c != ')') && (c != '.') && (c != 0x22)))

Definition at line 297 of file nkf.c.

Referenced by mime_putc().

#define NKF_RELEASE_DATE   "2010-04-28"

Definition at line 24 of file nkf.c.

Referenced by Init_nkf(), show_configuration(), and version().

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

Definition at line 282 of file nkf.c.

Referenced by mime_begin_strict(), and nkf_str_caseeql().

#define NKF_UNSPECIFIED   (-TRUE)

Definition at line 386 of file nkf.c.

Referenced by module_connection(), set_input_encoding(), and set_output_encoding().

#define NKF_VERSION   "2.1.1"

Definition at line 23 of file nkf.c.

Referenced by Init_nkf(), show_configuration(), and version().

#define nkf_xfree (   ptr  )     free(ptr)

Definition at line 690 of file nkf.c.

Referenced by main(), and mime_getc().

#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 at line 2284 of file nkf.c.

Referenced by j_oconv().

#define PREFIX_EUCG3   NKF_INT32_C(0x8F00)

Definition at line 421 of file nkf.c.

Referenced by kanji_convert(), s2e_conv(), and x0212_unshift().

#define RANGE_NUM_MAX   18
#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) \
                  )

Definition at line 3747 of file nkf.c.

Referenced by rot_conv().

#define rot47 (   c  ) 
Value:
( \
                   ( c < '!') ? c: \
                   ( c <= 'O') ? (c + 47) : \
                   ( c <= '~') ?  (c - 47) : \
                   c \
                  )

Definition at line 3757 of file nkf.c.

Referenced by rot_conv().

#define SCORE_CP932   (SCORE_DEPEND << 1)

Definition at line 2683 of file nkf.c.

Referenced by get_guessed_code(), and s_status().

#define SCORE_DEPEND   (SCORE_KANA << 1)

Definition at line 2682 of file nkf.c.

Referenced by get_guessed_code().

#define SCORE_ERROR   (SCORE_iMIME << 1)

Definition at line 2687 of file nkf.c.

Referenced by code_score().

#define SCORE_iMIME   (SCORE_NO_EXIST << 1)

Definition at line 2686 of file nkf.c.

Referenced by mime_begin_strict().

#define SCORE_INIT   (SCORE_iMIME)

Definition at line 2689 of file nkf.c.

#define SCORE_KANA   (SCORE_L2 << 1)

Definition at line 2681 of file nkf.c.

Referenced by code_score(), and get_guessed_code().

#define SCORE_L2   (1)

Definition at line 2680 of file nkf.c.

Referenced by code_score().

#define SCORE_NO_EXIST   (SCORE_X0212 << 1)

Definition at line 2685 of file nkf.c.

Referenced by code_score().

#define SCORE_X0212   (SCORE_CP932 << 1)

Definition at line 2684 of file nkf.c.

Referenced by code_score(), and get_guessed_code().

#define SEND   (void)0

Definition at line 5421 of file nkf.c.

#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 5423 of file nkf.c.

Referenced by kanji_convert().

#define SI   0x0f

Definition at line 77 of file nkf.c.

Referenced by kanji_convert().

#define SJ0162   0x00e1

Referenced by s2e_conv().

#define SJ6394   0x0161

Referenced by s2e_conv().

#define SKIP   c2=0;continue

Definition at line 5419 of file nkf.c.

#define SO   0x0e

Definition at line 78 of file nkf.c.

Referenced by kanji_convert(), and unicode_to_jis_common2().

#define SP   0x20
#define SS2   0x8e

Definition at line 79 of file nkf.c.

Referenced by code_score(), e_iconv(), e_status(), and s_status().

#define SS3   0x8f

Definition at line 80 of file nkf.c.

#define STD_GC_BUFSIZE   (256)

Definition at line 3017 of file nkf.c.

Referenced by nkf_state_init().

#define STRICT_MIME   8

Definition at line 58 of file nkf.c.

Referenced by kanji_convert(), mime_getc(), switch_mime_getc(), and unswitch_mime_getc().

#define TAB   0x09

Definition at line 71 of file nkf.c.

Referenced by fold_conv(), and mime_getc().

#define UCS_MAP_ASCII   0

Definition at line 347 of file nkf.c.

Referenced by e2w_conv().

#define UCS_MAP_CP10001   3

Definition at line 350 of file nkf.c.

Referenced by e2w_conv(), kanji_convert(), and unicode_to_jis_common().

#define UCS_MAP_CP932   2

Definition at line 349 of file nkf.c.

Referenced by unicode_to_jis_common().

#define UCS_MAP_MS   1

Definition at line 348 of file nkf.c.

Referenced by unicode_to_jis_common().

#define UNICODE_BMP_MAX   NKF_INT32_C(0x0000FFFF)

Definition at line 425 of file nkf.c.

#define UNICODE_MAX   NKF_INT32_C(0x0010FFFF)

Definition at line 426 of file nkf.c.

Referenced by w_oconv16().

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

Definition at line 2207 of file nkf.c.

Referenced by nkf_iconv_utf_16().

#define VALUE_MASK   NKF_INT32_C(0x00FFFFFF)

Definition at line 424 of file nkf.c.


Enumeration Type Documentation

enum byte_order
Enumerator:
ENDIAN_BIG 
ENDIAN_LITTLE 
ENDIAN_2143 
ENDIAN_3412 

Definition at line 61 of file nkf.c.

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

static void base64_conv ( nkf_char  c2,
nkf_char  c1 
) [static]

Definition at line 5078 of file nkf.c.

References mime_prechar().

static nkf_char base64decode ( nkf_char  c  )  [static]

Definition at line 4379 of file nkf.c.

Referenced by mime_getc().

static nkf_char broken_getc ( FILE f  )  [static]
static nkf_char broken_ungetc ( nkf_char  c,
FILE f 
) [static]

Definition at line 3341 of file nkf.c.

References nkf_state_t::broken_buf, nkf_buf_length, and nkf_buf_push().

static nkf_char cap_getc ( FILE f  )  [static]

Definition at line 4230 of file nkf.c.

References hex_getc(), i_cgetc, and i_cungetc.

static nkf_char cap_ungetc ( nkf_char  c,
FILE f 
) [static]

Definition at line 4236 of file nkf.c.

References i_cungetc.

static void check_bom ( FILE f  )  [static]

Definition at line 3193 of file nkf.c.

References i_getc, i_ungetc, iconv, input_endian, set_iconv(), TRUE, w_iconv(), w_iconv16(), and w_iconv32().

Referenced by kanji_convert().

static void close_mime ( void   )  [static]

Definition at line 4724 of file nkf.c.

References base64_count, and mimeout_mode.

Referenced by eof_mime(), and mime_putc().

static void clr_code_score ( struct input_code ptr,
nkf_char  score 
) [static]

Definition at line 2714 of file nkf.c.

References input_code::score.

Referenced by mime_begin_strict().

static void code_score ( struct input_code ptr  )  [static]
static void code_status ( nkf_char  c  )  [static]
static void debug ( const char *  str  )  [static]

Definition at line 4136 of file nkf.c.

References debug_f.

Referenced by kanji_convert(), and set_iconv().

static nkf_char e2s_conv ( nkf_char  c2,
nkf_char  c1,
nkf_char p2,
nkf_char p1 
) [static]

Definition at line 1544 of file nkf.c.

References is_eucg3, nkf_isgraph, x0212_shift(), x0212_shiftjis, and x0213_f.

Referenced by e_iconv(), e_oconv(), s_oconv(), and unicode_to_jis_common().

static nkf_char e2w_conv ( nkf_char  c2,
nkf_char  c1 
) [static]
static nkf_char e_iconv ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
) [static]
static void e_oconv ( nkf_char  c2,
nkf_char  c1 
) [static]
static void e_status ( struct input_code ptr,
nkf_char  c 
) [static]
static void encode_fallback_html ( nkf_char  c  )  [static]

Definition at line 1050 of file nkf.c.

References NKF_INT32_C.

static void encode_fallback_java ( nkf_char  c  )  [static]

Definition at line 1085 of file nkf.c.

References bin2hex, and nkf_char_unicode_bmp_p.

static void encode_fallback_perl ( nkf_char  c  )  [static]

Definition at line 1106 of file nkf.c.

References nkf_each_char_to_hex().

static void encode_fallback_subchar ( nkf_char  c  )  [static]

Definition at line 1117 of file nkf.c.

References unicode_subchar.

static void encode_fallback_xml ( nkf_char  c  )  [static]

Definition at line 1074 of file nkf.c.

References nkf_each_char_to_hex().

static void eof_mime ( void   )  [static]

Definition at line 4733 of file nkf.c.

References base64_count, close_mime(), FIXED_MIME, mimeout_f, mimeout_mode, and nkf_state_t::mimeout_state.

Referenced by mime_putc().

static void eol_conv ( nkf_char  c2,
nkf_char  c1 
) [static]

Definition at line 3349 of file nkf.c.

References CR, CRLF, EOF, eolmode_f, guess_f, input_eol, LF, and prev_cr.

static struct input_code* find_inputcode_byfunc ( nkf_char(*)(nkf_char c2, nkf_char c1, nkf_char c0)  iconv_func  )  [static, read]

Definition at line 1468 of file nkf.c.

References input_code::iconv_func, and input_code::name.

Referenced by get_guessed_code(), mime_begin_strict(), and set_iconv().

static void fold_conv ( nkf_char  c2,
nkf_char  c1 
) [static]
static char* get_backup_filename ( const char *  suffix,
const char *  filename 
) [static]

Definition at line 995 of file nkf.c.

References nkf_xmalloc().

Referenced by main().

static const char* get_guessed_code ( void   )  [static]
static int h_conv ( FILE f,
nkf_char  c1,
nkf_char  c2 
) [static]
static nkf_char hex_getc ( nkf_char  ch,
FILE f,
nkf_char(*)(FILE *f)  g,
nkf_char(*)(nkf_char c, FILE *f)  u 
) [static]

Definition at line 4208 of file nkf.c.

References hex2bin, and nkf_isxdigit.

Referenced by cap_getc(), and url_getc().

static void hira_conv ( nkf_char  c2,
nkf_char  c1 
) [static]

Definition at line 3777 of file nkf.c.

References hira_f, nkf_char_unicode_new, and nkf_enc_unicode_p.

static void iso2022jp_check_conv ( nkf_char  c2,
nkf_char  c1 
) [static]

Definition at line 3812 of file nkf.c.

References range.

static void j_oconv ( nkf_char  c2,
nkf_char  c1 
) [static]
static int kanji_convert ( FILE f  )  [static]
int main ( int  argc,
char **  argv 
)

Definition at line 6446 of file nkf.c.

Referenced by iseq_data_to_ary(), and WinMain().

static nkf_char mime_begin ( FILE f  )  [static]

Definition at line 4072 of file nkf.c.

References CR, is_alnum, LF, mime_decode_mode, mime_input_buf, mime_input_state, SP, and switch_mime_getc().

Referenced by kanji_convert().

static nkf_char mime_begin_strict ( FILE f  )  [static]
static nkf_char mime_getc ( FILE f  )  [static]
static nkf_char mime_getc_buf ( FILE f  )  [static]

Definition at line 3946 of file nkf.c.

References i_mgetc_buf, mime_input_buf, mime_input_state, and mimebuf_f.

static void mime_input_buf_unshift ( nkf_char  c  )  [static]

Definition at line 3923 of file nkf.c.

References mime_input_buf, and mime_input_state.

Referenced by mime_ungetc().

static nkf_char mime_integrity ( FILE f,
const unsigned char *  p 
) [static]
static void mime_prechar ( nkf_char  c2,
nkf_char  c1 
) [static]

Definition at line 4691 of file nkf.c.

References ASCII, base64_count, DEL, EOF, mimeout_mode, mimeout_state, o_base64conv, oconv_newline(), open_mime(), and output_mode.

Referenced by base64_conv().

static void mime_putc ( nkf_char  c  )  [static]
static nkf_char mime_ungetc ( nkf_char  c,
FILE f 
) [static]

Definition at line 3929 of file nkf.c.

References mime_input_buf_unshift().

static nkf_char mime_ungetc_buf ( nkf_char  c,
FILE f 
) [static]

Definition at line 3936 of file nkf.c.

References mime_input_buf, mime_input_state, and mimebuf_f.

static void mimeout_addchar ( nkf_char  c  )  [static]

Definition at line 4760 of file nkf.c.

References base64_count, bin2hex, CR, LF, mimeout_mode, nkf_state_t::mimeout_state, and nkf_isalnum.

Referenced by mime_putc().

static int module_connection ( void   )  [static]
static nkf_char nfc_getc ( FILE f  )  [static]
static nkf_char nfc_ungetc ( nkf_char  c,
FILE f 
) [static]

Definition at line 4371 of file nkf.c.

References i_nfc_ungetc.

static nkf_char nkf_buf_at ( nkf_buf_t buf,
int  index 
) [static]

Definition at line 839 of file nkf.c.

References assert, len, and nkf_buf_t::ptr.

Referenced by nfc_getc().

static void nkf_buf_clear ( nkf_buf_t buf  )  [static]

Definition at line 846 of file nkf.c.

References nkf_buf_t::len.

Referenced by nfc_getc(), and nkf_state_init().

static nkf_buf_t* nkf_buf_new ( int  length  )  [static]

Definition at line 817 of file nkf.c.

References buf, nkf_buf_t::capa, nkf_buf_t::len, nkf_xmalloc(), and nkf_buf_t::ptr.

Referenced by nkf_state_init().

static nkf_char nkf_buf_pop ( nkf_buf_t buf  )  [static]

Definition at line 861 of file nkf.c.

References assert, nkf_buf_t::len, nkf_buf_empty_p, and nkf_buf_t::ptr.

Referenced by broken_getc(), nfc_getc(), and std_getc().

static void nkf_buf_push ( nkf_buf_t buf,
nkf_char  c 
) [static]

Definition at line 852 of file nkf.c.

References nkf_buf_t::capa, EXIT_FAILURE, nkf_buf_t::len, and nkf_buf_t::ptr.

Referenced by broken_getc(), broken_ungetc(), nfc_getc(), and std_ungetc().

static nkf_encoding* nkf_default_encoding (  )  [static]

Definition at line 798 of file nkf.c.

References nkf_enc_from_index(), nkf_locale_encoding(), and nkf_utf8_encoding().

Referenced by module_connection(), and show_configuration().

static void nkf_each_char_to_hex ( void(*)(nkf_char c2, nkf_char c1)  f,
nkf_char  c 
) [static]

Definition at line 1032 of file nkf.c.

References bin2hex, NKF_INT32_C, and shift().

Referenced by encode_fallback_perl(), and encode_fallback_xml().

static nkf_encoding* nkf_enc_find ( const char *  name  )  [static]

Definition at line 726 of file nkf.c.

References nkf_enc_find_index(), and nkf_enc_from_index().

Referenced by nkf_locale_encoding(), options(), and rb_nkf_enc_get().

static int nkf_enc_find_index ( const char *  name  )  [static]

Definition at line 713 of file nkf.c.

References encoding_name_to_id_table, and nkf_str_caseeql().

Referenced by nkf_enc_find().

static nkf_encoding* nkf_enc_from_index ( int  idx  )  [static]
static size_t nkf_iconv_utf_16 ( nkf_char  c1,
nkf_char  c2,
nkf_char  c3,
nkf_char  c4 
) [static]

Definition at line 2209 of file nkf.c.

References ENDIAN_BIG, EOF, input_endian, unicode_iconv(), and UTF16_TO_UTF32.

Referenced by kanji_convert().

static size_t nkf_iconv_utf_32 ( nkf_char  c1,
nkf_char  c2,
nkf_char  c3,
nkf_char  c4 
) [static]

Definition at line 2254 of file nkf.c.

References ENDIAN_2143, ENDIAN_3412, ENDIAN_BIG, ENDIAN_LITTLE, EOF, input_endian, and unicode_iconv().

Referenced by kanji_convert().

static const char* nkf_locale_charmap (  )  [static]

Definition at line 753 of file nkf.c.

References buf, and ULONG().

Referenced by nkf_locale_encoding().

static nkf_encoding* nkf_locale_encoding (  )  [static]

Definition at line 781 of file nkf.c.

References nkf_enc_find(), and nkf_locale_charmap().

Referenced by nkf_default_encoding().

static void nkf_state_init ( void   )  [static]
static int nkf_str_caseeql ( const char *  src,
const char *  target 
) [static]

Definition at line 693 of file nkf.c.

References nkf_toupper.

Referenced by nkf_enc_find_index().

static void nkf_unicode_to_utf8 ( nkf_char  val,
nkf_char p1,
nkf_char p2,
nkf_char p3,
nkf_char p4 
) [static]

Definition at line 1659 of file nkf.c.

References nkf_char_unicode_bmp_p, and nkf_char_unicode_value_p.

Referenced by w16e_conv(), and w_oconv().

static nkf_encoding* nkf_utf8_encoding (  )  [static]

Definition at line 792 of file nkf.c.

Referenced by nkf_default_encoding().

static nkf_char nkf_utf8_to_unicode ( nkf_char  c1,
nkf_char  c2,
nkf_char  c3,
nkf_char  c4 
) [static]

Definition at line 1691 of file nkf.c.

Referenced by w2e_conv(), and w_iconv().

static void* nkf_xmalloc ( size_t  size  )  [static]

Definition at line 661 of file nkf.c.

References EXIT_FAILURE, malloc, and NULL.

Referenced by get_backup_filename(), main(), mime_getc(), nkf_buf_new(), and nkf_state_init().

static void* nkf_xrealloc ( void *  ptr,
size_t  size 
) [static]

Definition at line 677 of file nkf.c.

References EXIT_FAILURE, NULL, and realloc.

Referenced by mime_getc().

static void no_connection ( nkf_char  c2,
nkf_char  c1 
) [static]

Definition at line 517 of file nkf.c.

References no_connection2().

static nkf_char no_connection2 ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
) [static]

Definition at line 509 of file nkf.c.

References EXIT_FAILURE.

Referenced by no_connection().

static void no_putc ( nkf_char  c  )  [static]

Definition at line 4130 of file nkf.c.

static nkf_char noconvert ( FILE f  )  [static]

Definition at line 5405 of file nkf.c.

References EOF, i_getc, module_connection(), and nop_f.

Referenced by main().

static nkf_char numchar_getc ( FILE f  )  [static]

Definition at line 4256 of file nkf.c.

References buf, hex2bin, i_ngetc, i_nungetc, nkf_char_unicode_new, nkf_isdigit, and nkf_isxdigit.

static nkf_char numchar_ungetc ( nkf_char  c,
FILE f 
) [static]

Definition at line 4310 of file nkf.c.

References i_nungetc.

static void oconv_newline ( void(*)(nkf_char, nkf_char func  )  [static]

Definition at line 3387 of file nkf.c.

References CR, CRLF, DEFAULT_NEWLINE, eolmode_f, and LF.

Referenced by fold_conv(), and mime_prechar().

static void open_mime ( nkf_char  mode  )  [static]

Definition at line 4645 of file nkf.c.

References base64_count, mime_putc(), mimeout_mode, mimeout_state, nkf_isblank, nkf_isspace, o_mputc, and put_newline().

Referenced by mime_prechar(), and mime_putc().

static int options ( unsigned char *  cp  )  [static]
static void output_escape_sequence ( int  mode  )  [static]

Definition at line 2294 of file nkf.c.

References ISO_8859_1, JIS_X_0201_1976_K, JIS_X_0208, JIS_X_0212, JIS_X_0213_1, JIS_X_0213_2, kanji_intro, and output_mode.

Referenced by j_oconv().

static void print_guessed_code ( char *  filename  )  [static]

Definition at line 4183 of file nkf.c.

References CR, CRLF, EOF, get_guessed_code(), guess_f, input_codename, input_eol, LF, and NULL.

Referenced by main().

static nkf_char push_hold_buf ( nkf_char  c2  )  [static]

Definition at line 3067 of file nkf.c.

References EOF, and HOLD_SIZE.

Referenced by h_conv().

static void put_newline ( void(*)(nkf_char func  )  [static]

Definition at line 3370 of file nkf.c.

References CR, CRLF, DEFAULT_NEWLINE, eolmode_f, and LF.

Referenced by mime_putc(), and open_mime().

static void reinit ( void   )  [static]
static void rot_conv ( nkf_char  c2,
nkf_char  c1 
) [static]

Definition at line 3765 of file nkf.c.

References ISO_8859_1, JIS_X_0201_1976_K, rot13, and rot47.

static nkf_char s2e_conv ( nkf_char  c2,
nkf_char  c1,
nkf_char p2,
nkf_char p1 
) [static]
static nkf_char s_iconv ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
) [static]

Definition at line 2081 of file nkf.c.

References EOF, iso2022jp_f, JIS_X_0201_1976_K, nkf_char_unicode_new, s2e_conv(), SP, x0201_f, and x0213_f.

Referenced by h_conv(), and kanji_convert().

static void s_oconv ( nkf_char  c2,
nkf_char  c1 
) [static]
static void s_status ( struct input_code ptr,
nkf_char  c 
) [static]
static void set_code_score ( struct input_code ptr,
nkf_char  score 
) [static]

Definition at line 2706 of file nkf.c.

References input_code::score.

Referenced by code_score(), and s_status().

static void set_iconv ( nkf_char  f,
nkf_char(*)(nkf_char c2, nkf_char c1, nkf_char c0)  iconv_func 
) [static]
static void set_input_codename ( const char *  codename  )  [static]

Definition at line 4145 of file nkf.c.

References input_codename.

Referenced by kanji_convert(), and set_iconv().

static void set_input_encoding ( nkf_encoding enc  )  [static]
static void set_output_encoding ( nkf_encoding enc  )  [static]
static void show_configuration ( void   )  [static]
static void status_check ( struct input_code ptr,
nkf_char  c 
) [static]

Definition at line 2784 of file nkf.c.

References DEL, estab_f, and status_reset().

Referenced by e_status(), s_status(), and w_status().

static void status_clear ( struct input_code ptr  )  [static]

Definition at line 2763 of file nkf.c.

References input_code::index, and input_code::stat.

Referenced by e_status(), s_status(), status_reset(), and w_status().

static void status_disable ( struct input_code ptr  )  [static]

Definition at line 2748 of file nkf.c.

References input_code::buf, code_score(), FALSE, iconv, input_code::iconv_func, set_iconv(), and input_code::stat.

Referenced by e_status(), s_status(), and w_status().

static void status_push_ch ( struct input_code ptr,
nkf_char  c 
) [static]

Definition at line 2757 of file nkf.c.

References input_code::buf, and input_code::index.

Referenced by e_status(), s_status(), and w_status().

static void status_reinit ( struct input_code ptr  )  [static]

Definition at line 2777 of file nkf.c.

References input_code::_file_stat, and status_reset().

Referenced by module_connection(), and reinit().

static void status_reset ( struct input_code ptr  )  [static]

Definition at line 2770 of file nkf.c.

References input_code::score, and status_clear().

Referenced by code_status(), status_check(), and status_reinit().

static nkf_char std_getc ( FILE f  )  [static]

Definition at line 3039 of file nkf.c.

References getc, nkf_buf_empty_p, nkf_buf_pop(), and nkf_state_t::std_gc_buf.

static void std_putc ( nkf_char  c  )  [static]

Definition at line 3057 of file nkf.c.

References EOF, and putchar.

static nkf_char std_ungetc ( nkf_char  c,
FILE f 
) [static]

Definition at line 3049 of file nkf.c.

References nkf_buf_push(), and nkf_state_t::std_gc_buf.

static void switch_mime_getc ( void   )  [static]
static size_t unicode_iconv ( nkf_char  wc  )  [static]

Definition at line 2181 of file nkf.c.

References nkf_char_unicode_new, and w16e_conv().

Referenced by nkf_iconv_utf_16(), and nkf_iconv_utf_32().

static int unicode_to_jis_common ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0,
nkf_char p2,
nkf_char p1 
) [static]
static int unicode_to_jis_common2 ( nkf_char  c1,
nkf_char  c0,
const unsigned short *const *  pp,
nkf_char  psize,
nkf_char p2,
nkf_char p1 
) [static]

Definition at line 1729 of file nkf.c.

References NKF_INT32_C, no_cp932ext_f, and SO.

Referenced by unicode_to_jis_common().

static void unswitch_mime_getc ( void   )  [static]

Definition at line 3968 of file nkf.c.

References FALSE, i_getc, i_mgetc, i_mgetc_buf, i_mungetc, i_mungetc_buf, i_ungetc, mime_f, mime_iconv_back, set_iconv(), and STRICT_MIME.

Referenced by mime_getc().

static nkf_char url_getc ( FILE f  )  [static]

Definition at line 4242 of file nkf.c.

References hex_getc(), i_ugetc, and i_uungetc.

static nkf_char url_ungetc ( nkf_char  c,
FILE f 
) [static]

Definition at line 4248 of file nkf.c.

References i_uungetc.

static void usage ( void   )  [static]

Definition at line 880 of file nkf.c.

References HELP_OUTPUT, INPUT_OPTION, NUMCHAR_OPTION, OVERWRITE, UTF8_INPUT_ENABLE, UTF8_OUTPUT_ENABLE, and version().

Referenced by options().

static void version ( void   )  [static]
static nkf_char w16e_conv ( nkf_char  val,
nkf_char p2,
nkf_char p1 
) [static]
static nkf_char w2e_conv ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0,
nkf_char p2,
nkf_char p1 
) [static]

Definition at line 1968 of file nkf.c.

References nkf_char_unicode_new, nkf_utf8_to_unicode(), and unicode_to_jis_common().

Referenced by w_iconv(), and w_status().

static nkf_char w_iconv ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
) [static]

Definition at line 2105 of file nkf.c.

References EOF, nkf_char_unicode_new, nkf_utf8_to_unicode(), and w2e_conv().

Referenced by check_bom().

static nkf_char w_iconv16 ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
) [static]

Definition at line 2240 of file nkf.c.

Referenced by check_bom(), and kanji_convert().

static nkf_char w_iconv32 ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
) [static]

Definition at line 2247 of file nkf.c.

Referenced by check_bom(), and kanji_convert().

static void w_oconv ( nkf_char  c2,
nkf_char  c1 
) [static]

Definition at line 2536 of file nkf.c.

References e2w_conv(), EOF, nkf_char_unicode_p, nkf_unicode_to_utf8(), and output_bom_f.

static void w_oconv16 ( nkf_char  c2,
nkf_char  c1 
) [static]
static void w_oconv32 ( nkf_char  c2,
nkf_char  c1 
) [static]

Definition at line 2636 of file nkf.c.

References e2w_conv(), ENDIAN_LITTLE, EOF, ISO_8859_1, nkf_char_unicode_p, output_bom_f, and output_endian.

static void w_status ( struct input_code ptr,
nkf_char  c 
) [static]
static nkf_char x0212_shift ( nkf_char  c  )  [static]

Definition at line 1513 of file nkf.c.

References is_eucg3.

Referenced by e2s_conv().

static nkf_char x0212_unshift ( nkf_char  c  )  [static]

Definition at line 1531 of file nkf.c.

References PREFIX_EUCG3.

Referenced by s2e_conv().

static void z_conv ( nkf_char  c2,
nkf_char  c1 
) [static]

Definition at line 3595 of file nkf.c.

References alpha_f, cv, dv, EOF, ev, fv, JIS_X_0201_1976_K, SP, x0201_f, and z_prev1.


Variable Documentation

const char* alias

Definition at line 1127 of file nkf.c.

Referenced by Init_psych_emitter(), ole_type_src_type(), options(), parse(), and yyparse().

int alpha_f = FALSE [static]

Definition at line 395 of file nkf.c.

Referenced by module_connection(), options(), reinit(), and z_conv().

unsigned char ascii_intro = DEFAULT_R [static]

Definition at line 497 of file nkf.c.

Referenced by options(), and reinit().

int backup_f = FALSE [static]

Definition at line 649 of file nkf.c.

Referenced by main(), and options().

char* backup_suffix = "" [static]

Definition at line 650 of file nkf.c.

Referenced by main(), and options().

int base64_count = 0 [static]

Definition at line 484 of file nkf.c.

Referenced by close_mime(), eof_mime(), mime_prechar(), mime_putc(), mimeout_addchar(), open_mime(), and reinit().

const char basis_64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" [static]

Definition at line 4633 of file nkf.c.

int binmode_f = TRUE [static]

Definition at line 392 of file nkf.c.

Referenced by main(), options(), and reinit().

int broken_f = FALSE [static]

Definition at line 399 of file nkf.c.

Referenced by kanji_convert(), module_connection(), options(), and reinit().

char buf[MIMEOUT_BUF_LENGTH+1]

Definition at line 3913 of file nkf.c.

Referenced by add_char_amb_opt_map_info(), BigDecimal_to_f(), BSD_vfprintf(), bsock_getsockopt(), cbsubst_get_all_subst_keys(), cbsubst_get_subst_arg(), cbsubst_get_subst_key(), cbsubst_sym_to_subst(), cmdglob(), compile_warn_print(), cont_restore_1(), convert_UTF8_to_JSON(), convert_UTF8_to_JSON_ASCII(), copy_stream_fallback_body(), create_ip_exc(), expand_case_fold_string_alt(), fbuffer_append_long(), file_expand_path(), finish_writeconv(), flo_to_s(), glob_helper(), glob_make_pattern(), global_id(), inspect1(), inspect2(), ip_ruby_cmd_receiver_get(), ip_ruby_eval(), ip_set_exc_message(), join_path(), json_string_unescape(), lib_fromUTF8_core(), lib_toUTF8_core(), local_tbl_gen(), localtime_with_gmtoff_zone(), match_at(), mSyslog_inspect(), nfc_getc(), nkf_buf_new(), nkf_locale_charmap(), nl_langinfo_codeset(), nogvl_copy_stream_read_write(), numchar_getc(), ole_cp2encoding(), ole_raise(), onig_node_free(), onig_node_str_cat(), onig_node_str_clear(), onigenc_unicode_property_name_to_ctype(), ossl_asn1obj_get_oid(), ossl_asn1prim_to_der(), ossl_bn_to_s(), ossl_hmac_digest(), ossl_hmac_hexdigest(), ossl_hmac_s_digest(), ossl_hmac_s_hexdigest(), ossl_make_error(), ossl_membio2str0(), ossl_pkcs7_add_data(), ossl_spki_print(), ossl_ssl_session_to_der(), ossl_ssl_session_to_pem(), ossl_ssl_session_to_text(), ossl_sslctx_initialize(), ossl_x509crl_get_signature_algorithm(), ossl_x509crl_to_der(), ossl_x509crl_to_pem(), ossl_x509crl_to_text(), ossl_x509name_to_s_old(), ossl_x509req_get_signature_algorithm(), ossl_x509req_to_pem(), ossl_x509req_to_text(), pack_pack(), pack_unpack(), parser_yyerror(), raise_from_check(), raise_zlib_error(), rand_init(), random_seed(), rb_compile_error(), rb_compile_error_append(), rb_compile_warn(), rb_compile_warning(), rb_cstr_to_dbl(), rb_econv_insert_output(), rb_f_global_variables(), rb_feature_p(), rb_home_dir(), rb_num2long(), rb_num2ulong(), rb_parser_dump_tree(), rb_reg_check_preprocess(), rb_reg_preprocess(), rb_reg_preprocess_dregexp(), rb_str_buf_cat_ascii(), rb_str_buf_cat_escaped_char(), rb_str_format(), rb_str_inspect(), rb_str_slice_bang(), rb_sys_warning(), rb_warn(), rb_warning(), reg_enum_key(), report_bug(), ruby__sfvwrite(), ruby_brace_expand(), ruby_glob0(), ruby_setenv(), str_transcode0(), strftimev(), strio_ungetbyte(), strio_ungetc(), strscan_inspect(), swallow(), sys_fail2(), tcl_eval(), tcl_global_eval(), tcl_protect_core(), time_mdump(), time_mload(), time_strftime(), tr_setup_table(), tr_trans(), update_string_node_case_fold(), VpAlloc(), w_long(), w_nbyte(), warn_print(), warn_printf(), and yyparse().

int cap_f = FALSE [static]

Definition at line 412 of file nkf.c.

Referenced by module_connection(), options(), and reinit().

int count

Definition at line 4639 of file nkf.c.

int cp51932_f = FALSE [static]

Definition at line 456 of file nkf.c.

Referenced by e_iconv(), options(), reinit(), and set_input_encoding().

int cp932inv_f = TRUE [static]
const unsigned char cv[] [static]
Initial value:
 {
    0x21,0x21,0x21,0x23,0x21,0x56,0x21,0x57,
    0x21,0x22,0x21,0x26,0x25,0x72,0x25,0x21,
    0x25,0x23,0x25,0x25,0x25,0x27,0x25,0x29,
    0x25,0x63,0x25,0x65,0x25,0x67,0x25,0x43,
    0x21,0x3c,0x25,0x22,0x25,0x24,0x25,0x26,
    0x25,0x28,0x25,0x2a,0x25,0x2b,0x25,0x2d,
    0x25,0x2f,0x25,0x31,0x25,0x33,0x25,0x35,
    0x25,0x37,0x25,0x39,0x25,0x3b,0x25,0x3d,
    0x25,0x3f,0x25,0x41,0x25,0x44,0x25,0x46,
    0x25,0x48,0x25,0x4a,0x25,0x4b,0x25,0x4c,
    0x25,0x4d,0x25,0x4e,0x25,0x4f,0x25,0x52,
    0x25,0x55,0x25,0x58,0x25,0x5b,0x25,0x5e,
    0x25,0x5f,0x25,0x60,0x25,0x61,0x25,0x62,
    0x25,0x64,0x25,0x66,0x25,0x68,0x25,0x69,
    0x25,0x6a,0x25,0x6b,0x25,0x6c,0x25,0x6d,
    0x25,0x6f,0x25,0x73,0x21,0x2b,0x21,0x2c,
    0x00,0x00}

Definition at line 561 of file nkf.c.

Referenced by BigDecimal_add2(), BigDecimal_div2(), BigDecimal_mult2(), BigDecimal_sub2(), ossl_config_add_value(), and z_conv().

int debug_f = FALSE [static]

Definition at line 442 of file nkf.c.

Referenced by debug(), main(), options(), and reinit().

const unsigned char dv[] [static]
Initial value:
 {
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x25,0x74,
    0x00,0x00,0x00,0x00,0x25,0x2c,0x25,0x2e,
    0x25,0x30,0x25,0x32,0x25,0x34,0x25,0x36,
    0x25,0x38,0x25,0x3a,0x25,0x3c,0x25,0x3e,
    0x25,0x40,0x25,0x42,0x25,0x45,0x25,0x47,
    0x25,0x49,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x25,0x50,0x25,0x53,
    0x25,0x56,0x25,0x59,0x25,0x5c,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00}

Definition at line 583 of file nkf.c.

Referenced by z_conv().

void(* encode_fallback)(nkf_char c) = NULL [static]

Definition at line 360 of file nkf.c.

Referenced by e_oconv(), j_oconv(), options(), reinit(), and s_oconv().

struct { ... } encoding_name_to_id_table[]

Referenced by nkf_enc_find_index().

int eolmode_f = 0 [static]

Definition at line 653 of file nkf.c.

Referenced by eol_conv(), module_connection(), oconv_newline(), options(), put_newline(), and reinit().

int estab_f = FALSE [static]

Definition at line 390 of file nkf.c.

Referenced by code_status(), h_conv(), kanji_convert(), reinit(), set_iconv(), and status_check().

const unsigned char ev[] [static]
Initial value:
 {
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x25,0x51,0x25,0x54,
    0x25,0x57,0x25,0x5a,0x25,0x5d,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00}

Definition at line 604 of file nkf.c.

Referenced by EVENTSINK_Invoke(), and z_conv().

int f_line = 0 [static]

Definition at line 489 of file nkf.c.

Referenced by fold_conv(), module_connection(), and reinit().

int f_prev = 0 [static]

Definition at line 490 of file nkf.c.

Referenced by fold_conv(), and reinit().

int file_out_f = FALSE [static]

Definition at line 645 of file nkf.c.

Referenced by main(), options(), and reinit().

int fold_f = FALSE [static]

Definition at line 492 of file nkf.c.

Referenced by module_connection(), options(), and reinit().

int fold_len = 0 [static]

Definition at line 493 of file nkf.c.

Referenced by fold_conv(), options(), and reinit().

int fold_margin = FOLD_MARGIN [static]

Definition at line 504 of file nkf.c.

Referenced by fold_conv(), options(), and reinit().

int fold_preserve_f = FALSE [static]

Definition at line 491 of file nkf.c.

Referenced by fold_conv(), options(), and reinit().

const unsigned char fv[] [static]
Initial value:
 {

    0x00,0x00,0x00,0x00,0x2c,0x2e,0x00,0x3a,
    0x3b,0x3f,0x21,0x00,0x00,0x27,0x60,0x00,
    0x5e,0x00,0x5f,0x00,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x2d,0x00,0x2f,
    0x5c,0x00,0x00,0x7c,0x00,0x00,0x60,0x27,
    0x22,0x22,0x28,0x29,0x00,0x00,0x5b,0x5d,
    0x7b,0x7d,0x3c,0x3e,0x00,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x2b,0x2d,0x00,0x00,
    0x00,0x3d,0x00,0x3c,0x3e,0x00,0x00,0x00,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
    0x24,0x00,0x00,0x25,0x23,0x26,0x2a,0x40,
    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
}

Definition at line 626 of file nkf.c.

Referenced by z_conv().

int guess_f = 0 [static]

Definition at line 447 of file nkf.c.

Referenced by eol_conv(), main(), module_connection(), options(), print_guessed_code(), rb_nkf_guess(), and reinit().

int hira_f = FALSE [static]

Definition at line 394 of file nkf.c.

Referenced by hira_conv(), module_connection(), options(), and reinit().

nkf_char hold_buf[HOLD_SIZE *2] [static]

Definition at line 3064 of file nkf.c.

int hold_count = 0 [static]

Definition at line 3065 of file nkf.c.

nkf_char(* i_bgetc)(FILE *) = std_getc [static]

Definition at line 540 of file nkf.c.

Referenced by module_connection(), and reinit().

nkf_char(* i_bungetc)(nkf_char c,FILE *f) = std_ungetc [static]

Definition at line 541 of file nkf.c.

Referenced by module_connection(), and reinit().

nkf_char(* i_cgetc)(FILE *) = std_getc [static]

Definition at line 413 of file nkf.c.

Referenced by cap_getc(), and module_connection().

nkf_char(* i_cungetc)(nkf_char c,FILE *f) = std_ungetc [static]

Definition at line 414 of file nkf.c.

Referenced by cap_getc(), cap_ungetc(), and module_connection().

nkf_char(* i_getc)(FILE *f) = std_getc [static]
nkf_char(* i_mgetc)(FILE *) = std_getc [static]

Definition at line 545 of file nkf.c.

Referenced by mime_getc(), module_connection(), reinit(), switch_mime_getc(), and unswitch_mime_getc().

nkf_char(* i_mgetc_buf)(FILE *) = std_getc [static]

Definition at line 549 of file nkf.c.

Referenced by mime_getc_buf(), reinit(), switch_mime_getc(), and unswitch_mime_getc().

nkf_char(* i_mungetc)(nkf_char c,FILE *f) = std_ungetc [static]

Definition at line 546 of file nkf.c.

Referenced by module_connection(), reinit(), switch_mime_getc(), and unswitch_mime_getc().

nkf_char(* i_mungetc_buf)(nkf_char c, FILE *f) = std_ungetc [static]

Definition at line 550 of file nkf.c.

Referenced by reinit(), switch_mime_getc(), and unswitch_mime_getc().

nkf_char(* i_nfc_getc)(FILE *) = std_getc [static]

Definition at line 407 of file nkf.c.

Referenced by module_connection(), and nfc_getc().

nkf_char(* i_nfc_ungetc)(nkf_char c,FILE *f) = std_ungetc [static]

Definition at line 408 of file nkf.c.

Referenced by module_connection(), nfc_getc(), and nfc_ungetc().

nkf_char(* i_ngetc)(FILE *) = std_getc [static]

Definition at line 435 of file nkf.c.

Referenced by module_connection(), and numchar_getc().

nkf_char(* i_nungetc)(nkf_char c,FILE *f) = std_ungetc [static]

Definition at line 436 of file nkf.c.

Referenced by module_connection(), numchar_getc(), and numchar_ungetc().

nkf_char(* i_ugetc)(FILE *) = std_getc [static]

Definition at line 417 of file nkf.c.

Referenced by module_connection(), and url_getc().

nkf_char(* i_ungetc)(nkf_char c, FILE *f) = std_ungetc [static]
nkf_char(* i_uungetc)(nkf_char c,FILE *f) = std_ungetc [static]

Definition at line 418 of file nkf.c.

Referenced by module_connection(), url_getc(), and url_ungetc().

nkf_char(* iconv)(nkf_char c2, nkf_char c1, nkf_char c0) = no_connection2 [static]
nkf_char(* iconv_for_check)(nkf_char c2, nkf_char c1, nkf_char c0)=0 [static]

Definition at line 444 of file nkf.c.

Referenced by main(), reinit(), and set_iconv().

const int id
unsigned int input
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}
}

Definition at line 472 of file nkf.c.

const char* input_codename = NULL [static]
nkf_encoding* input_encoding = NULL [static]

Definition at line 337 of file nkf.c.

int input_endian = ENDIAN_BIG [static]
int input_eol = 0 [static]

Definition at line 654 of file nkf.c.

Referenced by eol_conv(), main(), print_guessed_code(), and reinit().

int input_mode = ASCII [static]

Definition at line 554 of file nkf.c.

Referenced by broken_getc(), kanji_convert(), mime_getc(), and reinit().

int iso2022jp_f = FALSE [static]

Definition at line 403 of file nkf.c.

Referenced by e_iconv(), module_connection(), options(), reinit(), and s_iconv().

int iso8859_f = FALSE [static]

Definition at line 400 of file nkf.c.

Referenced by kanji_convert(), options(), reinit(), and set_input_encoding().

unsigned char kanji_intro = DEFAULT_J [static]

Definition at line 496 of file nkf.c.

Referenced by options(), output_escape_sequence(), and reinit().

unsigned int last
struct { ... } long_option[] [static]

Referenced by options().

int mime_decode_f = FALSE [static]

Definition at line 397 of file nkf.c.

Referenced by kanji_convert(), options(), and reinit().

int mime_decode_mode = FALSE [static]
const nkf_char mime_encode[] [static]
Initial value:
 {
    EUC_JP, SHIFT_JIS, ISO_8859_1, ISO_8859_1, JIS_X_0208, JIS_X_0201_1976_K, JIS_X_0201_1976_K,

    UTF_8, UTF_8,

    ASCII,
    0
}

Definition at line 3888 of file nkf.c.

const nkf_char mime_encode_method[] [static]
Initial value:
 {
    'B', 'B','Q', 'B', 'B', 'B', 'Q',

    'B', 'Q',

    'Q',
    0
}

Definition at line 3897 of file nkf.c.

int mime_f = MIME_DECODE_DEFAULT [static]
nkf_char(* mime_iconv_back)(nkf_char c2, nkf_char c1, nkf_char c0) = NULL [static]

Definition at line 3918 of file nkf.c.

Referenced by mime_begin_strict(), and unswitch_mime_getc().

struct { ... } mime_input_state [static]
const unsigned char* mime_pattern[] [static]
Initial value:
 {
    (const unsigned char *)"\075?EUC-JP?B?",
    (const unsigned char *)"\075?SHIFT_JIS?B?",
    (const unsigned char *)"\075?ISO-8859-1?Q?",
    (const unsigned char *)"\075?ISO-8859-1?B?",
    (const unsigned char *)"\075?ISO-2022-JP?B?",
    (const unsigned char *)"\075?ISO-2022-JP?B?",
    (const unsigned char *)"\075?ISO-2022-JP?Q?",

    (const unsigned char *)"\075?UTF-8?B?",
    (const unsigned char *)"\075?UTF-8?Q?",

    (const unsigned char *)"\075?US-ASCII?Q?",
    NULL
}

Definition at line 3862 of file nkf.c.

Initial value:
 {
    e_iconv, s_iconv, 0, 0, 0, 0,

    w_iconv, w_iconv,

    0,
}

Definition at line 3880 of file nkf.c.

Referenced by mime_begin_strict().

int mimebuf_f = FALSE [static]
int mimeout_f = FALSE [static]

Definition at line 401 of file nkf.c.

Referenced by eof_mime(), mime_putc(), module_connection(), options(), rb_nkf_convert(), and reinit().

int mimeout_mode = 0 [static]
struct { ... } mimeout_state [static]
int ms_ucs_map_f = UCS_MAP_ASCII [static]
const char* name

Definition at line 208 of file nkf.c.

Referenced by addrinfo_inspect(), constant_to_sym(), curses_keyname(), env_aset(), fole_s_show_help(), folemethod_event_interface(), foletypelib_name(), foletypelib_s_typelibs(), get_device_once(), get_iconv_opt_i(), get_syserr(), GetDigestPtr(), GetX509NamePtr(), glob_helper(), host_str(), Init_curses(), init_env(), Init_ossl_asn1(), Init_ossl_ssl(), Init_prelude(), insn_operand_intern(), ip_create_slave(), ip_create_slave_core(), iseq_load(), match_backref_number(), match_inspect(), name_err_initialize(), ole_method_event(), options(), ossl_cipher_initialize(), ossl_config_get_value_old(), ossl_pkcs12_s_create(), ossl_pkcs7_sym2typeid(), ossl_sslctx_set_ssl_version(), ossl_x509_get_issuer(), ossl_x509_get_subject(), ossl_x509name_add_entry(), ossl_x509name_alloc(), ossl_x509name_hash(), ossl_x509name_initialize(), ossl_x509name_to_a(), ossl_x509name_to_der(), ossl_x509name_to_s(), ossl_x509name_to_s_old(), ossl_x509req_get_subject(), prelude_require(), rb_attr(), rb_check_argv(), rb_class2name(), rb_dlcfunc_initialize(), rb_enc_unicode_p(), rb_file_dirname(), rb_file_join(), rb_file_s_basename(), rb_file_s_extname(), rb_iseq_disasm(), rb_mod_const_defined(), rb_mod_const_get(), rb_reg_regsub(), rb_stat_inspect(), rb_struct_define_without_accessor(), rb_struct_s_def(), rb_w32_pipe(), rlimit_resource_type(), rlimit_resource_value(), rsock_intern_family(), rsock_intern_family_noprefix(), rsock_intern_ip_optname(), rsock_intern_iplevel(), rsock_intern_ipproto(), rsock_intern_ipv6_optname(), rsock_intern_local_optname(), rsock_intern_protocol_family(), rsock_intern_scm_optname(), rsock_intern_so_optname(), rsock_intern_socktype(), rsock_intern_tcp_optname(), rsock_intern_udp_optname(), set_conf_section_i(), specific_eval(), syck_resolver_transfer(), w_encoding(), and yyparse().

int nfc_f = FALSE [static]

Definition at line 406 of file nkf.c.

Referenced by module_connection(), options(), reinit(), and set_input_encoding().

Definition at line 167 of file nkf.c.

nkf_state_t* nkf_state = NULL [static]

Definition at line 3015 of file nkf.c.

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

Definition at line 153 of file nkf.c.

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

Definition at line 156 of file nkf.c.

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

Definition at line 154 of file nkf.c.

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

Definition at line 155 of file nkf.c.

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

Definition at line 158 of file nkf.c.

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

Definition at line 159 of file nkf.c.

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

Definition at line 157 of file nkf.c.

int no_best_fit_chars_f = FALSE [static]

Definition at line 357 of file nkf.c.

Referenced by options(), reinit(), and unicode_to_jis_common().

int no_cp932ext_f = FALSE [static]

Definition at line 355 of file nkf.c.

Referenced by options(), reinit(), and unicode_to_jis_common2().

int noout_f = FALSE [static]

Definition at line 440 of file nkf.c.

Referenced by module_connection(), options(), and reinit().

int nop_f = FALSE [static]

Definition at line 391 of file nkf.c.

Referenced by main(), noconvert(), options(), and reinit().

int numchar_f = FALSE [static]

Definition at line 434 of file nkf.c.

Referenced by module_connection(), options(), and reinit().

void(* o_base64conv)(nkf_char c2, nkf_char c1) = no_connection [static]

Definition at line 530 of file nkf.c.

Referenced by mime_prechar(), module_connection(), and reinit().

void(* o_eol_conv)(nkf_char c2, nkf_char c1) = no_connection [static]

Definition at line 527 of file nkf.c.

Referenced by module_connection(), and reinit().

void(* o_fconv)(nkf_char c2, nkf_char c1) = no_connection [static]

Definition at line 526 of file nkf.c.

Referenced by fold_conv(), module_connection(), and reinit().

void(* o_hira_conv)(nkf_char c2, nkf_char c1) = no_connection [static]

Definition at line 529 of file nkf.c.

Referenced by module_connection(), and reinit().

void(* o_iso2022jp_check_conv)(nkf_char c2, nkf_char c1) = no_connection [static]

Definition at line 531 of file nkf.c.

Referenced by module_connection(), and reinit().

void(* o_mputc)(nkf_char c) = std_putc [static]

Definition at line 543 of file nkf.c.

Referenced by mime_putc(), module_connection(), open_mime(), and reinit().

void(* o_putc)(nkf_char c) = std_putc [static]

Definition at line 535 of file nkf.c.

Referenced by module_connection(), and reinit().

void(* o_rot_conv)(nkf_char c2, nkf_char c1) = no_connection [static]

Definition at line 528 of file nkf.c.

Referenced by module_connection(), and reinit().

void(* o_zconv)(nkf_char c2, nkf_char c1) = no_connection [static]

Definition at line 525 of file nkf.c.

Referenced by module_connection(), and reinit().

void(* oconv)(nkf_char c2, nkf_char c1) = no_connection [static]

Definition at line 523 of file nkf.c.

Referenced by module_connection().

int option_mode = 0 [static]

Definition at line 644 of file nkf.c.

Referenced by options(), and reinit().

int output_bom_f = FALSE [static]

Definition at line 364 of file nkf.c.

Referenced by options(), rb_nkf_convert(), reinit(), set_output_encoding(), w_oconv(), w_oconv16(), and w_oconv32().

nkf_encoding* output_encoding = NULL [static]

Definition at line 338 of file nkf.c.

Referenced by rb_nkf_convert().

int output_endian = ENDIAN_BIG [static]

Definition at line 365 of file nkf.c.

Referenced by options(), reinit(), set_output_encoding(), w_oconv16(), and w_oconv32().

int output_mode = ASCII [static]
int overwrite_f = FALSE [static]

Definition at line 647 of file nkf.c.

Referenced by main(), and options().

unsigned char prefix_table[256] [static]

Definition at line 467 of file nkf.c.

Referenced by options(), reinit(), and s_oconv().

int preserve_time_f = FALSE [static]

Definition at line 648 of file nkf.c.

Referenced by main(), and options().

nkf_char prev_cr = 0 [static]

Definition at line 655 of file nkf.c.

Referenced by eol_conv(), and reinit().

int rot_f = FALSE [static]

Definition at line 393 of file nkf.c.

Referenced by module_connection(), options(), and reinit().

const nkf_char score_table_A0[] [static]
Initial value:
 {
    0, 0, 0, 0,
    0, 0, 0, 0,
    0, SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND,
    SCORE_DEPEND, SCORE_DEPEND, SCORE_DEPEND, SCORE_NO_EXIST,
}

Definition at line 2691 of file nkf.c.

const nkf_char score_table_F0[] [static]
Initial value:
 {
    SCORE_L2, SCORE_L2, SCORE_L2, SCORE_L2,
    SCORE_L2, SCORE_DEPEND, SCORE_NO_EXIST, SCORE_NO_EXIST,
    SCORE_DEPEND, SCORE_DEPEND, SCORE_CP932, SCORE_CP932,
    SCORE_CP932, SCORE_NO_EXIST, SCORE_NO_EXIST, SCORE_ERROR,
}

Definition at line 2698 of file nkf.c.

unsigned char stdibuf[IOBUF_SIZE] [static]

Definition at line 382 of file nkf.c.

Referenced by main().

unsigned char stdobuf[IOBUF_SIZE] [static]

Definition at line 383 of file nkf.c.

Referenced by main().

unsigned int top
int unbuf_f = FALSE [static]

Definition at line 389 of file nkf.c.

Referenced by main(), mime_begin_strict(), options(), and reinit().

nkf_char unicode_subchar = '?' [static]

Definition at line 359 of file nkf.c.

Referenced by encode_fallback_subchar(), options(), and reinit().

int url_f = FALSE [static]

Definition at line 416 of file nkf.c.

Referenced by module_connection(), options(), and reinit().

int x0201_f = NKF_UNSPECIFIED [static]
int x0212_f = FALSE [static]

Definition at line 464 of file nkf.c.

Referenced by e_oconv(), main(), options(), reinit(), set_input_encoding(), and set_output_encoding().

int x0213_f = FALSE [static]
nkf_char z_prev1 = 0 [static]

Definition at line 3592 of file nkf.c.

Referenced by reinit(), and z_conv().

nkf_char z_prev2 = 0 [static]

Definition at line 3592 of file nkf.c.