Unfortunately, I couldn't have both threads *and* signals, and I feel
like threads would be more widely applicable. Plus, I want them for a
project I want to work on.
The reason they don't mix is because I had to use thread-specific data,
and there is no safe way to get that data in a signal handler. I also
thought that it was too much complexity, so I just removed it.
Signed-off-by: Gavin Howard <gavin@yzena.com>
This also quiets as many of the maybe uninitialized warnings as I could,
but that GCC warning is just broken.
Signed-off-by: Gavin Howard <gavin@yzena.com>
This will make my code much more future-proof to future warnings, but it
did require some code changes, most notably explicit listing of all lex
tokens in three places.
Two -Wno-* options were kept: -Wno-padded (because it's a terrible
warning that has nothing to do with code hygiene, and because some bc
structs have padding) and -Wno-gnu-label-as-value (because I actually do
use the GNU labels as values feature in the bc_program_exec() function).
Signed-off-by: Gavin Howard <gavin@yzena.com>
This was requested a long time ago, and I rejected it. I see differently
now because the vast majority of my -e invocations are to set these.
Signed-off-by: Gavin Howard <gavin@yzena.com>
This requires testing for FreeBSD, like I do with OpenBSD. When on
FreeBSD, I have to *not* use _POSIX_C_SOURCE and _XOPEN_SOURCE.
Signed-off-by: Gavin Howard <gavin@yzena.com>
This was requested by an important FreeBSD user. This was an exploration
of the idea to just use editline and readline. I wasn't sure it was
possible. Turns out, it is.
What is not working: history in editline does not seem to work.
Everything else seems to work. Tests still pass as well.
Signed-off-by: Gavin Howard <gavin@yzena.com>
This bug was a little bit of an easy one to find and a doozy to fix. The
reason for that is because reading expressions from the command-line is
kind of its own special case, so I had to do a little bit of a redesign.
The redesign wasn't that big, however; I reused the same technique I
used for fixing a similar problem with stdin. I also reused the same
global buffer in BcVm because stdin won't ever use it at the same time.
I even used kind of the same code.
But the idea is the same: have a function the lexer can call when
there is an unfinished comment or string. In fact, I need to add a test
for both of those cases, as well as a test for a multiline string.
Signed-off-by: Gavin Howard <gavin@yzena.com>
This one was that bc allowed function definitions after semicolons when
the POSIX grammar technically does not allow it.
Also, this adds missing a missing error message. I found it because I
needed to add yet anothe error message for this bug.
Also, this commit adds the test too.
Signed-off-by: Gavin Howard <gavin@yzena.com>
The bug was the improper ending of if statements in files and before
function definitions. In 5.1.0, I fixed it such that an if statement
right before a function definition works, but not a series of if
statements or if statements inbetween loops.
This does the full fix.
Signed-off-by: Gavin Howard <gavin@yzena.com>
I did this because there were compile errors with the library using
BC_Z, and I thought to myself that it would be a good feature to add and
would take little code.
Signed-off-by: Gavin Howard <gavin@yzena.com>