aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-09-26 17:41:00 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-09-26 17:41:00 +0000
commite175ff252f9abb7267000571207c9d612728e1b9 (patch)
treebc6843cbc8ca3d0d2257a9e2349c03358b70b85a /editors
parent22f6dcb47c32909ca0a3d720b11df5ea86b1e76c (diff)
downloadbusybox-e175ff252f9abb7267000571207c9d612728e1b9.tar.gz
several fixes from openWRT project
Diffstat (limited to 'editors')
-rw-r--r--editors/awk.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/editors/awk.c b/editors/awk.c
index c934fe0df..bebc78092 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -249,7 +249,8 @@ enum {
/* builtins */
enum {
B_a2=0, B_ix, B_ma, B_sp, B_ss, B_ti, B_lo, B_up,
- B_ge, B_gs, B_su
+ B_ge, B_gs, B_su,
+ B_an, B_co, B_ls, B_or, B_rs, B_xo,
};
/* tokens and their corresponding info values */
@@ -289,6 +290,8 @@ static char * const tokenlist =
"\5while" NTC
"\4else" NTC
+ "\3and" "\5compl" "\6lshift" "\2or"
+ "\6rshift" "\3xor"
"\5close" "\6system" "\6fflush" "\5atan2" /* BUILTIN */
"\3cos" "\3exp" "\3int" "\3log"
"\4rand" "\3sin" "\4sqrt" "\5srand"
@@ -342,6 +345,8 @@ static const uint32_t tokeninfo[] = {
ST_WHILE,
0,
+ OC_B|B_an|P(0x83), OC_B|B_co|P(0x41), OC_B|B_ls|P(0x83), OC_B|B_or|P(0x83),
+ OC_B|B_rs|P(0x83), OC_B|B_xo|P(0x83),
OC_FBLTIN|Sx|F_cl, OC_FBLTIN|Sx|F_sy, OC_FBLTIN|Sx|F_ff, OC_B|B_a2|P(0x83),
OC_FBLTIN|Nx|F_co, OC_FBLTIN|Nx|F_ex, OC_FBLTIN|Nx|F_in, OC_FBLTIN|Nx|F_lg,
OC_FBLTIN|F_rn, OC_FBLTIN|Nx|F_si, OC_FBLTIN|Nx|F_sq, OC_FBLTIN|Nx|F_sr,
@@ -1923,6 +1928,30 @@ static var *exec_builtin(node *op, var *res)
s[n] = '\0';
setvar_p(res, s);
break;
+
+ case B_an:
+ setvar_i(res, (long)getvar_i(av[0]) & (long)getvar_i(av[1]));
+ break;
+
+ case B_co:
+ setvar_i(res, ~(long)getvar_i(av[0]));
+ break;
+
+ case B_ls:
+ setvar_i(res, (long)getvar_i(av[0]) << (long)getvar_i(av[1]));
+ break;
+
+ case B_or:
+ setvar_i(res, (long)getvar_i(av[0]) | (long)getvar_i(av[1]));
+ break;
+
+ case B_rs:
+ setvar_i(res, (long)((unsigned long)getvar_i(av[0]) >> (unsigned long)getvar_i(av[1])));
+ break;
+
+ case B_xo:
+ setvar_i(res, (long)getvar_i(av[0]) ^ (long)getvar_i(av[1]));
+ break;
case B_lo:
to_xxx = tolower;