Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Infinite loop (?) in "typeset"



Bart Schaefer wrote:

> It seems to be trying to print out the body of the _normal function from
> the $functions assoc, but I'm not quite sure.  It repeatedly executes
> 
> 228         while (1) {
> 229             if (stack) {
> 230                 if (!(s = tstack))
> 232                 if (s->pop) {
> 237                 code = s->code;
> 238                 stack = 0;
> 239             } else {
> 243             switch (wc_code(code)) {
> 697                 stack = 1;
> 698                 break;

I couldn't reproduce it (_normal works for me). The only thing that
has changed there lately was that (..) and {..} now have a WC_END
after their bodies.

Could you try the patch below?

Bye
 Sven

diff -ru ../z.old/Src/text.c Src/text.c
--- ../z.old/Src/text.c	Mon Mar 20 11:28:50 2000
+++ Src/text.c	Mon Mar 20 11:50:23 2000
@@ -194,6 +194,9 @@
 	struct {
 	    int par;
 	} _cond;
+	struct {
+	    Wordcode end;
+	} _subsh;
     } u;
 };
 
@@ -329,8 +332,10 @@
 	    if (!s) {
 		taddstr("( ");
 		tindent++;
-		tpush(code, 1);
+		n = tpush(code, 1);
+		n->u._subsh.end = state->pc + WC_SUBSH_SKIP(code);
 	    } else {
+		state->pc = s->u._subsh.end;
 		tindent--;
 		taddstr(" )");
 		stack = 1;
@@ -340,8 +345,10 @@
 	    if (!s) {
 		taddstr("{ ");
 		tindent++;
-		tpush(code, 1);
+		n = tpush(code, 1);
+		n->u._subsh.end = state->pc + WC_CURSH_SKIP(code);
 	    } else {
+		state->pc = s->u._subsh.end;
 		tindent--;
 		taddstr(" }");
 		stack = 1;

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author