| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
| |
* regex.c (regex_source): New function.
(regex_init): regex-source intrinsic registered.
* regex.h (regex_source): Declared.
* txr.1: Documented.
|
|
|
|
|
| |
* regex.c (print_rec): Fix checking arg1
for consp but accessing arg2.
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state loop): If the rs
variable is nil, provide a record reader which reads
paragraphs, like under Awk's paragraph mode when RS
is blank. This does not support the requirement that
newline is always a field separator, regardless of
the value of FS.
* txr.1: Documented paragraph mode.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state loop): Refactor
code so that record-processing loop obtains a lambda
which is called to extract a record. If rs and krs did
not change, then the same lambda is obtained from
a variable which caches it. The get-rec-reader local
function thus encapsulates the whole record delimiting
strategy as well as changes to the variables. With this
structure, it will be relatively easy to add support
for Awk's paragraph mode, which is notably missing in
the implementation.
|
|
|
|
|
|
|
|
| |
* awk.tl (sys:awk-state loop): The loop now notices
when rs or krs changes and switches to a new
record-adapter or to the raw stream as necessary.
* txr.1: Notes added about changes to rs and krs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (struct strlist_in): New struct type.
(strlist_in_stream_mark, strlist_in_get_line,
strlist_in_get_char, strlist_in_unget_char,
strlist_in_get_prop, strlist_in_get_error_str):
New static functions.
(strlist_in_ops): New static struct.
(make_strlist_input_stream): New function.
(stream_init): Register make-strlist-input-stream
intrinsic.
* stream.h (make_strlist_input_stream): Declared.
* txr.1: Documented make-strlist-input-stream.
Call fill_stream_ops on new strlist_in_ops
struct to fill in common default stream operations.
|
|
|
|
|
| |
* txr.1: Documenting effect of fconv on rec,
and its return value.
|
|
|
|
|
| |
* txr.1: POSIX-derived example 1 can be made to
conform to the original with orec.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state): New slot,
orig-rec.
(sys:awk-state loop): Initialize orig-rec after reading
each record.
(sys:awk-let): Provide orec symbol macro.
* txr.1: Document orec variable.
|
|
|
|
|
| |
* txr.1: Adding 19 examples, converted from POSIX
standard's Awk eamples.
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:range-test): Function renamed
to sys:awk-test, since it's not just for ranges.
(sys:awk-let): Uses of sys:range-test follow rename.
sys:awk-test introduced into expansion of cond parts
of cond-action clauses.
* txr.1: Documented new behavior (conditions can produce
a function or regex, which is implicitly invoked on rec).
|
|
|
|
| |
* txr.1: Change .coSS to .SS* in two places.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl: If there are no cond-action
clauses in the macro, do not generate the main record
processing lambda, or the begin-file and end-file
lambdas, and do not generate the call to the
awk state object's loop method.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/conv.tl (sys:conv-let): New
flets iz, oz, xz, bz and rz.
* txr.1: Documented under fconv.
|
|
|
|
|
|
|
|
|
|
| |
* arith.c (tofloatz, tointz): New functions.
* arith.h (tofloatz, tointz): Declared.
* eval.c (eval_init): Register tofloatz and tointz intrinsics.
* txr.1: Documented new functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TXR Lisp files run from the command line do not see -Dvar=val
bindings, whereas -p expressions do. The REPL sees the
bindings, but not code loaded from it using (load "file.tl")
because they are lexical.
Let's keep these bindings as local lexicals for -p and -e
forms, but install them as global lexicals for the
other situations.
* parser.c (repl): Get rid of the local repl_env made
from the bindings that are passed in. Instead, before
starting the REPL, loop through the bindings and install
them as global lexicals with reg_varl.
* txr.c (txr_main): Before processing a Lisp file,
install the bindings as global lexicals with reg_varl.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have a problem not handling negative list indices
which index beyond the beginning of the list.
Such accesses are just storing and retrieving the
first element!
* lib.c (listref): If a negative index is still negative
after the length of the list is added to it, then
return nil. Do not return car(list)!
(listref_l): Similary, do not return car_l(list) if
the index is less than zero, so that an error
occurs for an out-of-range negative index.
* txr.1: Update the documentation for ref
to describe these indexing constraints, and also
to include hashes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-compile-time): New slot,
rng-rec-temp. Specifies the name of a temporary variable
which is scoped over the evaluation of ranges, and which
caches a reference to the current record string.
(sys:range-test): New function.
(awk:let): Rename the original rng macrolet to sys:rng,
and introduce rng as a wrapper around it which inserts
the logic for calling the regex or function that might
emerge from the evaluation of from-expr or to-expr.
(awk): If ranges are present in the syntax, then bind
the temporary variable which caches the record around
the evaluations of the ranges.
* txr.1: Document new special behavior of rng w.r.t
functions and regexes. Add admonition against modifying
rec and some other awk variables from range expressions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The sys:regex internal symbol was historically used when
derivative-based regexes had a S-exp representation headed
by that symbol. It had to be a private symbol.
Now the regex symbol is only used as the COBJ class type
for regexes; it makes no sense for it to be in the sys
package. We want user code to be able to refer to this
type using a public symbol.
* lib.c (obj_init): Intern the regex symbol stored
in regex_s in user_package.
* txr.1: Include regex in the type graph in the
Object Type section, and in the type list under
the typeof function.
|
|
|
|
|
|
|
| |
* eval.c (do_eval): The no such function or operator message
is replaced with one which makes it clear that this means
that the first element of the form doesn't name an operator
or function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (do_match_full, do_match_full_offs, do_match_left,
do_match_left_offs, do_match_right, do_match_right_offs):
New static functions.
(regex_match_full_fun, regex_match_right_fun,
regex_match_full, regex_match_left, regex_match_right,
regex_range_full, regex_range_left, regex_range_right):
New functions.
(regex_init): Register f^$, f^, f$, m^$, m^, m$, r^$,
r^ and r$ intrinsics.
* regex.h (regex_match_full_fun, regex_match_right_fun,
regex_match_full, regex_match_left, regex_match_right,
regex_range_full, regex_range_left, regex_range_right):
Declared.
* txr.1: Documented new functions.
|
|
|
|
|
| |
* txr.1: New paragraph added under the Regular Expressions Library
minor section.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The way the end-position argument works in match-regex-right
and match-regst-right is poorly considered. It basically
enforces a constraint that there is a match which ends
at that position and does not go beyond. This patch changes
it work right: the functions test that the regex matches
up to that position, as if the string ended there.
* regex.c (match_regex_right_old): New static function,
identical to the previous match_regex_right.
Since we won't ever be using this inside TXR from any
other module, we don't make it external.
(match_regex_right): Rewritten to new semantics.
(match_regst_right_old): New static function;
provides the semantics of the old match_regst_right
based on match_regex_right_old.
(regex_init): Register match-regex-right and match-regst-right
intrinsics to the match_regex_right_old and
match_regst_right_old functions if compatibility <= 150 is
requested. Otherwise they go to the rewritten new
functions.
* txr.1: Documentation updated, and compat notes
added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The documentation says that match-regex returns the length.
Actually, it returns the position after the last character
matched. This makes a difference when the match doesn't begin
at character zero.
The actual behavior is that of the match_regex C function
which has behaved that way since the dawn of TXR, and
internals depend on it behaving that way.
So the internal function is being retained, and a new function
is being registered as the match-regex intrinsic. The choice
of binding for match-regex is subject to the compatibility
option.
The behavior of match-regst is also being fixed since its
return value is incorrect due to this issue. Since its
return value makes no sense at all (does not represent
the matched text), it is not subject to the compatibility
option; it is just fixed to conform with the documentation.
* regex.c (match_regex_len): New function.
(match_regst): Keep using match_regex, but use its return
value properly. This simplifies the range extraction code,
which is why match_regex works that way in the first place.
(regex_init): Register match-regex to match_regex_len,
unless compatibility <= 150 is requested; then register
to match_regex.
* regex.h (match_regex_len): Declared.
* txr.1: Compatibility notes added.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* LICENSE: Reverted to Two-Clause BSD license. The
copyright of the Linenoise library are included, because
it uses exactly the same license. A note is added
about MPI being in the public domain.
* LICENSE-CYG: Revised text to clarify the situation that
Cygnal is only bundled with a particular Windows build of TXR.
* METALICENSE: Revised text. All references to modifications
to the BSD license are removed. Gives pointers to the MPI and linenoise
license files. Notes that linenoise is under the Two-Clause BSD also.
Makes a note about Cygnal and points to LICENSE-CYG.
* inst.nsi: Remove the text which tells the user that
use of the program requires agreement with the license;
refer only to redistribution. The "Agree" buttons are renamed
"Acknowledge".
* mpi/make-logtab, mpi/mpi.c, mpi/mpi.h, mpi/mplogic.c,
mpi/mplogic.h: Remove copyright notices and "all rights
reserved", since the author had placed this into the public
domain, as made explicit in the README file.
|
|
|
|
|
| |
* txr.1: search-regst added to heading of section which
describes it.
|
|
|
|
|
|
|
|
| |
* lib.c (generic_funcall): Add case for regexes.
Handle arguments in such a way that the string is always
rightmost, with a view to convenient partial application.
* txr.1: Documented in multiple places.
|
|
|
|
|
|
|
|
|
| |
* regex.c (regsub): Allow the second argument to be
a function, which is called with str as an argument,
and returns a range which indicates what part of
the string is to be replaced, or else nil.
* txr.1: Documented functional argument of regsub.
|
|
|
|
|
|
|
|
|
| |
* regex.c (match_regex, match_regex_right): Detect
a negative start or end position, respectively,
and add the string length to it. If it is still
negative, bail with nil.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Remove all regex-related function
registrations from here.
* regex.c (regex_init): Move regex-related function
registrations here.
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (pset, push, pushnew): Use rlet
for binding the assigned or pushed value to a temporary,
so the temporary can disappear if the value is a constant.
|