| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* lib.c (sub_list, replace_list): Use original list
variable instead of copying it to iter. Use gc_hint on list so
that the old value doesn't hang around on the stack, while a
register copy marches through the list.
|
|
|
|
|
|
| |
* lib.c (last): Handle non-list sequences via sub function.
* txr.1: Updated description of last.
|
|
|
|
|
|
|
|
|
| |
* txr.c (txr_main): Implement handling of TXR_COMPAT
environment variable. Also, before entering interactive
mode, if compatibility has been set via TXR_COMPAT,
emit an informative message about this.
* txr.1: Documented TXR_COMPAT.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the equal method is defined for structs, its return
value is used in their place for hashing and comparison.
* eval.h (eq_s, eql_s, equal_s): Declared.
* hash.c (equal_hash): If a COBJ defines an equalsub
function, we call it. If it returns non-nil, we
take the object in its place and recurse.
* lib.c (equal): Refactored to support equality substitution.
(less): Support equality substitution.
* lib.h (cobj_ops): New function pointer member, equalsub.
Only struct instances define this, currently.
(cobj_ops_init): Add null entry to initializer for equalsub.
(cobj_ops_init_ex): New initialiation macro for
situations when the equalsub member must be provided.
* struct.c (struct struct_type): new member eqmslot.
(make_struct_type): Initialize emslot to zero.
(static_slot_set, static_slot_ensure): If eqmslot is -1,
indicating positive knowledge that there is no equal method
static slot, we must invalidate that with a zero: it is no
longer known whether there is or isn't such a slot.
(get_equal_method, struct_inst_equalsub): New static functions.
(struct_inst_ops): Initialize the equalsub member using
new cobj_ops_init_ex macro.
* txr.1: Document equality substitution.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allowing rankings among types which documentation says
are not comparable.
* lib.c (enum less_handling): New enum.
(less_tab): Elements are values of the less_handling enum.
(less_tab_init): Entries are renumbered. Everything that was
given precedence 5 or higher is now zero: not comparable.
Precedences 0 to 4 remap to 1 to 5. less_tab is populated
differently, since there are four values now. If either
the left or right type has 0 precedence, the value is
less_cannot: comparison is not possible.
(less): Only a less_tab value of less_compare now passes
control through to the switch statement. The less_cannot
value shortcuts to a cannot compare error.
Types that cannot occur in the switch now are removed,
and a default case goes to internal error.
|
|
|
|
|
|
|
|
| |
* lib.c (equal): We cannot pass both arguments to the
left object's equal function just because both arguments are
COBJ. We must make sure they are using the same operations.
The equal functions blindly assume that both arguments are
objects of the same type, and cast the pointers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (lnew): New macro.
* struct.c (struct_type): Turn id into a bitfield one bit
smaller than cnum. New Boolean bitfield lazy.
(struct_init): Register make-lazy-struct intrinsic.
(make_struct): Initialize lazy bitfield to zero.
(lazy_struct_init, check_init_lazy_struct): New static
functions.
(make_lazy_struct): New function.
(copy_struct, clear_struct, replace_struct, reset_struct,
lookup_slot, struct_inst_equal, struct_inst_hash):
Call check_init_lazy_struct on all structures involved.
(lookup_slot): Call check_init_lazy_struct.
(struct_inst_mark): If the struct is lazy, it has one
instance slot which must be marked, holding the argfun
function passed into make_lazy_struct.
* struct.h (make_lazy_struct): Declared.
* txr.1: Documented lnew and make-lazy-struct.
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (v_next): Evaluate the source expression as TXR Lisp,
unless it is meta-expression or meta-variable, or
the compatibility option is set to 124 or lower.
In those cases treat it as an expression of the TXR Pattern
* txr.1: Updated documentation of @(next) and all
relevant examples of @(next) everywhere.
Added compatibility notes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c (to_html_k, from_html_k, to_html_relaxed_k):
Variables removed.
(tohtml_k, tohtml_star_k, fromhtml_k): New keyword
symbol variables.
(to_html_table): Array renamed to tohtml_table.
(to_html_relaxed_table): Renamed to tohtml_star_table.
(from_html_table): Renamed to fromhtml_table.
(html_encode): Refers to tohtml_k.
(html_encode_star): Refers to tohtml_star_k.
(html_decode): Refers to fromhtml_k.
(filter_init): Initialize new symbol variables. Remove old
registrations. Register filters under old names too.
* txr.1: Document new names.
|
|
|
|
|
|
|
|
|
|
|
| |
* filter.c (to_html_relaxed_k): New keyword symbol variable.
(to_html_relaxed_table): New static array.
(html_encode_star): New static function.
(filter_init): Initialize new symbol variable.
Register new filter. Register html-encode* function.
* txr.1: Documented :to_html_relaxed filter and
html-encode* function.
|
|
|
|
| |
* filter.c (to_html_table): Add entry for apostrophe.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (h_coll): Check for rep symbol, and handle similarly
to v_coll. Use symbol in error message.
(dir_tables_init): Bind rep symbol to h_coll.
* parser.y (elems): Don't generate rep_elem phrase structure
for the sake of catching "rep outside of output"; this
production now conflicts with the intent to allow this.
(elem): Add various REP productions which clones of COLL.
* txr.1: Documented new @(rep) usage.
|
|
|
|
|
| |
* match.c (v_collect): Don't use hard-coded "collect"
in diagnostics because the symbol can be repeat.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (lazy_conses, term, nthcdr, memq, memql, memqual,
member, member_if, remq, remql, remqual, remove_if, keep_if,
countqual, countql, countq, count_if, some_satisfy,
all_satisfy, none_satisfy, proper_listp, length_list,
getplist, do_and, do_or, mappend, find, find_if, posqual,
posql, posq, pos, pos_if): Use gc_hint on list parameter.
(find_max, pos_max, in, search_list, where): Restructure so
that list parameter is used as iterator. Use gc_hint on it.
|
|
|
|
|
|
|
|
|
| |
* args.c (args_normalize): Zap the argument in the array
when moving it over to the list.
* args.h (args_atz): When zapping the argument in the list,
zap the actual car field, rather than the list itself. It seems there is a
copy of the list somewhere, so zapping it is not effective.
|
|
|
|
|
|
| |
* lib.c (mapdo): gc_hint the list variable so that the list
march isn't entirely optimized into a register, leaving a
pointer to the top of the list on the stack.
|
|
|
|
|
|
| |
* gc.c (gc_report_copies): New function
* gc.h (gc_report_copies): Declared.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Registered butlast intrinsic.
* lib.c (butlast): New function.
* lib.h (butlast): Declared.
* txr.1: Documented butlast.
|
|
|
|
|
|
|
| |
* lib.c (generic_funcall): If an object is used as a function,
get its lambda method and call that.
* txr.1: Document functors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* struct.c (struct_init): Register uslot intrinsic function.
(uslot_fun): New static function.
(uslot): New function.
* struct.h (uslot): Declared.
* share/txr/stdlib/struct.tl (usl): New macro.
* lisplib.c (struct_set_entries): Add usl macro.
* txr.1: Documented uslot and usl.
|
|
|
|
|
| |
* lisplib.c (struct_set_entries): Bugfix: missing
meth, umeth and defmeth.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
| |
* stream.c (formatv): The commit in which I added
the ~b specifier broke bignum octal printing due to
an incredibly silly typo.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* debug.c (show_bindings): Use ~d for level, so as
not to be influenced by *print-base*.
(debug): Use ~d for line numbers.
* lib.c (gensym): Use ~d conversion specifier
for formatting gensym counter into symbol name.
* match.c (LOG_MISMATCH, LOG_MATCH): Use ~d for
line number references.
(h_skip, h_coll, h_fun, h_chr, match_line_completely, v_skip,
v_fuzz, v_gather, v_collect, v_output, v_filter, v_fun,
v_assert, v_load, v_line, h_assert, open_data_source): Use ~d
for line refs, number of iterations, errno values.
* parser.c (repl): Use ~d for prompt line numbers,
numbered variables and the expr-<n> string in error
messages.
* parser.l (yyerrorf, source_loc_str): Use ~d for line
numbers.
* stream.c (print_base_s): New symbol variable.
(formatv): Implement *print-base*.
(stdio_maybe_read_error, stdio_maybe_error, stdio_close,
pipe_close, open_directory, open_file, open_fileno, open_tail,
open_process, run, remove_path): Use ~d for errno values.
(stream_init): Initialize print_base_s and register
*print-base* special variable.
sysif.c (mkdir_wrap, ensure_dir, getcwd_wrap, mknod_wrap,
chmod_wrap, symlink_wrap, link_wrap, readlink_wrap,
excec_wrap, stat_impl, pipe_wrap, poll_wrap, getgroups_wrap,
setuid_wrap, seteuid_wrap, setgid_wrap): Use ~d for
errno values and system function results.
* txr.1: Documented *print-base* and ~d conversion specifier.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* configure (have_dbl_decimal_dig): New variable.
New configure test to test for DBL_DECIMAL_DIG
or __DBL_DECIMAL_DIG__, resulting in FLO_MAX_DIG
macro being deposited in config.h.
* arith.c (arith_init): Register flo-max-dig variable.
* stream.c (print_flo_precision_s): New symbol variable.
(formatv): Obtain default precision from *print-flo-precision*
special variable, rather than hard coded DBL_DIG.
(stream_init): Initialize print_flo_precision_s variable,
and register *print-flo-precision* special.
* txr.1: Document flo-max-dig, *print-flo-precision*,
and change of behavior in format.
|
|
|
|
| |
* txr.1: Missing @, added for comma.
|
|
|
|
|
| |
* txr.1: mlet circular references are detected at
evaluation time, not by the macro.
|
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print_impl): When rendering quote,
quasiquote, unquote, splice, vector literals, and
meta-vars/meta-numbers into their read syntax, we must ensure
that these forms have the correct abstract syntax. If not, we
must print these as ordinary compound expressions. Otherwise
we throw errors, or don't print the complete object.
|
|
|
|
|
|
|
| |
* lib.h (list_collect, list_collect_nconc,
list_collect_append, list_collect_nreconc,
list_collect_revappend): Rename pptail parameter
to ptail, like in the lib.c definitions of these.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register revappend and nreconc
intrinsics.
* lib.c (list_collect_nreconc): New function.
(revlist): New static function.
(list_collect_revappend): New function.
(revappend, nreconc): New functions.
* lib.h (revappend, nreconc): Declared.
(list_collect_nreconc, list_collect_revappend): Declared.
* txr.1: Documented revappend and nreconc.
|
|
|
|
|
|
|
|
| |
* lib.c (nreverse): Handle strings and vectors
individually, and do strings and vectors in-place.
(reverse): Handle strings and vectors individually,
by duplicating and then in place. Handle lazy
strings by forcing, then reversing a copy.
|
|
|
|
|
| |
* lib.c (obj_print_impl): Handle rcons in same place
as other special syntax like sys:expr and quote.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register group-reduce intrinsic.
* hash.c (group_reduce): New function.
* hash.h (group_reduce): Declared.
* txr.1: Documented group-reduce.
|
|
|
|
|
|
| |
* lib.c (func_n6o): New function.
* lib.h (func_n6o): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (block_star_s): New symbol variable.
(op_block_star): New static function.
(do_expand): Handle block* symbol.
(return_star, abscond_star): New static functions.
(eval_init): Initialize block_star_s variable.
Register block* operator and return* and sys:abscond*
functions.
* txr.1: Documented new operator and functions.
|
|
|
|
|
|
|
|
| |
* eval.c (op_for): Establish the block before doing any
evaluation, subject to the compatibility option.
* txr.1: Updated documentation for for, exchanging
steps 1 and 2. Added compatibility notes.
|
|
|
|
|
|
| |
* lib.c (quicksort): Sort the shorter partition with real
recursion, then tail recurse with explicit goto to sort
the longer partition.
|
|
|
|
|
|
| |
* lib.c (med_of_three, middle_pivot): New static functions.
(quicksort): Use med_of_three to choose a pivot above a
threshold array size, otherwise just the middle element.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The read function no longer works like it used to on an
interactive terminal because of the support for .. and .
syntax on a top-level expression.
The iread function is provided which uses a modified syntax
that doesn't support these operators on a top-level
expression. The parser thus doesn't look one token ahead,
and so iread can return immediately.
* eval.c (eval_init): Register iread intrinsic function.
* parser.c (prime_parser): Only push back the recently seen
token when priming for a regular Lisp read. Handle
the prime_interactive method by preparing a SECRET_ESCAPE_I
token.
(lisp_parse_impl): New static function, formed from previous
lisp_parse. Takes a boolean argument indicating interactive
mode.
(prime_parser_post): New function.
(lisp_parse): Now a wrapper for lisp_parse_impl which
passes a nil to indicate noninteractive read.
(iread): New function.
* parser.h (enum prime_parser): New member, prime_interactive.
(scrub_scanner, iread, prime_parser_post): Declared.
* parser.l (prime_scanner): Handle the prime_interactive case
the same way as prime_lisp.
(scrub_scanner): New function.
* parser.y (SECRET_ESCAPE_I): New token type.
(i_expr): New nonterminal symbol. Like n_expr, but doesn't
support dot or dotdot operators, except in nested
subexpressions.
(spec): Handle SECRET_ESCAPE_I by way of i_expr.
(sym_helper): Before freeing the token lexeme, call
scrub_scanner. If the token is registered as the scanner's
most recently seen token, the scanner must forget that
registration, because it is no longer valid.
(parse): Call prime_parser_post.
* txr.1: Documented iread.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
| |
* gc.c (rel1): Removed.
* gc.h (rel1): Declaration removed.
|
|
|
|
|
|
|
|
| |
* regex.c (search_regex): In the Sep 7 2015 commit
titled "Don't use prot1 for temporary gc protection",
a rel1 call was left behind, causing an assert whenever
the function is used for a succesful "from end"
search.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
On 64 bit Darwin, sigset_t is 32 bits, sso our small_sigset_t is
actually larger. Let's use unsigned int.
* signal.h (small_sigset_t): Use unsignd int for set member.
* signal.c (small_sigfillset): Change cast to unsigned int.
|
|
|
|
|
|
|
|
|
|
|
| |
* unwind.c (revive_cont): Don't just reserve frame_slack
bytes below the continuation for any stack frame, but
clear the bytes to zero. On Cygwin, this fixes a failing
continuation test case. The issue is that the cont_obj
variable in capture_cont lands into this area (implying
it is not captured). When the continuation is revived,
the variable has a garbage value, rather than nil,
as expected.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When continuations are captured/restored in the middle of
variable binding constructs, a hidden problem occurs.
Binding constructs work by allocating an empty environment
and then destructively extending it. Since the environment
is not on the stack, but a referenced object, it doesn't
get deep copied into a continuation. As the continuation is
revived repeatedly, parts of the variable binding code are
repeatedly re-executed, and keep pushing fresh bindings into
the same environment object. Though the new bindings
correctly shadow the old, the old bindings are there and
potentially hang on to garbage.
The solution taken here is to introduce a new kind of frame
for handling the situation: a continuation copy handling
frame. This frame allows functions to register objects to
be copied more deeply if a continuation is captured/revived
across them.
* eval.c (copy_env): New static function.
(copy_env_handler): New static function.
(bind_args, bind_macro_params): Install continuation copy
handling frame for cloning new_env.
(struct bindings_helper_vars): New struct type.
(copy_bh_env_handler): New static function.
(bindings_helper): Install continuation copy handling frame
for de and ne variables which hold environments. The variables
are moved to a struct to facilitate access from the handler.
* eval.h (copy_env): Declared.
* unwind.c (uw_push_cont_copy): New function.
(call_copy_handler): New static function.
(revive_cont): When a continuation is being revived invoke the
copying actions in its continuation copy handling frames,
but not if it is only being temporarily revived for immediate
unwinding.
(capture_cont): After copying the continuation, invoke any
continuation copying frames in the "parent": the original
frames that were captured.
* unwind.h (enum uw_frtype): New type, UW_CONT_COPY.
(struct uw_cont_copy): New struct type.
(union uw_frame): New member cp.
(uw_push_cont_copy): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/yield.tl (sys:rcv-item): New struct type.
(sys:obtain-impl): Handle rcv-item, produced by a no-argument
yield-from, which requests an immediate resumption with
the previously given resume value. The reply value
is renamed the resume value.
(yield-from, yield): Form argument is optional.
* txr.1: Rewrote obtain and yield documentation with
lesser focus on implementation and greater focus on
abstract semantics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (set_dyn_env): Static function becomes external.
* eval.h (set_dyn_env): Declared.
* match.c (eval_with_bindings, eval_progn_with_bindings):
Evaluate Lisp code in null lexical environment. Instead
install the pattern variables as dynamic, so they shadow
global variables. A compatibility check for 121 or earlier
provides the old behavior.
* txr.1: Document scoping rules, and added compatibility
notes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We only need to stash the TXR matcher's context in an
environment frame when there is the possibility that
Lisp code may be called, or filters which re-enter
the matcher directly or through Lisp code.
* match.c (eval_with_bindings, eval_progn_with_bindings): New
static functions.
(dest_bind): Use eval_with_bindings instead of five lines
of boilerplate code.
(h_chr): No need to stash context around dest_bind;
lower levels take care of it.
(subst_vars): Do set up match context around the body
of this function, for the sake of Lisp calls and filtering
in format_field. Use eval_with_bindings.
(do_txeval): Remove match context environment frame setup
around subst_vars. Use eval_with_bindings, too.
(do_output_line): Use eval_with_bindings.
(v_output): No match context environment frame around
do_output.
(v_do, v_require): Use eval_progn_with_bindings instead of
five line boilerplate.
(v_line): No match context frame around dest_bind.
(h_do): Use eval_progn_with_bindings.
|