Psi4
Files | Functions
libpsio: The PSI I/O Library

Files

file  aio_handler.cc
 
file  change_namespace.cc
 
file  libpsio/close.cc
 
file  done.cc
 
file  libpsio/error.cc
 
file  get_address.cc
 
file  get_filename.cc
 
file  get_global_address.cc
 
file  get_length.cc
 
file  get_numvols.cc
 
file  get_volpath.cc
 
file  getpid.cc
 
file  libpsio/init.cc
 
file  open.cc
 
file  open_check.cc
 
file  read.cc
 
file  read_entry.cc
 
file  rename_file.cc
 
file  rw.cc
 
file  tocclean.cc
 
file  tocdel.cc
 
file  toclast.cc
 
file  toclen.cc
 
file  tocprint.cc
 
file  tocread.cc
 
file  tocscan.cc
 
file  tocwrite.cc
 
file  volseek.cc
 
file  write.cc
 
file  write_entry.cc
 
file  zero_disk.cc
 

Functions

void psi::psio_error (size_t unit, size_t errval)
 
psio_address psi::psio_get_address (psio_address start, size_t shift)
 
psio_address psi::psio_get_global_address (psio_address entry_start, psio_address rel_address)
 
size_t psi::psio_get_length (psio_address sadd, psio_address eadd)
 
int psi::psio_open_check (size_t unit)
 
void psi::PSIO::wt_toclen (size_t unit, size_t toclen)
 
int psi::psio_read (size_t unit, const char *key, char *buffer, size_t size, psio_address sadd, psio_address *eadd)
 
int psi::psio_read_entry (size_t unit, const char *key, char *buffer, size_t size)
 
int psi::psio_rw (size_t unit, char *buffer, psio_address address, size_t size, int wrt)
 
int psi::psio_tocclean (size_t unit, const char *key)
 
void psi::psio_tocprint (size_t unit)
 
psio_tocentry * psi::psio_tocscan (size_t unit, const char *key)
 
bool psi::psio_tocentry_exists (size_t unit, const char *key)
 
int psi::psio_tocwrite (size_t unit)
 
int psi::psio_volseek (psio_vol *vol, size_t page, size_t offset, size_t numvols)
 
int psi::psio_write (size_t unit, const char *key, char *buffer, size_t size, psio_address sadd, psio_address *eadd)
 
int psi::psio_write_entry (size_t unit, const char *key, char *buffer, size_t size)
 
int psi::psio_zero_disk (size_t unit, const char *key, size_t rows, size_t cols)
 

Detailed Description

Function Documentation

void psi::psio_error ( size_t  unit,
size_t  errval 
)

PSIO_ERROR(): Print out an error message for libpsio.

Parameters
unit= file number
errval= error code (defined symbolically, PSIO_ERROR_XXX)
psio_address psi::psio_get_address ( psio_address  start,
size_t  shift 
)

PSIO_GET_ADDRESS(): Given a starting page/offset and a shift length (in bytes), return the page/offset of the next position in the file.

psio_address psi::psio_get_global_address ( psio_address  entry_start,
psio_address  rel_address 
)

PSIO_GET_GLOBAL_ADDRESS(): Given the global starting address for a TOC entry and a relative offset within the entry, compute the global address for the offset.

size_t psi::psio_get_length ( psio_address  sadd,
psio_address  eadd 
)

PSIO_GET_LENGTH(): Given a start page and offset for two data sets, compute the number of bytes between them. Note that eadd denotes the beginning of the next entry and not the end of the current entry.

int psi::psio_open_check ( size_t  unit)

PSIO_OPEN_CHECK(): Check to see if a given PSI direct access file is already open.

Parameters
unit= the PSI unit number.
int psi::psio_read ( size_t  unit,
const char *  key,
char *  buffer,
size_t  size,
psio_address  start,
psio_address *  end 
)

PSIO_READ(): Reads data from within a TOC entry from a PSI file.

Parameters
unit= The PSI unit number used to identify the file to all read and write functions.
key= The TOC keyword identifying the desired entry.
buffer= The buffer to store the data as it is read.
size= The number of bytes to read.
start= The entry-relative starting page/offset of the desired data.
end= A pointer to the entry-relative page/offset for the next byte after the end of the read request.
int psi::psio_read_entry ( size_t  unit,
const char *  key,
char *  buffer,
size_t  size 
)

PSIO_READ_ENTRY(): Reads an entire TOC entry from a PSI file.

Parameters
unit= The PSI unit number used to identify the file to all read and write functions.
key= The TOC keyword identifying the desired entry.
buffer= The buffer to store the data as it is read.
size= The number of bytes to read.

Note that the value of size is not directly compared to the actual size of the entry, but care is taken to ensure that the end of the entry is not surpassed.

int psi::psio_rw ( size_t  unit,
char *  buffer,
psio_address  address,
size_t  size,
int  wrt 
)

PSIO_RW(): Central function for all reads and writes on a PSIO unit.

unit = The PSI unit number. buffer = The buffer containing the bytes for the read/write event. address = the PSIO global address for the start of the read/write. size = The number of bytes to read/write. = Indicates if the call is to read (0) or write (0) the input data.

int psi::psio_tocclean ( size_t  unit,
const char *  key 
)

PSIO_TOCCLEAN(): Delete all TOC entries after the given key. If a blank key is given, the entire TOC will be wiped.

bool psi::psio_tocentry_exists ( size_t  unit,
const char *  key 
)

PSIO_TOCSCAN(): Scans the TOC for a particular keyword and returns either a pointer to the entry or nullptr to the caller.

void psi::psio_tocprint ( size_t  unit)

PSIO_TOCPRINT(): Print the table of contents for the given unit

psio_tocentry * psi::psio_tocscan ( size_t  unit,
const char *  key 
)

PSIO_TOCSCAN(): Scans the TOC for a particular keyword and returns either a pointer to the entry or nullptr to the caller.

int psi::psio_tocwrite ( size_t  unit)

PSIO_TOCWRITE(): Write the table of contents for file number 'unit'.

Parameters
unit= The PSI unit to which we will write the TOC.

NB: This function should NOT call psio_error because the latter calls it!

int psi::psio_volseek ( psio_vol *  vol,
size_t  page,
size_t  offset,
size_t  numvols 
)

PSIO_VOLSEEK()

int psi::psio_write ( size_t  unit,
const char *  key,
char *  buffer,
size_t  size,
psio_address  start,
psio_address *  end 
)

PSIO_WRITE(): Writes data to a TOC entry in a PSI file.

Parameters
unit= The PSI unit number used to identify the file to all read and write functions.
key= The TOC keyword identifying the desired entry.
buffer= The buffer from which the data is written.
size= The number of bytes to write.
start= The entry-relative starting page/offset to write the data.
end= A pointer to the entry-relative page/offset for the next byte after the end of the write request.
int psi::psio_write_entry ( size_t  unit,
const char *  key,
char *  buffer,
size_t  size 
)

PSIO_WRITE_ENTRY()

int psi::psio_zero_disk ( size_t  unit,
const char *  key,
size_t  rows,
size_t  cols 
)

PSIO_ZERO_DISK()

void psi::PSIO::wt_toclen ( size_t  unit,
size_t  toclen 
)
private

Write the length of the TOC for a given unit directly to the file.

Parameters
unit= PSI unit number to which to write the toclen.