summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-sprintf
AgeCommit message (Collapse)Author
2021-09-14sprintf.c: `width` may have been `INT_MAX`.Yukihiro "Matz" Matsumoto
Now `width` is limited to `INT16_MIN..INT16_MAX`.
2021-09-07string.h: rename `mrb_str_to_inum` to `mrb_str_to_integer`.Yukihiro "Matz" Matsumoto
Consistent naming: `integer` to represent integer packed in `mrb_value` instead of `inum`.
2021-09-01mruby.h: obsolete `mrb_to_str()`.Yukihiro "Matz" Matsumoto
Replace them by `mrb_ensure_string_type()`.
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-07-25Remove redundant include headers.Yukihiro "Matz" Matsumoto
- stdlib.h - stddef.h - stdint.h - stdarg.h - limits.h - float.h
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-10sprintf.c: check value range before type casting.Yukihiro "Matz" Matsumoto
2021-06-07sprintf.c: fix `mrb_int` and `int` mixture errors.Yukihiro "Matz" Matsumoto
2021-05-30sprintf.c: avoid object allocation in integer formatting.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-22mruby-sprintf: reduce float digits to avoid test failure.Yukihiro "Matz" Matsumoto
Too many digits to fit in single precision float numbers, so that tests fail when `MRB_USE_FLOAT32` defined.
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-21sprintf.c: remove specifiers `%a` and `%A`.Yukihiro "Matz" Matsumoto
`fmt_fp.c` does not support those specifiers. In addition, I believe no one uses hexadecimal representation of float values.
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-04-16feat(CI): add the GitHub Super LinterJohn Bampton
The GitHub Super Linter is a more robust and better supported tool than the current GitHub Actions we are using. Running these checks: ERROR_ON_MISSING_EXEC_BIT: true VALIDATE_BASH: true VALIDATE_BASH_EXEC: true VALIDATE_EDITORCONFIG: true VALIDATE_MARKDOWN: true VALIDATE_SHELL_SHFMT: true VALIDATE_YAML: true https://github.com/marketplace/actions/super-linter https://github.com/github/super-linter Added the GitHub Super Linter badge to the README. Also updated the pre-commit framework and added more documentation on pre-commit. Added one more pre-commit check: check-executables-have-shebangs Added one extra check for merge conflicts to our GitHub Actions. EditorConfig and Markdown linting. Minor grammar and spelling fixes. Update linter.yml
2021-02-07Fix tests to work with `MRB_USE_FLOAT32`; fix #5329Yukihiro "Matz" Matsumoto
2021-01-26Revert "Minimize the changes in #5277"Yukihiro "Matz" Matsumoto
This reverts commit dc51d89ac22acc60b9bfeed87115863565b74085.
2021-01-22Minimize the changes in #5277Yukihiro "Matz" Matsumoto
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-11Avoid including `presym.inc` in existing header filesKOBAYASHI Shuji
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-05Remove duplicated `remove_sign_bits()` call.Yukihiro "Matz" Matsumoto
2021-01-02Allow negative integer value formatting in base 8 and 16.Yukihiro "Matz" Matsumoto
2020-12-13Fix spellingJohn Bampton
2020-11-21Rename `MRB_{ENABLE,DISABLE}_` to `MRB_{USE,NO}_`; close #5163KOBAYASHI Shuji
| Previous Name | New Name | |------------------------------|-------------------------| | MRB_ENABLE_ALL_SYMBOLS | MRB_USE_ALL_SYMBOLS | | MRB_ENABLE_SYMBOLL_ALL | MRB_USE_ALL_SYMBOLS | | MRB_ENABLE_CXX_ABI | MRB_USE_CXX_ABI | | MRB_ENABLE_CXX_EXCEPTION | MRB_USE_CXX_EXCEPTION | | MRB_ENABLE_DEBUG_HOOK | MRB_USE_DEBUG_HOOK | | MRB_DISABLE_DIRECT_THREADING | MRB_NO_DIRECT_THREADING | | MRB_DISABLE_STDIO | MRB_NO_STDIO | | ENABLE_LINENOISE | MRB_USE_LINENOISE | | ENABLE_READLINE | MRB_USE_READLINE | | DISABLE_MIRB_UNDERSCORE | MRB_NO_MIRB_UNDERSCORE | | DISABLE_GEMS | MRB_NO_GEMS | * `MRB_ENABLE_SYMBOLL_ALL` seems to be a typo, so it is fixed. * `MRB_` prefix is added to those without. * The previous names can also be used for compatibility.
2020-10-22Prohibit array changes by "a"/"*" specifier of `mrb_get_args()`dearblue
The "a"/"*" specifier of the `mrb_get_args()` function will now return `const mrb_value *`. This is because it is difficult for the caller to check if it is an array object and write-barrier if necessary. And it requires calling `mrb_ary_modify()` on the unmodified array object, which is also difficult (this is similar to #5087).
2020-10-12Fix `mrb_int_mul_overflow()` to check either operand being zero.Yukihiro "Matz" Matsumoto
2020-10-12Embed debug information to resolve Windows VC's issue.Yukihiro "Matz" Matsumoto
2020-10-12Adjust backslash position in multi-line macros.Yukihiro "Matz" Matsumoto
2020-10-12Use `MRB_INT_MAX` instead of `INT_MAX` according to variable type.Yukihiro "Matz" Matsumoto
2020-10-12Restore old function names for compatibility; ref #5070Yukihiro "Matz" Matsumoto
- `mrb_check_intern()` to return `mrb_value` - `mrb_intern_check()` to return `mrb_sym` [NEW] Other new functions: - `mrb_intern_check_cstr()` - `mrb_intern_check_str()`
2020-10-12Use `mrb_int_value()` instead of `mrb_fixnum_value()`.Yukihiro "Matz" Matsumoto
Where fixnum overflow can happen.
2020-10-12Reorganize `Integer` system.Yukihiro "Matz" Matsumoto
- Integrate `Fixnum` and `Integer` - Remove `Integral` - `int / int -> int` - Replace `mrb_fixnum()` to `mrb_int()` - Replace `mrb_fixnum_value()` to `mrb_int_value()`. - Use `mrb_integer_p()` instead of `mrb_fixnum_p()`
2020-10-12"backport" CRuby r46756; ref #3500Yukihiro "Matz" Matsumoto
Based on cremno/mruby@6bd0119
2020-10-12"backport" CRuby r46656; #2500Yukihiro "Matz" Matsumoto
Based on cremno/mruby@d446192
2020-10-12Rename `MRB_TT_FIXNUM` to `MRB_TT_INTEGER`.Yukihiro "Matz" Matsumoto
We still have `#define MRB_TT_FIXNUM MRB_TT_INTEGER` for compatibility.
2020-10-12change linkage to internalcremno
2020-10-12define sprintf and format as global functionscremno
2020-10-12move mrbgem initialization into sprintf.ccremno
Also remove some unnecessary code.
2020-10-12Add tests for CRuby bug #9982cremno
https://bugs.ruby-lang.org/issues/9982
2020-10-12Rename float configuration option names.Yukihiro "Matz" Matsumoto
- `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-12Use `mrb_funcall_id()` extensively.Yukihiro "Matz" Matsumoto
Except for support files e.g. `mruby-test/driver.c`, which are not target of symbol collection via `rake gensym`.
2020-06-20Fix potential buffer overflow in `sprintf.c`.Yukihiro "Matz" Matsumoto
2020-05-27Move `fmt_setup` until absolutely necessary.Yukihiro "Matz" Matsumoto
2020-05-26Integer format can be bigger than `32` on 64bit platforms.Yukihiro "Matz" Matsumoto
We made it `64` which should be big enough: - Format modifier: 4 characters max - Maximum width: 19 digits max - Period between width and precision: 1 character - Maximum precision: 19 digits max - Format specifier: 1 character - NUL terminator: 1 byte - Total: 45 < 64
2020-05-07Remove unnecessary `sprintf` test that fails since 91368c1.Yukihiro "Matz" Matsumoto
2020-05-07Avoid `mrb_funcall` if `MRB_UFT8_STRING` is not set.Yukihiro "Matz" Matsumoto
2020-04-11Support `MRB_DISABLE_STDIO` for mruby-sprintf; ref #4954dearblue
2020-04-11Supports some specifier flags with `mrb_float_to_str()`dearblue
Changed to understand `#`, `0`, `-`, ` ` and `+`. Based on src/stdio/vfprintf.c in git://git.musl-libc.org/musl
2020-03-08Add configuration guard for `MRB_DISABLE_STDIO`dearblue
ref #4576 and ref #4947 * Need MRBAPI functions without `MRB_DISABLE_STDIO`: * mrbgems/mruby-bin-debugger * mrbgems/mruby-bin-mirb * mrbgems/mruby-bin-mrbc * mrbgems/mruby-bin-mruby * mrbgems/mruby-bin-strip * Need `stdio.h`: * mrbgems/mruby-io * mrbgems/mruby-print * Need `snprintf()` in `stdio.h`: * mrbgems/mruby-pack * mrbgems/mruby-sprintf