| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (userdata_k): New keyword symbol variable.
(hash_print_op): Print the userdata together with
the hash flags as :userdata obj.
(hashv): Parse out :userdata obj syntax from
the argument list. This takes care of supporting
it in the read notation and in the hash function.
(hash_init): Initialize userdata_k.
* txr.1: Documenting :userdata in hash
read notation and hash function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (gmtoff_s, zone_s): New symbol variables.
(tm_to_time_struct): Copy tm_gmtoff and tm_zone into
Lisp struct from struct tm, if the platform has these.
(time_fields_to_tm): Zero/null-out the tm_gmtoff
and tm_zone fields of the target structure, if the
platform has them.
(time_init): Intern the gmtoff and zone symbols,
initializing the gmtoff_s and zone_s variables.
Add the gmtoff and zone slots to the time struct.
* txr.1: Documented new slots.
|
|
|
|
| |
* txr.1: necessary -> necessarily
|
|
|
|
|
|
|
|
|
|
|
| |
When Ctrl-X Enter is used to resubmit a line from
the history, and it is a duplicate, it is not entered
into the history. The position then doesn't advance
to the next historic line.
* linenoise/linenoise.c (lino_hist_add): Do add
the line even if it is duplicate if the last submitted
line was from the middle of the history.
|
|
|
|
|
|
|
| |
* filter.c (regex_from_trie): New static function.
(filter_init): Register regex-from-trie intrinsic.
* txr.1: Documented regex-from-trie.
|
|
|
|
|
|
|
|
|
|
|
| |
Since much regex code assumes these are binary, the easiest
and briefest approach is to implement a code transformation
pass which rewrites n-ary forms into binary.
* regex.c (reg_nary_unfold, reg_nary_to_bin): New
functions.
(regex_compile): Put raw sexp through reg_nary_to_bin
to expand the nary syntax.
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (reg_expand_nongreedy, reg_compile_csets):
Generalize the compound_s case slightly by referring
to sym rather than hard-coded compound_s. Then handle
most of the regex operators under this same case.
Their semantics are not relevant to the expansions
being performed in these functions: all their arguments
are regexes to be recursed over.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (meth): Take trailing arguments
and pass them down to method, which now accepts them.
* struct.c (struct_init): Register method intrinsic to the
function method_args instead of the method function.
(method_args_fun): New static function.
(method_args): New function. Behaves like method
function if args is empty, otherwise creates a function
by means of method_args_fun.
* struct.h (method_args_fun): Declared.
* tests/012/oop.tl: New test case.
* tests/012/oop.expected: Updated.
* txr.1: Documented new features in method and
meth, revising the documentation in the process.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (umeth): accept variadic
arguments. Evaluate them using the dwim brackets
and pass to umethod. The (fun umethod) trick is
used to refer to the umethod in the function namespace
even if it is shadowed by a variable.
* struct.c (struct_init): Update registration of umethod to
reflect its new variadic argument signature.
(umethod_args_fun): New static function.
(umethod): Return a function based on umethod_fun,
as before, if there are no variadic args. Otherwise,
use umethod_args_fun which deals with them.
* struct.h (umethod): Declaration updated.
* tests/012/oop.tl: Modest testcase for umeth
with curried argument.
* tests/012/oop.expected: Updated.
* txr.1: Updated documentation of umeth and umethod.
|
|
|
|
|
|
| |
* args.c (args_cat_zap): New function.
* args.c (args_cat_zap): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* args.c (args_copy): Use from->arg and from->fill
in calculating the memcpy size. It doesn't matter
in this function because the to and from are the same;
however, this may be the origin of the copy and paste
error that led to args_cat_zap problem.
(args_copy_zap): Similar change to args_copy: be
consistent in using the from side expressions.
(args_cat_zap): Bugfix: the total size of the
to arguments was used to zap the from side.
This writes zeros past the end of the from
arguments. Fixing by calculating the size in one
place and using the calculated size.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
| |
* struct.c (clear_struct, reset_struct): Inform the garbage
collector that the structure has been mutate, using the mut
macro. This is required for correctness because the structure
may be a mature object receiving young generation values.
|
|
|
|
|
|
|
|
|
| |
* struct.c (replace_struct): If target and source
are the same object, just do nothing and return
target.
* txr.1: Document self-assignment and return
value of replace-struct.
|
|
|
|
|
|
| |
* txr.1: Where do is being introduced, fix a statement
that about op, which should be about do. Plus fix
verb agreement.
|
|
|
|
|
|
|
|
|
| |
* signal.c (set_signal_handler, get_sign_handler): Eliminate
newline in exception messages.
* stream.c (unimpl, formatv): Likewise.
* unwind.c (uw_block_abscond): Likewise.
|
|
|
|
|
|
|
|
| |
* stream.c (formatv): When the format string ends
at the point where the format character is expected
to occur, do not emit an error about #\nul being
an unknown format directive character; emit
an error that the character is missing.
|
|
|
|
|
|
|
|
| |
* struct.c (static_slot_ens_rec): Neglected use of
set macro to store newval in freshly allocated slot,
which means we corrupt garbage collection if this
causes an old generation objet to point to a new
generation object.
|
|
|
|
|
|
| |
* struct.c (struct_type_mark): We must assert that
sl->store is nil if we are not marking it,
not that it is non-nil.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
| |
* txr.1: document that ranges are immutable
and expand the surrounding wording a bit.
|
|
|
|
|
| |
* txr.1: describe slot specifier as (name init-form)
rather than (symbol init-form).
|
|
|
|
|
|
| |
* lib.c (length, empty): Handle RNG in switch.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-expander): Recognize :set
and :set-file cases.
* txr.1: Documented :set and :set-file, replacing some :begin
uses with :set in the examples.
|
|
|
|
|
|
|
|
|
| |
* regex.c (range_regex_all, regex_range_all): New functions.
(regex_init): Register rra intrinsic function.
* regex.c (range_regex_all, regex_range_all): Declared.
* txr.1: Documented rra.
|
|
|
|
|
| |
* arith.c (plus): Eliminate compound statement braces
around case that consists of one return statement.
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (regex_range_search): New function.
(regex_init): Register regex_range_search as rr intrinsic.
* regex.h (regex_range_search): Declared.
* txr.1: Documented rr, and added reference to it
in description of regex-range.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (search_regex): Handle negative starting positions
according to the convention elsewhere and fail excessively
negative ones. Consistently fail on starting positions
exceeding the length of the string. Handle zero length
matches by reporting them against the start position
or position one past the last character, based on the
value of from-end.
* txr.1: search-regex documentation updated.
|
|
|
|
|
|
| |
* txr.1: Document how the less function operates on
ranges, and that ranges rank between numbers and strings
on the comparison precedence for dissimilar types.
|
|
|
|
|
| |
* txr.1: Improve wording in the description
of how the less function operates on vectors.
|
|
|
|
|
|
|
| |
* arith.c (plus, minus, neg, abso, mul, trunc, divi, zerop,
gt, lt, ge, le, numeq): Support RNG type.
* txr.1: Documented arithmetic properties of ranges.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Makefile, args.c, args.h, arith.c, arith.h, cadr.c, cadr.h, combi.c,
combi.h, configure, debug.c, debug.h, eval.c, eval.h, filter.c,
filter.h, ftw.c, ftw.h, gc.c, gc.h, glob.c, glob.h, hash.c, hash.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,
share/txr/stdlib/awk.tl, share/txr/stdlib/build.tl,
share/txr/stdlib/cadr.tl, share/txr/stdlib/conv.tl,
share/txr/stdlib/except.tl, share/txr/stdlib/hash.tl,
share/txr/stdlib/ifa.tl, share/txr/stdlib/path-test.tl,
share/txr/stdlib/place.tl, share/txr/stdlib/socket.tl,
share/txr/stdlib/struct.tl, share/txr/stdlib/termios.tl,
share/txr/stdlib/txr-case.tl, share/txr/stdlib/type.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, sysif.c, sysif.h, syslog.c,
syslog.h, termios.c, termios.h, txr.1, txr.c, txr.h, unwind.c,
unwind.h, utf8.c, utf8.h: Revert to verbatim 2-Clause BSD.
|
|
|
|
|
| |
* struct.c (make_struct_type, static_slot_ens_rec): Throw an
error if there are too many static slots.
|
|
|
|
|
| |
* txr.1: fix one "a any" in structs and one in
notes on exotic regexes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixing the broken static slot handling in TXR Lisp's
"OOP structs" object system. Inherited static slots
are now shared with the base type; only static slots
explicitly defined in a derived type have a distinct
global instance in that type.
* share/txr/stdlib/struct.tl (sys:prune-nil-inits):
Function removed.
(sys:prune-missing-inits): New function. We now handle
static slot forms with missing inits specially, not
those with nil or missing inits.
(defstruct): Translate a (word name) form to (word name)
rather than (word name nil) if word is :static, because we
need this nuance for non-shared static slots, so they can
inherit the value from the base struct. For the purposes of
generating the static init function, prune away all the static
slot forms that do not have an initializer; we let those
default.
* struct.c (struct stslot): New struct for representing
a static slot.
(stslot_loc, stslot_place): New macros.
(struct struct_type): Member eqmslot changes to a pointer
to a struct stslot. The stslot dynamic array is no longer
an array of val, but an array of stslot structs.
(call_stinitfun_chain): The superclass chain of static
init functions is now called only in compatibility mode.
Otherwise only the type's own static init fun is called,
which defclass uses to initialize just the new or repeated
static slots. Inherited static slots are completely left
alone; they do not require initialization.
(static_slot_home_fixup): New static function; needed to
fix some internal pointers within the static slot arrays
if they are realloc'ed.
(make_struct_type): Considerably revised to implement
new scheme, while providing backward compatibility
switching. New slots live in the struct stslot in which
they are allocated. Inherited slots have home pointers
to within the array in the base.
(struct_type_mark): When walking the static slots,
mark only the store cells of those which live in
this array. Those that live elsewhere should have store
cells that are nil; let's assert on it.
(lookup_slot): Static slot lookup code has to retrieve
slots in the new way, indirecting through the home
pointer, which is hidden behind the stslot_loc
macro.
(lookup_static_slot_desc): New function, like
lookup_static_slot, but returning a pointer to the
struct stslot. Formed from the guts of lookup_static_slot.
(lookup_static_slot): Gutted and turned into a wrappar
around lookup_static_slot_desc.
(static_slot_set): Simple change here: add cast
because of the pointer type of eqmslot.
(static_slot_home_fixup_rec): New static function.
Fixes up the cached home in slot arrays in an entire
type hierarchy rooted at a given type, which has to be
done when its static slot has been reallocated, so all those
inherited static slot pointers in the derived types
are invalid.
(static_slot_rewrite_rec): New static function:
rewrites a particular inherited static slot in an inheritance
hierarchy to point to a different slot.
(static_slot_ens_rec): New static function: factored out
recursive logic of static_slot_ensure. Substantially rewritten
to handle new static slot scheme, plus support backward
compatibility. There is a bug fixed here: if an instance slot
is encountered in the no_error_p mode, it looks like we were
dereferencing through an invalid ptr through the
set(ptr, newval) line.
(static_slot_ensure): A wrapper now for static_slot_ens_rec.
(get_equal_method): Rework the logic related to the eqmslot
member of the struct_type structure, in terms of it being
a pointer now rather than an integer. The value -1 cast
to a pointer serves the previous -1 sentinel value which
indicates that it is confirmed (for the time being) that this
type doesn't have an equal method.
* txr.1: All documentation related to static slots updated,
and compatibility notes added.
* tests/012/oop.tl, tests/012/oop.expected: New files.
|
|
|
|
|
|
|
|
|
|
|
|
| |
If the user types Ctrl-X and then an arrow key,
we don't want garbage. We let an ESC received
in Ctrl-X extended command mode to be processed
normally and cancel that mode.
* linenoise.c (edit): Bypass the extended command
switch if the character is ESC. Then down below
in the ESC case of the regular command switch,
clear extended mode.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (load): Do not resolve all relative paths
relative to the current *load-path*, only pure
relative ones.
* match.c (v_load): Likewise.
* txr.1: Update doc for @(load)/@(include) and load function.
|
|
|
|
|
|
|
|
|
| |
* stream.c (plp_regex): New static variable.
(pure_rel_path_p): New function.
(stream_init): gc-protect plp_regex.
Register pure-rel-path-p intrinsic.
* txr.1: Document pure-rel-path-p and slightly revise abs-path-p.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* match.c (v_load): Obtain parent load path from *load-path*
variable, rather than from source location info
associated with the directive. This changes the
semantics of when a @(load ...) occurs in code included
via @(include ...). That @(load ...) is processed in the
*load-path* context of the parent, rather than the
include.
* tests/011/txr-case.txr: Load txr-case.txr from the
standard library, rather than include it. Otherwise
txr-case.txr looks for txr-case.tl in tests/011.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (sys_load_s): Variable removed.
(sys_load): Function removed.
(load): Body of function taken from sys_load.
There is no sloc argument; the *load-path*
variable is sampled via new load_path macro.
(me_load): Static function removed.
(eval_init): Remove initialization of sys_load_s
Remove registration of load macro and
sys:load function. Register load function.
* eval.h (load_path): New macro.
* txr.1: Change documentation of load from macro
to function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The self-load-path symbol macro is as of now
deprecated. It simply expands to *load-path*.
*load-path* is a new special variable which is
dynamically bound to the path of a file
being loaded.
* eval.c (self_load_path_s): Global variable renamed
to load_path_s.
(sys_load): Bind *load-path* around processing of loaded file.
(me_load): Expand (load x) simply to (sys:load x *load-path*).
(set_get_symacro): Function removed.
(reg_symacro): New static function.
(eval_init): Initialize renamed load_path_s with interned
symbol having the name *load-path*. Register the *load-path*
special variable. Set up the sel-load-path symbol macro
aliasing for *load-path*.
* eval.h (self_load_path_s): Declaration renamed.
* match.c (v_load): Bind *load-path* around loading
or inclusion.
* parser.c (load_rcfile): Bind *load-path* around loading
of .txr_profile file.
* txr.c (txr_main): Bind *load-path* instead of
self-load-path symbol macro.
* txr.1: Updated documentation for @(load) directive
and load macro. Replaced documentation of self-load-path
with *load-path*.
|
|
|
|
| |
* txr.1: Left-anchored match in regsub with r^.
|
|
|
|
|
|
|
| |
* txr.c (license): Do not say that the TXR installation
might be unlicensed; there is no such licensing condition
that the license must be present at run-time.
Just state the fact of being unable to display it.
|
|
|
|
| |
* txr.1: Examples for f^$, f^ and f$.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (match_regex): Bail if pos is too positive,
beyond length of string.
(match_regex_right): Include the pos == end case in the
iteration, so we can match an empty suffix of the string. The
inner loop guard takes care of not feeding any characters from
the string into the regex machine in this case; we just feed
the terminating zero to get the final state.
(match_regst): Normalize a negative pos, otherwise the sub_str
calculation will be junk, since match_regex returns a
normalized position. After normalizing, check that if the
position is still negative, the match must fail.
(match_regst_right_old, match_regst_right): Use zero rather
than t as the range end in sub_str. That way if len is
zero and neg(len) produces zero, an empty string will
be sliced out. For negative values, the zero serves
as one position beyond the last char, just like t.
(do_match_full_offs, regex_match_full, regex_range_full,
regex_range_left): Fail match if normalized starting
pos is negative.
(regex_range_right): Fix completely bogus calculation of the
returne range in the case when the end position defaults to
the string length.
|
|
|
|
| |
* txr.1: New examples for awk macro fconv.
|
|
|
|
| |
* regex.c (puts_clear_flag): Fix bad indentation.
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (awk): Fix indentation
in two places.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state): New
slots: par-mode, par-mode-fs, par-mode-prev-fs.
(sys:awk-state rec-to-f): In paragraph mode,
detect that fs has changed since the last call.
In that case, take the user's fs and add to it
a newline match. If it is a regex, take the source,
add the syntax and recompile the regex. If it's
a string, build regex around it and compile.
(sys:awk-state loop): Maintain the par-mode-t
variable in the state structure as the rs
value triggers transitions into or out of
paragraph mode.
* txr.1: Updated documentation for rs.
|