2000-05-01 05:42:38 -04:00
|
|
|
/**********************************************************************
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
ruby.h -
|
|
|
|
|
|
|
|
$Author$
|
|
|
|
created at: Thu Jun 10 14:26:32 JST 1993
|
|
|
|
|
2003-01-16 02:34:03 -05:00
|
|
|
Copyright (C) 1993-2003 Yukihiro Matsumoto
|
2000-05-01 05:42:38 -04:00
|
|
|
Copyright (C) 2000 Network Applied Communication Laboratory, Inc.
|
2000-05-09 00:53:16 -04:00
|
|
|
Copyright (C) 2000 Information-technology Promotion Agency, Japan
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2000-05-01 05:42:38 -04:00
|
|
|
**********************************************************************/
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
#ifndef RUBY_H
|
|
|
|
#define RUBY_H
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
2005-09-14 09:41:02 -04:00
|
|
|
#if 0
|
|
|
|
} /* satisfy cc-mode */
|
|
|
|
#endif
|
1999-01-19 23:59:39 -05:00
|
|
|
#endif
|
1998-01-16 07:13:05 -05:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#include "config.h"
|
2005-07-02 04:11:24 -04:00
|
|
|
|
2005-07-25 08:29:37 -04:00
|
|
|
#define NORETURN_STYLE_NEW 1
|
|
|
|
#ifndef NORETURN
|
|
|
|
# define NORETURN(x) x
|
|
|
|
#endif
|
|
|
|
#ifndef DEPRECATED
|
|
|
|
# define DEPRECATED(x) x
|
|
|
|
#endif
|
2005-07-02 04:11:24 -04:00
|
|
|
#ifndef NOINLINE
|
|
|
|
# define NOINLINE(x) x
|
|
|
|
#endif
|
|
|
|
|
2005-09-13 07:26:42 -04:00
|
|
|
#ifdef __GNUC__
|
|
|
|
#define PRINTF_ARGS(decl, string_index, first_to_check) \
|
|
|
|
decl __attribute__((format(printf, string_index, first_to_check)))
|
|
|
|
#else
|
|
|
|
#define PRINTF_ARGS(decl, string_index, first_to_check) decl
|
|
|
|
#endif
|
|
|
|
|
1998-01-16 07:13:05 -05:00
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
# include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
|
1998-01-16 07:19:22 -05:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#else
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
2003-12-22 03:23:55 -05:00
|
|
|
#ifdef HAVE_INTRINSICS_H
|
|
|
|
# include <intrinsics.h>
|
|
|
|
#endif
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2005-12-06 02:52:18 -05:00
|
|
|
#include "defines.h"
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
/* need to include <ctype.h> to use these macros */
|
2001-12-10 02:24:00 -05:00
|
|
|
#ifndef ISPRINT
|
2003-12-10 21:39:59 -05:00
|
|
|
#define ISASCII(c) isascii((int)(unsigned char)(c))
|
1999-08-13 01:45:20 -04:00
|
|
|
#undef ISPRINT
|
2003-12-10 21:39:59 -05:00
|
|
|
#define ISPRINT(c) (ISASCII(c) && isprint((int)(unsigned char)(c)))
|
|
|
|
#define ISSPACE(c) (ISASCII(c) && isspace((int)(unsigned char)(c)))
|
|
|
|
#define ISUPPER(c) (ISASCII(c) && isupper((int)(unsigned char)(c)))
|
|
|
|
#define ISLOWER(c) (ISASCII(c) && islower((int)(unsigned char)(c)))
|
|
|
|
#define ISALNUM(c) (ISASCII(c) && isalnum((int)(unsigned char)(c)))
|
|
|
|
#define ISALPHA(c) (ISASCII(c) && isalpha((int)(unsigned char)(c)))
|
|
|
|
#define ISDIGIT(c) (ISASCII(c) && isdigit((int)(unsigned char)(c)))
|
|
|
|
#define ISXDIGIT(c) (ISASCII(c) && isxdigit((int)(unsigned char)(c)))
|
2001-12-10 02:24:00 -05:00
|
|
|
#endif
|
1999-01-19 23:59:39 -05:00
|
|
|
|
2003-12-10 21:39:59 -05:00
|
|
|
#if defined(HAVE_ALLOCA_H)
|
1998-01-16 07:13:05 -05:00
|
|
|
#include <alloca.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef _AIX
|
|
|
|
#pragma alloca
|
|
|
|
#endif
|
|
|
|
|
2002-03-22 02:26:42 -05:00
|
|
|
#if defined(__VMS)
|
|
|
|
# pragma builtins
|
|
|
|
# define alloca __alloca
|
|
|
|
#endif
|
|
|
|
|
2005-07-26 05:16:37 -04:00
|
|
|
#if SIZEOF_LONG == SIZEOF_VOIDP
|
1999-01-19 23:59:39 -05:00
|
|
|
typedef unsigned long VALUE;
|
1999-12-14 01:50:43 -05:00
|
|
|
typedef unsigned long ID;
|
2005-07-26 05:16:37 -04:00
|
|
|
#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
|
2005-07-27 03:27:19 -04:00
|
|
|
typedef unsigned LONG_LONG VALUE;
|
|
|
|
typedef unsigned LONG_LONG ID;
|
2005-07-26 05:16:37 -04:00
|
|
|
#else
|
|
|
|
# error ---->> ruby requires sizeof(void*) == sizeof(long) to be compiled. <<----
|
|
|
|
#endif
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
#ifdef __STDC__
|
|
|
|
# include <limits.h>
|
|
|
|
#else
|
|
|
|
# ifndef LONG_MAX
|
|
|
|
# ifdef HAVE_LIMITS_H
|
|
|
|
# include <limits.h>
|
|
|
|
# else
|
1999-01-19 23:59:39 -05:00
|
|
|
/* assuming 32bit(2's compliment) long */
|
|
|
|
# define LONG_MAX 2147483647
|
1998-01-16 07:13:05 -05:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# ifndef LONG_MIN
|
1999-01-19 23:59:39 -05:00
|
|
|
# define LONG_MIN (-LONG_MAX-1)
|
1998-01-16 07:13:05 -05:00
|
|
|
# endif
|
|
|
|
# ifndef CHAR_BIT
|
|
|
|
# define CHAR_BIT 8
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2002-03-14 01:23:46 -05:00
|
|
|
#if HAVE_LONG_LONG
|
|
|
|
# ifndef LLONG_MAX
|
|
|
|
# ifdef LONG_LONG_MAX
|
|
|
|
# define LLONG_MAX LONG_LONG_MAX
|
|
|
|
# else
|
* bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
big2ull, rb_big2ull, rb_big2ll): use LONG_LONG macro instead of
long long.
* numeric.c, intern.h, ruby.h (rb_num2ll, rb_num2ull): ditto.
* ruby.h: use _I64_MAX and _I64_MIN if they are defined (for VC++).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-15 03:51:31 -05:00
|
|
|
# ifdef _I64_MAX
|
|
|
|
# define LLONG_MAX _I64_MAX
|
|
|
|
# else
|
2002-03-14 01:23:46 -05:00
|
|
|
/* assuming 64bit(2's complement) long long */
|
* bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
big2ull, rb_big2ull, rb_big2ll): use LONG_LONG macro instead of
long long.
* numeric.c, intern.h, ruby.h (rb_num2ll, rb_num2ull): ditto.
* ruby.h: use _I64_MAX and _I64_MIN if they are defined (for VC++).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-15 03:51:31 -05:00
|
|
|
# define LLONG_MAX 9223372036854775807LL
|
|
|
|
# endif
|
2002-03-14 01:23:46 -05:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# ifndef LLONG_MIN
|
|
|
|
# ifdef LONG_LONG_MIN
|
|
|
|
# define LLONG_MIN LONG_LONG_MIN
|
|
|
|
# else
|
* bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
big2ull, rb_big2ull, rb_big2ll): use LONG_LONG macro instead of
long long.
* numeric.c, intern.h, ruby.h (rb_num2ll, rb_num2ull): ditto.
* ruby.h: use _I64_MAX and _I64_MIN if they are defined (for VC++).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-15 03:51:31 -05:00
|
|
|
# ifdef _I64_MIN
|
2003-07-29 04:28:54 -04:00
|
|
|
# define LLONG_MIN _I64_MIN
|
* bignum.c, intern.h (rb_ull2big, rb_ll2big, rb_ull2inum, rb_ll2inum,
big2ull, rb_big2ull, rb_big2ll): use LONG_LONG macro instead of
long long.
* numeric.c, intern.h, ruby.h (rb_num2ll, rb_num2ull): ditto.
* ruby.h: use _I64_MAX and _I64_MIN if they are defined (for VC++).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2002-03-15 03:51:31 -05:00
|
|
|
# else
|
|
|
|
# define LLONG_MIN (-LLONG_MAX-1)
|
|
|
|
# endif
|
2002-03-14 01:23:46 -05:00
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
1998-01-16 07:13:05 -05:00
|
|
|
#define FIXNUM_MAX (LONG_MAX>>1)
|
1999-01-19 23:59:39 -05:00
|
|
|
#define FIXNUM_MIN RSHIFT((long)LONG_MIN,1)
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
#define FIXNUM_FLAG 0x01
|
2000-03-07 03:37:59 -05:00
|
|
|
#define INT2FIX(i) ((VALUE)(((long)(i))<<1 | FIXNUM_FLAG))
|
2001-05-30 05:12:34 -04:00
|
|
|
#define LONG2FIX(i) INT2FIX(i)
|
2000-02-17 02:11:22 -05:00
|
|
|
#define rb_fix_new(v) INT2FIX(v)
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_int2inum(long);
|
1999-01-19 23:59:39 -05:00
|
|
|
#define INT2NUM(v) rb_int2inum(v)
|
2001-05-02 00:22:21 -04:00
|
|
|
#define LONG2NUM(v) INT2NUM(v)
|
2000-02-17 02:11:22 -05:00
|
|
|
#define rb_int_new(v) rb_int2inum(v)
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_uint2inum(unsigned long);
|
1999-12-14 01:50:43 -05:00
|
|
|
#define UINT2NUM(v) rb_uint2inum(v)
|
2001-05-02 00:22:21 -04:00
|
|
|
#define ULONG2NUM(v) UINT2NUM(v)
|
2000-02-17 02:11:22 -05:00
|
|
|
#define rb_uint_new(v) rb_uint2inum(v)
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2002-03-14 01:23:46 -05:00
|
|
|
#if HAVE_LONG_LONG
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_ll2inum(LONG_LONG);
|
2002-03-14 01:23:46 -05:00
|
|
|
#define LL2NUM(v) rb_ll2inum(v)
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_ull2inum(unsigned LONG_LONG);
|
2002-03-14 01:23:46 -05:00
|
|
|
#define ULL2NUM(v) rb_ull2inum(v)
|
|
|
|
#endif
|
|
|
|
|
2002-03-27 00:28:00 -05:00
|
|
|
#if SIZEOF_OFF_T > SIZEOF_LONG && defined(HAVE_LONG_LONG)
|
2002-03-14 01:23:46 -05:00
|
|
|
# define OFFT2NUM(v) LL2NUM(v)
|
|
|
|
#else
|
|
|
|
# define OFFT2NUM(v) INT2NUM(v)
|
|
|
|
#endif
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#define FIX2LONG(x) RSHIFT((long)x,1)
|
|
|
|
#define FIX2ULONG(x) (((unsigned long)(x))>>1)
|
1998-01-16 07:19:22 -05:00
|
|
|
#define FIXNUM_P(f) (((long)(f))&FIXNUM_FLAG)
|
1998-01-16 07:13:05 -05:00
|
|
|
#define POSFIXABLE(f) ((f) <= FIXNUM_MAX)
|
|
|
|
#define NEGFIXABLE(f) ((f) >= FIXNUM_MIN)
|
|
|
|
#define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f))
|
|
|
|
|
2000-03-07 03:37:59 -05:00
|
|
|
#define IMMEDIATE_MASK 0x03
|
|
|
|
#define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK)
|
|
|
|
|
|
|
|
#define SYMBOL_FLAG 0x0e
|
|
|
|
#define SYMBOL_P(x) (((VALUE)(x)&0xff)==SYMBOL_FLAG)
|
|
|
|
#define ID2SYM(x) ((VALUE)(((long)(x))<<8|SYMBOL_FLAG))
|
|
|
|
#define SYM2ID(x) RSHIFT((long)x,8)
|
|
|
|
|
1998-01-16 07:13:05 -05:00
|
|
|
/* special contants - i.e. non-zero and non-fixnum constants */
|
2005-10-25 07:21:08 -04:00
|
|
|
#define Qfalse ((VALUE)0)
|
|
|
|
#define Qtrue ((VALUE)2)
|
|
|
|
#define Qnil ((VALUE)4)
|
|
|
|
#define Qundef ((VALUE)6) /* undefined value for placeholder */
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2000-09-25 05:15:08 -04:00
|
|
|
#define RTEST(v) (((VALUE)(v) & ~Qnil) != 0)
|
1998-01-16 07:13:05 -05:00
|
|
|
#define NIL_P(v) ((VALUE)(v) == Qnil)
|
|
|
|
|
|
|
|
#define CLASS_OF(v) rb_class_of((VALUE)(v))
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#define T_NONE 0x00
|
|
|
|
|
|
|
|
#define T_NIL 0x01
|
|
|
|
#define T_OBJECT 0x02
|
|
|
|
#define T_CLASS 0x03
|
|
|
|
#define T_ICLASS 0x04
|
|
|
|
#define T_MODULE 0x05
|
|
|
|
#define T_FLOAT 0x06
|
|
|
|
#define T_STRING 0x07
|
|
|
|
#define T_REGEXP 0x08
|
|
|
|
#define T_ARRAY 0x09
|
|
|
|
#define T_FIXNUM 0x0a
|
|
|
|
#define T_HASH 0x0b
|
|
|
|
#define T_STRUCT 0x0c
|
|
|
|
#define T_BIGNUM 0x0d
|
|
|
|
#define T_FILE 0x0e
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2004-03-10 02:05:19 -05:00
|
|
|
#define T_TRUE 0x10
|
|
|
|
#define T_FALSE 0x11
|
|
|
|
#define T_DATA 0x12
|
|
|
|
#define T_MATCH 0x13
|
|
|
|
#define T_SYMBOL 0x14
|
|
|
|
|
|
|
|
#define T_BLOCK 0x1b
|
|
|
|
#define T_UNDEF 0x1c
|
|
|
|
#define T_VARMAP 0x1d
|
|
|
|
#define T_SCOPE 0x1e
|
|
|
|
#define T_NODE 0x1f
|
|
|
|
|
|
|
|
#define T_MASK 0x1f
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
#define BUILTIN_TYPE(x) (((struct RBasic*)(x))->flags & T_MASK)
|
|
|
|
|
|
|
|
#define TYPE(x) rb_type((VALUE)(x))
|
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_check_type(VALUE,int);
|
1998-01-16 07:13:05 -05:00
|
|
|
#define Check_Type(v,t) rb_check_type((VALUE)(v),t)
|
2001-05-02 00:22:21 -04:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_str_to_str(VALUE);
|
|
|
|
VALUE rb_string_value(volatile VALUE*);
|
|
|
|
char *rb_string_value_ptr(volatile VALUE*);
|
|
|
|
char *rb_string_value_cstr(volatile VALUE*);
|
2001-05-11 01:24:59 -04:00
|
|
|
|
2003-06-23 02:52:39 -04:00
|
|
|
#define StringValue(v) rb_string_value(&(v))
|
2003-03-24 04:38:37 -05:00
|
|
|
#define StringValuePtr(v) rb_string_value_ptr(&(v))
|
2003-07-20 13:17:52 -04:00
|
|
|
#define StringValueCStr(v) rb_string_value_cstr(&(v))
|
2003-03-24 04:38:37 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_check_safe_obj(VALUE);
|
|
|
|
void rb_check_safe_str(VALUE);
|
2001-05-02 00:22:21 -04:00
|
|
|
#define SafeStringValue(v) do {\
|
2001-05-11 01:24:59 -04:00
|
|
|
StringValue(v);\
|
2003-03-24 04:38:37 -05:00
|
|
|
rb_check_safe_obj(v);\
|
2001-03-28 03:43:25 -05:00
|
|
|
} while (0)
|
2001-05-11 01:24:59 -04:00
|
|
|
/* obsolete macro - use SafeStringValue(v) */
|
|
|
|
#define Check_SafeStr(v) rb_check_safe_str((VALUE)(v))
|
2001-05-02 00:22:21 -04:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_get_path(VALUE);
|
2004-04-07 02:30:15 -04:00
|
|
|
#define FilePathValue(v) ((v) = rb_get_path(v))
|
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_secure(int);
|
2003-03-04 09:12:19 -05:00
|
|
|
RUBY_EXTERN int ruby_safe_level;
|
2000-01-31 22:12:21 -05:00
|
|
|
#define rb_safe_level() (ruby_safe_level)
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_set_safe_level(int);
|
|
|
|
void rb_secure_update(VALUE);
|
2000-01-31 22:12:21 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
long rb_num2long(VALUE);
|
|
|
|
unsigned long rb_num2ulong(VALUE);
|
1999-08-13 01:45:20 -04:00
|
|
|
#define NUM2LONG(x) (FIXNUM_P(x)?FIX2LONG(x):rb_num2long((VALUE)x))
|
1999-01-19 23:59:39 -05:00
|
|
|
#define NUM2ULONG(x) rb_num2ulong((VALUE)x)
|
|
|
|
#if SIZEOF_INT < SIZEOF_LONG
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
long rb_num2int(VALUE);
|
1999-01-19 23:59:39 -05:00
|
|
|
#define NUM2INT(x) (FIXNUM_P(x)?FIX2INT(x):rb_num2int((VALUE)x))
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
long rb_fix2int(VALUE);
|
1999-01-19 23:59:39 -05:00
|
|
|
#define FIX2INT(x) rb_fix2int((VALUE)x)
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
unsigned long rb_num2uint(VALUE);
|
2003-05-30 09:28:10 -04:00
|
|
|
#define NUM2UINT(x) rb_num2uint(x)
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
unsigned long rb_fix2uint(VALUE);
|
2003-05-30 09:28:10 -04:00
|
|
|
#define FIX2UINT(x) rb_fix2uint(x)
|
1999-01-19 23:59:39 -05:00
|
|
|
#else
|
2002-10-29 16:35:28 -05:00
|
|
|
#define NUM2INT(x) ((int)NUM2LONG(x))
|
|
|
|
#define NUM2UINT(x) ((unsigned int)NUM2ULONG(x))
|
|
|
|
#define FIX2INT(x) ((int)FIX2LONG(x))
|
|
|
|
#define FIX2UINT(x) ((unsigned int)FIX2ULONG(x))
|
1999-01-19 23:59:39 -05:00
|
|
|
#endif
|
|
|
|
|
2002-03-14 01:23:46 -05:00
|
|
|
#if HAVE_LONG_LONG
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
LONG_LONG rb_num2ll(VALUE);
|
|
|
|
unsigned LONG_LONG rb_num2ull(VALUE);
|
2002-03-14 01:23:46 -05:00
|
|
|
# define NUM2LL(x) (FIXNUM_P(x)?FIX2LONG(x):rb_num2ll((VALUE)x))
|
2004-11-14 05:06:16 -05:00
|
|
|
# define NUM2ULL(x) rb_num2ull((VALUE)x)
|
2002-03-14 01:23:46 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if HAVE_LONG_LONG && SIZEOF_OFF_T > SIZEOF_LONG
|
|
|
|
# define NUM2OFFT(x) ((off_t)NUM2LL(x))
|
|
|
|
#else
|
|
|
|
# define NUM2OFFT(x) NUM2LONG(x)
|
|
|
|
#endif
|
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
double rb_num2dbl(VALUE);
|
1999-01-19 23:59:39 -05:00
|
|
|
#define NUM2DBL(x) rb_num2dbl((VALUE)(x))
|
|
|
|
|
2001-05-02 00:22:21 -04:00
|
|
|
/* obsolete API - use StringValue() */
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
char *rb_str2cstr(VALUE,long*);
|
2001-05-02 00:22:21 -04:00
|
|
|
/* obsolete API - use StringValuePtr() */
|
1999-01-19 23:59:39 -05:00
|
|
|
#define STR2CSTR(x) rb_str2cstr((VALUE)(x),0)
|
1998-01-16 07:19:22 -05:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#define NUM2CHR(x) (((TYPE(x) == T_STRING)&&(RSTRING(x)->len>=1))?\
|
1999-08-13 01:45:20 -04:00
|
|
|
RSTRING(x)->ptr[0]:(char)(NUM2INT(x)&0xff))
|
|
|
|
#define CHR2FIX(x) INT2FIX((long)((x)&0xff))
|
1998-01-16 07:13:05 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_newobj(void);
|
1998-01-16 07:13:05 -05:00
|
|
|
#define NEWOBJ(obj,type) type *obj = (type*)rb_newobj()
|
2002-04-24 00:54:16 -04:00
|
|
|
#define OBJSETUP(obj,c,t) do {\
|
1998-01-16 07:13:05 -05:00
|
|
|
RBASIC(obj)->flags = (t);\
|
2000-08-09 00:32:24 -04:00
|
|
|
RBASIC(obj)->klass = (c);\
|
1999-01-19 23:59:39 -05:00
|
|
|
if (rb_safe_level() >= 3) FL_SET(obj, FL_TAINT);\
|
2002-04-24 00:54:16 -04:00
|
|
|
} while (0)
|
1999-08-13 01:45:20 -04:00
|
|
|
#define CLONESETUP(clone,obj) do {\
|
2002-09-03 01:20:14 -04:00
|
|
|
OBJSETUP(clone,rb_singleton_class_clone((VALUE)obj),RBASIC(obj)->flags);\
|
1999-01-19 23:59:39 -05:00
|
|
|
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)clone);\
|
2001-07-14 11:17:19 -04:00
|
|
|
if (FL_TEST(obj, FL_EXIVAR)) rb_copy_generic_ivar((VALUE)clone,(VALUE)obj);\
|
1999-08-13 01:45:20 -04:00
|
|
|
} while (0)
|
2001-12-10 02:18:16 -05:00
|
|
|
#define DUPSETUP(dup,obj) do {\
|
|
|
|
OBJSETUP(dup,rb_obj_class(obj),(RBASIC(obj)->flags)&(T_MASK|FL_EXIVAR|FL_TAINT));\
|
|
|
|
if (FL_TEST(obj, FL_EXIVAR)) rb_copy_generic_ivar((VALUE)dup,(VALUE)obj);\
|
|
|
|
} while (0)
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
struct RBasic {
|
1999-01-19 23:59:39 -05:00
|
|
|
unsigned long flags;
|
|
|
|
VALUE klass;
|
1998-01-16 07:13:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct RObject {
|
|
|
|
struct RBasic basic;
|
|
|
|
struct st_table *iv_tbl;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RClass {
|
|
|
|
struct RBasic basic;
|
|
|
|
struct st_table *iv_tbl;
|
|
|
|
struct st_table *m_tbl;
|
1998-01-16 07:19:22 -05:00
|
|
|
VALUE super;
|
1998-01-16 07:13:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct RFloat {
|
|
|
|
struct RBasic basic;
|
|
|
|
double value;
|
|
|
|
};
|
|
|
|
|
2001-12-10 02:18:16 -05:00
|
|
|
#define ELTS_SHARED FL_USER2
|
|
|
|
|
1998-01-16 07:13:05 -05:00
|
|
|
struct RString {
|
|
|
|
struct RBasic basic;
|
1999-08-13 01:45:20 -04:00
|
|
|
long len;
|
1999-01-19 23:59:39 -05:00
|
|
|
char *ptr;
|
2001-12-10 02:18:16 -05:00
|
|
|
union {
|
2002-09-09 06:26:02 -04:00
|
|
|
long capa;
|
2001-12-10 02:18:16 -05:00
|
|
|
VALUE shared;
|
|
|
|
} aux;
|
1998-01-16 07:13:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct RArray {
|
|
|
|
struct RBasic basic;
|
2001-12-10 02:18:16 -05:00
|
|
|
long len;
|
|
|
|
union {
|
2002-09-09 06:26:02 -04:00
|
|
|
long capa;
|
2001-12-10 02:18:16 -05:00
|
|
|
VALUE shared;
|
|
|
|
} aux;
|
1998-01-16 07:13:05 -05:00
|
|
|
VALUE *ptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RRegexp {
|
|
|
|
struct RBasic basic;
|
|
|
|
struct re_pattern_buffer *ptr;
|
1999-08-13 01:45:20 -04:00
|
|
|
long len;
|
1999-01-19 23:59:39 -05:00
|
|
|
char *str;
|
1998-01-16 07:13:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct RHash {
|
|
|
|
struct RBasic basic;
|
|
|
|
struct st_table *tbl;
|
|
|
|
int iter_lev;
|
1999-01-19 23:59:39 -05:00
|
|
|
VALUE ifnone;
|
1998-01-16 07:13:05 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
struct RFile {
|
|
|
|
struct RBasic basic;
|
|
|
|
struct OpenFile *fptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct RData {
|
|
|
|
struct RBasic basic;
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void (*dmark)(void*);
|
|
|
|
void (*dfree)(void*);
|
1998-01-16 07:13:05 -05:00
|
|
|
void *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define DATA_PTR(dta) (RDATA(dta)->data)
|
|
|
|
|
2000-06-26 11:16:03 -04:00
|
|
|
/*
|
2005-09-14 04:30:16 -04:00
|
|
|
#define RUBY_DATA_FUNC(func) ((void (*)(void*))func)
|
2000-06-26 11:16:03 -04:00
|
|
|
*/
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
typedef void (*RUBY_DATA_FUNC)(void*);
|
2000-06-26 11:16:03 -04:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_data_object_alloc(VALUE,void*,RUBY_DATA_FUNC,RUBY_DATA_FUNC);
|
2000-06-26 11:16:03 -04:00
|
|
|
|
2002-04-24 00:54:16 -04:00
|
|
|
#define Data_Wrap_Struct(klass,mark,free,sval)\
|
|
|
|
rb_data_object_alloc(klass,sval,(RUBY_DATA_FUNC)mark,(RUBY_DATA_FUNC)free)
|
2000-06-26 11:16:03 -04:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#define Data_Make_Struct(klass,type,mark,free,sval) (\
|
1998-01-16 07:13:05 -05:00
|
|
|
sval = ALLOC(type),\
|
|
|
|
memset(sval, 0, sizeof(type)),\
|
2000-06-26 11:16:03 -04:00
|
|
|
Data_Wrap_Struct(klass,mark,free,sval)\
|
1998-01-16 07:13:05 -05:00
|
|
|
)
|
|
|
|
|
2002-04-24 00:54:16 -04:00
|
|
|
#define Data_Get_Struct(obj,type,sval) do {\
|
1998-01-16 07:13:05 -05:00
|
|
|
Check_Type(obj, T_DATA); \
|
|
|
|
sval = (type*)DATA_PTR(obj);\
|
2002-04-24 00:54:16 -04:00
|
|
|
} while (0)
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2006-02-05 09:40:01 -05:00
|
|
|
#define RSTRUCT_EMBED_LEN_MAX 3
|
1998-01-16 07:13:05 -05:00
|
|
|
struct RStruct {
|
|
|
|
struct RBasic basic;
|
2006-02-05 09:40:01 -05:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
long len;
|
|
|
|
VALUE *ptr;
|
|
|
|
} heap;
|
|
|
|
VALUE ary[RSTRUCT_EMBED_LEN_MAX];
|
|
|
|
} as;
|
1998-01-16 07:13:05 -05:00
|
|
|
};
|
2006-02-05 10:06:41 -05:00
|
|
|
#define RSTRUCT_EMBED_LEN_MASK (FL_USER2|FL_USER1)
|
|
|
|
#define RSTRUCT_EMBED_LEN_SHIFT FL_USHIFT+1
|
2006-02-05 09:40:01 -05:00
|
|
|
#define RSTRUCT_LEN(st) \
|
|
|
|
((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ? \
|
2006-02-05 10:06:41 -05:00
|
|
|
(RBASIC(st)->flags >> RSTRUCT_EMBED_LEN_SHIFT) & \
|
|
|
|
(RSTRUCT_EMBED_LEN_MASK >> RSTRUCT_EMBED_LEN_SHIFT) : \
|
2006-02-05 09:40:01 -05:00
|
|
|
RSTRUCT(st)->as.heap.len)
|
|
|
|
#define RSTRUCT_PTR(st) \
|
|
|
|
((RBASIC(st)->flags & RSTRUCT_EMBED_LEN_MASK) ? \
|
|
|
|
RSTRUCT(st)->as.ary : \
|
|
|
|
RSTRUCT(st)->as.heap.ptr)
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
struct RBignum {
|
|
|
|
struct RBasic basic;
|
|
|
|
char sign;
|
1999-08-13 01:45:20 -04:00
|
|
|
long len;
|
2000-01-04 23:41:21 -05:00
|
|
|
void *digits;
|
1998-01-16 07:13:05 -05:00
|
|
|
};
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#define R_CAST(st) (struct st*)
|
1998-01-16 07:13:05 -05:00
|
|
|
#define RBASIC(obj) (R_CAST(RBasic)(obj))
|
|
|
|
#define ROBJECT(obj) (R_CAST(RObject)(obj))
|
|
|
|
#define RCLASS(obj) (R_CAST(RClass)(obj))
|
1999-01-19 23:59:39 -05:00
|
|
|
#define RMODULE(obj) RCLASS(obj)
|
1998-01-16 07:13:05 -05:00
|
|
|
#define RFLOAT(obj) (R_CAST(RFloat)(obj))
|
|
|
|
#define RSTRING(obj) (R_CAST(RString)(obj))
|
|
|
|
#define RREGEXP(obj) (R_CAST(RRegexp)(obj))
|
|
|
|
#define RARRAY(obj) (R_CAST(RArray)(obj))
|
|
|
|
#define RHASH(obj) (R_CAST(RHash)(obj))
|
|
|
|
#define RDATA(obj) (R_CAST(RData)(obj))
|
|
|
|
#define RSTRUCT(obj) (R_CAST(RStruct)(obj))
|
|
|
|
#define RBIGNUM(obj) (R_CAST(RBignum)(obj))
|
|
|
|
#define RFILE(obj) (R_CAST(RFile)(obj))
|
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#define FL_SINGLETON FL_USER0
|
2004-11-16 21:27:38 -05:00
|
|
|
#define FL_MARK (1<<5)
|
|
|
|
#define FL_RESERVED (1<<6) /* will be used in the future GC */
|
2000-01-31 22:12:21 -05:00
|
|
|
#define FL_FINALIZE (1<<7)
|
|
|
|
#define FL_TAINT (1<<8)
|
|
|
|
#define FL_EXIVAR (1<<9)
|
|
|
|
#define FL_FREEZE (1<<10)
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
#define FL_USHIFT 11
|
|
|
|
|
|
|
|
#define FL_USER0 (1<<(FL_USHIFT+0))
|
|
|
|
#define FL_USER1 (1<<(FL_USHIFT+1))
|
|
|
|
#define FL_USER2 (1<<(FL_USHIFT+2))
|
|
|
|
#define FL_USER3 (1<<(FL_USHIFT+3))
|
|
|
|
#define FL_USER4 (1<<(FL_USHIFT+4))
|
|
|
|
#define FL_USER5 (1<<(FL_USHIFT+5))
|
|
|
|
#define FL_USER6 (1<<(FL_USHIFT+6))
|
1999-01-19 23:59:39 -05:00
|
|
|
#define FL_USER7 (1<<(FL_USHIFT+7))
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2000-03-07 03:37:59 -05:00
|
|
|
#define SPECIAL_CONST_P(x) (IMMEDIATE_P(x) || !RTEST(x))
|
2000-01-04 23:41:21 -05:00
|
|
|
|
2004-10-27 05:29:26 -04:00
|
|
|
#define FL_ABLE(x) (!SPECIAL_CONST_P(x) && BUILTIN_TYPE(x) != T_NODE)
|
1998-01-16 07:13:05 -05:00
|
|
|
#define FL_TEST(x,f) (FL_ABLE(x)?(RBASIC(x)->flags&(f)):0)
|
2000-05-12 05:07:57 -04:00
|
|
|
#define FL_SET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags |= (f);} while (0)
|
|
|
|
#define FL_UNSET(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags &= ~(f);} while (0)
|
|
|
|
#define FL_REVERSE(x,f) do {if (FL_ABLE(x)) RBASIC(x)->flags ^= (f);} while (0)
|
1998-01-16 07:13:05 -05:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#define OBJ_TAINTED(x) FL_TEST((x), FL_TAINT)
|
|
|
|
#define OBJ_TAINT(x) FL_SET((x), FL_TAINT)
|
2000-05-12 05:07:57 -04:00
|
|
|
#define OBJ_INFECT(x,s) do {if (FL_ABLE(x) && FL_ABLE(s)) RBASIC(x)->flags |= RBASIC(s)->flags & FL_TAINT;} while (0)
|
1998-01-16 07:19:22 -05:00
|
|
|
|
2000-01-31 22:12:21 -05:00
|
|
|
#define OBJ_FROZEN(x) FL_TEST((x), FL_FREEZE)
|
|
|
|
#define OBJ_FREEZE(x) FL_SET((x), FL_FREEZE)
|
|
|
|
|
2005-10-05 12:15:16 -04:00
|
|
|
#define ALLOC_N(type,n) (type*)xmalloc2((n),sizeof(type))
|
1998-01-16 07:13:05 -05:00
|
|
|
#define ALLOC(type) (type*)xmalloc(sizeof(type))
|
2005-10-05 12:15:16 -04:00
|
|
|
#define REALLOC_N(var,type,n) (var)=(type*)xrealloc2((char*)(var),(n),sizeof(type))
|
1998-01-16 07:13:05 -05:00
|
|
|
|
|
|
|
#define ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n))
|
|
|
|
|
|
|
|
#define MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n))
|
|
|
|
#define MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n))
|
|
|
|
#define MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n))
|
2000-09-15 02:00:30 -04:00
|
|
|
#define MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
|
1998-01-16 07:13:05 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_obj_infect(VALUE,VALUE);
|
2003-03-24 22:11:27 -05:00
|
|
|
|
2005-09-16 09:46:05 -04:00
|
|
|
typedef int ruby_glob_func(const char*,VALUE);
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_glob(const char*,void(*)(const char*,VALUE),VALUE);
|
2005-09-16 09:46:05 -04:00
|
|
|
int ruby_glob(const char*,int,ruby_glob_func*,VALUE);
|
|
|
|
int ruby_brace_expand(const char*,int,ruby_glob_func*,VALUE);
|
|
|
|
int ruby_brace_glob(const char*,int,ruby_glob_func*,VALUE);
|
2000-05-28 22:10:22 -04:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_define_class(const char*,VALUE);
|
|
|
|
VALUE rb_define_module(const char*);
|
|
|
|
VALUE rb_define_class_under(VALUE, const char*, VALUE);
|
|
|
|
VALUE rb_define_module_under(VALUE, const char*);
|
1998-01-16 07:19:22 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_include_module(VALUE,VALUE);
|
|
|
|
void rb_extend_object(VALUE,VALUE);
|
1998-01-16 07:13:05 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_define_variable(const char*,VALUE*);
|
|
|
|
void rb_define_virtual_variable(const char*,VALUE(*)(ANYARGS),void(*)(ANYARGS));
|
|
|
|
void rb_define_hooked_variable(const char*,VALUE*,VALUE(*)(ANYARGS),void(*)(ANYARGS));
|
|
|
|
void rb_define_readonly_variable(const char*,VALUE*);
|
|
|
|
void rb_define_const(VALUE,const char*,VALUE);
|
|
|
|
void rb_define_global_const(const char*,VALUE);
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2001-05-02 00:22:21 -04:00
|
|
|
#define RUBY_METHOD_FUNC(func) ((VALUE (*)(ANYARGS))func)
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_define_method(VALUE,const char*,VALUE(*)(ANYARGS),int);
|
|
|
|
void rb_define_module_function(VALUE,const char*,VALUE(*)(ANYARGS),int);
|
|
|
|
void rb_define_global_function(const char*,VALUE(*)(ANYARGS),int);
|
1998-01-16 07:19:22 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_undef_method(VALUE,const char*);
|
|
|
|
void rb_define_alias(VALUE,const char*,const char*);
|
|
|
|
void rb_define_attr(VALUE,const char*,int,int);
|
1998-01-16 07:13:05 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_global_variable(VALUE*);
|
|
|
|
void rb_gc_register_address(VALUE*);
|
|
|
|
void rb_gc_unregister_address(VALUE*);
|
2000-02-08 03:54:01 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
ID rb_intern(const char*);
|
|
|
|
char *rb_id2name(ID);
|
|
|
|
ID rb_to_id(VALUE);
|
1998-01-16 07:13:05 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
char *rb_class2name(VALUE);
|
|
|
|
char *rb_obj_classname(VALUE);
|
1998-01-16 07:19:22 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void rb_p(VALUE);
|
1998-01-16 07:13:05 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_eval_string(const char*);
|
|
|
|
VALUE rb_eval_string_protect(const char*, int*);
|
|
|
|
VALUE rb_eval_string_wrap(const char*, int*);
|
|
|
|
VALUE rb_funcall(VALUE, ID, int, ...);
|
|
|
|
VALUE rb_funcall2(VALUE, ID, int, const VALUE*);
|
|
|
|
VALUE rb_funcall3(VALUE, ID, int, const VALUE*);
|
|
|
|
int rb_scan_args(int, const VALUE*, const char*, ...);
|
|
|
|
VALUE rb_call_super(int, const VALUE*);
|
1998-01-16 07:13:05 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_gv_set(const char*, VALUE);
|
|
|
|
VALUE rb_gv_get(const char*);
|
|
|
|
VALUE rb_iv_get(VALUE, const char*);
|
|
|
|
VALUE rb_iv_set(VALUE, const char*, VALUE);
|
1998-01-16 07:13:05 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_equal(VALUE,VALUE);
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2003-03-04 09:12:19 -05:00
|
|
|
RUBY_EXTERN VALUE ruby_verbose, ruby_debug;
|
1998-01-16 07:13:05 -05:00
|
|
|
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
PRINTF_ARGS(NORETURN(void rb_raise(VALUE, const char*, ...)), 2, 3);
|
|
|
|
PRINTF_ARGS(NORETURN(void rb_fatal(const char*, ...)), 1, 2);
|
|
|
|
PRINTF_ARGS(NORETURN(void rb_bug(const char*, ...)), 1, 2);
|
|
|
|
NORETURN(void rb_sys_fail(const char*));
|
|
|
|
NORETURN(void rb_iter_break(void));
|
|
|
|
NORETURN(void rb_exit(int));
|
|
|
|
NORETURN(void rb_notimplement(void));
|
1998-01-16 07:13:05 -05:00
|
|
|
|
2005-09-13 07:26:42 -04:00
|
|
|
/* reports if `-w' specified */
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
PRINTF_ARGS(void rb_warning(const char*, ...), 1, 2);
|
2005-09-13 07:26:42 -04:00
|
|
|
/* reports if `-w' specified */
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
PRINTF_ARGS(void rb_sys_warning(const char*, ...), 1, 2);
|
2005-09-13 07:26:42 -04:00
|
|
|
/* reports always */
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
PRINTF_ARGS(void rb_warn(const char*, ...), 1, 2);
|
|
|
|
|
|
|
|
VALUE rb_each(VALUE);
|
|
|
|
VALUE rb_yield(VALUE);
|
|
|
|
VALUE rb_yield_values(int n, ...);
|
|
|
|
VALUE rb_yield_splat(VALUE);
|
|
|
|
int rb_block_given_p(void);
|
|
|
|
void rb_need_block(void);
|
|
|
|
VALUE rb_iterate(VALUE(*)(VALUE),VALUE,VALUE(*)(ANYARGS),VALUE);
|
2006-02-03 05:28:27 -05:00
|
|
|
VALUE rb_block_call(VALUE,ID,int,VALUE*,VALUE(*)(ANYARGS),VALUE);
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
VALUE rb_rescue(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
|
|
|
|
VALUE rb_rescue2(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE,...);
|
|
|
|
VALUE rb_ensure(VALUE(*)(ANYARGS),VALUE,VALUE(*)(ANYARGS),VALUE);
|
|
|
|
VALUE rb_catch(const char*,VALUE(*)(ANYARGS),VALUE);
|
|
|
|
NORETURN(void rb_throw(const char*,VALUE));
|
|
|
|
|
|
|
|
VALUE rb_require(const char*);
|
|
|
|
|
2006-01-22 08:34:41 -05:00
|
|
|
#ifdef __ia64
|
2005-12-27 00:40:04 -05:00
|
|
|
void ruby_init_stack(VALUE*, void*);
|
|
|
|
#define RUBY_INIT_STACK \
|
|
|
|
VALUE variable_in_this_stack_frame; \
|
|
|
|
ruby_init_stack(&variable_in_this_stack_frame, rb_ia64_bsp());
|
|
|
|
#else
|
|
|
|
void ruby_init_stack(VALUE*);
|
|
|
|
#define RUBY_INIT_STACK \
|
|
|
|
VALUE variable_in_this_stack_frame; \
|
|
|
|
ruby_init_stack(&variable_in_this_stack_frame);
|
|
|
|
#endif
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void ruby_init(void);
|
|
|
|
void ruby_options(int, char**);
|
|
|
|
NORETURN(void ruby_run(void));
|
1999-01-19 23:59:39 -05:00
|
|
|
|
2003-03-04 09:12:19 -05:00
|
|
|
RUBY_EXTERN VALUE rb_mKernel;
|
|
|
|
RUBY_EXTERN VALUE rb_mComparable;
|
|
|
|
RUBY_EXTERN VALUE rb_mEnumerable;
|
|
|
|
RUBY_EXTERN VALUE rb_mPrecision;
|
|
|
|
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_cObject;
|
|
|
|
RUBY_EXTERN VALUE rb_cArray;
|
2004-04-06 22:51:05 -04:00
|
|
|
RUBY_EXTERN VALUE rb_cValues;
|
2003-03-04 09:12:19 -05:00
|
|
|
RUBY_EXTERN VALUE rb_cBignum;
|
|
|
|
RUBY_EXTERN VALUE rb_cClass;
|
|
|
|
RUBY_EXTERN VALUE rb_cDir;
|
|
|
|
RUBY_EXTERN VALUE rb_cData;
|
|
|
|
RUBY_EXTERN VALUE rb_cFalseClass;
|
|
|
|
RUBY_EXTERN VALUE rb_cFile;
|
|
|
|
RUBY_EXTERN VALUE rb_cFixnum;
|
|
|
|
RUBY_EXTERN VALUE rb_cFloat;
|
|
|
|
RUBY_EXTERN VALUE rb_cHash;
|
|
|
|
RUBY_EXTERN VALUE rb_cInteger;
|
|
|
|
RUBY_EXTERN VALUE rb_cIO;
|
|
|
|
RUBY_EXTERN VALUE rb_cModule;
|
|
|
|
RUBY_EXTERN VALUE rb_cNilClass;
|
|
|
|
RUBY_EXTERN VALUE rb_cNumeric;
|
|
|
|
RUBY_EXTERN VALUE rb_cProc;
|
|
|
|
RUBY_EXTERN VALUE rb_cRange;
|
|
|
|
RUBY_EXTERN VALUE rb_cRegexp;
|
|
|
|
RUBY_EXTERN VALUE rb_cString;
|
|
|
|
RUBY_EXTERN VALUE rb_cSymbol;
|
|
|
|
RUBY_EXTERN VALUE rb_cThread;
|
|
|
|
RUBY_EXTERN VALUE rb_cTime;
|
|
|
|
RUBY_EXTERN VALUE rb_cTrueClass;
|
|
|
|
RUBY_EXTERN VALUE rb_cStruct;
|
|
|
|
|
|
|
|
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;
|
2004-09-22 00:48:52 -04:00
|
|
|
RUBY_EXTERN VALUE rb_eKeyError;
|
2003-03-04 09:12:19 -05:00
|
|
|
RUBY_EXTERN VALUE rb_eRangeError;
|
|
|
|
RUBY_EXTERN VALUE rb_eIOError;
|
|
|
|
RUBY_EXTERN VALUE rb_eRuntimeError;
|
|
|
|
RUBY_EXTERN VALUE rb_eSecurityError;
|
|
|
|
RUBY_EXTERN VALUE rb_eSystemCallError;
|
|
|
|
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_eScriptError;
|
|
|
|
RUBY_EXTERN VALUE rb_eNameError;
|
|
|
|
RUBY_EXTERN VALUE rb_eSyntaxError;
|
|
|
|
RUBY_EXTERN VALUE rb_eLoadError;
|
|
|
|
|
2003-05-13 01:53:08 -04:00
|
|
|
RUBY_EXTERN VALUE rb_stdin, rb_stdout, rb_stderr;
|
|
|
|
RUBY_EXTERN VALUE ruby_errinfo;
|
* intern.h: add prototypes.
rb_gc_enable(), rb_gc_disable(), rb_gc_start(), rb_str_new5()
rb_str_buf_append(), rb_str_buf_cat(), rb_str_buf_cat2(),
rb_str_dup_frozen()
* ruby.h: added declaration.
rb_defout, rb_stdin, rb_stdout, rb_stderr, ruby_errinfo
* rubyio.h: changed double include guard macro to RUBYIO_H.
* array.c (inspect_call): make static.
* eval.c (dvar_asgn): ditto.
* io.c (rb_io_close_read): ditto.
* lex.c (rb_reserved_word): ditto.
* ruby.c: (req_list_head, req_list_last): ditto.
* ruby.c (require_libraries): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1915 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2001-12-17 02:52:35 -05:00
|
|
|
|
2001-03-27 02:10:58 -05:00
|
|
|
static inline VALUE
|
2001-03-26 03:57:16 -05:00
|
|
|
rb_class_of(VALUE obj)
|
1999-01-19 23:59:39 -05:00
|
|
|
{
|
2005-04-29 22:59:44 -04:00
|
|
|
if (IMMEDIATE_P(obj)) {
|
2004-01-13 00:48:59 -05:00
|
|
|
if (FIXNUM_P(obj)) return rb_cFixnum;
|
|
|
|
if (obj == Qtrue) return rb_cTrueClass;
|
|
|
|
if (SYMBOL_P(obj)) return rb_cSymbol;
|
|
|
|
}
|
2005-04-29 22:59:44 -04:00
|
|
|
else if (!RTEST(obj)) {
|
2004-01-13 00:48:59 -05:00
|
|
|
if (obj == Qnil) return rb_cNilClass;
|
|
|
|
if (obj == Qfalse) return rb_cFalseClass;
|
|
|
|
}
|
2004-01-27 01:05:04 -05:00
|
|
|
return RBASIC(obj)->klass;
|
1999-01-19 23:59:39 -05:00
|
|
|
}
|
|
|
|
|
2001-03-27 02:10:58 -05:00
|
|
|
static inline int
|
2001-03-26 03:57:16 -05:00
|
|
|
rb_type(VALUE obj)
|
1999-01-19 23:59:39 -05:00
|
|
|
{
|
2005-04-29 22:59:44 -04:00
|
|
|
if (IMMEDIATE_P(obj)) {
|
2004-01-13 00:48:59 -05:00
|
|
|
if (FIXNUM_P(obj)) return T_FIXNUM;
|
|
|
|
if (obj == Qtrue) return T_TRUE;
|
|
|
|
if (SYMBOL_P(obj)) return T_SYMBOL;
|
|
|
|
if (obj == Qundef) return T_UNDEF;
|
|
|
|
}
|
2005-04-29 22:59:44 -04:00
|
|
|
else if (!RTEST(obj)) {
|
2004-01-13 00:48:59 -05:00
|
|
|
if (obj == Qnil) return T_NIL;
|
|
|
|
if (obj == Qfalse) return T_FALSE;
|
|
|
|
}
|
2004-01-27 01:05:04 -05:00
|
|
|
return BUILTIN_TYPE(obj);
|
1999-01-19 23:59:39 -05:00
|
|
|
}
|
|
|
|
|
2001-03-27 02:10:58 -05:00
|
|
|
static inline int
|
2001-03-26 03:57:16 -05:00
|
|
|
rb_special_const_p(VALUE obj)
|
1999-01-19 23:59:39 -05:00
|
|
|
{
|
2000-01-04 23:41:21 -05:00
|
|
|
if (SPECIAL_CONST_P(obj)) return Qtrue;
|
1999-08-13 01:45:20 -04:00
|
|
|
return Qfalse;
|
1999-01-19 23:59:39 -05:00
|
|
|
}
|
2001-03-26 03:57:16 -05:00
|
|
|
|
2002-05-11 15:34:13 -04:00
|
|
|
#include "missing.h"
|
2004-03-30 22:05:22 -05:00
|
|
|
#include "intern.h"
|
1998-01-16 07:19:22 -05:00
|
|
|
|
1998-01-16 07:13:05 -05:00
|
|
|
#if defined(EXTLIB) && defined(USE_DLN_A_OUT)
|
|
|
|
/* hook for external modules */
|
1999-01-19 23:59:39 -05:00
|
|
|
static char *dln_libs_to_be_linked[] = { EXTLIB, 0 };
|
1998-01-16 07:13:05 -05:00
|
|
|
#endif
|
|
|
|
|
2003-11-19 22:50:32 -05:00
|
|
|
#if defined(HAVE_LIBPTHREAD)
|
2003-11-20 11:47:30 -05:00
|
|
|
#ifdef HAVE_PTHREAD_H
|
|
|
|
#include <pthread.h>
|
|
|
|
#endif
|
2003-11-19 22:50:32 -05:00
|
|
|
typedef pthread_t rb_nativethread_t;
|
|
|
|
# define NATIVETHREAD_CURRENT() pthread_self()
|
|
|
|
# define NATIVETHREAD_EQUAL(t1,t2) pthread_equal((t1),(t2))
|
|
|
|
# define HAVE_NATIVETHREAD
|
2005-03-02 03:11:28 -05:00
|
|
|
|
|
|
|
# define NATIVETHREAD_KILL(th,sig) pthread_kill((th),(sig))
|
|
|
|
# define HAVE_NATIVETHREAD_KILL
|
2003-11-25 02:17:14 -05:00
|
|
|
#elif defined(_WIN32) || defined(_WIN32_WCE)
|
2003-11-19 22:50:32 -05:00
|
|
|
typedef DWORD rb_nativethread_t;
|
|
|
|
# define NATIVETHREAD_CURRENT() GetCurrentThreadId()
|
|
|
|
# define NATIVETHREAD_EQUAL(t1,t2) ((t1) == (t2))
|
|
|
|
# define HAVE_NATIVETHREAD
|
|
|
|
#endif
|
2003-11-20 11:47:30 -05:00
|
|
|
#ifdef HAVE_NATIVETHREAD
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
int is_ruby_native_thread(void);
|
2003-11-20 11:47:30 -05:00
|
|
|
#else
|
|
|
|
#define is_ruby_native_thread() (1)
|
|
|
|
#endif
|
2005-03-02 03:11:28 -05:00
|
|
|
#ifdef HAVE_NATIVETHREAD_KILL
|
* bignum.c: changed `foo _((boo))' to `foo(boo)`. [ruby-dev:27056]
* defines.h, dir.c, dln.h, enumerator.c, env.h, error.c, eval.c, file.c,
gc.c, hash.c, inits.c, intern.h, io.c, lex.c, marshal.c, missing.h,
node.h, numeric.c, pack.c, process.c, re.h, ruby.c, ruby.h, rubyio.h,
rubysig.h, signal.c, sprintf.c, st.h, string.c, struct.c, time.c,
util.c, util.h, variable.c: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-09-14 02:32:32 -04:00
|
|
|
void ruby_native_thread_kill(int);
|
2005-03-02 03:11:28 -05:00
|
|
|
#endif
|
2003-11-19 22:50:32 -05:00
|
|
|
|
1999-01-19 23:59:39 -05:00
|
|
|
#if defined(__cplusplus)
|
2005-09-14 09:41:02 -04:00
|
|
|
#if 0
|
|
|
|
{ /* satisfy cc-mode */
|
|
|
|
#endif
|
1999-01-19 23:59:39 -05:00
|
|
|
} /* extern "C" { */
|
1998-01-16 07:13:05 -05:00
|
|
|
#endif
|
1999-01-19 23:59:39 -05:00
|
|
|
|
|
|
|
#endif /* ifndef RUBY_H */
|