00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef GUTHTHILA_TOKEN_H
00019 #define GUTHTHILA_TOKEN_H
00020
00021 #include <guththila_defines.h>
00022 #include <guththila_stack.h>
00023 EXTERN_C_START() typedef struct guththila_token_s
00024 {
00025 short
00026 type;
00027 guththila_char_t *
00028 start;
00029 int
00030 _start;
00031
00032 size_t
00033 size;
00034 int
00035 last;
00036 int
00037 ref;
00038 }
00039 guththila_token_t;
00040 enum guththila_token_type
00041 {
00042 _Unknown =
00043 1, _name, _attribute_name, _attribute_value, _prefix,
00044 _char_data, _text_data
00045 };
00046 typedef struct guththila_tok_list_s
00047 {
00048
00049 guththila_stack_t
00050 fr_stack;
00051
00052 guththila_token_t **
00053 list;
00054 int
00055 no_list;
00056 int
00057 cur_list;
00058 int *
00059 capacity;
00060
00061 }
00062 guththila_tok_list_t;
00063
00064 #ifndef GUTHTHILA_TOK_DEF_SIZE
00065 #define GUTHTHILA_TOK_DEF_SIZE 4
00066 #endif
00067
00068 #ifndef GUTHTHILA_TOK_DEF_LIST_SIZE
00069 #define GUTHTHILA_TOK_DEF_LIST_SIZE 16
00070 #endif
00071
00072 #ifndef GUTHTHILA_TOKEN_LEN
00073 #define GUTHTHILA_TOKEN_LEN(tok) (tok->size)
00074 #endif
00075
00076 #ifndef GUTHTHILA_TOKEN_TO_STRING
00077 #define GUTHTHILA_TOKEN_TO_STRING(tok, string, _env) \
00078 { \
00079 string = (guththila_char_t *) AXIS2_MALLOC(_env->allocator, (GUTHTHILA_TOKEN_LEN(tok) + 1) * sizeof(guththila_char_t)); \
00080 memcpy(string, (tok)->start, GUTHTHILA_TOKEN_LEN(tok)); \
00081 string[GUTHTHILA_TOKEN_LEN(tok)] = 0; \
00082 }
00083 #endif
00084
00085 int GUTHTHILA_CALL
00086 guththila_tok_list_init(
00087 guththila_tok_list_t * tok_list,
00088 const axutil_env_t * env);
00089 void GUTHTHILA_CALL
00090 guththila_tok_list_free(
00091 guththila_tok_list_t * tok_list,
00092 const axutil_env_t * env);
00093 guththila_token_t *
00094 GUTHTHILA_CALL guththila_tok_list_get_token(guththila_tok_list_t * tok_list,
00095 const axutil_env_t * env);
00096 int GUTHTHILA_CALL
00097 guththila_tok_list_release_token(
00098 guththila_tok_list_t * tok_list,
00099 guththila_token_t * token,
00100 const axutil_env_t * env);
00101 void GUTHTHILA_CALL
00102 guththila_tok_list_free_data(
00103 guththila_tok_list_t * tok_list,
00104 const axutil_env_t * env);
00105 int GUTHTHILA_CALL
00106 guththila_tok_list_grow(
00107 guththila_tok_list_t * tok_list,
00108 const axutil_env_t * env);
00109 int GUTHTHILA_CALL
00110 guththila_tok_str_cmp(
00111 guththila_token_t * tok,
00112 guththila_char_t *str,
00113 size_t str_len,
00114 const axutil_env_t * env);
00115 int GUTHTHILA_CALL
00116 guththila_tok_tok_cmp(
00117 guththila_token_t * tok1,
00118 guththila_token_t * tok2,
00119 const axutil_env_t * env);
00120 void GUTHTHILA_CALL
00121 guththila_set_token(
00122 guththila_token_t* tok,
00123 guththila_char_t* start,
00124 short type,
00125 int size,
00126 int _start,
00127 int last,
00128 int ref,
00129 const axutil_env_t* env);
00130 EXTERN_C_END()
00131 #endif
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146