• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10/ruby-106/ruby/ext/date/

Lines Matching +defs:other +defs:buf

5487  *    d + other  ->  date
5489 * Returns a date object pointing other days after self. The other
5490 * should be a numeric value. If the other is flonum, assumes its
5502 d_lite_plus(VALUE self, VALUE other)
5506 switch (TYPE(other)) {
5514 t = FIX2LONG(other);
5558 if (f_positive_p(other))
5562 other = f_negate(other);
5565 nth = f_idiv(other, INT2FIX(CM_PERIOD));
5566 jd = FIX2INT(f_mod(other, INT2FIX(CM_PERIOD)));
5617 o = RFLOAT_VALUE(other);
5713 if (!k_numeric_p(other))
5715 other = f_to_r(other);
5717 if (!k_rational_p(other))
5718 return d_lite_plus(self, other);
5726 if (wholenum_p(other))
5727 return d_lite_plus(self, RRATIONAL(other)->num);
5729 if (f_positive_p(other))
5733 other = f_negate(other);
5736 nth = f_idiv(other, INT2FIX(CM_PERIOD));
5737 t = f_mod(other, INT2FIX(CM_PERIOD));
5819 minus_dd(VALUE self, VALUE other)
5821 get_d2(self, other);
5871 * d - other -> date or rational
5873 * Returns the difference between the two dates if the other is a date
5874 * object. If the other is a numeric value, returns a date object
5875 * pointing other days before self. If the other is flonum, assumes
5887 d_lite_minus(VALUE self, VALUE other)
5889 if (k_date_p(other))
5890 return minus_dd(self, other);
5892 switch (TYPE(other)) {
5894 return d_lite_plus(self, LONG2NUM(-FIX2LONG(other)));
5896 return d_lite_plus(self, DBL2NUM(-RFLOAT_VALUE(other)));
5898 if (!k_numeric_p(other))
5903 return d_lite_plus(self, f_negate(other));
5965 d_lite_rshift(VALUE self, VALUE other)
5974 other);
6015 d_lite_lshift(VALUE self, VALUE other)
6017 return d_lite_rshift(self, f_negate(other));
6187 cmp_gen(VALUE self, VALUE other)
6191 if (k_numeric_p(other))
6192 return f_cmp(m_ajd(dat), other);
6193 else if (k_date_p(other))
6194 return f_cmp(m_ajd(dat), f_ajd(other));
6195 return rb_num_coerce_cmp(self, other, rb_intern("<=>"));
6199 cmp_dd(VALUE self, VALUE other)
6201 get_d2(self, other);
6257 * d <=> other -> -1, 0, +1 or nil
6259 * Compares the two dates and returns -1, zero, 1 or nil. The other
6272 d_lite_cmp(VALUE self, VALUE other)
6274 if (!k_date_p(other))
6275 return cmp_gen(self, other);
6278 get_d2(self, other);
6282 return cmp_dd(self, other);
6387 equal_gen(VALUE self, VALUE other)
6391 if (k_numeric_p(other))
6392 return f_eqeq_p(m_real_local_jd(dat), other);
6393 else if (k_date_p(other))
6394 return f_eqeq_p(m_real_local_jd(dat), f_jd(other));
6395 return rb_num_coerce_cmp(self, other, rb_intern("=="));
6400 * d === other -> bool
6416 d_lite_equal(VALUE self, VALUE other)
6418 if (!k_date_p(other))
6419 return equal_gen(self, other);
6422 get_d2(self, other);
6425 return equal_gen(self, other);
6489 d_lite_eql_p(VALUE self, VALUE other)
6491 if (!k_date_p(other))
6493 return f_zero_p(d_lite_cmp(self, other));
6650 date_strftime_alloc(char **buf, const char *format,
6655 (*buf)[0] = '\0';
6661 len = date_strftime(*buf, SMALLBUF, format, tmx);
6662 if (len != 0 || (**buf == '\0' && errno != ERANGE)) return len;
6664 *buf = xmalloc(size);
6665 (*buf)[0] = '\0';
6666 len = date_strftime(*buf, size, format, tmx);
6675 xfree(*buf);
6765 char buffer[SMALLBUF], *buf = buffer;
6789 len = date_strftime_alloc(&buf, p, &tmx);
6790 rb_str_cat(str, buf, len);
6792 if (buf != buffer) {
6793 xfree(buf);
6794 buf = buffer;
6804 len = date_strftime_alloc(&buf, fmt, &tmx);
6806 str = rb_str_new(buf, len);
6807 if (buf != buffer) xfree(buf);
6939 * So, the result may differ even if a same format string is used in other
7000 char buffer[SMALLBUF], *buf = buffer;
7006 len = date_strftime_alloc(&buf, fmt, &tmx);
7007 str = rb_usascii_str_new(buf, len);
7008 if (buf != buffer) xfree(buf);
8370 * So, the result may differ even if a same format string is used in other