From 422719200ef68efdd8b2e86010188389e6ea3fe9 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Thu, 9 Dec 2021 16:56:00 +0100 Subject: [PATCH] re-enable parameters in agauss function fixes bug #564 reported by Stefan Schippers If nested braces {..{ }...} have been created, replace the inner { } by ( ) --- src/frontend/inpcom.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 299286b8f..18b2992a9 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -7543,6 +7543,27 @@ static void inp_quote_params(struct card *c, struct card *end_c, } } } + /* Now check if we have nested {..{ }...}, which is not accepted by numparam code. + Replace the inner { } by ( ) */ + char* cut_line = c->line; + cut_line = strchr(cut_line, '{'); + if (cut_line) { + int level = 1; + cut_line++; + while (*cut_line != '\0') { + if (*cut_line == '{') { + level++; + if (level > 1) + *cut_line = '('; + } + else if (*cut_line == '}') { + if (level > 1) + *cut_line = ')'; + level--; + } + cut_line++; + } + } } }