Commit 6603c523 authored by Pekka Pessi's avatar Pekka Pessi

Added end_tag_class[].

darcs-hash:20051128221858-65a35-7220d9e5cf4ad5a94dc3bd8be1a63d99bfd34b5b.gz
parent 1c5bec45
......@@ -25,7 +25,6 @@
#ifndef SU_TAG_CLASS_H /** Defined when su_tag_class.h has been included. */
#define SU_TAG_CLASS_H
/**@SU_TAG
* @file su_tag_class.h
* @brief Tag class interface for object-oriented tags
......@@ -73,18 +72,7 @@ struct tag_class_s {
tag_value_t *return_value);
};
SU_DLL extern tag_class_t int_tag_class[];
SU_DLL extern tag_class_t uint_tag_class[];
SU_DLL extern tag_class_t bool_tag_class[];
SU_DLL extern tag_class_t ptr_tag_class[];
SU_DLL extern tag_class_t cstr_tag_class[];
SU_DLL extern tag_class_t str_tag_class[];
#define REFTAG_TYPEDEF(tag) \
{{ TAG_NAMESPACE, #tag "_ref", ref_tag_class, (tag_value_t)tag }}
SU_DLL extern tag_class_t ref_tag_class[];
SU_DLL extern tag_class_t end_tag_class[];
SU_DLL extern tag_class_t int_tag_class[];
SU_DLL extern tag_class_t uint_tag_class[];
SU_DLL extern tag_class_t bool_tag_class[];
......
......@@ -51,7 +51,7 @@ static inline int t_end(tagi_t const *t)
{
tag_type_t tt = TAG_TYPE_OF(t);
/** XXX - virtualize this */
/* XXX - virtualize this */
return tt == tag_null || tt == tag_next;
}
......
......@@ -454,54 +454,6 @@ tagi_t *t_filter(tagi_t *dst, tagi_t const filter[], tagi_t const *src, void **b
return dst;
}
tagi_t *t_null_filter(tagi_t *dst,
tagi_t const filter[],
tagi_t const *src,
void **bb)
{
if (TAG_TYPE_OF(src) == tag_null) {
if (dst) {
dst->t_tag = NULL;
dst->t_value = 0;
}
return dst + 1;
}
return dst;
}
tagi_t *t_skip_filter(tagi_t *dst,
tagi_t const filter[],
tagi_t const *src,
void **bb)
{
return dst;
}
tagi_t *t_next_filter(tagi_t *dst,
tagi_t const filter[],
tagi_t const *src,
void **bb)
{
return dst;
}
tagi_t *t_any_filter(tagi_t *dst,
tagi_t const filter[],
tagi_t const *src,
void **bb)
{
if (!src)
return dst;
else if (dst) {
return t_dup(dst, src, bb);
}
else {
dst = (tagi_t *)((char *)dst + t_len(src));
*bb = (char *)*bb + t_xtra(src, (size_t)*bb);
return dst;
}
}
tagi_t *tl_filter(tagi_t dst[],
tagi_t const filter[],
tagi_t const src[],
......@@ -835,6 +787,21 @@ tagi_t const * t_null_find(tag_type_t tt, tagi_t const lst[])
return NULL;
}
tagi_t *t_null_filter(tagi_t *dst,
tagi_t const filter[],
tagi_t const *src,
void **bb)
{
if (TAG_TYPE_OF(src) == tag_null) {
if (dst) {
dst->t_tag = NULL;
dst->t_value = 0;
}
return dst + 1;
}
return dst;
}
tag_class_t null_tag_class[1] =
{{
sizeof(null_tag_class),
......@@ -851,6 +818,36 @@ tag_class_t null_tag_class[1] =
/* tc_scan */ NULL,
}};
/* ====================================================================== */
/* end tag */
tagi_t *t_end_filter(tagi_t *dst,
tagi_t const filter[],
tagi_t const *src,
void **bb)
{
return dst;
}
tag_class_t end_tag_class[1] =
{{
sizeof(end_tag_class),
/* tc_next */ NULL,
/* tc_len */ NULL,
/* tc_move */ NULL,
/* tc_xtra */ NULL,
/* tc_dup */ NULL,
/* tc_free */ NULL,
/* tc_find */ NULL,
/* tc_snprintf */ NULL,
/* tc_filter */ t_end_filter,
/* tc_ref_set */ NULL,
/* tc_scan */ NULL,
}};
/* ====================================================================== */
/* skip tag - placeholder in tag list */
tagi_t const *t_skip_next(tagi_t const *t)
{
return t + 1;
......@@ -871,6 +868,14 @@ tagi_t *t_skip_dup(tagi_t *dst, tagi_t const *src, void **bb)
return dst;
}
tagi_t *t_skip_filter(tagi_t *dst,
tagi_t const filter[],
tagi_t const *src,
void **bb)
{
return dst;
}
tag_class_t skip_tag_class[1] =
{{
sizeof(skip_tag_class),
......@@ -887,6 +892,9 @@ tag_class_t skip_tag_class[1] =
/* tc_scan */ NULL,
}};
/* ====================================================================== */
/* next tag - jump to next tag list */
tagi_t const *t_next_next(tagi_t const *t)
{
return (tagi_t *)(t->t_value);
......@@ -913,6 +921,14 @@ tagi_t *t_next_dup(tagi_t *dst, tagi_t const *src, void **bb)
return dst;
}
tagi_t *t_next_filter(tagi_t *dst,
tagi_t const filter[],
tagi_t const *src,
void **bb)
{
return dst;
}
tag_class_t next_tag_class[1] =
{{
sizeof(next_tag_class),
......@@ -929,6 +945,26 @@ tag_class_t next_tag_class[1] =
/* tc_scan */ NULL,
}};
/* ====================================================================== */
/* any tag - match to any tag when filtering */
tagi_t *t_any_filter(tagi_t *dst,
tagi_t const filter[],
tagi_t const *src,
void **bb)
{
if (!src)
return dst;
else if (dst) {
return t_dup(dst, src, bb);
}
else {
dst = (tagi_t *)((char *)dst + t_len(src));
*bb = (char *)*bb + t_xtra(src, (size_t)*bb);
return dst;
}
}
tag_class_t any_tag_class[1] =
{{
sizeof(any_tag_class),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment