Commit Graph

799 Commits

Author SHA1 Message Date
furunkel 08c877699a Use builtins for overflow math if possible 2015-04-17 17:37:09 +02:00
Yukihiro "Matz" Matsumoto d77249f006 Merge pull request #2754 from cremno/remove-unnecessary-inttypes.h-inclusion
remove unnecessary <inttypes.h> inclusion
2015-04-03 08:30:44 +09:00
cremno 18fdf7e03f remove unnecessary <inttypes.h> inclusion
The format specifier macros were needed to portably print a mrb_int,
because mrb_raisef() originally called vsnprintf(). It doesn't anymore
since 18b2683b97 and the mrb_int format
specifier macros are already gone.
2015-03-30 21:01:16 +02:00
cremno 6424569a63 MSVC 2015 implements inline keyword
Apparently the C compiler of Visual Studio 2015 CTP6 finally implements
inline as inline and not only as _inline and __inline.
2015-03-30 20:13:23 +02:00
Yukihiro "Matz" Matsumoto 44d8a40bac add a prototype declaration for mrb_fiber_resume(); ref #1269 2015-02-19 11:38:05 +09:00
cremno 6f893b5183 re-implement mrb_float_to_str()
The new implementation is backwards incompatible, but I couldn't find
any usage outside mruby and I also couldn't think of a different and
good name.

All ISO C99 printf conversion specifiers for floating point numbers and
an optional precision are supported.

