2020-04-10 01:11:40 -04:00
|
|
|
#ifndef INTERNAL_VARIABLE_H /*-*-C-*-vi:se ft=c:*/
|
|
|
|
#define INTERNAL_VARIABLE_H
|
|
|
|
/**
|
2019-11-29 01:18:34 -05:00
|
|
|
* @file
|
2020-04-08 00:28:13 -04:00
|
|
|
* @author Ruby developers <ruby-core@ruby-lang.org>
|
2019-11-29 01:18:34 -05:00
|
|
|
* @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.
|
2020-04-08 00:28:13 -04:00
|
|
|
* @brief Internal header for variables.
|
2019-11-29 01:18:34 -05:00
|
|
|
*/
|
2020-05-08 05:31:09 -04:00
|
|
|
#include "ruby/internal/config.h"
|
2019-12-03 01:11:09 -05:00
|
|
|
#include <stddef.h> /* for size_t */
|
|
|
|
#include "constant.h" /* for rb_const_entry_t */
|
2020-05-08 05:31:09 -04:00
|
|
|
#include "ruby/internal/stdbool.h" /* for bool */
|
2019-12-03 01:11:09 -05:00
|
|
|
#include "ruby/ruby.h" /* for VALUE */
|
|
|
|
|
2019-11-29 01:18:34 -05:00
|
|
|
/* global variable */
|
|
|
|
|
2019-12-03 01:11:09 -05:00
|
|
|
#define ROBJECT_TRANSIENT_FLAG FL_USER13
|
|
|
|
|
2019-11-29 01:18:34 -05:00
|
|
|
/* variable.c */
|
|
|
|
void rb_gc_mark_global_tbl(void);
|
2020-05-07 13:07:57 -04:00
|
|
|
void rb_gc_update_global_tbl(void);
|
2019-11-29 01:18:34 -05:00
|
|
|
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);
|
|
|
|
NORETURN(VALUE rb_mod_const_missing(VALUE,VALUE));
|
2020-07-03 03:56:44 -04:00
|
|
|
rb_gvar_getter_t *rb_gvar_getter_function_of(ID);
|
|
|
|
rb_gvar_setter_t *rb_gvar_setter_function_of(ID);
|
2019-11-29 01:18:34 -05:00
|
|
|
void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_);
|
2019-12-03 01:11:09 -05:00
|
|
|
static inline bool ROBJ_TRANSIENT_P(VALUE obj);
|
|
|
|
static inline void ROBJ_TRANSIENT_SET(VALUE obj);
|
|
|
|
static inline void ROBJ_TRANSIENT_UNSET(VALUE obj);
|
2019-11-29 01:18:34 -05:00
|
|
|
|
|
|
|
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);
|
2020-04-02 09:53:26 -04:00
|
|
|
void rb_deprecate_constant(VALUE mod, const char *name);
|
2019-11-29 01:18:34 -05:00
|
|
|
RUBY_SYMBOL_EXPORT_END
|
|
|
|
|
2019-12-03 01:11:09 -05:00
|
|
|
MJIT_SYMBOL_EXPORT_BEGIN
|
2020-07-03 03:56:44 -04:00
|
|
|
VALUE rb_gvar_get(ID);
|
|
|
|
VALUE rb_gvar_set(ID, VALUE);
|
|
|
|
VALUE rb_gvar_defined(ID);
|
2019-12-03 01:11:09 -05:00
|
|
|
void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
|
|
|
|
MJIT_SYMBOL_EXPORT_END
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
ROBJ_TRANSIENT_P(VALUE obj)
|
|
|
|
{
|
|
|
|
#if USE_TRANSIENT_HEAP
|
|
|
|
return FL_TEST_RAW(obj, ROBJECT_TRANSIENT_FLAG);
|
|
|
|
#else
|
|
|
|
return false;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
ROBJ_TRANSIENT_SET(VALUE obj)
|
|
|
|
{
|
|
|
|
#if USE_TRANSIENT_HEAP
|
|
|
|
FL_SET_RAW(obj, ROBJECT_TRANSIENT_FLAG);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
ROBJ_TRANSIENT_UNSET(VALUE obj)
|
|
|
|
{
|
|
|
|
#if USE_TRANSIENT_HEAP
|
|
|
|
FL_UNSET_RAW(obj, ROBJECT_TRANSIENT_FLAG);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2019-11-29 01:18:34 -05:00
|
|
|
#endif /* INTERNAL_VARIABLE_H */
|