w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

nkf.c File Reference
#include "config.h"
#include "nkf.h"
#include "utf8tbl.h"
#include <assert.h>
#include "ptexenc-nkf.c"
Include dependency graph for nkf.c:

Go to the source code of this file.

Classes

struct  nkf_native_encoding
 
struct  nkf_encoding
 
struct  input_code
 
struct  nkf_buf_t
 
struct  nkf_state_t
 

Macros

#define NKF_VERSION   "2.1.0"
 
#define NKF_RELEASE_DATE   "2009-11-17"
 
#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 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 /* 01 - 62 ku offset */
 
#define SJ6394   0x0161 /* 63 - 94 ku offset */
 
#define NKF_ICONV_INVALID_CODE_RANGE   -13
 
#define NKF_ICONV_NEED_ONE_MORE_BYTE   -1
 
#define NKF_ICONV_NEED_TWO_MORE_BYTES   -2
 
#define UTF16_TO_UTF32(lead, trail)   (((lead) << 10) + (trail) - NKF_INT32_C(0x35FDC00))
 
#define output_ascii_escape_sequence(mode)
 
#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_NO_EXIST   (SCORE_X0212 << 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   ; /* 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 ,
  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 , 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 voidnkf_xmalloc (size_t size)
 
static voidnkf_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 unsigned 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 unsigned char nkf_buf_pop (nkf_buf_t *buf)
 
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, int c1, int c2)
 
static void check_bom (FILE *f)
 
static void eol_conv (nkf_char c2, nkf_char c1)
 
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 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 int kanji_convert (FILE *f)
 
static int options (unsigned char *cp)
 

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 = 0
 
static int no_cp932ext_f = 0
 
static int no_best_fit_chars_f = 0
 
static int input_endian = ENDIAN_BIG
 
static nkf_char unicode_subchar = '?'
 
static void(* encode_fallback )(nkf_char c) = NULL
 
static int output_bom_f = 0
 
static int output_endian = ENDIAN_BIG
 
static int unbuf_f = 0
 
static int estab_f = 0
 
static int nop_f = 0
 
static int binmode_f = 1
 
static int rot_f = 0
 
static int hira_f = 0
 
static int alpha_f = 0
 
static int mime_f = 8
 
static int mime_decode_f = 0
 
static int mimebuf_f = 0
 
static int broken_f = 0
 
static int iso8859_f = 0
 
static int mimeout_f = 0
 
static int x0201_f = 1
 
static int iso2022jp_f = 0
 
static int nfc_f = 0
 
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 = 0
 
static nkf_char(* i_cgetc )(FILE *) = std_getc
 
static nkf_char(* i_cungetc )(nkf_char c, FILE *f) = std_ungetc
 
static int url_f = 0
 
static nkf_char(* i_ugetc )(FILE *) = std_getc
 
static nkf_char(* i_uungetc )(nkf_char c, FILE *f) = std_ungetc
 
static int numchar_f = 0
 
static nkf_char(* i_ngetc )(FILE *) = std_getc
 
static nkf_char(* i_nungetc )(nkf_char c, FILE *f) = std_ungetc
 
static int noout_f = 0
 
static int debug_f = 0
 
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 = 0
 
static int cp932inv_f = 1
 
static int x0212_f = 0
 
static int x0213_f = 0
 
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 = 0
 
static int fold_f = 0
 
static int fold_len = 0
 
static unsigned char kanji_intro = 'B'
 
static unsigned char ascii_intro = 'B'
 
static int fold_margin = 10
 
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 = 0
 
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 = 0
 
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 unsigned char hold_buf [1024 *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 [(1024)]
 
   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 []
 
struct {
   char   buf [74+1]
 
   int   count
 
mimeout_state
 

Macro Definition Documentation

◆ bin2hex

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

Definition at line 291 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 3374 of file nkf.c.

◆ CLASS_MASK

#define CLASS_MASK   NKF_INT32_C(0xFF000000)

Definition at line 416 of file nkf.c.

◆ CLASS_UNICODE

#define CLASS_UNICODE   NKF_INT32_C(0x01000000)

Definition at line 417 of file nkf.c.

◆ COPY_RIGHT

#define COPY_RIGHT
Value:
"Copyright (C) 1987, FUJITSU LTD. (I.Ichikawa).\n" \
"Copyright (C) 1996-2009, 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 496 of file nkf.c.

◆ DEFAULT_J

#define DEFAULT_J   'B'

Definition at line 307 of file nkf.c.

◆ DEFAULT_R

#define DEFAULT_R   'B'

Definition at line 308 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 495 of file nkf.c.

◆ GETA1

#define GETA1   0x22

Definition at line 311 of file nkf.c.

◆ GETA2

#define GETA2   0x2e

Definition at line 312 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)
#define c(n)
Definition: gpos-common.c:150

Definition at line 288 of file nkf.c.

◆ HOLD_SIZE

#define HOLD_SIZE   1024

Definition at line 300 of file nkf.c.

◆ IOBUF_SIZE

#define IOBUF_SIZE   16384

Definition at line 304 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 274 of file nkf.c.

◆ is_eucg3

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

Definition at line 292 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 297 of file nkf.c.

◆ LAST

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

Definition at line 5362 of file nkf.c.

◆ LF

#define LF   0x0a

Definition at line 72 of file nkf.c.

◆ MAXRECOVER

#define MAXRECOVER   20

Definition at line 3870 of file nkf.c.

◆ MIME_BUF_MASK

#define MIME_BUF_MASK   (MIME_BUF_SIZE-1)

Definition at line 3860 of file nkf.c.

◆ MIME_BUF_SIZE

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

Definition at line 3859 of file nkf.c.

◆ mime_input_buf

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

Definition at line 3861 of file nkf.c.

◆ MIMEOUT_BUF_LENGTH

#define MIMEOUT_BUF_LENGTH   74

Definition at line 4586 of file nkf.c.

◆ MORE

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

Definition at line 5360 of file nkf.c.

◆ NEXT

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

Definition at line 5358 of file nkf.c.

◆ nkf_buf_empty_p

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

Definition at line 830 of file nkf.c.

◆ nkf_buf_length

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

Definition at line 829 of file nkf.c.

◆ nkf_byte_jisx0201_katakana_p

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

Definition at line 298 of file nkf.c.

◆ nkf_char_euc3_new

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

Definition at line 421 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 424 of file nkf.c.

◆ nkf_char_unicode_new

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

Definition at line 422 of file nkf.c.

◆ nkf_char_unicode_p

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

Definition at line 423 of file nkf.c.

◆ nkf_char_unicode_value_p

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

Definition at line 425 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 NkfEncodingISO_2022_JP
Definition: nkf.c:154
nkf_native_encoding NkfEncodingASCII
Definition: nkf.c:153

Definition at line 733 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)
@ CP50221
Definition: nkf.c:91
@ CP50220
Definition: nkf.c:90
@ CP50222
Definition: nkf.c:92

