| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
| |
* stream.h (remove_path, rename_path): Declared.
* utf8.c (w_remove, w_rename): New functions.
* utf8.h (w_remove, w_rename): Declared.
* eval.c (eval_init): Registered remove_path and rename_path
as intrinsics.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(transform_op): Recognize compounded metas, and strip one level off.
(eval_init): Intern sys:expand function so we have access to the
form expander from TXR Lisp.
* lib.c (obj_print, obj_pprint): Fix: wasn't rendering metanumbers.
* parser.y (list): Support @ in front of anything. If it's an atom,
treat it similarly to a metasymbol or metanumber.
* txr.1: Documented meta-meta arguments in nested op.
* genvim.txr, txr.vim: Support coloring for compounded meta syntax.
|
|
|
|
| |
like @ (a b c) and @ [1 2 3].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
albeit hacky.
* parser.l (BSYM, NSYM): Regex definitions gone.
(BT0, BT1, BT2, NT0, NT1, NT2): New regex definitions.
(BTREG, BTKEY, NTREG, NTKEY): Rewritten, so that they cannot
match a lone @ character as a symbol name.
(grammar): Rules for returning METAPAR, METABKT and METAQUO
are gone. Instead, we just recognize a @ in the NESTED
and BRACED states and return it as a token.
* parser.y (METAPAR, METABKT, METAQUO): Token types removed.
(meta_expr): Nonterminal symbol removed.
('@'): New token type.
(list): Quotes and splices handling removed from this rule.
The new token '@' is handled here, on the other hand, because
there are places that reference the list rule that need to support
@ expressions.
(n_expr): Reference to meta_expr removed. Quote, unquote and splice
added here.
(yybadtoken): Removed references to METAPAR, METABKT and METAQUO.
|
| |
|
|
|
|
|
|
|
|
|
| |
the initial value is optional. this creates the possibility that
the effective list of operands is empty, in which case the function
must support a call with no arguments, just like in the common lisp
reduce.
* txr.1: rewrote reduce-left and reduce-right documentation.
|
|
|
|
|
|
|
|
| |
to something more useful.
* regex.h (match_regex_right): Change name of parameter.
* txr.1: Documented match-regex-right.
|
|
|
|
|
|
| |
additional expressions forms in (sys:var <sym>) after
the sym. These were not being printed. Such syntax occurs
often in the TXR pattern language.
|
|
|
|
|
|
| |
* regex.h (match_regex_right): Declared.
* eval.c (eval_init): Register match_regex_right as instrinsic.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
like @[...] and @(...) occurring in the TXR pattern language.
The previous behavior is that the parser always expands the interior
of these forms when they occur. This is wrong.
These forms only denote TXR Lisp (and so require expansion) when they
occur in a directive, inside a sub-expression that is not already known
to be Lisp.
For instance in @(do @(op foo)), the inner @(op foo) should not be
subject to expansion. The reason that the argument forms of @(do)
are TXR Lisp. The @(op foo) form denotes (sys:expr foo), and that
operator currently has no meaning; and so we should not expand it.
The previous, buggy behavior would turn the @(op ..) into
a @(lambda ...).
Another example is @(bind a @(list @(op foo))) where @(list ...)
denotes TXR Lisp and so the interior of the form should be expanded.
However, the @(op foo) should not be expanded into @(lambda ...)
Expanding @(...) forms is not currently harmful, but it interferes
with code that wants to use the @(...) syntax for its own use,
The solution involves adding shims in the parser so that the expansion
is only applied when expressions are reduced to the top level
within a directive, and then to walk the expressions, looking for
the @ syntax and expanding only the outermost occurrence thereof.
* parser.y (expand_meta): New static function.
(n_exprs n_expr): New nonterminal symbols.
(elem): The arguments of the list elem (representing a generic
directive) now need to be put through expand_meta when it is not
@(do ...) or @(require ...).
(list): Use n_exprs instead of exprs.
(meta_expr): Do not call expand, and use n_expr(s) instead of expr(s).
(exprs, expr): These rules no become just a shim which expands
the outer-most metas. The actual parsing is represented by n_expr
and n_exprs ("n" stands for nested), which behave just like the
old expr and exprs.
|
|
|
|
|
|
|
|
|
|
| |
for the @' combination, as in @(bind a @'(foo ,bar))
* parser.l: Handle the new METAQUO token.
* parser.y (METAQUO): New token.
(meta_expr): New "METAQUO expr" case. Added missing METABKT
error handling case.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* hash.h (hash_update): Declared.
* lib.c (update): New function.
* lib.h (update): Declared.
* eval.c (eval_init): Register hash_update and update as intrinsics.
* txr.1: Documented.
|
|
|
|
| |
to insert result form into the expanded output.
|
| |
|
|
|
|
|
|
|
|
| |
The dwim operator is deleted when the symbol is do.
(expand): Expand do_s form with expand_op, not only op_s. Pass down
symbol.
* txr.1: Document do operator.
|
|
|
|
|
| |
rearrangement that gives precedence to operator lookup over function
lookup.
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (expand_forms): Static function becomes external.
(expand_form): Remove case which handles do_s.
* eval.h (expand_forms): Declared.
* parser.y (elem): Expand both do_s and require_s forms by
using expand_forms.
|
|
|
|
|
|
|
|
|
|
|
| |
(lazy_conses_func): New static function.
* lib.h (conses, lazy_conses, func_set_env): Declared.
* eval.c (eval_init): conses, lazy_conses and func_set_env registered
as intrinsics.
* txr.1: Documented.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
the extension of list operations over vectors and strings.
* eval.c (do_eval_args, bindings_helper, op_each,
subst_vars, supplement_op_syms, mapcarv, mappendv): Switch from
list_collect_* macros to functions.
* lib.c (copy_list): Switch from list_collect* macros to functions.
Use list_collect_nconc for the final terminator. Doing a copy
there with list_collect_append was actually wasteful, and now
that list_collect_append calls copy_list in places, it triggered
runaway recursion.
(make_like): Bugfix: list_vector was used instead of vector_list.
(to_seq, list_collect, list_collect_nconc, list_collect_append): New
functions.
(append2, appendv, nappend2, sub_list, replace_list, ldiff, remq,
remql, remqual, remove_if, keep_if, proper_plist_to_alist,
improper_plist_to_alist, split_str, split_str_set, tok_str,
list_str, chain, andf, orf, lis_vector, mapcar, mapcon, mappend,
merge, set_diff, env): Switch from list_collect* macros to functions.
(replace_str, replace_vec): Allow single item replacement sequence.
* lib.h (to_seq): Declared.
(list_collect, list_collect_nconc, list_collect_append): Macros
removed, replaced by function declarations of the same name.
These functions return the new ptail since they cannot assign
to it, requiring all uses to be updated to do the assignment
of the returned value.
(list_collect_decl): Use val rather than obj_t *.
* match.c (vars_to_bindings, h_coll, subst_vars, extract_vars,
extract_bindings, do_output_line, do_output, v_gather, v_collect):
Switch from list_collect* macros to functions.
* parser.y (o_elems_transform): Likewise.
* regex.c (dv_compile_regex, regsub): Likewise.
* txr.c (txr_main): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
evaluation like (op or @1 42) or (op if (eq @1 foo) bar xyzzy)
is possible.
* eval.c (do_eval): Change precedence between operator and
function lookup to favor operators. This is important since
there are several operators now which are also functions.
(if_fun, or_fun, and_fun): New static functions.
(eval_init): New functions registered as intrinsics.
* txr.1: Documented that if, and, or exist as both functions
and operators.
|
|
|
|
|
|
|
|
|
| |
* eval.h (eval_intrinsic): Declared.
* txr.c (spec_file): Global variable removed.
(txr_main): Support for -e and -p options. Minor code cleanup.
* txr.1: Documented new options.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
input sequence.
* lib.c (make_like): New function.
(reverse, remq, remql, remqual, remove_if, keep_if, mapcar, mapcon,
mappend, set_diff): Convert output list to type of leftmost input
sequence.
* lib.h (make_like): Declared.
* txr.1: Documented.
|