--- bioruby-1.0.0/lib/bio/io/flatfile.rb	2006-02-22 19:01:27.000000000 +0900
+++ bioruby-1.0.0x/lib/bio/io/flatfile.rb	2006-06-12 18:42:45.000000000 +0900
@@ -262,6 +262,9 @@
         # the last entry read from the stream
         attr_reader :entry
 
+        # a flag to write down entry start and end positions
+        attr_accessor :entry_pos_flag
+
         # start position of the entry
         attr_reader :entry_start_pos
 
@@ -290,6 +293,7 @@
             end
           end
           @delimiter_overrun = klass::DELIMITER_OVERRUN rescue nil
+          @entry_pos_flag = nil
         end
 
         # (String) delimiter indicates the end of a entry.
@@ -330,7 +334,7 @@
 
         # gets a entry
         def get_entry
-          p0 = @stream.pos
+          p0 = @entry_pos_flag ? @stream.pos : nil
           e  = @stream.gets(@delimiter)
           if e and @delimiter_overrun then
             if e[-@delimiter.size, @delimiter.size ] == @delimiter then
@@ -339,7 +343,7 @@
               @stream.ungets(overrun)
             end
           end
-          p1 = @stream.pos
+          p1 = @entry_pos_flag ? @stream.pos : nil
           @entry_start_pos = p0
           @entry = e
           @entry_ended_pos = p1
@@ -422,7 +426,7 @@
       # check if file is filename or IO object
       unless file.respond_to?(:gets)
         # 'file' is a filename
-        self.open_file(file, *arg, &block)
+        _open_file(dbclass, file, *arg, &block)
       else
         # 'file' is a IO object
         ff = self.new(dbclass, file)
@@ -462,15 +466,27 @@
     # Otherwise, it returns a new FlatFile object.
     #
     def self.open_file(filename, *arg)
+      _open_file(nil, filename, *arg)
+    end
+
+    # Same as FlatFile.open(dbclass, filename, *arg),
+    # except that it only accept filename and doesn't accept IO object.
+    #
+    # It can accept a block.
+    # If a block is given, it returns the block's return value.
+    # Otherwise, it returns a new FlatFile object.
+    #
+    def self._open_file(dbclass, filename, *arg)
       if block_given? then
         BufferedInputStream.open_file(filename, *arg) do |stream|
-          yield self.new(nil, stream)
+          yield self.new(dbclass, stream)
         end
       else
         stream = BufferedInputStream.open_file(filename, *arg)
-        self.new(nil, stream)
+        self.new(dbclass, stream)
       end
     end
+    private_class_method :_open_file
 
     # Opens URI specified as _uri_.
     # _uri_ must be a String or URI object.
@@ -518,13 +534,11 @@
     #
     def initialize(dbclass, stream)
       # 2nd arg: IO object
-      if @stream.kind_of?(BufferedInputStream)
+      if stream.kind_of?(BufferedInputStream)
         @stream = stream
       else
         @stream = BufferedInputStream.for_io(stream)
       end
-      # default is raw mode
-      self.raw = false
       # 1st arg: database class (or file format autodetection)
       if dbclass then
 	self.dbclass = dbclass
@@ -534,6 +548,8 @@
       #
       @skip_leader_mode = :firsttime
       @firsttime_flag = true
+      # default raw mode is false
+      self.raw = false
     end
 
     # The mode how to skip leader of the data.
@@ -587,6 +603,16 @@
       @splitter.entry
     end
 
+    # a flag to write down entry start and end positions
+    def entry_pos_flag
+      @splitter.entry_pos_flag
+    end
+
+    # Sets flag to write down entry start and end positions
+    def entry_pos_flag=(x)
+      @splitter.entry_pos_flag = x
+    end
+
     # start position of the last entry
     def entry_start_pos
       @splitter.entry_start_pos