Definition at line 740 of file nkf.c.

◆ nkf_enc_name

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

Definition at line 728 of file nkf.c.

◆ nkf_enc_to_base_encoding

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

Definition at line 730 of file nkf.c.

◆ nkf_enc_to_iconv

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

Definition at line 731 of file nkf.c.

◆ nkf_enc_to_index

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

Definition at line 729 of file nkf.c.

◆ nkf_enc_to_oconv

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

Definition at line 732 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_8
Definition: nkf.c:157
nkf_native_encoding NkfEncodingUTF_32
Definition: nkf.c:159
nkf_native_encoding NkfEncodingUTF_16
Definition: nkf.c:158

Definition at line 736 of file nkf.c.

◆ NKF_ICONV_INVALID_CODE_RANGE

#define NKF_ICONV_INVALID_CODE_RANGE   -13

Definition at line 2170 of file nkf.c.

◆ NKF_ICONV_NEED_ONE_MORE_BYTE

#define NKF_ICONV_NEED_ONE_MORE_BYTE   -1

Definition at line 2196 of file nkf.c.

◆ NKF_ICONV_NEED_TWO_MORE_BYTES

#define NKF_ICONV_NEED_TWO_MORE_BYTES   -2

Definition at line 2197 of file nkf.c.

◆ nkf_isalnum

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

Definition at line 285 of file nkf.c.

◆ nkf_isalpha

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

Definition at line 284 of file nkf.c.

◆ nkf_isblank

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

Definition at line 282 of file nkf.c.

◆ nkf_isdigit

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

Definition at line 280 of file nkf.c.

◆ nkf_isgraph

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

Definition at line 287 of file nkf.c.

◆ nkf_isoctal

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

Definition at line 279 of file nkf.c.

◆ nkf_isprint

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

Definition at line 286 of file nkf.c.

◆ nkf_isspace

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

Definition at line 283 of file nkf.c.

◆ nkf_isxdigit

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

Definition at line 281 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 LF
Definition: nkf.c:72
#define CR
Definition: nkf.c:73
#define DEL
Definition: nkf.c:76
#define SP
Definition: nkf.c:75

Definition at line 293 of file nkf.c.

◆ NKF_RELEASE_DATE

#define NKF_RELEASE_DATE   "2009-11-17"

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

◆ NKF_VERSION

#define NKF_VERSION   "2.1.0"

Definition at line 23 of file nkf.c.

◆ nkf_xfree

#define nkf_xfree (   ptr)    free(ptr)

Definition at line 684 of file nkf.c.

◆ output_ascii_escape_sequence

#define output_ascii_escape_sequence (   mode)
Value:
do { \
(*o_putc)(ESC); \
(*o_putc)('('); \
(*o_putc)(ascii_intro); \
output_mode = mode; \
} \
} while (0)
#define mode
Definition: aptex-macros.h:510
#define ESC
Definition: nkf.c:74
@ ISO_8859_1
Definition: nkf.c:88
@ ASCII
Definition: nkf.c:87
static unsigned char ascii_intro
Definition: nkf.c:491
output_mode
Definition: luatex-api.h:25

Definition at line 2273 of file nkf.c.

◆ PREFIX_EUCG3

#define PREFIX_EUCG3   NKF_INT32_C(0x8F00)

Definition at line 415 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) \
)

Definition at line 3698 of file nkf.c.

◆ rot47

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

Definition at line 3708 of file nkf.c.

◆ SCORE_CP932

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

Definition at line 2672 of file nkf.c.

◆ SCORE_DEPEND

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

Definition at line 2671 of file nkf.c.

◆ SCORE_ERROR

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

Definition at line 2676 of file nkf.c.

◆ SCORE_iMIME

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

Definition at line 2675 of file nkf.c.

◆ SCORE_INIT

#define SCORE_INIT   (SCORE_iMIME)

Definition at line 2678 of file nkf.c.

◆ SCORE_KANA

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

Definition at line 2670 of file nkf.c.

◆ SCORE_L2

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

Definition at line 2669 of file nkf.c.

◆ SCORE_NO_EXIST

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

Definition at line 2674 of file nkf.c.

◆ SCORE_X0212

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

Definition at line 2673 of file nkf.c.

◆ SEND

#define SEND   ; /* output c1 and c2, get next */

Definition at line 5361 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 5363 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 5359 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 3006 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 343 of file nkf.c.

◆ UCS_MAP_CP10001

#define UCS_MAP_CP10001   3

Definition at line 346 of file nkf.c.

◆ UCS_MAP_CP932

#define UCS_MAP_CP932   2

Definition at line 345 of file nkf.c.

◆ UCS_MAP_MS

#define UCS_MAP_MS   1

Definition at line 344 of file nkf.c.

◆ UNICODE_BMP_MAX

#define UNICODE_BMP_MAX   NKF_INT32_C(0x0000FFFF)

Definition at line 419 of file nkf.c.

◆ UNICODE_MAX

#define UNICODE_MAX   NKF_INT32_C(0x0010FFFF)

Definition at line 420 of file nkf.c.

◆ UTF16_TO_UTF32

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

Definition at line 2198 of file nkf.c.

◆ VALUE_MASK

#define VALUE_MASK   NKF_INT32_C(0x00FFFFFF)

Definition at line 418 of file nkf.c.

Enumeration Type Documentation

◆ byte_order

enum byte_order
Enumerator
ENDIAN_BIG 
ENDIAN_LITTLE 
ENDIAN_2143 
ENDIAN_3412 
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 
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

◆ base64_conv()

static void base64_conv ( nkf_char  c2,
nkf_char  c1 
)
static

Definition at line 5024 of file nkf.c.

References c1, c2, and mime_prechar().

