| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Gone is the need for :vars to inform @(repeat)/@(rep) about
variable references buried in Lisp.
* eval.c (expand_with_free_refs): Change to external linkage.
* eval.h (expand_with_free_refs): Declared.
* parser.y (extract_vars): Handle sys:expr forms, which are
embedded Lisp via expand_with_free_refs to uncover their free
variables.
* txr.1: Redocumented this area.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Up to now the @(repeat) and @(rep) directives have scanned
their interior to find output variables. We now hoist that
into the parser; the variables are found up-front and
integrated into the abstract syntax.
This work anticipates doing a more proper job of identifying
free variables in Lisp expressions.
* match.c (extract_vars): Delete static this function here.
It moves into parser.y.
(extract_bindings): Don't call extract_vars to obtain the
variables occurring in the repeat body. Get it as a new
argument, occur_vars.
(do_output_line, do_repeat): Extract the new occur_vars
element of the abstract syntax node and pass it to
extract_bindings.
* parser.y (extract_vars): New static function, moved here
from match.c.
(repeat_rep_helper): Scan over each of the repeat subclauses
with extract vars. Catenate the resulting lists together and
pass through uniq to squash repeated symbols. Then add the
resulting vars as a new element of the returned syntax node.
|
|
|
|
|
|
| |
* lib.c (length_proper_list): Forward decl removed.
* match.c (do_match_line): Likewise.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This contains two reverts, folded into one.
"txr: spurious retention in @(next)."
commit fe1e960389a89f481d46c02aa040fdc762da735f.
"txr: avoid by-value match_files_ctx passing."
commit 3d7330b827d6e9cc0d9e87edd30388374cb45900.
These are dependent. The second of these two (i.e. the one
that was done first) is the problematic one. By-reference
passing of contexts means contexts become shared objects
between callers and callees. But this is incorrect, because
mutations are going on, like c->spec = rest(c->spec) or
c->data = rest(c->data). These mutations were done under the
assumption of safety: that the caller is not affected due to
by-value semantics of the entire context.
|
|
|
|
|
|
| |
* txr.1: Document that all the edits done to a history line
are committed as a single undo item when navigating away from
it. Clarify some text related to undo over a history line.
|
|
|
|
|
|
|
|
|
| |
This problem was was introduced in TXR 239 in commit
1f54ad5cc1d384d0818a6bf6cec20a95ecc5a5ae. The completion for
package-qualified symbols and keywords is wonky.
* parser.c (find_matching_syms): The first argument to scat is
the separator, so we must specify it as nil.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It looks like Flex has a "never-interactive" option which does
what the batch option should be doing: it removes the use of
isatty.
Historically, it was an %option only with no corresponding
command-line option; newer Flex has a --never-interactive
command line option also.
The batch option actually makes very little difference in the
output. If never-interactive is used, then the batch option
makes no difference.
* parser.l (%option): Add never-interactive option, remove
batch.
(VER, FLEX_VER, YY_NO_UNISTD_H, isatty, no_isatty): Remove all
these macros: under the never-interactive option, there are
no isatty calls and no inclusion of <unistd.h>.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Likewise.
|
|
|
|
|
|
|
|
|
| |
* parser.l (VER, FLEX_VER): New macros.
(isatty): Define the macro differently for Flex 2.5.36 and
older, to counteract the skeleton's "extern int isatty(int)"
declaration. This involves a dummy global variable.
(no_isatty): New dummy global, only under Flex 2.5.36 and
older.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This looks like it originates in June 19, 2019 commit
28c6225fec6ce999806e9c077f08ed0e668646c4, before Version 218.
The commit introduced the ability to use a character object
as a separator in cat_str and split_str_keep. The
implementation was broken as written for Cygwin.
This finally showed up for me today as a failure in the new
in6addr-str test cases. By chance, I noticed at the same time
that tab completion in the listener was acting strangely on
packag prefix symbols; that issue also went away with
this fix.
* lib.c (cat_str, vscat, scat3, split_str_keep): We must use
wref on the array initialized using the wini macro, because on
Cygwin, the string starts at [1] not [0].
|
|
|
|
|
|
|
| |
* stream.c (run): Pass self to fds_swizzle.
* sysif.c (getpwuid_wrap): Declare self variable and pass
to c_num.
|
|
|
|
| |
* txr.1: Clarifying comma and number agreement.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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 flex-generated scanner wastefully calls isatty(0) whenever
it is initialized, even though we don't read from a stdio
stream. Even (read "abc") will call isatty(0), which is
unacceptable.
Moreover, this happens even if Flex is told to operate in
batch mode rather than interactive.
With the following change, the isatty calls are gone.
Let's switch Flex to batch mode, too.
* parser.l: Remove <unistd.h> inclusion. Define isatty as a
macro that returns zero. Add the batch option to the scanner.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Flex-generated scanners contain a #include <unistd.h>
directive, whose purpose seems to be to ensure that isatty is
declared. This #include is in a bad place, long after all our
headers have been declared. We define macros in lib.h and
elsewhere that can interfere with system headers.
The Homebrew distro people have run into this problem on OS/X.
Our lib.h defines a "noreturn" macro (that should arguably be
named NORETURN, to match the style for INLINE). A "noreturn"
macro interferes with __attribute__((noreturn)) syntax in
system headers. Our main strategy for not causing that problem
is to include all system headers first, before local headers.
* parser.l: include <unistd.h> right after "config.h", if
HAVE_UNISTD_H is defined. Define YY_NO_UNISTD_H to suppress
the flex-generated #include.
|
|
|
|
|
|
| |
* txr.c (banner): In plain mode, indicate that the mode is
in effect. Do not suggest any Ctrl-X commands, since they
are not recognized.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (sock_set_entries): Register autoload entries for
inaddr-str and in6addr-str. Register prefix symbol to be
interned.
* share/txr/stdlib/socket.tl (sockaddr-in, sockaddr-in6): Both
structs get a new member, prefix, defaulting to the respective
number of bits in the address.
(inaddr-str, in6addr-str): New functions.
* tests/014/iaddr-str, tests/014/inaddr-str.expected,
tests/014/in6addr-str.tl, tests/014/in6addr-str.expected:
New files
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval (eval_init): Register sspl, an argument-reversed
interface to split-str-set.
* lib.c (sspl): New function.
* lib.h (sspl): Declared.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (dirstat): Call lstat_wrap, rather than stat_wrap.
This function must report about the directory entry itself,
not about what that entry points to if it happens to be a
symlink. The d-type member of the dirent structure
representing a symlink must be set to dt-lnk.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ftw.c (ftw_callback): Pass nil to new parameter of
stat_to_struct, to have a new stat struct allocated as before.
* sysif.c (stat_to_struct, stat_impl, stat_wrap, lstat_wrap
dirstat): New optional parameter that lets caller specify an
existing struct object to fill.
(sysif_init): Adjust registrations of stat, fstat, lstat and
dirstat for new optional parameter.
* sysif.h (stat_to_struct, stat_wrap): Declarations updated.
* txr.1: Documented.
|
|
|
|
|
|
| |
* txr.1: Add remarks on the differences between how TXR Lisp
and ANSI CL deal with unhandled exceptions/conditions of type
error and warning.
|
|
|
|
|
| |
* txr.1: Improved wording and fixed some grammar issues in the
the paragraphs that introduce TXR Lisp exception handling.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This partially reverts and reworks commit
c5afb01548c5b6bf4ec83373b5e2e09f14690b01 from May 4, 2018.
I have no idea why I replaced fallback code which does
something quite reasonable: invokes realpath on the value from
argv[0]. The commit comment claims that this breaks when the
program is not invoked with an absolute path, but how can that
be, if realpath is used?
* txr.c (get_self_path): Let's keep TXR_INST_PATH, and return
that in the case that progname_u8 is null, because of a
null argv[0]. Otherwise, let's revert to the original strategy
of calling realpath on progname_u8.
|
|
|
|
| |
* txr.1: cptr-buf syntax wrongly refers to cptr-obj.
|
|
|
|
|
| |
* ffi.c (cptr_out): tft->out may be null, in which case
tft->put must be used.
|
|
|
|
|
| |
* txr.1: "two three" should be three. Found thanks to the keen
eyes of Ivor Horton.
|
|
|
|
|
|
| |
* txr.1: Fix repeated "this this", and an an incorrect
insinuation that the ffi-get has an obj argument. Rather, it
returns an object.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These functions are quite helpful in dealing with semi-opaque
types, like the xmlNode type of libxml2. Such types must be
treated as an opaque handle when passed to and returned from
the API, and not subject to any encoding or decoding, which
means that the appropriate representation for them is via the
cptr family of types. However, semi-opaque types also have
client-visible members that must be accessed directly. These
new functions provide for that access in a convenient way.
* ffi.c (ffi_type_lookup_checked): New static function.
(cptr_getobj, cptr_out): New static functions.
(ffi_init): Register cptr-get and cptr-out.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* tags.tl (in-anon-package): Pass t to sys:make-anon-package,
so the resulting package won't hold on to symbols that the
utility isn't interested in, just because it's holding on to
other symbols that come from the smae package.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A package is weak if it holds weak references to symbols,
meaning that if there are no references to a symbol other than
its entry in a weak package, it can be removed from the
package and reclaimed by the garbage collector.
* eval.c (eval_init): Update registrations for make-package
and sys:make-anon-package to reflect new optional argument.
* lib.c (make_package_common): New argument weak. If it is
true then both the hashes will have weak values.
(make_package, make_anon_package): New optional argument weak.
(obj_init): Add nil argument to calls to make_package. All the
standard packages are regular, not weak.
* lib.h (make_package, make_anon_package): Declarations
updated.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* arith.h (minus_s): Declared.
* eval.c (reg_symacro): Changing to external linkage.
* eval.h (macro_time_s, reg_symacro): Declared.
* parser.c (repl): Bind the *-1 to *-20 symbol macros.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This function back-fills the missing d-type information in a
dirent on platforms that don't provide d_type in the native
dirent.
* sysif.c (DT_FIFO, DT_CHR, DT_DIR, DT_BLK, DT_REG, DT_LNK,
DT_SOCK): Define all these preprocessor symbols to their Linux
values on platforms where DT_DIR is not defined.
(DT_UNKNOWN): Make sure this symbol is #undef-d if DT_DIR
is not defined, so the corresponding dt-unknown variable does
not exist.
(dirstat): New static function.
(sysif_init): Register dirstat intrinsic. Register dt-fifo and
the rest unconditionally now. Changing their order to
increasing numeric.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* sysif.c (opendir_free): Since d->dir may now be null, avoid
calling closedir on it in that situation. Also, set d->dir to
null after closedir.
(closedir_wrap): New static function.
(readdir_wrap): If the d->dir is null, safely treat that as a
directory entry not being available; do not pass a null DIR
pointer to readdir.
(sysif_init): Register intrinsic function closedir.
* txr.1: Documented, plus spelling error fix under readdir.
|
|
|
|
|
|
| |
* sysif.c (opendir_wrap): Store path into d->path after
allocating the cobj, because d->path may be the only reference
to that object, and the cobj call may trigger gc.
|
|
|
|
|
|
|
| |
* sysif.c (readdir_wrap): If d_name is "." or ".." loop around
and get another directory entry.
* txr.1: Documented.
|
|
|
|
|
| |
* lib.c (iter_item): Fix neglect in this function to
check for an oop iterator and use its iter-item method.
|
|
|
|
|
| |
* txr.1: Document that iter-more returns t when an
oop-iterator does not feature the iter-more method.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.c (UTF_DECL_OPENDIR): Macro defined, to enable
w_opendir declaration in utf8.h.
(w_opendir): Static function removed.
* sysif.c (UTF_DECL_OPENDIR): Macro defined.
(dir_s): Symbol defined unconditionally now, regardless of
HAVE_PWUID.
(dirent_s): New symbol.
(dirent_st): New static variable.
(struct dir): New struct type.
(opendir_free, opendir_mark opendir_wrap, readdir_wrap): New
static functions.
(opendir_ops): New static structure.
(sysif_init): Intern dirent symbol. Create dirent structure
type. Register opendir and readdir intrinsic functions.
Register variables dt-blk, dt-chr, dt-dir, dt-fifo, dt-lnk,
dt-reg, dt-sock and dt-unknown.
* utf8.c (UTF8_DECL_OPENDIR): Macro defined.
(w_opendir): Function moved here from stream.c, and turned
external.
* utf8.h (w_opendir): Declared, conditionally on
UTF8_DECL_OPENDIR being defined, so that most modules that
include utf8.h don't have to include <dirent.h>.
* txr.1: Documented.
diff --git a/sysif.c b/sysif.c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The printer for uref/qref doesn't check for symbols that
contain digits in the name, and so for instance (qref a3 3a)
comes out as a3.3a, which does not read back, due to looking
like a cramped floating-point constant. It looks like the
weakest rule we can make is that all symbols that can be
preceded by a dot must not have a name starting with a digit.
Thus (qref 3a b c) can render as 3a.b.c. But (qref a 3b c)
must not render as a.3b.c; it must be (qref a 3b c).
* lib.c (simple_qref_args_p): Enact the above rule. In
all positions preceded by a dot, if the symbol starts with a
digit, then return nil to indicate that the syntax must be
rendered in the list form.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print_impl): The simple_qref_args_p function is
called with reversed values of pos. For uref, we want 1,
because the first item occurs after the dot, and for qref we
want 0, because the first item occurs before the dot. This
mix up means that the degenerate syntax (qref X) incorrectly
prints as just X instead of (qref X). Likewise, though
harmlessly, (uref X) fails to render as .X, instead coming out
as (uref X).
|
|
|
|
|
| |
* genvim.txr (generate): Use a single, undivided @(output)
block instead of multiple blocks with :continue.
|
|
|
|
|
| |
* parser.y (yybadtoken): Add all unhandled token types once
and for all: BLOCK, GATHER, MOD, MODLAST, SPLICE.
|
|
|
|
|
|
|
|
|
| |
* lib.c (list_seq_func): New static function.
(list_seq): Convert to lazy processing. The iterator is
threaded through the lazy cons's car field, so we don't have
to mutate the function's environment.
* txr.1: Added note about list-seq producing a lazy list.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This turns out to be way easier than I thought.
* match.c (do_output_if): New static function.
(do_output): Handle if via do_output_if.
* parser.y (out_if_clause, out_elif_clauses_opt,
out_else_clause_opt): New nonterminal symbols and grammar
rules.
(out_clause): Now produces out_if_clause.
(not_a_clause): Remove ELIF and ELSE; these entries here cause
conflicts now. Here, continue to recognize the Lisp if, which
is distinguished by having at least two arguments.
out_if_clause matches only a one-argument if, and a
no-argumeent one that is diagnosed as erroneous.
* txr.1: Documented.
|
|
|
|
|
| |
* match.c (do_repeat): New static function.
(do_output): Repeat processing logic moved into do_repeat.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_iterable): Return t if argument is a structure
supporting the iter-begin method.
(seq_iter_get_oop, seq_iter_peek_oop, seq_iter_get_fast_oop,
seq_iter_peek_fast_oop): New static functions.
(seq_iter_init_with_info): Handle COBJ case. If the COBJ is a
structure which suports the iter-begin method, then retrieve
the iterator object by calling it, and then prepare the
iterator structure for either the fast or the canonical
protocol based on whether the iterator supports iter-more.
(seq_iter_mark): Mark the iter member if the iterator is a
struct object.
(iter_begin): Rearrange tests here to check object type first
before sequence kind. If the object is a structure supporting
the iter-begin method, then call it and return its value.
(iter_more, iter_step): Check for struct object with
corresponding special methods and return.
(iter_reset): Similar change like in iter_begin. We check for
the iter-reset special method and try to use it, otherwise
fall back on the regular iter_begin logic.
* lib.h (struct seq_iter): New member next of the ul union
for caching the result of a peek operation.
* struct.c (iter_begin_s, iter_more_s, iter_item_s,
iter_step_s, iter_reset_s): New symbol variables;
(special_sym): Pointers to new symbol variables added to
array.
(struct_init): New symbol variables initialized.
(get_special_required_slot): New function.
* struct.h (iter_begin_s, iter_more_s, iter_item_s,
iter_step_s, iter_reset_s): Declared.
(enum special_slot): New enum members iter_begin_m,
iter_more_m, iter_item_m, iter_step_m, iter_reset_m.
(get_special_required_slot): Declared.
* txr.1: Documented.
* tests/012/oop-seq.expected: New file.
* tests/012/oop-seq.tl: New file.
|
|
|
|
| |
* txr.1: article missing: "satisfies [the] predicate function".
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_iter_rewind, seq_iter_init_with_info): Reverse
the order in which we perform some type tests. We check for
some special types first, and then for the sequence kind.
These situations are mutually exclusive now, so the order
doesn't matter. The plan is to introduce the ability for a
structure object to be iterable with special methods. Such an
object won't necessarily be a sequence (seq_info may identify
it as SEQ_NOTSEQ). This code will be prepared for it becuase
it's now checking for the type first, before the sequence
kind.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register iterable intrinsic.
* lib.c (seq_iterable): New static function.
(nullify): Use seq_iterable to simplify function.
(iterable): New function.
* lib.h (iterable): Declared.
* txr.1: Documented.
|