99 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto b99c389ec3 internal.h: aggregate internal functions.
Internal functions can only be called from within the library.
Functions listed in `mruby/internal.h` can be called from:

* core (src/*.c)
* gems (mrbgems/**/*.c)

But not from the application linked with `libmruby`.
2022-04-02 18:25:13 +09:00
Yukihiro "Matz" Matsumoto d6dd6f0e7b Update struct initializer to work with relatively older C++. 2021-09-20 19:13:17 +09:00
Yukihiro "Matz" Matsumoto 8619ba6a38 Use struct initializer instead of memset. 2021-09-15 13:02:15 +09:00
Yukihiro "Matz" Matsumoto 20635e6bdc debug.c: export integer compressing functions.
- mrb_packed_int_len()
- mrb_packed_int_encode()
- mrb_packed_int_decode()
2021-08-18 17:18:04 +09:00
Yukihiro "Matz" Matsumoto 504d05232d mrdb.c: do not skip OP_JMP on step execution. 2021-08-02 16:19:08 +09:00
Yukihiro "Matz" Matsumoto 5c804cf68f Remove redundant include headers.
- stdlib.h
- stddef.h
- stdint.h
- stdarg.h
- limits.h
- float.h
2021-07-25 13:07:10 +09:00
dearblue c8750048be Avoid implicit casting from void pointers for C++ 2021-07-17 20:21:30 +09:00
Yukihiro "Matz" Matsumoto b5039fdb6c debug.h: use uint8_t instead of char for BER compressed binary. 2021-07-09 14:10:48 +09:00
Yukihiro "Matz" Matsumoto 06b1662807 mruby-bin-debugger: remove unused local variables. 2021-07-08 09:58:44 +09:00
Yukihiro "Matz" Matsumoto c572165292 mruby-bin-debugger: support mrb_debug_line_packed_map. 2021-07-08 09:54:11 +09:00
Yukihiro "Matz" Matsumoto fb1d4ff682 mruby-bin-debugger: rename prefix 'mrb_debug_' to mrdb_. 2021-07-08 07:24:12 +09:00
Yukihiro "Matz" Matsumoto 7c362ee723 Merge branch 'mrb_debug_strdup-and-strndup' of https://github.com/cremno/mruby into cremno-mrb_debug_strdup-and-strndup 2021-07-06 17:01:37 +09:00
KOBAYASHI Shuji 00a13e22dd Use global defines for mruby-bin-debugger 2021-03-22 12:02:26 +09:00
John Bampton 1c9b1bfeb7 feat: add pre-commit framework 2021-03-01 10:06:17 +10:00
Yukihiro "Matz" Matsumoto 8684abd697 Remove periods from error messages according to the convention. 2021-02-28 19:32:52 +09:00
John Bampton be40e9c783 chore: fix spelling
Normally a single spell checker can't find all the mistakes or check all types of code.

These mistakes were found by another spell checker inside my editor with a more manual sift / find.
2021-02-13 17:21:17 +10: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
Yukihiro "Matz" Matsumoto 5e0f51c906 Silence gcc warning from strncpy(). 2021-01-21 12:22:54 +09:00
dearblue 04a4e59c83 Fix build error for mruby-bin-debugger
This is a missing change in #5272.

