Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
4e877bc9
Commit
4e877bc9
authored
Jun 10, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restructure header files; move non config lines away from mrbconf.h
parent
20ef86be
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
69 deletions
+72
-69
include/mrbconf.h
include/mrbconf.h
+0
-68
include/mruby.h
include/mruby.h
+3
-1
include/mruby/value.h
include/mruby/value.h
+69
-0
No files found.
include/mrbconf.h
View file @
4e877bc9
...
...
@@ -7,9 +7,6 @@
#ifndef MRUBYCONF_H
#define MRUBYCONF_H
#include <stdint.h>
#include <stddef.h>
/* configuration options: */
/* add -DMRB_USE_FLOAT to use float instead of double for floating point numbers */
//#define MRB_USE_FLOAT
...
...
@@ -67,49 +64,6 @@
/* end of configuration */
#ifdef MRB_USE_FLOAT
typedef
float
mrb_float
;
# define mrb_float_to_str(buf, i) sprintf(buf, "%.7e", i)
# define str_to_mrb_float(buf) strtof(buf, NULL)
#else
typedef
double
mrb_float
;
# define mrb_float_to_str(buf, i) sprintf(buf, "%.16e", i)
# define str_to_mrb_float(buf) strtod(buf, NULL)
#endif
#if defined(MRB_INT16) && defined(MRB_INT64)
# error "You can't define MRB_INT16 and MRB_INT64 at the same time."
#endif
#if defined(MRB_INT64)
# ifdef MRB_NAN_BOXING
# error Cannot use NaN boxing when mrb_int is 64bit
# else
typedef
int64_t
mrb_int
;
# define MRB_INT_MIN INT64_MIN
# define MRB_INT_MAX INT64_MAX
# define PRIdMRB_INT PRId64
# define PRIiMRB_INT PRIi64
# define PRIoMRB_INT PRIo64
# define PRIxMRB_INT PRIx64
# define PRIXMRB_INT PRIX64
# endif
#elif defined(MRB_INT16)
typedef
int16_t
mrb_int
;
# define MRB_INT_MIN INT16_MIN
# define MRB_INT_MAX INT16_MAX
#else
typedef
int32_t
mrb_int
;
# define MRB_INT_MIN INT32_MIN
# define MRB_INT_MAX INT32_MAX
# define PRIdMRB_INT PRId32
# define PRIiMRB_INT PRIi32
# define PRIoMRB_INT PRIo32
# define PRIxMRB_INT PRIx32
# define PRIXMRB_INT PRIX32
#endif
typedef
short
mrb_sym
;
/* define ENABLE_XXXX from DISABLE_XXX */
#ifndef DISABLE_STDIO
#define ENABLE_STDIO
...
...
@@ -118,28 +72,6 @@ typedef short mrb_sym;
#define DISABLE_DEBUG
#endif
#ifdef _MSC_VER
# define _ALLOW_KEYWORD_MACROS
# include <float.h>
# define inline __inline
# define snprintf _snprintf
# define isnan _isnan
# define isinf(n) (!_finite(n) && !_isnan(n))
# define strtoll _strtoi64
# define PRId32 "I32d"
# define PRIi32 "I32i"
# define PRIo32 "I32o"
# define PRIx32 "I32x"
# define PRIX32 "I32X"
# define PRId64 "I64d"
# define PRIi64 "I64i"
# define PRIo64 "I64o"
# define PRIx64 "I64x"
# define PRIX64 "I64X"
#else
# include <inttypes.h>
#endif
#ifdef ENABLE_STDIO
# include <stdio.h>
#endif
...
...
include/mruby.h
View file @
4e877bc9
...
...
@@ -32,8 +32,10 @@
extern
"C"
{
#endif
#include "mrbconf.h"
#include <stdint.h>
#include <stddef.h>
#include "mrbconf.h"
#include "mruby/value.h"
typedef
uint32_t
mrb_code
;
...
...
include/mruby/value.h
View file @
4e877bc9
...
...
@@ -7,6 +7,71 @@
#ifndef MRUBY_VALUE_H
#define MRUBY_VALUE_H
#ifdef MRB_USE_FLOAT
typedef
float
mrb_float
;
# define mrb_float_to_str(buf, i) sprintf(buf, "%.7e", i)
# define str_to_mrb_float(buf) strtof(buf, NULL)
#else
typedef
double
mrb_float
;
# define mrb_float_to_str(buf, i) sprintf(buf, "%.16e", i)
# define str_to_mrb_float(buf) strtod(buf, NULL)
#endif
#if defined(MRB_INT16) && defined(MRB_INT64)
# error "You can't define MRB_INT16 and MRB_INT64 at the same time."
#endif
#if defined(MRB_INT64)
# ifdef MRB_NAN_BOXING
# error Cannot use NaN boxing when mrb_int is 64bit
# else
typedef
int64_t
mrb_int
;
# define MRB_INT_MIN INT64_MIN
# define MRB_INT_MAX INT64_MAX
# define PRIdMRB_INT PRId64
# define PRIiMRB_INT PRIi64
# define PRIoMRB_INT PRIo64
# define PRIxMRB_INT PRIx64
# define PRIXMRB_INT PRIX64
# endif
#elif defined(MRB_INT16)
typedef
int16_t
mrb_int
;
# define MRB_INT_MIN INT16_MIN
# define MRB_INT_MAX INT16_MAX
#else
typedef
int32_t
mrb_int
;
# define MRB_INT_MIN INT32_MIN
# define MRB_INT_MAX INT32_MAX
# define PRIdMRB_INT PRId32
# define PRIiMRB_INT PRIi32
# define PRIoMRB_INT PRIo32
# define PRIxMRB_INT PRIx32
# define PRIXMRB_INT PRIX32
#endif
typedef
short
mrb_sym
;
#ifdef _MSC_VER
# define _ALLOW_KEYWORD_MACROS
# include <float.h>
# define inline __inline
# define snprintf _snprintf
# define isnan _isnan
# define isinf(n) (!_finite(n) && !_isnan(n))
# define strtoll _strtoi64
# define PRId32 "I32d"
# define PRIi32 "I32i"
# define PRIo32 "I32o"
# define PRIx32 "I32x"
# define PRIX32 "I32X"
# define PRId64 "I64d"
# define PRIi64 "I64i"
# define PRIo64 "I64o"
# define PRIx64 "I64x"
# define PRIX64 "I64X"
#else
# include <inttypes.h>
#endif
typedef
uint8_t
mrb_bool
;
struct
mrb_state
;
...
...
@@ -16,6 +81,10 @@ struct mrb_state;
# error ---->> MRB_NAN_BOXING and MRB_USE_FLOAT conflict <<----
#endif
#ifdef MRB_INT64
# error ---->> MRB_NAN_BOXING and MRB_INT64 conflict <<----
#endif
enum
mrb_vtype
{
MRB_TT_FALSE
=
1
,
/* 1 */
MRB_TT_FREE
,
/* 2 */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment