Skip to content

Commit

Permalink
re-adding tag v1_9_0_4 as an alias of trunk@18848
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.ruby-lang.org/repos/ruby/tags/v1_9_0_4@18849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
yugui committed Aug 25, 2008
2 parents d8d2f6e + d48d116 commit 57fd107
Show file tree
Hide file tree
Showing 2,969 changed files with 93 additions and 837,565 deletions.
24 changes: 24 additions & 0 deletions ChangeLog
@@ -1,3 +1,27 @@
Tue Aug 26 00:02:49 2008 Yusuke Endoh <mame@tsg.ne.jp>

* ext/bigdecimal/bigdecimal.c (VpMult): fix double free.

Mon Aug 25 23:59:36 2008 Tanaka Akira <akr@fsij.org>

* transcode.c (rb_econv_open): make last_tc NULL if there are only
additional transcoders.
(econv_description): extracted from rb_econv_open_exc.
(rb_econv_open_exc): use econv_description.
(econv_inspect): use econv_description.

Mon Aug 25 23:56:42 2008 NAKAMURA Usaku <usa@ruby-lang.org>

* win32.c (init_stdhandle): set binmode.

Mon Aug 25 23:38:17 2008 Tadayoshi Funaba <tadf@dotrb.org>

* lib/date/format.rb(strftime): can print with given arbitrary
precision.

* lib/date/format.rb(strftime): optional flags and filed width
should also affect %[nt].

Mon Aug 25 23:01:17 2008 Yukihiro Matsumoto <matz@ruby-lang.org>

* compile.c (defined_expr): default defined? should return
Expand Down
3 changes: 3 additions & 0 deletions doc/NEWS
Expand Up @@ -51,6 +51,7 @@ Incompatible (Trivial)
o Dir.exist?
* IO operations
o Non-blocking IO
o Kernel#open takes "t" for newline conversion
o Kernel#open takes encoding specified
o IO#initialize now accepts an IO argument
o StringIO#readpartial
Expand Down Expand Up @@ -112,6 +113,8 @@ Compatible
an enumerator.
* Regexp#match, String#match
o Regexp#match, String#match
* Encoding
* Encoding::Converter
* Fiber: coroutines/micro-threads
* Array
o Array#delete returns a deleted element rather than a given
Expand Down
2 changes: 1 addition & 1 deletion ext/bigdecimal/bigdecimal.c
Expand Up @@ -3165,7 +3165,7 @@ VpMult(Real *c, Real *a, Real *b)

c->exponent = a->exponent; /* set exponent */
if(!AddExponent(c,b->exponent)) {
VpFree(c);
if(w) VpFree(c);
return 0;
}
VpSetSign(c,VpGetSign(a)*VpGetSign(b)); /* set sign */
Expand Down
12 changes: 8 additions & 4 deletions lib/date/format.rb
Expand Up @@ -257,13 +257,17 @@ def strftime(fmt='%F')
when 'j'; emit_n(yday, 3, f)
when 'k'; emit_a(hour, 2, f)
when 'L'
emit_n((sec_fraction / MILLISECONDS_IN_SECOND).floor, 3, f)
w = f[:w] || 3
u = 10**w
emit_n((sec_fraction * u).floor, w, f)
when 'l'; emit_a((hour % 12).nonzero? || 12, 2, f)
when 'M', 'OM'; emit_n(min, 2, f)
when 'm', 'Om'; emit_n(mon, 2, f)
when 'N'
emit_n((sec_fraction / NANOSECONDS_IN_SECOND).floor, 9, f)
when 'n'; "\n"
w = f[:w] || 9
u = 10**w
emit_n((sec_fraction * u).floor, w, f)
when 'n'; emit_a("\n", 0, f)
when 'P'; emit_ad(strftime('%p').downcase, 0, f)
when 'p'; emit_au(if hour < 12 then 'AM' else 'PM' end, 0, f)
when 'Q'
Expand All @@ -281,7 +285,7 @@ def strftime(fmt='%F')
else
emit_a(strftime('%H:%M:%S'), 0, f)
end
when 't'; "\t"
when 't'; emit_a("\t", 0, f)
when 'U', 'W', 'OU', 'OW'
emit_n(if c[-1,1] == 'U' then wnum0 else wnum1 end, 2, f)
when 'u', 'Ou'; emit_n(cwday, 1, f)
Expand Down
71 changes: 45 additions & 26 deletions transcode.c
Expand Up @@ -745,6 +745,7 @@ rb_econv_open(const char *from, const char *to, rb_econv_option_t *opts)
{
transcoder_entry_t **entries = NULL;
int num_trans;
int num_additional;
static rb_econv_t *ec;
int flags = opts ? opts->flags : 0;

Expand All @@ -761,6 +762,7 @@ rb_econv_open(const char *from, const char *to, rb_econv_option_t *opts)
return NULL;
}

