32 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 78c8b649e7 mruby-print/print.c: small refactoring.
Inline `printstr` function which is called from only one place.
2022-10-05 23:11:11 +09:00
Yukihiro "Matz" Matsumoto d28009ebd8 mruby-print/print.rb: reduce explicit return values; ref #5762
By making __printstr__ to return nil.
2022-07-31 07:56:06 +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
Yukihiro "Matz" Matsumoto 8f362eaf8a io.rb,print.rb: puts to expand array arguments.
As CRuby behaves.
2021-05-01 00:00:14 +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
dearblue f0a64329b1 Prohibit array changes by "a"/"*" specifier of mrb_get_args()
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-22 22:55:35 +09:00
Yukihiro "Matz" Matsumoto 896338e219 Unify mrb_str_to_str to mrb_obj_as_string.
Redirect `mrb_str_to_str` to `mrb_obj_as_string` via C macro.
Inspired by #5082
2020-10-12 18:20:26 +09:00
Yukihiro "Matz" Matsumoto 30424dfa74 Restore old function names for compatibility; fix #5070
Rename new functions:

- `mrb_convert_type(mrb,val,type,tname,method)`
   => `mrb_type_convert(mrb,val,type,tname,method)`
- `mrb_check_convert_type(mrb,val,type,tname,method)`
   => `mrb_type_convert_check(mrb,val,type,tname,method)`

Old names are defined by macros (support `tname` drop and
`char*` => `mrb_sym` conversion).
2020-10-12 18:20:18 +09:00
Yukihiro "Matz" Matsumoto a127ded486 Fix warning from VC regarding implicit int conversion. 2020-10-12 18:20:17 +09:00
Yukihiro "Matz" Matsumoto dd1ce5d53e Silence warnings from implicit integer conversions.
Caused from combination of `mrb_int`, `int` and `size_t`..
2020-10-12 18:20:07 +09:00
Yukihiro "Matz" Matsumoto 1517d77e93 Fix puts in mruby-print on no argument; 0e9bd24
`puts` should print newline when called without arguments.
2020-07-31 06:57:05 +09:00
Yukihiro "Matz" Matsumoto 0e9bd24827 Fix puts to print newline with empty strings; ref b184772 2020-07-22 17:50:01 +09:00
Yukihiro "Matz" Matsumoto b1847721e8 Implement Kernel#print and Kernel#puts in C. 2020-07-20 23:35:17 +09:00
Yukihiro "Matz" Matsumoto 49ae2a69f2 Add mrb_get_arg1() that retrieves single (and only) argument.
`mrb_get_arg1()` raises `ArgumentError` if the method does not receive one
argument.

And replaces all `mrb_get_args(mrb, "o", &arg)` by the new function.
2020-06-20 12:49: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
KOBAYASHI Shuji a4c5fcc038 Remove redundant NULL check for mrb_malloc 2019-01-24 20:53:40 +09:00
Tomasz Dąbrowski 490de9dbe1 fix: src\print.c(22): warning C4244: 'initializing': conversion from 'mrb_int' to 'int', possible loss of data 2017-09-27 22:22:05 +02:00
fl0l0u e03042ec19 Update print.c
Strings not containing a newline are not printed synchronously
ex. bin/mruby -e '["a", "b", "c", "\n", "d", "e", "f", "\n"].each {|e| print e ; usleep 200000}'
2017-09-02 18:26:50 +02:00
Tomasz Dąbrowski c2a60eb8af Fix for Windows-specific mruby C++ issues 2016-11-24 09:28:00 +09:00
U.Nakamura 36c08476d9 Use non-underscore'ed names
Accept @mattn's comment.
2016-09-21 14:39:08 +09:00
U.Nakamura 37d2d57d63 Use underbar'ed name to get rid of warnings 2016-09-21 12:59:36 +09:00
U.Nakamura e5fedaf67f Not only for MINGW but also for Visual C++ 2016-09-21 12:58:58 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Yasuhiro Matsumoto 6c0dc1a720 print unicode on windows console 2015-10-08 23:52:58 +09:00
Yasuhiro Matsumoto 8277e950ee Support windows locale
Add mrb_utf8_from_locale, mrb_utf8_free, mrb_locale_from_utf8, mrb_locale_free. Just works for windows.
2015-09-11 11:12:03 +09:00
cubicdaiya bf3f45fc70 Use mrb_int instead of int 2014-03-25 22:33:53 +09:00
ksss 54132e4364 make embed string when create literals 2014-03-06 13:47:51 +00:00
ksss 4070b5987a embed small string
use flags 4 for *this object is embed*
use flags 8~64 for *embed string length*
2014-03-06 13:12:08 +00:00
Yukihiro "Matz" Matsumoto 30d580ecbc rename every ARGS_XXX to MRB_ARGS_XXX; ref #1206 2013-04-25 09:47:36 +09:00
mattn b69761e286 Add mruby-print 2013-03-24 00:20:35 +09:00