Referenced by module_connection().

◆ base64decode()

static nkf_char base64decode ( nkf_char  c)
static

Definition at line 4329 of file nkf.c.

References c, and i.

Referenced by mime_getc().

◆ broken_getc()

◆ broken_ungetc()

static nkf_char broken_ungetc ( nkf_char  c,
FILE f 
)
static

Definition at line 3326 of file nkf.c.

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

Referenced by module_connection().

◆ cap_getc()

static nkf_char cap_getc ( FILE f)
static

Definition at line 4180 of file nkf.c.

References f, hex_getc(), i_cgetc, and i_cungetc.

Referenced by module_connection().

◆ cap_ungetc()

static nkf_char cap_ungetc ( nkf_char  c,
FILE f 
)
static

Definition at line 4186 of file nkf.c.

References c, f, and i_cungetc.

Referenced by module_connection().

◆ check_bom()

static void check_bom ( FILE f)
static

◆ close_mime()

static void close_mime ( void  )
static

Definition at line 4674 of file nkf.c.

References base64_count, and mimeout_mode.

Referenced by eof_mime(), and mime_putc().

◆ clr_code_score()

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

Definition at line 2703 of file nkf.c.

References ptr.

Referenced by mime_begin_strict().

◆ code_score()

static void code_score ( struct input_code ptr)
static

◆ code_status()

static void code_status ( nkf_char  c)
static

Definition at line 2958 of file nkf.c.

References c, DEL, estab_f, input_code_list, p, ptr, check-static-inits::result, set_iconv(), status_reset(), and TRUE.

Referenced by h_conv(), and kanji_convert().

◆ debug()

static void debug ( const char *  str)
static

Definition at line 4086 of file nkf.c.

References debug_f, fprintf, and str.

Referenced by kanji_convert(), and set_iconv().

◆ e2s_conv()

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

Definition at line 1535 of file nkf.c.

References c1, c2, is_eucg3, nkf_isgraph, p1, p2, ptr, x0212_shift(), x0212_shiftjis, and x0213_f.

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

◆ e2w_conv()

◆ e_iconv()

static nkf_char e_iconv ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
)
static

◆ e_oconv()

◆ e_status()

static void e_status ( struct input_code ptr,
nkf_char  c 
)
static

◆ encode_fallback_html()

static void encode_fallback_html ( nkf_char  c)
static

Definition at line 1044 of file nkf.c.

References c, NKF_INT32_C, oconv, and VALUE_MASK.

Referenced by options().

◆ encode_fallback_java()

static void encode_fallback_java ( nkf_char  c)
static

Definition at line 1079 of file nkf.c.

References bin2hex, c, nkf_char_unicode_bmp_p, and VALUE_MASK.

Referenced by options().

◆ encode_fallback_perl()

static void encode_fallback_perl ( nkf_char  c)
static

Definition at line 1100 of file nkf.c.

References c, nkf_each_char_to_hex(), and oconv.

Referenced by options().

◆ encode_fallback_subchar()

static void encode_fallback_subchar ( nkf_char  c)
static

Definition at line 1111 of file nkf.c.

References c, and unicode_subchar.

Referenced by options().

◆ encode_fallback_xml()

static void encode_fallback_xml ( nkf_char  c)
static

Definition at line 1068 of file nkf.c.

References c, nkf_each_char_to_hex(), and oconv.

Referenced by options().

◆ eof_mime()

static void eof_mime ( void  )
static

◆ eol_conv()

static void eol_conv ( nkf_char  c2,
nkf_char  c1 
)
static

Definition at line 3334 of file nkf.c.

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

Referenced by module_connection().

◆ find_inputcode_byfunc()

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

Definition at line 1459 of file nkf.c.

References input_code::iconv_func, input_code_list, and p.

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

◆ fold_conv()

static void fold_conv ( nkf_char  c2,
nkf_char  c1 
)
static

◆ get_guessed_code()

static const char* get_guessed_code ( void  )
static

Definition at line 4105 of file nkf.c.

References find_inputcode_byfunc(), iconv, input_codename, p, SCORE_CP932, SCORE_DEPEND, SCORE_KANA, SCORE_X0212, and strcmp().

Referenced by ptexenc_nkf().

◆ h_conv()

static int h_conv ( FILE f,
int  c1,
int  c2 
)
static

it must NOT be in the kanji shifte sequence

it must NOT be written in JIS7

and it must be after 2 byte 8bit code

now, 1) EOF is detected, or 2) Code is established, or 3) Buffer is FULL (but last word is pushed)

in 1) and 3) cases, we continue to use Kanji codes by oconv and leave estab_f unchanged.

Definition at line 3065 of file nkf.c.

References c1, c2, code_status(), DEL, EOF, ESC, estab_f, f, hold_buf, hold_count, i_getc, iconv, input_code_list, JIS_X_0201_1976_K, p, push_hold_buf(), check-static-inits::result, ret, s_iconv(), set_iconv(), and TRUE.

Referenced by kanji_convert().

◆ hex_getc()

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

References c1, c2, ch, f, hex2bin, and nkf_isxdigit.

Referenced by cap_getc(), and url_getc().

◆ hira_conv()

static void hira_conv ( nkf_char  c2,
nkf_char  c1 
)
static

Definition at line 3728 of file nkf.c.

References c1, c2, hira_f, nkf_char_unicode_new, nkf_enc_unicode_p, and output_encoding.

Referenced by module_connection().

◆ iso2022jp_check_conv()

static void iso2022jp_check_conv ( nkf_char  c2,
nkf_char  c1 
)
static

Definition at line 3763 of file nkf.c.

References c, c1, c2, end, GETA1, GETA2, i, range, RANGE_NUM_MAX, and start.

Referenced by module_connection().

◆ j_oconv()

◆ kanji_convert()

◆ mime_begin()

static nkf_char mime_begin ( FILE f)
static

Definition at line 4022 of file nkf.c.

References c1, CR, EOF, f, FALSE, i, is_alnum, k, LF, MAXRECOVER, mime_decode_mode, mime_input_buf, mime_input_state, SP, and switch_mime_getc().

Referenced by kanji_convert().

◆ mime_begin_strict()

◆ mime_getc()

◆ mime_getc_buf()

static nkf_char mime_getc_buf ( FILE f)
static

