Pointwise Plugin SDK
Classes | Functions
+ Collaboration diagram for Unformatted FORTRAN File Handling:

Classes

struct  PWU_UNFDATA
 Unformatted file data block. More...
 

Functions

PWP_BOOL PwuUnfFileBegin (FILE *fp, PWU_UNFDATA *pUData)
 Prepares a PWU_UNFDATA block for a new unformatted file I/O session. More...
 
PWP_BOOL PwuUnfFileEnd (PWU_UNFDATA *pUData)
 Finalize an unformatted file I/O session. More...
 
PWP_ENDIANNESS PwuUnfFileGetEndianness (PWU_UNFDATA *pUData)
 Get the output endianness setting for this PWU_UNFDATA block. More...
 
PWP_ENDIANNESS PwuUnfFileSetEndianness (PWU_UNFDATA *pUData, PWP_ENDIANNESS endianness)
 Set the output endianness. More...
 
PWP_BOOL PwuUnfHadError (PWU_UNFDATA *pUData)
 Check if an unformatted file I/O session has detected any errors. More...
 
PWP_BOOL PwuUnfRecBegin (PWU_UNFDATA *pUData)
 Prepares a PWU_UNFDATA block for writing a new unformatted data record. More...
 
PWP_BOOL PwuUnfRecBeginFixed (PWU_UNFDATA *pUData, PWP_UINT32 bytes, PWP_UINT32 count)
 Prepares a PWU_UNFDATA block for writing a new unformatted data record when the amount of data being written is known ahead of time. More...
 
PWP_UINT32 PwuUnfRecBytes (PWU_UNFDATA *pUData)
 Get the running total number of bytes written to the current record during an unformatted file I/O session. More...
 
PWP_UINT32 PwuUnfRecCount (PWU_UNFDATA *pUData)
 Get the running total number of finalized records written during an unformatted file I/O session. More...
 
PWP_BOOL PwuUnfRecEnd (PWU_UNFDATA *pUData)
 Finalize the current record write. More...
 
PWP_BOOL PwuUnfRecWriteArr (PWU_UNFDATA *pUData, const void *arr, size_t itemSize, size_t itemCnt)
 Write an array of data to the current record. More...
 
PWP_BOOL PwuUnfRecWriteBuf (PWU_UNFDATA *pUData, const void *buf, size_t size)
 Write a data buffer to the current record. More...
 
PWP_BOOL PwuUnfRecWriteEndianBuf (PWU_UNFDATA *pUData, const void *buf, size_t size)
 Write a data buffer to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteFLOAT (PWU_UNFDATA *pUData, PWP_FLOAT val)
 Write a PWP_FLOAT value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteINT (PWU_UNFDATA *pUData, PWP_INT val)
 Write a PWP_INT value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteINT16 (PWU_UNFDATA *pUData, PWP_INT16 val)
 Write a PWP_INT16 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteINT32 (PWU_UNFDATA *pUData, PWP_INT32 val)
 Write a PWP_INT32 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteINT64 (PWU_UNFDATA *pUData, PWP_INT64 val)
 Write a PWP_INT64 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteINT8 (PWU_UNFDATA *pUData, PWP_INT8 val)
 Write a PWP_INT8 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteREAL (PWU_UNFDATA *pUData, PWP_REAL val)
 Write a PWP_REAL value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteUINT (PWU_UNFDATA *pUData, PWP_UINT val)
 Write a PWP_UINT value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteUINT16 (PWU_UNFDATA *pUData, PWP_UINT16 val)
 Write a PWP_UINT16 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteUINT32 (PWU_UNFDATA *pUData, PWP_UINT32 val)
 Write a PWP_UINT32 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteUINT64 (PWU_UNFDATA *pUData, PWP_UINT64 val)
 Write a PWP_UINT64 value to the current record with endian order applied. More...
 
PWP_BOOL PwuUnfRecWriteUINT8 (PWU_UNFDATA *pUData, PWP_UINT8 val)
 Write a PWP_UINT8 value to the current record with endian order applied. More...
 
PWP_UINT32 PwuUnfTotRecBytes (PWU_UNFDATA *pUData)
 Get the running total number of bytes written to all records during an unformatted file I/O session. More...
 

Detailed Description

Unformatted FORTRAN file I/O utility functions and data-types.

Function Documentation

◆ PwuUnfFileBegin()

PWP_BOOL PwuUnfFileBegin ( FILE *  fp,
PWU_UNFDATA pUData 
)

Prepares a PWU_UNFDATA block for a new unformatted file I/O session.

Parameters
fpThe file pointer used for writing. The file must be open and ready for write before calling this function. The file position is not changed by this call.
pUDataPointer to an uninitialized I/O control block.
Returns
PWP_TRUE on success. PWP_FALSE on failure.
See also
pwpFileOpen(), PwuUnfFileSetEndianness()
Note
PWP_ENDIAN_NATIVE is the default endianness.

Definition at line 359 of file apiPWPUtils.cxx.

References PWU_UNFDATA::fp, PWP_FALSE, PWP_TRUE, and unfUDataInit().

Referenced by PwpUnformattedWriter::PwpUnformattedWriter().

◆ PwuUnfFileEnd()

PWP_BOOL PwuUnfFileEnd ( PWU_UNFDATA pUData)

Finalize an unformatted file I/O session.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfFileBegin().
Returns
PWP_TRUE on success. PWP_FALSE on failure.
See also
pwpFileClose()
Note
If a record is currently active, it will be ended automatically before the I/O session is finalized.
It is the callers reponsibility to close the file pointer originally passed to PwuUnfFileBegin().

Definition at line 594 of file apiPWPUtils.cxx.

References PWU_UNFDATA::fp, PWU_UNFDATA::hadError, PWP_FALSE, PwuUnfRecEnd(), STAT_CLOSED, and PWU_UNFDATA::status.

Referenced by PwpUnformattedWriter::~PwpUnformattedWriter().

◆ PwuUnfFileGetEndianness()

PWP_ENDIANNESS PwuUnfFileGetEndianness ( PWU_UNFDATA pUData)

Get the output endianness setting for this PWU_UNFDATA block.

Parameters
pUDataPointer to an I/O control block initialized by a call to PwuUnfFileBegin().
Returns
Current endianness setting.

Definition at line 352 of file apiPWPUtils.cxx.

References PWU_UNFDATA::endianness, and PWP_ENDIAN_ERROR.

◆ PwuUnfFileSetEndianness()

PWP_ENDIANNESS PwuUnfFileSetEndianness ( PWU_UNFDATA pUData,
PWP_ENDIANNESS  endianness 
)

Set the output endianness.

The endianness will apply to all (future) writes using this PWU_UNFDATA block.

Parameters
pUDataPointer to an I/O control block initialized by PwuUnfFileBegin().
endiannessThe endianness flag. See notes.
Returns
Previous endianness setting.
Note
If endianness may be one of:
  • PWP_ENDIAN_LITTLE - force output to little endian
  • PWP_ENDIAN_BIG - force output to big endian
  • PWP_ENDIAN_NATIVE - force output to OS's native endianness
  • PWP_ENDIAN_FOREIGN - force output to OS's non-native endianness

Definition at line 340 of file apiPWPUtils.cxx.

References PWU_UNFDATA::endianness, PWP_ENDIAN_ERROR, and UDATA_ISOPEN.

Referenced by PwpUnformattedWriter::beginRecord().

◆ PwuUnfHadError()

PWP_BOOL PwuUnfHadError ( PWU_UNFDATA pUData)

Check if an unformatted file I/O session has detected any errors.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfFileBegin().
Returns
PWP_TRUE if an error was detected. PWP_FALSE if an error was not detected.
Note
It is valid to call this function after PwuUnfFileEnd(). The internals are only cleared on a call to PwuUnfFileBegin().

Definition at line 609 of file apiPWPUtils.cxx.

