| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
| |
* txr.1: Section describing rcomb function wrongly
refers to comb.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The comb function is broken; some combinations of items
are missing in the output. This is because the iteration
reset step in comb_gen_fun_common handles only one
column of the state, neglecting to reset the other
columns: what is now done by the for (j = i ...
loop. I'm changing the representation of the state from
a list of lists to a vector of lists. Moreover, it is not
reversed. This allows the loop in comb_gen_fun_common
to perform random access.
* combi.c (k_conses): Return a vector, that is not
reversed.
(comb_init): New helper function to slightly abstract
the use of k_conses.
(comb_while_fun): Termination now occurs if the state
vector is nil (degenerate case, like k items chosen
from n, when k > n), or if the vector has nil in
element zero (special flag situation).
(comb_gen_fun_common): Rewritten, with correction.
The logic is similar. Since we have random access,
we don't need the "prev" variable. When we reset
a column iterator, we now also populate all the
columns to the right of it. For instance, if a
given column resets to (a b c), the one to the right
must reset to (b c), and so on. In the broken function,
this is what was not done, resulting in missing
items due to, say, a column resetting to (a b c)
but the one next to it remaining at (c).
(comb_list_gen_fun): Drop nreverse.
(comb_vec_gen_fun, comb_str_gen_fun, comb_hash_gen_fun):
Use the same i iterator for the state and the output object,
accessing the vector directly.
(comb_list, comb_vec, comb_str, comb_hash): Use comb_init.
* tests/015/comb.tl: New file.
|
|
|
|
|
|
| |
* combi.c (perm_seq_gen_fun, perm_seq): New functions.
(perm): Call perm_seq in default case to handle more
sequence kinds.
|
|
|
|
|
|
|
|
|
| |
* txr.1: The Math Library is documented in a way that is
oblivious to User-Defined Arithmetic. This is now clarified.
When some of the argument types of a math function are
user-defined arithmetic structures, the stated conversions
and restrictions don't apply, since it defers all semantics
to the method invoked.
|
|
|
|
|
|
| |
* Makefile (shipped): This rule works correctly but
shows, for instance, COPY lex.yy.c.shipped -> lex.yy.c.
which is backwards. Let's fix it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I've run into situations in which I wanted a comment in a
big JSON quasiliteral to explain some embedded piece of code.
We support only semicolon comments, and no #; ignore notation.
* parser.l (grammar): Recognize Lisp comments in the JSON
state also. That does it.
* tests/010/json.tl: One modest little test.
* txr.1: Documented.
* lex.yy.c.shipped: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We have these issues, which are regressions:
1> (compile-toplevel '(/ 1 0))
** expr-1:1: warning: sys:b/: constant expression (sys:b/ 1 0) throws
** /: division by zero
** during evaluation at expr-1:1 of form (sys:b/ 1 0)
1> (compile-toplevel '(let ((a 1) (b 0)) (/ a b)))
** /: division by zero
** during evaluation at expr-1:1 of form (compile-toplevel [...])
While the compiler's early pass constant folding is careful
to detect constant expressions that throw, care was not taken
in the optimizer's later constant folding which takes place
after constant values are propagated around.
After the fix:
1> (compile-toplevel '(let ((a 1) (b 0) (c t)) (if c (/ a b))))
** expr-1:1: warning: let: function sys:b/ with arguments (1 0) throws
#<sys:vm-desc: 9aceb20>
2> (compile-toplevel '(let ((a 1) (b 0) (c nil)) (if c (/ a b))))
#<sys:vm-desc: 9aef9f0>
* stdlib/compiler.tl (compiler): New slot top-form.
(compile-toplevel): Initialize the top-form slot of the
compiler. The optimizer uses this to issue a warning now.
Since the warning is based on analyzing generated code, we
cannot trace it to the code more precisely than to the top-level
form.
* stdlib/optimize.tl (basic-blocks): New slot, warned-insns.
List of instructions that have been warned about.
(basic-blocks do-peephole-block): Rearrange the constant folding
case so that as part of the pattern match condition, we include
the fact that the function will not throw when called with those
constant arguments. Only in that case do we do the optimization.
We warn in the case when the function call does throw.
A function rejected due to throwing could be processed through
this rule multiple times, under multiple peephole passes, so
for that reason we use the warned-insns list to suppress duplicate
warnings.
|
|
|
|
|
|
| |
* stdlib/compiler.tl (compiler compile): Don't store form
into me.last-form if it's an atom; it won't be useful
or error reporting.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (read_objects_common): New static function, formed
from read_objects_from-string.
(read_objects_from_string): Now wrapper for read_objects_common.
(read_objects): New function.
* parser.h (read_objects): Declared.
* eval.c (eval_init): Register read-objects intrinsic.
* autoload.c (getput_set_entries): Add three new symbols:
file-get-objects, file-put-objects and file-append-objects.
* stdlib/getput.tl (put-objects): New system function.
(file-get-objects, file-put-objects, file-append-objects):
New functions.
* txr.1: Documented.
* tests/018/getput.tl: New file.
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_join): New function.
(hash_init): hash-join intrinsic registered.
* hash.h (hash_join): Declared.
* tests/010/hash.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
| |
* tests/010/hash.tl: Add test cases for the hash set operations.
* txr.1: Clarify that in hash-uni, the mapping functions are
used on all items, not just ones subject to joinfun.
|
|
|
|
|
|
| |
* hash.h (hash_uni): Rename lunitfun and runitfun parameters
to the same names as in the definition, which follow the
terminology in the manual.
|
|
|
|
| |
* stdlib/quips.tl (%quips%): New one.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In March 2012, b7f1f4c5bbea86e288b6a4d68595c1d2d07217bd
introduced the feature that the @nil variable matches and
discards. This was incompletely implemented. Some cases
of a nil variable with modifiers fail to match.
* match.c (dest_bind): This function must correctly handle
the case when pattern is nil: it should just return bindings
without extending them. If the pattern is any nonbindable
symbol, it should indicate a failed match using t.
The logic has not been touched since 2009, at which time
an additional bogosity was introduced of calling
funcall(testfun, pattern, value) when pattern is a
non-bindable symbol. If value is a string, that could
never work. Possibly the idea is that the value could come
from a symbol-valued expression, such as one producing
a keyword symbol. We are not going to support that, unless
someone complains.
* tests/000/nilvar.txr, tests/000/nilvar.expected: New files,
providing a test case that fails without this commit.
|
|
|
|
|
| |
* hash.c (gethash_d): Use gethash-d as self rather than
gethash_d for consistency.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* parser.c (repl): The first bug is that we are not correctly
checking the special variable: auto_parens holds the binding.
Thus TXR was behaving as if they feature is always enabled.
The second bug is that forms might not be a list; it could
be the colon symbol, so we cannot evaluate cdr(forms).
The third bug is that we don't want to create (progn . :)
when forms is the : symbol. These two bugs are reproduced
by turning on the mode and evaluating (1 2 3 . 4 5 6),
a bad form.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* stdlib/compiler.tl (compile-file-conditionally): When evaluation
of a compiled top-level form is not suppressed, there is a risk
that it can terminate non-locally, via throwing an exception or
performing a block return. The compilation of the file is then
aborted. We can do better: using an unwind-protect, we can catch
all non-local control transfers out of the form and just ignore
them. The motivation for this is that it lets us compile files
which call (return-from load ...), without requiring that it be
written as (compile-only (return-from load ...)). Other things will
work, like compiling a (load "foo") where foo doesn't exist or
aborts due to errors.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When TXR executes a top-level program, such that it will
exit when the last form in that program terminates,
it simulates a load. There is a block named load visible,
and the program can evaluate a (return-from load <expr>).
The value of that <expr> is thrown away, and the
termination status is always unsuccessful.
In this patch, (return-from load <expr>) is made to work
such that the value of <expr> will determine the exit
status, according to the same interpretation that
(exit <expr>) would give to the value.
* sysif.[ch] (exit_wrap): Static function becomes external.
* txr.c (txr_main): In the cases where we execute a file
and return from main, we now call exit_wrap instead.
The termination status is not simply based on whether
the file was successfully read, but takes into account the
load block.
* tests/019/load-ret/{script.tl,bad.tl}: New files.
* tests/019/load-ret/load-ret.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (obj_print_impl): Do not print (rcons X Y)
as X..Y if X looks like (rcons ...). This
causes the problem that (rcons (rcons 1 2) 3)
prints as 1..2..3, a notation which unambiguously
means (rcons 1 (rcons 2 3)).
* tests/012/syntax.tl: New test cases.
|
|
|
|
| |
* stdlib/quips.tl (%quips%): Wording change.
|
|
|
|
|
| |
* txr.1: Fix numerous "an" articles that should be "a",
as well as one case of "and" missing a "d".
|
|
|
|
|
|
|
|
| |
* txr.1: Add dialect note about TXR supporting ,',*args
whereby multiple items get spliced into a quote, which
effectively distributes into multiple quotes. The direct
equivalent does not work in all Common Lisp implementations,
and doesn't appear to be required by the standard.
|
|
|
|
| |
* txr.1: fix transposition: "ot" -> "to".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Not all special characters can just be backslash escaped.
Spaces and newlines must be quoted.
* stream.c (sh_esc_common): New function. Handles both
sh-esc and sh-esc-all logic, distinguished by a flag.
Quoting is used, rather than backslash escaping.
If the string contains no special characters, it is just
erturned. If it can be double quoted, it is double quoted.
Otherwise it is single quoted and any contained single
quotes are replaced by '\''.
(sh_esc, sh_esc_all): Now just wrap sh_esc_common.
(sh_esc_dq): Remove the newline from the set of escaped
characters. Escaping a newline generates a continuation
sequence which eats the newline.
* tests/018/sh-esc.tl: Most test cases deleted; many new test
cases added.
* txr.1: Documentation revised.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* glob.c (glob_wrap): When converting the glob array to the
returned list, suppress consecutive duplicates. This has to be
done separately for each call to glob or super_glob, so we now
interleave the production of the output list with the glob
calls. It has to be done separately because there can be
duplicates between different patterns. E.g. if (glob "?")
matches one path then (glob '("?" "?")) must return two copies
of it. Furthermore, the brace expansion implementation in
glob* produces multiple glob calls and appends their results.
Duplicates inside a single super_glob call result when there
are multiple ** (double star) patterns present, which are
matched by the same path in more than one way. If the results
are sorted, then the duplicates appear consecutively and we
will squash them. Also, a memory leak is fixed here: we
must free(pat_u8) unconditionally, before testing for the
early exit situation.
|
|
|
|
|
|
|
| |
* tests/017/setjmp.tl: Solaris has libpng.so, but but some
version without png_set_longjmp_fn. We add a test for the
presence of this function as a precondition for running
the real test.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* RELNOTES: Updated.
* configure (txr_ver): Bumped version.
* stdlib/ver.tl (lib-version): Bumped.
* txr.1: Bumped version and date.
* txr.vim, tl.vim: Regenerated.
* protsym.c: Regenerated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This works fine:
1> (time-struct-utc 0)
#S(time year 1970 month 1 day 1 hour 0 min 0 sec 0 wday 4 yday 0
dst nil gmtoff 0 zone "GMT")
2> *1.(time-utc)
0
3> *1.(time-local)
28800
But we want the following to return the same results:
1> (time-struct-local 0)
#S(time year 1969 month 12 day 31 hour 16 min 0 sec 0 wday 3 yday 364
dst nil gmtoff -28800 zone "PST")
2> *1.(time-utc)
-57600
3> *1.(time-local)
-28800
With the patch, we do:
1> (time-struct-local 0)
#S(time year 1969 month 12 day 31 hour 16 min 0 sec 0 wday 3 yday 364
dst nil gmtoff -28800 zone "PST")
2> *1.(time-utc)
0
3> *1.(time-local)
28800
This is also broken:
1> (time-parse-utc "%H:%M:%z" "00:00:-0800")
-28800
It must return 28800.
* time.c (time_meth): This function, which is the
imlpementation of the time-utc and time-local methods, must
subtract the gmtoff field, not add it. This is so that
a UTC time expressed in a local time zone will convert
back to the correct UTC epoch.
(time_parse_local, time_parse_utc): Here we likewise
must subtract the gmtoff.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There used to be a hack in the Makefile whereby the
compilation of stdlib/error.tl was forced to occur earlier.
I got rid of it. Now, the issue that was solving reproduced.
A situation can occur whereby loading error.tl triggers
loading some other files, which end up performing an expansion
that needs sys:bind-mac-check: but that function has not yet
been defined because error.tl has not yet loaded that far.
The issue occurs when stdlib/place.tl is compiled before
stdlib/error.tl. The compiled place.tl has a run-time
dependency on functions in error.tl, because the compiled
version of mac-param-bind and other forms relies on a run-time
support function sys:bind-mac-check defined in stdlib/error.tl.
* stdlib/error.tl (sys:dig): This function triggers the
problem, but it's not the only cause. Here, the problem is
because the (set ...) macro is used which triggers loading the
stdlib/place module. That brings in the need for
bind-mac-params. So here we use sys:setq instead. That is not
a complete solution. The changes in eval.c are also required,
because built-in macros like whilet expand to code that uses
the (set ...) macro. Note how sys:dig uses whilet.
(sys:bind-mac-check, sys:bind-mac-error): We move these
functions above compile-warning. This addresses remaining
circularity problem. The compile-warning function uses the
catch macro which brings in stdlib/except.tl, which pulls in
stdlib/op.tl due to its use of (do ...), which pulls in
stdlib/place.tl. So if we already define sys:bind-mac-check
at that point, we are good.
* eval.c: Sweep the file for almost all places where macros
generate code that invokes (set <symbol> <value>) and replace
that with (sys:setq <symbol> <value>) to eliminate the
dependency on loading the stdlib/place.tl module.
(me_def_variable, me_gun, me_while_until_star, me_case,
me_whilet, me_mlet, me_load_for, me_pop_after_load):
In all these macro expanders, use sys:setq rather than set
in the generated code.
* tests/019/load-hook.tl: Some test cases here look for a
macro expansion containing (set ...), needing to be fixed
to look for (sys:setq ...) due to the change in eval.c.
|
|
|
|
|
| |
* txr.1: The rlink function resolves the target path
if it is a symlink, not the new link's path.
|
|
|
|
|
|
|
|
| |
* txr.1: Fix numerous occurrences of nil and t being
typeset using "meta" rather than "code". That makes them
slanted in the HTML and PDF, and appear in angle
brackets as <nil> and <t> in text-based man output.
We want a non-slanted type, and no angle brackets for these.
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (dwim_del): Remove check against structures from
OBJ case; we just let this pass through to the logic that
invokes replace.
* tests/012/aseq.tl: New test cases.
* txr.1: Document how del works on a [obj index] place.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* struct.c (invalidate_special_slots): New static function.
(invalidate_special_slot_nonexistence): Move static function
up in file, to be next to invalidate_special_slots.
(make_struct_type, static_slot_ens_rec): Call the new
invalidate_special_slots function in addition to calling
static_slot_home_fixup whenever the stslots array is resized.
The spslot array contains pointers to the elements of stslots,
which become invalid when that is resized.
* tests/012/oop-seq.tl: Repro test case added.
|
|
|
|
|
|
|
| |
* lib.c (dwim_set): The "not a place" diagnostic applies
not only in situations when the object is a list;
the diagnostic should not imply that the argument is a list
when it isn't.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register mref intrinsic.
* lib.[ch] (mref): New function.
* stdlib/place.tl (sys:mref1): New place.
(mref): New place macro, defined in terms
of sys:merf1, ref place and mref function.
* tests/012/seq.tl: New tests.
* txr.1: Documented.
|
|
|
|
| |
* stdlib/place.tl (dwim): Fix incorrect indentation.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ref function is not defined in the documentation
as an accessor, but there is a ref place. Unfortunately,
deletion is broken: (del (ref x y)) does not store the
new sequence back into place x, and so it does not work
correctly for lists; if x is a list, it doesn't change.
Various accessors are defined in terms of ref, as place
macros, such as the first, second, third, ... accessors.
This fixes the bug for them also; (del (second list))
must update list.
* stdlib/place.tl (ref): Fix the delete-expander to
fetch the clobber expander of the sequence place,
and use the simple setter to put the edited sequence into
that place.
* tests/012/seq.tl: Test case, which breaks without
this fix. Test the (second ...) place also, which is defined
in terms of ref.
* txr.1: Split documentation for ref and refset, mainly
because one is an Accessor and one is a Function. Removing
some discussions about the equivalences between DWIM brackets
and ref; there are subtleties there not worth going into.
Description of refset is simplified. We mention the possibility
of del over a ref place; only in that case is the sequence
itself required to be a place.
|
|
|
|
|
|
|
|
|
|
|
| |
* autoload.c (op_set_entries): Add tap symbol as autoload
trigger for op module.
* stdlib/op.tl (tap): New macro.
* tests/012/op.tl: New test.
* txr.1: Documented.
|
|
|
|
| |
* stdlib/quips.tl (%quips%): New one.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The motivation here is that casequal brings in some optimizations
not done by match-case, like hashed lookup and jump tables.
* stdlib/match.tl (non-triv-pat-t): Move temporary definition
higher in file since it is needed earlier in the bootsrapping.
(match-case-to-casequal): New function.
(match-case): Try converting clauses to casequal with new
function. If that returns something, use that as the expansion,
otherwise perform the normal expansion.
* txr.1: Documentation revised. Existing text is wrong which
says that the clauses of a caseq, caseql or casequal are
always evaluated sequentially. Furthermore, now that
match-case and match-ecase can be transformed to casequal,
they also don't necessarily evaluate sequentially. We spell
out the conditions under which they may translate.
|
|
|
|
|
| |
* configure: make it clear that the user must run "make"
or "make all" before "make tests" and "make install".
|
|
|
|
|
|
| |
* autoload.c (match_set_entries): We must not just intern
match-error, but load the function if it is referenced.
Likewise, we must register an autoload for sys:match-pat-error.
|
|
|
|
|
|
|
| |
* genvim.txr (txr_quasilit): Fix gaping omission here: the
quasiliteral region does not contain any of the character
escapes, screwing up the syntax highlighting if any of them
occur.
|
|
|
|
|
|
| |
* Makefile (TXR_LDLIBS): Fix PLAFORM_LDLIBS typo in definition
of variable. This typo renders ineffective the --platform-ldlibs
option of the configure script.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are functions for testing whether a list or
sequence is shorter than a given integer. This is cheaper
than calculating the length of lists, which is in
some cases impossible if they are infinite.
A length-str-< function already exists, useful
with lazy strings.
length-< uses length-list-< or length-str-<
as appropriate
* lib.[ch] (length_list_lt, length_lt): New functions.
* eval.c (eval_init): length-list-< and length-<
intrinsics registered.
* tests/012/seq.tl: New tests.
* txr.1: Documented.
|
|
|
|
|
| |
* txr.1: Document that flatcar and flatcar* accept
an atom argument, which is returned.
|
|
|
|
| |
* tests/012/seq.tl: New tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib.c (lazy_flatten_scan): Fix a problem which results
in cases like (()), ((())) ... to incorrectly flatten
to (nil). The do loop in this function which iteratively
descends into a nested left-nesting of a list does not handle
all cases, and therefore the function may not return at that
point. Removing the return fixes the problem, but so does
removing the loop so that in that case we just descend one
level into the nested list, and continue in the main loop.
What is incorrect is that when the consp(a) test fails and the
do loop terminates, we need to distinguish the cases off
a being an atom versus nil. Continuing in the loop does that.
This bug was spotted by a reviewer in the comp.lang.c
Usenet newsgroup.
(lazy_flatten): We neglect to handle the case here that
the input is an empty list, resulting in (flatten* nil)
returning (nil) rather than nil. The flatten function
is correct.
* tests/012/seq.tl: New tests.
* txr.1: Documentation improved. In particular, these
functions don't handle improper lists. Also, it needs
to be documented that the argument may be an atom.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Defining libpng bindings, with longjmp catching, is
now possible.
* autoload.c (ffi_set_entries): Add setjmp symbol, which is
a new macro in stdlib/ffi.tl.
* ffi.c (jmp_buf_s): New symbol variable.
(mk_jmp_buf, rt_setjmp, longjmp_wrap): New functions.
(ffi_init): Initialize jmp_buf_s. Register
sys:rt-setjmp and longjmp intrinsics.
* ffi.h (jmp_buf_s): Declared.
* stdlib/ffi.h (setjmp): New macro. Rather than introducing
a new special operator, we use a run-time support function
called sys:rt-setjmp, which takes functional arguments.
* unwind.[ch] (uw_snapshot, uw_restore): New functions.
The rt_setjmp function needs these to restore our unwind
frame stack into a sane state after catching a longjmp,
which bails without unwinding it, leaving the pointers
referring to frames that no longer exist.
* tests/017/setjmp.tl,
* tests/017/setjmp.expected: New files.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register hist-sort intrinsic.
* lib.c (gt_f): New global variable.
(hist_succ_f): New static variable.
(hist_succ): New static function.
(hist_sort): New function.
* lib.h (gt_f, hist_sort): Declared.
* tests/012/sort.tl: New tests.
* txr.1: Documented.
|