/************************************************************************** * * * File sorting functions * * * * Programmed by Ondrej Jombik * * Copyright (c) 2000 Condy software inc. * * Copyright (c) 2001-2003 Platon Software Development Group * * All rights reserved. * * * * Updates: 20.4.2000, 5.10.2001 * * 16.7.2002 - on non-MSDOS systems is mkstep() used instead tmpnam() * * - slovak comments changed to english * * * **************************************************************************/ /** * File sorting functions * * @file platon/misc/fileplus.h * @author Ondrej Jombik * @version \$Platon: libplaton/platon/misc/fileplus.h,v 1.11 2003/04/23 19:28:35 nepto Exp $ * @date 2000-2003 */ #ifndef _PLATON_MISC_FILEPLUS_H #define _PLATON_MISC_FILEPLUS_H /** * File sort modes enumeration * @internal dummy text to make silly Doxygen happy */ enum __fsort_mode { __FSORT_SORTONLY = 0, __FSORT_SORT = 0, __FSORT_RMSORT = 1, __FSORT_REMOVE = 1 }; /** * File sort modes type definitio * @internal dummy text to make silly Doxygen happy */ typedef enum __fsort_mode __FSORT_MODE; /** Maximum line length (size) of sorted file */ #ifndef FSORT_LINESIZE # define FSORT_LINESIZE 200 #endif /** * Sorts file by lines * * @param __fname filename to sort * @param __fsfnc sorting function, such as strcmp() * @return -1 on error, 0 on success */ #define filesort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_SORTONLY) /** Alias for filesort() */ #define fsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_SORTONLY) /** * Sorts file with removing duplicate lines * * @param __fname filename to sort * @param __fsfnc sorting function, such as strcmp() * @return -1 on error, 0 on success */ #define filermsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_RMSORT) /** Alias for filermsort() */ #define frmsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_RMSORT) #ifdef __cplusplus extern "C" { #endif /** * File sorting core function * * @internal dummy text to make silly Doxygen happy * this must be at the beginning, else Doxygen will f*ck this up * @param filename filename to sort * @param fsfnc sorting function, such as strcmp() * @param mode sorting mode, see @ref __fsort_mode * @return -1 on error, 0 on success */ int __fsort( const char *filename, int (*fsfnc) (const char*,const char*), __FSORT_MODE mode ); #ifdef __cplusplus } #endif #endif /* #ifndef _PLATON_MISC_FILEPLUS_H */