2001-07-19
2001-07-19 00:05:27 by Martin Stjernholm <mast@lysator.liu.se>
-
f853b844319a6a66e4ec42fbcb9a5666b05779b0
(58 lines)
(+41/-17)
[
Show
| Annotate
]
Branch: 5.2
Fixed a binding bug in PikeCompile. Be more failsafe when keeping
track of the frame depth, which ought to fix [bug 1874 (#1874)] that was
caused by an earlier context never being finished correctly.
Rev: server/etc/modules/RXML.pmod/module.pmod:1.206
2:
//
// Created 1999-07-30 by Martin Stjernholm.
//
- // $Id: module.pmod,v 1.205 2001/07/16 21:33:21 mast Exp $
+ // $Id: module.pmod,v 1.206 2001/07/19 00:05:27 mast Exp $
// Kludge: Must use "RXML.refs" somewhere for the whole module to be
// loaded correctly.
67:
// #define RXML_ENCODE_DEBUG
// #define TYPE_OBJ_DEBUG
// #define PARSER_OBJ_DEBUG
+ // #define FRAME_DEPTH_DEBUG
#ifdef RXML_OBJ_DEBUG
119:
# define DO_IF_MODULE_DEBUG(code...)
#endif
+ #ifdef FRAME_DEPTH_DEBUG
+ # define FRAME_DEPTH_MSG(msg...) report_debug (msg)
+ #else
+ # define FRAME_DEPTH_MSG(msg...)
+ #endif
+
#define _LITERAL(X) #X
#define LITERAL(X) _LITERAL (X)
1781: Inside #if defined(DEBUG)
#ifdef DEBUG
private int eval_finished = 0;
- private mixed foo;
+
#endif
final void eval_finish()
// Called at the end of the evaluation in this context.
{
- if (!frame_depth && tag_set) {
+ FRAME_DEPTH_MSG ("%*s%O eval_finish\n", frame_depth, "", this_object());
+ if (!frame_depth) {
#ifdef DEBUG
- if (eval_finished) fatal_error ("Context already finished.\n" + foo);
+ if (eval_finished) fatal_error ("Context already finished.\n");
eval_finished = 1;
- foo = describe_backtrace (backtrace());
+
#endif
- tag_set->call_eval_finish_funs (this_object());
+ if (tag_set) tag_set->call_eval_finish_funs (this_object());
if (p_code_comp) p_code_comp->compile(); // Fix all delayed resolves.
}
}
3267:
up = ctx->frame;
ctx->frame = this_object();
ctx->frame_depth++;
+ FRAME_DEPTH_MSG ("%*s%O frame_depth increase line %d\n",
+ ctx->frame_depth, "", this_object(), __LINE__);
process_tag:
while (1) { // Looping only when continuing in streaming mode.
3602:
if (ctx->new_runtime_tags)
_handle_runtime_tags (ctx, evaler);
- #define CLEANUP_1 do { \
+ #define CLEANUP do { \
if (in_args) args = in_args; \
if (in_content) content = in_content; \
- } while (0)
-
- #define CLEANUP_2 do { \
+
ctx->make_p_code = orig_make_p_code; \
if (orig_tag_set) ctx->tag_set = orig_tag_set; \
ctx->frame = up; \
-
+ FRAME_DEPTH_MSG ("%*s%O frame_depth decrease line %d\n", \
+ ctx->frame_depth, "", this_object(), \
+ __LINE__); \
ctx->frame_depth--; \
} while (0)
- CLEANUP_1;
- CLEANUP_2;
+ CLEANUP;
THIS_TAG_TOP_DEBUG ("Done\n");
TRACE_LEAVE ("");
3710:
THIS_TAG_TOP_DEBUG ("Exception\n");
TRACE_LEAVE ("exception");
- CLEANUP_1;
+ err = catch {
ctx->handle_exception (err, evaler); // Will rethrow unknown errors.
- CLEANUP_2;
+ };
+ CLEANUP;
+ if (err) throw (err);
return result = nil;
}
fatal_error ("Should not get here.\n");
4182:
// variable names containing ':' are thus not accessible this way.
sscanf (varref, "%[^:]:%s", varref, encoding);
context->frame_depth++;
+ FRAME_DEPTH_MSG ("%*s%O frame_depth increase line %d\n",
+ context->frame_depth, "", varref, __LINE__);
splitted = context->parse_user_var (varref, 1);
if (splitted[0] == 1) {
4226:
}) {
if (objectp (err) && err->is_RXML_Backtrace) err->current_var = varref;
+ if ((err = catch {
context->handle_exception (err, this_object()); // May throw.
-
+ })) {
+ context->frame_depth--;
+ throw (err);
+ }
val = nil;
}
if (PCode p_code = evaler->p_code)
p_code->add (VarRef (splitted[0], splitted[1..], encoding, want_type));
}
-
+ FRAME_DEPTH_MSG ("%*s%O frame_depth increase line %d\n",
+ context->frame_depth, "", varref, __LINE__);
context->frame_depth--;
return val;
}
5743:
// Note: Parser.handle_var more or less duplicates this.
ctx->frame_depth++;
+ FRAME_DEPTH_MSG ("%*s%O frame_depth increase line %d\n",
+ ctx->frame_depth, "", this_object(), __LINE__);
mixed err = catch {
#ifdef DEBUG
5775:
TAG_DEBUG (ctx->frame, " Got value %s\n", utils->format_short (val));
#endif
+ FRAME_DEPTH_MSG ("%*s%O frame_depth decrease line %d\n",
+ ctx->frame_depth, "", this_object(), __LINE__);
ctx->frame_depth--;
return val;
};
if (objectp (err) && err->is_RXML_Backtrace) err->current_var = VAR_STRING;
-
+ FRAME_DEPTH_MSG ("%*s%O frame_depth decrease line %d\n",
+ ctx->frame_depth, "", this_object(), __LINE__);
ctx->frame_depth--;
throw (err);
}
5867:
string id = "b" + idnr++;
COMP_MSG ("%O bind %O to %s\n", this_object(), val, id);
bindings[id] = val;
- cur_ids[id] = 1;
+
return id;
}