| version 1.16, 2002/08/16 20:31:43 |
version 1.17, 2002/08/27 13:12:33 |
|
|
| |
|
| /* TODO: macros should not be in extern "C" { } */ |
/* TODO: macros should not be in extern "C" { } */ |
| |
|
| |
#ifndef PLATON_FUNC |
| |
# define PLATON_FUNC(_name) _name |
| |
#endif |
| |
#ifndef PLATON_FUNC_STR |
| |
# define PLATON_FUNC_STR(_name) #_name |
| |
#endif |
| |
|
| #ifdef __cplusplus |
#ifdef __cplusplus |
| extern "C" { |
extern "C" { |
| #endif |
#endif |
|
|
| |
|
| #define strendstr(__s1,__s2) (strstr(__s1,__s2) + strlen(__s2)) |
#define strendstr(__s1,__s2) (strstr(__s1,__s2) + strlen(__s2)) |
| |
|
| #ifdef PLATON_PREFIX |
char *PLATON_FUNC(strestr)(const char *s1, const char *s2); |
| char *FUNCTION(strestr)(const char *s1, const char *s2); |
char *PLATON_FUNC(stristr)(const char *s1, const char *s2); |
| char *FUNCTION(stristr)(const char *s1, const char *s2); |
|
| #else |
|
| char *strestr(const char *s1, const char *s2); |
|
| char *stristr(const char *s1, const char *s2); |
|
| #endif |
|
| |
|
| #define strcasestr(__s1, __s2) stristr(__s1, __s2) |
#define strcasestr(__s1, __s2) stristr(__s1, __s2) |
| |
|
| #ifdef PLATON_PREFIX |
char *PLATON_FUNC(str_white_str)(char *str, char *substr, int *size); |
| char *FUNCTION(str_white_str)(char *str, char *substr, int *size); |
|
| #else |
|
| char *str_white_str(char *str, char *substr, int *size); |
|
| #endif |
|
| |
|
| #define strwhitestr(str, substr, size) str_white_str(str, substr, size) |
#define strwhitestr(str, substr, size) str_white_str(str, substr, size) |
| #define strwstr(str, substr) str_white_str(str, substr, NULL) |
#define strwstr(str, substr) str_white_str(str, substr, NULL) |
|
|
| * strcnt_sepstr() - count number of separate substrings in string |
* strcnt_sepstr() - count number of separate substrings in string |
| */ |
*/ |
| |
|
| #ifdef PLATON_PREFIX |
int PLATON_FUNC(strcnt)(const char *str, const int c); |
| int FUNCTION(strcnt)(const char *str, const int c); |
int PLATON_FUNC(strcnt_str)(const char *str, const char *substr); |
| int FUNCTION(strcnt_str)(const char *str, const char *substr); |
int PLATON_FUNC(strcnt_sepstr)(const char *str, const char *substr); |
| int FUNCTION(strcnt_sepstr)(const char *str, const char *substr); |
|
| #else |
|
| int strcnt(const char *str, const int c); |
|
| int strcnt_str(const char *str, const char *substr); |
|
| int strcnt_sepstr(const char *str, const char *substr); |
|
| #endif |
|
| |
|
| /* |
/* |
| * Removing functions |
* Removing functions |
|
|
| * one space character |
* one space character |
| */ |
*/ |
| |
|
| #ifdef PLATON_PREFIX |
char *PLATON_FUNC(strdel)(char *s); |
| char *FUNCTION(strdel)(char *s); |
char *PLATON_FUNC(strrmlf)(char *s); |
| char *FUNCTION(strrmlf)(char *s); |
char *PLATON_FUNC(strrmcr)(char *s); |
| char *FUNCTION(strrmcr)(char *s); |
|
| #else |
|
| char *strdel(char *s); |
|
| char *strrmlf(char *s); |
|
| char *strrmcr(char *s); |
|
| #endif |
|
| |
|
| #define strrmeol(__s) strrmcr(strrmlf(__s)) |
#define strrmeol(__s) strrmcr(strrmlf(__s)) |
| #define strrmcrlf(__s) strrmeol(__s) |
#define strrmcrlf(__s) strrmeol(__s) |
| #define strrmlfcr(__s) strrmeol(__s) |
#define strrmlfcr(__s) strrmeol(__s) |
| |
|
| #ifdef PLATON_PREFIX |
char *PLATON_FUNC(str_left_trim)(char *s); |
| char *FUNCTION(str_left_trim)(char *s); |
char *PLATON_FUNC(str_right_trim)(char *s); |
| char *FUNCTION(str_right_trim)(char *s); |
char *PLATON_FUNC(str_trim_whitechars)(char *s); |
| char *FUNCTION(str_trim_whitechars)(char *s); |
# define ltrim(s) PLATON_FUNC(str_left_trim)(s) |
| # define ltrim(s) FUNCTION(str_left_trim)(s) |
# define rtrim(s) PLATON_FUNC(str_right_trim)(s) |
| # define rtrim(s) FUNCTION(str_right_trim)(s) |
|
| |
|
| #else |
|
| char *str_left_trim(char *s); |
|
| char *str_right_trim(char *s); |
|
| char *str_trim_whitechars(char *s); |
|
| # define ltrim(s) str_left_trim(s) |
|
| # define rtrim(s) str_right_trim(s) |
|
| |
|
| #endif |
|
| |
|
| #define trim(s) rtrim(ltrim(s)) |
#define trim(s) rtrim(ltrim(s)) |
| #define strtrim(s) trim(s) |
#define strtrim(s) trim(s) |
|
|
| * strins() - function inserts string ins at position str; |
* strins() - function inserts string ins at position str; |
| * there MUST be enough memory allocated in str |
* there MUST be enough memory allocated in str |
| */ |
*/ |
| #ifdef PLATON_PREFIX |
char *PLATON_FUNC(strins)(char *str, char *ins); |
| char *FUNCTION(strins)(char *str, char *ins); |
|
| #else |
|
| char *strins(char *str, char *ins); |
|
| #endif |
|
| |
|
| /* |
/* |
| * Comparing functions |
* Comparing functions |
|
|
| * strrcmp() - compares two string in reverse order |
* strrcmp() - compares two string in reverse order |
| */ |
*/ |
| |
|
| #ifdef PLATON_PREFIX |
int PLATON_FUNC(strrcmp)(const char *s1, const char *s2); |
| int FUNCTION(strrcmp)(const char *s1, const char *s2); |
|
| #else |
|
| int strrcmp(const char *s1, const char *s2); |
|
| #endif |
|
| |
|
| #ifdef __cplusplus |
#ifdef __cplusplus |
| } |
} |