KOBAYASHI Shuji
feaf80d899
Use type predicate macros instead of mrb_type if possible
...
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for
all `enum mrb_vtype`).
2019-09-26 22:23:27 +09:00
Yukihiro "Matz" Matsumoto
76f1aa7de5
Remove mrb_funcall from <=> operations.
2019-09-14 09:05:32 +09:00
Yukihiro "Matz" Matsumoto
34cdff5ee4
Use mrb_equal instead of mrb_funcall.
...
In the typical case, `mrb_funcall` invocation would be skipped.
2019-09-14 09:05:32 +09:00
KOBAYASHI Shuji
334afb167c
Use new specifiers/modifiers of mrb_vfromat()
...
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-08-05 13:18:50 +09:00
KOBAYASHI Shuji
c9a3867ff2
Remove unnecessary backticks in src/range.c; ref #2858
2019-06-28 19:27:58 +09:00
dearblue
56e0e1934d
Name the return value of mrb_range_beg_len()
2019-05-25 12:12:21 +09:00
Yukihiro "Matz" Matsumoto
53d87c59c0
Remove unused local variable n in range_initialize; #4213
2019-01-04 14:42:47 +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
ba090a46af
Need to add a write barrier for ranges; fix #4042
...
Ranges are almost immutable but `initialize` and `initialize_copy`
modify the receiver so that we need to add a write barrier.
2018-06-14 11:25:12 +09:00
YAMAMOTO Masaya
acdc2d1f24
Add MRB_WITHOUT_FLOAT
2017-10-11 17:58:11 +09:00
Tomasz Dąbrowski
0e2976bf93
fix: src\range.c(136): warning C4244: '=': conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27 22:22:05 +02:00
Yukihiro "Matz" Matsumoto
0c52112dd4
Keep Range class in mrb_state structure for performance.
2017-08-26 02:01:50 +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
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