summaryrefslogtreecommitdiffhomepage
path: root/src/range.c
AgeCommit message (Collapse)Author
2021-09-03range.c: `len = b - a` may overflow.Yukihiro "Matz" Matsumoto
2021-09-03range.c: hide internal `__num_to_a' method from backtrace.Yukihiro "Matz" Matsumoto
2021-07-09range.c: avoid implicit conversion from `mrb_float` to `mrb_int`.Yukihiro "Matz" Matsumoto
2021-07-08range.c: should not include internal `__num_to_a` in the backtrace.Yukihiro "Matz" Matsumoto
2021-06-20Added `MRB_OBJ_ALLOC()` macro that does not require a castdearblue
The `MRB_OBJ_ALLOC()` macro function returns a pointer of the type corresponding to the constant literal defined in `enum mrb_vtype`.
2021-05-17Global renaming regarding `integer` and `float`.Yukihiro "Matz" Matsumoto
Consistent number conversion function names: * `mrb_value` to immediate (C) value * `mrb_int()` -> `mrb_as_int()` * `mrb_to_flo()` -> `mrb_as_float()` * `mrb_value` to `mrb_value` (converted) * `mrb_to_int()' * `mrb_Integer()` - removed * `mrb_Float()` -> `mrb_to_float` Consistent function name (avoid `_flo` suffix): * `mrb_div_flo()` -> `mrb_div_float`
2021-05-14range.c: implement (part of) `Range#to_a` in C.Yukihiro "Matz" Matsumoto
Mostly for performance reason.
2021-05-14range.c: refactor conditional compilation code.Yukihiro "Matz" Matsumoto
So that auto indentation works.
2021-05-14range.c: rename `RANGE_INITIALIZED_MASK` to `RANGE_INITIALIZED_FLAG`.Yukihiro "Matz" Matsumoto
2021-03-17range.c: fixed a begin-less ranges issue.Yukihiro "Matz" Matsumoto
2021-01-26Revert "Minimize the changes in #5277"Yukihiro "Matz" Matsumoto
This reverts commit dc51d89ac22acc60b9bfeed87115863565b74085.
2021-01-22Minimize the changes in #5277Yukihiro "Matz" Matsumoto
Instead of including `mruby/presym.h` everywhere, we provided the fallback `mruby/presym.inc` under `include/mruby` directory, and specify `-I<build-dir>/include` before `-I<top-dir>/include` in `presym.rake`. So even when someone drops `-I<build-dir>/include` in compiler options, it just compiles without failure.
2021-01-11Avoid including `presym.inc` in existing header filesKOBAYASHI Shuji
Addressed an issue where existing programs linking `libmruby.a` could only be built by adding `<build-dir>/include` to compiler's include path.
2020-11-02Make Ranges frozen as Ruby3.0.Yukihiro "Matz" Matsumoto
2020-10-16Add startless range (another part of #5085)Yukihiro "Matz" Matsumoto
Ref #5093; close #5085
2020-10-16Remove uninitialized local variable warning.Yukihiro "Matz" Matsumoto
Fix for #5093
2020-10-15Merge branch 'work_for_merge' of https://github.com/zubycz/mruby into ↵Yukihiro "Matz" Matsumoto
zubycz-work_for_merge
2020-10-13Introduce endless range (a part of #5085)taiyoslime
Co-Authored-By: n4o847 <[email protected]> Co-Authored-By: smallkirby <[email protected]>
2020-10-12Reorganize `Integer` system.Yukihiro "Matz" Matsumoto
- Integrate `Fixnum` and `Integer` - Remove `Integral` - `int / int -> int` - Replace `mrb_fixnum()` to `mrb_int()` - Replace `mrb_fixnum_value()` to `mrb_int_value()`. - Use `mrb_integer_p()` instead of `mrb_fixnum_p()`
2020-10-12Rename `MRB_TT_FIXNUM` to `MRB_TT_INTEGER`.Yukihiro "Matz" Matsumoto
We still have `#define MRB_TT_FIXNUM MRB_TT_INTEGER` for compatibility.
2020-10-12Rename float configuration option names.Yukihiro "Matz" Matsumoto
- `MRB_WITHOUT_FLOAT` => `MRB_NO_FLOAT` - `MRB_USE_FLOAT` => `MRB_USE_FLOAT32` The former is to use `USE_XXX` naming convention. The latter is to make sure `float` is 32bit float and not floating point number in general.
2020-10-12Add `MRB_SYM()` for inline symbols.Yukihiro "Matz" Matsumoto
2020-06-20Add `mrb_get_arg1()` that retrieves single (and only) argument.Yukihiro "Matz" Matsumoto
`mrb_get_arg1()` raises `ArgumentError` if the method does not receive one argument. And replaces all `mrb_get_args(mrb, "o", &arg)` by the new function.
2019-09-26Use type predicate macros instead of `mrb_type` if possibleKOBAYASHI Shuji
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for all `enum mrb_vtype`).
2019-09-14Remove `mrb_funcall` from `<=>` operations.Yukihiro "Matz" Matsumoto
2019-09-14Use `mrb_equal` instead of `mrb_funcall`.Yukihiro "Matz" Matsumoto
In the typical case, `mrb_funcall` invocation would be skipped.
2019-08-05Use new specifiers/modifiers of `mrb_vfromat()`KOBAYASHI Shuji
The binary sizes (gems are only `mruby-bin-mruby`) are reduced slightly in my environment than before the introduction of new specifiers/modifiers (5116789a) with this change. ------------+-------------------+-------------------+-------- BINARY | BEFORE (5116789a) | AFTER (This PR) | RATIO ------------+-------------------+-------------------+-------- mruby | 593416 bytes | 593208 bytes | -0.04% libmruby.a | 769048 bytes | 767264 bytes | -0.23% ------------+-------------------+-------------------+-------- BTW, I accidentally changed `tasks/toolchains/visualcpp.rake` at #4613, so I put it back.
2019-06-28Remove unnecessary backticks in `src/range.c`; ref #2858KOBAYASHI Shuji
2019-05-25Name the return value of `mrb_range_beg_len()`dearblue
2019-01-04Remove unused local variable `n` in `range_initialize`; #4213Yukihiro "Matz" Matsumoto
2019-01-03range: Refactor range.h/range.cKOBAYASHI Shuji
Functions order, name, linkage and so on.
2019-01-01range: Embed edges in RRange on boxing environment.KOBAYASHI Shuji
[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
2018-06-14Need to add a write barrier for ranges; fix #4042Yukihiro "Matz" Matsumoto
Ranges are almost immutable but `initialize` and `initialize_copy` modify the receiver so that we need to add a write barrier.
2017-10-11Add MRB_WITHOUT_FLOATYAMAMOTO Masaya
2017-09-27fix: src\range.c(136): warning C4244: '=': conversion from 'mrb_int' to ↵Tomasz Dąbrowski
'int', possible loss of data
2017-08-26Keep `Range` class in `mrb_state` structure for performance.Yukihiro "Matz" Matsumoto
2017-01-23Change return type of mrb_range_beg_len() from `int` to `mrb_int`.Yukihiro "Matz" Matsumoto
ref #3411
2017-01-23Add MRB_API to mrb_range_beg_len(); ref #3411Yukihiro "Matz" Matsumoto
2017-01-23Changed the behavior of mrb_range_beg_len(); close #3411Yukihiro "Matz" Matsumoto
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]
2016-12-13Check type before calling mrb_range_ptr.Clayton Smith
2016-12-03Check before retrieving struct RRange pointer; fix #3320Yukihiro "Matz" Matsumoto
range->edges may be NULL for example when #initialize_copy removed.
2016-11-18Range#include?: simplify condition; ref #3255Yukihiro "Matz" Matsumoto
2016-11-18Merge pull request #3255 from ksss/range-includeYukihiro "Matz" Matsumoto
Fix condition of Range#include?
2016-11-18Fix condition of Range#include?ksss
2016-11-17Ranges should not rewriteksss
2016-10-24macro mrb_bool() may evaluate arg multiple times; ref #3228Yukihiro "Matz" Matsumoto
2015-11-27include changed from by quotes ("") to by brackets (<>); close #3032Yukihiro "Matz" Matsumoto
2015-07-16use mrb_str_cat_str() instead of mrb_str_append()cremno
If the argument is always a string, then mrb_str_cat_str() can be directly called instead of indirectly by mrb_str_append(). mrb_any_to_s(), mrb_obj_as_string(), mrb_inspect() always return a string.
2014-08-16removed unused variable in range_beg_lengo kikuta
2014-08-04fix linkage of range_beg_len and mrb_range_beg_lencremno