| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
* txr.c (version): Bumped.
* txr.1: Bumped version and set date.
* configure (txr_ver): Bumped.
* RELNOTES, txr.vim, dep.mk: Updated.
|
|
|
|
| |
Fix sybol misspelling.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
intrinsic, rather than gensymv.
Register gensym_counter as *gensym-counter*.
* lib.c (gensym): Handle missing prefix argument by defaulting
the prefix to "g".
(gensymv): Function removed.
* lib.h (gensymv): Declaration removed.
* txr.1: Fixed omission: missing documentation for gensym.
Documented *gensym-counter*.
|
|
|
|
|
| |
form via expand_forms. This is completely wrong since only the
macro knows what material is evaluated and what isn't.
|
|
|
|
|
|
|
|
| |
nil parameter list; this is correctly handled by bind_macro_params.
Added support for the colon symbol as an indication that
the case is declined.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (tree_case_s, tree_bind_s): New symbol variables.
(bind_macro_params): Bugfix: inappropriate exception thrown when atom
matched against parameter list. Bugfix: nil being returned when
atom matches empty parameter list. Added support for a new convention:
if loose_p is the colon keyword, then exceptions are not thrown
for destructuring mismatches; nil is returned instad.
(op_tree_case, expand_tree_cases, expand_tree_case, op_tree_bind):
New static functions.
(expand): Handle tree_case_s and tree_bind_s.
(eval_init): Intern tree-case and tree-bind symbols.
Register the corresponding operator functions op_tree_case and
op_tree_bind under these symbols in op_table.
* txr.1: Documented tree-case and tree-bind operators.
|
|
|
|
| |
superfluous material.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
alleviate a long-standing pain: when an exception happens in
TXR's library somewhere, the program dies without leaving
a clue about what code was being evaluated when that happened.
What we can do is have the evaluator publish the most recent
compound form it has processed by stashing it in a variable.
Then when an unhandled exception occurs, we can peek at that
and try to pull out source location info.
* eval.c (last_form_evaled): New variable.
(do_eval): When evaluating a compound form, stash it in
last_form_evaled.
(eval_init): Protect last_form_evaled from gc.
* eval.h (last_form_evaled): Declared.
(eval_error_s): Existing variable declared.
* unwind.c: Has to include "eval.h" for the above variable
and "parser.h" for the source_loc function.
(uw_throw): When an exception is unhandled, if
last_form_evaled has source info, add it to the diagnostic.
But not if the exception is eval-error; because errors from
the evaluators already have the info.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
back-fills some missing source code location info. We apply this to
macro expansions. If some error occurs in expanded code, this way it
is referenced to the line where the macro *call* occurs.
Not only is this better than nothing, it may be better than tracing
it to the macro definition. Ideally, we would have both places:
("the error is in the code expanded from this macro, at this site").
* eval.c (expand): Use rlcp_tree to back-fill source info in
macro expansion by taking it from the unexpanded form.
* parser.h (rlcp_tree): Declared.
* parser.y (rlcp_tree): New function.
|
|
|
|
|
|
| |
* eval.c (expand_quasi): Add some rlcp's here.
* parser.y (o_var, quasi_items, o_elems_transform): Likewise.
|
|
|
|
| |
a backwards goto.
|
|
|
|
|
|
|
|
|
| |
capture the entire form, not just the arguments.
(expand): Apply rlcp to the result of macro expansion, if it has
not set up source code location.
(eval_init): Register rlcp as intrinsic.
* txr.1: Start of macro documentation. Documented rlcp.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (top_mb, defmacro_s, macro_time_s, whole_k, env_k): New global
variables.
(expand_params): Recurse to handle macro parameter lists too.
(bind_macro_params, op_defmacro, expand_macro): New static functions.
(expand): Evaluate defmacro forms and macro-time forms at expansion
time. Recognize and expand macros (albeit not yet with proper lexical
scoping: local bindings are not able to shadow a macro).
(eval_init): Protect top_mb from GC and initialize it.
Intern new symbols defmacro, macro-time, and :whole.
Register defmacro operator in op_table.
* match.h (env_k): Added declaration for existing external variable.
|
|
|
|
|
|
|
|
|
|
|
| |
They need to be since they can contain evaluable initforms for default
arguments. Ditto with lambda; lambda parameters were being treated
using expand_vars, which is not appropriate.
* eval.c (expand_opt_params, expand_params): New static functions.
(expand_vars): Bugfix: added some missing rlcp's to propagate
line number info.
(expand): Move lambda to separate case, and expand its params
|
|
|
|
| |
in error messages.
|
|
|
|
| |
message.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
in text.
* utf8.h (UTF8_ADMIT_NUL): New preprocessor symbol.
(utf8_decoder): New member, flags.
* utf8.c (utf8_decoder_init): Initialize flags to 0.
(utf8_decode): If a null byte is encountered in the input,
then convert it to 0xDC00, rather than keeping it as zero,
unless flags contains UTF8_ADMIT_NUL.
* txr.1: Document handling of null bytes.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
that return the new or old cons cell rather than a pointer
to its cdr field.
* eval.c (transform_op): use of acons_new_l replaced with
acons_new_c.
* hash.c (struct hash): acons_new_l_fun member replaced
with acons_new_c_fun.
(make_hash, make_similar_hash): initialize acons_new_l_fun
member using either acons_new_c or aconsql_new_c.
(gethash_l): function becomes an inline in hash.h.
(gethash_c): new function, based on gethash_l.
(inhash, gethash_n): updated w.r.t struct hash change.
* hash.h (gethash_c): declared.
(gethash_l): becomes an inline wrapper for gethash_c.
* lib.c (acons_new_l, aconsql_new_l): functions removed.
(acons_new_c, aconsql_new_c): new functions.
(obj_init): use gethash_c and rplacd instead of gethash_l
and set.
* lib.h (acons_new_l, aconsql_new_l): declarations removed.
(acons_new_c, aconsql_new_c): declared.
|
| |
|
|
|
|
|
|
|
|
| |
* hash.c (hash_update_1): New function.
* hash.h (hash_update_1): Declared.
* txr.1: Documented hash-update-1.
|
|
|
|
|
| |
This is consistent with usage elsewhere in the module,
and more importantly, keeps our code C++.
|
|
|
|
|
| |
the argument is a pointer type object, leading to a crash
if given a fixnum integer or string literal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
for more flexible joining of data from the hash tables.
* eval.c (eval_init): Remove hash_guni and hash_gisec. Change
registration for hash_uni and hash_isec to three arguments with
one optional.
* hash.c (hash_uni): Third parameter introduced, join_func.
The default behavior changes: in the two argument case,
clashing keys prefer the value from hash1 rather than hash2.
For this reason, we now iterate over hash2 first, then hash1.
(hash_guni): Removed.
(hash_isec): Third parameter introduced, join_func.
(hash_gisec): Removed.
* hash.h (hash_uni, hash_isec): Declarations updated.
(hash_guni, hash_gisec): Delarations removed.
* txr.1: Documentation updated.
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.c (hash_guni, hash_gisec): New functions.
(hash_isec): Bugfix: since gethash was naively used, keys in hash2
associated with the value nil were erroneously omitted from the
intersection.
* hash.h (hash_guni, hash_gisec): Declared.
* txr.1: Documented new functions.
|
|
|
|
|
|
|
|
|
| |
* hash.c (inhash): New function.
* hash.h (inhash): Declared.
* txr.1: Documented inhash. Also, added surprisingly missing
documentation for gethash!
|
|
|
|
|
|
|
|
| |
an invalid floating-point token. The problem is that 1a is allowed,
for compatibility with other Lisp dialects (it is a symbol) whereas
1.0a was scanning as 1.0 followed by a, which is inconsistent.
Some Lisp dialects embedded dots in symbols, and allow 1.0a
as a symbol token. We don't.
|
|
|
|
|
|
|
| |
(hash_equal_op): Short circuited logic: whenever we pull
identical cells from either hash, we don't have to go
through the pending lookaside list.
(make_hash, make_similar_hash): Initialize new structure member.
|
|
|
|
|
|
|
| |
(hash_ops): New functions registered in table of operations.
* txr.1: Documentation for equal function updated to explain
how two hashes are equal.
|
|
|
|
|
|
|
|
| |
are treated as immutable.
* hash.c (last_equal_key, last_equal_hash): Variables removed.
(equal_hash, hash_process_weak): All references to removed
variables scrubbed.
|
|
|
|
| |
mistake from two commits ago leading to a regression.
|
|
|
|
|
|
|
|
|
|
| |
posq, pos, and pos_if as intrinsics.
* lib.c (posqual, posql, posq, pos, pos_if): New functions.
* lib.h (posqual, posql, posq, pos, pos_if): Declared.
* txr.1: Documented
|
|
|
|
|
|
|
|
|
|
| |
one for the functions some, all and none.
* lib.c (some_satisfy, all_satisfy, none_satisfy): Add defaulting
behavior for pred parameter.
* txr.1: Document that the predicate function is optional
in calls to some, all and none.
|
| |
|
|
|
|
| |
alternative argument.
|
|
|
|
|
|
|
|
|
|
|
|
| |
treated in the same way as variables: lists not stringified,
causing expansions with parentheses, and sometimes errors
due to unhandled objects. Also, use tostringp instead of
format for stringifying objects.
stringifying object. Bugfix.k
* match.c (subst_vars): Added comment similar to the one in
the subst_vars of eval.c. Removed superfluous conversion code where the
str variable is already known to be a string.
|
|
|
|
|
| |
nil object properly. Since dwim now trivially delegates to apply,
apply must recognize nil.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
static functions.
(comb): Support hash tables.
* hash.c (print_key_val): When values are nil, print in a more condensed
way by omitting the second element. This notation is accepted as
input already by the parser.
(hash_insert_pair): New function.
* txr.1: Description of comb updated to indicate that it works over
hashes.
|
|
|
|
| |
and <dirent.h>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* dep.mk: Updated.
* eval.c: Removed combination and permutation functions; they
now reside in combi.c.
(generate): Changed from static to external linkage.
* eval.h (generate): Declared.
* combi.c: New file.
* combi.h: New file.
* txr.vim: Regenerated.
|
|
|
|
| |
Got rid of stack that is consed up on each call.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
but return an empty list.
* eval.c (perm_init_common): Do not throw error; return a nil
state if permutation length exceeds sequence length.
(perm_vec, perm_list, perm_str): Check for null return from
perm_init_common and return empty list.
(k_conses): Do not throw error; return empty list.
(comb_list_gen_fun): Check for nil value out of k_conses.
(comb): For vectors and strings, check length against k and
return nil if necessary. For lists, comb_list_gen_fun handles it.
* txr.1: Section order rearranged, and updated.
|
|
|
|
|
|
|
|
| |
rcomb_list_gen_fun, rcomb_list, rcomb_vec_gen_fun, rcomb_vec,
rcomb_str_gen_fun, rcomb_str, rcomb): New static functions.
(eval_init): Register rcomb as intrinsic.
* txr.1: Documented rcomb.
|
|
|
|
|
|
|
|
|
|
| |
string, rather than null_string, which is a literal.
(k_conses, comb_while_fun, comb_gen_fun_common,
comb_list_gen_fun, comb_list, comb_vec_gen_fun, comb_vec,
comb_str_gen_fun, comb_str, comb): New static functions.
(eval_init): Registered comb as instrinsic.
* txr.1: Documented comb.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to k, for consistency with rperm.
(rperm): Likewise, and the behavior in the k == zero case is
changed to return a single empty permutation.
(perm_while_fun, perm_index, perm_gen_fun_common, perm_init_common,
perm_vec_gen_fill, perm_vec_gen_fun, perm_vec,
perm_list_gen_fill, perm_list_gen_fun, perm_list,
perm_str_gen_fill, perm_str_gen_fun, perm_str, perm): New
static functions.
(eval_init): perm registered as intrinsic.
* lib.c (vecref_l): Bugfix: allow negative indices, just like vecref.
* lib.h (three, four): New macros.
* txr.1: Updated documentation for rperm. Documented perm.
|
|
|
|
| |
overflows the size_t type that is passed to malloc, throw an exception.
|
|
|
|
|
|
|
|
| |
nperm_vec_gen_fun, nperm_vec, nperm_str_gen_fun, nperm_str, nperm): New
static functions.
(eval_init): nperm registered as intrinsic.
* txr.1: Documented nperm function.
|
| |
|
| |
|