2006-08-31 16:00:20 +00:00
|
|
|
/*
|
2007-02-03 10:52:36 +00:00
|
|
|
* $Id: str.h,v 1.6 2007-02-03 10:51:14 bacon Exp $
|
2007-02-03 10:47:41 +00:00
|
|
|
*
|
|
|
|
* {License}
|
2006-08-31 16:00:20 +00:00
|
|
|
*/
|
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
#ifndef _ASE_AWK_STR_H_
|
|
|
|
#define _ASE_AWK_STR_H_
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
#ifndef _ASE_AWK_AWK_H_
|
|
|
|
#error Never include this file directly. Include <ase/awk/awk.h> instead
|
2006-08-31 16:00:20 +00:00
|
|
|
#endif
|
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
#define ASE_AWK_STR_LEN(x) ((x)->size)
|
|
|
|
#define ASE_AWK_STR_SIZE(x) ((x)->size + 1)
|
|
|
|
#define ASE_AWK_STR_CAPA(x) ((x)->capa)
|
|
|
|
#define ASE_AWK_STR_BUF(x) ((x)->buf)
|
|
|
|
#define ASE_AWK_STR_CHAR(x,idx) ((x)->buf[idx])
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
typedef struct ase_awk_str_t ase_awk_str_t;
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
struct ase_awk_str_t
|
2006-08-31 16:00:20 +00:00
|
|
|
{
|
2006-10-24 04:10:12 +00:00
|
|
|
ase_char_t* buf;
|
|
|
|
ase_size_t size;
|
|
|
|
ase_size_t capa;
|
|
|
|
ase_awk_t* awk;
|
|
|
|
ase_bool_t __dynamic;
|
2006-08-31 16:00:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
ase_awk_str_t* ase_awk_str_open (
|
|
|
|
ase_awk_str_t* str, ase_size_t capa, ase_awk_t* awk);
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
void ase_awk_str_close (ase_awk_str_t* str);
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
void ase_awk_str_forfeit (ase_awk_str_t* str);
|
|
|
|
void ase_awk_str_swap (ase_awk_str_t* str, ase_awk_str_t* str2);
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
ase_size_t ase_awk_str_cpy (ase_awk_str_t* str, const ase_char_t* s);
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
ase_size_t ase_awk_str_ncpy (
|
|
|
|
ase_awk_str_t* str, const ase_char_t* s, ase_size_t len);
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
ase_size_t ase_awk_str_cat (ase_awk_str_t* str, const ase_char_t* s);
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
ase_size_t ase_awk_str_ncat (
|
|
|
|
ase_awk_str_t* str, const ase_char_t* s, ase_size_t len);
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
ase_size_t ase_awk_str_ccat (ase_awk_str_t* str, ase_char_t c);
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
ase_size_t ase_awk_str_nccat (ase_awk_str_t* str, ase_char_t c, ase_size_t len);
|
2006-08-31 16:00:20 +00:00
|
|
|
|
2006-10-24 04:10:12 +00:00
|
|
|
void ase_awk_str_clear (ase_awk_str_t* str);
|
2006-08-31 16:00:20 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|