1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enc/trans/newline.trans (universal_newline_finish): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-09-05 11:16:28 +00:00
parent 067b98736f
commit debeb7db77
2 changed files with 17 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Fri Sep 5 20:12:23 2008 Tanaka Akira <akr@fsij.org>
* enc/trans/newline.trans (universal_newline_finish): new function.
Fri Sep 5 20:07:37 2008 Tanaka Akira <akr@fsij.org>
* include/ruby/io.h (rb_io_mode_modenum): moved from

View file

@ -41,7 +41,7 @@ universal_newline_init(void *statep)
}
static int
fun_so_universal_newline(void *statep, const unsigned char* s, size_t l, unsigned char* o)
fun_so_universal_newline(void *statep, const unsigned char *s, size_t l, unsigned char *o)
{
unsigned char *sp = statep;
int len;
@ -75,6 +75,16 @@ fun_so_universal_newline(void *statep, const unsigned char* s, size_t l, unsigne
return len;
}
static int
universal_newline_finish(void *statep, unsigned char *o)
{
unsigned char *sp = statep;
if (STATE == JUST_AFTER_CR)
NEWLINES_MET |= MET_CR;
STATE = NORMAL;
return 0;
}
static const rb_transcoder
rb_universal_newline = {
"universal_newline", "", universal_newline,
@ -84,7 +94,8 @@ rb_universal_newline = {
1, /* max_output */
stateful_decoder, /* stateful_type */
2, universal_newline_init, universal_newline_init, /* state_size, state_init, state_fini */
NULL, NULL, NULL, fun_so_universal_newline
NULL, NULL, NULL, fun_so_universal_newline,
universal_newline_finish
};
static const rb_transcoder