This issue was reported by @shuujii.
https://github.com/mruby/mruby/pull/5272#issuecomment-761819737
2021-01-18 00:00:53 +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
John Bampton 940dec5e7d Fix spelling 2020-12-13 18:38:22 +10:00
KOBAYASHI Shuji 3d056d084a Rename MRB_{ENABLE,DISABLE}_ to MRB_{USE,NO}_; close #5163
|        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-11-21 21:14:40 +09:00
KOBAYASHI Shuji fd113da3aa Allow bintest even if build name is not host 2020-11-19 11:37:00 +09:00
KOBAYASHI Shuji f50cde9924 Fix integer overflow error in mrdb test 2020-11-18 18:54:00 +09:00
Yukihiro "Matz" Matsumoto 963b44286a Use C99 __func__ instead of __FUNCTION__; #5107 2020-11-03 18:03:23 +09:00
Yukihiro "Matz" Matsumoto 33742d941f Move build_config.rb -> build_config/default.rb; ref #5098
In addition, update the documents referring `build_config.rb` which is
no longer used. The new `build_config.rb` describes the new configuration
structure in the comment.
2020-10-29 11:49:05 +09:00
Yukihiro "Matz" Matsumoto ab2b42d363 Update bintest of mruby-bin-debugger.
Need to support `int / int -> int` update.
2020-10-12 18:20:24 +09:00
Yukihiro "Matz" Matsumoto b9007244bd Add const before struct mrb_irep in mruby-bin-debugger gem. 2020-10-12 18:20:23 +09:00
Yukihiro "Matz" Matsumoto a4c5824e59 Restore old function names for compatibility; ref #5070
- `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-12 18:20:19 +09:00
Yukihiro "Matz" Matsumoto caee1f68a2 Change the return type of mrb_check_intern() and friends.
They used to return `mrb_value` but now return `mrb_sym` for consistency
with other `intern` functions. If symbols are not defined, `check`
functions return `0`, instead of `nil` in the past.

It causes API incompatibility but I believe few people use those
functions out of the core, and those changes are very easy to handle,
hopefully.
2020-10-12 16:21:50 +09:00
Yukihiro "Matz" Matsumoto 029c7c1116 Add const modifier to mrb_irep for code_fetch_hook. 2020-10-12 16:21:05 +09:00
Yukihiro "Matz" Matsumoto 00f5ddc9ae Use mrb_funcall_id() extensively.
Except for support files e.g. `mruby-test/driver.c`, which are not
target of symbol collection via `rake gensym`.
2020-10-12 16:20:58 +09:00
dearblue 67606170e3 Add configuration guard for MRB_DISABLE_STDIO
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
2020-03-08 21:57:17 +09:00
dearblue cc1db2d117 Remove unnecessary 'stdio.h'; ref #4947
'stdio.h' is included in 'mruby.h' ('mrbconf.h').

However, keep 'stdio.h' used by mruby-test.
2020-03-08 21:42:09 +09:00
dearblue b3d4ab0cd8 Improve conflict error message of mruby-bin-debugger; ref 87d1b2a91 2020-03-08 20:49:22 +09:00
KOBAYASHI Shuji f92867a59e Refine the assertion failure message in mrdb print tests
#### Before this patch:

  ```console
  Fail: mruby-bin-debugger(print) error (mrbgems: mruby-bin-debugger)
   - Assertion[2]
      Expected true to be false.
  ```

#### After this patch:

  ```console
  Fail: mruby-bin-debugger(print) error (mrbgems: mruby-bin-debugger)
   - Assertion[2]
      Expected "$2 = undefined method 'bar' (NoMethodError)\n" to be start_with? "$2 = (eval):2: undefined method".
  ```
2019-12-24 23:20:20 +09:00
KOBAYASHI Shuji f0b8c9ec06 Fix mruby-bin-debugger tests; ref d2f2f9db 2019-12-18 19:34:11 +09:00
KOBAYASHI Shuji 7f6e8e8ddc Fix that print command raises FrozenError in mrdb; ref 1f5a7f2f
#### Before this patch:

  ```
  $ echo 'p true' | bin/mrdb /dev/null
  (/dev/null:1) mruby application exited.
  FrozenError: can't modify frozen String
  (-:0)
  ```

#### After this patch:

  ```
  $ echo 'p true' | bin/mrdb /dev/null
  (/dev/null:1) $1 = true
  (/dev/null:1)
  ```
2019-10-09 20:00:17 +09:00
Yukihiro "Matz" Matsumoto a365f9a67d Rename symbol-to-string functions; close #4684
* mrb_sym2name -> mrb_sym_name
* mrb_sym2name_len -> mrb_sym_name_len
* mrb_sym2str -> mrb_sym_str
2019-09-25 23:52:00 +09:00
dearblue 279c21b816 Prohibit changes to iseq in principle 2019-08-18 15:00:32 +09:00
dearblue c96b517ea2 Error needed/conflicts configuration
The purpose is to clarify the error if there is a needed/conflicts
configuration at compile time.
2019-07-14 00:29:17 +09:00
Yukihiro "Matz" Matsumoto 2871d0cdc5 Avoid keeping pointers from mrb_sym2name_len(); fix #4342
The addresses for packed inline symbols reference `mrb->symbuf` that
could be overridden by the later call of `mrb_sym2name_len`. Since
file names in call stack information are kept as symbols, keeping the
address in the C structures could cause problems like #4342.

This changes small incompatible changes in function prototypes:
* `mrb_parser_get_filename`: return value changed to `mrb_sym`.
* `mrb_debug_get_filename`: add `mrb_state*` as a first argument.
* `mrb_debug_get_line`: ditto.

I believe above functions are almost internal, and no third-party
mrbgem use them.
2019-04-01 14:13:06 +09:00
kimu_shu 477ffc7473 Add "info locals" command to mrdb 2019-02-19 18:10:05 +09:00
KOBAYASHI Shuji c86861bddf Use mrb->eException_class instead of mrb_class_get() 2019-02-03 22:00:55 +09:00
Kazuhiro Sera 2b2ff844a1 Fix misspelling words in comments 2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto beb6e5c299 Bytecode support for mrdb. 2018-07-31 17:28:42 +09:00
Yukihiro "Matz" Matsumoto 891839b976 New bytecode implementation of mruby VM. 2018-07-30 22:57:54 +09:00
mimaki e57d9e6047 Fixed test case for mruby ddebugger. 2018-04-04 14:07:59 +09:00