Ruby: constant.h File Reference

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

Data Structures | Macros | Typedefs | Enumerations | Functions
constant.h File Reference
`#include "ruby/ruby.h"`
`#include "id_table.h"`

Go to the source code of this file.

## Data Structures
struct | rb_const_entry_struct

## Macros
#define | RB_CONST_PRIVATE_P(ce) (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PRIVATE)
#define | RB_CONST_PUBLIC_P(ce) (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PUBLIC)
#define | RB_CONST_DEPRECATED_P(ce) ((ce)->flag & CONST_DEPRECATED)

## Typedefs
typedef struct rb_const_entry_struct | rb_const_entry_t

## Enumerations
enum | rb_const_flag_t { CONST_DEPRECATED = 0x100 , CONST_VISIBILITY_MASK = 0xff , CONST_PUBLIC = 0x00 , CONST_PRIVATE , CONST_VISIBILITY_MAX }

## Functions
VALUE | rb_mod_private_constant (int argc, const VALUE *argv, VALUE obj)
VALUE | rb_mod_public_constant (int argc, const VALUE *argv, VALUE obj)
VALUE | rb_mod_deprecate_constant (int argc, const VALUE *argv, VALUE obj)
void | rb_free_const_table (struct rb_id_table *tbl)
VALUE | rb_const_source_location (VALUE, ID)
int | rb_autoloading_value (VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag)
rb_const_entry_t * | rb_const_lookup (VALUE klass, ID id)
VALUE | rb_public_const_get_at (VALUE klass, ID id)
VALUE | rb_public_const_get_from (VALUE klass, ID id)
int | rb_public_const_defined_from (VALUE klass, ID id)
VALUE | rb_const_source_location_at (VALUE, ID)

## Macro Definition Documentation

## ◆ RB_CONST_DEPRECATED_P

#define RB_CONST_DEPRECATED_P | ( |  | ce | ) | ((ce)->flag & CONST_DEPRECATED)

Definition at line 30 of file constant.h.

## ◆ RB_CONST_PRIVATE_P

#define RB_CONST_PRIVATE_P | ( |  | ce | ) | (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PRIVATE)

Definition at line 25 of file constant.h.

## ◆ RB_CONST_PUBLIC_P

#define RB_CONST_PUBLIC_P | ( |  | ce | ) | (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PUBLIC)

Definition at line 27 of file constant.h.

## Typedef Documentation

## ◆ rb_const_entry_t

typedef struct rb_const_entry_struct rb_const_entry_t

## Enumeration Type Documentation

## ◆ rb_const_flag_t

enum rb_const_flag_t

Enumerator
CONST_DEPRECATED |
CONST_VISIBILITY_MASK |
CONST_PUBLIC |
CONST_PRIVATE |
CONST_VISIBILITY_MAX |

Definition at line 16 of file constant.h.

## Function Documentation

## ◆ rb_autoloading_value()

int rb_autoloading_value | ( | VALUE | mod,
|  | ID | id,
|  | VALUE * | value,
|  | rb_const_flag_t * | flag
| ) |  |

Definition at line 2299 of file variable.c.

References FALSE, autoload_const::flag, mod, TRUE, and autoload_const::value.

## ◆ rb_const_lookup()

rb_const_entry_t * rb_const_lookup | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 3614 of file variable.c.

References NULL, rb_id_table_lookup(), RB_VM_LOCK_ENTER, RB_VM_LOCK_LEAVE, and RCLASS_CONST_TBL.

Referenced by rb_autoload_load(), rb_autoload_str(), rb_const_remove(), and rb_deprecate_constant().

## ◆ rb_const_source_location()

VALUE rb_const_source_location | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2694 of file variable.c.

References FALSE, and TRUE.

## ◆ rb_const_source_location_at()

VALUE rb_const_source_location_at | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2700 of file variable.c.

References FALSE, and TRUE.

## ◆ rb_free_const_table()

void rb_free_const_table | ( | struct rb_id_table * | tbl | ) |

Definition at line 2595 of file gc.c.

References rb_id_table_foreach_values(), and rb_id_table_free().

## ◆ rb_mod_deprecate_constant()

VALUE rb_mod_deprecate_constant | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | obj
| ) |  |

Definition at line 3281 of file variable.c.

References argc, argv, and CONST_DEPRECATED.

## ◆ rb_mod_private_constant()

VALUE rb_mod_private_constant | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | obj
| ) |  |

Definition at line 3241 of file variable.c.

References argc, argv, CONST_PRIVATE, and CONST_VISIBILITY_MASK.

## ◆ rb_mod_public_constant()

VALUE rb_mod_public_constant | ( | int | argc,
|  | const VALUE * | argv,
|  | VALUE | obj
| ) |  |

Definition at line 3255 of file variable.c.

References argc, argv, CONST_PUBLIC, and CONST_VISIBILITY_MASK.

## ◆ rb_public_const_defined_from()

int rb_public_const_defined_from | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2940 of file variable.c.

References TRUE.

## ◆ rb_public_const_get_at()

VALUE rb_public_const_get_at | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2642 of file variable.c.

References FALSE, and TRUE.

## ◆ rb_public_const_get_from()

VALUE rb_public_const_get_from | ( | VALUE | klass,
|  | ID | id
| ) |  |

Definition at line 2636 of file variable.c.

References TRUE.