X7ROOT File Manager
Current Path:
/opt/alt/ruby31/include/ruby/internal
opt
/
alt
/
ruby31
/
include
/
ruby
/
internal
/
ðŸ“
..
📄
anyargs.h
(36.23 KB)
ðŸ“
arithmetic
📄
arithmetic.h
(2.05 KB)
📄
assume.h
(3.26 KB)
ðŸ“
attr
📄
cast.h
(2.28 KB)
ðŸ“
compiler_is
📄
compiler_is.h
(2.06 KB)
📄
compiler_since.h
(2.72 KB)
📄
config.h
(4.71 KB)
📄
constant_p.h
(1.85 KB)
ðŸ“
core
📄
core.h
(1.83 KB)
📄
ctype.h
(22.56 KB)
📄
dllexport.h
(4.05 KB)
📄
dosish.h
(3.16 KB)
ðŸ“
encoding
📄
error.h
(20.24 KB)
📄
eval.h
(16.81 KB)
📄
event.h
(6.08 KB)
📄
fl_type.h
(34.55 KB)
📄
gc.h
(2.25 KB)
📄
glob.h
(4.98 KB)
📄
globals.h
(9.77 KB)
ðŸ“
has
ðŸ“
intern
📄
interpreter.h
(9.46 KB)
📄
iterator.h
(18.19 KB)
📄
memory.h
(23.13 KB)
📄
method.h
(7.08 KB)
📄
module.h
(7.07 KB)
📄
newobj.h
(7.65 KB)
📄
rgengc.h
(13.2 KB)
📄
scan_args.h
(18.48 KB)
📄
special_consts.h
(10.08 KB)
📄
static_assert.h
(3.14 KB)
📄
stdalign.h
(4.58 KB)
📄
stdbool.h
(1.99 KB)
📄
symbol.h
(12.78 KB)
📄
value.h
(4.26 KB)
📄
value_type.h
(14.12 KB)
📄
variable.h
(11.81 KB)
📄
warning_push.h
(4.91 KB)
📄
xmalloc.h
(17.08 KB)
Editing: variable.h
#ifndef RBIMPL_VARIABLE_H /*-*-C++-*-vi:se ft=cpp:*/ #define RBIMPL_VARIABLE_H /** * @file * @author Ruby developers <ruby-core@ruby-lang.org> * @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. * @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are * implementation details. Don't take them as canon. They could * rapidly appear then vanish. The name (path) of this header file * is also an implementation detail. Do not expect it to persist * at the place it is now. Developers are free to move it anywhere * anytime at will. * @note To ruby-core: remember that this header can be possibly * recursively included from extension libraries written in C++. * Do not expect for instance `__VA_ARGS__` is always available. * We assume C99 for ruby itself but we don't assume languages of * extension libraries. They could be written in C++98. * @brief Declares rb_define_variable(). */ #include "ruby/internal/dllexport.h" #include "ruby/internal/value.h" #include "ruby/internal/attr/nonnull.h" #include "ruby/internal/attr/noreturn.h" RBIMPL_SYMBOL_EXPORT_BEGIN() /** * Type that represents a global variable getter function. * * @param[in] id The variable name. * @param[in,out] data Where the value is stored. * @return The value that shall be visible from Ruby. */ typedef VALUE rb_gvar_getter_t(ID id, VALUE *data); /** * Type that represents a global variable setter function. * * @param[in] val The value to set. * @param[in] id The variable name. * @param[in,out] data Where the value is to be stored. */ typedef void rb_gvar_setter_t(VALUE val, ID id, VALUE *data); /** * Type that represents a global variable marker function. * * @param[in] var Where the value is to be stored. */ typedef void rb_gvar_marker_t(VALUE *var); /** * @deprecated * * This function has no actual usage (than in ruby itself). Please ignore. It * was a bad idea to expose this function to 3rd parties, but we can no longer * delete it. */ rb_gvar_getter_t rb_gvar_undef_getter; /** * @deprecated * * This function has no actual usage (than in ruby itself). Please ignore. It * was a bad idea to expose this function to 3rd parties, but we can no longer * delete it. */ rb_gvar_setter_t rb_gvar_undef_setter; /** * @deprecated * * This function has no actual usage (than in ruby itself). Please ignore. It * was a bad idea to expose this function to 3rd parties, but we can no longer * delete it. */ rb_gvar_marker_t rb_gvar_undef_marker; /** * This is the getter function that backs global variables defined from a ruby * script. Extension libraries can use this if its global variable needs no * custom logic. */ rb_gvar_getter_t rb_gvar_val_getter; /** * This is the setter function that backs global variables defined from a ruby * script. Extension libraries can use this if its global variable needs no * custom logic. */ rb_gvar_setter_t rb_gvar_val_setter; /** * This is the setter function that backs global variables defined from a ruby * script. Extension libraries can use this if its global variable needs no * custom logic. */ rb_gvar_marker_t rb_gvar_val_marker; /** * @deprecated * * This function has no actual usage (than in ruby itself). Please ignore. It * was a bad idea to expose this function to 3rd parties, but we can no longer * delete it. */ rb_gvar_getter_t rb_gvar_var_getter; /** * @deprecated * * This function has no actual usage (than in ruby itself). Please ignore. It * was a bad idea to expose this function to 3rd parties, but we can no longer * delete it. */ rb_gvar_setter_t rb_gvar_var_setter; /** * @deprecated * * This function has no actual usage (than in ruby itself). Please ignore. It * was a bad idea to expose this function to 3rd parties, but we can no longer * delete it. */ rb_gvar_marker_t rb_gvar_var_marker; RBIMPL_ATTR_NORETURN() /** * This function just raises ::rb_eNameError. Handy when you want to prohibit * a global variable from being squashed by someone. */ rb_gvar_setter_t rb_gvar_readonly_setter; RBIMPL_ATTR_NONNULL(()) /** * "Shares" a global variable between Ruby and C. Normally a Ruby-level global * variable is stored somewhere deep inside of the interpreter's execution * context, but this way you can explicitly specify its storage. * * ```CXX * static VALUE foo; * * extern "C" void * init_Foo(void) * { * foo = rb_eval_string("..."); * rb_define_global_variable("$foo", &foo); * } * ``` * * In the above example a Ruby global variable named `$foo` is stored in a C * global variable named `foo`. * * @param[in] name Variable (Ruby side). * @param[in] var Variable (C side). * @post Ruby level global variable named `name` is defined if absent, * and its storage is set to `var`. */ void rb_define_variable(const char *name, VALUE *var); RBIMPL_ATTR_NONNULL((1)) /** * Defines a global variable that is purely function-backended. By using this * API a programmer can define a global variable that dynamically changes from * time to time. * * @param[in] name Variable name, in C's string. * @param[in] getter A getter function. * @param[in] setter A setter function. * @post Ruby level global variable named `name` is defined if absent. * * @internal * * @shyouhei doesn't know if this is an Easter egg or an official feature, but * you can pass 0 to the third argument (setter). That effectively nullifies * any efforts to write to the defining global variable. */ void rb_define_virtual_variable(const char *name, rb_gvar_getter_t *getter, rb_gvar_setter_t *setter); RBIMPL_ATTR_NONNULL((1)) /** * Identical to rb_define_virtual_variable(), but can also specify a storage. * A programmer can use the storage for e.g. memoisation, storing intermediate * computation result, etc. * * Also you can pass 0 to this function, unlike other variants: * * - When getter is 0 ::rb_gvar_var_getter is used instead. * - When setter is 0 ::rb_gvar_var_setter is used instead. * - When data is 0, you must specify a non-zero setter function. Otherwise * ::rb_gvar_var_setter tries to write to `*NULL`, and just causes SEGV. * * @param[in] name Variable name, in C's string. * @param[in] var Variable storage. * @param[in] getter A getter function. * @param[in] setter A setter function. * @post Ruby level global variable named `name` is defined if absent. */ void rb_define_hooked_variable(const char *name, VALUE *var, rb_gvar_getter_t *getter, rb_gvar_setter_t *setter); RBIMPL_ATTR_NONNULL(()) /** * Identical to rb_define_variable(), except it does not allow Ruby programs to * assign values to such global variable. C codes can still set values at * will. This could be handy for you when implementing an `errno`-like * experience, where a method updates a read-only global variable as a side- * effect. * * @param[in] name Variable (Ruby side). * @param[in] var Variable (C side). * @post Ruby level global variable named `name` is defined if absent, * and its storage is set to `var`. */ void rb_define_readonly_variable(const char *name, const VALUE *var); RBIMPL_ATTR_NONNULL(()) /** * Defines a Ruby level constant under a namespace. * * @param[out] klass Namespace for the constant to reside. * @param[in] name Name of the constant. * @param[in] val Value of the constant. * @exception rb_eTypeError `klass` is not a kind of ::rb_cModule. * @exception rb_eFrozenError `klass` is frozen. * @post Ruby level constant `klass::name` is defined to be `val`. * @note This API does not stop you from defining a constant that is * unable to reach from ruby (like for instance passing * non-capital letter to `name`). * @note This API does not stop you from overwriting a constant that * already exist. * * @internal * * Above description is in fact inaccurate. This API interfaces with Ractors. */ void rb_define_const(VALUE klass, const char *name, VALUE val); RBIMPL_ATTR_NONNULL(()) /** * Identical to rb_define_const(), except it defines that of "global", * i.e. toplevel constant. * * @param[in] name Name of the constant. * @param[in] val Value of the constant. * @exception rb_eFrozenError ::rb_cObject is frozen. * @post Ruby level constant \::name is defined to be `val`. * @note This API does not stop you from defining a constant that is * unable to reach from ruby (like for instance passing * non-capital letter to `name`). * @note This API does not stop you from overwriting a constant that * already exist. */ void rb_define_global_const(const char *name, VALUE val); RBIMPL_ATTR_NONNULL(()) /** * Asserts that the given constant is deprecated. Attempt to refer such * constant will produce a warning. * * @param[in] mod Namespace of the target constant. * @param[in] name Name of the constant. * @exception rb_eNameError No such constant. * @exception rb_eFrozenError `mod` is frozen. * @post `name` under `mod` is deprecated. */ void rb_deprecate_constant(VALUE mod, const char *name); RBIMPL_ATTR_NONNULL(()) /** * Assigns to a global variable. * * @param[in] name Target global variable. * @param[in] val Value to assign. * @return Passed value. * @post Ruby level global variable named `name` is defined if absent, * whose value is set to `val`. * * @internal * * Above description is in fact inaccurate. This API interfaces with * `set_trace_func`. */ VALUE rb_gv_set(const char *name, VALUE val); RBIMPL_ATTR_NONNULL(()) /** * Obtains a global variable. * * @param[in] name Global variable to query. * @retval RUBY_Qnil The global variable does not exist. * @retval otherwise The value assigned to the global variable. * * @internal * * Unlike rb_gv_set(), there is no way to trace this function. */ VALUE rb_gv_get(const char *name); RBIMPL_ATTR_NONNULL(()) /** * Obtains an instance variable. * * @param[in] obj Target object. * @param[in] name Target instance variable to query. * @exception rb_eEncodingError `name` is corrupt (contains Hanzi etc.). * @retval RUBY_nil No such instance variable. * @retval otherwise The value assigned to the instance variable. */ VALUE rb_iv_get(VALUE obj, const char *name); RBIMPL_ATTR_NONNULL(()) /** * Assigns to an instance variable. * * @param[out] obj Target object. * @param[in] name Target instance variable. * @param[in] val Value to assign. * @exception rb_eFrozenError Can't modify `obj`. * @exception rb_eArgError `obj` has too many instance variables. * @return Passed value. * @post An instance variable named `name` is defined if absent on * `obj`, whose value is set to `val`. * * @internal * * This function does not stop you form creating an ASCII-incompatible instance * variable, but there is no way to get one because rb_iv_get raises exceptions * for such things. This design seems broken... But no idea why. */ VALUE rb_iv_set(VALUE obj, const char *name, VALUE val); RBIMPL_SYMBOL_EXPORT_END() #endif /* RBIMPL_VARIABLE_H */
Upload File
Create Folder