| version 1.6, 2002/07/16 22:26:16 |
version 1.7, 2002/09/19 23:18:00 |
|
|
| * Special file-oriented functions header file * |
* Special file-oriented functions header file * |
| * * |
* * |
| * Programmed by Ondrej Jombik <nepto@pobox.sk> * |
* Programmed by Ondrej Jombik <nepto@pobox.sk> * |
| * (c) Copyright 2000 Condy software inc. * |
* Copyright (c) 2000 Condy software inc. * |
| * (c) Copyright 2001-2002 Platon software development group * |
* Copyright (c) 2001-2002 Platon software development group * |
| * All rights reserved. * |
* All rights reserved. * |
| * * |
* * |
| * Updates: 20.4.2000, 5.10.2001 * |
* Updates: 20.4.2000, 5.10.2001 * |
|
|
| * * |
* * |
| **************************************************************************/ |
**************************************************************************/ |
| |
|
| #ifndef _PLATON_UTILS_FILEPLUS_H |
/** |
| #define _PLATON_UTILS_FILEPLUS_H |
* @file misc/fileplus.h |
| |
* @brief File sorting functions |
| |
* @author Ondrej Jombik <nepto@pobox.sk> |
| |
* @version \$Id$ |
| |
* @date 2001-2002 |
| |
*/ |
| |
|
| |
#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 { |
enum __fsort_mode { |
| __FSORT_SORTONLY = 0, |
__FSORT_SORTONLY = 0, |
| __FSORT_SORT = 0, |
__FSORT_SORT = 0, |
| Line 23 enum __fsort_mode { |
|
| Line 35 enum __fsort_mode { |
|
| __FSORT_REMOVE = 1 |
__FSORT_REMOVE = 1 |
| }; |
}; |
| |
|
| |
/** |
| |
* File sort modes type definitio |
| |
* @internal dummy text to make silly Doxygen happy |
| |
*/ |
| typedef enum __fsort_mode __FSORT_MODE; |
typedef enum __fsort_mode __FSORT_MODE; |
| |
|
| /* Maximum line length (size) of sorted file. */ |
/** Maximum line length (size) of sorted file */ |
| #ifndef FSORT_LINESIZE |
#ifndef FSORT_LINESIZE |
| # define FSORT_LINESIZE 200 |
# define FSORT_LINESIZE 200 |
| #endif |
#endif |
| |
|
| /* |
/** |
| * Sorts lines of file __fname with function __fsfnc. |
* Sorts file by lines |
| * Returns -1 on error, 0 on success. |
* |
| |
* @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) |
#define filesort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_SORTONLY) |
| |
/** Alias for filesort() */ |
| #define fsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_SORTONLY) |
#define fsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_SORTONLY) |
| |
|
| /* |
/** |
| * Sorts lines of file __fname with function __fsfnc. |
* Sorts file with removing duplicate lines |
| * It also removes duplicate lines. |
* |
| * Returns -1 on error, 0 on success. |
* @param __fname filename to sort |
| |
* @param __fsfnc sorting function, such as strcmp() |
| |
* @return -1 on error, 0 on success |
| */ |
*/ |
| #define frmsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_RMSORT) |
|
| #define filermsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_RMSORT) |
#define filermsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_RMSORT) |
| |
/** Alias for filermsort() */ |
| |
#define frmsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_RMSORT) |
| |
|
| #ifdef __cplusplus |
#ifdef __cplusplus |
| extern "C" { |
extern "C" { |
| #endif |
#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( |
int __fsort( |
| const char *filename, |
const char *filename, |
| int (*fsfnc) (const char*,const char*), |
int (*fsfnc) (const char*,const char*), |
|
|
| } |
} |
| #endif |
#endif |
| |
|
| #endif /* #ifndef _PLATON_UTILS_FILEPLUS_H */ |
#endif /* #ifndef _PLATON_MISC_FILEPLUS_H */ |
| |
|