/* c/zx-di-dec.c - WARNING: This file was automatically generated. DO NOT EDIT! * $Id$ */ /* Code generation design Copyright (c) 2006 Sampo Kellomaki (sampo@iki.fi), * All Rights Reserved. NO WARRANTY. See file COPYING for terms and conditions * of use. Some aspects of code generation were driven by schema * descriptions that were used as input and may be subject to their own copyright. * Code generation uses a template, whose copyright statement follows. */ /** dec-templ.c - XML decoder template, used in code generation ** Copyright (c) 2006-2007 Symlabs (symlabs@symlabs.com), All Rights Reserved. ** Author: Sampo Kellomaki (sampo@iki.fi) ** This is confidential unpublished proprietary source code of the author. ** NO WARRANTY, not even implied warranties. Contains trade secrets. ** Distribution prohibited unless authorized in writing. ** Licensed under Apache License 2.0, see file COPYING. ** Id: dec-templ.c,v 1.29 2007-10-11 04:54:25 sampo Exp $ ** ** 28.5.2006, created, Sampo Kellomaki (sampo@iki.fi) ** 8.8.2006, reworked namespace handling --Sampo ** 12.8.2006, added special scanning of xmlns to avoid backtracking elem recognition --Sampo ** 23.9.2006, added collection of WO information --Sampo ** 21.6.2007, improved handling of undeclared namespace prefixes --Sampo ** ** N.B: This template is meant to be processed by pd/xsd2sg.pl. Beware ** of special markers that xsd2sg.pl expects to find and understand. **/ #include "errmac.h" #include "zx.h" #include "c/zx-const.h" #include "c/zx-data.h" #include "c/zx-di-data.h" #define TPF zx_ #ifndef ZX_ATTR_DEC_EXT #define ZX_ATTR_DEC_EXT(ss) /* Extension point called just after decoding known attribute */ #endif #ifndef ZX_XMLNS_DEC_EXT #define ZX_XMLNS_DEC_EXT(ss) /* Extension point called just after decoding xmlns attribute */ #endif #ifndef ZX_UNKNOWN_ATTR_DEC_EXT #define ZX_UNKNOWN_ATTR_DEC_EXT(ss) /* Extension point called just after decoding unknown attr */ #endif #ifndef ZX_START_DEC_EXT #define ZX_START_DEC_EXT(x) /* Extension point called just after decoding element name and allocating struct, but before decoding any of the attributes. */ #endif #ifndef ZX_END_DEC_EXT #define ZX_END_DEC_EXT(x) /* Extension point called just after decoding the entire element. */ #endif #ifndef ZX_START_BODY_DEC_EXT #define ZX_START_BODY_DEC_EXT(x) /* Extension point called just after decoding element tag, including attributes, but before decoding the body of the element. */ #endif #ifndef ZX_PI_DEC_EXT #define ZX_PI_DEC_EXT(pi) /* Extension point called just after decoding processing instruction */ #endif #ifndef ZX_COMMENT_DEC_EXT #define ZX_COMMENT_DEC_EXT(comment) /* Extension point called just after decoding comment */ #endif #ifndef ZX_CONTENT_DEC #define ZX_CONTENT_DEC(ss) /* Extension point called just after decoding string content */ #endif #ifndef ZX_UNKNOWN_ELEM_DEC_EXT #define ZX_UNKNOWN_ELEM_DEC_EXT(elem) /* Extension point called just after decoding unknown element */ #endif /* FUNC(zx_DEC_di_EndpointContext) */ #define EL_NAME di_EndpointContext #define EL_STRUCT zx_di_EndpointContext_s #define EL_NS di #define EL_TAG EndpointContext /* Called by: */ struct zx_di_EndpointContext_s* zx_DEC_di_EndpointContext(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_EndpointContext_s* x = ZX_ZALLOC(c, struct zx_di_EndpointContext_s); x->gg.g.tok = zx_di_EndpointContext_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_Address_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->Address->g; x->Address = el; break; case zx_sbf_Framework_ELEM: el = (struct zx_elem_s*)zx_DEC_sbf_Framework(c, ns); el->g.n = &x->Framework->gg.g; x->Framework = (struct zx_sbf_Framework_s*)el; break; case zx_di_SecurityMechID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->SecurityMechID->g; x->SecurityMechID = el; break; case zx_di_Action_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->Action->g; x->Action = el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_Framework) */ #define EL_NAME di_Framework #define EL_STRUCT zx_di_Framework_s #define EL_NS di #define EL_TAG Framework /* Called by: */ struct zx_di_Framework_s* zx_DEC_di_Framework(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_Framework_s* x = ZX_ZALLOC(c, struct zx_di_Framework_s); x->gg.g.tok = zx_di_Framework_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case zx_version_ATTR: ss = ZX_ZALLOC(c, struct zx_str); ss->g.n = &x->version->g; x->version = ss; ZX_ATTR_DEC_EXT(ss); break; case zx_wsu_Id_ATTR: ss = ZX_ZALLOC(c, struct zx_str); ss->g.n = &x->Id->g; x->Id = ss; ZX_ATTR_DEC_EXT(ss); break; case zx_e_actor_ATTR: ss = ZX_ZALLOC(c, struct zx_str); ss->g.n = &x->actor->g; x->actor = ss; ZX_ATTR_DEC_EXT(ss); break; case zx_e_mustUnderstand_ATTR: ss = ZX_ZALLOC(c, struct zx_str); ss->g.n = &x->mustUnderstand->g; x->mustUnderstand = ss; ZX_ATTR_DEC_EXT(ss); break; case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_Keys) */ #define EL_NAME di_Keys #define EL_STRUCT zx_di_Keys_s #define EL_NS di #define EL_TAG Keys /* Called by: */ struct zx_di_Keys_s* zx_DEC_di_Keys(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_Keys_s* x = ZX_ZALLOC(c, struct zx_di_Keys_s); x->gg.g.tok = zx_di_Keys_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_md_KeyDescriptor_ELEM: el = (struct zx_elem_s*)zx_DEC_md_KeyDescriptor(c, ns); el->g.n = &x->KeyDescriptor->gg.g; x->KeyDescriptor = (struct zx_md_KeyDescriptor_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_Options) */ #define EL_NAME di_Options #define EL_STRUCT zx_di_Options_s #define EL_NS di #define EL_TAG Options /* Called by: */ struct zx_di_Options_s* zx_DEC_di_Options(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_Options_s* x = ZX_ZALLOC(c, struct zx_di_Options_s); x->gg.g.tok = zx_di_Options_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_Option_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->Option->g; x->Option = el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_Query) */ #define EL_NAME di_Query #define EL_STRUCT zx_di_Query_s #define EL_NS di #define EL_TAG Query /* Called by: */ struct zx_di_Query_s* zx_DEC_di_Query(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_Query_s* x = ZX_ZALLOC(c, struct zx_di_Query_s); x->gg.g.tok = zx_di_Query_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_RequestedService_ELEM: el = (struct zx_elem_s*)zx_DEC_di_RequestedService(c, ns); el->g.n = &x->RequestedService->gg.g; x->RequestedService = (struct zx_di_RequestedService_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_QueryResponse) */ #define EL_NAME di_QueryResponse #define EL_STRUCT zx_di_QueryResponse_s #define EL_NS di #define EL_TAG QueryResponse /* Called by: */ struct zx_di_QueryResponse_s* zx_DEC_di_QueryResponse(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_QueryResponse_s* x = ZX_ZALLOC(c, struct zx_di_QueryResponse_s); x->gg.g.tok = zx_di_QueryResponse_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_lu_Status_ELEM: el = (struct zx_elem_s*)zx_DEC_lu_Status(c, ns); el->g.n = &x->Status->gg.g; x->Status = (struct zx_lu_Status_s*)el; break; case zx_a_EndpointReference_ELEM: el = (struct zx_elem_s*)zx_DEC_a_EndpointReference(c, ns); el->g.n = &x->EndpointReference->gg.g; x->EndpointReference = (struct zx_a_EndpointReference_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_RequestedService) */ #define EL_NAME di_RequestedService #define EL_STRUCT zx_di_RequestedService_s #define EL_NS di #define EL_TAG RequestedService /* Called by: */ struct zx_di_RequestedService_s* zx_DEC_di_RequestedService(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_RequestedService_s* x = ZX_ZALLOC(c, struct zx_di_RequestedService_s); x->gg.g.tok = zx_di_RequestedService_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case zx_reqID_ATTR: ss = ZX_ZALLOC(c, struct zx_str); ss->g.n = &x->reqID->g; x->reqID = ss; ZX_ATTR_DEC_EXT(ss); break; case zx_resultsType_ATTR: ss = ZX_ZALLOC(c, struct zx_str); ss->g.n = &x->resultsType->g; x->resultsType = ss; ZX_ATTR_DEC_EXT(ss); break; case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_ServiceType_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->ServiceType->g; x->ServiceType = el; break; case zx_di_ProviderID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->ProviderID->g; x->ProviderID = el; break; case zx_di_Options_ELEM: el = (struct zx_elem_s*)zx_DEC_di_Options(c, ns); el->g.n = &x->Options->gg.g; x->Options = (struct zx_di_Options_s*)el; break; case zx_di_SecurityMechID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->SecurityMechID->g; x->SecurityMechID = el; break; case zx_di_Framework_ELEM: el = (struct zx_elem_s*)zx_DEC_di_Framework(c, ns); el->g.n = &x->Framework->gg.g; x->Framework = (struct zx_di_Framework_s*)el; break; case zx_di_Action_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->Action->g; x->Action = el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SecurityContext) */ #define EL_NAME di_SecurityContext #define EL_STRUCT zx_di_SecurityContext_s #define EL_NS di #define EL_TAG SecurityContext /* Called by: */ struct zx_di_SecurityContext_s* zx_DEC_di_SecurityContext(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SecurityContext_s* x = ZX_ZALLOC(c, struct zx_di_SecurityContext_s); x->gg.g.tok = zx_di_SecurityContext_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_SecurityMechID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->SecurityMechID->g; x->SecurityMechID = el; break; case zx_sec_Token_ELEM: el = (struct zx_elem_s*)zx_DEC_sec_Token(c, ns); el->g.n = &x->Token->gg.g; x->Token = (struct zx_sec_Token_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_ServiceContext) */ #define EL_NAME di_ServiceContext #define EL_STRUCT zx_di_ServiceContext_s #define EL_NS di #define EL_TAG ServiceContext /* Called by: */ struct zx_di_ServiceContext_s* zx_DEC_di_ServiceContext(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_ServiceContext_s* x = ZX_ZALLOC(c, struct zx_di_ServiceContext_s); x->gg.g.tok = zx_di_ServiceContext_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_ServiceType_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->ServiceType->g; x->ServiceType = el; break; case zx_di_Options_ELEM: el = (struct zx_elem_s*)zx_DEC_di_Options(c, ns); el->g.n = &x->Options->gg.g; x->Options = (struct zx_di_Options_s*)el; break; case zx_di_EndpointContext_ELEM: el = (struct zx_elem_s*)zx_DEC_di_EndpointContext(c, ns); el->g.n = &x->EndpointContext->gg.g; x->EndpointContext = (struct zx_di_EndpointContext_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMD) */ #define EL_NAME di_SvcMD #define EL_STRUCT zx_di_SvcMD_s #define EL_NS di #define EL_TAG SvcMD /* Called by: */ struct zx_di_SvcMD_s* zx_DEC_di_SvcMD(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMD_s* x = ZX_ZALLOC(c, struct zx_di_SvcMD_s); x->gg.g.tok = zx_di_SvcMD_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case zx_svcMDID_ATTR: ss = ZX_ZALLOC(c, struct zx_str); ss->g.n = &x->svcMDID->g; x->svcMDID = ss; ZX_ATTR_DEC_EXT(ss); break; case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_Abstract_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->Abstract->g; x->Abstract = el; break; case zx_di_ProviderID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->ProviderID->g; x->ProviderID = el; break; case zx_di_ServiceContext_ELEM: el = (struct zx_elem_s*)zx_DEC_di_ServiceContext(c, ns); el->g.n = &x->ServiceContext->gg.g; x->ServiceContext = (struct zx_di_ServiceContext_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDAssociationAdd) */ #define EL_NAME di_SvcMDAssociationAdd #define EL_STRUCT zx_di_SvcMDAssociationAdd_s #define EL_NS di #define EL_TAG SvcMDAssociationAdd /* Called by: */ struct zx_di_SvcMDAssociationAdd_s* zx_DEC_di_SvcMDAssociationAdd(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDAssociationAdd_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDAssociationAdd_s); x->gg.g.tok = zx_di_SvcMDAssociationAdd_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_SvcMDID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->SvcMDID->g; x->SvcMDID = el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDAssociationAddResponse) */ #define EL_NAME di_SvcMDAssociationAddResponse #define EL_STRUCT zx_di_SvcMDAssociationAddResponse_s #define EL_NS di #define EL_TAG SvcMDAssociationAddResponse /* Called by: */ struct zx_di_SvcMDAssociationAddResponse_s* zx_DEC_di_SvcMDAssociationAddResponse(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDAssociationAddResponse_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDAssociationAddResponse_s); x->gg.g.tok = zx_di_SvcMDAssociationAddResponse_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_lu_Status_ELEM: el = (struct zx_elem_s*)zx_DEC_lu_Status(c, ns); el->g.n = &x->Status->gg.g; x->Status = (struct zx_lu_Status_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDAssociationDelete) */ #define EL_NAME di_SvcMDAssociationDelete #define EL_STRUCT zx_di_SvcMDAssociationDelete_s #define EL_NS di #define EL_TAG SvcMDAssociationDelete /* Called by: */ struct zx_di_SvcMDAssociationDelete_s* zx_DEC_di_SvcMDAssociationDelete(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDAssociationDelete_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDAssociationDelete_s); x->gg.g.tok = zx_di_SvcMDAssociationDelete_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_SvcMDID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->SvcMDID->g; x->SvcMDID = el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDAssociationDeleteResponse) */ #define EL_NAME di_SvcMDAssociationDeleteResponse #define EL_STRUCT zx_di_SvcMDAssociationDeleteResponse_s #define EL_NS di #define EL_TAG SvcMDAssociationDeleteResponse /* Called by: */ struct zx_di_SvcMDAssociationDeleteResponse_s* zx_DEC_di_SvcMDAssociationDeleteResponse(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDAssociationDeleteResponse_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDAssociationDeleteResponse_s); x->gg.g.tok = zx_di_SvcMDAssociationDeleteResponse_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_lu_Status_ELEM: el = (struct zx_elem_s*)zx_DEC_lu_Status(c, ns); el->g.n = &x->Status->gg.g; x->Status = (struct zx_lu_Status_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDAssociationQuery) */ #define EL_NAME di_SvcMDAssociationQuery #define EL_STRUCT zx_di_SvcMDAssociationQuery_s #define EL_NS di #define EL_TAG SvcMDAssociationQuery /* Called by: */ struct zx_di_SvcMDAssociationQuery_s* zx_DEC_di_SvcMDAssociationQuery(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDAssociationQuery_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDAssociationQuery_s); x->gg.g.tok = zx_di_SvcMDAssociationQuery_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_SvcMDID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->SvcMDID->g; x->SvcMDID = el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDAssociationQueryResponse) */ #define EL_NAME di_SvcMDAssociationQueryResponse #define EL_STRUCT zx_di_SvcMDAssociationQueryResponse_s #define EL_NS di #define EL_TAG SvcMDAssociationQueryResponse /* Called by: */ struct zx_di_SvcMDAssociationQueryResponse_s* zx_DEC_di_SvcMDAssociationQueryResponse(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDAssociationQueryResponse_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDAssociationQueryResponse_s); x->gg.g.tok = zx_di_SvcMDAssociationQueryResponse_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_lu_Status_ELEM: el = (struct zx_elem_s*)zx_DEC_lu_Status(c, ns); el->g.n = &x->Status->gg.g; x->Status = (struct zx_lu_Status_s*)el; break; case zx_di_SvcMDID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->SvcMDID->g; x->SvcMDID = el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDDelete) */ #define EL_NAME di_SvcMDDelete #define EL_STRUCT zx_di_SvcMDDelete_s #define EL_NS di #define EL_TAG SvcMDDelete /* Called by: */ struct zx_di_SvcMDDelete_s* zx_DEC_di_SvcMDDelete(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDDelete_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDDelete_s); x->gg.g.tok = zx_di_SvcMDDelete_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_SvcMDID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->SvcMDID->g; x->SvcMDID = el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDDeleteResponse) */ #define EL_NAME di_SvcMDDeleteResponse #define EL_STRUCT zx_di_SvcMDDeleteResponse_s #define EL_NS di #define EL_TAG SvcMDDeleteResponse /* Called by: */ struct zx_di_SvcMDDeleteResponse_s* zx_DEC_di_SvcMDDeleteResponse(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDDeleteResponse_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDDeleteResponse_s); x->gg.g.tok = zx_di_SvcMDDeleteResponse_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_lu_Status_ELEM: el = (struct zx_elem_s*)zx_DEC_lu_Status(c, ns); el->g.n = &x->Status->gg.g; x->Status = (struct zx_lu_Status_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDQuery) */ #define EL_NAME di_SvcMDQuery #define EL_STRUCT zx_di_SvcMDQuery_s #define EL_NS di #define EL_TAG SvcMDQuery /* Called by: */ struct zx_di_SvcMDQuery_s* zx_DEC_di_SvcMDQuery(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDQuery_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDQuery_s); x->gg.g.tok = zx_di_SvcMDQuery_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_SvcMDID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->SvcMDID->g; x->SvcMDID = el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDQueryResponse) */ #define EL_NAME di_SvcMDQueryResponse #define EL_STRUCT zx_di_SvcMDQueryResponse_s #define EL_NS di #define EL_TAG SvcMDQueryResponse /* Called by: */ struct zx_di_SvcMDQueryResponse_s* zx_DEC_di_SvcMDQueryResponse(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDQueryResponse_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDQueryResponse_s); x->gg.g.tok = zx_di_SvcMDQueryResponse_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_lu_Status_ELEM: el = (struct zx_elem_s*)zx_DEC_lu_Status(c, ns); el->g.n = &x->Status->gg.g; x->Status = (struct zx_lu_Status_s*)el; break; case zx_di_SvcMD_ELEM: el = (struct zx_elem_s*)zx_DEC_di_SvcMD(c, ns); el->g.n = &x->SvcMD->gg.g; x->SvcMD = (struct zx_di_SvcMD_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDRegister) */ #define EL_NAME di_SvcMDRegister #define EL_STRUCT zx_di_SvcMDRegister_s #define EL_NS di #define EL_TAG SvcMDRegister /* Called by: */ struct zx_di_SvcMDRegister_s* zx_DEC_di_SvcMDRegister(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDRegister_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDRegister_s); x->gg.g.tok = zx_di_SvcMDRegister_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_SvcMD_ELEM: el = (struct zx_elem_s*)zx_DEC_di_SvcMD(c, ns); el->g.n = &x->SvcMD->gg.g; x->SvcMD = (struct zx_di_SvcMD_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDRegisterResponse) */ #define EL_NAME di_SvcMDRegisterResponse #define EL_STRUCT zx_di_SvcMDRegisterResponse_s #define EL_NS di #define EL_TAG SvcMDRegisterResponse /* Called by: */ struct zx_di_SvcMDRegisterResponse_s* zx_DEC_di_SvcMDRegisterResponse(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDRegisterResponse_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDRegisterResponse_s); x->gg.g.tok = zx_di_SvcMDRegisterResponse_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_lu_Status_ELEM: el = (struct zx_elem_s*)zx_DEC_lu_Status(c, ns); el->g.n = &x->Status->gg.g; x->Status = (struct zx_lu_Status_s*)el; break; case zx_di_SvcMDID_ELEM: el = zx_DEC_simple_elem(c, ns, tok); el->g.n = &x->SvcMDID->g; x->SvcMDID = el; break; case zx_di_Keys_ELEM: el = (struct zx_elem_s*)zx_DEC_di_Keys(c, ns); el->g.n = &x->Keys->gg.g; x->Keys = (struct zx_di_Keys_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDReplace) */ #define EL_NAME di_SvcMDReplace #define EL_STRUCT zx_di_SvcMDReplace_s #define EL_NS di #define EL_TAG SvcMDReplace /* Called by: */ struct zx_di_SvcMDReplace_s* zx_DEC_di_SvcMDReplace(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDReplace_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDReplace_s); x->gg.g.tok = zx_di_SvcMDReplace_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_di_SvcMD_ELEM: el = (struct zx_elem_s*)zx_DEC_di_SvcMD(c, ns); el->g.n = &x->SvcMD->gg.g; x->SvcMD = (struct zx_di_SvcMD_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* FUNC(zx_DEC_di_SvcMDReplaceResponse) */ #define EL_NAME di_SvcMDReplaceResponse #define EL_STRUCT zx_di_SvcMDReplaceResponse_s #define EL_NS di #define EL_TAG SvcMDReplaceResponse /* Called by: */ struct zx_di_SvcMDReplaceResponse_s* zx_DEC_di_SvcMDReplaceResponse(struct zx_ctx* c, struct zx_ns_s* ns ) { int tok; struct zx_elem_s* iternode; struct zx_elem_s* el; struct zx_str* ss; struct zx_ns_s* pop_seen; char* name; char* data; struct zx_di_SvcMDReplaceResponse_s* x = ZX_ZALLOC(c, struct zx_di_SvcMDReplaceResponse_s); x->gg.g.tok = zx_di_SvcMDReplaceResponse_ELEM; x->gg.g.ns = ns; ZX_START_DEC_EXT(x); #if 1 /* NORMALMODE */ ZX_DEC_TAG_NOT_YET_CLOSED(x->gg.g); /* The tag name has already been detected. Process attributes until '>' */ for (; c->p; ++c->p) { ZX_SKIP_WS(c,x); if (ONE_OF_2(*c->p, '>', '/')) break; if (!(data = zx_dec_attr_val(c, &name))) return 0; tok = zx_attr_lookup(c, name, data-2, &ns); switch (tok) { case ZX_TOK_XMLNS: ZX_XMLNS_DEC_EXT(ss); DD("xmlns detected(%.*s)", data-2-name, name); goto next_attr; default: ss = zx_dec_unknown_attr(c, &x->gg, name, data, tok, x->gg.g.tok); } ss->g.ns = ns; ss->g.tok = tok; ss->g.err |= ZXERR_ATTR_FLAG; ss->len = c->p - data; ss->s = data; next_attr: continue; } if (c->p) { ++c->p; if (c->p[-1] == '/' && c->p[0] == '>') { /* Tag without content */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; } } #endif /* Process contents until 'p) { next_elem: /*ZX_SKIP_WS(c,x); DO NOT SQUASH WS! EXC-CANON NEEDS IT. */ if (*c->p == '<') { potential_tag: ++c->p; switch (*c->p) { case '?': /* processing instruction */ case '!': /* comment */ if (zx_scan_pi_or_comment(c)) break; goto next_elem; case '/': /* close tag */ ++c->p; name = c->p; ZX_LOOK_FOR(c,'>'); #if defined(DEC_WRONG_ELEM) if (c->p-name != namlen || memcmp(name, nam, namlen)) #else tok = zx_elem_lookup(c, name, c->p, &ns); if (tok != x->gg.g.tok) #endif { ERR("Mismatching close tag(%.*s) tok=%d context=%d", c->p-name, name, tok, x->gg.g.tok); zx_xml_parse_err(c, '-', __FUNCTION__, "Mismatching close tag"); ZX_DEC_TAG_MISMATCH_CLOSE(x->gg.g); ++c->p; return x; } /* Legitimate close tag. Normal exit from this function. */ ++c->p; ZX_DEC_TAG_NOW_CLOSED(x->gg.g); goto out; default: if (A_Z_a_z_(*c->p)) { name = c->p; for (++c->p; *c->p && !ONE_OF_6(*c->p, ' ', '>', '/', '\n', '\r', '\t'); ++c->p) ; if (!c->p) return 0; pop_seen = zx_scan_xmlns(c); /* Prescan namespaces so that token can be correctly recognized. */ tok = zx_elem_lookup(c, name, c->p, &ns); switch (tok) { case zx_lu_Status_ELEM: el = (struct zx_elem_s*)zx_DEC_lu_Status(c, ns); el->g.n = &x->Status->gg.g; x->Status = (struct zx_lu_Status_s*)el; break; default: el = zx_known_or_unknown_elem(c, tok, &x->gg, c->p - name, name, ns); tok = ZX_TOK_NOT_FOUND; break; } el->g.wo = &x->gg.kids->g; x->gg.kids = el; zx_pop_seen(pop_seen); goto next_elem; } } /* false alarm <, fall thru */ } if (!zx_scan_data(c, &x->gg)) return x; goto potential_tag; } out: iternode = x->gg.kids; REVERSE_LIST_NEXT(x->gg.kids, iternode, g.wo); ZX_END_DEC_EXT(x); return x; look_for_not_found: zx_xml_parse_err(c, '>', __FUNCTION__, "char not found"); return x; } #undef EL_NAME #undef EL_STRUCT #undef EL_NS #undef EL_TAG /* EOF -- c/zx-di-dec.c */