References PWU_UNFDATA::hadError, and UDATA_ISINIT.

◆ PwuUnfRecBegin()

PWP_BOOL PwuUnfRecBegin ( PWU_UNFDATA pUData)

Prepares a PWU_UNFDATA block for writing a new unformatted data record.

Parameters
pUDataPointer to an I/O control block initialized by a call to PwuUnfFileBegin().
Returns
PWP_TRUE on success. PWP_FALSE on failure.
See also
PwuUnfRecEnd()
Note
If a record is currently active, it will be ended automatically before the new record is prepared.

Definition at line 428 of file apiPWPUtils.cxx.

References PWU_UNFDATA::fixedBytes, PWU_UNFDATA::fp, PWU_UNFDATA::fPos, PWU_UNFDATA::hadError, PWU_UNFDATA::inRec, PWP_FALSE, PWP_TRUE, pwpFileGetpos(), PwuUnfRecEnd(), PWU_UNFDATA::recBytes, UDATA_ISOPEN, and unfHdrLenWrite().

Referenced by PwpUnformattedWriter::beginRecord().

◆ PwuUnfRecBeginFixed()

PWP_BOOL PwuUnfRecBeginFixed ( PWU_UNFDATA pUData,
PWP_UINT32  bytes,
PWP_UINT32  count 
)

Prepares a PWU_UNFDATA block for writing a new unformatted data record when the amount of data being written is known ahead of time.

Parameters
pUDataPointer to an I/O control block initialized by a call to PwuUnfFileBegin().
bytesNumber of bytes per item.
countNumber of items.
Returns
PWP_TRUE on success. PWP_FALSE on failure.
See also
PwuUnfRecEnd(), PwuUnfRecBegin()
Note
If a record is currently active, it will be ended automatically before the new record is prepared.
This call writes records significantly faster than using PwuUnfRecBegin(). If the plugin creates many records in a tight loop, use this call if at all possible to prevent a performance issue.

Definition at line 453 of file apiPWPUtils.cxx.

References PWU_UNFDATA::fixedBytes, PWU_UNFDATA::hadError, PWU_UNFDATA::inRec, PWP_FALSE, PWP_TRUE, PwuUnfRecEnd(), PWU_UNFDATA::recBytes, UDATA_ISOPEN, and unfHdrLenWrite().

Referenced by PwpUnformattedWriter::beginRecord().

◆ PwuUnfRecBytes()

PWP_UINT32 PwuUnfRecBytes ( PWU_UNFDATA pUData)

Get the running total number of bytes written to the current record during an unformatted file I/O session.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfFileBegin().
Returns
The number of bytes written to the current record so far.
Note
It is valid to call this function after PwuUnfRecEnd(). The record internals are only cleared on a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().

Definition at line 616 of file apiPWPUtils.cxx.

References PWU_UNFDATA::recBytes, and UDATA_ISINIT.

◆ PwuUnfRecCount()

PWP_UINT32 PwuUnfRecCount ( PWU_UNFDATA pUData)

Get the running total number of finalized records written during an unformatted file I/O session.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfFileBegin().
Returns
The total number of bytes written to all records so far.
Note
It is valid to call this function after PwuUnfFileEnd(). The internals are only cleared on a call to PwuUnfFileBegin().

Definition at line 630 of file apiPWPUtils.cxx.

References PWU_UNFDATA::recCnt, and UDATA_ISINIT.

◆ PwuUnfRecEnd()

PWP_BOOL PwuUnfRecEnd ( PWU_UNFDATA pUData)

Finalize the current record write.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
Returns
PWP_TRUE on success. PWP_FALSE on failure.
See also
PwuUnfRecBegin(), PwuUnfRecBeginFixed()

Definition at line 371 of file apiPWPUtils.cxx.

