mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
pre 1.4.0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5d941186af
commit
ccfdf8c80e
24 changed files with 226 additions and 111 deletions
14
ChangeLog
14
ChangeLog
|
|
@ -1,3 +1,17 @@
|
|||
Fri Aug 13 03:16:07 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* io.c (argf_forward): since $stdout may be non-IO, ARGF.file is
|
||||
not granteed to be IO. check and forwarding added to every ARGF
|
||||
method.
|
||||
|
||||
* io.c (set_outfile): $stdout/$stderr may not be IO now.
|
||||
|
||||
* io.c (set_stdin): $stdin may not be IO now.
|
||||
|
||||
* range.c (rb_range_beg_len): round `end' to length as documented.
|
||||
|
||||
* io.c (Init_IO): preserve original stdin/stdout/stderr.
|
||||
|
||||
Thu Aug 12 13:44:33 1999 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* eval.c (Init_load): require receives 1 argument.
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ file.@OBJEXT@: file.c ruby.h config.h defines.h intern.h rubyio.h rubysig.h
|
|||
gc.@OBJEXT@: gc.c ruby.h config.h defines.h intern.h rubysig.h st.h node.h env.h re.h regex.h
|
||||
hash.@OBJEXT@: hash.c ruby.h config.h defines.h intern.h st.h rubysig.h util.h
|
||||
inits.@OBJEXT@: inits.c ruby.h config.h defines.h intern.h
|
||||
io.@OBJEXT@: io.c ruby.h config.h defines.h intern.h rubyio.h rubysig.h
|
||||
io.@OBJEXT@: io.c ruby.h config.h defines.h intern.h rubyio.h rubysig.h env.h
|
||||
main.@OBJEXT@: main.c ruby.h config.h defines.h intern.h
|
||||
marshal.@OBJEXT@: marshal.c ruby.h config.h defines.h intern.h rubyio.h st.h
|
||||
prec.@OBJEXT@: prec.c ruby.h config.h defines.h intern.h
|
||||
|
|
|
|||
20
README
20
README
|
|
@ -20,10 +20,28 @@ Perl). It is simple, straight-forward, and extensible.
|
|||
|
||||
* How to get Ruby
|
||||
|
||||
The Ruby distribution can be found on
|
||||
The Ruby distribution can be found on:
|
||||
|
||||
ftp://ftp.netlab.co.jp/pub/lang/ruby/
|
||||
|
||||
You can get it by anonymous CVS. How to check out is:
|
||||
|
||||
$ cvs -d :pserver:anonymous@cvs.netlab.co.jp:/home/cvs login
|
||||
(Logging in to anonymous@cvs.netlab.co.jp)
|
||||
CVS password: guest
|
||||
$ cvs -d :pserver:anonymous@cvs.netlab.co.jp:/home/cvs checkout ruby
|
||||
|
||||
* Mailing list
|
||||
|
||||
There is a mailing list to talk about Ruby.
|
||||
To subscribe this list, please send the following phrase
|
||||
|
||||
subscribe Your-Last-Name Your-First-Name
|
||||
e.g.
|
||||
subscribe Joseph Smith
|
||||
|
||||
in the mail body (not subject) to the address <ruby-talk-ctl@netlab.co.jp>.
|
||||
|
||||
* How to compile and install
|
||||
|
||||
This is what you need to do to compile and install Ruby:
|
||||
|
|
|
|||
29
README.jp
29
README.jp
|
|
@ -32,6 +32,12 @@ Ruby
|
|||
|
||||
ftp://ftp.netlab.co.jp/pub/lang/ruby/
|
||||
|
||||
** CVSで
|
||||
|
||||
$ cvs -d :pserver:anonymous@cvs.netlab.co.jp:/home/cvs login
|
||||
(Logging in to anonymous@cvs.netlab.co.jp)
|
||||
CVS password: guest
|
||||
$ cvs -d :pserver:anonymous@cvs.netlab.co.jp:/home/cvs checkout ruby
|
||||
|
||||
* ホームページ
|
||||
|
||||
|
|
@ -44,12 +50,27 @@ Ruby
|
|||
|
||||
* メーリングリスト
|
||||
|
||||
Rubyに関わる話題のためのメーリングリストを開設しました.ア
|
||||
ドレスは
|
||||
Rubyのメーリングリストがあります。参加希望の方は
|
||||
|
||||
ruby-list@netlab.co.jp
|
||||
ruby-list-ctl@netlab.co.jp
|
||||
|
||||
です.このアドレスにメールを送れば,自動的に登録されます.
|
||||
まで本文に
|
||||
|
||||
subscribe YourFirstName YourFamilyName
|
||||
|
||||
と書いて送って下さい。
|
||||
|
||||
Ruby開発者向けメーリングリストもあります。こちらではrubyのバ
|
||||
グ、将来の仕様拡張など実装上の問題について議論されています。
|
||||
参加希望の方は
|
||||
|
||||
ruby-dev-ctl@netlab.co.jp
|
||||
|
||||
までruby-listと同様の方法でメールしてください。
|
||||
|
||||
Ruby拡張モジュールについて話し合うruby-extメーリングリストと
|
||||
英語で話し合うruby-talkメーリングリストもあります。参加方法
|
||||
はどれも同じです。
|
||||
|
||||
|
||||
* コンパイル・インストール
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@
|
|||
#define RSHIFT(x,y) ((x)>>y)
|
||||
#define FILE_COUNT _cnt
|
||||
#define DLEXT ".o"
|
||||
#define RUBY_LIB "/usr/local/lib/ruby/1.3"
|
||||
#define RUBY_SITE_LIB "/usr/local/lib/ruby/1.3/site_ruby"
|
||||
#define RUBY_LIB "/usr/local/lib/ruby/1.4"
|
||||
#define RUBY_SITE_LIB "/usr/local/lib/ruby/1.4/site_ruby"
|
||||
#define RUBY_PLATFORM "i386-djgpp"
|
||||
#define RUBY_ARCHLIB "/usr/local/lib/ruby/1.3/i386-djgpp"
|
||||
#define RUBY_SITE_ARCHLIB "/usr/local/lib/ruby/1.3/site_ruby/i386-djgpp"
|
||||
#define RUBY_ARCHLIB "/usr/local/lib/ruby/1.4/i386-djgpp"
|
||||
#define RUBY_SITE_ARCHLIB "/usr/local/lib/ruby/1.4/site_ruby/i386-djgpp"
|
||||
|
|
|
|||
1
dln.h
1
dln.h
|
|
@ -3,7 +3,6 @@
|
|||
dln.h -
|
||||
|
||||
$Author$
|
||||
$Revision$
|
||||
$Date$
|
||||
created at: Wed Jan 19 16:53:09 JST 1994
|
||||
|
||||
|
|
|
|||
1
env.h
1
env.h
|
|
@ -3,7 +3,6 @@
|
|||
env.h -
|
||||
|
||||
$Author$
|
||||
$Revision$
|
||||
$Date$
|
||||
created at: Mon Jul 11 11:53:03 JST 1994
|
||||
|
||||
|
|
|
|||
10
eval.c
10
eval.c
|
|
@ -4091,6 +4091,16 @@ rb_funcall2(recv, mid, argc, argv)
|
|||
return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 1);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_funcall3(recv, mid, argc, argv)
|
||||
VALUE recv;
|
||||
ID mid;
|
||||
int argc;
|
||||
VALUE *argv;
|
||||
{
|
||||
return rb_call(CLASS_OF(recv), recv, mid, argc, argv, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
backtrace(lev)
|
||||
int lev;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
gdbm ext-library for Ruby 1.3
|
||||
gdbm ext-library for Ruby 1.3 or later
|
||||
|
|
|
|||
|
|
@ -133,9 +133,7 @@ rb_nkf_guess(obj, src)
|
|||
if (*p == '\033') {
|
||||
return INT2FIX(_JIS);
|
||||
}
|
||||
if ('\000' <= *p && *p < '\006'
|
||||
|| *p == 0x7f
|
||||
|| *p == 0xff) {
|
||||
if (*p < '\006' || *p == 0x7f || *p == 0xff) {
|
||||
return INT2FIX(_BINARY);
|
||||
}
|
||||
if (0x81 <= *p && *p <= 0x8d) {
|
||||
|
|
|
|||
1
intern.h
1
intern.h
|
|
@ -107,7 +107,6 @@ VALUE rb_eval_cmd _((VALUE, VALUE));
|
|||
int rb_respond_to _((VALUE, ID));
|
||||
void rb_interrupt _((void));
|
||||
VALUE rb_apply _((VALUE, ID, VALUE));
|
||||
VALUE rb_funcall2 _((VALUE, ID, int, VALUE*));
|
||||
void rb_backtrace _((void));
|
||||
ID rb_frame_last_func _((void));
|
||||
VALUE rb_obj_instance_eval _((int, VALUE*, VALUE));
|
||||
|
|
|
|||
177
io.c
177
io.c
|
|
@ -13,6 +13,7 @@
|
|||
#include "ruby.h"
|
||||
#include "rubyio.h"
|
||||
#include "rubysig.h"
|
||||
#include "env.h"
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
|
@ -79,6 +80,7 @@ VALUE rb_eEOFError;
|
|||
VALUE rb_eIOError;
|
||||
|
||||
VALUE rb_stdin, rb_stdout, rb_stderr, rb_defout;
|
||||
static VALUE orig_stdin, orig_stdout, orig_stderr;
|
||||
|
||||
VALUE rb_fs;
|
||||
VALUE rb_output_fs;
|
||||
|
|
@ -94,7 +96,7 @@ extern char *ruby_inplace_mode;
|
|||
|
||||
struct timeval rb_time_interval _((VALUE));
|
||||
|
||||
static VALUE filename, file;
|
||||
static VALUE filename, current_file;
|
||||
static int gets_lineno;
|
||||
static int init_p = 0, next_p = 0;
|
||||
static VALUE lineno;
|
||||
|
|
@ -2031,9 +2033,6 @@ rb_io_defset(val, id)
|
|||
VALUE val;
|
||||
ID id;
|
||||
{
|
||||
if (TYPE(val) == T_STRING) {
|
||||
val = rb_io_open(RSTRING(val)->ptr, "w");
|
||||
}
|
||||
if (!rb_respond_to(val, id_write)) {
|
||||
rb_raise(rb_eTypeError, "$> must have write method, %s given",
|
||||
rb_class2name(CLASS_OF(val)));
|
||||
|
|
@ -2072,7 +2071,11 @@ set_stdin(val, id, var)
|
|||
|
||||
if (val == *var) return;
|
||||
if (TYPE(val) != T_FILE) {
|
||||
rb_raise(rb_eTypeError, "%s must be IO object", rb_id2name(id));
|
||||
*var = val;
|
||||
return;
|
||||
}
|
||||
if (TYPE(*var) != T_FILE) {
|
||||
*var = orig_stdin;
|
||||
}
|
||||
|
||||
GetOpenFile(val, fptr);
|
||||
|
|
@ -2095,10 +2098,10 @@ set_stdin(val, id, var)
|
|||
}
|
||||
|
||||
static void
|
||||
set_outfile(val, id, var, stdf)
|
||||
set_outfile(val, var, orig, stdf)
|
||||
VALUE val;
|
||||
ID id;
|
||||
VALUE *var;
|
||||
VALUE orig;
|
||||
FILE *stdf;
|
||||
{
|
||||
OpenFile *fptr;
|
||||
|
|
@ -2107,10 +2110,16 @@ set_outfile(val, id, var, stdf)
|
|||
char *mode;
|
||||
|
||||
if (val == *var) return;
|
||||
rb_io_flush(*var);
|
||||
|
||||
if (TYPE(*var) == T_FILE) {
|
||||
rb_io_flush(*var);
|
||||
}
|
||||
if (TYPE(val) != T_FILE) {
|
||||
rb_raise(rb_eTypeError, "%s must be IO object", rb_id2name(id));
|
||||
*var = val;
|
||||
return;
|
||||
}
|
||||
if (TYPE(*var) != T_FILE) {
|
||||
*var = orig;
|
||||
}
|
||||
|
||||
GetOpenFile(val, fptr);
|
||||
|
|
@ -2143,7 +2152,7 @@ set_stdout(val, id, var)
|
|||
ID id;
|
||||
VALUE *var;
|
||||
{
|
||||
set_outfile(val, id, var, stdout);
|
||||
set_outfile(val, var, orig_stdout, stdout);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -2152,7 +2161,7 @@ set_stderr(val, id, var)
|
|||
ID id;
|
||||
VALUE *var;
|
||||
{
|
||||
set_outfile(val, id, var, stderr);
|
||||
set_outfile(val, var, orig_stderr, stderr);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
@ -2190,10 +2199,22 @@ rb_io_s_new(argc, argv, klass)
|
|||
|
||||
static int binmode = 0;
|
||||
|
||||
static VALUE
|
||||
argf_forward()
|
||||
{
|
||||
return rb_funcall3(current_file, ruby_frame->last_func,
|
||||
ruby_frame->argc, ruby_frame->argv);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
argf_binmode()
|
||||
{
|
||||
rb_io_binmode(file);
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
argf_forward();
|
||||
}
|
||||
else {
|
||||
rb_io_binmode(current_file);
|
||||
}
|
||||
binmode = 1;
|
||||
return argf;
|
||||
}
|
||||
|
|
@ -2210,7 +2231,7 @@ next_argv()
|
|||
}
|
||||
else {
|
||||
next_p = -1;
|
||||
file = rb_stdin;
|
||||
current_file = rb_stdin;
|
||||
}
|
||||
init_p = 1;
|
||||
gets_lineno = 0;
|
||||
|
|
@ -2223,7 +2244,7 @@ next_argv()
|
|||
filename = rb_ary_shift(rb_argv);
|
||||
fn = STR2CSTR(filename);
|
||||
if (strlen(fn) == 1 && fn[0] == '-') {
|
||||
file = rb_stdin;
|
||||
current_file = rb_stdin;
|
||||
if (ruby_inplace_mode) {
|
||||
rb_defout = rb_stdout;
|
||||
}
|
||||
|
|
@ -2284,9 +2305,9 @@ next_argv()
|
|||
#endif
|
||||
rb_defout = prep_stdio(fw, FMODE_WRITABLE, rb_cFile);
|
||||
}
|
||||
file = prep_stdio(fr, FMODE_READABLE, rb_cFile);
|
||||
current_file = prep_stdio(fr, FMODE_READABLE, rb_cFile);
|
||||
}
|
||||
if (binmode) rb_io_binmode(file);
|
||||
if (binmode) rb_io_binmode(current_file);
|
||||
}
|
||||
else {
|
||||
init_p = 0;
|
||||
|
|
@ -2296,6 +2317,16 @@ next_argv()
|
|||
return Qtrue;
|
||||
}
|
||||
|
||||
static void
|
||||
any_close(file)
|
||||
VALUE file;
|
||||
{
|
||||
if (TYPE(file) == T_FILE)
|
||||
rb_io_close(file);
|
||||
else
|
||||
rb_funcall3(file, rb_intern("close"), 0, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_f_gets_internal(argc, argv)
|
||||
int argc;
|
||||
|
|
@ -2305,14 +2336,17 @@ rb_f_gets_internal(argc, argv)
|
|||
|
||||
retry:
|
||||
if (!next_argv()) return Qnil;
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
line = rb_funcall3(current_file, rb_intern("gets"), argc, argv);
|
||||
}
|
||||
if (argc == 0 && rb_rs == rb_default_rs) {
|
||||
line = rb_io_gets(file);
|
||||
line = rb_io_gets(current_file);
|
||||
}
|
||||
else {
|
||||
line = rb_io_gets_internal(argc, argv, file);
|
||||
line = rb_io_gets_internal(argc, argv, current_file);
|
||||
}
|
||||
if (NIL_P(line) && next_p != -1) {
|
||||
rb_io_close(file);
|
||||
any_close(current_file);
|
||||
next_p = 1;
|
||||
goto retry;
|
||||
}
|
||||
|
|
@ -2344,9 +2378,9 @@ rb_gets()
|
|||
|
||||
retry:
|
||||
if (!next_argv()) return Qnil;
|
||||
line = rb_io_gets(file);
|
||||
line = rb_io_gets(current_file);
|
||||
if (NIL_P(line) && next_p != -1) {
|
||||
rb_io_close(file);
|
||||
any_close(current_file);
|
||||
next_p = 1;
|
||||
goto retry;
|
||||
}
|
||||
|
|
@ -2795,13 +2829,6 @@ rb_io_s_pipe()
|
|||
#endif
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_f_pipe()
|
||||
{
|
||||
rb_warn("pipe is obsolete; use IO::pipe instead");
|
||||
return rb_io_s_pipe();
|
||||
}
|
||||
|
||||
struct foreach_arg {
|
||||
int argc;
|
||||
VALUE sep;
|
||||
|
|
@ -2873,7 +2900,14 @@ rb_io_s_readlines(argc, argv, io)
|
|||
static VALUE
|
||||
argf_tell()
|
||||
{
|
||||
return rb_io_tell(file);
|
||||
if (!next_argv()) {
|
||||
rb_raise(rb_eArgError, "no stream to tell");
|
||||
}
|
||||
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
return argf_forward();
|
||||
}
|
||||
return rb_io_tell(current_file);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
@ -2884,7 +2918,10 @@ argf_seek(self, offset, ptrname)
|
|||
rb_raise(rb_eArgError, "no stream to seek");
|
||||
}
|
||||
|
||||
return rb_io_seek(file, offset, ptrname);
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
return argf_forward();
|
||||
}
|
||||
return rb_io_seek(current_file, offset, ptrname);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
@ -2895,25 +2932,40 @@ argf_set_pos(self, offset)
|
|||
rb_raise(rb_eArgError, "no stream to pos");
|
||||
}
|
||||
|
||||
return rb_io_set_pos(file, offset);
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
return argf_forward();
|
||||
}
|
||||
return rb_io_set_pos(current_file, offset);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
argf_rewind()
|
||||
{
|
||||
return rb_io_rewind(file);
|
||||
if (!next_argv()) {
|
||||
rb_raise(rb_eArgError, "no stream to rewind");
|
||||
}
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
return argf_forward();
|
||||
}
|
||||
return rb_io_rewind(current_file);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
argf_fileno()
|
||||
{
|
||||
return rb_io_fileno(file);
|
||||
if (!next_argv()) {
|
||||
rb_raise(rb_eArgError, "no stream");
|
||||
}
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
return argf_forward();
|
||||
}
|
||||
return rb_io_fileno(current_file);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
argf_to_io()
|
||||
{
|
||||
return file;
|
||||
return current_file;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
@ -2929,9 +2981,15 @@ argf_read(argc, argv)
|
|||
|
||||
retry:
|
||||
if (!next_argv()) return str;
|
||||
tmp = io_read(argc, argv, file);
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
tmp = argf_forward();
|
||||
STR2CSTR(tmp);
|
||||
}
|
||||
else {
|
||||
tmp = io_read(argc, argv, current_file);
|
||||
}
|
||||
if (NIL_P(tmp) && next_p != -1) {
|
||||
rb_io_close(file);
|
||||
any_close(current_file);
|
||||
next_p = 1;
|
||||
goto retry;
|
||||
}
|
||||
|
|
@ -2957,9 +3015,14 @@ argf_getc()
|
|||
|
||||
retry:
|
||||
if (!next_argv()) return Qnil;
|
||||
byte = rb_io_getc(file);
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
byte = rb_funcall3(current_file, rb_intern("getc"), 0, 0);
|
||||
}
|
||||
else {
|
||||
byte = rb_io_getc(current_file);
|
||||
}
|
||||
if (NIL_P(byte) && next_p != -1) {
|
||||
rb_io_close(file);
|
||||
any_close(current_file);
|
||||
next_p = 1;
|
||||
goto retry;
|
||||
}
|
||||
|
|
@ -2970,7 +3033,7 @@ argf_getc()
|
|||
static VALUE
|
||||
argf_readchar()
|
||||
{
|
||||
VALUE c = rb_io_getc(file);
|
||||
VALUE c = argf_getc();
|
||||
|
||||
if (NIL_P(c)) {
|
||||
rb_eof_error();
|
||||
|
|
@ -2983,20 +3046,16 @@ argf_eof()
|
|||
{
|
||||
if (init_p == 0 && !next_argv())
|
||||
return Qtrue;
|
||||
if (rb_io_eof(file)) {
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
return argf_forward();
|
||||
}
|
||||
if (rb_io_eof(current_file)) {
|
||||
next_p = 1;
|
||||
return Qtrue;
|
||||
}
|
||||
return Qfalse;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
rb_f_eof()
|
||||
{
|
||||
rb_warn("eof? is obsolete; use ARGF.eof? instead");
|
||||
return argf_eof();
|
||||
}
|
||||
|
||||
static VALUE
|
||||
argf_each_line(argc, argv)
|
||||
int argc;
|
||||
|
|
@ -3030,14 +3089,14 @@ argf_filename()
|
|||
static VALUE
|
||||
argf_file()
|
||||
{
|
||||
return file;
|
||||
return current_file;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
argf_skip()
|
||||
{
|
||||
if (next_p != -1) {
|
||||
rb_io_close(file);
|
||||
any_close(current_file);
|
||||
next_p = 1;
|
||||
}
|
||||
return argf;
|
||||
|
|
@ -3046,7 +3105,7 @@ argf_skip()
|
|||
static VALUE
|
||||
argf_close()
|
||||
{
|
||||
rb_io_close(file);
|
||||
any_close(current_file);
|
||||
if (next_p != -1) {
|
||||
next_p = 1;
|
||||
}
|
||||
|
|
@ -3057,7 +3116,10 @@ argf_close()
|
|||
static VALUE
|
||||
argf_closed()
|
||||
{
|
||||
return rb_io_closed(file);
|
||||
if (TYPE(current_file) != T_FILE) {
|
||||
return argf_forward();
|
||||
}
|
||||
return rb_io_closed(current_file);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
|
|
@ -3095,15 +3157,12 @@ Init_IO()
|
|||
rb_define_global_function("puts", rb_f_puts, -1);
|
||||
rb_define_global_function("gets", rb_f_gets, -1);
|
||||
rb_define_global_function("readline", rb_f_readline, -1);
|
||||
rb_define_global_function("eof", rb_f_eof, 0);
|
||||
rb_define_global_function("eof?", rb_f_eof, 0);
|
||||
rb_define_global_function("getc", rb_f_getc, 0);
|
||||
rb_define_global_function("select", rb_f_select, -1);
|
||||
|
||||
rb_define_global_function("readlines", rb_f_readlines, -1);
|
||||
|
||||
rb_define_global_function("`", rb_f_backquote, 1);
|
||||
rb_define_global_function("pipe", rb_f_pipe, 0);
|
||||
|
||||
rb_define_global_function("p", rb_f_p, -1);
|
||||
rb_define_method(rb_mKernel, "display", rb_obj_display, -1);
|
||||
|
|
@ -3192,11 +3251,11 @@ Init_IO()
|
|||
rb_define_method(rb_cIO, "ioctl", rb_io_ioctl, -1);
|
||||
rb_define_method(rb_cIO, "fcntl", rb_io_fcntl, -1);
|
||||
|
||||
rb_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO);
|
||||
rb_stdin = orig_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO);
|
||||
rb_define_hooked_variable("$stdin", &rb_stdin, 0, set_stdin);
|
||||
rb_stdout = prep_stdio(stdout, FMODE_WRITABLE, rb_cIO);
|
||||
rb_stdout = orig_stdout = prep_stdio(stdout, FMODE_WRITABLE, rb_cIO);
|
||||
rb_define_hooked_variable("$stdout", &rb_stdout, 0, set_stdout);
|
||||
rb_stderr = prep_stdio(stderr, FMODE_WRITABLE, rb_cIO);
|
||||
rb_stderr = orig_stderr = prep_stdio(stderr, FMODE_WRITABLE, rb_cIO);
|
||||
rb_define_hooked_variable("$stderr", &rb_stderr, 0, set_stderr);
|
||||
rb_defout = rb_stdout;
|
||||
rb_define_hooked_variable("$>", &rb_defout, 0, rb_io_defset);
|
||||
|
|
@ -3244,8 +3303,8 @@ Init_IO()
|
|||
rb_define_singleton_method(argf, "lineno", argf_lineno, 0);
|
||||
rb_define_singleton_method(argf, "lineno=", argf_set_lineno, 1);
|
||||
|
||||
file = rb_stdin;
|
||||
rb_global_variable(&file);
|
||||
current_file = rb_stdin;
|
||||
rb_global_variable(¤t_file);
|
||||
filename = rb_str_new2("-");
|
||||
rb_define_readonly_variable("$FILENAME", &filename);
|
||||
|
||||
|
|
|
|||
38
lib/jcode.rb
38
lib/jcode.rb
|
|
@ -76,37 +76,34 @@ class String
|
|||
a
|
||||
end
|
||||
|
||||
HashCache = {}
|
||||
|
||||
def expand_ch_hash from, to = ""
|
||||
key = from.intern.to_s + ":" + to.intern.to_s
|
||||
return HashCache[key] if HashCache.key? key
|
||||
afrom = _expand_ch(from)
|
||||
def expand_ch_hash from, to
|
||||
h = {}
|
||||
if to.length != 0
|
||||
ato = _expand_ch(to)
|
||||
afrom.each_with_index do |x,i| h[x] = ato[i] || ato[-1] end
|
||||
else
|
||||
afrom.each do |x| h[x] = true end
|
||||
end
|
||||
HashCache[key] = h
|
||||
afrom = _expand_ch(from)
|
||||
ato = _expand_ch(to)
|
||||
afrom.each_with_index do |x,i| h[x] = ato[i] || ato[-1] end
|
||||
h
|
||||
end
|
||||
|
||||
def bsquote(str)
|
||||
str.gsub(/\\/, '\\\\\\\\')
|
||||
end
|
||||
|
||||
HashCache = {}
|
||||
TrPatternCache = {}
|
||||
DeletePatternCache = {}
|
||||
SqueezePatternCache = {}
|
||||
|
||||
public
|
||||
|
||||
def tr!(from, to)
|
||||
return self.delete!(from) if to.length == 0
|
||||
|
||||
pattern = /[#{bsquote(from)}]/
|
||||
pattern = TrPatternCache[from] ||= /[#{bsquote(from)}]/
|
||||
if from[0] == ?^
|
||||
last = /.$/.match(to)[0]
|
||||
self.gsub!(pattern, last)
|
||||
else
|
||||
h = expand_ch_hash(from, to)
|
||||
h = HashCache[from + "::" + to] ||= expand_ch_hash(from, to)
|
||||
self.gsub!(pattern) do |c| h[c] end
|
||||
end
|
||||
end
|
||||
|
|
@ -116,8 +113,7 @@ class String
|
|||
end
|
||||
|
||||
def delete!(del)
|
||||
pattern = /[#{bsquote(del)}]+/
|
||||
self.gsub!(pattern, '')
|
||||
self.gsub!(DeletePatternCache[del] ||= /[#{bsquote(del)}]+/, '')
|
||||
end
|
||||
|
||||
def delete(del)
|
||||
|
|
@ -127,7 +123,7 @@ class String
|
|||
def squeeze!(del=nil)
|
||||
pattern =
|
||||
if del
|
||||
/([#{bsquote(del)}])\1+/
|
||||
SqueezePatternCache[del] ||= /([#{bsquote(del)}])\1+/
|
||||
else
|
||||
/(.|\n)\1+/
|
||||
end
|
||||
|
|
@ -141,12 +137,12 @@ class String
|
|||
def tr_s!(from, to)
|
||||
return self.delete!(from) if to.length == 0
|
||||
|
||||
pattern = /([#{bsquote(from)}])\1+/
|
||||
pattern = SqueezePatternCache[from] ||= /([#{bsquote(from)}])\1+"/
|
||||
if from[0] == ?^
|
||||
last = /.$/.match(to)[0]
|
||||
self.gsub!(pattern, last)
|
||||
else
|
||||
h = expand_ch_hash(from, to)
|
||||
h = HashCache[from + "::" + to] ||= expand_ch_hash(from, to)
|
||||
self.gsub!(pattern) do h[$1] end
|
||||
end
|
||||
end
|
||||
|
|
@ -156,7 +152,7 @@ class String
|
|||
end
|
||||
|
||||
def chop!
|
||||
self.gsub!(/(?:.|\n)\z/, '')
|
||||
self.gsub!(/(?:.|\r?\n)\z/, '')
|
||||
end
|
||||
|
||||
def chop
|
||||
|
|
|
|||
|
|
@ -108,6 +108,6 @@ and source-file directory for your debugger."
|
|||
(gud-def gud-print "p %e" "\C-p" "Evaluate ruby expression at point.")
|
||||
|
||||
(setq comint-prompt-regexp "^(rdb:-) ")
|
||||
(setq paragraph-start comint-prompt-regexp)
|
||||
(set (make-local-variable 'paragraph-start) comint-prompt-regexp)
|
||||
(run-hooks 'rubydb-mode-hook)
|
||||
)
|
||||
|
|
|
|||
2
range.c
2
range.c
|
|
@ -189,7 +189,7 @@ rb_range_beg_len(range, begp, lenp, len, err)
|
|||
if (err == 0 || err == 2) {
|
||||
if (beg > len) goto out_of_range;
|
||||
if (end > len || (!EXCL(range) && end == len))
|
||||
goto out_of_range;
|
||||
end = len;
|
||||
}
|
||||
if (end < 0) {
|
||||
end += len;
|
||||
|
|
|
|||
2
ruby.1
2
ruby.1
|
|
@ -1,6 +1,6 @@
|
|||
.\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.co.jp>.
|
||||
.na
|
||||
.TH RUBY 1 "ruby 1.3" "18/Jan/99" "Ruby Programmers Reference Guide"
|
||||
.TH RUBY 1 "ruby 1.4" "13/Aug/99" "Ruby Programmers Reference Guide"
|
||||
.SH NAME
|
||||
ruby - Interpreted object-oriented scripting language
|
||||
.SH SYNOPSIS
|
||||
|
|
|
|||
2
ruby.c
2
ruby.c
|
|
@ -244,7 +244,7 @@ ruby_require_libraries()
|
|||
|
||||
req_list_last = 0;
|
||||
while (list) {
|
||||
rb_f_require(Qnil, rb_str_new2(list->name));
|
||||
rb_require(list->name);
|
||||
tmp = list->next;
|
||||
free(list);
|
||||
list = tmp;
|
||||
|
|
|
|||
2
ruby.h
2
ruby.h
|
|
@ -398,6 +398,8 @@ 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, VALUE*));
|
||||
VALUE rb_funcall3 _((VALUE, ID, int, VALUE*));
|
||||
int rb_scan_args __((int, VALUE*, const char*, ...));
|
||||
|
||||
VALUE rb_iv_get _((VALUE, const char*));
|
||||
|
|
|
|||
1
rubyio.h
1
rubyio.h
|
|
@ -3,7 +3,6 @@
|
|||
rubyio.h -
|
||||
|
||||
$Author$
|
||||
$Revision$
|
||||
$Date$
|
||||
created at: Fri Nov 12 16:47:09 JST 1993
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
version.c -
|
||||
|
||||
$Author$
|
||||
$Revision$
|
||||
$Date$
|
||||
created at: Thu Sep 30 20:08:01 JST 1993
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#define RUBY_VERSION "1.3.7"
|
||||
#define RUBY_RELEASE_DATE "1999-08-11"
|
||||
#define RUBY_VERSION "1.4.0"
|
||||
#define RUBY_RELEASE_DATE "1999-08-13"
|
||||
#define RUBY_VERSION_CODE 137
|
||||
#define RUBY_RELEASE_CODE 19990811
|
||||
#define RUBY_RELEASE_CODE 19990813
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@
|
|||
#define RSHIFT(x,y) ((x)>>y)
|
||||
#define FILE_COUNT _cnt
|
||||
#define DLEXT ".dll"
|
||||
#define RUBY_LIB "/usr/local/lib/ruby/1.3"
|
||||
#define RUBY_ARCHLIB "/usr/local/lib/ruby/1.3/i386-mswin32"
|
||||
#define RUBY_LIB "/usr/local/lib/ruby/1.4"
|
||||
#define RUBY_ARCHLIB "/usr/local/lib/ruby/1.4/i386-mswin32"
|
||||
#define RUBY_PLATFORM "i386-mswin32"
|
||||
|
||||
#define SIZEOF_INT 4
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ s%@CPPFLAGS@%%g
|
|||
s%@CXXFLAGS@%%g
|
||||
s%@FFLAGS@%%g
|
||||
s%@DEFS@%
|
||||
-DUSE_THREAD -DSIZEOF_INT=4 -DSIZEOF_SHORT=2 -DSIZEOF_LONG=4 -DSIZEOF_VOIDP=4 -DSIZEOF_FLOAT=4 -DSIZEOF_DOUBLE=8 -DHAVE_PROTOTYPES=1 -DHAVE_STDARG_PROTOTYPES=1 -DHAVE_STDLIB_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_FILE_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ST_RDEV=1 -DGETGROUPS_T=int -DRETSIGTYPE=void -DHAVE_ALLOCA=1 -DHAVE_FMOD=1 -DHAVE_WAITPID=1 -DHAVE_GETCWD=1 -DHAVE_CHSIZE=1 -DHAVE_GETGROUPS=1 -DHAVE_GETLOGIN=1 -DRSHIFT=\(x,y\)\ \(\(x\)\>\>y\) -DFILE_COUNT=_cnt -DDLEXT=\".dll\" -DRUBY_LIB=\"/usr/local/lib/ruby/1.3\" -DRUBY_ARCHLIB=\"/usr/local/lib/ruby/1.3/i386-mswin32\" -DRUBY_PLATFORM=\"i386-mswin32\" %g
|
||||
-DUSE_THREAD -DSIZEOF_INT=4 -DSIZEOF_SHORT=2 -DSIZEOF_LONG=4 -DSIZEOF_VOIDP=4 -DSIZEOF_FLOAT=4 -DSIZEOF_DOUBLE=8 -DHAVE_PROTOTYPES=1 -DHAVE_STDARG_PROTOTYPES=1 -DHAVE_STDLIB_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_FILE_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_ST_RDEV=1 -DGETGROUPS_T=int -DRETSIGTYPE=void -DHAVE_ALLOCA=1 -DHAVE_FMOD=1 -DHAVE_WAITPID=1 -DHAVE_GETCWD=1 -DHAVE_CHSIZE=1 -DHAVE_GETGROUPS=1 -DHAVE_GETLOGIN=1 -DRSHIFT=\(x,y\)\ \(\(x\)\>\>y\) -DFILE_COUNT=_cnt -DDLEXT=\".dll\" -DRUBY_LIB=\"/usr/local/lib/ruby/1.4\" -DRUBY_ARCHLIB=\"/usr/local/lib/ruby/1.4/i386-mswin32\" -DRUBY_PLATFORM=\"i386-mswin32\" %g
|
||||
s%@LDFLAGS@%%g
|
||||
s%@LIBS@%advapi32.lib wsock32.lib%g
|
||||
s%@exec_prefix@%${prefix}%g
|
||||
|
|
|
|||
|
|
@ -101,8 +101,6 @@ EXPORTS
|
|||
isinf
|
||||
;missing/isnan.c
|
||||
isnan
|
||||
;missing/isnan.c
|
||||
isnan
|
||||
;win32/win32.c
|
||||
NtInitialize
|
||||
myfdopen
|
||||
|
|
@ -133,6 +131,7 @@ EXPORTS
|
|||
mygetservbyname
|
||||
mygetservbyport
|
||||
myget_osfhandle
|
||||
win32_getenv
|
||||
;array.c
|
||||
rb_mem_clear
|
||||
rb_ary_freeze
|
||||
|
|
@ -276,6 +275,7 @@ EXPORTS
|
|||
rb_rescue
|
||||
rb_protect
|
||||
rb_ensure
|
||||
rb_with_disable_interrupt
|
||||
rb_apply
|
||||
rb_funcall
|
||||
rb_funcall2
|
||||
|
|
@ -286,6 +286,7 @@ EXPORTS
|
|||
rb_load_protect
|
||||
rb_provide
|
||||
rb_f_require
|
||||
rb_require
|
||||
rb_obj_call_init
|
||||
rb_class_new_instance
|
||||
rb_extend_object
|
||||
|
|
@ -546,6 +547,7 @@ EXPORTS
|
|||
rb_mark_generic_ivar
|
||||
rb_mark_generic_ivar_tbl
|
||||
rb_free_generic_ivar
|
||||
rb_clone_generic_ivar
|
||||
rb_ivar_get
|
||||
rb_ivar_set
|
||||
rb_ivar_defined
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue