Yukihiro "Matz" Matsumoto
73dc32c670
add new functions mrb_gc_register/unregister; close #1411
...
some routines need to refer mruby objects (e.g. callbacks), in that case
you have to protect your objects from garbage collection. the new functions
mrb_gc_register() keeps those objects from GC. you have to remove your
objects using mrb_gc_unregister() when your C routines use mruby objects
any longer, otherwise objects will leak.
2015-09-22 00:15:29 +09:00
Jun Hiroe
ce6297aa04
Fix indents
2015-09-19 06:38:28 +09:00
Jun Hiroe
dd1fa91a66
Replace 1 with TURE macro
2015-09-18 15:51:49 +09:00
Tatsuhiro Tsujikawa
a085c04e37
Don't crash if NULL is passed to mrb_close
...
Sometimes it is very useful just return from mrb_close if NULL is
passed as mrb. This is the same spirit of free(3), which just does
nothing if NULL is passed.
2015-09-12 12:11:10 +09:00
Yasuhiro Matsumoto
8277e950ee
Support windows locale
...
Add mrb_utf8_from_locale, mrb_utf8_free, mrb_locale_from_utf8, mrb_locale_free. Just works for windows.
2015-09-11 11:12:03 +09:00
Kazuho Oku
8256d77c7f
avoid unnecessary string duplications by checking the frozen flag
2015-09-10 22:50:01 +09:00
Kazuho Oku
44eb1492be
freeze the hash key ( fixes #2945 )
2015-09-10 22:24:10 +09:00
Yukihiro "Matz" Matsumoto
2550edd570
remove origin member to implement prepend from struct RClass; ref #2885
...
instead origin is saved in ICLASS with MRB_FLAG_IS_ORIGIN set.
2015-09-05 02:01:02 +09:00
Yukihiro "Matz" Matsumoto
8bb7962eb8
Merge branch 'module-prepend' of https://github.com/polyfox/mruby into polyfox-module-prepend
2015-09-04 04:01:49 +09:00
Yukihiro "Matz" Matsumoto
7b5f8b0728
remove trailing spaces from bc9c47d5
2015-09-03 01:39:17 +09:00
Yukihiro "Matz" Matsumoto
e35c3aff83
unsigned long may be smaller than mrb_int; use uint64_t instead; fix #2935
2015-09-03 00:14:37 +09:00
Yukihiro "Matz" Matsumoto
3a462fe468
Integer << and >> to use Float instead of raising RangeError
2015-09-02 23:41:51 +09:00
Yukihiro "Matz" Matsumoto
6ddd79fd0e
ensure must not be called before rescue; fix #2933
2015-09-02 21:46:51 +09:00
Yukihiro "Matz" Matsumoto
14f0e4a4e4
update string.h.md; ref #2931
2015-09-02 15:09:50 +09:00
Jun Hiroe
e9b4cb11cf
Add a global const variable MRUBY_RELEASE_NO
2015-09-01 13:55:08 +09:00
Yukihiro "Matz" Matsumoto
1a45447b8b
add String#freeze to the core
2015-08-27 17:54:30 +09:00
cremno
ad50a6c410
fix irep float dump format string for MRB_USE_FLOAT
...
IEC 60559 single format has 6 to 9 significant decimal digits precision.
However the printf conversion specifier e (and E, of course) already
writes 1 digit - the one before the decimal point - and precision
specifies the number of digits to write after the decimal point.
2015-08-17 20:39:24 +02:00
Yukihiro "Matz" Matsumoto
a1731254be
Merge pull request #2913 from gkta/remove-duplicate-len-check
...
Remove duplicated RARRAY_LEN check in ary_elt
2015-08-12 12:11:43 +09:00
go.kikuta
c7fad5aa33
Remove duplicated RARRAY_LEN check
2015-08-12 10:20:55 +09:00
go.kikuta
96c948d812
Remove non-need tmp value
2015-08-11 18:02:12 +09:00
Yukihiro "Matz" Matsumoto
5af770cd59
prevent out-of-bounds ensure clause access; fix #2910
2015-08-10 11:41:01 +09:00
Yukihiro "Matz" Matsumoto
0c7d29dff6
FIXABLE() may work wrong on MRB_INT64; fix #2909
2015-08-07 15:30:52 +09:00
Yukihiro "Matz" Matsumoto
f0040b5371
vm: execute ensure without exception at the top of the fiber; fix #2904
2015-07-30 16:46:31 +09:00
Yukihiro "Matz" Matsumoto
89ebb0c4f1
vm: execute ensure at the top of the fiber; fix #2903
2015-07-30 16:45:31 +09:00
Corey Powell
ae1ece7228
Make include_module_at static
...
Since I can't forsee any reason to use it directly inplace of using
prepend/include
2015-07-16 15:25:14 -05:00
Yukihiro "Matz" Matsumoto
6c94b2d963
Merge pull request #2889 from takkaw/fix_build_cygwin64
...
64bit Cygwin also doesn't have frexpl(3)
2015-07-16 21:56:38 +09:00
Yukihiro "Matz" Matsumoto
4f37adfd5e
Merge pull request #2887 from cremno/use-mrb_str_cat_str-instead-of-mrb_str_append
...
use mrb_str_cat_str() instead of mrb_str_append()
2015-07-16 21:56:00 +09:00
takkaw
67e187f0f8
64bit Cygwin also doesn't have frexpl(3)
2015-07-16 18:40:07 +09:00
cremno
0f284091d1
delete mrb_free()-related non-NULL checks
...
No need to optimize since a program only exits once and errors are rare.
Also the mruby source code doesn't have these kind of checks elsewhere.
The ones in {Time,Random}#initialize are kept because there it actually
matters
since initialization always happens and re-initialization is unlikely.
2015-07-16 04:58:21 +02: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
Corey Powell
dbbf2e2623
Remove non-applicable "hack" comment
2015-07-14 14:12:23 -05:00
Corey Powell
eb172c28d7
Applied gc patch to fix ORIGIN ICLASS method table leak
...
Based on the gc patch by ko1
https://github.com/ruby/ruby/commit/5922c954614e5947a548780bb3b894626affe6dd
2015-07-14 09:44:04 -05:00
Corey Powell
f0e920baf0
Renamed parameters in include_module_at
2015-07-14 08:55:53 -05:00
Yukihiro "Matz" Matsumoto
53a81da0fa
mrb_get_args: improve function description about !
2015-07-14 13:35:06 +09:00
Yukihiro "Matz" Matsumoto
4e7050fe0c
mrb_get_args: allow d!
2015-07-14 13:34:21 +09:00
Yukihiro "Matz" Matsumoto
a075498613
mrb_get_args: allow A,H,s,z,a,d specifiers to take ! to accept nil.
...
S,A,H gives nil, s,z,a,d gives NULL for nil argument. ref 02474da
2015-07-14 13:22:42 +09:00
Blaž Hrastnik
8c13e2b7c6
Set origin when doing kind_of? comparisons
2015-07-13 23:35:30 +02:00
Corey Powell
81a2b3431c
included_modules, origin fix
...
Prepended modules would include their origin ICLASS
2015-07-13 09:49:51 -05:00
Corey Powell
199a808e36
Bugfix, included_modules would include classes
2015-07-13 09:49:18 -05:00
Corey Powell
1f678a4ace
Removed comment beside method_removed
...
Not sure if this apart of the ISO standard, so make sure its not misrepresented
2015-07-13 09:40:40 -05:00
Corey Powell
668153092f
Added Module#method_removed hook
2015-07-13 09:38:24 -05:00
Blaž Hrastnik
a725cb9093
Include prepended methods in the instance_methods list.
2015-07-13 14:04:43 +02:00
Corey Powell
d4b009b394
Fixed Modules not being fully initialized before #initialize was called
2015-07-13 14:04:42 +02:00
Corey Powell
40f48034d5
Added changed check to the mrb_include_module
2015-07-13 14:04:42 +02:00
Corey Powell
ce66727177
Remove some remnant debug code
2015-07-13 14:04:42 +02:00
Corey Powell
005cacf18b
Additional patches to make this work
2015-07-13 14:04:42 +02:00
Blaž Hrastnik
97529c2a9a
Comment in a refactor to match MRI, but that fails 320 tests.
2015-07-13 14:04:42 +02:00
Blaž Hrastnik
2e617e37e1
origin must be initialized
2015-07-13 14:04:42 +02:00
Blaž Hrastnik
ad9f32c5a8
Expose insert position, which should be at origin for include and klass for
...
prepend.
2015-07-13 14:04:42 +02:00
Blaž Hrastnik
f962890a92
Implement Module#prepend.
2015-07-13 14:04:42 +02:00