diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-25 15:13:14 +0000 |
commit | d0233291bc8a5068e52c69c210e5979e5324b5bc (patch) | |
tree | 7d9459449c33792c63eeb7baa071e76352e0baab /trunk/enc/trans/newline.trans | |
parent | 0dc342de848a642ecce8db697b8fecd83a63e117 (diff) | |
parent | 72eaacaa15256ab95c3b52ea386f88586fb9da40 (diff) |
re-adding tag v1_9_0_4 as an alias of trunk@18848v1_9_0_4
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'trunk/enc/trans/newline.trans')
-rw-r--r-- | trunk/enc/trans/newline.trans | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/trunk/enc/trans/newline.trans b/trunk/enc/trans/newline.trans deleted file mode 100644 index 409da1dc33..0000000000 --- a/trunk/enc/trans/newline.trans +++ /dev/null @@ -1,94 +0,0 @@ -#include "transcode_data.h" - -<% - map_normalize = {} - map_normalize["{00-ff}"] = :func_so -%> - -<%= transcode_generate_node(ActionMap.parse(map_normalize), "universal_newline") %> - -static int -fun_so_universal_newline(rb_transcoding* t, const unsigned char* s, size_t l, unsigned char* o) -{ - int len; - /* - t->stateful[0] == 0 : normal - t->stateful[0] == 1 : just after '\r' - */ - if (s[0] == '\n') { - if (t->stateful[0] == 0) { - o[0] = '\n'; - len = 1; - } - else { - len = 0; - } - t->stateful[0] = 0; - } - else if (s[0] == '\r') { - o[0] = '\n'; - len = 1; - t->stateful[0] = 1; - } - else { - o[0] = s[0]; - len = 1; - t->stateful[0] = 0; - } - return len; -} - -static const rb_transcoder -rb_universal_newline = { - "universal_newline", "", &universal_newline, - 1, /* input_unit_length */ - 1, /* max_input */ - 1, /* max_output */ - stateful_decoder, /* stateful_type */ - NULL, NULL, NULL, fun_so_universal_newline -}; - -<% - map_crlf = {} - map_crlf["{00-09,0b-ff}"] = :nomap - map_crlf["0a"] = "0d0a" -%> - -<%= transcode_generate_node(ActionMap.parse(map_crlf), "crlf_newline") %> - -static const rb_transcoder -rb_crlf_newline = { - "", "crlf_newline", &crlf_newline, - 1, /* input_unit_length */ - 1, /* max_input */ - 2, /* max_output */ - stateless_converter, /* stateful_type */ - NULL, NULL, NULL, NULL -}; - -<% - map_cr = {} - map_cr["{00-09,0b-ff}"] = :nomap - map_cr["0a"] = "0d" -%> - -<%= transcode_generate_node(ActionMap.parse(map_cr), "cr_newline") %> - -static const rb_transcoder -rb_cr_newline = { - "", "cr_newline", &cr_newline, - 1, /* input_unit_length */ - 1, /* max_input */ - 1, /* max_output */ - stateless_converter, /* stateful_type */ - NULL, NULL, NULL, NULL -}; - -void -Init_newline(void) -{ - rb_register_transcoder(&rb_universal_newline); - rb_register_transcoder(&rb_crlf_newline); - rb_register_transcoder(&rb_cr_newline); -} - |