Ruby: include/ruby/internal/newobj.h File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Macros | Functions
newobj.h File Reference

Defines NEWOBJ. More...

`#include "ruby/internal/cast.h"`
`#include "ruby/internal/core/rbasic.h"`
`#include "ruby/internal/dllexport.h"`
`#include "ruby/internal/fl_type.h"`
`#include "ruby/internal/special_consts.h"`
`#include "ruby/internal/value.h"`
`#include "ruby/assert.h"`

Go to the source code of this file.

## Macros
#define | RB_NEWOBJ(obj, type) type *(obj) = RBIMPL_CAST((type *)rb_newobj())
#define | RB_NEWOBJ_OF(obj, type, klass, flags) type *(obj) = RBIMPL_CAST((type *)rb_newobj_of(klass, flags))
#define | NEWOBJ RB_NEWOBJ
#define | NEWOBJ_OF RB_NEWOBJ_OF /* core has special NEWOBJ_OF() in internal.h */
#define | OBJSETUP rb_obj_setup /* use NEWOBJ_OF instead of NEWOBJ()+OBJSETUP() */
#define | CLONESETUP rb_clone_setup
#define | DUPSETUP rb_dup_setup

## Functions
VALUE | rb_newobj (void)
VALUE | rb_newobj_of (VALUE, VALUE)
VALUE | rb_obj_setup (VALUE obj, VALUE klass, VALUE type)
| Fills common (`RBasic`) fields in obj. More...
VALUE | rb_obj_class (VALUE)
VALUE | rb_singleton_class_clone (VALUE)
void | rb_singleton_class_attached (VALUE, VALUE)
| Attach a object to a singleton class. More...
void | rb_copy_generic_ivar (VALUE, VALUE)

## Detailed Description

Defines NEWOBJ.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.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.

Definition in file newobj.h.

## Macro Definition Documentation

## ◆ CLONESETUP

#define CLONESETUP rb_clone_setup

Definition at line 37 of file newobj.h.

## ◆ DUPSETUP

#define DUPSETUP rb_dup_setup

Definition at line 38 of file newobj.h.

## ◆ NEWOBJ

#define NEWOBJ RB_NEWOBJ

Definition at line 34 of file newobj.h.

## ◆ NEWOBJ_OF

#define NEWOBJ_OF RB_NEWOBJ_OF /* core has special NEWOBJ_OF() in internal.h */

Definition at line 35 of file newobj.h.

## ◆ OBJSETUP

#define OBJSETUP rb_obj_setup /* use NEWOBJ_OF instead of NEWOBJ()+OBJSETUP() */

Definition at line 36 of file newobj.h.

## ◆ RB_NEWOBJ

#define RB_NEWOBJ | ( |  | obj,
|  |  | type
| ) |  | type *(obj) = RBIMPL_CAST((type *)rb_newobj())

Definition at line 31 of file newobj.h.

## ◆ RB_NEWOBJ_OF

#define RB_NEWOBJ_OF | ( |  | obj,
|  |  | type,
|  |  | klass,
|  |  | flags
| ) |  | type *(obj) = RBIMPL_CAST((type *)rb_newobj_of(klass, flags))

Definition at line 32 of file newobj.h.

## Function Documentation

## ◆ rb_copy_generic_ivar()

void rb_copy_generic_ivar | ( | VALUE | clone,
|  | VALUE | obj
| ) |  |

Definition at line 1638 of file variable.c.

## ◆ rb_newobj()

VALUE rb_newobj | ( | void |  | ) |

Definition at line 2365 of file gc.c.

References FALSE, and T_NONE.

## ◆ rb_newobj_of()

VALUE rb_newobj_of | ( | VALUE | klass,
|  | VALUE | flags
| ) |  |

Definition at line 2371 of file gc.c.

References FL_WB_PROTECTED, heap_page::flags, Qundef, ROBJECT_EMBED, RUBY_T_MASK, and T_OBJECT.