42 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto cce8f62b21 mruby-object-ext/test: call #remove_const via #__send__ 2025-03-07 17:17:40 +09:00
dearblue f9151e0bd9 Fixed argument forwarding in instance_exec
However, on C, there is no easy way to pass keyword arguments.
Therefore, when called `Kernel#instance_exec` on C, keyword arguments are converted to positional arguments.
This is a limitation of current mruby.

fixed #6389
2024-10-24 21:20:46 +09:00
Yukihiro "Matz" Matsumoto e1a62a581f mruby-object-ext: use presym for initialization 2024-06-14 00:33:18 +09:00
dearblue 3111990089 Introduce mrb_obj_itself()
Some method definitions were changed to use this function.
2024-01-20 22:07:29 +09:00
Yukihiro "Matz" Matsumoto 49b887d75f mruby-object-ext/object.c: remove mrb_ prefix from static functions 2023-04-20 22:40:10 +09:00
Yukihiro "Matz" Matsumoto 7df31d9451 mruby.h: remove acc from callinfo; add cci instead.
`acc` was used as an index of the receiver (if positive), or a flag for
methods implemented in C. We replace `regs[ci->acc]` by `ci[1].stack[0]`.
And renamed `acc` (originally meant accumulator position) to `cci`
(means callinfo for C implemented method).
2021-09-10 12:39:51 +09:00
Yukihiro "Matz" Matsumoto 17ecf14511 Revert "Minimize the changes in #5277"
This reverts commit dc51d89ac2.
2021-01-26 10:57:07 +09:00
Yukihiro "Matz" Matsumoto dc51d89ac2 Minimize the changes in #5277
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-22 18:38:53 +09:00
Yukihiro "Matz" Matsumoto 6c5ccd5abe Merge branch 'avoid-including-presym.inc-in-existing-header-files' of https://github.com/shuujii/mruby into shuujii-avoid-including-presym.inc-in-existing-header-files 2021-01-21 14:53:18 +09:00
KOBAYASHI Shuji 90b53f4c29 Avoid including presym.inc in existing header files
Addressed an issue where existing programs linking `libmruby.a` could only
be built by adding `<build-dir>/include` to compiler's include path.
2021-01-11 09:21:07 +09:00
dearblue 58e9442737 Unified target_class and env of mrb_callinfo
If there is `env`, `env->c` means `target_class`.
2021-01-10 13:23:28 +09:00
Yukihiro "Matz" Matsumoto 8a87549315 Rename float configuration option names.
- `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-12 16:21:40 +09:00
Yukihiro "Matz" Matsumoto 2a366ffba8 Use functions that take symbols to reduce string litrals in C. 2020-10-12 16:20:59 +09:00
Yukihiro "Matz" Matsumoto d3a02a297f Fix instance_exec and class_exec to avoid crash on indirect calls.
Thank you @shuujii to additional report on #4973
2020-04-22 16:48:33 +09:00
dearblue 099a4f3969 Entrust "no block given" error to mrb_get_args()
Some error messages will be changed.
2019-09-16 20:29:58 +09:00
KOBAYASHI Shuji 2d520eaf6f Move NilClass#to_h to mruby-object-ext from mruby-enum-ext 2019-07-24 20:13:26 +09:00
KOBAYASHI Shuji 05493e651d Clarify mruby-(kernel|object)-ext gem summary; ref 8e637bdd [ci skip] 2019-06-06 20:21:40 +09:00
KOBAYASHI Shuji 03fce2e206 Kernel#itself should not be a module function 2019-05-29 15:57:18 +09:00
Yukihiro "Matz" Matsumoto 8170f6899c Merge pull request #4450 from shuujii/move-Kernel-instance_exec-to-BasicObject
Move `Kernel#instance_exec` to `BasicObject`
2019-05-19 22:21:31 +09:00
Yukihiro "Matz" Matsumoto 8e637bdd83 Should clarify the role of mruby-kernel-ext and mruby-object-ext; close #4449
The former should contain function like methods, and the latter should
contain methods shared by all objects.
2019-05-19 22:17:56 +09:00
KOBAYASHI Shuji ef5dd5d31d Move Kernel#instance_exec to BasicObject 2019-05-18 19:19:52 +09:00
Yukihiro "Matz" Matsumoto cca19532c5 Remove Kernel#class_defined? which is not available in CRuby; #3829 2019-01-03 11:34:35 +09:00
YAMAMOTO Masaya 9afd376fa4 Support MRB_WIHTOUT_FLOAT to mruby-object-ext 2017-10-16 18:15:25 +09:00
Yukihiro "Matz" Matsumoto 877e16501c No longer need to copy argv from mrb_get_args; ref #3722 2017-06-27 22:47:26 +09:00
Yukihiro "Matz" Matsumoto 6a0b68f8b8 Use trampoline technique for instance_exec; ref #3359
A new function `mrb_yield_cont()` is provided. You have to call it
at the end of a C defined method, e.g. `return mrb_yield_cont()`.
2017-04-19 19:54:55 +09:00
Yukihiro "Matz" Matsumoto 191ee2596c Need to copy argv since it may be reallocated; fix #3500
The argv for `mrb_yield_with_class()` should not be on mruby stack.
Note the result from `mrb_get_args("*")` is on the stack.
2017-03-13 22:51:53 +09:00
Yukihiro "Matz" Matsumoto b165708c8d Move #instance_exec to Kernel module
CRuby defines #instance_exec in BasicObject, but we don't.
It's a small incompatibility that isn't worth accomplish at
the price of implementation complexity.
2017-02-15 13:24:03 +09:00
Bouke van der Bijl 4523aaec01 Fix segfault when defining class inside instance_exec on primitive 2016-11-24 10:06:15 -05:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Jun Hiroe 4e4929bc72 Rename extended xxxx class or module to xxxx class or module extension 2015-06-28 11:18:52 +09:00
Jun Hiroe c69d1201e1 Fix typo; Replace extensional with extended 2015-06-28 00:05:58 +09:00
kkkkkt d94469ac23 changed to call check_cv_name_str in check_cv_name_sym and adjust indent 2014-08-21 13:56:43 +09:00
take_cheeze b5028421b9 Use mrb_int in mrbgem rest argument getting. 2014-04-25 22:02:10 +09:00
ksss d3ea800cba Implement Object#tap 2014-03-27 19:36:07 +09:00
Yukihiro "Matz" Matsumoto 9084e03556 rename mrb_yield_internal to mrb_yield_with_class since it's no longer internal 2014-03-19 08:57:54 +09:00
Tomoyuki Sahara 93694fe521 export mrb_yield_internal. 2014-03-19 01:08:01 +09:00
take_cheeze c73f8d4def move summary of mrbgems in default gembox to its spec 2014-03-17 00:34:24 +09:00
Daniel Bovensiepen b99aa126a6 Improve test of mruby-object-ext GEM 2013-08-04 22:41:45 +08:00
Jun Hiroe 0804800921 I replace 0 with NULL because struct pointer be should set NULL in. 2013-07-27 13:16:08 +09:00
Tomoyuki Sahara 116f75a8ce "spec.author" is better for single-author gems.
"spec.author=" expects a String represents a single author.
"spec.authors=" expects an Array which is a list of multiple authors.

http://guides.rubygems.org/specification-reference/
2013-07-23 10:09:24 +09:00
h2so5 2117f0973c Add Object#instance_exec 2013-07-01 16:23:14 +09:00
Akira Yumiyama 36fc42e7db add nil.to_a, nil.to_f, nil.to_i methods 2013-06-28 10:01:07 +09:00