Definition at line 3896 of file nkf.c.

References f, i_mgetc_buf, mime_input_buf, mime_input_state, and mimebuf_f.

Referenced by switch_mime_getc().

◆ mime_input_buf_unshift()

static void mime_input_buf_unshift ( nkf_char  c)
static

Definition at line 3873 of file nkf.c.

References c, mime_input_buf, and mime_input_state.

Referenced by mime_ungetc().

◆ mime_integrity()

static nkf_char mime_integrity ( FILE f,
const unsigned char *  p 
)
static

Definition at line 3931 of file nkf.c.

References c, d, EOF, f, i_getc, is_alnum, MIME_BUF_MASK, mime_decode_mode, mime_input_buf, mime_input_state, p, q, and switch_mime_getc().

Referenced by mime_begin_strict().

◆ mime_prechar()

static void mime_prechar ( nkf_char  c2,
nkf_char  c1 
)
static

Definition at line 4641 of file nkf.c.

References ASCII, base64_count, c2, EOF, ISO_8859_1, mimeout_mode, mimeout_state, o_base64conv, OCONV_NEWLINE, open_mime(), and SP.

Referenced by base64_conv().

◆ mime_putc()

◆ mime_ungetc()

static nkf_char mime_ungetc ( nkf_char  c,
FILE f 
)
static

Definition at line 3879 of file nkf.c.

References c, and mime_input_buf_unshift().

Referenced by module_connection(), and switch_mime_getc().

◆ mime_ungetc_buf()

static nkf_char mime_ungetc_buf ( nkf_char  c,
FILE f 
)
static

Definition at line 3886 of file nkf.c.

References c, f, mime_input_buf, mime_input_state, and mimebuf_f.

Referenced by switch_mime_getc().

◆ mimeout_addchar()

static void mimeout_addchar ( nkf_char  c)
static

Definition at line 4710 of file nkf.c.

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

Referenced by mime_putc().

◆ module_connection()

◆ nfc_getc()

◆ nfc_ungetc()

static nkf_char nfc_ungetc ( nkf_char  c,
FILE f 
)
static

Definition at line 4321 of file nkf.c.

References c, f, and i_nfc_ungetc.

Referenced by module_connection().

◆ nkf_buf_at()

static unsigned char nkf_buf_at ( nkf_buf_t buf,
int  index 
)
static

Definition at line 833 of file nkf.c.

References assert(), buf, index, and len.

Referenced by nfc_getc().

◆ nkf_buf_clear()

static void nkf_buf_clear ( nkf_buf_t buf)
static

Definition at line 840 of file nkf.c.

References buf.

Referenced by nfc_getc(), and nkf_state_init().

◆ nkf_buf_new()

static nkf_buf_t* nkf_buf_new ( int  length)
static

Definition at line 811 of file nkf.c.

References buf, length, and nkf_xmalloc().

Referenced by nkf_state_init().

◆ nkf_buf_pop()

static unsigned char nkf_buf_pop ( nkf_buf_t buf)
static

Definition at line 855 of file nkf.c.

References assert(), buf, and nkf_buf_empty_p.

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

◆ nkf_buf_push()

static void nkf_buf_push ( nkf_buf_t buf,
nkf_char  c 
)
static

Definition at line 846 of file nkf.c.

References buf, c, exit(), and EXIT_FAILURE.

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

◆ nkf_default_encoding()

static nkf_encoding* nkf_default_encoding ( )
static

Definition at line 792 of file nkf.c.

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

Referenced by module_connection().

◆ nkf_each_char_to_hex()

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

Definition at line 1026 of file nkf.c.

References bin2hex, c, shift, and VALUE_MASK.

Referenced by encode_fallback_perl(), and encode_fallback_xml().

◆ nkf_enc_find()

static nkf_encoding* nkf_enc_find ( const char *  name)
static

Definition at line 720 of file nkf.c.

References idx, name, nkf_enc_find_index(), and nkf_enc_from_index().

Referenced by nkf_locale_encoding(), and options().

◆ nkf_enc_find_index()

static int nkf_enc_find_index ( const char *  name)
static

Definition at line 707 of file nkf.c.

References encoding_name_to_id_table, i, name, and nkf_str_caseeql().

Referenced by nkf_enc_find().

◆ nkf_enc_from_index()

static nkf_encoding* nkf_enc_from_index ( int  idx)
static

Definition at line 698 of file nkf.c.

References idx, nkf_encoding_table, and NKF_ENCODING_TABLE_SIZE.

Referenced by module_connection(), nkf_default_encoding(), nkf_enc_find(), and options().

◆ nkf_iconv_utf_16()

static size_t nkf_iconv_utf_16 ( nkf_char  c1,
nkf_char  c2,
nkf_char  c3,
nkf_char  c4 
)
static

Definition at line 2200 of file nkf.c.

References c1, c2, ENDIAN_BIG, EOF, input_endian, NKF_ICONV_NEED_TWO_MORE_BYTES, unicode_iconv(), and UTF16_TO_UTF32.

Referenced by kanji_convert().

◆ nkf_iconv_utf_32()

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

◆ nkf_locale_charmap()

static const char* nkf_locale_charmap ( )
static

Definition at line 747 of file nkf.c.

References buf, nl_langinfo(), NULL, sprintf, and strcpy().

Referenced by nkf_locale_encoding().

◆ nkf_locale_encoding()

static nkf_encoding* nkf_locale_encoding ( )
static

Definition at line 775 of file nkf.c.

References enc, nkf_enc_find(), and nkf_locale_charmap().

Referenced by nkf_default_encoding().

◆ nkf_state_init()

◆ nkf_str_caseeql()

static int nkf_str_caseeql ( const char *  src,
const char *  target 
)
static

Definition at line 687 of file nkf.c.

References FALSE, i, nkf_toupper, link_confs::src, target, and TRUE.

Referenced by nkf_enc_find_index().

◆ nkf_unicode_to_utf8()

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

References nkf_char_unicode_bmp_p, nkf_char_unicode_value_p, p1, p2, val, and VALUE_MASK.

Referenced by w16e_conv(), and w_oconv().

◆ nkf_utf8_encoding()

static nkf_encoding* nkf_utf8_encoding ( )
static

Definition at line 786 of file nkf.c.

References nkf_encoding_table, and UTF_8.

Referenced by nkf_default_encoding().

◆ nkf_utf8_to_unicode()

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

Definition at line 1682 of file nkf.c.

References c1, and c2.

Referenced by w2e_conv(), and w_iconv().

◆ nkf_xmalloc()

static void* nkf_xmalloc ( size_t  size)
static

Definition at line 655 of file nkf.c.

References exit(), EXIT_FAILURE, malloc, NULL, perror(), ptr, and size.

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

◆ nkf_xrealloc()

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

Definition at line 671 of file nkf.c.

References exit(), EXIT_FAILURE, NULL, perror(), ptr, realloc, and size.

Referenced by mime_getc().

◆ no_connection()

static void no_connection ( nkf_char  c2,
nkf_char  c1 
)
static

Definition at line 511 of file nkf.c.

References c1, c2, and no_connection2().

Referenced by reinit().

◆ no_connection2()

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

Definition at line 503 of file nkf.c.

References exit(), EXIT_FAILURE, and fprintf.

Referenced by no_connection().

◆ no_putc()

static void no_putc ( nkf_char  c)
static

Definition at line 4080 of file nkf.c.

Referenced by module_connection(), and ptexenc_nkf().

◆ numchar_getc()

static nkf_char numchar_getc ( FILE f)
static

Definition at line 4206 of file nkf.c.

References buf, c, f, FILE, g, hex2bin, i, i_ngetc, i_nungetc, j, nkf_char_unicode_new, nkf_isdigit, nkf_isxdigit, and u.

Referenced by module_connection().

◆ numchar_ungetc()

static nkf_char numchar_ungetc ( nkf_char  c,
FILE f 
)
static

Definition at line 4260 of file nkf.c.

References c, f, and i_nungetc.

Referenced by module_connection().

◆ open_mime()

static void open_mime ( nkf_char  mode)
static

◆ options()

◆ output_escape_sequence()

static void output_escape_sequence ( int  mode)
static

Definition at line 2283 of file nkf.c.

References ESC, 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 mode.

Referenced by j_oconv().

◆ push_hold_buf()

static nkf_char push_hold_buf ( nkf_char  c2)
static

Definition at line 3056 of file nkf.c.

References c2, EOF, hold_buf, hold_count, and HOLD_SIZE.

Referenced by h_conv().

◆ reinit()

◆ rot_conv()

static void rot_conv ( nkf_char  c2,
nkf_char  c1 
)
static

Definition at line 3716 of file nkf.c.

References c1, c2, ISO_8859_1, JIS_X_0201_1976_K, rot13, and rot47.

Referenced by module_connection().

◆ s2e_conv()

static nkf_char s2e_conv ( nkf_char  c2,
nkf_char  c1,
nkf_char p2,
nkf_char p1 
)
static

◆ s_iconv()

static nkf_char s_iconv ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
)
static

Definition at line 2072 of file nkf.c.

References c1, c2, EOF, GETA1, GETA2, iso2022jp_f, JIS_X_0201_1976_K, nkf_char_unicode_new, ret, s2e_conv(), SP, x0201_f, and x0213_f.

Referenced by h_conv(), and kanji_convert().

◆ s_oconv()

◆ s_status()

◆ set_code_score()

static void set_code_score ( struct input_code ptr,
nkf_char  score 
)
static

Definition at line 2695 of file nkf.c.

References ptr, and score.

Referenced by code_score(), and s_status().

◆ set_iconv()

◆ set_input_codename()

static void set_input_codename ( const char *  codename)
static

Definition at line 4095 of file nkf.c.

References input_codename, and strcmp().

Referenced by kanji_convert(), and set_iconv().

◆ set_input_encoding()

◆ set_output_encoding()

◆ status_check()

static void status_check ( struct input_code ptr,
nkf_char  c 
)
static

Definition at line 2773 of file nkf.c.

References c, DEL, estab_f, ptr, and status_reset().

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

◆ status_clear()

static void status_clear ( struct input_code ptr)
static

Definition at line 2752 of file nkf.c.

References ptr.

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

◆ status_disable()

static void status_disable ( struct input_code ptr)
static

Definition at line 2737 of file nkf.c.

References code_score(), FALSE, iconv, ptr, and set_iconv().

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

◆ status_push_ch()

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

Definition at line 2746 of file nkf.c.

References c, and ptr.

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

◆ status_reinit()

static void status_reinit ( struct input_code ptr)
static

Definition at line 2766 of file nkf.c.

References ptr, and status_reset().

Referenced by module_connection(), and reinit().

◆ status_reset()

static void status_reset ( struct input_code ptr)
static

Definition at line 2759 of file nkf.c.

References ptr, SCORE_INIT, and status_clear().

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

◆ std_getc()

static nkf_char std_getc ( FILE f)
static

Definition at line 3028 of file nkf.c.

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

Referenced by module_connection(), and reinit().

◆ std_putc()

static void std_putc ( nkf_char  c)
static

Definition at line 3046 of file nkf.c.

References c, and EOF.

Referenced by module_connection(), and reinit().

◆ std_ungetc()

static nkf_char std_ungetc ( nkf_char  c,
FILE f 
)
static

Definition at line 3038 of file nkf.c.

References c, nkf_buf_push(), nkf_state, and nkf_state_t::std_gc_buf.

Referenced by module_connection(), and reinit().

◆ switch_mime_getc()

◆ unicode_iconv()

static size_t unicode_iconv ( nkf_char  wc)
static

Definition at line 2172 of file nkf.c.

References c1, c2, nkf_char_unicode_new, NKF_ICONV_INVALID_CODE_RANGE, ret, and w16e_conv().

Referenced by nkf_iconv_utf_16(), and nkf_iconv_utf_32().

◆ unicode_to_jis_common()

◆ unicode_to_jis_common2()

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

References c1, c2, JIS_X_0201_1976_K, NKF_INT32_C, no_cp932ext_f, p, p1, p2, pp, PREFIX_EUCG3, SO, and val.

Referenced by unicode_to_jis_common().

◆ unswitch_mime_getc()

static void unswitch_mime_getc ( void  )
static

Definition at line 3918 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, NULL, set_iconv(), and STRICT_MIME.

Referenced by mime_getc().

◆ url_getc()

static nkf_char url_getc ( FILE f)
static

Definition at line 4192 of file nkf.c.

