summaryrefslogtreecommitdiffhomepage
path: root/include
AgeCommit message (Collapse)Author
2021-09-01mruby.h: obsolete `mrb_to_str()`.Yukihiro "Matz" Matsumoto
Replace them by `mrb_ensure_string_type()`.
2021-09-01object.c: remove `mrb_convert_to_integer()' function.Yukihiro "Matz" Matsumoto
And merged to `mrb_f_integer()` which is only usage of the function.
2021-09-01string.h: obsolete `mrb_str_to_str()`, even from examples.Yukihiro "Matz" Matsumoto
2021-09-01mruby.h: reorganize `mrb_ensure/check` functions in headers.Yukihiro "Matz" Matsumoto
2021-08-30Merge pull request #5542 from dearblue/mrb_get_args-cIYukihiro "Matz" Matsumoto
Allow `nil` for `c!` and `I!` specifiers of `mrb_get_args()`
2021-08-28Allow `nil` for `c!` and `I!` specifiers of `mrb_get_args()`dearblue
2021-08-28Integrate the processing of similar specifiers of `mrb_get_args()`dearblue
It is `o`, `C`, `S`, `A` and `H` specifiers that are integrated. As a side effect, the `C!` Specifier can now be used.
2021-08-26boxing_nan.h: rename prefix `BOXNAN` to `NANBOX`.Yukihiro "Matz" Matsumoto
2021-08-26boxing_word.h: rename prefix `BOXWORD` to `WORDBOX`.Yukihiro "Matz" Matsumoto
2021-08-26boxing_word.h: rename configuration macro name.Yukihiro "Matz" Matsumoto
`MRB_WORDBOX_USE_HEAP_FLOAT` instead of `MRB_USE_FLOAT_FULL_PRECISION`.
2021-08-26value.h: reconstruct `mrb_ro_data_p()`.Yukihiro "Matz" Matsumoto
* use predefined `mrb_ro_data_p()` for user-mode Linux and macOS * define `MRB_LINK_TIME_RO_DATA_P` if predefined one is used * configure macro `MRB_USE_LINK_TIME_RO_DATA_P` is no longer used * contributions for new platforms are welcome
2021-08-24Merge pull request #5535 from dearblue/get-args-frozenYukihiro "Matz" Matsumoto
Checks the frozen object with `mrb_get_args()`
2021-08-23Checks the frozen object with `mrb_get_args()`dearblue
This now works with the `+` modifier that can be added after each specifier. - `nil` is bypassed. - The `s` and `z` specifiers are received in C as a `const char *`, so adding a `+` modifier will raise an exception. - The `a` specifier is received in C as `const mrb_value *`, so adding a `+` modifier will raise an exception. - The `|`, `*`, `&`, `?` and `:` specifiers with `+` modifier raises an exception. If `!`/`+` exceeds one for each specifier, an exception will occur in the subsequent processing. This is the same behavior as before.
2021-08-21Organize the include of header filesdearblue
- `#include <math.h>` is done in `mruby.h`. Eliminate the need to worry about the `MRB_NO_FLOAT` macro. - Include mruby header files before standard header files. If the standard header file is already placed before `mruby.h`, the standard header file added in the future tends to be placed before `mruby.h`. This change should some reduce the chances of macros that must be defined becoming undefined in C++ or including problematic header files in a particular mruby build configuration.
2021-08-21boxing_word.h: embed `mrb_float` in `mrb_value` if possible.Yukihiro "Matz" Matsumoto
Embedding reduce memory consumption, sacrificing precision. It clips least significant 2 bits from `mrb_float`, so if you need to keep float precision, define `MRB_USE_FLOAT_FULL_PRECISION`. `MRB_WORD_BOXING` and `MRB_INT64`: `mrb_float` (`double`) is embedded in `mrb_value` clipped last 2 bits. `MRB_WORD_BOXING` and `MRB_INT64` and `MRB_USE_FLOAT_FULL_PRECISION`: `mrb_float` is allocated in the heaps wrapped by `struct RFloat`. `MRB_WORD_BOXING` and `MRB_INT32` and `MRB_USE_FLOAT32`: `mrb_float` (`float`) is embedded in `mrb_value` clipped last 2 bits. In addition, to reserve bit space in the `mrb_value`, maximum inline symbol length become 4 (instead of 5) in the configuration. `MRB_WORD_BOXING` and `MRB_INT32`: Assume `MRB_USE_FLOAT_FULL_PRECISION` and allocate Float values in heap.
2021-08-19symbol.c: reduce memory by avoiding alignment gaps.Yukihiro "Matz" Matsumoto
In additions: * use bitmap for flags * BER integer compression for length
2021-08-19value.h: fixed warnings on `__APPLE__`.Yukihiro "Matz" Matsumoto
2021-08-19value.h: enable `mrb_ro_data_p()` on `__linux__` and `__APPLE__`.Yukihiro "Matz" Matsumoto
Probably we should add conditions for FreeBSD, etc.
2021-08-17boxing_word.h: simplifies inline symbols on `MRB_64BIT`.Yukihiro "Matz" Matsumoto
2021-08-13Check the class with `I` specifier of `mrb_get_args()`dearblue
Previously, the `I` specifier only checked if the object was `MRB_TT_ISTRUCT`. So it was at risk of getting pointers to different C structs if multiple classes were to use the `MRB_TT_ISTRUCT` instance. Change this behavior and change the C argument corresponding to the `I` specifier to `(void *, struct RClass)`. This change is not compatible with the previous mruby. Please note that if the user uses the previous specifications, `SIGSEGV` may occur or the machine stack may be destroyed. resolve #5527
2021-08-07array.h: avoid duplicated defined of `MRB_ARY_NO_EMBED`; fix #5520Yukihiro "Matz" Matsumoto
2021-07-31codegen.c: `mrb_prev_pc()` to take previous instruction position.Yukihiro "Matz" Matsumoto
It rescans `s->iseq` so that peephole optimizer can take multiple previous instructions for constant folding, etc.
2021-07-26irep.h: operand c should be fit in `uint8_t`.Yukihiro "Matz" Matsumoto
2021-07-25Remove redundant include headers.Yukihiro "Matz" Matsumoto
- stdlib.h - stddef.h - stdint.h - stdarg.h - limits.h - float.h
2021-07-17Output an error if the `INTPTR_MAX` macro is undefined in C++dearblue
When doing `conf.enable_cxx_abi` and compiling with FreeBSD + clang or MinGW, such as `INTPTR_MAX` constant macro is not defined if `#include <stdint.h>` precedes `#include <mruby.h>`. Currently I get a warning when I use an undefined macro, but if I don't notice it I get confused in a link error. It can be expected that the problem will be easier to understand by making a clear error. Adding `-Werror=undef` as a compiler flag can also result in an error, but this can be a problem if the system header file itself uses undefined macros, for example. This patch does minimal confirmation only, but has no side effects.
2021-07-09debug.h: use `uint8_t` instead of `char` for BER compressed binary.Yukihiro "Matz" Matsumoto
2021-07-08debug.c: new debug line information format `mrb_debug_line_packed_map`.Yukihiro "Matz" Matsumoto
It uses BER number compression of delta of instruction positions and line numbers. BER compression is a variable length number representation. * `mrb_debug_line_ary`: array of line numbers represented in `uint16_t`. `[lineno, lineno, ...]` * `mrb_debug_line_flat_map`: array of `mrb_irep_debug_info_line`, which is `struct {uint32_t pos; uint16_t lineno}`, for each line. * `mrb_debug_line_packed_map` [new]: sequence of BER compressed 2 numbers, `pos_delta, lineno_delta`. Deltas are differences from previous values (starting `0`). `line_entry_counts` represents total length of a packed map string for this type.
2021-07-03ops.h: made terms consistent.Yukihiro "Matz" Matsumoto
- `Lit` -> `Pool` - `SEQ` -> `Irep`
2021-07-03vm.c: `OP_DEF` to push a symbol to `a` register.Yukihiro "Matz" Matsumoto
The code generator no longer need to emit `OP_LOADSYM` after `OP_DEF`. `doc/opcode.md` is also updated.
2021-06-30Revert "Remove `OP_EXT[123]` from operands."Yukihiro "Matz" Matsumoto
This reverts commit fd10c7231906ca48cb35892d2a86460004b62249. I thought it was OK to restrict index value within 1 byte, but in some cases index value could be 16 bits (2 bytes). I had several ideas to address the issue, but reverting `fd10c72` is the easiest way. The biggest reason is `mruby/c` still supports `OP_EXT[123]`, so that they don't need any additional work.
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-06-19Added `MRB_API` function to get block arguments info.dearblue
- ` mrb_block_given_p()` -- The name comes from CRuby's `rb_block_given_p ()` At the same time, it applies to `f_instance_eval()` and `f_class_eval()` of `mruby-eval`.
2021-06-16Merge pull request #5445 from jbampton/add-codespell-pre-commit-hookYukihiro "Matz" Matsumoto
Run pre-commit with GitHub Actions
2021-06-16Run pre-commit with GitHub ActionsJohn Bampton
Running pre-commit with GitHub Actions now gives us more tests and coverage Remove duplicate GitHub Actions for merge conflicts and trailing whitespace Remove duplicate checks for markdownlint and yamllint from the GitHub Super-Linter Add new custom pre-commit hook running with a shell script to sort alphabetically and uniquify codespell.txt Add new pre-commit hook to check spelling with codespell https://github.com/codespell-project/codespell Fix spelling
2021-06-15numeric.c: restore `fmt` argument for backward compatibility.Yukihiro "Matz" Matsumoto
`mrb_float_to_str()` used to take `fmt` argument. We thought no one used the function, and OK to remove the argument. But at least `mruby-redis` gem used the function.
2021-06-11readint.c: add new function `mrb_int_read`.Yukihiro "Matz" Matsumoto
Difference from `strtoul(3)`: * reads `mrb_int` based on configuration * specifies the end of the string * no sign interpretation * base 10 only
2021-06-08string.c: remove two unused functions.Yukihiro "Matz" Matsumoto
* `mrb_cstr_to_inum()` * `mrb_cstr_to_dbl()`
2021-06-05ops.h: fix term consistency. `Lit` -> `Pool`.Yukihiro "Matz" Matsumoto
2021-05-30numeric.c: introduce `mrb_int_to_cstr()` to dump `mrb_int`.Yukihiro "Matz" Matsumoto
* refactor `mrb_integer_to_str()` * refactor `mrb_str_format()`
2021-05-27array.c: unify `mrb_ary_ref` and `mrb_ary_entry`Yukihiro "Matz" Matsumoto
Use only `mrb_ary_entry` hereafter.
2021-05-22fp_fmt.c: remove `mrb_float_to_cstr()`.Yukihiro "Matz" Matsumoto
The function was intended to be a utility function for `mruby-sprintf`. The functionality was integrated into `sprintf.c`.
2021-05-22fmt_fp.c: replace with public domain float format routine; ref #5448Yukihiro "Matz" Matsumoto
The original code can be found in `https://github.com/dhylands/format-float`. Changes: - support `double` - support `#` (alt_form) modifier - small refactoring
2021-05-21numeric.h: remove 2 functions from `MRB_API`Yukihiro "Matz" Matsumoto
- `mrb_float_to_str()` - `mrb_float_to_cstr()` Both functions will be replaced to support new coming `format-float.c`.
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-17Rename `mrb_fixnum_to_str` to `mrb_integer_to_str`.Yukihiro "Matz" Matsumoto
2021-05-17Rename `mrb_flo_to_fixnum` to `mrb_float_to_integer`.Yukihiro "Matz" Matsumoto
2021-05-16numeric.h: reduce conditional compilation branch on `MRB_NO_FLOAT`.Yukihiro "Matz" Matsumoto
2021-05-13Update `mrb_bool` definition; close #2385Yukihiro "Matz" Matsumoto
- move `TRUE/FALSE` definition from `mrbconf.h` (not configurable) - use C/C++ definition of boolean type for `mrb_bool` The fix is originally written by @take-cheeze.
2021-04-24Introduce `MRB_GC_RED`dearblue
Replaces the magic number `7` except in `src/gc.c`.
2021-04-22error.h: rename `mrb_protect_raw` to `mrb_protect_error`; #5415Yukihiro "Matz" Matsumoto
- `_raw` does not describe the nature of the function - the function protect errors during C function execution