mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* the VMS support patch submitted by Akiyoshi, Masamichi
<Masamichi.Akiyoshi@jp.compaq.com> is merged. * eval.c (exec_under): changing ruby_class is OK, but should not alter cbase. * eval.c (yield_under_i): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
890521d117
commit
2bd0c2bf73
16 changed files with 259 additions and 93 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,8 @@
|
|||
Fri Mar 22 16:22:55 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* the VMS support patch submitted by Akiyoshi, Masamichi
|
||||
<Masamichi.Akiyoshi@jp.compaq.com> is merged.
|
||||
|
||||
Fri Mar 22 16:27:24 2002 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* lib/racc/parser.rb: new file.
|
||||
|
@ -8,6 +13,13 @@ Fri Mar 22 16:27:24 2002 Minero Aoki <aamine@loveruby.net>
|
|||
|
||||
* ext/Setup*: add racc/cparse.
|
||||
|
||||
Fri Mar 22 15:04:03 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* eval.c (exec_under): changing ruby_class is OK, but should not
|
||||
alter cbase.
|
||||
|
||||
* eval.c (yield_under_i): ditto.
|
||||
|
||||
Fri Mar 22 15:44:38 2002 Minero Aoki <aamine@loveruby.net>
|
||||
|
||||
* ext/strscan/MANIFEST, strscan.c, depend, extconf.rb: new files.
|
||||
|
|
6
bignum.c
6
bignum.c
|
@ -290,7 +290,8 @@ rb_quad_pack(buf, val)
|
|||
if (!RBIGNUM(val)->sign) {
|
||||
len = QUAD_SIZE;
|
||||
while (len--) {
|
||||
*buf = ~*buf++;
|
||||
*buf = (J~(B*buf;
|
||||
buf++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +312,8 @@ rb_quad_unpack(buf, sign)
|
|||
|
||||
RBIGNUM(big)->sign = 0;
|
||||
while (len--) {
|
||||
*tmp = ~*tmp++;
|
||||
*tmp = ~*tmp;
|
||||
tmp++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,6 +88,10 @@ void xfree _((void*));
|
|||
#include "win32/win32.h"
|
||||
#endif
|
||||
|
||||
#if defined(__VMS)
|
||||
#include "vms/vms.h"
|
||||
#endif
|
||||
|
||||
#if defined __CYGWIN__
|
||||
# undef EXTERN
|
||||
# if defined USEIMPORTLIB
|
||||
|
|
34
dln.c
34
dln.c
|
@ -48,7 +48,7 @@ void *xrealloc();
|
|||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef NT
|
||||
#if defined(NT) || defined(__VMS)
|
||||
#include "missing/file.h"
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
|
@ -72,6 +72,11 @@ void *xrealloc();
|
|||
char *getenv();
|
||||
#endif
|
||||
|
||||
#if defined(__VMS)
|
||||
#pragma builtins
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef __MACOS__
|
||||
# include <TextUtils.h>
|
||||
# include <CodeFragments.h>
|
||||
|
@ -1517,6 +1522,33 @@ dln_load(file)
|
|||
}
|
||||
#endif /* __MACOS__ */
|
||||
|
||||
#if defined(__VMS)
|
||||
#define DLN_DEFINED
|
||||
{
|
||||
void *handle, (*init_fct)();
|
||||
char *fname, *p1, *p2;
|
||||
|
||||
fname = (char *)__alloca(strlen(file)+1);
|
||||
strcpy(fname,file);
|
||||
if (p1 = strrchr(fname,'/'))
|
||||
fname = p1 + 1;
|
||||
if (p2 = strrchr(fname,'.'))
|
||||
*p2 = '(J\(B0';
|
||||
|
||||
if ((handle = (void*)dlopen(fname, 0)) == NULL) {
|
||||
goto failed;
|
||||
}
|
||||
|
||||
if ((init_fct = (void (*)())dlsym(handle, buf)) == NULL) {
|
||||
dlclose(handle);
|
||||
goto failed;
|
||||
}
|
||||
/* Call the init code */
|
||||
(*init_fct)();
|
||||
return handle;
|
||||
}
|
||||
#endif /* __VMS */
|
||||
|
||||
#ifndef DLN_DEFINED
|
||||
rb_notimplement("dynamic link not supported");
|
||||
#endif
|
||||
|
|
2
error.c
2
error.c
|
@ -718,7 +718,7 @@ void
|
|||
rb_sys_fail(mesg)
|
||||
const char *mesg;
|
||||
{
|
||||
#ifndef NT
|
||||
#if !defined(NT) && !defined(__VMS)
|
||||
char *strerror();
|
||||
#endif
|
||||
char *err;
|
||||
|
|
50
eval.c
50
eval.c
|
@ -87,6 +87,10 @@ struct timeval {
|
|||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(__VMS)
|
||||
#pragma nostandard
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
|
@ -3110,7 +3114,7 @@ rb_eval(self, n)
|
|||
body = search_method(ruby_class, node->nd_mid, &origin);
|
||||
if (body){
|
||||
if (RTEST(ruby_verbose) && ruby_class == origin && body->nd_cnt == 0) {
|
||||
rb_warning("discarding old %s", rb_id2name(node->nd_mid));
|
||||
rb_warning("method redefined; discarding old %s", rb_id2name(node->nd_mid));
|
||||
}
|
||||
if (node->nd_noex) { /* toplevel */
|
||||
/* should upgrade to rb_warn() if no super was called inside? */
|
||||
|
@ -5106,9 +5110,9 @@ rb_f_eval(argc, argv, self)
|
|||
|
||||
/* function to call func under the specified class/module context */
|
||||
static VALUE
|
||||
exec_under(func, under, args)
|
||||
exec_under(func, under, cbase, args)
|
||||
VALUE (*func)();
|
||||
VALUE under;
|
||||
VALUE under, cbase;
|
||||
void *args;
|
||||
{
|
||||
VALUE val; /* OK */
|
||||
|
@ -5123,10 +5127,12 @@ exec_under(func, under, args)
|
|||
ruby_frame->last_class = _frame.prev->last_class;
|
||||
ruby_frame->argc = _frame.prev->argc;
|
||||
ruby_frame->argv = _frame.prev->argv;
|
||||
if (ruby_cbase != under) {
|
||||
ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,under,0,ruby_frame->cbase);
|
||||
if (cbase) {
|
||||
if (ruby_cbase != cbase) {
|
||||
ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,under,0,ruby_frame->cbase);
|
||||
}
|
||||
PUSH_CREF(cbase);
|
||||
}
|
||||
PUSH_CREF(under);
|
||||
|
||||
mode = scope_vmode;
|
||||
SCOPE_SET(SCOPE_PUBLIC);
|
||||
|
@ -5135,7 +5141,7 @@ exec_under(func, under, args)
|
|||
val = (*func)(args);
|
||||
}
|
||||
POP_TAG();
|
||||
POP_CREF();
|
||||
if (cbase) POP_CREF();
|
||||
SCOPE_SET(mode);
|
||||
POP_FRAME();
|
||||
POP_CLASS();
|
||||
|
@ -5170,39 +5176,13 @@ eval_under(under, self, src, file, line)
|
|||
args[1] = src;
|
||||
args[2] = (VALUE)file;
|
||||
args[3] = (VALUE)line;
|
||||
return exec_under(eval_under_i, under, args);
|
||||
return exec_under(eval_under_i, under, under, args);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
yield_under_i(self)
|
||||
VALUE self;
|
||||
{
|
||||
if (ruby_block->flags & BLOCK_DYNAMIC) {
|
||||
struct BLOCK * volatile old_block = ruby_block;
|
||||
struct BLOCK block;
|
||||
|
||||
/* cbase should be pointed from volatile local variable */
|
||||
/* to be protected from GC. */
|
||||
VALUE result;
|
||||
int state;
|
||||
|
||||
/* copy the block to avoid modifying global data. */
|
||||
block = *ruby_block;
|
||||
block.frame.cbase = ruby_frame->cbase;
|
||||
ruby_block = █
|
||||
|
||||
PUSH_TAG(PROT_NONE);
|
||||
if ((state = EXEC_TAG()) == 0) {
|
||||
result = rb_yield_0(self, self, ruby_class, 0);
|
||||
}
|
||||
POP_TAG();
|
||||
ruby_block = old_block;
|
||||
if (state) JUMP_TAG(state);
|
||||
|
||||
return result;
|
||||
}
|
||||
/* static block, no need to restore */
|
||||
ruby_block->frame.cbase = ruby_frame->cbase;
|
||||
return rb_yield_0(self, self, ruby_class, 0);
|
||||
}
|
||||
|
||||
|
@ -5211,7 +5191,7 @@ static VALUE
|
|||
yield_under(under, self)
|
||||
VALUE under, self;
|
||||
{
|
||||
return exec_under(yield_under_i, under, self);
|
||||
return exec_under(yield_under_i, under, 0, self);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
|
@ -401,9 +401,9 @@ bsock_send(argc, argv, sock)
|
|||
return INT2FIX(n);
|
||||
}
|
||||
|
||||
static VALUE ipaddr _((struct sockaddr *));
|
||||
static VALUE ipaddr _((struct sockaddr*));
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
static VALUE unixaddr _((struct sockaddr_un *));
|
||||
static VALUE unixaddr _((struct sockaddr_un*));
|
||||
#endif
|
||||
|
||||
enum sock_recv_type {
|
||||
|
@ -465,10 +465,10 @@ s_recvfrom(sock, argc, argv, from)
|
|||
rb_raise(rb_eTypeError, "sockaddr size differs - should not happen");
|
||||
}
|
||||
#endif
|
||||
return rb_assoc_new(str, ipaddr((struct sockaddr *)buf));
|
||||
return rb_assoc_new(str, ipaddr((struct sockaddr*)buf));
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
case RECV_UNIX:
|
||||
return rb_assoc_new(str, unixaddr((struct sockaddr_un *)buf));
|
||||
return rb_assoc_new(str, unixaddr((struct sockaddr_un*)buf));
|
||||
#endif
|
||||
case RECV_SOCKET:
|
||||
return rb_assoc_new(str, rb_tainted_str_new(buf, alen));
|
||||
|
@ -535,7 +535,7 @@ mkinetaddr(host, buf, len)
|
|||
sin.sin_family = AF_INET;
|
||||
SET_SIN_LEN(&sin, sizeof(sin));
|
||||
sin.sin_addr.s_addr = host;
|
||||
mkipaddr0((struct sockaddr *)&sin, buf, len);
|
||||
mkipaddr0((struct sockaddr*)&sin, buf, len);
|
||||
}
|
||||
|
||||
static struct addrinfo*
|
||||
|
@ -590,6 +590,7 @@ ip_addrsetup(host, port)
|
|||
MEMZERO(&hints, struct addrinfo, 1);
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_DGRAM;
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
error = getaddrinfo(hostp, portp, &hints, &res);
|
||||
if (error) {
|
||||
if (hostp && hostp[strlen(hostp)-1] == '\n') {
|
||||
|
@ -972,17 +973,19 @@ static VALUE
|
|||
tcp_s_gethostbyname(obj, host)
|
||||
VALUE obj, host;
|
||||
{
|
||||
#if 0
|
||||
struct sockaddr_storage addr;
|
||||
struct hostent *h;
|
||||
char **pch;
|
||||
VALUE ary, names;
|
||||
size_t size;
|
||||
|
||||
rb_secure(3);
|
||||
if (rb_obj_is_kind_of(host, rb_cInteger)) {
|
||||
long i = NUM2LONG(host);
|
||||
struct sockaddr_in *sin;
|
||||
|
||||
sin = (struct sockaddr_in *)&addr;
|
||||
sin = (struct sockaddr_in*)&addr;
|
||||
MEMZERO(sin, struct sockaddr_in, 1);
|
||||
sin->sin_family = AF_INET;
|
||||
SET_SIN_LEN(sin, sizeof(*sin));
|
||||
|
@ -995,8 +998,8 @@ tcp_s_gethostbyname(obj, host)
|
|||
case AF_INET:
|
||||
{
|
||||
struct sockaddr_in *sin;
|
||||
sin = (struct sockaddr_in *)&addr;
|
||||
h = gethostbyaddr((char *)&sin->sin_addr,
|
||||
sin = (struct sockaddr_in*)&addr;
|
||||
h = gethostbyaddr((char*)&sin->sin_addr,
|
||||
sizeof(sin->sin_addr),
|
||||
sin->sin_family);
|
||||
break;
|
||||
|
@ -1005,8 +1008,8 @@ tcp_s_gethostbyname(obj, host)
|
|||
case AF_INET6:
|
||||
{
|
||||
struct sockaddr_in6 *sin6;
|
||||
sin6 = (struct sockaddr_in6 *)&addr;
|
||||
h = gethostbyaddr((char *)&sin6->sin6_addr,
|
||||
sin6 = (struct sockaddr_in6*)&addr;
|
||||
h = gethostbyaddr((char*)&sin6->sin6_addr,
|
||||
sizeof(sin6->sin6_addr),
|
||||
sin6->sin6_family);
|
||||
break;
|
||||
|
@ -1019,7 +1022,7 @@ tcp_s_gethostbyname(obj, host)
|
|||
if (h == NULL) {
|
||||
#ifdef HAVE_HSTERROR
|
||||
extern int h_errno;
|
||||
rb_raise(rb_eSocket, "%s", (char *)hsterror(h_errno));
|
||||
rb_raise(rb_eSocket, "%s", (char*)hsterror(h_errno));
|
||||
#else
|
||||
rb_raise(rb_eSocket, "host not found");
|
||||
#endif
|
||||
|
@ -1033,48 +1036,83 @@ tcp_s_gethostbyname(obj, host)
|
|||
}
|
||||
rb_ary_push(ary, INT2NUM(h->h_addrtype));
|
||||
#ifdef h_addr
|
||||
for (pch = h->h_addr_list; *pch; pch++) {
|
||||
for (pch = h->h_addr_list; *pch; pch++)
|
||||
;
|
||||
pch++;
|
||||
size = (char*)pch - (char*)h->h_addr_list;
|
||||
pch = (char**)alloca(size);
|
||||
memcpy((char*)pch, (char *)h->h_addr_list, size);
|
||||
size = h->h_length;
|
||||
for (; *pch && h; pch++) {
|
||||
switch (addr.ss_family) {
|
||||
case AF_INET:
|
||||
{
|
||||
case AF_INET: {
|
||||
struct sockaddr_in sin;
|
||||
|
||||
MEMZERO(&sin, struct sockaddr_in, 1);
|
||||
sin.sin_family = AF_INET;
|
||||
SET_SIN_LEN(&sin, sizeof(sin));
|
||||
memcpy((char *) &sin.sin_addr, *pch, h->h_length);
|
||||
h = gethostbyaddr((char *)&sin.sin_addr,
|
||||
memcpy((char*)&sin.sin_addr, *pch, size);
|
||||
h = gethostbyaddr((char*)&sin.sin_addr,
|
||||
sizeof(sin.sin_addr),
|
||||
sin.sin_family);
|
||||
rb_ary_push(ary, mkipaddr((struct sockaddr *)&sin));
|
||||
rb_ary_push(ary, mkipaddr((struct sockaddr*)&sin));
|
||||
break;
|
||||
}
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
{
|
||||
case AF_INET6: {
|
||||
struct sockaddr_in6 sin6;
|
||||
|
||||
MEMZERO(&sin6, struct sockaddr_in6, 1);
|
||||
sin6.sin6_family = AF_INET;
|
||||
#ifdef SIN6_LEN
|
||||
sin6.sin6_len = sizeof(sin6);
|
||||
#endif
|
||||
memcpy((char *) &sin6.sin6_addr, *pch, h->h_length);
|
||||
h = gethostbyaddr((char *)&sin6.sin6_addr,
|
||||
memcpy((char*)&sin6.sin6_addr, *pch, size);
|
||||
h = gethostbyaddr((char*)&sin6.sin6_addr,
|
||||
sizeof(sin6.sin6_addr),
|
||||
sin6.sin6_family);
|
||||
rb_ary_push(ary, mkipaddr((struct sockaddr *)&sin6));
|
||||
rb_ary_push(ary, mkipaddr((struct sockaddr*)&sin6));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
default:
|
||||
h = NULL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
memcpy((char *)&addr.sin_addr, h->h_addr, h->h_length);
|
||||
rb_ary_push(ary, mkipaddr((struct sockaddr *)&addr));
|
||||
memcpy((char*)&addr.sin_addr, h->h_addr, h->h_length);
|
||||
rb_ary_push(ary, mkipaddr((struct sockaddr*)&addr));
|
||||
#endif
|
||||
|
||||
return ary;
|
||||
#else
|
||||
|
||||
struct addrinfo hints, *res, *r;
|
||||
VALUE ary, names;
|
||||
int error;
|
||||
|
||||
rb_secure(3);
|
||||
MEMZERO(&hints, struct addrinfo, 1);
|
||||
hints.ai_family = PF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
r = res = ip_addrsetup(host, Qnil);
|
||||
ary = rb_ary_new();
|
||||
rb_ary_push(ary, rb_tainted_str_new2(r->ai_canonname));
|
||||
r = r->ai_next;
|
||||
names = rb_ary_new();
|
||||
rb_ary_push(ary, names);
|
||||
rb_ary_push(ary, INT2NUM(res->ai_family));
|
||||
for (r = res; r; r = r->ai_next) {
|
||||
if (r != res) {
|
||||
rb_ary_push(names, rb_tainted_str_new2(r->ai_canonname));
|
||||
}
|
||||
rb_ary_push(ary, mkipaddr(r->ai_addr));
|
||||
}
|
||||
freeaddrinfo(res);
|
||||
|
||||
return ary;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1202,7 +1240,7 @@ ip_addr(sock)
|
|||
|
||||
if (getsockname(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
|
||||
rb_sys_fail("getsockname(2)");
|
||||
return ipaddr((struct sockaddr *)&addr);
|
||||
return ipaddr((struct sockaddr*)&addr);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1217,7 +1255,7 @@ ip_peeraddr(sock)
|
|||
|
||||
if (getpeername(fileno(fptr->f), (struct sockaddr*)&addr, &len) < 0)
|
||||
rb_sys_fail("getpeername(2)");
|
||||
return ipaddr((struct sockaddr *)&addr);
|
||||
return ipaddr((struct sockaddr*)&addr);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1236,7 +1274,7 @@ ip_s_getaddress(obj, host)
|
|||
struct sockaddr_storage addr;
|
||||
|
||||
setipaddr(host, &addr);
|
||||
return mkipaddr((struct sockaddr *)&addr);
|
||||
return mkipaddr((struct sockaddr*)&addr);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
@ -1876,7 +1914,7 @@ mkhostent(h)
|
|||
if (h == NULL) {
|
||||
#ifdef HAVE_HSTRERROR
|
||||
extern int h_errno;
|
||||
rb_raise(rb_eSocket, "%s", (char *)hstrerror(h_errno));
|
||||
rb_raise(rb_eSocket, "%s", (char*)hstrerror(h_errno));
|
||||
#else
|
||||
rb_raise(rb_eSocket, "host not found");
|
||||
#endif
|
||||
|
@ -1935,21 +1973,21 @@ sock_s_gethostbyname(obj, host)
|
|||
if (rb_obj_is_kind_of(host, rb_cInteger)) {
|
||||
long i = NUM2LONG(host);
|
||||
struct sockaddr_in *sin;
|
||||
sin = (struct sockaddr_in *)&addr;
|
||||
sin = (struct sockaddr_in*)&addr;
|
||||
MEMZERO(sin, struct sockaddr_in, 1);
|
||||
sin->sin_family = AF_INET;
|
||||
SET_SIN_LEN(sin, sizeof(*sin));
|
||||
sin->sin_addr.s_addr = htonl(i);
|
||||
}
|
||||
else {
|
||||
setipaddr(host, (struct sockaddr *)&addr);
|
||||
setipaddr(host, (struct sockaddr*)&addr);
|
||||
}
|
||||
switch (addr.ss_family) {
|
||||
case AF_INET:
|
||||
{
|
||||
struct sockaddr_in *sin;
|
||||
sin = (struct sockaddr_in *)&addr;
|
||||
h = gethostbyaddr((char *)&sin->sin_addr,
|
||||
sin = (struct sockaddr_in*)&addr;
|
||||
h = gethostbyaddr((char*)&sin->sin_addr,
|
||||
sizeof(sin->sin_addr),
|
||||
sin->sin_family);
|
||||
break;
|
||||
|
@ -1958,8 +1996,8 @@ sock_s_gethostbyname(obj, host)
|
|||
case AF_INET6:
|
||||
{
|
||||
struct sockaddr_in6 *sin6;
|
||||
sin6 = (struct sockaddr_in6 *)&addr;
|
||||
h = gethostbyaddr((char *)&sin6->sin6_addr,
|
||||
sin6 = (struct sockaddr_in6*)&addr;
|
||||
h = gethostbyaddr((char*)&sin6->sin6_addr,
|
||||
sizeof(sin6->sin6_addr),
|
||||
sin6->sin6_family);
|
||||
break;
|
||||
|
@ -2127,10 +2165,10 @@ sock_s_getnameinfo(argc, argv)
|
|||
rb_raise(rb_eTypeError, "sockaddr length too big");
|
||||
}
|
||||
memcpy(&ss, RSTRING(sa)->ptr, RSTRING(sa)->len);
|
||||
if (RSTRING(sa)->len != SA_LEN((struct sockaddr *)&ss)) {
|
||||
if (RSTRING(sa)->len != SA_LEN((struct sockaddr*)&ss)) {
|
||||
rb_raise(rb_eTypeError, "sockaddr size differs - should not happen");
|
||||
}
|
||||
sap = (struct sockaddr *)&ss;
|
||||
sap = (struct sockaddr*)&ss;
|
||||
}
|
||||
else if (TYPE(sa) == T_ARRAY) {
|
||||
MEMZERO(&hints, struct addrinfo, 1);
|
||||
|
|
13
io.c
13
io.c
|
@ -12,6 +12,11 @@
|
|||
|
||||
**********************************************************************/
|
||||
|
||||
#if defined(__VMS)
|
||||
#define _XOPEN_SOURCE
|
||||
#define _POSIX_C_SOURCE 2
|
||||
#endif
|
||||
|
||||
#include "ruby.h"
|
||||
#include "rubyio.h"
|
||||
#include "rubysig.h"
|
||||
|
@ -131,6 +136,8 @@ static VALUE lineno;
|
|||
# define READ_DATA_PENDING(fp) (fp->_state._eof == 0)
|
||||
#elif defined(__UCLIBC__)
|
||||
# define READ_DATA_PENDING(fp) ((fp)->bufpos < (fp)->bufend)
|
||||
#elif defined(__VMS)
|
||||
# define READ_DATA_PENDING(fp) (((unsigned int)((*(fp))->_flag) & _IOEOF) == 0)
|
||||
#else
|
||||
/* requires systems own version of the ReadDataPending() */
|
||||
extern int ReadDataPending();
|
||||
|
@ -1643,7 +1650,7 @@ rb_file_sysopen(fname, flags, mode)
|
|||
return rb_file_sysopen_internal(io, fname, flags, mode);
|
||||
}
|
||||
|
||||
#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__)
|
||||
#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__VMS)
|
||||
static struct pipe_list {
|
||||
OpenFile *fptr;
|
||||
struct pipe_list *next;
|
||||
|
@ -1685,7 +1692,7 @@ pipe_del_fptr(fptr)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__)
|
||||
#if defined (NT) || defined(DJGPP) || defined(__CYGWIN__) || defined(__human68k__) || defined(__VMS)
|
||||
static void
|
||||
pipe_atexit _((void))
|
||||
{
|
||||
|
@ -1748,7 +1755,7 @@ pipe_open(pname, mode)
|
|||
int modef = rb_io_mode_flags(mode);
|
||||
OpenFile *fptr;
|
||||
|
||||
#if defined(NT) || defined(DJGPP) || defined(__human68k__)
|
||||
#if defined(NT) || defined(DJGPP) || defined(__human68k__) || defined(__VMS)
|
||||
FILE *f = popen(pname, mode);
|
||||
|
||||
if (!f) rb_sys_fail(pname);
|
||||
|
|
|
@ -198,7 +198,7 @@ typedef struct __sFILE {
|
|||
#endif
|
||||
|
||||
|
||||
#if defined(__hpux) && !defined(__GNUC__)
|
||||
#if defined(__hpux) && !defined(__GNUC__) || defined(__DECC)
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
|
|
15
numeric.c
15
numeric.c
|
@ -944,6 +944,10 @@ static VALUE
|
|||
int_succ(num)
|
||||
VALUE num;
|
||||
{
|
||||
if (FIXNUM_P(num)) {
|
||||
long i = FIX2LONG(num) + 1;
|
||||
return rb_int2inum(i);
|
||||
}
|
||||
return rb_funcall(num, '+', 1, INT2FIX(1));
|
||||
}
|
||||
|
||||
|
@ -1437,15 +1441,6 @@ fix_id2name(fix)
|
|||
return Qnil;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
fix_succ(fix)
|
||||
VALUE fix;
|
||||
{
|
||||
long i = FIX2LONG(fix) + 1;
|
||||
|
||||
return rb_int2inum(i);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
fix_size(fix)
|
||||
VALUE fix;
|
||||
|
@ -1709,8 +1704,6 @@ Init_Numeric()
|
|||
|
||||
rb_define_method(rb_cFixnum, "to_f", fix_to_f, 0);
|
||||
|
||||
rb_define_method(rb_cFixnum, "succ", fix_succ, 0);
|
||||
rb_define_method(rb_cFixnum, "next", fix_succ, 0);
|
||||
rb_define_method(rb_cFixnum, "size", fix_size, 0);
|
||||
|
||||
rb_define_method(rb_cFixnum, "upto", fix_upto, 1);
|
||||
|
|
27
process.c
27
process.c
|
@ -713,7 +713,7 @@ static VALUE
|
|||
rb_f_fork(obj)
|
||||
VALUE obj;
|
||||
{
|
||||
#if !defined(__human68k__) && !defined(NT) && !defined(__MACOS__) && !defined(__EMX__)
|
||||
#if !defined(__human68k__) && !defined(NT) && !defined(__MACOS__) && !defined(__EMX__) && !defined(__VMS)
|
||||
int pid;
|
||||
|
||||
rb_secure(2);
|
||||
|
@ -885,6 +885,30 @@ rb_f_system(argc, argv)
|
|||
}
|
||||
last_status_set(status == -1 ? 127 : status);
|
||||
return status == 0 ? Qtrue : Qfalse;
|
||||
#else
|
||||
#if defined(__VMS)
|
||||
VALUE cmd;
|
||||
int status;
|
||||
|
||||
if (argc == 0) {
|
||||
rb_last_status = Qnil;
|
||||
rb_raise(rb_eArgError, "wrong number of arguments");
|
||||
}
|
||||
|
||||
if (TYPE(argv[0]) == T_ARRAY) {
|
||||
if (RARRAY(argv[0])->len != 2) {
|
||||
rb_raise(rb_eArgError, "wrong first argument");
|
||||
}
|
||||
argv[0] = RARRAY(argv[0])->ptr[0];
|
||||
}
|
||||
cmd = rb_ary_join(rb_ary_new4(argc, argv), rb_str_new2(" "));
|
||||
|
||||
SafeStringValue(cmd);
|
||||
status = system(RSTRING(cmd)->ptr);
|
||||
last_status_set((status & 0xff) << 8);
|
||||
|
||||
if (status == 0) return Qtrue;
|
||||
return Qfalse;
|
||||
#else
|
||||
volatile VALUE prog = 0;
|
||||
int pid;
|
||||
|
@ -938,6 +962,7 @@ rb_f_system(argc, argv)
|
|||
if (NUM2INT(rb_last_status) == 0)
|
||||
return Qtrue;
|
||||
return Qfalse;
|
||||
#endif /* __VMS */
|
||||
#endif /* __human68k__ */
|
||||
#endif /* DJGPP */
|
||||
#endif /* NT */
|
||||
|
|
5
ruby.h
5
ruby.h
|
@ -60,6 +60,11 @@ extern "C" {
|
|||
#pragma alloca
|
||||
#endif
|
||||
|
||||
#if defined(__VMS)
|
||||
# pragma builtins
|
||||
# define alloca __alloca
|
||||
#endif
|
||||
|
||||
#if SIZEOF_LONG != SIZEOF_VOIDP
|
||||
---->> ruby requires sizeof(void*) == sizeof(long) to be compiled. <<----
|
||||
#endif
|
||||
|
|
1
st.c
1
st.c
|
@ -4,6 +4,7 @@ static char sccsid[] = "@(#) st.c 5.1 89/12/14 Crucible";
|
|||
|
||||
#include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "st.h"
|
||||
|
||||
#ifdef NT
|
||||
|
|
2
time.c
2
time.c
|
@ -1382,7 +1382,7 @@ time_load(klass, str)
|
|||
int i;
|
||||
|
||||
StringValue(str);
|
||||
buf = RSTRING(str)->ptr;
|
||||
buf = (unsigned char *)RSTRING(str)->ptr;
|
||||
if (RSTRING(str)->len != 8) {
|
||||
rb_raise(rb_eTypeError, "marshaled time format differ");
|
||||
}
|
||||
|
|
61
vms/config.h_in
Normal file
61
vms/config.h_in
Normal file
|
@ -0,0 +1,61 @@
|
|||
/* config.h for OpenVMS Alpha */
|
||||
|
||||
/* #define HAVE_PROTOTYPES 1 */
|
||||
#define HAVE_STDARG_PROTOTYPES 1
|
||||
/* #define HAVE_ATTR_NORETURN 1 */
|
||||
/* #define inline __inline */
|
||||
#define HAVE_DIRENT_H 1
|
||||
#define HAVE_UNISTD_H 1
|
||||
#define HAVE_STDLIB_H 1
|
||||
#define HAVE_LIMITS_H 1
|
||||
|
||||
#define HAVE_SYS_FILE_H 1
|
||||
#define HAVE_FCNTL_H 1
|
||||
/* #define HAVE_PWD_H 1 */
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
#define HAVE_SYS_TIMES_H 1
|
||||
/* #define HAVE_SYS_PARAM_H 1 */
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
#define HAVE_STRING_H 1
|
||||
#define HAVE_UTIME_H 1
|
||||
#define HAVE_MEMORY_H 1
|
||||
/* #define HAVE_ST_BLKSIZE 1 */
|
||||
#define HAVE_ST_RDEV 1
|
||||
/* #define GETGROUPS_T gid_t */
|
||||
#define GETGROUPS_T int
|
||||
#define RETSIGTYPE void
|
||||
/* #define HAVE_ALLOCA 1 */
|
||||
/* #define vfork fork */
|
||||
#define HAVE_FMOD 1
|
||||
#define HAVE_RANDOM 1
|
||||
#define HAVE_WAITPID 1
|
||||
#define HAVE_GETCWD 1
|
||||
#define HAVE_TRUNCATE 1
|
||||
/* #define HAVE_CHSIZE 1 */
|
||||
#define HAVE_TIMES 1
|
||||
/* #define HAVE_UTIMES 1 */
|
||||
#define HAVE_FCNTL 1
|
||||
/* #define HAVE_SETITIMER 1 */
|
||||
/* #define HAVE_GETGROUPS 1 */
|
||||
#define HAVE_SIGPROCMASK 1
|
||||
#define HAVE_GETLOGIN 1
|
||||
#define HAVE_TELLDIR 1
|
||||
#define HAVE_SEEKDIR 1
|
||||
|
||||
#define RSHIFT(x,y) ((x)>>y)
|
||||
#define DEFAULT_KCODE KCODE_NONE
|
||||
#define DLEXT ".EXE"
|
||||
/* #define DLEXT2 "" */
|
||||
#define RUBY_LIB "/RUBY_LIB"
|
||||
#define RUBY_SITE_LIB "/RUBY_SYSLIB"
|
||||
#define RUBY_SITE_LIB2 "/SYS$SHARE"
|
||||
#define RUBY_PLATFORM "alpha-vms"
|
||||
#define RUBY_ARCHLIB ""
|
||||
#define RUBY_SITE_ARCHLIB ""
|
||||
|
||||
#define SIZEOF_INT 4
|
||||
#define SIZEOF_SHORT 2
|
||||
#define SIZEOF_LONG 4
|
||||
#define SIZEOF_VOIDP 4
|
||||
#define SIZEOF_FLOAT 4
|
||||
#define SIZEOF_DOUBLE 8
|
6
vms/vms.h
Normal file
6
vms/vms.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
extern int isinf(double);
|
||||
extern int isnan(double);
|
||||
extern int flock(int fd, int oper);
|
||||
|
||||
extern int vsnprintf();
|
||||
extern int snprintf();
|
Loading…
Reference in a new issue