References f, hex_getc(), i_ugetc, and i_uungetc.

Referenced by module_connection().

◆ url_ungetc()

static nkf_char url_ungetc ( nkf_char  c,
FILE f 
)
static

Definition at line 4198 of file nkf.c.

References c, f, and i_uungetc.

Referenced by module_connection().

◆ w16e_conv()

static nkf_char w16e_conv ( nkf_char  val,
nkf_char p2,
nkf_char p1 
)
static

◆ w2e_conv()

static nkf_char w2e_conv ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0,
nkf_char p2,
nkf_char p1 
)
static

Definition at line 1959 of file nkf.c.

References c1, c2, nkf_char_unicode_new, nkf_utf8_to_unicode(), p1, p2, ret, and unicode_to_jis_common().

Referenced by w_iconv(), and w_status().

◆ w_iconv()

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

Definition at line 2096 of file nkf.c.

References c1, c2, EOF, nkf_char_unicode_new, nkf_utf8_to_unicode(), ret, and w2e_conv().

Referenced by check_bom().

◆ w_iconv16()

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

Definition at line 2231 of file nkf.c.

Referenced by check_bom(), and kanji_convert().

◆ w_iconv32()

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

Definition at line 2237 of file nkf.c.

Referenced by check_bom(), and kanji_convert().

◆ w_oconv()

static void w_oconv ( nkf_char  c2,
nkf_char  c1 
)
static

Definition at line 2525 of file nkf.c.

References c1, c2, e2w_conv(), EOF, FALSE, nkf_char_unicode_p, nkf_unicode_to_utf8(), output_bom_f, val, and VALUE_MASK.

◆ w_oconv16()

◆ w_oconv32()

static void w_oconv32 ( nkf_char  c2,
nkf_char  c1 
)
static

◆ w_status()

static void w_status ( struct input_code ptr,
nkf_char  c 
)
static

◆ x0212_shift()

static nkf_char x0212_shift ( nkf_char  c)
static

Definition at line 1504 of file nkf.c.

References c, is_eucg3, and ret.

Referenced by e2s_conv().

◆ x0212_unshift()

static nkf_char x0212_unshift ( nkf_char  c)
static

Definition at line 1522 of file nkf.c.

References c, PREFIX_EUCG3, and ret.

Referenced by s2e_conv().

◆ z_conv()

static void z_conv ( nkf_char  c2,
nkf_char  c1 
)
static

Definition at line 3546 of file nkf.c.

References alpha_f, c, c1, c2, cv, dv, EOF, ev, fv, JIS_X_0201_1976_K, SP, x0201_f, z_prev1, and z_prev2.

Referenced by module_connection().

Variable Documentation

◆ alias

◆ alpha_f

int alpha_f = 0
static

Definition at line 389 of file nkf.c.

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

◆ ascii_intro

unsigned char ascii_intro = 'B'
static

Definition at line 491 of file nkf.c.

Referenced by options(), and reinit().

◆ base64_count

int base64_count = 0
static

Definition at line 478 of file nkf.c.

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

◆ basis_64

const char basis_64[]
static
Initial value:
=
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"

Definition at line 4583 of file nkf.c.

Referenced by eof_mime(), and mimeout_addchar().

◆ binmode_f

int binmode_f = 1
static

Definition at line 386 of file nkf.c.

Referenced by options(), and reinit().

◆ broken_f

int broken_f = 0
static

Definition at line 393 of file nkf.c.

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

◆ buf

char buf[74+1]

◆ cap_f

int cap_f = 0
static

Definition at line 406 of file nkf.c.

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

◆ count

int count

Definition at line 4589 of file nkf.c.

◆ cp51932_f

int cp51932_f = 0
static

Definition at line 450 of file nkf.c.

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

◆ cp932inv_f

int cp932inv_f = 1
static

◆ cv

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

Referenced by create_line(), f_instance_eval(), fapproxcurve(), Free_CaretValue(), Free_LigGlyph(), glyf_parse_point(), handle_non_switch_argument(), json_boolof(), json_numof(), json_obj_getbool(), json_obj_getbool_fallback(), json_obj_getint(), json_obj_getint_fallback(), json_obj_getnum(), json_obj_getnum_fallback(), json_vqOf(), Load_CaretValue(), Load_LigGlyph(), main(), mrb_bob_not(), mrb_instance_alloc(), mrb_instance_new(), DvipsEncoding::parse_ligkern_words(), spc_read_color_color(), spc_read_color_pdf(), TIFFWriteNormalTag(), and z_conv().

◆ debug_f

int debug_f = 0
static

Definition at line 436 of file nkf.c.

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

◆ dv

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

Referenced by DHDVText(), Efont::AmfmMetrics::interpolate(), Load_Device(), TIFFReadDirectory(), TIFFWriteNormalTag(), ttf_math_read_icta(), ttf_math_read_mathkernv(), and z_conv().

◆ encode_fallback

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

Definition at line 356 of file nkf.c.

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

◆ 

encoding_name_to_id_table[] { ... } struct

Referenced by nkf_enc_find_index().

◆ eolmode_f

int eolmode_f = 0
static

Definition at line 647 of file nkf.c.

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

◆ estab_f

int estab_f = 0
static

Definition at line 384 of file nkf.c.

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

◆ ev

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

Referenced by checksum(), getenc(), lj_vmevent_prepare(), main(), old_checksum(), rec_for(), rec_loop_interp(), rec_loop_jit(), strtonum(), and z_conv().

◆ f_line

int f_line = 0
static

Definition at line 483 of file nkf.c.

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

◆ f_prev

int f_prev = 0
static

Definition at line 484 of file nkf.c.

Referenced by fold_conv(), and reinit().

◆ file_out_f

int file_out_f = 0
static

Definition at line 639 of file nkf.c.

Referenced by options(), and reinit().

◆ fold_f

int fold_f = 0
static

Definition at line 486 of file nkf.c.

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

◆ fold_len

int fold_len = 0
static

Definition at line 487 of file nkf.c.

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

◆ fold_margin

int fold_margin = 10
static

Definition at line 498 of file nkf.c.

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

◆ fold_preserve_f

int fold_preserve_f = 0
static

Definition at line 485 of file nkf.c.

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

◆ fv

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