num_additional = 0;
if (flags & (ECONV_CRLF_NEWLINE_ENCODER|ECONV_CR_NEWLINE_ENCODER)) {
const char *name = (flags & ECONV_CRLF_NEWLINE_ENCODER) ? "crlf_newline" : "cr_newline";
transcoder_entry_t *e = get_transcoder_entry("", name);
Expand All @@ -775,6 +777,7 @@ rb_econv_open(const char *from, const char *to, rb_econv_option_t *opts)
MEMMOVE(entries+1, entries, transcoder_entry_t *, num_trans);
entries[0] = e;
num_trans++;
num_additional++;
}

if (flags & ECONV_UNIVERSAL_NEWLINE_DECODER) {
Expand All @@ -784,6 +787,7 @@ rb_econv_open(const char *from, const char *to, rb_econv_option_t *opts)
return NULL;
}
entries[num_trans++] = e;
num_additional++;
}

ec = rb_econv_open_by_transcoder_entries(num_trans, entries);
Expand All @@ -798,15 +802,13 @@ rb_econv_open(const char *from, const char *to, rb_econv_option_t *opts)
ec->source_encoding_name = from;
ec->destination_encoding_name = to;

if (flags & ECONV_UNIVERSAL_NEWLINE_DECODER) {
if (ec->num_trans == 1) {
ec->last_tc = NULL;
ec->last_trans_index = -1;
}
else {
ec->last_tc = ec->elems[ec->num_trans-2].tc;
ec->last_trans_index = ec->num_trans-2;
}
if (num_trans == num_additional) {
ec->last_tc = NULL;
ec->last_trans_index = -1;
}
else if (flags & ECONV_UNIVERSAL_NEWLINE_DECODER) {
ec->last_tc = ec->elems[ec->num_trans-2].tc;
ec->last_trans_index = ec->num_trans-2;
}

return ec;
Expand Down Expand Up @@ -1483,29 +1485,30 @@ rb_econv_binmode(rb_econv_t *ec)
}
}

VALUE
rb_econv_open_exc(const char *senc, const char *denc, rb_econv_option_t *opts)
static VALUE
econv_description(const char *senc, const char *denc, rb_econv_option_t *opts, VALUE mesg)
{
int flags = opts ? opts->flags : 0;
VALUE mesg, exc;
int noenc = 0;
mesg = rb_str_new_cstr("code converter open failed (");
if (*senc == '\0' || *denc == '\0') {
if (*senc != '\0')
rb_str_cat2(mesg, senc);
else if (*denc != '\0')
int has_description = 0;

if (NIL_P(mesg))
mesg = rb_str_new(NULL, 0);

if (*senc != '\0' || *denc != '\0') {
if (*senc == '\0')
rb_str_cat2(mesg, denc);
else if (*denc == '\0')
rb_str_cat2(mesg, senc);
else
noenc = 1;
}
else {
rb_str_catf(mesg, "%s to %s", senc, denc);
rb_str_catf(mesg, "%s to %s", senc, denc);
has_description = 1;
}

if (flags & (ECONV_UNIVERSAL_NEWLINE_DECODER|
ECONV_CRLF_NEWLINE_ENCODER|
ECONV_CR_NEWLINE_ENCODER)) {
const char *pre = "";
if (!noenc)
if (has_description)
rb_str_cat2(mesg, " with ");
if (flags & ECONV_UNIVERSAL_NEWLINE_DECODER) {
rb_str_cat2(mesg, pre); pre = ",";
Expand All @@ -1519,7 +1522,21 @@ rb_econv_open_exc(const char *senc, const char *denc, rb_econv_option_t *opts)
rb_str_cat2(mesg, pre); pre = ",";
rb_str_cat2(mesg, "CR-newline");
}
has_description = 1;
}
if (!has_description) {
rb_str_cat2(mesg, "no-conversion");
}

return mesg;
}

VALUE
rb_econv_open_exc(const char *senc, const char *denc, rb_econv_option_t *opts)
{
VALUE mesg, exc;
mesg = rb_str_new_cstr("code converter open failed (");
econv_description(senc, denc, opts, mesg);
rb_str_cat2(mesg, ")");
exc = rb_exc_new3(rb_eNoConverter, mesg);
return exc;
Expand Down Expand Up @@ -2110,9 +2127,11 @@ econv_inspect(VALUE self)
else {
const char *sname = ec->source_encoding_name;
const char *dname = ec->destination_encoding_name;
if (*sname == '\0') sname = "(none)";
if (*dname == '\0') dname = "(none)";
return rb_sprintf("#<%s: %s to %s>", cname, sname, dname);
VALUE str;
str = rb_sprintf("#<%s: ", cname);
econv_description(sname, dname, &ec->opts, str);
rb_str_cat2(str, ">");
return str;
}
}

Expand Down
52 changes: 0 additions & 52 deletions trunk/.cvsignore

This file was deleted.

16 changes: 0 additions & 16 deletions trunk/.document

This file was deleted.

0 comments on commit 57fd107

Please sign in to comment.