From 57f20719e1cfaea77b67cb26e26de7fe4d7f9b2e Mon Sep 17 00:00:00 2001 From: Chris Liddell Date: Wed, 3 May 2017 12:05:45 +0100 Subject: Bug 697846: revision to commit 4f83478c88 (.eqproc) When using the "DELAYBIND" feature, it turns out that .eqproc can be called with parameters that are not both procedures. In this case, it turns out, the expectation is for the operator to return 'false', rather than throw an error. --- psi/zmisc3.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'psi/zmisc3.c') diff --git a/psi/zmisc3.c b/psi/zmisc3.c index 37293ff4b..3f01d39a3 100644 --- a/psi/zmisc3.c +++ b/psi/zmisc3.c @@ -38,6 +38,15 @@ zcliprestore(i_ctx_t *i_ctx_p) return gs_cliprestore(igs); } +static inline bool +eqproc_check_type(ref *r) +{ + return r_has_type(r, t_array) + || r_has_type(r, t_mixedarray) + || r_has_type(r, t_shortarray) + || r_has_type(r, t_oparray); +} + /* .eqproc */ /* * Test whether two procedures are equal to depth 10. @@ -58,8 +67,10 @@ zeqproc(i_ctx_t *i_ctx_p) if (ref_stack_count(&o_stack) < 2) return_error(gs_error_stackunderflow); - if (!r_is_array(op - 1) || !r_is_array(op)) { - return_error(gs_error_typecheck); + if (!eqproc_check_type(op -1) || !eqproc_check_type(op)) { + make_false(op - 1); + pop(1); + return 0; } make_array(&stack[0].proc1, 0, 1, op - 1); -- cgit v1.2.1