| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register trunc-rem intrinsic.
* lib.h (trunc_rem): Declared.
* txr.1: Documented trunc-rem.
* tl.vim, txr.vim: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c, arith.h, combi.c, combi.h, debug.c, debug.h, eval.c, eval.h,
filter.c, filter.h, gc.c, gc.h, hash.c, hash.h, lib.c, lib.h,
match.c, match.h, parser.h, rand.c, rand.h, regex.c, regex.h,
signal.c, signal.h, stream.c, stream.h, sysif.c, sysif.h, syslog.c,
syslog.h, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h:
Update.
* LICENSE, METALICENSE: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
| |
(sign_extend): New function.
* eval.c (eval_init): Register sign-extend intrinsic.
* lib.h (sign_extend): Declared.
* txr.1: Documented sign-extend.
* tl.vim, txr.vim: Updated.
|
|
|
|
|
|
|
|
| |
* arith.h (width): Declared.
* eval.c (eval_init): Width registered as intrisinc.
* txr.1: Documented width.
|
|
|
|
|
|
|
|
|
|
|
| |
(plusp, minusp): New functions.
* eval.c (eval_init): Register plusp and minusp.
* lib.h (plusp, minusp): Declared.
* txr.1: Documented plusp and minusp, and the
handling of characters by zerop.
|
|
|
|
|
|
| |
Fix error message in toint wrongly identifying itself as tofloat.
* txr.1: Document handling of characters.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Registered wrap and wrap* intrinsics.
* lib.h (wrap_star, wrap): Declared.
* txr.1: wrap and wrap* documented.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register new functions as intrinsics.
* lib.h (succ, ssucc, sssucc, pred, ppred, pppred): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
(GREP_CHECK): New macro.
(enforce): Rewritten using GREP_CHECK, with new checks.
* arith.c, combi.c, debug.c, eval.c, filter.c, gc.c, hash.c, lib.c,
* lib.h, match.c, parser.l, parser.y, rand.c, regex.c, signal.c,
* signal.h, stream.c, syslog.c, txr.c, unwind.c, utf8.c: Remove
trailing spaces.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to C++ style casts when compiling as C++.
* lib.h (strip_qual, convert, coerce): New casting macros.
(TAG_MASK, tag, type, wli_noex, auto_str, static_str,
litptr, num_fast, chr, lit_noex, nil, nao): Use cast macros.
* arith.c (mul, isqrt_fixnum, bit): Use cast macros.
* configure (INT_PTR_MAX): Define using cast macro.
* debug.c (debug_init): Use cast macro.
* eval.c (do_eval, expand_macro, reg_op, reg_mac, eval_init):
Use cast macros.
* filter.c (filter_init): Use cast macro.
* gc.c (more, mark_obj, in_heap, mark, sweep_one, unmark): Use
cast macros.
* hash.c (hash_double, equal_hash, eql_hash, hash_equal_op,
hash_hash_op, hash_print_op, hash_mark, make_hash, make_similar_hash,
copy_hash, gethash_c, gethash, gethash_f, gethash_n, remhash,
hash_count, get_hash_userdata, set_hash_userdata, hash_iter_destroy,
hash_iter_mark, hash_begin, hash_uni, hash_diff, hash_isec): Use
cast macros.
* lib.c (code2type, chk_malloc, chk_malloc_gc_more, chk_calloc,
chk_realloc, chk_strdup, num, c_num, string, mkstring, mkustring,
upcase_str, downcase_str, string_extend, sub_str, cat_str, trim_str,
c_chr, vector, vec_set_length, copy_vec, sub_vec, cat_vec,
cobj_print_op, obj_init): Likewise.
* match.c (do_match_line, hv_trampoline, match_files, dir_tables_init):
Likewise.
* parser.l (grammar): Likewise.
* parser.y (parse): Likewise.
* rand.c (make_state, make_random_state, random_fixnum, random):
Likewise.
* regex.c (CHAR_SET_L2_LO, CHAR_SET_L2_HI, CHAR_SET_L1_LO,
CHAR_SET_L1_HI, CHAR_SET_L0_LO, CHAR_SET_L0_HI, L0_full, L0_fill_range,
L1_full, L1_fill_range, L1_contains, L1_free, L2_full, L2_fill_range,
L2_contains, L2_free, L3_fill_range, L3_contains, L3_free,
char_set_create, char_set_cobj_destroy, nfa_state_accept,
nfa_state_empty, nfa_state_single, nfa_state_wild, nfa_state_set,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
zero, return the other operand.
(lcm): New function.
* eval.c (eval_init): Retarget registration of gcd to
variable argument gcdv function. Register lcm.
* lib.c (gcdv, lcmv): New functions.
* lib.h (gcdv, lcm, lcmv): Declared.
* txr.1: Re-document gcd with coverage of lcm.
* txr.vim: Regenerated.
|
|
|
|
| |
in fixnum range not normalized.
|
|
|
|
|
|
|
|
|
|
|
|
| |
*flo-min*, *flo-max*, *flo-epsilon*, *pi* and *e*.
* genvim.txr: Include arith.c in scan for symbols.
* lib.c (init): arith_init() must now be called after eval_init().
* txr.1: Documented new variables..
* txr.vim: Updated.
|
|
|
|
|
| |
to switch statements, leading to strange error
messages when wrong types are passed in.
|
|
|
|
|
|
| |
which breaks the n_perm_k function for k == 1.
* txr.1: Fix typo: n-choose-k written in place of n-perm-k.
|
|
|
|
|
|
|
|
| |
debug.h, eval.c, eval.h, filter.c, filter.h, gc.c, gc.h, hash.c,
hash.h, lib.c, lib.h, match.c, match.h, parser.h, parser.l, parser.y,
rand.c, rand.h, regex.c, regex.h, signal.c, signal.h, stream.c,
stream.h, syslog.c, syslog.h, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h: Synchronize license header with LICENSE.
|
|
|
|
|
|
|
|
| |
* configure, txr.1: Bumped version.
* share/txr/stdlib/ver.txr: Likewise
* arith.c (log2): Change to static.
|
|
|
|
|
|
|
|
|
| |
Use "/" name in error reporting, not "divi".
* eval.c (eval_init): Change registration of / so only
one argument is required out of two.
* txr.1: Document one-argument division.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
library so we can test for math functions.
* arith.c (log2_init): New static function.
(log2, logtwo): New functions.
(l2): New static variable.
(arith_init): Call log2_init.
* configure (lang_flags): Switching _XOPEN_SOURCE
from 500 to 600 to reveal log2.
Adding test for log2.
* eval.c (eval_init): Register log2 intrinsic.
* lib.h (logtwo): Declared.
* txr.1: Documented log2.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register bit as intrinsic.
* lib.h (bit): Declared.
* mpi-patches/add-bitops (mp_bit): New function.
* txr.1: Documented bit
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
when bit field operands are negative, affecting logand, logor, logxor,
lognot, logtrunc, logtest and ash. In addition, logtest was found to
return the logical inverse of its correct value.
* arith.c (logtest): Fix broken boolean polarity
of return value.
* mpi-patches/add-bitops (mp_2comp): Fix incorrect
treatment of negative values.
(mp_and): Fix incorrectly ordered statements, which
cause failure when operands are negative.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
some places. In particular, the test case
echo : | ./txr -c '@a:@a' -
breaks because of neglected LIT in do_match_line.
* arith.c (tofloat, toint): Handle LIT type in switch.
* lib.c (ref, refset, replace, update): Handle LSTR type.
* match.c (do_match_line, do_output_line): Handle LSTR and LIT
objects in switch.
|
| |
|
|
|
|
|
|
|
|
|
| |
* arith.h (tofloat, toint): Declared.
* eval.c (eval_init): tofloat and toint registered
as intrinsics.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): logten registered as intrinsic.
* lib.h (logten): Declared.
* txr.1: Documented.
|
|
|
|
| |
and <dirent.h>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (apply): Unconditionally use colon_k for missing optional
args, for intrinsic functions.
(eval_intrinsic, rangev, rangev_star, errno_wrap): Conform to new
scheme for defaulting optional args.
(reg_fun_mark): Function removed.
(eval_init): Switch reduce_left and reduce_right back to reg_fun
registration.
* hash.c (gethash_n): Conform to new scheme for defaulting optional
arguments.
* lib.c (sub_list, replace_list, remove_if, keep_if, remove_if_lazy,
keep_if_lazy, tree_find, count_if, some_satisfy, all_satisfy,
none_satisfy, search_str, match_str, match_str_tree, sub_str,
replace_str, cat_str, tok_str, intern, rehome_sym, sub_vec,
replace_vec, lazy_str, sort, multi_sort, find, find_if, set_diff,
obj_print, obj_pprint): Conform to new scheme for defaulting optional
arguments.
(func_f0, func_f1, func_f2, func_f3, func_f4, func_n0, func_n1,
func_n2, func_n3, func_n4, func_n5, func_n6, func_n7, func_f0v,
func_f1v, func_f2v, func_f3v, func_f4v, func_n0v, func_n1v,
func_n2v, func_n3v, func_n4v, func_n5v, func_n6v, func_n7v):
Remove references to removed mark_missing_args member of struct func.
(func_set_mark_missing): Function removed.
(generic_funcall): Unconditionally use colon_k for missing optional
args, for intrinsic functions.
* lib.h (struct func): mark_missing_args member removed.
(func_set_mark_missing): Declaration removed.
(default_arg, default_bool_arg): New inline functions.
* rand.c (random): Left argument is not optional.
(rnd): Conform to new scheme for defaulting optional arguments.
* regex.c (search_regex, match_regex): Conform to new scheme for
defaulting optional arguments.
* stream.c (unget_char, unget_byte, put_string, put_char, put_byte,
put_line): Conform to new scheme for defaulting optional arguments.
* syslog.c (openlog_wrap): Conform to new scheme for defaulting
optional arguments.
* txr.1: Remove the specification that nil is a sentinel value in
default arguments, where necessary. Use consistent syntax for
specifying variable parts in argument lists. A few errors and omissions
addressed.
|
|
|
|
|
|
|
|
|
|
| |
of C names of functions, or otherwise clarified them.
* filter.c: Likewise.
* lib.c: Likewise.
* match.c: Likewise.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register as atang2 as a atan2 intrinsic.
* lib.h (atang2): Declared.
* txr.1: Documented atan2.
|
|
|
|
|
| |
* arith.c (plus, minus, mul, trunc): Optimize cases
where bignum is opposite 1 or 0.
|
|
|
|
|
|
|
|
|
|
| |
(n_choose_k, n_perm_k): New functions.
* arith.h (n_choose_k, n_perm_k): Declared.
* eval.c (eval_init): New functions interned.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
so it doesn't have quotes around it.
(cum_norm_dist): New function.
* arith.h (cum_norm_dist): Declared.
* eval.c: Include arith.h.
(eval_init): Register cum_norm_dist as intrinsic.
* txr.1: Documented cum-norm-dist.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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 =
|