REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 5.38 KB
Close
//proc/thread-self/root/opt/alt/ruby32/include/ruby/internal/core/rbasic.h
Text
Base64
#ifndef RBIMPL_RBASIC_H /*-*-C++-*-vi:se ft=cpp:*/ #define RBIMPL_RBASIC_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 Defines struct ::RBasic. */ #include "ruby/internal/attr/artificial.h" #include "ruby/internal/attr/constexpr.h" #include "ruby/internal/attr/forceinline.h" #include "ruby/internal/attr/noalias.h" #include "ruby/internal/attr/pure.h" #include "ruby/internal/cast.h" #include "ruby/internal/dllexport.h" #include "ruby/internal/special_consts.h" #include "ruby/internal/value.h" #include "ruby/assert.h" /** * Convenient casting macro. * * @param obj Arbitrary Ruby object. * @return The passed object casted to ::RBasic. */ #define RBASIC(obj) RBIMPL_CAST((struct RBasic *)(obj)) /** @cond INTERNAL_MACRO */ #define RBASIC_CLASS RBASIC_CLASS #define RBIMPL_RVALUE_EMBED_LEN_MAX 3 #define RVALUE_EMBED_LEN_MAX RVALUE_EMBED_LEN_MAX #define RBIMPL_EMBED_LEN_MAX_OF(T) \ RBIMPL_CAST((int)(sizeof(VALUE[RBIMPL_RVALUE_EMBED_LEN_MAX]) / (sizeof(T)))) /** @endcond */ /** * This is an enum because GDB wants it (rather than a macro). People need not * bother. */ enum ruby_rvalue_flags { /** Max possible number of objects that can be embedded. */ RVALUE_EMBED_LEN_MAX = RBIMPL_RVALUE_EMBED_LEN_MAX }; /** * Ruby's object's, base components. Every single ruby objects have them in * common. */ struct RUBY_ALIGNAS(SIZEOF_VALUE) RBasic { /** * Per-object flags. Each ruby objects have their own characteristics * apart from their classes. For instance whether an object is frozen or * not is not controlled by its class. This is where such properties are * stored. * * @see enum ::ruby_fl_type * * @note This is ::VALUE rather than an enum for alignment purpose. Back * in the 1990s there were no such thing like `_Alignas` in C. */ VALUE flags; /** * Class of an object. Every object has its class. Also, everything is an * object in Ruby. This means classes are also objects. Classes have * their own classes, classes of classes have their classes, too ... and * it recursively continues forever. * * Also note the `const` qualifier. In ruby an object cannot "change" its * class. */ const VALUE klass; #ifdef __cplusplus public: RBIMPL_ATTR_CONSTEXPR(CXX11) RBIMPL_ATTR_ARTIFICIAL() RBIMPL_ATTR_FORCEINLINE() RBIMPL_ATTR_NOALIAS() /** * We need to define this explicit constructor because the field `klass` is * const-qualified above, which effectively defines the implicit default * constructor as "deleted" (as of C++11) -- No way but to define one by * ourselves. */ RBasic() : flags(RBIMPL_VALUE_NULL), klass(RBIMPL_VALUE_NULL) { } # define RBASIC_INIT RBasic() #else # define RBASIC_INIT {RBIMPL_VALUE_NULL} #endif }; RBIMPL_SYMBOL_EXPORT_BEGIN() /** * Make the object invisible from Ruby code. * * It is useful to let Ruby's GC manage your internal data structure -- The * object keeps being managed by GC, but `ObjectSpace.each_object` never yields * the object. * * Note that the object also lose a way to call a method on it. * * @param[out] obj A Ruby object. * @return The passed object. * @post The object is destructively modified to be invisible. * @see rb_obj_reveal */ VALUE rb_obj_hide(VALUE obj); /** * Make a hidden object visible again. * * It is the caller's responsibility to pass the right `klass` which `obj` * originally used to belong to. * * @param[out] obj A Ruby object. * @param[in] klass Class of `obj`. * @return Passed `obj`. * @pre `obj` was previously hidden. * @post `obj`'s class is `klass`. * @see rb_obj_hide */ VALUE rb_obj_reveal(VALUE obj, VALUE klass); /* do not use this API to change klass information */ RBIMPL_SYMBOL_EXPORT_END() RBIMPL_ATTR_PURE_UNLESS_DEBUG() RBIMPL_ATTR_ARTIFICIAL() /** * Queries the class of an object. * * @param[in] obj An object. * @return Its class. */ static inline VALUE RBASIC_CLASS(VALUE obj) { RBIMPL_ASSERT_OR_ASSUME(! RB_SPECIAL_CONST_P(obj)); return RBASIC(obj)->klass; } #endif /* RBIMPL_RBASIC_H */
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 13
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
rarray.h
17.94 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rbasic.h
5.38 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rbignum.h
2.88 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rclass.h
3.45 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rdata.h
13.87 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rfile.h
2.09 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rhash.h
4.80 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rmatch.h
5.31 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
robject.h
5.86 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rregexp.h
5.50 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rstring.h
19.53 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rstruct.h
4.10 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
rtypeddata.h
21.80 KB
lrw-r--r--
2026-04-07 14:12:49
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).