| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* gencadr.txr: Use let instead of useless rlet
that will just reduce to let.
* share/txr/stdlib/cadr.tl: Regenerated.
* share/txr/stdlib/place.tl (sys:var, car, cdr, errno):
Replace rlet with slet where safe.
(nthcdr): Replace useless let* with let.
Replace one safe-looking rlet with slet.
(dwim): Replace useless rlet with let.
|
|
|
|
|
| |
* genman.txr: Recognize the form of the table-of-contents
line with the extra blank line generated by the .coSS macro.
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state loop): Take input
stream directly without a record adapter, if the record
separator is the string "\n".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-compile-time): New slots,
begin-file-actions and end-file-actions.
(sys:awk-state loop): Take two additional functional arguments
for the begin file and end file actions, and do the
calls in the right places. unwind-protect triggers the
end file function.
(sys:awk-expander): Parse out :begin-file and :end-file
actions.
(awk): Generate lambdas for begin-file and end-file actions,
if they are defined. Pass these to the loop method.
The code is refactored here to do one big sys:awk-let
around everything.
* txr.1: Documented :begin-file and :end-file, revising
the :begin and :end documentation in the process.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-compile-time): New
slots: inputs, output, name, lets, begin-actions,
end-actions, cond-actions.
(sys:awk-expander): Use just one local variable,
an awk compile time. Instead of the previous local
variables, use the slots of this structure and
return just that structure. Note that pattern-actions
has been renamed cond-actions. This is per the terminology
used in the newly-written documentation.
(awk): Adjust to sys:awk-expander returning just the
awk compile-time structure. No need to set up numerous
locals; just refer to struct.
|
|
|
|
| |
* txr.1: New section on the awk macro.
|
|
|
|
|
|
|
|
| |
* genman.txr: Hack: put <dd> before nested <dl> element
in table of contents. Without this, the nested lists
are rendered flush left by Google Chrome. With this, they
are indented. Chrome adds ugly whitespace around the embedded
definition lists, but it's better than no identation.
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state rec-to-f): Don't use
zap macro when the return value is not used.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-let): The closing
expression of an awk range only applies when
the range is active. Refactor generated code with local flags to
eliminate duplicating the end range expression.
Avoid evaluating the start range expression if the
range is already active.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-let): Use our
wonderful placelet macro instead of symacrolet for binding the
flag alias to the flag place. This removes the duplicate
evaluations of the slot access.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
awk ranges must evaluate out-of-band after the
record is read, before the patterns and actions
are evaluated.
* share/txr/stdlib/awk.tl (sys:awk-compile-time): New slots,
rng-expr-temps and rng-exprs.
(sys:awk-let): Stash the code for evaluating a range into
the compile-time info into the rng-exprs list, and associate
it with a gensym in the parallel rng-expr-temps list.
Then emit that gensym as the expansion for the rng form.
(awk): Process the pattern code in two steps. First, expand
it, to get it to drop the rng-exprs into the awk compile-time
info structure. Then when generating the final lambda,
wrap an let* around the generated code which
binds the rng-temps with the rng-exprs. This resolves the
gensym references that replaced the ranges. let* is is used
and its bindings are reversed into discovery order because
this supports nested rng syntax. Given (rng x (rng y z)), the
(rng y z) is expanded first, and so its code and temp gensym
are pushed onto their respective lists firsts. The outer
rng's code will thus contain a temp referring to the
code of the inner one.
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state): if output is a
string, open file.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state): New slot, ors.
(sys:awk-state prn): Use put-string to output the record
rather than put-line, and stick the ors at the end.
(sys:awk-let): Provide ors local symbol macro.
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (qref): Use slet instead of let
in expansion so that in the common case of var.(method ...)
the expansion simply produces a form with var evaluated in two
places.
(sys:rslot): Use slet instead of rlet.
* tests/012/struct.tl: Update qref expansion test-cases
to test for the now simpler expansions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (place_set_entries): Add slet symbol to autoload
list for place.tl.
* share/txr/stdlib/place.tl (sys:r-s-let-expander): New
function.
(rlet): Replace body with call to sys:r-s-let-expander.
(slet): New macro.
* txr.1: Clarification and corrections in rlet description
and example. rlet will in fact handle the three-variable
rotation case because, since a is not a constant expression,
(rlet ((temp a)) ...) reduces to let.
Documented new slet.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state): New slot,
rng-vec: holds boolean flags for ranges.
New slot, rng-n, holds size for rng-vec.
New :postinit handler for creating vector for
rng-vec.
(sys:awk-compile-time): New struct.
(sys:awk-expander): Construct an awk compile time,
and return that as one of the values.
(sys:awk-let): Provide (rng) local macro: the two argument
range operator. Generates code and keeps track of
number of ranges and their association to a position
in rng-vec using the compile-time info structure.
(awk): Capture awk compile-time object from expander.
Initialize rng-n slot of awk state with
number of ranges indicated in compile time info.
Pass compile-time info to awk:let macro.
Binding of lambda and of awk state had to be reordered
because macro-expansion of the lambda fills in the compile
time info which is then used in the expansion of the
constructing expression for the awk state.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (pinc, pdec, test-set, test-clear,
compare-swap, test-inc, test-dec): New macros.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (inc, dec): If the delta
is zero, don't generate code which calls getter
and setter; just generate the place form as the
output.
|
|
|
|
|
|
|
|
|
| |
* struct.c (call_postinitfun_chain): call base
handlers before derived ones, except in backward
compatibility mode.
* txr.1: Updated documentation of :postinit,
and added compatibility note.
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (awk_set_entries, awk_instantiate): New static
functions.
(lisplib_init): Register auto-loading for awk module
via new functions.
* share/txr/stdlib/awk.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This provides a way to create lexical macros denoting slots,
such that method are invoked when they are updated.
* lisplib.c (struct_set_entries): Add rslot to list of
auto-load symbols for struct.tl module.
* share/txr/stdlib/struct.tl (sys:rslotset): New function.
(rslot, rslot): New macro and place macro.
(sys:rslot): New place kind.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The expansion of a place macro form should not be
subject to a complete macro-expansion (as a
regular macro form). Only one round of expansion
should be performed, and the results should be
re-tried as a place macro. Otherwise an opportunity
to expland a place macro will be missed.
* share/txr/stdlib/place.tl (sys:pl-expand):
Use macroexpand-1 rather than macroexpand.
* txr.1: Documentation updated to make the new behavior
clear. It's unlikely that anything in the world depends
on this, so no backward compatibility switch is being
provded to the old behavior. In situations where this
makes a difference, the old behavior is likely too wrong
to be useful.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:l1-setq): Expand sym, because
it might not be a symbol. If it isn't a symbol, just generate
a set.
(dwim): Unconditionally bind sys:*lisp1* to t, whether
or not the unexpanded place is a symbol. It could expand to
a symbol. The context is lisp-1 if it does that.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (sys:*pl-env*): New special
variable for passing macro-expansion environment to
expanders.
(call-update-expander, call-clobber-expander,
call-delete-expander): bind sys:*pl-env* with
passed-in env argument, so if the expander needs to itself
recursively expand a macro, it has the macro-time env.
(nthcdr): Do not try to capture :env parameter, because
this will always be nil. Refer to sys:*pl-env* instead.
|
|
|
|
|
|
|
| |
Introduced on 2016-04-27 in 7afbcc19.
* parser.y (elem): Check $4 phrase position for
empty clauses, rather than $2. That's where they are.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
| |
* txr.1: Substantially rewrote incorrect and incomplete
description of merge directive.
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.c (txr_main): the --lisp option causes the parse
stream to be processed as Lisp, which is fine if it is a file
stream. If it is a byte string input stream created by the -c
option, it won't work due to missing character operations on
the stream, resulting in a strange error message and
termination. That issue isn't being fixed here; just providing
a more meaningful error message when --lisp is combined
with -c.
|
|
|
|
|
|
|
|
| |
* inst.nsi: Windows has no man page reading tools, and
the PDF and HTML are packaged already, so don't bundle
the txr.1 man page source. Furthermore, we need to remove
this when updating over existing installations, else
they will forever have a stale txr.1 file hanging around.
|
|
|
|
|
| |
* inst.nsi: consistently specify installation directory
with lower-case "txr" path component.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.1: The term "query language" is retired; "pattern
language" is used everywhere. The script argument can be TXR
Lisp or TXR, so is referred to as "script-file" in all
contexts where it could be either. Clarifications are added in
a few places that the script could be Lisp or that some
wording only applies when the script is TXR. Removing
incorrect, obsolescent wording which specifies that the
leading exclamation mark convention is honored in a file name
argument.
|
|
|
|
|
|
| |
* txr.1: Under INTERACTIVE LISTENER, add remarks that
using the exit function, or raising a fatal signal,
will prevent the history from being saved.
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.1: Revise the synopsis so that it doesn't insinuate
that the query-file or data-file arguments are mandatory.
A formatting issue with the brackets around options is
fixed. Under ARGUMENTS AND OPTIONS document that if
no arguments are present, the interactive listener
is launched. Under INTERACTIVE LISTENER, mention that
not only does the -i option run the listener, but so does
txr invocation with no arguments.
|
|
|
|
|
| |
* txr.1: Fix plural subject "lines" paired with singular
verb "has".
|
|
|
|
|
| |
* txr.1: Fix sentence talking about two functions,
respectively, but just one function as its subject.
|
|
|
|
|
|
|
|
|
| |
* parser.y (if_clause, elif_clauses_opt):
The previous commit changes the emulation of old @(if)
behavior, since expressions obtained via the n_exprs_opt
grammar phrase are not subject to expand_meta.
We can counteract this by calling expand_meta in
the compatibility code.
|
|
|
|
|
|
|
|
|
| |
* parser.y (if_clause, elif_clauses_opt, repeat_clause,
rep_elem): Recognize argument expressions as n_exprs_opt
rather than exprs_opt, so that expand_meta is not applied.
They are Lisp expressions, which are broken by expand_meta.
A failing test case is op syntax with @num metanum
variables, e.g. @(if (foo (op bar @1.slot))).
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (qquote_init): Stricter quote_form_p_f test
function: reject the quote form if it isn't a proper
list of two elements.
(optimize_qquote_form): Extract all arguments of list
forms and catenate them with mapcan, rather than
assuming that they have one argument. This wrong
assumption breaks ,,*(list ...) interpolation,
for instance.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (consp_f, second_f, list_form_p_f, quote_form_p_f,
xform_listed_quote_f): New static variables.
(qquote_init): New function.
(optimize_qquote_form): Use list_form_p_f, quote_form_p_f, and
second_f instead of constructing functions locally.
(optimize_qquote_args): Use xform_listed_quote_f instead
of locally constructed function.
(eval_init): Call qquote_init.
Register second function to second_f.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Staci-blowing test case:
(defstruct foo nil bar)
(mlet ((f (lnew foo bar (not f.bar))))
(prinl f.bar))
* struct.c (lazy_struct_init): Do not flip the lazy flag to zero
here. The problem is that it's being done after the
funcall(so->slot[0]), and so the struct is still marked for
lazy initialization while that function is running.
We could detect the circularity (as done in the force function) but that
would create inflexibilities in lazy struct initialization.
(check_init_lazy_struct): Flip the lazy flag to zero in
this function before calling lazy_struct_init.
* txr.1: Document behavior of struct being freely accessible during
lazy initialization.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The surface motive here is to get better code than
forms like (append (list 'a) (list 'b) ...).
The ulterior motive is to suppress the memory
explosion when heavily nested forms like ^^^^^^^^^^^x
are expanded. This problem was uncovered by
AFL (fast).
* eval.c (optimize_qquote_form, optimize_qquote_args,
optimize_qquote): New static functions.
(expand_qquote_rec): New function.
(expand_qquote): Contents moved into expand_qquote_rec.
This function now optimizes the results of calling
expand_qquote_rec.
|
|
|
|
|
|
| |
* eval.c (list_star_s): New symbol variable.
(eval_init): Initialize list_star_s and use it for the
list* function registration.
|
|
|
|
| |
* txr.1: list* symbol was typeset as meta.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (time_parse_s): New symbol variable.
(tm_to_time_struct): New static function,
based on code moved out of broken_time_struct.
(broken_time_struct): Bulk of code replaced with call to
tm_to_time_struct.
(time_struct_to_tm): New parameter, strict. Indicates
whether nils in time struct are converted to zeros,
or whether they trigger errors.
(time_string_meth): Specify strict conversion
of argument time struct to to struct tm when
calling time_struct_to_tm.
(time_parse_meth): New static function.
(time_init): Initialize time_parse_s symbol variable;
add time-parse static slot to time struct;
initialize slot with new method.
* txr.1: Document time-parse method.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The op transformer generates a lambda which has
as many arguments as the highest-valued metanumber
(@<digits> syntax) occurring in the form.
If this is a huge integer, it obligingly tries to
construct the argument list, running out of memory.
In this commit, we cap the value to 1024.
This issue was uncovered by the fuzzing utility
AFL (fast) 2.30b.
* eval.c (me_op): Throw error if max exceeds 1024,
preventing the call to supplement_op_syms to actually
generate an a formal parameter list of max symbols.
|
|
|
|
|
|
| |
* eval.c (me_def_variable): Check for sym not
being a bindable symbol. Otherwise we might call
mark_special on nil, which triggers an assertion.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Variables defined with defvarl or defparml are being marked
special, due to a mark_special call in the macro expander
which existed before they were introduced.
* eval.c (me_def_variable): We have to call mark_special
at macro-expansion-time for defparm and defvar, rather than
arrange for it to be called later, for the same reasons
that the (now incorrect) mark_special call had been introduced
in do_expand function for handling defvar.
(do_expand): Do not call mark_special, because the symbol
being handled here is defvarl: define lexical variable.
|
|
|
|
|
|
| |
* eval.c (do_expand): Throw error if defsymacro form
isn't a list of three elements, just like defparm
and defparml do.
|
|
|
|
|
|
| |
* eval.c (op_defvarl, op_defsymacro): Report correct
symbol in not-bindable-symbol error message rather
than reporting as let.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (time_string_s): New symbol variable.
(time_fields_to_tm, time_struct_to_tm): New static functions.
(make_time_impl): Replace bunch of code with call to
time_fields_to_tm.
(time_string_meth): New static function.
(time_init): Initialize time_string_s. Add time-string
static slot to time struct. Register time-string
method.
* txr.1: Documented.
|