1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

1.1b9_10 pre0

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 1998-04-10 10:09:49 +00:00
parent 882c18e65e
commit 4af06a86de
5 changed files with 66 additions and 10 deletions

View file

@ -1,3 +1,13 @@
Wed Apr 8 17:24:11 1998 MAEDA shugo <shugo@po.aianet.ne.jp>
* dir.c (dir_s_open): can be called with block (like IO#open).
* dir.c (dir_s_chdir): print directory path on error.
* dir.c (dir_s_chroot): ditto
* dir.c (Init_Dir): needed to override `new'.
Thu Apr 9 18:24:58 1998 Yukihiro Matsumoto <matz@netlab.co.jp>
* experimental release 1.1b9_09.

View file

@ -169,24 +169,24 @@ x68.o: @srcdir@/missing/x68.c
# Prevent GNU make v3 from overflowing arg limit on SysV.
.NOEXPORT:
###
parse.o : parse.y ruby.h defines.h config.h intern.h env.h node.h st.h regex.h lex.c
parse.o: parse.y ruby.h config.h defines.h intern.h env.h node.h st.h regex.h util.h lex.c
###
array.o: array.c ruby.h config.h defines.h intern.h
bignum.o: bignum.c ruby.h config.h defines.h intern.h
class.o: class.c ruby.h config.h defines.h intern.h node.h st.h
compar.o: compar.c ruby.h config.h defines.h intern.h
dir.o: dir.c ruby.h config.h defines.h intern.h
dln.o: dln.c config.h defines.h dln.h st.h
dln.o: dln.c config.h defines.h dln.h
dmyext.o: dmyext.c
enum.o: enum.c ruby.h config.h defines.h intern.h
error.o: error.c ruby.h config.h defines.h intern.h env.h
eval.o: eval.c ruby.h config.h defines.h intern.h env.h node.h sig.h st.h dln.h
eval.o: eval.c ruby.h config.h defines.h intern.h node.h env.h sig.h st.h dln.h
file.o: file.c ruby.h config.h defines.h intern.h io.h sig.h
gc.o: gc.c ruby.h config.h defines.h intern.h env.h sig.h st.h node.h re.h regex.h
hash.o: hash.c ruby.h config.h defines.h intern.h st.h
gc.o: gc.c ruby.h config.h defines.h intern.h sig.h st.h node.h env.h re.h regex.h
hash.o: hash.c ruby.h config.h defines.h intern.h st.h sig.h
inits.o: inits.c ruby.h config.h defines.h intern.h
io.o: io.c ruby.h config.h defines.h intern.h io.h sig.h
main.o: main.c
main.o: main.c ruby.h config.h defines.h intern.h
marshal.o: marshal.c ruby.h config.h defines.h intern.h io.h sig.h st.h
math.o: math.c ruby.h config.h defines.h intern.h
numeric.o: numeric.c ruby.h config.h defines.h intern.h
@ -203,6 +203,6 @@ st.o: st.c config.h st.h
string.o: string.c ruby.h config.h defines.h intern.h re.h regex.h
struct.o: struct.c ruby.h config.h defines.h intern.h
time.o: time.c ruby.h config.h defines.h intern.h
util.o: util.c ruby.h defines.h intern.h config.h util.h
variable.o: variable.c ruby.h config.h defines.h intern.h env.h st.h
util.o: util.c ruby.h config.h defines.h intern.h util.h
variable.o: variable.c ruby.h config.h defines.h intern.h env.h node.h st.h
version.o: version.c ruby.h config.h defines.h intern.h version.h

View file

@ -1299,6 +1299,7 @@ Init_Array()
rb_define_method(cArray, "uniq!", ary_uniq_bang, 0);
rb_define_method(cArray, "uniq", ary_uniq, 0);
rb_define_method(cArray, "compact", ary_compact, 0);
rb_define_method(cArray, "compact!", ary_compact_bang, 0);
rb_define_method(cArray, "nitems", ary_nitems, 0);

30
dir.c
View file

@ -59,6 +59,8 @@ free_dir(dir)
if (dir) closedir(dir);
}
static VALUE dir_close _((VALUE));
static VALUE
dir_s_open(dir_class, dirname)
VALUE dir_class, dirname;
@ -81,6 +83,9 @@ dir_s_open(dir_class, dirname)
obj = Data_Wrap_Struct(dir_class, 0, free_dir, dirp);
if (iterator_p())
rb_ensure(rb_yield, obj, dir_close, obj);
return obj;
}
@ -95,6 +100,23 @@ dir_closed()
if (dirp == NULL) dir_closed();\
}
#if 0
static VALUE
dir_read(dir)
VALUE dir;
{
DIR *dirp;
struct dirent *dp;
GetDIR(dir, dirp);
dp = readdir(dirp);
if (dp)
return str_taint(str_new(dp->d_name, NAMLEN(dp)));
else
return Qnil;
}
#endif
static VALUE
dir_each(dir)
VALUE dir;
@ -190,7 +212,7 @@ dir_s_chdir(argc, argv, obj)
}
if (chdir(dist) < 0)
rb_sys_fail(0);
rb_sys_fail(dist);
return INT2FIX(0);
}
@ -220,7 +242,7 @@ dir_s_chroot(dir, path)
Check_SafeStr(path);
if (chroot(RSTRING(path)->ptr) == -1)
rb_sys_fail(0);
rb_sys_fail(RSTRING(path)->ptr);
return INT2FIX(0);
#else
@ -402,9 +424,13 @@ Init_Dir()
rb_include_module(cDir, mEnumerable);
rb_define_singleton_method(cDir, "new", dir_s_open, 1);
rb_define_singleton_method(cDir, "open", dir_s_open, 1);
rb_define_singleton_method(cDir, "foreach", dir_foreach, 1);
#if 0
rb_define_method(cDir,"read", dir_read, 0);
#endif
rb_define_method(cDir,"each", dir_each, 0);
rb_define_method(cDir,"rewind", dir_rewind, 0);
rb_define_method(cDir,"tell", dir_tell, 0);

View file

@ -146,6 +146,25 @@ so it only valid in rbc."
(re-search-backward P)
))
(if (not (functionp 'replace-in-string))
;; simple version of replace-in-string in XEmacs
(defun replace-in-string (str regexp newtext)
"Replace all matches in STR for REGEXP with NEWTEXT string,
and returns the new string."
(let ((rtn-str "")
(start 0)
(special)
match prev-start)
(while (setq match (string-match regexp str start))
(setq prev-start start
start (match-end 0)
rtn-str
(concat
rtn-str
(substring str prev-start match) newtext)))
(concat rtn-str (substring str start))))
)
(defun ruby-get-old-input ()
"Snarf the sexp ending at point"
(save-excursion