| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
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.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Pass second argument to vector.
* lib.c (vector): Takes additional argument specifying the value
for the slots of the vector.
(vector_list, sub_vec): Pass second argument to vector.
* lib.h (vector): Declaration updated.
* eval.c (eval_init): Register vector as two-argument function
with one required arg.
* txr.1: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Basically the dwim operator is just a Lisp-1 version of the call
operator now. It doesn't have to do anything funny with non-function
objects, since they are callable.
* lib.c (chr_str, chr_str_set, vecref, vecref_l): Replace
inappropriate internal assertions with error exceptions.
* unwind.h (numeric_assert, range_bug_unless): Unused macros
removed.
|
|
|
|
|
|
|
| |
one argument to a sequence being used as a function, split it into two
arguments. This is consistent with the DWIM operator behavior.
* txr.1: Document callable objects.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is already supported in the DWIM operator.
* eval.c (apply): If object isn't a function, gather the
arguments into an array and delegate to generic_funcall.
* lib.c (generic_funcall): Changed from static to external linkage.
Supports sequences and hashes as functions. Error messages
fixed not to refer to "funcall".
(funcall, funcall1, funcall2, funcall3, funcall4): Do not throw
exception if fun is not of FUN type; instead, delegate
to generic_funcall. Error messages fixed not to refer to "funcall".
* lib.h (generic_function): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (apply): Unconditionally use colon_k for missing optional
args, for intrinsic functions.
(eval_intrinsic, rangev, rangev_star, errno_wrap): Conform to new
scheme for defaulting optional args.
(reg_fun_mark): Function removed.
(eval_init): Switch reduce_left and reduce_right back to reg_fun
registration.
* hash.c (gethash_n): Conform to new scheme for defaulting optional
arguments.
* lib.c (sub_list, replace_list, remove_if, keep_if, remove_if_lazy,
keep_if_lazy, tree_find, count_if, some_satisfy, all_satisfy,
none_satisfy, search_str, match_str, match_str_tree, sub_str,
replace_str, cat_str, tok_str, intern, rehome_sym, sub_vec,
replace_vec, lazy_str, sort, multi_sort, find, find_if, set_diff,
obj_print, obj_pprint): Conform to new scheme for defaulting optional
arguments.
(func_f0, func_f1, func_f2, func_f3, func_f4, func_n0, func_n1,
func_n2, func_n3, func_n4, func_n5, func_n6, func_n7, func_f0v,
func_f1v, func_f2v, func_f3v, func_f4v, func_n0v, func_n1v,
func_n2v, func_n3v, func_n4v, func_n5v, func_n6v, func_n7v):
Remove references to removed mark_missing_args member of struct func.
(func_set_mark_missing): Function removed.
(generic_funcall): Unconditionally use colon_k for missing optional
args, for intrinsic functions.
* lib.h (struct func): mark_missing_args member removed.
(func_set_mark_missing): Declaration removed.
(default_arg, default_bool_arg): New inline functions.
* rand.c (random): Left argument is not optional.
(rnd): Conform to new scheme for defaulting optional arguments.
* regex.c (search_regex, match_regex): Conform to new scheme for
defaulting optional arguments.
* stream.c (unget_char, unget_byte, put_string, put_char, put_byte,
put_line): Conform to new scheme for defaulting optional arguments.
* syslog.c (openlog_wrap): Conform to new scheme for defaulting
optional arguments.
* txr.1: Remove the specification that nil is a sentinel value in
default arguments, where necessary. Use consistent syntax for
specifying variable parts in argument lists. A few errors and omissions
addressed.
|
|
|
|
|
|
|
|
| |
form (sym initform present-p-sym). Also, support the convention
that a value of : explicitly passed for an optional argument produces
the same behavior as if that argument value were missing.
* txr.1: Document new conventions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
to functions for which this is requested.
(reg_fun_mark): New static function.
(eval_init): Register reduce_left and reduce_right as requiring
marking for missing optionals.
* lib.c (func_set_mark_missing): New function.
(generic_funcall): Pass missing optional arguments as colon_k
to functions for which this is requested.
(reduce_left, reduce_right): Handle missing values of init and key.
(func_f0, func_f1, func_f2, func_f3, func_f4, func_n0, func_n1,
func_n2, func_n3, func_n4, func_n5, func_n6, func_n7, func_f0v,
func_f1v, func_f2v, func_f3v, func_f4v, func_n0v, func_n1v,
func_n2v, func_n3v, func_n4v, func_n5v, func_n6v, func_n7v):
Initialize new mark_missing_args member of struct func.
* lib.h (struct func): New bitfield member, mark_missing_args.
(func_set_mark_missing): Declared.
(missingp, null_or_missing_p): New inline functions.
* txr.1: Updated descriptions of reduce-left and reduce-right.
|
|
|
|
|
| |
* lib.h (nullp): New inline function.
(eq): Removed useless parentheses: it's not a macro.
|
|
|
|
| |
in format calls.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
init forms, while streamlining the implementation.
* eval.c (bind_args): Get rid of opt_init_parm array hack;
turns out we already have a useful function for extending an
environment object, namely env_vbind: hitherto unused! We now make a
blank environment upfront and extend it destructively with env_vbind.
Except that after evaluating an init form, we create a new environment:
this is in case a lexical closure was made by the init form, in which
event we don't want to be destructively manipulating the environment
any more.
* txr.1: Clarified.
|
|
|
|
| |
list_star_intrinsic, diagnosed by compiler.
|
|
|
|
| |
no locale-dependent silliness.
|
|
|
|
|
|
|
|
|
| |
new helper function that supports apply.
* eval.c (list_star_intrinsic): New static function.
(eval_init): Register list_star_intrinsic as list*.
* txr.1: Document list*.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (apply_frob_args): New static function.
(apply_intrinsic): Process arguments with apply_frob_args.
(eval_init): apply_intrinsic registered differently, as a
variadic function with one mandatory arg.
* lib.c (lastcons): New function.
* lib.h (lastcons): Declared.
* txr.1: Updated append documentation.
|
|
|
|
| |
in the dot position of a function call form.
|
|
|
|
|
|
|
|
|
|
|
| |
(do_eval_args): Support string or vector in dot position.
* lib.c (tolist): New function.
* lib.h (tolist): Declared.
* txr.1: Document how apply and dot position in compound forms
supports strings as well as vectors.
|
|
|
|
|
|
|
| |
list evaluates to a vector, then convert the vector to a list.
* txr.1: Document compound forms, and how they allow the dotted
position and how it may be a vector.
|
|
|
|
|
|
| |
under the name vec, as a variadic function.
* txr.1: Document vec.
|
| |
|
| |
|
|
|
|
| |
weak keys that are equal-based.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
copy_hash, gethash_l, gethash, gethash_f, gethash_n,
hash_count, hash_next, hash_eql, hash_equal): Use
num_fast instead of num.
(make_hash): An attempt to make a weak-keys hash that has
equal-based keys is nonsensical; it is now diagnosed with
an exception. Use num_fast instead of num.
(hash_process_weak): Call breakpt whenever the weak object(s) due to
which entries are being deleted match the value in break_obj.
Use num_fast instead of num.
* parser.l (parse_init): Bugfix: the forms_to_ln_hash
was equal-based, which makes no sense.
|
|
|
|
|
|
|
| |
* gc.c (break_obj): Change to external linkage.
(mark): Use t variable instead of re-evaluating obj->t.type.
* gc.h (break_obj): Declared.
|
|
|
|
|
|
| |
It's importa for this function not to have the side effect
of triggering garbage collection, when it is used for
debugging issues that show up under --gc-debug.
|
| |
|
|
|
|
| |
GNU Make check. This was introduced in May 2012.
|
|
|
|
|
|
| |
Do not color embedded decimal integers in symbols as integers.
* txr.vim: Regenerated.
|
|
|
|
|
|
|
|
|
| |
is an operator, then suppress the addition of the rest
parameter in the dotted cons position at the end of the form,
since this mechanism for applying additional arguments is only
supported by function calls, not by special forms.
* lib.h (and2, and3): New macros.
|
|
|
|
|
|
|
| |
operator, we must feed the entire form to the expander, not the
individual forms. That is to say (do operator arg) must expand the
form (operator arg), whereas (op fun arg) just expands the forms fun
and arg individually.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
things like (defun foo (s : (l (length s))) ...).
Default arguments can be initialized by expressions that
refer to the arguments.
* eval.c (bind_args): By means of a local array, defer the evaluation
of optional argument init forms until the lexical environment,
including all the parameters, is captured. Then valuates the forms
in the array, and set the variable values.
* txr.1: Clarify the new scoping rules.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
intrinsic.
* stream.c (cat_get_line, cat_get_char, cat_get_byte): Do not
remove the last stream from the stream list, so that there is
some stream object there which can take the unget-char or
unget-byte operations.
(cat_unget_byte, cat_unget_char): New static functions.
(cat_stream_ops): unget_char and unget_byte function pointers
filled in.
* txr.1: Documented catenated-streams.
|
|
|
|
|
|
|
|
|
|
| |
Moved mode member down.
(make_stdio_stream_common): Initialize is_rotated.
(tail_strategy): Substantially rewritten in order to address
a possible race condition, when a file is rotated.
The issue is that even when the file disappears, or when the file has
been replaced, we must continue reading from the old stream until the
end, and only then can we switch to the newly rotated file.
|