[前][次][番号順一覧][スレッド一覧]

ruby-changes:3097

From: ko1@a...
Date: 24 Dec 2007 17:23:23 +0900
Subject: [ruby-changes:3097] nahi - Ruby:r14589 (trunk): Mon Dec 24 17:20:34 2007 NAKAMURA, Hiroshi <nahi@r...>

nahi	2007-12-24 17:23:09 +0900 (Mon, 24 Dec 2007)

  New Revision: 14589

  Removed files:
    trunk/lib/getopts.rb
    trunk/lib/mailread.rb
    trunk/lib/parsearg.rb
  Modified files:
    trunk/ChangeLog

  Log:
    Mon Dec 24 17:20:34 2007  NAKAMURA, Hiroshi  <nahi@r...>
    
    * lib/{mailread.rb,getopts.rb,parsearg.rb}: removed.
      see [ruby-core:12535], [ruby-dev:31969].


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/getopts.rb
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=14589&r2=14588
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/parsearg.rb
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/mailread.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 14588)
+++ ChangeLog	(revision 14589)
@@ -1,3 +1,8 @@
+Mon Dec 24 17:20:34 2007  NAKAMURA, Hiroshi  <nahi@r...>
+
+	* lib/{mailread.rb,getopts.rb,parsearg.rb}: removed.
+	  see [ruby-core:12535], [ruby-dev:31969].
+
 Mon Dec 24 17:12:57 2007  Tanaka Akira  <akr@f...>
 
 	* include/ruby/intern.h, random.c, array.c:
