[PATCH] bc Version 1.1

Gavin Howard gavin.d.howard at gmail.com
Tue Dec 4 20:56:20 UTC 2018


Whoops. I had a bug in the code I just sent. The correct code is:

+    if (prev == BC_INST_BOOL_NOT || nexprs != 1)
+        return BC_STATUS_PARSE_BAD_EXP;

+    for (i = 0; i < next.len && t != next.tokens[i]; ++i) continue;
+    if (i == next.len) return BC_STATUS_PARSE_BAD_EXP;

Gavin Howard
On Tue, Dec 4, 2018 at 1:48 PM Gavin Howard <gavin.d.howard at gmail.com> wrote:
>
> I think a possible alternative would be:
>
> +    if (prev == BC_INST_BOOL_NOT || nexprs != 1) return s;
>
> +    for (i = 0; i < next.len && t != next.tokens[i]; ++i) continue;
> +    if (i == next.len) return BC_STATUS_PARSE_BAD_EXP;
>
> Is that what you would like?
>
> Gavin Howard
>
> On Tue, Dec 4, 2018 at 1:33 PM Denys Vlasenko <vda.linux at googlemail.com> wrote:
> >
> > On Sat, Nov 3, 2018 at 6:17 PM Gavin Howard <gavin.d.howard at gmail.com> wrote:
> > >
> > > Hello,
> > >
> > > After making changes to the bc for Denys' requests, I have a better
> > > version of the bc.
> > >
> > > This version, pasted at https://pastebin.com/0M9sMhtM and raw at
> > > https://pastebin.com/raw/0M9sMhtM, has fulfilled every one of Denys'
> > > requests except for a few.
> >
> >
> > +    s = BC_STATUS_PARSE_BAD_EXP;
> > +    if (prev == BC_INST_BOOL_NOT || nexprs != 1) return s;
> > +
> > +    for (i = 0; s && i < next.len; ++i) s *= t != next.tokens[i];
> > +    if (s) return s;
> >
> > This is not readable


More information about the busybox mailing list