References PWU_UNFDATA::fixedBytes, PWU_UNFDATA::fp, PWU_UNFDATA::fPos, PWU_UNFDATA::hadError, PWU_UNFDATA::inRec, PWP_FALSE, PWP_TRUE, pwpFileGetpos(), pwpFileSetpos(), PWU_UNFDATA::recBytes, PWU_UNFDATA::recCnt, PWU_UNFDATA::totRecBytes, UDATA_INREC, and unfHdrLenWrite().

Referenced by PwpUnformattedWriter::endRecord(), PwuUnfFileEnd(), PwuUnfRecBegin(), and PwuUnfRecBeginFixed().

◆ PwuUnfRecWriteArr()

PWP_BOOL PwuUnfRecWriteArr ( PWU_UNFDATA pUData,
const void *  arr,
size_t  itemSize,
size_t  itemCnt 
)

Write an array of data to the current record.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
arrPointer to the array data.
itemSizeSize of each array item (bytes).
itemCntThe number of array items.
Returns
PWP_TRUE on success. PWP_FALSE on failure.
Note
Data is written as-is. Endianness is not enforced.

Definition at line 477 of file apiPWPUtils.cxx.

References PWU_UNFDATA::fp, PWU_UNFDATA::hadError, PWP_FALSE, PWP_TRUE, pwpFileWrite(), PWU_UNFDATA::recBytes, and UDATA_INREC.

Referenced by PwuUnfRecWriteBuf(), and PwuUnfRecWriteEndianBuf().

◆ PwuUnfRecWriteBuf()

PWP_BOOL PwuUnfRecWriteBuf ( PWU_UNFDATA pUData,
const void *  buf,
size_t  size 
)

Write a data buffer to the current record.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
bufPointer to the data buffer.
sizeSize of the data buffer (bytes).
Returns
PWP_TRUE on success. PWP_FALSE on failure.
Note
Data is written as-is. Endianness is not enforced.

Definition at line 495 of file apiPWPUtils.cxx.

References PwuUnfRecWriteArr().

Referenced by PwuUnfRecWriteINT8(), PwuUnfRecWriteUINT8(), and PwpUnformattedWriter::write().

◆ PwuUnfRecWriteEndianBuf()

PWP_BOOL PwuUnfRecWriteEndianBuf ( PWU_UNFDATA pUData,
const void *  buf,
size_t  size 
)

Write a data buffer to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
bufPointer to the data buffer.
sizeSize of the data buffer (bytes). Size must be an even value between 2 and 32.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 502 of file apiPWPUtils.cxx.

References PWU_UNFDATA::endianness, PwuApplyEndianness(), and PwuUnfRecWriteArr().

Referenced by PwuUnfRecWriteFLOAT(), PwuUnfRecWriteINT(), PwuUnfRecWriteINT16(), PwuUnfRecWriteINT32(), PwuUnfRecWriteINT64(), PwuUnfRecWriteREAL(), PwuUnfRecWriteUINT(), PwuUnfRecWriteUINT16(), PwuUnfRecWriteUINT32(), and PwuUnfRecWriteUINT64().

◆ PwuUnfRecWriteFLOAT()

PWP_BOOL PwuUnfRecWriteFLOAT ( PWU_UNFDATA pUData,
PWP_FLOAT  val 
)

Write a PWP_FLOAT value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 580 of file apiPWPUtils.cxx.

References PwuUnfRecWriteEndianBuf().

Referenced by PwpUnformattedWriter::write().

◆ PwuUnfRecWriteINT()

PWP_BOOL PwuUnfRecWriteINT ( PWU_UNFDATA pUData,
PWP_INT  val 
)

Write a PWP_INT value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 510 of file apiPWPUtils.cxx.

References PwuUnfRecWriteEndianBuf().

◆ PwuUnfRecWriteINT16()

PWP_BOOL PwuUnfRecWriteINT16 ( PWU_UNFDATA pUData,
PWP_INT16  val 
)

Write a PWP_INT16 value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 538 of file apiPWPUtils.cxx.

References PwuUnfRecWriteEndianBuf().

Referenced by PwpUnformattedWriter::write().

◆ PwuUnfRecWriteINT32()

