| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Tree-walking code in the place expander runs into
trouble if the expression contains cycles.
Test case: (defparm a '(#1=(a . #1#))).
* share/txr/stdlib/place.tl (sys:cp-origin): Take list
of symbols as a single argument instead of trailing
arguments. Support an optional argument that gives
serves as a cycle-detecting stack. Bail if a cycle
is detected.
(call-udpate-expander, call-clobber-expander,
call-delete-expander): Update sys:cp-origin
calls to follow interface change.
|
|
|
|
|
| |
* lib.c (reduce_left): init value pulled from
list itself must be passed through the key function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit implements the parse-side support
for handling a notation that exists in ANSI
Common Lisp for specifying objects with cycles
and shared substructure.
* parser.h (struct parser): New members, circ_ref_hash
and circ_count.
(circref_s, parser_resolve_circ, parser_circ_def,
parser_circ_ref): Declared.
* parser.c (circref_s): New symbol variable.
(parser_mark): Visit the new circ_ref_hash member of the
parser structure.
(parser_common_init): Initialize new members
circ_ref_hash and circ_count of parser structure.
(patch_ref, circ_backpatch): New static functions.
(parser_resolve_circ, parser_circ_def, parser_circ_ref): New
functions.
(circref): New static function.
(parse_init): Initialize circref_s as sys:circref symbol.
Register sys:circref function.
* parser.l (grammar): Scan #<num>= and #<num># notation as
tokens, extracting their numeric value.
* parser.y (HASH_N_EQUALS, HASH_N_HASH): New token types.
(i_expr, n_expr): Adding phrases for hash-equalsign and
hash-hash syntax.
(yybadtoken): Handle new token types in switch.
(parse_once): Call parser_resolve_circ after parsing
to rewrite any remaining #<num># references in the
structure to the objects they denote.
(parse): Reset new struct parse members to initial
state. Call parser_resolve_circ after parsing
to rewrite any remaining #<num># references.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This will be required when the parser becomes
capable of creating object graphs with cycles.
* parser.c (parser_callgraph_circ_check): New function.
* parser.h (struct circ_stack): New struct.
(parser_callgraph_circ_check): Declared.
* parser.y (rlcp_tree_rec): New static function.
(rlcp_tree): Reduced to wrapper for rlcp_tree_rec.
|
|
|
|
|
|
| |
* struct.c (slots): New function.
* struct.h (slots): Declared.
|
|
|
|
|
|
|
|
|
|
| |
Ranges continue to be immutable; but a
backdoor is needed for upcoming support for
circular notation.
* lib.c (set_from, set_to): New functions.
* lib.h (set_from, set_to): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This regression was caused by commit
957f80f "Bugfix: issue with expansion of place macros"
on Sep 7, 2016. The commit itself is sound, but exposes a
hidden problem in nearby code.
* share/txr/stdlib/place.tl (sys:pl-expand): The conditions
for terminating the loop and returning the expansion are too
weak, due to the inclusion of an incorrect test. We must not
bail when the expansion of a compound form is a compound form
with the same symbol. This is because some macros behave that
way, such as, oh: qref! The expansion of (qref a b c) is
(qref (slot a 'b) 'c): another qref form. To fully expand, we
must keep iterating until the returned form is eq to the input
form. The original macroexpand (which was replaced by
macroexpand-1 in 957f80f) hid this problem because macroexpand
doesn't use this broken termination test.
|
|
|
|
|
|
|
|
| |
* eval.c (env_fbind, env_vbind): Allow env to be
nil, indicating that the binding is to take
place in the global environment.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
|
|
| |
* args.c (args_cat_zap_from): Clear the area that was
copied, starting at the index offset, rather than
from argument zero. This bug could result in spurious
retention due to failing to zap some arguments.
|
|
|
|
|
| |
* txr.1: If a symbol macro expands to itself indirectly, the
result isn't a loop but runaway recursion.
|
|
|
|
|
| |
* txr.1: Updating awkward wording, beginning with clumsy
two-clause sentence joined by a colon.
|
|
|
|
|
| |
* txr.1: typeset print function name with .code so
it turns to typewriter font and hyperlink.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A static slot indicating the address family simplifies
code which wants to map a socket address to its
family.
* lisplib.c (sock_instantiate): Call sock_load_init
before loading socket.tl rather than after, because socket.tl
now references variables defined inside sock_load_init.
* share/txr/stdlib/socket.tl (sockaddr, sockaddr-in,
sockaddr-in6, sockaddr-un): New static slot, family.
* txr.1: Documented family slots.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (length_proper_list): New static function.
(length): Use length_proper_list for objects.
(sub): Call nullify on COBJ object before passing
to sub_list.
* tests/012/aseq.tl, tests/012/aseq.expected:
New files.
|
|
|
|
|
| |
* lib.c (where): Implement faster ref-based access for vectors
and strings. Support abstract sequence structs.
|
|
|
|
|
|
| |
* txr.1: the nullify method need not return the object
itself in the non-empty case; it may also return
a sequence.
|
|
|
|
|
|
| |
* lib.c (in, sub, ref, search, rsearch, sel): These
functions now accept struct objects that have the
nullify, car and cdr methods.
|
|
|
|
|
|
|
| |
* lib.c (find_max): Restructured to implement separately
for vectors and lists. Support hash tables.
* txr.1: Document find-min and find-max for hashes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The get-hash-userdata function is now deprecated in favor of
hash-userdata, which is an accessor.
* hash.c (hash_init): Register hash-userdata as a synonym
for the same function as get-hash-userdata.
* share/txr/stdlib/place.tl (hash-userdata): New defplace.
* txr.1: Document new accessor, marking get-hash-userdata as a
deprecated synonym. Replace references to get-hash-userdata
with references to hash-userdata.
|
|
|
|
|
|
|
|
| |
* parser.c (repl): After each successful command that
produces a value, not only print the value but also
call lino_set_result to install its string representation
into the linenoise object, so it is available for insertion
via Ctrl-X Ctrl-P.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* linenoise/linenoise.c (struct lino_state): New member,
result.
(edit): Ctrl-P or p in extended mode cause result string
to be inserted into the buffer.
(lino_copy): Ensure result string in copy is null.
(lino_cleanup): Free result string and set to null.
(lino_set_result): New function.
* linenoise/linenoise.h (lino_set_result): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (userdata_k): New keyword symbol variable.
(hash_print_op): Print the userdata together with
the hash flags as :userdata obj.
(hashv): Parse out :userdata obj syntax from
the argument list. This takes care of supporting
it in the read notation and in the hash function.
(hash_init): Initialize userdata_k.
* txr.1: Documenting :userdata in hash
read notation and hash function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (gmtoff_s, zone_s): New symbol variables.
(tm_to_time_struct): Copy tm_gmtoff and tm_zone into
Lisp struct from struct tm, if the platform has these.
(time_fields_to_tm): Zero/null-out the tm_gmtoff
and tm_zone fields of the target structure, if the
platform has them.
(time_init): Intern the gmtoff and zone symbols,
initializing the gmtoff_s and zone_s variables.
Add the gmtoff and zone slots to the time struct.
* txr.1: Documented new slots.
|
|
|
|
| |
* txr.1: necessary -> necessarily
|
|
|
|
|
|
|
|
|
|
|
| |
When Ctrl-X Enter is used to resubmit a line from
the history, and it is a duplicate, it is not entered
into the history. The position then doesn't advance
to the next historic line.
* linenoise/linenoise.c (lino_hist_add): Do add
the line even if it is duplicate if the last submitted
line was from the middle of the history.
|
|
|
|
|
|
|
| |
* filter.c (regex_from_trie): New static function.
(filter_init): Register regex-from-trie intrinsic.
* txr.1: Documented regex-from-trie.
|
|
|
|
|
|
|
|
|
|
|
| |
Since much regex code assumes these are binary, the easiest
and briefest approach is to implement a code transformation
pass which rewrites n-ary forms into binary.
* regex.c (reg_nary_unfold, reg_nary_to_bin): New
functions.
(regex_compile): Put raw sexp through reg_nary_to_bin
to expand the nary syntax.
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (reg_expand_nongreedy, reg_compile_csets):
Generalize the compound_s case slightly by referring
to sym rather than hard-coded compound_s. Then handle
most of the regex operators under this same case.
Their semantics are not relevant to the expansions
being performed in these functions: all their arguments
are regexes to be recursed over.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (meth): Take trailing arguments
and pass them down to method, which now accepts them.
* struct.c (struct_init): Register method intrinsic to the
function method_args instead of the method function.
(method_args_fun): New static function.
(method_args): New function. Behaves like method
function if args is empty, otherwise creates a function
by means of method_args_fun.
* struct.h (method_args_fun): Declared.
* tests/012/oop.tl: New test case.
* tests/012/oop.expected: Updated.
* txr.1: Documented new features in method and
meth, revising the documentation in the process.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/struct.tl (umeth): accept variadic
arguments. Evaluate them using the dwim brackets
and pass to umethod. The (fun umethod) trick is
used to refer to the umethod in the function namespace
even if it is shadowed by a variable.
* struct.c (struct_init): Update registration of umethod to
reflect its new variadic argument signature.
(umethod_args_fun): New static function.
(umethod): Return a function based on umethod_fun,
as before, if there are no variadic args. Otherwise,
use umethod_args_fun which deals with them.
* struct.h (umethod): Declaration updated.
* tests/012/oop.tl: Modest testcase for umeth
with curried argument.
* tests/012/oop.expected: Updated.
* txr.1: Updated documentation of umeth and umethod.
|
|
|
|
|
|
| |
* args.c (args_cat_zap): New function.
* args.c (args_cat_zap): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* args.c (args_copy): Use from->arg and from->fill
in calculating the memcpy size. It doesn't matter
in this function because the to and from are the same;
however, this may be the origin of the copy and paste
error that led to args_cat_zap problem.
(args_copy_zap): Similar change to args_copy: be
consistent in using the from side expressions.
(args_cat_zap): Bugfix: the total size of the
to arguments was used to zap the from side.
This writes zeros past the end of the from
arguments. Fixing by calculating the size in one
place and using the calculated size.
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
|
|
|
|
|
|
|
| |
* struct.c (clear_struct, reset_struct): Inform the garbage
collector that the structure has been mutate, using the mut
macro. This is required for correctness because the structure
may be a mature object receiving young generation values.
|
|
|
|
|
|
|
|
|
| |
* struct.c (replace_struct): If target and source
are the same object, just do nothing and return
target.
* txr.1: Document self-assignment and return
value of replace-struct.
|
|
|
|
|
|
| |
* txr.1: Where do is being introduced, fix a statement
that about op, which should be about do. Plus fix
verb agreement.
|
|
|
|
|
|
|
|
|
| |
* signal.c (set_signal_handler, get_sign_handler): Eliminate
newline in exception messages.
* stream.c (unimpl, formatv): Likewise.
* unwind.c (uw_block_abscond): Likewise.
|
|
|
|
|
|
|
|
| |
* stream.c (formatv): When the format string ends
at the point where the format character is expected
to occur, do not emit an error about #\nul being
an unknown format directive character; emit
an error that the character is missing.
|
|
|
|
|
|
|
|
| |
* struct.c (static_slot_ens_rec): Neglected use of
set macro to store newval in freshly allocated slot,
which means we corrupt garbage collection if this
causes an old generation objet to point to a new
generation object.
|
|
|
|
|
|
| |
* struct.c (struct_type_mark): We must assert that
sl->store is nil if we are not marking it,
not that it is non-nil.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim: Regenerated.
|
|
|
|
|
| |
* txr.1: document that ranges are immutable
and expand the surrounding wording a bit.
|
|
|
|
|
| |
* txr.1: describe slot specifier as (name init-form)
rather than (symbol init-form).
|
|
|
|
|
|
| |
* lib.c (length, empty): Handle RNG in switch.
* txr.1: Documented.
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-expander): Recognize :set
and :set-file cases.
* txr.1: Documented :set and :set-file, replacing some :begin
uses with :set in the examples.
|
|
|
|
|
|
|
|
|
| |
* regex.c (range_regex_all, regex_range_all): New functions.
(regex_init): Register rra intrinsic function.
* regex.c (range_regex_all, regex_range_all): Declared.
* txr.1: Documented rra.
|
|
|
|
|
| |
* arith.c (plus): Eliminate compound statement braces
around case that consists of one return statement.
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (regex_range_search): New function.
(regex_init): Register regex_range_search as rr intrinsic.
* regex.h (regex_range_search): Declared.
* txr.1: Documented rr, and added reference to it
in description of regex-range.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* regex.c (search_regex): Handle negative starting positions
according to the convention elsewhere and fail excessively
negative ones. Consistently fail on starting positions
exceeding the length of the string. Handle zero length
matches by reporting them against the start position
or position one past the last character, based on the
value of from-end.
* txr.1: search-regex documentation updated.
|