Displaying 9 results from an estimated 9 matches for "skipcont".
Did you mean:
skipcnt
2019 Jan 25
0
[klibc:update-dash] [EVAL] Move common skipcount logic into skiploop
...sh/eval.c b/usr/dash/eval.c
index 204f1e57..bb106368 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -339,27 +339,45 @@ void evaltreenr(union node *n, int flags)
#endif
+static int skiploop(void)
+{
+ int skip = evalskip;
+
+ switch (skip) {
+ case 0:
+ break;
+
+ case SKIPBREAK:
+ case SKIPCONT:
+ if (likely(--skipcount <= 0)) {
+ evalskip = 0;
+ break;
+ }
+
+ skip = SKIPBREAK;
+ break;
+ }
+
+ return skip;
+}
+
+
STATIC void
evalloop(union node *n, int flags)
{
+ int skip;
int status;
loopnest++;
status = 0;
flags &= EV_TESTED;
- for (;;) {
+ do {
int i;...
2020 Mar 28
0
[klibc:update-dash] dash: [EVAL] Move common skipcount logic into skiploop
...sh/eval.c b/usr/dash/eval.c
index e0c21f94..6cc92c19 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -339,27 +339,45 @@ void evaltreenr(union node *n, int flags)
#endif
+static int skiploop(void)
+{
+ int skip = evalskip;
+
+ switch (skip) {
+ case 0:
+ break;
+
+ case SKIPBREAK:
+ case SKIPCONT:
+ if (likely(--skipcount <= 0)) {
+ evalskip = 0;
+ break;
+ }
+
+ skip = SKIPBREAK;
+ break;
+ }
+
+ return skip;
+}
+
+
STATIC void
evalloop(union node *n, int flags)
{
+ int skip;
int status;
loopnest++;
status = 0;
flags &= EV_TESTED;
- for (;;) {
+ do {
int i;...
2019 Jan 25
0
[klibc:update-dash] eval: Return status in eval functions
...== SKIPFUNC)
+ status = i;
if (skip)
continue;
- i = exitstatus;
if (n->type != NWHILE)
i = !i;
if (i != 0)
break;
- evaltree(n->nbinary.ch2, flags);
- status = exitstatus;
+ status = evaltree(n->nbinary.ch2, flags);
skip = skiploop();
} while (!(skip & ~SKIPCONT));
- if (skip != SKIPFUNC)
- exitstatus = status;
loopnest--;
+
+ return status;
}
-STATIC void
+STATIC int
evalfor(union node *n, int flags)
{
struct arglist arglist;
union node *argp;
struct strlist *sp;
struct stackmark smark;
+ int status;
errlinno = lineno = n->nfor....
2020 Mar 28
0
[klibc:update-dash] dash: eval: Return status in eval functions
...== SKIPFUNC)
+ status = i;
if (skip)
continue;
- i = exitstatus;
if (n->type != NWHILE)
i = !i;
if (i != 0)
break;
- evaltree(n->nbinary.ch2, flags);
- status = exitstatus;
+ status = evaltree(n->nbinary.ch2, flags);
skip = skiploop();
} while (!(skip & ~SKIPCONT));
- if (skip != SKIPFUNC)
- exitstatus = status;
loopnest--;
+
+ return status;
}
-STATIC void
+STATIC int
evalfor(union node *n, int flags)
{
struct arglist arglist;
union node *argp;
struct strlist *sp;
struct stackmark smark;
+ int status;
errlinno = lineno = n->nfor....
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Allow return in loop conditional to set exit status
...-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index bb106368..57db825b 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -387,8 +387,9 @@ evalloop(union node *n, int flags)
status = exitstatus;
skip = skiploop();
} while (!(skip & ~SKIPCONT));
+ if (skip != SKIPFUNC)
+ exitstatus = status;
loopnest--;
- exitstatus = status;
}
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Allow return in loop conditional to set exit status
...-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr/dash/eval.c b/usr/dash/eval.c
index 6cc92c19..bb9fc260 100644
--- a/usr/dash/eval.c
+++ b/usr/dash/eval.c
@@ -387,8 +387,9 @@ evalloop(union node *n, int flags)
status = exitstatus;
skip = skiploop();
} while (!(skip & ~SKIPCONT));
+ if (skip != SKIPFUNC)
+ exitstatus = status;
loopnest--;
- exitstatus = status;
}
2012 Jul 02
0
[klibc:master] [BUILTIN] Merge SKIPFUNC/ SKIPFILE and only clear SKIPFUNC when leaving dotcmd
...KIPFUNC : SKIPFILE;
+ evalskip = SKIPFUNC;
return argv[1] ? number(argv[1]) : exitstatus;
}
diff --git a/usr/dash/eval.h b/usr/dash/eval.h
index ac394e8..5ccfa9f 100644
--- a/usr/dash/eval.h
+++ b/usr/dash/eval.h
@@ -57,4 +57,3 @@ extern int evalskip;
#define SKIPBREAK (1 << 0)
#define SKIPCONT (1 << 1)
#define SKIPFUNC (1 << 2)
-#define SKIPFILE (1 << 3)
diff --git a/usr/dash/main.c b/usr/dash/main.c
index b38dc27..7df3c44 100644
--- a/usr/dash/main.c
+++ b/usr/dash/main.c
@@ -242,7 +242,7 @@ cmdloop(int top)
skip = evalskip;
if (skip) {
- evalskip = 0;
+ e...
2019 Jan 25
0
[klibc:update-dash] [BUILTIN] Return without arguments in a trap should use status outside traps
...skip = SKIPFUNCDEF;
+ status = exitstatus;
+ }
+ evalskip = skip;
+
+ return status;
}
diff --git a/usr/dash/eval.h b/usr/dash/eval.h
index 6e62137a..6e8acdaf 100644
--- a/usr/dash/eval.h
+++ b/usr/dash/eval.h
@@ -62,3 +62,4 @@ extern int evalskip;
#define SKIPBREAK (1 << 0)
#define SKIPCONT (1 << 1)
#define SKIPFUNC (1 << 2)
+#define SKIPFUNCDEF (1 << 3)
diff --git a/usr/dash/main.c b/usr/dash/main.c
index 29a258d3..00c5e00d 100644
--- a/usr/dash/main.c
+++ b/usr/dash/main.c
@@ -242,7 +242,7 @@ cmdloop(int top)
skip = evalskip;
if (skip) {
- evalskip &...
2020 Mar 28
0
[klibc:update-dash] dash: [BUILTIN] Return without arguments in a trap should use status outside traps
...skip = SKIPFUNCDEF;
+ status = exitstatus;
+ }
+ evalskip = skip;
+
+ return status;
}
diff --git a/usr/dash/eval.h b/usr/dash/eval.h
index 6e62137a..6e8acdaf 100644
--- a/usr/dash/eval.h
+++ b/usr/dash/eval.h
@@ -62,3 +62,4 @@ extern int evalskip;
#define SKIPBREAK (1 << 0)
#define SKIPCONT (1 << 1)
#define SKIPFUNC (1 << 2)
+#define SKIPFUNCDEF (1 << 3)
diff --git a/usr/dash/main.c b/usr/dash/main.c
index 29a258d3..00c5e00d 100644
--- a/usr/dash/main.c
+++ b/usr/dash/main.c
@@ -242,7 +242,7 @@ cmdloop(int top)
skip = evalskip;
if (skip) {
- evalskip &...