This commit is contained in:
2008-09-05 04:58:08 +00:00
parent fd2eb3f012
commit f90fffc853
20 changed files with 487 additions and 363 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: str.h 352 2008-08-31 10:55:59Z baconevi $
* $Id: str.h 363 2008-09-04 10:58:08Z baconevi $
*
* {License}
*/
@ -21,6 +21,8 @@ typedef struct ase_str_t ase_str_t;
struct ase_str_t
{
ase_mmgr_t* mmgr;
ase_sizer_t sizer;
ase_char_t* buf;
ase_size_t size;
ase_size_t capa;
@ -216,6 +218,58 @@ int ase_str_yield (
int new_capa /* new capacity in number of characters */
);
/*
* NAME: get the sizer
*
* DESCRIPTION:
* The ase_str_getsizer() function returns the sizer specified.
*
* RETURNS: a sizer function set or ASE_NULL if no sizer is set.
*/
ase_sizer_t ase_str_getsizer (
ase_str_t* str /* a dynamic string */
);
/*
* NAME: specify a sizer
*
* DESCRIPTION:
* The ase_str_setsizer() function specify a new sizer for a dynamic string.
* With no sizer specified, the dynamic string doubles the current buffer
* when it needs to increase its size.
*/
void ase_str_setsizer (
ase_str_t* str /* a dynamic string */,
ase_sizer_t sizer /* a sizer function */
);
/*
* NAME: get capacity
*
* DESCRIPTION:
* The ase_str_getcapa() function returns the current capacity.
*
* RETURNS: the current capacity in number of characters.
*/
ase_size_t ase_str_getcapa (
ase_str_t* str /* a dynamic string */
);
/*
* NAME: set new capacity
*
* DESCRIPTION:
* The ase_str_setcapa() function set new capacity. If the new capacity
* is smaller than the old, the overflowing characters are removed from
* from the buffer.
*
* RETURNS: -1 on failure, a new capacity on success
*/
ase_size_t ase_str_setcapa (
ase_str_t* str /* a dynamic string */,
ase_size_t capa /* a new capacity */
);
void ase_str_clear (ase_str_t* str);
void ase_str_swap (ase_str_t* str, ase_str_t* str2);

View File

@ -1,5 +1,5 @@
/*
* $Id: types.h 354 2008-08-31 10:57:24Z baconevi $
* $Id: types.h 363 2008-09-04 10:58:08Z baconevi $
*
* {License}
*/
@ -345,26 +345,6 @@ struct ase_mmgr_t
void* data;
};
/*
struct ase_ccls_t
{
ase_isccls_t is_upper;
ase_isccls_t is_lower;
ase_isccls_t is_alpha;
ase_isccls_t is_digit;
ase_isccls_t is_xdigit;
ase_isccls_t is_alnum;
ase_isccls_t is_space;
ase_isccls_t is_print;
ase_isccls_t is_graph;
ase_isccls_t is_cntrl;
ase_isccls_t is_punct;
ase_toccls_t to_upper;
ase_toccls_t to_lower;
void* data;
};
*/
struct ase_ccls_t
{
ase_bool_t (*is) (void* data, ase_cint_t c, int type);
@ -372,4 +352,14 @@ struct ase_ccls_t
void* data;
};
/*
* NAME: determine the size of data
*
* DESCRIPTION:
* The ase_sizer_t is a generic type used by many other modules usually to
* get the new size for resizing data structure.
*/
typedef ase_size_t (*ase_sizer_t) (void* data);
#endif

View File

@ -1,5 +1,5 @@
pkginclude_HEADERS = helper.h ctype.h getopt.h http.h main.h stdio.h
pkginclude_HEADERS = http.h main.h stdio.h
pkgincludedir= $(includedir)/ase/utl