• rewrite code to no longer use statements-as-expressions

• optimise a little
• Build.sh: remove HAVE_EXPSTMT test
• Build.sh, */Makefile: sort tests, regenerate
• mksh.hts: sync clog
This commit is contained in:
tg
2008-10-28 14:32:43 +00:00
parent 5167e7398b
commit 88d7b7d08b
16 changed files with 174 additions and 229 deletions

14
expr.c
View File

@@ -2,7 +2,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.18 2008/07/12 16:56:38 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.19 2008/10/28 14:32:40 tg Exp $");
/* The order of these enums is constrained by the order of opinfo[] */
enum token {
@@ -470,22 +470,20 @@ exprtoken(Expr_state *es)
es->val = tempvar();
es->val->flag |= EXPRLVALUE;
} else {
tvar = str_nsave(es->tokp, cp - es->tokp, ATEMP);
strndupx(tvar, es->tokp, cp - es->tokp, ATEMP);
es->val = global(tvar);
afree(tvar, ATEMP);
}
es->tok = VAR;
} else if (c == '1' && cp[1] == '#') {
utf_cptradj(cp + 2, &cp);
tvar = str_nsave(es->tokp, cp - es->tokp, ATEMP);
cp += 2;
utf_ptradjx(cp, cp);
strndupx(tvar, es->tokp, cp - es->tokp, ATEMP);
goto process_tvar;
} else if (ksh_isdigit(c)) {
int i;
while (c != '_' && (ksh_isalnux(c) || c == '#'))
c = *cp++;
i = --cp - es->tokp;
tvar = str_nsave(es->tokp, i, ATEMP);
strndupx(tvar, es->tokp, --cp - es->tokp, ATEMP);
process_tvar:
es->val = tempvar();
es->val->flag &= ~INTEGER;