Commit Graph

36 Commits

Author SHA1 Message Date
dearblue e570ca82a8 Remove mrb_final_mrbgems() in mrbc.c
The current `mrb_final_mrbgems()` function is only referenced in the `mrbgem/gem_init.c` file.

Also, the definition in that file makes it a static function.
2023-05-06 21:07:08 +09:00
Yukihiro "Matz" Matsumoto c39ee489e1 Remove non formatting fprintf(). 2022-11-25 16:17:29 +09:00
Yukihiro "Matz" Matsumoto bae11ef689 complex.c (mrb_complex_copy): allow copying of complex numbers. 2022-07-11 11:25:31 +09:00
Yukihiro "Matz" Matsumoto 67f47c9b42 rational.c (mrb_rational_copy): allow copying of rational numbers. 2022-07-11 11:19:22 +09:00
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 e45081d310 mrbc/stub.c: define stub functions in a separated file. 2022-03-18 12:29:47 +09:00
Yukihiro "Matz" Matsumoto fe03e01078 numeric.c: enhance integer division to support Rational and Complex.
No longer need to override division methods in mrbgems.
2022-03-18 12:27:46 +09:00
Yukihiro "Matz" Matsumoto 7659b3b271 numeric.c: avoid mrb_funcall; call functions directly.
When you try to call functions defined in mrbgems, you need to add the
names of functions to `mrbc.c`, since `mrbc` does not link any mrbgem
regardless of the configuration.
2022-03-12 13:31:38 +09:00
Yukihiro "Matz" Matsumoto 2dff7ed6a2 mrbc.c: add --no-optimize option to disable optimization; close #5661 2022-03-05 08:04:34 +09:00
Yukihiro "Matz" Matsumoto aaa3bd0e80 mrbc.c: simplify place holder functions; #5622 2022-01-05 19:39:39 +09:00
dearblue ac22a63ae3 Call functions directly from mrb_ensure_float_type()
ref. commit 7f40b645d2

Currently, the build configurations `MRB_USE_COMPLEX` and `MRB_USE_RATIONAL` are not listed in the documentation.
In other words, they are hidden settings.
They are defined in `mrbgems/mruby-{complex,rational}/mrbgem.rake`.
So this patch assumes that it is safe to refer to these functions in core-gems directly from core functions.

However, applications that link with `libmruby_core.a` will have compatibility issues.
In fact, `mrbgems/mruby-bin-mrbc` links with `libmruby_core.a`, so I had to prepare a dummy function.
2021-12-31 19:12:11 +09:00
dearblue 6b8582c95d Add bin/mrbc --no-ext-ops switch
Print an error if `OP_EXT[123]` is needed when generating mruby binary.
This may be useful for mruby/c.

Inspired by #5590.
2021-12-17 23:02:04 +09:00
Chris Reuter 5c4273f944 Added testing support for cross-MinGW builds.
This adds a build_config that will cross-build a Windows executable
using the MinGW cross-compiler and will also run the unit (i.e.
'rake test') using Wine.

For this to work, I made some modifications to the underlying test
scripts as well as some minor changes to a couple of the tests
themselves.
2021-10-21 21:58:45 -04:00
KOBAYASHI Shuji a6a76d8fd2 Add -s option to mrbc for make variable static 2021-02-14 11:55:53 +09:00
KOBAYASHI Shuji 1fc8e00e4a Use mrb_open_core() instead of mrb_open() in mrbc 2021-01-31 22:37:27 +09:00
KOBAYASHI Shuji 73b4152574 Make it possible that libmruby.a is not created
Previously, `libmruby.a` was created even if only `mruby-bin-mrbc` or`
mruby-compiler` was specified for gem, but by specifying `disable_libmruby`,
the creation of `libmruby.a` can be suppressed.

### Note

The https://github.com/mruby/mruby/pull/5084#issuecomment-723521971
incompatibility seems to be difficult for users to avoid, so the original
behavior has been restored. Therefore, if we need `mrbc` other than the
`host` build, we need to explicitly specify `mruby-bin-mrbc` gem.

Due to the above changes, `build_config/boxing.rb` etc. will not work, but I
have added` mruby-bin-mrbc` to `default.gembox` to fix it. I don't think
this change is a big deal because originally `mruby-compiler` was included.
2020-12-05 09:16:08 +09:00
KOBAYASHI Shuji 4452041ebb Move mrbc test to mruby-bin-mrbc gem from mruby-compiler gem 2020-12-04 09:22:13 +09: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
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 850e200e84 Describe the need for -o option if multi files given. 2020-10-12 16:21:51 +09:00
Yukihiro "Matz" Matsumoto b978231bda Update usage description of mrbc. 2020-10-12 16:21:51 +09:00
Yukihiro "Matz" Matsumoto ad15e59cd9 Add irep C struct dump from mrbc with -S option.
But we need more work:
- recursive `irep` dump (`irep->reps`)
- pool values dump (`irep->pool`)
2020-10-12 16:21:07 +09:00
Yukihiro "Matz" Matsumoto 5a3e014e49 Constify irep members.
- `pool`
- `syms`
- `reps`
2020-10-12 16:21:03 +09:00
Yukihiro "Matz" Matsumoto ac8360003e Fix the bug that mrbc generates a.rb.mrb instead of a.mrb.
The bug was introduced by 9dfe50f1d.
2020-06-29 07:25:03 +09:00
Yukihiro "Matz" Matsumoto 9dfe50f1d9 Use snprintf instead of memcpy in mrbc.c. 2020-06-25 06:57:42 +09:00
Yukihiro "Matz" Matsumoto 48c473a0c4 Remove -e/-E options from mrbc.
You don't have to specify endian since `mruby 2.0`.
2020-05-07 08:38:46 +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
take-cheeze bb0aec1d94 Use binary mode in mrbc source code reading 2019-12-23 21:01:42 +09:00
KOBAYASHI Shuji 5345731b1d Fix wrong argument for fprintf in mruby-bin-mrbc 2019-08-17 21:46:45 +09:00
take-cheeze b37b312081 Rename libmruby stuff to avoid confusion 2018-10-29 14:07:16 +09:00
yuri dabb20ddbb add mrbc option --remove-lv
* refactor: move `irep_remove_lv` from `mruby-bin-strip` gem to src/dump and rename to `mrb_irep_remove_lv`
* add: mrbc option `--remove-lv` to remove LVAR section
2018-07-10 01:42:33 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Yukihiro "Matz" Matsumoto cc0b28373a clear DUMP_ENDIAN flags before setting 2015-09-03 01:46:35 +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
take_cheeze 6460ef77bc Compile mruby compiler as mrbgem.
Compiler codes is moved to "mruby-compiler".
Executable `mrbc` is moved to "mruby-bin-mrbc".
2015-06-01 21:53:55 +09:00