00001 /** @file psLine.h 00002 * 00003 * @brief charater-string fixed-length line functions 00004 * 00005 * The psLine functions allow manipulation of fixed-length lines. 00006 * 00007 * @author EAM, IFA 00008 * @author Paul Price, IFA 00009 * @author David Robbins, MHPCC 00010 * 00011 * @version $Revision: 1.6 $ $Name: $ 00012 * @date $Date: 2007/02/03 06:01:42 $ 00013 * 00014 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii 00015 */ 00016 00017 #ifndef PS_LINE_H 00018 #define PS_LINE_H 00019 00020 /// @addtogroup SysUtils System Utilities 00021 /// @{ 00022 00023 /** Structure to carry a dynamic string */ 00024 typedef struct 00025 { 00026 long NLINE; ///< allocated length 00027 long Nline; ///< current length 00028 psString line; ///< character string data 00029 } 00030 psLine; 00031 00032 /** Allocates a line object of length Nline. 00033 * 00034 * @return psLine*: the newly allocated line object. 00035 */ 00036 psLine *psLineAlloc( 00037 long Nline ///< length of line object to allocate 00038 ); 00039 00040 /** Checks the type of a particular pointer. 00041 * 00042 * Uses the appropriate deallocation function in psMemBlock to check the ptr datatype. 00043 * 00044 * @return bool: True if the pointer matches a psLine structure, false otherwise. 00045 */ 00046 bool psMemCheckLine( 00047 psPtr ptr ///< the pointer whose type to check 00048 ); 00049 00050 /** Initializes or re-initializes a line. 00051 * 00052 * Initializes or re-initializes a line, setting the current length to zero and setting 00053 * the string data values to 0. If the function is passed NULL, false is returned. 00054 * 00055 * @return bool: True if successful, otherwise false. 00056 */ 00057 bool psLineInit( 00058 psLine *line ///< line to (re-)initialize 00059 ); 00060 00061 /** Adds the line segment to the string. 00062 * 00063 * Appends a line segment to the string, returning false if the new segment would 00064 * overflow the allocated string length. 00065 * 00066 * @return bool: True if successful, otherwise false. 00067 */ 00068 bool psLineAdd( 00069 psLine *line, ///< the line segment to append 00070 const char *format, ///< printf-style format of line 00071 ... ///< any parameters required in format 00072 ); 00073 00074 /// @} 00075 #endif /* PS_LINE_H */
1.5.1