| version 1.5, 2002/03/28 21:41:57 |
version 1.6, 2002/07/16 22:26:16 |
|
|
| * All rights reserved. * |
* All rights reserved. * |
| * * |
* * |
| * Updates: 20.4.2000, 5.10.2001 * |
* Updates: 20.4.2000, 5.10.2001 * |
| |
* 16.7.2002 - on non-MSDOS systems is mkstep() used instead tmpnam() * |
| |
* - slovak comments changed to english * |
| * * |
* * |
| **************************************************************************/ |
**************************************************************************/ |
| |
|
| #ifndef _PLATON_UTILS_FILEPLUS_H |
#ifndef _PLATON_UTILS_FILEPLUS_H |
| #define _PLATON_UTILS_FILEPLUS_H |
#define _PLATON_UTILS_FILEPLUS_H |
| |
|
| typedef enum __fsort_mode { |
enum __fsort_mode { |
| __FSORT_SORTONLY=0, |
__FSORT_SORTONLY = 0, |
| __FSORT_SORT=0, |
__FSORT_SORT = 0, |
| __FSORT_RMSORT=1, |
__FSORT_RMSORT = 1, |
| __FSORT_REMOVE=1 |
__FSORT_REMOVE = 1 |
| } __FSORT_MODE; |
}; |
| |
|
| /* Maximalna mozna velkost riadku triedeneho suboru. */ |
typedef enum __fsort_mode __FSORT_MODE; |
| |
|
| |
/* Maximum line length (size) of sorted file. */ |
| #ifndef FSORT_LINESIZE |
#ifndef FSORT_LINESIZE |
| #define FSORT_LINESIZE 200 |
# define FSORT_LINESIZE 200 |
| #endif |
#endif |
| |
|
| /* Utiedi riadky suboru funkciou fsfnc(). */ |
/* |
| /* Vracia -1 pri chybe, inak 0. */ |
* Sorts lines of file __fname with function __fsfnc. |
| #define filesort(__fname,__fsfnc) fsort(__fname,__fsfnc) |
* Returns -1 on error, 0 on success. |
| #define fsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_SORTONLY) |
*/ |
| |
#define filesort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_SORTONLY) |
| /* Utiedi a vymaze zhodne riadky suboru. Triedi sa funkciou fsfnc(). */ |
#define fsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_SORTONLY) |
| /* Vracia -1 pri chybe, inak 0. */ |
|
| #define frmsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_RMSORT) |
/* |
| #define filermsort(__fname,__fsfnc) frmsort(__fname,__fsfnc) |
* Sorts lines of file __fname with function __fsfnc. |
| |
* It also removes duplicate lines. |
| |
* Returns -1 on error, 0 on success. |
| |
*/ |
| |
#define frmsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_RMSORT) |
| |
#define filermsort(__fname,__fsfnc) __fsort(__fname,__fsfnc,__FSORT_RMSORT) |
| |
|
| #ifdef __cplusplus |
#ifdef __cplusplus |
| extern "C" { |
extern "C" { |
| #endif |
#endif |
| |
|
| int __fsort( |
int __fsort( |
| const char *filename, |
const char *filename, |
| int (*fsfnc) (const char*,const char*), |
int (*fsfnc) (const char*,const char*), |
| __FSORT_MODE mode |
__FSORT_MODE mode |
| ); |
); |
| |
|
| #ifdef __cplusplus |
#ifdef __cplusplus |
| } |
} |