This commit is contained in:
2008-08-21 03:17:25 +00:00
parent a95dad6655
commit 5e8901042a
40 changed files with 307 additions and 391 deletions

View File

@ -9,14 +9,4 @@
#include <ase/cmn/chr.h>
#ifdef USE_STDC
#include <ctype.h>
#else
#define ASE_ISALPHA(c) ase_isalpha(c)
#endif
#endif

View File

@ -32,4 +32,8 @@
#endif
#define ASE_MALLOC(mmgr,size) ASE_MMGR_ALLOC(mmgr,size)
#define ASE_REALLOC(mmgr,ptr,size) ASE_MMGR_REALLOC(mmgr,ptr,size)
#define ASE_FREE(mmgr,ptr) ASE_MMGR_FREE(mmgr,ptr)
#endif

View File

@ -1,11 +1,12 @@
/*
* $Id: rex.c 332 2008-08-18 11:21:48Z baconevi $
* $Id: rex.c 337 2008-08-20 09:17:25Z baconevi $
*
* {License}
*/
#include <ase/cmn/rex.h>
#include "mem.h"
#include "chr.h"
#ifdef DEBUG_REX
#include <ase/utl/stdio.h>
@ -1380,7 +1381,7 @@ static const ase_byte_t* match_ord_char (
ubound = cp->ubound;
cc = *(ase_char_t*)p; p += ASE_SIZEOF(cc);
if (matcher->ignorecase) cc = ASE_TOUPPER(matcher->ccls, cc);
if (matcher->ignorecase) cc = ASE_CCLS_TOUPPER(matcher->ccls, cc);
/* merge the same consecutive codes
* for example, a{1,10}a{0,10} is shortened to a{1,20} */
@ -1389,7 +1390,7 @@ static const ase_byte_t* match_ord_char (
while (p < mat->branch_end &&
cp->cmd == ((const code_t*)p)->cmd)
{
if (ASE_TOUPPER (matcher->ccls, *(ase_char_t*)(p+ASE_SIZEOF(*cp))) != cc) break;
if (ASE_CCLS_TOUPPER (matcher->ccls, *(ase_char_t*)(p+ASE_SIZEOF(*cp))) != cc) break;
lbound += ((const code_t*)p)->lbound;
ubound += ((const code_t*)p)->ubound;
@ -1431,7 +1432,7 @@ static const ase_byte_t* match_ord_char (
ASE_T("match_ord_char: <ignorecase> %c %c\n"),
cc, mat->match_ptr[si]);
#endif
if (cc != ASE_TOUPPER (matcher->ccls, mat->match_ptr[si])) break;
if (cc != ASE_CCLS_TOUPPER (matcher->ccls, mat->match_ptr[si])) break;
si++;
}
}
@ -1494,7 +1495,7 @@ static const ase_byte_t* match_charset (
if (&mat->match_ptr[si] >= matcher->match.str.end) break;
c = mat->match_ptr[si];
if (matcher->ignorecase) c = ASE_TOUPPER(matcher->ccls, c);
if (matcher->ignorecase) c = ASE_CCLS_TOUPPER(matcher->ccls, c);
n = __test_charset (matcher, p, cshdr->csc, c);
if (cp->negate) n = !n;
@ -1759,7 +1760,7 @@ static ase_bool_t __test_charset (
{
c1 = *(const ase_char_t*)p;
if (matcher->ignorecase)
c1 = ASE_TOUPPER(matcher->ccls, c1);
c1 = ASE_CCLS_TOUPPER(matcher->ccls, c1);
#ifdef DEBUG_REX
ase_dprintf (
ASE_T("match_charset: <one> %c %c\n"), c, c1);
@ -1774,8 +1775,8 @@ static ase_bool_t __test_charset (
if (matcher->ignorecase)
{
c1 = ASE_TOUPPER(matcher->ccls, c1);
c2 = ASE_TOUPPER(matcher->ccls, c2);
c1 = ASE_CCLS_TOUPPER(matcher->ccls, c1);
c2 = ASE_CCLS_TOUPPER(matcher->ccls, c2);
}
#ifdef DEBUG_REX
ase_dprintf (
@ -1808,12 +1809,12 @@ static ase_bool_t __test_charset (
static ase_bool_t cc_isalnum (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISALNUM (ccls, c);
return ASE_CCLS_ISALNUM (ccls, c);
}
static ase_bool_t cc_isalpha (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISALPHA (ccls, c);
return ASE_CCLS_ISALPHA (ccls, c);
}
static ase_bool_t cc_isblank (ase_ccls_t* ccls, ase_char_t c)
@ -1823,47 +1824,47 @@ static ase_bool_t cc_isblank (ase_ccls_t* ccls, ase_char_t c)
static ase_bool_t cc_iscntrl (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISCNTRL (ccls, c);
return ASE_CCLS_ISCNTRL (ccls, c);
}
static ase_bool_t cc_isdigit (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISDIGIT (ccls, c);
return ASE_CCLS_ISDIGIT (ccls, c);
}
static ase_bool_t cc_isgraph (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISGRAPH (ccls, c);
return ASE_CCLS_ISGRAPH (ccls, c);
}
static ase_bool_t cc_islower (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISLOWER (ccls, c);
return ASE_CCLS_ISLOWER (ccls, c);
}
static ase_bool_t cc_isprint (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISPRINT (ccls, c);
return ASE_CCLS_ISPRINT (ccls, c);
}
static ase_bool_t cc_ispunct (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISPUNCT (ccls, c);
return ASE_CCLS_ISPUNCT (ccls, c);
}
static ase_bool_t cc_isspace (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISSPACE (ccls, c);
return ASE_CCLS_ISSPACE (ccls, c);
}
static ase_bool_t cc_isupper (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISUPPER (ccls, c);
return ASE_CCLS_ISUPPER (ccls, c);
}
static ase_bool_t cc_isxdigit (ase_ccls_t* ccls, ase_char_t c)
{
return ASE_ISXDIGIT (ccls, c);
return ASE_CCLS_ISXDIGIT (ccls, c);
}
#if 0

View File

@ -1,10 +1,11 @@
/*
* $Id: str_bas.c 332 2008-08-18 11:21:48Z baconevi $
* $Id: str_bas.c 337 2008-08-20 09:17:25Z baconevi $
*
* {License}
*/
#include <ase/cmn/str.h>
#include "chr.h"
#include "mem.h"
ase_size_t ase_strlen (const ase_char_t* str)
@ -180,13 +181,13 @@ int ase_strxncmp (
int ase_strcasecmp (
const ase_char_t* s1, const ase_char_t* s2, ase_ccls_t* ccls)
{
while (ASE_TOUPPER(ccls,*s1) == ASE_TOUPPER(ccls,*s2))
while (ASE_CCLS_TOUPPER(ccls,*s1) == ASE_CCLS_TOUPPER(ccls,*s2))
{
if (*s1 == ASE_C('\0')) return 0;
s1++, s2++;
}
return (ASE_TOUPPER(ccls,*s1) > ASE_TOUPPER(ccls,*s2))? 1: -1;
return (ASE_CCLS_TOUPPER(ccls,*s1) > ASE_CCLS_TOUPPER(ccls,*s2))? 1: -1;
}
int ase_strxncasecmp (
@ -199,10 +200,10 @@ int ase_strxncasecmp (
while (s1 < end1)
{
c1 = ASE_TOUPPER (ccls, *s1);
c1 = ASE_CCLS_TOUPPER (ccls, *s1);
if (s2 < end2)
{
c2 = ASE_TOUPPER (ccls, *s2);
c2 = ASE_CCLS_TOUPPER (ccls, *s2);
if (c1 > c2) return 1;
if (c1 < c2) return -1;
}