PWP_BOOL PwuUnfRecWriteINT32 ( PWU_UNFDATA pUData,
PWP_INT32  val 
)

Write a PWP_INT32 value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 552 of file apiPWPUtils.cxx.

References PwuUnfRecWriteEndianBuf().

Referenced by PwpUnformattedWriter::write().

◆ PwuUnfRecWriteINT64()

PWP_BOOL PwuUnfRecWriteINT64 ( PWU_UNFDATA pUData,
PWP_INT64  val 
)

Write a PWP_INT64 value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 566 of file apiPWPUtils.cxx.

References PwuUnfRecWriteEndianBuf().

Referenced by PwpUnformattedWriter::write().

◆ PwuUnfRecWriteINT8()

PWP_BOOL PwuUnfRecWriteINT8 ( PWU_UNFDATA pUData,
PWP_INT8  val 
)

Write a PWP_INT8 value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 524 of file apiPWPUtils.cxx.

References PwuUnfRecWriteBuf().

Referenced by PwpUnformattedWriter::write().

◆ PwuUnfRecWriteREAL()

PWP_BOOL PwuUnfRecWriteREAL ( PWU_UNFDATA pUData,
PWP_REAL  val 
)

Write a PWP_REAL value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 587 of file apiPWPUtils.cxx.

References PwuUnfRecWriteEndianBuf().

Referenced by PwpUnformattedWriter::write().

◆ PwuUnfRecWriteUINT()

PWP_BOOL PwuUnfRecWriteUINT ( PWU_UNFDATA pUData,
PWP_UINT  val 
)

Write a PWP_UINT value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 517 of file apiPWPUtils.cxx.

References PwuUnfRecWriteEndianBuf().

◆ PwuUnfRecWriteUINT16()

PWP_BOOL PwuUnfRecWriteUINT16 ( PWU_UNFDATA pUData,
PWP_UINT16  val 
)

Write a PWP_UINT16 value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 545 of file apiPWPUtils.cxx.

References PwuUnfRecWriteEndianBuf().

Referenced by PwpUnformattedWriter::write().

◆ PwuUnfRecWriteUINT32()

PWP_BOOL PwuUnfRecWriteUINT32 ( PWU_UNFDATA pUData,
PWP_UINT32  val 
)

Write a PWP_UINT32 value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 559 of file apiPWPUtils.cxx.

References PwuUnfRecWriteEndianBuf().

Referenced by PwpUnformattedWriter::write().

◆ PwuUnfRecWriteUINT64()

PWP_BOOL PwuUnfRecWriteUINT64 ( PWU_UNFDATA pUData,
PWP_UINT64  val 
)

Write a PWP_UINT64 value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 573 of file apiPWPUtils.cxx.

References PwuUnfRecWriteEndianBuf().

Referenced by PwpUnformattedWriter::write().

◆ PwuUnfRecWriteUINT8()

PWP_BOOL PwuUnfRecWriteUINT8 ( PWU_UNFDATA pUData,
PWP_UINT8  val 
)

Write a PWP_UINT8 value to the current record with endian order applied.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfRecBegin() or PwuUnfRecBeginFixed().
valThe value to write.
Returns
PWP_TRUE on success. PWP_FALSE on failure.

Definition at line 531 of file apiPWPUtils.cxx.

References PwuUnfRecWriteBuf().

Referenced by PwpUnformattedWriter::write().

◆ PwuUnfTotRecBytes()

PWP_UINT32 PwuUnfTotRecBytes ( PWU_UNFDATA pUData)

Get the running total number of bytes written to all records during an unformatted file I/O session.

Parameters
pUDataPointer to an I/O control block already prepared by a call to PwuUnfFileBegin().
Returns
The total number of bytes written to all records so far.
Note
It is valid to call this function after PwuUnfFileEnd(). The internals are only cleared on a call to PwuUnfFileBegin().

Definition at line 623 of file apiPWPUtils.cxx.

References PWU_UNFDATA::totRecBytes, and UDATA_ISINIT.