| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
* 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.h (mod_s, bit_s): Add extern declarations.
* ffi.c (bit_s): Remove definition.
* match.c (mod_s): Remove definition. Include "arith.h" to
obtain declaration of mod_s.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
| |
* txr.1: umask returns the current value, not the value t.
The argument is optional, for just returning the current
value, which is done via a destructive trick that we should
document. Mention all the permission constants also.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For security, the temporary files used by the "edit in
external editor" feature of the listener, as well as the
listener history file, should be readable and writable only to
the owner.
This relates to Debian bug 832460 against the Linenoise
library:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=832460
In the TXR fork of the linenoise library, since we have an OS
abstraction invoked by callback functions, we fix this
entirely outside of linenoise.
I don't agree with the upstream approach of fiddling with the
umask and doing a chmod on the path.
Since we are truncating and overwriting the file, all we
have to do is, before writing any data, fchmod it to the
required permissions.
* parser.c (lino_open): If the file is being open for
overwriting, then let's set its permissions so that it's
readable and writable for the user only.
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
|
|
| |
* arith.c (plus_s): Definition moved here.
(arith_init): Register numerous math intrinsics here.
* eval.c (plus_s): Definition removed.
(eval_init): Numerous math function registrations removed.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
| |
* lib.c (bad_float): Add missing parentheses around
controlling expression of switch statement. This worked on
glibc because it's a macro which expands to parentheses.
|
|
|
|
|
|
|
|
|
| |
* txr.1: Make it clearer that the default expression of an
optional parameter is only evaluated when required.
Document that t, nil and keyword symbols can't be used
as parameters, and that duplicates symbols are unspecified,
the situation being diagnosed by the compiler but ignored by the
interpreter.
|
|
|
|
|
|
| |
* txr.1: specification of let and let* is substantially
revised for clarity, and behavior of duplicate symbols,
and special variables.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (take_until_list_fun): Renamed to
lazy_take_until_list_fun.
(lazy_take_until_list_fun, take_until): take_until upgraded to
use seq_info to classify sequence. In the lazy list case, the
state cons is elided; the predicate function is passed as the
function environment, and the key function and list being
traversed are propagated via the lazy cons car and cdr.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (take_list_fun, take_while_list_fun): Renamed to
lazy_take_list_fun and lazy_take_while_list_fun respectively.
(lazy_take_list_fun, take): take upgraded to use seq_info to
classify sequence. In the lazy list case, the state cons is
elided; the list is passed as the function environment, and
the remaining count is propagated in the lazy cons's car field.
(lazy_take_while_list_fun, take_while): Similar changes.
* txr.1: Fixed accidental reference to drop function in the
documentation for the take function.
|
|
|
|
|
| |
* lib.c (lazy_interpose_func, lazy_interpose): Pass list in
car of lcons, and separator as function env.
|
|
|
|
|
|
| |
* lib.c (partition_star_func, partition_star): Eliminate
state cons. Eliminate wasteful cons updating and destructuring
in loop.
|
|
|
|
|
| |
* txr.1: Under in split doc, add a sentence highlighting
the difference between split and partition.
|
|
|
|
|
|
| |
* lib.c (partition_func, split_func, split_star_func,
partition_split_common): Store three context elements
in function's env, and lcons car/cdr.
|
|
|
|
|
|
| |
* lib.c (partition_by_func, partition_by): Store the three
context items in the function's env, and the lcons car and
cdr, instead of allocating a two-cons list stored in the env.
|
|
|
|
|
|
| |
* lib.c (tuples_func, tuples): Store the three context items
in the function's env, and the lcons car and cdr, instead
of allocating a two-cons list stored in the env.
|
|
|
|
|
|
|
| |
* lib.c (lazy_flatcar_func, lazy_flatcar): Here, the state
information consists of just one value. We just make
that value itself the function's env, and mutate that env
as needed.
|
|
|
|
|
|
|
| |
* lib.c (lazy_flatten_func, lazy_flatten): Do not allocate a
cons to hold the traversal state. In fact, the environment of
the function is not used at all; the lcons car and cdr are
used to propagate the state.
|
|
|
|
|
|
|
|
| |
* lib.c (lazy_appendv_func, lazy_appendv): Do not allocate a
cons cell for maintaining the state. Use the function
environment for one of the two state values, and thread
the other state value through the initial car contents of each
lazy cons cell.
|
|
|
|
|
|
|
| |
* lib.c (us_func_set_env): New function: func_set_env without
the type check.
* lib.h (us_func_set_env): Declared.
|
|
|
|
|
| |
* txr.1: Clarifying text added under find-struct-type and
struct-type-p to better explain struct-type.
|
|
|
|
|
|
|
|
| |
* lib.c (subtypep): If the supertype is struct, then return t
if the subtype is the name of a struct type.
* txr.1: Update the type graph to show the struct root, adding
a note about it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Here we allow application code to take advantage of a trick
already used internally.
When a lazy cons cell is created, we can temporarily put
state information into its car and cdr fields.
When these fields are accessed normally, by the car and cdr
function, the lazy cons' update function will be invoked,
which will populate these fields.
If we have a way for that function to retrieve the existing
values of those fields, then the function can treat those
fields as state information: it can retrieve the values into
temporary local variables, overwrite the original values,
and then propagate the state information into the car and cdr
into the next lazy cons cell being added.
Thus lazy list generation that needs two cells of state or
less does not require the allocation of a context object.
* eval.c (eval_init): make-lazy-cons becomes a three-argument
function with two optional parameters. New functions
lcons-car and lcons-cdr are registered.
* lib.c (make_lazy_cons_pub): New function, wrapping
make_lazy_cons_car_cdr with argument defaulting.
(lcons_car, lcons_cdr): New functions.
* lib.h (make_lazy_cons_pu, lcons_car, lcons_cdr): Declared.
* txr.1: Updated doc of make-lazy-cons regarding new
arguments. Documented lcons-car and lcons-cdr.
|
|
|
|
|
|
|
|
| |
* hash.c (hash_keys_lazy, hash_values_lazy, hash_pairs_lazy,
hash_alist_lazy): Use us_lcons_fun instead of direct
lcons->lc.fun access.
* lib.c (simple_lazy_stream_func, lazy_stream_func): Likewise.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (make_lazy_cons_car_cdr): New function.
(lazy_where_func, lazy_where_hash_func, where): Use
make_lazy_cons_car and the new make_lazy_cons_car_cdr instead
of two-step construction and initialization with us_rplaca and
us_rplacd.
* lib.h (make_lazy_cons_car_cdr): Declared.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (make_half_lazy_cons): Renamed to make
make_lazy_cons_car.
* lib.c (rem_lazy_rec, make_half_lazy_cons): Follow rename.
* hash.c (hash_keys_lazy, hash_keys, hash_values_lazy,
hash_values, hash_pairs_lazy, hash_pairs, hash_alist_lazy,
hash_alist): Follow rename.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.h (us_lcons_fun): New inline function.
(us_cons_bind): New macro.
* eval.c (lazy_mapcar_func, lazy_mapcarv_func, range_func,
range_star_func, generate_func, giterate_func, ginterate_func,
expand_right_fun, repeat_infinite_func, repeat_times_func,
pad_func): Use us_cons_bind, us_car, us_cdr, us_rplaca,
us_rplacd and us_lazy_cons_func, which skip the type check.
* lib.c (lazy_conses_func, lazy_appendv_func, rem_lazy_func,
lazy_flatten_func, lazy_flatcar_fund, tuples_func,
partition_by_func, partition_func, split_func,
split_star_func, partition_star_func, lazy_interpose_fun,
take_list_fun, take_while_list_fun, take_until_list_fun,
lazy_where_has_func): Likewise.
|
|
|
|
|
| |
* txr.1: Update the possibly misleading dialect note about
treatment of foo:bar in ANSI CL.
|
|
|
|
|
|
|
|
| |
* lib.c (lazy_where_func, lazy_where_hash_func): New static
functions.
(where): Rewritten to generate lazy list.
* txr.1: Doc updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On platforms that have the C99 fpclassify, we can use it to
banish infinity and NaN representations. If such a thing
arises, we throw an exception rather than producing an object
that prints as #<bad-float>.
* configure: add detection for fpclassify.
* lib.c (bad_float): New inline function and macro.
(flo): If the argument is other than zero, a normal
value or a subnormal, then throw an exception. We thereby
refuse to admit such objects into our numeric object
system.
|
|
|
|
|
|
|
|
|
|
| |
* parser.l (out_of_range_float): New static function.
(grammar): Check for flo_str returning nil in several places;
that value is returned for out of range floats. This is not
documented!
* txr.1: Document athat flo-str returns nil for out-of-range
floats.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register seq-begin, seq-next and
seq-reset.
* lib.c (seq_iter_s): New symbol variable.
(seq_iter_mark): New static function.
(seq_iter_ops): New static structure.
(seq_begin, seq_next, seq_reset): New functions.
(obj_init): Intern seq-iter symbol, used as class name for
iterators.
* lib.h (seq_iter_s, seq_begin, seq_next, seq_reset):
Declared.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: Document that floor, mod, floor-rem and other
functions in this family throw an exception if the
divisor is zero.
|
|
|
|
|
|
|
|
|
| |
* arith.c (expt): The function overhauled. Raising integers to
negative integers now works. Raising zero to a negative is
diagnosed as a division by zero for operands of all kinds.
* txr.1: Documentation updated for expt, and also division by
zero error is documented for the / function.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander): Drop getform
argument. Obtain the arguments of the place in a variable
called args, which is then explicitly destructured with
tree-case to match the params list. Having all of the original
arguments in args, we can work backwards to replace some of
them with gensyms. The resulting gensym-ized list is used
to generate the access call to the operator named by name.
* txr.1: Update doc to get rid of get-form. Updated and
corrected the long form example.
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (struct_set_entries): Add missing entry for lnew
in the name array. This is not just a missing auto-load issue.
Because we don't intern the symbol, struct.tl ends up defining
a sys:lnew macro, and not usr:lnew. The symbol usr:lnew
doesn't exist and so when application code tries to use lnew,
it's trying to invoke pub:lnew.
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/defset.tl (defset-expander): Check for
restpar being an atom and handle differently. We still don't
handle the case where (b . c) is matched against a rest
parameter; in this case the mapcar will process an improper
list. I.e. the improper form must have an atom which matches
the position of the rest parameter.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* defset.tl (defset-expander): Add logic to expand parameter
list to determine additional paramters that may come out of
the expansion, as well as additional symbols that may be
visible as a result as a result of processing in the expanded
body. These symbols are included in the same way as original
the original parameters.
* txr.1: Documented defset's support for parameter list macros.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (do_expand): A wrong thing is being done here:
the macro is extended using the original parameter
syntax, that has not been processed by expand_params.
The body is then expanded using that environment.
This subtly breaks support for parameter macros in tree-bind.
They work, but there are spurious warnings about undefined
variables during expansion, and the wrong scope handling
can introduce bugs. The right thing is to derive new_menv
by pulling the parameter symbols from params_ex.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (defset_instantiate, defset_set_entries): New
static functions.
(lisplib_init): Register auto-load of defset.tl, keyed on
defset symbol.
* share/txr/stdlib/defset.tl: New file.
* share/txr/stdlib/paramt.tl (param-parser-base opt-syms):
New method.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: The hash function doesn't support a keyword
like :seed <n> to specify the hash seed. Adding an explanation
of why. Spoiler: security reason.
|
|
|
|
|
| |
* txr.1: Fold make-hash over two lines to avoid 80 col
overflow under man.
|