| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (OBJS-y): Include signal.o if have_posix_sigs is "y".
* configure (have_posix_sigs): New variable, set by detecting POSIX
signal stuff.
* dep.mk: Regenerated.
* arith.c, debug.c, eval.c, filter.c, hash.c, match.c, parser.y,
parser.l, rand.c, regex.c, syslog.c, txr.c, utf8.c: Include new
signal.h header, now required by unwind, and the <signal.h> system
header.
* eval.c (exit_wrap): New function.
(eval_init): New functions registered as intrinsics: exit_wrap,
set_sig_handler, get_sig_handler, sig_check.
* gc.c (release): Unused functions removed.
* gc.h (release): Declaration removed.
* lib.c (init): Call sig_init.
* stream.c (set_putc, se_getc, se_fflush): New static functions.
(stdio_put_char_callback, stdio_get_char_callback, stdio_put_byte,
stdio_flush, stdio_get_byte): Use new functions to enable
signals when blocked on I/O.
(tail_strategy): Allow signals across sleep.
(pipev_close): Allow signals across waitpid.
(se_pclose): New static function.
(pipe_close): Use new function to enable signals across pclose.
* unwind.c (uw_unwind_to_exit_point): use extended_longjmp instead of
longjmp.
* unwind.h (struct uw_block, struct uw_catch): jb member changes from
jmp_buf to extended_jmp_buf.
(uw_block_begin, uw_simple_catch_begin, uw_catch_begin): Use
extended_setjmp instead of setjmp.
* signal.c: New file.
* signal.h: New file.
|
|
|
|
|
| |
include <assert.h> since none of these modules uses the standard C
assert macro.
|
|
|
|
| |
Fixing some errors in copyright comments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile: Use -iquote to restrict our #include search paths from
being processed for #include <...>. Add syslog.o to OBJS-y if
have_syslog is y.
* configure (have_syslog): New variable, set by detecting syslog API.
* eval.c (eval_init): logand and logior registrations changed to
go to variadic versions. New syslog variables and functions registered.
* lib.c (logandv, logiorv): New functions.
* lib.h (logandv, logiorv): Declared.
* txr.c (main): Call syslog_init.
* syslog.c: New file.
* syslog.h: New file.
* txr.1: Updated.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* arith.h (bignum_from_long): Declared.
* lib.c (int_str): Streamlined. Only use mp_read_radix in the case when
wcstol fails, because now we have bignum_from_long to handle all values
of long. Ensure that the bignum is normalized, in case it falls in the
fixnum range (does not happen on our usual platforms).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Registered logtest.
Registered s-ifmt, s-iflnk, s-ifreg, s-ifblk, s-ifdir,
s-ifchr, s-ififo, s-isuid, s-isgid, s-isvtx, s-irwxu,
s-irusr, s-iwusr, s-ixusr, s-irwxg, s-irgrp, s-iwgrp,
s-ixgrp, s-irwxo, s-iroth, s-iwoth, s-ixoth variables.
* lib.h (logtest): Declared.
* stream.c (s_ifmt, s_ifsock, s_iflnk, s_ifreg, s_ifblk,
s_ifdir, s_ifchr, s_ififo, s_isuid, s_isgid, s_isvtx, s_irwxu, s_irusr,
s_iwusr, s_ixusr, s_irwxg, s_irgrp, s_iwgrp, s_ixgrp, s_irwxo, s_iroth,
s_iwoth, s_ixoth): New global variables.
* stream.h (s_ifmt, s_ifsock, s_iflnk, s_ifreg, s_ifblk,
s_ifdir, s_ifchr, s_ififo, s_isuid, s_isgid, s_isvtx, s_irwxu, s_irusr,
s_iwusr, s_ixusr, s_irwxg, s_irgrp, s_iwgrp, s_ixgrp, s_irwxo, s_iroth,
s_iwoth, s_ixoth): Declared.
* txr.1: Documented logtest and s-* variables for stat,
as well as open-file and open-directory.
|
|
|
|
|
|
|
|
| |
consistent with Common Lisp.
* eval.c (eval_init): logcomp to lognot.
* lib.h (logcomp): Declaration updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(comp_clamp): Bugfix: avoid shifting left into sign bit. Function
renamed to comp_trunc.
(logtrunc, ash): New functions.
* eval.c (eval_init): Registered logtrunc and ash intrinsics.
* lib.h (logtrunc, ash): Declared.
* mpi-patches/add-bitops (s_highest_bit_mp): Forward declaration for
added.
(mp_clamp_comp): Bugfix in handling remainder bits. Function
renamed to mp_trunc_comp.
(mp_trunc, mp_shift): New functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
normalized, otherwise we end up with fixnum-range bignums.
(comp_clamp): New function.
(logcomp): Changed to two argument form. If second argument
is present (not nil) then call comp_clamp.
* eval.c (eval_init): Change registration of logcomp to allow
optional argument.
* lib.h (logcomp): Declaration updated.
* mpi-patches/add-bitops: New mp_clamp_comp function implemented.
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (logcomp): New function.
* eval.c (eval_init): logcomp registered as intrinsic.
* lib.h (logcomp) declared.
* mpi-patches/add-bitops: Fixed bugs in mp_xor. Implemented mp_comp.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
negative integers behave as an "infinite bit two's complement".
* arith.c (logand, logor, logxor): New functions.
* eval.c (eval_init): New intrinsic functions logand, logior, logxor.
* lib.h (logand, logor, logxor): Declared.
* mpi-patches/series: New patch, add-bitops.
* mpi-patches/add-bitops: New file.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(in_int_ptr_range): New function.
(arith_init): Initialize INT_PTR_MAX_MP.
* arith.h (in_int_ptr_range): Declared.
* lib.c (c_num): Allow bignums to be converted to a cnum, if
they are in range, rather than allowing only fixnums.
* rand.c (make_random_state): Now that we have such a function,
initialize random seed using time value from time_sec_usec rather than
from time and clock. clock is bad for random seeding because it
measures virtual time since the start of the process.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (bignum_dbl_ipt): Added missing #if HAVE_DOUBLE_INTPTR_T
around function
* configure: NetBSD's shell is too pathetic to expand "$@" properly
when there are no positional arguments, so I applied the ${@+"$@"}
trick.
(make): New variable. GNU make might be known only as gmake,
so we now detect the command for our own use within the configure
script and also for giving the user advice on what command to use for
building. Put in a fix so that the attempt to run $make --version
does not bail the script under "set -e" if that command terminates
unsuccessfully.
The check for clashing names has been moved earlier, so that
the renaming #define's appear early in config.h (so config.h itself
can rely on the renames). The identifier longlong_t has been added
to the potential clash list. NetBSD exposes this identifier in spite
of -D_POSIX_SOURCE=2, and it clashes with our longlong_t.
The tests for integers wider than long long has been modified
to actually compile a multiplication of two long-long-s into
the wider precision. On the NetBSD system, with gcc 4.1.3, I found
that the __int128 type is there, but doesn't actually work;
compilation of arith.c bails with an internal compiler error.
We now get this internal error at configure time and avoid using
the type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.h (bignum): Declared.
* configure: Added check for tm_gmtoff and tm_tmzone fields
being present in struct tm.
* eval.c (eval_init): New intrinsic functions: time, time-usec.
* lib.c (num): If the cnum is outside of the fixnum range, then
construct a bignum.
(time_sec, time_sec_usec): New functions.
* lib.h (mut): Slight change to macro to eliminate compiler warning.
(time_sec, time_sec_usec): Declared.
* txr.1: Stub section for time and time-usec.
* txr.vim: Highlighting for time and time-usec.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(exptmod): Bugfix: was no normalizing the bignum, ouch.
Also was reporting "non-integral operands" for other
errors.
* eval.c (eval_init): Registered = intrinsic function.
* lib.c (numeqv): New function.
* lib.h (numeq, numeqv): Declared.
* txr.1: Documented expt, sqrt, isqrt, exptmod, fixnump, bignump,
integerp, floatp, numberp, zerop, evenp, oddp, >, <, >=, <= and =.
* txr.vim: Highlight =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
exception if MPI fails.
(floorf, ceili): Map integer argument to itself.
(tang, asine, acosi): New functions.
* eval.c (eval_init): New intrinsics: tan, asin, acos.
* lib.h (tang, asine, acosi): Declared.
* txr.1: Documented gcd, abs, floor, ceil, sin, cos, tan
asin, acos, atan, log, and exp.
* txr.vim: Highlighting for tang, asine, acosi.
|
|
|
|
|
|
|
|
| |
(mod): Use dmod instead of fmod directly, to calculate
the correct semantics for combinations of
negative operands in the floating point domain also.
* txr.1: Documented /, trunc and mod.
|
|
|
|
| |
* lib.c (funcall): Likewise.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): expo registered as intrinsic exp.
* lib.h (expo): Declared.
* txr.1: Added to stub heading.
* txr.vim: Highlighting for exp.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
for the integer square root.
* arith.c (sqroot_fixnum): Renamed back to isqrt_fixnum.
(sqroot): Rewritten to handle only floating-point square root.
(isqrt): New function, based on previous sqroot,
handles only integers.
* eval.c (eval_init): New intrinsic, isqrt.
* lib.h (isqrt): New declaration.
* txr.1: Doc stubs.
* txr.vim: Highlighting for isqrt.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New intrinsic functions registered:
floor, ceil, sin, cons, atan, log.
* lib.h (floorf, ceili, sine, cosi, atang, loga): Declared.
* txr.1: Doc stub section for new functions.
* txr.vim: Highighting added.
|
|
|
|
|
|
|
|
| |
that doesn't begin with a digit, it's most likely NaN or Inf.
We can turn that into an exception.
* stream.c (vformat): If sprintf produces a non-number,
turn it into the printed representation #<bad-float>.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(divi): Uses to_float.
(zerop, gt, lt, ge, le, expt): Floating support.
(isqrt_fixnum): Static function renamed to sqroot_fixnum.
(isqrt): Renamed to sqroot. Floating support.
(evenp, oddp, exptmod, gcd): Work with integers, not floats.
* eval.c (eval_init): intrinsic registration of sqrt follows rename of
isqrt to sqroot.
* lib.h (isqrt): Declaration replaced.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): divi registered as / intrinsic.
* lib.h (divi): Declared.
* txr.1: divi added to stub heading.
* txr.vim: / operator highlighted.
|
| |
|
| |
|
|
|
|
| |
which are already implied by the switch case.
|
|
|
|
|
| |
* arith.c (plus, minus): Eliminated some unnecessary (double) casts.
(abso, mul): Floating support.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.l: FLO and FLODOT cases had to be reordered because
the lex trailing context counts as part of the match length,
causing 3.0 to be matched as three characters with 0 as
the trailing context. The cases are split up to eliminate
a flex warning.
* stream.c (vformat): Support bignum in floating point
conversion. Bugfixes: floating point conversion was
accessing obj->fl.n instead of using n.
Changed some if/else ladders to switches.
|
|
|
|
|
|
|
|
| |
(minus): Floating point support.
* mpi-patches/mpi-to-double (mp_to_double): Re-apply lost
bugfix: index incremented instead of decremented.
Didn't refresh patch last time, then did a make distclean.
|
|
|
|
| |
and float-bignum cases.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): flo-int registered as intrinsic.
* lib.h (flo_int): Declared.
* mpi-patches/series: Added mpi-to-double to patch stack.
(mp_to_double): New MPI function.
* mpi-patches/mpi-to-double: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
result is in the fixnum range.
Implemented FLNUM cases, except for adding a FLNUM
to BGNUM.
(minus, mul): Use num_fast when the cnum value is in the fixnum range.
(int_flo): New function.
* eval.c (eval_init): Register int-flo intrinsic.
* lib.c (c_flo): New function.
* lib.h (TYPE_SHIFT, TYPE_PAIR): New macros, carried over
from the lazy strings branch.
(c_flo, int_flo): Declared.
|
|
|
|
| |
broken for fixnum <= 0. Bad pointer passed to MPI.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.h: Likewise.
* debug.c: Added copyright header.
* debug.h: Updated copyright year.
* eval.c: Likewise.
* eval.h: Likewise.
* filter.c: Likewise.
* filter.h: Likewise.
* gc.c: Likewise.
* gc.h: Likewise.
* hash.c: Likewise.
* hash.h: Likewise.
* lib.c: Likewise.
* lib.h: Likewise.
* match.c: Likewise.
* match.h: Likewise.
* parser.h: Likewise.
* regex.c: Likewise.
* regex.h: Likewise.
* stream.c: Likewise.
* stream.h: Likewise.
* txr.c: Likewise, and e-mail address.
* txr.h: Updated copyright year.
* unwind.c: Likewise.
* unwind.h: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (dwim_loc): Assignments to string indices and ranges
supported. New arguments for this purpose.
(op_modplace): Use new dwim_loc interface for returned value.
(op_dwim): Support assignment to string ranges.
(eval_init): replace_str registered.
* lib.c (string_extend): If the argument is a number, let it
specify the amount by which to extend the string.
(replace_str): New function.
* lib.h (replace_str): Declared.
* txr.1: Updated.
* txr.vim: Updated.
|
|
|
|
|
|
|
| |
* lib.c (sub_list, replace_list, sub_vec, replace_vec):
Allow the value t to specify one element past the end, so that t t
refers to zero-length sequence just past the end of the array or list.
Also, fixed out of bounds memmoves in replace_vec.
|
|
|
|
|
|
|
|
| |
* arith.h (highest_bit): Declared.
* rand.c (random): Rewrote using different algorithm which
ensures even distribution, and avoids doing a bignum mod
operation.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (plus, minus, mul, gt, ge, lt, le, exptmod, gcd): Remove
trailing abort; we already marked uw_throwf as noreturn. This hack
should not be needed in functions where the last statement is a throw.
(trunc, expt): Repeated error case handled in one place. Temp variable
used to avoid two calls to mp_clear. Call to abort removed.
(mod): Repeated error handed in one place. Plugged memory leak
by moving throw past mp_clear calls. Call to abort removed.
(isqrt): Repeated error case handed in one place.
|
|
|
|
|
|
|
|
| |
* arith.h (normalize): Declared.
* rand.c (random): Bugfix: normalize the bignum before returning it.
* txr.1: Doc stubs for PRNG functionality.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New functions interned.
* lib.c (num_chr, chr_num): New functions.
* lib.h (num_chr, chr_num): Declared.
* txr.1: Documentation stubs.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New functions registered as intrisics.
* lib.h (exptmod, gcd): Declared.
* txr.1: Documentation stubs added.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): New functions registered as intrinsics.
* lib.h (evenp, oddp): Declared.
* txr.1: Documentation stub updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(abso, isqrt): New functions.
(isqrt_fixnum): New static function.
* eval.c (eval_init): Registered abs, sqrt and numberp instrinsics.
* lib.c (numberp): New function.
* lib.h (numberp, abso, isqrt): Declared.
* mpi-patches/series: New patch added.
* mpi-patches/faster-square-root: New patch added.
* txr.1: Documentation stubs for new functions.
|
| |
|