mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@867 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
65cdbd0667
commit
d3a6170010
6 changed files with 89 additions and 49 deletions
|
@ -1,3 +1,12 @@
|
|||
Tue Aug 1 16:41:58 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* ruby.c (proc_options): global load path setting moved from
|
||||
ruby_prog_init().
|
||||
|
||||
* ruby.c (incpush): renamed. push path entry at the END of the
|
||||
load path array. This makes -I directories sorted in order in
|
||||
the arguments.
|
||||
|
||||
Sat Jul 29 23:42:04 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
|
||||
|
||||
* dir.c (dir_each): should check whether dir is closed during the
|
||||
|
|
|
@ -54,6 +54,8 @@ AC_ARG_ENABLE(fat-binary,
|
|||
TARGET_ARCHS="m68k `/usr/bin/arch`"
|
||||
fi
|
||||
fi
|
||||
# to ensure AC_HEADER_SYS_WAIT works
|
||||
AC_DEFINE(_POSIX_SOURCE)
|
||||
;;
|
||||
esac
|
||||
# /usr/lib/arch_tool -archify_list $TARGET_ARCHS
|
||||
|
@ -94,6 +96,7 @@ AC_PROG_LN_S
|
|||
AC_PROG_MAKE_SET
|
||||
|
||||
# checks for UNIX variants that set C preprocessor variables
|
||||
AC_AIX
|
||||
AC_MINIX
|
||||
|
||||
AC_EXEEXT
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#
|
||||
# tkafter.rb : methods for Tcl/Tk after command
|
||||
# 1998/07/02 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
|
||||
# 2000/08/01 by Hidetoshi Nagai <nagai@ai.kyutech.ac.jp>
|
||||
#
|
||||
require 'tk'
|
||||
|
||||
|
@ -37,7 +37,16 @@ class TkAfter
|
|||
###############################
|
||||
def do_callback(*args)
|
||||
@in_callback = true
|
||||
ret = @current_proc.call(*args)
|
||||
begin
|
||||
ret = @current_proc.call(*args)
|
||||
rescue StandardError, NameError
|
||||
if @cancel_on_exception
|
||||
cancel
|
||||
return nil
|
||||
else
|
||||
fail $!
|
||||
end
|
||||
end
|
||||
if @set_next
|
||||
set_next_callback(*args)
|
||||
else
|
||||
|
@ -118,6 +127,8 @@ class TkAfter
|
|||
@after_id = nil
|
||||
@after_script = nil
|
||||
|
||||
@cancel_on_exception = true
|
||||
|
||||
set_procs(*args) if args != []
|
||||
|
||||
@running = false
|
||||
|
@ -135,7 +146,16 @@ class TkAfter
|
|||
end
|
||||
|
||||
def current_status
|
||||
[@running, @current_sleep, @current_proc, @current_args, @do_loop]
|
||||
[@running, @current_sleep, @current_proc, @current_args,
|
||||
@do_loop, @cancel_on_exception]
|
||||
end
|
||||
|
||||
def cancel_on_exception?
|
||||
@cancel_on_exception
|
||||
end
|
||||
|
||||
def cancel_on_exception=(mode)
|
||||
@cancel_on_exception = mode
|
||||
end
|
||||
|
||||
def running?
|
||||
|
|
|
@ -460,7 +460,7 @@ class TkText<TkTextWin
|
|||
when 'anchor'
|
||||
result.push TkTextMarkAnchor.new(self)
|
||||
else
|
||||
result.push tk_tcl2rb(val)
|
||||
result.push tk_tcl2ruby(val)
|
||||
end
|
||||
when 'tagon'
|
||||
if val == 'sel'
|
||||
|
@ -470,12 +470,12 @@ class TkText<TkTextWin
|
|||
result.push TkTextTagSel.new(self)
|
||||
end
|
||||
else
|
||||
result.push tk_tcl2rb val
|
||||
result.push tk_tcl2ruby(val)
|
||||
end
|
||||
when 'tagoff'
|
||||
result.push tk_tcl2rb sel
|
||||
result.push tk_tcl2ruby(sel)
|
||||
when 'window'
|
||||
result.push tk_tcl2rb val
|
||||
result.push tk_tcl2ruby(val)
|
||||
end
|
||||
i = idx + 1
|
||||
end
|
||||
|
|
|
@ -16,27 +16,27 @@ module Shellwords
|
|||
unless line.kind_of?(String)
|
||||
raise ArgumentError, "Argument must be String class object."
|
||||
end
|
||||
line.sub!(/^\s+/, '')
|
||||
line.sub!(/\A\s+/, '')
|
||||
words = []
|
||||
while line != ''
|
||||
field = ''
|
||||
while true
|
||||
if line.sub!(/^"(([^"\\]|\\.)*)"/, '') then #"
|
||||
if line.sub!(/\A"(([^"\\]|\\.)*)"/, '') then #"
|
||||
snippet = $1
|
||||
snippet.gsub!(/\\(.)/, '\1')
|
||||
elsif line =~ /^"/ then #"
|
||||
elsif line =~ /\A"/ then #"
|
||||
raise ArgumentError, "Unmatched double quote: #{line}"
|
||||
elsif line.sub!(/^'(([^'\\]|\\.)*)'/, '') then #'
|
||||
elsif line.sub!(/\A'(([^'\\]|\\.)*)'/, '') then #'
|
||||
snippet = $1
|
||||
snippet.gsub!(/\\(.)/, '\1')
|
||||
elsif line =~ /^'/ then #'
|
||||
elsif line =~ /\A'/ then #'
|
||||
raise ArgumentError, "Unmatched single quote: #{line}"
|
||||
elsif line.sub!(/^\\(.)/, '') then
|
||||
elsif line.sub!(/\A\\(.)/, '') then
|
||||
snippet = $1
|
||||
elsif line.sub!(/^([^\s\\'"]+)/, '') then #'
|
||||
elsif line.sub!(/\A([^\s\\'"]+)/, '') then #'
|
||||
snippet = $1
|
||||
else
|
||||
line.sub!(/^\s+/, '')
|
||||
line.sub!(/\A\s+/, '')
|
||||
break
|
||||
end
|
||||
field.concat(snippet)
|
||||
|
|
76
ruby.c
76
ruby.c
|
@ -82,14 +82,14 @@ usage(name)
|
|||
"-Idirectory specify $LOAD_PATH directory (may be used more than once)",
|
||||
"-Kkcode specifies KANJI (Japanese) code-set",
|
||||
"-l enable line ending processing",
|
||||
"-n assume 'while gets; ...; end' loop around your script",
|
||||
"-n assume 'while gets(); ... end' loop around your script",
|
||||
"-p assume loop like -n but print line also like sed",
|
||||
"-rlibrary require the library, before executing your script",
|
||||
"-s enable some switch parsing for switches after script name",
|
||||
"-S look for the script using PATH environment variable",
|
||||
"-T[level] turn on tainting checks",
|
||||
"-v enables verbose mode",
|
||||
"-w turn warnings on for compilation of your script",
|
||||
"-v print version number, then turn on verbose mode",
|
||||
"-w turn warnings on for your script",
|
||||
"-x[directory] strip off text before #!ruby line and perhaps cd to directory",
|
||||
"--copyright print the copyright",
|
||||
"--version print the version",
|
||||
|
@ -167,7 +167,7 @@ rubylib_mangle(s, l)
|
|||
#endif
|
||||
|
||||
static void
|
||||
addpath(path)
|
||||
incpush(path)
|
||||
const char *path;
|
||||
{
|
||||
const char sep = PATH_SEP_CHAR;
|
||||
|
@ -196,10 +196,43 @@ addpath(path)
|
|||
break;
|
||||
}
|
||||
}
|
||||
rb_load_path = rb_ary_plus(ary, rb_load_path);
|
||||
rb_ary_concat(rb_load_path, ary);
|
||||
}
|
||||
else {
|
||||
rb_ary_unshift(rb_load_path, rubylib_mangled_path2(path));
|
||||
rb_ary_push(rb_load_path, rubylib_mangled_path2(path));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ruby_path_init()
|
||||
{
|
||||
if (rb_safe_level() == 0) {
|
||||
incpush(getenv("RUBYLIB"));
|
||||
}
|
||||
|
||||
#ifdef RUBY_SEARCH_PATH
|
||||
incpush(RUBY_SEARCH_PATH);
|
||||
#endif
|
||||
|
||||
#ifdef RUBY_SITE_THIN_ARCHLIB
|
||||
incpush(RUBY_SITE_THIN_ARCHLIB);
|
||||
#endif
|
||||
incpush(RUBY_SITE_ARCHLIB);
|
||||
incpush(RUBY_SITE_LIB2);
|
||||
incpush(RUBY_SITE_LIB);
|
||||
|
||||
#ifdef RUBY_THIN_ARCHLIB
|
||||
incpush(RUBY_THIN_ARCHLIB);
|
||||
#endif
|
||||
incpush(RUBY_ARCHLIB);
|
||||
|
||||
incpush(RUBY_LIB);
|
||||
#if defined(_WIN32) || defined(DJGPP)
|
||||
incpush(ruby_libpath());
|
||||
#endif
|
||||
|
||||
if (rb_safe_level() == 0) {
|
||||
incpush(".");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,11 +268,6 @@ require_libraries()
|
|||
struct req_list *list = req_list_head.next;
|
||||
struct req_list *tmp;
|
||||
|
||||
if (rb_safe_level() == 0) {
|
||||
rb_ary_push(rb_load_path, rb_str_new2("."));
|
||||
addpath(getenv("RUBYLIB"));
|
||||
}
|
||||
|
||||
Init_ext(); /* should be called here for some reason :-( */
|
||||
ruby_sourcefile = 0;
|
||||
save[0] = ruby_eval_tree;
|
||||
|
@ -487,9 +515,9 @@ proc_options(argc, argv)
|
|||
case 'I':
|
||||
forbid_setid("-I");
|
||||
if (*++s)
|
||||
addpath(s);
|
||||
incpush(s);
|
||||
else if (argv[1]) {
|
||||
addpath(argv[1]);
|
||||
incpush(argv[1]);
|
||||
argc--,argv++;
|
||||
}
|
||||
break;
|
||||
|
@ -631,6 +659,7 @@ proc_options(argc, argv)
|
|||
ruby_set_argv(argc, argv);
|
||||
process_sflag();
|
||||
|
||||
ruby_path_init();
|
||||
ruby_sourcefile = argv0;
|
||||
if (e_script) {
|
||||
require_libraries();
|
||||
|
@ -929,27 +958,6 @@ ruby_prog_init()
|
|||
rb_define_readonly_variable("$-p", &do_print);
|
||||
rb_define_readonly_variable("$-l", &do_line);
|
||||
|
||||
addpath(RUBY_LIB);
|
||||
#if defined(_WIN32) || defined(DJGPP)
|
||||
addpath(ruby_libpath());
|
||||
#endif
|
||||
|
||||
addpath(RUBY_ARCHLIB);
|
||||
#ifdef RUBY_THIN_ARCHLIB
|
||||
addpath(RUBY_THIN_ARCHLIB);
|
||||
#endif
|
||||
|
||||
addpath(RUBY_SITE_LIB);
|
||||
addpath(RUBY_SITE_LIB2);
|
||||
addpath(RUBY_SITE_ARCHLIB);
|
||||
#ifdef RUBY_SITE_THIN_ARCHLIB
|
||||
addpath(RUBY_SITE_THIN_ARCHLIB);
|
||||
#endif
|
||||
|
||||
#ifdef RUBY_SEARCH_PATH
|
||||
addpath(RUBY_SEARCH_PATH);
|
||||
#endif
|
||||
|
||||
rb_define_hooked_variable("$0", &rb_progname, 0, set_arg0);
|
||||
|
||||
rb_argv = rb_ary_new();
|
||||
|
|
Loading…
Reference in a new issue