30 Commits

Author SHA1 Message Date
David Siaw b5299b1c58 fix up documentation for values 2019-08-18 20:12:44 +09:00
KOBAYASHI Shuji 81828f8b08 Fix struct RRange overflow on 32-bit CPU with MRB_NAN_BOXING 2019-06-18 18:17:03 +09:00
dearblue 56e0e1934d Name the return value of mrb_range_beg_len() 2019-05-25 12:12:21 +09:00
KOBAYASHI Shuji eb216fc858 range: Refactor range.h/range.c
Functions order, name, linkage and so on.
2019-01-03 20:09:41 +09:00
KOBAYASHI Shuji 648b57620a range: Embed edges in RRange on boxing environment.
[Breaking changes]

Developers must use following APIs for accessing attributes of RRange
because RRange structure depends on boxing setting.

- mrb_range_beg
- mrb_range_end
- mrb_range_excl_p
2019-01-01 15:35:56 +09:00
Yukihiro "Matz" Matsumoto 28cf7a549d Change return type of mrb_range_beg_len() from int to mrb_int.
ref #3411
2017-01-23 22:18:29 +09:00
Yukihiro "Matz" Matsumoto 5e1d923381 Changed the behavior of mrb_range_beg_len(); close #3411
The new API is:

int mrb_range_beg_len(mrb, range, &beg, &len, len, trunc)

The new argument `trunc` is a boolean value that specifies
whether the function truncates the range. The new return value
is an integer instead of a boolean, that is:

 0: not a range
 1: range with proper edges
 2: out of range

To get the old behavior, you have to rewrite:

  mrb_range_beg_len(mrb, range, &beg, &len, len)

to:

  mrn_range_beg_len(mrb, range, &beg, &len, len, TRUE) == 1

[Breaking Change]
2017-01-23 14:35:26 +09:00
Yukihiro "Matz" Matsumoto 79a621dd73 Check before retrieving struct RRange pointer; fix #3320
range->edges may be NULL for example when #initialize_copy removed.
2016-12-03 12:30:01 +09:00
Yukihiro "Matz" Matsumoto 065966dae4 common.h are supposed to be included from other header, so call it with quotes; ref #3032 2015-11-28 00:10:38 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Seba Gamboa 5dfdd53bcc Merge doc/api/mruby/range.h.md docs 2015-10-08 13:26:23 -03:00
Seba Gamboa a0fe0c40b1 Remove old doxygen tags 2015-10-08 12:29:10 -03:00
Seba Gamboa 40bf7bde78 Sorting documentation grouping 2015-09-21 01:48:42 -03:00
Seba Gamboa c127614638 Setting up doxygen groups 2015-09-20 21:14:07 -03:00
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
take_cheeze 44dc05f12a Implement Struct#values_at and Array#values_at .
Add API `mrb_get_values_at()` to mruby/range.h .
2014-05-02 23:20:48 +09:00
ksss f1d85c2f97 mrb_range_new excl flag use mrb_bool insteard of int 2014-04-24 13:18:57 +00:00
cremno 4507985c3e use mrb_bool, FALSE and TRUE more
It doesn't matter to me if one is using FALSE/TRUE instead of 1/0
but I prefer a type (alias) which emphasizes boolean vars to int.
I changed 1/0 to FALSE/TRUE anyway.
2014-01-31 18:00:36 +01:00
Yukihiro "Matz" Matsumoto 40e6cdcb5c rename mrb_value_p() to mrb_ptr() since _p means predicate in mruby source 2013-08-07 17:39:28 +09:00
Yuichi Nishiwaki 8dc2fa3bc8 add read barrier to value.p
API changes:
- value.p must be accessed via mrb_value_p macro
- value.p must be mutated via MRB_SET_VALUE_P macro
2013-08-03 14:03:44 -07:00
Masaki Muranaka e4231a0a33 Add typedef to structures that have mrb_ prefix. Use typedef-ed type instead of struct directly. 2013-03-01 14:28:22 +09:00
Masaki Muranaka cb7cf4e795 Simplify mrb_range_beg_len(). Don't use OTHER macro. 2013-02-26 15:43:19 +09:00
Yukihiro Matsumoto 97b7eb6096 rename MRUBY_OBJECT_HEADER to MRB_OBJECT_HEADER 2012-08-18 19:05:18 +09:00
Yukihiro Matsumoto 7d02df3016 NaN boxing 2012-08-14 13:16:34 +09:00
Mitchell Blank Jr 3471e2b134 C++ compilability - don't define types inside others
The following is legal code in both C and C++:

  struct foo {
    struct bar { int a } x;
    int y;
  };

...however in C++ it defines a type called "foo::bar" instead of "bar".
Just avoid this construct altogether
2012-05-19 22:40:57 -07:00
Yukihiro Matsumoto a4d3579e31 add extern "C" guards; close #126 2012-05-18 02:02:49 +09:00
Yukihiro Matsumoto eac8e4a303 move mrb_obj_is_instance_of from range.c to kernel.c 2012-05-05 00:21:23 +09:00
roco 4ec6d41f16 rm whitespace 2012-04-30 14:29:19 -07:00
mimaki 835443614d add file header 2012-04-23 11:46:16 +09:00
mimaki e0d6430f63 add mruby sources 2012-04-20 09:39:03 +09:00