summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.mk314
-rw-r--r--misc/ruby-electric.el200
-rw-r--r--test/openssl/test_pair.rb332
-rwxr-xr-xwin32/ifchange.bat30
4 files changed, 876 insertions, 0 deletions
diff --git a/common.mk b/common.mk
new file mode 100644
index 0000000000..3a71fa8d75
--- /dev/null
+++ b/common.mk
@@ -0,0 +1,314 @@
+bin: $(PROGRAM) $(WPROGRAM)
+lib: $(LIBRUBY);
+dll: $(LIBRUBY_SO);
+
+EXTCONF = extconf.rb
+RBCONFIG = ./.rbconfig.time
+
+DMYEXT = dmyext.$(OBJEXT)
+MAINOBJ = main.$(OBJEXT)
+
+OBJS = array.$(OBJEXT) \
+ ascii.$(OBJEXT) \
+ bignum.$(OBJEXT) \
+ class.$(OBJEXT) \
+ compar.$(OBJEXT) \
+ dir.$(OBJEXT) \
+ dln.$(OBJEXT) \
+ enum.$(OBJEXT) \
+ error.$(OBJEXT) \
+ euc_jp.$(OBJEXT) \
+ eval.$(OBJEXT) \
+ file.$(OBJEXT) \
+ gc.$(OBJEXT) \
+ hash.$(OBJEXT) \
+ inits.$(OBJEXT) \
+ io.$(OBJEXT) \
+ marshal.$(OBJEXT) \
+ math.$(OBJEXT) \
+ numeric.$(OBJEXT) \
+ object.$(OBJEXT) \
+ pack.$(OBJEXT) \
+ parse.$(OBJEXT) \
+ process.$(OBJEXT) \
+ prec.$(OBJEXT) \
+ random.$(OBJEXT) \
+ range.$(OBJEXT) \
+ re.$(OBJEXT) \
+ regcomp.$(OBJEXT) \
+ regenc.$(OBJEXT) \
+ regerror.$(OBJEXT) \
+ regexec.$(OBJEXT) \
+ regparse.$(OBJEXT) \
+ ruby.$(OBJEXT) \
+ signal.$(OBJEXT) \
+ sjis.$(OBJEXT) \
+ sprintf.$(OBJEXT) \
+ st.$(OBJEXT) \
+ string.$(OBJEXT) \
+ struct.$(OBJEXT) \
+ time.$(OBJEXT) \
+ utf8.$(OBJEXT) \
+ util.$(OBJEXT) \
+ variable.$(OBJEXT) \
+ version.$(OBJEXT) \
+ $(MISSING)
+
+SCRIPT_ARGS = --dest-dir="$(DESTDIR)" \
+ --make="$(MAKE)" \
+ --mflags="$(MFLAGS)" \
+ --make-flags="$(MAKEFLAGS)"
+EXTMK_ARGS = $(SCRIPT_ARGS) --extout="$(EXTOUT)" --extension $(EXTS) --extstatic $(EXTSTATIC) --
+
+all: $(MKFILES) $(PREP) $(RBCONFIG) $(LIBRUBY)
+ @$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS)
+prog: $(PROGRAM) $(WPROGRAM)
+
+miniruby$(EXEEXT): config.status $(LIBRUBY_A) $(MAINOBJ) $(OBJS) $(DMYEXT)
+
+$(PROGRAM): $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(SETUP) $(PREP)
+
+$(LIBRUBY_A): $(OBJS) $(DMYEXT)
+
+$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) $(LIBRUBY_A) $(PREP) $(ARCHFILE)
+
+static-ruby: $(MAINOBJ) $(EXTOBJS) $(LIBRUBY_A)
+ @$(RM) $@
+ $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINLIBS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBY_A) $(LIBS) $(OUTFLAG)$@
+
+ruby.imp: $(LIBRUBY_A)
+ @$(NM) -Pgp $(LIBRUBY_A) | awk 'BEGIN{print "#!"}; $$2~/^[BD]$$/{print $$1}' | sort -u -o $@
+
+install: install-nodoc $(RDOCTARGET)
+install-all: install-nodoc install-doc
+
+install-nodoc: install-local install-ext
+install-local: pre-install-local do-install-local post-install-local
+install-ext: pre-install-ext do-install-ext post-install-ext
+
+do-install-local: $(RBCONFIG)
+ $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
+do-install-ext: $(RBCONFIG)
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) install
+
+install-bin: $(RBCONFIG)
+ $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=bin
+install-lib: $(RBCONFIG)
+ $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=lib
+install-man: $(RBCONFIG)
+ $(MINIRUBY) $(srcdir)/instruby.rb $(SCRIPT_ARGS) --install=man --mantype="$(MANTYPE)"
+
+what-where-all no-install-all: no-install no-install-doc
+what-where no-install: no-install-local no-install-ext
+what-where-local: no-install-local
+no-install-local: $(RBCONFIG)
+ $(MINIRUBY) $(srcdir)/instruby.rb -n $(SCRIPT_ARGS) --mantype="$(MANTYPE)"
+what-where-ext: no-install-ext
+no-install-ext: $(RBCONFIG)
+ $(MINIRUBY) $(srcdir)/ext/extmk.rb -n $(EXTMK_ARGS) install
+
+install-doc: pre-install-doc do-install-doc post-install-doc
+do-install-doc: $(PROGRAM)
+ @echo Generating RDoc documentation
+ $(RUNRUBY) "$(srcdir)/bin/rdoc" --all --ri --op "$(RIDATADIR)" "$(srcdir)"
+
+pre-install: pre-install-local pre-install-ext
+pre-install-local:: PHONY
+pre-install-ext:: PHONY
+pre-install-doc:: PHONY
+
+post-install: post-install-local post-install-ext
+post-install-local:: PHONY
+post-install-ext:: PHONY
+post-install-doc:: PHONY
+
+clean: clean-ext clean-local
+clean-local::
+ @$(RM) $(OBJS) $(MAINOBJ) $(WINMAINOBJ) $(LIBRUBY_A) $(LIBRUBY_SO) $(LIBRUBY) $(LIBRUBY_ALIASES)
+ @$(RM) $(PROGRAM) $(WPROGRAM) miniruby$(EXEEXT) dmyext.$(OBJEXT) $(PREP) $(ARCHFILE)
+clean-ext:
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) clean
+
+distclean: distclean-ext distclean-local
+distclean-local:: clean-local
+ @$(RM) $(MKFILES) config.h rbconfig.rb
+ @$(RM) config.cache config.log config.status
+ @$(RM) *~ *.bak *.stackdump core *.core gmon.out y.tab.c y.output ruby.imp
+distclean-ext:
+ @-$(MINIRUBY) $(srcdir)/ext/extmk.rb $(EXTMK_ARGS) distclean
+
+realclean:: distclean
+ @$(RM) parse.c lex.c
+
+test: miniruby$(EXEEXT) $(RBCONFIG) $(PROGRAM) PHONY
+ @$(MINIRUBY) $(srcdir)/rubytest.rb
+
+test-all:
+ $(RUNRUBY) -C "$(srcdir)/test" runner.rb --runner=$(TESTUI) $(TESTS)
+
+extconf:
+ $(MINIRUBY) -I$(srcdir)/lib -run -e mkdir -- -p "$(EXTCONFDIR)"
+ $(RUNRUBY) -C "$(EXTCONFDIR)" $(EXTCONF) $(EXTCONFARGS)
+
+$(RBCONFIG): $(srcdir)/mkconfig.rb config.status $(PREP)
+ @$(MINIRUBY) $(srcdir)/mkconfig.rb -timestamp=$@ \
+ -install_name=$(RUBY_INSTALL_NAME) \
+ -so_name=$(RUBY_SO_NAME) rbconfig.rb
+
+.PRECIOUS: $(MKFILES)
+
+.PHONY: test install install-nodoc install-doc
+
+PHONY:
+
+{$(VPATH)}parse.c: parse.y
+
+acosh.$(OBJEXT): {$(VPATH)}acosh.c
+alloca.$(OBJEXT): {$(VPATH)}alloca.c
+crypt.$(OBJEXT): {$(VPATH)}crypt.c
+dup2.$(OBJEXT): {$(VPATH)}dup2.c
+erf.$(OBJEXT): {$(VPATH)}erf.c
+finite.$(OBJEXT): {$(VPATH)}finite.c
+flock.$(OBJEXT): {$(VPATH)}flock.c
+memcmp.$(OBJEXT): {$(VPATH)}memcmp.c
+memmove.$(OBJEXT): {$(VPATH)}memmove.c
+mkdir.$(OBJEXT): {$(VPATH)}mkdir.c
+vsnprintf.$(OBJEXT): {$(VPATH)}vsnprintf.c
+strcasecmp.$(OBJEXT): {$(VPATH)}strcasecmp.c
+strncasecmp.$(OBJEXT): {$(VPATH)}strncasecmp.c
+strchr.$(OBJEXT): {$(VPATH)}strchr.c
+strdup.$(OBJEXT): {$(VPATH)}strdup.c
+strerror.$(OBJEXT): {$(VPATH)}strerror.c
+strftime.$(OBJEXT): {$(VPATH)}strftime.c
+strstr.$(OBJEXT): {$(VPATH)}strstr.c
+strtod.$(OBJEXT): {$(VPATH)}strtod.c
+strtol.$(OBJEXT): {$(VPATH)}strtol.c
+strtoul.$(OBJEXT): {$(VPATH)}strtoul.c
+nt.$(OBJEXT): {$(VPATH)}nt.c
+x68.$(OBJEXT): {$(VPATH)}x68.c
+os2.$(OBJEXT): {$(VPATH)}os2.c
+dl_os2.$(OBJEXT): {$(VPATH)}dl_os2.c
+
+# when I use -I., there is confliction at "OpenFile"
+# so, set . into environment varible "include"
+win32.$(OBJEXT): {$(VPATH)}win32.c
+
+###
+
+array.$(OBJEXT): {$(VPATH)}array.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}util.h {$(VPATH)}st.h
+ascii.$(OBJEXT): {$(VPATH)}ascii.c {$(VPATH)}regenc.h \
+ {$(VPATH)}oniguruma.h config.h
+bignum.$(OBJEXT): {$(VPATH)}bignum.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+class.$(OBJEXT): {$(VPATH)}class.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}rubysig.h {$(VPATH)}node.h {$(VPATH)}st.h
+compar.$(OBJEXT): {$(VPATH)}compar.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+dir.$(OBJEXT): {$(VPATH)}dir.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}util.h
+dln.$(OBJEXT): {$(VPATH)}dln.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}dln.h
+dmyext.$(OBJEXT): {$(VPATH)}dmyext.c
+enum.$(OBJEXT): {$(VPATH)}enum.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}node.h {$(VPATH)}util.h
+error.$(OBJEXT): {$(VPATH)}error.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}env.h {$(VPATH)}st.h
+euc_jp.$(OBJEXT): {$(VPATH)}euc_jp.c {$(VPATH)}regenc.h \
+ {$(VPATH)}oniguruma.h
+eval.$(OBJEXT): {$(VPATH)}eval.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}node.h {$(VPATH)}env.h {$(VPATH)}util.h \
+ {$(VPATH)}rubysig.h {$(VPATH)}st.h {$(VPATH)}dln.h
+file.$(OBJEXT): {$(VPATH)}file.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}rubyio.h {$(VPATH)}rubysig.h {$(VPATH)}util.h \
+ {$(VPATH)}dln.h
+gc.$(OBJEXT): {$(VPATH)}gc.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}rubysig.h {$(VPATH)}st.h {$(VPATH)}node.h \
+ {$(VPATH)}env.h {$(VPATH)}re.h {$(VPATH)}regex.h
+hash.$(OBJEXT): {$(VPATH)}hash.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}st.h {$(VPATH)}util.h {$(VPATH)}rubysig.h
+inits.$(OBJEXT): {$(VPATH)}inits.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+io.$(OBJEXT): {$(VPATH)}io.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}rubyio.h {$(VPATH)}rubysig.h {$(VPATH)}util.h
+main.$(OBJEXT): {$(VPATH)}main.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+marshal.$(OBJEXT): {$(VPATH)}marshal.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}rubyio.h {$(VPATH)}st.h {$(VPATH)}util.h
+math.$(OBJEXT): {$(VPATH)}math.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+numeric.$(OBJEXT): {$(VPATH)}numeric.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}env.h {$(VPATH)}defines.h {$(VPATH)}intern.h \
+ {$(VPATH)}missing.h
+object.$(OBJEXT): {$(VPATH)}object.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}st.h {$(VPATH)}util.h
+pack.$(OBJEXT): {$(VPATH)}pack.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+parse.$(OBJEXT): {$(VPATH)}parse.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}env.h {$(VPATH)}node.h {$(VPATH)}st.h \
+ {$(VPATH)}regex.h {$(VPATH)}util.h {$(VPATH)}lex.c
+prec.$(OBJEXT): {$(VPATH)}prec.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+process.$(OBJEXT): {$(VPATH)}process.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}rubysig.h {$(VPATH)}st.h
+random.$(OBJEXT): {$(VPATH)}random.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+range.$(OBJEXT): {$(VPATH)}range.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+re.$(OBJEXT): {$(VPATH)}re.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}re.h {$(VPATH)}regex.h
+regcomp.$(OBJEXT): {$(VPATH)}regcomp.c {$(VPATH)}oniguruma.h \
+ {$(VPATH)}regint.h {$(VPATH)}regparse.h {$(VPATH)}regenc.h config.h
+regenc.$(OBJEXT): {$(VPATH)}regenc.c {$(VPATH)}regint.h \
+ {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h config.h
+regerror.$(OBJEXT): {$(VPATH)}regerror.c {$(VPATH)}regint.h \
+ {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h config.h
+regexec.$(OBJEXT): {$(VPATH)}regexec.c {$(VPATH)}regint.h \
+ {$(VPATH)}regenc.h {$(VPATH)}oniguruma.h config.h
+regparse.$(OBJEXT): {$(VPATH)}regparse.c {$(VPATH)}oniguruma.h \
+ {$(VPATH)}regint.h {$(VPATH)}regparse.h {$(VPATH)}regenc.h config.h
+ruby.$(OBJEXT): {$(VPATH)}ruby.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}dln.h {$(VPATH)}node.h {$(VPATH)}util.h
+signal.$(OBJEXT): {$(VPATH)}signal.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}rubysig.h
+sjis.$(OBJEXT): {$(VPATH)}sjis.c {$(VPATH)}regenc.h \
+ {$(VPATH)}oniguruma.h config.h
+sprintf.$(OBJEXT): {$(VPATH)}sprintf.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+st.$(OBJEXT): {$(VPATH)}st.c config.h {$(VPATH)}st.h
+string.$(OBJEXT): {$(VPATH)}string.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}re.h {$(VPATH)}regex.h
+struct.$(OBJEXT): {$(VPATH)}struct.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+time.$(OBJEXT): {$(VPATH)}time.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h
+utf8.$(OBJEXT): {$(VPATH)}utf8.c {$(VPATH)}regenc.h \
+ {$(VPATH)}oniguruma.h config.h
+util.$(OBJEXT): {$(VPATH)}util.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}util.h
+variable.$(OBJEXT): {$(VPATH)}variable.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}env.h {$(VPATH)}node.h {$(VPATH)}st.h {$(VPATH)}util.h
+version.$(OBJEXT): {$(VPATH)}version.c {$(VPATH)}ruby.h config.h \
+ {$(VPATH)}defines.h {$(VPATH)}intern.h {$(VPATH)}missing.h \
+ {$(VPATH)}version.h
diff --git a/misc/ruby-electric.el b/misc/ruby-electric.el
new file mode 100644
index 0000000000..c361089938
--- /dev/null
+++ b/misc/ruby-electric.el
@@ -0,0 +1,200 @@
+;; -*-Emacs-Lisp-*-
+;;
+;; ruby-electric.el --- electric editing commands for ruby files
+;;
+;; Copyright (C) 2005 by Dee Zsombor <dee dot zsombor at gmail dot com>.
+;; Released under same license terms as Ruby.
+;;
+;; Due credit: this work was inspired by a code snippet posted by
+;; Frederick Ros at http://rubygarden.org/ruby?EmacsExtensions.
+;;
+;; Following improvements where added:
+;;
+;; - handling of strings of type 'here document'
+;; - more keywords, with special handling for 'do'
+;; - packaged into a minor mode
+;;
+;; Usage:
+;;
+;; 0) copy ruby-electric.el into directory where emacs can find it.
+;;
+;; 1) modify your startup file (.emacs or whatever) by adding
+;; following line:
+;;
+;; (require 'ruby-electric)
+;;
+;; note that you need to have font lock enabled beforehand.
+;;
+;; 2) toggle Ruby Electric Mode on/off with ruby-electric-mode.
+;;
+;; Changelog:
+;;
+;; 2005/Jan/14: inserts matching pair delimiters like {, [, (, ', ",
+;; ' and | .
+;;
+;; 2005/Jan/14: added basic Custom support for configuring keywords
+;; with electric closing.
+;;
+;; 2005/Jan/18: more Custom support for configuring characters for
+;; which matching expansion should occur.
+;;
+;; 2005/Jan/18: no longer uses 'looking-back' or regexp character
+;; classes like [:space:] since they are not implemented on XEmacs.
+;;
+;; 2005/Feb/01: explicitly provide default argument of 1 to
+;; 'backward-word' as it requires it on Emacs 21.3
+;;
+;; 2005/Mar/06: now stored inside ruby CVS; customize pages now have
+;; ruby as parent; cosmetic fixes.
+
+
+(require 'ruby-mode)
+
+(defgroup ruby-electric nil
+ "Minor mode providing electric editing commands for ruby files"
+ :group 'ruby)
+
+(defconst ruby-electric-expandable-do-re
+ "do\\s-$")
+
+(defconst ruby-electric-expandable-bar
+ "\\s-\\(do\\|{\\)\\s-+|")
+
+(defvar ruby-electric-matching-delimeter-alist
+ '((?\[ . ?\])
+ (?\( . ?\))
+ (?\' . ?\')
+ (?\` . ?\`)
+ (?\" . ?\")))
+
+(defcustom ruby-electric-simple-keywords-re
+ "\\(def\\|if\\|class\\|module\\|unless\\|case\\|while\\|do\\|until\\|for\\|begin\\)"
+ "*Regular expresion matching keywords for which closing 'end'
+is to be inserted."
+ :type 'regexp :group 'ruby-electric)
+
+(defcustom ruby-electric-expand-delimiters-list '(all)
+ "*List of contexts where matching delimiter should be
+inserted. The word 'all' will do all insertions."
+ :type '(set :extra-offset 8
+ (const :tag "Everything" all )
+ (const :tag "Curly brace" ?\{ )
+ (const :tag "Square brace" ?\[ )
+ (const :tag "Round brace" ?\( )
+ (const :tag "Quote" ?\' )
+ (const :tag "Double quote" ?\" )
+ (const :tag "Back quote" ?\` )
+ (const :tag "Vertical bar" ?\| ))
+ :group 'ruby-electric)
+
+(defcustom ruby-electric-newline-before-closing-bracket nil
+ "*Controls whether a newline should be inserted before the
+closing bracket or not."
+ :type 'boolean :group 'ruby-electric)
+
+(define-minor-mode ruby-electric-mode
+ "Toggle Ruby Electric minor mode.
+With no argument, this command toggles the mode. Non-null prefix
+argument turns on the mode. Null prefix argument turns off the
+mode.
+
+When Ruby Electric mode is enabled, an indented 'end' is
+heuristicaly inserted whenever typing a word like 'module',
+'class', 'def', 'if', 'unless', 'case', 'until', 'for', 'begin',
+'do'. Simple, double and back quotes as well as braces are paired
+auto-magically. Expansion does not occur inside comments and
+strings. Note that you must have Font Lock enabled."
+ ;; initial value.
+ nil
+ ;;indicator for the mode line.
+ " REl"
+ ;;keymap
+ ruby-mode-map
+ (ruby-electric-setup-keymap))
+
+(defun ruby-electric-setup-keymap()
+ (define-key ruby-mode-map " " 'ruby-electric-space)
+ (define-key ruby-mode-map "{" 'ruby-electric-curlies)
+ (define-key ruby-mode-map "(" 'ruby-electric-matching-char)
+ (define-key ruby-mode-map "[" 'ruby-electric-matching-char)
+ (define-key ruby-mode-map "\"" 'ruby-electric-matching-char)
+ (define-key ruby-mode-map "\'" 'ruby-electric-matching-char)
+ (define-key ruby-mode-map "|" 'ruby-electric-bar))
+
+(defun ruby-electric-space (arg)
+ (interactive "P")
+ (self-insert-command (prefix-numeric-value arg))
+ (if (ruby-electric-space-can-be-expanded-p)
+ (save-excursion
+ (ruby-indent-line t)
+ (newline)
+ (ruby-insert-end))))
+
+(defun ruby-electric-code-at-point-p()
+ (and ruby-electric-mode
+ (let* ((properties (text-properties-at (point))))
+ (and (null (memq 'font-lock-string-face properties))
+ (null (memq 'font-lock-comment-face properties))))))
+
+(defun ruby-electric-string-at-point-p()
+ (and ruby-electric-mode
+ (consp (memq 'font-lock-string-face (text-properties-at (point))))))
+
+(defun ruby-electric-is-last-command-char-expandable-punct-p()
+ (or (memq 'all ruby-electric-expand-delimiters-list)
+ (memq last-command-char ruby-electric-expand-delimiters-list)))
+
+(defun ruby-electric-space-can-be-expanded-p()
+ (if (ruby-electric-code-at-point-p)
+ (let* ((ruby-electric-keywords-re
+ (concat ruby-electric-simple-keywords-re "\\s-$"))
+ (ruby-electric-single-keyword-in-line-re
+ (concat "\\s-*" ruby-electric-keywords-re)))
+ (save-excursion
+ (backward-word 1)
+ (or (looking-at ruby-electric-expandable-do-re)
+ (and (looking-at ruby-electric-keywords-re)
+ (not (string= "do" (match-string 1)))
+ (progn
+ (beginning-of-line)
+ (looking-at ruby-electric-single-keyword-in-line-re))))))))
+
+
+(defun ruby-electric-curlies(arg)
+ (interactive "P")
+ (self-insert-command (prefix-numeric-value arg))
+ (if (ruby-electric-is-last-command-char-expandable-punct-p)
+ (cond ((ruby-electric-code-at-point-p)
+ (insert " ")
+ (save-excursion
+ (if ruby-electric-newline-before-closing-bracket
+ (newline))
+ (insert "}")))
+ ((ruby-electric-string-at-point-p)
+ (save-excursion
+ (backward-char 1)
+ (when (char-equal ?\# (preceding-char))
+ (forward-char 1)
+ (insert "}")))))))
+
+(defun ruby-electric-matching-char(arg)
+ (interactive "P")
+ (self-insert-command (prefix-numeric-value arg))
+ (and (ruby-electric-is-last-command-char-expandable-punct-p)
+ (ruby-electric-code-at-point-p)
+ (save-excursion
+ (insert (cdr (assoc last-command-char
+ ruby-electric-matching-delimeter-alist))))))
+
+(defun ruby-electric-bar(arg)
+ (interactive "P")
+ (self-insert-command (prefix-numeric-value arg))
+ (and (ruby-electric-is-last-command-char-expandable-punct-p)
+ (ruby-electric-code-at-point-p)
+ (and (save-excursion (re-search-backward ruby-electric-expandable-bar nil t))
+ (= (point) (match-end 0))) ;looking-back is missing on XEmacs
+ (save-excursion
+ (insert "|"))))
+
+
+(provide 'ruby-electric)
diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb
new file mode 100644
index 0000000000..7dd658b825
--- /dev/null
+++ b/test/openssl/test_pair.rb
@@ -0,0 +1,332 @@
+begin
+ require "openssl"
+rescue LoadError
+end
+require 'test/unit'
+
+if defined?(OpenSSL)
+
+require 'socket'
+dir = File.expand_path(__FILE__)
+2.times {dir = File.dirname(dir)}
+$:.replace([File.join(dir, "ruby")] | $:)
+require 'ut_eof'
+
+module SSLPair
+ def server
+ host = "127.0.0.1"
+ port = 0
+ key = OpenSSL::PKey::RSA.new(512)
+ cert = OpenSSL::X509::Certificate.new
+ cert.version = 2
+ cert.serial = 0
+ name = OpenSSL::X509::Name.new([["C","JP"],["O","TEST"],["CN","localhost"]])
+ cert.subject = name
+ cert.issuer = name
+ cert.not_before = Time.now
+ cert.not_after = Time.now + 3600
+ cert.public_key = key.public_key
+ ef = OpenSSL::X509::ExtensionFactory.new(nil,cert)
+ cert.extensions = [
+ ef.create_extension("basicConstraints","CA:FALSE"),
+ ef.create_extension("subjectKeyIdentifier","hash"),
+ ef.create_extension("extendedKeyUsage","serverAuth"),
+ ef.create_extension("keyUsage",
+ "keyEncipherment,dataEncipherment,digitalSignature")
+ ]
+ ef.issuer_certificate = cert
+ cert.add_extension ef.create_extension("authorityKeyIdentifier",
+ "keyid:always,issuer:always")
+ cert.sign(key, OpenSSL::Digest::SHA1.new)
+ ctx = OpenSSL::SSL::SSLContext.new()
+ ctx.key = key
+ ctx.cert = cert
+ tcps = TCPServer.new(host, port)
+ ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
+ return ssls
+ end
+
+ def client(port)
+ host = "127.0.0.1"
+ ctx = OpenSSL::SSL::SSLContext.new()
+ s = TCPSocket.new(host, port)
+ ssl = OpenSSL::SSL::SSLSocket.new(s, ctx)
+ ssl.connect
+ ssl.sync_close = true
+ ssl
+ end
+
+ def ssl_pair
+ ssls = server
+ th = Thread.new {
+ ns = ssls.accept
+ ssls.close
+ ns
+ }
+ port = ssls.to_io.addr[1]
+ c = client(port)
+ s = th.value
+ if block_given?
+ begin
+ yield c, s
+ ensure
+ c.close unless c.closed?
+ s.close unless s.closed?
+ end
+ else
+ return c, s
+ end
+ end
+end
+
+class OpenSSL::TestEOF1 < Test::Unit::TestCase
+ include TestEOF
+ include SSLPair
+
+ def open_file(content)
+ s1, s2 = ssl_pair
+ Thread.new { s2 << content; s2.close }
+ yield s1
+ end
+end
+
+class OpenSSL::TestEOF2 < Test::Unit::TestCase
+ include TestEOF
+ include SSLPair
+
+ def open_file(content)
+ s1, s2 = ssl_pair
+ Thread.new { s1 << content; s1.close }
+ yield s2
+ end
+end
+
+class OpenSSL::TestPair < Test::Unit::TestCase
+ include SSLPair
+
+ def test_getc
+ ssl_pair {|s1, s2|
+ s1 << "a"
+ assert_equal(?a, s2.getc)
+ }
+ end
+
+ def test_readpartial
+ ssl_pair {|s1, s2|
+ s2.write "a\nbcd"
+ assert_equal("a\n", s1.gets)
+ assert_equal("bcd", s1.readpartial(10))
+ s2.write "efg"
+ assert_equal("efg", s1.readpartial(10))
+ s2.close
+ assert_raise(EOFError) { s1.readpartial(10) }
+ assert_raise(EOFError) { s1.readpartial(10) }
+ assert_equal("", s1.readpartial(0))
+ }
+ end
+
+ def test_readall
+ ssl_pair {|s1, s2|
+ s2.close
+ assert_equal("", s1.read)
+ }
+ end
+
+ def test_readline
+ ssl_pair {|s1, s2|
+ s2.close
+ assert_raise(EOFError) { s1.readline }
+ }
+ end
+
+ def test_puts_meta
+ ssl_pair {|s1, s2|
+ begin
+ old = $/
+ $/ = '*'
+ s1.puts 'a'
+ ensure
+ $/ = old
+ end
+ s1.close
+ assert_equal("a\n", s2.read)
+ }
+ end
+
+ def test_puts_empty
+ ssl_pair {|s1, s2|
+ s1.puts
+ s1.close
+ assert_equal("\n", s2.read)
+ }
+ end
+
+end
+
+end
+begin
+ require "openssl"
+rescue LoadError
+end
+require 'test/unit'
+
+if defined?(OpenSSL)
+
+require 'socket'
+dir = File.expand_path(__FILE__)
+2.times {dir = File.dirname(dir)}
+$:.replace([File.join(dir, "ruby")] | $:)
+require 'ut_eof'
+
+module SSLPair
+ def server
+ host = "127.0.0.1"
+ port = 0
+ key = OpenSSL::PKey::RSA.new(512)
+ cert = OpenSSL::X509::Certificate.new
+ cert.version = 2
+ cert.serial = 0
+ name = OpenSSL::X509::Name.new([["C","JP"],["O","TEST"],["CN","localhost"]])
+ cert.subject = name
+ cert.issuer = name
+ cert.not_before = Time.now
+ cert.not_after = Time.now + 3600
+ cert.public_key = key.public_key
+ ef = OpenSSL::X509::ExtensionFactory.new(nil,cert)
+ cert.extensions = [
+ ef.create_extension("basicConstraints","CA:FALSE"),
+ ef.create_extension("subjectKeyIdentifier","hash"),
+ ef.create_extension("extendedKeyUsage","serverAuth"),
+ ef.create_extension("keyUsage",
+ "keyEncipherment,dataEncipherment,digitalSignature")
+ ]
+ ef.issuer_certificate = cert
+ cert.add_extension ef.create_extension("authorityKeyIdentifier",
+ "keyid:always,issuer:always")
+ cert.sign(key, OpenSSL::Digest::SHA1.new)
+ ctx = OpenSSL::SSL::SSLContext.new()
+ ctx.key = key
+ ctx.cert = cert
+ tcps = TCPServer.new(host, port)
+ ssls = OpenSSL::SSL::SSLServer.new(tcps, ctx)
+ return ssls
+ end
+
+ def client(port)
+ host = "127.0.0.1"
+ ctx = OpenSSL::SSL::SSLContext.new()
+ s = TCPSocket.new(host, port)
+ ssl = OpenSSL::SSL::SSLSocket.new(s, ctx)
+ ssl.connect
+ ssl.sync_close = true
+ ssl
+ end
+
+ def ssl_pair
+ ssls = server
+ th = Thread.new {
+ ns = ssls.accept
+ ssls.close
+ ns
+ }
+ port = ssls.to_io.addr[1]
+ c = client(port)
+ s = th.value
+ if block_given?
+ begin
+ yield c, s
+ ensure
+ c.close unless c.closed?
+ s.close unless s.closed?
+ end
+ else
+ return c, s
+ end
+ end
+end
+
+class OpenSSL::TestEOF1 < Test::Unit::TestCase
+ include TestEOF
+ include SSLPair
+
+ def open_file(content)
+ s1, s2 = ssl_pair
+ Thread.new { s2 << content; s2.close }
+ yield s1
+ end
+end
+
+class OpenSSL::TestEOF2 < Test::Unit::TestCase
+ include TestEOF
+ include SSLPair
+
+ def open_file(content)
+ s1, s2 = ssl_pair
+ Thread.new { s1 << content; s1.close }
+ yield s2
+ end
+end
+
+class OpenSSL::TestPair < Test::Unit::TestCase
+ include SSLPair
+
+ def test_getc
+ ssl_pair {|s1, s2|
+ s1 << "a"
+ assert_equal(?a, s2.getc)
+ }
+ end
+
+ def test_readpartial
+ ssl_pair {|s1, s2|
+ s2.write "a\nbcd"
+ assert_equal("a\n", s1.gets)
+ assert_equal("bcd", s1.readpartial(10))
+ s2.write "efg"
+ assert_equal("efg", s1.readpartial(10))
+ s2.close
+ assert_raise(EOFError) { s1.readpartial(10) }
+ assert_raise(EOFError) { s1.readpartial(10) }
+ assert_equal("", s1.readpartial(0))
+ }
+ end
+
+ def test_readall
+ ssl_pair {|s1, s2|
+ s2.close
+ assert_equal("", s1.read)
+ }
+ end
+
+ def test_readline
+ ssl_pair {|s1, s2|
+ s2.close
+ assert_raise(EOFError) { s1.readline }
+ }
+ end
+
+ def test_puts_meta
+ ssl_pair {|s1, s2|
+ begin
+ old = $/
+ $/ = '*'
+ s1.puts 'a'
+ ensure
+ $/ = old
+ end
+ s1.close
+ assert_equal("a\n", s2.read)
+ }
+ end
+
+ def test_puts_empty
+ ssl_pair {|s1, s2|
+ s1.puts
+ s1.close
+ assert_equal("\n", s2.read)
+ }
+ end
+
+end
+
+end
diff --git a/win32/ifchange.bat b/win32/ifchange.bat
new file mode 100755
index 0000000000..61a80c841b
--- /dev/null
+++ b/win32/ifchange.bat
@@ -0,0 +1,30 @@
+@echo off
+:: usage: ifchange target temporary
+
+:: check if fc.exe works.
+echo foo > conftest1.tmp
+echo bar > conftest2.tmp
+fc.exe conftest1.tmp conftest2.tmp > nul
+if not errorlevel 1 goto :brokenfc
+
+:: target does not exist or new file differs from it.
+if not exist %1 goto :update
+fc.exe %1 %2 > nul
+if errorlevel 1 goto :update
+
+:unchange
+echo %1 unchanged.
+del %2
+goto :end
+
+:brokenfc
+del conftest1.tmp > nul
+del conftest2.tmp > nul
+echo FC.EXE does not work properly.
+echo assuming %1 should be changed.
+
+:update
+echo %1 updated.
+if exist %1 del %1
+copy %2 %1 > nul
+:end