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
4d38cad31b
Add MRB_API to mrb_range_beg_len(); ref #3411
2017-01-23 15:05:12 +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
Clayton Smith
73ad7395c0
Check type before calling mrb_range_ptr.
2016-12-13 10:04:15 -05: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
0ff3ae1fba
Range#include?: simplify condition; ref #3255
2016-11-18 11:54:24 +09:00
Yukihiro "Matz" Matsumoto
b03b1e37d9
Merge pull request #3255 from ksss/range-include
...
Fix condition of Range#include?
2016-11-18 11:48:49 +09:00
ksss
4ef591c897
Fix condition of Range#include?
2016-11-18 10:01:03 +09:00
ksss
176d93d72a
Ranges should not rewrite
2016-11-17 14:57:30 +09:00
Yukihiro "Matz" Matsumoto
c45ed46f28
macro mrb_bool() may evaluate arg multiple times; ref #3228
2016-10-24 01:30:31 +09:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
cremno
938ed044f4
use mrb_str_cat_str() instead of mrb_str_append()
...
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.
2015-07-16 03:56:31 +02:00
go kikuta
d5fd823d82
removed unused variable in range_beg_len
2014-08-16 01:09:40 +09:00
cremno
3bf244e67c
fix linkage of range_beg_len and mrb_range_beg_len
2014-08-04 05:52:09 +02:00
Yukihiro "Matz" Matsumoto
206f89e209
add MRB_API modifiers to mruby API functions
2014-08-04 00:47:08 +09:00
yui-knk
1f3957afe4
Change range_check before mrb_obj_alloc.
2014-05-18 11:59:54 +09:00
Jun Hiroe
0725aacfeb
Use boolean macro in mrb_range_initialize()
2014-05-17 09:58:40 +09:00
Yukihiro "Matz" Matsumoto
f977772359
new macro mrb_int(mrb,x) to retrieve mrb_int from mrb_value with conversion if needed
2014-05-03 23:45:40 +09:00
Yukihiro "Matz" Matsumoto
1519e441a0
use proper length for mrb_get_values_at()
...
separate mrb_range_beg_len() into two: the one truncates range into the
sequence size, and the one does not. #values_at uses the latter.
2014-05-03 23:35:24 +09:00
Yukihiro "Matz" Matsumoto
206c96e4a7
reindent else
2014-05-03 21:20:14 +09:00
Yukihiro "Matz" Matsumoto
0c294af091
convert range edges to integers
2014-05-03 21:19:06 +09:00
Yukihiro "Matz" Matsumoto
bd681269f4
do not raise error in mrb_range_beg_len()
2014-05-03 21:18:25 +09:00
Yukihiro "Matz" Matsumoto
342f124702
raise TypeError instead of ArgumentError when argument of wrong type given to the values_at
2014-05-03 21:17:22 +09:00
Yukihiro "Matz" Matsumoto
c3aa436e2c
Merge branch 'values_at' of https://github.com/take-cheeze/mruby into take-cheeze-values_at
2014-05-03 21:13:03 +09:00
Yukihiro "Matz" Matsumoto
c2bd0d33ea
remove each from range.c
2014-05-03 12:11:17 +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
aca3a1f3fb
range_init argument for exclude_end use mrb_bool
2014-04-24 13:25:59 +00:00
ksss
f1d85c2f97
mrb_range_new excl flag use mrb_bool insteard of int
2014-04-24 13:18:57 +00:00
Yukihiro "Matz" Matsumoto
5138f62d6b
resolve conflict
2014-04-15 10:55:46 +09:00
Yukihiro "Matz" Matsumoto
19a08b8455
Merge pull request #1674 from cremno/mrb_bool-FALSE-TRUE
...
use mrb_bool, FALSE and TRUE more
2014-02-09 18:35:20 +09:00
Yukihiro "Matz" Matsumoto
4a2c37df93
made mrb_define_class to return existing class, with heavy refactoring
2014-02-08 13:44:31 +09: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
cremno
f2a62a74ed
clean up external symbols
...
remove unused and unneeded:
- sysexit_status
- type (a global variable)
add mrb_ prefix to:
- codedump_all
- class_instance_method_list
- parser_dump
make various functions static, incl.:
- yyparse
- make_exception
2014-01-31 01:30:18 +01:00
cremno
09bb30870b
tiny word boxing optimization
2014-01-02 06:36:29 +01:00
Yukihiro "Matz" Matsumoto
429e69243c
remove unused inspect_range
2013-08-01 18:29:55 +09:00
Jun Hiroe
8e42868600
Repalace int with mrb_bool because a return value is boolean.
2013-07-15 23:17:12 +09:00
Jun Hiroe
780930cbf5
Refactor mrb_range_beg_len() func in range.c
2013-07-05 21:21:17 +09:00
Yukihiro "Matz" Matsumoto
068087439e
Merge pull request #1324 from h2so5/fix-range-equal
...
Fix Range#==
2013-06-30 14:23:57 -07:00
h2so5
db0eaa6352
Fix Range#==
2013-06-30 23:40:53 +09:00
Jun Hiroe
85ea2f6144
Refactor range_eql() func in rangec.c
2013-06-30 21:30:22 +09:00
Jun Hiroe
a2210274ea
Refactor mrb_range_eq() func in range.c.
2013-06-30 02:11:37 +09:00
Daniel Bovensiepen
373122a299
Merge upstream
2013-06-15 03:53:50 +08:00
Daniel Bovensiepen
80c26d2235
Add ISO Number to Range
2013-06-17 04:50:37 +08:00
h2so5
1e5b00e772
Remove mrb_class_obj_get
2013-05-01 21:10:17 +09:00
Yukihiro "Matz" Matsumoto
30d580ecbc
rename every ARGS_XXX to MRB_ARGS_XXX; ref #1206
2013-04-25 09:47:36 +09:00
h2so5
9b798114bb
Use mrb_bool for the 'b' format specifier of mrb_get_args
2013-04-22 10:41:53 +09:00
Yukihiro Matz Matsumoto
d0d920e909
rename mrb_true_or_false_value() to mrb_bool_value()
2013-03-19 12:03:54 +09:00
Masaki Muranaka
ea5a059969
Use mrb_true_or_false_value() / in range_eql().
2013-03-19 11:04:23 +09:00
Masaki Muranaka
be5986b2b4
Use mrb_true_or_false_value() / in mrb_range_include().
2013-03-19 11:04:23 +09:00
Masaki Muranaka
90cd202fd1
Use mrb_true_or_false_value() / in mrb_range_eq().
2013-03-19 11:04:22 +09:00