summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
Diffstat (limited to 'sample')
-rw-r--r--sample/Artistic117
-rw-r--r--sample/MANIFEST3
-rw-r--r--sample/attr.rb2
-rw-r--r--sample/cbreak.rb24
-rw-r--r--sample/const.rb16
-rw-r--r--sample/evaldef.rb4
-rw-r--r--sample/export.rb2
-rw-r--r--sample/getopts.rb16
-rwxr-xr-xsample/getopts.test2
-rwxr-xr-xsample/less.rb2
-rw-r--r--sample/opt_x.rb10
-rw-r--r--sample/opt_x.test10
-rw-r--r--sample/ruby-mode.el16
-rw-r--r--sample/svr.rb2
-rw-r--r--sample/tt.rb2
15 files changed, 61 insertions, 167 deletions
diff --git a/sample/Artistic b/sample/Artistic
index fbf7989..e69de29 100644
--- a/sample/Artistic
+++ b/sample/Artistic
@@ -1,117 +0,0 @@
-
-
-
-
- The "Artistic License"
-
- Preamble
-
-The intent of this document is to state the conditions under which a
-Package may be copied, such that the Copyright Holder maintains some
-semblance of artistic control over the development of the package,
-while giving the users of the package the right to use and distribute
-the Package in a more-or-less customary fashion, plus the right to make
-reasonable modifications.
-
-Definitions:
-
- "Package" refers to the collection of files distributed by the
- Copyright Holder, and derivatives of that collection of files
- created through textual modification.
-
- "Standard Version" refers to such a Package if it has not been
- modified, or has been modified in accordance with the wishes
- of the Copyright Holder.
-
- "Copyright Holder" is whoever is named in the copyright or
- copyrights for the package.
-
- "You" is you, if you're thinking about copying or distributing
- this Package.
-
- "Reasonable copying fee" is whatever you can justify on the
- basis of media cost, duplication charges, time of people involved,
- and so on. (You will not be required to justify it to the
- Copyright Holder, but only to the computing community at large
- as a market that must bear the fee.)
-
- "Freely Available" means that no fee is charged for the item
- itself, though there may be fees involved in handling the item.
- It also means that recipients of the item may redistribute it
- under the same conditions they received it.
-
-1. You may make and give away verbatim copies of the source form of the
-Standard Version of this Package without restriction, provided that you
-duplicate all of the original copyright notices and associated disclaimers.
-
-2. You may apply bug fixes, portability fixes and other modifications
-derived from the Public Domain or from the Copyright Holder. A Package
-modified in such a way shall still be considered the Standard Version.
-
-3. You may otherwise modify your copy of this Package in any way, provided
-that you insert a prominent notice in each changed file stating how and
-when you changed that file, and provided that you do at least ONE of the
-following:
-
- a) place your modifications in the Public Domain or otherwise make them
- Freely Available, such as by posting said modifications to Usenet or
- an equivalent medium, or placing the modifications on a major archive
- site such as uunet.uu.net, or by allowing the Copyright Holder to include
- your modifications in the Standard Version of the Package.
-
- b) use the modified Package only within your corporation or organization.
-
- c) rename any non-standard executables so the names do not conflict
- with standard executables, which must also be provided, and provide
- a separate manual page for each non-standard executable that clearly
- documents how it differs from the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-4. You may distribute the programs of this Package in object code or
-executable form, provided that you do at least ONE of the following:
-
- a) distribute a Standard Version of the executables and library files,
- together with instructions (in the manual page or equivalent) on where
- to get the Standard Version.
-
- b) accompany the distribution with the machine-readable source of
- the Package with your modifications.
-
- c) accompany any non-standard executables with their corresponding
- Standard Version executables, giving the non-standard executables
- non-standard names, and clearly documenting the differences in manual
- pages (or equivalent), together with instructions on where to get
- the Standard Version.
-
- d) make other distribution arrangements with the Copyright Holder.
-
-5. You may charge a reasonable copying fee for any distribution of this
-Package. You may charge any fee you choose for support of this Package.
-You may not charge a fee for this Package itself. However,
-you may distribute this Package in aggregate with other (possibly
-commercial) programs as part of a larger (possibly commercial) software
-distribution provided that you do not advertise this Package as a
-product of your own.
-
-6. The scripts and library files supplied as input to or produced as
-output from the programs of this Package do not automatically fall
-under the copyright of this Package, but belong to whomever generated
-them, and may be sold commercially, and may be aggregated with this
-Package.
-
-7. C subroutines supplied by you and linked into this Package in order
-to emulate subroutines and variables of the language defined by this
-Package shall not be considered part of this Package, but are the
-equivalent of input as in Paragraph 6, provided these subroutines do
-not change the language in any way that would cause it to fail the
-regression tests for the language.
-
-8. The name of the Copyright Holder may not be used to endorse or promote
-products derived from this software without specific prior written permission.
-
-9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
-
- The End
diff --git a/sample/MANIFEST b/sample/MANIFEST
index c54adf3..c91c078 100644
--- a/sample/MANIFEST
+++ b/sample/MANIFEST
@@ -1,5 +1,4 @@
MANIFEST
-Artistic
aset.rb
attr.rb
biorhythm.rb
@@ -39,7 +38,7 @@ occur.pl
occur.rb
occur2.rb
opt_s.rb
-opt_x.rb
+opt_x.test
parsearg.rb
rcs.awk
rcs.dat
diff --git a/sample/attr.rb b/sample/attr.rb
index 8326529..1d329ea 100644
--- a/sample/attr.rb
+++ b/sample/attr.rb
@@ -4,7 +4,7 @@
# #<Foo: @test=10>
class Foo
- attr "test", %TRUE
+ attr "test", TRUE
end
foo = Foo.new
diff --git a/sample/cbreak.rb b/sample/cbreak.rb
index 6d3d551..5d2d849 100644
--- a/sample/cbreak.rb
+++ b/sample/cbreak.rb
@@ -1,31 +1,31 @@
# ioctl example works on Sun
-%CBREAK = 0x00000002
-%ECHO = 0x00000008
-%TIOCGETP = 0x40067408
-%TIOCSETP = 0x80067409
+CBREAK = 0x00000002
+ECHO = 0x00000008
+TIOCGETP = 0x40067408
+TIOCSETP = 0x80067409
def cbreak ()
- set_cbreak(%TRUE)
+ set_cbreak(TRUE)
end
def cooked ()
- set_cbreak(%FALSE)
+ set_cbreak(FALSE)
end
def set_cbreak (on)
tty = "\0" * 256
- $stdin.ioctl(%TIOCGETP, tty)
+ $stdin.ioctl(TIOCGETP, tty)
ttys = tty.unpack("C4 S")
if on
- ttys[4] |= %CBREAK
- ttys[4] &= ~%ECHO
+ ttys[4] |= CBREAK
+ ttys[4] &= ~ECHO
else
- ttys[4] &= ~%CBREAK
- ttys[4] |= %ECHO
+ ttys[4] &= ~CBREAK
+ ttys[4] |= ECHO
end
tty = ttys.pack("C4 S")
- $stdin.ioctl(%TIOCSETP, tty)
+ $stdin.ioctl(TIOCSETP, tty)
end
cbreak();
diff --git a/sample/const.rb b/sample/const.rb
index 783965c..5078040 100644
--- a/sample/const.rb
+++ b/sample/const.rb
@@ -2,23 +2,23 @@
# output:
# 1234
# 1268
-%test1 = 1
-%test2 = 2
+TEST1 = 1
+TEST2 = 2
module Const
- %test3 = 3
- %test4 = 4
+ TEST3 = 3
+ TEST4 = 4
end
module Const2
- %test3 = 6
- %test4 = 8
+ TEST3 = 6
+ TEST4 = 8
end
include Const
-print(%test1,%test2,%test3,%test4,"\n")
+print(TEST1,TEST2,TEST3,TEST4,"\n")
include Const2
-print(%test1,%test2,%test3,%test4,"\n")
+print(TEST1,TEST2,TEST3,TEST4,"\n")
diff --git a/sample/evaldef.rb b/sample/evaldef.rb
index 1d77a3c..a705300 100644
--- a/sample/evaldef.rb
+++ b/sample/evaldef.rb
@@ -3,7 +3,7 @@
# bar
# (eval):26: method `baz' not available for "#<foo: 0xbfc5c>"(foo)
-class foo
+class Foo
def foo
eval("
def baz
@@ -12,7 +12,7 @@ end")
end
end
-class bar:foo
+class Bar : Foo
def bar
baz()
end
diff --git a/sample/export.rb b/sample/export.rb
index 03b9492..a6dfa8e 100644
--- a/sample/export.rb
+++ b/sample/export.rb
@@ -3,7 +3,7 @@
# foobar
# foo
-class foo
+class Foo
export :printf
end
diff --git a/sample/getopts.rb b/sample/getopts.rb
index 01eddce..37fd3dc 100644
--- a/sample/getopts.rb
+++ b/sample/getopts.rb
@@ -28,7 +28,7 @@
#
# オプションの指定があった場合, 変数 $OPT_?? に non-nil もしくは, そのオ
# プションの引数がセットされます.
-# -f -> $OPT_f = %TRUE
+# -f -> $OPT_f = TRUE
# --geometry 300x400 -> $OPT_geometry = 300x400
#
# - もしくは -- は, それ以降, 全てオプションの解析をしません.
@@ -50,7 +50,8 @@ def getopts(single_opts, *opts)
end
end
end
-
+
+ opts = {}
count = 0
while ($ARGV.length != 0)
compare = nil
@@ -68,11 +69,13 @@ def getopts(single_opts, *opts)
return nil
end
eval("$OPT_" + compare + " = " + '$ARGV[1]')
+ opts[compare] = TRUE
$ARGV.shift
count += 1
break
elsif (option == compare)
- eval("$OPT_" + compare + " = %TRUE")
+ eval("$OPT_" + compare + " = TRUE")
+ opts[compare] = TRUE
count += 1
break
end
@@ -82,16 +85,19 @@ def getopts(single_opts, *opts)
for index in 1..($ARGV[0].length - 1)
compare = $ARGV[0][index, 1]
if (single_opts && compare =~ "[" + single_opts + "]")
- eval("$OPT_" + compare + " = %TRUE")
+ eval("$OPT_" + compare + " = TRUE")
+ opts[compare] = TRUE
count += 1
elsif (single_colon != "" && compare =~ "[" + single_colon + "]")
if ($ARGV[0][index..-1].length > 1)
eval("$OPT_" + compare + " = " + '$ARGV[0][(index + 1)..-1]')
+ opts[compare] = TRUE
count += 1
elsif ($ARGV.length <= 1)
return nil
else
eval("$OPT_" + compare + " = " + '$ARGV[1]')
+ opts[compare] = TRUE
$ARGV.shift
count = count + 1
end
@@ -103,7 +109,7 @@ def getopts(single_opts, *opts)
end
$ARGV.shift
- if (!defined("$OPT_" + compare))
+ if (!opts.includes(compare))
return nil
end
end
diff --git a/sample/getopts.test b/sample/getopts.test
index cdb818d..adef762 100755
--- a/sample/getopts.test
+++ b/sample/getopts.test
@@ -1,4 +1,4 @@
-#! /mp/free/bin/ruby -- -*- ruby -*-
+#! /usr/local/bin/ruby
load("parsearg.rb")
diff --git a/sample/less.rb b/sample/less.rb
index 6960b9c..b0906d5 100755
--- a/sample/less.rb
+++ b/sample/less.rb
@@ -1,4 +1,4 @@
-#! /usr/local/bin/ruby -- -*- ruby -*-
+#! /usr/local/bin/ruby
ZCAT = "/usr/local/bin/zcat"
LESS = "/usr/local/bin/less"
diff --git a/sample/opt_x.rb b/sample/opt_x.rb
index 47a67f6..e69de29 100644
--- a/sample/opt_x.rb
+++ b/sample/opt_x.rb
@@ -1,10 +0,0 @@
-test for option `-x'
-
-this is a forwarding header
-this is a header too.
-
-from here script starts
-#! ./ruby -v
-print("tt\n")
-__END__
-this is a trailer
diff --git a/sample/opt_x.test b/sample/opt_x.test
new file mode 100644
index 0000000..47a67f6
--- /dev/null
+++ b/sample/opt_x.test
@@ -0,0 +1,10 @@
+test for option `-x'
+
+this is a forwarding header
+this is a header too.
+
+from here script starts
+#! ./ruby -v
+print("tt\n")
+__END__
+this is a trailer
diff --git a/sample/ruby-mode.el b/sample/ruby-mode.el
index 4396b10..20e1abe 100644
--- a/sample/ruby-mode.el
+++ b/sample/ruby-mode.el
@@ -8,7 +8,7 @@
;;;
(defconst ruby-block-beg-re
- "class\\|module\\|def\\|if\\|unless\\|case\\|while\\|until\\|for\\|begin"
+ "class\\|module\\|def\\|if\\|case\\|while\\|for\\|begin"
)
(defconst ruby-block-mid-re
@@ -170,10 +170,14 @@ The variable ruby-indent-level controls the amount of indentation.
((or (string= "\"" w) ;skip string
(string= "'" w)
(string= "`" w))
- (if (search-forward w indent-point t)
- nil
+ (cond
+ ((string= w (char-to-string (char-after (point))))
+ (forward-char 1))
+ ((re-search-forward (format "[^\\]%s" w) indent-point t)
+ nil)
+ (t
(goto-char indent-point)
- (setq in-string t)))
+ (setq in-string t))))
((or (string= "/" w)
(string= "<" w))
(if (string= "<" w) (setq w ">"))
@@ -189,7 +193,9 @@ The variable ruby-indent-level controls the amount of indentation.
(and (eq c ?w)
(save-excursion
(forward-word -1)
- (looking-at ruby-block-beg-re))))
+ (or
+ (looking-at ruby-block-beg-re)
+ (looking-at ruby-block-mid-re)))))
(if (search-forward w indent-point t)
nil
(goto-char indent-point)
diff --git a/sample/svr.rb b/sample/svr.rb
index 1c0104c..91faa56 100644
--- a/sample/svr.rb
+++ b/sample/svr.rb
@@ -5,7 +5,7 @@ gs = TCPserver.open(0)
printf("server port is on %d\n", gs.port)
socks = [gs]
-while %TRUE
+while TRUE
nsock = select(socks);
if nsock == nil; continue end
for s in nsock[0]
diff --git a/sample/tt.rb b/sample/tt.rb
index c53ec39..4afa202 100644
--- a/sample/tt.rb
+++ b/sample/tt.rb
@@ -43,7 +43,7 @@ if offset = (ttt =~ /this ([^ ]*) (.*)/)
println("2 = ", $2);
end
-class Fib:Object
+class Fib : Object
print("in Fib:Object\n")
def Fib.test(*args)