Referenced by _FontViewBaseCreate(), DStemInfoGeninst(), FixDstem(), FixDStemPoint(), FixPointOnLine(), FontIsActive(), FontOfFilename(), FontViewBase_Append(), FontViewBase_Close(), FontViewBase_Create(), FontViewBase_Free(), FontViewBaseWinInfo(), FVAddEncodingSlot(), FVAutoTrace(), FVB_ChangeDisplayBitmap(), FVB_DeselectAll(), FVB_DisplayChar(), FVB_ShowFilled(), FVExtraEncSlots(), InterpolateAlongDiag(), MapAddEnc(), MovePointsToIntersections(), otfcc_build_gpos_pair_individual(), ScriptPrint(), SetFreedomVector(), SFAddGlyphAndEncode(), SFExpandGlyphCount(), SnapDStemCorners(), TIFFWriteNormalTag(), TIFFWriteRationalArray(), TouchDStemPoints(), and z_conv().

◆ guess_f

int guess_f = 0
static

Definition at line 441 of file nkf.c.

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

◆ hira_f

int hira_f = 0
static

Definition at line 388 of file nkf.c.

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

◆ hold_buf

unsigned char hold_buf[1024 *2]
static

Definition at line 3053 of file nkf.c.

Referenced by h_conv(), and push_hold_buf().

◆ hold_count

int hold_count = 0
static

Definition at line 3054 of file nkf.c.

Referenced by h_conv(), push_hold_buf(), and reinit().

◆ i_bgetc

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

Definition at line 534 of file nkf.c.

Referenced by module_connection(), and reinit().

◆ i_bungetc

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

Definition at line 535 of file nkf.c.

Referenced by module_connection(), and reinit().

◆ i_cgetc

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

Definition at line 407 of file nkf.c.

Referenced by cap_getc(), and module_connection().

◆ i_cungetc

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

Definition at line 408 of file nkf.c.

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

◆ i_getc

◆ i_mgetc

nkf_char(* i_mgetc) (FILE *) ( FILE ) = std_getc
static

Definition at line 539 of file nkf.c.

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

◆ i_mgetc_buf

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

Definition at line 543 of file nkf.c.

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

◆ i_mungetc

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

Definition at line 540 of file nkf.c.

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

◆ i_mungetc_buf

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

Definition at line 544 of file nkf.c.

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

◆ i_nfc_getc

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

Definition at line 401 of file nkf.c.

Referenced by module_connection(), and nfc_getc().

◆ i_nfc_ungetc

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

Definition at line 402 of file nkf.c.

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

◆ i_ngetc

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

Definition at line 429 of file nkf.c.

Referenced by module_connection(), and numchar_getc().

◆ i_nungetc

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

Definition at line 430 of file nkf.c.

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

◆ i_ugetc

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

Definition at line 411 of file nkf.c.

Referenced by module_connection(), and url_getc().

◆ i_ungetc

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

◆ i_uungetc

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

Definition at line 412 of file nkf.c.

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

◆ iconv

nkf_char(* iconv) (nkf_char c2, nkf_char c1, nkf_char c0) ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
) = no_connection2
static

◆ iconv_for_check

nkf_char(* iconv_for_check) (nkf_char c2, nkf_char c1, nkf_char c0)=0 ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
)
static

Definition at line 438 of file nkf.c.

Referenced by reinit(), and set_iconv().

◆ id

back_token id = -1

Definition at line 209 of file nkf.c.

◆ input

unsigned int input ( void  )

Definition at line 3866 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},
{0}
}
#define NULL
Definition: ftobjs.h:61
static nkf_char e_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
Definition: nkf.c:2008
static nkf_char s_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
Definition: nkf.c:2072
static void e_status(struct input_code *, nkf_char)
Definition: nkf.c:2854
static nkf_char w_iconv16(nkf_char c2, nkf_char c1, nkf_char c0)
Definition: nkf.c:2231
static nkf_char w_iconv32(nkf_char c2, nkf_char c1, nkf_char c0)
Definition: nkf.c:2237
static void w_status(struct input_code *, nkf_char)
Definition: nkf.c:2900
static nkf_char w_iconv(nkf_char c2, nkf_char c1, nkf_char c0)
Definition: nkf.c:2096
static void s_status(struct input_code *, nkf_char)
Definition: nkf.c:2781

Definition at line 464 of file nkf.c.

Referenced by code_status(), find_inputcode_byfunc(), h_conv(), kanji_convert(), module_connection(), and reinit().

◆ input_codename

const char* input_codename = NULL
static

Definition at line 332 of file nkf.c.

Referenced by get_guessed_code(), kanji_convert(), reinit(), and set_input_codename().

◆ input_encoding

nkf_encoding* input_encoding = NULL
static

Definition at line 333 of file nkf.c.

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

◆ input_endian

int input_endian = ENDIAN_BIG
static

◆ input_eol

int input_eol = 0
static

Definition at line 648 of file nkf.c.

Referenced by eol_conv(), and reinit().

◆ input_mode

int input_mode = ASCII
static

Definition at line 548 of file nkf.c.

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

◆ iso2022jp_f

int iso2022jp_f = 0
static

Definition at line 397 of file nkf.c.

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

◆ iso8859_f

int iso8859_f = 0
static

Definition at line 394 of file nkf.c.

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

◆ kanji_intro

unsigned char kanji_intro = 'B'
static

Definition at line 490 of file nkf.c.

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

◆ last

int last

Definition at line 3865 of file nkf.c.

◆ 

long_option[] { ... } const struct

Referenced by options().

◆ mime_decode_f

int mime_decode_f = 0
static

Definition at line 391 of file nkf.c.

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

◆ mime_decode_mode

int mime_decode_mode = 0
static

◆ mime_encode

const nkf_char mime_encode[]
static
Initial value:
= {
0
}
@ SHIFT_JIS
Definition: nkf.c:96
@ JIS_X_0201_1976_K
Definition: nkf.c:124
@ UTF_8
Definition: nkf.c:108
@ JIS_X_0208
Definition: nkf.c:128
@ EUC_JP
Definition: nkf.c:99

Definition at line 3838 of file nkf.c.

Referenced by open_mime().

◆ mime_encode_method

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

Definition at line 3847 of file nkf.c.

Referenced by open_mime().

◆ mime_f

int mime_f = 8
static

◆ mime_iconv_back

