Unverified Commit 049e749c authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #5166 from shuujii/rename-MRB_ENABLE-DISABLE_-to-MRB_USE-NO_

Rename `MRB_{ENABLE,DISABLE}_` to `MRB_{USE,NO}_`; close #5163
parents 544784ef 3d056d08
......@@ -33,7 +33,7 @@ MRuby::CrossBuild.new("ArduinoDue") do |conf|
cc.defines << %w(KHASH_DEFAULT_SIZE=8)
cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
cc.defines << %w(MRB_GC_STRESS)
#cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio.
#cc.defines << %w(MRB_NO_STDIO) #if you dont need stdio.
#cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
end
......
......@@ -5,7 +5,7 @@
MRuby::Build.new do |conf|
toolchain :gcc
conf.gembox 'default'
conf.cc.defines = %w(ENABLE_READLINE)
conf.cc.defines = %w(MRB_USE_READLINE)
conf.gembox 'default'
#lightweight regular expression
......@@ -33,7 +33,7 @@ MRuby::CrossBuild.new('core2-32-poky-linux') do |conf|
cc.flags << %w(-O2 -pipe -g -feliminate-unused-debug-types)
cc.flags << "--sysroot=#{POKY_EDISON_SYSROOT}"
cc.compile_options = %Q[%{flags} -o "%{outfile}" -c "%{infile}"]
cc.defines = %w(ENABLE_READLINE)
cc.defines = %w(MRB_USE_READLINE)
end
conf.cxx do |cxx|
......
......@@ -19,7 +19,7 @@ MRuby::CrossBuild.new("RX630") do |conf|
cc.defines << %w(KHASH_DEFAULT_SIZE=8)
cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
cc.defines << %w(MRB_GC_STRESS)
cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio.
cc.defines << %w(MRB_NO_STDIO) #if you dont need stdio.
#cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
end
......
......@@ -30,7 +30,7 @@ MRuby::CrossBuild.new("chipKITMax32") do |conf|
cc.defines << %w(KHASH_DEFAULT_SIZE=8)
cc.defines << %w(MRB_STR_BUF_MIN_SIZE=20)
cc.defines << %w(MRB_GC_STRESS)
#cc.defines << %w(MRB_DISABLE_STDIO) #if you dont need stdio.
#cc.defines << %w(MRB_NO_STDIO) #if you dont need stdio.
#cc.defines << %w(POOL_PAGE_SIZE=1000) #effective only for use with mruby-eval
end
......
......@@ -6,7 +6,7 @@ MRuby::Build.new do |conf|
conf.gembox 'default'
# C compiler settings
conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK)
conf.cc.defines = %w(MRB_USE_DEBUG_HOOK)
conf.enable_debug
conf.enable_cxx_abi
conf.enable_test
......
......@@ -14,7 +14,7 @@ MRuby::Build.new('host') do |conf|
conf.gembox 'full-core'
# C compiler settings
conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK MRB_NO_BOXING)
conf.cc.defines = %w(MRB_USE_DEBUG_HOOK MRB_NO_BOXING)
# Generate mruby debugger command (require mruby-eval)
conf.gem :core => "mruby-bin-debugger"
......
......@@ -4,7 +4,7 @@ MRuby::Build.new('full-debug') do |conf|
# include all core GEMs
conf.gembox 'full-core'
conf.cc.defines += %w(MRB_GC_STRESS MRB_ENABLE_DEBUG_HOOK)
conf.cc.defines += %w(MRB_GC_STRESS MRB_USE_DEBUG_HOOK)
conf.enable_test
end
......
......@@ -503,7 +503,7 @@ can't be disabled for the main build.
MRuby::CrossBuild.new('Minimal') do |conf|
toolchain :gcc
conf.cc.defines = %w(MRB_DISABLE_STDIO)
conf.cc.defines = %w(MRB_NO_STDIO)
conf.bins = []
end
```
......
......@@ -11,7 +11,7 @@ You can use mrbconfs with following ways:
changes `struct` layout and cause memory access error when C and other language(e.g., C++) is mixed.
## stdio setting.
`MRB_DISABLE_STDIO`
`MRB_NO_STDIO`
* When defined `<stdio.h>` functions won't be used.
* Some features will be disabled when this is enabled:
* `mrb_irep` load/dump from/to file.
......@@ -19,7 +19,7 @@ You can use mrbconfs with following ways:
* Printing features in **src/print.c**.
## Debug macros.
`MRB_ENABLE_DEBUG_HOOK`
`MRB_USE_DEBUG_HOOK`
* When defined code fetch hook and debug OP hook will be enabled.
* When using any of the hook set function pointer `code_fetch_hook` and/or `debug_op_hook` of `mrb_state`.
* Fetch hook will be called before any OP.
......@@ -176,6 +176,6 @@ largest value of required alignment.
* No `MRB_USE_METHOD_T_STRUCT` requires highest 2 bits of function pointers to be zero
* Define this macro on machines that use higher bits of pointers
`MRB_ENABLE_ALL_SYMBOLS`
`MRB_USE_ALL_SYMBOLS`
* Make it available `Symbols.all_symbols` in `mrbgems/mruby-symbol-ext`
* Increase heap memory usage.
......@@ -148,26 +148,36 @@
/* fixed size state atexit stack */
//#define MRB_FIXED_STATE_ATEXIT_STACK
/* -DMRB_DISABLE_XXXX to drop following features */
//#define MRB_DISABLE_STDIO /* use of stdio */
/* -DMRB_NO_XXXX to drop following features */
//#define MRB_NO_STDIO /* use of stdio */
/* -DMRB_ENABLE_XXXX to enable following features */
//#define MRB_ENABLE_DEBUG_HOOK /* hooks for debugger */
//#define MRB_ENABLE_ALL_SYMBOLS /* Symbols.all_symbols */
/* -DMRB_USE_XXXX to enable following features */
//#define MRB_USE_DEBUG_HOOK /* hooks for debugger */
//#define MRB_USE_ALL_SYMBOLS /* Symbols.all_symbols */
/* end of configuration */
/* define MRB_DISABLE_XXXX from DISABLE_XXX (for compatibility) */
#ifdef DISABLE_STDIO
#define MRB_DISABLE_STDIO
/* obsolete configurations */
#if defined(DISABLE_STDIO) || defined(MRB_DISABLE_STDIO)
# define MRB_NO_STDIO
#endif
/* define MRB_ENABLE_XXXX from ENABLE_XXX (for compatibility) */
#ifdef ENABLE_DEBUG
#define MRB_ENABLE_DEBUG_HOOK
#ifdef MRB_DISABLE_DIRECT_THREADING
# define MRB_NO_DIRECT_THREADING
#endif
#if defined(ENABLE_DEBUG) || defined(MRB_ENABLE_DEBUG_HOOK)
# define MRB_USE_DEBUG_HOOK
#endif
#ifdef MRB_ENABLE_ALL_SYMBOLS
# define MRB_USE_ALL_SYMBOLS
#endif
#ifdef MRB_ENABLE_CXX_ABI
# define MRB_USE_CXX_ABI
#endif
#ifdef MRB_ENABLE_CXX_EXCEPTION
# define MRB_USE_CXX_EXCEPTION
#endif
/* end of configuration */
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
# include <stdio.h>
#endif
......
......@@ -269,11 +269,11 @@ typedef struct mrb_state {
struct symbol_name *symtbl; /* symbol table */
mrb_sym symhash[256];
size_t symcapa;
#ifndef MRB_ENABLE_SYMBOLL_ALL
#ifndef MRB_USE_ALL_SYMBOLS
char symbuf[8]; /* buffer for small symbol names */
#endif
#ifdef MRB_ENABLE_DEBUG_HOOK
#ifdef MRB_USE_DEBUG_HOOK
void (*code_fetch_hook)(struct mrb_state* mrb, const struct mrb_irep *irep, const mrb_code *pc, mrb_value *regs);
void (*debug_op_hook)(struct mrb_state* mrb, const struct mrb_irep *irep, const mrb_code *pc, mrb_value *regs);
#endif
......
......@@ -14,7 +14,7 @@
#endif
#ifdef __cplusplus
#ifdef MRB_ENABLE_CXX_ABI
#ifdef MRB_USE_CXX_ABI
#define MRB_BEGIN_DECL
#define MRB_END_DECL
#else
......
......@@ -115,7 +115,7 @@ struct mrb_parser_state {
struct mrb_pool *pool;
mrb_ast_node *cells;
const char *s, *send;
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
/* If both f and s are non-null, it will be taken preferentially from s until s < send. */
FILE *f;
#endif
......@@ -174,7 +174,7 @@ MRB_API void mrb_parser_set_filename(struct mrb_parser_state*, char const*);
MRB_API mrb_sym mrb_parser_get_filename(struct mrb_parser_state*, uint16_t idx);
/* utility functions */
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
MRB_API struct mrb_parser_state* mrb_parse_file(mrb_state*,FILE*,mrbc_context*);
#endif
MRB_API struct mrb_parser_state* mrb_parse_string(mrb_state*,const char*,mrbc_context*);
......@@ -191,7 +191,7 @@ MRB_API mrb_value mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc
* mrb_value status = mrb_load_string(mrb, buffer);
* mrb_gc_arena_restore(mrb, ai);
*/
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
MRB_API mrb_value mrb_load_file(mrb_state*,FILE*);
MRB_API mrb_value mrb_load_file_cxt(mrb_state*,FILE*, mrbc_context *cxt);
MRB_API mrb_value mrb_load_detect_file_cxt(mrb_state *mrb, FILE *fp, mrbc_context *c);
......
......@@ -19,7 +19,7 @@ MRB_BEGIN_DECL
#define DUMP_DEBUG_INFO 1
int mrb_dump_irep(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, uint8_t **bin, size_t *bin_size);
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
int mrb_dump_irep_binary(mrb_state*, const mrb_irep*, uint8_t, FILE*);
int mrb_dump_irep_cfunc(mrb_state *mrb, const mrb_irep*, uint8_t flags, FILE *f, const char *initname);
int mrb_dump_irep_cstruct(mrb_state *mrb, const mrb_irep*, uint8_t flags, FILE *f, const char *initname);
......
......@@ -7,13 +7,13 @@
#ifndef MRB_THROW_H
#define MRB_THROW_H
#if defined(MRB_ENABLE_CXX_ABI)
#if defined(MRB_USE_CXX_ABI)
# if !defined(__cplusplus)
# error Trying to use C++ exception handling in C code
# endif
#endif
#if defined(MRB_ENABLE_CXX_EXCEPTION)
#if defined(MRB_USE_CXX_EXCEPTION)
# if defined(__cplusplus)
......@@ -52,7 +52,7 @@ typedef mrb_int mrb_jmpbuf_impl;
struct mrb_jmpbuf {
mrb_jmpbuf_impl impl;
#if defined(MRB_ENABLE_CXX_EXCEPTION)
#if defined(MRB_USE_CXX_EXCEPTION)
static mrb_int jmpbuf_id;
# if defined(__cplusplus)
mrb_jmpbuf() : impl(jmpbuf_id++) {}
......
......@@ -151,7 +151,7 @@ module MRuby
end
@cxx_exception_enabled = true
compilers.each { |c|
c.defines += %w(MRB_ENABLE_CXX_EXCEPTION)
c.defines += %w(MRB_USE_CXX_EXCEPTION)
c.flags << c.cxx_exception_flag
}
linker.command = cxx.command if toolchains.find { |v| v == 'gcc' }
......@@ -171,7 +171,7 @@ module MRuby
raise "cxx_exception already enabled"
end
compilers.each { |c|
c.defines += %w(MRB_ENABLE_CXX_EXCEPTION MRB_ENABLE_CXX_ABI)
c.defines += %w(MRB_USE_CXX_EXCEPTION MRB_USE_CXX_ABI)
c.flags << c.cxx_compile_flag
c.flags = c.flags.flatten - c.cxx_invalid_flags.flatten
}
......@@ -188,11 +188,11 @@ module MRuby
#define __STDC_CONSTANT_MACROS
#define __STDC_LIMIT_MACROS
#ifndef MRB_ENABLE_CXX_ABI
#ifndef MRB_USE_CXX_ABI
extern "C" {
#endif
#include "#{File.absolute_path src}"
#ifndef MRB_ENABLE_CXX_ABI
#ifndef MRB_USE_CXX_ABI
}
#endif
EOS
......@@ -273,11 +273,11 @@ EOS
use_mrdb = @gems.find{|g| g.name == "mruby-bin-debugger"}
compilers.each do |compiler|
if respond_to?(:enable_gems?) && enable_gems?
compiler.defines -= %w(DISABLE_GEMS)
compiler.defines -= %w(MRB_NO_GEMS)
else
compiler.defines += %w(DISABLE_GEMS)
compiler.defines += %w(MRB_NO_GEMS)
end
compiler.defines |= %w(MRB_ENABLE_DEBUG_HOOK) if use_mrdb
compiler.defines |= %w(MRB_USE_DEBUG_HOOK) if use_mrdb
compiler.define_rules build_dir, File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
end
end
......
......@@ -6,12 +6,12 @@
#ifndef MRDBCONF_H
#define MRDBCONF_H
#ifndef MRB_ENABLE_DEBUG_HOOK
# error mruby-bin-debugger need 'MRB_ENABLE_DEBUG_HOOK' in your build configuration
#ifndef MRB_USE_DEBUG_HOOK
# error mruby-bin-debugger need 'MRB_USE_DEBUG_HOOK' in your build configuration
#endif
#ifdef MRB_DISABLE_STDIO
# error mruby-bin-debugger conflicts 'MRB_DISABLE_STDIO' in your build configuration
#ifdef MRB_NO_STDIO
# error mruby-bin-debugger conflicts 'MRB_NO_STDIO' in your build configuration
#endif
/* configuration options: */
......
......@@ -4,7 +4,7 @@ MRuby::Gem::Specification.new('mruby-bin-mirb') do |spec|
spec.summary = 'mirb command'
if spec.build.cc.search_header_path 'readline/readline.h'
spec.cc.defines << "ENABLE_READLINE"
spec.cc.defines << "MRB_USE_READLINE"
if spec.build.cc.search_header_path 'termcap.h'
if MRUBY_BUILD_HOST_IS_CYGWIN || MRUBY_BUILD_HOST_IS_OPENBSD
if spec.build.cc.search_header_path 'termcap.h'
......@@ -34,7 +34,7 @@ MRuby::Gem::Specification.new('mruby-bin-mirb') do |spec|
end
end
elsif spec.build.cc.search_header_path 'linenoise.h'
spec.cc.defines << "ENABLE_LINENOISE"
spec.cc.defines << "MRB_USE_LINENOISE"
end
spec.bins = %w(mirb)
......
......@@ -8,8 +8,8 @@
#include <mruby.h>
#ifdef MRB_DISABLE_STDIO
# error mruby-bin-mirb conflicts 'MRB_DISABLE_STDIO' in your build configuration
#ifdef MRB_NO_STDIO
# error mruby-bin-mirb conflicts 'MRB_NO_STDIO' in your build configuration
#endif
#include <mruby/array.h>
......@@ -26,7 +26,18 @@
#include <signal.h>
#include <setjmp.h>
/* obsolete configuration */
#ifdef ENABLE_READLINE
# define MRB_USE_READLINE
#endif
#ifdef ENABLE_LINENOISE
# define MRB_USE_LINENOISE
#endif
#ifdef DISABLE_MIRB_UNDERSCORE
# define MRB_NO_MIRB_UNDERSCORE
#endif
#ifdef MRB_USE_READLINE
#include <readline/readline.h>
#include <readline/history.h>
#define MIRB_ADD_HISTORY(line) add_history(line)
......@@ -40,8 +51,8 @@
#define MIRB_WRITE_HISTORY(path) write_history(path)
#define MIRB_READ_HISTORY(path) read_history(path)
#define MIRB_USING_HISTORY() using_history()
#elif defined(ENABLE_LINENOISE)
#define ENABLE_READLINE
#elif defined(MRB_USE_LINENOISE)
#define MRB_USE_READLINE
#include <linenoise.h>
#define MIRB_ADD_HISTORY(line) linenoiseHistoryAdd(line)
#define MIRB_READLINE(ch) linenoise(ch)
......@@ -61,7 +72,7 @@
#define SIGJMP_BUF jmp_buf
#endif
#ifdef ENABLE_READLINE
#ifdef MRB_USE_READLINE
static const char history_file_name[] = ".mirb_history";
......@@ -352,7 +363,7 @@ print_hint(void)
printf("mirb - Embeddable Interactive Ruby Shell\n\n");
}
#ifndef ENABLE_READLINE
#ifndef MRB_USE_READLINE
/* Print the command line prompt of the REPL */
static void
print_cmdline(int code_block_open)
......@@ -393,7 +404,7 @@ check_keyword(const char *buf, const char *word)
}
#ifndef ENABLE_READLINE
#ifndef MRB_USE_READLINE
volatile sig_atomic_t input_canceled = 0;
void
ctrl_c_handler(int signo)
......@@ -409,7 +420,7 @@ ctrl_c_handler(int signo)
}
#endif
#ifndef DISABLE_MIRB_UNDERSCORE
#ifndef MRB_NO_MIRB_UNDERSCORE
void decl_lv_underscore(mrb_state *mrb, mrbc_context *cxt)
{
struct RProc *proc;
......@@ -434,7 +445,7 @@ main(int argc, char **argv)
{
char ruby_code[4096] = { 0 };
char last_code_line[1024] = { 0 };
#ifndef ENABLE_READLINE
#ifndef MRB_USE_READLINE
int last_char;
size_t char_index;
#else
......@@ -478,7 +489,7 @@ main(int argc, char **argv)
mrb_define_global_const(mrb, "ARGV", ARGV);
mrb_gv_set(mrb, mrb_intern_lit(mrb, "$DEBUG"), mrb_bool_value(args.debug));
#ifdef ENABLE_READLINE
#ifdef MRB_USE_READLINE
history_path = get_history_path(mrb);
if (history_path == NULL) {
fputs("failed to get history path\n", stderr);
......@@ -511,7 +522,7 @@ main(int argc, char **argv)
mrbc_cleanup_local_variables(mrb, cxt);
}
#ifndef DISABLE_MIRB_UNDERSCORE
#ifndef MRB_NO_MIRB_UNDERSCORE
decl_lv_underscore(mrb, cxt);
#endif
......@@ -531,7 +542,7 @@ main(int argc, char **argv)
break;
}
#ifndef ENABLE_READLINE
#ifndef MRB_USE_READLINE
print_cmdline(code_block_open);
signal(SIGINT, ctrl_c_handler);
......@@ -672,7 +683,7 @@ main(int argc, char **argv)
result = mrb_any_to_s(mrb, result);
}
p(mrb, result, 1);
#ifndef DISABLE_MIRB_UNDERSCORE
#ifndef MRB_NO_MIRB_UNDERSCORE
*(mrb->c->stack + 1) = result;
#endif
}
......@@ -685,7 +696,7 @@ main(int argc, char **argv)
cxt->lineno++;
}
#ifdef ENABLE_READLINE
#ifdef MRB_USE_READLINE
MIRB_WRITE_HISTORY(history_path);
mrb_free(mrb, history_path);
#endif
......
#include <mruby.h>
#ifdef MRB_DISABLE_STDIO
# error mruby-bin-mrbc conflicts 'MRB_DISABLE_STDIO' in your build configuration
#ifdef MRB_NO_STDIO
# error mruby-bin-mrbc conflicts 'MRB_NO_STDIO' in your build configuration
#endif
#include <stdlib.h>
......@@ -344,7 +344,7 @@ mrb_init_mrblib(mrb_state *mrb)
{
}
#ifndef DISABLE_GEMS
#ifndef MRB_NO_GEMS
void
mrb_init_mrbgems(mrb_state *mrb)
{
......
#include <mruby.h>
#ifdef MRB_DISABLE_STDIO
# error mruby-bin-mruby conflicts 'MRB_DISABLE_STDIO' in your build configuration
#ifdef MRB_NO_STDIO
# error mruby-bin-mruby conflicts 'MRB_NO_STDIO' in your build configuration
#endif
#include <stdlib.h>
......
#include <mruby.h>
#ifdef MRB_DISABLE_STDIO
# error mruby-bin-strip conflicts 'MRB_DISABLE_STDIO' in your build configuration
#ifdef MRB_NO_STDIO
# error mruby-bin-strip conflicts 'MRB_NO_STDIO' in your build configuration
#endif
#include <stdlib.h>
......
......@@ -129,7 +129,7 @@ codegen_error(codegen_scope *s, const char *message)
mrb_pool_close(s->mpool);
s = tmp;
}
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
if (s->filename_sym && s->lineno) {
const char *filename = mrb_sym_name_len(s->mrb, s->filename_sym, NULL);
fprintf(stderr, "codegen error:%s:%d: %s\n", filename, s->lineno, message);
......@@ -1232,7 +1232,7 @@ gen_assignment(codegen_scope *s, node *tree, int sp, int val)
break;
default:
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
fprintf(stderr, "unknown lhs %d\n", type);
#endif
break;
......
......@@ -3984,7 +3984,7 @@ yyerror(parser_state *p, const char *s)
size_t n;
if (! p->capture_errors) {
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
if (p->filename_sym) {
const char *filename = mrb_sym_name_len(p->mrb, p->filename_sym, NULL);
fprintf(stderr, "%s:%d:%d: %s\n", filename, p->lineno, p->column, s);
......@@ -4023,7 +4023,7 @@ yywarn(parser_state *p, const char *s)
size_t n;
if (! p->capture_errors) {
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
if (p->filename_sym) {
const char *filename = mrb_sym_name_len(p->mrb, p->filename_sym, NULL);
fprintf(stderr, "%s:%d:%d: warning: %s\n", filename, p->lineno, p->column, s);
......@@ -4128,7 +4128,7 @@ nextc0(parser_state *p)
c = (unsigned char)*p->s++;
}
else {
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
if (p->f) {
c = fgetc(p->f);
if (feof(p->f)) return -1;
......@@ -4232,7 +4232,7 @@ peeks(parser_state *p, const char *s)
{
size_t len = strlen(s);
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
if (p->f) {
int n = 0;
while (*s) {
......@@ -6398,7 +6398,7 @@ mrb_parser_new(mrb_state *mrb)
p->pool = pool;
p->s = p->send = NULL;
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
p->f = NULL;
#endif
......@@ -6520,7 +6520,7 @@ mrb_parser_get_filename(struct mrb_parser_state* p, uint16_t idx) {
}
}
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
static struct mrb_parser_state *
mrb_parse_file_continue(mrb_state *mrb, FILE *f, const void *prebuf, size_t prebufsize, mrbc_context *c)
{
......@@ -6625,7 +6625,7 @@ mrb_load_exec(mrb_state *mrb, struct mrb_parser_state *p, mrbc_context *c)
return v;
}
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
MRB_API mrb_value
mrb_load_file_cxt(mrb_state *mrb, FILE *f, mrbc_context *c)
{
......@@ -6712,7 +6712,7 @@ mrb_load_string(mrb_state *mrb, const char *s)
return mrb_load_string_cxt(mrb, s, NULL);
}
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
static void
dump_prefix(node *tree, int offset)
......@@ -6802,7 +6802,7 @@ str_dump(mrb_state *mrb, const char *str, int len)
void
mrb_parser_dump(mrb_state *mrb, node *tree, int offset)
{
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
int nodetype;
if (!tree) return;
......
This diff is collapsed.
......@@ -7,8 +7,8 @@
#include <mruby.h>
#ifdef MRB_DISABLE_STDIO
# error IO and File conflicts 'MRB_DISABLE_STDIO' in your build configuration
#ifdef MRB_NO_STDIO
# error IO and File conflicts 'MRB_NO_STDIO' in your build configuration
#endif
#if defined(__cplusplus)
......
......@@ -186,7 +186,7 @@ pack_l(mrb_state *mrb, mrb_value o, mrb_value str, mrb_int sidx, unsigned int fl
static void
u32tostr(char *buf, size_t len, uint32_t n)
{
#ifdef MRB_DISABLE_STDIO
#ifdef MRB_NO_STDIO
char *bufend = buf + len;
char *p = bufend - 1;
......@@ -211,13 +211,13 @@ u32tostr(char *buf, size_t len, uint32_t n)
memmove(buf, p, bufend - p);
#else
snprintf(buf, len, "%" PRIu32, n);
#endif /* MRB_DISABLE_STDIO */
#endif /* MRB_NO_STDIO */
}
static void
i32tostr(char *buf, size_t len, int32_t n)
{
#ifdef MRB_DISABLE_STDIO
#ifdef MRB_NO_STDIO
if (len < 1) {
return;
}
......@@ -231,7 +231,7 @@ i32tostr(char *buf, size_t len, int32_t n)
u32tostr(buf, len, (uint32_t)n);
#else
snprintf(buf, len, "%" PRId32, n);
#endif /* MRB_DISABLE_STDIO */
#endif /* MRB_NO_STDIO */
}
#endif /* MRB_INT64 */
......@@ -309,7 +309,7 @@ pack_q(mrb_state *mrb, mrb_value o, mrb_value str, mrb_int sidx, unsigned int fl
static void
u64tostr(char *buf, size_t len, uint64_t n)
{
#ifdef MRB_DISABLE_STDIO
#ifdef MRB_NO_STDIO
char *bufend = buf + len;
char *p = bufend - 1;
......@@ -334,13 +334,13 @@ u64tostr(char *buf, size_t len, uint64_t n)
memmove(buf, p, bufend - p);
#else
snprintf(buf, len, "%" PRIu64, n);
#endif /* MRB_DISABLE_STDIO */
#endif /* MRB_NO_STDIO */
}
static void
i64tostr(char *buf, size_t len, int64_t n)
{
#ifdef MRB_DISABLE_STDIO
#ifdef MRB_NO_STDIO
if (len < 1) {
return;
}
......@@ -354,7 +354,7 @@ i64tostr(char *buf, size_t len, int64_t n)
u64tostr(buf, len, (uint64_t)n);
#else
snprintf(buf, len, "%" PRId64, n);
#endif /* MRB_DISABLE_STDIO */
#endif /* MRB_NO_STDIO */
}
static int
......
#include <mruby.h>
#ifdef MRB_DISABLE_STDIO
# error print conflicts 'MRB_DISABLE_STDIO' in your build configuration
#ifdef MRB_NO_STDIO
# error print conflicts 'MRB_NO_STDIO' in your build configuration
#endif
#include <mruby/string.h>
......
......@@ -533,7 +533,7 @@ mrb_f_sprintf(mrb_state *mrb, mrb_value obj)
static int
mrb_int2str(char *buf, size_t len, mrb_int n)
{
#ifdef MRB_DISABLE_STDIO
#ifdef MRB_NO_STDIO
char *bufend = buf + len;
char *p = bufend - 1;
......@@ -571,7 +571,7 @@ mrb_int2str(char *buf, size_t len, mrb_int n)
return bufend - p - 1;
#else
return snprintf(buf, len, "%" MRB_PRId, n);
#endif /* MRB_DISABLE_STDIO */
#endif /* MRB_NO_STDIO */
}
mrb_value
......
......@@ -18,7 +18,7 @@
* :Tms, :getwd, :$=, :ThreadGroup,
* :wait2, :$>]
*/
#ifdef MRB_ENABLE_ALL_SYMBOLS
#ifdef MRB_USE_ALL_SYMBOLS
static mrb_value
mrb_sym_all_symbols(mrb_state *mrb, mrb_value self)
{
......@@ -58,7 +58,7 @@ void
mrb_mruby_symbol_ext_gem_init(mrb_state* mrb)
{
struct RClass *s = mrb->symbol_class;
#ifdef MRB_ENABLE_ALL_SYMBOLS
#ifdef MRB_USE_ALL_SYMBOLS
mrb_define_class_method(mrb, s, "all_symbols", mrb_sym_all_symbols, MRB_ARGS_NONE());
#endif
mrb_define_method(mrb, s, "length", mrb_sym_length, MRB_ARGS_NONE());
......
......@@ -15,7 +15,7 @@
#include <mruby/time.h>
#include <mruby/string.h>
#ifdef MRB_DISABLE_STDIO
#ifdef MRB_NO_STDIO
#include <string.h>
#endif
......@@ -65,7 +65,7 @@ double round(double x) {
/* asctime(3) */
/* mruby usually use its own implementation of struct tm to string conversion */
/* except when DISABLE_STDIO is set. In that case, it uses asctime() or asctime_r(). */
/* except when MRB_NO_STDIO is set. In that case, it uses asctime() or asctime_r(). */
/* By default mruby tries to use asctime_r() which is reentrant. */
/* Undef following macro on platforms that does not have asctime_r(). */
/* #define NO_ASCTIME_R */
......@@ -180,7 +180,7 @@ static const mrb_timezone_name timezone_names[] = {
{ "LOCAL", sizeof("LOCAL") - 1 },
};
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
static const char mon_names[12][4] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
};
......@@ -652,7 +652,7 @@ mrb_time_asctime(mrb_state *mrb, mrb_value self)
struct tm *d = &tm->datetime;
int len;
#if defined(MRB_DISABLE_STDIO)
#if defined(MRB_NO_STDIO)
char *s;
# ifdef NO_ASCTIME_R
s = asctime(d);
......
......@@ -74,7 +74,7 @@ each_backtrace(mrb_state *mrb, ptrdiff_t ciidx, const mrb_code *pc0, each_backtr
}
}
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
static void
print_backtrace(mrb_state *mrb, struct RObject *exc, mrb_value backtrace)
......
......@@ -6,7 +6,7 @@
#include <mruby/proc.h>
#include <mruby/dump.h>
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
static void
print_r(mrb_state *mrb, const mrb_irep *irep, size_t n)
{
......@@ -556,7 +556,7 @@ codedump_recur(mrb_state *mrb, const mrb_irep *irep)
void
mrb_codedump_all(mrb_state *mrb, struct RProc *proc)
{
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
codedump_recur(mrb, proc->body.irep);
#endif
}
......@@ -874,7 +874,7 @@ mrb_dump_irep(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, uint8_t **bin
return dump_irep(mrb, irep, flags, bin, bin_size);
}
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
int
mrb_dump_irep_binary(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, FILE* fp)
......@@ -1112,4 +1112,4 @@ mrb_dump_irep_cstruct(mrb_state *mrb, const mrb_irep *irep, uint8_t flags, FILE
return MRB_DUMP_OK;
}
#endif /* MRB_DISABLE_STDIO */
#endif /* MRB_NO_STDIO */
......@@ -420,7 +420,7 @@ mrb_name_error(mrb_state *mrb, mrb_sym id, const char *fmt, ...)
MRB_API void
mrb_warn(mrb_state *mrb, const char *fmt, ...)
{
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
va_list ap;
mrb_value str;
......@@ -436,7 +436,7 @@ mrb_warn(mrb_state *mrb, const char *fmt, ...)
MRB_API mrb_noreturn void
mrb_bug(mrb_state *mrb, const char *fmt, ...)
{
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
va_list ap;
mrb_value str;
......
#ifndef MRB_NO_FLOAT
#if defined(MRB_DISABLE_STDIO) || defined(_WIN32) || defined(_WIN64)
#if defined(MRB_NO_STDIO) || defined(_WIN32) || defined(_WIN64)
/*
Most code in this file originates from musl (src/stdio/vfprintf.c)
......@@ -442,7 +442,7 @@ mrb_float_to_cstr(mrb_state *mrb, char *buf, size_t len, const char *fmt, mrb_fl
*cstr.buf = '\0';
return (int)(cstr.buf - buf);
}
#else /* MRB_DISABLE_STDIO || _WIN32 || _WIN64 */
#else /* MRB_NO_STDIO || _WIN32 || _WIN64 */
#include <mruby.h>
#include <stdio.h>
......@@ -460,5 +460,5 @@ mrb_float_to_cstr(mrb_state *mrb, char *buf, size_t len, const char *fmt, mrb_fl
{
return snprintf(buf, len, fmt, fval);
}
#endif /* MRB_DISABLE_STDIO || _WIN32 || _WIN64 */
#endif /* MRB_NO_STDIO || _WIN32 || _WIN64 */
#endif
......@@ -685,7 +685,7 @@ mrb_load_proc(mrb_state *mrb, const struct RProc *proc)
return mrb_vm_run(mrb, proc, mrb_top_self(mrb), 0);
}
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
mrb_irep*
mrb_read_irep_file(mrb_state *mrb, FILE* fp)
......@@ -732,4 +732,4 @@ mrb_load_irep_file(mrb_state *mrb, FILE* fp)
{
return mrb_load_irep_file_cxt(mrb, fp, NULL);
}
#endif /* MRB_DISABLE_STDIO */
#endif /* MRB_NO_STDIO */
......@@ -10,7 +10,7 @@
#include <mruby/error.h>
#include <string.h>
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
static void
printcstr(const char *str, size_t len, FILE *stream)
{
......
......@@ -77,7 +77,7 @@ mrb_open(void)
return mrb;
}
#ifndef DISABLE_GEMS
#ifndef MRB_NO_GEMS
static void
init_mrbgems(mrb_state *mrb, void *opaque)
{
......@@ -94,7 +94,7 @@ mrb_open_allocf(mrb_allocf f, void *ud)
return NULL;
}
#ifndef DISABLE_GEMS
#ifndef MRB_NO_GEMS
if (mrb_core_init_protect(mrb, init_mrbgems, NULL)) {
mrb_close(mrb);
return NULL;
......
......@@ -69,7 +69,7 @@ typedef struct symbol_name {
const char *name;
} symbol_name;
#ifdef MRB_ENABLE_ALL_SYMBOLS
#ifdef MRB_USE_ALL_SYMBOLS
#define SYMBOL_SHIFT 0
# define SYMBOL_INLINE_P(sym) FALSE
# define sym_inline_pack(name, len) 0
......@@ -88,7 +88,7 @@ sym_validate_len(mrb_state *mrb, size_t len)
}
}
#ifndef MRB_ENABLE_ALL_SYMBOLS
#ifndef MRB_USE_ALL_SYMBOLS
static const char pack_table[] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
static mrb_sym
......
......@@ -25,7 +25,7 @@
#include <mruby/throw.h>
#include <mruby/dump.h>
#ifdef MRB_DISABLE_STDIO
#ifdef MRB_NO_STDIO
#if defined(__cplusplus)
extern "C" {
#endif
......@@ -935,7 +935,7 @@ prepare_tagged_break(mrb_state *mrb, uint32_t tag, const struct RProc *proc, mrb
#define ERR_PC_SET(mrb) mrb->c->ci->err = pc0;
#define ERR_PC_CLR(mrb) mrb->c->ci->err = 0;
#ifdef MRB_ENABLE_DEBUG_HOOK
#ifdef MRB_USE_DEBUG_HOOK
#define CODE_FETCH_HOOK(mrb, irep, pc, regs) if ((mrb)->code_fetch_hook) (mrb)->code_fetch_hook((mrb), (irep), (pc), (regs));
#else
#define CODE_FETCH_HOOK(mrb, irep, pc, regs)
......@@ -947,11 +947,11 @@ prepare_tagged_break(mrb_state *mrb, uint32_t tag, const struct RProc *proc, mrb
#define BYTECODE_DECODER(x) (x)
#endif
#ifndef MRB_DISABLE_DIRECT_THREADING
#ifndef MRB_NO_DIRECT_THREADING
#if defined __GNUC__ || defined __clang__ || defined __INTEL_COMPILER
#define DIRECT_THREADED
#endif
#endif /* ifndef MRB_DISABLE_DIRECT_THREADING */
#endif /* ifndef MRB_NO_DIRECT_THREADING */
#ifndef DIRECT_THREADED
......@@ -2797,10 +2797,10 @@ RETRY_TRY_BLOCK:
CASE(OP_DEBUG, Z) {
FETCH_BBB();
#ifdef MRB_ENABLE_DEBUG_HOOK
#ifdef MRB_USE_DEBUG_HOOK
mrb->debug_op_hook(mrb, irep, pc, regs);
#else
#ifndef MRB_DISABLE_STDIO
#ifndef MRB_NO_STDIO
printf("OP_DEBUG %d %d %d\n", a, b, c);
#else
abort();
......@@ -2887,12 +2887,12 @@ mrb_top_run(mrb_state *mrb, const struct RProc *proc, mrb_value self, mrb_int st
return v;
}
#if defined(MRB_ENABLE_CXX_EXCEPTION) && defined(__cplusplus)
# if !defined(MRB_ENABLE_CXX_ABI)
#if defined(MRB_USE_CXX_EXCEPTION) && defined(__cplusplus)
# if !defined(MRB_USE_CXX_ABI)
} /* end of extern "C" */
# endif
mrb_int mrb_jmpbuf::jmpbuf_id = 0;
# if !defined(MRB_ENABLE_CXX_ABI)
# if !defined(MRB_USE_CXX_ABI)
extern "C" {
# endif
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment