2010-10-26 21:27:32 +04:00
|
|
|
/**********************************************************************
|
|
|
|
|
|
|
|
constant.h -
|
|
|
|
|
|
|
|
$Author$
|
|
|
|
created at: Sun Nov 15 00:09:33 2009
|
|
|
|
|
|
|
|
Copyright (C) 2009 Yusuke Endoh
|
|
|
|
|
|
|
|
**********************************************************************/
|
|
|
|
#ifndef CONSTANT_H
|
|
|
|
#define CONSTANT_H
|
|
|
|
|
|
|
|
typedef enum {
|
2015-07-30 07:20:00 +03:00
|
|
|
CONST_DEPRECATED = 0x100,
|
|
|
|
|
|
|
|
CONST_VISIBILITY_MASK = 0xff,
|
2010-10-26 21:27:32 +04:00
|
|
|
CONST_PUBLIC = 0x00,
|
2014-10-08 12:27:51 +04:00
|
|
|
CONST_PRIVATE,
|
|
|
|
CONST_VISIBILITY_MAX
|
2010-10-26 21:27:32 +04:00
|
|
|
} rb_const_flag_t;
|
|
|
|
|
2014-10-08 12:27:51 +04:00
|
|
|
#define RB_CONST_PRIVATE_P(ce) \
|
2015-07-30 07:20:00 +03:00
|
|
|
(((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PRIVATE)
|
2014-10-08 12:27:51 +04:00
|
|
|
#define RB_CONST_PUBLIC_P(ce) \
|
2015-07-30 07:20:00 +03:00
|
|
|
(((ce)->flag & CONST_VISIBILITY_MASK) == CONST_PUBLIC)
|
|
|
|
|
|
|
|
#define RB_CONST_DEPRECATED_P(ce) \
|
|
|
|
((ce)->flag & CONST_DEPRECATED)
|
2014-10-08 12:27:51 +04:00
|
|
|
|
2010-10-26 21:27:32 +04:00
|
|
|
typedef struct rb_const_entry_struct {
|
|
|
|
rb_const_flag_t flag;
|
2014-02-07 00:33:03 +04:00
|
|
|
int line;
|
2013-06-14 13:23:54 +04:00
|
|
|
const VALUE value; /* should be mark */
|
|
|
|
const VALUE file; /* should be mark */
|
2010-10-26 21:27:32 +04:00
|
|
|
} rb_const_entry_t;
|
|
|
|
|
2014-06-18 10:16:39 +04:00
|
|
|
VALUE rb_mod_private_constant(int argc, const VALUE *argv, VALUE obj);
|
|
|
|
VALUE rb_mod_public_constant(int argc, const VALUE *argv, VALUE obj);
|
2015-07-30 07:20:00 +03:00
|
|
|
VALUE rb_mod_deprecate_constant(int argc, const VALUE *argv, VALUE obj);
|
2010-10-26 21:27:32 +04:00
|
|
|
void rb_free_const_table(st_table *tbl);
|
2011-01-28 20:57:27 +03:00
|
|
|
VALUE rb_public_const_get(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(VALUE klass, ID id);
|
|
|
|
int rb_public_const_defined_at(VALUE klass, ID id);
|
|
|
|
int rb_public_const_defined_from(VALUE klass, ID id);
|
2014-08-04 05:12:53 +04:00
|
|
|
rb_const_entry_t *rb_const_lookup(VALUE klass, ID id);
|
2010-10-26 21:27:32 +04:00
|
|
|
|
|
|
|
#endif /* CONSTANT_H */
|