2000-08-15
2000-08-15 01:25:33 by Martin Stjernholm <mast@lysator.liu.se>
-
0f998bf1d4677cb04f6abe3cf72918d7ffe2f3a2
(156 lines)
(+79/-77)
[
Show
| Annotate
]
Branch: 5.2
Fixed frame initialization bug. Trig a parse error if content is sent
to an empty element tag. Fixed TRACE_LEAVE calls.
Rev: server/etc/modules/RXML.pmod/module.pmod:1.101
2:
//!
//! Created 1999-07-30 by Martin Stjernholm.
//!
- //! $Id: module.pmod,v 1.100 2000/08/12 21:29:21 mast Exp $
+ //! $Id: module.pmod,v 1.101 2000/08/15 01:25:33 mast Exp $
//! Kludge: Must use "RXML.refs" somewhere for the whole module to be
//! loaded correctly.
1551:
Type content_type;
//! The type of the content.
- mixed content;
+ mixed content = nil;
//! The content, if any. Set before do_process() and do_return() are
//! called. Initialized to RXML.nil every time the frame executed.
1567:
//! necessary. An exception (which this frame can't catch) is thrown
//! if conversion is impossible.
- mixed result;
+ mixed result = nil;
//! The result, which is assumed to be either RXML.nil or a valid
//! value according to result_type. The exec arrays returned by e.g.
//! do_return() changes this. It may also be set directly.
2212:
ENTER_SCOPE (ctx, this);
for (; iter > 0; iter--) {
- if (raw_content && raw_content != "") { // Got nested parsing to do.
+ if (raw_content && raw_content != "")
+ if (flags & FLAG_EMPTY_ELEMENT)
+ parse_error ("This tag doesn't handle content.\n");
+ else { // Got nested parsing to do.
int finished = 0;
if (!subparser) { // The nested content is not yet parsed.
if (this->local_tags) {
2251: Inside #if defined(DEBUG)
if (flags & FLAG_STREAM_RESULT) {
#ifdef DEBUG
if (!zero_type (ctx->unwind_state->stream_piece))
- fatal_error ("Internal error: "
- "Clobbering unwind_state->stream_piece.\n");
+ fatal_error ("Internal error: Clobbering "
+ "unwind_state->stream_piece.\n");
#endif
if (result_type->encoding_type ?
result_type->encoding_type !=
2265:
exec = 0;
}
else if (flags & FLAG_STREAM_RESULT) {
- // do_process() finished the stream. Ignore remaining content.
+ // do_process() finished the stream.
+ // Ignore remaining content.
ctx->unwind_state = 0;
piece = nil;
break;
2408:
ustate[this] = ({err, eval_state, iter, raw_content, subparser, piece,
exec, orig_tag_set, ctx->new_runtime_tags});
- if (id->misc->trace_leave && tag)
+
TRACE_LEAVE (action);
}
else {
- if (id->misc->trace_leave && tag)
+
TRACE_LEAVE ("exception");
ctx->handle_exception (err, parser); // Will rethrow unknown errors.
result = nil;
2436:
}
}
else
- if (id->misc->trace_leave && tag)
+
TRACE_LEAVE ("");
} while (0); // Breaks go here.