| 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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (pm_table): New static variable.
(expand_param_macro): New static function.
(expand_params): Expand parameter list macros via
expand_param_macro.
(eval_init): gc-protect pm_table and initialize it.
Register *param-macro* variable.
* lisplib.v (pmac_set_entries, pmac_instantiate): New static
functions.
(lisplib_init): Register autoloading of pmac.tl via new
functions.
* share/txr/stdlib/pmac.tl: New file.
* txr.1: Notes under defun, lambds, flet/labels and defmacro
about the existence of parameter macros which add to
the syntax. New Parameter List Macros section.
Documented *param-macro* and define-param-expander.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It turns out we have a silly problem: catch is a special
operator, which undergoes a macro-like expansion which alters
its syntax, but uses the same operator symbol.
We turn catch into a macro which expands to a sys:catch
operator.
* eval.c (sys_catch_s): New symbol variable.
(expand_catch): Function now expands sys:catch forms
without altering any syntax.
(do_expand): Check for sys:catch rather than catch.
Call expand_catch differently: it takes the form now
instead of just the arguments, so it can return the
original form if no expansion takes place.
(eval_init): Initialize sys_catch_s variable. Change
registration of op_catch to sys:catch symbol.
* lisplib.c (except_set_entries): Add catch to the
list of autoload symbols for except.tl.
* share/txr/stdlib/except.tl (catch): New macro for
transforming catch to sys:catch.
* txr.1: Reclassify catch operator as a macro.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state): New
slots fw, fw-prev and fw-ranges.
(sys:awk-state rec-to-f): New logic to handle
self.fw.
(sys:awk-let): New local fw symacro.
* txr.1: Documented fw.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
| |
* share/txr/stdlib/tagbody.tl (tagbody): When calling
sys:expand, env was left out due to wrong parenthesis
placement.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-mac-let): Local macro
sys:rng generalized to support code generation for ranges that
exclude either endpoint. Local rng macro adjusted to target
this new form. Local macros rng-, -rng, and -rng- added.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (tagbody_set_entries): Add prog and prog* to
autoload list.
* share/txr/stdlib/tagbody.tl (prog, prog*): New macros.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-let): Renamed to
sys:awk-mac-let. Macrolet prn removed from here.
(sys:awk-fun-let): New macro, provides awk functions.
The prn function removed from sys:awk-mac-let is generated
here.
(sys:awk-fun-shadowing-env): New function.
(awk): Follow rename of sys:awk-let. When expanding p-action
forms, use only sys:awk-mac-let; do not include the awk
functions, which do not "vaporize" unlike local macros. To
compensate for not including the functions, extend the macro
environment with one that shadows the functions, so that
during this expansion, any global macros of the same name as
awk local functions are properlly hidden. In the final
expansion, include the awk functions.
* txr.1: Updated documentation to consistently call
prn an awk function everywhere.
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (awk): We must generate the
code to bind the awk-fun under the same conditions that
control whether the loop call is generated to which it
is an argument. Otherwise we end up with an unbound var
reference: the loop isn't elided because begin/end
actions are present, but the call refers to a nonexistent
variable.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This problem happens when awk is issued from the command line
followed by one or more arguments as exemplified by the usage
txr -e '(awk ...) arg ... . In this case, after awk processes
the args as input sources and completes, TXR resumes
processing the command line arguments and wants to open arg
as a script file! To address this problem, when awk defaults
on using *args* as input sources, it consumes *args* by
clearing the variable to nil. TXR's command line processing
already reacts to changes in *args* by evaluated forms.
Code that wants *args* to be left alone by awk can explicitly
pass them in using (awk (:inputs *args*) ...).
* share/txr/stdlib/awk.tl (sys:awk-state): Move
default initialization of inputs into :postinit.
If there are no inputs by :postinit time, then
take *args* or *stdin*. If *args* is used in this
default manner, then consume *args*.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (awk): The macro must not
elide the processing loop if there are :begin-file,
:end-file or :end actions. All these actions must
be missing, not only the, cond-actions for that elision
to be valid.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Contrary to the documentation, handle doesn't in fact have the
same syntax as catch. It passes the exception symbol to
clauses as the leftmost argument, followed by the exception
arguments, whereas catch passes only the exception arguments.
* share/txr/stdlib/except.tl (handle): Do not pass the
exception sybmol as the leftmost argument, unless operating
in TXR 161 or earlier compatibility.
* tests/012/except.tl: drop exception symbol argument from
handle clause.
* txr.1: Compatibility note added.
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (sys:rslotset): Return the new
value that comes out of slotset, rather than the value of the
method call. Also, we don't need macro-time wrapping.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rather than fix this in the awk macro, let's
just have sys:expand block warnings.
* eval.c (warning_continue, no_warn_expand): New static
function.
(eval_init): Change registration of sys:expand to point
to no_warn_expand.
* share/txr/stdlib/place.tl (call-update-expander,
call-clobber-expander, call-delete-expander, sys:placelet-1):
Remove ignwarn wrapping from sys:expand calls.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (do_expand): If a compound form doesn't expand into
anything, then let us check whether it calls an unbound
function, and issue a warning.
* share/txr/stdlib/place.tl (sys:pl-expand): Move function
definition ahead of first use to suppress unbound function
warning. Eventually we will have a relaxed model of deferred
warning about this.
(sys:placelet-1): Suppress warnings around call to sys:expand
because we are expanding a body into which we inserted
function calls without inserting their definitions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_exception): New static function.
(eval_error): Reduced to wrapper around eval_exception.
(eval_warn): New function.
(me_op): Bind the rest symbol in a shadowing env to suppress
watnings about unbound rest.
(do_expand): Throw a warning when a bindable symbol is
traversed that has no binding.
(expand): Don't install atoms as last_form_expanded.
* lib.c (warning_s, restart_s, continue_s): New symbol
variables.
(obj_init): Initialize new symbol variables.
* lib.h (warning_s, restart_s, continue_s): Declared.
* lisplib.c (except_set_entries): New entries for
ignwarn and macro-time-ignwarn.
* parser.c (repl_warning): New static function.
(repl): Use repl_warning function as a handler for
warning exceptions: to print their message and then
continue by throwing a continue exception.
* parser.y (warning_continue): New static function.
(parse_once): Use warning_continue to ignore warnings.
In other words, we suppress warnings from Lisp that is
mixed into TXR pattern language code, because this
produces too many false positives.
* share/txr/stdlib/except.tl (ignwarn, macro-time-ignwarn):
New macros.
* share/txr/stdlib/place.tl (call-update-expander,
call-clobber-expander, call-delete-expander): Ignore warnings
around calls to sys:expand, because of some gensym-related
false positives (we expand code into which we inserted some
gensyms, without having inserted the constructs which
bind them.
* tests/011/macros-2.txr: Suppress unbound variable
warnings from a test case.
* tests/012/ifa.tl: Bind unbound x y variables in one
test case.
* tests/012/struct.tl: Suppress unbound variable
warnings in some test cases.
* uwind.c (uw_throw): If a warning is unhandled, then
print its message with a "warning" prefix and then
throw a continue exception.
(uw_register_subtype): Eliminate the check for sub
already being a subtype of sup. This allows us to
officially register new types against t.
(uw_late_init): Register continue exception type as a
subtype of the restart type.
Formally register warning type.
* txr.1: Documented ignwarn.
|
|
|
|
|
|
| |
* share/txr/stdlib/socket.tl (sys:str-inaddr-net-impl):
Use let* so that calculation of we can see dependent w
variable.
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (test-inc): Expander
refers to unbound variable.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/trace.tl (sys:trace): If symbol-function
returns nil, throw exception.
* txr.1: Document the behavior, along with return values
of trace and untrace, and the tolerance of untrace to
bad arguments.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In this patch we allow (symbol-function '(macro sym)),
(defun (macro sym) (form env) ...), and
(trace (macro sym)).
* eval.c (macro_s): New symbol variable.
(lookup_fun, func_get_name, op_defun): Support (macro sym)
syntax.
(builtin_reject_test): Pass through (macro sym) syntax.
(eval_init); Initialize macro_s.
* share/txr/stdlib/place.tl (sys:get-fun-getter-setter):
Support macro place.
* txr.1: Documented verything.
|
|
|
|
|
| |
* share/txr/stdlib/trace.tl (sys:*trace-hash*): Hash must be
equal-based to correctly support compound places.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a "disciplined goto" feature of Common Lisp.
This uses a new sys:switch operator, which could
also be used for optimizing case and cond forms.
* eval.c (switch_s): New symbol variable.
(op_switch, expand_list_of_form_lists, expand_switch):
New static functions.
(do_expand): Hook in the expansion of the sys:switch
operator.
(eval_init): Initialize switch_s special variable to
sys:switch symbol. Register sys:switch special op.
* lisplib.c (tagbody_set_entries, tagbody_instantiate): New
static functions.
(lisplib_init): Register autoloading of tagbody module
via new functions.
* share/txr/stdlib/tagbody.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (find_symbol): New function.
(symbol_present): Search the fallback list also to
determine whether the symbol is visible.
* lib.h (find_symbol): Declared.
* parser.y (sym_helper): Implement a new behavior for
qualified symbols. Interning new symbols is only allowed
for packages that have an empty fallback list.
* parser.c (get_visible_syms): New static function.
(find_matching_syms): Use get_visible_syms to get
the list of eligible symbols. This way the fallback list
of the package is included if it is the current package.
* share/txr/stdlib/package.tl (defpackage): Do not insert
a default (:use usr) if there is no :usr clause. Since
defpackage is very new, no need for backward compatibility;
the amount of code depending on this is likely zero.
* txr.1: Documented fallback list feature.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register package-fallback-list and
set-package-fallback-list intrinsics.
* lib.c (package_fallback_list, set_package_fallback_list,
intern_fallback): New functions
* lib.h (package_fallback_list, set_package_fallback_list,
intern_fallback): Declared.
* parser.y (sym_helper): Slightly restructure function
so that the symbol interning is done separately in
the various cases. In the unqualified symbol case,
use intern_fallback to search the fallback list
of the current package.
* share/txr/stdlib/package.tl (defpackage): Implement
:fallback clause.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (package_set_entries): Add in-package
symbol name to autload list.
* share/txr/stdlib/package.tl (in-package): New macro.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Test case: (symacrolet ((f g)) (set [f x] y)) fails to expand.
The root cause is that f is not expanded, because a nil
environment is passed down to with-update-expander macro.
This problem affects not only the dwim place, but nthcdr,
sub and others.
This bug was surprising at first because the Awk macro
establishes the field array f via symbol macro. But
assignments like (set [f 0] ...) worked!
The thing is, they only worked by fluke due to the
way expansions are handled in the Awk macro. That fluke
came to an end in the November 4 commit
157fd76ee20125f409929b95b768b931268b43cf, just before 156
was released. The changes there don't cause this problem,
but they remove the circumstances which protect the awk
macro from the problem. So yes, that commit effectively
caused another regression in 156: assignment to awk fields
not working.
* share/txr/stdlib/place.tl (nthcdr, nthlast, ref, sub,
dwim): Do not pass an environment value of nil to
with-update-expander! Pass the value of the special variable
sys:*pl-env* which is there exactly for this purpose:
to give to place expanders like these the original macro
environment where the form occurs, so they can expand
embedded places.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (getput_set_entries, getput_instantiate):
New static functions.
(dlt_register): Register auto-loading for getput module
via new functions.
* share/txr/stdlib/getput.tl: New file.
* txr.1: Documented new functions file-get, file-put,
file-append, file-get-string, file-put-string,
file-append-string, file-get-lines, file-put-lines,
file-append-lines, command-get, command-put,
command-get-string, command-put-string, command-get-lines,
and command-put-lines.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/package.tl (defpackage): Implemented
new :use-from clause.
* txr.1: Documented :use-from and made some improvements
to the defpackage documentation.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (package_set_entries, package_instantiate): New
static functions.
(lisplib_init): Register auto-loading for new package.tl
file using new functions.
* share/txr/stdlib/package.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This shows up when the anaphoric ifa is used.
Test case:
| (ifa (f a)
| (set it (g it)))
* share/txr/stdlib/place.tl (sys:pl-expand): In the
origin chasing loop, use a stack to more thoroughly
detect a cycle.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This change actually achieves the original intent
that forms generated by place expansion register
the place as their macro-expansion origin, enabling
clearer diagnostics when things go wrong in that
generated code.
* share/txr/stdlib/place.tl (sys:cp-origin): Drop
the syms argument; it's useless because we want to
walk over the fully expanded to-tree in which
those syms (denoting the names of local macros)
will no longer appear. Now instead we find any
conses in to-tree which already have macro
ancestors. We trace the ancestor chain to the end
and install the place form as the grand-ancestor,
to express that all the expansion ultimately is
derived from the place that is being manipulated.
(call-update-expander, call-clobber-expander,
call-delete-expander): After calling the expander,
fully expand whatever it returns in the given
environment. Then, propagate place as the macro
origin throughout the forms contained in the expansion
before returning it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/getopts.tl (defstruct sys:opt-parsed): New
slot eff-type, appearing as an optional parameter in the boa
constructor parameter list.
(opt-desc check): Allow a type to be a cons with list
in the car position.
(sys:opt-parsed convert-type): Use the eff-type slot
if it is set instead of the type from the descriptor.
This lets us override the type for a slot, which is
key to the recursive approach to how lists are handled
in this same function.
(opthelp): Show list type options in a visual way
which suggests the use. No details are given.
* txr.1: Documented list option type.
|
|
|
|
|
|
|
|
|
|
|
| |
* lisplib.c (getopts_set_entries, getopts_instantiate): New
functions.
(lisplib_init): Register auto-loading for getopt.tl
via new functions.
* share/txr/stdlib/getopts.tl: New file.
* txr.1: Documented new library area.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
No longer require the leftmost expression in a dwim place to
itself be a place, except when the expression evaluates to
a list, and the list is subject to an element deletion or
a range operation.
* eval.c (eval_init): Register dwim-set and dwim-del with
one additional argument that the C functions now take.
* lib.c (dwim_set, dwim_del): Take a new place_p argument
which informs these functions whether the object they
are operating on came from a syntactic place. The forbidden
situations are diagnosed based on this flag: modification
of the subrange of a list, or deletion of a list ref.
Some error messages reworded.
* lib.h (dwim_set, dwim_del): Declarations updated.
* share/txr/stdlib/place.tl (defplace dwim): Produce a
different update, clobber and delete expansion when
the obj-place form isn't a place. In the non-place case,
do not assign the result of the sys:dwim-set or
sys:dwim-del operation back obj-place. Furthermore,
pass a Boolean flag to sys:dwim-set and sys:dwim-del
indicating which situation is the case: did the object
argument come from a place or non-place.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Change registration of dwim-set to only
one required argument, with the rest variadic.
* lib.c (lambda_set_s): New symbol variable.
(dwim_set): Change to variadic function that takes all
arguments other than the object/sequence being operated on as
struct args *. Rewrite to do a test on the object type first,
handling hashes and structs specially.
(obj_init): Initialize lambda_set_s.
* share/txr/stdlib/place.tl (defplace dwim): Rewritten for
more generic syntax. The only argument required is obj-place;
the other arguments are treated as a variable argument list,
all treated uniformly. This eliminates the special handling
of the default value for hash lookups.
* args.h (args_count): New inline function.
* txr.1: Updated documentation for dwim operator, which neglects
to mention use over objects thanks to the lambda function.
Documented lambda-set.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (looup_fun): Handle (meth ...) syntax.
* share/txr/stdlib/place.tl (sys:get-fb): Function
removed.
(sys:get-fun-getter-setter): New function.
(defplace symbol-function): Rework getter and
setter using new function which works for method
as well as regular function bindings.
* txr.1: Documentation updated in several places.
The mention of symbol-function in the list of place
forms altered so it doesn't insinuate that the argument
must be a symbol. Description of symbol-function
updated. Also under the trace and untrace macros,
a note added that tracing methods is possible.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New variable *trace-output*, and macros trace and untrace.
* lisplib.c (trace_set_entries, trace_instantiate): new static
functions.
(dlt_register): Register new functions to auto-load trace
module.
* share/txr/stdlib/trace.tl: New file.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-state): New slot, streams.
Holds hash table of open streams. New :fini finalizer
which closes all streams.
(sys:awk-state ensure-stream, sys:awk-state close-or-flush):
New methods.
(sys:awk-redir): New macro.
(sys:awk-let): Bind new local macros ->, ->>, <-, !> and !<.
(awk): Call finalizers on awk state to get all streams
to close.
* txr.1: Document new awk macros.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (defplace dwim): In updater,
removing unused and redundant gensyms. Engaging unused
oldval-sym as a temporary to hold the result of invoking
(,ogetter-sym), the "getter" for the sequence object place we
are operating on. Both references then refer to this resut
instead of expanding the getter twice. Though getters should
not have side effects, they could be expensive. In simple
setter and deleter, setting up obj-sym similarly. We don't
make multiple accesses to the sequence, but we were evaluating
it in the wrong order w.r.t the index and new-val.
|
|
|
|
|
|
| |
* share/txr/stdlib/place.tl (defplace sub): Fix unbound
variable seq-setter in update expander. Wrong unquoting
level.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The alet macro should always convert bindings to constants
into symbol macros; the all-or-nothing logic should be applied
to any remaining bindings.
* share/txr/stdlib/place.tl (sys:r-s-let-expander): Generalize
this function somewhat more by passing in the fallback binding
symbol to use for bindings that can't be turned into symbol
macros, instead of hard-coding them to let.
(rlset, slet): Specify 'let when calling sys:r-s-let-expander.
(alet): If there are any bindings with constantp init
expressions, then recurse: produce an expansion which
separates constantp from non-constantp using
sys:r-s-let-expander. Pass 'alet as fallback binding symbol;
thus the expansion will recurse back to alet, but without
all the constantp bindings, if there are any.
We then deal with those using the existing all-or-nothing
logic (which simplifies slightly since it doesn't have
to check for constantp any more).
* txr.1: Revised description of alet.
|