forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

reading files > 4Gb

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit
View previous topic :: View next topic  
Author Message
KennyT



Joined: 02 Aug 2005
Posts: 281

PostPosted: Wed May 25, 2016 11:52 am    Post subject: reading files > 4Gb Reply with quote

Are there any plans for the @ functions (e.g. FPOS@) to support full 8-byte positioning?

K
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5916
Location: Salford, UK

PostPosted: Wed May 25, 2016 3:07 pm    Post subject: Reply with quote

No but if you can give me a list of the relevant functions then it would not be a major task.
Back to top
View user's profile Send private message
KennyT



Joined: 02 Aug 2005
Posts: 281

PostPosted: Wed May 25, 2016 3:26 pm    Post subject: Reply with quote

OK,

I envisage as a minimum:

FPOS8@
RFPOS8@

And possibly:

READF8@
WRITEF8@

That'll do for starters!

tks

K
Back to top
View user's profile Send private message Visit poster's website
JohnCampbell



Joined: 16 Feb 2006
Posts: 2079
Location: Sydney

PostPosted: Fri May 27, 2016 9:35 am    Post subject: Reply with quote

Paul,

The following is taken from my interface to the salford file i/o routines, where I have updated the file position to integer*8.
The byte_size could also be integer*8, should an individual record be larger than 2^31 bytes, although this is not as important.
Also the file handle (lunit) and error_code are integer*2, which could be changed to integer*4.
These routines provide all the functionality I use, apart from closef@, file_size8@ and erase@.

The changes, both needed and possible are:
rfpos@ need I*8:file_position
fpos@ need I*8:file_position

writef@ could have I*8:byte_size
readf@ could have I*8: byte_size, bytes_read
openrw@ could have I*4:lunit, error_code
doserr@
closef@
file_size8@ could have I*8:file_size
erase@
Code:
      subroutine open_salford_io ( file_name, lunit, error_code )
!
!  File I/O using Salford I/O library
!
      character file_name*(*)
      integer*2 lunit, error_code
!
      lunit = -1
      CALL openrw@ (file_name, lunit, error_code)
      write ( *,*) 'OPEN : File       = ', trim (file_name)
      write ( *,*) 'OPEN : Handle     =', lunit
      write ( *,*) 'OPEN : Error code =', error_code
      write (98,*) 'OPEN : File       = ', trim (file_name)
      write (98,*) 'OPEN : Handle     =', lunit
      write (98,*) 'OPEN : Error code =', error_code
         if (error_code.ne.0) call doserr@ (error_code)
!
      end subroutine open_salford_io

      subroutine getpos_salford_io ( lunit, file_position )
!
!  File I/O using Salford I/O library
!
      integer*2 lunit, error_code
      integer*8 file_position
!
      call rfpos@ (lunit, file_position, error_code)    ! get byte position, first is 0
         if (error_code.ne.0) call doserr@ (error_code)
!
      end subroutine getpos_salford_io

      subroutine setpos_salford_io ( lunit, file_position )
!
!  File I/O using Salford I/O library
!
      integer*2 lunit, error_code
      integer*8 file_position, new_position
!
      call fpos@ (lunit, file_position, new_position, error_code)    ! get byte position, first is 0
         if (file_position.ne.new_position) write ( *,*) 'File position error', file_position, new_position
         if (file_position.ne.new_position) write (98,*) 'File position error', file_position, new_position
         if (error_code.ne.0) call doserr@ (error_code)
!
      end subroutine setpos_salford_io

      subroutine write_salford_io ( lunit, buffer, byte_size, file_position )
!
!  File I/O using Salford I/O library
!
      integer*2 lunit, error_code
      integer*4 byte_size
      integer*8 file_position
      real*8    buffer(*)
!
      if (file_position /= -1) call setpos_salford_io ( lunit, file_position )
!
      call writef@ (buffer, lunit, byte_size, error_code)
         if (error_code.ne.0) call doserr@ (error_code)
!
      end subroutine write_salford_io

      subroutine read_salford_io ( lunit, buffer, byte_size, file_position )
!
!  File I/O using Salford I/O library
!
      integer*2 lunit, error_code
      integer*4 byte_size, bytes_read
      integer*8 file_position
      real*8    buffer(*)
!
      if (file_position /= -1) call setpos_salford_io ( lunit, file_position )
!
      call readf@ (buffer, lunit, byte_size, bytes_read, error_code)
         if (bytes_read.ne.byte_size) write ( *,*) 'Bytes read error', byte_size, bytes_read
         if (bytes_read.ne.byte_size) write (98,*) 'Bytes read error', byte_size, bytes_read
         if (error_code.ne.0) call doserr@ (error_code)
!
      end subroutine read_salford_io
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5916
Location: Salford, UK

PostPosted: Mon May 30, 2016 6:54 am    Post subject: Reply with quote

Kenny and John: Thanks for the feedback.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5916
Location: Salford, UK

PostPosted: Mon Jun 06, 2016 10:52 am    Post subject: Reply with quote

The following undocumented Win32 routines have now been ported to 64 bits for the next release: FPOSLONG@, RFPOSLONG@ and FPOS_EOFLONG@. These are similar to FPOS@, RFPOS@ and FPOS_EOF@ but take INTEGER*8 position arguments. Note that other arguments are still INTEGER*2.

READFLONG@ and WRITEFLONG@ don't exist at the moment but hopefully are less urgent.
Back to top
View user's profile Send private message
StamK



Joined: 12 Oct 2016
Posts: 106

PostPosted: Thu Dec 20, 2018 12:53 am    Post subject: Reply with quote

Would it be possible to now add also READFLONG@ and WRITEFLONG@? I checked in 8.40 and they don't seem to be there. Thanks
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 5916
Location: Salford, UK

PostPosted: Thu Dec 20, 2018 11:32 am    Post subject: Reply with quote

I have added these routines and a new DLL can be downloaded from here...

https://www.dropbox.com/s/ak5r1ghhiq0pml5/newDLLs29.zip?dl=0

Here is some sample code used for testing...

Code:
program main
implicit none
integer(4),parameter::N = 4294967296_4 !4GB
character(len=N) buffer
integer(2) handle,ierror
integer(4) bytes_read
call OPENR@("xxxxx", handle, ierror)
call READFLONG@(buffer, handle, N, bytes_read, ierror)
call CLOSEF@(handle, ierror)
call OPENW@("zzzzzz", handle, ierror)
call WRITEFLONG@(buffer, handle, bytes_read, ierror)
call CLOSEF@(handle, ierror)
end
Back to top
View user's profile Send private message
StamK



Joined: 12 Oct 2016
Posts: 106

PostPosted: Tue Jan 22, 2019 11:11 pm    Post subject: Reply with quote

I forgot to thank you Paul for the quick fix. I can confirm that the calls are there now. Thanks again
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> 64-bit All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group