mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* transcode_data.h (STR1_LENGTH): defined.
(makeSTR1LEN): defined. * tool/transcode-tblgen.rb: use makeSTR1LEN. generate STR1 for 4 to 259 bytes. * transcode.c (rb_transcoding): new field: output_index. (transcode_restartable0): use STR1_LENGTH. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
69029b90fe
commit
6eb3843b17
4 changed files with 21 additions and 7 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
Tue Sep 16 00:40:56 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* transcode_data.h (STR1_LENGTH): defined.
|
||||
(makeSTR1LEN): defined.
|
||||
|
||||
* tool/transcode-tblgen.rb: use makeSTR1LEN. generate STR1 for 4 to
|
||||
259 bytes.
|
||||
|
||||
* transcode.c (rb_transcoding): new field: output_index.
|
||||
(transcode_restartable0): use STR1_LENGTH.
|
||||
|
||||
Mon Sep 15 23:52:45 2008 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c, include/ruby/ruby.h: rename rb_register_mark_object()
|
||||
|
|
|
@ -307,7 +307,7 @@ class ActionMap
|
|||
n = str_name(bytes)
|
||||
@bytes_code.insert_at_last(1 + len,
|
||||
"\#define #{n} makeSTR1(#{size})\n" +
|
||||
" #{len}," + bytes.gsub(/../, ' 0x\&,') + "\n\n")
|
||||
" makeSTR1LEN(#{len})," + bytes.gsub(/../, ' 0x\&,') + "\n\n")
|
||||
n
|
||||
end
|
||||
end
|
||||
|
@ -336,7 +336,7 @@ class ActionMap
|
|||
"o3(0x#$1,0x#$2,0x#$3)"
|
||||
when /\A(f[0-7])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])\z/i
|
||||
"o4(0x#$1,0x#$2,0x#$3,0x#$4)"
|
||||
when /\A([0-9a-f][0-9a-f]){0,255}\z/i
|
||||
when /\A([0-9a-f][0-9a-f]){4,259}\z/i
|
||||
gen_str(info.upcase)
|
||||
when /\A\/\*BYTE_LOOKUP\*\// # pointer to BYTE_LOOKUP structure
|
||||
$'.to_s
|
||||
|
|
|
@ -52,6 +52,7 @@ typedef struct rb_transcoding {
|
|||
unsigned int next_table;
|
||||
VALUE next_info;
|
||||
unsigned char next_byte;
|
||||
unsigned int output_index;
|
||||
|
||||
int recognized_len; /* already interpreted */
|
||||
int readagain_len; /* not yet interpreted */
|
||||
|
@ -584,10 +585,10 @@ transcode_restartable0(const unsigned char **in_pos, unsigned char **out_pos,
|
|||
SUSPEND_OBUF(19); *out_p++ = getBT3(next_info);
|
||||
continue;
|
||||
case STR1:
|
||||
next_byte = 0; /* index */
|
||||
while (next_byte < BYTE_ADDR(STR1_BYTEINDEX(next_info))[0]) {
|
||||
SUSPEND_OBUF(28); *out_p++ = BYTE_ADDR(STR1_BYTEINDEX(next_info))[1+next_byte];
|
||||
next_byte++;
|
||||
tc->output_index = 0;
|
||||
while (tc->output_index < STR1_LENGTH(BYTE_ADDR(STR1_BYTEINDEX(next_info)))) {
|
||||
SUSPEND_OBUF(28); *out_p++ = BYTE_ADDR(STR1_BYTEINDEX(next_info))[1+tc->output_index];
|
||||
tc->output_index++;
|
||||
}
|
||||
continue;
|
||||
case FUNii:
|
||||
|
|
|
@ -34,10 +34,12 @@
|
|||
#define FUNsi (PType 0x0D) /* function from start to info */
|
||||
#define FUNio (PType 0x0E) /* function from info to output */
|
||||
#define FUNso (PType 0x0F) /* function from start to output */
|
||||
#define STR1 (PType 0x11) /* string up to 255 bytes: 1byte length + content */
|
||||
#define STR1 (PType 0x11) /* string 4 <= len <= 259 bytes: 1byte length + content */
|
||||
|
||||
#define STR1_LENGTH(byte_addr) (*(byte_addr) + 4)
|
||||
#define STR1_BYTEINDEX(w) ((w) >> 6)
|
||||
#define makeSTR1(bi) (((bi) << 6) | STR1)
|
||||
#define makeSTR1LEN(len) ((len)-4)
|
||||
|
||||
#define o1(b1) (PType((((unsigned char)(b1))<<8)|ONEbt))
|
||||
#define o2(b1,b2) (PType((((unsigned char)(b1))<<8)|(((unsigned char)(b2))<<16)|TWObt))
|
||||
|
|
Loading…
Reference in a new issue