diff options
author | 卜部昌平 <[email protected]> | 2019-11-29 15:18:34 +0900 |
---|---|---|
committer | 卜部昌平 <[email protected]> | 2019-12-26 20:45:12 +0900 |
commit | b739a63eb41f52d33c33f87ebc44dcf89762cc37 (patch) | |
tree | 46e00221c40f90e47c9acca04905d9877a84cc10 /internal/variable.h | |
parent | ba78bf9778082795bdb4735ccd7b692b5c3769f9 (diff) |
split internal.h into files
One day, I could not resist the way it was written. I finally started
to make the code clean. This changeset is the beginning of a series of
housekeeping commits. It is a simple refactoring; split internal.h into
files, so that we can divide and concur in the upcoming commits. No
lines of codes are either added or removed, except the obvious file
headers/footers. The generated binary is identical to the one before.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2711
Diffstat (limited to 'internal/variable.h')
-rw-r--r-- | internal/variable.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/internal/variable.h b/internal/variable.h new file mode 100644 index 0000000000..1de31f6b92 --- /dev/null +++ b/internal/variable.h @@ -0,0 +1,59 @@ +#ifndef INTERNAL_VARIABLE_H /* -*- C -*- */ +#define INTERNAL_VARIABLE_H +/** + * @file + * @brief Internal header for variables. + * @author \@shyouhei + * @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. + */ + +/* global variable */ + +struct rb_global_entry { + struct rb_global_variable *var; + ID id; +}; + +struct rb_global_entry *rb_global_entry(ID); +VALUE rb_gvar_get(struct rb_global_entry *); +VALUE rb_gvar_set(struct rb_global_entry *, VALUE); +VALUE rb_gvar_defined(struct rb_global_entry *); + +/* variable.c */ +#if USE_TRANSIENT_HEAP +#define ROBJECT_TRANSIENT_FLAG FL_USER13 +#define ROBJ_TRANSIENT_P(obj) FL_TEST_RAW((obj), ROBJECT_TRANSIENT_FLAG) +#define ROBJ_TRANSIENT_SET(obj) FL_SET_RAW((obj), ROBJECT_TRANSIENT_FLAG) +#define ROBJ_TRANSIENT_UNSET(obj) FL_UNSET_RAW((obj), ROBJECT_TRANSIENT_FLAG) +#else +#define ROBJ_TRANSIENT_P(obj) 0 +#define ROBJ_TRANSIENT_SET(obj) ((void)0) +#define ROBJ_TRANSIENT_UNSET(obj) ((void)0) +#endif +void rb_gc_mark_global_tbl(void); +size_t rb_generic_ivar_memsize(VALUE); +VALUE rb_search_class_path(VALUE); +VALUE rb_attr_delete(VALUE, ID); +VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef); +void rb_autoload_str(VALUE mod, ID id, VALUE file); +VALUE rb_autoload_at_p(VALUE, ID, int); +void rb_deprecate_constant(VALUE mod, const char *name); +NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE)); +rb_gvar_getter_t *rb_gvar_getter_function_of(const struct rb_global_entry *); +rb_gvar_setter_t *rb_gvar_setter_function_of(const struct rb_global_entry *); +bool rb_gvar_is_traced(const struct rb_global_entry *); +void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_); + +RUBY_SYMBOL_EXPORT_BEGIN +/* variable.c (export) */ +void rb_mark_generic_ivar(VALUE); +void rb_mv_generic_ivar(VALUE src, VALUE dst); +VALUE rb_const_missing(VALUE klass, VALUE name); +int rb_class_ivar_set(VALUE klass, ID vid, VALUE value); +void rb_iv_tbl_copy(VALUE dst, VALUE src); +RUBY_SYMBOL_EXPORT_END + +#endif /* INTERNAL_VARIABLE_H */ |