10 #define RUBY_NKF_REVISION "$Revision$" 11 #define RUBY_NKF_VERSION NKF_VERSION " (" NKF_RELEASE_DATE ")" 21 #define getc(f) (input_ctr>=i_len?-1:input[input_ctr++]) 22 #define ungetc(c,f) input_ctr-- 28 #define putchar(c) rb_nkf_putchar(c) 32 static unsigned char *output;
33 static unsigned char *
input;
36 static int output_ctr;
43 rb_nkf_putchar(
unsigned int c)
45 if (output_ctr >= o_len) {
51 output[output_ctr++] = c;
80 unsigned char option[256];
82 int is_escaped =
FALSE;
83 int is_single_quoted =
FALSE;
84 int is_double_quoted =
FALSE;
85 for(i = 0; arg[i]; i++){
88 }
else if(is_single_quoted){
90 is_single_quoted =
FALSE;
97 }
else if(arg[i] ==
'\\'){
99 }
else if(is_double_quoted){
101 is_double_quoted =
FALSE;
103 option[j++] = arg[i];
105 }
else if(arg[i] ==
'\''){
106 is_single_quoted =
TRUE;
107 }
else if(arg[i] ==
'"'){
108 is_double_quoted =
TRUE;
109 }
else if(arg[i] ==
' '){
114 option[j++] = arg[i];
144 case UTF_8_BOM: output_encoding = nkf_enc_from_index(
UTF_8);
break;
150 output_bom_f =
FALSE;
200 kanji_convert(
NULL );
rb_encoding * rb_nkf_enc_get(const char *name)
void rb_raise(VALUE exc, const char *fmt,...)
#define nkf_enc_name(enc)
VALUE rb_enc_from_encoding(rb_encoding *encoding)
void rb_str_set_len(VALUE, long)
VALUE rb_enc_associate(VALUE obj, rb_encoding *enc)
rb_encoding * rb_utf8_encoding(void)
VALUE rb_singleton_class(VALUE obj)
Returns the singleton class of obj.
void rb_define_const(VALUE, const char *, VALUE)
VALUE rb_str_resize(VALUE, long)
void rb_define_alias(VALUE klass, const char *name1, const char *name2)
Defines an alias of a method.
void rb_define_module_function(VALUE module, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a module function for module.
#define nkf_enc_to_base_encoding(enc)
rb_encoding * rb_usascii_encoding(void)
#define nkf_enc_to_index(enc)
int rb_define_dummy_encoding(const char *name)
#define StringValueCStr(v)
#define StringValuePtr(v)
int rb_enc_find_index(const char *name)
#define RSTRING_LENINT(str)
VALUE rb_define_module(const char *name)
int nkf_split_options(const char *arg)
rb_encoding * rb_enc_from_index(int index)
VALUE rb_str_new(const char *, long)