2020-04-10 08:11:40 +03:00
|
|
|
#ifndef INTERNAL_VARIABLE_H /*-*-C-*-vi:se ft=c:*/
|
|
|
|
#define INTERNAL_VARIABLE_H
|
|
|
|
/**
|
2020-04-08 07:28:13 +03:00
|
|
|
* @author Ruby developers <ruby-core@ruby-lang.org>
|
2019-11-29 09:18:34 +03: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 07:28:13 +03:00
|
|
|
* @brief Internal header for variables.
|
2019-11-29 09:18:34 +03:00
|
|
|
*/
|
2020-05-08 12:31:09 +03:00
|
|
|
#include "ruby/internal/config.h"
|
2019-12-03 09:11:09 +03:00
|
|
|
#include <stddef.h> /* for size_t */
|
|
|
|
#include "constant.h" /* for rb_const_entry_t */
|
2020-05-08 12:31:09 +03:00
|
|
|
#include "ruby/internal/stdbool.h" /* for bool */
|
2019-12-03 09:11:09 +03:00
|
|
|
#include "ruby/ruby.h" /* for VALUE */
|
2022-11-08 23:35:31 +03:00
|
|
|
#include "shape.h" /* for rb_shape_t */
|
2019-12-03 09:11:09 +03:00
|
|
|
|
2019-11-29 09:18:34 +03:00
|
|
|
/* variable.c */
|
|
|
|
void rb_gc_mark_global_tbl(void);
|
2020-05-07 20:07:57 +03:00
|
|
|
void rb_gc_update_global_tbl(void);
|
2019-11-29 09:18:34 +03:00
|
|
|
size_t rb_generic_ivar_memsize(VALUE);
|
|
|
|
VALUE rb_search_class_path(VALUE);
|
|
|
|
VALUE rb_attr_delete(VALUE, ID);
|
|
|
|
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 10:56:44 +03:00
|
|
|
rb_gvar_getter_t *rb_gvar_getter_function_of(ID);
|
|
|
|
rb_gvar_setter_t *rb_gvar_setter_function_of(ID);
|
2019-11-29 09:18:34 +03:00
|
|
|
void rb_gvar_readonly_setter(VALUE v, ID id, VALUE *_);
|
2020-03-09 20:22:11 +03:00
|
|
|
void rb_gvar_ractor_local(const char *name);
|
2019-11-29 09:18:34 +03:00
|
|
|
|
2023-06-21 10:49:51 +03:00
|
|
|
/**
|
|
|
|
* Sets the name of a module.
|
|
|
|
*
|
|
|
|
* Non-permanently named classes can have a temporary name assigned (or
|
|
|
|
* cleared). In that case the name will be used for `#inspect` and `#to_s`, and
|
|
|
|
* nested classes/modules will be named with the temporary name as a prefix.
|
|
|
|
*
|
|
|
|
* After the module is assigned to a constant, the temporary name will be
|
|
|
|
* discarded, and the name will be computed based on the nesting.
|
|
|
|
*
|
|
|
|
* @param[in] mod An instance of ::rb_cModule.
|
|
|
|
* @param[in] name An instance of ::rb_cString.
|
|
|
|
* @retval mod
|
|
|
|
*/
|
|
|
|
VALUE rb_mod_set_temporary_name(VALUE, VALUE);
|
|
|
|
|
2022-10-03 18:14:32 +03:00
|
|
|
struct gen_ivtbl;
|
|
|
|
int rb_gen_ivtbl_get(VALUE obj, ID id, struct gen_ivtbl **ivtbl);
|
2022-12-09 01:16:52 +03:00
|
|
|
int rb_obj_evacuate_ivs_to_hash_table(ID key, VALUE val, st_data_t arg);
|
2022-10-03 18:14:32 +03:00
|
|
|
|
2019-11-29 09:18:34 +03:00
|
|
|
RUBY_SYMBOL_EXPORT_BEGIN
|
|
|
|
/* variable.c (export) */
|
2022-10-27 12:47:47 +03:00
|
|
|
void rb_mark_and_update_generic_ivar(VALUE);
|
2019-11-29 09:18:34 +03:00
|
|
|
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
|
|
|
|
|
2022-11-01 00:05:37 +03:00
|
|
|
VALUE rb_ivar_lookup(VALUE obj, ID id, VALUE undef);
|
2020-07-03 10:56:44 +03:00
|
|
|
VALUE rb_gvar_get(ID);
|
|
|
|
VALUE rb_gvar_set(ID, VALUE);
|
|
|
|
VALUE rb_gvar_defined(ID);
|
2019-12-03 09:11:09 +03:00
|
|
|
void rb_const_warn_if_deprecated(const rb_const_entry_t *, VALUE, ID);
|
2022-11-08 23:35:31 +03:00
|
|
|
rb_shape_t * rb_grow_iv_list(VALUE obj);
|
2022-10-03 18:14:32 +03:00
|
|
|
void rb_ensure_iv_list_size(VALUE obj, uint32_t len, uint32_t newsize);
|
2023-02-28 22:59:33 +03:00
|
|
|
struct gen_ivtbl *rb_ensure_generic_iv_list_size(VALUE obj, rb_shape_t *shape, uint32_t newsize);
|
2022-11-15 18:52:39 +03:00
|
|
|
attr_index_t rb_obj_ivar_set(VALUE obj, ID id, VALUE val);
|
2019-12-03 09:11:09 +03:00
|
|
|
|
2019-11-29 09:18:34 +03:00
|
|
|
#endif /* INTERNAL_VARIABLE_H */
|