diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-05-25 09:42:47 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-05-25 09:42:47 +0000 |
commit | 8b1e7e34403977058d412931e31577df719fd2e4 (patch) | |
tree | 7743656749f91b601f3d025ea357e8a8043424d8 | |
parent | 45c61f40b23b14e97428206e1b813eb813526e6f (diff) |
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 33 | ||||
-rw-r--r-- | MANIFEST | 1 | ||||
-rw-r--r-- | Makefile.in | 15 | ||||
-rw-r--r-- | array.c | 4 | ||||
-rw-r--r-- | beos/ruby.def.in | 352 | ||||
-rw-r--r-- | bignum.c | 6 | ||||
-rw-r--r-- | configure | 424 | ||||
-rw-r--r-- | configure.in | 31 | ||||
-rw-r--r-- | dir.c | 2 | ||||
-rw-r--r-- | ext/curses/curses.c | 19 | ||||
-rw-r--r-- | ext/extmk.rb.in | 21 | ||||
-rw-r--r-- | file.c | 3 | ||||
-rw-r--r-- | hash.c | 4 | ||||
-rw-r--r-- | instruby.rb | 5 | ||||
-rw-r--r-- | io.c | 50 | ||||
-rw-r--r-- | lib/ftplib.rb | 6 | ||||
-rw-r--r-- | lib/mkmf.rb | 18 | ||||
-rw-r--r-- | lib/shell.rb | 666 | ||||
-rw-r--r-- | parse.y | 17 | ||||
-rw-r--r-- | re.c | 38 | ||||
-rw-r--r-- | regex.c | 225 | ||||
-rw-r--r-- | regex.h | 16 | ||||
-rw-r--r-- | ruby.h | 4 | ||||
-rw-r--r-- | sample/inf-ruby.el | 111 | ||||
-rw-r--r-- | sample/ruby-mode.el | 3 |
25 files changed, 1659 insertions, 415 deletions
@@ -1,3 +1,36 @@ +Mon May 25 12:38:56 1998 Yukihiro Matsumoto <matz@netlab.co.jp> + + * regex.c (re_compile_pattern): inline i option (?i). + + * regex.c (re_compile_pattern): inline x option (?x). + + * regex.c (re_compile_pattern): x option for regexp. + + * dir.c (dir_s_open): returns block's evaluated value. + + * io.c (f_open): returns block's evaluated value. + + * ext/curses/curses.c (curses_addstr): nil argument caused SEGV. + +Fri May 22 11:52:45 1998 Yukihiro Matsumoto <matz@netlab.co.jp> + + * regex.c (re_compile_pattern): push mark on (?:), so that + laststart check for {a,b} can be done. + +Thu May 21 17:31:16 1998 Yukihiro Matsumoto <matz@netlab.co.jp> + + * regex.c (re_match): wrong match (too non-greedy) for `{a,b}?'. + + * io.c (io_lineno): new method IO#lineno, IO#lineno=. + +Wed May 20 06:04:43 1998 MAEDA shugo <shugo@aianet.ne.jp> + + * BeOS patch. + +Wed May 20 16:32:19 1998 Yukihiro Matsumoto <matz@netlab.co.jp> + + * bignum.c (BIGDN): use RSHIFT(), instead of mere `>>'. + Tue May 19 16:36:26 1998 Yukihiro Matsumoto <matz@netlab.co.jp> * experimental release 1.1b9_22. @@ -74,6 +74,7 @@ util.c variable.c version.c version.h +beos/ruby.def.in ext/Setup ext/Setup.dj ext/Setup.nt diff --git a/Makefile.in b/Makefile.in index 562948f382..43c9ec7831 100644 --- a/Makefile.in +++ b/Makefile.in @@ -15,13 +15,17 @@ CFLAGS = @CFLAGS@ -I@srcdir@ -I@includedir@ LDFLAGS = @STATIC@ $(CFLAGS) @LDFLAGS@ LIBS = @LIBS@ $(EXTLIBS) MISSING = @LIBOBJS@ @ALLOCA@ +LDSHARED = @LDSHARED@ +DLDFLAGS = @DLDFLAGS@ +SOLIBS = @SOLIBS@ binsuffix = @binsuffix@ #### End of system configuration section. #### -LIBRUBY = libruby.a +LIBRUBY = @LIBRUBY@ +LIBRUBYARG = @LIBRUBYARG@ EXTOBJS = @@ -75,12 +79,15 @@ miniruby$(binsuffix): $(OBJS) $(MAINOBJ) dmyext.o ruby$(binsuffix): $(LIBRUBY) $(MAINOBJ) $(EXTOBJS) @rm -f $@ - $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY) $(LIBS) -o $@ + $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@ -$(LIBRUBY): $(OBJS) dmyext.o - @AR@ rcu $(LIBRUBY) $(OBJS) dmyext.o +libruby.a: $(OBJS) dmyext.o + @AR@ rcu $@ $(OBJS) dmyext.o @-@RANLIB@ $(LIBRUBY) 2> /dev/null || true +libruby.so: $(OBJS) dmyext.o + $(LDSHARED) $(DLDFLAGS) $(SOLIBS) $(OBJS) dmyext.o -o $@ + install: rbconfig.rb ./miniruby$(binsuffix) $(srcdir)/instruby.rb @@ -802,7 +802,9 @@ ary_delete(ary, item) i2++; } if (RARRAY(ary)->len == i2) { - if (iterator_p()) rb_yield(item); + if (iterator_p()) { + return rb_yield(item); + } return Qnil; } else { diff --git a/beos/ruby.def.in b/beos/ruby.def.in new file mode 100644 index 0000000000..3bdc536082 --- /dev/null +++ b/beos/ruby.def.in @@ -0,0 +1,352 @@ +ArgError +Bug +Error +Error_Append +Fail +Fatal +IndexError +LoadError +NameError +Raise +TypeError +Warning +any_to_s +ary_assoc +ary_concat +ary_delete +ary_delete_at +ary_each +ary_entry +ary_freeze +ary_includes +ary_join +ary_new +ary_new2 +ary_new3 +ary_new4 +ary_plus +ary_pop +ary_push +ary_rassoc +ary_reverse +ary_shift +ary_sort +ary_sort_bang +ary_store +ary_to_s +ary_unshift +assoc_new +backref_get +backref_set +big2dbl +big2str +big_2comp +big_and +big_clone +big_lshift +big_minus +big_mul +big_norm +big_or +big_plus +big_pow +big_rand +big_to_f +big_to_i +big_xor +cArray +cBignum +cClass +cData +cFile +cFixnum +cFixnum +cFloat +cHash +cIO +cInteger +cModule +cNumeric +cObject +cProc +cRegexp +cString +cStruct +class_new +class_new_instance +data_object_alloc +dbl2big +dln_find_exe +dln_find_file +dln_load +dyna_var_asgn +dyna_var_defined +dyna_var_ref +eaccess +enum_length +eof_error +exc_new +exc_new2 +exc_new3 +f_autoload +f_gets +f_lambda +f_load +f_require +file_open +file_s_expand_path +fix2str +fix_to_s +fix_upto +flo_pow +float_new +gc_force_recycle +gc_gc +gc_mark +gc_mark_frame +gc_mark_global_tbl +gc_mark_locations +gc_mark_maybe +gc_mark_threads +gc_mark_trap_list +gc_s_disable +gc_s_enable +hash_aref +hash_aset +hash_new +id_attrset +int2big +int2inum +io_binmode +io_check_closed +io_close +io_fptr_finalize +io_getc +io_gets +io_gets_method +io_mode_flags +io_readable +io_reopen +io_unbuffered +io_ungetc +io_writable +io_write +iterator_p +lastline_get +lastline_set +local_var_append +memclear +mod_constants +module_new +new_idhash +nodeline +nodetype +num2fix +num2int +num2long +num_coerce_bin +num_upto +num_zerodiv +obj_alloc +obj_as_string +obj_call_init +obj_equal +obj_is_instance_of +obj_is_kind_of +range_beg_end +range_new +rb_Array +rb_Float +rb_Integer +rb_String +rb_add_method +rb_alias +rb_alias_variable +rb_apply +rb_autoload +rb_autoload_defined +rb_backtrace +rb_call_inits +rb_check_safe_str +rb_check_type +rb_class2name +rb_class_of +rb_class_path +rb_clear_cache +rb_const_defined +rb_const_defined_at +rb_const_get +rb_const_get_at +rb_const_set +rb_define_alias +rb_define_attr +rb_define_class +rb_define_class_id +rb_define_class_under +rb_define_const +rb_define_global_const +rb_define_global_function +rb_define_hooked_variable +rb_define_method +rb_define_method_id +rb_define_module +rb_define_module_function +rb_define_module_id +rb_define_module_under +rb_define_private_method +rb_define_readonly_variable +rb_define_singleton_method +rb_define_variable +rb_define_virtual_variable +rb_each +rb_ensure +rb_eql +rb_equal +rb_eval_cmd +rb_eval_string +rb_exit +rb_extend_object +rb_fatal +rb_fdopen +rb_fopen +rb_frame_last_func +rb_funcall +rb_funcall2 +rb_get_kcode +rb_global_entry +rb_global_variable +rb_gvar_defined +rb_gvar_get +rb_gvar_set +rb_gvar_set2 +rb_hash +rb_id2name +rb_include_module +rb_inspect +rb_intern +rb_interrupt +rb_is_const_id +rb_is_instance_id +rb_iterate +rb_iv_get +rb_iv_set +rb_ivar_defined +rb_ivar_get +rb_ivar_set +rb_load_file +rb_method_boundp +rb_name_class +rb_newobj +rb_notimplement +rb_path2class +rb_proc_exec +rb_provide +rb_raise +rb_rescue +rb_respond_to +rb_safe_level +rb_scan_args +rb_secure +rb_set_class_path +rb_set_kcode +rb_set_safe_level +rb_singleton_class +rb_special_const_p +rb_str_setter +rb_sys_fail +rb_syswait +rb_test_false_or_nil +rb_to_id +rb_trap_eval +rb_trap_exec +rb_trap_exit +rb_type +rb_undef_method +rb_yield +rb_yield_0 +reg_free +reg_last_match +reg_match +reg_match2 +reg_match_last +reg_match_post +reg_match_pre +reg_new +reg_nth_defined +reg_nth_match +reg_regcomp +reg_regsub +reg_search +ruby_init +ruby_options +ruby_process_options +ruby_prog_init +ruby_run +ruby_script +ruby_set_argv +scan_hex +scan_oct +show_copyright +show_version +singleton_class_clone +singleton_class_new +st_add_direct +st_copy +st_delete +st_delete_safe +st_find_or_add +st_foreach +st_free_table +st_init_numtable +st_init_strtable +st_init_table +st_init_table_with_size +st_insert +st_lookup +str2inum +str_cat +str_cicmp +str_cmp +str_dup +str_freeze +str_hash +str_inspect +str_modify +str_new +str_new2 +str_new3 +str_new4 +str_plus +str_resize +str_split +str_substr +str_taint +str_tainted +str_times +str_upto +struct_alloc +struct_aref +struct_aset +struct_define +struct_getmember +struct_new +thread_alone +thread_create +thread_fd_writable +thread_interrupt +thread_schedule +thread_select +thread_sleep +thread_sleep_forever +thread_wait_fd +thread_wait_for +time_new +time_timeval +uint2big +uint2inum +xcalloc +xmalloc +xrealloc +eException +eStandardError +trap_immediate @@ -21,7 +21,7 @@ typedef unsigned short USHORT; #define BIGRAD (1L << BITSPERDIG) #define DIGSPERINT ((unsigned int)(sizeof(long)/sizeof(short))) #define BIGUP(x) ((unsigned int)(x) << BITSPERDIG) -#define BIGDN(x) ((x) >> BITSPERDIG) +#define BIGDN(x) RSHIFT((x),BITSPERDIG) #define BIGLO(x) ((x) & (BIGRAD-1)) static VALUE @@ -347,11 +347,11 @@ unsigned long big2ulong(x) VALUE x; { - unsigned int num; + unsigned long num; unsigned int len = RBIGNUM(x)->len; USHORT *ds; - if (len > sizeof(long)/sizeof(short)) + if (len > sizeof(long)/sizeof(USHORT)) ArgError("bignum too big to convert into `uint'"); ds = BDIGITS(x); num = 0; @@ -647,7 +647,6 @@ EOF echo "." fi - if test "$program_transform_name" = s,x,x,; then program_transform_name= else @@ -671,7 +670,7 @@ test "$program_transform_name" = "" && program_transform_name="s,x,x," # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:675: checking for $ac_word" >&5 +echo "configure:674: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -700,7 +699,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:704: checking for $ac_word" >&5 +echo "configure:703: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -748,7 +747,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:752: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:751: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -758,11 +757,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 762 "configure" +#line 761 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -782,12 +781,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:786: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:785: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:791: checking whether we are using GNU C" >&5 +echo "configure:790: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -796,7 +795,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:799: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -811,7 +810,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:815: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:814: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -839,7 +838,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:843: checking how to run the C preprocessor" >&5 +echo "configure:842: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -854,13 +853,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 858 "configure" +#line 857 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:864: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:863: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -871,13 +870,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 875 "configure" +#line 874 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:881: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:880: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -901,13 +900,13 @@ echo "$ac_t""$CPP" 1>&6 if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:905: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:904: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext <<EOF -#line 911 "configure" +#line 910 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -925,7 +924,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 929 "configure" +#line 928 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -951,7 +950,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:955: checking for $ac_word" >&5 +echo "configure:954: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_YACC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -983,7 +982,7 @@ test -n "$YACC" || YACC="yacc" # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:987: checking for $ac_word" >&5 +echo "configure:986: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1015,7 +1014,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1019: checking for $ac_word" >&5 +echo "configure:1018: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AR'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1055,7 +1054,7 @@ test -n "$AR" || AR="ar" # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1059: checking for a BSD compatible install" >&5 +echo "configure:1058: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1105,7 +1104,7 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1109: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1108: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1135,17 +1134,17 @@ fi # checks for UNIX variants that set C preprocessor variables ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:1139: checking for minix/config.h" >&5 +echo "configure:1138: checking for minix/config.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1144 "configure" +#line 1143 "configure" #include "confdefs.h" #include <minix/config.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1149: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1148: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1184,7 +1183,7 @@ fi echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1188: checking size of int" >&5 +echo "configure:1187: checking size of int" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1192,7 +1191,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 1196 "configure" +#line 1195 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1203,7 +1202,7 @@ main() exit(0); } EOF -if { (eval echo configure:1207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_int=`cat conftestval` else @@ -1223,7 +1222,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1227: checking size of long" >&5 +echo "configure:1226: checking size of long" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1231,7 +1230,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 1235 "configure" +#line 1234 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1242,7 +1241,7 @@ main() exit(0); } EOF -if { (eval echo configure:1246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_long=`cat conftestval` else @@ -1262,7 +1261,7 @@ EOF echo $ac_n "checking size of void*""... $ac_c" 1>&6 -echo "configure:1266: checking size of void*" >&5 +echo "configure:1265: checking size of void*" >&5 if eval "test \"`echo '$''{'ac_cv_sizeof_voidp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1270,7 +1269,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 1274 "configure" +#line 1273 "configure" #include "confdefs.h" #include <stdio.h> main() @@ -1281,7 +1280,7 @@ main() exit(0); } EOF -if { (eval echo configure:1285: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_sizeof_voidp=`cat conftestval` else @@ -1302,19 +1301,19 @@ EOF echo $ac_n "checking for prototypes""... $ac_c" 1>&6 -echo "configure:1306: checking for prototypes" >&5 +echo "configure:1305: checking for prototypes" >&5 if eval "test \"`echo '$''{'rb_cv_have_prototypes'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1311 "configure" +#line 1310 "configure" #include "confdefs.h" int foo(int x) { return 0; } int main() { return foo(10); ; return 0; } EOF -if { (eval echo configure:1318: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_have_prototypes=yes else @@ -1335,12 +1334,12 @@ EOF fi echo $ac_n "checking for variable length prototypes and stdarg.h""... $ac_c" 1>&6 -echo "configure:1339: checking for variable length prototypes and stdarg.h" >&5 +echo "configure:1338: checking for variable length prototypes and stdarg.h" >&5 if eval "test \"`echo '$''{'rb_cv_stdarg'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1344 "configure" +#line 1343 "configure" #include "confdefs.h" #include <stdarg.h> @@ -1357,7 +1356,7 @@ int main() { return foo(10, "", 3.14); ; return 0; } EOF -if { (eval echo configure:1361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1360: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_stdarg=yes else @@ -1378,19 +1377,19 @@ EOF fi echo $ac_n "checking for gcc attribute noreturn""... $ac_c" 1>&6 -echo "configure:1382: checking for gcc attribute noreturn" >&5 +echo "configure:1381: checking for gcc attribute noreturn" >&5 if eval "test \"`echo '$''{'rb_cv_have_attr_noreturn'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1387 "configure" +#line 1386 "configure" #include "confdefs.h" void exit(int x) __attribute__ ((noreturn)); int main() { ; return 0; } EOF -if { (eval echo configure:1394: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_have_attr_noreturn=yes else @@ -1417,7 +1416,7 @@ beos*) ;; *) LIBS="-lm $LIBS";; esac echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 -echo "configure:1421: checking for crypt in -lcrypt" >&5 +echo "configure:1420: checking for crypt in -lcrypt" >&5 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1425,7 +1424,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcrypt $LIBS" cat > conftest.$ac_ext <<EOF -#line 1429 "configure" +#line 1428 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1436,7 +1435,7 @@ int main() { crypt() ; return 0; } EOF -if { (eval echo configure:1440: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1464,7 +1463,7 @@ else fi echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:1468: checking for dlopen in -ldl" >&5 +echo "configure:1467: checking for dlopen in -ldl" >&5 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1472,7 +1471,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 1476 "configure" +#line 1475 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1483,7 +1482,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:1487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1486: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1511,7 +1510,7 @@ else fi # Dynamic linking for SunOS/Solaris and SYSV echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 -echo "configure:1515: checking for shl_load in -ldld" >&5 +echo "configure:1514: checking for shl_load in -ldld" >&5 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1519,7 +1518,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldld $LIBS" cat > conftest.$ac_ext <<EOF -#line 1523 "configure" +#line 1522 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1530,7 +1529,7 @@ int main() { shl_load() ; return 0; } EOF -if { (eval echo configure:1534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1563,12 +1562,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 -echo "configure:1567: checking for $ac_hdr that defines DIR" >&5 +echo "configure:1566: checking for $ac_hdr that defines DIR" >&5 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1572 "configure" +#line 1571 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_hdr> @@ -1576,7 +1575,7 @@ int main() { DIR *dirp = 0; ; return 0; } EOF -if { (eval echo configure:1580: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval "ac_cv_header_dirent_$ac_safe=yes" else @@ -1601,7 +1600,7 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 -echo "configure:1605: checking for opendir in -ldir" >&5 +echo "configure:1604: checking for opendir in -ldir" >&5 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1609,7 +1608,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldir $LIBS" cat > conftest.$ac_ext <<EOF -#line 1613 "configure" +#line 1612 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1620,7 +1619,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:1624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1642,7 +1641,7 @@ fi else echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 -echo "configure:1646: checking for opendir in -lx" >&5 +echo "configure:1645: checking for opendir in -lx" >&5 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1650,7 +1649,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lx $LIBS" cat > conftest.$ac_ext <<EOF -#line 1654 "configure" +#line 1653 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1661,7 +1660,7 @@ int main() { opendir() ; return 0; } EOF -if { (eval echo configure:1665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1684,12 +1683,12 @@ fi fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1688: checking for ANSI C header files" >&5 +echo "configure:1687: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1693 "configure" +#line 1692 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1697,7 +1696,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1701: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1700: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1714,7 +1713,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1718 "configure" +#line 1717 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1732,7 +1731,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1736 "configure" +#line 1735 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1753,7 +1752,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1757 "configure" +#line 1756 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1764,7 +1763,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1767: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1793,17 +1792,17 @@ for ac_hdr in stdlib.h unistd.h limits.h sys/file.h sys/ioctl.h pwd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1797: checking for $ac_hdr" >&5 +echo "configure:1796: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1802 "configure" +#line 1801 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1807: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1831,12 +1830,12 @@ done echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:1835: checking for uid_t in sys/types.h" >&5 +echo "configure:1834: checking for uid_t in sys/types.h" >&5 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1840 "configure" +#line 1839 "configure" #include "confdefs.h" #include <sys/types.h> EOF @@ -1865,12 +1864,12 @@ EOF fi echo $ac_n "checking for size_t""... $ac_c" 1>&6 -echo "configure:1869: checking for size_t" >&5 +echo "configure:1868: checking for size_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1874 "configure" +#line 1873 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1898,12 +1897,12 @@ EOF fi echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 -echo "configure:1902: checking for st_blksize in struct stat" >&5 +echo "configure:1901: checking for st_blksize in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1907 "configure" +#line 1906 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1911,7 +1910,7 @@ int main() { struct stat s; s.st_blksize; ; return 0; } EOF -if { (eval echo configure:1915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1914: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blksize=yes else @@ -1933,12 +1932,12 @@ fi save_LIBOJBS="$LIBOBJS" echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 -echo "configure:1937: checking for st_blocks in struct stat" >&5 +echo "configure:1936: checking for st_blocks in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1942 "configure" +#line 1941 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1946,7 +1945,7 @@ int main() { struct stat s; s.st_blocks; ; return 0; } EOF -if { (eval echo configure:1950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1949: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_blocks=yes else @@ -1970,12 +1969,12 @@ fi LIBOBJS="$save_LIBOBJS" echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 -echo "configure:1974: checking for st_rdev in struct stat" >&5 +echo "configure:1973: checking for st_rdev in struct stat" >&5 if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1979 "configure" +#line 1978 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/stat.h> @@ -1983,7 +1982,7 @@ int main() { struct stat s; s.st_rdev; ; return 0; } EOF -if { (eval echo configure:1987: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_st_rdev=yes else @@ -2005,7 +2004,7 @@ fi echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 -echo "configure:2009: checking type of array argument to getgroups" >&5 +echo "configure:2008: checking type of array argument to getgroups" >&5 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2013,7 +2012,7 @@ else ac_cv_type_getgroups=cross else cat > conftest.$ac_ext <<EOF -#line 2017 "configure" +#line 2016 "configure" #include "confdefs.h" /* Thanks to Mike Rendell for this test. */ @@ -2038,7 +2037,7 @@ main() } EOF -if { (eval echo configure:2042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_type_getgroups=gid_t else @@ -2052,7 +2051,7 @@ fi if test $ac_cv_type_getgroups = cross; then cat > conftest.$ac_ext <<EOF -#line 2056 "configure" +#line 2055 "configure" #include "confdefs.h" #include <unistd.h> EOF @@ -2076,12 +2075,12 @@ EOF echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:2080: checking return type of signal handlers" >&5 +echo "configure:2079: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2085 "configure" +#line 2084 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -2098,7 +2097,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:2102: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2101: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -2119,19 +2118,19 @@ EOF # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:2123: checking for working alloca.h" >&5 +echo "configure:2122: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2128 "configure" +#line 2127 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:2135: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -2152,12 +2151,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:2156: checking for alloca" >&5 +echo "configure:2155: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2161 "configure" +#line 2160 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -2180,7 +2179,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:2184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -2212,12 +2211,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:2216: checking whether alloca needs Cray hooks" >&5 +echo "configure:2215: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2221 "configure" +#line 2220 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -2242,12 +2241,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2246: checking for $ac_func" >&5 +echo "configure:2245: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2251 "configure" +#line 2250 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2270,7 +2269,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2297,7 +2296,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:2301: checking stack direction for C alloca" >&5 +echo "configure:2300: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2305,7 +2304,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 2309 "configure" +#line 2308 "configure" #include "confdefs.h" find_stack_direction () { @@ -2324,7 +2323,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:2328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -2346,12 +2345,12 @@ EOF fi echo $ac_n "checking for pid_t""... $ac_c" 1>&6 -echo "configure:2350: checking for pid_t" >&5 +echo "configure:2349: checking for pid_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2355 "configure" +#line 2354 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -2380,17 +2379,17 @@ fi ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 -echo "configure:2384: checking for vfork.h" >&5 +echo "configure:2383: checking for vfork.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2389 "configure" +#line 2388 "configure" #include "confdefs.h" #include <vfork.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2394: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2393: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -2415,18 +2414,18 @@ else fi echo $ac_n "checking for working vfork""... $ac_c" 1>&6 -echo "configure:2419: checking for working vfork" >&5 +echo "configure:2418: checking for working vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$cross_compiling" = yes; then echo $ac_n "checking for vfork""... $ac_c" 1>&6 -echo "configure:2425: checking for vfork" >&5 +echo "configure:2424: checking for vfork" >&5 if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2430 "configure" +#line 2429 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char vfork(); below. */ @@ -2449,7 +2448,7 @@ vfork(); ; return 0; } EOF -if { (eval echo configure:2453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2452: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_vfork=yes" else @@ -2470,7 +2469,7 @@ fi else cat > conftest.$ac_ext <<EOF -#line 2474 "configure" +#line 2473 "configure" #include "confdefs.h" /* Thanks to Paul Eggert for this test. */ #include <stdio.h> @@ -2565,7 +2564,7 @@ main() { } } EOF -if { (eval echo configure:2569: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_vfork_works=yes else @@ -2588,7 +2587,7 @@ EOF fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:2592: checking for 8-bit clean memcmp" >&5 +echo "configure:2591: checking for 8-bit clean memcmp" >&5 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2596,7 +2595,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <<EOF -#line 2600 "configure" +#line 2599 "configure" #include "confdefs.h" main() @@ -2606,7 +2605,7 @@ main() } EOF -if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_memcmp_clean=yes else @@ -2627,12 +2626,12 @@ for ac_func in dup2 setenv memmove mkdir strcasecmp strerror strftime\ strchr strstr strtoul strdup crypt flock do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2631: checking for $ac_func" >&5 +echo "configure:2630: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2636 "configure" +#line 2635 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2655,7 +2654,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2688,12 +2687,12 @@ for ac_func in fmod killpg drand48 random wait4 waitpid syscall getcwd\ dlopen sigprocmask sigaction _setjmp setpgrp do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:2692: checking for $ac_func" >&5 +echo "configure:2691: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2697 "configure" +#line 2696 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -2716,7 +2715,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:2720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -2742,12 +2741,12 @@ done if test "$ac_cv_func_strftime" = no; then echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:2746: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:2745: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2751 "configure" +#line 2750 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -2755,7 +2754,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:2759: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2758: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -2776,12 +2775,12 @@ EOF fi echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6 -echo "configure:2780: checking for tm_zone in struct tm" >&5 +echo "configure:2779: checking for tm_zone in struct tm" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm_zone'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2785 "configure" +#line 2784 "configure" #include "confdefs.h" #include <sys/types.h> #include <$ac_cv_struct_tm> @@ -2789,7 +2788,7 @@ int main() { struct tm tm; tm.tm_zone; ; return 0; } EOF -if { (eval echo configure:2793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2792: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm_zone=yes else @@ -2809,12 +2808,12 @@ EOF else echo $ac_n "checking for tzname""... $ac_c" 1>&6 -echo "configure:2813: checking for tzname" >&5 +echo "configure:2812: checking for tzname" >&5 if eval "test \"`echo '$''{'ac_cv_var_tzname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2818 "configure" +#line 2817 "configure" #include "confdefs.h" #include <time.h> #ifndef tzname /* For SGI. */ @@ -2824,7 +2823,7 @@ int main() { atoi(*tzname); ; return 0; } EOF -if { (eval echo configure:2828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_var_tzname=yes else @@ -2846,14 +2845,14 @@ EOF fi cat > conftest.$ac_ext <<EOF -#line 2850 "configure" +#line 2849 "configure" #include "confdefs.h" int main() { extern int daylight; int i = daylight; ; return 0; } EOF -if { (eval echo configure:2857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2856: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_DAYLIGHT 1 @@ -2873,7 +2872,7 @@ EOF else echo $ac_n "checking for BSD signal semantics""... $ac_c" 1>&6 -echo "configure:2877: checking for BSD signal semantics" >&5 +echo "configure:2876: checking for BSD signal semantics" >&5 if eval "test \"`echo '$''{'rb_cv_bsd_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2881,7 +2880,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 2885 "configure" +#line 2884 "configure" #include "confdefs.h" #include <stdio.h> @@ -2903,7 +2902,7 @@ main() } EOF -if { (eval echo configure:2907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_bsd_signal=yes else @@ -2937,19 +2936,19 @@ EOF else echo $ac_n "checking whether getpgrp() has arg""... $ac_c" 1>&6 -echo "configure:2941: checking whether getpgrp() has arg" >&5 +echo "configure:2940: checking whether getpgrp() has arg" >&5 if eval "test \"`echo '$''{'rb_cv_bsdgetpgrp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2946 "configure" +#line 2945 "configure" #include "confdefs.h" #include <unistd.h> int main() { getpgrp(0); ; return 0; } EOF -if { (eval echo configure:2953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2952: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_bsdgetpgrp=yes else @@ -2970,19 +2969,19 @@ EOF fi echo $ac_n "checking whether setpgrp() has args""... $ac_c" 1>&6 -echo "configure:2974: checking whether setpgrp() has args" >&5 +echo "configure:2973: checking whether setpgrp() has args" >&5 if eval "test \"`echo '$''{'rb_cv_bsdsetpgrp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 2979 "configure" +#line 2978 "configure" #include "confdefs.h" #include <unistd.h> int main() { setpgrp(1, 1); ; return 0; } EOF -if { (eval echo configure:2986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2985: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_bsdsetpgrp=yes else @@ -3004,14 +3003,14 @@ EOF fi echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 -echo "configure:3008: checking whether byte ordering is bigendian" >&5 +echo "configure:3007: checking whether byte ordering is bigendian" >&5 if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_cv_c_bigendian=unknown # See if sys/param.h defines the BYTE_ORDER macro. cat > conftest.$ac_ext <<EOF -#line 3015 "configure" +#line 3014 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3022,11 +3021,11 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3026: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* # It does; now see whether it defined to BIG_ENDIAN or not. cat > conftest.$ac_ext <<EOF -#line 3030 "configure" +#line 3029 "configure" #include "confdefs.h" #include <sys/types.h> #include <sys/param.h> @@ -3037,7 +3036,7 @@ int main() { #endif ; return 0; } EOF -if { (eval echo configure:3041: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3040: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_bigendian=yes else @@ -3057,7 +3056,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3061 "configure" +#line 3060 "configure" #include "confdefs.h" main () { /* Are we little or big endian? From Harbison&Steele. */ @@ -3070,7 +3069,7 @@ main () { exit (u.c[sizeof (long) - 1] == 1); } EOF -if { (eval echo configure:3074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3073: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_bigendian=no else @@ -3094,14 +3093,14 @@ EOF fi echo $ac_n "checking whether char is unsigned""... $ac_c" 1>&6 -echo "configure:3098: checking whether char is unsigned" >&5 +echo "configure:3097: checking whether char is unsigned" >&5 if eval "test \"`echo '$''{'ac_cv_c_char_unsigned'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test "$GCC" = yes; then # GCC predefines this symbol on systems where it applies. cat > conftest.$ac_ext <<EOF -#line 3105 "configure" +#line 3104 "configure" #include "confdefs.h" #ifdef __CHAR_UNSIGNED__ yes @@ -3123,7 +3122,7 @@ if test "$cross_compiling" = yes; then { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3127 "configure" +#line 3126 "configure" #include "confdefs.h" /* volatile prevents gcc2 from optimizing the test away on sparcs. */ #if !defined(__STDC__) || __STDC__ != 1 @@ -3133,7 +3132,7 @@ main() { volatile char c = 255; exit(c < 0); } EOF -if { (eval echo configure:3137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3136: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_char_unsigned=yes else @@ -3158,19 +3157,19 @@ fi echo $ac_n "checking count field in FILE structures""... $ac_c" 1>&6 -echo "configure:3162: checking count field in FILE structures" >&5 +echo "configure:3161: checking count field in FILE structures" >&5 if eval "test \"`echo '$''{'rb_cv_fcnt'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3167 "configure" +#line 3166 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_cnt = 0; ; return 0; } EOF -if { (eval echo configure:3174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3173: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_cnt" else @@ -3180,14 +3179,14 @@ fi rm -f conftest* if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 3184 "configure" +#line 3183 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->__cnt = 0; ; return 0; } EOF -if { (eval echo configure:3191: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3190: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="__cnt" else @@ -3198,14 +3197,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 3202 "configure" +#line 3201 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->_r = 0; ; return 0; } EOF -if { (eval echo configure:3209: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="_r" else @@ -3216,14 +3215,14 @@ rm -f conftest* fi if test "$rb_cv_fcnt" = ""; then cat > conftest.$ac_ext <<EOF -#line 3220 "configure" +#line 3219 "configure" #include "confdefs.h" #include <stdio.h> int main() { FILE *f = stdin; f->readCount = 0; ; return 0; } EOF -if { (eval echo configure:3227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3226: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_fcnt="readCount" else @@ -3248,9 +3247,9 @@ fi if test "$ac_cv_func_getpwent" = yes; then echo $ac_n "checking struct passwd""... $ac_c" 1>&6 -echo "configure:3252: checking struct passwd" >&5 +echo "configure:3251: checking struct passwd" >&5 cat > conftest.$ac_ext <<EOF -#line 3254 "configure" +#line 3253 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3265,7 +3264,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3269 "configure" +#line 3268 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3280,7 +3279,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3284 "configure" +#line 3283 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3295,7 +3294,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3299 "configure" +#line 3298 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3310,7 +3309,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3314 "configure" +#line 3313 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3325,7 +3324,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3329 "configure" +#line 3328 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3340,7 +3339,7 @@ fi rm -f conftest* cat > conftest.$ac_ext <<EOF -#line 3344 "configure" +#line 3343 "configure" #include "confdefs.h" #include <pwd.h> EOF @@ -3373,7 +3372,7 @@ fi case "$host_os" in linux*) echo $ac_n "checking whether ELF binaries are produced""... $ac_c" 1>&6 -echo "configure:3377: checking whether ELF binaries are produced" >&5 +echo "configure:3376: checking whether ELF binaries are produced" >&5 if eval "test \"`echo '$''{'rb_cv_linux_elf'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3381,7 +3380,7 @@ else : else cat > conftest.$ac_ext <<EOF -#line 3385 "configure" +#line 3384 "configure" #include "confdefs.h" /* Test for whether ELF binaries are produced */ @@ -3401,7 +3400,7 @@ main() { } EOF -if { (eval echo configure:3405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3404: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_linux_elf=yes else @@ -3431,7 +3430,7 @@ STATIC= if test "$with_dln_a_out" != yes; then rb_cv_dlopen=unknown echo $ac_n "checking whether OS depend dynamic link works""... $ac_c" 1>&6 -echo "configure:3435: checking whether OS depend dynamic link works" >&5 +echo "configure:3434: checking whether OS depend dynamic link works" >&5 if test "$GCC" = yes; then case "$host_os" in nextstep*) ;; @@ -3480,8 +3479,15 @@ echo "configure:3435: checking whether OS depend dynamic link works" >&5 human*) DLDFLAGS='' LDSHARED='' LDFLAGS='' ;; - beos*) LDSHARED="mwld -xms" - DLDFLAGS="" + beos*) LDSHARED="ld -xms" + case "$host_cpu" in + powerpc*) + DLDFLAGS="-f ruby.def -lbe -lroot -ldll" + ;; + *) + DLDFLAGS="ruby.def -lbe -lroot /boot/develop/lib/x86/glue-noinit.a" + ;; + esac rb_cv_dlopen=yes ;; *) LDSHARED='ld' ;; esac @@ -3492,13 +3498,13 @@ dln_a_out_works=no if test "$ac_cv_header_a_out_h" = yes; then if test "$with_dln_a_out" = yes || test "$rb_cv_dlopen" = unknown; then echo $ac_n "checking whether matz's dln works""... $ac_c" 1>&6 -echo "configure:3496: checking whether matz's dln works" >&5 +echo "configure:3502: checking whether matz's dln works" >&5 cat confdefs.h > config.h if eval "test \"`echo '$''{'rb_cv_dln_a_out'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3502 "configure" +#line 3508 "configure" #include "confdefs.h" #define USE_DLN_A_OUT @@ -3508,7 +3514,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3512: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3518: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* rb_cv_dln_a_out=yes else @@ -3591,7 +3597,7 @@ fi case "$host_os" in human*) echo $ac_n "checking for _harderr in -lsignal""... $ac_c" 1>&6 -echo "configure:3595: checking for _harderr in -lsignal" >&5 +echo "configure:3601: checking for _harderr in -lsignal" >&5 ac_lib_var=`echo signal'_'_harderr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3599,7 +3605,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lsignal $LIBS" cat > conftest.$ac_ext <<EOF -#line 3603 "configure" +#line 3609 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3610,7 +3616,7 @@ int main() { _harderr() ; return 0; } EOF -if { (eval echo configure:3614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3638,7 +3644,7 @@ else fi echo $ac_n "checking for hmemset in -lhmem""... $ac_c" 1>&6 -echo "configure:3642: checking for hmemset in -lhmem" >&5 +echo "configure:3648: checking for hmemset in -lhmem" >&5 ac_lib_var=`echo hmem'_'hmemset | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3646,7 +3652,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lhmem $LIBS" cat > conftest.$ac_ext <<EOF -#line 3650 "configure" +#line 3656 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -3657,7 +3663,7 @@ int main() { hmemset() ; return 0; } EOF -if { (eval echo configure:3661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3687,12 +3693,12 @@ fi for ac_func in select do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3691: checking for $ac_func" >&5 +echo "configure:3697: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 3696 "configure" +#line 3702 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -3715,7 +3721,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:3719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:3725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3740,7 +3746,7 @@ fi done echo $ac_n "checking whether PD libc _dtos18 fail to convert big number""... $ac_c" 1>&6 -echo "configure:3744: checking whether PD libc _dtos18 fail to convert big number" >&5 +echo "configure:3750: checking whether PD libc _dtos18 fail to convert big number" >&5 if eval "test \"`echo '$''{'rb_cv_missing__dtos18'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3748,7 +3754,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3752 "configure" +#line 3758 "configure" #include "confdefs.h" #include <stdio.h> @@ -3760,7 +3766,7 @@ main () } EOF -if { (eval echo configure:3764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_missing__dtos18=yes else @@ -3782,7 +3788,7 @@ EOF fi echo $ac_n "checking whether PD libc fconvert fail to round""... $ac_c" 1>&6 -echo "configure:3786: checking whether PD libc fconvert fail to round" >&5 +echo "configure:3792: checking whether PD libc fconvert fail to round" >&5 if eval "test \"`echo '$''{'rb_cv_missing_fconvert'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3790,7 +3796,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 3794 "configure" +#line 3800 "configure" #include "confdefs.h" #include <stdio.h> @@ -3803,7 +3809,7 @@ main () } EOF -if { (eval echo configure:3807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3813: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then rb_cv_missing_fconvert=yes else @@ -3845,10 +3851,29 @@ if test "$fat_binary" = yes ; then CFLAGS="$CFLAGS -pipe $ARCH_FLAG" fi +LIBRUBY='libruby.a' +LIBRUBYARG='libruby.a' +SOLIBS= if test "$host_os" = "beos"; then CFLAGS="$CFLAGS -relax_pointers" + LIBRUBY='libruby.so' + LIBRUBYARG='-lruby' + SOLIBS='-lnet' + echo creating ruby.def + case "$host_cpu" in + powerpc*) + cp beos/ruby.def.in ruby.def + ;; + *) + echo EXPORTS > ruby.def + cat beos/ruby.def.in >> ruby.def + ;; + esac fi + + + ri_prefix= test "$program_prefix" != NONE && ri_prefix=$program_prefix @@ -4078,6 +4103,9 @@ s%@STRIP@%$STRIP%g s%@EXTSTATIC@%$EXTSTATIC%g s%@binsuffix@%$binsuffix%g s%@setup@%$setup%g +s%@LIBRUBY@%$LIBRUBY%g +s%@LIBRUBYARG@%$LIBRUBYARG%g +s%@SOLIBS@%$SOLIBS%g s%@arch@%$arch%g CEOF diff --git a/configure.in b/configure.in index 7939da9498..0b916f741d 100644 --- a/configure.in +++ b/configure.in @@ -56,7 +56,6 @@ if test "$fat_binary" = yes ; then echo "." fi - AC_ARG_PROGRAM dnl Checks for programs. @@ -358,8 +357,15 @@ if test "$with_dln_a_out" != yes; then human*) DLDFLAGS='' LDSHARED='' LDFLAGS='' ;; - beos*) LDSHARED="mwld -xms" - DLDFLAGS="" + beos*) LDSHARED="ld -xms" + case "$host_cpu" in + powerpc*) + DLDFLAGS="-f ruby.def -lbe -lroot -ldll" + ;; + *) + DLDFLAGS="ruby.def -lbe -lroot /boot/develop/lib/x86/glue-noinit.a" + ;; + esac rb_cv_dlopen=yes ;; *) LDSHARED='ld' ;; esac @@ -496,9 +502,28 @@ if test "$fat_binary" = yes ; then CFLAGS="$CFLAGS -pipe $ARCH_FLAG" fi +LIBRUBY='libruby.a' +LIBRUBYARG='libruby.a' +SOLIBS= if test "$host_os" = "beos"; then CFLAGS="$CFLAGS -relax_pointers" + LIBRUBY='libruby.so' + LIBRUBYARG='-lruby' + SOLIBS='-lnet' + echo creating ruby.def + case "$host_cpu" in + powerpc*) + cp beos/ruby.def.in ruby.def + ;; + *) + echo EXPORTS > ruby.def + cat beos/ruby.def.in >> ruby.def + ;; + esac fi +AC_SUBST(LIBRUBY) +AC_SUBST(LIBRUBYARG) +AC_SUBST(SOLIBS) ri_prefix= test "$program_prefix" != NONE && @@ -88,7 +88,7 @@ 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 rb_ensure(rb_yield, obj, dir_close, obj); } return obj; diff --git a/ext/curses/curses.c b/ext/curses/curses.c index ec7c6c6002..a2fbe182fa 100644 --- a/ext/curses/curses.c +++ b/ext/curses/curses.c @@ -333,7 +333,11 @@ curses_addstr(obj, str) VALUE obj; VALUE str; { - addstr(STR2CSTR(str)); + char *s = STR2CSTR(str); + + if (s) { + addstr(s); + } return Qnil; } @@ -681,11 +685,14 @@ window_addstr(obj, str) VALUE obj; VALUE str; { - struct windata *winp; - - GetWINDOW(obj, winp); - waddstr(winp->window, STR2CSTR(str)); - + char *s = STR2CSTR(str); + + if (s) { + struct windata *winp; + + GetWINDOW(obj, winp); + waddstr(winp->window, s); + } return Qnil; } diff --git a/ext/extmk.rb.in b/ext/extmk.rb.in index 77f42d7072..14374c2249 100644 --- a/ext/extmk.rb.in +++ b/ext/extmk.rb.in @@ -225,6 +225,17 @@ def create_makefile(target) $defs.push(format("-DEXTLIB='%s'", libs.join(","))) end + $DLDFLAGS = '@DLDFLAGS@' + + if PLATFORM =~ /beos/ + if $libs + $libs = $libs + " -lruby" + else + $libs = "-lruby" + end + $DLDFLAGS = $DLDFLAGS + " -L" + $topdir + end + $srcdir = $topdir + "/ext/" + target mfile = open("Makefile", "w") mfile.printf "\ @@ -241,7 +252,7 @@ CC = @CC@ prefix = @prefix@ CFLAGS = %s -I#{$topdir} -I@includedir@ %s #$CFLAGS %s -DLDFLAGS = @DLDFLAGS@ #$LDFLAGS +DLDFLAGS = #$DLDFLAGS #$LDFLAGS LDSHARED = @LDSHARED@ ", if $static then "" else "@CCDLFLAGS@" end, CFLAGS, $defs.join(" ") @@ -343,6 +354,14 @@ $(TARGET): $(OBJS) dfile.close end mfile.close + + if PLATFORM =~ /beos/ + print "creating ruby.def\n" + open("ruby.def", "w") do |file| + file.print("EXPORTS\n") if PLATFORM =~ /^i/ + file.print("Init_#{target}\n") + end + end end def extmake(target) @@ -1158,7 +1158,8 @@ file_s_expand_path(argc, argv) } else if (s[0] != '/') { if (argc == 2) { - strcpy(buf, STR2CSTR(dname)); + dname = file_s_expand_path(1, &dname); + strcpy(buf, RSTRING(dname)->ptr); } else { #ifdef HAVE_GETCWD @@ -371,7 +371,9 @@ hash_delete(hash, key) } else if (st_delete(RHASH(hash)->tbl, &key, &val)) return val; - if (iterator_p()) rb_yield(key); + if (iterator_p()) { + return rb_yield(key); + } return Qnil; } diff --git a/instruby.rb b/instruby.rb index 9f55628655..7566160b13 100644 --- a/instruby.rb +++ b/instruby.rb @@ -23,6 +23,11 @@ File.install "ruby#{binsuffix}", for dll in Dir['*.dll'] File.install dll, "#{bindir}/#{dll}", 0755, TRUE end +for lib in ["libruby.so", "libruby.so.LIB"] + if File.exist? lib + File.install lib, "#{prefix}/lib", 0644, TRUE + end +end File.makedirs libdir, TRUE Dir.chdir "ext" system "../miniruby#{binsuffix} extmk.rb install" @@ -83,6 +83,11 @@ extern char *inplace; struct timeval time_timeval _((VALUE)); +static VALUE filename, file; +static int gets_lineno; +static int init_p = 0, next_p = 0; +static VALUE lineno; + #ifdef _STDIO_USES_IOSTREAM /* GNU libc */ # ifdef _IO_fpos_t # define READ_DATA_PENDING(fp) ((fp)->_IO_read_ptr != (fp)->_IO_read_end) @@ -432,8 +437,6 @@ io_read(argc, argv, io) return str_taint(str); } -static VALUE lineno; - VALUE io_gets_method(argc, argv, io) int argc; @@ -622,6 +625,38 @@ io_gets(io) } static VALUE +io_lineno(io) + VALUE io; +{ + OpenFile *fptr; + + GetOpenFile(io, fptr); + io_readable(fptr); + return INT2NUM(fptr->lineno); +} + +static VALUE +io_set_lineno(io, lineno) + VALUE io, lineno; +{ + OpenFile *fptr; + + GetOpenFile(io, fptr); + io_readable(fptr); + fptr->lineno = NUM2INT(lineno); +} + +static void +lineno_setter(val, id, var) + VALUE val; + ID id; + VALUE *var; +{ + gets_lineno = NUM2INT(val); + *var = INT2FIX(gets_lineno); +} + +static VALUE io_readline(argc, argv, io) int argc; VALUE *argv; @@ -1246,7 +1281,7 @@ f_open(argc, argv) port = io_open(RSTRING(pname)->ptr, mode); if (iterator_p()) { - rb_ensure(rb_yield, port, io_close, port); + return rb_ensure(rb_yield, port, io_close, port); } return port; @@ -1663,10 +1698,6 @@ io_s_new(argc, argv, klass) return prep_stdio(rb_fdopen(NUM2INT(fnum), m), io_mode_flags(m), klass); } -static VALUE filename, file; -static int gets_lineno; -static int init_p = 0, next_p = 0; - static int next_argv() { @@ -2590,7 +2621,7 @@ Init_IO() rb_define_hooked_variable("$-0", &RS, 0, rb_str_setter); rb_define_hooked_variable("$\\", &ORS, 0, rb_str_setter); - rb_define_variable("$.", &lineno); + rb_define_hooked_variable("$.", &lineno, 0, lineno_setter); rb_define_virtual_variable("$_", lastline_get, lastline_set); rb_define_method(cIO, "clone", io_clone, 0); @@ -2615,6 +2646,9 @@ Init_IO() rb_define_method(cIO, "sync", io_sync, 0); rb_define_method(cIO, "sync=", io_set_sync, 1); + rb_define_method(cIO, "lineno", io_lineno, 0); + rb_define_method(cIO, "lineno=", io_set_lineno, 1); + rb_define_method(cIO, "readlines", io_readlines, -1); rb_define_method(cIO, "read", io_read, -1); diff --git a/lib/ftplib.rb b/lib/ftplib.rb index f0c3f10930..617d85899b 100644 --- a/lib/ftplib.rb +++ b/lib/ftplib.rb @@ -452,10 +452,10 @@ class FTP MDTM_REGEXP = /^(\d\d\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)$/ - def mtime(filename) + def mtime(filename, local = false) str = mdtm(filename) - ary = str.scan(MDTM_REGEXP)[0].collect {|i| i.to_i} - return Time.gm(*ary) + ary = str.scan(MDTM_REGEXP)[0].collect {|i| i.to_i} + return local ? Time.local(*ary) : Time.gm(*ary) end def mkdir(dirname) diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 4221e98b92..72f0bfa8b8 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -236,6 +236,12 @@ def create_makefile(target) $defs.push(format("-DEXTLIB='%s'", libs.join(","))) end $libs = "" unless $libs + $DLDFLAGS = CONFIG["DLDFLAGS"] + + if PLATFORM =~ /beos/ + $libs = $libs + " -lruby" + $DLDFLAGS = $DLDFLAGS + " -L" + CONFIG["prefix"] + "/lib" + end unless $objs then $objs = Dir["*.c"] @@ -258,7 +264,7 @@ CC = gcc prefix = #{CONFIG["prefix"]} CFLAGS = #{CONFIG["CCDLFLAGS"]} -I#{$hdrdir} -I#{CONFIG["includedir"]} #{CFLAGS} #{$CFLAGS} #{$defs.join(" ")} -DLDFLAGS = #{CONFIG["DLDFLAGS"]} #{$LDFLAGS} +DLDFLAGS = #{$DLDFLAGS} #{$LDFLAGS} LDSHARED = #{CONFIG["LDSHARED"]} prefix = #{CONFIG["prefix"]} @@ -349,10 +355,18 @@ EOMF rescue end end + + if PLATFORM =~ /beos/ + print "creating ruby.def\n" + open("ruby.def", "w") do |file| + file.print("EXPORTS\n") if PLATFORM =~ /^i/ + file.print("Init_#{target}\n") + end + end end $local_libs = nil -$libs = PLATFORM =~ /cygwin32/ ? nil : "-lc" +$libs = PLATFORM =~ /cygwin32|beos/ ? nil : "-lc" $objs = nil $CFLAGS = nil $LDFLAGS = nil diff --git a/lib/shell.rb b/lib/shell.rb new file mode 100644 index 0000000000..a0ade9ab46 --- /dev/null +++ b/lib/shell.rb @@ -0,0 +1,666 @@ +# +# shell.rb - +# $Release Version: 0.1 $ +# $Revision: 1.1 $ +# $Date: 1998/03/29 17:10:09 $ +# by Keiju ISHITSUKA(Nippon Rational Inc.) +# +# -- +# +# +# + +require "e2mmap" +require "ftools" + +class Shell + @RCS_ID='-$Id: shell.rb,v 1.1 1998/03/29 17:10:09 keiju Exp $-' + + module Error + extend Exception2MessageMapper + def_exception :DirStackEmpty, "Directory stack empty." + def_exception :CanNotDefine, "Can't define method(%s, %s)." + def_exception :CanNotMethodApply, "This method(%s) can't apply this type(%s)." + def_exception :CommandNotFound, "Command not found(%s)." + end + include Error + + class << Shell + attr :cascade, TRUE + attr :debug, TRUE + attr :verbose, TRUE + + alias cascade? cascade + alias debug? debug + alias verbose? verbose + end + + def Shell.cd(path) + sh = new + sh.cd path + sh + end + + def Shell.default_system_path + if @default_system_path + @default_system_path + else + ENV["PATH"].split(":") + end + end + + def Shell.default_system_path=(path) + @default_system_path = path + end + + def Shell.default_record_separator + if @default_record_separator + @default_record_separator + else + $/ + end + end + + def Shell.default_record_separator=(rs) + @default_record_separator = rs + end + + @cascade = TRUE + @debug = FALSE + @verbose = TRUE + + def initialize + @cwd = Dir.pwd + @dir_stack = [] + @umask = nil + + @system_commands = {} + + @system_path = Shell.default_system_path + @record_separator = Shell.default_record_separator + + @verbose = Shell.verbose + end + + attr :system_path + + def system_path=(path) + @system_path = path + @system_commands = {} + end + + def rehash + @system_commands = {} + end + + attr :record_separator, TRUE + + attr :umask, TRUE + attr :verbose, TRUE + + alias verbose? verbose + + def expand_path(path) + if /^\// =~ path + File.expand_path(path) + else + File.expand_path(File.join(@cwd, path)) + end + end + + def effect_umask + if @umask + Thread.critical = TRUE + save = File.umask + begin + yield + ensure + File.umask save + Thread.critical = FALSE + end + else + yield + end + end + + # Dir関連メソッド + def [](pattern) + Thread.critical=TRUE + back = Dir.pwd + begin + Dir.chdir @cwd + Dir[pattern] + ensure + Dir.chdir back + Thread.critical = FALSE + end + end + alias glob [] + + def chdir(path = nil) + path = "~" unless path + @cwd = expand_path(path) + @system_commands.clear + end + alias cd chdir + + def pushdir(path = nil) + if iterator? + pushdir(path) + begin + yield + ensure + popdir + end + elsif path + @dir_stack.push @cwd + @cwd = expand_path(path) + else + if pop = @dir_stack.pop + @dir_stack.push @cwd + chdir pop + else + Shell.fail DirStackEmpty + end + end + end + alias pushd pushdir + + def popdir + if pop = @dir_stack.pop + @cwd = pop + else + Shell.fail DirStackEmpty + end + end + alias popd popdir + + attr :cwd + alias dir cwd + alias getwd cwd + alias pwd cwd + + def foreach(path = nil, *rs) + path = "." unless path + path = expand_path(path) + + if File.directory?(path) + Dir.foreach(path){|fn| yield fn} + else + IO.foreach(path, *rs){|l| yield l} + end + end + + def mkdir(path) + Dir.mkdir(expand_path(path)) + end + + # + # modeはpathがファイルの時だけ有効 + # + def open(path, mode) + path = expand_path(path) + if File.directory?(path) + Dir.open(path) + else + effect_umask do + File.open(path, mode) + end + end + end +# public :open + + def rmdir(path) + Dir.rmdir(expand_path(path)) + end + + def unlink(path) + path = expand_path(path) + if File.directory?(path) + Dir.unlink(path) + else + IO.unlink(path) + end + end + + # + # コマンド拡張 + # command_specs = [[command_name, [arguments,...]]] + # FILENAME* -> expand_path(filename*) + # \*FILENAME* -> filename*.collect{|fn| expand_path(fn)}.join(", ") + # + def Shell.def_commands(delegation_class, command_specs) + for meth, args in command_specs + arg_str = args.collect{|arg| arg.downcase}.join(", ") + call_arg_str = args.collect{ + |arg| + case arg + when /^(FILENAME.*)$/ + format("expand_path(%s)", $1.downcase) + when /^(\*FILENAME.*)$/ + # \*FILENAME* -> filenames.collect{|fn| expand_path(fn)}.join(", ") + $1.downcase + '.collect{|fn| expand_path(fn)}' + else + arg + end + }.join(", ") + d = %Q[ + def #{meth}(#{arg_str}) + #{delegation_class}.#{meth}(#{call_arg_str}) + end + ] + if debug? + print d + elsif verbose? + print "Define #{meth}(#{arg_str})\n" + end + eval d + end + end + + # + # File関連メソッド + # open/foreach/unlinkは別定義 + # + normal_delegation_file_methods = [ + ["atime", ["FILENAME"]], + ["basename", ["fn", "*opts"]], + ["chmod", ["mode", "*FILENAMES"]], + ["chown", ["owner", "group", "FILENAME"]], + ["ctime", ["group", "*FILENAMES"]], + ["delete", ["*FILENAMES"]], + ["dirname", ["FILENAME"]], + ["ftype", ["FILENAME"]], + ["join", ["*items"]], + ["link", ["FILENAME_O", "FILENAME_N"]], + ["lstat", ["FILENAME"]], + ["mtime", ["FILENAME"]], + ["readlink", ["FILENAME"]], + ["rename", ["FILENAME_FROM", "FILENAME_TO"]], + ["size", ["FILENAME"]], + ["split", ["pathname"]], + ["stat", ["FILENAME"]], + ["symlink", ["FILENAME_O", "FILENAME_N"]], + ["truncate", ["FILENAME", "length"]], + ["utime", ["atime", "mtime", "*FILENAMES"]]] + def_commands(File, + normal_delegation_file_methods) + alias rm delete + + # FileTest関連メソッド + def_commands(FileTest, + FileTest.singleton_methods.collect{|m| [m, ["FILENAME"]]}) + + # ftools関連メソッド + normal_delegation_ftools_methods = [ + ["syscopy", ["FILENAME_FROM", "FILENAME_TO"]], + ["copy", ["FILENAME_FROM", "FILENAME_TO"]], + ["move", ["FILENAME_FROM", "FILENAME_TO"]], + ["compare", ["FILENAME_FROM", "FILENAME_TO"]], + ["safe_unlink", ["*FILENAMES"]], + ["makedirs", ["*FILENAMES"]], +# ["chmod", ["mode", "*FILENAMES"]], + ["install", ["FILENAME_FROM", "FILENAME_TO", "mode"]], + ] + def_commands(File, + normal_delegation_ftools_methods) + alias cmp compare + alias mv move + alias cp copy + alias rm_f safe_unlink + alias mkpath makedirs + + # testコマンド + alias top_level_test test + def test(command, file1, file2 = nil) + if file2 + top_level_test command, expand_path(file1), expand_path(file2) + else + top_level_test command, expand_path(file1) + end + end + + # shell拡張 + def echo(*strings) + Echo.new(self, *strings) + end + + def cat(*filenames) + Cat.new(self, *filenames) + end + + def tee(file) + Tee.new(self, file) + end + +# def sort(*filenames) +# Sort.new(self, *filenames) +# end + + def system(command, *opts) + System.new(self, find_system_command(command), *opts) + end + + # + # コマンドを検索する. もし存在しなけば例外を返す. + # + def find_system_command(command) + return command if /^\// =~ command + case path = @system_commands[command] + when String + if sh.exists?(path) + return path + else + Shell.fail CommandNotFound, command + end + when FALSE + Shell.fail CommandNotFound, command + end + + for p in @system_path + path = join(p, command) + if FileTest.exists?(path) + @system_commands[command] = path + return path + end + end + @system_commands[command] = FALSE + Shell.fail CommandNotFound, command + end + + # + # コマンドを特異メソッドとして定義する. + # 定義できない時は例外が発生する. + # + def def_system_command(command, path = command) + d = " + def self.#{command}(*opts) + System.new(self, find_system_command('#{path}'), *opts) + end + " + begin + eval d + rescue + print "Can't define self.#{command} path: #{path}\n" if debug? or verbose? + Shell.fail CanNotDefine, comamnd, path + end + if debug? + print d + elsif verbose? + print "Define self.#{command} path: #{path}\n" + end + end + + # + # コマンドをShellのメソッドとして定義する. + # 定義できない時は例外が発生する. + # + def Shell.def_system_command(command, path = command) + d = " + def #{command}(*opts) + System.new(self, '#{path}', *opts) + end + " + begin + eval d + rescue + print "Can't define #{command} path: #{path}\n" if debug? or verbose? + Shell.fail CanNotDefine, comamnd, path + end + if debug? + print d + elsif verbose? + print "Define #{command} path: #{path}\n" + end + end + + # + # default_path上にのるコマンドを定義する. すでに同名のメソッドが存在 + # する時は, 定義を行なわない. + # デフォルトでは, 全てのメソッドには接頭子"sys_"をつける. + # メソッド名として許されないキャラクタ(英数時以外とメソッド名の + # 先頭が数値になる場合)は, 強制的に``_''に変換する. + # 定義エラーは無視する. + # + def Shell.install_system_command(pre = "sys_") + defined_meth = {} + for m in Shell.methods + defined_meth[m] = TRUE + end + sh = Shell.new + for path in Shell.default_path + next unless sh.directory? path + sh.cd path + sh.foreach do + |cn| + if !defined_meth[pre + cn] && sh.file?(cn) && sh.executable?(cn) + command = (pre + cn).gsub(/\W/, "_").sub(/^([0-9])/, '_\1') + begin + def_system_command(command, sh.expand_path(cn)) + rescue + printf("Warning: Can't define %s path: %s\n", + comamnd, + cn) unless debug? or verbose? + end + defined_meth[command] = command + end + end + end + end + + # + # Filterクラス + # 必要なメソッド: + # each() + class Filter + include Enumerable + include Error + + def initialize(sh) + @shell = sh + end + + def input=(filter) + @input = filter + end + + def each(rs = nil) + rs = @shell.record_separator unless rs + if @input + @input.each(rs){|l| yield l} + end + end + + def < (src) + case src + when String + cat = Cat.new(@shell, src) + cat | self + when IO + @input = src + self + else + Filter.fail CanNotMethodApply, "<", to.type + end + end + + def > (to) + case to + when String + dst = @shell.open(to, "w") + begin + each(){|l| dst << l} + ensure + dst.close + end + when IO + each(){|l| to << l} + else + Filter.fail CanNotMethodApply, ">", to.type + end + self + end + + def >> (to) + case to + when String + dst = @shell.open(to, "a") + begin + each(){|l| dst << l} + ensure + dst.close + end + when IO + each(){|l| to << l} + else + Filter.fail CanNotMethodApply, ">>", to.type + end + self + end + + def | (filter) + filter.input = self + filter + end + + def method_missing(method, *args) + if Shell.cascade? and @shell.respond_to?(method) + self | @shell.send(method, *args) + else + super + end + end + + def to_a + ary = [] + each(){|l| ary.push l} + ary + end + + def to_s + str = "" + each(){|l| str.concat l} + str + end + end + + class Echo < Filter + def initialize(sh, *strings) + super sh + @strings = strings + end + + def each(rs = nil) + rs = @shell.record_separator unless rs + for str in @strings + yield str + rs + end + end + end + + class Cat < Filter + def initialize(sh, *filenames) + super sh + @cat_files = filenames + end + + def each(rs = nil) + if @cat_files.empty? + super + else + for src in @cat_files + @shell.foreach(src, rs){|l| yield l} + end + end + end + end + +# class Sort < Cat +# def initialize(sh, *filenames) +# super +# end +# +# def each(rs = nil) +# ary = [] +# super{|l| ary.push l} +# for l in ary.sort! +# yield l +# end +# end +# end + + class Tee < Filter + def initialize(sh, filename) + super sh + @to_filename = filename + end + + def each(rs = nil) + to = @shell.open(@to_filename, "w") + begin + super{|l| to << l; yield l} + ensure + to.close + end + end + end + + class System < Filter + def initialize(sh, command, *opts) + require "socket" + + super(sh) +# @sock_me, @sock_peer = Socket.pair(Socket::AF_UNIX, Socket::SOCK_STREAM, 0) + @pipe_me_in, @pipe_peer_out = pipe + @pipe_peer_in, @pipe_me_out = pipe + begin + pid = fork { +# @sock_me.close + @pipe_me_in.close + @pipe_me_out.close +# STDIN.reopen(@sock_peer) +# STDOUT.reopen(@sock_peer) + STDIN.reopen(@pipe_peer_in) + STDOUT.reopen(@pipe_peer_out) + fork { + exec(command + " " + opts.join(" ")) + } + exit + } +# print pid; $stdout.flush + ensure +# sock_peer.close + @pipe_peer_in.close + @pipe_peer_out.close + begin + Process.waitpid(pid, nil) + rescue Errno::ECHILD + end + end + end + + def each(rs = nil) + rs = @shell.record_separator unless rs + begin + th_o = Thread.start{ + super{|l| @pipe_me_out.print l} +# @sock_me.shutdown(0) + @pipe_me_out.close + } + begin + @pipe_me_in.each(rs) do + |l| +# print l + yield l + end + ensure + th_o.exit + end + ensure +# @sock_peer.close unless @sock_peer.closed? +# @sock_me.close + @pipe_me_in.close + end + end + end +end @@ -1832,7 +1832,7 @@ parse_regx(term, paren) char kcode = 0; int once = 0; int nest = 0; - int casefold = 0; + int options = 0; int in_brack = 0; int re_start = sourceline; NODE *list = 0; @@ -1921,19 +1921,22 @@ parse_regx(term, paren) for (;;) { switch (c = nextc()) { case 'i': - casefold = 1; + options |= RE_OPTION_IGNORECASE; + break; + case 'x': + options |= RE_OPTION_EXTENDED; break; case 'o': once = 1; break; case 'n': - kcode = 2; + kcode = 4; break; case 'e': - kcode = 4; + kcode = 8; break; case 's': - kcode = 6; + kcode = 12; break; default: pushback(c); @@ -1950,12 +1953,12 @@ parse_regx(term, paren) list_append(list, NEW_STR(ss)); } nd_set_type(list, once?NODE_DREGX_ONCE:NODE_DREGX); - list->nd_cflag = kcode | casefold; + list->nd_cflag = options | kcode; yylval.node = list; return tDREGEXP; } else { - yylval.val = reg_new(tok(), toklen(), kcode | casefold); + yylval.val = reg_new(tok(), toklen(), options | kcode); return tREGEXP; } } @@ -318,7 +318,7 @@ make_regexp(s, len, flag) rp->allocated = 16; rp->fastmap = ALLOC_N(char, 256); if (flag) { - rp->translate = casetable; + rp->options = flag; } err = re_compile_pattern(s, (size_t)len, rp); kcode_reset_option(); @@ -376,15 +376,8 @@ reg_prepare_re(reg) if (FL_TEST(reg, REG_IGNORECASE)) { casefold = TRUE; } - if (casefold) { - if (RREGEXP(reg)->ptr->translate != casetable) { - RREGEXP(reg)->ptr->translate = casetable; - RREGEXP(reg)->ptr->fastmap_accurate = 0; - need_recompile = 1; - } - } - else if (RREGEXP(reg)->ptr->translate) { - RREGEXP(reg)->ptr->translate = NULL; + if ((casefold && !(RREGEXP(reg)->ptr->options & RE_OPTION_IGNORECASE)) + || (!casefold && (RREGEXP(reg)->ptr->options & RE_OPTION_IGNORECASE))) { RREGEXP(reg)->ptr->fastmap_accurate = 0; need_recompile = 1; } @@ -619,42 +612,42 @@ Regexp *rp; VALUE cRegexp; static VALUE -reg_new_1(klass, s, len, flag) +reg_new_1(klass, s, len, options) VALUE klass; char *s; int len; - int flag; /* CASEFOLD = 0x1 */ - /* CODE_NONE = 0x2 */ - /* CODE_EUC = 0x4 */ - /* CODE_SJIS = 0x6 */ + int options; /* CASEFOLD = 1 */ + /* EXTENDED = 2 */ + /* CODE_NONE = 4 */ + /* CODE_EUC = 8 */ + /* CODE_SJIS = 12 */ { NEWOBJ(re, struct RRegexp); OBJSETUP(re, klass, T_REGEXP); - re->ptr = 0; re->str = 0; - if (flag & 0x1) { + if (options & 0x1) { FL_SET(re, REG_IGNORECASE); } - switch (flag & ~0x1) { + switch (options & ~0x3) { case 0: default: FL_SET(re, reg_kcode); break; - case 2: + case 4: kcode_none(re); break; - case 4: + case 8: kcode_euc(re); break; - case 6: + case 12: kcode_sjis(re); break; } kcode_set_option(re); - re->ptr = make_regexp(s, len, flag & 0x1); + re->ptr = make_regexp(s, len, options & 0x3); re->str = ALLOC_N(char, len+1); memcpy(re->str, s, len); re->str[len] = '\0'; @@ -1024,6 +1017,7 @@ Init_Regexp() | RE_CONTEXTUAL_INVALID_OPS | RE_CHAR_CLASSES | RE_BACKSLASH_ESCAPE_IN_LISTS); + re_set_casetable(casetable); rb_define_virtual_variable("$~", match_getter, match_setter); rb_define_virtual_variable("$&", last_match_getter, 0); @@ -134,8 +134,7 @@ static void store_jump_n P((char *, int, char *, unsigned)); static void insert_jump_n P((int, char *, char *, char *, unsigned)); static void insert_op P((int, char *, char *)); static void insert_op_2 P((int, char *, char *, int, int)); -static int memcmp_translate P((unsigned char *, unsigned char *, - int, unsigned char *)); +static int memcmp_translate P((unsigned char *, unsigned char *, int)); /* Define the syntax stuff, so we can do the \<, \>, etc. */ @@ -149,6 +148,7 @@ static int memcmp_translate P((unsigned char *, unsigned char *, static char re_syntax_table[256]; static void init_syntax_once P((void)); +static char *translate = 0; #undef P @@ -185,6 +185,13 @@ init_syntax_once() done = 1; } +void +re_set_casetable(table) + char *table; +{ + translate = table; +} + /* Jim Meyering writes: "... Some ctype macros are valid only for character codes that @@ -287,6 +294,9 @@ enum regexpcode and store it in a memory register. Followed by one byte containing the register number. Register numbers must be in the range 0 through RE_NREGS. */ + start_paren, /* Just a mark for starting(?:). */ + start_casefold, /* Start casefold region. */ + stop_casefold, /* End casefold region. */ start_nowidth, /* Save string point to the stack. */ stop_nowidth, /* Restore string place at the point start_nowidth. */ pop_and_fail, /* Fail after popping nowidth entry from stack. */ @@ -369,6 +379,7 @@ long re_syntax_options = 0; /* Macros for re_compile_pattern, which is found below these definitions. */ +#define TRANSLATE_P() ((options&RE_OPTION_IGNORECASE) && translate) /* Fetch the next character in the uncompiled pattern---translating it if necessary. Also cast from a signed character in the constant string passed to us by the user to an unsigned char that we can use @@ -376,7 +387,7 @@ long re_syntax_options = 0; #define PATFETCH(c) \ do {if (p == pend) goto end_of_pattern; \ c = (unsigned char) *p++; \ - if (translate) c = (unsigned char)translate[c]; \ + if (TRANSLATE_P()) c = (unsigned char)translate[c]; \ } while (0) /* Fetch the next character in the uncompiled pattern, with no @@ -649,6 +660,18 @@ print_partial_compiled_pattern(start, end) printf ("/stop_memory/%d", mcnt); break; + case start_paren: + printf ("/start_paren"); + break; + + case start_casefold: + printf ("/start_casefold"); + break; + + case stop_casefold: + printf ("/stop_casefold"); + break; + case start_nowidth: EXTRACT_NUMBER_AND_INCR (mcnt, p); printf ("/start_nowidth//%d", mcnt); @@ -853,6 +876,9 @@ calculate_must_string(start, end) p++; break; + case start_casefold: + case stop_casefold: + case start_paren: case start_nowidth: case stop_nowidth: case pop_and_fail: @@ -1008,8 +1034,7 @@ re_compile_pattern(pattern, size, bufp) int range = 0; int had_char_class = 0; - /* How to translate the characters in the pattern. */ - char *translate = bufp->translate; + int options = bufp->options; bufp->fastmap_accurate = 0; @@ -1038,37 +1063,21 @@ re_compile_pattern(pattern, size, bufp) char *p1 = p; /* When testing what follows the $, look past the \-constructs that don't consume anything. */ - if (! (re_syntax_options & RE_CONTEXT_INDEP_OPS)) - while (p1 != pend) - { - if (*p1 == '\\' && p1 + 1 != pend - && (p1[1] == 'b' || p1[1] == 'B')) - p1 += 2; - else - break; - } - if (re_syntax_options & RE_TIGHT_VBAR) + + while (p1 != pend) { - if (! (re_syntax_options & RE_CONTEXT_INDEP_OPS) && p1 != pend) - goto normal_char; - /* Make operand of last vbar end before this `$'. */ - if (fixup_jump) - store_jump(fixup_jump, jump, b); - fixup_jump = 0; - BUFPUSH(endline); - break; + if (*p1 == '\\' && p1 + 1 != pend + && (p1[1] == 'b' || p1[1] == 'B')) + p1 += 2; + else + break; } /* $ means succeed if at end of line, but only in special contexts. If validly in the middle of a pattern, it is a normal character. */ if (p1 == pend || *p1 == '\n' - || (re_syntax_options & RE_CONTEXT_INDEP_OPS) - || (re_syntax_options & RE_NO_BK_PARENS - ? *p1 == ')' - : *p1 == '\\' && p1[1] == ')') - || (re_syntax_options & RE_NO_BK_VBAR - ? *p1 == '|' - : *p1 == '\\' && p1[1] == '|')) + || *p1 == ')' + || *p1 == '|') { BUFPUSH(endline); break; @@ -1079,36 +1088,19 @@ re_compile_pattern(pattern, size, bufp) /* ^ means succeed if at beg of line, but only if no preceding pattern. */ - if ((re_syntax_options & RE_CONTEXTUAL_INVALID_OPS) && laststart) + if (laststart) goto invalid_pattern; - if (laststart && p - 2 >= pattern && p[-2] != '\n' - && !(re_syntax_options & RE_CONTEXT_INDEP_OPS)) + if (laststart && p - 2 >= pattern && p[-2] != '\n') goto normal_char; - if (re_syntax_options & RE_TIGHT_VBAR) - { - if (p != pattern + 1 - && ! (re_syntax_options & RE_CONTEXT_INDEP_OPS)) - goto normal_char; - BUFPUSH(begline); - begalt = b; - } - else - { - BUFPUSH(begline); - } + BUFPUSH(begline); break; case '+': case '?': - if (re_syntax_options & RE_LIMITED_OPS) - goto normal_char; case '*': /* If there is no previous pattern, char not special. */ if (!laststart) { - if (re_syntax_options & RE_CONTEXTUAL_INVALID_OPS) - goto invalid_pattern; - else if (! (re_syntax_options & RE_CONTEXT_INDEP_OPS)) - goto normal_char; + goto invalid_pattern; } /* If there is a sequence of repetition chars, collapse it down to just one. */ @@ -1221,9 +1213,7 @@ re_compile_pattern(pattern, size, bufp) if (c == ']') { if (p == p0 + 1) { - /* If this is an empty bracket expression. */ - if ((re_syntax_options & RE_NO_EMPTY_BRACKETS) - && p == pend) + if (p == pend) goto invalid_pattern; } else @@ -1325,10 +1315,6 @@ re_compile_pattern(pattern, size, bufp) if (last > c) goto invalid_pattern; - if ((re_syntax_options & RE_NO_HYPHEN_RANGE_END) - && c == '-' && *p != ']') - goto invalid_pattern; - range = 0; if (last < 1 << BYTEWIDTH && c < 1 << BYTEWIDTH) { for (;last<=c;last++) @@ -1442,11 +1428,31 @@ re_compile_pattern(pattern, size, bufp) if (c == '?') { PATFETCH(c); switch (c) { - case '#': - case 'i': - case 'm': - case 's': case 'x': + case 'i': + for (;;) { + switch (c) { + case ')': + break; + + case 'x': + options |= RE_OPTION_EXTENDED; + break; + case 'i': + options |= RE_OPTION_IGNORECASE; + BUFPUSH(start_casefold); + break; + + default: + FREE_AND_RETURN(stackb, "undefined (?...) inline option"); + } + if (c == ')') break; + PATFETCH(c); + } + c = '#'; /* read whole in-line options */ + break; + + case '#': for (;;) { PATFETCH(c); if (c == ')') break; @@ -1468,7 +1474,7 @@ re_compile_pattern(pattern, size, bufp) c = '('; } if (c == '#') break; - if (stackp+6 >= stacke) { + if (stackp+7 >= stacke) { int *stackx; unsigned int len = stacke - stackb; @@ -1509,11 +1515,14 @@ re_compile_pattern(pattern, size, bufp) break; case ':': + if (b > bufp->buffer && b[-1] != start_paren) + BUFPUSH(start_paren); pending_exact = 0; default: break; } *stackp++ = c; + *stackp++ = options; fixup_jump = 0; laststart = 0; begalt = b; @@ -1521,6 +1530,10 @@ re_compile_pattern(pattern, size, bufp) case ')': if (stackp == stackb) goto unmatched_close; + if ((options ^ stackp[-1]) & RE_OPTION_IGNORECASE) { + BUFPUSH(stop_casefold); + } + options = *--stackp; switch (c = *--stackp) { case '(': if (fixup_jump) @@ -1589,32 +1602,27 @@ re_compile_pattern(pattern, size, bufp) /* If there is no previous pattern, this isn't an interval. */ if (!laststart) { - if (re_syntax_options & RE_CONTEXTUAL_INVALID_OPS) - goto invalid_pattern; - else goto normal_backsl; } /* It also isn't an interval if not preceded by an re matching a single character or subexpression, or if the current type of intervals can't handle back references and the previous thing is a back reference. */ + if (! (*laststart == anychar || *laststart == charset || *laststart == charset_not || *laststart == wordchar || *laststart == notwordchar || *laststart == start_memory + || *laststart == start_paren || (*laststart == exactn && (laststart[1] == 1 || laststart[1] == 2 && ismbchar(laststart[2]))) - || (! (re_syntax_options & RE_NO_BK_REFS) - && *laststart == duplicate))) + || *laststart == duplicate)) { /* Posix extended syntax is handled in previous statement; this is for Posix basic syntax. */ - if (re_syntax_options & RE_INTERVALS) - goto invalid_pattern; - goto normal_backsl; } lower_bound = -1; /* So can see if are set. */ @@ -1875,6 +1883,23 @@ re_compile_pattern(pattern, size, bufp) } break; + case '#': + if (options & RE_OPTION_EXTENDED) + { + while (p != pend) { + PATFETCH(c); + if (c == '\n') break; + } + break; + } + goto normal_char; + + case ' ': + case '\t': + case '\n': + if (options & RE_OPTION_EXTENDED) + break; + default: normal_char: /* Expects the character in `c'. */ c1 = 0; @@ -2160,12 +2185,12 @@ re_compile_fastmap(bufp) register unsigned char *p = pattern; register unsigned char *pend = pattern + size; register int j, k; - unsigned char *translate = (unsigned char *)bufp->translate; unsigned is_a_succeed_n; unsigned char **stackb = RE_TALLOC(NFAILURES, unsigned char*); unsigned char **stackp = stackb; unsigned char **stacke = stackb + NFAILURES; + int options = bufp->options; memset(fastmap, 0, (1 << BYTEWIDTH)); bufp->fastmap_accurate = 1; @@ -2187,12 +2212,12 @@ re_compile_fastmap(bufp) { case exactn: if (p[1] == 0xff) { - if (translate) + if (TRANSLATE_P()) fastmap[translate[p[2]]] = 2; else fastmap[p[2]] = 2; } - else if (translate) + else if (TRANSLATE_P()) fastmap[translate[p[1]]] = 1; else fastmap[p[1]] = 1; @@ -2206,10 +2231,13 @@ re_compile_fastmap(bufp) case wordbeg: case wordend: case pop_and_fail: + case start_paren: + case start_casefold: + case stop_casefold: continue; case endline: - if (translate) + if (TRANSLATE_P()) fastmap[translate['\n']] = 1; else fastmap['\n'] = 1; @@ -2333,7 +2361,7 @@ re_compile_fastmap(bufp) for (j = *p++ * BYTEWIDTH - 1; j >= 0; j--) if (p[j / BYTEWIDTH] & (1 << (j % BYTEWIDTH))) { - if (translate) + if (TRANSLATE_P()) fastmap[translate[j]] = 1; else fastmap[j] = 1; @@ -2453,8 +2481,8 @@ re_search(bufp, string, size, startpos, range, regs) struct re_registers *regs; { register char *fastmap = bufp->fastmap; - register unsigned char *translate = (unsigned char *) bufp->translate; int val, anchor = 0; + int options = bufp->options; /* Check for out-of-range starting position. */ if (startpos < 0 || startpos > size) @@ -2490,7 +2518,7 @@ re_search(bufp, string, size, startpos, range, regs) && bufp->must && !must_instr(bufp->must+1, bufp->must[0], string+startpos, size-startpos, - translate)) { + (TRANSLATE_P())?translate:0)) { return -1; } #endif @@ -2528,7 +2556,7 @@ re_search(bufp, string, size, startpos, range, regs) break; } else - if (fastmap[translate ? translate[c] : c]) + if (fastmap[(TRANSLATE_P()) ? translate[c] : c]) break; range--; } @@ -2540,7 +2568,7 @@ re_search(bufp, string, size, startpos, range, regs) c = string[startpos]; c &= 0xff; - if (translate ? !fastmap[translate[c]] : !fastmap[c]) + if ((TRANSLATE_P()) ? !fastmap[translate[c]] : !fastmap[c]) goto advance; } } @@ -2787,7 +2815,7 @@ re_match(bufp, string_arg, size, pos, regs) register unsigned char *d, *dend; register int mcnt; /* Multipurpose. */ - unsigned char *translate = (unsigned char *) bufp->translate; + int options = bufp->options; unsigned is_a_jump_n = 0; /* Failure point stack. Each place that can handle a failure further @@ -3041,8 +3069,8 @@ re_match(bufp, string_arg, size, pos, regs) /* Compare that many; failure if mismatch, else move past them. */ - if (translate - ? memcmp_translate(d, d2, mcnt, translate) + if ((options & RE_OPTION_IGNORECASE) + ? memcmp_translate(d, d2, mcnt) : memcmp((char *)d, (char *)d2, mcnt)) goto fail; d += mcnt, d2 += mcnt; @@ -3079,9 +3107,7 @@ re_match(bufp, string_arg, size, pos, regs) d += 2; break; } - if ((translate ? translate[*d] : *d) == '\n' - || ((re_syntax_options & RE_DOT_NOT_NULL) - && (translate ? translate[*d] : *d) == '\000')) + if (((TRANSLATE_P()) ? translate[*d] : *d) == '\n') goto fail; SET_REGS_MATCHED; d++; @@ -3102,7 +3128,7 @@ re_match(bufp, string_arg, size, pos, regs) c |= (unsigned char)d[1]; } } - else if (translate) + else if (TRANSLATE_P()) c = (unsigned char)translate[c]; half = not = is_in_list(c, p); @@ -3308,11 +3334,16 @@ re_match(bufp, string_arg, size, pos, regs) continue; case finalize_push_n: - EXTRACT_NUMBER(mcnt, p + 2); - /* Originally, this is how many times we CAN jump. */ + EXTRACT_NUMBER(mcnt, p + 2); + /* Originally, this is how many times we CAN jump. */ if (mcnt) { + int pos, i; + mcnt--; STORE_NUMBER(p + 2, mcnt); + EXTRACT_NUMBER(pos, p); + EXTRACT_NUMBER(i, p+pos+5); + if (i > 0) goto nofinalize; POP_FAILURE_POINT(); EXTRACT_NUMBER_AND_INCR(mcnt, p); PUSH_FAILURE_POINT(p + mcnt, d); @@ -3329,6 +3360,17 @@ re_match(bufp, string_arg, size, pos, regs) case unused: continue; + case start_paren: + continue; + + case start_casefold: + options |= RE_OPTION_IGNORECASE; + continue; + + case stop_casefold: + options &= ~RE_OPTION_IGNORECASE; + continue; + case wordbound: if (AT_WORD_BOUNDARY(d)) break; @@ -3374,7 +3416,7 @@ re_match(bufp, string_arg, size, pos, regs) mcnt = *p++; /* This is written out as an if-else so we don't waste time testing `translate' inside the loop. */ - if (translate) + if (TRANSLATE_P()) { do { @@ -3469,10 +3511,9 @@ re_match(bufp, string_arg, size, pos, regs) static int -memcmp_translate(s1, s2, len, translate) +memcmp_translate(s1, s2, len) unsigned char *s1, *s2; register int len; - unsigned char *translate; { register unsigned char *p1 = s1, *p2 = s2, c; while (len) @@ -164,6 +164,9 @@ extern long re_syntax_options; | RE_NO_BK_REFS | RE_NO_EMPTY_RANGES \ | RE_NO_HYPHEN_RANGE_END) +#define RE_OPTION_IGNORECASE (1L<<0) +#define RE_OPTION_EXTENDED (1L<<1) + /* For multi-byte char support */ #define MBCTYPE_ASCII 0 #define MBCTYPE_EUC 1 @@ -192,13 +195,10 @@ struct re_pattern_buffer char *fastmap; /* Pointer to fastmap, if any, or zero if none. */ /* re_search uses the fastmap, if there is one, to skip over totally implausible characters. */ - char *translate; /* Translate table to apply to all characters before - comparing, or zero for no translation. - The translation is applied to a pattern when it is - compiled and to data when it is matched. */ char *must; /* Pointer to exact pattern which strings should have to be matched. */ + long options; /* Flags for options such as extended_pattern. */ long re_nsub; /* Number of subexpressions found by the compiler. */ char fastmap_accurate; /* Set to zero when a new pattern is stored, @@ -213,11 +213,6 @@ struct re_pattern_buffer }; -/* search.c (search_buffer) needs this one value. It is defined both in - regex.c and here. */ -#define RE_EXACTN_VALUE 1 - - /* Structure to store register contents data in. Pass the address of such a structure as an argument to re_match, etc., @@ -252,7 +247,9 @@ extern int re_search (struct re_pattern_buffer *, char*, int, int, int, extern int re_match (struct re_pattern_buffer *, char *, int, int, struct re_registers *); extern long re_set_syntax (long syntax); +extern void re_set_casetable(char *table); extern void re_copy_registers (struct re_registers*, struct re_registers*); +extern void re_free_registers (struct re_registers*); #ifndef RUBY /* 4.2 bsd compatibility. */ @@ -268,6 +265,7 @@ extern void re_compile_fastmap (); extern int re_search (); extern int re_match (); extern long re_set_syntax(); +extern void re_set_casetable(); extern void re_copy_registers (); extern void re_free_registers (); @@ -499,8 +499,8 @@ VALUE rb_ensure _((VALUE(*)(),VALUE,VALUE(*)(),VALUE)); static char *libs_to_be_linked[] = { EXTLIB, 0 }; #endif -#endif - #if defined(__cplusplus) } /* extern "C" { */ #endif + +#endif /* ifndef RUBY_H */ diff --git a/sample/inf-ruby.el b/sample/inf-ruby.el index 317bf21d5f..504aff2db7 100644 --- a/sample/inf-ruby.el +++ b/sample/inf-ruby.el @@ -1,22 +1,18 @@ -;;; -*-Emacs-Lisp-*- +(J;;;(B (J-*-Emacs-Lisp-*-(B ;;; -;;; $Id: inf-ruby.el,v 1.2 1998/04/09 07:53:42 senda Exp $ +;;; $Id: inf-ruby.el,v 1.4 1998/05/20 02:45:58 senda Exp $ ;;; $Author: senda $ -;;; $Date: 1998/04/09 07:53:42 $ +;;; $Date: 1998/05/20 02:45:58 $ ;;; ;;; Inferior Ruby Mode - ruby process in a buffer. ;;; adapted from cmuscheme.el ;;; +;;; Usage: ;;; -;;; How to use it ? +;;; (0) check ruby-program-name variable that can run your environment. ;;; -;;; (0) this program need 'rbc.rb'. It must install as named 'rbc', -;;; set mode to executable (ex. chmod a+x rbc) and place in your -;;; command search path. -;;; -;;; (1) modify .emacs to use ruby-mode -;;; -;;; ex) +;;; (1) modify .emacs to use ruby-mode +;;; for example : ;;; ;;; (autoload 'ruby-mode "ruby-mode" ;;; "Mode for editing ruby source files") @@ -39,6 +35,17 @@ ;;; HISTORY ;;; senda - 8 Apr 1998: Created. ;;; $Log: inf-ruby.el,v $ +;;; Revision 1.4 1998/05/20 02:45:58 senda +;;; default program to irb +;;; +;;; Revision 1.3 1998/04/10 04:11:30 senda +;;; modification by Matsumoto san (1.1b9_09) +;;; remove-in-string defined +;;; global variable : +;;; inferior-ruby-first-prompt-pattern +;;; inferior-ruby-prompt-pattern +;;; defined +;;; ;;; Revision 1.2 1998/04/09 07:53:42 senda ;;; remove M-C-x in inferior-ruby-mode ;;; @@ -48,11 +55,33 @@ ;;; (require 'comint) - (require 'ruby-mode) -(autoload 'ruby-beginning-of-defun "ruby-mode") -(autoload 'ruby-end-of-defun "ruby-mode") +;; +;; you may change these variables +;; +;(defvar ruby-program-name "rbc --noreadline" +; "*Program invoked by the run-ruby command") +; +;(defvar inferior-ruby-first-prompt-pattern "^rbc0> *" +; "first prompt regex pattern of ruby interpreter.") +; +;(defvar inferior-ruby-prompt-pattern "^\\(rbc.[>*\"'] *\\)+" +; "prompt regex pattern of ruby interpreter.") + +;;;; for irb +(defvar ruby-program-name "irb --inf-ruby-mode" + "*Program invoked by the run-ruby command") + +(defvar inferior-ruby-first-prompt-pattern "^irb(.*)[0-9:]+0> *" + "first prompt regex pattern of ruby interpreter.") + +(defvar inferior-ruby-prompt-pattern "^\\(irb(.*)[0-9:]+[>*\"'] *\\)+" + "prompt regex pattern of ruby interpreter.") + +;; +;; mode variables +;; (defvar inferior-ruby-mode-hook nil "*Hook for customising inferior-ruby mode.") (defvar inferior-ruby-mode-map nil @@ -77,12 +106,13 @@ (define-key ruby-mode-map "\C-c\M-r" 'ruby-send-region-and-go) (define-key ruby-mode-map "\C-c\C-z" 'switch-to-ruby) (define-key ruby-mode-map "\C-c\C-l" 'ruby-load-file) + (define-key ruby-mode-map "\C-c\C-s" 'run-ruby) ) -(defvar ruby-buffer nil "current ruby (actually rbc) process buffer.") +(defvar ruby-buffer nil "current ruby (actually irb) process buffer.") (defun inferior-ruby-mode () - "Major mode for interacting with an inferior ruby (rbc) process. + "Major mode for interacting with an inferior ruby (irb) process. The following commands are available: \\{inferior-ruby-mode-map} @@ -119,7 +149,7 @@ to continue it." (comint-mode) ;; Customise in inferior-ruby-mode-hook ;(setq comint-prompt-regexp "^[^>\n]*>+ *") - (setq comint-prompt-regexp "^rbc.> *") ; rbc prompt ..... + (setq comint-prompt-regexp inferior-ruby-prompt-pattern) ;;(scheme-mode-variables) (ruby-mode-variables) (setq major-mode 'inferior-ruby-mode) @@ -130,7 +160,7 @@ to continue it." (setq comint-get-old-input (function ruby-get-old-input)) (run-hooks 'inferior-ruby-mode-hook)) -(defvar inferior-ruby-filter-regexp "" ;;"\\`\\s *\\S ?\\S ?\\s *\\'" +(defvar inferior-ruby-filter-regexp "\\`\\s *\\S ?\\S ?\\s *\\'" "*Input matching this regexp are not saved on the history list. Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters.") @@ -138,39 +168,23 @@ Defaults to a regexp ignoring all inputs of 0, 1, or 2 letters.") "Don't save anything matching inferior-ruby-filter-regexp" (not (string-match inferior-ruby-filter-regexp str))) -(defun ruby-rbc-backward-sexp () - "backward-sexp for ruby. -it search rbc0> prompt and set point to the beginning of prompt. -so it only valid in rbc." - (let ((P "^rbc0> *")) - (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)))) -) +;; adapted from replace-in-string in XEmacs (subr.el) +(defun remove-in-string (str regexp) + "Remove all matches in STR for REGEXP and returns the new string." + (let ((rtn-str "") (start 0) 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)))) + (concat rtn-str (substring str start)))) (defun ruby-get-old-input () "Snarf the sexp ending at point" (save-excursion - (let ((end (point))(P "^rbc.> *")) - (ruby-rbc-backward-sexp) - (replace-in-string (buffer-substring (point) end) P "") + (let ((end (point))) + (re-search-backward inferior-ruby-first-prompt-pattern) + (remove-in-string (buffer-substring (point) end) + inferior-ruby-prompt-pattern) ))) (defun ruby-args-to-list (string) @@ -186,9 +200,6 @@ so it only valid in rbc." (ruby-args-to-list (substring string pos (length string))))))))) -(defvar ruby-program-name "rbc --noreadline" - "*Program invoked by the run-ruby command") - (defun run-ruby (cmd) "Run an inferior Ruby process, input and output via buffer *ruby*. If there is a process already running in `*ruby*', switch to that buffer. diff --git a/sample/ruby-mode.el b/sample/ruby-mode.el index 3a5bab86ce..8beb2ecebf 100644 --- a/sample/ruby-mode.el +++ b/sample/ruby-mode.el @@ -349,7 +349,8 @@ The variable ruby-indent-level controls the amount of indentation. (goto-char pnt)) ((looking-at ":\\([a-zA-Z_][a-zA-Z_0-9]*\\)?") (goto-char (match-end 0))) - ((or (looking-at "\\.\\.\\.?") + ((or (looking-at "\\.") + (looking-at "\\.\\.\\.?") (looking-at "\\.[0-9]+") (looking-at "\\.[a-zA-Z_0-9]+")) (goto-char (match-end 0))) |