tl.h
/* tl.h - TEXTLINES header file
** MG 9/16/97
*/
/* The TEXTLINES structure */
typedef struct _tagTEXTLINES
{
short LineCount, /* # of lines in structure */
Max; /* Maximum # of lines we can hold */
char ** Lines; /* The lines of data */
} TEXTLINES;
/* Define the grow-by value for TEXTLINES */
#define TLGROWBY 16
/* Some macros */
#define TLGetCount(x) ((x)->LineCount)
#define TLAppend(x,s) (TLInsert(x,-1,s))
#define TLMoveUp(x,i) (TLSwap(x,i,i-1))
#define TLMoveDown(x,i) (TLSwap(x,i,i+1))
/* Define error codes used by TEXTLINES and ErrMsg */
enum ERR_CODE { ERR_OK, ERR_BADINDEX, ERR_NOMEM, ERR_NOOPEN };
/* Prototypes */
TEXTLINES * TLConstruct( void );
void TLDestruct( TEXTLINES * Dest );
int TLResize( TEXTLINES * Dest, int Count );
int TLInsert( TEXTLINES * Dest, int Index, char *Src );
int TLRemove( TEXTLINES * Dest, int Index );
void TLClear( TEXTLINES * Dest );
int TLSwap( TEXTLINES * Dest, int A, int B );
int TLLoadFromFile( TEXTLINES * Dest, char * Filename, int ClearFirst );
int TLSaveToFile( TEXTLINES * Src, char * Filename );
int TLEzSortICmp( const void* A, const void* B );
int TLEzSortCmp( const void* A, const void* B );
void TLEzSort( TEXTLINES * Dest, int Sensitive );
void ErrMsg( int ErrCode, int Exit );
int Trim( char *Src );
#define ErrMsgExit(c) (ErrMsg(c,1))