Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

constant.h
Go to the documentation of this file.
1 /**********************************************************************
2
3 constant.h -
4
5 $Author$
6 created at: Sun Nov 15 00:09:33 2009
7
8 Copyright (C) 2009 Yusuke Endoh
9
10 **********************************************************************/
11 #ifndef CONSTANT_H
12 #define CONSTANT_H
13
14 typedef enum {
15 CONST_DEPRECATED = 0x100,
16
17 CONST_VISIBILITY_MASK = 0xff,
18 CONST_PUBLIC = 0x00,
19 CONST_PRIVATE,
20 CONST_VISIBILITY_MAX
21 } rb_const_flag_t;
22
23 #define RB_CONST_PRIVATE_P(ce) \
24 (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PRIVATE)
25 #define RB_CONST_PUBLIC_P(ce) \
26 (((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PUBLIC)
27
28 #define RB_CONST_DEPRECATED_P(ce) \
29 ((ce)->flag & CONST_DEPRECATED)
30
31 typedef struct rb_const_entry_struct {
32 rb_const_flag_t flag;
33 int line;
34 VALUE value; /* should be mark */
35 VALUE file; /* should be mark */
36 } rb_const_entry_t;
37
38 VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj);
39 VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj);
40 VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj);
41 void rb_free_const_table(struct rb_id_table *tbl);
42 VALUE rb_public_const_get_at(VALUE klass, ID id);
43 VALUE rb_public_const_get_from(VALUE klass, ID id);
44 int rb_public_const_defined_from(VALUE klass, ID id);
45 rb_const_entry_t *rb_const_lookup(VALUE klass, ID id);
46 int rb_autoloading_value(VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag);
47 VALUE rb_const_source_location(VALUE, ID);
48 VALUE rb_const_source_location_at(VALUE, ID);
49
50 #endif /* CONSTANT_H */
ID
unsigned long ID
Definition: ruby.h:103
CONST_PUBLIC
@ CONST_PUBLIC
Definition: constant.h:27
rb_const_source_location_at
VALUE rb_const_source_location_at(VALUE, ID)
Definition: variable.c:2463
rb_const_entry_struct::line
int line
Definition: constant.h:33
VALUE
unsigned long VALUE
Definition: ruby.h:102
rb_const_entry_struct::value
VALUE value
Definition: constant.h:34
rb_free_const_table
void rb_free_const_table(struct rb_id_table *tbl)
Definition: gc.c:2491
rb_const_flag_t
rb_const_flag_t
Definition: constant.h:14
rb_id_table
Definition: id_table.c:40
rb_autoloading_value
int rb_autoloading_value(VALUE mod, ID id, VALUE *value, rb_const_flag_t *flag)
Definition: variable.c:2074
rb_const_entry_struct::flag
rb_const_flag_t flag
Definition: constant.h:32
CONST_VISIBILITY_MAX
@ CONST_VISIBILITY_MAX
Definition: constant.h:29
CONST_PRIVATE
@ CONST_PRIVATE
Definition: constant.h:28
obj
const VALUE VALUE obj
Definition: rb_mjit_min_header-2.7.0.h:5742
rb_public_const_get_from
VALUE rb_public_const_get_from(VALUE klass, ID id)
Definition: variable.c:2399
mod
#define mod(x, y)
Definition: date_strftime.c:28
rb_const_source_location
VALUE rb_const_source_location(VALUE, ID)
Definition: variable.c:2457
argv
char ** argv
Definition: ruby.c:223
klass
VALUE klass
Definition: rb_mjit_min_header-2.7.0.h:13254
argc
int argc
Definition: ruby.c:222
rb_const_entry_t
struct rb_const_entry_struct rb_const_entry_t
rb_const_lookup
rb_const_entry_t * rb_const_lookup(VALUE klass, ID id)
Definition: variable.c:3341
rb_mod_deprecate_constant
VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj)
Definition: variable.c:3011
rb_const_entry_struct::file
VALUE file
Definition: constant.h:35
CONST_VISIBILITY_MASK
@ CONST_VISIBILITY_MASK
Definition: constant.h:26
rb_mod_private_constant
VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj)
Definition: variable.c:2971
CONST_DEPRECATED
@ CONST_DEPRECATED
Definition: constant.h:24
rb_public_const_get_at
VALUE rb_public_const_get_at(VALUE klass, ID id)
Definition: variable.c:2405
rb_const_entry_struct
Definition: constant.h:31
rb_mod_public_constant
VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj)
Definition: variable.c:2985
rb_public_const_defined_from
int rb_public_const_defined_from(VALUE klass, ID id)
Definition: variable.c:2694