summaryrefslogtreecommitdiff
path: root/internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'internal.h')
-rw-r--r--internal.h60
1 files changed, 32 insertions, 28 deletions
diff --git a/internal.h b/internal.h
index 4d95fe704e..002044cfa1 100644
--- a/internal.h
+++ b/internal.h
@@ -1,18 +1,15 @@
-/**********************************************************************
-
- internal.h -
-
- $Author$
- created at: Tue May 17 11:42:20 JST 2011
-
- Copyright (C) 2011 Yukihiro Matsumoto
-
-**********************************************************************/
-
-#ifndef RUBY_INTERNAL_H
+#ifndef RUBY_INTERNAL_H /*-*-C-*-vi:se ft=c:*/
#define RUBY_INTERNAL_H 1
-
-#include "ruby/config.h"
+/**
+ * @author $Author$
+ * @date Tue May 17 11:42:20 JST 2011
+ * @copyright Copyright (C) 2011 Yukihiro Matsumoto
+ * @copyright This file is a part of the programming language Ruby.
+ * Permission is hereby granted, to either redistribute and/or
+ * modify this file, provided that the conditions mentioned in the
+ * file COPYING are met. Consult the file for details.
+ */
+#include "ruby/internal/config.h"
#ifdef __cplusplus
# error not for C++
@@ -28,26 +25,26 @@
/* Prevent compiler from reordering access */
#define ACCESS_ONCE(type,x) (*((volatile type *)&(x)))
+#define UNDEF_P RB_UNDEF_P
+#define NIL_OR_UNDEF_P RB_NIL_OR_UNDEF_P
+
#include "ruby/ruby.h"
-/* Folowing macros were formerlly defined in this header but moved to somewhere
+/* Following macros were formerly defined in this header but moved to somewhere
* else. In order to detect them we undef here. */
-/* internal/error.h */
-#undef Check_Type
+/* internal/array.h */
+#undef RARRAY_AREF
/* internal/class.h */
#undef RClass
#undef RCLASS_SUPER
-/* internal/gc.h */
-#undef NEWOBJ_OF
-#undef RB_NEWOBJ_OF
-#undef RB_OBJ_WRITE
-
/* internal/hash.h */
#undef RHASH_IFNONE
#undef RHASH_SIZE
+#undef RHASH_TBL
+#undef RHASH_EMPTY_P
/* internal/struct.h */
#undef RSTRUCT_LEN
@@ -61,9 +58,6 @@
/* internal/array.h */
#define rb_ary_new_from_args(...) rb_nonexistent_symbol(__VA_ARGS__)
-/* internal/io.h */
-#define rb_io_fptr_finalize(...) rb_nonexistent_symbol(__VA_ARGS__)
-
/* internal/string.h */
#define rb_fstring_cstr(...) rb_nonexistent_symbol(__VA_ARGS__)
@@ -82,20 +76,30 @@ void rb_obj_info_dump(VALUE obj);
void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func);
/* debug.c */
+
+RUBY_SYMBOL_EXPORT_BEGIN
void ruby_debug_breakpoint(void);
PRINTF_ARGS(void ruby_debug_printf(const char*, ...), 1, 2);
+RUBY_SYMBOL_EXPORT_END
// show obj data structure without any side-effect
-#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, __func__)
+#define rp(obj) rb_obj_info_dump_loc((VALUE)(obj), __FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING)
// same as rp, but add message header
#define rp_m(msg, obj) do { \
- fprintf(stderr, "%s", (msg)); \
- rb_obj_info_dump((VALUE)obj); \
+ fputs((msg), stderr); \
+ rb_obj_info_dump((VALUE)(obj)); \
} while (0)
// `ruby_debug_breakpoint()` does nothing,
// but breakpoint is set in run.gdb, so `make gdb` can stop here.
#define bp() ruby_debug_breakpoint()
+#define RBOOL(v) ((v) ? Qtrue : Qfalse)
+#define RB_BIGNUM_TYPE_P(x) RB_TYPE_P((x), T_BIGNUM)
+
+#ifndef __MINGW32__
+#undef memcpy
+#define memcpy ruby_nonempty_memcpy
+#endif
#endif /* RUBY_INTERNAL_H */