| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
| |
* lib.c (car, cdr): Don't fail if the struct object has no car
or cdr method. Use it if it is available, otherwise try to
fall back on the lambda method if that is available.
|
|
|
|
|
|
|
|
| |
* lib.c (ltail): Function removed. This was introduced at the
same time as lazy_appendv and used only by it. That function
was rewritten a few months ago and doesn't use lail.
* lib.h (ltail): Declaration removed.
|
|
|
|
|
|
| |
* lib.c (seq_info): The obj_struct_p test must be applied to
obj, not to cls, which is a symbol. Due to this bug, seq_info
would always report struct-based sequences as SEQ_NOTSEQ.
|
|
|
|
|
| |
* lib.c (seq_info): Incorrect indentation of else
statement fixed.
|
|
|
|
|
| |
* lib.c (last): Use seq_info classification
rather than relying on listp.
|
|
|
|
|
|
| |
* lib.c (lastcons): Return value is just the last cons rather
than a loc. The only caller of this function is last.
(last): Adapt to the new lastcons.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reduces the proliferation of car_l and cdr_l.
With this change, nreverse should work on chains of
objects that implement rplacd.
* combi.c (comb_gen_fun_common, rcomb_gen_fun_common): Use
rplaca.
* eval.c (mappendv, mapdov): Likewise
* hash.c (hash_equal_op): Likewise.
* lib.c (nreverse, acons_new, aconsql_new, sort_list): Use
rplaca and rplacd.
* match.c (dest_set, v_gather, v_collect, v_flatten, v_cat,
v_output, v_filter): Likewise
* parser.c (ensure_parser): Use sys_rplacd.
* unwind.c (uw_register_subtype): Use rplacd.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (replace_obj): New static function.
(sub): Handle struct case via lambda method.
(replace): Handle struct case via replace_obj.
* txr.1: Documented.
* tests/012/aseq.tl (add): The lambda method now has to handle
a range argument. One test case uses the last function, which
for non-lists relies on sub, which now calls the lambda method
if the object has one.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (seq_info, car, cdr, make_like, nullify,
generic_funcall, copy, length, empty, ref, refset, dwim_set,
dwim_del, populate_obj_hash): Use new obj_struct_p test when
we know that the object is a COBJ.
* struct.c (struct_inst_ops): Change from static to extern.
* struct.h (ob_struct_p): New inline function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register rplaca and rplacd using new
rplaca_s and rplacd_s symbol variables.
* lib.c (rplaca_s, rplacd_s): New symbol variables.
(rplaca): Handle struct object via rplaca method, if it has
one, otherwise lambda-set, if it has that, or else error
out.
(rplacd): Handle struct object via rplacd method.
* lib.h (rplaca_s, rplacd_s): Declared.
* txr.1: Documented rplaca and rplacd methods.
|
|
|
|
|
|
| |
* lib.c (refset): If structure has no lambda-set method,
diagnose it like that, rather than "not a sequence".
Also, diagnostics should use refset:, not ref:.
|
|
|
|
|
| |
* txr.1: Fix wording under invoke-catch which refers to a
nonexistent function called get-frames.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Recording of source location info incurs a time and space
penalty. We don't want to impose this on programs which are
just reading large amounts of Lisp data that isn't code.
* eval.c (eval_init): Register lisp-parse and read functions
to the newly introduced nread function rather than lisp_parse.
lisp_parse continues to record source location info
unconditionally.
* parser.c (rec_source_loc_s): New symbol variable.
(parser_common_init): Set the new member of the parser
structure, rec_source_loc, according to the current value of
the special var *rec-source-loc*.
(lisp_parse_impl): New second argument, rlcp_p. If true, it
overrides the rec_source_loc member of the parser structure
to true.
(lisp_parse): Pass true argument to rlcp_p parameter of
lisp_parse_impl, so parsing via lisp_parse always records
source loc info.
(nread): New function.
(iread): Pass true argument to rlcp_p parameter of
lisp_parse_impl, so *rec-source-loc* controls whether source
location info is recorded.
(parse_init): Initilize rec_source_loc_s symbol variable,
and register the *rec-source-loc* special var.
* parser.h (struct parser): New member, rec_source_loc.
(rec_source_loc_s, nread): Declared.
* parser.y (rlcp_parser): New static function. Like rlcp but
does nothing if parser->rec_source_loc is false.
(rlc): New macro.
(grammar): Replace rlcp uses with rlc, which expands to a call
to rlcp_parser.
(rlrec): Do nothing if source loc recording is not enabled in
the parser.
(make_expr, uref_helper): Replace rlcp with rlc. This is
possible because these functions have a parser local
variable that the macro expansion can refer to.
(parse_once): Override rec_source_loc in the parser to 1, so
that source loc info is always recorded when parsing is
invoked through this function.
* txr.1: Documented *rec-source-loc* and added text under
read and iread.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
TXR 188 makes a slight mess of the #H notation. An :eql-based
hash table prints as #H(() ...), but when that notation is
read, it produces an :equal-based hash table. No aspect of
this situation was intended; the intent was that the notation
stays the same as before, and just the hash function changes
to make :equal-based the default. Let's just go with this
and have #H(() ...) denote :equal-based tables.
* hash.c (hash_print_op): Print an :eql-based for eql-based
hash tables, and nothing for equal-based ones. In
compatibility mode with 188 and older, reproduce the old
behavior, rendering equal-based tables with :equal-based and
the absence of a symbol for eql-based.
* txr.1: Updated places that touch on :equal-based and
added compatibility notes.
* tests/009/json.expected: updated, since equal-based hash
tables now print without :equal-based keyword.
|
|
|
|
|
| |
* txr.1: There is no :print command in the listener to print
the current prompt; it is actually the :prompt command.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim, tl.vim, protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
| |
These easily express discontinuous ranges.
* eval.c (rlist_fun, rlist_star_fun, rlist, rlist_star): New
static functions.
(eval_init): Register rlist and rlist* intrinsics.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
| |
* eval.c (do_expand): In the function call case, check for the
operator being the rcons function. If it is called with
exactly two arguments and they are constantp in the given
environment, then evaluate them and replace with a range
literal object. Rationale: ranges often appear in constant
form like [array 1..:] and whatnot.
|
|
|
|
|
|
| |
* txr.1: Clarify that Ctrl-D is the only deletion command
which copies into the clipboard, and only in visual selection
mode.
|
|
|
|
|
|
|
|
|
|
|
| |
* txr.1: Fix wrong wording about the by-value nuance of the
in operation. What is specifically doesn't do, in contrast
to the by-pointer nuance, is propagate the foreign
representation back to Lisp. Not Lisp to foreign, which is
opposite to the in operation. Also clarifying some wording
in the description of the out operation: that the by-value
nuance doesn't reconstruct from the updated Lisp structure,
to help the reader keep in mind the data direction.
|
|
|
|
|
|
|
|
|
| |
* share/txr/stdlib/awk.tl (sys:awk-mac-let): Move repeated
boiler-plate code from the various rng macrolets into an
the implementation of the sys:rng macro they rely on.
That implementation is split into two macros: sys:rng is
now the name of a wrapper which adds the boiler-plate, and the
bulky implementation macrolet is now called sys:rng-impl.
|
|
|
|
|
|
| |
* txr.1: Fixed a number of places where structure slots
are called members. In the context of structures, we use the
word member only for C structures; Lisp structures have slots.
|
|
|
|
|
|
| |
* txr.1: Example for sys:capture-cond uses wrong style
for the reference to the suspend operator suspend, causing it
not to be hyper-linked to the definition in the HTML version.
|
|
|
|
|
|
| |
* txr.1: Paragraph about sys:cont-poison must say
"continuation's evaluation frames" not "evaluation's
continuation frames"
|
|
|
|
|
|
|
| |
* txr.1: Under sys:capture cont, try to revise some
potentially confusing text. Also adding more notes, clarifying
the semantics of shared lexical environments, and behavior of
special variable bindings with regard to continuations.
|
|
|
|
|
|
| |
* txr.1: Fix example code that is too wide, causing
a visual problem for standard 80 column man page
formatting.
|
|
|
|
|
| |
* txr.1: Fix lack of escaping of backslash in #\c causing the
c to be interpreted as a troff code.
|
|
|
|
| |
* txr.1: Add missing comma in mapcar section heading.
|
|
|
|
|
|
|
| |
* txr.1: New major (SS*) section User-Defined Streams.
Documented make-struct-delegate-stream function,
the stream-wrap class and all the stream interface object
methods.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A new kind of stream object which redirects its operations to
the methods of a structure.
* Makefile (OBJS): New object file, strudel.o.
* lib.c (init): Call new strudel_init function.
* lisplib.c (stream_wrap_set_entries,
stream_wrap_instantiate): New static functions.
(lisplib_init): Arrange for autloading of new stream-wrap.tl.
* share/txr/stdlib/stream-wrap.tl: New file.
* stream.c (put_string_s, put_char_s, put_byte_s, get_line_s,
get_char_s, get_byte_s, unget_char_s, unget_byte_s, put_buf_s,
fill_buf_s, flush_s, seek_s, truncate_s, get_prop_s,
set_prop_s, get_error_s, get_error_str_s, clear_error_s,
get_fd_s): New symbol variables.
(stream_init): New symbol variables initialized. Numerous
functions registered via these variables now rather than
intern(...) expressions.
* stream.h (put_string_s, put_char_s, put_byte_s, get_line_s,
get_char_s, get_byte_s, unget_char_s, unget_byte_s, put_buf_s,
fill_buf_s, flush_s, seek_s, truncate_s, get_prop_s,
set_prop_s, get_error_s, get_error_str_s, clear_error_s,
get_fd_s): Declared.
* strudel.c, strudel.h: New files.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a method is traced with (trace (meth class slot)),
a spurious warning occurs. This is because the function
is recorded in the trace hash first and then the hook
is installed, and the hook is installed using the
static-slot-ensure function which performs the trace
warning check.
* share/txr/stdlib/trace.tl (sys:trace): Swap the order:
install the hook first, and then put the the previous function
into the trace hash. Doing this in parallel with pset would
also work.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (eql_based_k): New keyword variable.
(equal_based_p): New static function.
(hashv): Use eql_based_p to determine whether to make an
equal-based hash table. Subject to opt_compat relative
to version 187.
(hash_init): Intern :eql-based keyword and store in new
variable.
* hash.h (eql_based_k, userdata_k): Declared.
* txr.1: Documentation updated, with compat notes too.
|
|
|
|
|
|
|
|
| |
* eval.c (op_prof): Deal with the cases when alloc_bytes_t
value cannot be converted to a val in a single call to
unum.
* lib.h (SIZEOF_ALLOC_BYTES_T): New macro.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* args.c (struct args_bool_key): Structure moved
to header file.
(struct args_bool_ctx): One more piece of context information,
the array size.
(args_check_key_store): Work with array of args_bool_key
structs rather than linked list.
Remove useless local variable "store".
(args_key_extract_vl): Function removed.
(args_key_extract): Takes array instead of va_list.
* args.h (struct args_bool_key): Structure declared here.
Loses the next pointer since not used for a linked list.
(args_key_extract_vl): Function removed.
(args_key_extract): Redeclared.
* hash.c (hashv): Adapt to new args_key_extract function.
|
|
|
|
| |
* hash.c (hashv): Switch over to args_keys_extract.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Implement a mechanism for extracting keyword arguments out of
"struct args *" argument lists which avoids consing up an
argument list and scanning it multiple times for multiple
keywords.
* args.c (args_for_each): New function.
(struct args_bool_key, struct args_bool_ctx): New struct
types.
(args_key_check_store): New static function.
(args_keys_extract_vl, args_key_extract): New functions.
* args.h (args_for_each, args_keys_extract_vl,
args_key_extract): Declared.
|
|
|
|
|
|
| |
* lib.c (mapcar_listout): Rework using seq_info for
efficient processing of vector-like sequences and
objects that implement sequences.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a form is a macro, but the macro declines to expand the
form, the form must still be code walked; we can't just return
it and be done. For instance if it is a function call, its
argument expressions have to be expanded.
This also causes undefined function warning to be generated
properly if a macro declines, and the resulting form is
a function call to a not-yet-defined function.
* eval.c (do_expand): If expand_macro yields the original
form, branch backwards to re-execute the whole if statement
again. Use the fact that the local variable macro is now
non-nil to skip the macro expansion case.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch implements a new requirement which clarifies what
happens when a macro declines to expand a form.
To decline expanding a form means to return the original form
(same object) without returning it. The expander detects this
situation with an eq comparison on the input and output.
The current behavior is that no further attempts are made to
expand the form. This is problematic for various reasons. In
code which is expanded more than once, this can lead to the
expansion being different between the expansion passes. In
the first pass, a local macro M might decline to expand a
form. In the second pass, the local macro definition no longer
exists, and the form does get expanded by a global macro M.
This kind of instability introduces a flaw into complex macros
which expand their argument material more than once.
The new requirement is that if a macro definition declines to
expand a macro, then a search takes place through the outer
lexical scopes, and global scope, for the innermost macro
definition which will expand the form. The search tries every
macro in turn, stopping if a macro is found which doesn't
decline the expansion, or after passing the global scope.
* eval.c (expand_macro): Implement new searching behavior.
* txr.1: Documented the expansion declining mechanism
under defmacro and macrolet.
* tests/011/macros-3.tl: New file.
* tests/011/macros-3.expected: New file.
|
|
|
|
|
|
|
|
|
| |
* lib.c (unsup_obj): New static function.
(grade, find, rfind, find_max, find_if, rfind_if, pos, rpos,
pos_if, rpos_if, pos_max): Replace call to uw_throwf with call
to unsup_obj. IN all these functions except grade, the ~s
conversion specifier was wrongly used on the function name
rather than ~a, resulting in unwanted quoting.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Inspired by APL.
* eval.c (eval_init): Register grade intrinsic.
* lib.c (grade): New function.
* lib.h (grade): Declared.
* txr.1: Documented.
|
|
|
|
|
| |
* lib.c (lastcons): Don't wastefully call cdr on an object
after called cdr_l; just dereference the cdr_l loc.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (tail): This low-level function is used by the
list accumulation routines. Because it doesn't handle
improper lists, looking for a null terminator, certain
things don't work, like the associativity of append.
For instance (append '(1 2) #(3) 4) works but not
(append (append '(1 2) #(3)) 4). Fixing tail so that it
terminates on any atom, rather than failing trying to
cdr through it.
|
|
|
|
|
|
|
| |
* txr.1: Documentation for append and nconc is rewritten.
Treatment of non-list sequences is explained in detail.
Description of append* is split off into its own section,
because its handling of non-lists is too different.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Two bugs in these functions, both attributable to
the lazy_appendv implementation:
They destructively catenate the input lists,
much like nconc, even though documented as
non-destructive.
If any input list is infinite, other than the
last input list, that list is forced, resulting
in an infinite loop.
* lib.c (lazy_appendv_func): Rewritten to use a
different algorithm which earnestly allocates a
new lazy cons for each element of the output
sequence, except for the tail part corresponding
to the last list.
(lazy_appendv): Set up the lazy cons according
to the new representation and just return it.
No searching for the tail of the nonempty list,
and no destructive manipulation.
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure, txr.1: Bumped version and date.
* share/txr/stdlib/ver.tl: Likewise.
* txr.vim: Regenerated.
|
|
|
|
|
|
| |
* txr.1: mention that the rightmost maximum can be found by
manipulating the comparison function. (Hence, this is why
we don't provide rpos-max and rfind-max).
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (find, rfind, find_max, find_if, rfind_if, pos, rpos,
pos_if, rpos_if, pos_max): Consistently fixnum indices for
iterating over vector. In some functions, a cnum is already
used, but could be out of fixnum range; we switch to using
c_fixnum for extracting the length and then num_fast on the
index. Some functions are converted from using a val index.
In the case of rfind_if, a bug is fixed: it was using plusp,
which now becomes the correct >= 0.
|
|
|
|
| |
* lib.c (pos_max): Rewrite using seq_info.
|
|
|
|
|
|
| |
* lib.c (find_max): Fix a regression introduced
in recent work: only execute the loop when the vector isn't
empty.
|