Fix: DON'T move in_p because before in_p is replaced by buffered data.

* transcode.c: NOMAP is now multibyte direct map.

* transcode.c: remove ASIS.

* transcode_data.h: ditto.

* tool/transcode-tb (ActionMap#generate_info): remove :asis.

* tool/transcode-tb (ActionMap#generate_info): add :nomap0.

* enc/trans/utf8_mac.trans: replace :asis by :nomap0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2009-05-05 00:05:11 +00:00
Родитель 92c89f12fb
Коммит 3abca796f4
5 изменённых файлов: 32 добавлений и 22 удалений

Просмотреть файл

@ -1,3 +1,17 @@
Tue May 5 07:22:37 2009 NARUSE, Yui <naruse@ruby-lang.org>
* transcode.c: NOMAP is now multibyte direct map.
* transcode.c: remove ASIS.
* transcode_data.h: ditto.
* tool/transcode-tb (ActionMap#generate_info): remove :asis.
* tool/transcode-tb (ActionMap#generate_info): add :nomap0.
* enc/trans/utf8_mac.trans: replace :asis by :nomap0.
Sat May 2 22:53:02 2009 Akinori MUSHA <knu@iDaemons.org>
* lib/set.rb (SortedSet): Fix document. [Bug #1429]

Просмотреть файл

@ -6,13 +6,13 @@
transcode_tblgen("UTF-8", "UTF8-MAC",
MAC_DECOMPOSE_TBL + [
["{00-7F}", :nomap],
["{c2-df}{80-bf}", :asis],
["e0{a0-bf}{80-bf}", :asis],
["{e1-ec}{80-bf}{80-bf}", :asis],
["ed{80-9f}{80-bf}", :asis],
["{ee-ef}{80-bf}{80-bf}", :asis],
["f0{90-bf}{80-bf}{80-bf}", :asis],
["{f1-f3}{80-bf}{80-bf}{80-bf}", :asis],
["{c2-df}{80-bf}", :nomap0],
["e0{a0-bf}{80-bf}", :nomap0],
["{e1-ec}{80-bf}{80-bf}", :nomap0],
["ed{80-9f}{80-bf}", :nomap0],
["{ee-ef}{80-bf}{80-bf}", :nomap0],
["f0{90-bf}{80-bf}{80-bf}", :nomap0],
["{f1-f3}{80-bf}{80-bf}{80-bf}", :nomap0],
])
map = {}

Просмотреть файл

@ -238,9 +238,9 @@ class ActionMap
ss.each_firstbyte {|byte, rest|
h[byte] ||= {}
if h[byte][rest].nil?
elsif action == :asis
elsif action == :nomap0
next
elsif h[byte][rest] != :asis
elsif h[byte][rest] != :nomap0
raise "ambiguous %s or %s (%02X/%s)" % [h[byte][rest], action, byte, rest]
end
h[byte][rest] = action
@ -317,10 +317,9 @@ class ActionMap
def generate_info(info)
case info
when :nomap
when :nomap, :nomap0
# :nomap0 is low priority. it never collides.
"NOMAP"
when :asis
"ASIS"
when :undef
"UNDEF"
when :invalid

Просмотреть файл

@ -505,7 +505,6 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
case 30: goto resume_label30;
case 31: goto resume_label31;
case 32: goto resume_label32;
case 33: goto resume_label33;
}
while (1) {
@ -541,15 +540,14 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
follow_info:
switch (next_info & 0x1F) {
case NOMAP:
SUSPEND_OBUF(3); *out_p++ = next_byte;
continue;
case ASIS:
{
const unsigned char *p = inchar_start;
while (p < in_p) {
SUSPEND_OBUF(33); *out_p++ = (unsigned char)*p++;
const unsigned char *pend = in_p;
in_p = inchar_start;
while (in_p < pend) {
next_byte = (unsigned char)*in_p++;
SUSPEND_OBUF(3); *out_p++ = next_byte;
}
}
}
continue;
case 0x00: case 0x04: case 0x08: case 0x0C:
case 0x10: case 0x14: case 0x18: case 0x1C:

Просмотреть файл

@ -22,7 +22,7 @@
#define PType (unsigned int)
#define NOMAP (PType 0x01) /* single byte direct map */
#define NOMAP (PType 0x01) /* direct map */
#define ONEbt (0x02) /* one byte payload */
#define TWObt (0x03) /* two bytes payload */
#define THREEbt (0x05) /* three bytes payload */
@ -36,7 +36,6 @@
#define FUNso (PType 0x0F) /* function from start to output */
#define STR1 (PType 0x11) /* string 4 <= len <= 259 bytes: 1byte length + content */
#define GB4bt (PType 0x12) /* GB18030 four bytes payload */
#define ASIS (PType 0x13) /* multi byte direct map */
#define STR1_LENGTH(byte_addr) (unsigned int)(*(byte_addr) + 4)
#define STR1_BYTEINDEX(w) ((w) >> 6)