1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/enc/us_ascii.c
duerst 78c5ca7074 * include/ruby/oniguruma.h: Extend OnigEncodingTypeDefine to define a
new encoding primitive 'case_map' for case mapping
* enc/utf-8.c, utf_16be/le.c, utf_32be/le.c:
  add onigenc_unicode_case_map as case_map primitive
* enc/ascii.c, big5.c, cp949.c, emacs_mule.c, euc_jp/kr/tw.c, gb18030.c,
  gbk.c, iso_8859_1/2/3/4/5/6/7/8/9/10/11/13/14/15/16.c, koi8_r/u.c,
  shift_jis.c, us_ascii.c, windows_1250/1251/1252.c:
  add onigenc_not_support_case_map as case_map primitive


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 05:57:44 +00:00

40 lines
1.1 KiB
C

#include "regenc.h"
#include "encindex.h"
#ifndef ENCINDEX_US_ASCII
#define ENCINDEX_US_ASCII 0
#endif
static int
us_ascii_mbc_enc_len(const UChar* p, const UChar* e, OnigEncoding enc)
{
if (*p & 0x80)
return ONIGENC_CONSTRUCT_MBCLEN_INVALID();
return ONIGENC_CONSTRUCT_MBCLEN_CHARFOUND(1);
}
OnigEncodingDefine(us_ascii, US_ASCII) = {
us_ascii_mbc_enc_len,
"US-ASCII",/* name */
1, /* max byte length */
1, /* min byte length */
onigenc_is_mbc_newline_0x0a,
onigenc_single_byte_mbc_to_code,
onigenc_single_byte_code_to_mbclen,
onigenc_single_byte_code_to_mbc,
onigenc_ascii_mbc_case_fold,
onigenc_ascii_apply_all_case_fold,
onigenc_ascii_get_case_fold_codes_by_str,
onigenc_minimum_property_name_to_ctype,
onigenc_ascii_is_code_ctype,
onigenc_not_support_get_ctype_code_range,
onigenc_single_byte_left_adjust_char_head,
onigenc_always_true_is_allowed_reverse_match,
ENCINDEX_US_ASCII,
ONIGENC_FLAG_NONE,
#ifdef ONIG_CASE_MAPPING
onigenc_not_support_case_map,
#endif /* ONIG_CASE_MAPPING */
};
ENC_ALIAS("ASCII", "US-ASCII")
ENC_ALIAS("ANSI_X3.4-1968", "US-ASCII")
ENC_ALIAS("646", "US-ASCII")