2020-05-04 02:52:56 -04:00
|
|
|
#ifndef RBIMPL_GLOBALS_H /*-*-C++-*-vi:se ft=cpp:*/
|
|
|
|
#define RBIMPL_GLOBALS_H
|
2020-04-10 01:11:40 -04:00
|
|
|
/**
|
2020-04-08 00:28:13 -04:00
|
|
|
* @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.
|
2020-05-04 03:27:48 -04:00
|
|
|
* @warning Symbols prefixed with either `RBIMPL` or `rbimpl` are
|
2020-04-08 00:28:13 -04:00
|
|
|
* 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 Ruby-level global variables / constants, visible from C.
|
|
|
|
*/
|
2020-05-04 02:35:26 -04:00
|
|
|
#include "ruby/impl/attr/pure.h"
|
|
|
|
#include "ruby/impl/dllexport.h"
|
|
|
|
#include "ruby/impl/fl_type.h"
|
|
|
|
#include "ruby/impl/special_consts.h"
|
|
|
|
#include "ruby/impl/value.h"
|
|
|
|
#include "ruby/impl/value_type.h"
|
2020-04-08 00:28:13 -04:00
|
|
|
|
2020-05-04 02:52:56 -04:00
|
|
|
RBIMPL_SYMBOL_EXPORT_BEGIN()
|
2020-04-08 00:28:13 -04:00
|
|
|
|
|
|
|
#define RUBY_INTEGER_UNIFICATION 1
|
|
|
|
|
|
|
|
RUBY_EXTERN VALUE rb_mKernel;
|
|
|
|
RUBY_EXTERN VALUE rb_mComparable;
|
|
|
|
RUBY_EXTERN VALUE rb_mEnumerable;
|
|
|
|
RUBY_EXTERN VALUE rb_mErrno;
|
|
|
|
RUBY_EXTERN VALUE rb_mFileTest;
|
|
|
|
RUBY_EXTERN VALUE rb_mGC;
|
|
|
|
RUBY_EXTERN VALUE rb_mMath;
|
|
|
|
RUBY_EXTERN VALUE rb_mProcess;
|
|
|
|
RUBY_EXTERN VALUE rb_mWaitReadable;
|
|
|
|
RUBY_EXTERN VALUE rb_mWaitWritable;
|
|
|
|
|
|
|
|
RUBY_EXTERN VALUE rb_cBasicObject;
|
|
|
|
RUBY_EXTERN VALUE rb_cObject;
|
|
|
|
RUBY_EXTERN VALUE rb_cArray;
|
|
|
|
RUBY_EXTERN VALUE rb_cBinding;
|
|
|
|
RUBY_EXTERN VALUE rb_cClass;
|
|
|
|
RUBY_EXTERN VALUE rb_cCont;
|
|
|
|
RUBY_EXTERN VALUE rb_cData;
|
|
|
|
RUBY_EXTERN VALUE rb_cDir;
|
|
|
|
RUBY_EXTERN VALUE rb_cEncoding;
|
|
|
|
RUBY_EXTERN VALUE rb_cEnumerator;
|
|
|
|
RUBY_EXTERN VALUE rb_cFalseClass;
|
|
|
|
RUBY_EXTERN VALUE rb_cFile;
|
|
|
|
RUBY_EXTERN VALUE rb_cComplex;
|
|
|
|
RUBY_EXTERN VALUE rb_cFloat;
|
|
|
|
RUBY_EXTERN VALUE rb_cHash;
|
|
|
|
RUBY_EXTERN VALUE rb_cIO;
|
|
|
|
RUBY_EXTERN VALUE rb_cInteger;
|
|
|
|
RUBY_EXTERN VALUE rb_cMatch;
|
|
|
|
RUBY_EXTERN VALUE rb_cMethod;
|
|
|
|
RUBY_EXTERN VALUE rb_cModule;
|
|
|
|
RUBY_EXTERN VALUE rb_cNameErrorMesg;
|
|
|
|
RUBY_EXTERN VALUE rb_cNilClass;
|
|
|
|
RUBY_EXTERN VALUE rb_cNumeric;
|
|
|
|
RUBY_EXTERN VALUE rb_cProc;
|
|
|
|
RUBY_EXTERN VALUE rb_cRandom;
|
|
|
|
RUBY_EXTERN VALUE rb_cRange;
|
|
|
|
RUBY_EXTERN VALUE rb_cRational;
|
|
|
|
RUBY_EXTERN VALUE rb_cRegexp;
|
|
|
|
RUBY_EXTERN VALUE rb_cStat;
|
|
|
|
RUBY_EXTERN VALUE rb_cString;
|
|
|
|
RUBY_EXTERN VALUE rb_cStruct;
|
|
|
|
RUBY_EXTERN VALUE rb_cSymbol;
|
|
|
|
RUBY_EXTERN VALUE rb_cThread;
|
|
|
|
RUBY_EXTERN VALUE rb_cTime;
|
|
|
|
RUBY_EXTERN VALUE rb_cTrueClass;
|
|
|
|
RUBY_EXTERN VALUE rb_cUnboundMethod;
|
|
|
|
|
|
|
|
RUBY_EXTERN VALUE rb_eException;
|
|
|
|
RUBY_EXTERN VALUE rb_eStandardError;
|
|
|
|
RUBY_EXTERN VALUE rb_eSystemExit;
|
|
|
|
RUBY_EXTERN VALUE rb_eInterrupt;
|
|
|
|
RUBY_EXTERN VALUE rb_eSignal;
|
|
|
|
RUBY_EXTERN VALUE rb_eFatal;
|
|
|
|
RUBY_EXTERN VALUE rb_eArgError;
|
|
|
|
RUBY_EXTERN VALUE rb_eEOFError;
|
|
|
|
RUBY_EXTERN VALUE rb_eIndexError;
|
|
|
|
RUBY_EXTERN VALUE rb_eStopIteration;
|
|
|
|
RUBY_EXTERN VALUE rb_eKeyError;
|
|
|
|
RUBY_EXTERN VALUE rb_eRangeError;
|
|
|
|
RUBY_EXTERN VALUE rb_eIOError;
|
|
|
|
RUBY_EXTERN VALUE rb_eRuntimeError;
|
|
|
|
RUBY_EXTERN VALUE rb_eFrozenError;
|
|
|
|
RUBY_EXTERN VALUE rb_eSecurityError;
|
|
|
|
RUBY_EXTERN VALUE rb_eSystemCallError;
|
|
|
|
RUBY_EXTERN VALUE rb_eThreadError;
|
|
|
|
RUBY_EXTERN VALUE rb_eTypeError;
|
|
|
|
RUBY_EXTERN VALUE rb_eZeroDivError;
|
|
|
|
RUBY_EXTERN VALUE rb_eNotImpError;
|
|
|
|
RUBY_EXTERN VALUE rb_eNoMemError;
|
|
|
|
RUBY_EXTERN VALUE rb_eNoMethodError;
|
|
|
|
RUBY_EXTERN VALUE rb_eFloatDomainError;
|
|
|
|
RUBY_EXTERN VALUE rb_eLocalJumpError;
|
|
|
|
RUBY_EXTERN VALUE rb_eSysStackError;
|
|
|
|
RUBY_EXTERN VALUE rb_eRegexpError;
|
|
|
|
RUBY_EXTERN VALUE rb_eEncodingError;
|
|
|
|
RUBY_EXTERN VALUE rb_eEncCompatError;
|
|
|
|
RUBY_EXTERN VALUE rb_eNoMatchingPatternError;
|
|
|
|
|
|
|
|
RUBY_EXTERN VALUE rb_eScriptError;
|
|
|
|
RUBY_EXTERN VALUE rb_eNameError;
|
|
|
|
RUBY_EXTERN VALUE rb_eSyntaxError;
|
|
|
|
RUBY_EXTERN VALUE rb_eLoadError;
|
|
|
|
|
|
|
|
RUBY_EXTERN VALUE rb_eMathDomainError;
|
|
|
|
|
|
|
|
RUBY_EXTERN VALUE rb_stdin, rb_stdout, rb_stderr;
|
|
|
|
|
2020-05-04 02:52:56 -04:00
|
|
|
RBIMPL_ATTR_PURE()
|
2020-04-08 00:28:13 -04:00
|
|
|
static inline VALUE
|
|
|
|
rb_class_of(VALUE obj)
|
|
|
|
{
|
|
|
|
if (! RB_SPECIAL_CONST_P(obj)) {
|
|
|
|
return RBASIC_CLASS(obj);
|
|
|
|
}
|
|
|
|
else if (obj == RUBY_Qfalse) {
|
|
|
|
return rb_cFalseClass;
|
|
|
|
}
|
|
|
|
else if (obj == RUBY_Qnil) {
|
|
|
|
return rb_cNilClass;
|
|
|
|
}
|
|
|
|
else if (obj == RUBY_Qtrue) {
|
|
|
|
return rb_cTrueClass;
|
|
|
|
}
|
|
|
|
else if (RB_FIXNUM_P(obj)) {
|
|
|
|
return rb_cInteger;
|
|
|
|
}
|
|
|
|
else if (RB_STATIC_SYM_P(obj)) {
|
|
|
|
return rb_cSymbol;
|
|
|
|
}
|
|
|
|
else if (RB_FLONUM_P(obj)) {
|
|
|
|
return rb_cFloat;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if RUBY_NDEBUG
|
2020-05-04 02:52:56 -04:00
|
|
|
RBIMPL_UNREACHABLE_RETURN(Qfalse);
|
2020-04-08 00:28:13 -04:00
|
|
|
#else
|
|
|
|
RUBY_ASSERT_FAIL(rb_class_of);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#define CLASS_OF rb_class_of
|
|
|
|
|
2020-05-04 02:52:56 -04:00
|
|
|
RBIMPL_SYMBOL_EXPORT_END()
|
2020-04-08 00:28:13 -04:00
|
|
|
|
2020-05-04 02:52:56 -04:00
|
|
|
#endif /* RBIMPL_GLOBALS_H */
|