| Commit message (Collapse) | Author | Age | Files | 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.
|
|
|
|
|
|
|
|
| |
* eval.c (me_case): If forms is nil, substitute
the object (nil) for forms, to ensure a nil result
through the expansion to a cond.
* txr.1: Documented and added compat notes.
|
|
|
|
|
|
|
|
|
| |
* eval.c (me_case): The key must be quoted unconditionally
whether it's an atom or list. Let's make this subject
to the compatibility flag in case someone's code depends
on it.
* txr.1: Compat notes added.
|
|
|
|
|
|
|
|
|
| |
* genvim.txr (txr_circ): New match. Link to
Special highlight group.
(txr_bracevar, txr_directive, txr_list, txr_mlist,
txr_mbracket): Introduce txr_circ into these regions.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
* eval.c (op_setq, op_lisp1_setq): Take the bindable(var) test
out of the frequently executed path. We can safely do the variable
lookup with any object. If the lookup fails, then we can
complain that the object isn't a bindable symbol, if that is
the case.
|
|
|
|
|
|
| |
* lib.c (obj_print_impl): Print package name using ~a
rather than ~s. Otherwise if the string object occurs
elsewhere in the structure being printed, we have a problem.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Interpreted functions print as #<interpreted fun: name args>,
thus repeating some list structure in their notation.
This means we must traverse them when populating the
object hash during printing, and also when backpatching
after parsing.
Test case: evaluate and print
(let ((s '(lambda (a b c) d))) (list s (eval s)))
with *print-circle* enabled.
* lib.c (populate_obj_hash): Handle FUN objects of
functype FINTERP.
* parser.c (circ_backpatch): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (force): When replacing the promise by a
forced value, we must use the set macro. Only the deref
assignments which store symbols are safe, not the one storing
ret.
* lib.c (alist_nremove, alist_nremove1): We must
use the set macro here instead of assigning through deref.
Even though these assignments preserve the direction of the
list (they just splice out nodes), it's possible that the list
already contains a "wrong-way" reference (old generation to
new) and that the node making this reference is appropriately
marked to be processed properly in the next GC cycle. If we
remove *that* node, we then cause its predecessor to point to
the new generation node and that predecessor could be old
generation.
|
|
|
|
|
|
| |
* lib.c (get_current_package): If *package* contains
nonsense, then reset it to a sane value and throw
an exception.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register new intrinsics:
package-local-symbols, package-foreign-symbols, use-sym,
unuse-sym, use-package, unuse-package, unintern.
* gc.c (mark_obj): Mark new hidhash member of
struct package.
* lib.c (make_package): Initialize new hidhash
member of struct package.
(lookup_package): New static function.
(find_package): Allow string or symbol argument.
(get_package): New static function.
(delete_package, package_symbols): Use get_package for
flexible package argument; delete_package removes
symbols from other packages via unuse_package.
(package_local_symbols, package_foreign_symbols): New
functions.
(use_sym, unuse_sym): New functions.
(resolve_package_designators): New static function.
(use_package, unuse_package): New functions.
(symbol_present): New static function.
(intern): Revised with get_package for flexible
package argument.
(unintern): New function.
(rehome_sym): Use get_package. Semantics revised.
(obj_print_impl): Use symbol_present function to
determine whether object is visible in *package* and
can be printed without a prefix, rather than naive
home package test.
* lib.h (struct package): New member, hidhash.
(package_local_symbols, package_foreign_symbols, use_sym,
unuse_sym, use_package, unuse_package, unintern): Declared.
* txr.1: Documentation updated. Extended section introducing
the design of packages, and argument conventions. New
functions described. Existing function descriptions revised,
particularly rehome-sym. Missing description of
delete-package added.
|
|
|
|
|
| |
* lib.c (make_sym, make_package, intern): Check
that the name argument is a string.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (load): Rebind *package* in the local dynamic
environment already established for the sake of *load-path*.
By doing this we cause *package* to be restored to its
prior value, which allows the loaded file to alter it.
Common Lisp works this way.
(eval_init): Register *package* variable, with the
user package as its default value.
* lib.c (package_s): New symbol variable.
(intern, rehome_sym): Default the package argument to the
current package, not to user_package.
(get_user_package, get_system_package, get_keyword_package):
Functions removed.
(get_current_package): New function.
(obj_print_impl): Revise symbol printing. Keyword and
uninterned symbols are printed with : and #: prefixes.
The remainder are printed with a package prefix if their
home package isn't the current package.
* lib.h (keyword_package, user_package, system_package): These
macros are just straight aliases for the global
variables, not going through the lookup mechanism,
which was pointless.
(cur_package): New macro.
(package_s): Declared.
(get_current_package): Declared.
* lisplib.c (lisplib_try_load): Establish a local
dynamic environment, and bind the *package* variable
to the user package which the library modules expect.
* parser.c (find_matching_syms, provide_completions):
Treat unqualified symbols in the current package
rather than user package.
* parser.y (sym_helper): Intern unqualified symbols
in the current package, not user package.
* txr.1: Document that the variables user-package,
system-package and keyword-package should not be modified.
Document the *package* special variable, and that intern and
rehome-sym default their package argument to its value. (Here
we get rid of wrong references to the undocumented variable
*user-package*).
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print): Check that print_circle_s has
been interned before trying to look it up as a variable.
Otherwise the auto-load code will be triggered, and try to use
a hash table that doesn't exist yet. This can happen when
this code is called during early initialization.
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Do not register *user-package*,
or *system-package* or *keyword-package* variables
unless in compatibility mode. We don't document this
in the compatibility notes since the variables are not
documented.
* tests/009/json.txr: Change use of *keyword-package*
to keyword-package.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.l (BTKEY, NTKEY): Renamed to BTKWUN and NTKWUN
("keyword and uninterned") respectively. Include an
optional match for the # character.
(BTOK, NTOK): Refer to BTKEY and NTKEY respectively
* parser.y (sym_helper): Implement uninterned symbols
by detecting when the package name string is "#"
and handling specially.
* txr.1: Documented package prefixes and uninterned
symbols.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (parser_circ_ref): Don't generate the
circular reference if circular suppression is in
effect.
* parser.h (struct parser): New member, circ_suppress.
We use this for suppressing the generation of
circular #n# references in erased objects.
* parser.l (grammar): Scan #; producing HASH_SEMI token.
* parser.y (HASH_SEMI): New token.
(hash_semis_n_expr, hash_semis_i_expr, ignored_i_exprs,
ignored_n_exprs): New nonterminals, needed for supporting
the use of #; in front of top-level forms.
(spec): Use hash_semis_n_expr and hash_semis_i_expr
instead of n_expr and i_expr.
(r_expr): Support object erasure within nested syntax.
(yybadtoken): Handle H_SEMI token.
(parse): Initialize new circ_suppress member of parser
struct to zero.
* txr.1: Documented.
* genvim.txr (txr_ign_par, txr_ign_bkt, txr_ign_par_interior,
txr_ign_bkt_interior): New regions for colorizing erased
objects (partial support).
(txr_list, txr_bracket, txr_mlist, txr_mbrackets): Include
erased objects by including regions txr_ign_par and
txr_ign_bkt.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
| |
* genvim.txr (txr_list): Rewrite start delimiter regex.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
| |
* parser.y (yybadtoken): HASH_R token not handled;
must be mapped to "#R" string.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
* struct.c (struct_init): Register slots intrinsic.
(slots): Pass correct name string to stype_handle.
* txr.1: Slots function documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
* eval.c (set_origin): If either form or origin isn't
a heap object, or is an interned symbol, then
don't record the relationship.
|
|
|
|
|
|
|
| |
* cadr.c: Regenerated.
* gencadr.txr (cadr_register): stdlib_path already
has a slash; we don't have to add one.
|
|
|
|
|
|
| |
* eval.c (error_trace): No need to indicate where
an expansion was calculated; it is distracting information
when the exception isn't happening at expansion time.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (expand_macrolet): Do not call set_origin to
establish a macro ancestry link between the output of
the expansion and the original macrolet block. This is
not necessary. What is useful and important that the
individual expansions of the actual macrolets have their
origins tracked to the respective subforms of the original
macrolet form. That's already taken care of by expand_macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Old behavior:
| 1> (sys:expand '(defstruct foo bar))
| ** defstruct: inheritance base bar does
| not name a struct type
| ** during expansion at
| /usr/local/share/txr/stdlib/struct.tl:120
| of form (defstruct foo bar)
New behavior:
| 1> (sys:expand '(defstruct foo bar))
| ** defstruct: inheritance base bar does
| not name a struct type
| ** during expansion at expr-1:1 of form (defstruct foo
| bar)
| ** by macro code located at
| /home/kaz/txr/share/txr/stdlib/struct.tl:120
* eval.c (error_trace): Show location of the form being
expanded in the "during expansion" message, rather than,
confusingly, the locaton of the code of its macro. Then, if
the location of the macro is available, show that in a
separate message whose wording makes it clear that the location
of the expanding macro is being given.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register neq, neql and nequal
intrinsics.
* lib.h (neq, neql, nequal): New inline functions.
* txr.1: Documented neq, neql and nequal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Two issues addressed here, both occurring when *print-circle*
is enabled and an object has struct components which have a
custom print method that re-enters the object printer.
One issue is that the children of these components which occur
just once print with spurious labels: like #3=, when no
matching #3# occurs. The other bug is a wrong "unexpected
duplicate object" exception caused by mismanagement of the
child object's label hash table and its merging with the parent.
* stream.h (struct stream_ctx): New member, obj_hash_prev.
Makes the parent hash table known to populate_obj_hash,
if there is a table, otherwise nil.
* lib.c (populate_obj_hash): If there is a parent table, check
each object in it. If it occurs, then bail. I.e. don't add
objects to the child table which occur in the parent. This
fixes both issues. Also, we do the unexpected duplicate object
check right here now: if we traverse an object that already
printed without a label (because it is not known to be
duplicate), that means that a custom print method is
inappropriately introducing new references to existing
objects, contrary to the rules. (obj_hash_merge): The logic
here is now simplified. All entries in the child table are
simply moved to the parent. If anything already exists, that
is an unexpected stuation indicating an internal problem,
turned into a variant of the unexpected duplicate object
message.
* tests/012/circ.tl: New file, giving tests for the bugs.
* tests/012/circ.expected: New file.
|
|
|
|
|
|
|
|
| |
* unwind.c (uw_unwind_to_exit_point): Prior to printing
diagnostics related to an unhandled exception to std_error,
flush std_output. This clarifies the output in situations when
both std_error and std_output go to the same destination, and
the exception occurred while producing output on std_output.
|
|
|
|
|
|
|
|
|
| |
* lib.c (circle_print_eligible): New inline function.
(obj_print_impl): Do not bother with hash lookup for
interned objects that don't participate in circle
notation.
(populate_obj_hash): Replace open-coded test with
call to circle_print_eligible.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (print_key_val): Static function removed.
(hash_print_op): Don't use maphash over print_key_val
to print hash tables. Use open-coded iteration and
printing with calls to obj_print_impl. This was
occassioned by a bug in circle printing. The use of
obj_print by hash_print_op resembles the actions of
a custom print method on a structure. A bug showed
up which is masked by refactoring to more direct
recursion via obj_print_impl. (The bug still has to be
fixed, though).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
* txr.1: Fix description under fun operator which
says that a macro expander is available via
symbol-function. This is outdated; the symbol-macro
function accesses macro bindings.
|
|
|
|
| |
* txr.1: Only first word of heading is capitalized.
|
|
|
|
| |
* txr.1: Under pprof, *std-output* corrected to *stdout*.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
* txr.1: Listing last, butlast, nthlast, butlastn, ref, sub,
hash-userdata, slot, qref, slot access dot notation,
and sock peer. Redundant listing of rest removed.
|
|
|
|
| |
* txr.1: Around half a dozen toplevel -> top-level edits.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
| |
lib.c (tok_where) Implement new loop which suppresses
empty tokens immediately matching after non-empty
tokens. Old loop available under compatibility.
No documentation update needed since tok-where
is already documented as working like tok-str.
|
|
|
|
| |
* lib.c (tok_where): Just compare match_end == match_start.
|