| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure: Detect all the new functions, with separate
tests for the unary and binary ones.
* arith.c (cbrt_s, erf_s, erfc_s, exp10_s, exp2_s,
expm1_s, gamma_s, j0_s, j1_s, lgamma_s, log1p_s, logb_s,
nearbyint_s, rint_s, significand_s, tgamma_s, y0_s, y1_s,
copysign_s, drem_s, fdim_s, fmax_s, fmin_s, hypot_s,
jn_s, ldexp_s, nextafter_s, remainder_s, scalb_s, scalbln_s,
yn_s, r_copysign_s, r_drem_s, r_fdim_s, r_fmax_s, r_fmin_s,
hypot_s, r_jn_s, r_ldexp_s, r_nextafter_s, r_remainder_s,
r_scalb_s, scalbln_s, r_yn_s): New symbol variables.
(not_available): New static function.
(cbrt_wrap, erf_wrap, erfc_wrap, exp10_wrap, exp2_wrap,
expm1_wrap, gamma_wrap, j0_wrap, j1_wrap, lgamma_wrap,
log1p_wrap, logb_wrap, nearbyint_wrap, rint_wrap,
significand_wrap, tgamma_wrap, y0_wrap, y1_wrap,
copysign_wrap, drem_wrap, fdim_wrap, fmax_wrap,
fmin_wrap, hypot_wrap, jn_wrap, ldexp_wrap,
nextafter_wrap, remainder_wrap, scalb_wrap, scalbln_wrap,
yn_wrap): New static functions.
(arith_set_entries, arith_instantiate): New static functions.
(arith_init): Initialize symbols and instantiate functions
via autoload mechanism. In a program that doesn't use the
functions, we suffer only the overhead of interning the symbols.
* lib.h (UNUSED): New macro for GCC unused attribute.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (arithp): Declared.
(plus_s): Existing symbol declared.
* arith.c (arithp): New function.
* struct.h (special_slot): New enum member plus_m.
* struct.c (special_sym): Register plus_s together as
the [plus_m] entry of the array.
* tests/016/arith.tl
* tests/016/ud-arith.tl: Tests for arithp.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h,
args.c, args.h, arith.c, arith.h, autoload.c, autoload.h,
buf.c, buf.h, cadr.c, cadr.h, chksum.c, chksum.h,
chksums/crc32.c, chksums/crc32.h, combi.c, combi.h, configure,
debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h, filter.c,
filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, gzio.c,
gzio.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S,
lex.yy.c.shipped, lib.c, lib.h, linenoise/linenoise.c,
linenoise/linenoise.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, psquare.h, rand.c, rand.h,
regex.c, regex.h, signal.c, signal.h, socket.c, socket.h,
stdlib/arith-each.tl, stdlib/asm.tl, stdlib/awk.tl,
stdlib/build.tl, stdlib/cadr.tl, stdlib/compiler.tl,
stdlib/constfun.tl, stdlib/conv.tl, stdlib/copy-file.tl,
stdlib/debugger.tl, stdlib/defset.tl, stdlib/doloop.tl,
stdlib/each-prod.tl, stdlib/error.tl, stdlib/except.tl,
stdlib/ffi.tl, stdlib/getopts.tl, stdlib/getput.tl,
stdlib/hash.tl, stdlib/ifa.tl, stdlib/keyparams.tl,
stdlib/match.tl, stdlib/op.tl, stdlib/optimize.tl,
stdlib/package.tl, stdlib/param.tl, stdlib/path-test.tl,
stdlib/pic.tl, stdlib/place.tl, stdlib/pmac.tl,
stdlib/quips.tl, stdlib/save-exe.tl, stdlib/socket.tl,
stdlib/stream-wrap.tl, stdlib/struct.tl, stdlib/tagbody.tl,
stdlib/termios.tl, stdlib/trace.tl, stdlib/txr-case.tl,
stdlib/type.tl, stdlib/vm-param.tl, stdlib/with-resources.tl,
stdlib/with-stream.tl, stdlib/yield.tl, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, time.c, time.h,
tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr,
y.tab.c.shipped: Copyright year bumped to 2023.
|
|
|
|
|
|
|
|
| |
* arith.c (expt): NUM-FLNUM, FLNUM-NUM and FLNUM-FLNUM cases
ensure that if the expontent is zero, the return value is
1.0. Implementations of pow do this, but ISO C doesn't require it.
* txr.1: Now documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Older GCC 4.x versions do not support diagnostic pragmas
in functions and don't have push pragmas for diagnostics.
* arith.c (flo): Put the diagnostic disabling pragma stuff
outside of the function. Instead saving and restoring
the status with push and pop, we just disable the aliasing
warning and re-instate it as a warning.
* lib.h (c_f): Likewise.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (flo): The line of code which triggers the
aliasing diagnostic is wrapped with GNU-C-specific
pramgas that disable the diagnostic just for that line.
* lib.h (c_f): Likewise.
* configure: Drop the test which adds -Wno-strict-aliasing
to the DIAG_FLAGS;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On platforms with 64 bit pointers, and therefore 64-bit-wide
TXR values, we can use a representation technique which allows
double floating-point values to be unboxed.
Fixnum integers are reduced from 62 bits to 50, and there is
a little more complexity in the run-time type checking and
dispatch which costs extra cycles.
The support is currently off by default; it must be explicitly
enabled with ./configure --nan-boxing.
* lib.h (NUM_MAX, NUM_MIN, NUM_BIT): Define separately for
NaN boxing.
(TAG_FLNUM, TAG_WIDTH, NAN_TAG_BIT, NAN_TAG_MASK, TAG_BIGMASK,
TAG_BIGSHIFT, NAN_FLNUM_DELTA): New preprocessor symbols.
(enum type, type_t): The FLNUM enumeration constant moves
to just after LIT, so that its value is the same as TAG_FLNUM.
(struct flonum): Does not exist under NaN boxing.
(union obj): No fl member under NaN boxing.
(tag, is_ptr): Separately defined for NaN boxing.
(is_flo): New function under NaN boxing.
(tag_ex): New function. It's like tag, but identifies
floating-point values as TAG_FLNUM. The tag function continues
to map them to TAG_PTR, which is wrong under NaN boxing,
but needed in order not to separately write tons of cases in
the arith.c module.
(type): Use tag_ex, so TAG_FLNUM is handled, if it exists.
(auto_str, static_str, litptr, num_fast, chr, c_n, c_u):
Different definition for NaN boxing.
(c_ch, c_f): New function.
(throw_mismatch): Attribute with NORETURN.
(nao): Separate definition for NaN boxing.
* lib.c (seq_kind_tab): Reorder initializer to follow enum
reordering.
(seq_iter_rewind): use c_n and c_ch functions, since type
checking has been done in those cases. The self parameter
is no longer needed.
(iter_more): use c_ch on CHR object.
(equal): Use c_f accessor to get double value rather than
assuming there is a struct flonum representation.
(stringp): Use tag_ex, otherwise a floating-point number
is identified as TAG_PTR.
(diff, isec, isecp): Don't pass removed self parameter
to seq_iter_rewind.
* arith.c (c_unum, c_dbl_num, c_dbl_unum, plus, minus,
signum, gt, lt, ge, le, numeq, logand, logior,
logxor, logxor_old, bit, bitset, tofloat, toint,
width, c_num, c_fixnum): Extract floating-point value
using c_f accessor. Handle CHR type separately from NUM
because the storage representation is no longer identical;
CHR values have a two bit tag over bits where NUM has
ordinary value bits. NUM is tagged at the NaN level with
the upper 14 bits being 0xFFFC. The remaining 50 bits
are the value.
(flo): Construct unboxed float under NaN boxing by taking
image of double as a 64 bit value, and adding the
delta offset, then casting to the val pointer type.
(c_flo): Separate implementation for NaN boxing.
(integerp, numberp): Use tag_ex.
* buf.c (str_buf, buf_int): Separate CHR and NUM cases,
like in numerous arith.c functions.
* chksum.c (sha256_hash, md5_hash): Use c_ch accessor for
CHR value.
* hash.c (equal_hash, eql_hash): Handle CHR separately. Use
c_f accessor for floating-point value.
(eq_hash): Use tag_ex and handle TAG_FLNUM value under NaN
boxing. Handle CHR separately from NUM.
* ffi.c (ffi_float_put, ffi_double_put, carray_uint, carray_int):
Handle CHR and NUM separately.
* stream.c (formatv): Use c_f accessor.
* configure: disable automatic selection of NaN boxing
on 64 bit platforms, for now.
Add test whether -Wno-strict-aliasing is supported by
the compiler, performed only if NaN boxing is enabled.
We need to disable this warning because it goes off on
the code that reinterprets an integer as a double and
vice versa.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (NUM_BIT): New preprocessor symbol.
* arith.c (CNUM_BIT): Preprocessor symbol removed; this
same quantity is already known as PTR_BIT in lib.h.
(mul, square): Replace CNUM_BIT with PTR_BIT.
(comp_trunc, logtrunc, sign_extend, ash): Replace
num_bits with NUM_BIT.
* struct.c (struct_inst): Replace calculation with NUM_BIT.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (num_to_buffer, c_unum, c_dbl_num, c_dbl_unum,
c_num, c_fixnum): Use c_n inline function instead of open
coding exactly the same thing.
* lib.c (c_chr): Likewise.
* struct.c (make_struct_type, lookup_slot,
lookup_static_slot_desc, static_slot_p): Likewise.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (gcd): New implementation which uses arithmetic
in the unsigned type ucnum if both operands are in that
type's range. This uses Stein's algorithm a.k.a.
binary GCD. The mpi_gcd function is used only if at least
one argument is a bignum whose value doesn't fit into
a ucnum.
* tests/016/arith.tl: gcd test cases added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (highest_significant_bit): Bugfix: do not pass a
negative value to highest_bit, where we will get then get the
wrong idea about the number of significant bits in the value,
since the __builtin_clz primitives will include the sign bit.
We want to complement the all the bits, so that the sign bit
will go to zero. We can do this arithmetically by taking the
additive inverse (which is the two's complement (which is the
complement plus one)) and subtracting one.
(ash): Avoid left shifting a negative number in HAVE_UBSAN
mode using the same trick as in num_fast.
* ffi.c (ffi_swap_u16): Here the shift and or calculation is
producing a value beyond 16 bits which we are relying on
the implicit conversion back to uin16_t to trim away.
We add the cast to uint16_t to make it explicit.
* hash.c (equal_hash): Also handle the CHR and NUM cases here
via c_u like in eql_hash and eq_hash.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h,
args.c, args.h, arith.c, arith.h, buf.c, buf.h, cadr.c,
cadr.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h,
combi.c, combi.h, configure, debug.c, debug.h, eval.c, eval.h,
ffi.c, ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h,
glob.c, glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S,
lex.yy.c.shipped, lib.c, lib.h, linenoise/linenoise.c,
linenoise/linenoise.h, lisplib.c, lisplib.h, match.c, match.h,
parser.c, parser.h, parser.l, parser.y, protsym.c, psquare.h,
rand.c, rand.h, regex.c, regex.h, signal.c, signal.h,
socket.c, socket.h, stdlib/arith-each.tl, stdlib/asm.tl,
stdlib/awk.tl, stdlib/build.tl, stdlib/cadr.tl,
stdlib/compiler.tl, stdlib/constfun.tl, stdlib/conv.tl,
stdlib/copy-file.tl, stdlib/debugger.tl, stdlib/defset.tl,
stdlib/doloop.tl, stdlib/each-prod.tl, stdlib/error.tl,
stdlib/except.tl, stdlib/ffi.tl, stdlib/getopts.tl,
stdlib/getput.tl, stdlib/hash.tl, stdlib/ifa.tl,
stdlib/keyparams.tl, stdlib/match.tl, stdlib/op.tl,
stdlib/optimize.tl, stdlib/package.tl, stdlib/param.tl,
stdlib/path-test.tl, stdlib/pic.tl, stdlib/place.tl,
stdlib/pmac.tl, stdlib/quips.tl, stdlib/save-exe.tl,
stdlib/socket.tl, stdlib/stream-wrap.tl, stdlib/struct.tl,
stdlib/tagbody.tl, stdlib/termios.tl, stdlib/trace.tl,
stdlib/txr-case.tl, stdlib/type.tl, stdlib/vm-param.tl,
stdlib/with-resources.tl, stdlib/with-stream.tl,
stdlib/yield.tl, stream.c, stream.h, struct.c, struct.h,
strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h,
termios.c, termios.h, time.c, time.h, tree.c, tree.h, txr.1,
txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h,
vmop.h, win/cleansvg.txr, y.tab.c.shipped: Copyright year
bumped to 2022.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes two failing test cases introduced in the
parent commit.
* arith.c (c_dbl_unum): Here, what is wrong that if the
incoming value is a CHR or NUM, we just convert it to a signed
cnum, and return that value. The problem with this is that
negative values are supposed to be out of range for
double_uintptr_t. We now check for negative and route to
the out-of-range error.
* mpi/mpi.c (s_mp_in_big_range): Here, the edge case of
handling the most negative two's complement value is
incorrectly coded. We replace the logic by a simple test for
that exact special case. If a negative bignum being tested
whether it fits into the signed double_intptr_t, then
we check whether its mantissa has the 0x80..00 bit pattern.
That is the only value greater than 0x7F..FF that is
still in range, so we return 1 for that case. We remove the
bogus subtraction (top - neg). After handling the above
special value, we just need to look whether the most
significant word of the bignum is 0x7F...FF or lower.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile (psquare.o): New object file.
* arith.c (psq_ops): New static structure.
(quant_fun): New static function.
(quantile): New function.
(arith_init): Register quantile intrinsic.
* arith.h (quantile): Declared.
* psquare.c, psquare.h: New files.
* tests/016/arith.tl: New tests.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile, alloca.h, args.c, args.h, arith.c, arith.h, buf.c,
buf.h, chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h,
combi.c, combi.h, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c,
glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c,
lib.h, lisplib.c, lisplib.h, match.c, match.h, parser.c,
parser.h, parser.l, parser.y, rand.c, rand.h, regex.c,
regex.h, signal.c, signal.h, socket.c, socket.h,
stdlib/asm.tl, stdlib/awk.tl, stdlib/build.tl,
stdlib/compiler.tl, stdlib/constfun.tl, stdlib/conv.tl,
stdlib/copy-file.tl, stdlib/debugger.tl, stdlib/defset.tl,
stdlib/doloop.tl, stdlib/each-prod.tl, stdlib/error.tl,
stdlib/except.tl, stdlib/ffi.tl, stdlib/getopts.tl,
stdlib/getput.tl, stdlib/hash.tl, stdlib/ifa.tl,
stdlib/keyparams.tl, stdlib/match.tl, stdlib/op.tl,
stdlib/optimize.tl, stdlib/package.tl, stdlib/param.tl,
stdlib/path-test.tl, stdlib/pic.tl, stdlib/place.tl,
stdlib/pmac.tl, stdlib/quips.tl, stdlib/save-exe.tl,
stdlib/socket.tl, stdlib/stream-wrap.tl, stdlib/struct.tl,
stdlib/tagbody.tl, stdlib/termios.tl, stdlib/trace.tl,
stdlib/txr-case.tl, stdlib/type.tl, stdlib/vm-param.tl,
stdlib/with-resources.tl, stdlib/with-stream.tl,
stdlib/yield.tl, stream.c, stream.h, struct.c, struct.h,
strudel.c, strudel.h, sysif.c, sysif.h, syslog.c, syslog.h,
termios.c, termios.h, time.c, time.h, tree.c, tree.h, txr.c,
txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c, vm.h, vmop.h:
License reformatted.
* lex.yy.c.shipped, y.tab.c.shipped, y.tab.h.shipped: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We are doing numerous compat_ver checks in various init
functions, to enact alternative symbol registrations. Only
problem is, compat_ver is always zero during initialization;
it is not set until the -C option is processed in txr_main.
Registrations must be fixed up after initialization;
that's what the compat_fixup mechanism is for.
This is an long-standing problem which affects compatibility
operation going back over 150 versions.
* arith.c (arith_init): Move compat logic to
arith_compat_fixup.
(arith_compat_fixup): New function.
* arith.h (arith_compat_fixup): Declared.
* eval.c (eval_init): Move compat logic to eval_compat_fixup.
* ffi.c (ffi_init): Move compat logic to ffi_compat_fixup.
(ffi_compat_fixup): New function.
* ffi.h (ffi_compat_fixup): Declared.
* regex.c (regex_init): Move compat logic to
regex_compat_fixup.
(regex_compat_fixup): New function.
* regex.h (regex_compat_fixup): Declared.
* stream.c (stream_init): Move compat logic to
stream_compat_fixup.
(stream_compat_fixup): New function.
* stream.h (stream_compat_fixup): Declared.
* struct.c (struct_init): Move compat logic to
struct_compat_fixup.
(struct_compat_fixup): New function.
* struct.h (stream_compat_fixup): Declared.
* lib.c (compat_fixup): Call arith_compat_fixup,
ffi_compat_fixup, regex_compat_fixup, stream_compat_fixup and
struct_compat_fixup.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The issue, reported by Paul A. Patience, is that
code like (< 1 "abc") is successfully producing a result.
The root cause is that 1 is an iterable object, and so
is treated as a sequence opposite to the "abc" operand.
We should allow only true sequences in this situation.
* arith.c (seq_lt_compat_check): New static function. Checks
that neither of two sequences is SEQ_NOTSEQ or SEQ_HASHLIKE.
(seq_lt, seq_le): Use seq_lt_compat_check to reject dubious
inputs.
* txr.1: Minor wording change in the related documentation,
removing a gratuitous adjective.
* tests/016/arith.tl: Inequality tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (nary_op_keyfun): Static function removed.
(nary_op_seq, nary_op_seq_keyfun): New static functions.
(sumv, prodv): Static functions removed.
(sum, prod): Reimplement using nary_op_seq and
nary_op_seq_keyfun. Conversion of sequence to
list smuggled via args is gone.
* tests/016/arith.tl: new sum and prod tests.
* txr.1: Note about sum and prod taking an iterable sequence
added.
|
|
|
|
|
| |
* arith.c (poly, rpoly): fix: the poly function wrongly refers
to itself as rpoly and vice versa in diagnostics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As of this commit, binary search trees can be iterated:
mapped over with mapcar and such.
* arith.c (poly, rpoly): rpoly won't work with trees. They
work just with vectors and lists so let's make the error
message more accurate. I noticed the self names of these two
are swapped; will fix in another commit.
* eval.c (tprint): Refactor to use iterator framework for
objects other than lists. The tree case falls into this,
so trees are supported.
* lib.h (enum seq_kind): New enum constant SEQ_TREELIKE.
(seq_iter_init_with_info): Declared.
* lib.c (seq_info): Map tree object to SEQ_TREELIKE type.
(seq_iter_get_tree, seq_iter_peek_tree): New static functions.
(seq_iter_rewind): Support rewinding tree iteration.
I think we could reuse the existing iterator here, and in the
hash case as well. I made a note to look into this.
(seq_iter_init_with_info): Internal linkage changed to
external, because tprint in eval.c uses this.
Handle SEQ_TREELIKE case here, by setting up iterator with the
two new static functions.
(seq_iter_mark): Handle SEQ_TREELIKE_CASE. Change switch
statement to exhaustively list cases.
(ldiff): Add SEQ_TREELIKE to various cases. Idea is that we
handle it like SEQ_HASH.
(nsort, sort, nshuffle, take, take_while, take_until,
drop_while, drop_until, update): Add case for SEQ_TREELIKE,
routing to error message.
(lazy_where_tree_func): New static function.
(where, sel, reject): Support trees.
|
|
|
|
|
|
|
|
|
| |
* arith.c (invalid_ops, invalid_op): Static functions removed.
* unwind.c (invalid_oips, invalid_op): Functions added here,
as external functions.
* unwind.h (invalid_oips, invalid_op): Declared.
|
|
|
|
|
|
|
|
|
|
| |
The TAG_PAIR macro is going to be useful outside of the
math module.
* arith.c (TAG_PAIR): Macro removed.
* lib.h (TAG_PAIR): Added here--oh look!--next to the very
similar and related TYPE_PAIR.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (NOOP): Unused macro removed. This is a leftover
from a code generation system that only existed over the
weekend of December 10-11, 2011. A file called arith.txr was
used to generate arith.c. One case in the minus function
required negating the result due to the reversed operands. The
code was generated by a template common with plus, but plus
didn't need the negation, due to being commutative, so the
code generated for plus called the NOOP macro in the same
place where minus called mp_neg. Just a few hours after
removing arith.txr, I changed the plus code by hand such that
the NOOP macro was not called, without removing the macro.
Good grief.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (toint): Use self instead of repeating function name
in diagnostic.
* ftw.c (ftw_wrap): Likewise.
* glib.c (glow_wrap): Likewise.
* rand.c (make_random_state, random): Likewise.
* lib.c (nreverse, reverse, remove_if, int_str, less, chr_str,
chr_str_set, unintern, rehome_sym, in): Likewise.
(vector, obj_print_impl): Pass self to helper function instead
of repeating identical literal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The int_flo function also has a sensitivity to locale because
the bignum handling is text-based, involving printing a
floating-point value, and then assuming it contains a period
decimal separator.
* arith.c (int_flo): If CONFIG_LOCALE_TOLERANCE is enabled,
look for dec_point rather than '.' in the formatted number.
When matching and destructuring the number with sscanf,
don't look for the '.' character, but rather a complemented
character set which can maching nothing but the separator,
whatever that is.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* METALICENSE: 2020 copyrights bumped to 2021. Added note
about SHA-256 routines from Colin Percival.
* LICENSE, LICENSE-CYG, Makefile, alloca.h, args.c, args.h,
arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h, chksum.c,
chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c, combi.h,
configure, debug.c, debug.h, eval.c, eval.h, ffi.c, ffi.h,
filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h,
hash.c, hash.h, itypes.c, itypes.h, jmp.S, lex.yy.c.shipped,
lib.c, lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/copy-file.tl, share/txr/stdlib/debugger.tl,
share/txr/stdlib/defset.tl, share/txr/stdlib/doloop.tl,
share/txr/stdlib/each-prod.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/quips.tl,
share/txr/stdlib/save-exe.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/stream-wrap.tl, share/txr/stdlib/struct.tl,
share/txr/stdlib/tagbody.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/trace.tl, share/txr/stdlib/txr-case.tl,
share/txr/stdlib/type.tl, share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, time.c, time.h,
tree.c, tree.h, txr.1, txr.c, txr.h, unwind.c, unwind.h,
utf8.c, utf8.h, vm.c, vm.h, vmop.h, win/cleansvg.txr,
y.tab.c.shipped: Copyright year bumped to 2021.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (int_flo): On 64 bit, we incorrectly handle the positive
floating-point values which correspond to (expt 2 63) and (expt 2 64).
This is because in the range check which detects whether a double value
lands into the cnum or ucnum range, the 64 bit INT_PTR_MAX and
UINT_PTR_MAX have no exact equivalent in the double type and are being
converted to double values which are greater. That then causes the range
check to incorrectly include double values that are actually out of
range for the conversion to the cnum or ucnum type, causing bogus
values. The quickest fix would be to use < comparison for a half-open
range, but that sacrifices two double values on 32 bit, unnecessarily
sending them to the text-based conversion code. So instead, let's
subtract margins from the range constants on 64 bit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The noreturn macro is respelled to harmonize with the
upper-case INLINE and NOINLINE.
* lib.h (noreturn): Rename to NORETURN.
* arith.c (not_number, not_integer, invalid_ops, invalid_op):
Declaration updated.
* arith.c (do_mp_error): Likewise.
* eval.c (eval_error, no_bindable_error, dotted_form_error):
Likewise.
* eval.h (eval_error): Likewise.
* lib.c (unsup_obj, callerror, wrongargs): Likewise.
* match.c (sem_error): Likewise.
* stream.c (unimpl, unimpl_put_string, unimpl_put_char,
unimpl_put_byte, unimpl_get_line, unimpl_get_char,
unimpl_get_byte, unimpl_unget_char, unimpl_unget_byte,
unimpl_put_buf, unimpl_fill_buf, unimpl_seek, unimpl_truncate,
unimpl_get_sock_family, unimpl_get_sock_type,
unimpl_get_sock_peer, unimpl_set_sock_peer): Likewise.
* struct.c (no_such_struct, no_such_slot,
no_such_static_slot): Likewise.
* unwind.h (jmp_restore, uw_throw, uw_throwf, uw_errorf,
uw_errorfv, type_mismatch): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The c_num and c_unum functions now take a self argument for
identifying the calling function. This requires changes in a
large number of places.
In a few places, additional functions acquire a self
argument. The ffi module has the most extensive example of
this.
Some functions mention their name in a larger string, or have
scattered literals giving their name; with the introduction of
the self local variable, these are replaced by references to
self.
In the following changelog, the notation TS stands for "take
self argument", meaning that the functions acquires a new "val
self" argument. The notation DS means "define self": the functions
in question defines a self variable, which they pass down.
The notation PS means that the functions pass down an existing
self variable to functions that now require it.
* args.h (args_count): TS.
* arith.c (c_unum, c_num): TS.
(toint, exptv): DS.
* buf.c (buf_check_len, buf_check_alloc_size, buf_check_index,
buf_do_set_len, replace_buf, buf_put_buf, buf_put_i8,
buf_put_u8, buf_put_char, buf_put_uchar, buf_get_bytes,
buf_get_i8, buf_get_u8, buf_get_cptr,
buf_strm_get_byte_callback, buf_strm_unget_byte, buf_swap32,
str_buf, buf_int, buf_uint, int_buf, uint_buf): PS.
(make_duplicate_buf, buf_shrink, sub_buf, buf_print,
buf_pprint): DS.
* chskum.c (sha256_stream_impl, sha256_buf, crc32_buf,
md5_stream_impl, md5_buf): TS.
(chksum_ensure_buf, sha256_stream, sha256, sha256_hash,
md5_stream, md5, md5_hash): PS.
(crc32_stream): DS.
* combi.c (perm_while_fun, perm_gen_fun_common,
perm_str_gen_fun, rperm_gen_fun, comb_vec_gen_fun,
comb_str_gen_fun, rcomb_vec_gen_fun, rcomb_str_gen_fun): DS.
* diff.c (dbg_clear, dbg_set, dbg_restore): DS.
* eval.c (do_eval, gather_free_refs, maprodv, maprendv,
maprodo, do_args_apf, do_args_ipf): DS.
(op_dwim, me_op, map_common): PS.
(prod_common): TS.
* ffi.c (struct txr_ffi_type): release member TS.
(make_ffi_type_pointer): PS and release argument TS.
(ffi_varray_dynsize, ffi_array_in, ffi_array_put_common,
ffi_array_get_common, ffi_varray_in, ffi_varray_null_term): PS.
(ffi_simple_release, ffi_ptr_in_release, ffi_struct_release,
ffi_wchar_array_get, ffi_array_release_common,
ffi_array_release, ffi_varray_release): TS.
(ffi_float_put, double_put, ffi_be_i16_put, ffi_be_u16_put,
ffi_le_i16_put, ffi_le_u16_put, ffi_be_i32_put, ffi_be_u32_put,
ffi_le_i32_put, ffi_sbit_put, ffi_ubit_put, ffi_buf_d_put,
make_ffi_type_array, make_ffi_type_enum, ffi_type_compile,
make_ffi_type_desc, ffi_make_call_desc, ffi_call_wrap,
ffi_closure_dispatch_save, ffi_put_into, ffi_in, ffi_get,
ffi_put, carray_set_length, carray_blank, carray_buf,
carray_buf_sync, carray_cptr, carray_refset, carray_sub,
carray_replace, carray_uint, carray_int): PS.
(carray_vec, carray_list): DS.
* filter.c (url_encode, url_decode, base64_stream_enc_impl): DS.
* ftw.c (ftw_callback, ftw_wrap): DS.
* gc.c (mark_obj, gc_set_delta): DS.
* glob.c (glob_wrap): DS.
* hash.c (equal_hash, eql_hash, eq_hash, do_make_hash,
hash_equal, set_hash_traversal_limit, gen_hash_seed): DS.
* itypes.c (c_i8, c_u8, c_i16, c_u16, c_i32, c_u32, c_i64,
c_u64, c_short, c_ushort, c_int, c_uint, c_long, c_ulong): PS.
* lib.c (seq_iter_rewind): TS and becomes internal.
(seq_iter_init_with_info, seq_setpos, replace_str, less,
replace_vec, diff, isec, obj_print_impl): PS.
(nthcdr, equal, mkstring, mkustring, upcase_str, downcase_str,
search_str, sub_str, cat_str, scat2, scat3, fmt_join,
split_str_keep, split_str_set, trim_str, int_str, chr_int,
chr_str, chr_str_set, vector, vecref, vecref_l, list_vec,
copy_vec, sub_vec, cat_vec, lazy_str_put, lazy_str_gt,
length_str_ge, length_str_lt, length_str_le, cptr_size_hint,
cptr_int, out_lazy_str, out_quasi_str, time_string_local_time,
time_string_utc, time_fields_local_time, time_fields_utc,
time_struct_local, time_struct_utc, make_time, time_meth,
time_parse_meth): DS.
(init_str, cat_str_init, cat_str_measure, cat_str_append,
vscat, time_fields_to_tm, time_struct_to_tm, make_time_impl): TS.
* lib.h (seq_iter_rewind): Declaration removed.
(c_num, c_unum, init_str): Declarations updated.
* match.c (LOG_MISMATCH, LOG_MATCH): PS.
(h_skip, h_coll, do_output_line, do_output, v_skip, v_fuzz,
v_collect): DS.
* parser.c (parser, circ_backpatch, report_security_problem,
hist_save, repl, lino_fileno, lino_getch, lineno_getl,
lineno_gets, lineno_open): DS.
(parser_set_lineno, lisp_parse_impl): PS.
* parser.l (YY_INPUT): PS.
* rand.c (make_random_state): PS.
* regex.c (print_rec): DS.
(search_regex): PS.
* signal.c (kill_wrap, raise_wrap, get_sig_handler,
getitimer_wrap, setitimer_wrap): DS.
* socket.c (addrinfo_in, sockaddr_pack, fd_timeout,
to_connect, open_sockfd, sock_mark_connected,
sock_timeout): TS.
(getaddrinfo_wrap, dgram_set_sock_peer, sock_bind,
sock_connect, sock_listen, sock_accept, sock_shutdown,
sock_send_timeout, sock_recv_timeout, socketpair_wrap): DS.
* stream.c (generic_fill_buf, errno_to_string, stdio_truncate,
string_out_put_string, open_fileno, open_command, base_name,
dir-name): DS.
(unget_byte, put_buf, fill_buf, fill_buf_adjust,
get_line_as_buf, formatv, put_byte, test_set_indent_mode,
test_neq_set_indent_mode, set_indent_mode, set_indent,
inc_indent, set_max_length, set_max_depth, open_subprocess, run ): PS.
(fds_subst, fds_swizzle): TS.
* struct.c (make_struct_type, super, umethod_args_fun): PS.
(method_args_fun): DS.
* strudel.c (strudel_put_buf, strudel_fill_buf): DS.
* sysif.c (errno_wrap, exit_wrap, usleep_wrap, mkdir_wrap,
ensure_dir, makedev_wrap, minor_wrap, major_wrap, mknod_wrap,
mkfifo_wrap, wait_wrap, wifexited, wexitstatus, wifsignaled,
wtermsig, wcoredump, wifstopped, wstopsig, wifcontinued,
dup_wrap, close_wrap, exit_star_wrap, umask_wrap, setuid_wrap,
seteuid_wrap, setgid_wrap, setegid_wrap,
simulate_setuid_setgid, getpwuid_wrap, fnmatch_wrap,
dlopen_wrap): DS.
(chmod_wrap, do_chown, flock_pack, do_utimes, poll_wrap,
setgroups_wrap, setresuid_wrap, setresgid_wrap, getgrgid_wrap): PS.
(c_time): TS.
* sysif.h (c_time): Declaration updated.
* syslog.c (openlog_wrap, syslog_wrap): DS.
* termios.c (termios_pack): TS.
(tcgetattr_wrap, tcsetattr_wrap, tcsendbreak_wrap,
tcdrain_wrap, tcflush_wrap, tcflow_rap, encode_speeds,
decode_speeds): DS.
* txr.c (compato, array_dim, gc_delta): DS.
* unwind.c (uw_find_frames_by_mask): DS.
* vm.c (vm_make_desc): PS.
(vm_make_closure, vm_swtch): DS.
|
|
|
|
|
|
|
|
|
|
| |
Time for some spring cleaning.
* args.c, arith.c, buf.c, cadr.c, chksum.c, debug.c, ftw.c,
gc.c, gencadr.txr, glob.c, hash.c, lisplib.c, match.c,
parser.c, parser.l, parser.y, rand.c, signal.c, stream.c,
strudel.c, syslog.c, tree.c, unwind.c, utf8.c, vm.c: Numerous
unnecessary #include directives removed.
|
|
|
|
|
|
|
|
| |
* arith.c (numneqv): Do not unconditionally cons all the
arguments into a list. If the arguments structure has no
trailing list, then just loop over the arguments in the arg
array. Only cons all the arguments into a list if there is a
trailing list.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (seq_nueq, seq_lt, seq_le): New
static functions.
(gt, lt): Handle sequences via seq_lt.
(ge, le): Handle sequences via seq_le.
(numeq): Handle sequences via seq_eq.
* txr.1: Documented, and also added missing documentation
about comparison of ranges by these functions, fixed
mistake in the syntax (> listed twice) and added
some notes about symmetry of > >= and < <=.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is the second round of an effort to enable GCC's -Wextra
option. All function parameters that are unused and
are removable are removed. They are eliminated from the
function defintions, declarations, callers, and any related
function pointer variables or structure members.
* arith.c (nary_simple_op): Remove unused self parameter.
See lib.c: maxv, minv.
* chksum.c (crc32_buf, crc32_str): Remove unused self
parameter.
(crc32): Don't pass self to the above functions.
* eval.c (copy_env_handler, copy_bh_env_handler): Remove
unused parent parameter. See unwind.c.
(supplement_op_syms): Remove unused max parameter.
(me_op): Don't pass max to supplement_op_syms.
* lib.c (seq_iter_rewind): Remove unused self parameter.
(lazy_flatten_func): Remove unused env parameter.
(lazy_flatten): Use func_n1 to create non-environment-carrying
funtion out of lazy_flatten_func.
(maxv, minv): Don't pass self parameter to nary_simple_op.
(middle_pivot): Remove unused lessfun param.
(quicksort): Don't pass lessfun to middle_pivot.
(diff, isec): Don't pass self to seq_iter_rewind.
* lib.h (seq_iter_rewind, nary_simple_op): Declarations
updated.
* struct.c (get_super_slots): Remove unused self parameteer.
(make_struct_type): Don't pass self to get_super_slots.
* sysif.c (flock_unpack): Remove unused self parameter.
(fcntl_wrap): Don't pass self to flock_unpack.
* unwind.c (uw_push_cont_copy): Remove parent parameter from
function pointer parameter. See eval.c: copy_env_handler.
(call_copy_handlers): Remove parent parameter and don't
pass that argument to the indirect call via pointer
to the copy handler function.
(revive_cont, capture_cont): Don't pass 0 value to
removed parent parameter of call_copy_handlers.
* unwind.h (struct uw_cont_copy): Function pointer member copy
loses parent parameter.
(uw_push_cont_copy): Declaration updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE, LICENSE-CYG, METALICENSE, Makefile, alloca.h, args.c,
args.h, arith.c, arith.h, buf.c, buf.h, cadr.c, cadr.h,
chksum.c, chksum.h, chksums/crc32.c, chksums/crc32.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, ffi.c,
ffi.h, filter.c, filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c,
glob.h, hash.c, hash.h, itypes.c, itypes.h, jmp.S, lib.c,
lib.h, linenoise/linenoise.c, linenoise/linenoise.h,
lisplib.c, lisplib.h, match.c, match.h, parser.c, parser.h,
parser.l, parser.y, protsym.c, rand.c, rand.h, regex.c,
regex.h, share/txr/stdlib/asm.tl, share/txr/stdlib/awk.tl,
share/txr/stdlib/build.tl, share/txr/stdlib/cadr.tl,
share/txr/stdlib/compiler.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/debugger.tl, share/txr/stdlib/defset.tl,
share/txr/stdlib/doloop.tl, share/txr/stdlib/error.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/ffi.tl,
share/txr/stdlib/getopts.tl, share/txr/stdlib/getput.tl,
share/txr/stdlib/hash.tl, share/txr/stdlib/ifa.tl,
share/txr/stdlib/keyparams.tl, share/txr/stdlib/op.tl,
share/txr/stdlib/package.tl, share/txr/stdlib/param.tl,
share/txr/stdlib/path-test.tl, share/txr/stdlib/place.tl,
share/txr/stdlib/pmac.tl, share/txr/stdlib/save-exe.tl,
share/txr/stdlib/socket.tl, share/txr/stdlib/stream-wrap.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/tagbody.tl,
share/txr/stdlib/termios.tl, share/txr/stdlib/trace.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.tl,
share/txr/stdlib/vm-param.tl,
share/txr/stdlib/with-resources.tl,
share/txr/stdlib/with-stream.tl, share/txr/stdlib/yield.tl,
signal.c, signal.h, socket.c, socket.h, stream.c, stream.h,
struct.c, struct.h, strudel.c, strudel.h, sysif.c, sysif.h,
syslog.c, syslog.h, termios.c, termios.h, tree.c, tree.h,
txr.1, txr.c, txr.h, unwind.c, unwind.h, utf8.c, utf8.h, vm.c,
vm.h, vmop.h, win/cleansvg.txr: Extended copyright notices
to 2020.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (sinh_s, cosh_s, tanh_s, asinh_s, acosh_s, atanh_s):
New symbol variables.
(sinh, cosh, tanh, asinh, acosh, atanh): New static functions.
(sineh, cosih, tangh, asineh, acosih, atangh): New functions.
(arith_init): Register sinh, cosh, tanh, asinh, acosh and
atanh intrinsic functions, and initialize the new symbol
variables.
* configure: Detect availability of hyperbolic functions in
math library and defne HAVE_HYPERBOLICS as 1 in config.h
accordingly.
* lib.h (sineh, cosih, tangh, asineh, acosih, atangh):
Declared.
* txr.1: Documented new hyperbolic functions and their method
counterparts that a numeric struct can implement.
|
|
|
|
|
|
|
| |
* arith.c (digcommon): Improved termination test in the second
loop to avoid wasteful pop when the list of powers is empty.
Use rcyc_pop to recycle these conses; they will be immediately
reused for building the output list.
|
|
|
|
|
|
| |
* arith.c (digcommon): Fix off-by-one test causing incorrect
results for radix powers like (digits 10) (digits 100) ...
and analogously in other radices. Reported by vapnik spaknik.
|
|
|
|
|
| |
* arith.c (digcommon): Fix wrong test that allows base 1 to be
admitted, resulting in infinitely looping behavior.
|
|
|
|
|
|
|
|
|
| |
* arith.c (ash): Introduce smaller scopes and move variable
initializations close to their use. The NUM case of argument
a no longer falls through to the BGNUM case, and doesn't
cons up a bignum object. Rather, a temporary mp_int is
allocated, used and freed. The gc_hint added in the previous
commit is now gone.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On 32 bit x86 Solaris 10, with gcc 4.9.0, this issue caused a
miscompilation of the pset macro, due to ash abruptly
returning zero, causing the op-code field of an instruction to
be NOOP rather than GCALL.
I'm committing this fix just for reference; I will immediately
replace it with a refactoring of the function.
* arith.c (ash): Add a gc_hint to prevent the a bignum from
being reclaimed if the b = make_bignum() triggers gc.
This happens in the case when the previous case computes
a = make_bignum() and falls through.
|
|
|
|
|
|
|
| |
* arith.c (logcount): NUM case doesn't have a return statement
in 64 bit build, statement causing fall-through to BGNUM case
where the integer object is treated as a bignum. This bug has
existed in the function ab initio.
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (bitset_s): New symbol variable.
(bitset): New function.
(arith_init): bitset_s initialized, bitset intrinsic
registered.
* lib.h (bitset): Declared.
* txr.1: Documented bitset function and method.
|
|
|
|
|
| |
* arith.c (int_flo): Don't subtract one from INT_PTR_MIN any
more, since it is now the most negative integer already.
|
|
|
|
|
|
| |
* arith.c: we need to include "alloca.h" since we have moved
some functions into here from lib.c which use "args.h" macros.
This shows up on Cygwin and some other platforms.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (r_ceil_s, r_round_s): New symbol variables.
(ceildiv, roundiv): Route binary cases involving struts
directly to binary methods so the object is responsible for
the complete implementation.
(arith_init): Initialize r_ceil_s and r_round_s.
* tests/016/ud-arith.tl (numbase): Binary methods added for
ceil and round. Test cases added.
* txr.1: Descriptions for binary ceil and round methods added;
Notes about non-existence of binary methods removed from unary
ceil and round removed.
|
|
|
|
|
| |
* arith.c (plus, minus, mul, mod, floordiv): Dispatch reverse
operaton for PTR/COBJ combination.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* tests/016/ud-arith.expected b/tests/016/ud-arith.tl:
New file.
* tests/016/ud-arith.expected b/tests/016/ud-arith.expected:
New file.
* arith.c (divi): Bugfix: wrong argument tested for being
a COBJ.
(logtrunc): Fix incorrect method call: calling r-logtrunc-s
for the object-in-left-position case.
(sign_extend): Fix semantics not following documentation:
dispatch method with original arguments.
(divv): When there is just one argument, take advantage of the
hitherto unused unary case of divi rather than giving it both
arguments. The object dispatch is in that unary case, so we
need it now.
(arith_init): Fix wrong name of r_lognot_s symbol.
* txr.1: Fix atan2 being documented as atan.
Fix misspelling of r-lognot as lognot-r.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Most of the library now accepts struct objects as
arguments, relying on them to implement methods.
* arith.c (minus_s, inv_minus_s, neg_s, abs_s, signum_s,
mul_s, div_s, recip_s, inv_div_s, trunc1_s, trunc_s,
r_trunc_s, mod_s, r_mod_s, zerop_s, plusp_s, minusp_s,
evenp_s, oddp_s, gt_s, lt_s, ge_s, le_s, numeq_s, expt_s,
r_expt_s, exptmod_s, isqrt_s, square_s, floor_s, floor1_s,
r_floor_s, ceil_s, ceil1_s, round_s, round1_s, sin_s, cos_s,
tan_s, asin_s, acos_s, atan_s, atan2_s, r_atan2_s, log_s,
log2_s, log10_s, exp_s, sqrt_s, logand_s, logior_s, logxor_s,
lognot1_s, lognot_s, r_lognot_s, logtrunc_s, r_logtrunc_s,
sign_extend_s, ash_s, bit_s, width_s, logcount_s): New symbol
variables.
(not_struct_error, method_error, do_unary_method,
do_binary_method, do_ternary_method): New static functions.
(plus, minus, neg, abso, signum, mul, trunc1, trunc, mod,
floordiv, round1, roundiv, divi, zerop, plusp, minusp, evenp,
oddp, gt, lt, ge, le, numeq, expt, exptmod, isqrt, square,
floorf, ceili, since, cosi, tang, asine, atang, atang2, loga,
logten, logtwo, expo, sqroot, logand, logior, logxor,
comp_trunc, lognot, sign_extend, ash, bit, logcount, width,
bits, unary_num, unary_arith): Support struct arguments.
(plusv, minusv, mulv, divv, sumv, prodv, gtv, ltv, gev, lev,
numeqv, exptv, logandv, logiorv): Use symbol for self instead
of string lit.
(arith_init): Initialize new symbol variables. Replace
existing intern calls in function registrations with
references to some of these symbol variables.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* arith.c (plus): Add missing break statements to two switch
cases. One is at the end, where it is not strictly necessary.
The other omission is harmless also and may have been
deliberate, though not commented by a /* fallthrough */.
The other functions with this same pattern, namely minus,
has the breaks.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.c, lib.c (num, c_num, c_fixnum, bad_float, flo, c_flo, fixnump, bignump,
integerp, floatp, numberp nary_op, nary_simple_op, plusv,
minusv, mulv, divv, logandv, logiorv, gtv, ltv, gev, lev,
numeqv, numneqv, sumv, prod, exptv, gcdv, lcmv): Function
definitions moved from lib.c to arith.c.
(nary_op_keyfun, unary_num, unary_arith, unary_int, sumv,
prodv, rexpt, abso_self): Static functions moved from
libmoved from lib.c to arith.c.
(max): New macro in arith.c.
(arith_init): Registrations moved from eval.c.
* eval.c (eval_init): Registrations moved to arith.c
|