added qse_mbscmp()/qse_wcscmp() and related functions while doing similar things for character class handling
This commit is contained in:
parent
794b0f8c47
commit
c3f6340f9e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: chr.h 356 2010-09-07 12:29:25Z hyunghwan.chung $
|
||||
* $Id: chr.h 413 2011-03-25 04:36:43Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -42,71 +42,156 @@ enum qse_ccls_id_t
|
||||
QSE_CCLS_PUNCT
|
||||
};
|
||||
typedef enum qse_ccls_id_t qse_ccls_id_t;
|
||||
typedef qse_ccls_id_t qse_mccls_id_t;
|
||||
typedef qse_ccls_id_t qse_wccls_id_t;
|
||||
|
||||
#define QSE_MCCLS_UPPER QSE_CCLS_UPPER
|
||||
#define QSE_MCCLS_LOWER QSE_CCLS_LOWER
|
||||
#define QSE_MCCLS_ALPHA QSE_CCLS_ALPHA
|
||||
#define QSE_MCCLS_DIGIT QSE_CCLS_DIGIT
|
||||
#define QSE_MCCLS_XDIGIT QSE_CCLS_XDIGIT
|
||||
#define QSE_MCCLS_ALNUM QSE_CCLS_ALNUM
|
||||
#define QSE_MCCLS_SPACE QSE_CCLS_SPACE
|
||||
#define QSE_MCCLS_PRINT QSE_CCLS_PRINT
|
||||
#define QSE_MCCLS_GRAPH QSE_CCLS_GRAPH
|
||||
#define QSE_MCCLS_CNTRL QSE_CCLS_CNTRL
|
||||
#define QSE_MCCLS_PUNCT QSE_CCLS_PUNCT
|
||||
|
||||
#define QSE_WCCLS_UPPER QSE_CCLS_UPPER
|
||||
#define QSE_WCCLS_LOWER QSE_CCLS_LOWER
|
||||
#define QSE_WCCLS_ALPHA QSE_CCLS_ALPHA
|
||||
#define QSE_WCCLS_DIGIT QSE_CCLS_DIGIT
|
||||
#define QSE_WCCLS_XDIGIT QSE_CCLS_XDIGIT
|
||||
#define QSE_WCCLS_ALNUM QSE_CCLS_ALNUM
|
||||
#define QSE_WCCLS_SPACE QSE_CCLS_SPACE
|
||||
#define QSE_WCCLS_PRINT QSE_CCLS_PRINT
|
||||
#define QSE_WCCLS_GRAPH QSE_CCLS_GRAPH
|
||||
#define QSE_WCCLS_CNTRL QSE_CCLS_CNTRL
|
||||
#define QSE_WCCLS_PUNCT QSE_CCLS_PUNCT
|
||||
|
||||
#ifdef USE_STDC
|
||||
# if defined(QSE_CHAR_IS_MCHAR)
|
||||
# include <ctype.h>
|
||||
# define QSE_ISUPPER(c) isupper(c)
|
||||
# define QSE_ISLOWER(c) islower(c)
|
||||
# define QSE_ISALPHA(c) isalpha(c)
|
||||
# define QSE_ISDIGIT(c) isdigit(c)
|
||||
# define QSE_ISXDIGIT(c) isxdigit(c)
|
||||
# define QSE_ISALNUM(c) isalnum(c)
|
||||
# define QSE_ISSPACE(c) isspace(c)
|
||||
# define QSE_ISPRINT(c) isprint(c)
|
||||
# define QSE_ISGRAPH(c) isgraph(c)
|
||||
# define QSE_ISCNTRL(c) iscntrl(c)
|
||||
# define QSE_ISPUNCT(c) ispunct(c)
|
||||
# define QSE_TOUPPER(c) toupper(c)
|
||||
# define QSE_TOLOWER(c) tolower(c)
|
||||
# elif defined(QSE_CHAR_IS_WCHAR)
|
||||
# include <wctype.h>
|
||||
# define QSE_ISUPPER(c) iswupper(c)
|
||||
# define QSE_ISLOWER(c) iswlower(c)
|
||||
# define QSE_ISALPHA(c) iswalpha(c)
|
||||
# define QSE_ISDIGIT(c) iswdigit(c)
|
||||
# define QSE_ISXDIGIT(c) iswxdigit(c)
|
||||
# define QSE_ISALNUM(c) iswalnum(c)
|
||||
# define QSE_ISSPACE(c) iswspace(c)
|
||||
# define QSE_ISPRINT(c) iswprint(c)
|
||||
# define QSE_ISGRAPH(c) iswgraph(c)
|
||||
# define QSE_ISCNTRL(c) iswcntrl(c)
|
||||
# define QSE_ISPUNCT(c) iswpunct(c)
|
||||
# define QSE_TOUPPER(c) towupper(c)
|
||||
# define QSE_TOLOWER(c) towlower(c)
|
||||
# else
|
||||
# error Unsupported character type
|
||||
# endif
|
||||
# include <ctype.h>
|
||||
# include <wctype.h>
|
||||
#
|
||||
# define QSE_ISUPPER(c) isupper(c)
|
||||
# define QSE_ISLOWER(c) islower(c)
|
||||
# define QSE_ISALPHA(c) isalpha(c)
|
||||
# define QSE_ISDIGIT(c) isdigit(c)
|
||||
# define QSE_ISXDIGIT(c) isxdigit(c)
|
||||
# define QSE_ISALNUM(c) isalnum(c)
|
||||
# define QSE_ISSPACE(c) isspace(c)
|
||||
# define QSE_ISPRINT(c) isprint(c)
|
||||
# define QSE_ISGRAPH(c) isgraph(c)
|
||||
# define QSE_ISCNTRL(c) iscntrl(c)
|
||||
# define QSE_ISPUNCT(c) ispunct(c)
|
||||
# define QSE_TOUPPER(c) toupper(c)
|
||||
# define QSE_TOLOWER(c) tolower(c)
|
||||
#
|
||||
# define QSE_ISUPPER(c) iswupper(c)
|
||||
# define QSE_ISLOWER(c) iswlower(c)
|
||||
# define QSE_ISALPHA(c) iswalpha(c)
|
||||
# define QSE_ISDIGIT(c) iswdigit(c)
|
||||
# define QSE_ISXDIGIT(c) iswxdigit(c)
|
||||
# define QSE_ISALNUM(c) iswalnum(c)
|
||||
# define QSE_ISSPACE(c) iswspace(c)
|
||||
# define QSE_ISPRINT(c) iswprint(c)
|
||||
# define QSE_ISGRAPH(c) iswgraph(c)
|
||||
# define QSE_ISCNTRL(c) iswcntrl(c)
|
||||
# define QSE_ISPUNCT(c) iswpunct(c)
|
||||
# define QSE_TOUPPER(c) towupper(c)
|
||||
# define QSE_TOLOWER(c) towlower(c)
|
||||
#else
|
||||
# define QSE_ISUPPER(c) (qse_ccls_is(c,QSE_CCLS_UPPER))
|
||||
# define QSE_ISLOWER(c) (qse_ccls_is(c,QSE_CCLS_LOWER))
|
||||
# define QSE_ISALPHA(c) (qse_ccls_is(c,QSE_CCLS_ALPHA))
|
||||
# define QSE_ISDIGIT(c) (qse_ccls_is(c,QSE_CCLS_DIGIT))
|
||||
# define QSE_ISXDIGIT(c) (qse_ccls_is(c,QSE_CCLS_XDIGIT))
|
||||
# define QSE_ISALNUM(c) (qse_ccls_is(c,QSE_CCLS_ALNUM))
|
||||
# define QSE_ISSPACE(c) (qse_ccls_is(c,QSE_CCLS_SPACE))
|
||||
# define QSE_ISPRINT(c) (qse_ccls_is(c,QSE_CCLS_PRINT))
|
||||
# define QSE_ISGRAPH(c) (qse_ccls_is(c,QSE_CCLS_GRAPH))
|
||||
# define QSE_ISCNTRL(c) (qse_ccls_is(c,QSE_CCLS_CNTRL))
|
||||
# define QSE_ISPUNCT(c) (qse_ccls_is(c,QSE_CCLS_PUNCT))
|
||||
# define QSE_TOUPPER(c) (qse_ccls_to(c,QSE_CCLS_UPPER))
|
||||
# define QSE_TOLOWER(c) (qse_ccls_to(c,QSE_CCLS_LOWER))
|
||||
# define QSE_ISMUPPER(c) (qse_mccls_is(c,QSE_CCLS_UPPER))
|
||||
# define QSE_ISMLOWER(c) (qse_mccls_is(c,QSE_CCLS_LOWER))
|
||||
# define QSE_ISMALPHA(c) (qse_mccls_is(c,QSE_CCLS_ALPHA))
|
||||
# define QSE_ISMDIGIT(c) (qse_mccls_is(c,QSE_CCLS_DIGIT))
|
||||
# define QSE_ISMXDIGIT(c) (qse_mccls_is(c,QSE_CCLS_XDIGIT))
|
||||
# define QSE_ISMALNUM(c) (qse_mccls_is(c,QSE_CCLS_ALNUM))
|
||||
# define QSE_ISMSPACE(c) (qse_mccls_is(c,QSE_CCLS_SPACE))
|
||||
# define QSE_ISMPRINT(c) (qse_mccls_is(c,QSE_CCLS_PRINT))
|
||||
# define QSE_ISMGRAPH(c) (qse_mccls_is(c,QSE_CCLS_GRAPH))
|
||||
# define QSE_ISMCNTRL(c) (qse_mccls_is(c,QSE_CCLS_CNTRL))
|
||||
# define QSE_ISMPUNCT(c) (qse_mccls_is(c,QSE_CCLS_PUNCT))
|
||||
# define QSE_TOMUPPER(c) (qse_mccls_to(c,QSE_CCLS_UPPER))
|
||||
# define QSE_TOMLOWER(c) (qse_mccls_to(c,QSE_CCLS_LOWER))
|
||||
#
|
||||
# define QSE_ISWUPPER(c) (qse_wccls_is(c,QSE_CCLS_UPPER))
|
||||
# define QSE_ISWLOWER(c) (qse_wccls_is(c,QSE_CCLS_LOWER))
|
||||
# define QSE_ISWALPHA(c) (qse_wccls_is(c,QSE_CCLS_ALPHA))
|
||||
# define QSE_ISWDIGIT(c) (qse_wccls_is(c,QSE_CCLS_DIGIT))
|
||||
# define QSE_ISWXDIGIT(c) (qse_wccls_is(c,QSE_CCLS_XDIGIT))
|
||||
# define QSE_ISWALNUM(c) (qse_wccls_is(c,QSE_CCLS_ALNUM))
|
||||
# define QSE_ISWSPACE(c) (qse_wccls_is(c,QSE_CCLS_SPACE))
|
||||
# define QSE_ISWPRINT(c) (qse_wccls_is(c,QSE_CCLS_PRINT))
|
||||
# define QSE_ISWGRAPH(c) (qse_wccls_is(c,QSE_CCLS_GRAPH))
|
||||
# define QSE_ISWCNTRL(c) (qse_wccls_is(c,QSE_CCLS_CNTRL))
|
||||
# define QSE_ISWPUNCT(c) (qse_wccls_is(c,QSE_CCLS_PUNCT))
|
||||
# define QSE_TOWUPPER(c) (qse_wccls_to(c,QSE_CCLS_UPPER))
|
||||
# define QSE_TOWLOWER(c) (qse_wccls_to(c,QSE_CCLS_LOWER))
|
||||
#endif
|
||||
|
||||
#ifdef QSE_CHAR_IS_MCHAR
|
||||
# define QSE_ISUPPER(c) QSE_ISMUPPER(c)
|
||||
# define QSE_ISLOWER(c) QSE_ISMLOWER(c)
|
||||
# define QSE_ISALPHA(c) QSE_ISMALPHA(c)
|
||||
# define QSE_ISDIGIT(c) QSE_ISMDIGIT(c)
|
||||
# define QSE_ISXDIGIT(c) QSE_ISMXDIGIT(c)
|
||||
# define QSE_ISALNUM(c) QSE_ISMALNUM(c)
|
||||
# define QSE_ISSPACE(c) QSE_ISMSPACE(c)
|
||||
# define QSE_ISPRINT(c) QSE_ISMPRINT(c)
|
||||
# define QSE_ISGRAPH(c) QSE_ISMGRAPH(c)
|
||||
# define QSE_ISCNTRL(c) QSE_ISMCNTRL(c)
|
||||
# define QSE_ISPUNCT(c) QSE_ISMPUNCT(c)
|
||||
# define QSE_TOUPPER(c) QSE_TOMUPPER(c)
|
||||
# define QSE_TOLOWER(c) QSE_TOMLOWER(c)
|
||||
#else
|
||||
# define QSE_ISUPPER(c) QSE_ISWUPPER(c)
|
||||
# define QSE_ISLOWER(c) QSE_ISWLOWER(c)
|
||||
# define QSE_ISALPHA(c) QSE_ISWALPHA(c)
|
||||
# define QSE_ISDIGIT(c) QSE_ISWDIGIT(c)
|
||||
# define QSE_ISXDIGIT(c) QSE_ISWXDIGIT(c)
|
||||
# define QSE_ISALNUM(c) QSE_ISWALNUM(c)
|
||||
# define QSE_ISSPACE(c) QSE_ISWSPACE(c)
|
||||
# define QSE_ISPRINT(c) QSE_ISWPRINT(c)
|
||||
# define QSE_ISGRAPH(c) QSE_ISWGRAPH(c)
|
||||
# define QSE_ISCNTRL(c) QSE_ISWCNTRL(c)
|
||||
# define QSE_ISPUNCT(c) QSE_ISWPUNCT(c)
|
||||
# define QSE_TOUPPER(c) QSE_TOWUPPER(c)
|
||||
# define QSE_TOLOWER(c) QSE_TOWLOWER(c)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
qse_bool_t qse_ccls_is (
|
||||
qse_cint_t c,
|
||||
qse_ccls_id_t type
|
||||
qse_bool_t qse_mccls_is (
|
||||
qse_mcint_t c,
|
||||
qse_mccls_id_t type
|
||||
);
|
||||
|
||||
qse_cint_t qse_ccls_to (
|
||||
qse_cint_t c,
|
||||
qse_ccls_id_t type
|
||||
qse_bool_t qse_wccls_is (
|
||||
qse_wcint_t c,
|
||||
qse_wccls_id_t type
|
||||
);
|
||||
|
||||
qse_mcint_t qse_mccls_to (
|
||||
qse_mcint_t c,
|
||||
qse_mccls_id_t type
|
||||
);
|
||||
|
||||
qse_wcint_t qse_wccls_to (
|
||||
qse_wcint_t c,
|
||||
qse_wccls_id_t type
|
||||
);
|
||||
|
||||
#ifdef QSE_CHAR_IS_MCHAR
|
||||
# define qse_ccls_is(c,type) qse_mccls_is(c,type);
|
||||
# define qse_ccls_to(c,type) qse_mccls_to(c,type);
|
||||
#else
|
||||
# define qse_ccls_is(c,type) qse_wccls_is(c,type);
|
||||
# define qse_ccls_to(c,type) qse_wccls_to(c,type);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The qse_mblen() function scans a multibyte sequence to get the number of
|
||||
* bytes needed to form a wide character. It does not scan more than @a mblen
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fio.h 402 2011-03-18 15:07:21Z hyunghwan.chung $
|
||||
* $Id: fio.h 413 2011-03-25 04:36:43Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -78,7 +78,7 @@ enum qse_fio_mode_t
|
||||
QSE_FIO_XOTH = 00001 /* can be executed by others */
|
||||
};
|
||||
|
||||
#if defined (_WIN32)
|
||||
#if defined(_WIN32)
|
||||
/* <winnt.h> => typedef PVOID HANDLE; */
|
||||
typedef void* qse_fio_hnd_t;
|
||||
#elif defined(__OS2__)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: sll.h 356 2010-09-07 12:29:25Z hyunghwan.chung $
|
||||
* $Id: sll.h 413 2011-03-25 04:36:43Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -133,8 +133,8 @@ struct qse_sll_node_t
|
||||
|
||||
#define QSE_SLL_HEAD(sll) ((sll)->head)
|
||||
#define QSE_SLL_TAIL(sll) ((sll)->tail)
|
||||
#define QSE_SLL_SIZE(sll) ((const qse_size_t)(sll)->size)
|
||||
#define QSE_SLL_SCALE(sll) ((const int)(sll)->scale)
|
||||
#define QSE_SLL_SIZE(sll) ((sll)->size)
|
||||
#define QSE_SLL_SCALE(sll) ((sll)->scale)
|
||||
|
||||
/**
|
||||
* The QSE_SLL_DPTR macro gets the data pointer in a node.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: str.h 411 2011-03-24 14:20:55Z hyunghwan.chung $
|
||||
* $Id: str.h 413 2011-03-25 04:36:43Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -473,37 +473,67 @@ qse_size_t qse_strxncat (
|
||||
qse_size_t len
|
||||
);
|
||||
|
||||
int qse_strcmp (
|
||||
const qse_char_t* s1,
|
||||
const qse_char_t* s2
|
||||
|
||||
int qse_mbscmp (
|
||||
const qse_mchar_t* s1,
|
||||
const qse_mchar_t* s2
|
||||
);
|
||||
|
||||
int qse_strxcmp (
|
||||
const qse_char_t* s1,
|
||||
qse_size_t len1,
|
||||
const qse_char_t* s2
|
||||
int qse_wcscmp (
|
||||
const qse_wchar_t* s1,
|
||||
const qse_wchar_t* s2
|
||||
);
|
||||
|
||||
int qse_strxncmp (
|
||||
const qse_char_t* s1,
|
||||
qse_size_t len1,
|
||||
const qse_char_t* s2,
|
||||
qse_size_t len2
|
||||
int qse_mbsxcmp (
|
||||
const qse_mchar_t* s1,
|
||||
qse_size_t ln1,
|
||||
const qse_mchar_t* s2
|
||||
);
|
||||
|
||||
int qse_strcasecmp (
|
||||
const qse_char_t* s1,
|
||||
const qse_char_t* s2
|
||||
int qse_wcsxcmp (
|
||||
const qse_wchar_t* s1,
|
||||
qse_size_t ln1,
|
||||
const qse_wchar_t* s2
|
||||
);
|
||||
|
||||
int qse_strxcasecmp (
|
||||
const qse_char_t* s1,
|
||||
qse_size_t len,
|
||||
const qse_char_t* s2
|
||||
int qse_mbsxncmp (
|
||||
const qse_mchar_t* s1,
|
||||
qse_size_t ln1,
|
||||
const qse_mchar_t* s2,
|
||||
qse_size_t ln2
|
||||
);
|
||||
|
||||
int qse_wcsxncmp (
|
||||
const qse_wchar_t* s1,
|
||||
qse_size_t ln1,
|
||||
const qse_wchar_t* s2,
|
||||
qse_size_t ln2
|
||||
);
|
||||
|
||||
int qse_mbscasecmp (
|
||||
const qse_mchar_t* s1,
|
||||
const qse_mchar_t* s2
|
||||
);
|
||||
|
||||
int qse_wcscasecmp (
|
||||
const qse_wchar_t* s1,
|
||||
const qse_wchar_t* s2
|
||||
);
|
||||
|
||||
int qse_mbsxcasecmp (
|
||||
const qse_mchar_t* s1,
|
||||
qse_size_t ln,
|
||||
const qse_mchar_t* s2
|
||||
);
|
||||
|
||||
int qse_wcsxcasecmp (
|
||||
const qse_wchar_t* s1,
|
||||
qse_size_t ln,
|
||||
const qse_wchar_t* s2
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_strxncasecmp() function compares characters at the same position
|
||||
* The qse_mbsxncasecmp() function compares characters at the same position
|
||||
* in each string after converting them to the same case temporarily.
|
||||
* It accepts two strings and a character class handler. A string is
|
||||
* represented by its beginning pointer and length.
|
||||
@ -514,7 +544,7 @@ int qse_strxcasecmp (
|
||||
*
|
||||
* The following code snippet compares "foo" and "FoO" case-insenstively.
|
||||
* @code
|
||||
* qse_strxncasecmp (QSE_T("foo"), 3, QSE_T("FoO"), 3);
|
||||
* qse_mbsxncasecmp (QSE_MT("foo"), 3, QSE_MT("FoO"), 3);
|
||||
* @endcode
|
||||
*
|
||||
* @return 0 if two strings are equal,
|
||||
@ -522,13 +552,59 @@ int qse_strxcasecmp (
|
||||
* -1 if the second string is larger.
|
||||
*
|
||||
*/
|
||||
int qse_strxncasecmp (
|
||||
const qse_char_t* s1, /**< pointer to the first string */
|
||||
qse_size_t len1, /**< length of the first string */
|
||||
const qse_char_t* s2, /**< pointer to the second string */
|
||||
qse_size_t len2 /**< length of the second string */
|
||||
int qse_mbsxncasecmp (
|
||||
const qse_mchar_t* s1, /**< pointer to the first string */
|
||||
qse_size_t ln1, /**< length of the first string */
|
||||
const qse_mchar_t* s2, /**< pointer to the second string */
|
||||
qse_size_t ln2 /**< length of the second string */
|
||||
);
|
||||
|
||||
/**
|
||||
* The qse_wcsxncasecmp() function compares characters at the same position
|
||||
* in each string after converting them to the same case temporarily.
|
||||
* It accepts two strings and a character class handler. A string is
|
||||
* represented by its beginning pointer and length.
|
||||
*
|
||||
* For two strings to be equal, they need to have the same length and all
|
||||
* characters in the first string must be equal to their counterpart in the
|
||||
* second string.
|
||||
*
|
||||
* The following code snippet compares "foo" and "FoO" case-insenstively.
|
||||
* @code
|
||||
* qse_wcsxncasecmp (QSE_WT("foo"), 3, QSE_WT("FoO"), 3);
|
||||
* @endcode
|
||||
*
|
||||
* @return 0 if two strings are equal,
|
||||
* a positive number if the first string is larger,
|
||||
* -1 if the second string is larger.
|
||||
*
|
||||
*/
|
||||
int qse_wcsxncasecmp (
|
||||
const qse_wchar_t* s1, /**< pointer to the first string */
|
||||
qse_size_t ln1, /**< length of the first string */
|
||||
const qse_wchar_t* s2, /**< pointer to the second string */
|
||||
qse_size_t ln2 /**< length of the second string */
|
||||
);
|
||||
|
||||
#ifdef QSE_CHAR_IS_MCHAR
|
||||
# define qse_strcmp(s1,s2) qse_mbscmp(s1,s2)
|
||||
# define qse_strxcmp(s1,ln1,s2) qse_mbsxcmp(s1,ln1,s2)
|
||||
# define qse_strxncmp(s1,ln1,s2,ln2) qse_mbsxncmp(s1,ln1,s2,ln2)
|
||||
# define qse_strcasecmp(s1,s2) qse_mbscasecmp(s1,s2)
|
||||
# define qse_strxcasecmp(s1,ln1,s2) qse_mbsxcasecmp(s1,ln1,s2)
|
||||
# define qse_strxncasecmp(s1,ln1,s2,ln2) qse_mbsxncasecmp(s1,ln1,s2,ln2)
|
||||
#else
|
||||
# define qse_strcmp(s1,s2) qse_wcscmp(s1,s2)
|
||||
# define qse_strxcmp(s1,ln1,s2) qse_wcsxcmp(s1,ln1,s2)
|
||||
# define qse_strxncmp(s1,ln1,s2,ln2) qse_wcsxncmp(s1,ln1,s2,ln2)
|
||||
# define qse_strcasecmp(s1,s2) qse_wcscasecmp(s1,s2)
|
||||
# define qse_strxcasecmp(s1,ln1,s2) qse_wcsxcasecmp(s1,ln1,s2)
|
||||
# define qse_strxncasecmp(s1,ln1,s2,ln2) qse_wcsxncasecmp(s1,ln1,s2,ln2)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
qse_char_t* qse_strdup (
|
||||
const qse_char_t* str,
|
||||
qse_mmgr_t* mmgr
|
||||
|
@ -9,7 +9,7 @@ lib_LTLIBRARIES = libqsecmn.la
|
||||
libqsecmn_la_SOURCES = \
|
||||
syscall.h mem.h \
|
||||
mem.c xma.c fma.c chr.c chr_cnv.c rex.c \
|
||||
str_bas.c str_cnv.c str_cpy.c str_dyn.c str_fcpy.c \
|
||||
str_bas.c str_cnv.c str_cmp.c str_cpy.c str_dyn.c str_fcpy.c \
|
||||
str_pbrk.c str_put.c str_spn.c str_utl.c \
|
||||
lda.c oht.c htb.c rbt.c sll.c gdl.c dll.c opt.c \
|
||||
tio.c tio_get.c tio_put.c \
|
||||
|
@ -73,8 +73,8 @@ am__installdirs = "$(DESTDIR)$(libdir)"
|
||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
||||
libqsecmn_la_DEPENDENCIES =
|
||||
am_libqsecmn_la_OBJECTS = mem.lo xma.lo fma.lo chr.lo chr_cnv.lo \
|
||||
rex.lo str_bas.lo str_cnv.lo str_cpy.lo str_dyn.lo str_fcpy.lo \
|
||||
str_pbrk.lo str_put.lo str_spn.lo str_utl.lo lda.lo oht.lo \
|
||||
rex.lo str_bas.lo str_cmp.lo str_cnv.lo str_cpy.lo str_dyn.lo
|
||||
str_fcpy.lo str_pbrk.lo str_put.lo str_spn.lo str_utl.lo lda.lo oht.lo \
|
||||
htb.lo rbt.lo sll.lo gdl.lo dll.lo opt.lo tio.lo tio_get.lo \
|
||||
tio_put.lo fio.lo pio.lo sio.lo alg_search.lo alg_sort.lo \
|
||||
time.lo misc.lo assert.lo main.lo stdio.lo
|
||||
@ -265,7 +265,7 @@ lib_LTLIBRARIES = libqsecmn.la $(am__append_1)
|
||||
libqsecmn_la_SOURCES = \
|
||||
syscall.h mem.h \
|
||||
mem.c xma.c fma.c chr.c chr_cnv.c rex.c \
|
||||
str_bas.c str_cnv.c str_cpy.c str_dyn.c str_fcpy.c \
|
||||
str_bas.c str_cmp.c str_cnv.c str_cpy.c str_dyn.c str_fcpy.c \
|
||||
str_pbrk.c str_put.c str_spn.c str_utl.c \
|
||||
lda.c oht.c htb.c rbt.c sll.c gdl.c dll.c opt.c \
|
||||
tio.c tio_get.c tio_put.c \
|
||||
@ -385,6 +385,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sll.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stdio.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_bas.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_cmp.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_cnv.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_cpy.Plo@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str_dyn.Plo@am__quote@
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: chr.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
|
||||
* $Id: chr.c 413 2011-03-25 04:36:43Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -20,47 +20,46 @@
|
||||
|
||||
#include <qse/cmn/chr.h>
|
||||
|
||||
#if defined(QSE_CHAR_IS_MCHAR)
|
||||
|
||||
#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
|
||||
static qse_bool_t is_upper (qse_cint_t c) { return isupper(c); }
|
||||
static qse_bool_t is_lower (qse_cint_t c) { return islower(c); }
|
||||
static qse_bool_t is_alpha (qse_cint_t c) { return isalpha(c); }
|
||||
static qse_bool_t is_digit (qse_cint_t c) { return isdigit(c); }
|
||||
static qse_bool_t is_xdigit (qse_cint_t c) { return isxdigit(c); }
|
||||
static qse_bool_t is_alnum (qse_cint_t c) { return isalnum(c); }
|
||||
static qse_bool_t is_space (qse_cint_t c) { return isspace(c); }
|
||||
static qse_bool_t is_print (qse_cint_t c) { return isprint(c); }
|
||||
static qse_bool_t is_graph (qse_cint_t c) { return isgraph(c); }
|
||||
static qse_bool_t is_cntrl (qse_cint_t c) { return iscntrl(c); }
|
||||
static qse_bool_t is_punct (qse_cint_t c) { return ispunct(c); }
|
||||
static qse_bool_t is_mupper (qse_mcint_t c) { return isupper(c); }
|
||||
static qse_bool_t is_mlower (qse_mcint_t c) { return islower(c); }
|
||||
static qse_bool_t is_malpha (qse_mcint_t c) { return isalpha(c); }
|
||||
static qse_bool_t is_mdigit (qse_mcint_t c) { return isdigit(c); }
|
||||
static qse_bool_t is_mxdigit (qse_mcint_t c) { return isxdigit(c); }
|
||||
static qse_bool_t is_malnum (qse_mcint_t c) { return isalnum(c); }
|
||||
static qse_bool_t is_mspace (qse_mcint_t c) { return isspace(c); }
|
||||
static qse_bool_t is_mprint (qse_mcint_t c) { return isprint(c); }
|
||||
static qse_bool_t is_mgraph (qse_mcint_t c) { return isgraph(c); }
|
||||
static qse_bool_t is_mcntrl (qse_mcint_t c) { return iscntrl(c); }
|
||||
static qse_bool_t is_mpunct (qse_mcint_t c) { return ispunct(c); }
|
||||
|
||||
qse_bool_t qse_ccls_is (qse_cint_t c, qse_ccls_id_t type)
|
||||
qse_bool_t qse_mccls_is (qse_mcint_t c, qse_mccls_id_t type)
|
||||
{
|
||||
/* TODO: use GetStringTypeW/A for WIN32 to implement these */
|
||||
|
||||
static qse_bool_t (*f[]) (qse_cint_t) =
|
||||
static qse_bool_t (*f[]) (qse_mcint_t) =
|
||||
{
|
||||
is_upper,
|
||||
is_lower,
|
||||
is_alpha,
|
||||
is_digit,
|
||||
is_xdigit,
|
||||
is_alnum,
|
||||
is_space,
|
||||
is_print,
|
||||
is_graph,
|
||||
is_cntrl,
|
||||
is_punct
|
||||
is_mupper,
|
||||
is_mlower,
|
||||
is_malpha,
|
||||
is_mdigit,
|
||||
is_mxdigit,
|
||||
is_malnum,
|
||||
is_mspace,
|
||||
is_mprint,
|
||||
is_mgraph,
|
||||
is_mcntrl,
|
||||
is_mpunct
|
||||
};
|
||||
|
||||
QSE_ASSERTX (type >= QSE_CCLS_UPPER && type <= QSE_CCLS_PUNCT,
|
||||
"The character type should be one of qse_ccls_id_t values");
|
||||
"The character type should be one of qse_mccls_id_t values");
|
||||
return f[type] (c);
|
||||
}
|
||||
|
||||
qse_cint_t qse_ccls_to (qse_cint_t c, qse_ccls_id_t type)
|
||||
qse_mcint_t qse_mccls_to (qse_mcint_t c, qse_mccls_id_t type)
|
||||
{
|
||||
QSE_ASSERTX (type >= QSE_CCLS_UPPER && type <= QSE_CCLS_LOWER,
|
||||
"The character type should be one of QSE_CCLS_UPPER and QSE_CCLS_LOWER");
|
||||
@ -70,11 +69,7 @@ qse_cint_t qse_ccls_to (qse_cint_t c, qse_ccls_id_t type)
|
||||
return c;
|
||||
}
|
||||
|
||||
#elif defined(QSE_CHAR_IS_WCHAR)
|
||||
|
||||
#include <wctype.h>
|
||||
|
||||
qse_bool_t qse_ccls_is (qse_cint_t c, qse_ccls_id_t type)
|
||||
qse_bool_t qse_wccls_is (qse_wcint_t c, qse_wccls_id_t type)
|
||||
{
|
||||
static const char* name[] =
|
||||
{
|
||||
@ -107,13 +102,13 @@ qse_bool_t qse_ccls_is (qse_cint_t c, qse_ccls_id_t type)
|
||||
};
|
||||
|
||||
QSE_ASSERTX (type >= QSE_CCLS_UPPER && type <= QSE_CCLS_PUNCT,
|
||||
"The character type should be one of qse_ccls_id_t values");
|
||||
"The character type should be one of qse_wccls_id_t values");
|
||||
|
||||
if (desc[type] == (wctype_t)0) desc[type] = wctype(name[type]);
|
||||
return iswctype (c, desc[type]);
|
||||
}
|
||||
|
||||
qse_cint_t qse_ccls_to (qse_cint_t c, qse_ccls_id_t type)
|
||||
qse_wcint_t qse_wccls_to (qse_wcint_t c, qse_wccls_id_t type)
|
||||
{
|
||||
#ifdef HAVE_WCTRANS
|
||||
static const char* name[] =
|
||||
@ -133,7 +128,6 @@ qse_cint_t qse_ccls_to (qse_cint_t c, qse_ccls_id_t type)
|
||||
|
||||
if (desc[type] == (wctrans_t)0) desc[type] = wctrans(name[type]);
|
||||
return towctrans (c, desc[type]);
|
||||
|
||||
#else
|
||||
QSE_ASSERTX (type >= QSE_CCLS_UPPER && type <= QSE_CCLS_LOWER,
|
||||
"The type should be one of QSE_CCLS_UPPER and QSE_CCLS_LOWER");
|
||||
@ -141,8 +135,3 @@ qse_cint_t qse_ccls_to (qse_cint_t c, qse_ccls_id_t type)
|
||||
#endif
|
||||
}
|
||||
|
||||
#else
|
||||
#error unsupported character type
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: fio.c 404 2011-03-20 14:16:54Z hyunghwan.chung $
|
||||
* $Id: fio.c 413 2011-03-25 04:36:43Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -156,7 +156,7 @@ qse_fio_t* qse_fio_init (
|
||||
}
|
||||
if (handle == INVALID_HANDLE_VALUE) return QSE_NULL;
|
||||
|
||||
/* some special check
|
||||
/* some special check */
|
||||
if (GetFileType(handle) == FILE_TYPE_UNKNOWN)
|
||||
{
|
||||
CloseHandle (handle);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: sio.c 402 2011-03-18 15:07:21Z hyunghwan.chung $
|
||||
* $Id: sio.c 413 2011-03-25 04:36:43Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -37,16 +37,17 @@ static qse_sio_t __sio_in =
|
||||
|
||||
/* fio */
|
||||
{
|
||||
QSE_NULL,
|
||||
0,
|
||||
QSE_NULL, /* mmgr */
|
||||
0, /* errnum */
|
||||
#if defined(_WIN32)
|
||||
(HANDLE)STD_INPUT_HANDLE,
|
||||
(HANDLE)STD_INPUT_HANDLE, /* handle */
|
||||
#elif defined(__OS2__)
|
||||
(HFILE)0,
|
||||
(HFILE)0, /* handle */
|
||||
#else
|
||||
0,
|
||||
0, /* handle */
|
||||
#endif
|
||||
QSE_NULL
|
||||
0, /* flags */
|
||||
QSE_NULL /* tio */
|
||||
},
|
||||
|
||||
/* tio */
|
||||
@ -84,6 +85,7 @@ static qse_sio_t __sio_out =
|
||||
#else
|
||||
1,
|
||||
#endif
|
||||
0,
|
||||
QSE_NULL
|
||||
},
|
||||
|
||||
@ -122,6 +124,7 @@ static qse_sio_t __sio_err =
|
||||
#else
|
||||
2,
|
||||
#endif
|
||||
0,
|
||||
QSE_NULL
|
||||
},
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: str_bas.c 411 2011-03-24 14:20:55Z hyunghwan.chung $
|
||||
* $Id: str_bas.c 413 2011-03-25 04:36:43Z hyunghwan.chung $
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
@ -126,7 +126,6 @@ qse_size_t qse_strxcat (qse_char_t* buf, qse_size_t bsz, const qse_char_t* str)
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
|
||||
qse_size_t qse_strxncat (
|
||||
qse_char_t* buf, qse_size_t bsz, const qse_char_t* str, qse_size_t len)
|
||||
{
|
||||
@ -152,101 +151,6 @@ qse_size_t qse_strxncat (
|
||||
return p - buf;
|
||||
}
|
||||
|
||||
int qse_strcmp (const qse_char_t* s1, const qse_char_t* s2)
|
||||
{
|
||||
while (*s1 == *s2)
|
||||
{
|
||||
if (*s1 == QSE_T('\0')) return 0;
|
||||
s1++, s2++;
|
||||
}
|
||||
|
||||
return (*s1 > *s2)? 1: -1;
|
||||
}
|
||||
|
||||
int qse_strxcmp (const qse_char_t* s1, qse_size_t len, const qse_char_t* s2)
|
||||
{
|
||||
const qse_char_t* end = s1 + len;
|
||||
while (s1 < end && *s2 != QSE_T('\0') && *s1 == *s2) s1++, s2++;
|
||||
if (s1 == end && *s2 == QSE_T('\0')) return 0;
|
||||
if (*s1 == *s2) return (s1 < end)? 1: -1;
|
||||
return (*s1 > *s2)? 1: -1;
|
||||
}
|
||||
|
||||
int qse_strxncmp (
|
||||
const qse_char_t* s1, qse_size_t len1,
|
||||
const qse_char_t* s2, qse_size_t len2)
|
||||
{
|
||||
qse_char_t c1, c2;
|
||||
const qse_char_t* end1 = s1 + len1;
|
||||
const qse_char_t* end2 = s2 + len2;
|
||||
|
||||
while (s1 < end1)
|
||||
{
|
||||
c1 = *s1;
|
||||
if (s2 < end2)
|
||||
{
|
||||
c2 = *s2;
|
||||
if (c1 > c2) return 1;
|
||||
if (c1 < c2) return -1;
|
||||
}
|
||||
else return 1;
|
||||
s1++; s2++;
|
||||
}
|
||||
|
||||
return (s2 < end2)? -1: 0;
|
||||
}
|
||||
|
||||
int qse_strcasecmp (const qse_char_t* s1, const qse_char_t* s2)
|
||||
{
|
||||
while (QSE_TOUPPER(*s1) == QSE_TOUPPER(*s2))
|
||||
{
|
||||
if (*s1 == QSE_C('\0')) return 0;
|
||||
s1++, s2++;
|
||||
}
|
||||
|
||||
return (QSE_TOUPPER(*s1) > QSE_TOUPPER(*s2))? 1: -1;
|
||||
}
|
||||
|
||||
int qse_strxcasecmp (const qse_char_t* s1, qse_size_t len, const qse_char_t* s2)
|
||||
{
|
||||
qse_char_t c1, c2;
|
||||
const qse_char_t* end = s1 + len;
|
||||
|
||||
c1 = QSE_TOUPPER(*s1); c2 = QSE_TOUPPER(*s2);
|
||||
while (s1 < end && c2 != QSE_T('\0') && c1 == c2)
|
||||
{
|
||||
s1++; s2++;
|
||||
c1 = QSE_TOUPPER(*s1); c2 = QSE_TOUPPER(*s2);
|
||||
}
|
||||
if (s1 == end && c2 == QSE_T('\0')) return 0;
|
||||
if (c1 == c2) return (s1 < end)? 1: -1;
|
||||
return (c1 > c2)? 1: -1;
|
||||
}
|
||||
|
||||
int qse_strxncasecmp (
|
||||
const qse_char_t* s1, qse_size_t len1,
|
||||
const qse_char_t* s2, qse_size_t len2)
|
||||
{
|
||||
qse_char_t c1, c2;
|
||||
const qse_char_t* end1 = s1 + len1;
|
||||
const qse_char_t* end2 = s2 + len2;
|
||||
|
||||
while (s1 < end1)
|
||||
{
|
||||
c1 = QSE_TOUPPER (*s1);
|
||||
if (s2 < end2)
|
||||
{
|
||||
c2 = QSE_TOUPPER (*s2);
|
||||
if (c1 > c2) return 1;
|
||||
if (c1 < c2) return -1;
|
||||
}
|
||||
else return 1;
|
||||
s1++; s2++;
|
||||
}
|
||||
|
||||
return (s2 < end2)? -1: 0;
|
||||
}
|
||||
|
||||
qse_char_t* qse_strdup (const qse_char_t* str, qse_mmgr_t* mmgr)
|
||||
{
|
||||
qse_char_t* tmp;
|
||||
|
212
qse/lib/cmn/str_cmp.c
Normal file
212
qse/lib/cmn/str_cmp.c
Normal file
@ -0,0 +1,212 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
Copyright 2006-2009 Chung, Hyung-Hwan.
|
||||
This file is part of QSE.
|
||||
|
||||
QSE is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as
|
||||
published by the Free Software Foundation, either version 3 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
QSE is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with QSE. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <qse/cmn/str.h>
|
||||
#include <qse/cmn/chr.h>
|
||||
|
||||
int qse_mbscmp (const qse_mchar_t* s1, const qse_mchar_t* s2)
|
||||
{
|
||||
while (*s1 == *s2)
|
||||
{
|
||||
if (*s1 == QSE_MT('\0')) return 0;
|
||||
s1++, s2++;
|
||||
}
|
||||
|
||||
return (*s1 > *s2)? 1: -1;
|
||||
}
|
||||
|
||||
int qse_mbsxcmp (const qse_mchar_t* s1, qse_size_t ln, const qse_mchar_t* s2)
|
||||
{
|
||||
const qse_mchar_t* end = s1 + ln;
|
||||
while (s1 < end && *s2 != QSE_MT('\0') && *s1 == *s2) s1++, s2++;
|
||||
if (s1 == end && *s2 == QSE_MT('\0')) return 0;
|
||||
if (*s1 == *s2) return (s1 < end)? 1: -1;
|
||||
return (*s1 > *s2)? 1: -1;
|
||||
}
|
||||
|
||||
int qse_mbsxncmp (
|
||||
const qse_mchar_t* s1, qse_size_t ln1,
|
||||
const qse_mchar_t* s2, qse_size_t ln2)
|
||||
{
|
||||
qse_mchar_t c1, c2;
|
||||
const qse_mchar_t* end1 = s1 + ln1;
|
||||
const qse_mchar_t* end2 = s2 + ln2;
|
||||
|
||||
while (s1 < end1)
|
||||
{
|
||||
c1 = *s1;
|
||||
if (s2 < end2)
|
||||
{
|
||||
c2 = *s2;
|
||||
if (c1 > c2) return 1;
|
||||
if (c1 < c2) return -1;
|
||||
}
|
||||
else return 1;
|
||||
s1++; s2++;
|
||||
}
|
||||
|
||||
return (s2 < end2)? -1: 0;
|
||||
}
|
||||
|
||||
int qse_mbscasecmp (const qse_mchar_t* s1, const qse_mchar_t* s2)
|
||||
{
|
||||
while (QSE_TOMUPPER(*s1) == QSE_TOMUPPER(*s2))
|
||||
{
|
||||
if (*s1 == QSE_C('\0')) return 0;
|
||||
s1++, s2++;
|
||||
}
|
||||
|
||||
return (QSE_TOMUPPER(*s1) > QSE_TOMUPPER(*s2))? 1: -1;
|
||||
}
|
||||
|
||||
int qse_mbsxcasecmp (const qse_mchar_t* s1, qse_size_t ln, const qse_mchar_t* s2)
|
||||
{
|
||||
qse_mchar_t c1, c2;
|
||||
const qse_mchar_t* end = s1 + ln;
|
||||
|
||||
c1 = QSE_TOMUPPER(*s1); c2 = QSE_TOMUPPER(*s2);
|
||||
while (s1 < end && c2 != QSE_MT('\0') && c1 == c2)
|
||||
{
|
||||
s1++; s2++;
|
||||
c1 = QSE_TOMUPPER(*s1); c2 = QSE_TOMUPPER(*s2);
|
||||
}
|
||||
if (s1 == end && c2 == QSE_MT('\0')) return 0;
|
||||
if (c1 == c2) return (s1 < end)? 1: -1;
|
||||
return (c1 > c2)? 1: -1;
|
||||
}
|
||||
|
||||
int qse_mbsxncasecmp (
|
||||
const qse_mchar_t* s1, qse_size_t ln1,
|
||||
const qse_mchar_t* s2, qse_size_t ln2)
|
||||
{
|
||||
qse_mchar_t c1, c2;
|
||||
const qse_mchar_t* end1 = s1 + ln1;
|
||||
const qse_mchar_t* end2 = s2 + ln2;
|
||||
|
||||
while (s1 < end1)
|
||||
{
|
||||
c1 = QSE_TOMUPPER (*s1);
|
||||
if (s2 < end2)
|
||||
{
|
||||
c2 = QSE_TOMUPPER (*s2);
|
||||
if (c1 > c2) return 1;
|
||||
if (c1 < c2) return -1;
|
||||
}
|
||||
else return 1;
|
||||
s1++; s2++;
|
||||
}
|
||||
|
||||
return (s2 < end2)? -1: 0;
|
||||
}
|
||||
|
||||
int qse_wcscmp (const qse_wchar_t* s1, const qse_wchar_t* s2)
|
||||
{
|
||||
while (*s1 == *s2)
|
||||
{
|
||||
if (*s1 == QSE_WT('\0')) return 0;
|
||||
s1++, s2++;
|
||||
}
|
||||
|
||||
return (*s1 > *s2)? 1: -1;
|
||||
}
|
||||
|
||||
int qse_wcsxcmp (const qse_wchar_t* s1, qse_size_t ln, const qse_wchar_t* s2)
|
||||
{
|
||||
const qse_wchar_t* end = s1 + ln;
|
||||
while (s1 < end && *s2 != QSE_WT('\0') && *s1 == *s2) s1++, s2++;
|
||||
if (s1 == end && *s2 == QSE_WT('\0')) return 0;
|
||||
if (*s1 == *s2) return (s1 < end)? 1: -1;
|
||||
return (*s1 > *s2)? 1: -1;
|
||||
}
|
||||
|
||||
int qse_wcsxncmp (
|
||||
const qse_wchar_t* s1, qse_size_t ln1,
|
||||
const qse_wchar_t* s2, qse_size_t ln2)
|
||||
{
|
||||
qse_wchar_t c1, c2;
|
||||
const qse_wchar_t* end1 = s1 + ln1;
|
||||
const qse_wchar_t* end2 = s2 + ln2;
|
||||
|
||||
while (s1 < end1)
|
||||
{
|
||||
c1 = *s1;
|
||||
if (s2 < end2)
|
||||
{
|
||||
c2 = *s2;
|
||||
if (c1 > c2) return 1;
|
||||
if (c1 < c2) return -1;
|
||||
}
|
||||
else return 1;
|
||||
s1++; s2++;
|
||||
}
|
||||
|
||||
return (s2 < end2)? -1: 0;
|
||||
}
|
||||
|
||||
int qse_wcscasecmp (const qse_wchar_t* s1, const qse_wchar_t* s2)
|
||||
{
|
||||
while (QSE_TOWUPPER(*s1) == QSE_TOWUPPER(*s2))
|
||||
{
|
||||
if (*s1 == QSE_C('\0')) return 0;
|
||||
s1++, s2++;
|
||||
}
|
||||
|
||||
return (QSE_TOWUPPER(*s1) > QSE_TOWUPPER(*s2))? 1: -1;
|
||||
}
|
||||
|
||||
int qse_wcsxcasecmp (const qse_wchar_t* s1, qse_size_t ln, const qse_wchar_t* s2)
|
||||
{
|
||||
qse_wchar_t c1, c2;
|
||||
const qse_wchar_t* end = s1 + ln;
|
||||
|
||||
c1 = QSE_TOWUPPER(*s1); c2 = QSE_TOWUPPER(*s2);
|
||||
while (s1 < end && c2 != QSE_WT('\0') && c1 == c2)
|
||||
{
|
||||
s1++; s2++;
|
||||
c1 = QSE_TOWUPPER(*s1); c2 = QSE_TOWUPPER(*s2);
|
||||
}
|
||||
if (s1 == end && c2 == QSE_WT('\0')) return 0;
|
||||
if (c1 == c2) return (s1 < end)? 1: -1;
|
||||
return (c1 > c2)? 1: -1;
|
||||
}
|
||||
|
||||
int qse_wcsxncasecmp (
|
||||
const qse_wchar_t* s1, qse_size_t ln1,
|
||||
const qse_wchar_t* s2, qse_size_t ln2)
|
||||
{
|
||||
qse_wchar_t c1, c2;
|
||||
const qse_wchar_t* end1 = s1 + ln1;
|
||||
const qse_wchar_t* end2 = s2 + ln2;
|
||||
|
||||
while (s1 < end1)
|
||||
{
|
||||
c1 = QSE_TOWUPPER (*s1);
|
||||
if (s2 < end2)
|
||||
{
|
||||
c2 = QSE_TOWUPPER (*s2);
|
||||
if (c1 > c2) return 1;
|
||||
if (c1 < c2) return -1;
|
||||
}
|
||||
else return 1;
|
||||
s1++; s2++;
|
||||
}
|
||||
|
||||
return (s2 < end2)? -1: 0;
|
||||
}
|
@ -42,7 +42,7 @@ WVList
|
||||
0
|
||||
10
|
||||
WPickList
|
||||
40
|
||||
41
|
||||
11
|
||||
MItem
|
||||
3
|
||||
@ -494,7 +494,7 @@ WVList
|
||||
111
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_cnv.c
|
||||
..\..\..\..\..\lib\cmn\str_cmp.c
|
||||
112
|
||||
WString
|
||||
4
|
||||
@ -512,7 +512,7 @@ WVList
|
||||
115
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_cpy.c
|
||||
..\..\..\..\..\lib\cmn\str_cnv.c
|
||||
116
|
||||
WString
|
||||
4
|
||||
@ -530,7 +530,7 @@ WVList
|
||||
119
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_dyn.c
|
||||
..\..\..\..\..\lib\cmn\str_cpy.c
|
||||
120
|
||||
WString
|
||||
4
|
||||
@ -547,8 +547,8 @@ WVList
|
||||
0
|
||||
123
|
||||
MItem
|
||||
33
|
||||
..\..\..\..\..\lib\cmn\str_fcpy.c
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_dyn.c
|
||||
124
|
||||
WString
|
||||
4
|
||||
@ -566,7 +566,7 @@ WVList
|
||||
127
|
||||
MItem
|
||||
33
|
||||
..\..\..\..\..\lib\cmn\str_pbrk.c
|
||||
..\..\..\..\..\lib\cmn\str_fcpy.c
|
||||
128
|
||||
WString
|
||||
4
|
||||
@ -583,8 +583,8 @@ WVList
|
||||
0
|
||||
131
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_put.c
|
||||
33
|
||||
..\..\..\..\..\lib\cmn\str_pbrk.c
|
||||
132
|
||||
WString
|
||||
4
|
||||
@ -602,7 +602,7 @@ WVList
|
||||
135
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_spn.c
|
||||
..\..\..\..\..\lib\cmn\str_put.c
|
||||
136
|
||||
WString
|
||||
4
|
||||
@ -620,7 +620,7 @@ WVList
|
||||
139
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_utl.c
|
||||
..\..\..\..\..\lib\cmn\str_spn.c
|
||||
140
|
||||
WString
|
||||
4
|
||||
@ -637,8 +637,8 @@ WVList
|
||||
0
|
||||
143
|
||||
MItem
|
||||
29
|
||||
..\..\..\..\..\lib\cmn\time.c
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_utl.c
|
||||
144
|
||||
WString
|
||||
4
|
||||
@ -655,8 +655,8 @@ WVList
|
||||
0
|
||||
147
|
||||
MItem
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\tio.c
|
||||
29
|
||||
..\..\..\..\..\lib\cmn\time.c
|
||||
148
|
||||
WString
|
||||
4
|
||||
@ -673,8 +673,8 @@ WVList
|
||||
0
|
||||
151
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\tio_get.c
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\tio.c
|
||||
152
|
||||
WString
|
||||
4
|
||||
@ -692,7 +692,7 @@ WVList
|
||||
155
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\tio_put.c
|
||||
..\..\..\..\..\lib\cmn\tio_get.c
|
||||
156
|
||||
WString
|
||||
4
|
||||
@ -709,8 +709,8 @@ WVList
|
||||
0
|
||||
159
|
||||
MItem
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\xma.c
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\tio_put.c
|
||||
160
|
||||
WString
|
||||
4
|
||||
@ -727,26 +727,26 @@ WVList
|
||||
0
|
||||
163
|
||||
MItem
|
||||
3
|
||||
*.h
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\xma.c
|
||||
164
|
||||
WString
|
||||
3
|
||||
NIL
|
||||
4
|
||||
COBJ
|
||||
165
|
||||
WVList
|
||||
0
|
||||
166
|
||||
WVList
|
||||
0
|
||||
-1
|
||||
11
|
||||
1
|
||||
1
|
||||
0
|
||||
167
|
||||
MItem
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\mem.h
|
||||
3
|
||||
*.h
|
||||
168
|
||||
WString
|
||||
3
|
||||
@ -757,14 +757,14 @@ WVList
|
||||
170
|
||||
WVList
|
||||
0
|
||||
163
|
||||
-1
|
||||
1
|
||||
1
|
||||
0
|
||||
171
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\syscall.h
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\mem.h
|
||||
172
|
||||
WString
|
||||
3
|
||||
@ -775,7 +775,25 @@ WVList
|
||||
174
|
||||
WVList
|
||||
0
|
||||
163
|
||||
167
|
||||
1
|
||||
1
|
||||
0
|
||||
175
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\syscall.h
|
||||
176
|
||||
WString
|
||||
3
|
||||
NIL
|
||||
177
|
||||
WVList
|
||||
0
|
||||
178
|
||||
WVList
|
||||
0
|
||||
167
|
||||
1
|
||||
1
|
||||
0
|
||||
|
@ -67,7 +67,7 @@ WFileName
|
||||
30
|
||||
release/os2/lib/cmn/qsecmn.tgt
|
||||
24
|
||||
27
|
||||
31
|
||||
17
|
||||
VComponent
|
||||
18
|
||||
@ -121,7 +121,7 @@ VComponent
|
||||
27
|
||||
WRect
|
||||
1340
|
||||
413
|
||||
400
|
||||
5700
|
||||
4240
|
||||
0
|
||||
@ -130,8 +130,8 @@ WRect
|
||||
WFileName
|
||||
28
|
||||
debug/os2/lib/cmn/qsecmn.tgt
|
||||
21
|
||||
24
|
||||
18
|
||||
20
|
||||
29
|
||||
VComponent
|
||||
30
|
||||
|
@ -42,7 +42,7 @@ WVList
|
||||
0
|
||||
10
|
||||
WPickList
|
||||
40
|
||||
41
|
||||
11
|
||||
MItem
|
||||
3
|
||||
@ -558,7 +558,7 @@ WVList
|
||||
127
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_cnv.c
|
||||
..\..\..\..\..\lib\cmn\str_cmp.c
|
||||
128
|
||||
WString
|
||||
4
|
||||
@ -576,7 +576,7 @@ WVList
|
||||
131
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_cpy.c
|
||||
..\..\..\..\..\lib\cmn\str_cnv.c
|
||||
132
|
||||
WString
|
||||
4
|
||||
@ -594,7 +594,7 @@ WVList
|
||||
135
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_dyn.c
|
||||
..\..\..\..\..\lib\cmn\str_cpy.c
|
||||
136
|
||||
WString
|
||||
4
|
||||
@ -611,8 +611,8 @@ WVList
|
||||
0
|
||||
139
|
||||
MItem
|
||||
33
|
||||
..\..\..\..\..\lib\cmn\str_fcpy.c
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_dyn.c
|
||||
140
|
||||
WString
|
||||
4
|
||||
@ -630,7 +630,7 @@ WVList
|
||||
143
|
||||
MItem
|
||||
33
|
||||
..\..\..\..\..\lib\cmn\str_pbrk.c
|
||||
..\..\..\..\..\lib\cmn\str_fcpy.c
|
||||
144
|
||||
WString
|
||||
4
|
||||
@ -647,8 +647,8 @@ WVList
|
||||
0
|
||||
147
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_put.c
|
||||
33
|
||||
..\..\..\..\..\lib\cmn\str_pbrk.c
|
||||
148
|
||||
WString
|
||||
4
|
||||
@ -666,7 +666,7 @@ WVList
|
||||
151
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_spn.c
|
||||
..\..\..\..\..\lib\cmn\str_put.c
|
||||
152
|
||||
WString
|
||||
4
|
||||
@ -684,47 +684,47 @@ WVList
|
||||
155
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_utl.c
|
||||
..\..\..\..\..\lib\cmn\str_spn.c
|
||||
156
|
||||
WString
|
||||
4
|
||||
COBJ
|
||||
157
|
||||
WVList
|
||||
1
|
||||
158
|
||||
MVState
|
||||
159
|
||||
WString
|
||||
3
|
||||
WCC
|
||||
160
|
||||
WString
|
||||
25
|
||||
o?2??Include directories:
|
||||
1
|
||||
161
|
||||
WString
|
||||
54
|
||||
"$(%watcom)/h;$(%watcom)/h/os2;..\..\..\..\..\include"
|
||||
0
|
||||
162
|
||||
158
|
||||
WVList
|
||||
0
|
||||
11
|
||||
1
|
||||
1
|
||||
0
|
||||
163
|
||||
159
|
||||
MItem
|
||||
29
|
||||
..\..\..\..\..\lib\cmn\time.c
|
||||
164
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\str_utl.c
|
||||
160
|
||||
WString
|
||||
4
|
||||
COBJ
|
||||
165
|
||||
161
|
||||
WVList
|
||||
1
|
||||
162
|
||||
MVState
|
||||
163
|
||||
WString
|
||||
3
|
||||
WCC
|
||||
164
|
||||
WString
|
||||
25
|
||||
o?2??Include directories:
|
||||
1
|
||||
165
|
||||
WString
|
||||
54
|
||||
"$(%watcom)/h;$(%watcom)/h/os2;..\..\..\..\..\include"
|
||||
0
|
||||
166
|
||||
WVList
|
||||
@ -735,8 +735,8 @@ WVList
|
||||
0
|
||||
167
|
||||
MItem
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\tio.c
|
||||
29
|
||||
..\..\..\..\..\lib\cmn\time.c
|
||||
168
|
||||
WString
|
||||
4
|
||||
@ -753,8 +753,8 @@ WVList
|
||||
0
|
||||
171
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\tio_get.c
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\tio.c
|
||||
172
|
||||
WString
|
||||
4
|
||||
@ -772,7 +772,7 @@ WVList
|
||||
175
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\tio_put.c
|
||||
..\..\..\..\..\lib\cmn\tio_get.c
|
||||
176
|
||||
WString
|
||||
4
|
||||
@ -789,8 +789,8 @@ WVList
|
||||
0
|
||||
179
|
||||
MItem
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\xma.c
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\tio_put.c
|
||||
180
|
||||
WString
|
||||
4
|
||||
@ -807,26 +807,26 @@ WVList
|
||||
0
|
||||
183
|
||||
MItem
|
||||
3
|
||||
*.h
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\xma.c
|
||||
184
|
||||
WString
|
||||
3
|
||||
NIL
|
||||
4
|
||||
COBJ
|
||||
185
|
||||
WVList
|
||||
0
|
||||
186
|
||||
WVList
|
||||
0
|
||||
-1
|
||||
11
|
||||
1
|
||||
1
|
||||
0
|
||||
187
|
||||
MItem
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\mem.h
|
||||
3
|
||||
*.h
|
||||
188
|
||||
WString
|
||||
3
|
||||
@ -837,14 +837,14 @@ WVList
|
||||
190
|
||||
WVList
|
||||
0
|
||||
183
|
||||
-1
|
||||
1
|
||||
1
|
||||
0
|
||||
191
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\syscall.h
|
||||
28
|
||||
..\..\..\..\..\lib\cmn\mem.h
|
||||
192
|
||||
WString
|
||||
3
|
||||
@ -855,7 +855,25 @@ WVList
|
||||
194
|
||||
WVList
|
||||
0
|
||||
183
|
||||
187
|
||||
1
|
||||
1
|
||||
0
|
||||
195
|
||||
MItem
|
||||
32
|
||||
..\..\..\..\..\lib\cmn\syscall.h
|
||||
196
|
||||
WString
|
||||
3
|
||||
NIL
|
||||
197
|
||||
WVList
|
||||
0
|
||||
198
|
||||
WVList
|
||||
0
|
||||
187
|
||||
1
|
||||
1
|
||||
0
|
||||
|
Loading…
Reference in New Issue
Block a user