void Init_transcode(void) { transcoder_table = st_init_strcasetable(); transcoder_lib_table = st_init_strcasetable(); sym_invalid = ID2SYM(rb_intern("invalid")); sym_ignore = ID2SYM(rb_intern("ignore")); rb_define_method(rb_cString, "encode", str_encode, -1); rb_define_method(rb_cString, "encode!", str_encode_bang, -1); }
void rb_enc_init(void) { enc_table_expand(ENCODING_COUNT + 1); if (!enc_table.names) { enc_table.names = st_init_strcasetable(); } #define ENC_REGISTER(enc) enc_register_at(ENCINDEX_##enc, rb_enc_name(&OnigEncoding##enc), &OnigEncoding##enc) ENC_REGISTER(ASCII); ENC_REGISTER(UTF_8); ENC_REGISTER(US_ASCII); #undef ENC_REGISTER #define ENCDB_REGISTER(name, enc) enc_register_at(ENCINDEX_##enc, name, NULL) ENCDB_REGISTER("UTF-16BE", UTF_16BE); ENCDB_REGISTER("UTF-16LE", UTF_16LE); ENCDB_REGISTER("UTF-32BE", UTF_32BE); ENCDB_REGISTER("UTF-32LE", UTF_32LE); ENCDB_REGISTER("UTF-16", UTF_16); ENCDB_REGISTER("UTF-32", UTF_32); ENCDB_REGISTER("UTF8-MAC", UTF8_MAC); ENCDB_REGISTER("EUC-JP", EUC_JP); ENCDB_REGISTER("Windows-31J", Windows_31J); #undef ENCDB_REGISTER enc_table.count = ENCINDEX_BUILTIN_MAX; }
void rb_enc_init(void) { enc_table_expand(ENCODING_COUNT + 1); if (!enc_table.names) { enc_table.names = st_init_strcasetable(); } #define ENC_REGISTER(enc) enc_register_at(ENCINDEX_##enc, rb_enc_name(&OnigEncoding##enc), &OnigEncoding##enc) ENC_REGISTER(ASCII); ENC_REGISTER(UTF_8); ENC_REGISTER(US_ASCII); #undef ENC_REGISTER enc_table.count = ENCINDEX_BUILTIN_MAX; }