It is largely based on code from the MIT licensed musl libc
(http://www.musl-libc.org/) and its floating point printing is exact
(unlike the current code behind Float#to_s).
2015-02-13 09:33:03 +01:00
Yukihiro "Matz" Matsumoto bc9c47d518 allow endian specification of mrb files by mrbc -e/-E
`mruby -b` now accepts both big/little endian mrb (compiled binary) files.

`mrbc` generates mrb files in big endian for .mrb files and in native endian
for C files (with -B option specified) by default.  If you are cross compiling,
you need to specify target endian by -e/-E options if it is different from
host endian.
2015-02-02 09:34:24 +09:00
Tatsuhiko Kubo dae42ffe54 Removed duplicated declarations.
* `mrb_show_version()`
 * `mrb_show_copyright()`
2015-01-03 22:56:36 +09:00
Yukihiro "Matz" Matsumoto bb3447173b khash.h: keep key/value table accessible from original hashtable during resize; fix #2682 2014-12-23 22:28:33 +09:00
cremno f6d15cfc38 fix ISBLANK() for Visual Studio < 2013 (ref #2658)
Visual Studio versions older than 2013 lack C99's isblank().
Since only ASCII characters are passed to it, implement it
directly without calling the locale-specific isblank().
2014-12-02 00:43:45 +01:00
Hiroshi Mimaki 4e4bfb08cb Merge pull request #2640 from mruby-Forum/v1.1.0
mruby-1.1.0
2014-11-19 09:02:10 +09:00
Yukihiro "Matz" Matsumoto 5c6d6309b6 separate mrb_notimplement() and mrb_notimplement_m(); ref #2636 2014-11-19 01:03:19 +09:00
mimaki b473043acf mruby-1.1.0 2014-11-18 23:35:19 +09:00
mimaki e5bacc03f2 Add mruby debugger (mrdb) 2014-11-18 23:33:32 +09:00
ksss 9a06cfa9d8 Implement C API mrb_notimplement 2014-11-17 17:42:20 +09:00
Yukihiro "Matz" Matsumoto 887e9f4225 Merge branch 'master' of github.com:mruby/mruby 2014-11-10 11:47:12 +09:00
Xuejie "Rafael" Xiao 164cb87c5b Fix mrb_iv_check function decleration 2014-11-10 10:12:40 +08:00
Yukihiro "Matz" Matsumoto 3e0575ecb1 update teeny of MRUBY_VERSION; ref #2629 2014-11-04 22:19:40 +09:00
Yukihiro "Matz" Matsumoto be844f9284 Fix misaligned access when reading irep; close #2630
Add padding bytes before iseq block that may be used as mrb_code[].
Note that dumped mrb format has changed.

Based on a patch from kimu_shu <alfvegardrisc@gmail.com>
2014-11-04 02:41:42 +09:00
Jun Hiroe 5235e54137 Fix mrb_convert_to_integer. 2014-10-29 01:30:30 +09:00
Yukihiro "Matz" Matsumoto c5a23e6a0d remove header prototype of mrb_exc_print; close #2607 2014-10-15 21:21:58 +09:00
Yukihiro "Matz" Matsumoto 2b3675bca1 word_boxing.h used int to represent symbols; use mrb_sym instead 2014-10-03 11:02:06 +09:00
Yukihiro "Matz" Matsumoto 83992ee163 cast MRB_ENV_STACK_LEN to (mrb_int); ref #2600 2014-10-02 17:59:01 +09:00
Yukihiro "Matz" Matsumoto 6b956f1c1b use __init_array_start to determine readonly data section;
b72e94f used _etext and _edata to distinguish C string literals from heap allocated strings,
but using _edata, global char arrays may be considered as string literals.  to avoid the issue,
we have to use __init_array_start, which might be less portable.  you can still use _edata, by
using MRB_NO_INIT_ARRAY_START.
2014-10-02 09:27:39 +09:00
Yukihiro "Matz" Matsumoto b72e94fa6b mrbconf.h option MRB_USE_ETEXT_EDATA to reduce memory.
on platforms with _etext and _edata, mruby can distinguish string literals so that it avoids memory allocation to copy them.
for example, on my Linux box (x86 32bit), memory consumed by mrbtest decreased from 8,168,203 to 8,078,848 (reduced 88KB).
2014-09-30 23:48:57 +09:00
Yukihiro "Matz" Matsumoto 4a55b42984 O(1) mrb_sym2name_len(); close #2591
instead of adding sym->name hash table, linear symbol table is added, and reduced name->sym hash table size.
2014-09-30 20:15:27 +09:00
Kouhei Sutou 55dca8337e Remove duplicated mrb_print_backtrace() declaration
It is declared in mruby.h.
2014-09-27 23:53:25 +09:00
Yukihiro "Matz" Matsumoto 95c7f570e1 change class argument of mrb_const_defined_at from struct RClass* to mrb_value to make it consistent with mrb_const_defined; ref #2593 2014-09-19 02:51:52 +09:00
Yukihiro "Matz" Matsumoto 6057b2e378 change mrb_sym type from uint16_t to uint32_t 2014-09-15 01:48:08 +09:00
Yukihiro "Matz" Matsumoto 48c5321dca constify pointer from RARRAY_PTR to detect potential write barrier bugs.
if you see compiler errors due to this commit, you'd better to use array-modifying
functions, e.g. mrb_ary_set() or mrb_ary_push(), otherwise you might see nasty
GC bugs in the future.  if you are sure what you are doing, replace `RARRAY_PTR(ary)`
by `mrb_ary_ptr(ary)->ptr`. but be warned.
2014-09-12 12:42:39 +09:00
Yukihiro "Matz" Matsumoto 81c894a1c6 add some MRB_API to function prototypes 2014-09-05 00:54:51 +09:00
Yukihiro "Matz" Matsumoto 9b4ec380d2 use uint16_t instead of short; ref #2568 2014-09-05 00:47:22 +09:00
Yukihiro "Matz" Matsumoto 6c7b0d88e8 refactor valid instance variable name check 2014-09-02 16:37:40 +09:00
Yukihiro "Matz" Matsumoto 471c43ff96 move mrb_proc_new_cfunc_with_env() to the core 2014-09-02 13:03:32 +09:00
cremno 17b0d658fc delete obsolete macros (mrb_basic + mrb_object)
Over a year ago is not "soon" anymore. See:
88483fad00
243669308d
2014-08-29 16:47:28 +02:00
Yukihiro "Matz" Matsumoto 3c4cd5428a allow no_optimize esp. for debugger 2014-08-29 15:09:14 +09:00
Yukihiro "Matz" Matsumoto 9e4b012478 Merge pull request #2570 from cubicdaiya/issues/unify_duplicated_functions
Unify and rename duplicated functions (noregexp() and regexp_check()).
2014-08-29 01:09:33 +09:00
Tatsuhiko Kubo 5fa30aeaea Fix mismatches for MRB_API declarations. 2014-08-29 01:06:22 +09:00
Tatsuhiko Kubo db29a25ada Rename functions for avoinding symbol confiliction.
Add prefix(mrb) to noregexp() and regexp_check().
2014-08-28 19:18:52 +09:00
Tatsuhiko Kubo d958aa2cb1 Unify duplicated functions (noregexp() and regexp_check()). 2014-08-28 19:13:57 +09:00
cremno 89b27648dd add symbol table overflow check
Since raising an error might intern a few new strings, some symbols need
to be reserved. 8 should be sufficient.

If the real limit has been reached, mrb_bug() is called.
2014-08-27 12:51:10 +02:00
cremno 3ac4c24534 remove unused MSVC strtoll fallback 2014-08-26 00:52:31 +02:00
Tatsuhiko Kubo 3b904e9408 Unify include guard styles and header comments. 2014-08-21 13:27:37 +09:00
take_cheeze b3d0585fe5 Add API mrb_data_init to initialize MRB_TT_DATA tagged instance. 2014-08-20 22:42:35 +09:00
Jun Hiroe 21f583783d Rename GC_STATE_NONE GC_STATE_ROOT 2014-08-06 22:59:48 +09:00
Jun Hiroe 3569723ab3 Refactor obj_free() in gc.c 2014-08-05 23:16:01 +09:00
Yukihiro "Matz" Matsumoto fce644df59 Merge pull request #2508 from iij/pr-mrb-str-to-cstr-returns-mutable
revert accidental constify.
2014-08-05 16:32:52 +09:00
Tomoyuki Sahara 412b9eb827 revert accidental constify. 2014-08-05 15:02:27 +09:00
Yukihiro "Matz" Matsumoto ea80e82852 Merge branch 'master' of github.com:mruby/mruby 2014-08-04 16:28:02 +09:00
cremno b6e27218ad MSVC: add simple (v)snprintf implementation
_snprintf is not C99's snprintf!

This simple implementation, unlike _snprintf,
always null-terminates and returns the expected
return value (in most cases).
Other C99 behaviors (like format specifiers) require
adding a complete snprintf implementation.
Do we want or need that?

The same applies to vsnprintf (aka _vsnprintf).
2014-08-03 21:15:48 +02:00