This commit is contained in:
parent
89b9bf7296
commit
01dd1ad765
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* $Id: awk.c 337 2008-08-20 09:17:25Z baconevi $
|
* $Id: awk.c 339 2008-08-20 09:58:42Z baconevi $
|
||||||
*
|
*
|
||||||
* {License}
|
* {License}
|
||||||
*/
|
*/
|
||||||
@ -40,7 +40,7 @@ ase_awk_t* ase_awk_open (
|
|||||||
if (mmgr == ASE_NULL) return ASE_NULL;
|
if (mmgr == ASE_NULL) return ASE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
awk = ASE_ALLOC (mmgr, ASE_SIZEOF(ase_awk_t) + extension);
|
awk = ASE_MMGR_ALLOC (mmgr, ASE_SIZEOF(ase_awk_t) + extension);
|
||||||
if (awk == ASE_NULL) return ASE_NULL;
|
if (awk == ASE_NULL) return ASE_NULL;
|
||||||
|
|
||||||
ASE_MEMSET (awk, 0, ASE_SIZEOF(ase_awk_t) + extension);
|
ASE_MEMSET (awk, 0, ASE_SIZEOF(ase_awk_t) + extension);
|
||||||
|
@ -34,9 +34,9 @@ typedef struct ase_awk_tree_t ase_awk_tree_t;
|
|||||||
#define ASE_AWK_MAX_LOCALS 9999
|
#define ASE_AWK_MAX_LOCALS 9999
|
||||||
#define ASE_AWK_MAX_PARAMS 9999
|
#define ASE_AWK_MAX_PARAMS 9999
|
||||||
|
|
||||||
#define ASE_AWK_ALLOC(awk,size) ASE_ALLOC((awk)->mmgr,size)
|
#define ASE_AWK_ALLOC(awk,size) ASE_MMGR_ALLOC((awk)->mmgr,size)
|
||||||
#define ASE_AWK_REALLOC(awk,ptr,size) ASE_REALLOC((awk)->mmgr,ptr,size)
|
#define ASE_AWK_REALLOC(awk,ptr,size) ASE_MMGR_REALLOC((awk)->mmgr,ptr,size)
|
||||||
#define ASE_AWK_FREE(awk,ptr) ASE_FREE((awk)->mmgr,ptr)
|
#define ASE_AWK_FREE(awk,ptr) ASE_MMGR_FREE((awk)->mmgr,ptr)
|
||||||
|
|
||||||
#define ASE_AWK_ISUPPER(awk,c) ASE_CCLS_ISUPPER((awk)->ccls,c)
|
#define ASE_AWK_ISUPPER(awk,c) ASE_CCLS_ISUPPER((awk)->ccls,c)
|
||||||
#define ASE_AWK_ISLOWER(awk,c) ASE_CCLS_ISLOWER((awk)->ccls,c)
|
#define ASE_AWK_ISLOWER(awk,c) ASE_CCLS_ISLOWER((awk)->ccls,c)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
static ase_bool_t ccls_is (void* data, ase_cint_t c, ase_ccls_type_t type)
|
static ase_bool_t ccls_is (void* data, ase_cint_t c, ase_ccls_type_t type)
|
||||||
{
|
{
|
||||||
/* TODO: use GetStringTypeW/A for WIN32 to implement these */
|
/* TODO: use GetStringTypeW/A for WIN32 to implement these */
|
||||||
|
#error NOT IMPLEMENTED YET.
|
||||||
}
|
}
|
||||||
|
|
||||||
static ase_cint_t ccls_to (void* data, ase_cint_t c, in type)
|
static ase_cint_t ccls_to (void* data, ase_cint_t c, in type)
|
||||||
@ -29,40 +30,63 @@ static ase_cint_t ccls_to (void* data, ase_cint_t c, in type)
|
|||||||
|
|
||||||
#include <wctype.h>
|
#include <wctype.h>
|
||||||
|
|
||||||
static ase_bool_t ccls_is (void* data, ase_cint_t c, ase_ccls_type_t type)
|
static ase_bool_t ccls_is (void* data, ase_cint_t c, int type)
|
||||||
{
|
{
|
||||||
|
static const char* name[] =
|
||||||
|
{
|
||||||
|
"upper",
|
||||||
|
"lower",
|
||||||
|
"alpha",
|
||||||
|
"digit",
|
||||||
|
"xdigit",
|
||||||
|
"alnum",
|
||||||
|
"space",
|
||||||
|
"print",
|
||||||
|
"graph",
|
||||||
|
"cntrl",
|
||||||
|
"punct"
|
||||||
|
};
|
||||||
|
|
||||||
static wctype_t desc[] =
|
static wctype_t desc[] =
|
||||||
{
|
{
|
||||||
wctype("upper"),
|
(wctype_t)0,
|
||||||
wctype("lower"),
|
(wctype_t)0,
|
||||||
wctype("alpha"),
|
(wctype_t)0,
|
||||||
wctype("digit"),
|
(wctype_t)0,
|
||||||
wctype("xdigit"),
|
(wctype_t)0,
|
||||||
wctype("alnum"),
|
(wctype_t)0,
|
||||||
wctype("space"),
|
(wctype_t)0,
|
||||||
wctype("print"),
|
(wctype_t)0,
|
||||||
wctype("graph"),
|
(wctype_t)0,
|
||||||
wctype("cntrl"),
|
(wctype_t)0,
|
||||||
wctype("punct")
|
(wctype_t)0
|
||||||
};
|
};
|
||||||
|
|
||||||
ASE_ASSERTX (type >= ASE_CCLS_UPPER && type <= ASE_CCLS_PUNCT,
|
ASE_ASSERTX (type >= ASE_CCLS_UPPER && type <= ASE_CCLS_PUNCT,
|
||||||
"The character type should be one of ase_ccls_type_t values");
|
"The character type should be one of ase_ccls_type_t values");
|
||||||
|
|
||||||
|
if (desc[type] == (wctype_t)0) desc[type] = wctype(name[type]);
|
||||||
return iswctype (c, desc[type]);
|
return iswctype (c, desc[type]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ase_cint_t ccls_to (void* data, ase_cint_t c, in type)
|
static ase_cint_t ccls_to (void* data, ase_cint_t c, int type)
|
||||||
{
|
{
|
||||||
static wctype_t desc[] =
|
static const char* name[] =
|
||||||
{
|
{
|
||||||
wctrans("toupper"),
|
"upper",
|
||||||
wctrans("tolower")
|
"lower"
|
||||||
|
};
|
||||||
|
|
||||||
|
static wctrans_t desc[] =
|
||||||
|
{
|
||||||
|
(wctrans_t)0,
|
||||||
|
(wctrans_t)0
|
||||||
};
|
};
|
||||||
|
|
||||||
ASE_ASSERTX (type >= ASE_CCLS_UPPER && type <= ASE_CCLS_LOWER,
|
ASE_ASSERTX (type >= ASE_CCLS_UPPER && type <= ASE_CCLS_LOWER,
|
||||||
"The character type should be one of ASE_CCLS_UPPER and ASE_CCLS_LOWER");
|
"The character type should be one of ASE_CCLS_UPPER and ASE_CCLS_LOWER");
|
||||||
|
|
||||||
|
if (desc[type] == (wctrans_t)0) desc[type] = wctrans(name[type]);
|
||||||
return towctrans (c, desc[type]);
|
return towctrans (c, desc[type]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ ase_dll_t* ase_dll_open (
|
|||||||
if (mmgr == ASE_NULL) return ASE_NULL;
|
if (mmgr == ASE_NULL) return ASE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dll = ASE_MALLOC (mmgr, ASE_SIZEOF(ase_dll_t) + extension);
|
dll = ASE_MMGR_ALLOC (mmgr, ASE_SIZEOF(ase_dll_t) + extension);
|
||||||
if (dll == ASE_NULL) return ASE_NULL;
|
if (dll == ASE_NULL) return ASE_NULL;
|
||||||
|
|
||||||
ASE_MEMSET (dll, 0, ASE_SIZEOF(ase_dll_t) + extension);
|
ASE_MEMSET (dll, 0, ASE_SIZEOF(ase_dll_t) + extension);
|
||||||
|
@ -29,7 +29,7 @@ ase_sll_t* ase_sll_open (
|
|||||||
if (mmgr == ASE_NULL) return ASE_NULL;
|
if (mmgr == ASE_NULL) return ASE_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
sll = ASE_MALLOC (mmgr, ASE_SIZEOF(ase_sll_t) + extension);
|
sll = ASE_MMGR_ALLOC (mmgr, ASE_SIZEOF(ase_sll_t) + extension);
|
||||||
if (sll == ASE_NULL) return ASE_NULL;
|
if (sll == ASE_NULL) return ASE_NULL;
|
||||||
|
|
||||||
ASE_MEMSET (sll, 0, ASE_SIZEOF(ase_sll_t) + extension);
|
ASE_MEMSET (sll, 0, ASE_SIZEOF(ase_sll_t) + extension);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ase/tgp/tgp.h>
|
#include <ase/tgp/tgp.h>
|
||||||
#include <ase/cmn/mem.h>
|
#include "../cmn/mem.h"
|
||||||
|
|
||||||
struct ase_tgp_t
|
struct ase_tgp_t
|
||||||
{
|
{
|
||||||
@ -67,18 +67,18 @@ ase_tgp_t* ase_tgp_open (ase_mmgr_t* mmgr)
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tgp = ASE_MALLOC (mmgr, ASE_SIZEOF(*tgp));
|
tgp = ASE_MMGR_ALLOC (mmgr, ASE_SIZEOF(*tgp));
|
||||||
if (tgp == ASE_NULL) return ASE_NULL;
|
if (tgp == ASE_NULL) return ASE_NULL;
|
||||||
|
|
||||||
ase_memset (tgp, 0, ASE_SIZEOF(*tgp));
|
ASE_MEMSET (tgp, 0, ASE_SIZEOF(*tgp));
|
||||||
ase_memcpy (&tgp->mmgr, mmgr, ASE_SIZEOF(*mmgr));
|
ASE_MEMCPY (&tgp->mmgr, mmgr, ASE_SIZEOF(*mmgr));
|
||||||
|
|
||||||
return tgp;
|
return tgp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ase_tgp_close (ase_tgp_t* tgp)
|
void ase_tgp_close (ase_tgp_t* tgp)
|
||||||
{
|
{
|
||||||
ASE_FREE (&tgp->mmgr, tgp);
|
ASE_MMGR_FREE (&tgp->mmgr, tgp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ase_tgp_setassocdata (ase_tgp_t* tgp, void* data)
|
void ase_tgp_setassocdata (ase_tgp_t* tgp, void* data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user