nkf_char(* mime_iconv_back) (nkf_char c2, nkf_char c1, nkf_char c0) ( nkf_char  c2,
nkf_char  c1,
nkf_char  c0 
) = NULL
static

Definition at line 3868 of file nkf.c.

Referenced by mime_begin_strict(), and unswitch_mime_getc().

◆ 

◆ mime_pattern

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?Q?",
(const unsigned char *)"\075?UTF-8?B?",
(const unsigned char *)"\075?UTF-8?Q?",
(const unsigned char *)"\075?US-ASCII?Q?",
}

Definition at line 3813 of file nkf.c.

Referenced by mime_begin_strict(), and open_mime().

◆ mime_priority_func

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

Definition at line 3830 of file nkf.c.

Referenced by mime_begin_strict().

◆ mimebuf_f

int mimebuf_f = 0
static

◆ mimeout_f

int mimeout_f = 0
static

Definition at line 395 of file nkf.c.

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

◆ mimeout_mode

int mimeout_mode = 0
static

◆ 

mimeout_state { ... } struct

◆ ms_ucs_map_f

int ms_ucs_map_f = 0
static

◆ name

const char* name

Definition at line 208 of file nkf.c.

Referenced by nkf_enc_find(), nkf_enc_find_index(), and options().

◆ nfc_f

int nfc_f = 0
static

Definition at line 400 of file nkf.c.

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

◆ nkf_encoding_table

nkf_encoding nkf_encoding_table[]

Definition at line 167 of file nkf.c.

Referenced by nkf_enc_from_index(), and nkf_utf8_encoding().

◆ nkf_state

nkf_state_t* nkf_state = NULL
static

◆ 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.

◆ no_best_fit_chars_f

int no_best_fit_chars_f = 0
static

Definition at line 353 of file nkf.c.

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

◆ no_cp932ext_f

int no_cp932ext_f = 0
static

Definition at line 351 of file nkf.c.

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

◆ noout_f

int noout_f = 0
static

Definition at line 434 of file nkf.c.

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

◆ nop_f

int nop_f = 0
static

Definition at line 385 of file nkf.c.

Referenced by options(), and reinit().

◆ numchar_f

int numchar_f = 0
static

Definition at line 428 of file nkf.c.

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

◆ o_base64conv

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

Definition at line 524 of file nkf.c.

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

◆ o_eol_conv

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

Definition at line 521 of file nkf.c.

Referenced by module_connection(), and reinit().

◆ o_fconv

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

Definition at line 520 of file nkf.c.

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

◆ o_hira_conv

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

Definition at line 523 of file nkf.c.

Referenced by module_connection(), and reinit().

◆ o_iso2022jp_check_conv

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

Definition at line 525 of file nkf.c.

Referenced by module_connection(), and reinit().

◆ o_mputc

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

Definition at line 537 of file nkf.c.

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

◆ o_putc

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

Definition at line 529 of file nkf.c.

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

◆ o_rot_conv

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

Definition at line 522 of file nkf.c.

Referenced by module_connection(), and reinit().

◆ o_zconv

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

Definition at line 519 of file nkf.c.

Referenced by module_connection(), and reinit().

◆ oconv

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

◆ option_mode

int option_mode = 0
static

Definition at line 638 of file nkf.c.

Referenced by options(), and reinit().

◆ output_bom_f

int output_bom_f = 0
static

Definition at line 360 of file nkf.c.

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

◆ output_encoding

nkf_encoding* output_encoding = NULL
static

◆ output_endian

int output_endian = ENDIAN_BIG
static

Definition at line 361 of file nkf.c.

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

◆ output_mode

int output_mode = ASCII
static

Definition at line 547 of file nkf.c.

◆ prefix_table

unsigned char prefix_table[256]
static

Definition at line 461 of file nkf.c.

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

◆ prev_cr

nkf_char prev_cr = 0
static

Definition at line 649 of file nkf.c.

Referenced by eol_conv(), and reinit().

◆ rot_f

int rot_f = 0
static

Definition at line 387 of file nkf.c.

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

◆ score_table_A0

const nkf_char score_table_A0[]
static
Initial value:
= {
0, 0, 0, 0,
0, 0, 0, 0,
0, ( ( (1) << 1) << 1) , ( ( (1) << 1) << 1) , ( ( (1) << 1) << 1) ,
( ( (1) << 1) << 1) , ( ( (1) << 1) << 1) , ( ( (1) << 1) << 1) , ( ( ( ( ( (1) << 1) << 1) << 1) << 1) << 1) ,
}

Definition at line 2680 of file nkf.c.

Referenced by code_score().

◆ score_table_F0

const nkf_char score_table_F0[]
static
Initial value:
= {
(1) , (1) , (1) , (1) ,
(1) , ( ( (1) << 1) << 1) , ( ( ( ( ( (1) << 1) << 1) << 1) << 1) << 1) , ( ( ( ( ( (1) << 1) << 1) << 1) << 1) << 1) ,
( ( (1) << 1) << 1) , ( ( (1) << 1) << 1) , ( ( ( (1) << 1) << 1) << 1) , ( ( ( (1) << 1) << 1) << 1) ,
( ( ( (1) << 1) << 1) << 1) , ( ( ( ( ( (1) << 1) << 1) << 1) << 1) << 1) , ( ( ( ( ( (1) << 1) << 1) << 1) << 1) << 1) , ( ( ( ( ( ( ( (1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) ,
}

Definition at line 2687 of file nkf.c.

Referenced by code_score().

◆ top

unsigned int top

Definition at line 3864 of file nkf.c.

◆ unbuf_f

int unbuf_f = 0
static

Definition at line 383 of file nkf.c.

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

◆ unicode_subchar

nkf_char unicode_subchar = '?'
static

Definition at line 355 of file nkf.c.

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

◆ url_f

int url_f = 0
static

Definition at line 410 of file nkf.c.

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

◆ x0201_f

int x0201_f = 1
static

◆ x0212_f

int x0212_f = 0
static

Definition at line 458 of file nkf.c.

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

◆ x0213_f

int x0213_f = 0
static

◆ z_prev1

nkf_char z_prev1 =0
static

Definition at line 3543 of file nkf.c.

Referenced by reinit(), and z_conv().

◆ z_prev2

nkf_char z_prev2 =0
static

Definition at line 3543 of file nkf.c.

Referenced by reinit(), and z_conv().