Commit Graph

100 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto a0fbc46ccd Import locale insensitive strtod() from Ruby1.8; fix #3270
The function was renamed to `mrb_float_read(const char*, char**)`.
2016-12-03 18:47:04 +09:00
Tomasz Dąbrowski b21b02465e asserts checking validity of pointer and TT added for mrb_obj_value
Useful for testing when using boxing on different platforms.
2016-11-21 12:37:45 +01:00
Yukihiro "Matz" Matsumoto 8438792d27 renamed "inline" to "istruct" to represent inline struct; ref #3251 2016-11-17 17:19:49 +09:00
Tomasz Dąbrowski 4cca8bac6b inline structures data type for mruby (MRB_TT_INLINE) (fix #3237)
Inline structures have no instance variables, no finalizer, and offer as much space as possible in RBASIC object. This means 24 bytes on 64-bit platforms and 12 bytes on 32-bit platforms.
mruby-inline-struct gem is only provided for testing.
2016-11-17 17:19:49 +09:00
cremno 30b0100e6c fix VS2010/2012 build
They don't have <inttypes.h>, only <stdint.h>.
2016-03-22 11:46:49 +01:00
Yukihiro "Matz" Matsumoto 7c82bfa7fe mruby-sprintf to use mrb_int formatting macros; ref #3076 2016-01-07 12:23:17 +09:00
Kazuho Oku cd131d18a7 define MRB_PRI? that map to PRI?NN depending on the size of mrb_int 2016-01-06 12:00:56 +09:00
Yukihiro "Matz" Matsumoto 065966dae4 common.h are supposed to be included from other header, so call it with quotes; ref #3032 2015-11-28 00:10:38 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Seba Gamboa 84b70886cd Add block to document mrb_value type 2015-10-20 12:16:46 -03:00
Seba Gamboa e441fdaad8 Merge doc/api/mruby/value.h.md docs 2015-10-08 13:17:31 -03:00
Seba Gamboa a0fe0c40b1 Remove old doxygen tags 2015-10-08 12:29:10 -03:00
Seba Gamboa 88f9770f83 document mrb_nil_value 2015-09-21 14:50:59 -03:00
Seba Gamboa 40bf7bde78 Sorting documentation grouping 2015-09-21 01:48:42 -03:00
Seba Gamboa c127614638 Setting up doxygen groups 2015-09-20 21:14:07 -03: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
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 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 6057b2e378 change mrb_sym type from uint16_t to uint32_t 2014-09-15 01:48:08 +09:00
Yukihiro "Matz" Matsumoto 9b4ec380d2 use uint16_t instead of short; ref #2568 2014-09-05 00:47:22 +09:00
cremno 3ac4c24534 remove unused MSVC strtoll fallback 2014-08-26 00:52:31 +02: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
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
Yukihiro "Matz" Matsumoto 5e5fad2f25 fix typo with MRB_INT16; fix #2495 2014-08-03 20:30:29 +09:00
Jonas Kulla ec606e3aa7 Silence "unused parameter" warnings in C++
This has been done already, but the fixes were accidentally
removed in 249f05e7d7.
2014-07-23 21:40:15 +02:00
take_cheeze 3c96602574 Use MRB_TT_EXCEPTION in exception object. 2014-07-21 23:09:13 +09:00
Yukihiro "Matz" Matsumoto df4c298e3b rename boxing_nix.h to boxing_no.h 2014-07-09 07:06:58 +09:00
Yukihiro "Matz" Matsumoto 0cf86dea0e rename SET_FIXNUM_VALUE to SET_INT_VALUE since it sets mrb_int value 2014-07-09 06:40:19 +09:00
David Turnbull 249f05e7d7 Clean up value.h and mrb_value boxing 2014-07-09 06:32:11 +09:00
David Turnbull ed5c13bc11 Fix MRB_WORD_BOXING by correctly telling GC which mrb_value types are immediate. 2014-07-01 15:23:23 -07:00
Santa Zhang 17ecbaa23d add a few const qualifier 2014-06-25 07:53:23 +09:00
cremno 84e1b0a9d0 upcoming Visual Studio versions provide snprintf 2014-06-04 06:04:06 +02:00
yui-knk 0c96ba4bd8 Replace tab with spaces. 2014-05-17 00:49:08 +09:00
Yukihiro "Matz" Matsumoto c12f64271a fix overflow error like #2244 on MRB_WORD_BOXING 2014-05-13 23:15:44 +09:00
cremno 86cfcd20d6 simply use isfinite 2014-05-04 01:50:17 +02:00
kyab 10cc4be32d Fix MSVC warnings for numeric.c 2014-04-28 03:07:28 +09:00
take_cheeze d4a510f751 Add mrb_regexp_p to check whether mrb_value is Regexp. 2014-04-17 14:32:45 +09:00
take_cheeze 90d74b99ff Add MRB_TT_HAS_BASIC_P macro to check whether a typetag has MRB_OBJECT_HEADER. 2014-04-09 14:26:26 +09:00
Yukihiro "Matz" Matsumoto ddd1bfda02 type of mrb_type() should be enum mrb_vtype when MRB_NAN_BOXING is on 2014-03-15 14:30:17 +09:00
cremno 1b6a4fb5a2 add MRB_INT_BIT 2014-03-11 20:14:18 +01:00
cremno 8a4faae55e MSVC: add NAN and INFINITY for older versions 2014-03-08 17:25:56 +01:00
cubicdaiya dd4ddcae38 fix a comment end of include guard 2014-03-04 20:35:11 +09:00
Yukihiro "Matz" Matsumoto 7952e7af3c Merge pull request #1740 from tmash06/fix_missing_spaces
fix missing spaces.
2014-02-26 01:54:27 +09:00
Tatsuya Matsumoto fd903c1f38 fix missing spaces. 2014-02-26 00:06:23 +09:00
cremno 1838099e00 more mrb_flo_to_str fixes
- remove float check (take mrb_float instead of mrb_value)
- support -0.0
- fix range error if log10 is called when n == 0.0
- MSVC older than 2013: add signbit macro (for double)
2014-02-17 12:37:39 +01:00
Yukihiro "Matz" Matsumoto dc27c2be46 Merge pull request #1634 from cremno/use-mrb_fixnum_p
tiny word boxing optimization
2014-01-02 15:46:00 -08:00
cremno 09bb30870b tiny word boxing optimization 2014-01-02 06:36:29 +01:00