From 76f7aecff326666543d9bac31fe13e0cab8e05f4 Mon Sep 17 00:00:00 2001 From: Yukihiro Matsumoto Date: Fri, 15 Jun 2012 15:34:49 +0900 Subject: use ENABLE/DISABLE instead of INCLUDE for configuration macro names --- include/mrbconf.h | 50 ++++++++++++++++++++++++-------------------------- include/mruby/class.h | 9 +-------- 2 files changed, 25 insertions(+), 34 deletions(-) (limited to 'include') diff --git a/include/mrbconf.h b/include/mrbconf.h index f4f3ccaef..4b778e6de 100644 --- a/include/mrbconf.h +++ b/include/mrbconf.h @@ -8,8 +8,21 @@ #define MRUBYCONF_H #include + +/* configuration options: */ +/* add -DMRB_USE_FLOAT to use float instead of double for floating point numbers */ #undef MRB_USE_FLOAT +/* -DDISABLE_XXXX to change to drop the feature */ +#define DISABLE_REGEXP /* regular expression classes */ +#undef DISABLE_KERNEL_SPRINTF /* Kernel.sprintf method */ +#undef DISABLE_MATH /* Math functions */ +#undef DISABLE_TIME /* Time class */ + +#undef HAVE_UNISTD_H /* WINDOWS */ +#define HAVE_UNISTD_H /* LINUX */ +/* end of configuration */ + #ifdef MRB_USE_FLOAT typedef float mrb_float; #else @@ -20,34 +33,19 @@ typedef double mrb_float; typedef int mrb_int; typedef intptr_t mrb_sym; -//#define PARSER_DUMP /* print out parser state */ -#undef PARSER_DUMP /* do not print out parser state */ - -//#define INCLUDE_ENCODING /* use UTF-8 encoding classes */ -#undef INCLUDE_ENCODING /* not use encoding classes (ascii only) */ - -//#define INCLUDE_REGEXP /* use regular expression classes */ -#undef INCLUDE_REGEXP /* not use regular expression classes */ - -#ifdef INCLUDE_REGEXP -# define INCLUDE_ENCODING /* Regexp depends Encoding */ +/* define ENABLE_XXXX from DISABLE_XXX */ +#ifndef DISABLE_REGEXP +#define ENABLE_REGEXP #endif - -#define INCLUDE_KERNEL_SPRINTF /* not use Kernel.sprintf method */ -//#undef INCLUDE_KERNEL_SPRINTF /* not use Kernel.sprintf method */ - -#define INCLUDE_MATH /* use (non ISO) Math module */ -//#undef INCLUDE_MATH /* not use (non ISO) Math module */ - -#define INCLUDE_TIME /* use Time module */ -//#undef INCLUDE_TIME /* not use Time module */ - -#ifdef MRUBY_DEBUG_BUILD -# define PARSER_DUMP +#ifndef DISABLE_KERNEL_SPRINTF +#define ENABLE_KERNEL_SPRINTF +#endif +#ifndef DISABLE_MATH +#define ENABLE_MATH +#endif +#ifndef DISABLE_TIME +#define ENABLE_TIME #endif - -#undef HAVE_UNISTD_H /* WINDOWS */ -#define HAVE_UNISTD_H /* LINUX */ #ifndef FALSE # define FALSE 0 diff --git a/include/mruby/class.h b/include/mruby/class.h index 35dd0ec1d..2cc90310e 100644 --- a/include/mruby/class.h +++ b/include/mruby/class.h @@ -40,14 +40,7 @@ mrb_class(mrb_state *mrb, mrb_value v) case MRB_TT_FLOAT: return mrb->float_class; -#ifdef INCLUDE_REGEXP -// case MRB_TT_REGEX: -// return mrb->regex_class; -// case MRB_TT_MATCH: -// return mrb->match_class; -// case MRB_TT_DATA: -// return mrb->encode_class; -#else +#ifdef ENABLE_REGEXP case MRB_TT_REGEX: case MRB_TT_MATCH: mrb_raise(mrb, E_TYPE_ERROR, "type mismatch: %s given", -- cgit v1.2.3