From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29449 invoked from network); 19 Jan 2000 12:46:38 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 19 Jan 2000 12:46:38 -0000 Received: (qmail 10643 invoked by alias); 19 Jan 2000 12:46:29 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9365 Received: (qmail 10635 invoked from network); 19 Jan 2000 12:46:27 -0000 To: zsh-workers@sunsite.auc.dk Subject: Re: If someone wants to try... In-reply-to: "Sven Wischnowsky"'s message of "Mon, 17 Jan 2000 13:50:03 +0100." <200001171250.NAA21712@beta.informatik.hu-berlin.de> Date: Wed, 19 Jan 2000 12:48:50 +0000 From: Peter Stephenson Message-Id: Sven Wischnowsky wrote: > Note that I'm not sure if this should be used in the distribution > before the next official beta. Well, we can't (or, rather, won't) test it if it isn't in. I've found three problems, described and supposedly fixed below. If all the basic things get fixed, I'm tempted to put the whole thing in to the source and see what happens. In particular, I'm not sad that dupstruct() and all its relatives have vanished. That was the main use for having routines that either used the heap or permanent allocation. If this means we're now (nearly) in a position to use either explicitly, and hence junk all the HEAPALLOC/PERMALLOC stuff, it would make me very happy. Problems: First `[ ... ]' dumps core. Is this the right fix (the middle parse.c hunk)? It seems to work. I've added a debugging test for other unhandled codes, and a couple of tests to Test/07cond.ztst (strictly these were waiting for tests for builtins to come along, but the more the merrier). Second: % [[ ( -z foo && -z foo ) || -z foo ]] zsh: bad cond code It looks like the offsets for skipping chunks of `&&' and `||' weren't right. The text.c bit did work (e.g. if you embed that test in a function and look at it), so I've assumed it's the chunk in evalcond() that's wrong. The offsets now seem to be right, although it's possible I've been unnecessarily conservative in using variables. I've added a test for this, too. Third, the point already noted by Tanaka Akira, but fixed by Sven in 9361, which boils down to: unset NULLCMD print "$(pc++; + Wordcode pcode = state->pc++; + wordcode code = *pcode; int ctype = WC_COND_TYPE(code); switch (ctype) { @@ -57,7 +58,7 @@ fprintf(stderr, " %s", condstr[ctype]); return evalcond(state); } else { - state->pc += WC_COND_SKIP(code) - 1; + state->pc = pcode + (WC_COND_SKIP(code) + 1); return 0; } case COND_OR: @@ -66,7 +67,7 @@ fprintf(stderr, " %s", condstr[ctype]); return evalcond(state); } else { - state->pc += WC_COND_SKIP(code) - 1; + state->pc = pcode + (WC_COND_SKIP(code) + 1); return 1; } case COND_MOD: --- Src/parse.c.cond Tue Jan 18 21:35:08 2000 +++ Src/parse.c Tue Jan 18 21:43:42 2000 @@ -2217,6 +2217,14 @@ } } break; + case N_COND: + eccond((Cond) n); + break; +#ifdef DEBUG + default: + dputs("BUG: node type not handled in ecomp()."); + break; +#endif } } -- Peter Stephenson