Index: lib/mailread.rb
===================================================================
--- lib/mailread.rb	(revision 14588)
+++ lib/mailread.rb	(revision 14589)
@@ -1,62 +0,0 @@
-# The Mail class represents an internet mail message (as per RFC822, RFC2822)
-# with headers and a body. 
-class Mail
-
-  # Create a new Mail where +f+ is either a stream which responds to gets(),
-  # or a path to a file.  If +f+ is a path it will be opened.
-  #
-  # The whole message is read so it can be made available through the #header,
-  # #[] and #body methods.
-  #
-  # The "From " line is ignored if the mail is in mbox format.
-  def initialize(f)
-    unless defined? f.gets
-      f = open(f, "r")
-      opened = true
-    end
-
-    @header = {}
-    @body = []
-    begin
-      while line = f.gets()
-	line.chop!
-	next if /^From /=~line	# skip From-line
-	break if /^$/=~line	# end of header
-
-	if /^(\S+?):\s*(.*)/=~line
-	  (attr = $1).capitalize!
-	  @header[attr] = $2
-	elsif attr
-	  line.sub!(/^\s*/, '')
-	  @header[attr] += "\n" + line
-	end
-      end
-  
-      return unless line
-
-      while line = f.gets()
-	break if /^From /=~line
-	@body.push(line)
-      end
-    ensure
-      f.close if opened
-    end
-  end
-
-  # Return the headers as a Hash.
-  def header
-    return @header
-  end
-
-  # Return the message body as an Array of lines
-  def body
-    return @body
-  end
-
-  # Return the header corresponding to +field+. 
-  #
-  # Matching is case-insensitive.
-  def [](field)
-    @header[field.capitalize]
-  end
-end
Index: lib/getopts.rb
===================================================================
--- lib/getopts.rb	(revision 14588)
+++ lib/getopts.rb	(revision 14589)
@@ -1,127 +0,0 @@
-#
-#               getopts.rb - 
-#                       $Release Version: $
-#                       $Revision$
-#                       $Date$
-#                       by Yasuo OHBA(SHL Japan Inc. Technology Dept.)
-#
-# --
-# this is obsolete; use getoptlong
-#
-# 2000-03-21
-# modified by Minero Aoki <aamine@d...>
-#
-# 2002-03-05
-# rewritten by Akinori MUSHA <knu@r...>
-#
-
-warn "Warning:#{caller[0].sub(/:in `.*'\z/, '')}: getopts is deprecated after Ruby 1.8.1; use optparse instead" if caller[0]
-
-$RCS_ID=%q$Header$
-
-# getopts is obsolete. Use GetoptLong.
-
-def getopts(single_options, *options)
-  boolopts = {}
-  valopts = {}
-
-  #
-  # set defaults
-  #
-  single_options.scan(/.:?/) do |opt|
-    if opt.size == 1
-      boolopts[opt] = false
-    else
-      valopts[opt[0, 1]] = nil
-    end
-  end if single_options
-
-  options.each do |arg|
-    opt, val = arg.split(':', 2)
-
-    if val
-      valopts[opt] = val.empty? ? nil : val
-    else
-      boolopts[opt] = false
-    end
-  end
-
-  #
-  # scan
-  #
-  c = 0
-  argv = ARGV
-
-  while arg = argv.shift
-    case arg
-    when /\A--(.*)/
-      if $1.empty?			# xinit -- -bpp 24
-	break
-      end
-
-      opt, val = $1.split('=', 2)
-
-      if opt.size == 1
-	argv.unshift arg
-	return nil
-      elsif valopts.key? opt		# imclean --src +trash
-	valopts[opt] = val || argv.shift or return nil
-      elsif boolopts.key? opt		# ruby --verbose
-	boolopts[opt] = true
-      else
-	argv.unshift arg
-	return nil
-      end
-
-      c += 1
-    when /\A-(.+)/
-      opts = $1
-
-      until opts.empty?
-	opt = opts.slice!(0, 1)
-
-	if valopts.key? opt
-	  val = opts
-
-	  if val.empty?			# ruby -e 'p $:'
-	    valopts[opt] = argv.shift or return nil
-	  else				# cc -ohello ...
-	    valopts[opt] = val
-	  end
-
-	  c += 1
-	  break
-	elsif boolopts.key? opt
-	  boolopts[opt] = true		# ruby -h
-	  c += 1
-	else
-	  argv.unshift arg
-	  return nil
-	end
-      end
-    else
-      argv.unshift arg
-      break
-    end
-  end
-
-  #
-  # set
-  #
-  $OPT = {}
-
-  boolopts.each do |opt, val|
-    $OPT[opt] = val
-
-    sopt = opt.gsub(/[^A-Za-z0-9_]/, '_')
-    eval "$OPT_#{sopt} = val"
-  end
-  valopts.each do |opt, val|
-    $OPT[opt] = val
-
-    sopt = opt.gsub(/[^A-Za-z0-9_]/, '_')
-    eval "$OPT_#{sopt} = val"
-  end
-
-  c
-end
Index: lib/parsearg.rb
===================================================================
--- lib/parsearg.rb	(revision 14588)
+++ lib/parsearg.rb	(revision 14589)
@@ -1,87 +0,0 @@
-#
-#		parsearg.rb - parse arguments
-#			$Release Version: $
-#			$Revision$
-#			$Date$
-#			by Yasuo OHBA(SHL Japan Inc. Technology Dept.)
-#
-# --
-#
-#	
-#
-
-warn "Warning:#{caller[0].sub(/:in `.*'\z/, '')}: parsearg is deprecated after Ruby 1.8.1; use optparse instead"
-
-$RCS_ID=%q$Header$
-
-require "getopts"
-
-def printUsageAndExit()
-  if $USAGE
-    eval($USAGE)
-  end
-  exit()
-end
-
-def setParenthesis(ex, opt, c)
-  if opt != ""
-    ex = sprintf("%s$OPT_%s%s", ex, opt, c)
-  else
-    ex = sprintf("%s%s", ex, c)
-  end
-  return ex
-end
-
-def setOrAnd(ex, opt, c)
-  if opt != ""
-    ex = sprintf("%s$OPT_%s %s%s ", ex, opt, c, c)
-  else
-    ex = sprintf("%s %s%s ", ex, c, c)
-  end
-  return ex
-end
-
-def setExpression(ex, opt, op)
-  if !op
-    ex = sprintf("%s$OPT_%s", ex, opt)
-    return ex
-  end
-  case op.chr
-  when "(", ")"
-    ex = setParenthesis(ex, opt, op.chr)
-  when "|", "&"
-    ex = setOrAnd(ex, opt, op.chr)
-  else
-    return nil
-  end
-  return ex
-end
-
-# parseArgs is obsolete.  Use OptionParser instead.
-
-def parseArgs(argc, nopt, single_opts, *opts)
-  if (noOptions = getopts(single_opts, *opts)) == nil
-    printUsageAndExit()
-  end
-  if nopt
-    ex = nil
-    pos = 0
-    for o in nopt.split(/[()|&]/)
-      pos += o.length
-      ex = setExpression(ex, o, nopt[pos])
-      pos += 1
-    end
-    begin
-      if !eval(ex)
-	printUsageAndExit()
-      end
-    rescue
-      print "Format Error!! : \"" + nopt + "\"\t[parseArgs]\n"
-      exit!(-1)
-    end
-  end
-  if ARGV.length < argc
-    printUsageAndExit()
-  end
-  return noOptions
-end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml

[前][次][番号順一覧][スレッド一覧]