Created
December 19, 2015 10:35
-
-
Save rhenium/d173137681c3b4610b9d to your computer and use it in GitHub Desktop.
Ruby 1.0 をビルドしようとした
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/array.c b/array.c | |
index 39e10a3..cb5d8d3 100644 | |
--- a/array.c | |
+++ b/array.c | |
@@ -82,12 +82,10 @@ ary_new() | |
return ary_new2(ARY_DEFAULT_SIZE); | |
} | |
-#include <varargs.h> | |
+#include <stdarg.h> | |
VALUE | |
-ary_new3(n, va_alist) | |
- int n; | |
- va_dcl | |
+ary_new3(int n, ...) | |
{ | |
va_list ar; | |
struct RArray* ary; | |
@@ -98,7 +96,7 @@ ary_new3(n, va_alist) | |
} | |
ary = (struct RArray*)ary_new2(n<ARY_DEFAULT_SIZE?ARY_DEFAULT_SIZE:n); | |
- va_start(ar); | |
+ va_start(ar, n); | |
for (i=0; i<n; i++) { | |
ary->ptr[i] = va_arg(ar, VALUE); | |
} | |
@@ -259,7 +257,7 @@ ary_shift(ary) | |
VALUE | |
ary_unshift(ary, item) | |
struct RArray *ary; | |
- int item; | |
+ VALUE item; | |
{ | |
ary_modify(ary); | |
if (ary->len >= ary->capa) { | |
diff --git a/class.c b/class.c | |
index b78b2aa..9fd2705 100644 | |
--- a/class.c | |
+++ b/class.c | |
@@ -349,22 +349,18 @@ rb_define_attr(class, id, pub) | |
} | |
} | |
-#include <varargs.h> | |
+#include <stdarg.h> | |
#include <ctype.h> | |
int | |
-rb_scan_args(argc, argv, fmt, va_alist) | |
- int argc; | |
- VALUE *argv; | |
- char *fmt; | |
- va_dcl | |
+rb_scan_args(int argc, VALUE *argv, char *fmt, ...) | |
{ | |
int n, i; | |
char *p = fmt; | |
VALUE *var; | |
va_list vargs; | |
- va_start(vargs); | |
+ va_start(vargs, fmt); | |
if (*p == '*') { | |
var = va_arg(vargs, VALUE*); | |
diff --git a/dln.c b/dln.c | |
index 23edc6f..896cef0 100644 | |
--- a/dln.c | |
+++ b/dln.c | |
@@ -54,7 +54,7 @@ void *xrealloc(); | |
#endif | |
#ifndef NT | |
-char *strdup(); | |
+// char *strdup(); | |
char *getenv(); | |
#endif | |
diff --git a/enum.c b/enum.c | |
index 5074170..2c3e4fd 100644 | |
--- a/enum.c | |
+++ b/enum.c | |
@@ -78,7 +78,7 @@ find_i(i, arg) | |
static VALUE | |
enum_find(argc, argv, obj) | |
int argc; | |
- VALUE argv; | |
+ VALUE *argv; | |
VALUE obj; | |
{ | |
struct find_arg arg; | |
diff --git a/error.c b/error.c | |
index 39e63dd..f5f0580 100644 | |
--- a/error.c | |
+++ b/error.c | |
@@ -13,7 +13,7 @@ | |
#include "ruby.h" | |
#include "env.h" | |
#include <stdio.h> | |
-#include <varargs.h> | |
+#include <stdarg.h> | |
extern char *sourcefile; | |
extern int sourceline; | |
@@ -68,36 +68,30 @@ err_print(fmt, args) | |
} | |
void | |
-Error(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+Error(char *fmt, ...) | |
{ | |
va_list args; | |
- va_start(args); | |
+ va_start(args, fmt); | |
err_print(fmt, args); | |
va_end(args); | |
nerrs++; | |
} | |
void | |
-Error_Append(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+Error_Append(char *fmt, ...) | |
{ | |
va_list args; | |
char buf[BUFSIZ]; | |
- va_start(args); | |
+ va_start(args, fmt); | |
vsprintf(buf, fmt, args); | |
va_end(args); | |
err_append(buf); | |
} | |
void | |
-Warning(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+Warning(char *fmt, ...) | |
{ | |
char buf[BUFSIZ]; | |
va_list args; | |
@@ -106,15 +100,13 @@ Warning(fmt, va_alist) | |
sprintf(buf, "warning: %s", fmt); | |
- va_start(args); | |
+ va_start(args, fmt); | |
err_print(buf, args); | |
va_end(args); | |
} | |
void | |
-Bug(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+Bug(char *fmt, ...) | |
{ | |
char buf[BUFSIZ]; | |
va_list args; | |
@@ -122,7 +114,7 @@ Bug(fmt, va_alist) | |
sprintf(buf, "[BUG] %s", fmt); | |
rb_in_eval = 0; | |
- va_start(args); | |
+ va_start(args, fmt); | |
err_print(buf, args); | |
va_end(args); | |
abort(); | |
@@ -156,7 +148,7 @@ static struct types { | |
-1, 0, | |
}; | |
-extern void TypeError(); | |
+extern void TypeError(char *fmt, ...); | |
void | |
rb_check_type(x, t) | |
@@ -267,7 +259,7 @@ exception(argc, argv) | |
int argc; | |
VALUE *argv; | |
{ | |
- void ArgError(); | |
+ void ArgError(char *fmt, ...); | |
VALUE v = Qnil; | |
int i; | |
ID id; | |
@@ -341,7 +333,7 @@ Init_Exception() | |
va_list args;\ | |
char buf[BUFSIZ];\ | |
\ | |
- va_start(args);\ | |
+ va_start(args, fmt);\ | |
vsprintf(buf, fmt, args);\ | |
va_end(args);\ | |
\ | |
@@ -349,50 +341,37 @@ Init_Exception() | |
} | |
void | |
-Raise(exc, fmt, va_alist) | |
- VALUE exc; | |
- char *fmt; | |
- va_dcl | |
+Raise(VALUE exc, char *fmt, ...) | |
{ | |
RAISE_ERROR(exc); | |
} | |
void | |
-TypeError(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+TypeError(char *fmt, ...) | |
{ | |
RAISE_ERROR(eTypeError); | |
} | |
void | |
-ArgError(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+ArgError(char *fmt, ...) | |
{ | |
RAISE_ERROR(eArgError); | |
} | |
void | |
-NameError(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+NameError(char *fmt, ...) | |
{ | |
RAISE_ERROR(eNameError); | |
} | |
void | |
-IndexError(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+IndexError(char *fmt, ...) | |
{ | |
RAISE_ERROR(eIndexError); | |
} | |
void | |
-Fail(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+Fail(char *fmt, ...) | |
{ | |
RAISE_ERROR(eRuntimeError); | |
} | |
@@ -406,22 +385,18 @@ rb_notimplement() | |
} | |
void | |
-LoadError(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+LoadError(char *fmt, ...) | |
{ | |
RAISE_ERROR(eLoadError); | |
} | |
void | |
-Fatal(fmt, va_alist) | |
- char *fmt; | |
- va_dcl | |
+Fatal(char *fmt, ...) | |
{ | |
va_list args; | |
char buf[BUFSIZ]; | |
- va_start(args); | |
+ va_start(args, fmt); | |
vsprintf(buf, fmt, args); | |
va_end(args); | |
diff --git a/eval.c b/eval.c | |
index 92113a7..a579652 100644 | |
--- a/eval.c | |
+++ b/eval.c | |
@@ -40,7 +40,7 @@ static VALUE f_binding(); | |
#define CACHE_SIZE 0x200 | |
#define CACHE_MASK 0x1ff | |
-#define EXPR1(c,m) ((((int)(c)>>3)^(m))&CACHE_MASK) | |
+#define EXPR1(c,m) ((((VALUE)(c)>>3)^(m))&CACHE_MASK) | |
struct cache_entry { /* method hash table. */ | |
ID mid; /* method's id */ | |
@@ -261,8 +261,8 @@ struct BLOCK { | |
struct FRAME frame; | |
struct SCOPE *scope; | |
struct RClass *class; | |
- int level; | |
- int iter; | |
+ struct tag *level; | |
+ struct iter *iter; | |
struct RVarmap *d_vars; | |
#ifdef THREAD | |
VALUE orig_thread; | |
@@ -272,7 +272,7 @@ struct BLOCK { | |
#define PUSH_BLOCK(v,b) { \ | |
struct BLOCK _block; \ | |
- _block.level = (int)prot_tag; \ | |
+ _block.level = prot_tag; \ | |
_block.var = v; \ | |
_block.body = b; \ | |
_block.self = self; \ | |
@@ -383,6 +383,7 @@ static struct tag { | |
struct FRAME *frame; | |
struct iter *iter; | |
struct tag *prev; | |
+ VALUE ret; | |
} *prot_tag; | |
#define PUSH_TAG() { \ | |
@@ -392,12 +393,13 @@ static struct tag { | |
_tag.prev = prot_tag; \ | |
prot_tag = &_tag; | |
-#define EXEC_TAG() ((NODE*)setjmp(prot_tag->buf)) | |
+#define EXEC_TAG() (setjmp(prot_tag->buf) ? (NODE *)prot_tag->ret : 0) | |
#define JUMP_TAG(st) { \ | |
the_frame = prot_tag->frame; \ | |
the_iter = prot_tag->iter; \ | |
- longjmp(prot_tag->buf,(int)(st)); \ | |
+ prot_tag->ret = (VALUE)(st); \ | |
+ longjmp(prot_tag->buf, -1); \ | |
} | |
#define JUMP_TAG3(val,data1,data2) \ | |
@@ -2243,6 +2245,7 @@ f_retry() | |
} | |
#ifdef __GNUC__ | |
+typedef void voidfn (); | |
static volatile voidfn rb_longjmp; | |
#endif | |
@@ -2393,6 +2396,9 @@ rb_yield_0(val, self) | |
else if (nd_type(node) == NODE_CFUNC) { | |
result = (*node->nd_cfnc)(val, node->nd_argc, self); | |
} | |
+ else if (nd_type(node) == NODE_CFUNC_TMP) { | |
+ result = (*node->nd_cfnc)(val, node->nd_body); | |
+ } | |
else { | |
result = rb_eval(self, node); | |
} | |
@@ -2539,7 +2545,7 @@ rb_iterate(it_proc, data1, bl_proc, data2) | |
{ | |
NODE *state; | |
volatile VALUE retval = Qnil; | |
- NODE *node = NEW_CFUNC(bl_proc, data2); | |
+ NODE *node = node_newnode(NODE_CFUNC_TMP, bl_proc, data2, 0); | |
VALUE self = TopSelf; | |
int tag_level; | |
@@ -3144,14 +3150,10 @@ f_send(argc, argv, recv) | |
return vid; | |
} | |
-#include <varargs.h> | |
+#include <stdarg.h> | |
VALUE | |
-rb_funcall(recv, mid, n, va_alist) | |
- VALUE recv; | |
- ID mid; | |
- int n; | |
- va_dcl | |
+rb_funcall(VALUE recv, ID mid, int n, ...) | |
{ | |
va_list ar; | |
VALUE *argv; | |
@@ -3161,7 +3163,7 @@ rb_funcall(recv, mid, n, va_alist) | |
argv = ALLOCA_N(VALUE, n); | |
- va_start(ar); | |
+ va_start(ar, n); | |
for (i=0;i<n;i++) { | |
argv[i] = va_arg(ar, VALUE); | |
} | |
diff --git a/file.c b/file.c | |
index 0caa98a..bd09aef 100644 | |
--- a/file.c | |
+++ b/file.c | |
@@ -368,87 +368,87 @@ file_lstat(obj) | |
#endif | |
} | |
-static int | |
-group_member(gid) | |
- GETGROUPS_T gid; | |
-{ | |
-#ifndef NT | |
- if (getgid() == gid || getegid() == gid) | |
- return TRUE; | |
- | |
-# ifdef HAVE_GETGROUPS | |
-# ifndef NGROUPS | |
-# define NGROUPS 32 | |
-# endif | |
- { | |
- GETGROUPS_T gary[NGROUPS]; | |
- int anum; | |
- | |
- anum = getgroups(NGROUPS, gary); | |
- while (--anum >= 0) | |
- if (gary[anum] == gid) | |
- return TRUE; | |
- } | |
-# endif | |
-#endif | |
- return FALSE; | |
-} | |
+// static int | |
+// group_member(gid) | |
+// GETGROUPS_T gid; | |
+// { | |
+// #ifndef NT | |
+// if (getgid() == gid || getegid() == gid) | |
+// return TRUE; | |
+// | |
+// # ifdef HAVE_GETGROUPS | |
+// # ifndef NGROUPS | |
+// # define NGROUPS 32 | |
+// # endif | |
+// { | |
+// GETGROUPS_T gary[NGROUPS]; | |
+// int anum; | |
+// | |
+// anum = getgroups(NGROUPS, gary); | |
+// while (--anum >= 0) | |
+// if (gary[anum] == gid) | |
+// return TRUE; | |
+// } | |
+// # endif | |
+// #endif | |
+// return FALSE; | |
+// } | |
#ifndef S_IXUGO | |
# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) | |
#endif | |
-int | |
-eaccess(path, mode) | |
- char *path; | |
- int mode; | |
-{ | |
-#ifndef NT | |
- struct stat st; | |
- static int euid = -1; | |
- | |
- if (stat(path, &st) < 0) return (-1); | |
- | |
- if (euid == -1) | |
- euid = geteuid (); | |
- | |
- if (euid == 0) | |
- { | |
- /* Root can read or write any file. */ | |
- if (mode != X_OK) | |
- return 0; | |
- | |
- /* Root can execute any file that has any one of the execute | |
- bits set. */ | |
- if (st.st_mode & S_IXUGO) | |
- return 0; | |
- } | |
- | |
-#if defined(DJGPP) | |
- { | |
- int stat_mode = 0; | |
- if (mode & X_OK) | |
- stat_mode |= S_IXOTH; | |
- if (mode & W_OK) | |
- stat_mode |= S_IWOTH; | |
- if (mode & R_OK) | |
- stat_mode |= S_IROTH; | |
- mode = stat_mode; | |
- } | |
-#endif | |
- | |
- if (st.st_uid == euid) /* owner */ | |
- mode <<= 6; | |
- else if (group_member (st.st_gid)) | |
- mode <<= 3; | |
- | |
- if (st.st_mode & mode) return 0; | |
- | |
- return -1; | |
-#else /* !NT*/ | |
- return 0; | |
-#endif | |
-} | |
+// int | |
+// eaccess(path, mode) | |
+// char *path; | |
+// int mode; | |
+// { | |
+// #ifndef NT | |
+// struct stat st; | |
+// static int euid = -1; | |
+// | |
+// if (stat(path, &st) < 0) return (-1); | |
+// | |
+// if (euid == -1) | |
+// euid = geteuid (); | |
+// | |
+// if (euid == 0) | |
+// { | |
+// /* Root can read or write any file. */ | |
+// if (mode != X_OK) | |
+// return 0; | |
+// | |
+// /* Root can execute any file that has any one of the execute | |
+// bits set. */ | |
+// if (st.st_mode & S_IXUGO) | |
+// return 0; | |
+// } | |
+// | |
+// #if defined(DJGPP) | |
+// { | |
+// int stat_mode = 0; | |
+// if (mode & X_OK) | |
+// stat_mode |= S_IXOTH; | |
+// if (mode & W_OK) | |
+// stat_mode |= S_IWOTH; | |
+// if (mode & R_OK) | |
+// stat_mode |= S_IROTH; | |
+// mode = stat_mode; | |
+// } | |
+// #endif | |
+// | |
+// if (st.st_uid == euid) /* owner */ | |
+// mode <<= 6; | |
+// else if (group_member (st.st_gid)) | |
+// mode <<= 3; | |
+// | |
+// if (st.st_mode & mode) return 0; | |
+// | |
+// return -1; | |
+// #else /* !NT*/ | |
+// return 0; | |
+// #endif | |
+// } | |
static VALUE | |
test_d(obj, fname) | |
diff --git a/gc.c b/gc.c | |
index 710f8d6..47c4f3c 100644 | |
--- a/gc.c | |
+++ b/gc.c | |
@@ -200,8 +200,8 @@ RVALUE *freelist = 0; | |
#define HEAPS_INCREMENT 10 | |
static RVALUE **heaps; | |
-static int heaps_length = 0; | |
-static int heaps_used = 0; | |
+static VALUE heaps_length = 0; | |
+static VALUE heaps_used = 0; | |
#define HEAP_SLOTS 10000 | |
#define FREE_MIN 512 | |
diff --git a/glob.c b/glob.c | |
index 6c355ad..6d08978 100644 | |
--- a/glob.c | |
+++ b/glob.c | |
@@ -20,6 +20,7 @@ | |
based on specifications for the pattern matching. --RMS. */ | |
#include "config.h" | |
+#include "ruby.h" | |
#include <sys/types.h> | |
@@ -79,7 +80,7 @@ | |
#ifdef _AIX | |
#pragma alloca | |
#else | |
-#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__) | |
+#if defined(HAVE_ALLOCA_H) | |
#include <alloca.h> | |
#else | |
char *alloca (); | |
diff --git a/node.h b/node.h | |
index db5824b..b413028 100644 | |
--- a/node.h | |
+++ b/node.h | |
@@ -94,6 +94,8 @@ enum node_type { | |
NODE_DEFINED, | |
NODE_TAG, | |
NODE_NEWLINE, | |
+ | |
+ NODE_CFUNC_TMP, | |
}; | |
typedef struct RNode { | |
diff --git a/object.c b/object.c | |
index 6430440..d83257c 100644 | |
--- a/object.c | |
+++ b/object.c | |
@@ -396,6 +396,7 @@ static VALUE | |
class_s_new(argc, argv, class) | |
int argc; | |
VALUE *argv; | |
+ VALUE class; | |
{ | |
VALUE super, cls; | |
diff --git a/parse.y b/parse.y | |
index 02ff720..e16ed9c 100644 | |
--- a/parse.y | |
+++ b/parse.y | |
@@ -2925,7 +2925,6 @@ static NODE* | |
block_append(head, tail) | |
NODE *head, *tail; | |
{ | |
- extern int verbose; | |
NODE *end; | |
if (tail == 0) return head; | |
diff --git a/regex.c b/regex.c | |
index 686695c..31c6daf 100644 | |
--- a/regex.c | |
+++ b/regex.c | |
@@ -34,6 +34,7 @@ | |
#include "config.h" | |
#include "defines.h" | |
+#include "ruby.h" | |
#ifdef __STDC__ | |
#define P(s) s | |
diff --git a/ruby.c b/ruby.c | |
index 5d8a028..7e65ead 100644 | |
--- a/ruby.c | |
+++ b/ruby.c | |
@@ -30,9 +30,9 @@ char *getenv(); | |
static int version, copyright; | |
-int debug = FALSE; | |
-int verbose = FALSE; | |
-int tainting = FALSE; | |
+VALUE debug = FALSE; | |
+VALUE verbose = FALSE; | |
+VALUE tainting = FALSE; | |
static int sflag = FALSE; | |
char *inplace = FALSE; | |
diff --git a/ruby.h b/ruby.h | |
index b477c9e..37b2ec2 100644 | |
--- a/ruby.h | |
+++ b/ruby.h | |
@@ -16,6 +16,11 @@ | |
#include "config.h" | |
#include "defines.h" | |
+#include <string.h> | |
+#include <stdio.h> | |
+#include <crypt.h> | |
+#include <time.h> | |
+#include <unistd.h> | |
#ifdef HAVE_STDLIB_H | |
# include <stdlib.h> | |
@@ -42,8 +47,8 @@ | |
#endif | |
typedef unsigned int UINT; | |
-typedef UINT VALUE; | |
-typedef UINT ID; | |
+typedef unsigned long long VALUE; | |
+typedef VALUE ID; | |
typedef unsigned short USHORT; | |
typedef unsigned char UCHAR; | |
@@ -74,7 +79,7 @@ typedef unsigned char UCHAR; | |
#define FIXNUM_MIN RSHIFT((long)LONG_MIN,1) | |
#define FIXNUM_FLAG 0x01 | |
-#define INT2FIX(i) (VALUE)(((int)(i))<<1 | FIXNUM_FLAG) | |
+#define INT2FIX(i) (((VALUE)(i))<<1 | FIXNUM_FLAG) | |
VALUE int2inum _((int)); | |
#define INT2NUM(v) int2inum(v) | |
@@ -83,10 +88,10 @@ VALUE int2inum _((int)); | |
#else | |
# define RSHIFT(x,y) (((x)<0) ? ~((~(x))>>y) : (x)>>y) | |
#endif | |
-#define FIX2INT(x) RSHIFT((int)x,1) | |
+#define FIX2INT(x) RSHIFT((VALUE)x,1) | |
#define FIX2UINT(f) ((UINT)(f)>>1) | |
-#define FIXNUM_P(f) (((int)(f))&FIXNUM_FLAG) | |
+#define FIXNUM_P(f) (((VALUE)(f))&FIXNUM_FLAG) | |
#define POSFIXABLE(f) ((f) <= FIXNUM_MAX) | |
#define NEGFIXABLE(f) ((f) >= FIXNUM_MIN) | |
#define FIXABLE(f) (POSFIXABLE(f) && NEGFIXABLE(f)) | |
@@ -148,6 +153,7 @@ void rb_secure _((int)); | |
VALUE num2fix _((VALUE)); | |
int num2int _((VALUE)); | |
+struct RBasic * rb_newobj(); | |
#define NEWOBJ(obj,type) type *obj = (type*)rb_newobj() | |
#define OBJSETUP(obj,c,t) {\ | |
RBASIC(obj)->class = (c);\ | |
@@ -324,8 +330,8 @@ char *rb_class2name _((VALUE)); | |
int rb_method_boundp _((VALUE,ID,int)); | |
VALUE rb_eval_string _((char*)); | |
-VALUE rb_funcall(); | |
-int rb_scan_args(); | |
+VALUE rb_funcall(VALUE recv, ID mid, int n, ...); | |
+int rb_scan_args(int argc, VALUE *argv, char *fmt, ...); | |
VALUE rb_iv_get(); | |
VALUE rb_iv_set(); | |
@@ -337,12 +343,12 @@ int iterator_p(); | |
VALUE rb_equal _((VALUE,VALUE)); | |
-extern int verbose, debug; | |
+extern VALUE verbose, debug; | |
int rb_safe_level(); | |
void rb_set_safe_level _((int)); | |
-#ifdef __GNUC__ | |
+#ifdef __GNUC__XXX | |
typedef void voidfn (); | |
volatile voidfn Raise; | |
volatile voidfn Fail; | |
@@ -356,11 +362,11 @@ volatile voidfn rb_fatal; | |
volatile voidfn rb_raise; | |
volatile voidfn rb_notimplement; | |
#else | |
-void Raise(); | |
-void Fail(); | |
-void Fatal(); | |
-void Bug(); | |
-void WrongType(); | |
+void Raise(VALUE exc, char *fmt, ...); | |
+void Fail(char *fmt, ...); | |
+void Fatal(char *fmt, ...); | |
+void Bug(char *fmt, ...); | |
+void WrongType(char *fmt, ...); | |
void rb_sys_fail(); | |
void rb_break(); | |
void rb_exit(); | |
@@ -369,12 +375,111 @@ void rb_raise(); | |
void rb_notimplement(); | |
#endif | |
-void Error(); | |
-void Warning(); | |
+void Error(char *fmt, ...); | |
+void Warning(char *fmt, ...); | |
#if defined(EXTLIB) && defined(USE_DLN_A_OUT) | |
/* hook for external modules */ | |
static char *libs_to_be_linked[] = { EXTLIB, 0 }; | |
#endif | |
+ | |
+VALUE rb_to_a(); | |
+VALUE obj_alloc(); | |
+VALUE str_new(); | |
+VALUE str_new2(); | |
+VALUE str_new3(); | |
+VALUE str_new4(); | |
+VALUE str_dup(); | |
+VALUE rb_inspect(); | |
+VALUE obj_as_string(); | |
+VALUE rb_hash(); | |
+VALUE str_taint(); | |
+VALUE ary_new(); | |
+VALUE ary_push(); | |
+VALUE ary_shift(); | |
+VALUE ary_new2(); | |
+VALUE str_dup_freezed(); | |
+VALUE rb_define_class_under(); | |
+VALUE struct_new(VALUE, ...); | |
+VALUE ary_unshift(); | |
+VALUE struct_define(char *name, ...); | |
+VALUE io_gets(); | |
+VALUE str2inum(); | |
+VALUE float_new(); | |
+VALUE uint2inum(); | |
+VALUE reg_new(); | |
+VALUE ary_new4(); | |
+VALUE exc_new(); | |
+VALUE exc_new2(); | |
+VALUE exc_new3(); | |
+VALUE any_to_s(); | |
+VALUE ary_join(); | |
+VALUE file_s_expand_path(); | |
+VALUE ary_new3(int n, ...); | |
+VALUE range_new(); | |
+VALUE file_open(); | |
+VALUE io_getc(); | |
+VALUE reg_match2(); | |
+int rb_const_defined(); | |
+VALUE reg_match_pre(); | |
+VALUE reg_match_post(); | |
+VALUE rb_gvar_get(); | |
+VALUE rb_ivar_get(); | |
+VALUE id_attrset(); | |
+VALUE reg_last_match(); | |
+VALUE reg_nth_match(); | |
+VALUE hash_new(); | |
+VALUE ary_entry(); | |
+int str_cicmp(); | |
+VALUE reg_match(); | |
+VALUE reg_regcomp(); | |
+int reg_search(); | |
+VALUE backref_get(); | |
+VALUE reg_regsub(); | |
+VALUE lastline_get(); | |
+VALUE assoc_new(); | |
+VALUE io_reopen(); | |
+struct timeval time_timeval(); | |
+VALUE reg_match_last(); | |
+VALUE rb_const_get_at(); | |
+VALUE f_lambda(); | |
+VALUE dbl2big(); | |
+VALUE int2big(); | |
+VALUE big2str(); | |
+void big_2comp(); | |
+VALUE big_clone(); | |
+unsigned long scan_oct(); | |
+VALUE ary_plus(); | |
+VALUE enum_length(); | |
+int str_cmp(); | |
+VALUE num_coerce_bin(); | |
+VALUE rb_ensure(); | |
+VALUE ary_sort(); | |
+VALUE rb_class_path(); | |
+VALUE str_taint(); | |
+VALUE fix2str(); | |
+VALUE singleton_class_clone(); | |
+VALUE f_float(); | |
+VALUE str_plus(); | |
+VALUE str_times(); | |
+int big2int(); | |
+VALUE rb_rescue(); | |
+VALUE big_pow(); | |
+VALUE big_mul(); | |
+VALUE big_plus(); | |
+VALUE big_minus(); | |
+VALUE big_and(); | |
+VALUE big_or(); | |
+VALUE big_xor(); | |
+VALUE big_lshift(); | |
+VALUE f_sprintf(); | |
+void rb_set_class_path(); | |
+void rb_name_class(); | |
+VALUE rb_singleton_class(); | |
+VALUE rb_define_class_id(); | |
+VALUE singleton_class_new(); | |
+VALUE class_new(); | |
+VALUE rb_define_module_id(); | |
+ | |
#endif | |
diff --git a/st.c b/st.c | |
index 6b25bc8..350d4c5 100644 | |
--- a/st.c | |
+++ b/st.c | |
@@ -3,6 +3,7 @@ | |
static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible"; | |
#include "config.h" | |
+#include "ruby.h" | |
#include <stdio.h> | |
#include "st.h" | |
diff --git a/struct.c b/struct.c | |
index 52822d9..b7f4e78 100644 | |
--- a/struct.c | |
+++ b/struct.c | |
@@ -155,12 +155,10 @@ make_struct(name, member) | |
return nstr; | |
} | |
-#include <varargs.h> | |
+#include <stdarg.h> | |
VALUE | |
-struct_define(name, va_alist) | |
- char *name; | |
- va_dcl | |
+struct_define(char *name, ...) | |
{ | |
va_list ar; | |
VALUE nm, ary; | |
@@ -169,7 +167,7 @@ struct_define(name, va_alist) | |
nm = str_new2(name); | |
ary = ary_new(); | |
- va_start(ar); | |
+ va_start(ar, name); | |
while (mem = va_arg(ar, char*)) { | |
ID slot = rb_intern(mem); | |
ary_push(ary, INT2FIX(slot)); | |
@@ -225,9 +223,7 @@ struct_alloc(class, values) | |
} | |
VALUE | |
-struct_new(class, va_alist) | |
- VALUE class; | |
- va_dcl | |
+struct_new(VALUE class, ...) | |
{ | |
VALUE val, mem; | |
int size; | |
@@ -236,7 +232,7 @@ struct_new(class, va_alist) | |
val = rb_iv_get(class, "__size__"); | |
size = FIX2INT(val); | |
mem = ary_new(); | |
- va_start(args); | |
+ va_start(args, size); | |
while (size--) { | |
val = va_arg(args, VALUE); | |
ary_push(mem, val); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment