Index: trunk/src_plugins/order/constraint.c =================================================================== --- trunk/src_plugins/order/constraint.c (revision 36873) +++ trunk/src_plugins/order/constraint.c (revision 36874) @@ -322,7 +322,7 @@ pcb_ordc_exec_node(ctx, &a, node->ch_first); pcb_ordc_exec_node(ctx, &b, node->ch_first->next); - ctx->error_cb(ctx, a.val.s, b.val.s); /* no need to convert; grammar ensures static strings */ + ctx->error_cb(ctx, a.val.s, b.val.s, &node->ch_first->ucache); /* no need to convert; grammar ensures static strings */ val_free(&a); val_free(&b); break; @@ -351,7 +351,7 @@ break; /* everything evaluates to error */ } - ctx->var_cb(ctx, dst, node->val.s); /* no need to convert; grammar ensures static string */ + ctx->var_cb(ctx, dst, node->val.s, &node->ucache); /* no need to convert; grammar ensures static string */ if (dst->type == PCB_ORDC_VERR) rnd_message(RND_MSG_ERROR, "order: constraint script error: no such variable '%s'\n", node->val.s); break; Index: trunk/src_plugins/order/constraint.h =================================================================== --- trunk/src_plugins/order/constraint.h (revision 36873) +++ trunk/src_plugins/order/constraint.h (revision 36874) @@ -48,6 +48,7 @@ double d; char *s; } val; + void *ucache; pcb_ordc_node_t *ch_first, *next; }; @@ -67,8 +68,14 @@ pcb_ordc_node_t *root; /*** application provided callbacks ***/ - void (*error_cb)(pcb_ordc_ctx_t *ctx, const char *varname, const char *msg); - void (*var_cb)(pcb_ordc_ctx_t *ctx, pcb_ordc_val_t *dst, const char *varname); + /* note: ucache is a (void *) stored in the node triggering the call; the + caller may cache varname resolution there */ + + /* called on error() from the script */ + void (*error_cb)(pcb_ordc_ctx_t *ctx, const char *varname, const char *msg, void **ucache); + + /* called on $var from the script, should load dst->type and dst->val */ + void (*var_cb)(pcb_ordc_ctx_t *ctx, pcb_ordc_val_t *dst, const char *varname, void **ucache); }; int pcb_ordc_parse_str(pcb_ordc_ctx_t *ctx, const char *script);