gibuu is hosted by Hepforge, IPPP Durham
GiBUU

TABLE OF CONTENTS


/bzip [ Modules ]

[ Top ] [ Modules ]

NAME

module bzip

NOTES

This module provides routines for reading and writing bz2-compressed files.


bzip/bzFile [ Types ]

[ Top ] [ bzip ] [ Types ]

SOURCE

  type, public :: bzFile
    type(c_ptr) :: handle, bzHandle           ! file handles
    character(kind=c_char,len=100) :: fname   ! file name
    logical :: eof = .false.                  ! end of file reached?
  end type

NOTES

This is a data type to represent bzip files, including file name and file handles. 'handle' is used by the stdio functions 'fopen' and 'close'. 'bzHandle' is used by the libbz2 functions 'BZ2_bzReadOpen', 'BZ2_bzRead', 'BZ2_bzReadClose' etc.


bzip/bzOpenR [ Functions ]

[ Top ] [ bzip ] [ Functions ]

NAME

function bzOpenR (fname)

PURPOSE

Open a bz2 file for reading.

INPUTS

character(len=*) :: fname --- full file name

OUTPUT

type(bzFile) :: bzOpenR --- bzFile structure containing valid file handles (if successful)


bzip/bzOpenW [ Functions ]

[ Top ] [ bzip ] [ Functions ]

NAME

function bzOpenW (fname)

PURPOSE

Open a bz2 file for writing.

INPUTS

character(len=*) :: fname --- full file name

OUTPUT

type(bzFile) :: bzOpenW --- bzFile structure containing valid file handles (if successful)


bzip/bzReadline [ Subroutines ]

[ Top ] [ bzip ] [ Subroutines ]

NAME

subroutine bzReadline (f, buf, length, debug)

PURPOSE

Read one line from a bz2 file.

INPUTS

  • type(bzFile) :: f --- bzFile structure (which should have been obtained from a previous bzOpenR)
  • integer :: length --- minimal length of the line to read (excluding '\n')

OUTPUT

  • character(kind=C_CHAR,len=*) :: buf --- buffer containing the data which has been read from the file
  • integer,intent(inout) :: length --- actual length of the line (excluding '\n')

NOTES

The input "length" must be set before calling this routine. Smaller values provide more safety and flexibility, while larger value provide better performance. If the line length is unknown, this can just be set to zero, and the line length will be determined automatically (note: this is slow). If the line length is known, the fastest method is to set "length" to the exact line length (excluding the newline character '\n'). "Length" can also be set to any value between zero and the actual line length (as a trade-off between performance and flexibility). However, it should never be set to values larger than the actual line length, or you will get two lines instead of one.


bzip/bzWriteline [ Subroutines ]

[ Top ] [ bzip ] [ Subroutines ]

NAME

subroutine bzWriteline (f, buf)

PURPOSE

Write one line to a bz2 file.

INPUTS

  • type(bzFile) :: f --- bzFile structure (which should have been obtained from a previous bzOpenW)
  • character(kind=C_CHAR,len=*) :: buf --- buffer containing the data which should be written the file


bzip/bzCloseR [ Subroutines ]

[ Top ] [ bzip ] [ Subroutines ]

NAME

subroutine bzCloseR (f)

PURPOSE

Close a bz2 file, which has been opened for reading.

INPUTS

type(bzFile) :: f --- bzFile structure representing the file which should be closed


bzip/bzCloseW [ Subroutines ]

[ Top ] [ bzip ] [ Subroutines ]

NAME

subroutine bzCloseW (f)

PURPOSE

Close a bz2 file, which has been opened for writing.

INPUTS

type(bzFile) :: f --- bzFile structure representing the file which should be closed